(command.CommandList
  children: [
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<Id.Lit_LBracket '['>} {<-f>} {<'/etc/profile.d/modules.sh'>} {<Id.Lit_RBracket ']'>})
        (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})
      ]
    )
    (command.ShFunction
      name: _module_list
      body: 
        (BraceGroup
          children: [
            (C {<local>} 
              {<Id.Lit_VarLike 'modules='> 
                (DQ 
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: 
                      (command.Pipeline
                        children: [
                          (command.Simple
                            words: [{<sed>} {(SQ <'s/:/ /g'>)}]
                            redirects: [
                              (redir
                                op: <Id.Redir_TLess '<<<'>
                                loc: (redir_loc.Fd fd:0)
                                arg: {($ Id.VSub_DollarName '$LOADEDMODULES')}
                              )
                            ]
                            do_fork: T
                          )
                          (C {<sort>})
                        ]
                        negated: F
                      )
                  )
                )
              }
            )
            (C {<compgen>} {<-W>} {(DQ ($ Id.VSub_DollarName '$modules'))} {<-->} 
              {($ Id.VSub_Number '$1')}
            )
          ]
        )
    )
    (command.ShFunction
      name: _module_path
      body: 
        (BraceGroup
          children: [
            (C {<local>} 
              {<Id.Lit_VarLike 'modules='> 
                (DQ 
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: 
                      (command.Pipeline
                        children: [
                          (command.Simple
                            words: [{<sed>} {(SQ <'s/:/ /g'>)}]
                            redirects: [
                              (redir
                                op: <Id.Redir_TLess '<<<'>
                                loc: (redir_loc.Fd fd:0)
                                arg: {($ Id.VSub_DollarName '$MODULEPATH')}
                              )
                            ]
                            do_fork: T
                          )
                          (C {<sort>})
                        ]
                        negated: F
                      )
                  )
                )
              }
            )
            (C {<compgen>} {<-W>} {(DQ ($ Id.VSub_DollarName '$modules'))} {<-->} 
              {($ Id.VSub_Number '$1')}
            )
          ]
        )
    )
    (command.ShFunction
      name: _module_avail
      body: 
        (BraceGroup
          children: [
            (C {<local>} 
              {<Id.Lit_VarLike 'modules='> 
                (DQ 
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: 
                      (command.Pipeline
                        children: [
                          (command.Simple
                            words: [{<module>} {<avail>}]
                            redirects: [
                              (redir
                                op: <Id.Redir_GreatAnd '2>&'>
                                loc: (redir_loc.Fd fd:2)
                                arg: {<1>}
                              )
                            ]
                            do_fork: T
                          )
                          (C {<command>} {<grep>} {<-E>} {<-v>} {(SQ <'^(-|$)'>)})
                          (C {<xargs>} {<printf>} {(SQ <'%s\\n'>)})
                          (C {<sed>} {<-e>} {(SQ <'s/(default)//g'>)})
                          (C {<sort>})
                        ]
                        negated: F
                      )
                  )
                )
              }
            )
            (C {<compgen>} {<-W>} {(DQ ($ Id.VSub_DollarName '$modules'))} {<-->} 
              {($ Id.VSub_Number '$1')}
            )
          ]
        )
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.ShFunction
          name: _module
          body: 
            (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>)
                  ]
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_eq
                                      left: {($ Id.VSub_DollarName '$cword')}
                                      right: {<1>}
                                    )
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      action: [
                        (C {<local>} {<options>})
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:options)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (DQ 
                                    (command_sub
                                      left_token: <Id.Left_DollarParen '$('>
                                      child: 
                                        (command.Pipeline
                                          children: [
                                            (command.Simple
                                              words: [{<module>} {<help>}]
                                              redirects: [
                                                (redir
                                                  op: <Id.Redir_GreatAnd '2>&'>
                                                  loc: (redir_loc.Fd fd:2)
                                                  arg: {<1>}
                                                )
                                              ]
                                              do_fork: T
                                            )
                                            (C {<command>} {<grep>} {<-E>} {(SQ <'^[[:space:]]*\\+'>)})
                                            (C {<awk>} {(SQ <'{print $2}'>)})
                                            (C {<sed>} {<-e>} {(SQ <'s/|/ /g'>)})
                                            (C {<sort>})
                                          ]
                                          negated: F
                                        )
                                    )
                                  )
                                }
                              spids: [309]
                            )
                          ]
                        )
                        (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 '$('>
                                          child: 
                                            (C {<compgen>} {<-W>} 
                                              {(DQ ($ Id.VSub_DollarName '$options'))} {<-->} {(DQ ($ Id.VSub_DollarName '$cur'))}
                                            )
                                        )
                                      }
                                    ]
                                  )
                                }
                              spids: [361]
                            )
                          ]
                        )
                      ]
                      spids: [283 296]
                    )
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_eq
                                      left: {($ Id.VSub_DollarName '$cword')}
                                      right: {<2>}
                                    )
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      action: [
                        (command.Case
                          to_match: {($ Id.VSub_DollarName '$prev')}
                          arms: [
                            (case_arm
                              pat_list: [{<add>} {<display>} {<help>} {<load>} {<show>} {<whatis>}]
                              action: [
                                (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 '$('>
                                                  child: 
                                                    (C {<_module_avail>} 
                                                      {(DQ ($ Id.VSub_DollarName '$cur'))}
                                                    )
                                                )
                                              }
                                            ]
                                          )
                                        }
                                      spids: [421]
                                    )
                                  ]
                                )
                              ]
                              spids: [407 418 435 -1]
                            )
                            (case_arm
                              pat_list: [{<rm>} {<switch>} {<swap>} {<unload>} {<update>}]
                              action: [
                                (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 '$('>
                                                  child: 
                                                    (C {<_module_list>} 
                                                      {(DQ ($ Id.VSub_DollarName '$cur'))}
                                                    )
                                                )
                                              }
                                            ]
                                          )
                                        }
                                      spids: [450]
                                    )
                                  ]
                                )
                              ]
                              spids: [438 447 464 -1]
                            )
                            (case_arm
                              pat_list: [{<unuse>}]
                              action: [
                                (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 '$('>
                                                  child: 
                                                    (C {<_module_path>} 
                                                      {(DQ ($ Id.VSub_DollarName '$cur'))}
                                                    )
                                                )
                                              }
                                            ]
                                          )
                                        }
                                      spids: [471]
                                    )
                                  ]
                                )
                              ]
                              spids: [467 468 485 -1]
                            )
                          ]
                        )
                      ]
                      spids: [384 397]
                    )
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_eq
                                      left: {($ Id.VSub_DollarName '$cword')}
                                      right: {<3>}
                                    )
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      action: [
                        (command.Case
                          to_match: 
                            {
                              (braced_var_sub
                                token: <Id.VSub_Name words>
                                bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 1>})
                              )
                            }
                          arms: [
                            (case_arm
                              pat_list: [{<swap>} {<switch>}]
                              action: [
                                (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 '$('>
                                                  child: 
                                                    (C {<_module_avail>} 
                                                      {(DQ ($ Id.VSub_DollarName '$cur'))}
                                                    )
                                                )
                                              }
                                            ]
                                          )
                                        }
                                      spids: [525]
                                    )
                                  ]
                                )
                              ]
                              spids: [519 522 539 -1]
                            )
                          ]
                        )
                      ]
                      spids: [491 504]
                    )
                  ]
                )
                (command.ControlFlow
                  token: <Id.ControlFlow_Return return>
                  arg_word: {<0>}
                )
              ]
            )
        )
        (C {<complete>} {<-F>} {<_module>} {<-o>} {<default>} {<module>})
      ]
    )
  ]
)