(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_Pound '$#'))} 
                  {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(3)} {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:18)
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Usage: add-memzip.sh input.hex output.hex file-directory'))})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:30)
              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: (Token id:Id.Left_DollarParen val:'$(' span_id:70)
                command_list: 
                  (command.CommandList
                    children: [(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: (Token id:Id.Left_DollarParen val:'$(' span_id:79)
                command_list: 
                  (command.CommandList
                    children: [(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: (Token id:Id.Left_DollarParen val:'$(' span_id:88)
                command_list: 
                  (command.CommandList
                    children: [(C {(realpath)} {(${ Id.VSub_Name zip_dir)})]
                  )
              )
            }
          spids: [87]
        )
      ]
    )
    (C {(rm)} {(-f)} {(${ Id.VSub_Name zip_file)})
    (command.Subshell
      command_list: 
        (command.CommandList
          children: [
            (command.Sentence
              child: (C {(cd)} {(${ Id.VSub_Name memzip_src_dir)})
              terminator: (Token id:Id.Op_Semi val:';' span_id:111)
            )
            (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.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:160)
          fd: -1
          arg_word: {(${ Id.VSub_Name output_bin)}
        )
      ]
    )
    (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)
        )
      }
    )
  ]
)