(command.AndOr
  ops: [Id.Op_DAmp]
  children: [
    (command.ShFunction
      name: _upgradepkg
      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:26)
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName '$cur'))}
                              right: {(-) (Id.Lit_Other '*')}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:44)
                    )
                  ]
                  action: [
                    (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:50)
                                words: [
                                  {
                                    (command_sub
                                      left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:52)
                                      command_list: 
                                        (command.CommandList
                                          children: [
                                            (C {(compgen)} {(-W)} 
                                              {
                                                (SQ 
                                                  (Token
                                                    id: Id.Lit_Chars
                                                    val: '--dry-run --install-new --reinstall\n'
                                                    span_id: 59
                                                  ) (Token id:Id.Lit_Chars val:'            --verbose' span_id:60)
                                                )
                                              } {(--)} {(DQ ($ Id.VSub_DollarName '$cur'))}
                                            )
                                          ]
                                        )
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [49]
                        )
                      ]
                    )
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:74)
                    )
                  ]
                  spids: [30 46]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName '$cur'))}
                              right: 
                                {(Id.Lit_Other '?') (Id.Lit_Other '*') (Id.Lit_Other '%') 
                                  (Id.Lit_Other '*')
                                }
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:97)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:prev)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: (Token id:Id.VSub_Name val:cur span_id:105)
                                  suffix_op: 
                                    (suffix_op.Unary
                                      op_id: Id.VOp1_DPercent
                                      arg_word: 
                                        {('?(') 
                                          (word_part.EscapedLiteral
                                            token: 
                                              (Token
                                                id: Id.Lit_EscapedChar
                                                val: '\\\\'
                                                span_id: 108
                                              )
                                          ) (')') (Id.Lit_Percent '%') ('*')
                                        }
                                    )
                                )
                              )
                            }
                          spids: [102]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:cur)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: (Token id:Id.VSub_Name val:cur span_id:119)
                                  suffix_op: 
                                    (suffix_op.Unary
                                      op_id: Id.VOp1_Pound
                                      arg_word: {('*') (Id.Lit_Percent '%')}
                                    )
                                )
                              )
                            }
                          spids: [116]
                        )
                      ]
                    )
                    (C {(local)} {(nofiles)} 
                      {(Id.Lit_VarLike 'IFS=') 
                        (single_quoted
                          left: (Token id:Id.Left_SingleQuoteC val:"$'" span_id:132)
                          tokens: [(Token id:Id.Char_OneChar val:'\\n' span_id:133)]
                        )
                      }
                    )
                    (C {(compopt)} {(-o)} {(filenames)})
                    (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:145)
                                words: [
                                  {
                                    (command_sub
                                      left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:147)
                                      command_list: 
                                        (command.CommandList
                                          children: [
                                            (C {(compgen)} {(-P)} 
                                              {(DQ ($ Id.VSub_DollarName '$prev') ('%'))} {(-f)} {(-X)} {(DQ ('!*.@(t[bgxl]z)'))} {(--)} {(DQ ($ Id.VSub_DollarName '$cur'))}
                                            )
                                          ]
                                        )
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [144]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.DBracket
                          expr: (bool_expr.WordTest w:{($ Id.VSub_DollarName '$COMPREPLY')})
                        )
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:nofiles)
                              op: assign_op.Equal
                              rhs: {(1)}
                              spids: [185]
                            )
                          ]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:COMPREPLY)
                          op: assign_op.PlusEqual
                          rhs: 
                            {
                              (sh_array_literal
                                left: (Token id:Id.Op_LParen val:'(' span_id:190)
                                words: [
                                  {
                                    (command_sub
                                      left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:192)
                                      command_list: 
                                        (command.CommandList
                                          children: [
                                            (C {(compgen)} {(-P)} 
                                              {(DQ ($ Id.VSub_DollarName '$prev') ('%'))} {(-S)} {(SQ (Token id:Id.Lit_Chars val:/ span_id:206))} {(-d)} {(--)} {(DQ ($ Id.VSub_DollarName '$cur'))}
                                            )
                                          ]
                                        )
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [189]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (command.DBracket
                          expr: (bool_expr.WordTest w:{($ Id.VSub_DollarName '$nofiles')})
                        )
                        (C {(compopt)} {(-o)} {(nospace)})
                      ]
                    )
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:237)
                    )
                  ]
                  spids: [81 99]
                )
              ]
            )
            (C {(_filedir)} {(SQ (Token id:Id.Lit_Chars val:'t[bglx]z' span_id:247))})
          ]
        )
    )
    (C {(complete)} {(-F)} {(_upgradepkg)} {(upgradepkg)})
  ]
)