(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_z
                      child: 
                        {
                          (DQ 
                            (word_part.BracedVarSub
                              token: <VSub_Name BASH_SOURCE>
                              bracket_op: 
                                (bracket_op.ArrayIndex
                                  expr: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                )
                            )
                          )
                        }
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.SimpleCommand
              words: [{(echo)} {(DQ ('Sorry, you need to use a debugger-enabled version of bash.'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)})
          ]
        )
      ]
    )
    (command.ForEach
      iter_name: _Dbg_file
      iter_words: [{(require)} {(pre)} {(vars)} {(io)}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(source)} {(${ VSub_Name _Dbg_libdir) (/init/) (${ VSub_Name _Dbg_file) (.sh)})
          ]
        )
    )
    (command.ForEach
      iter_name: _Dbg_file
      iter_words: [
        {(${ VSub_Name _Dbg_libdir) (/lib/) (Lit_Other '*') (.sh)}
        {(${ VSub_Name _Dbg_libdir) (/command/) (Lit_Other '*') (.sh)}
      ]
      do_arg_iter: F
      body: (command.DoGroup children:[(C {(source)} {($ VSub_DollarName '$_Dbg_file')})])
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: (bool_expr.BoolUnary op_id:BoolUnary_r child:{(/dev/stdin)})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(_Dbg_do_source)} {(/dev/stdin)})]
        )
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolBinary
                      op_id: BoolBinary_GlobNEqual
                      left: 
                        {
                          (word_part.CommandSubPart
                            command_list: (command.CommandList children:[(C {(tty)})])
                            left_token: <Left_CommandSub '$('>
                          )
                        }
                      right: {(SQ <'not a tty'>)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(_Dbg_do_source)} 
              {
                (word_part.CommandSubPart
                  command_list: (command.CommandList children:[(C {(tty)})])
                  left_token: <Left_CommandSub '$('>
                )
              }
            )
          ]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_Typeset
      flags: [-a]
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:_Dbg_input) op:Equal)]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_n
                      child: {(DQ ($ VSub_DollarName '$DBG_INPUT'))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:_Dbg_input)
                  op: Equal
                  rhs: {(word_part.ArrayLiteralPart words:[{(DQ ($ VSub_DollarName '$DBG_INPUT'))}])}
                )
              ]
            )
            (C {(_Dbg_do_source)} 
              {
                (DQ 
                  (word_part.BracedVarSub
                    token: <VSub_Name _Dbg_input>
                    bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)}))
                  )
                )
              }
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:_Dbg_no_nx) op:Equal rhs:{(1)})]
            )
          ]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_Typeset
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:_Dbg_startup_cmdfile)
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name HOME>
                suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:{('~')})
              ) (/.) (${ VSub_Name _Dbg_debugger_name) (rc)
            }
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.AndOr
                  ops: [Op_DAmp]
                  children: [
                    (command.DParen
                      child: 
                        (arith_expr.ArithBinary
                          op_id: Arith_DEqual
                          left: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                          right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike _Dbg_o_nx>)
                        )
                    )
                    (command.DBracket
                      expr: 
                        (bool_expr.BoolUnary
                          op_id: BoolUnary_r
                          child: {(DQ ($ VSub_DollarName '$_Dbg_startup_cmdfile'))}
                        )
                    )
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(_Dbg_do_source)} {(DQ ($ VSub_DollarName '$_Dbg_startup_cmdfile'))})]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_z
                      child: {(DQ (${ VSub_Name _Dbg_DEBUGGER_LEVEL))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_Typeset
              flags: [-xi]
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:_Dbg_DEBUGGER_LEVEL) op:Equal rhs:{(1)})]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: 
                        {
                          (word_part.BracedVarSub
                            token: <VSub_Name _Dbg_libdir>
                            suffix_op: 
                              (suffix_op.Slice
                                begin: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                length: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                              )
                          )
                        }
                      right: {(SQ <.>)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:_Dbg_libdir)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (C {(_Dbg_expand_filename)} 
                                {(${ VSub_Name _Dbg_init_cwd) (/) (${ VSub_Name _Dbg_libdir)}
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
    )
    (command.ForEach
      iter_name: source_file
      iter_words: [
        {
          (word_part.BracedVarSub
            token: <VSub_Name _Dbg_o_init_files>
            bracket_op: (bracket_op.WholeArray op_id:Lit_At)
          )
        }
        {(DQ ($ VSub_DollarName '$DBG_RESTART_FILE'))}
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolUnary
                              op_id: BoolUnary_n
                              child: {(DQ ($ VSub_DollarName '$source_file'))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.AndOr
                                  ops: [Op_DAmp]
                                  children: [
                                    (command.DBracket
                                      expr: 
                                        (bool_expr.BoolUnary
                                          op_id: BoolUnary_r
                                          child: {(DQ ($ VSub_DollarName '$source_file'))}
                                        )
                                    )
                                    (command.DBracket
                                      expr: 
                                        (bool_expr.BoolUnary
                                          op_id: BoolUnary_f
                                          child: {(DQ ($ VSub_DollarName '$source_file'))}
                                        )
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(C {(source)} {($ VSub_DollarName '$source_file')})]
                        )
                      ]
                      else_action: [
                        (C {(_Dbg_errmsg)} 
                          {(DQ ('Unable to read shell script: ') (${ VSub_Name source_file))}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
  ]
)