(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DO_OPTIMIZE)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [39]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DO_DARTIUM)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [42]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TESTS_FAILED)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [45]
        )
      ]
    )
    (command.ShFunction
      name: usage
      body: 
        (BraceGroup
          children: [
            (C {<echo>} 
              {(DQ <'usage: '> ($ Id.VSub_Number '$0') <' [ --help ] [ --optimize ] [ --dartium ] '>)}
            )
            (C {<echo>})
            (C {<echo>} {(DQ <'Runs a quick set of tests on runtime, client, and compiler dirs'>)})
            (C {<echo>})
            (C {<echo>} {(DQ <' --optimize: Also run dartc and client tests in release mode'>)})
            (C {<echo>} {(DQ <' --dartium : Also run dartium/debug tests'>)})
            (C {<echo>})
          ]
        )
    )
    (command.ShFunction
      name: doBuild
      body: 
        (BraceGroup
          children: [
            (C {<'./tools/build.py'>} {<--arch>} {($ Id.VSub_Number '$1')} {<--mode>} 
              {($ Id.VSub_Number '$2')}
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'Build of '> ($ Id.VSub_Number '$1') <' - '> ($ Id.VSub_Number '$2') 
                          <' failed'>
                        )
                      }
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [127 142]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: doTest
      body: 
        (BraceGroup
          children: [
            (C {<'./tools/test.py'>} {<--component>} {($ Id.VSub_Number '$2')} {<--mode>} 
              {($ Id.VSub_Number '$3')}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:RESULT)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [199]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name RESULT)} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:TESTS_FAILED)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [223]
                        )
                      ]
                    )
                  ]
                  spids: [203 220]
                )
              ]
            )
            (command.ControlFlow
              token: <Id.ControlFlow_Return return>
              arg_word: {(${ Id.VSub_Name RESULT)}
            )
          ]
        )
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: 
        (condition.Shell
          commands: [
            (command.Sentence
              child: 
                (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_Number '$1'))} 
                  {<Id.Lit_RBracket ']'>}
                )
              terminator: <Id.Op_Semi _>
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_Number '$1')}
              arms: [
                (case_arm
                  pat_list: [{(DQ <-h>)} {(DQ <'-?'>)} {(DQ <-help>)} {(DQ <--help>)}]
                  action: [
                    (C {<usage>})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [269 284 295 -1]
                )
                (case_arm
                  pat_list: [{(DQ <--optimize>)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:DO_OPTIMIZE)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [304]
                        )
                      ]
                    )
                  ]
                  spids: [298 301 308 -1]
                )
                (case_arm
                  pat_list: [{(DQ <--dartium>)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:DO_DARTIUM)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [317]
                        )
                      ]
                    )
                  ]
                  spids: [311 314 321 -1]
                )
                (case_arm
                  pat_list: [{<Id.Lit_Star '*'>}]
                  action: [
                    (C {<echo>} {(DQ <'Unrecognized argument: '> ($ Id.VSub_Number '$1'))})
                    (C {<usage>})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [325 326 345 -1]
                )
              ]
            )
            (C {<shift>})
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-d>} {<compiler>} {<-o>} 
                      {<Id.KW_Bang '!'>} {<-d>} {<runtime>} {<-o>} {<Id.KW_Bang '!'>} {<-d>} {<tests>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'This doesn\'t look like the dart source tree.'>)})
            (C {<echo>} {(DQ <'Change your directory to the dart trunk source'>)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [356 386]
        )
      ]
    )
    (C {<echo>})
    (C {<echo>} {(DQ <'--- Building release ---'>)})
    (C {<doBuild>} {<ia32>} {<release>})
    (C {<echo>})
    (C {<echo>} {(DQ <'--- Building debug ---'>)})
    (C {<doBuild>} {<ia32>} {<debug>})
    (C {<echo>})
    (C {<echo>} {(DQ <'=== Runtime tests === '>)})
    (C {<echo>} {(DQ <' Debug (Ctrl-C to skip this set of tests)'>)})
    (C {<doTest>} {<runtime>} {<vm>} {<debug>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:RUNTIME_RESULT)
          op: assign_op.Equal
          rhs: {($ Id.VSub_QMark '$?')}
          spids: [462]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name RUNTIME_RESULT)} 
                      {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <' Release (Ctrl-C to skip this set of tests)'>)})
            (C {<doTest>} {<runtime>} {<vm>} {<release>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:RUNTIME_RESULT)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [502]
                )
              ]
            )
          ]
          spids: [465 482]
        )
      ]
    )
    (C {<echo>})
    (C {<echo>} {(DQ <'=== dartc tests ==='>)})
    (C {<echo>} {(DQ <' Debug mode (Ctrl-C to skip this set of tests)'>)})
    (C {<doTest>} {<compiler>} {<dartc>} {<debug>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DARTC_RESULT)
          op: assign_op.Equal
          rhs: {($ Id.VSub_QMark '$?')}
          spids: [531]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name DO_OPTIMIZE)} 
                      {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<1>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <' Release mode (--optimize)'>)})
            (C {<doTest>} {<compiler>} {<dartc>} {<release>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:RESULT)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [571]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name RESULT)} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:DARTC_RESULT)
                          op: assign_op.Equal
                          rhs: {(${ Id.VSub_Name RESULT)}
                          spids: [595]
                        )
                      ]
                    )
                  ]
                  spids: [575 592]
                )
              ]
            )
          ]
          spids: [535 552]
        )
      ]
    )
    (C {<echo>})
    (C {<echo>} {(DQ <'=== Client tests ==='>)})
    (C {<echo>} {(DQ <' Chromium  (Ctrl-C to skip this set of tests)'>)})
    (C {<doTest>} {<client>} {<chromium>} {<debug>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CLIENT_RESULT)
          op: assign_op.Equal
          rhs: {($ Id.VSub_QMark '$?')}
          spids: [628]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name DO_OPTIMIZE)} 
                      {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<1>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <' Chromium Release mode (--optimize)'>)})
            (C {<doTest>} {<compiler>} {<chromium>} {<release>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:RESULT)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [668]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name RESULT)} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:CLIENT_RESULT)
                          op: assign_op.Equal
                          rhs: {(${ Id.VSub_Name RESULT)}
                          spids: [692]
                        )
                      ]
                    )
                  ]
                  spids: [672 689]
                )
              ]
            )
          ]
          spids: [632 649]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name DO_DARTIUM)} 
                      {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<1>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <' Dartium (Ctrl-C to skip this set of tests)'>)})
            (C {<doTest>} {<client>} {<dartium>} {<release>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:RESULT)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [739]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name RESULT)} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:CLIENT_RESULT)
                          op: assign_op.Equal
                          rhs: {(${ Id.VSub_Name RESULT)}
                          spids: [763]
                        )
                      ]
                    )
                  ]
                  spids: [743 760]
                )
              ]
            )
          ]
          spids: [703 720]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name RUNTIME_RESULT)} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [(C {<echo>} {(DQ <'*** vm tests failed'>)})]
          spids: [777 794]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name DARTC_RESULT)} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [(C {<echo>} {(DQ <'*** dartc tests failed'>)})]
          spids: [806 823]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name CLIENT_RESULT)} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [(C {<echo>} {(DQ <'*** client tests failed'>)})]
          spids: [835 852]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name TESTS_FAILED)} 
                      {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [(C {<echo>} {(DQ <'All presubmit tests passed!'>)})]
          spids: [864 881]
        )
      ]
    )
  ]
)