(command.CommandList
  children: [
    (command.ShFunction
      name: hal_check_priv
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName HAVE_POLKIT))} 
                              {<Id.Lit_Equals '='>} {(DQ <1>)} {<-a>} {<-n>} {($ Id.VSub_DollarName HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME)} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ACTION='> name:ACTION)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_Number 1)}
                          spids: [58]
                        )
                      ]
                      redirects: []
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PK_RESULT='> name:PK_RESULT)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Id.Left_Backtick '`'>
                                child: 
                                  (C {<hal-is-caller-privileged>} {<--udi>} {($ Id.VSub_DollarName UDI)} 
                                    {<--action>} {($ Id.VSub_DollarName ACTION)} {<--caller>} 
                                    {
                                      ($ Id.VSub_DollarName 
HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME
                                      )
                                    }
                                  )
                                right: <Id.Backtick_Right '`'>
                              )
                            }
                          spids: [62]
                        )
                      ]
                      redirects: []
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'RET='> name:RET)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_QMark '?')}
                          spids: [87]
                        )
                      ]
                      redirects: []
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName RET))} 
                                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <0>)} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (command.Simple
                              words: [{<echo>} {(DQ <org.freedesktop.Hal.Device.Error>)}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_GreatAnd '>&'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<2>}
                                )
                              ]
                              more_env: []
                              do_fork: T
                            )
                            (command.Simple
                              words: [{<echo>} {(DQ <'Cannot determine if caller is privileged'>)}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_GreatAnd '>&'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<2>}
                                )
                              ]
                              more_env: []
                              do_fork: T
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Exit exit>
                              arg_word: {<1>}
                            )
                          ]
                          spids: [91 109]
                        )
                      ]
                      else_action: []
                      redirects: []
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName PK_RESULT))} 
                                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <yes>)} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (command.Simple
                              words: [
                                {<echo>}
                                {(DQ <org.freedesktop.Hal.Device.PermissionDeniedByPolicy>)}
                              ]
                              redirects: [
                                (redir
                                  op: <Id.Redir_GreatAnd '>&'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<2>}
                                )
                              ]
                              more_env: []
                              do_fork: T
                            )
                            (command.Simple
                              words: [
                                {<echo>}
                                {
                                  (DQ ($ Id.VSub_DollarName ACTION) <' '> 
                                    ($ Id.VSub_DollarName PK_RESULT) <' <-- (action, result)'>
                                  )
                                }
                              ]
                              redirects: [
                                (redir
                                  op: <Id.Redir_GreatAnd '>&'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<2>}
                                )
                              ]
                              more_env: []
                              do_fork: T
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Exit exit>
                              arg_word: {<1>}
                            )
                          ]
                          spids: [140 158]
                        )
                      ]
                      else_action: []
                      redirects: []
                    )
                  ]
                  spids: [32 55]
                )
              ]
              else_action: []
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: hal_call_backend
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PROGRAM='> name:PROGRAM)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: (C {<basename>} {($ Id.VSub_Number 0)})
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  spids: [204]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName HALD_UNAME_S))} 
                              {<-a>} {<-x>} 
                              {<'./'> ($ Id.VSub_DollarName HALD_UNAME_S) <'/'> 
                                ($ Id.VSub_DollarName PROGRAM) <-> ($ Id.VSub_DollarName HALD_UNAME_S)
                              } {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C 
                      {<'./'> ($ Id.VSub_DollarName HALD_UNAME_S) <'/'> ($ Id.VSub_DollarName PROGRAM) 
                        <-> ($ Id.VSub_DollarName HALD_UNAME_S)
                      } {($ Id.VSub_At '@')}
                    )
                  ]
                  spids: [214 238]
                )
              ]
              else_action: [
                (command.Simple
                  words: [{<echo>} {(DQ <org.freedesktop.Hal.Device.UnknownError>)}]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  more_env: []
                  do_fork: T
                )
                (command.Simple
                  words: [{<echo>} {(DQ <'No back-end for your operating system'>)}]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  more_env: []
                  do_fork: T
                )
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: hal_exec_backend
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PROGRAM='> name:PROGRAM)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: (C {<basename>} {($ Id.VSub_Number 0)})
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  spids: [291]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName HALD_UNAME_S))} 
                              {<-a>} {<-x>} 
                              {<'./'> ($ Id.VSub_DollarName HALD_UNAME_S) <'/'> 
                                ($ Id.VSub_DollarName PROGRAM) <-> ($ Id.VSub_DollarName HALD_UNAME_S)
                              } {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<exec>} 
                      {<'./'> ($ Id.VSub_DollarName HALD_UNAME_S) <'/'> ($ Id.VSub_DollarName PROGRAM) 
                        <-> ($ Id.VSub_DollarName HALD_UNAME_S)
                      } {($ Id.VSub_At '@')}
                    )
                  ]
                  spids: [301 325]
                )
              ]
              else_action: [
                (command.Simple
                  words: [{<echo>} {(DQ <org.freedesktop.Hal.Device.UnknownError>)}]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  more_env: []
                  do_fork: T
                )
                (command.Simple
                  words: [{<echo>} {(DQ <'No back-end for your operating system'>)}]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  more_env: []
                  do_fork: T
                )
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
  ]
)