(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Pound '$#'))} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<3>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'Usage: add-memzip.sh input.hex output.hex file-directory'>)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [4 20]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:input_hex)
          op: assign_op.Equal
          rhs: {($ Id.VSub_Number '$1')}
          spids: [41]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:output_hex)
          op: assign_op.Equal
          rhs: {($ Id.VSub_Number '$2')}
          spids: [44]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:memzip_src_dir)
          op: assign_op.Equal
          rhs: {($ Id.VSub_Number '$3')}
          spids: [47]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:input_bin)
          op: assign_op.Equal
          rhs: {(${ Id.VSub_Name input_hex) <.bin>}
          spids: [51]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:output_bin)
          op: assign_op.Equal
          rhs: {(${ Id.VSub_Name output_hex) <.bin>}
          spids: [57]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:zip_file)
          op: assign_op.Equal
          rhs: {(${ Id.VSub_Name output_hex) <.zip>}
          spids: [63]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:zip_base)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<basename>} {(${ Id.VSub_Name zip_file)})
              )
            }
          spids: [69]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:zip_dir)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<dirname>} {(${ Id.VSub_Name zip_file)})
              )
            }
          spids: [78]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:abs_zip_dir)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<realpath>} {(${ Id.VSub_Name zip_dir)})
              )
            }
          spids: [87]
        )
      ]
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name zip_file)})
    (command.Subshell
      child: 
        (command.CommandList
          children: [
            (command.Sentence
              child: (C {<cd>} {(${ Id.VSub_Name memzip_src_dir)})
              terminator: <Id.Op_Semi _>
            )
            (C {<zip>} {<-0>} {<-r>} {<-D>} 
              {(${ Id.VSub_Name abs_zip_dir) <'/'> (${ Id.VSub_Name zip_base)} {<.>}
            )
          ]
        )
    )
    (C {<objcopy>} {<-I>} {<ihex>} {<-O>} {<binary>} {(${ Id.VSub_Name input_hex)} 
      {(${ Id.VSub_Name input_bin)}
    )
    (command.Simple
      words: [{<cat>} {(${ Id.VSub_Name input_bin)} {(${ Id.VSub_Name zip_file)}]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {(${ Id.VSub_Name output_bin)}
        )
      ]
      do_fork: T
    )
    (C {<objcopy>} {<-I>} {<binary>} {<-O>} {<ihex>} {(${ Id.VSub_Name output_bin)} 
      {(${ Id.VSub_Name output_hex)}
    )
    (C {<echo>} 
      {
        (DQ <'Added '> (${ Id.VSub_Name memzip_src_dir) <' to '> (${ Id.VSub_Name input_hex) 
          <' creating '> (${ Id.VSub_Name output_hex)
        )
      }
    )
  ]
)