// File: /workspace/github_c_makefile_star2_O0/kopytjuk[P]wasm-image-converter/src/main.cpp
// Function: main
int main ( int argc, char *argv[] )
{
  string input_filename(argv[1]);
  string output_filename(argv[2]);

  int insize = utils::filesize(input_filename);
  cout << insize << endl;

  char *indata = new char[insize];

  utils::print_first_bytes(indata, 10);

  string inext = utils::getExtension(input_filename);
  ImageType intype = resolveImageType(inext);

  utils::read_file_to_char_array(input_filename, indata, insize);


  utils::print_first_bytes(indata, 10);

  // output

  char *outdata;
  int outsize;

  string outext = utils::getExtension(output_filename);
  ImageType outtype = resolveImageType(outext);

  convert_image(&indata, insize, intype, &outdata, outsize, outtype);

  cout << "Output file: " << to_string(outsize) << "B" << endl;

  utils::write_char_array_to_file(output_filename, outdata, outsize);

  cout << "Done!" << endl;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x59c0
movq -0x1e8(%rbp), %rsi
movq -0x1e0(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x6170
jmp 0x5c81
leaq -0x31(%rbp), %rdi
callq 0x5600
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x59c0
movq -0x1f8(%rbp), %rsi
movq -0x1f0(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x6170
jmp 0x5cc2
leaq -0x69(%rbp), %rdi
callq 0x5600
leaq -0x90(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5290
jmp 0x5cdd
leaq -0x90(%rbp), %rdi
callq 0x210f0
movl %eax, -0x1fc(%rbp)
jmp 0x5cf1
leaq -0x90(%rbp), %rdi
callq 0x5390
movl -0x1fc(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %esi
movq 0x2e2c0(%rip), %rdi     # 0x33fd0
callq 0x5960
movq %rax, -0x208(%rbp)
jmp 0x5d1e
movq -0x208(%rbp), %rdi
movq 0x2e284(%rip), %rsi     # 0x33fb0
callq 0x55d0
jmp 0x5d33
movslq -0x70(%rbp), %rdi
callq 0x5040
movq %rax, -0x210(%rbp)
jmp 0x5d45
movq -0x210(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
movl $0xa, %esi
callq 0x20f60
jmp 0x5d66
leaq -0xd8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5290
jmp 0x5d78
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x20fc0
jmp 0x5d8d
leaq -0xd8(%rbp), %rdi
callq 0x5390
leaq -0x100(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x5290
jmp 0x5dae
leaq -0x100(%rbp), %rdi
callq 0x67d0
movl %eax, -0x214(%rbp)
jmp 0x5dc2
leaq -0x100(%rbp), %rdi
callq 0x5390
movl -0x214(%rbp), %eax
movl %eax, -0xdc(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5290
jmp 0x5dec
movq -0x98(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0x120(%rbp), %rdi
callq 0x20e70
jmp 0x5e04
leaq -0x120(%rbp), %rdi
callq 0x5390
movq -0x98(%rbp), %rdi
movl $0xa, %esi
callq 0x20f60
jmp 0x5e23
leaq -0x170(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5290
jmp 0x5e35
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x20fc0
jmp 0x5e4a
leaq -0x170(%rbp), %rdi
callq 0x5390
leaq -0x198(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x5290
jmp 0x5e6b
leaq -0x198(%rbp), %rdi
callq 0x67d0
movl %eax, -0x218(%rbp)
jmp 0x5e7f
leaq -0x198(%rbp), %rdi
callq 0x5390
movl -0x218(%rbp), %eax
movl %eax, -0x174(%rbp)
movl -0xdc(%rbp), %edx
movl -0x174(%rbp), %r9d
leaq -0x98(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x128(%rbp), %rcx
leaq -0x12c(%rbp), %r8
callq 0x6850
jmp 0x5ec4
movq 0x2e105(%rip), %rdi     # 0x33fd0
leaq 0x1c132(%rip), %rsi     # 0x22004
callq 0x5570
movq %rax, -0x220(%rbp)
jmp 0x5ee0
movl -0x12c(%rbp), %esi
leaq -0x1b8(%rbp), %rdi
callq 0x6220
jmp 0x5ef4
movq -0x220(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x5510
movq %rax, -0x228(%rbp)
jmp 0x5f10
movq -0x228(%rbp), %rdi
leaq 0x1c0f4(%rip), %rsi     # 0x22012
callq 0x5570
movq %rax, -0x230(%rbp)
jmp 0x5f2c
movq -0x230(%rbp), %rdi
movq 0x2e076(%rip), %rsi     # 0x33fb0
callq 0x55d0
jmp 0x5f41
leaq -0x1b8(%rbp), %rdi
callq 0x5390
leaq -0x1d8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5290
jmp 0x5f5f
movq -0x128(%rbp), %rsi
movl -0x12c(%rbp), %edx
leaq -0x1d8(%rbp), %rdi
callq 0x21020
jmp 0x5f7a
leaq -0x1d8(%rbp), %rdi
callq 0x5390
movq 0x2e043(%rip), %rdi     # 0x33fd0
leaq 0x1c080(%rip), %rsi     # 0x22014
callq 0x5570
movq %rax, -0x238(%rbp)
jmp 0x5fa2
movq -0x238(%rbp), %rdi
movq 0x2e000(%rip), %rsi     # 0x33fb0
callq 0x55d0
jmp 0x5fb7
movl $0x0, -0x4(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x5390
leaq -0xb8(%rbp), %rdi
callq 0x5390
leaq -0x68(%rbp), %rdi
callq 0x5390
leaq -0x30(%rbp), %rdi
callq 0x5390
movl -0x4(%rbp), %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x5600
jmp 0x615c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x5600
jmp 0x6153
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x614a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5390
jmp 0x614a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x5390
jmp 0x614a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x613e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x5390
jmp 0x613e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x5390
jmp 0x613e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x5390
jmp 0x613e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6132
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x5390
jmp 0x6132
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x5390
jmp 0x6132
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x5390
leaq -0x150(%rbp), %rdi
callq 0x5390
leaq -0xb8(%rbp), %rdi
callq 0x5390
leaq -0x68(%rbp), %rdi
callq 0x5390
leaq -0x30(%rbp), %rdi
callq 0x5390
movq -0x40(%rbp), %rdi
callq 0x59b0
nopw %cs:(%rax,%rax)
nop