(command.AndOr
  ops: [Op_DAmp]
  children: [
    (command.FuncDef
      name: _removepkg
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:cur spids:[13])
                  op: Equal
                  spids: [13]
                )
                (assign_pair
                  lhs: (lhs_expr.LhsName name:prev spids:[15])
                  op: Equal
                  spids: [15]
                )
                (assign_pair
                  lhs: (lhs_expr.LhsName name:words spids:[17])
                  op: Equal
                  spids: [17]
                )
                (assign_pair
                  lhs: (lhs_expr.LhsName name:cword spids:[19])
                  op: Equal
                  spids: [19]
                )
              ]
              spids: [11]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(_init_completion)})
                (command.ControlFlow token:<ControlFlow_Return return>)
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_DollarName '$cur'))}
                              right: {(-) (Lit_Other '*')}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:COMPREPLY spids:[48])
                          op: Equal
                          rhs: 
                            {
                              (word_part.ArrayLiteralPart
                                words: [
                                  {
                                    (word_part.CommandSubPart
                                      command_list: 
                                        (command.CommandList
                                          children: [
                                            (C {(compgen)} {(-W)} {(SQ <'-copy -keep -preserve -warn'>)} 
                                              {(--)} {(DQ ($ VSub_DollarName '$cur'))}
                                            )
                                          ]
                                        )
                                      left_token: <Left_CommandSub '$('>
                                      spids: [51 67]
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [48]
                        )
                      ]
                      spids: [48]
                    )
                    (command.ControlFlow token:<ControlFlow_Return return>)
                  ]
                  spids: [16777215 45]
                )
              ]
              spids: [16777215 75]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_DollarName '$cur'))}
                              right: {(Lit_Other '*') (/) (Lit_Other '*')}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(_filedir)}) (command.ControlFlow token:<ControlFlow_Return return>)]
                  spids: [16777215 96]
                )
              ]
              spids: [16777215 105]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:root spids:[111])
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Name ROOT>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {(Lit_Slash /)}
                          )
                        spids: [112 116]
                      )
                    }
                  spids: [111]
                )
              ]
              spids: [109]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:COMPREPLY spids:[119])
                  op: Equal
                  rhs: 
                    {
                      (word_part.ArrayLiteralPart
                        words: [
                          {
                            (word_part.CommandSubPart
                              command_list: 
                                (command.CommandList
                                  children: [
                                    (command.Sentence
                                      child: 
                                        (command.AndOr
                                          ops: [Op_DPipe]
                                          children: [
                                            (command.SimpleCommand
                                              words: [
                                                {(cd)}
                                                {
                                                  (DQ ($ VSub_DollarName '$root') (/var/log/packages))
                                                }
                                              ]
                                              redirects: [
                                                (redir.Redir
                                                  op: <Redir_Great '2>'>
                                                  fd: 2
                                                  arg_word: {(/dev/null)}
                                                )
                                              ]
                                            )
                                            (command.ControlFlow
                                              token: <ControlFlow_Return return>
                                              arg_word: {(1)}
                                            )
                                          ]
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                    (C {(compgen)} {(-f)} {(--)} {(DQ ($ VSub_DollarName '$cur'))})
                                  ]
                                )
                              left_token: <Left_CommandSub '$('>
                              spids: [122 154]
                            )
                          }
                        ]
                      )
                    }
                  spids: [119]
                )
              ]
              spids: [119]
            )
          ]
          spids: [8]
        )
      spids: [4 7]
    )
    (C {(complete)} {(-F)} {(_removepkg)} {(removepkg)})
  ]
)