(command.AndOr
  ops: [Id.Op_DAmp]
  children: [
    (command.ShFunction
      name: _portinstall
      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>)
              ]
            )
            (C {<local>} {<portsdir>} {<indexfile>})
            (C {<local>} {<-a>} {<COMPREPLY2>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:portsdir)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name PORTSDIR>
                        suffix_op: 
                          (suffix_op.Unary
                            op_id: Id.VTest_ColonHyphen
                            arg_word: {<Id.Lit_Slash /> <usr> <Id.Lit_Slash /> <ports>}
                          )
                      ) </>
                    }
                  spids: [45]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:indexfile)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_DollarName '$portsdir') </INDEX-5>}
                  spids: [62]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalAnd
                      left: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name OSTYPE>
                                  suffix_op: (suffix_op.Unary op_id:Id.VOp1_Percent arg_word:{<'.*'>})
                                )
                              )
                            }
                          right: {<freebsd5>}
                        )
                      right: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_f
                          child: {($ Id.VSub_DollarName '$indexfile')}
                        )
                    )
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:indexfile)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_DollarName '$portsdir') </INDEX>}
                      spids: [96]
                    )
                  ]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  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>}
                            )
                        )
                    )
                )
                (command.ControlFlow
                  token: <Id.ControlFlow_Return return>
                  arg_word: {<0>}
                )
              ]
            )
            (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: [
                                    (command.Pipeline
                                      children: [
                                        (command.Simple
                                          words: [
                                            {<command>}
                                            {<grep>}
                                            {<-E>}
                                            {(DQ <'^'> ($ Id.VSub_DollarName '$cur'))}
                                          ]
                                          redirects: [
                                            (redir.Redir
                                              op: <Id.Redir_Great '2>'>
                                              fd: 2
                                              arg_word: {</dev/null>}
                                            )
                                            (redir.Redir
                                              op: <Id.Redir_Less '<'>
                                              fd: -1
                                              arg_word: {($ Id.VSub_DollarName '$indexfile')}
                                            )
                                          ]
                                        )
                                        (C {<cut>} {<-d> (SQ <'|'>)} {<-f1>})
                                      ]
                                      negated: F
                                    )
                                  ]
                                )
                            )
                          }
                        ]
                      )
                    }
                  spids: [142]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:COMPREPLY2)
                  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: [
                                    (command.Pipeline
                                      children: [
                                        (command.Simple
                                          words: [
                                            {<command>}
                                            {<grep>}
                                            {<-E>}
                                            {
                                              (DQ <'^[^'> <Id.Lit_Other '\\'> <'|]+'> 
                                                <Id.Lit_Other '\\'> <'|'> ($ Id.VSub_DollarName '$portsdir') ($ Id.VSub_DollarName '$cur')
                                              )
                                            }
                                          ]
                                          redirects: [
                                            (redir.Redir
                                              op: <Id.Redir_Great '2>'>
                                              fd: 2
                                              arg_word: {</dev/null>}
                                            )
                                            (redir.Redir
                                              op: <Id.Redir_Less '<'>
                                              fd: -1
                                              arg_word: {($ Id.VSub_DollarName '$indexfile')}
                                            )
                                          ]
                                        )
                                        (C {<cut>} {<-d> (SQ <'|'>)} {<-f2>})
                                      ]
                                      negated: F
                                    )
                                  ]
                                )
                            )
                          }
                        ]
                      )
                    }
                  spids: [183]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:COMPREPLY2)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (braced_var_sub
                              token: <Id.VSub_Name COMPREPLY2>
                              bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                              suffix_op: 
                                (suffix_op.Unary
                                  op_id: Id.VOp1_Pound
                                  arg_word: {($ Id.VSub_DollarName '$portsdir')}
                                )
                            )
                          }
                        ]
                      )
                    }
                  spids: [229]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:COMPREPLY)
                  op: assign_op.PlusEqual
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (DQ 
                              (braced_var_sub
                                token: <Id.VSub_Name COMPREPLY2>
                                bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                              )
                            )
                          }
                        ]
                      )
                    }
                  spids: [244]
                )
              ]
            )
            (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})
          ]
        )
    )
    (C {<complete>} {<-F>} {<_portinstall>} {<-o>} {<dirnames>} {<portinstall>})
  ]
)