(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tid)
          op: assign_op.Equal
          rhs: {(DQ <'disallow agent ptrace attach'>)}
          spids: [7]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: (C {<have_prog>} {<uname>})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Case
              to_match: {(command_sub left_token:<Id.Left_Backtick '`'> child:(C {<uname>}))}
              arms: [
                (case_arm
                  pat_list: [{<AIX>} {<CYGWIN> <Id.Lit_Star '*'>} {<OSF1>}]
                  action: [
                    (C {<echo>} {(DQ <'skipped (not supported on this platform)'>)})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<0>}
                    )
                  ]
                  spids: [35 41 56 -1]
                )
              ]
            )
          ]
          spids: [13 21]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ <x> ($ Id.VSub_DollarName '$USER'))} 
                      {<Id.Lit_Equals '='>} {(DQ <xroot>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'Skipped: running as root'>)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [64 82]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [(command.Sentence child:(C {<have_prog>} {<gdb>}) terminator:<Id.Op_Semi _>)]
            )
          action: [(C {<Id.Lit_Colon ':'>} {<ok>})]
          spids: [99 107]
        )
      ]
      else_action: [
        (C {<echo>} {(DQ <'skipped (gdb not found)'>)})
        (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {($ Id.VSub_DollarName '$OBJ') <'/setuid-allowed'>} {(${ Id.VSub_Name SSHAGENT)})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [(C {<Id.Lit_Colon ':'>} {<ok>})]
          spids: [131 142]
        )
      ]
      else_action: [
        (C {<echo>} 
          {(DQ <'skipped ('> (${ Id.VSub_Name SSHAGENT) <' is mounted on a no-setuid filesystem)'>)}
        )
        (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: (C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName '$SUDO'))})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'skipped (SUDO not set)'>)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [170 182]
        )
      ]
      else_action: [
        (C {($ Id.VSub_DollarName '$SUDO')} {<chown>} {<0>} {(${ Id.VSub_Name SSHAGENT)})
        (C {($ Id.VSub_DollarName '$SUDO')} {<chgrp>} {<0>} {(${ Id.VSub_Name SSHAGENT)})
        (C {($ Id.VSub_DollarName '$SUDO')} {<chmod>} {<2755>} {(${ Id.VSub_Name SSHAGENT)})
      ]
    )
    (C {<trace>} {(DQ <'start agent'>)})
    (command.Simple
      words: [
        {<eval>}
        {(command_sub left_token:<Id.Left_Backtick '`'> child:(C {(${ Id.VSub_Name SSHAGENT)} {<-s>}))}
      ]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
      do_fork: T
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:r)
          op: assign_op.Equal
          rhs: {($ Id.VSub_QMark '$?')}
          spids: [256]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$r')} {<-ne>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<fail>} {(DQ <'could not start ssh-agent: exit code '> ($ Id.VSub_DollarName '$r'))})
          ]
          spids: [259 272]
        )
      ]
      else_action: [
        (command.Simple
          words: [{<gdb>} {(${ Id.VSub_Name SSHAGENT)} {(${ Id.VSub_Name SSH_AGENT_PID)}]
          redirects: [
            (redir
              op: <Id.Redir_Great '>'>
              loc: (redir_loc.Fd fd:1)
              arg: {(${ Id.VSub_Name OBJ) <'/gdb.out'>}
            )
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
            (redir
              op: <Id.Redir_DLess '<<'>
              loc: (redir_loc.Fd fd:0)
              arg: 
                (redir_param.HereDoc
                  here_begin: {<EOF>}
                  here_end_span_id: 315
                  stdin_parts: [<'\t\tquit\n'>]
                )
            )
          ]
          do_fork: T
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:r)
              op: assign_op.Equal
              rhs: {($ Id.VSub_QMark '$?')}
              spids: [317]
            )
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$r')} {<-ne>} {<0>} 
                          {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              action: [(C {<fail>} {(DQ <'gdb failed: exit code '> ($ Id.VSub_DollarName '$r'))})]
              spids: [321 334]
            )
          ]
        )
        (command.Simple
          words: [
            {<egrep>}
            {
              (SQ 
                <
'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task '
                >
              )
            }
            {(${ Id.VSub_Name OBJ) <'/gdb.out'>}
          ]
          redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
          do_fork: T
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:r)
              op: assign_op.Equal
              rhs: {($ Id.VSub_QMark '$?')}
              spids: [363]
            )
          ]
        )
        (C {<rm>} {<-f>} {(${ Id.VSub_Name OBJ) <'/gdb.out'>})
        (command.If
          arms: [
            (if_arm
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$r')} {<-ne>} {<0>} 
                          {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              action: [(C {<fail>} {(DQ <'ptrace succeeded?: exit code '> ($ Id.VSub_DollarName '$r'))})]
              spids: [377 390]
            )
          ]
        )
        (C {<trace>} {(DQ <'kill agent'>)})
        (command.Simple
          words: [{(${ Id.VSub_Name SSHAGENT)} {<-k>}]
          redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
          do_fork: T
        )
      ]
    )
  ]
)