(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(KW_Bang '!')} {(-d)} {(py)} {(-o)} {(KW_Bang '!')} {(-d)} {(unix)} 
                  {(-o)} {(KW_Bang '!')} {(-d)} {(stmhal)} {(Lit_RBracket ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('script must be run from root of the repository'))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:output) op:Equal rhs:{(codestats.dat)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:RM) op:Equal rhs:{(/bin/rm)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:AWK) op:Equal rhs:{(awk)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:MAKE) op:Equal rhs:{(DQ ('make -j2'))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:bin_unix) op:Equal rhs:{(unix/micropython)})]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_stmhal)
          op: Equal
          rhs: {(stmhal/build-PYBV10/firmware.elf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_barearm_1)
          op: Equal
          rhs: {(bare-arm/build/flash.elf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_barearm_2)
          op: Equal
          rhs: {(bare-arm/build/firmware.elf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_minimal)
          op: Equal
          rhs: {(minimal/build/firmware.elf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_cc3200_1)
          op: Equal
          rhs: {(cc3200/build/LAUNCHXL/application.axf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_cc3200_2)
          op: Equal
          rhs: {(cc3200/build/LAUNCHXL/release/application.axf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bin_cc3200_3)
          op: Equal
          rhs: {(cc3200/build/WIPY/release/application.axf)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:size_unix) op:Equal rhs:{(DQ (0))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:size_stmhal) op:Equal rhs:{(DQ (0))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:size_barearm) op:Equal rhs:{(DQ (0))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:size_minimal) op:Equal rhs:{(DQ (0))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:size_cc3200) op:Equal rhs:{(DQ (0))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:pystones) op:Equal rhs:{(DQ (0))})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:pystoneavg) op:Equal rhs:{(/tmp/pystoneavg.py)})]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: <Redir_Great '>'>
          fd: 16777215
          arg_word: {($ VSub_DollarName '$pystoneavg')}
        )
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 194
          stdin_parts: [
            ('import pystone\n')
            ('samples = [pystone.pystones(300000)[1] for i in range(5)]\n')
            ('samples.sort()\n')
            ('stones = sum(samples[1:-1]) / (len(samples) - 2) # exclude smallest and largest\n')
            ('print(')
            (Right_DoubleQuote '"')
            ('stones %g')
            (Right_DoubleQuote '"')
            (' % stones)\n')
          ]
        )
      ]
    )
    (command.ShFunction
      name: get_size
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-r)} {($ VSub_Number '$2')} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(size)} {($ VSub_Number '$2')})
                        (C {(tail)} {(-n1)})
                        (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                      ]
                      negated: F
                    )
                  ]
                )
              ]
              else_action: [(C {(echo)} {($ VSub_Number '$1')})]
            )
          ]
        )
    )
    (command.ShFunction
      name: get_size2
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-r)} {($ VSub_Number '$2')} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(size)} {($ VSub_Number '$2')})
                        (C {(tail)} {(-n1)})
                        (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                      ]
                      negated: F
                    )
                  ]
                )
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-r)} {($ VSub_Number '$3')} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(size)} {($ VSub_Number '$3')})
                        (C {(tail)} {(-n1)})
                        (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                      ]
                      negated: F
                    )
                  ]
                )
              ]
              else_action: [(C {(echo)} {($ VSub_Number '$1')})]
            )
          ]
        )
    )
    (command.ShFunction
      name: get_size3
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-r)} {($ VSub_Number '$2')} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(size)} {($ VSub_Number '$2')})
                        (C {(tail)} {(-n1)})
                        (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                      ]
                      negated: F
                    )
                  ]
                )
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-r)} {($ VSub_Number '$3')} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(size)} {($ VSub_Number '$3')})
                        (C {(tail)} {(-n1)})
                        (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                      ]
                      negated: F
                    )
                  ]
                )
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-r)} {($ VSub_Number '$4')} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(size)} {($ VSub_Number '$4')})
                        (C {(tail)} {(-n1)})
                        (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                      ]
                      negated: F
                    )
                  ]
                )
              ]
              else_action: [(C {(echo)} {($ VSub_Number '$1')})]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(-r)} {($ VSub_DollarName '$output')} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:last_rev)
                  op: Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(tail)} {(-n1)} {($ VSub_DollarName '$output')})
                                  (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $1}'>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
      else_action: [
        (command.Simple
          words: [
            {(echo)}
            {(DQ ('# hash size_unix size_stmhal size_barearm size_minimal size_cc3200 pystones'))}
          ]
          redirects: [
            (redir.Redir
              op: <Redir_Great '>'>
              fd: 16777215
              arg_word: {($ VSub_DollarName '$output')}
            )
          ]
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:last_rev) op:Equal rhs:{(DQ (v1.0))})]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:hashes)
          op: Equal
          rhs: 
            {
              (command_sub
                left_token: <Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(git)} {(log)} 
                        {(--format) (Lit_Equals '=') (format) (Lit_Other ':') (DQ ('%H'))} {(--reverse)} {(${ VSub_Name last_rev) (..master)}
                      )
                    ]
                  )
              )
            }
        )
      ]
    )
    (command.ForEach
      iter_name: hash
      iter_words: [{($ VSub_DollarName '$hashes')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(git)} {(checkout)} {($ VSub_DollarName '$hash')})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {($ VSub_QMark '$?')} {(-ne)} {(0)} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ (aborting))})
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(grep)} {(-q)} 
                          {
                            (SQ 
                              <
'#if defined(MP_CLOCKS_PER_SEC) && (MP_CLOCKS_PER_SEC == 1000000) // POSIX'
                              >
                            )
                          } {(unix/modtime.c)}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} {(apply)} {(patch)})
                    (command.Simple
                      words: [{(git)} {(apply)} {(-)}]
                      redirects: [
                        (redir.HereDoc
                          op: <Redir_DLess '<<'>
                          fd: 16777215
                          here_begin: {(EOF)}
                          here_end_span_id: 658
                          stdin_parts: [
                            ('diff --git a/unix/modtime.c b/unix/modtime.c\n')
                            ('index 77d2945..dae0644 100644\n')
                            ('--- a/unix/modtime.c\n')
                            ('+++ b/unix/modtime.c\n')
                            ('@@ -55,10 +55,8 @@ void msec_sleep_tv(struct timeval *tv) {\n')
                            (' #define MP_CLOCKS_PER_SEC CLOCKS_PER_SEC\n')
                            (' #endif\n')
                            (' \n')
                            (
'-#if defined(MP_CLOCKS_PER_SEC) && (MP_CLOCKS_PER_SEC == 1000000) // POSIX\n'
                            )
                            ('-#define CLOCK_DIV 1000.0\n')
                            (
'-#elif defined(MP_CLOCKS_PER_SEC) && (MP_CLOCKS_PER_SEC == 1000) // WIN32\n'
                            )
                            ('-#define CLOCK_DIV 1.0\n')
                            ('+#if defined(MP_CLOCKS_PER_SEC)\n')
                            ('+#define CLOCK_DIV (MP_CLOCKS_PER_SEC / 1000.0F)\n')
                            (' #else\n')
                            (' #error Unsupported clock() implementation\n')
                            (' #endif\n')
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (C {($ VSub_DollarName '$RM')} {($ VSub_DollarName '$bin_unix')})
            (C {($ VSub_DollarName '$MAKE')} {(-C)} {(unix)} {(Lit_VarLike 'CFLAGS_EXTRA=') (-DNDEBUG)})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:size_unix)
                  op: Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (C {(get_size)} {($ VSub_DollarName '$size_unix')} 
                                {($ VSub_DollarName '$bin_unix')}
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
            (C {(git)} {(checkout)} {(unix/modtime.c)})
            (C {($ VSub_DollarName '$RM')} {($ VSub_DollarName '$bin_stmhal')})
            (C {($ VSub_DollarName '$MAKE')} {(-C)} {(stmhal)} {(Lit_VarLike 'board=') (PYBV10)})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:size_stmhal)
                  op: Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (C {(get_size)} {($ VSub_DollarName '$size_stmhal')} 
                                {($ VSub_DollarName '$bin_stmhal')}
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
            (C {($ VSub_DollarName '$RM')} {($ VSub_DollarName '$bin_barearm_1')} 
              {($ VSub_DollarName '$bin_barearm_2')}
            )
            (C {($ VSub_DollarName '$MAKE')} {(-C)} {(bare-arm)})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:size_barearm)
                  op: Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (C {(get_size2)} {($ VSub_DollarName '$size_barearm')} 
                                {($ VSub_DollarName '$bin_barearm_1')} {($ VSub_DollarName '$bin_barearm_2')}
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(Lit_LBracket '[')} {(-r)} {(minimal/Makefile)} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {($ VSub_DollarName '$RM')} {($ VSub_DollarName '$bin_minimal')})
                    (C {($ VSub_DollarName '$MAKE')} {(-C)} {(minimal)} {(Lit_VarLike 'CROSS=') (1)})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:size_minimal)
                          op: Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Left_DollarParen '$('>
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(get_size)} {($ VSub_DollarName '$size_minimal')} 
                                        {($ VSub_DollarName '$bin_minimal')}
                                      )
                                    ]
                                  )
                              )
                            }
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(Lit_LBracket '[')} {(-r)} {(cc3200/Makefile)} {(Lit_RBracket ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {($ VSub_DollarName '$RM')} {($ VSub_DollarName '$bin_cc3200_1')} 
                      {($ VSub_DollarName '$bin_cc3200_2')} {($ VSub_DollarName '$bin_cc3200_3')}
                    )
                    (C {($ VSub_DollarName '$MAKE')} {(-C)} {(cc3200)} 
                      {(Lit_VarLike 'BTARGET=') (application)}
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:size_cc3200)
                          op: Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Left_DollarParen '$('>
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(get_size3)} {($ VSub_DollarName '$size_cc3200')} 
                                        {($ VSub_DollarName '$bin_cc3200_1')} {($ VSub_DollarName '$bin_cc3200_2')} {($ VSub_DollarName '$bin_cc3200_3')}
                                      )
                                    ]
                                  )
                              )
                            }
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-x)} {($ VSub_DollarName '$bin_unix')} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:new_pystones)
                          op: Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Left_DollarParen '$('>
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {($ VSub_DollarName '$bin_unix')} 
                                        {($ VSub_DollarName '$pystoneavg')}
                                      )
                                    ]
                                  )
                              )
                            }
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.Pipeline
                                  children: [
                                    (C {(echo)} {($ VSub_DollarName '$new_pystones')})
                                    (C {(grep)} {(-q)} {(DQ ('^stones'))})
                                  ]
                                  negated: F
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:pystones)
                                  op: Equal
                                  rhs: 
                                    {
                                      (command_sub
                                        left_token: <Left_DollarParen '$('>
                                        command_list: 
                                          (command.CommandList
                                            children: [
                                              (command.Pipeline
                                                children: [
                                                  (C {(echo)} {($ VSub_DollarName '$new_pystones')})
                                                  (C {($ VSub_DollarName '$AWK')} {(SQ <'{print $2}'>)})
                                                ]
                                                negated: F
                                              )
                                            ]
                                          )
                                      )
                                    }
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.Simple
              words: [
                {(echo)}
                {
                  (DQ ($ VSub_DollarName '$hash') (' ') ($ VSub_DollarName '$size_unix') (' ') 
                    ($ VSub_DollarName '$size_stmhal') (' ') ($ VSub_DollarName '$size_barearm') (' ') ($ VSub_DollarName '$size_minimal') (' ') 
                    ($ VSub_DollarName '$size_cc3200') (' ') ($ VSub_DollarName '$pystones')
                  )
                }
              ]
              redirects: [
                (redir.Redir
                  op: <Redir_DGreat '>>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$output')}
                )
              ]
            )
          ]
        )
    )
    (C {(git)} {(checkout)} {(master)})
    (C {($ VSub_DollarName '$RM')} {($ VSub_DollarName '$pystoneavg')})
  ]
)