(command.CommandList
  children: [
    (C {(Id.KW_Set set)} {(-e)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:PATH)
          op: assign_op.Equal
          rhs: 
            {(/usr/bin) (Id.Lit_Other ':') (/usr/sbin) (Id.Lit_Other ':') (/bin) (Id.Lit_Other ':') 
              (/sbin)
            }
          spids: [36]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SOCKET_DIR)
          op: assign_op.Equal
          rhs: {(.X11-unix)}
          spids: [45]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:ICE_DIR)
          op: assign_op.Equal
          rhs: {(.ICE-unix)}
          spids: [48]
        )
      ]
    )
    (C {(.)} {(/lib/lsb/init-functions)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Id.Lit_LBracket '[')} {(-f)} {(/etc/default/rcS)} {(Id.Lit_RBracket ']')})
              terminator: (Token id:Id.Op_Semi val:';' span_id:65)
            )
          ]
          action: [(C {(.)} {(/etc/default/rcS)})]
          spids: [56 67]
        )
      ]
    )
    (command.ShFunction
      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: (Token id:Id.Redir_Great val:'>' span_id:95)
                              fd: -1
                              arg_word: {(/dev/null)}
                            )
                            (redir.Redir
                              op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:98)
                              fd: 2
                              arg_word: {(1)}
                            )
                          ]
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:100)
                    )
                  ]
                  action: [(C {(restorecon)} {(DQ ($ Id.VSub_Number '$1'))})]
                  spids: [89 102]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: set_up_dir
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:DIR)
                  op: assign_op.Equal
                  rhs: {(DQ (/tmp/) ($ Id.VSub_Number '$1'))}
                  spids: [131]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$VERBOSE'))} 
                          {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(no)} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:153)
                    )
                  ]
                  action: [(C {(log_progress_msg)} {(DQ ($ Id.VSub_DollarName '$DIR'))})]
                  spids: [139 155]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Id.Op_DAmp Id.Op_DPipe]
                          children: [
                            (C {(Id.Lit_LBracket '[')} {(-e)} {($ Id.VSub_DollarName '$DIR')} 
                              {(Id.Lit_RBracket ']')}
                            )
                            (command.Pipeline
                              children: [
                                (C {(Id.Lit_LBracket '[')} {(-d)} {($ Id.VSub_DollarName '$DIR')} 
                                  {(Id.Lit_RBracket ']')}
                                )
                              ]
                              negated: T
                            )
                            (C {(Id.Lit_LBracket '[')} {(-h)} {($ Id.VSub_DollarName '$DIR')} 
                              {(Id.Lit_RBracket ']')}
                            )
                          ]
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:203)
                    )
                  ]
                  action: [
                    (C {(mv)} {(DQ ($ Id.VSub_DollarName '$DIR'))} 
                      {
                        (DQ 
                          (command_sub
                            left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:215)
                            command_list: 
                              (command.CommandList
                                children: [
                                  (C {(mktemp)} {(-d)} {($ Id.VSub_DollarName '$DIR') (.XXXXXX)})
                                ]
                              )
                          )
                        )
                      }
                    )
                  ]
                  spids: [172 205]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:error)
                  op: assign_op.Equal
                  rhs: {(0)}
                  spids: [230]
                )
              ]
            )
            (command.WhileUntil
              keyword: (Token id:Id.KW_While val:while span_id:234)
              cond: [
                (command.Sentence
                  child: (C {(Id.Lit_Other ':')})
                  terminator: (Token id:Id.Op_Semi val:';' span_id:237)
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$error')} {(-ne)} 
                                  {(0)} {(Id.Lit_RBracket ']')}
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:254)
                            )
                          ]
                          action: [
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$error')} 
                                          {(-gt)} {(5)} {(Id.Lit_RBracket ']')}
                                        )
                                      terminator: (Token id:Id.Op_Semi val:';' span_id:282)
                                    )
                                  ]
                                  action: [
                                    (C {(log_failure_msg)} 
                                      {(DQ ('failed to set up ') ($ Id.VSub_DollarName '$DIR'))}
                                    )
                                    (command.ControlFlow
                                      token: (Token id:Id.ControlFlow_Return val:return span_id:295)
                                      arg_word: {(1)}
                                    )
                                  ]
                                  spids: [271 284]
                                )
                              ]
                            )
                            (command.AndOr
                              ops: [Id.Op_DPipe]
                              children: [
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:fn)
                                      op: assign_op.Equal
                                      rhs: 
                                        {
                                          (DQ 
                                            (command_sub
                                              left_token: 
                                                (Token
                                                  id: Id.Left_DollarParen
                                                  val: '$('
                                                  span_id: 305
                                                )
                                              command_list: 
                                                (command.CommandList
                                                  children: [
                                                    (C {(mktemp)} {(/tmp/testwriteable.XXXXXXXXXX)})
                                                  ]
                                                )
                                            )
                                          )
                                        }
                                      spids: [303]
                                    )
                                  ]
                                )
                                (command.ControlFlow
                                  token: (Token id:Id.ControlFlow_Return val:return span_id:314)
                                  arg_word: {(1)}
                                )
                              ]
                            )
                            (C {(rm)} {(DQ ($ Id.VSub_DollarName '$fn'))})
                          ]
                          spids: [242 256]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {(mkdir)} {(-p)} {(-m)} {(01777)} {(DQ ($ Id.VSub_DollarName '$DIR'))})
                        (command.BraceGroup
                          children: [
                            (command.Sentence
                              child: 
                                (command.AndOr
                                  ops: [Id.Op_DPipe]
                                  children: [
                                    (C {(rm)} {(DQ ($ Id.VSub_DollarName '$DIR'))})
                                    (command.ShAssignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (sh_lhs_expr.Name name:error)
                                          op: assign_op.Equal
                                          rhs: 
                                            {
                                              (word_part.ArithSub
                                                anode: 
                                                  (arith_expr.Binary
                                                    op_id: Id.Arith_Plus
                                                    left: 
                                                      (arith_expr.VarRef
                                                        token: 
                                                          (Token
                                                            id: Id.Lit_ArithVarLike
                                                            val: error
                                                            span_id: 355
                                                          )
                                                      )
                                                    right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                                  )
                                              )
                                            }
                                          spids: [353]
                                        )
                                      ]
                                    )
                                  ]
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:363)
                            )
                            (command.Sentence
                              child: 
                                (command.ControlFlow
                                  token: (Token id:Id.ControlFlow_Continue val:continue span_id:365)
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:367)
                            )
                          ]
                        )
                      ]
                    )
                    (command.Case
                      to_match: 
                        {
                          (DQ 
                            (command_sub
                              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:375)
                              command_list: 
                                (command.CommandList
                                  children: [
                                    (command.Simple
                                      words: [
                                        {(stat)}
                                        {(-c)}
                                        {(SQ (Token id:Id.Lit_Chars val:'%u %g %a %F' span_id:384))}
                                        {(DQ ($ Id.VSub_DollarName '$DIR'))}
                                      ]
                                      more_env: [(env_pair name:LC_ALL val:{(C)} spids:[376])]
                                    )
                                  ]
                                )
                            )
                          )
                        }
                      arms: [
                        (case_arm
                          pat_list: [{(DQ ('0 0 1777 directory'))}]
                          action: [
                            (command.ControlFlow
                              token: (Token id:Id.ControlFlow_Break val:break span_id:406)
                            )
                          ]
                          spids: [396 399 409 -1]
                        )
                        (case_arm
                          pat_list: [{(DQ ('0 0 ')) (Id.Lit_Star '*') (DQ (' directory'))}]
                          action: [
                            (C {(chmod)} {(01777)} {(DQ ($ Id.VSub_DollarName '$DIR'))})
                            (command.ControlFlow
                              token: (Token id:Id.ControlFlow_Break val:break span_id:435)
                            )
                          ]
                          spids: [412 419 438 -1]
                        )
                        (case_arm
                          pat_list: [{(Id.Lit_Star '*') (DQ (' directory'))}]
                          action: [
                            (command.AndOr
                              ops: [Id.Op_DPipe]
                              children: [
                                (C {(chown)} {(-h)} {(root) (Id.Lit_Other ':') (root)} 
                                  {(DQ ($ Id.VSub_DollarName '$DIR'))}
                                )
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:error)
                                      op: assign_op.Equal
                                      rhs: 
                                        {
                                          (word_part.ArithSub
                                            anode: 
                                              (arith_expr.Binary
                                                op_id: Id.Arith_Plus
                                                left: 
                                                  (arith_expr.VarRef
                                                    token: 
                                                      (Token
                                                        id: Id.Lit_ArithVarLike
                                                        val: error
                                                        span_id: 468
                                                      )
                                                  )
                                                right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                              )
                                          )
                                        }
                                      spids: [466]
                                    )
                                  ]
                                )
                              ]
                            )
                            (command.ControlFlow
                              token: (Token id:Id.ControlFlow_Continue val:continue span_id:477)
                            )
                          ]
                          spids: [441 445 480 -1]
                        )
                        (case_arm
                          pat_list: [{(Id.Lit_Star '*')}]
                          action: [
                            (C {(log_failure_msg)} 
                              {(DQ ('failed to set up ') ($ Id.VSub_DollarName '$DIR'))}
                            )
                            (command.ControlFlow
                              token: (Token id:Id.ControlFlow_Return val:return span_id:495)
                              arg_word: {(1)}
                            )
                          ]
                          spids: [483 484 500 -1]
                        )
                      ]
                    )
                  ]
                )
            )
            (C {(do_restorecon)} {(DQ ($ Id.VSub_DollarName '$DIR'))})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Return val:return span_id:517)
              arg_word: {(0)}
            )
          ]
        )
    )
    (command.ShFunction
      name: do_status
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {(Id.Lit_LBracket '[')} {(-d)} 
                              {(DQ (/tmp/) ($ Id.VSub_DollarName '$ICE_DIR'))} {(Id.Lit_RBracket ']')}
                            )
                            (C {(Id.Lit_LBracket '[')} {(-d)} 
                              {(DQ (/tmp/) ($ Id.VSub_DollarName '$SOCKET_DIR'))} {(Id.Lit_RBracket ']')}
                            )
                          ]
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:557)
                    )
                  ]
                  action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:562)
                      arg_word: {(0)}
                    )
                  ]
                  spids: [532 559]
                )
              ]
              else_action: [
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Return val:return span_id:570)
                  arg_word: {(4)}
                )
              ]
            )
          ]
        )
    )
    (command.Case
      to_match: {(DQ ($ Id.VSub_Number '$1'))}
      arms: [
        (case_arm
          pat_list: [{(start)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$VERBOSE'))} 
                          {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(no)} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:607)
                    )
                  ]
                  action: [(C {(log_begin_msg)} {(DQ ('Setting up X socket directories...'))})]
                  spids: [593 609]
                )
              ]
            )
            (C {(set_up_dir)} {(DQ ($ Id.VSub_DollarName '$SOCKET_DIR'))})
            (C {(set_up_dir)} {(DQ ($ Id.VSub_DollarName '$ICE_DIR'))})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$VERBOSE'))} 
                          {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(no)} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:650)
                    )
                  ]
                  action: [(C {(log_end_msg)} {(0)})]
                  spids: [636 652]
                )
              ]
            )
          ]
          spids: [589 590 663 -1]
        )
        (case_arm
          pat_list: [{(restart)} {(reload)} {(force-reload)}]
          action: [(C {(/etc/init.d/x11-common)} {(start)})]
          spids: [667 672 680 -1]
        )
        (case_arm
          pat_list: [{(stop)}]
          action: [(C {(Id.Lit_Other ':')})]
          spids: [684 685 691 -1]
        )
        (case_arm pat_list:[{(status)}] action:[(C {(do_status)})] spids:[695 696 702 -1])
        (case_arm
          pat_list: [{(Id.Lit_Star '*')}]
          action: [
            (C {(log_success_msg)} 
              {(DQ ('Usage: /etc/init.d/x11-common {start|stop|status|restart|reload|force-reload}'))}
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:716)
              arg_word: {(1)}
            )
          ]
          spids: [705 706 721 -1]
        )
      ]
    )
    (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:726) arg_word:{(0)})
  ]
)