(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-ne>} {<1>} {<Id.Lit_RBracket ']'>})
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'usage: '> ($ Id.VSub_Number '$0') <' CONTROL_IMAGE'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [22 34]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-f>} {(DQ ($ Id.VSub_Number '$1'))} 
                  {<Id.Lit_RBracket ']'>}
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'Filesystem image '> ($ Id.VSub_Number '$1') <' missing'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [56 70]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:HDCFILE)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<readlink>} {<-f>} {($ Id.VSub_Number '$1')})
                )
              )
            }
          spids: [91]
        )
      ]
    )
    (C {<INCLUDE>} {<unique-port.sh>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$FTP_SERVER'))} 
                  {<Id.Lit_RBracket ']'>}
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:FTP_SERVER)
                  op: assign_op.Equal
                  rhs: {<127.0.0.1>}
                  spids: [127]
                )
              ]
            )
          ]
          spids: [112 124]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$FTP_PORT'))} 
                  {<Id.Lit_RBracket ']'>}
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:FTP_PORT)
                  op: assign_op.Equal
                  rhs: {<21>}
                  spids: [145]
                )
              ]
            )
          ]
          spids: [130 142]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$FTP_PORT'))} 
                  {<Id.Lit_RBracket ']'>}
                )
              ]
            )
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (C {<Id.Lit_LBracket '['>} {<-z>} 
                          {
                            (DQ 
                              (command_sub
                                left_token: <Id.Left_DollarParen '$('>
                                child: (C {<which>} {<toybox>})
                              )
                            )
                          } {<Id.Lit_RBracket ']'>}
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [{<echo>} {(DQ <'Warning: can\'t find toybox, no ftp daemon launched.'>)}]
                      redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                      do_fork: T
                    )
                  ]
                  spids: [166 183]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:FTP_PORT)
                      op: assign_op.Equal
                      rhs: 
                        {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<unique_port>}))}
                      spids: [199]
                    )
                  ]
                )
                (C {<echo>} {<Id.Lit_Equals '='> <Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<launching>} 
                  {<FTP>} {<daemon>} {<on>} {<port>} {(DQ ($ Id.VSub_DollarName '$FTP_PORT'))}
                )
                (C {<mkdir>} {<-p>} {<upload>})
                (command.Sentence
                  child: 
                    (C {<toybox>} {<nc>} {<-s>} {<127.0.0.1>} {<-p>} {($ Id.VSub_DollarName '$FTP_PORT')} 
                      {<-L>} {<busybox>} {<ftpd>} {<-w>} {<upload>}
                    )
                  terminator: <Id.Op_Amp _>
                )
                (C {<trap>} 
                  {
                    (DQ <'kill '> 
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<jobs>} {<-p>})
                      )
                    )
                  } {<EXIT>}
                )
                (C {<disown>} 
                  {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<jobs>} {<-p>}))}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:FTP_SERVER)
                      op: assign_op.Equal
                      rhs: {<10.0.2.2>}
                      spids: [302]
                    )
                  ]
                )
              ]
            )
          ]
          spids: [151 163]
        )
      ]
    )
    (C {<export>} {<Id.Lit_VarLike 'HDC='> (DQ ($ Id.VSub_DollarName '$HDCFILE'))})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:NATIVE_BUILD)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {(DQ ($ Id.VSub_DollarName '$HDCFILE'))})
                        (C {<sed>} {<-e>} {(SQ <'s@.*/@@'>)} {<-e>} {(SQ <'s@[.]hdc$@@'>)})
                      ]
                      negated: F
                    )
                )
              )
            }
          spids: [325]
        )
      ]
    )
    (C {<export>} 
      {<Id.Lit_VarLike 'KERNEL_EXTRA='> 
        (DQ <'FTP_SERVER='> ($ Id.VSub_DollarName '$FTP_SERVER') <' FTP_PORT='> 
          ($ Id.VSub_DollarName '$FTP_PORT') <' NATIVE_BUILD='> ($ Id.VSub_DollarName '$NATIVE_BUILD') <' '> ($ Id.VSub_DollarName '$KERNEL_EXTRA')
        )
      }
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$HDB'))} {<Id.Lit_RBracket ']'>})
        (C {<rm>} {<-f>} {<hdb.img>})
      ]
    )
    (C {<'./dev-environment.sh'>})
    (C {<echo>} {<Id.Lit_Equals '='> <Id.Lit_Equals '='> <Id.Lit_Equals '='>} {<End>} {<native>} {<build>})
  ]
)