(command.CommandList
  children: [
    (C {<Id.KW_Set set>} {<-u>})
    (command.ShFunction
      name: die
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<0>} {<Id.Lit_RBracket ']'>})
                (command.Simple
                  words: [{<echo>} {(DQ <'error: '> ($ Id.VSub_Star '$*'))}]
                  redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                )
              ]
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BASE_DIR)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [(C {<dirname>} {(DQ ($ Id.VSub_Number '$0'))})]
                  )
              )
            }
          spids: [100]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LIB_DIR)
          op: assign_op.Equal
          rhs: {(DQ (${ Id.VSub_Name BASE_DIR) </lib>)}
          spids: [109]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<.>} {(DQ (${ Id.VSub_Name LIB_DIR) </shflags>)})
        (C {<die>} {(SQ <'unable to load shflags library'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<.>} {(DQ (${ Id.VSub_Name LIB_DIR) </shlib>)})
        (C {<die>} {(SQ <'unable to load shlib library'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<.>} {(DQ (${ Id.VSub_Name LIB_DIR) </versions>)})
        (C {<die>} {(SQ <'unable to load versions library'>)})
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BASE_DIR)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [(C {<shlib_relToAbsPath>} {(DQ (${ Id.VSub_Name BASE_DIR))})]
                  )
              )
            }
          spids: [182]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:os_name)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [(C {<versions_osName>}) (C {<sed>} {(SQ <'s/ /_/g'>)})]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [197]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:os_version)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                command_list: (command.CommandList children:[(C {<versions_osVersion>})])
              )
            }
          spids: [209]
        )
      ]
    )
    (C {<DEFINE_boolean>} {<force>} {<false>} {(SQ <'force overwrite'>)} {<f>})
    (C {<DEFINE_string>} {<output_dir>} {(DQ (${ Id.VSub_Name TMPDIR))} {(SQ <'output dir'>)} {<d>})
    (C {<DEFINE_string>} {<output_file>} 
      {(DQ (${ Id.VSub_Name os_name) <-> (${ Id.VSub_Name os_version) <.txt>)} {(SQ <'output file'>)} {<o>}
    )
    (C {<DEFINE_string>} {<runner>} {(SQ <test_runner>)} {(SQ <'unit test runner'>)} {<r>})
    (C {<DEFINE_boolean>} {<dry_run>} {<false>} {(DQ <'suppress logging to a file'>)} {<n>})
    (command.ShFunction
      name: main
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:output)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (braced_var_sub
                          token: <Id.VSub_Name FLAGS_output_dir>
                          suffix_op: 
                            (suffix_op.Unary
                              op_id: Id.VTest_ColonPlus
                              arg_word: {(${ Id.VSub_Name FLAGS_output_dir) <Id.Lit_Slash />}
                            )
                        ) (${ Id.VSub_Name FLAGS_output_file)
                      )
                    }
                  spids: [306]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:output)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [(C {<shlib_relToAbsPath>} {(DQ (${ Id.VSub_Name output))})]
                          )
                      )
                    }
                  spids: [322]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name FLAGS_dry_run))} {<-eq>} 
                          {(DQ (${ Id.VSub_Name FLAGS_FALSE))} {<-a>} {<-f>} {(DQ (${ Id.VSub_Name output))} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name FLAGS_force))} {<-eq>} 
                                  {(DQ (${ Id.VSub_Name FLAGS_TRUE))} {<Id.Lit_RBracket ']'>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                          action: [(C {<rm>} {<-f>} {(DQ (${ Id.VSub_Name output))})]
                          spids: [373 394]
                        )
                      ]
                      else_action: [
                        (command.Simple
                          words: [{<echo>} {(DQ <"not overwriting '"> (${ Id.VSub_Name output) <"'">)}]
                          redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                        )
                        (command.ControlFlow
                          token: <Id.ControlFlow_Exit exit>
                          arg_word: {(DQ (${ Id.VSub_Name FLAGS_ERROR))}
                        )
                      ]
                    )
                  ]
                  spids: [339 370]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name FLAGS_dry_run))} {<-eq>} 
                          {(DQ (${ Id.VSub_Name FLAGS_FALSE))} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.Simple
                          words: [{<touch>} {(DQ (${ Id.VSub_Name output))}]
                          redirects: [
                            (redir.Redir
                              op: <Id.Redir_Great '2>'>
                              fd: 2
                              arg_word: {</dev/null>}
                            )
                          ]
                        )
                        (C {<die>} {(DQ <"unable to write to '"> (${ Id.VSub_Name output) <"'">)})
                      ]
                    )
                  ]
                  spids: [440 461]
                )
              ]
            )
            (command.Subshell
              command_list: 
                (command.CommandList
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name FLAGS_dry_run))} 
                                  {<-eq>} {(DQ (${ Id.VSub_Name FLAGS_FALSE))} {<Id.Lit_RBracket ']'>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                          action: [
                            (command.Pipeline
                              children: [
                                (C {(DQ <./> (${ Id.VSub_Name FLAGS_runner))})
                                (C {<tee>} {(DQ (${ Id.VSub_Name output))})
                              ]
                              negated: F
                            )
                          ]
                          spids: [499 520]
                        )
                      ]
                      else_action: [(C {(DQ <./> (${ Id.VSub_Name FLAGS_runner))})]
                    )
                  ]
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name FLAGS_dry_run))} {<-eq>} 
                          {(DQ (${ Id.VSub_Name FLAGS_FALSE))} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [{<echo>}]
                      redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                    )
                    (command.Simple
                      words: [{<echo>} {(DQ <"Output written to '"> (${ Id.VSub_Name output) <"'.">)}]
                      redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                    )
                  ]
                  spids: [558 579]
                )
              ]
            )
          ]
        )
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<FLAGS>} {(DQ ($ Id.VSub_At '$@'))})
        (command.ControlFlow
          token: <Id.ControlFlow_Exit exit>
          arg_word: {($ Id.VSub_QMark '$?')}
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name FLAGS_help))} {<-eq>} 
          {(DQ (${ Id.VSub_Name FLAGS_FALSE))} {<Id.Lit_RBracket ']'>}
        )
        (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
      ]
    )
    (C {<eval>} {<Id.KW_Set set>} {<-->} {(DQ (${ Id.VSub_Name FLAGS_ARGV))})
    (C {<main>} 
      {
        (DQ 
          (braced_var_sub
            token: <Id.VSub_At '@'>
            suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:(word.Empty))
          )
        )
      }
    )
  ]
)