(command.CommandList
  children: [
    (C {(set)} {(-e)})
    (command.Assignment
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:PATH)
          op: Equal
          rhs: {(/usr/bin) (Lit_Other ':') (/usr/sbin) (Lit_Other ':') (/bin) (Lit_Other ':') (/sbin)}
        )
      ]
    )
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:SOCKET_DIR) op:Equal rhs:{(.X11-unix)})]
    )
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:ICE_DIR) op:Equal rhs:{(.ICE-unix)})]
    )
    (C {(.)} {(/lib/lsb/init-functions)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_LBracket '[')} {(-f)} {(/etc/default/rcS)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(.)} {(/etc/default/rcS)})]
        )
      ]
    )
    (command.FuncDef
      name: do_restorecon
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Simple
                          words: [{(which)} {(restorecon)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(/dev/null)}
                            )
                            (redir.Redir
                              op: <Redir_GreatAnd '2>&'>
                              fd: 2
                              arg_word: {(1)}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(restorecon)} {(DQ ($ VSub_Number '$1'))})]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: set_up_dir
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:DIR)
                  op: Equal
                  rhs: {(DQ (/tmp/) ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$VERBOSE'))} 
                          {(KW_Bang '!') (Lit_Other '=')} {(no)} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(log_progress_msg)} {(DQ ($ VSub_DollarName '$DIR'))})]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Op_DAmp Op_DPipe]
                          children: [
                            (C {(Lit_LBracket '[')} {(-e)} {($ VSub_DollarName '$DIR')} 
                              {(Lit_RBracket ']')}
                            )
                            (command.Pipeline
                              children: [
                                (C {(Lit_LBracket '[')} {(-d)} {($ VSub_DollarName '$DIR')} 
                                  {(Lit_RBracket ']')}
                                )
                              ]
                              negated: T
                            )
                            (C {(Lit_LBracket '[')} {(-h)} {($ VSub_DollarName '$DIR')} 
                              {(Lit_RBracket ']')}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(mv)} {(DQ ($ VSub_DollarName '$DIR'))} 
                      {
                        (DQ 
                          (word_part.CommandSub
                            left_token: <Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [(C {(mktemp)} {(-d)} {($ VSub_DollarName '$DIR') (.XXXXXX)})]
                              )
                          )
                        )
                      }
                    )
                  ]
                )
              ]
            )
            (command.Assignment
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:error) op:Equal rhs:{(0)})]
            )
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [(command.Sentence child:(C {(Lit_Other ':')}) terminator:<Op_Semi ';'>)]
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_LBracket '[')} {($ VSub_DollarName '$error')} {(-ne)} {(0)} 
                                  {(Lit_RBracket ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (C {(Lit_LBracket '[')} {($ VSub_DollarName '$error')} {(-gt)} 
                                          {(5)} {(Lit_RBracket ']')}
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  action: [
                                    (C {(log_failure_msg)} 
                                      {(DQ ('failed to set up ') ($ VSub_DollarName '$DIR'))}
                                    )
                                    (command.ControlFlow
                                      token: <ControlFlow_Return return>
                                      arg_word: {(1)}
                                    )
                                  ]
                                )
                              ]
                            )
                            (command.AndOr
                              ops: [Op_DPipe]
                              children: [
                                (command.Assignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (lhs_expr.LhsName name:fn)
                                      op: Equal
                                      rhs: 
                                        {
                                          (DQ 
                                            (word_part.CommandSub
                                              left_token: <Left_DollarParen '$('>
                                              command_list: 
                                                (command.CommandList
                                                  children: [
                                                    (C {(mktemp)} {(/tmp/testwriteable.XXXXXXXXXX)})
                                                  ]
                                                )
                                            )
                                          )
                                        }
                                    )
                                  ]
                                )
                                (command.ControlFlow
                                  token: <ControlFlow_Return return>
                                  arg_word: {(1)}
                                )
                              ]
                            )
                            (C {(rm)} {(DQ ($ VSub_DollarName '$fn'))})
                          ]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Op_DPipe]
                      children: [
                        (C {(mkdir)} {(-p)} {(-m)} {(01777)} {(DQ ($ VSub_DollarName '$DIR'))})
                        (command.BraceGroup
                          children: [
                            (command.Sentence
                              child: 
                                (command.AndOr
                                  ops: [Op_DPipe]
                                  children: [
                                    (C {(rm)} {(DQ ($ VSub_DollarName '$DIR'))})
                                    (command.Assignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (lhs_expr.LhsName name:error)
                                          op: Equal
                                          rhs: 
                                            {
                                              (word_part.ArithSub
                                                anode: 
                                                  (arith_expr.Binary
                                                    op_id: Arith_Plus
                                                    left: 
                                                      (arith_expr.VarRef
                                                        token: <Lit_ArithVarLike error>
                                                      )
                                                    right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                                  )
                                              )
                                            }
                                        )
                                      ]
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                            (command.Sentence
                              child: (command.ControlFlow token:<ControlFlow_Continue continue>)
                              terminator: <Op_Semi ';'>
                            )
                          ]
                        )
                      ]
                    )
                    (command.Case
                      to_match: 
                        {
                          (DQ 
                            (word_part.CommandSub
                              left_token: <Left_DollarParen '$('>
                              command_list: 
                                (command.CommandList
                                  children: [
                                    (command.Simple
                                      words: [
                                        {(stat)}
                                        {(-c)}
                                        {(SQ <'%u %g %a %F'>)}
                                        {(DQ ($ VSub_DollarName '$DIR'))}
                                      ]
                                      more_env: [(env_pair name:LC_ALL val:{(C)})]
                                    )
                                  ]
                                )
                            )
                          )
                        }
                      arms: [
                        (case_arm
                          pat_list: [{(DQ ('0 0 1777 directory'))}]
                          action: [(command.ControlFlow token:<ControlFlow_Break break>)]
                        )
                        (case_arm
                          pat_list: [{(DQ ('0 0 ')) (Lit_Star '*') (DQ (' directory'))}]
                          action: [
                            (C {(chmod)} {(01777)} {(DQ ($ VSub_DollarName '$DIR'))})
                            (command.ControlFlow
                              token: <ControlFlow_Break break>
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(Lit_Star '*') (DQ (' directory'))}]
                          action: [
                            (command.AndOr
                              ops: [Op_DPipe]
                              children: [
                                (C {(chown)} {(-h)} {(root) (Lit_Other ':') (root)} 
                                  {(DQ ($ VSub_DollarName '$DIR'))}
                                )
                                (command.Assignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (lhs_expr.LhsName name:error)
                                      op: Equal
                                      rhs: 
                                        {
                                          (word_part.ArithSub
                                            anode: 
                                              (arith_expr.Binary
                                                op_id: Arith_Plus
                                                left: 
                                                  (arith_expr.VarRef
                                                    token: <Lit_ArithVarLike error>
                                                  )
                                                right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                              )
                                          )
                                        }
                                    )
                                  ]
                                )
                              ]
                            )
                            (command.ControlFlow
                              token: <ControlFlow_Continue continue>
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(Lit_Star '*')}]
                          action: [
                            (C {(log_failure_msg)} 
                              {(DQ ('failed to set up ') ($ VSub_DollarName '$DIR'))}
                            )
                            (command.ControlFlow
                              token: <ControlFlow_Return return>
                              arg_word: {(1)}
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
            )
            (C {(do_restorecon)} {(DQ ($ VSub_DollarName '$DIR'))})
            (command.ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})
          ]
        )
    )
    (command.FuncDef
      name: do_status
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (C {(Lit_LBracket '[')} {(-d)} {(DQ (/tmp/) ($ VSub_DollarName '$ICE_DIR'))} 
                              {(Lit_RBracket ']')}
                            )
                            (C {(Lit_LBracket '[')} {(-d)} 
                              {(DQ (/tmp/) ($ VSub_DollarName '$SOCKET_DIR'))} {(Lit_RBracket ']')}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})]
                )
              ]
              else_action: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(4)})]
            )
          ]
        )
    )
    (command.Case
      to_match: {(DQ ($ VSub_Number '$1'))}
      arms: [
        (case_arm
          pat_list: [{(start)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$VERBOSE'))} 
                          {(KW_Bang '!') (Lit_Other '=')} {(no)} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(log_begin_msg)} {(DQ ('Setting up X socket directories...'))})]
                )
              ]
            )
            (C {(set_up_dir)} {(DQ ($ VSub_DollarName '$SOCKET_DIR'))})
            (C {(set_up_dir)} {(DQ ($ VSub_DollarName '$ICE_DIR'))})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$VERBOSE'))} 
                          {(KW_Bang '!') (Lit_Other '=')} {(no)} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(log_end_msg)} {(0)})]
                )
              ]
            )
          ]
        )
        (case_arm
          pat_list: [{(restart)} {(reload)} {(force-reload)}]
          action: [(C {(/etc/init.d/x11-common)} {(start)})]
        )
        (case_arm pat_list:[{(stop)}] action:[(C {(Lit_Other ':')})])
        (case_arm pat_list:[{(status)}] action:[(C {(do_status)})])
        (case_arm
          pat_list: [{(Lit_Star '*')}]
          action: [
            (C {(log_success_msg)} 
              {(DQ ('Usage: /etc/init.d/x11-common {start|stop|status|restart|reload|force-reload}'))}
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
  ]
)