(command.AndOr
  children: [
    (command.ShFunction
      name_tok: <_portinstall>
      name: _portinstall
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <local>
              more_env: []
              words: [{<local>} {<cur>} {<prev>} {<words>} {<cword>}]
              redirects: []
              do_fork: T
            )
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <_init_completion>
                  more_env: []
                  words: [{<_init_completion>}]
                  redirects: []
                  do_fork: T
                )
                (command.ControlFlow keyword:<Id.ControlFlow_Return return>)
              ]
              ops: [<Id.Op_DPipe _>]
            )
            (command.Simple
              blame_tok: <local>
              more_env: []
              words: [{<local>} {<portsdir>} {<indexfile>}]
              redirects: []
              do_fork: T
            )
            (command.Simple
              blame_tok: <local>
              more_env: []
              words: [{<local>} {<-a>} {<COMPREPLY2>}]
              redirects: []
              do_fork: T
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'portsdir='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'portsdir='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'portsdir='> name:portsdir)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (BracedVarSub
                        left: <Id.Left_DollarBrace '${'>
                        token: <Id.VSub_Name PORTSDIR>
                        var_name: PORTSDIR
                        suffix_op: 
                          (suffix_op.Unary
                            op: <Id.VTest_ColonHyphen _>
                            arg_word: {<Id.Lit_Slash '/'> <usr> <Id.Lit_Slash '/'> <ports>}
                          )
                        right: <Id.Right_DollarBrace '}'>
                      ) <'/'>
                    }
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'indexfile='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'indexfile='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'indexfile='> name:indexfile)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_DollarName portsdir) <'/INDEX-5'>}
                )
              ]
              redirects: []
            )
            (command.AndOr
              children: [
                (command.DBracket
                  left: <Id.KW_DLeftBracket '[['>
                  expr: 
                    (bool_expr.LogicalAnd
                      left: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: 
                            {
                              (DQ 
                                (BracedVarSub
                                  left: <Id.Left_DollarBrace '${'>
                                  token: <Id.VSub_Name OSTYPE>
                                  var_name: OSTYPE
                                  suffix_op: 
                                    (suffix_op.Unary
                                      op: <Id.VOp1_Percent '%'>
                                      arg_word: {<.> <Id.Lit_Other '*'>}
                                    )
                                  right: <Id.Right_DollarBrace '}'>
                                )
                              )
                            }
                          right: {<freebsd5>}
                        )
                      right: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_f
                          child: {($ Id.VSub_DollarName indexfile)}
                        )
                    )
                  right: <Id.Lit_DRightBracket ']]'>
                  redirects: []
                )
                (command.ShAssignment
                  left: <Id.Lit_VarLike 'indexfile='>
                  pairs: [
                    (AssignPair
                      left: <Id.Lit_VarLike 'indexfile='>
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'indexfile='> name:indexfile)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_DollarName portsdir) <'/INDEX'>}
                    )
                  ]
                  redirects: []
                )
              ]
              ops: [<Id.Op_DPipe _>]
            )
            (command.AndOr
              children: [
                (command.DBracket
                  left: <Id.KW_DLeftBracket '[['>
                  expr: 
                    (bool_expr.LogicalOr
                      left: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: {(DQ ($ Id.VSub_DollarName prev))}
                          right: {<-l>}
                        )
                      right: 
                        (bool_expr.LogicalOr
                          left: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName prev))}
                              right: {<Id.BoolUnary_L -L>}
                            )
                          right: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName prev))}
                              right: {<Id.BoolUnary_o -o>}
                            )
                        )
                    )
                  right: <Id.Lit_DRightBracket ']]'>
                  redirects: []
                )
                (command.ControlFlow
                  keyword: <Id.ControlFlow_Return return>
                  arg_word: {<0>}
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'COMPREPLY='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'COMPREPLY='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'COMPREPLY='> name:COMPREPLY)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (ShArrayLiteral
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (CommandSub
                              left_token: <Id.Left_DollarParen '$('>
                              child: 
                                (command.Pipeline
                                  children: [
                                    (command.Simple
                                      blame_tok: <command>
                                      more_env: []
                                      words: [
                                        {<command>}
                                        {<grep>}
                                        {<-E>}
                                        {(DQ <'^'> ($ Id.VSub_DollarName cur))}
                                      ]
                                      redirects: [
                                        (Redir
                                          op: <Id.Redir_Great '2>'>
                                          loc: (redir_loc.Fd fd:2)
                                          arg: {<'/dev/null'>}
                                        )
                                        (Redir
                                          op: <Id.Redir_Less '<'>
                                          loc: (redir_loc.Fd fd:0)
                                          arg: {($ Id.VSub_DollarName indexfile)}
                                        )
                                      ]
                                      do_fork: T
                                    )
                                    (command.Simple
                                      blame_tok: <cut>
                                      more_env: []
                                      words: [{<cut>} {<-d> (SQ <'|'>)} {<-f1>}]
                                      redirects: []
                                      do_fork: T
                                    )
                                  ]
                                  ops: [<Id.Op_Pipe _>]
                                )
                              right: <Id.Eof_RParen _>
                            )
                          }
                        ]
                        right: <Id.Right_ShArrayLiteral _>
                      )
                    }
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'COMPREPLY2='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'COMPREPLY2='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'COMPREPLY2='> name:COMPREPLY2)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (ShArrayLiteral
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (CommandSub
                              left_token: <Id.Left_DollarParen '$('>
                              child: 
                                (command.Pipeline
                                  children: [
                                    (command.Simple
                                      blame_tok: <command>
                                      more_env: []
                                      words: [
                                        {<command>}
                                        {<grep>}
                                        {<-E>}
                                        {
                                          (DQ <'^[^'> <Id.Lit_BadBackslash '\\'> <'|]+'> 
                                            <Id.Lit_BadBackslash '\\'> <'|'> ($ Id.VSub_DollarName portsdir) ($ Id.VSub_DollarName cur)
                                          )
                                        }
                                      ]
                                      redirects: [
                                        (Redir
                                          op: <Id.Redir_Great '2>'>
                                          loc: (redir_loc.Fd fd:2)
                                          arg: {<'/dev/null'>}
                                        )
                                        (Redir
                                          op: <Id.Redir_Less '<'>
                                          loc: (redir_loc.Fd fd:0)
                                          arg: {($ Id.VSub_DollarName indexfile)}
                                        )
                                      ]
                                      do_fork: T
                                    )
                                    (command.Simple
                                      blame_tok: <cut>
                                      more_env: []
                                      words: [{<cut>} {<-d> (SQ <'|'>)} {<-f2>}]
                                      redirects: []
                                      do_fork: T
                                    )
                                  ]
                                  ops: [<Id.Op_Pipe _>]
                                )
                              right: <Id.Eof_RParen _>
                            )
                          }
                        ]
                        right: <Id.Right_ShArrayLiteral _>
                      )
                    }
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'COMPREPLY2='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'COMPREPLY2='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'COMPREPLY2='> name:COMPREPLY2)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (ShArrayLiteral
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (BracedVarSub
                              left: <Id.Left_DollarBrace '${'>
                              token: <Id.VSub_Name COMPREPLY2>
                              var_name: COMPREPLY2
                              bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                              suffix_op: 
                                (suffix_op.Unary
                                  op: <Id.VOp1_Pound '#'>
                                  arg_word: {($ Id.VSub_DollarName portsdir)}
                                )
                              right: <Id.Right_DollarBrace '}'>
                            )
                          }
                        ]
                        right: <Id.Right_ShArrayLiteral _>
                      )
                    }
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'COMPREPLY+='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'COMPREPLY+='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'COMPREPLY+='> name:COMPREPLY)
                  op: assign_op.PlusEqual
                  rhs: 
                    {
                      (ShArrayLiteral
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (DQ 
                              (BracedVarSub
                                left: <Id.Left_DollarBrace '${'>
                                token: <Id.VSub_Name COMPREPLY2>
                                var_name: COMPREPLY2
                                bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                                right: <Id.Right_DollarBrace '}'>
                              )
                            )
                          }
                        ]
                        right: <Id.Right_ShArrayLiteral _>
                      )
                    }
                )
              ]
              redirects: []
            )
            (command.ControlFlow keyword:<Id.ControlFlow_Return return> arg_word:{<0>})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.Simple
      blame_tok: <complete>
      more_env: []
      words: [{<complete>} {<-F>} {<_portinstall>} {<-o>} {<dirnames>} {<portinstall>}]
      redirects: []
      do_fork: T
    )
  ]
  ops: [<Id.Op_DAmp _>]
)