(command.CommandList
  children: [
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:NETDOWN) op:Equal rhs:{(yes)})]
    )
    (command.Assignment
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:PATH)
          op: Equal
          rhs: {(/sbin) (Lit_Other ':') (/usr/sbin) (Lit_Other ':') (/bin) (Lit_Other ':') (/usr/bin)}
        )
      ]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (C {(Lit_LBracket '[')} {(-f)} {(/etc/default/halt)} {(Lit_RBracket ']')})
        (C {(.)} {(/etc/default/halt)})
      ]
    )
    (C {(.)} {(/lib/lsb/init-functions)})
    (command.FuncDef
      name: do_stop
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$INIT_HALT'))} {(Lit_Other '=')} {(DQ )} 
                      {(Lit_RBracket ']')}
                    )
                  ]
                  action: [
                    (command.Case
                      to_match: {(DQ ($ VSub_DollarName '$HALT'))}
                      arms: [
                        (case_arm
                          pat_list: [{(Lit_LBracket '[') (Pp) (Lit_RBracket ']') (Lit_Star '*')}]
                          action: [
                            (command.Assignment
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:INIT_HALT)
                                  op: Equal
                                  rhs: {(POWEROFF)}
                                )
                              ]
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(Lit_LBracket '[') (Hh) (Lit_RBracket ']') (Lit_Star '*')}]
                          action: [
                            (command.Assignment
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:INIT_HALT)
                                  op: Equal
                                  rhs: {(HALT)}
                                )
                              ]
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(Lit_Star '*')}]
                          action: [
                            (command.Assignment
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:INIT_HALT)
                                  op: Equal
                                  rhs: {(POWEROFF)}
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$INIT_HALT'))} 
                          {(Lit_Other '=')} {(DQ (POWEROFF))} {(Lit_RBracket ']')}
                        )
                        (C {(Lit_LBracket '[')} {(-x)} {(/etc/init.d/ups-monitor)} {(Lit_RBracket ']')})
                      ]
                    )
                  ]
                  action: [(C {(/etc/init.d/ups-monitor)} {(poweroff)})]
                )
              ]
            )
            (command.Assignment
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:hddown) op:Equal rhs:{(DQ (-h))})]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(grep)} {(-qs)} {(SQ <'^md.*active'>)} {(/proc/mdstat)})]
                  action: [
                    (command.Assignment
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:hddown) op:Equal rhs:{(DQ )})]
                    )
                  ]
                )
              ]
            )
            (command.Assignment
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:poweroff) op:Equal rhs:{(DQ (-p))})]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$INIT_HALT'))} {(Lit_Other '=')} 
                      {(DQ (HALT))} {(Lit_RBracket ']')}
                    )
                  ]
                  action: [
                    (command.Assignment
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:poweroff) op:Equal rhs:{(DQ )})]
                    )
                  ]
                )
              ]
            )
            (command.Assignment
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:netdown) op:Equal rhs:{(DQ (-i))})]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$NETDOWN'))} {(Lit_Other '=')} 
                          {(DQ (no))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Assignment
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:netdown) op:Equal rhs:{(DQ )})]
                    )
                  ]
                )
              ]
            )
            (C {(log_action_msg)} {(DQ ('Will now halt'))})
            (C {(halt)} {(-d)} {(-f)} {($ VSub_DollarName '$netdown')} {($ VSub_DollarName '$poweroff')} 
              {($ VSub_DollarName '$hddown')}
            )
          ]
        )
    )
    (command.Case
      to_match: {(DQ ($ VSub_Number '$1'))}
      arms: [
        (case_arm pat_list:[{(start)} {(status)}])
        (case_arm
          pat_list: [{(restart)} {(reload)} {(force-reload)}]
          action: [
            (command.Simple
              words: [{(echo)} {(DQ ("Error: argument '") ($ VSub_Number '$1') ("' not supported"))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(3)})
          ]
        )
        (case_arm pat_list:[{(stop)}] action:[(C {(do_stop)})])
        (case_arm
          pat_list: [{(Lit_Star '*')}]
          action: [
            (command.Simple
              words: [{(echo)} {(DQ ('Usage: ') ($ VSub_Number '$0') (' start|stop'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(3)})
          ]
        )
      ]
    )
    (C {(Lit_Other ':')})
  ]
)