(command.CommandList
  children: [
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:PIDDIR) op:Equal rhs:{(/var/run/samba)})]
    )
    (command.Assignment
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:SMBDPID)
          op: Equal
          rhs: {($ VSub_DollarName '$PIDDIR') (/smbd.pid)}
        )
      ]
    )
    (C {(unset)} {(TMPDIR)})
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(test)} {(-x)} {(/usr/sbin/smbd)})
        (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
      ]
    )
    (C {(.)} {(/lib/lsb/init-functions)})
    (command.Case
      to_match: {($ VSub_Number '$1')}
      arms: [
        (case_arm
          pat_list: [{(start)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Sentence child:(C {(init_is_upstart)}) terminator:<Op_Semi ';'>)]
                  action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})]
                )
              ]
            )
            (command.Assignment
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:SERVER_ROLE)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSub
                        left_token: <Left_Backtick '`'>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (command.Simple
                                    words: [
                                      {(samba-tool)}
                                      {(testparm)}
                                      {(--parameter-name) (Lit_Other '=') (DQ ('server role'))}
                                    ]
                                    redirects: [
                                      (redir.Redir
                                        op: <Redir_Great '2>'>
                                        fd: 2
                                        arg_word: {(/dev/null)}
                                      )
                                    ]
                                  )
                                  (C {(tail)} {(-1)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$SERVER_ROLE'))} 
                          {(Lit_Other '=')} {(DQ ('active directory domain controller'))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})]
                )
              ]
            )
            (C {(log_daemon_msg)} {(DQ ('Starting SMB/CIFS daemon'))} {(smbd)})
            (C {(install)} {(-o)} {(root)} {(-g)} {(root)} {(-m)} {(755)} {(-d)} 
              {($ VSub_DollarName '$PIDDIR')}
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(start-stop-daemon)} {(--start)} {(--quiet)} {(--oknodo)} {(--exec)} 
                              {(/usr/sbin/smbd)} {(--)} {(-D)}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(log_end_msg)} {(1)})
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                )
              ]
            )
            (C {(log_end_msg)} {(0)})
          ]
        )
        (case_arm
          pat_list: [{(stop)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Sentence child:(C {(init_is_upstart)}) terminator:<Op_Semi ';'>)]
                  action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})]
                )
              ]
            )
            (C {(log_daemon_msg)} {(DQ ('Stopping SMB/CIFS daemon'))} {(smbd)})
            (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--pidfile)} {($ VSub_DollarName '$SMBDPID')})
            (C {(sleep)} {(1)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(Lit_LBracket '[')} {(-f)} {($ VSub_DollarName '$SMBDPID')} 
                          {(Lit_RBracket ']')}
                        )
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [
                                {(ps)}
                                {(h)}
                                {
                                  (word_part.CommandSub
                                    left_token: <Left_Backtick '`'>
                                    command_list: 
                                      (command.CommandList
                                        children: [(C {(cat)} {($ VSub_DollarName '$SMBDPID')})]
                                      )
                                  )
                                }
                              ]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(/dev/null)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      ]
                    )
                  ]
                  action: [(C {(rm)} {(-f)} {($ VSub_DollarName '$SMBDPID')})]
                )
              ]
            )
            (C {(log_end_msg)} {(0)})
          ]
        )
        (case_arm
          pat_list: [{(reload)}]
          action: [
            (C {(log_daemon_msg)} {(DQ ('Reloading /etc/samba/smb.conf'))} {(smbd)})
            (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--signal)} {(HUP)} {(--pidfile)} 
              {($ VSub_DollarName '$SMBDPID')}
            )
            (C {(log_end_msg)} {(0)})
          ]
        )
        (case_arm
          pat_list: [{(restart)} {(force-reload)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Sentence child:(C {(init_is_upstart)}) terminator:<Op_Semi ';'>)]
                  action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})]
                )
              ]
            )
            (C {($ VSub_Number '$0')} {(stop)})
            (C {(sleep)} {(1)})
            (C {($ VSub_Number '$0')} {(start)})
          ]
        )
        (case_arm
          pat_list: [{(status)}]
          action: [
            (C {(status_of_proc)} {(-p)} {($ VSub_DollarName '$SMBDPID')} {(/usr/sbin/smbd)} {(smbd)})
            (command.ControlFlow
              token: <ControlFlow_Exit exit>
              arg_word: {($ VSub_QMark '$?')}
            )
          ]
        )
        (case_arm
          pat_list: [{(Lit_Star '*')}]
          action: [
            (C {(echo)} 
              {(DQ ('Usage: /etc/init.d/smbd {start|stop|reload|restart|force-reload|status}'))}
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
  ]
)