(command.AndOr
  ops: [Id.Op_DAmp Id.Op_DAmp]
  children: [
    (C {(_have)} {(pkgrm)})
    (command.ShFunction
      name: _pkgrm
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(cur)} {(prev)} {(words)} {(cword)})
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {(_init_completion)})
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Return val:return span_id:40)
                )
              ]
            )
            (command.Sentence
              child: (C {(local)} {(Id.Lit_VarLike 'spool=') (/var/sadm/pkg)})
              terminator: (Token id:Id.Op_Semi val:';' span_id:60)
            )
            (C {(local)} {(Id.Lit_VarLike 'i=') ($ Id.VSub_DollarName '$cword')})
            (command.Sentence
              child: 
                (command.WhileUntil
                  keyword: (Token id:Id.KW_While val:while span_id:69)
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_gt
                              left: 
                                {
                                  (word_part.ArithSub
                                    anode: 
                                      (arith_expr.UnaryAssign
                                        op_id: Id.Node_PostDMinus
                                        child: (sh_lhs_expr.Name name:i)
                                      )
                                  )
                                }
                              right: {(0)}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:84)
                    )
                  ]
                  body: 
                    (command.DoGroup
                      children: [
                        (command.Sentence
                          child: 
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:i)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (word_part.ArithSub
                                        anode: 
                                          (arith_expr.Binary
                                            op_id: Id.Arith_Minus
                                            left: 
                                              (arith_expr.VarRef
                                                token: 
                                                  (Token
                                                    id: Id.Lit_ArithVarLike
                                                    val: i
                                                    span_id: 91
                                                  )
                                              )
                                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                          )
                                      )
                                    }
                                  spids: [89]
                                )
                              ]
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:96)
                        )
                        (command.Sentence
                          child: 
                            (command.Case
                              to_match: 
                                {
                                  (DQ 
                                    (braced_var_sub
                                      token: (Token id:Id.VSub_Name val:words span_id:103)
                                      bracket_op: 
                                        (bracket_op.ArrayIndex
                                          expr: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                                        )
                                    )
                                  )
                                }
                              arms: [
                                (case_arm
                                  pat_list: [{(-s)}]
                                  action: [
                                    (command.Sentence
                                      child: 
                                        (command.ShAssignment
                                          pairs: [
                                            (assign_pair
                                              lhs: (sh_lhs_expr.Name name:spool)
                                              op: assign_op.Equal
                                              rhs: 
                                                {
                                                  (DQ 
                                                    (braced_var_sub
                                                      token: 
                                                        (Token
                                                          id: Id.VSub_Name
                                                          val: words
                                                          span_id: 120
                                                        )
                                                      bracket_op: 
                                                        (bracket_op.ArrayIndex
                                                          expr: 
                                                            (arith_expr.ArithWord
                                                              w: 
                                                                {
                                                                  (word_part.ArithSub
                                                                    anode: 
                                                                      (arith_expr.Binary
                                                                        op_id: Id.Arith_Plus
                                                                        left: 
                                                                          (arith_expr.VarRef
                                                                            token: 
                                                                              (Token
                                                                                id: 
Id.Lit_ArithVarLike
                                                                                val: i
                                                                                span_id: 123
                                                                              )
                                                                          )
                                                                        right: 
                                                                          (arith_expr.ArithWord
                                                                            w: {(Id.Lit_Digits 1)}
                                                                          )
                                                                      )
                                                                  )
                                                                }
                                                            )
                                                        )
                                                    )
                                                  )
                                                }
                                              spids: [117]
                                            )
                                          ]
                                        )
                                      terminator: (Token id:Id.Op_Semi val:';' span_id:131)
                                    )
                                    (command.ControlFlow
                                      token: (Token id:Id.ControlFlow_Break val:break span_id:134)
                                    )
                                  ]
                                  spids: [113 114 137 -1]
                                )
                              ]
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:141)
                        )
                      ]
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:145)
            )
            (command.Case
              to_match: {($ Id.VSub_DollarName '$prev')}
              arms: [
                (case_arm
                  pat_list: [{(-a)} {(-V)}]
                  action: [(C {(_filedir)})]
                  spids: [156 161 167 -1]
                )
                (case_arm
                  pat_list: [{(-s)} {(-R)}]
                  action: [(C {(_filedir)} {(-d)})]
                  spids: [170 175 183 -1]
                )
                (case_arm pat_list:[{(-Y)}] spids:[186 187 190 -1])
                (case_arm
                  pat_list: [{(Id.Lit_Star '*')}]
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_GlobDEqual
                                      left: {(${ Id.VSub_Name cur)}
                                      right: {(-) (Id.Lit_Other '*')}
                                    )
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:211)
                            )
                          ]
                          action: [
                            (command.Sentence
                              child: 
                                (C {(local)} 
                                  {(Id.Lit_VarLike 'opts=') (DQ ('-a -A -n -M -R -s -v -V -Y'))}
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:222)
                            )
                            (command.Sentence
                              child: 
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:COMPREPLY)
                                      op: assign_op.Equal
                                      rhs: 
                                        {
                                          (sh_array_literal
                                            left: (Token id:Id.Op_LParen val:'(' span_id:226)
                                            words: [
                                              {
                                                (command_sub
                                                  left_token: 
                                                    (Token
                                                      id: Id.Left_DollarParen
                                                      val: '$('
                                                      span_id: 227
                                                    )
                                                  command_list: 
                                                    (command.CommandList
                                                      children: [
                                                        (C {(compgen)} {(-W)} 
                                                          {(DQ (${ Id.VSub_Name opts))} {(--)} {(${ Id.VSub_Name cur)}
                                                        )
                                                      ]
                                                    )
                                                )
                                              }
                                            ]
                                          )
                                        }
                                      spids: [225]
                                    )
                                  ]
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:245)
                            )
                            (command.Sentence
                              child: 
                                (command.ControlFlow
                                  token: (Token id:Id.ControlFlow_Return val:return span_id:248)
                                  arg_word: {(0)}
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:251)
                            )
                          ]
                          spids: [197 213]
                        )
                      ]
                      else_action: [
                        (command.Sentence
                          child: 
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:COMPREPLY)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (sh_array_literal
                                        left: (Token id:Id.Op_LParen val:'(' span_id:258)
                                        words: [
                                          {
                                            (command_sub
                                              left_token: 
                                                (Token
                                                  id: Id.Left_DollarParen
                                                  val: '$('
                                                  span_id: 259
                                                )
                                              command_list: 
                                                (command.CommandList
                                                  children: [
                                                    (C {(compgen)} {(-W)} 
                                                      {
                                                        (DQ 
                                                          (command_sub
                                                            left_token: 
                                                              (Token
                                                                id: Id.Left_DollarParen
                                                                val: '$('
                                                                span_id: 265
                                                              )
                                                            command_list: 
                                                              (command.CommandList
                                                                children: [
                                                                  (C {(/bin/ls)} {(-1)} 
                                                                    {($ Id.VSub_DollarName '$spool')}
                                                                  )
                                                                ]
                                                              )
                                                          )
                                                        )
                                                      } {(--)} {(${ Id.VSub_Name cur)}
                                                    )
                                                  ]
                                                )
                                            )
                                          }
                                        ]
                                      )
                                    }
                                  spids: [257]
                                )
                              ]
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:281)
                        )
                        (command.Sentence
                          child: 
                            (command.ControlFlow
                              token: (Token id:Id.ControlFlow_Return val:return span_id:284)
                              arg_word: {(0)}
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:287)
                        )
                      ]
                    )
                  ]
                  spids: [193 194 293 -1]
                )
              ]
            )
          ]
        )
    )
    (C {(complete)} {(-F)} {(_pkgrm)} {(pkgrm)})
  ]
)