#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ isdigit(unsigned char);
int /*<<< orphan*/ isxdigit(unsigned char);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ store_data(int /*<<< orphan*/, unsigned char);
int strlen(char *);
int tolower(unsigned char);
int read_hex(char *filename) {
  FILE *fd;
  unsigned char buf[256], data[16], record_type, sum;
  unsigned address, high;
  int bytes, i;
  fd = fopen(filename, "r");
  if (!fd) {
    perror(filename);
    exit(1);
  }
  high = 0;
  while (fgets((char *)buf, sizeof(buf), fd)) {
    if (buf[0] == '\n')
      continue;
    if (buf[0] != ':') {
      fclose(fd);
      return 0;
    }
    if (!isxdigit(buf[1]) || !isxdigit(buf[2]) || !isxdigit(buf[3]) ||
        !isxdigit(buf[4]) || !isxdigit(buf[5]) || !isxdigit(buf[6]) ||
        !isxdigit(buf[7]) || !isxdigit(buf[8])) {
      fprintf(stderr, ("%s: bad HEX record: %s\n"), filename, buf);
      exit(1);
    }
    record_type = (((isdigit((buf + 7)[0]) ? ((buf + 7)[0]) - '0'
                                           : tolower((buf + 7)[0]) + 10 - 'a')
                    << 4) +
                   (isdigit((buf + 7)[1]) ? ((buf + 7)[1]) - '0'
                                          : tolower((buf + 7)[1]) + 10 - 'a'));
    if (record_type == 1) {
      break;
    }
    if (record_type == 5) {
      continue;
    }
    bytes = (((isdigit((buf + 1)[0]) ? ((buf + 1)[0]) - '0'
                                     : tolower((buf + 1)[0]) + 10 - 'a')
              << 4) +
             (isdigit((buf + 1)[1]) ? ((buf + 1)[1]) - '0'
                                    : tolower((buf + 1)[1]) + 10 - 'a'));
    if (strlen((char *)buf) < bytes * 2 + 11) {
      fprintf(stderr, ("%s: too short hex line\n"), filename);
      exit(1);
    }
    address = high << 16 |
              (((isdigit((buf + 3)[0]) ? ((buf + 3)[0]) - '0'
                                       : tolower((buf + 3)[0]) + 10 - 'a')
                << 4) +
               (isdigit((buf + 3)[1]) ? ((buf + 3)[1]) - '0'
                                      : tolower((buf + 3)[1]) + 10 - 'a'))
                  << 8 |
              (((isdigit((buf + 5)[0]) ? ((buf + 5)[0]) - '0'
                                       : tolower((buf + 5)[0]) + 10 - 'a')
                << 4) +
               (isdigit((buf + 5)[1]) ? ((buf + 5)[1]) - '0'
                                      : tolower((buf + 5)[1]) + 10 - 'a'));
    sum = 0;
    for (i = 0; i < bytes; ++i) {
      data[i] = (((isdigit((buf + 9 + i + i)[0])
                       ? ((buf + 9 + i + i)[0]) - '0'
                       : tolower((buf + 9 + i + i)[0]) + 10 - 'a')
                  << 4) +
                 (isdigit((buf + 9 + i + i)[1])
                      ? ((buf + 9 + i + i)[1]) - '0'
                      : tolower((buf + 9 + i + i)[1]) + 10 - 'a'));
      sum += data[i];
    }
    sum += record_type + bytes + (address & 0xff) + (address >> 8 & 0xff);
    if (sum != (unsigned char)-(
                   ((isdigit((buf + 9 + bytes + bytes)[0])
                         ? ((buf + 9 + bytes + bytes)[0]) - '0'
                         : tolower((buf + 9 + bytes + bytes)[0]) + 10 - 'a')
                    << 4) +
                   (isdigit((buf + 9 + bytes + bytes)[1])
                        ? ((buf + 9 + bytes + bytes)[1]) - '0'
                        : tolower((buf + 9 + bytes + bytes)[1]) + 10 - 'a'))) {
      fprintf(stderr, ("%s: bad HEX checksum\n"), filename);
      exit(1);
    }
    if (record_type == 4) {
      if (bytes != 2) {
        fprintf(stderr, ("%s: invalid HEX linear address record length\n"),
                filename);
        exit(1);
      }
      high = data[0] << 8 | data[1];
      continue;
    }
    if (record_type != 0) {
      fprintf(stderr, ("%s: unknown HEX record type: %d\n"), filename,
              record_type);
      exit(1);
    }
    for (i = 0; i < bytes; i++) {
      store_data(address++, data[i]);
    }
  }
  fclose(fd);
  return 1;
}


x86 assembly (clang, -O0):
<read_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f1 <read_hex+0x41>
mov    -0x10(%rbp),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x13c(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1ab0 <read_hex+0x900>
movzbl -0x120(%rbp),%eax
cmp    $0xa,%eax
jne    122f <read_hex+0x7f>
jmp    11fb <read_hex+0x4b>
movzbl -0x120(%rbp),%eax
cmp    $0x3a,%eax
je     1254 <read_hex+0xa4>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1ac0 <read_hex+0x910>
movzbl -0x11f(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x11e(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x11d(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x11c(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x11b(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x11a(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x119(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
je     12fc <read_hex+0x14c>
movzbl -0x118(%rbp),%edi
call   10d0 <isxdigit@plt>
cmp    $0x0,%eax
jne    1328 <read_hex+0x178>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xceb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movzbl -0x119(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1353 <read_hex+0x1a3>
movzbl -0x119(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x148(%rbp)
jmp    136b <read_hex+0x1bb>
movzbl -0x119(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x148(%rbp)
mov    -0x148(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x14c(%rbp)
movzbl -0x118(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     13a5 <read_hex+0x1f5>
movzbl -0x118(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x150(%rbp)
jmp    13bd <read_hex+0x20d>
movzbl -0x118(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x150(%rbp)
mov    -0x14c(%rbp),%eax
mov    -0x150(%rbp),%ecx
add    %ecx,%eax
mov    %al,-0x131(%rbp)
movzbl -0x131(%rbp),%eax
cmp    $0x1,%eax
jne    13e6 <read_hex+0x236>
jmp    1ab0 <read_hex+0x900>
movzbl -0x131(%rbp),%eax
cmp    $0x5,%eax
jne    13fb <read_hex+0x24b>
jmp    11fb <read_hex+0x4b>
movzbl -0x11f(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1426 <read_hex+0x276>
movzbl -0x11f(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x154(%rbp)
jmp    143e <read_hex+0x28e>
movzbl -0x11f(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x154(%rbp)
mov    -0x154(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x158(%rbp)
movzbl -0x11e(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1478 <read_hex+0x2c8>
movzbl -0x11e(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x15c(%rbp)
jmp    1490 <read_hex+0x2e0>
movzbl -0x11e(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x15c(%rbp)
mov    -0x158(%rbp),%eax
mov    -0x15c(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x140(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x140(%rbp),%ecx
shl    $0x1,%ecx
add    $0xb,%ecx
cmp    %ecx,%eax
jge    14e9 <read_hex+0x339>
mov    0x2b15(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xb42(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x13c(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x160(%rbp)
movzbl -0x11d(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1523 <read_hex+0x373>
movzbl -0x11d(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x164(%rbp)
jmp    153b <read_hex+0x38b>
movzbl -0x11d(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x164(%rbp)
mov    -0x164(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x168(%rbp)
movzbl -0x11c(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1575 <read_hex+0x3c5>
movzbl -0x11c(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x16c(%rbp)
jmp    158d <read_hex+0x3dd>
movzbl -0x11c(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x16c(%rbp)
mov    -0x160(%rbp),%eax
mov    -0x168(%rbp),%ecx
mov    -0x16c(%rbp),%edx
add    %edx,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x170(%rbp)
movzbl -0x11b(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     15d7 <read_hex+0x427>
movzbl -0x11b(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x174(%rbp)
jmp    15ef <read_hex+0x43f>
movzbl -0x11b(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x174(%rbp)
mov    -0x174(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x178(%rbp)
movzbl -0x11a(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1629 <read_hex+0x479>
movzbl -0x11a(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x17c(%rbp)
jmp    1641 <read_hex+0x491>
movzbl -0x11a(%rbp),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x17c(%rbp)
mov    -0x170(%rbp),%eax
mov    -0x178(%rbp),%ecx
mov    -0x17c(%rbp),%edx
add    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x138(%rbp)
movb   $0x0,-0x132(%rbp)
movl   $0x0,-0x144(%rbp)
mov    -0x144(%rbp),%eax
cmp    -0x140(%rbp),%eax
jge    17fe <read_hex+0x64e>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
movslq -0x144(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     16dd <read_hex+0x52d>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
movslq -0x144(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x180(%rbp)
jmp    170e <read_hex+0x55e>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
movslq -0x144(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x180(%rbp)
mov    -0x180(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x184(%rbp)
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
movslq -0x144(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     177c <read_hex+0x5cc>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
movslq -0x144(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x188(%rbp)
jmp    17ae <read_hex+0x5fe>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
movslq -0x144(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x188(%rbp)
mov    -0x184(%rbp),%eax
mov    -0x188(%rbp),%ecx
add    %ecx,%eax
mov    %al,%cl
movslq -0x144(%rbp),%rax
mov    %cl,-0x130(%rbp,%rax,1)
movslq -0x144(%rbp),%rax
movzbl -0x130(%rbp,%rax,1),%ecx
ff
movzbl -0x132(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x132(%rbp)
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    166e <read_hex+0x4be>
movzbl -0x131(%rbp),%ecx
add    -0x140(%rbp),%ecx
mov    -0x138(%rbp),%eax
and    $0xff,%eax
add    %eax,%ecx
mov    -0x138(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
add    %eax,%ecx
movzbl -0x132(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x132(%rbp)
movzbl -0x132(%rbp),%eax
mov    %eax,-0x18c(%rbp)
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x140(%rbp),%rcx
add    %rcx,%rax
movslq -0x140(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     18a1 <read_hex+0x6f1>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x140(%rbp),%rcx
add    %rcx,%rax
movslq -0x140(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x190(%rbp)
jmp    18d2 <read_hex+0x722>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x140(%rbp),%rcx
add    %rcx,%rax
movslq -0x140(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x190(%rbp)
mov    -0x190(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x194(%rbp)
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x140(%rbp),%rcx
add    %rcx,%rax
movslq -0x140(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1940 <read_hex+0x790>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x140(%rbp),%rcx
add    %rcx,%rax
movslq -0x140(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x198(%rbp)
jmp    1972 <read_hex+0x7c2>
lea    -0x120(%rbp),%rax
add    $0x9,%rax
movslq -0x140(%rbp),%rcx
add    %rcx,%rax
movslq -0x140(%rbp),%rcx
movzbl 0x1(%rax,%rcx,1),%edi
call   1090 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x198(%rbp)
mov    -0x18c(%rbp),%eax
mov    -0x194(%rbp),%edx
mov    -0x198(%rbp),%ecx
add    %ecx,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movzbl %cl,%ecx
cmp    %ecx,%eax
je     19ba <read_hex+0x80a>
mov    0x2644(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0x689(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movzbl -0x131(%rbp),%eax
cmp    $0x4,%eax
jne    1a1a <read_hex+0x86a>
cmpl   $0x2,-0x140(%rbp)
je     19fc <read_hex+0x84c>
mov    0x2602(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0x65d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movzbl -0x130(%rbp),%eax
shl    $0x8,%eax
movzbl -0x12f(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x13c(%rbp)
jmp    11fb <read_hex+0x4b>
movzbl -0x131(%rbp),%eax
cmp    $0x0,%eax
je     1a56 <read_hex+0x8a6>
mov    0x25af(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
movzbl -0x131(%rbp),%ecx
lea    0x631(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x144(%rbp)
mov    -0x144(%rbp),%eax
cmp    -0x140(%rbp),%eax
jge    1aab <read_hex+0x8fb>
mov    -0x138(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x138(%rbp)
movslq -0x144(%rbp),%rax
movzbl -0x130(%rbp,%rax,1),%esi
ff
call   1080 <store_data@plt>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    1a60 <read_hex+0x8b0>
jmp    11fb <read_hex+0x4b>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_hex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
lea    0xe38(%rip),%rsi
mov    %rdi,(%rsp)
call   10a0 <fopen@plt>
test   %rax,%rax
je     16c5 <read_hex+0x515>
mov    %rax,%r14
lea    0x40(%rsp),%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
movl   $0x1,0x8(%rsp)
test   %rax,%rax
je     161e <read_hex+0x46e>
xor    %r13d,%r13d
lea    0x40(%rsp),%r15
mov    %r14,0x28(%rsp)
shl    $0x10,%r13d
mov    %r13,0x10(%rsp)
jmp    1241 <read_hex+0x91>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%al
jne    1616 <read_hex+0x466>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     161e <read_hex+0x46e>
mov    0x40(%rsp),%al
cmp    $0x3a,%al
jne    1220 <read_hex+0x70>
movzbl 0x41(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x42(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x43(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x44(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x45(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x46(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x47(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x48(%rsp),%edi
call   10d0 <isxdigit@plt>
test   %eax,%eax
je     163c <read_hex+0x48c>
movzbl 0x47(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x47(%rsp),%ebx
test   %rax,%rax
je     12f2 <read_hex+0x142>
add    $0xffffffd0,%ebx
jmp    12fe <read_hex+0x14e>
mov    %ebx,%edi
call   1090 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
shl    $0x4,%ebx
movzbl 0x48(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x48(%rsp),%edi
test   %rax,%rax
je     131a <read_hex+0x16a>
add    $0xffffffd0,%edi
jmp    1324 <read_hex+0x174>
call   1090 <tolower@plt>
mov    %eax,%edi
add    $0xffffffa9,%edi
add    %ebx,%edi
cmp    $0x5,%dil
je     1228 <read_hex+0x78>
cmp    $0x1,%dil
je     161e <read_hex+0x46e>
mov    %rdi,0x20(%rsp)
movzbl 0x41(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x41(%rsp),%ebp
test   %rax,%rax
je     1358 <read_hex+0x1a8>
add    $0xffffffd0,%ebp
jmp    1364 <read_hex+0x1b4>
mov    %ebp,%edi
call   1090 <tolower@plt>
mov    %eax,%ebp
add    $0xffffffa9,%ebp
shl    $0x4,%ebp
movzbl 0x42(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x42(%rsp),%r14d
test   %rax,%rax
je     1382 <read_hex+0x1d2>
add    $0xffffffd0,%r14d
jmp    1391 <read_hex+0x1e1>
mov    %r14d,%edi
call   1090 <tolower@plt>
mov    %eax,%r14d
add    $0xffffffa9,%r14d
add    %ebp,%r14d
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    (%r14,%r14,1),%ecx
add    $0xb,%ecx
cmp    %ecx,%eax
jl     1666 <read_hex+0x4b6>
movzbl 0x43(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x43(%rsp),%ebp
test   %rax,%rax
je     13c4 <read_hex+0x214>
add    $0xffffffd0,%ebp
jmp    13d0 <read_hex+0x220>
mov    %ebp,%edi
call   1090 <tolower@plt>
mov    %eax,%ebp
add    $0xffffffa9,%ebp
shl    $0x4,%ebp
movzbl 0x44(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x44(%rsp),%ebx
test   %rax,%rax
je     13ec <read_hex+0x23c>
add    $0xffffffd0,%ebx
jmp    13f8 <read_hex+0x248>
mov    %ebx,%edi
call   1090 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
add    %ebp,%ebx
shl    $0x8,%ebx
movzbl 0x45(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x45(%rsp),%r12d
test   %rax,%rax
je     1418 <read_hex+0x268>
add    $0xffffffd0,%r12d
jmp    1427 <read_hex+0x277>
mov    %r12d,%edi
call   1090 <tolower@plt>
mov    %eax,%r12d
add    $0xffffffa9,%r12d
or     %r13d,%ebx
shl    $0x4,%r12d
movzbl 0x46(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x46(%rsp),%r15d
test   %rax,%rax
je     1449 <read_hex+0x299>
add    $0xffffffd0,%r15d
jmp    1458 <read_hex+0x2a8>
mov    %r15d,%edi
call   1090 <tolower@plt>
mov    %eax,%r15d
add    $0xffffffa9,%r15d
add    %r12d,%r15d
or     %r15d,%ebx
mov    %ebx,0xc(%rsp)
mov    %r14d,%r12d
test   %r14d,%r14d
jle    14ed <read_hex+0x33d>
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    149c <read_hex+0x2ec>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1090 <tolower@plt>
add    $0xffffffa9,%eax
add    %ebp,%eax
mov    %al,0x30(%rsp,%r13,1)
add    %al,%bl
add    $0x1,%r13
cmp    %r13,%r12
je     14ef <read_hex+0x33f>
movzbl 0x49(%rsp,%r13,2),%edi
call   1030 <isdigit@plt>
movzbl 0x49(%rsp,%r13,2),%ebp
test   %rax,%rax
je     14c0 <read_hex+0x310>
add    $0xffffffd0,%ebp
jmp    14cc <read_hex+0x31c>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1090 <tolower@plt>
mov    %eax,%ebp
add    $0xffffffa9,%ebp
shl    $0x4,%ebp
movzbl 0x4a(%rsp,%r13,2),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
movzbl 0x4a(%rsp,%r13,2),%eax
test   %rcx,%rcx
je     1480 <read_hex+0x2d0>
add    $0xffffffd0,%eax
jmp    148a <read_hex+0x2da>
xor    %ebx,%ebx
mov    0x20(%rsp),%rax
add    %r14d,%eax
add    %eax,%r15d
mov    %r14,%rax
mov    0xc(%rsp),%r14d
shr    $0x8,%r14d
add    %r15d,%r14d
mov    %rax,0x18(%rsp)
movslq %eax,%rbp
lea    0x49(%rsp),%rax
lea    (%rax,%rbp,1),%r13
movzbl 0x0(%rbp,%r13,1),%edi
call   1030 <isdigit@plt>
movzbl 0x0(%rbp,%r13,1),%edi
test   %rax,%rax
je     153b <read_hex+0x38b>
mov    $0x30,%r15d
sub    %edi,%r15d
jmp    1549 <read_hex+0x399>
call   1090 <tolower@plt>
mov    $0x57,%r15d
sub    %eax,%r15d
add    %r14b,%bl
shl    $0x4,%r15d
movzbl 0x1(%r13,%rbp,1),%edi
call   1030 <isdigit@plt>
movzbl 0x1(%r13,%rbp,1),%edi
test   %rax,%rax
je     156f <read_hex+0x3bf>
mov    $0x30,%ecx
sub    %edi,%ecx
jmp    157b <read_hex+0x3cb>
call   1090 <tolower@plt>
mov    $0x57,%ecx
sub    %eax,%ecx
mov    0x10(%rsp),%r13
add    %r15d,%ecx
cmp    %cl,%bl
jne    1678 <read_hex+0x4c8>
mov    0x20(%rsp),%rax
test   %al,%al
mov    0x28(%rsp),%r14
lea    0x40(%rsp),%r15
mov    0xc(%rsp),%ecx
jne    15db <read_hex+0x42b>
cmpl   $0x0,0x18(%rsp)
jle    1228 <read_hex+0x78>
mov    %ecx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%edi
movzbl 0x30(%rsp,%rbp,1),%esi
call   1080 <store_data@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    15c0 <read_hex+0x410>
jmp    1228 <read_hex+0x78>
cmp    $0x4,%al
jne    169d <read_hex+0x4ed>
cmpl   $0x2,0x18(%rsp)
jne    16d8 <read_hex+0x528>
movzwl 0x30(%rsp),%r13d
shl    $0x10,%r13d
bswap  %r13d
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    120d <read_hex+0x5d>
jmp    161e <read_hex+0x46e>
movl   $0x0,0x8(%rsp)
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x299d(%rip),%rax
mov    (%rax),%edi
lea    0x9b6(%rip),%rsi
lea    0x40(%rsp),%rcx
mov    (%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2973(%rip),%rax
mov    (%rax),%edi
lea    0x9a4(%rip),%rsi
jmp    1688 <read_hex+0x4d8>
mov    0x2961(%rip),%rax
mov    (%rax),%edi
lea    0x9aa(%rip),%rsi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movzbl %al,%ecx
mov    0x2939(%rip),%rax
mov    (%rax),%edi
lea    0x9c6(%rip),%rsi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    (%rsp),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2901(%rip),%rax
mov    (%rax),%edi
lea    0x960(%rip),%rsi
jmp    1688 <read_hex+0x4d8>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"%s: bad HEX record: %s\0A\00"
@.str.2 = [24 x i8] c"%s: too short hex line\0A\00"
@.str.3 = [22 x i8] c"%s: bad HEX checksum\0A\00"
@.str.4 = [46 x i8] c"%s: invalid HEX linear address record length\0A\00"
@.str.5 = [33 x i8] c"%s: unknown HEX record type: %d\0A\00"
define i32 @read_hex(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [256 x i8]
%6 = alloca [16 x i8]
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
%13 = load i8*, i8** %3
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %4
%15 = load i32*, i32** %4
%16 = icmp ne i32* %15, null
br i1 %16, label %21, label %17
17: ; preds = %1
%18 = load i8*, i8** %3
%19 = call i32 @perror(i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %1
store i32 0, i32* %10
br label %22
22: ; preds = %572, %536, %145, %32, %21
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%24 = load i32*, i32** %4
%25 = call i64 @fgets(i8* %23, i32 256, i32* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %573
27: ; preds = %22
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = icmp eq i32 %30, 10
br i1 %31, label %32, label %33
32: ; preds = %27
br label %22
33: ; preds = %27
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = icmp ne i32 %36, 58
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i32*, i32** %4
%40 = call i32 @fclose(i32* %39)
store i32 0, i32* %2
br label %576
41: ; preds = %33
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 1
%43 = load i8, i8* %42
%44 = call i32 @isxdigit(i8 zeroext %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %81
46: ; preds = %41
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 2
%48 = load i8, i8* %47
%49 = call i32 @isxdigit(i8 zeroext %48)
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %81
51: ; preds = %46
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 3
%53 = load i8, i8* %52
%54 = call i32 @isxdigit(i8 zeroext %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %81
56: ; preds = %51
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 4
%58 = load i8, i8* %57
%59 = call i32 @isxdigit(i8 zeroext %58)
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %81
61: ; preds = %56
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 5
%63 = load i8, i8* %62
%64 = call i32 @isxdigit(i8 zeroext %63)
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %81
66: ; preds = %61
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 6
%68 = load i8, i8* %67
%69 = call i32 @isxdigit(i8 zeroext %68)
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %81
71: ; preds = %66
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 7
%73 = load i8, i8* %72
%74 = call i32 @isxdigit(i8 zeroext %73)
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %71
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 8
%78 = load i8, i8* %77
%79 = call i32 @isxdigit(i8 zeroext %78)
%80 = icmp ne i32 %79, 0
br i1 %80, label %87, label %81
81: ; preds = %76, %71, %66, %61, %56, %51, %46, %41
%82 = load i32, i32* @stderr
%83 = load i8*, i8** %3
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%85 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %83, i8* %84)
%86 = call i32 @exit(i32 1)
unreachable
87: ; preds = %76
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%89 = getelementptr inbounds i8, i8* %88, i64 7
%90 = getelementptr inbounds i8, i8* %89, i64 0
%91 = load i8, i8* %90
%92 = call i64 @isdigit(i8 zeroext %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %101
94: ; preds = %87
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%96 = getelementptr inbounds i8, i8* %95, i64 7
%97 = getelementptr inbounds i8, i8* %96, i64 0
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = sub nsw i32 %99, 48
br label %109
101: ; preds = %87
%102 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%103 = getelementptr inbounds i8, i8* %102, i64 7
%104 = getelementptr inbounds i8, i8* %103, i64 0
%105 = load i8, i8* %104
%106 = call i32 @tolower(i8 zeroext %105)
%107 = add nsw i32 %106, 10
%108 = sub nsw i32 %107, 97
br label %109
109: ; preds = %101, %94
%110 = phi i32 [ %100, %94 ], [ %108, %101 ]
%111 = shl i32 %110, 4
%112 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%113 = getelementptr inbounds i8, i8* %112, i64 7
%114 = getelementptr inbounds i8, i8* %113, i64 1
%115 = load i8, i8* %114
%116 = call i64 @isdigit(i8 zeroext %115)
%117 = icmp ne i64 %116, 0
br i1 %117, label %118, label %125
118: ; preds = %109
%119 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%120 = getelementptr inbounds i8, i8* %119, i64 7
%121 = getelementptr inbounds i8, i8* %120, i64 1
%122 = load i8, i8* %121
%123 = zext i8 %122 to i32
%124 = sub nsw i32 %123, 48
br label %133
125: ; preds = %109
%126 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%127 = getelementptr inbounds i8, i8* %126, i64 7
%128 = getelementptr inbounds i8, i8* %127, i64 1
%129 = load i8, i8* %128
%130 = call i32 @tolower(i8 zeroext %129)
%131 = add nsw i32 %130, 10
%132 = sub nsw i32 %131, 97
br label %133
133: ; preds = %125, %118
%134 = phi i32 [ %124, %118 ], [ %132, %125 ]
%135 = add nsw i32 %111, %134
%136 = trunc i32 %135 to i8
store i8 %136, i8* %7
%137 = load i8, i8* %7
%138 = zext i8 %137 to i32
%139 = icmp eq i32 %138, 1
br i1 %139, label %140, label %141
140: ; preds = %133
br label %573
141: ; preds = %133
%142 = load i8, i8* %7
%143 = zext i8 %142 to i32
%144 = icmp eq i32 %143, 5
br i1 %144, label %145, label %146
145: ; preds = %141
br label %22
146: ; preds = %141
%147 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%148 = getelementptr inbounds i8, i8* %147, i64 1
%149 = getelementptr inbounds i8, i8* %148, i64 0
%150 = load i8, i8* %149
%151 = call i64 @isdigit(i8 zeroext %150)
%152 = icmp ne i64 %151, 0
br i1 %152, label %153, label %160
153: ; preds = %146
%154 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%155 = getelementptr inbounds i8, i8* %154, i64 1
%156 = getelementptr inbounds i8, i8* %155, i64 0
%157 = load i8, i8* %156
%158 = zext i8 %157 to i32
%159 = sub nsw i32 %158, 48
br label %168
160: ; preds = %146
%161 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%162 = getelementptr inbounds i8, i8* %161, i64 1
%163 = getelementptr inbounds i8, i8* %162, i64 0
%164 = load i8, i8* %163
%165 = call i32 @tolower(i8 zeroext %164)
%166 = add nsw i32 %165, 10
%167 = sub nsw i32 %166, 97
br label %168
168: ; preds = %160, %153
%169 = phi i32 [ %159, %153 ], [ %167, %160 ]
%170 = shl i32 %169, 4
%171 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%172 = getelementptr inbounds i8, i8* %171, i64 1
%173 = getelementptr inbounds i8, i8* %172, i64 1
%174 = load i8, i8* %173
%175 = call i64 @isdigit(i8 zeroext %174)
%176 = icmp ne i64 %175, 0
br i1 %176, label %177, label %184
177: ; preds = %168
%178 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%179 = getelementptr inbounds i8, i8* %178, i64 1
%180 = getelementptr inbounds i8, i8* %179, i64 1
%181 = load i8, i8* %180
%182 = zext i8 %181 to i32
%183 = sub nsw i32 %182, 48
br label %192
184: ; preds = %168
%185 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%186 = getelementptr inbounds i8, i8* %185, i64 1
%187 = getelementptr inbounds i8, i8* %186, i64 1
%188 = load i8, i8* %187
%189 = call i32 @tolower(i8 zeroext %188)
%190 = add nsw i32 %189, 10
%191 = sub nsw i32 %190, 97
br label %192
192: ; preds = %184, %177
%193 = phi i32 [ %183, %177 ], [ %191, %184 ]
%194 = add nsw i32 %170, %193
store i32 %194, i32* %11
%195 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%196 = call i32 @strlen(i8* %195)
%197 = load i32, i32* %11
%198 = mul nsw i32 %197, 2
%199 = add nsw i32 %198, 11
%200 = icmp slt i32 %196, %199
br i1 %200, label %201, label %206
201: ; preds = %192
%202 = load i32, i32* @stderr
%203 = load i8*, i8** %3
%204 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %202, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %203)
%205 = call i32 @exit(i32 1)
unreachable
206: ; preds = %192
%207 = load i32, i32* %10
%208 = shl i32 %207, 16
%209 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%210 = getelementptr inbounds i8, i8* %209, i64 3
%211 = getelementptr inbounds i8, i8* %210, i64 0
%212 = load i8, i8* %211
%213 = call i64 @isdigit(i8 zeroext %212)
%214 = icmp ne i64 %213, 0
br i1 %214, label %215, label %222
215: ; preds = %206
%216 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%217 = getelementptr inbounds i8, i8* %216, i64 3
%218 = getelementptr inbounds i8, i8* %217, i64 0
%219 = load i8, i8* %218
%220 = zext i8 %219 to i32
%221 = sub nsw i32 %220, 48
br label %230
222: ; preds = %206
%223 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%224 = getelementptr inbounds i8, i8* %223, i64 3
%225 = getelementptr inbounds i8, i8* %224, i64 0
%226 = load i8, i8* %225
%227 = call i32 @tolower(i8 zeroext %226)
%228 = add nsw i32 %227, 10
%229 = sub nsw i32 %228, 97
br label %230
230: ; preds = %222, %215
%231 = phi i32 [ %221, %215 ], [ %229, %222 ]
%232 = shl i32 %231, 4
%233 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%234 = getelementptr inbounds i8, i8* %233, i64 3
%235 = getelementptr inbounds i8, i8* %234, i64 1
%236 = load i8, i8* %235
%237 = call i64 @isdigit(i8 zeroext %236)
%238 = icmp ne i64 %237, 0
br i1 %238, label %239, label %246
239: ; preds = %230
%240 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%241 = getelementptr inbounds i8, i8* %240, i64 3
%242 = getelementptr inbounds i8, i8* %241, i64 1
%243 = load i8, i8* %242
%244 = zext i8 %243 to i32
%245 = sub nsw i32 %244, 48
br label %254
246: ; preds = %230
%247 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%248 = getelementptr inbounds i8, i8* %247, i64 3
%249 = getelementptr inbounds i8, i8* %248, i64 1
%250 = load i8, i8* %249
%251 = call i32 @tolower(i8 zeroext %250)
%252 = add nsw i32 %251, 10
%253 = sub nsw i32 %252, 97
br label %254
254: ; preds = %246, %239
%255 = phi i32 [ %245, %239 ], [ %253, %246 ]
%256 = add nsw i32 %232, %255
%257 = shl i32 %256, 8
%258 = or i32 %208, %257
%259 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%260 = getelementptr inbounds i8, i8* %259, i64 5
%261 = getelementptr inbounds i8, i8* %260, i64 0
%262 = load i8, i8* %261
%263 = call i64 @isdigit(i8 zeroext %262)
%264 = icmp ne i64 %263, 0
br i1 %264, label %265, label %272
265: ; preds = %254
%266 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%267 = getelementptr inbounds i8, i8* %266, i64 5
%268 = getelementptr inbounds i8, i8* %267, i64 0
%269 = load i8, i8* %268
%270 = zext i8 %269 to i32
%271 = sub nsw i32 %270, 48
br label %280
272: ; preds = %254
%273 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%274 = getelementptr inbounds i8, i8* %273, i64 5
%275 = getelementptr inbounds i8, i8* %274, i64 0
%276 = load i8, i8* %275
%277 = call i32 @tolower(i8 zeroext %276)
%278 = add nsw i32 %277, 10
%279 = sub nsw i32 %278, 97
br label %280
280: ; preds = %272, %265
%281 = phi i32 [ %271, %265 ], [ %279, %272 ]
%282 = shl i32 %281, 4
%283 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%284 = getelementptr inbounds i8, i8* %283, i64 5
%285 = getelementptr inbounds i8, i8* %284, i64 1
%286 = load i8, i8* %285
%287 = call i64 @isdigit(i8 zeroext %286)
%288 = icmp ne i64 %287, 0
br i1 %288, label %289, label %296
289: ; preds = %280
%290 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%291 = getelementptr inbounds i8, i8* %290, i64 5
%292 = getelementptr inbounds i8, i8* %291, i64 1
%293 = load i8, i8* %292
%294 = zext i8 %293 to i32
%295 = sub nsw i32 %294, 48
br label %304
296: ; preds = %280
%297 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%298 = getelementptr inbounds i8, i8* %297, i64 5
%299 = getelementptr inbounds i8, i8* %298, i64 1
%300 = load i8, i8* %299
%301 = call i32 @tolower(i8 zeroext %300)
%302 = add nsw i32 %301, 10
%303 = sub nsw i32 %302, 97
br label %304
304: ; preds = %296, %289
%305 = phi i32 [ %295, %289 ], [ %303, %296 ]
%306 = add nsw i32 %282, %305
%307 = or i32 %258, %306
store i32 %307, i32* %9
store i8 0, i8* %8
store i32 0, i32* %12
br label %308
308: ; preds = %410, %304
%309 = load i32, i32* %12
%310 = load i32, i32* %11
%311 = icmp slt i32 %309, %310
br i1 %311, label %312, label %413
312: ; preds = %308
%313 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%314 = getelementptr inbounds i8, i8* %313, i64 9
%315 = load i32, i32* %12
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds i8, i8* %314, i64 %316
%318 = load i32, i32* %12
%319 = sext i32 %318 to i64
%320 = getelementptr inbounds i8, i8* %317, i64 %319
%321 = getelementptr inbounds i8, i8* %320, i64 0
%322 = load i8, i8* %321
%323 = call i64 @isdigit(i8 zeroext %322)
%324 = icmp ne i64 %323, 0
br i1 %324, label %325, label %338
325: ; preds = %312
%326 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%327 = getelementptr inbounds i8, i8* %326, i64 9
%328 = load i32, i32* %12
%329 = sext i32 %328 to i64
%330 = getelementptr inbounds i8, i8* %327, i64 %329
%331 = load i32, i32* %12
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds i8, i8* %330, i64 %332
%334 = getelementptr inbounds i8, i8* %333, i64 0
%335 = load i8, i8* %334
%336 = zext i8 %335 to i32
%337 = sub nsw i32 %336, 48
br label %352
338: ; preds = %312
%339 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%340 = getelementptr inbounds i8, i8* %339, i64 9
%341 = load i32, i32* %12
%342 = sext i32 %341 to i64
%343 = getelementptr inbounds i8, i8* %340, i64 %342
%344 = load i32, i32* %12
%345 = sext i32 %344 to i64
%346 = getelementptr inbounds i8, i8* %343, i64 %345
%347 = getelementptr inbounds i8, i8* %346, i64 0
%348 = load i8, i8* %347
%349 = call i32 @tolower(i8 zeroext %348)
%350 = add nsw i32 %349, 10
%351 = sub nsw i32 %350, 97
br label %352
352: ; preds = %338, %325
%353 = phi i32 [ %337, %325 ], [ %351, %338 ]
%354 = shl i32 %353, 4
%355 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%356 = getelementptr inbounds i8, i8* %355, i64 9
%357 = load i32, i32* %12
%358 = sext i32 %357 to i64
%359 = getelementptr inbounds i8, i8* %356, i64 %358
%360 = load i32, i32* %12
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds i8, i8* %359, i64 %361
%363 = getelementptr inbounds i8, i8* %362, i64 1
%364 = load i8, i8* %363
%365 = call i64 @isdigit(i8 zeroext %364)
%366 = icmp ne i64 %365, 0
br i1 %366, label %367, label %380
367: ; preds = %352
%368 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%369 = getelementptr inbounds i8, i8* %368, i64 9
%370 = load i32, i32* %12
%371 = sext i32 %370 to i64
%372 = getelementptr inbounds i8, i8* %369, i64 %371
%373 = load i32, i32* %12
%374 = sext i32 %373 to i64
%375 = getelementptr inbounds i8, i8* %372, i64 %374
%376 = getelementptr inbounds i8, i8* %375, i64 1
%377 = load i8, i8* %376
%378 = zext i8 %377 to i32
%379 = sub nsw i32 %378, 48
br label %394
380: ; preds = %352
%381 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%382 = getelementptr inbounds i8, i8* %381, i64 9
%383 = load i32, i32* %12
%384 = sext i32 %383 to i64
%385 = getelementptr inbounds i8, i8* %382, i64 %384
%386 = load i32, i32* %12
%387 = sext i32 %386 to i64
%388 = getelementptr inbounds i8, i8* %385, i64 %387
%389 = getelementptr inbounds i8, i8* %388, i64 1
%390 = load i8, i8* %389
%391 = call i32 @tolower(i8 zeroext %390)
%392 = add nsw i32 %391, 10
%393 = sub nsw i32 %392, 97
br label %394
394: ; preds = %380, %367
%395 = phi i32 [ %379, %367 ], [ %393, %380 ]
%396 = add nsw i32 %354, %395
%397 = trunc i32 %396 to i8
%398 = load i32, i32* %12
%399 = sext i32 %398 to i64
%400 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 %399
store i8 %397, i8* %400
%401 = load i32, i32* %12
%402 = sext i32 %401 to i64
%403 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 %402
%404 = load i8, i8* %403
%405 = zext i8 %404 to i32
%406 = load i8, i8* %8
%407 = zext i8 %406 to i32
%408 = add nsw i32 %407, %405
%409 = trunc i32 %408 to i8
store i8 %409, i8* %8
br label %410
410: ; preds = %394
%411 = load i32, i32* %12
%412 = add nsw i32 %411, 1
store i32 %412, i32* %12
br label %308
413: ; preds = %308
%414 = load i8, i8* %7
%415 = zext i8 %414 to i32
%416 = load i32, i32* %11
%417 = add nsw i32 %415, %416
%418 = load i32, i32* %9
%419 = and i32 %418, 255
%420 = add i32 %417, %419
%421 = load i32, i32* %9
%422 = lshr i32 %421, 8
%423 = and i32 %422, 255
%424 = add i32 %420, %423
%425 = load i8, i8* %8
%426 = zext i8 %425 to i32
%427 = add i32 %426, %424
%428 = trunc i32 %427 to i8
store i8 %428, i8* %8
%429 = load i8, i8* %8
%430 = zext i8 %429 to i32
%431 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%432 = getelementptr inbounds i8, i8* %431, i64 9
%433 = load i32, i32* %11
%434 = sext i32 %433 to i64
%435 = getelementptr inbounds i8, i8* %432, i64 %434
%436 = load i32, i32* %11
%437 = sext i32 %436 to i64
%438 = getelementptr inbounds i8, i8* %435, i64 %437
%439 = getelementptr inbounds i8, i8* %438, i64 0
%440 = load i8, i8* %439
%441 = call i64 @isdigit(i8 zeroext %440)
%442 = icmp ne i64 %441, 0
br i1 %442, label %443, label %456
443: ; preds = %413
%444 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%445 = getelementptr inbounds i8, i8* %444, i64 9
%446 = load i32, i32* %11
%447 = sext i32 %446 to i64
%448 = getelementptr inbounds i8, i8* %445, i64 %447
%449 = load i32, i32* %11
%450 = sext i32 %449 to i64
%451 = getelementptr inbounds i8, i8* %448, i64 %450
%452 = getelementptr inbounds i8, i8* %451, i64 0
%453 = load i8, i8* %452
%454 = zext i8 %453 to i32
%455 = sub nsw i32 %454, 48
br label %470
456: ; preds = %413
%457 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%458 = getelementptr inbounds i8, i8* %457, i64 9
%459 = load i32, i32* %11
%460 = sext i32 %459 to i64
%461 = getelementptr inbounds i8, i8* %458, i64 %460
%462 = load i32, i32* %11
%463 = sext i32 %462 to i64
%464 = getelementptr inbounds i8, i8* %461, i64 %463
%465 = getelementptr inbounds i8, i8* %464, i64 0
%466 = load i8, i8* %465
%467 = call i32 @tolower(i8 zeroext %466)
%468 = add nsw i32 %467, 10
%469 = sub nsw i32 %468, 97
br label %470
470: ; preds = %456, %443
%471 = phi i32 [ %455, %443 ], [ %469, %456 ]
%472 = shl i32 %471, 4
%473 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%474 = getelementptr inbounds i8, i8* %473, i64 9
%475 = load i32, i32* %11
%476 = sext i32 %475 to i64
%477 = getelementptr inbounds i8, i8* %474, i64 %476
%478 = load i32, i32* %11
%479 = sext i32 %478 to i64
%480 = getelementptr inbounds i8, i8* %477, i64 %479
%481 = getelementptr inbounds i8, i8* %480, i64 1
%482 = load i8, i8* %481
%483 = call i64 @isdigit(i8 zeroext %482)
%484 = icmp ne i64 %483, 0
br i1 %484, label %485, label %498
485: ; preds = %470
%486 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%487 = getelementptr inbounds i8, i8* %486, i64 9
%488 = load i32, i32* %11
%489 = sext i32 %488 to i64
%490 = getelementptr inbounds i8, i8* %487, i64 %489
%491 = load i32, i32* %11
%492 = sext i32 %491 to i64
%493 = getelementptr inbounds i8, i8* %490, i64 %492
%494 = getelementptr inbounds i8, i8* %493, i64 1
%495 = load i8, i8* %494
%496 = zext i8 %495 to i32
%497 = sub nsw i32 %496, 48
br label %512
498: ; preds = %470
%499 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%500 = getelementptr inbounds i8, i8* %499, i64 9
%501 = load i32, i32* %11
%502 = sext i32 %501 to i64
%503 = getelementptr inbounds i8, i8* %500, i64 %502
%504 = load i32, i32* %11
%505 = sext i32 %504 to i64
%506 = getelementptr inbounds i8, i8* %503, i64 %505
%507 = getelementptr inbounds i8, i8* %506, i64 1
%508 = load i8, i8* %507
%509 = call i32 @tolower(i8 zeroext %508)
%510 = add nsw i32 %509, 10
%511 = sub nsw i32 %510, 97
br label %512
512: ; preds = %498, %485
%513 = phi i32 [ %497, %485 ], [ %511, %498 ]
%514 = add nsw i32 %472, %513
%515 = sub nsw i32 0, %514
%516 = trunc i32 %515 to i8
%517 = zext i8 %516 to i32
%518 = icmp ne i32 %430, %517
br i1 %518, label %519, label %524
519: ; preds = %512
%520 = load i32, i32* @stderr
%521 = load i8*, i8** %3
%522 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %520, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %521)
%523 = call i32 @exit(i32 1)
unreachable
524: ; preds = %512
%525 = load i8, i8* %7
%526 = zext i8 %525 to i32
%527 = icmp eq i32 %526, 4
br i1 %527, label %528, label %545
528: ; preds = %524
%529 = load i32, i32* %11
%530 = icmp ne i32 %529, 2
br i1 %530, label %531, label %536
531: ; preds = %528
%532 = load i32, i32* @stderr
%533 = load i8*, i8** %3
%534 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %532, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %533)
%535 = call i32 @exit(i32 1)
unreachable
536: ; preds = %528
%537 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%538 = load i8, i8* %537
%539 = zext i8 %538 to i32
%540 = shl i32 %539, 8
%541 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 1
%542 = load i8, i8* %541
%543 = zext i8 %542 to i32
%544 = or i32 %540, %543
store i32 %544, i32* %10
br label %22
545: ; preds = %524
%546 = load i8, i8* %7
%547 = zext i8 %546 to i32
%548 = icmp ne i32 %547, 0
br i1 %548, label %549, label %556
549: ; preds = %545
%550 = load i32, i32* @stderr
%551 = load i8*, i8** %3
%552 = load i8, i8* %7
%553 = zext i8 %552 to i32
%554 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %550, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %551, i32 %553)
%555 = call i32 @exit(i32 1)
unreachable
556: ; preds = %545
store i32 0, i32* %12
br label %557
557: ; preds = %569, %556
%558 = load i32, i32* %12
%559 = load i32, i32* %11
%560 = icmp slt i32 %558, %559
br i1 %560, label %561, label %572
561: ; preds = %557
%562 = load i32, i32* %9
%563 = add i32 %562, 1
store i32 %563, i32* %9
%564 = load i32, i32* %12
%565 = sext i32 %564 to i64
%566 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 %565
%567 = load i8, i8* %566
%568 = call i32 @store_data(i32 %562, i8 zeroext %567)
br label %569
569: ; preds = %561
%570 = load i32, i32* %12
%571 = add nsw i32 %570, 1
store i32 %571, i32* %12
br label %557
572: ; preds = %557
br label %22
573: ; preds = %140, %22
%574 = load i32*, i32** %4
%575 = call i32 @fclose(i32* %574)
store i32 1, i32* %2
br label %576
576: ; preds = %573, %38
%577 = load i32, i32* %2
ret i32 %577
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"%s: bad HEX record: %s\0A\00"
@.str.2 = [24 x i8] c"%s: too short hex line\0A\00"
@.str.3 = [22 x i8] c"%s: bad HEX checksum\0A\00"
@.str.4 = [46 x i8] c"%s: invalid HEX linear address record length\0A\00"
@.str.5 = [33 x i8] c"%s: unknown HEX record type: %d\0A\00"
define i32 @read_hex(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %22, label %8
8: ; preds = %1
%9 = call i64 @fgets(i8* %4, i32 256, i32* %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %305, label %11
11: ; preds = %8
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 1
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 2
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 3
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 4
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 5
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 6
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 7
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 8
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 9
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 1
br label %288
22: ; preds = %1
%23 = tail call i32 @perror(i8* %0)
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %288, %27
%26 = load i8, i8* %4
switch i8 %26, label %305 [
i8 10, label %27
i8 58, label %30
]
27: ; preds = %296, %270, %25, %90
%28 = call i64 @fgets(i8* %4, i32 256, i32* %6)
%29 = icmp eq i64 %28, 0
br i1 %29, label %305, label %25
30: ; preds = %25
%31 = load i8, i8* %12
%32 = call i32 @isxdigit(i8 zeroext %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %62, label %34
34: ; preds = %30
%35 = load i8, i8* %13
%36 = call i32 @isxdigit(i8 zeroext %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %62, label %38
38: ; preds = %34
%39 = load i8, i8* %14
%40 = call i32 @isxdigit(i8 zeroext %39)
%41 = icmp eq i32 %40, 0
br i1 %41, label %62, label %42
42: ; preds = %38
%43 = load i8, i8* %15
%44 = call i32 @isxdigit(i8 zeroext %43)
%45 = icmp eq i32 %44, 0
br i1 %45, label %62, label %46
46: ; preds = %42
%47 = load i8, i8* %16
%48 = call i32 @isxdigit(i8 zeroext %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %62, label %50
50: ; preds = %46
%51 = load i8, i8* %17
%52 = call i32 @isxdigit(i8 zeroext %51)
%53 = icmp eq i32 %52, 0
br i1 %53, label %62, label %54
54: ; preds = %50
%55 = load i8, i8* %18
%56 = call i32 @isxdigit(i8 zeroext %55)
%57 = icmp eq i32 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %54
%59 = load i8, i8* %19
%60 = call i32 @isxdigit(i8 zeroext %59)
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %58, %54, %50, %46, %42, %38, %34, %30
%63 = load i32, i32* @stderr
%64 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %4)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = load i8, i8* %18
%68 = call i64 @isdigit(i8 zeroext %67)
%69 = icmp eq i64 %68, 0
%70 = load i8, i8* %18
br i1 %69, label %74, label %71
71: ; preds = %66
%72 = zext i8 %70 to i32
%73 = add nsw i32 %72, -48
br label %77
74: ; preds = %66
%75 = call i32 @tolower(i8 zeroext %70)
%76 = add nsw i32 %75, -87
br label %77
77: ; preds = %74, %71
%78 = phi i32 [ %73, %71 ], [ %76, %74 ]
%79 = shl i32 %78, 4
%80 = load i8, i8* %19
%81 = call i64 @isdigit(i8 zeroext %80)
%82 = icmp eq i64 %81, 0
%83 = load i8, i8* %19
br i1 %82, label %87, label %84
84: ; preds = %77
%85 = zext i8 %83 to i32
%86 = add nsw i32 %85, -48
br label %90
87: ; preds = %77
%88 = call i32 @tolower(i8 zeroext %83)
%89 = add nsw i32 %88, -87
br label %90
90: ; preds = %87, %84
%91 = phi i32 [ %86, %84 ], [ %89, %87 ]
%92 = add nsw i32 %91, %79
%93 = trunc i32 %92 to i8
switch i8 %93, label %94 [
i8 1, label %305
i8 5, label %27
]
94: ; preds = %90
%95 = load i8, i8* %12
%96 = call i64 @isdigit(i8 zeroext %95)
%97 = icmp eq i64 %96, 0
%98 = load i8, i8* %12
br i1 %97, label %102, label %99
99: ; preds = %94
%100 = zext i8 %98 to i32
%101 = add nsw i32 %100, -48
br label %105
102: ; preds = %94
%103 = call i32 @tolower(i8 zeroext %98)
%104 = add nsw i32 %103, -87
br label %105
105: ; preds = %102, %99
%106 = phi i32 [ %101, %99 ], [ %104, %102 ]
%107 = shl i32 %106, 4
%108 = load i8, i8* %13
%109 = call i64 @isdigit(i8 zeroext %108)
%110 = icmp eq i64 %109, 0
%111 = load i8, i8* %13
br i1 %110, label %115, label %112
112: ; preds = %105
%113 = zext i8 %111 to i32
%114 = add nsw i32 %113, -48
br label %118
115: ; preds = %105
%116 = call i32 @tolower(i8 zeroext %111)
%117 = add nsw i32 %116, -87
br label %118
118: ; preds = %115, %112
%119 = phi i32 [ %114, %112 ], [ %117, %115 ]
%120 = add i32 %119, %107
%121 = call i32 @strlen(i8* %4)
%122 = shl nsw i32 %120, 1
%123 = add nsw i32 %122, 11
%124 = icmp slt i32 %121, %123
br i1 %124, label %125, label %129
125: ; preds = %118
%126 = load i32, i32* @stderr
%127 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %118
%130 = load i8, i8* %14
%131 = call i64 @isdigit(i8 zeroext %130)
%132 = icmp eq i64 %131, 0
%133 = load i8, i8* %14
br i1 %132, label %137, label %134
134: ; preds = %129
%135 = zext i8 %133 to i32
%136 = add nsw i32 %135, -48
br label %140
137: ; preds = %129
%138 = call i32 @tolower(i8 zeroext %133)
%139 = add nsw i32 %138, -87
br label %140
140: ; preds = %137, %134
%141 = phi i32 [ %136, %134 ], [ %139, %137 ]
%142 = shl i32 %141, 4
%143 = load i8, i8* %15
%144 = call i64 @isdigit(i8 zeroext %143)
%145 = icmp eq i64 %144, 0
%146 = load i8, i8* %15
br i1 %145, label %150, label %147
147: ; preds = %140
%148 = zext i8 %146 to i32
%149 = add nsw i32 %148, -48
br label %153
150: ; preds = %140
%151 = call i32 @tolower(i8 zeroext %146)
%152 = add nsw i32 %151, -87
br label %153
153: ; preds = %150, %147
%154 = phi i32 [ %149, %147 ], [ %152, %150 ]
%155 = add nsw i32 %154, %142
%156 = shl i32 %155, 8
%157 = or i32 %156, %290
%158 = load i8, i8* %16
%159 = call i64 @isdigit(i8 zeroext %158)
%160 = icmp eq i64 %159, 0
%161 = load i8, i8* %16
br i1 %160, label %165, label %162
162: ; preds = %153
%163 = zext i8 %161 to i32
%164 = add nsw i32 %163, -48
br label %168
165: ; preds = %153
%166 = call i32 @tolower(i8 zeroext %161)
%167 = add nsw i32 %166, -87
br label %168
168: ; preds = %165, %162
%169 = phi i32 [ %164, %162 ], [ %167, %165 ]
%170 = shl i32 %169, 4
%171 = load i8, i8* %17
%172 = call i64 @isdigit(i8 zeroext %171)
%173 = icmp eq i64 %172, 0
%174 = load i8, i8* %17
br i1 %173, label %178, label %175
175: ; preds = %168
%176 = zext i8 %174 to i32
%177 = add nsw i32 %176, -48
br label %181
178: ; preds = %168
%179 = call i32 @tolower(i8 zeroext %174)
%180 = add nsw i32 %179, -87
br label %181
181: ; preds = %178, %175
%182 = phi i32 [ %177, %175 ], [ %180, %178 ]
%183 = add nsw i32 %182, %170
%184 = or i32 %157, %183
%185 = icmp sgt i32 %120, 0
br i1 %185, label %186, label %225
186: ; preds = %181
%187 = zext i32 %120 to i64
br label %188
188: ; preds = %186, %217
%189 = phi i64 [ 0, %186 ], [ %223, %217 ]
%190 = phi i8 [ 0, %186 ], [ %222, %217 ]
%191 = getelementptr inbounds i8, i8* %20, i64 %189
%192 = getelementptr inbounds i8, i8* %191, i64 %189
%193 = load i8, i8* %192
%194 = call i64 @isdigit(i8 zeroext %193)
%195 = icmp eq i64 %194, 0
%196 = load i8, i8* %192
br i1 %195, label %200, label %197
197: ; preds = %188
%198 = zext i8 %196 to i32
%199 = add nsw i32 %198, -48
br label %203
200: ; preds = %188
%201 = call i32 @tolower(i8 zeroext %196)
%202 = add nsw i32 %201, -87
br label %203
203: ; preds = %200, %197
%204 = phi i32 [ %199, %197 ], [ %202, %200 ]
%205 = shl i32 %204, 4
%206 = getelementptr inbounds i8, i8* %192, i64 1
%207 = load i8, i8* %206
%208 = call i64 @isdigit(i8 zeroext %207)
%209 = icmp eq i64 %208, 0
%210 = load i8, i8* %206
br i1 %209, label %214, label %211
211: ; preds = %203
%212 = zext i8 %210 to i32
%213 = add nsw i32 %212, -48
br label %217
214: ; preds = %203
%215 = call i32 @tolower(i8 zeroext %210)
%216 = add nsw i32 %215, -87
br label %217
217: ; preds = %214, %211
%218 = phi i32 [ %213, %211 ], [ %216, %214 ]
%219 = add nsw i32 %218, %205
%220 = trunc i32 %219 to i8
%221 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %189
store i8 %220, i8* %221
%222 = add i8 %190, %220
%223 = add nuw nsw i64 %189, 1
%224 = icmp eq i64 %223, %187
br i1 %224, label %225, label %188
225: ; preds = %217, %181
%226 = phi i8 [ 0, %181 ], [ %222, %217 ]
%227 = add i32 %120, %92
%228 = add i32 %227, %183
%229 = lshr i32 %184, 8
%230 = add i32 %228, %229
%231 = trunc i32 %230 to i8
%232 = add i8 %226, %231
%233 = sext i32 %120 to i64
%234 = getelementptr inbounds i8, i8* %20, i64 %233
%235 = getelementptr inbounds i8, i8* %234, i64 %233
%236 = load i8, i8* %235
%237 = call i64 @isdigit(i8 zeroext %236)
%238 = icmp eq i64 %237, 0
%239 = load i8, i8* %235
br i1 %238, label %243, label %240
240: ; preds = %225
%241 = zext i8 %239 to i32
%242 = sub nsw i32 48, %241
br label %246
243: ; preds = %225
%244 = call i32 @tolower(i8 zeroext %239)
%245 = sub i32 87, %244
br label %246
246: ; preds = %243, %240
%247 = phi i32 [ %242, %240 ], [ %245, %243 ]
%248 = shl i32 %247, 4
%249 = getelementptr inbounds i8, i8* %235, i64 1
%250 = load i8, i8* %249
%251 = call i64 @isdigit(i8 zeroext %250)
%252 = icmp eq i64 %251, 0
%253 = load i8, i8* %249
br i1 %252, label %257, label %254
254: ; preds = %246
%255 = zext i8 %253 to i32
%256 = sub nsw i32 48, %255
br label %260
257: ; preds = %246
%258 = call i32 @tolower(i8 zeroext %253)
%259 = sub i32 87, %258
br label %260
260: ; preds = %257, %254
%261 = phi i32 [ %256, %254 ], [ %259, %257 ]
%262 = add i32 %261, %248
%263 = trunc i32 %262 to i8
%264 = icmp eq i8 %232, %263
br i1 %264, label %269, label %265
265: ; preds = %260
%266 = load i32, i32* @stderr
%267 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %266, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%268 = call i32 @exit(i32 1)
unreachable
269: ; preds = %260
switch i8 %93, label %291 [
i8 4, label %273
i8 0, label %270
]
270: ; preds = %269
br i1 %185, label %271, label %27
271: ; preds = %270
%272 = zext i32 %120 to i64
br label %296
273: ; preds = %269
%274 = icmp eq i32 %120, 2
br i1 %274, label %279, label %275
275: ; preds = %273
%276 = load i32, i32* @stderr
%277 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %276, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%278 = call i32 @exit(i32 1)
unreachable
279: ; preds = %273
%280 = load i8, i8* %5
%281 = zext i8 %280 to i32
%282 = shl nuw nsw i32 %281, 8
%283 = load i8, i8* %21
%284 = zext i8 %283 to i32
%285 = or i32 %282, %284
%286 = call i64 @fgets(i8* %4, i32 256, i32* %6)
%287 = icmp eq i64 %286, 0
br i1 %287, label %305, label %288
288: ; preds = %11, %279
%289 = phi i32 [ 0, %11 ], [ %285, %279 ]
%290 = shl i32 %289, 16
br label %25
291: ; preds = %269
%292 = and i32 %92, 255
%293 = load i32, i32* @stderr
%294 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %293, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %0, i32 %292)
%295 = call i32 @exit(i32 1)
unreachable
296: ; preds = %271, %296
%297 = phi i64 [ 0, %271 ], [ %303, %296 ]
%298 = phi i32 [ %184, %271 ], [ %299, %296 ]
%299 = add i32 %298, 1
%300 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %297
%301 = load i8, i8* %300
%302 = call i32 @store_data(i32 %298, i8 zeroext %301)
%303 = add nuw nsw i64 %297, 1
%304 = icmp eq i64 %303, %272
br i1 %304, label %27, label %296
305: ; preds = %279, %90, %27, %25, %8
%306 = phi i32 [ 1, %8 ], [ 0, %25 ], [ 1, %27 ], [ 1, %90 ], [ 1, %279 ]
%307 = call i32 @fclose(i32* %6)
ret i32 %306
}