#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fread_wrapper(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *, int *, long,
                  char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ strncpy(char *, char *, int);
int strtoul(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i;
  uint32_t bin_offset = 0;
  uint32_t hex_offset = 0;
  uint32_t length = (1 << 30);
  int eof = 1;
  int segment = -1;
  int append = 0;
  int help = 0;
  int unnamed = 0;
  int add_length = 0;
  char name_in[1024];
  char name_out[1024];
  char version[16];
  unsigned char buffer[64], b1, b2, ch;
  FILE *fi, *fo;
  if (argc == 1)
    help = 1;
  memset(version, 0, 16);
  for (i = 1; i < argc; i++) {
    if (argv[i][0] == '-') {
      switch (argv[i][1]) {
      case 'i':
        if (i != (argc - 1)) {
          bin_offset = strtoul(argv[i + 1], 0, 0);
          i++;
        } else {
          printf("-i option: no offset given.\n");
          exit(1);
        }
        break;
      case 'h':
        help = 1;
        break;
      case 'o':
        if (i != (argc - 1)) {
          hex_offset = strtoul(argv[i + 1], 0, 0);
          i++;
        } else {
          printf("-o option: no offset given.\n");
          exit(1);
        }
        break;
      case 'l':
        if (i != (argc - 1)) {
          length = strtoul(argv[i + 1], 0, 0);
          i++;
        } else {
          printf("-l option: no length given.\n");
          exit(1);
        }
        break;
      case 't':
        eof = 0;
        break;
      case 'a':
        append = 1;
        break;
      case 'v':
        if (i != (argc - 1)) {
          strncpy(version, argv[i + 1], 11);
          i++;
        } else {
          printf("-v option: no string given.\n");
          exit(1);
        }
        break;
      case 'z':
        add_length = 1;
        break;
      case 'Z':
        add_length = 2;
        break;
      default:
        printf("Unknown option %s given.\n", argv[i]);
        exit(2);
      }
    } else {
      switch (unnamed) {
      case 0:
        strncpy(name_in, argv[i], 1024);
        break;
      case 1:
        strncpy(name_out, argv[i], 1024);
        break;
      default:
        printf("Superfluous argument %s.\n", argv[i]);
        exit(3);
      }
      unnamed++;
    }
  }
  if (help) {
    fprintf(stderr,
            "Usage: %s [-i <bin offset>] [-o <hex offset>] [-l <length>] "
            "\n\t\t[-h] [-t] [-z/Z] [-a] <infile> <outfile>\n",
            argv[0]);
    fprintf(stderr, "\t-h shows this help.\n");
    fprintf(stderr, "\t-t omits the end record.\n");
    fprintf(stderr, "\t-z adds file length word in little endian.\n");
    fprintf(stderr, "\t-Z adds file length word in big endian.\n");
    fprintf(stderr, "\t-a appends to the existing hex file.\n");
    return 1;
  }
  fi = fopen(name_in, "rb");
  if (!fi) {
    fprintf(stderr, "Can't open '%s' as input.\n", name_in);
    exit(-1);
  }
  fo = fopen(name_out, (append) ? "at" : "wt");
  if (!fo) {
    fprintf(stderr, "Can't open '%s' as output.\n", name_out);
    exit(-1);
  }
  long file_size = 0;
  if (add_length) {
    fseek(fi, 0L, SEEK_END);
    file_size = ftell(fi);
  }
  fseek(fi, bin_offset, SEEK_SET);
  int bytes_in_segment;
  int bytes_read;
  int bytes_to_read;
  int seg_flag = 0;
  while (length && !feof(fi)) {
    bytes_in_segment = 65536 - (hex_offset & 0xFFFF);
    if ((bytes_in_segment == 65536) || (segment == -1)) {
      segment = (hex_offset >> 16);
      b1 = (segment & 0xFF);
      b2 = (segment >> 8) & 0xFF;
      ch = 0xFA - b1 - b2;
      seg_flag = 1;
    }
    bytes_to_read = (bytes_in_segment > 32) ? 32 : bytes_in_segment;
    bytes_read = fread_wrapper((uint8_t *)buffer, bytes_to_read, fi,
                               &add_length, file_size, version);
    if (bytes_read) {
      if (seg_flag) {
        fprintf(fo, ":02000004%04X%02X\n", segment, ch);
        seg_flag = 0;
      }
      fprintf(fo, ":%02X%04X00", bytes_read, hex_offset & 0xFFFF);
      b1 = (hex_offset & 0xFF);
      b2 = (hex_offset >> 8) & 0xFF;
      ch = 0 + bytes_read + b1 + b2;
      for (i = 0; i < bytes_read; i++) {
        fprintf(fo, "%02X", buffer[i]);
        ch += buffer[i];
      }
      ch = ~ch + 1;
      fprintf(fo, "%02X\n", ch);
    }
    hex_offset += bytes_read;
    length -= bytes_read;
  }
  if (eof) {
    fprintf(fo, ":00000001FF\n");
  }
  fclose(fo);
  fclose(fi);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x40000000,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0xffffffff,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1229 <main+0x69>
movl   $0x1,-0x30(%rbp)
lea    -0x850(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    151f <main+0x35f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1471 <main+0x2b1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
add    $0xffffffa6,%eax
mov    %eax,%ecx
mov    %rcx,-0x8c8(%rbp)
sub    $0x20,%eax
ja     1448 <main+0x288>
mov    -0x8c8(%rbp),%rax
lea    0xd66(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     12df <main+0x11f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10c0 <strtoul@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12f7 <main+0x137>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    146c <main+0x2ac>
movl   $0x1,-0x30(%rbp)
jmp    146c <main+0x2ac>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1344 <main+0x184>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10c0 <strtoul@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    135c <main+0x19c>
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    146c <main+0x2ac>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     139d <main+0x1dd>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10c0 <strtoul@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13b5 <main+0x1f5>
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    146c <main+0x2ac>
movl   $0x0,-0x24(%rbp)
jmp    146c <main+0x2ac>
movl   $0x1,-0x2c(%rbp)
jmp    146c <main+0x2ac>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1413 <main+0x253>
lea    -0x850(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    142b <main+0x26b>
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    146c <main+0x2ac>
movl   $0x1,-0x38(%rbp)
jmp    146c <main+0x2ac>
movl   $0x2,-0x38(%rbp)
jmp    146c <main+0x2ac>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
jmp    150c <main+0x34c>
mov    -0x34(%rbp),%eax
mov    %eax,-0x8cc(%rbp)
test   %eax,%eax
je     149b <main+0x2db>
jmp    1487 <main+0x2c7>
mov    -0x8cc(%rbp),%eax
sub    $0x1,%eax
je     14bd <main+0x2fd>
jmp    14df <main+0x31f>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
jmp    1503 <main+0x343>
lea    -0x840(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
jmp    1503 <main+0x343>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x3,%edi
call   10d0 <exit@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1511 <main+0x351>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1243 <main+0x83>
cmpl   $0x0,-0x30(%rbp)
je     15cc <main+0x40c>
mov    0x2aa8(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xbeb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a89(%rip),%rax
mov    (%rax),%rdi
lea    0xc3c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a71(%rip),%rax
mov    (%rax),%rdi
lea    0xc3a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a59(%rip),%rax
mov    (%rax),%rdi
lea    0xc3d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a41(%rip),%rax
mov    (%rax),%rdi
lea    0xc52(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a29(%rip),%rax
mov    (%rax),%rdi
lea    0xc64(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1997 <main+0x7d7>
lea    -0x440(%rbp),%rdi
lea    0xc6a(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x8a0(%rbp)
cmpq   $0x0,-0x8a0(%rbp)
jne    161d <main+0x45d>
mov    0x29dd(%rip),%rax
mov    (%rax),%rdi
lea    -0x440(%rbp),%rdx
lea    0xc3b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    -0x840(%rbp),%rdi
mov    -0x2c(%rbp),%ecx
lea    0xc37(%rip),%rsi
lea    0xc2d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x8a8(%rbp)
cmpq   $0x0,-0x8a8(%rbp)
jne    167f <main+0x4bf>
mov    0x297b(%rip),%rax
mov    (%rax),%rdi
lea    -0x840(%rbp),%rdx
lea    0xbfa(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
movq   $0x0,-0x8b0(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     16be <main+0x4fe>
mov    -0x8a0(%rbp),%rdi
mov    0x2946(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x8a0(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x8b0(%rbp)
mov    -0x8a0(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2901(%rip),%rax
mov    (%rax),%edx
call   10a0 <fseek@plt>
movl   $0x0,-0x8c0(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x20(%rbp)
mov    %al,-0x8cd(%rbp)
je     170c <main+0x54c>
mov    -0x8a0(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x8cd(%rbp)
mov    -0x8cd(%rbp),%al
test   $0x1,%al
jne    171f <main+0x55f>
jmp    1959 <main+0x799>
mov    -0x1c(%rbp),%ecx
and    $0xffff,%ecx
mov    $0x10000,%eax
sub    %ecx,%eax
mov    %eax,-0x8b4(%rbp)
cmpl   $0x10000,-0x8b4(%rbp)
je     174f <main+0x58f>
cmpl   $0xffffffff,-0x28(%rbp)
jne    179e <main+0x5de>
mov    -0x1c(%rbp),%eax
sar    $0x10,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x891(%rbp)
mov    -0x28(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x892(%rbp)
movzbl -0x891(%rbp),%ecx
mov    $0xfa,%eax
sub    %ecx,%eax
movzbl -0x892(%rbp),%ecx
sub    %ecx,%eax
mov    %al,-0x893(%rbp)
movl   $0x1,-0x8c0(%rbp)
cmpl   $0x20,-0x8b4(%rbp)
jle    17bb <main+0x5fb>
mov    $0x20,%eax
mov    %eax,-0x8d4(%rbp)
jmp    17c7 <main+0x607>
mov    -0x8b4(%rbp),%eax
mov    %eax,-0x8d4(%rbp)
mov    -0x8d4(%rbp),%eax
mov    %eax,-0x8bc(%rbp)
lea    -0x890(%rbp),%rdi
mov    -0x8bc(%rbp),%esi
mov    -0x8a0(%rbp),%rdx
mov    -0x8b0(%rbp),%r8
lea    -0x850(%rbp),%r9
lea    -0x38(%rbp),%rcx
call   10e0 <fread_wrapper@plt>
mov    %eax,-0x8b8(%rbp)
cmpl   $0x0,-0x8b8(%rbp)
je     193a <main+0x77a>
cmpl   $0x0,-0x8c0(%rbp)
je     1847 <main+0x687>
mov    -0x8a8(%rbp),%rdi
mov    -0x28(%rbp),%edx
movzbl -0x893(%rbp),%ecx
lea    0xa4e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x8c0(%rbp)
mov    -0x8a8(%rbp),%rdi
mov    -0x8b8(%rbp),%edx
mov    -0x1c(%rbp),%ecx
and    $0xffff,%ecx
lea    0xa33(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x891(%rbp)
mov    -0x1c(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x892(%rbp)
mov    -0x8b8(%rbp),%eax
add    $0x0,%eax
movzbl -0x891(%rbp),%ecx
add    %ecx,%eax
movzbl -0x892(%rbp),%ecx
add    %ecx,%eax
mov    %al,-0x893(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8b8(%rbp),%eax
jge    190b <main+0x74b>
mov    -0x8a8(%rbp),%rdi
movslq -0x14(%rbp),%rax
movzbl -0x890(%rbp,%rax,1),%edx
ff
lea    0x9c8(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movslq -0x14(%rbp),%rax
movzbl -0x890(%rbp,%rax,1),%ecx
ff
movzbl -0x893(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x893(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    18b2 <main+0x6f2>
movzbl -0x893(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
mov    %al,-0x893(%rbp)
mov    -0x8a8(%rbp),%rdi
movzbl -0x893(%rbp),%edx
lea    0x95e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8b8(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8b8(%rbp),%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
jmp    16e0 <main+0x520>
cmpl   $0x0,-0x24(%rbp)
je     1978 <main+0x7b8>
mov    -0x8a8(%rbp),%rdi
lea    0x937(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8a8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x8a0(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x898,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
movl   $0x0,0x2c(%rsp)
xor    %r15d,%r15d
cmp    $0x1,%edi
sete   %r15b
lea    0x40(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <memset@plt>
mov    %rbx,%rdx
cmp    $0x2,%edx
jl     13e0 <main+0x200>
lea    -0x1(%rdx),%eax
mov    %eax,0x10(%rsp)
movl   $0x40000000,0x14(%rsp)
40
mov    $0x1,%r13d
movl   $0x0,0xc(%rsp)
movl   $0x0,0x24(%rsp)
xor    %ebx,%ebx
xor    %r14d,%r14d
mov    %r15d,%r12d
movl   $0x0,0x30(%rsp)
movl   $0x1,0x28(%rsp)
mov    %rdx,0x18(%rsp)
jmp    129e <main+0xbe>
nopl   0x0(%rax)
lea    0x90(%rsp),%rdi
mov    $0x400,%edx
call   1030 <strncpy@plt>
add    $0x1,%r14d
mov    %r12d,%r15d
mov    0x18(%rsp),%rdx
add    $0x1,%r13d
mov    %r15d,%r12d
cmp    %edx,%r13d
jge    140a <main+0x22a>
movslq %r13d,%rax
mov    0x0(%rbp,%rax,8),%rsi
cmpb   $0x2d,(%rsi)
jne    12f0 <main+0x110>
movsbl 0x1(%rsi),%ecx
add    $0xffffffa6,%ecx
cmp    $0x20,%ecx
ja     1730 <main+0x550>
mov    $0x1,%r15d
lea    0xd38(%rip),%rdi
movslq (%rdi,%rcx,4),%rcx
add    %rdi,%rcx
jmp    *%rcx
movl   $0x2,0x2c(%rsp)
movl   $0x2,0xc(%rsp)
mov    %r12d,%r15d
jmp    128e <main+0xae>
cs nopw 0x0(%rax,%rax,1)
lea    0x490(%rsp),%rdi
test   %r14d,%r14d
je     1278 <main+0x98>
cmp    $0x1,%r14d
je     1270 <main+0x90>
jmp    1718 <main+0x538>
movl   $0x1,0x30(%rsp)
mov    %r12d,%r15d
jmp    128e <main+0xae>
cmp    0x10(%rsp),%r13d
je     1748 <main+0x568>
add    $0x1,%r13d
mov    0x8(%rbp,%rax,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <strtoul@plt>
mov    %eax,0x24(%rsp)
jmp    1286 <main+0xa6>
cmp    0x10(%rsp),%r13d
je     1751 <main+0x571>
add    $0x1,%r13d
mov    0x8(%rbp,%rax,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <strtoul@plt>
mov    %eax,0x14(%rsp)
jmp    1286 <main+0xa6>
cmp    0x10(%rsp),%r13d
je     175a <main+0x57a>
add    $0x1,%r13d
mov    0x8(%rbp,%rax,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <strtoul@plt>
mov    %eax,%ebx
jmp    1286 <main+0xa6>
movl   $0x0,0x28(%rsp)
mov    %r12d,%r15d
jmp    128e <main+0xae>
cmp    0x10(%rsp),%r13d
je     1763 <main+0x583>
add    $0x1,%r13d
mov    0x8(%rbp,%rax,8),%rsi
lea    0x40(%rsp),%rdi
mov    $0xb,%edx
call   1030 <strncpy@plt>
jmp    1286 <main+0xa6>
movl   $0x1,0x2c(%rsp)
movl   $0x1,0xc(%rsp)
mov    %r12d,%r15d
jmp    128e <main+0xae>
movl   $0x0,0xc(%rsp)
movl   $0x40000000,0x14(%rsp)
40
movl   $0x1,0x28(%rsp)
movl   $0x0,0x30(%rsp)
xor    %ebx,%ebx
movl   $0x0,0x24(%rsp)
test   %r15d,%r15d
je     14b6 <main+0x2d6>
mov    0x2bbe(%rip),%rbx
mov    (%rbx),%rdi
mov    0x0(%rbp),%rdx
lea    0xc90(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%rcx
lea    0xce8(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    (%rbx),%rcx
lea    0xce5(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    (%rbx),%rcx
lea    0xce7(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    (%rbx),%rcx
lea    0xcfb(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    (%rbx),%rcx
lea    0xd0c(%rip),%rdi
mov    $0x26,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    $0x1,%eax
jmp    1706 <main+0x526>
lea    0xd13(%rip),%rsi
lea    0x490(%rsp),%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1779 <main+0x599>
mov    %rax,%r12
cmpl   $0x0,0x30(%rsp)
lea    0xd0f(%rip),%rax
lea    0xd05(%rip),%rsi
cmove  %rax,%rsi
lea    0x90(%rsp),%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
mov    0x14(%rsp),%r15d
je     1794 <main+0x5b4>
mov    %rax,%r13
cmpl   $0x0,0xc(%rsp)
je     152f <main+0x34f>
mov    0x2acf(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r12,%rdi
call   1090 <ftell@plt>
jmp    1531 <main+0x351>
xor    %eax,%eax
mov    %rax,0x30(%rsp)
mov    0x2a93(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    0x24(%rsp),%esi
call   10b0 <fseek@plt>
test   %r15d,%r15d
je     16d4 <main+0x4f4>
movl   $0xffffffff,0x18(%rsp)
ff
movl   $0x0,0x10(%rsp)
mov    %r12,0x38(%rsp)
jmp    1589 <main+0x3a9>
nopl   0x0(%rax,%rax,1)
mov    %ebp,0x10(%rsp)
add    %r12d,%ebx
mov    %ebx,%eax
mov    %eax,%ebx
sub    %r12d,%r15d
mov    0x38(%rsp),%r12
je     16d4 <main+0x4f4>
mov    %r12,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    16d4 <main+0x4f4>
movzwl %bx,%eax
mov    $0x10000,%esi
sub    %eax,%esi
mov    %eax,0xc(%rsp)
test   %eax,%eax
sete   %al
mov    0x18(%rsp),%ebp
cmp    $0xffffffff,%ebp
sete   %dil
or     %al,%dil
mov    %ebx,%eax
sar    $0x10,%eax
mov    %ebx,%edx
shr    $0x18,%edx
add    %eax,%edx
mov    $0xfa,%cl
sub    %dl,%cl
test   %dil,%dil
cmovne %eax,%ebp
mov    %ebp,0x18(%rsp)
movzbl %cl,%eax
movzbl %r14b,%r14d
cmovne %eax,%r14d
mov    $0x1,%eax
mov    0x10(%rsp),%ebp
cmovne %eax,%ebp
cmp    $0x20,%esi
mov    $0x20,%eax
cmovae %eax,%esi
lea    0x50(%rsp),%rdi
mov    %r12,%rdx
lea    0x2c(%rsp),%rcx
mov    0x30(%rsp),%r8
lea    0x40(%rsp),%r9
call   1100 <fread_wrapper@plt>
mov    %eax,%r12d
test   %eax,%eax
je     1570 <main+0x390>
test   %ebp,%ebp
je     163a <main+0x45a>
movzbl %r14b,%ecx
mov    %r13,%rdi
lea    0xbe1(%rip),%rsi
mov    0x18(%rsp),%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15d,0x14(%rsp)
mov    %r13,%rdi
lea    0xbda(%rip),%rsi
mov    %r12d,%edx
mov    0xc(%rsp),%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    (%r12,%rbx,1),%eax
shr    $0x8,%ebx
add    %eax,%ebx
test   %r12d,%r12d
mov    %eax,0xc(%rsp)
jle    16a5 <main+0x4c5>
mov    %r12d,%r14d
xor    %ebp,%ebp
lea    0xbba(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x50(%rsp,%rbp,1),%edx
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
movzbl 0x50(%rsp,%rbp,1),%eax
movzbl %bl,%ebx
add    %eax,%ebx
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1680 <main+0x4a0>
neg    %bl
movzbl %bl,%edx
movl   $0x0,0x10(%rsp)
mov    %r13,%rdi
lea    0xb61(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,%r14d
mov    0x14(%rsp),%r15d
mov    0xc(%rsp),%eax
jmp    1579 <main+0x399>
cmpl   $0x0,0x28(%rsp)
je     16f4 <main+0x514>
lea    0xb52(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10f0 <fwrite@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x898,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x97f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x3,%edi
call   10e0 <exit@plt>
lea    0x94d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%edi
call   10e0 <exit@plt>
lea    0xb46(%rip),%rdi
jmp    176a <main+0x58a>
lea    0xb05(%rip),%rdi
jmp    176a <main+0x58a>
lea    0xb18(%rip),%rdi
jmp    176a <main+0x58a>
lea    0xad7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2858(%rip),%rax
mov    (%rax),%rdi
lea    0xa49(%rip),%rsi
lea    0x490(%rsp),%rdx
jmp    17ad <main+0x5cd>
mov    0x283d(%rip),%rax
mov    (%rax),%rdi
lea    0xa4f(%rip),%rsi
lea    0x90(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"-i option: no offset given.\0A\00"
@.str.1 = [29 x i8] c"-o option: no offset given.\0A\00"
@.str.2 = [29 x i8] c"-l option: no length given.\0A\00"
@.str.3 = [29 x i8] c"-v option: no string given.\0A\00"
@.str.4 = [26 x i8] c"Unknown option %s given.\0A\00"
@.str.5 = [26 x i8] c"Superfluous argument %s.\0A\00"
@stderr = global i32* null
@.str.6 = [105 x i8] c"Usage: %s [-i <bin offset>] [-o <hex offset>] [-l <length>] \0A\09\09[-h] [-t] [-z/Z] [-a] <infile> <outfile>\0A\00"
@.str.7 = [22 x i8] c"\09-h shows this help.\0A\00"
@.str.8 = [27 x i8] c"\09-t omits the end record.\0A\00"
@.str.9 = [45 x i8] c"\09-z adds file length word in little endian.\0A\00"
@.str.10 = [42 x i8] c"\09-Z adds file length word in big endian.\0A\00"
@.str.11 = [39 x i8] c"\09-a appends to the existing hex file.\0A\00"
@.str.12 = [3 x i8] c"rb\00"
@.str.13 = [27 x i8] c"Can't open '%s' as input.\0A\00"
@.str.14 = [3 x i8] c"at\00"
@.str.15 = [3 x i8] c"wt\00"
@.str.16 = [28 x i8] c"Can't open '%s' as output.\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.17 = [19 x i8] c":02000004%04X%02X\0A\00"
@.str.18 = [12 x i8] c":%02X%04X00\00"
@.str.19 = [5 x i8] c"%02X\00"
@.str.20 = [6 x i8] c"%02X\0A\00"
@.str.21 = [13 x i8] c":00000001FF\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [1024 x i8]
%17 = alloca [1024 x i8]
%18 = alloca [16 x i8]
%19 = alloca [64 x i8]
%20 = alloca i8
%21 = alloca i8
%22 = alloca i8
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i64
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 1073741824, i32* %9
store i32 1, i32* %10
store i32 -1, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %33
32: ; preds = %2
store i32 1, i32* %13
br label %33
33: ; preds = %32, %2
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%35 = call i32 @memset(i8* %34, i32 0, i32 16)
store i32 1, i32* %6
br label %36
36: ; preds = %180, %33
%37 = load i32, i32* %6
%38 = load i32, i32* %4
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %183
40: ; preds = %36
%41 = load i8**, i8*** %5
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8, i8* %45, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 45
br i1 %49, label %50, label %150
50: ; preds = %40
%51 = load i8**, i8*** %5
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
switch i32 %58, label %141 [
i32 105, label %59
i32 104, label %78
i32 111, label %79
i32 108, label %98
i32 116, label %117
i32 97, label %118
i32 118, label %119
i32 122, label %139
i32 90, label %140
]
59: ; preds = %50
%60 = load i32, i32* %6
%61 = load i32, i32* %4
%62 = sub nsw i32 %61, 1
%63 = icmp ne i32 %60, %62
br i1 %63, label %64, label %74
64: ; preds = %59
%65 = load i8**, i8*** %5
%66 = load i32, i32* %6
%67 = add nsw i32 %66, 1
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %65, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @strtoul(i8* %70, i32 0, i32 0)
store i32 %71, i32* %7
%72 = load i32, i32* %6
%73 = add nsw i32 %72, 1
store i32 %73, i32* %6
br label %77
74: ; preds = %59
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %64
br label %149
78: ; preds = %50
store i32 1, i32* %13
br label %149
79: ; preds = %50
%80 = load i32, i32* %6
%81 = load i32, i32* %4
%82 = sub nsw i32 %81, 1
%83 = icmp ne i32 %80, %82
br i1 %83, label %84, label %94
84: ; preds = %79
%85 = load i8**, i8*** %5
%86 = load i32, i32* %6
%87 = add nsw i32 %86, 1
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %85, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @strtoul(i8* %90, i32 0, i32 0)
store i32 %91, i32* %8
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
store i32 %93, i32* %6
br label %97
94: ; preds = %79
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %84
br label %149
98: ; preds = %50
%99 = load i32, i32* %6
%100 = load i32, i32* %4
%101 = sub nsw i32 %100, 1
%102 = icmp ne i32 %99, %101
br i1 %102, label %103, label %113
103: ; preds = %98
%104 = load i8**, i8*** %5
%105 = load i32, i32* %6
%106 = add nsw i32 %105, 1
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8*, i8** %104, i64 %107
%109 = load i8*, i8** %108
%110 = call i32 @strtoul(i8* %109, i32 0, i32 0)
store i32 %110, i32* %9
%111 = load i32, i32* %6
%112 = add nsw i32 %111, 1
store i32 %112, i32* %6
br label %116
113: ; preds = %98
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%115 = call i32 @exit(i32 1)
unreachable
116: ; preds = %103
br label %149
117: ; preds = %50
store i32 0, i32* %10
br label %149
118: ; preds = %50
store i32 1, i32* %12
br label %149
119: ; preds = %50
%120 = load i32, i32* %6
%121 = load i32, i32* %4
%122 = sub nsw i32 %121, 1
%123 = icmp ne i32 %120, %122
br i1 %123, label %124, label %135
124: ; preds = %119
%125 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%126 = load i8**, i8*** %5
%127 = load i32, i32* %6
%128 = add nsw i32 %127, 1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8*, i8** %126, i64 %129
%131 = load i8*, i8** %130
%132 = call i32 @strncpy(i8* %125, i8* %131, i32 11)
%133 = load i32, i32* %6
%134 = add nsw i32 %133, 1
store i32 %134, i32* %6
br label %138
135: ; preds = %119
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %124
br label %149
139: ; preds = %50
store i32 1, i32* %15
br label %149
140: ; preds = %50
store i32 2, i32* %15
br label %149
141: ; preds = %50
%142 = load i8**, i8*** %5
%143 = load i32, i32* %6
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8*, i8** %142, i64 %144
%146 = load i8*, i8** %145
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %146)
%148 = call i32 @exit(i32 2)
unreachable
149: ; preds = %140, %139, %138, %118, %117, %116, %97, %78, %77
br label %179
150: ; preds = %40
%151 = load i32, i32* %14
switch i32 %151, label %168 [
i32 0, label %152
i32 1, label %160
]
152: ; preds = %150
%153 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%154 = load i8**, i8*** %5
%155 = load i32, i32* %6
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8*, i8** %154, i64 %156
%158 = load i8*, i8** %157
%159 = call i32 @strncpy(i8* %153, i8* %158, i32 1024)
br label %176
160: ; preds = %150
%161 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%162 = load i8**, i8*** %5
%163 = load i32, i32* %6
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8*, i8** %162, i64 %164
%166 = load i8*, i8** %165
%167 = call i32 @strncpy(i8* %161, i8* %166, i32 1024)
br label %176
168: ; preds = %150
%169 = load i8**, i8*** %5
%170 = load i32, i32* %6
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8*, i8** %169, i64 %171
%173 = load i8*, i8** %172
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %173)
%175 = call i32 @exit(i32 3)
unreachable
176: ; preds = %160, %152
%177 = load i32, i32* %14
%178 = add nsw i32 %177, 1
store i32 %178, i32* %14
br label %179
179: ; preds = %176, %149
br label %180
180: ; preds = %179
%181 = load i32, i32* %6
%182 = add nsw i32 %181, 1
store i32 %182, i32* %6
br label %36
183: ; preds = %36
%184 = load i32, i32* %13
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %202
186: ; preds = %183
%187 = load i32*, i32** @stderr
%188 = load i8**, i8*** %5
%189 = getelementptr inbounds i8*, i8** %188, i64 0
%190 = load i8*, i8** %189
%191 = call i32 (i32*, i8*, ...) @fprintf(i32* %187, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.6, i64 0, i64 0), i8* %190)
%192 = load i32*, i32** @stderr
%193 = call i32 (i32*, i8*, ...) @fprintf(i32* %192, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%194 = load i32*, i32** @stderr
%195 = call i32 (i32*, i8*, ...) @fprintf(i32* %194, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%196 = load i32*, i32** @stderr
%197 = call i32 (i32*, i8*, ...) @fprintf(i32* %196, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
%198 = load i32*, i32** @stderr
%199 = call i32 (i32*, i8*, ...) @fprintf(i32* %198, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%200 = load i32*, i32** @stderr
%201 = call i32 (i32*, i8*, ...) @fprintf(i32* %200, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %376
202: ; preds = %183
%203 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%204 = call i32* @fopen(i8* %203, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
store i32* %204, i32** %23
%205 = load i32*, i32** %23
%206 = icmp ne i32* %205, null
br i1 %206, label %212, label %207
207: ; preds = %202
%208 = load i32*, i32** @stderr
%209 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%210 = call i32 (i32*, i8*, ...) @fprintf(i32* %208, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i8* %209)
%211 = call i32 @exit(i32 -1)
unreachable
212: ; preds = %202
%213 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%214 = load i32, i32* %12
%215 = icmp ne i32 %214, 0
%216 = zext i1 %215 to i64
%217 = select i1 %215, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0)
%218 = call i32* @fopen(i8* %213, i8* %217)
store i32* %218, i32** %24
%219 = load i32*, i32** %24
%220 = icmp ne i32* %219, null
br i1 %220, label %226, label %221
221: ; preds = %212
%222 = load i32*, i32** @stderr
%223 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%224 = call i32 (i32*, i8*, ...) @fprintf(i32* %222, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i8* %223)
%225 = call i32 @exit(i32 -1)
unreachable
226: ; preds = %212
store i64 0, i64* %25
%227 = load i32, i32* %15
%228 = icmp ne i32 %227, 0
br i1 %228, label %229, label %235
229: ; preds = %226
%230 = load i32*, i32** %23
%231 = load i32, i32* @SEEK_END
%232 = call i32 @fseek(i32* %230, i32 0, i32 %231)
%233 = load i32*, i32** %23
%234 = call i64 @ftell(i32* %233)
store i64 %234, i64* %25
br label %235
235: ; preds = %229, %226
%236 = load i32*, i32** %23
%237 = load i32, i32* %7
%238 = load i32, i32* @SEEK_SET
%239 = call i32 @fseek(i32* %236, i32 %237, i32 %238)
store i32 0, i32* %29
br label %240
240: ; preds = %358, %235
%241 = load i32, i32* %9
%242 = icmp ne i32 %241, 0
br i1 %242, label %243, label %248
243: ; preds = %240
%244 = load i32*, i32** %23
%245 = call i32 @feof(i32* %244)
%246 = icmp ne i32 %245, 0
%247 = xor i1 %246, true
br label %248
248: ; preds = %243, %240
%249 = phi i1 [ false, %240 ], [ %247, %243 ]
br i1 %249, label %250, label %365
250: ; preds = %248
%251 = load i32, i32* %8
%252 = and i32 %251, 65535
%253 = sub nsw i32 65536, %252
store i32 %253, i32* %26
%254 = load i32, i32* %26
%255 = icmp eq i32 %254, 65536
br i1 %255, label %259, label %256
256: ; preds = %250
%257 = load i32, i32* %11
%258 = icmp eq i32 %257, -1
br i1 %258, label %259, label %276
259: ; preds = %256, %250
%260 = load i32, i32* %8
%261 = ashr i32 %260, 16
store i32 %261, i32* %11
%262 = load i32, i32* %11
%263 = and i32 %262, 255
%264 = trunc i32 %263 to i8
store i8 %264, i8* %20
%265 = load i32, i32* %11
%266 = ashr i32 %265, 8
%267 = and i32 %266, 255
%268 = trunc i32 %267 to i8
store i8 %268, i8* %21
%269 = load i8, i8* %20
%270 = zext i8 %269 to i32
%271 = sub nsw i32 250, %270
%272 = load i8, i8* %21
%273 = zext i8 %272 to i32
%274 = sub nsw i32 %271, %273
%275 = trunc i32 %274 to i8
store i8 %275, i8* %22
store i32 1, i32* %29
br label %276
276: ; preds = %259, %256
%277 = load i32, i32* %26
%278 = icmp sgt i32 %277, 32
br i1 %278, label %279, label %280
279: ; preds = %276
br label %282
280: ; preds = %276
%281 = load i32, i32* %26
br label %282
282: ; preds = %280, %279
%283 = phi i32 [ 32, %279 ], [ %281, %280 ]
store i32 %283, i32* %28
%284 = getelementptr inbounds [64 x i8], [64 x i8]* %19, i64 0, i64 0
%285 = bitcast i8* %284 to i32*
%286 = load i32, i32* %28
%287 = load i32*, i32** %23
%288 = load i64, i64* %25
%289 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%290 = call i32 @fread_wrapper(i32* %285, i32 %286, i32* %287, i32* %15, i64 %288, i8* %289)
store i32 %290, i32* %27
%291 = load i32, i32* %27
%292 = icmp ne i32 %291, 0
br i1 %292, label %293, label %358
293: ; preds = %282
%294 = load i32, i32* %29
%295 = icmp ne i32 %294, 0
br i1 %295, label %296, label %302
296: ; preds = %293
%297 = load i32*, i32** %24
%298 = load i32, i32* %11
%299 = load i8, i8* %22
%300 = zext i8 %299 to i32
%301 = call i32 (i32*, i8*, ...) @fprintf(i32* %297, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i32 %298, i32 %300)
store i32 0, i32* %29
br label %302
302: ; preds = %296, %293
%303 = load i32*, i32** %24
%304 = load i32, i32* %27
%305 = load i32, i32* %8
%306 = and i32 %305, 65535
%307 = call i32 (i32*, i8*, ...) @fprintf(i32* %303, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), i32 %304, i32 %306)
%308 = load i32, i32* %8
%309 = and i32 %308, 255
%310 = trunc i32 %309 to i8
store i8 %310, i8* %20
%311 = load i32, i32* %8
%312 = ashr i32 %311, 8
%313 = and i32 %312, 255
%314 = trunc i32 %313 to i8
store i8 %314, i8* %21
%315 = load i32, i32* %27
%316 = add nsw i32 0, %315
%317 = load i8, i8* %20
%318 = zext i8 %317 to i32
%319 = add nsw i32 %316, %318
%320 = load i8, i8* %21
%321 = zext i8 %320 to i32
%322 = add nsw i32 %319, %321
%323 = trunc i32 %322 to i8
store i8 %323, i8* %22
store i32 0, i32* %6
br label %324
324: ; preds = %345, %302
%325 = load i32, i32* %6
%326 = load i32, i32* %27
%327 = icmp slt i32 %325, %326
br i1 %327, label %328, label %348
328: ; preds = %324
%329 = load i32*, i32** %24
%330 = load i32, i32* %6
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds [64 x i8], [64 x i8]* %19, i64 0, i64 %331
%333 = load i8, i8* %332
%334 = zext i8 %333 to i32
%335 = call i32 (i32*, i8*, ...) @fprintf(i32* %329, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %334)
%336 = load i32, i32* %6
%337 = sext i32 %336 to i64
%338 = getelementptr inbounds [64 x i8], [64 x i8]* %19, i64 0, i64 %337
%339 = load i8, i8* %338
%340 = zext i8 %339 to i32
%341 = load i8, i8* %22
%342 = zext i8 %341 to i32
%343 = add nsw i32 %342, %340
%344 = trunc i32 %343 to i8
store i8 %344, i8* %22
br label %345
345: ; preds = %328
%346 = load i32, i32* %6
%347 = add nsw i32 %346, 1
store i32 %347, i32* %6
br label %324
348: ; preds = %324
%349 = load i8, i8* %22
%350 = zext i8 %349 to i32
%351 = xor i32 %350, -1
%352 = add nsw i32 %351, 1
%353 = trunc i32 %352 to i8
store i8 %353, i8* %22
%354 = load i32*, i32** %24
%355 = load i8, i8* %22
%356 = zext i8 %355 to i32
%357 = call i32 (i32*, i8*, ...) @fprintf(i32* %354, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 %356)
br label %358
358: ; preds = %348, %282
%359 = load i32, i32* %27
%360 = load i32, i32* %8
%361 = add nsw i32 %360, %359
store i32 %361, i32* %8
%362 = load i32, i32* %27
%363 = load i32, i32* %9
%364 = sub nsw i32 %363, %362
store i32 %364, i32* %9
br label %240
365: ; preds = %248
%366 = load i32, i32* %10
%367 = icmp ne i32 %366, 0
br i1 %367, label %368, label %371
368: ; preds = %365
%369 = load i32*, i32** %24
%370 = call i32 (i32*, i8*, ...) @fprintf(i32* %369, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0))
br label %371
371: ; preds = %368, %365
%372 = load i32*, i32** %24
%373 = call i32 @fclose(i32* %372)
%374 = load i32*, i32** %23
%375 = call i32 @fclose(i32* %374)
store i32 0, i32* %3
br label %376
376: ; preds = %371, %186
%377 = load i32, i32* %3
ret i32 %377
}

LLVM IR (-O2):
@.str.4 = [26 x i8] c"Unknown option %s given.\0A\00"
@.str.5 = [26 x i8] c"Superfluous argument %s.\0A\00"
@stderr = global i32* null
@.str.6 = [105 x i8] c"Usage: %s [-i <bin offset>] [-o <hex offset>] [-l <length>] \0A\09\09[-h] [-t] [-z/Z] [-a] <infile> <outfile>\0A\00"
@.str.7 = [22 x i8] c"\09-h shows this help.\0A\00"
@.str.8 = [27 x i8] c"\09-t omits the end record.\0A\00"
@.str.9 = [45 x i8] c"\09-z adds file length word in little endian.\0A\00"
@.str.10 = [42 x i8] c"\09-Z adds file length word in big endian.\0A\00"
@.str.11 = [39 x i8] c"\09-a appends to the existing hex file.\0A\00"
@.str.12 = [3 x i8] c"rb\00"
@.str.13 = [27 x i8] c"Can't open '%s' as input.\0A\00"
@.str.14 = [3 x i8] c"at\00"
@.str.15 = [3 x i8] c"wt\00"
@.str.16 = [28 x i8] c"Can't open '%s' as output.\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.17 = [19 x i8] c":02000004%04X%02X\0A\00"
@.str.18 = [12 x i8] c":%02X%04X00\00"
@.str.19 = [5 x i8] c"%02X\00"
@.str.20 = [6 x i8] c"%02X\0A\00"
@.str.21 = [13 x i8] c":00000001FF\0A\00"
@str = [28 x i8] c"-v option: no string given.\00"
@str.22 = [28 x i8] c"-l option: no length given.\00"
@str.23 = [28 x i8] c"-o option: no offset given.\00"
@str.24 = [28 x i8] c"-i option: no offset given.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [16 x i8]
%7 = alloca [64 x i8]
%8 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 1
%14 = zext i1 %13 to i32
%15 = call i32 @memset(i8* %11, i32 0, i32 16)
%16 = icmp sgt i32 %0, 1
br i1 %16, label %17, label %110
17: ; preds = %2
%18 = add nsw i32 %0, -1
br label %19
19: ; preds = %17, %98
%20 = phi i32 [ 0, %17 ], [ %99, %98 ]
%21 = phi i32 [ 1, %17 ], [ %108, %98 ]
%22 = phi i32 [ 0, %17 ], [ %106, %98 ]
%23 = phi i32 [ 0, %17 ], [ %105, %98 ]
%24 = phi i32 [ 1073741824, %17 ], [ %104, %98 ]
%25 = phi i32 [ 0, %17 ], [ %103, %98 ]
%26 = phi i32 [ %14, %17 ], [ %102, %98 ]
%27 = phi i32 [ 0, %17 ], [ %101, %98 ]
%28 = phi i32 [ 1, %17 ], [ %100, %98 ]
%29 = sext i32 %21 to i64
%30 = getelementptr inbounds i8*, i8** %1, i64 %29
%31 = load i8*, i8** %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 45
br i1 %33, label %34, label %89
34: ; preds = %19
%35 = getelementptr inbounds i8, i8* %31, i64 1
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
switch i32 %37, label %86 [
i32 105, label %38
i32 104, label %98
i32 111, label %49
i32 108, label %60
i32 116, label %71
i32 97, label %72
i32 118, label %73
i32 122, label %84
i32 90, label %85
]
38: ; preds = %34
%39 = icmp eq i32 %21, %18
br i1 %39, label %46, label %40
40: ; preds = %38
%41 = add nsw i32 %21, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %1, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @strtoul(i8* %44, i32 0, i32 0)
br label %98
46: ; preds = %38
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.24, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %34
%50 = icmp eq i32 %21, %18
br i1 %50, label %57, label %51
51: ; preds = %49
%52 = add nsw i32 %21, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %1, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @strtoul(i8* %55, i32 0, i32 0)
br label %98
57: ; preds = %49
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.23, i64 0, i64 0))
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %34
%61 = icmp eq i32 %21, %18
br i1 %61, label %68, label %62
62: ; preds = %60
%63 = add nsw i32 %21, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
%67 = call i32 @strtoul(i8* %66, i32 0, i32 0)
br label %98
68: ; preds = %60
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.22, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %34
br label %98
72: ; preds = %34
br label %98
73: ; preds = %34
%74 = icmp eq i32 %21, %18
br i1 %74, label %81, label %75
75: ; preds = %73
%76 = add nsw i32 %21, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %1, i64 %77
%79 = load i8*, i8** %78
%80 = call i32 @strncpy(i8* %11, i8* %79, i32 11)
br label %98
81: ; preds = %73
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %34
store i32 1, i32* %3
br label %98
85: ; preds = %34
store i32 2, i32* %3
br label %98
86: ; preds = %34
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%88 = call i32 @exit(i32 2)
unreachable
89: ; preds = %19
switch i32 %25, label %91 [
i32 0, label %94
i32 1, label %90
]
90: ; preds = %89
br label %94
91: ; preds = %89
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %31)
%93 = call i32 @exit(i32 3)
unreachable
94: ; preds = %89, %90
%95 = phi i8* [ %10, %90 ], [ %9, %89 ]
%96 = call i32 @strncpy(i8* %95, i8* %31, i32 1024)
%97 = add nuw nsw i32 %25, 1
br label %98
98: ; preds = %34, %94, %85, %84, %75, %72, %71, %62, %51, %40
%99 = phi i32 [ 2, %85 ], [ 1, %84 ], [ %20, %75 ], [ %20, %72 ], [ %20, %71 ], [ %20, %62 ], [ %20, %51 ], [ %20, %40 ], [ %20, %94 ], [ %20, %34 ]
%100 = phi i32 [ %28, %85 ], [ %28, %84 ], [ %28, %75 ], [ %28, %72 ], [ 0, %71 ], [ %28, %62 ], [ %28, %51 ], [ %28, %40 ], [ %28, %94 ], [ %28, %34 ]
%101 = phi i32 [ %27, %85 ], [ %27, %84 ], [ %27, %75 ], [ 1, %72 ], [ %27, %71 ], [ %27, %62 ], [ %27, %51 ], [ %27, %40 ], [ %27, %94 ], [ %27, %34 ]
%102 = phi i32 [ %26, %85 ], [ %26, %84 ], [ %26, %75 ], [ %26, %72 ], [ %26, %71 ], [ %26, %62 ], [ %26, %51 ], [ %26, %40 ], [ %26, %94 ], [ 1, %34 ]
%103 = phi i32 [ %25, %85 ], [ %25, %84 ], [ %25, %75 ], [ %25, %72 ], [ %25, %71 ], [ %25, %62 ], [ %25, %51 ], [ %25, %40 ], [ %97, %94 ], [ %25, %34 ]
%104 = phi i32 [ %24, %85 ], [ %24, %84 ], [ %24, %75 ], [ %24, %72 ], [ %24, %71 ], [ %67, %62 ], [ %24, %51 ], [ %24, %40 ], [ %24, %94 ], [ %24, %34 ]
%105 = phi i32 [ %23, %85 ], [ %23, %84 ], [ %23, %75 ], [ %23, %72 ], [ %23, %71 ], [ %23, %62 ], [ %56, %51 ], [ %23, %40 ], [ %23, %94 ], [ %23, %34 ]
%106 = phi i32 [ %22, %85 ], [ %22, %84 ], [ %22, %75 ], [ %22, %72 ], [ %22, %71 ], [ %22, %62 ], [ %22, %51 ], [ %45, %40 ], [ %22, %94 ], [ %22, %34 ]
%107 = phi i32 [ %21, %85 ], [ %21, %84 ], [ %76, %75 ], [ %21, %72 ], [ %21, %71 ], [ %63, %62 ], [ %52, %51 ], [ %41, %40 ], [ %21, %94 ], [ %21, %34 ]
%108 = add nsw i32 %107, 1
%109 = icmp slt i32 %108, %0
br i1 %109, label %19, label %110
110: ; preds = %98, %2
%111 = phi i32 [ 0, %2 ], [ %99, %98 ]
%112 = phi i32 [ 1, %2 ], [ %100, %98 ]
%113 = phi i32 [ 0, %2 ], [ %101, %98 ]
%114 = phi i32 [ %14, %2 ], [ %102, %98 ]
%115 = phi i32 [ 1073741824, %2 ], [ %104, %98 ]
%116 = phi i32 [ 0, %2 ], [ %105, %98 ]
%117 = phi i32 [ 0, %2 ], [ %106, %98 ]
%118 = icmp eq i32 %114, 0
br i1 %118, label %133, label %119
119: ; preds = %110
%120 = load i32*, i32** @stderr
%121 = load i8*, i8** %1
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %120, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.6, i64 0, i64 0), i8* %121)
%123 = load i32*, i32** @stderr
%124 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i64 21, i64 1, i32* %123)
%125 = load i32*, i32** @stderr
%126 = call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i64 26, i64 1, i32* %125)
%127 = load i32*, i32** @stderr
%128 = call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i64 44, i64 1, i32* %127)
%129 = load i32*, i32** @stderr
%130 = call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), i64 41, i64 1, i32* %129)
%131 = load i32*, i32** @stderr
%132 = call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i64 38, i64 1, i32* %131)
br label %235
133: ; preds = %110
%134 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%135 = icmp eq i32* %134, null
br i1 %135, label %136, label %140
136: ; preds = %133
%137 = load i32*, i32** @stderr
%138 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i8* %9)
%139 = call i32 @exit(i32 -1)
unreachable
140: ; preds = %133
%141 = icmp eq i32 %113, 0
%142 = select i1 %141, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0)
%143 = call i32* @fopen(i8* %10, i8* %142)
%144 = icmp eq i32* %143, null
br i1 %144, label %145, label %149
145: ; preds = %140
%146 = load i32*, i32** @stderr
%147 = call i32 (i32*, i8*, ...) @fprintf(i32* %146, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i8* %10)
%148 = call i32 @exit(i32 -1)
unreachable
149: ; preds = %140
%150 = icmp eq i32 %111, 0
br i1 %150, label %155, label %151
151: ; preds = %149
%152 = load i32, i32* @SEEK_END
%153 = call i32 @fseek(i32* %134, i32 0, i32 %152)
%154 = call i64 @ftell(i32* %134)
br label %155
155: ; preds = %151, %149
%156 = phi i64 [ %154, %151 ], [ 0, %149 ]
%157 = load i32, i32* @SEEK_SET
%158 = call i32 @fseek(i32* %134, i32 %117, i32 %157)
%159 = icmp eq i32 %115, 0
br i1 %159, label %228, label %160
160: ; preds = %155
%161 = bitcast [64 x i8]* %7 to i32*
br label %162
162: ; preds = %160, %222
%163 = phi i32 [ 0, %160 ], [ %225, %222 ]
%164 = phi i32 [ %116, %160 ], [ %223, %222 ]
%165 = phi i32 [ %115, %160 ], [ %226, %222 ]
%166 = phi i8 [ undef, %160 ], [ %224, %222 ]
%167 = phi i32 [ -1, %160 ], [ %181, %222 ]
%168 = call i32 @feof(i32* %134)
%169 = icmp eq i32 %168, 0
br i1 %169, label %170, label %228
170: ; preds = %162
%171 = and i32 %164, 65535
%172 = sub nuw nsw i32 65536, %171
%173 = icmp eq i32 %171, 0
%174 = icmp eq i32 %167, -1
%175 = select i1 %173, i1 true, i1 %174
%176 = ashr i32 %164, 16
%177 = lshr i32 %164, 24
%178 = add nsw i32 %176, %177
%179 = trunc i32 %178 to i8
%180 = sub i8 -6, %179
%181 = select i1 %175, i32 %176, i32 %167
%182 = select i1 %175, i8 %180, i8 %166
%183 = select i1 %175, i32 1, i32 %163
%184 = icmp ult i32 %172, 32
%185 = select i1 %184, i32 %172, i32 32
%186 = call i32 @fread_wrapper(i32* %161, i32 %185, i32* %134, i32* %3, i64 %156, i8* %11)
%187 = icmp eq i32 %186, 0
br i1 %187, label %188, label %190
188: ; preds = %170
%189 = add nuw nsw i32 %186, %164
br label %222
190: ; preds = %170
%191 = icmp eq i32 %183, 0
br i1 %191, label %195, label %192
192: ; preds = %190
%193 = zext i8 %182 to i32
%194 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i32 %181, i32 %193)
br label %195
195: ; preds = %192, %190
%196 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), i32 %186, i32 %171)
%197 = lshr i32 %164, 8
%198 = add i32 %186, %164
%199 = add i32 %198, %197
%200 = icmp sgt i32 %186, 0
br i1 %200, label %201, label %216
201: ; preds = %195
%202 = zext i32 %186 to i64
br label %203
203: ; preds = %201, %203
%204 = phi i64 [ 0, %201 ], [ %214, %203 ]
%205 = phi i32 [ %199, %201 ], [ %213, %203 ]
%206 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 %204
%207 = load i8, i8* %206
%208 = zext i8 %207 to i32
%209 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %208)
%210 = load i8, i8* %206
%211 = zext i8 %210 to i32
%212 = and i32 %205, 255
%213 = add nuw nsw i32 %212, %211
%214 = add nuw nsw i64 %204, 1
%215 = icmp eq i64 %214, %202
br i1 %215, label %216, label %203
216: ; preds = %203, %195
%217 = phi i32 [ %199, %195 ], [ %213, %203 ]
%218 = trunc i32 %217 to i8
%219 = sub i8 0, %218
%220 = zext i8 %219 to i32
%221 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 %220)
br label %222
222: ; preds = %188, %216
%223 = phi i32 [ %189, %188 ], [ %198, %216 ]
%224 = phi i8 [ %182, %188 ], [ %219, %216 ]
%225 = phi i32 [ %183, %188 ], [ 0, %216 ]
%226 = sub nsw i32 %165, %186
%227 = icmp eq i32 %226, 0
br i1 %227, label %228, label %162
228: ; preds = %162, %222, %155
%229 = icmp eq i32 %112, 0
br i1 %229, label %232, label %230
230: ; preds = %228
%231 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i64 12, i64 1, i32* %143)
br label %232
232: ; preds = %230, %228
%233 = call i32 @fclose(i32* %143)
%234 = call i32 @fclose(i32* %134)
br label %235
235: ; preds = %232, %119
%236 = phi i32 [ 1, %119 ], [ 0, %232 ]
ret i32 %236
}