(command.CommandList
  children: [
    (command.AndOr
      ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
      children: [
        (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_Number 2))} 
          {<Id.Lit_RBracket ']'>}
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'REBUILD='> name:REBUILD)
              op: assign_op.Equal
              rhs: {(DQ ($ Id.VSub_Number 2))}
              spids: [77]
            )
          ]
          redirects: []
        )
        (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-e>} {(DQ ($ Id.VSub_Number 2)) <.sh>} 
          {<Id.Lit_RBracket ']'>}
        )
        (C {<echo>} {(DQ <'no stage '> ($ Id.VSub_Number 2))})
        (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.AndOr
                  ops: [Id.Op_DPipe Id.Op_DPipe]
                  children: [
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '#')} {<-lt>} {<1>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '#')} {<-gt>} {<2>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-e>} 
                      {<'sources/targets/'> (DQ ($ Id.VSub_Number 1))} {<Id.Lit_RBracket ']'>}
                    )
                  ]
                )
              ]
            )
          action: [
            (C {<echo>})
            (C {<echo>} {(DQ <'Usage: '> ($ Id.VSub_Number 0) <' TARGET [REBUILD_FROM_STAGE]'>)})
            (C {<echo>})
            (C {<echo>} {(DQ <'Supported architectures:'>)})
            (C {<ls>} {<'sources/targets'>})
            (C {<echo>})
            (C {<echo>} {(DQ <'Build stages:'>)})
            (command.Pipeline
              children: [
                (C {<sed>} {<-n>} {(SQ <'s/#.*//;s@.*[.]/\\([^.]*\\)[.]sh.*@\\1@p'>)} 
                  {(DQ ($ Id.VSub_Number 0))}
                )
                (C {<uniq>})
                (C {<xargs>} {<echo>})
              ]
              negated: F
              stderr_indices: []
            )
            (C {<echo>})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [114 153]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ARCH='> name:ARCH)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_Number 1))}
          spids: [226]
        )
      ]
      redirects: []
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<Id.Lit_LBracket '['>} {<-e>} {<config>} {<Id.Lit_RBracket ']'>})
        (C {<source>} {<config>})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName BUILD))} {<Id.Lit_RBracket ']'>})
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'BUILD='> name:BUILD)
              op: assign_op.Equal
              rhs: {(DQ <build>)}
              spids: [270]
            )
          ]
          redirects: []
        )
      ]
    )
    (command.ShFunction
      name: not_already
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName AGAIN))} 
                  {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {(DQ ($ Id.VSub_Number 1))} {<Id.Lit_RBracket ']'>}
                )
                (command.ControlFlow
                  token: <Id.ControlFlow_Return return>
                  arg_word: {<0>}
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName REBUILD))} 
                  {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {(DQ ($ Id.VSub_Number 1))} {<Id.Lit_RBracket ']'>}
                )
                (C {<zap>} {(DQ ($ Id.VSub_Number 1))})
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (C {<Id.Lit_LBracket '['>} {<-f>} 
                          {
                            (DQ ($ Id.VSub_DollarName BUILD) <'/'> ($ Id.VSub_Number 1) <-> 
                              ($ Id.VSub_DollarName ARCH) <.tar.gz>
                            )
                          } {<Id.Lit_RBracket ']'>}
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'=== Skipping '> ($ Id.VSub_Number 1) <-> ($ Id.VSub_DollarName ARCH) 
                          <' (already there)'>
                        )
                      }
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [344 362]
                )
              ]
              else_action: []
              redirects: []
            )
            (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: zap
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ForEach
              iter_names: [i]
              iterable: (for_iter.Words words:[{(DQ ($ Id.VSub_At '@'))}])
              body: 
                (command.DoGroup
                  children: [
                    (C {<rm>} {<-f>} 
                      {
                        (DQ ($ Id.VSub_DollarName BUILD) <'/'> ($ Id.VSub_DollarName i) <-> 
                          ($ Id.VSub_DollarName ARCH) <.tar.gz>
                        )
                      }
                    )
                  ]
                )
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: do_stage
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'STAGE='> name:STAGE)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number 1))}
                  spids: [442]
                )
              ]
              redirects: []
            )
            (C {<shift>})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName AFTER))} 
                          {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName STAGE))} {<Id.Lit_RBracket ']'>}
                        )
                      ]
                    )
                  action: [(C {<unset>} {<AFTER>})]
                  spids: [452 470]
                )
              ]
              else_action: [
                (command.AndOr
                  ops: [Id.Op_DPipe]
                  children: [
                    (command.TimeBlock
                      pipeline: 
                        (C {<'./'> (DQ ($ Id.VSub_DollarName STAGE)) <.sh>} {(DQ ($ Id.VSub_At '@'))})
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                )
              ]
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (C {<do_stage>} {<download>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName NO_HOST_TOOLS))} 
                  {<Id.Lit_RBracket ']'>}
                )
              ]
            )
          action: [(C {<do_stage>} {<host-tools>})]
          spids: [537 549]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.AndOr
                  ops: [Id.Op_DAmp]
                  children: [
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName MY_CROSS_PATH))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                    (C {<not_already>} {<simple-cross-compiler>})
                  ]
                )
              ]
            )
          action: [
            (C {<zap>} {<root-filesystem>} {<cross-compiler>} {<native-compiler>})
            (C {<do_stage>} {<simple-cross-compiler>} {(DQ ($ Id.VSub_DollarName ARCH))})
          ]
          spids: [563 581]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.AndOr
                  ops: [Id.Op_DAmp Id.Op_DAmp]
                  children: [
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName MY_CROSS_PATH))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-z>} 
                      {(DQ ($ Id.VSub_DollarName CROSS_COMPILER_HOST))} {<Id.Lit_RBracket ']'>}
                    )
                    (C {<not_already>} {<cross-compiler>})
                  ]
                )
              ]
            )
          action: [
            (C {<zap>} {<root-filesystem>} {<native-compiler>})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Simple
                          words: [{<not_already>} {<simple-cross-compiler>}]
                          redirects: []
                          more_env: [
                            (env_pair
                              name: ARCH
                              val: {(DQ ($ Id.VSub_DollarName CROSS_COMPILER_HOST))}
                              spids: [671]
                            )
                          ]
                          do_fork: T
                        )
                      ]
                    )
                  action: [
                    (C {<do_stage>} {<simple-cross-compiler>} 
                      {(DQ ($ Id.VSub_DollarName CROSS_COMPILER_HOST))}
                    )
                  ]
                  spids: [669 681]
                )
              ]
              else_action: []
              redirects: []
            )
            (C {<do_stage>} {<cross-compiler>} {(DQ ($ Id.VSub_DollarName ARCH))})
          ]
          spids: [620 653]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Pipeline
                  children: [
                    (C {<grep>} {<-q>} {<Id.Lit_VarLike 'KARCH='>} 
                      {<'sources/targets/'> (DQ ($ Id.VSub_DollarName ARCH))}
                    )
                  ]
                  negated: T
                  stderr_indices: []
                )
              ]
            )
          action: [
            (C {<echo>} {<no>} {<KARCH>} {<Id.KW_In in>} {($ Id.VSub_Number 1) <Id.Lit_Comma ','>} 
              {<stopping>} {<here>}
            )
          ]
          spids: [708 723]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: (condition.Shell commands:[(C {<not_already>} {<root-filesystem>})])
          action: [(C {<do_stage>} {<root-filesystem>} {(DQ ($ Id.VSub_DollarName ARCH))})]
          spids: [748 754]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.AndOr
                  ops: [Id.Op_DAmp Id.Op_DAmp]
                  children: [
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName MY_CROSS_PATH))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                    (command.Pipeline
                      children: [
                        (C {<grep>} {<-q>} {<ELF2FLT>} 
                          {<'sources/targets/'> (DQ ($ Id.VSub_DollarName ARCH))}
                        )
                      ]
                      negated: T
                      stderr_indices: []
                    )
                    (C {<not_already>} {<native-compiler>})
                  ]
                )
              ]
            )
          action: [(C {<do_stage>} {<native-compiler>} {(DQ ($ Id.VSub_DollarName ARCH))})]
          spids: [779 813]
        )
      ]
      else_action: []
      redirects: []
    )
    (C {<do_stage>} {<system-image>} {(DQ ($ Id.VSub_DollarName ARCH))})
  ]
)