(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:<Id.ControlFlow_Return return>)
              ]
            )
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'spool='> </var/sadm/pkg>})
              terminator: <Id.Op_Semi _>
            )
            (C {<local>} {<Id.Lit_VarLike 'i='> ($ Id.VSub_DollarName '$cword')})
            (command.Sentence
              child: 
                (command.WhileUntil
                  keyword: <Id.KW_While while>
                  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: <Id.Op_Semi _>
                    )
                  ]
                  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:<Id.Lit_ArithVarLike i>)
                                            right: (arith_expr.ArithWord w:{<Id.Lit_Digits 1>})
                                          )
                                      )
                                    }
                                  spids: [89]
                                )
                              ]
                            )
                          terminator: <Id.Op_Semi _>
                        )
                        (command.Sentence
                          child: 
                            (command.Case
                              to_match: 
                                {
                                  (DQ 
                                    (braced_var_sub
                                      token: <Id.VSub_Name words>
                                      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: <Id.VSub_Name words>
                                                      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: 
                                                                              <Id.Lit_ArithVarLike i>
                                                                          )
                                                                        right: 
                                                                          (arith_expr.ArithWord
                                                                            w: {<Id.Lit_Digits 1>}
                                                                          )
                                                                      )
                                                                  )
                                                                }
                                                            )
                                                        )
                                                    )
                                                  )
                                                }
                                              spids: [117]
                                            )
                                          ]
                                        )
                                      terminator: <Id.Op_Semi _>
                                    )
                                    (command.ControlFlow
                                      token: <Id.ControlFlow_Break break>
                                    )
                                  ]
                                  spids: [113 114 137 -1]
                                )
                              ]
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                )
              terminator: <Id.Op_Semi _>
            )
            (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: <Id.Op_Semi _>
                            )
                          ]
                          action: [
                            (command.Sentence
                              child: 
                                (C {<local>} 
                                  {<Id.Lit_VarLike 'opts='> (DQ <'-a -A -n -M -R -s -v -V -Y'>)}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: 
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:COMPREPLY)
                                      op: assign_op.Equal
                                      rhs: 
                                        {
                                          (sh_array_literal
                                            left: <Id.Op_LParen _>
                                            words: [
                                              {
                                                (command_sub
                                                  left_token: <Id.Left_DollarParen '$('>
                                                  command_list: 
                                                    (command.CommandList
                                                      children: [
                                                        (C {<compgen>} {<-W>} 
                                                          {(DQ (${ Id.VSub_Name opts))} {<-->} {(${ Id.VSub_Name cur)}
                                                        )
                                                      ]
                                                    )
                                                )
                                              }
                                            ]
                                          )
                                        }
                                      spids: [225]
                                    )
                                  ]
                                )
                              terminator: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: 
                                (command.ControlFlow
                                  token: <Id.ControlFlow_Return return>
                                  arg_word: {<0>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                          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: <Id.Op_LParen _>
                                        words: [
                                          {
                                            (command_sub
                                              left_token: <Id.Left_DollarParen '$('>
                                              command_list: 
                                                (command.CommandList
                                                  children: [
                                                    (C {<compgen>} {<-W>} 
                                                      {
                                                        (DQ 
                                                          (command_sub
                                                            left_token: <Id.Left_DollarParen '$('>
                                                            command_list: 
                                                              (command.CommandList
                                                                children: [
                                                                  (C {</bin/ls>} {<-1>} 
                                                                    {($ Id.VSub_DollarName '$spool')}
                                                                  )
                                                                ]
                                                              )
                                                          )
                                                        )
                                                      } {<-->} {(${ Id.VSub_Name cur)}
                                                    )
                                                  ]
                                                )
                                            )
                                          }
                                        ]
                                      )
                                    }
                                  spids: [257]
                                )
                              ]
                            )
                          terminator: <Id.Op_Semi _>
                        )
                        (command.Sentence
                          child: 
                            (command.ControlFlow
                              token: <Id.ControlFlow_Return return>
                              arg_word: {<0>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  ]
                  spids: [193 194 293 -1]
                )
              ]
            )
          ]
        )
    )
    (C {<complete>} {<-F>} {<_pkgrm>} {<pkgrm>})
  ]
)