(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: (Token id:Id.ControlFlow_Return val:return span_id:26)
                )
              ]
            )
            (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: (Token id:Id.VSub_Name val:PORTSDIR span_id:47)
                        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: (Token id:Id.VSub_Name val:OSTYPE span_id:75)
                                  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: (Token id:Id.ControlFlow_Return val:return span_id:136)
                  arg_word: {(0)}
                )
              ]
            )
            (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:143)
                        words: [
                          {
                            (command_sub
                              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:145)
                              command_list: 
                                (command.CommandList
                                  children: [
                                    (command.Pipeline
                                      children: [
                                        (command.Simple
                                          words: [
                                            {(command)}
                                            {(grep)}
                                            {(-E)}
                                            {(DQ ('^') ($ Id.VSub_DollarName '$cur'))}
                                          ]
                                          redirects: [
                                            (redir.Redir
                                              op: (Token id:Id.Redir_Great val:'2>' span_id:158)
                                              fd: 2
                                              arg_word: {(/dev/null)}
                                            )
                                            (redir.Redir
                                              op: (Token id:Id.Redir_Less val:'<' span_id:161)
                                              fd: -1
                                              arg_word: {($ Id.VSub_DollarName '$indexfile')}
                                            )
                                          ]
                                        )
                                        (C {(cut)} 
                                          {(-d) (SQ (Token id:Id.Lit_Chars val:'|' span_id:173))} {(-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: (Token id:Id.Op_LParen val:'(' span_id:184)
                        words: [
                          {
                            (command_sub
                              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:186)
                              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: (Token id:Id.Redir_Great val:'2>' span_id:204)
                                              fd: 2
                                              arg_word: {(/dev/null)}
                                            )
                                            (redir.Redir
                                              op: (Token id:Id.Redir_Less val:'<' span_id:209)
                                              fd: -1
                                              arg_word: {($ Id.VSub_DollarName '$indexfile')}
                                            )
                                          ]
                                        )
                                        (C {(cut)} 
                                          {(-d) (SQ (Token id:Id.Lit_Chars val:'|' span_id:219))} {(-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: (Token id:Id.Op_LParen val:'(' span_id:230)
                        words: [
                          {
                            (braced_var_sub
                              token: (Token id:Id.VSub_Name val:COMPREPLY2 span_id:233)
                              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: (Token id:Id.Op_LParen val:'(' span_id:245)
                        words: [
                          {
                            (DQ 
                              (braced_var_sub
                                token: (Token id:Id.VSub_Name val:COMPREPLY2 span_id:249)
                                bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                              )
                            )
                          }
                        ]
                      )
                    }
                  spids: [244]
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Return val:return span_id:260)
              arg_word: {(0)}
            )
          ]
        )
    )
    (C {(complete)} {(-F)} {(_portinstall)} {(-o)} {(dirnames)} {(portinstall)})
  ]
)