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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ isdigit(unsigned char);
int /*<<< orphan*/ isxdigit(unsigned char);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int tolower(unsigned char);
int read_srec(char *filename, unsigned char *output, u_int32_t *start) {
  FILE *fd;
  unsigned char buf[256];
  unsigned char *data;
  u_int32_t address;
  int bytes, output_len;
  fd = fopen(filename, "r");
  if (!fd) {
    fprintf(stderr, "\n-- ");
    perror(filename);
    exit(1);
  }
  output_len = 0;
  while (fgets((char *)buf, sizeof(buf), fd)) {
    if (buf[0] == '\n')
      continue;
    if (buf[0] != 'S') {
      fprintf(stderr, "%s: bad file format\n", filename);
      exit(1);
    }
    if (buf[1] == '7' || buf[1] == '8' || buf[1] == '9')
      break;
    if (!isxdigit(buf[2]) || !isxdigit(buf[3])) {
      fprintf(stderr, "%s: bad record: %s\n", filename, buf);
      exit(1);
    }
    bytes = (((isdigit((buf + 2)[0]) ? ((buf + 2)[0]) - '0'
                                     : tolower((buf + 2)[0]) + 10 - 'a')
              << 4) +
             (isdigit((buf + 2)[1]) ? ((buf + 2)[1]) - '0'
                                    : tolower((buf + 2)[1]) + 10 - 'a'));
    --bytes;
    address = 0;
    data = buf + 4;
    switch (buf[1]) {
    case '3':
      address = (((isdigit((data)[0]) ? ((data)[0]) - '0'
                                      : tolower((data)[0]) + 10 - 'a')
                  << 4) +
                 (isdigit((data)[1]) ? ((data)[1]) - '0'
                                     : tolower((data)[1]) + 10 - 'a'));
      data += 2;
      --bytes;
    case '2':
      address = (address << 8) |
                (((isdigit((data)[0]) ? ((data)[0]) - '0'
                                      : tolower((data)[0]) + 10 - 'a')
                  << 4) +
                 (isdigit((data)[1]) ? ((data)[1]) - '0'
                                     : tolower((data)[1]) + 10 - 'a'));
      data += 2;
      --bytes;
    case '1':
      address = (address << 8) |
                (((isdigit((data)[0]) ? ((data)[0]) - '0'
                                      : tolower((data)[0]) + 10 - 'a')
                  << 4) +
                 (isdigit((data)[1]) ? ((data)[1]) - '0'
                                     : tolower((data)[1]) + 10 - 'a'));
      data += 2;
      address = (address << 8) |
                (((isdigit((data)[0]) ? ((data)[0]) - '0'
                                      : tolower((data)[0]) + 10 - 'a')
                  << 4) +
                 (isdigit((data)[1]) ? ((data)[1]) - '0'
                                     : tolower((data)[1]) + 10 - 'a'));
      data += 2;
      bytes -= 2;
      if (address + bytes >= 0x40000) {
        fprintf(stderr, "%s: address too large: %s\n", filename, buf);
        exit(1);
      }
      while (bytes-- > 0) {
        if (address < *start)
          *start = address;
        output[address++] =
            (((isdigit((data)[0]) ? ((data)[0]) - '0'
                                  : tolower((data)[0]) + 10 - 'a')
              << 4) +
             (isdigit((data)[1]) ? ((data)[1]) - '0'
                                 : tolower((data)[1]) + 10 - 'a'));
        data += 2;
      }
      if (output_len < address)
        output_len = address;
      break;
    }
  }
  return output_len;
}


x86 assembly (clang, -O0):
<read_srec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11e0 <read_srec+0x60>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe3c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0x134(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1937 <read_srec+0x7b7>
movzbl -0x120(%rbp),%eax
cmp    $0xa,%eax
jne    121e <read_srec+0x9e>
jmp    11ea <read_srec+0x6a>
movzbl -0x120(%rbp),%eax
cmp    $0x53,%eax
je     1253 <read_srec+0xd3>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdc5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movzbl -0x11f(%rbp),%eax
cmp    $0x37,%eax
je     1283 <read_srec+0x103>
movzbl -0x11f(%rbp),%eax
cmp    $0x38,%eax
je     1283 <read_srec+0x103>
movzbl -0x11f(%rbp),%eax
cmp    $0x39,%eax
jne    1288 <read_srec+0x108>
jmp    1937 <read_srec+0x7b7>
movzbl -0x11e(%rbp),%edi
call   10a0 <isxdigit@plt>
cmp    $0x0,%eax
je     12b2 <read_srec+0x132>
movzbl -0x11d(%rbp),%edi
call   10a0 <isxdigit@plt>
cmp    $0x0,%eax
jne    12de <read_srec+0x15e>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xd4f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movzbl -0x11e(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1309 <read_srec+0x189>
movzbl -0x11e(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x138(%rbp)
jmp    1321 <read_srec+0x1a1>
movzbl -0x11e(%rbp),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x138(%rbp)
mov    -0x138(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x13c(%rbp)
movzbl -0x11d(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     135b <read_srec+0x1db>
movzbl -0x11d(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x140(%rbp)
jmp    1373 <read_srec+0x1f3>
movzbl -0x11d(%rbp),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x140(%rbp)
mov    -0x13c(%rbp),%eax
mov    -0x140(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x130(%rbp)
mov    -0x130(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x130(%rbp)
movl   $0x0,-0x12c(%rbp)
lea    -0x11c(%rbp),%rax
mov    %rax,-0x128(%rbp)
movzbl -0x11f(%rbp),%eax
mov    %eax,-0x144(%rbp)
sub    $0x31,%eax
je     15c6 <read_srec+0x446>
jmp    13c9 <read_srec+0x249>
mov    -0x144(%rbp),%eax
sub    $0x32,%eax
je     14d0 <read_srec+0x350>
jmp    13dd <read_srec+0x25d>
mov    -0x144(%rbp),%eax
sub    $0x33,%eax
jne    1932 <read_srec+0x7b2>
jmp    13f1 <read_srec+0x271>
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1422 <read_srec+0x2a2>
mov    -0x128(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x148(%rbp)
jmp    143d <read_srec+0x2bd>
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x148(%rbp)
mov    -0x148(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x14c(%rbp)
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     147f <read_srec+0x2ff>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x150(%rbp)
jmp    149b <read_srec+0x31b>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x150(%rbp)
mov    -0x14c(%rbp),%eax
mov    -0x150(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x12c(%rbp)
mov    -0x128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x128(%rbp)
mov    -0x130(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x130(%rbp)
mov    -0x12c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x154(%rbp)
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1510 <read_srec+0x390>
mov    -0x128(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x158(%rbp)
jmp    152b <read_srec+0x3ab>
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x158(%rbp)
mov    -0x158(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x15c(%rbp)
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     156d <read_srec+0x3ed>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x160(%rbp)
jmp    1589 <read_srec+0x409>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x160(%rbp)
mov    -0x154(%rbp),%eax
mov    -0x15c(%rbp),%ecx
mov    -0x160(%rbp),%edx
add    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x12c(%rbp)
mov    -0x128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x128(%rbp)
mov    -0x130(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x130(%rbp)
mov    -0x12c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x164(%rbp)
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1606 <read_srec+0x486>
mov    -0x128(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x168(%rbp)
jmp    1621 <read_srec+0x4a1>
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x168(%rbp)
mov    -0x168(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x16c(%rbp)
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1663 <read_srec+0x4e3>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x170(%rbp)
jmp    167f <read_srec+0x4ff>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x170(%rbp)
mov    -0x164(%rbp),%eax
mov    -0x16c(%rbp),%ecx
mov    -0x170(%rbp),%edx
add    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x12c(%rbp)
mov    -0x128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x128(%rbp)
mov    -0x12c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x174(%rbp)
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     16ed <read_srec+0x56d>
mov    -0x128(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x178(%rbp)
jmp    1708 <read_srec+0x588>
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x178(%rbp)
mov    -0x178(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x17c(%rbp)
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     174a <read_srec+0x5ca>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x180(%rbp)
jmp    1766 <read_srec+0x5e6>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x180(%rbp)
mov    -0x174(%rbp),%eax
mov    -0x17c(%rbp),%ecx
mov    -0x180(%rbp),%edx
add    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x12c(%rbp)
mov    -0x128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x128(%rbp)
mov    -0x130(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x130(%rbp)
mov    -0x12c(%rbp),%eax
add    -0x130(%rbp),%eax
cmp    $0x40000,%eax
jl     17e6 <read_srec+0x666>
mov    0x281f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0x85b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    17eb <read_srec+0x66b>
mov    -0x130(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x130(%rbp)
cmp    $0x0,%eax
jle    190f <read_srec+0x78f>
mov    -0x12c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1823 <read_srec+0x6a3>
mov    -0x12c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1854 <read_srec+0x6d4>
mov    -0x128(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x184(%rbp)
jmp    186f <read_srec+0x6ef>
mov    -0x128(%rbp),%rax
movzbl (%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x184(%rbp)
mov    -0x184(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x188(%rbp)
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     18b1 <read_srec+0x731>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x18c(%rbp)
jmp    18cd <read_srec+0x74d>
mov    -0x128(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1060 <tolower@plt>
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x18c(%rbp)
mov    -0x188(%rbp),%eax
mov    -0x18c(%rbp),%ecx
add    %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x12c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x12c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x128(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x128(%rbp)
jmp    17eb <read_srec+0x66b>
mov    -0x134(%rbp),%eax
cmp    -0x12c(%rbp),%eax
jge    192d <read_srec+0x7ad>
mov    -0x12c(%rbp),%eax
mov    %eax,-0x134(%rbp)
jmp    1932 <read_srec+0x7b2>
jmp    11ea <read_srec+0x6a>
mov    -0x134(%rbp),%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_srec>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %rdx,0x10(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%r12
lea    0xe5b(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     157a <read_srec+0x3fa>
mov    %rax,%rbp
xor    %r13d,%r13d
lea    0x20(%rsp),%r15
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1518 <read_srec+0x398>
mov    0x20(%rsp),%al
cmp    $0xa,%al
je     11c0 <read_srec+0x40>
cmp    $0x53,%al
jne    152d <read_srec+0x3ad>
mov    0x21(%rsp),%al
add    $0xc9,%al
cmp    $0x3,%al
jb     1518 <read_srec+0x398>
movzbl 0x22(%rsp),%edi
call   10a0 <isxdigit@plt>
test   %eax,%eax
je     1551 <read_srec+0x3d1>
movzbl 0x23(%rsp),%edi
call   10a0 <isxdigit@plt>
test   %eax,%eax
je     1551 <read_srec+0x3d1>
movzbl 0x22(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x22(%rsp),%ebx
test   %rax,%rax
je     1234 <read_srec+0xb4>
add    $0xffffffd0,%ebx
jmp    1240 <read_srec+0xc0>
mov    %ebx,%edi
call   1060 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
movzbl 0x23(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x23(%rsp),%r14d
test   %rax,%rax
je     125b <read_srec+0xdb>
add    $0xffffffd0,%r14d
jmp    126a <read_srec+0xea>
mov    %r14d,%edi
call   1060 <tolower@plt>
mov    %eax,%r14d
add    $0xffffffa9,%r14d
mov    0x21(%rsp),%al
cmp    $0x31,%al
je     129a <read_srec+0x11a>
cmp    $0x32,%al
je     12bf <read_srec+0x13f>
cmp    $0x33,%al
jne    11c0 <read_srec+0x40>
shl    $0x4,%ebx
movzbl 0x24(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x24(%rsp),%edi
test   %rax,%rax
je     12dc <read_srec+0x15c>
add    $0xffffffd0,%edi
jmp    12e6 <read_srec+0x166>
mov    %r13d,0x4(%rsp)
mov    %r12,0x8(%rsp)
shl    $0x4,%ebx
add    %ebx,%r14d
add    $0xffffffff,%r14d
movl   $0x0,(%rsp)
lea    0x24(%rsp),%r13
jmp    138d <read_srec+0x20d>
mov    %r13d,0x4(%rsp)
mov    %r12,0x8(%rsp)
shl    $0x4,%ebx
add    %ebx,%r14d
add    $0xffffffff,%r14d
xor    %ebx,%ebx
lea    0x24(%rsp),%r13
jmp    132a <read_srec+0x1aa>
call   1060 <tolower@plt>
mov    %eax,%edi
add    $0xffffffa9,%edi
add    %ebx,%r14d
shl    $0x4,%edi
mov    %edi,(%rsp)
movzbl 0x25(%rsp),%edi
call   1030 <isdigit@plt>
movzbl 0x25(%rsp),%ebx
test   %rax,%rax
mov    %r12,0x8(%rsp)
mov    %r13d,0x4(%rsp)
je     1312 <read_srec+0x192>
add    $0xffffffd0,%ebx
jmp    131e <read_srec+0x19e>
mov    %ebx,%edi
call   1060 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
add    (%rsp),%ebx
add    $0xfffffffe,%r14d
lea    0x26(%rsp),%r13
movzbl 0x0(%r13),%edi
call   1030 <isdigit@plt>
movzbl 0x0(%r13),%r12d
test   %rax,%rax
je     1344 <read_srec+0x1c4>
add    $0xffffffd0,%r12d
jmp    1353 <read_srec+0x1d3>
mov    %r12d,%edi
call   1060 <tolower@plt>
mov    %eax,%r12d
add    $0xffffffa9,%r12d
shl    $0x8,%ebx
shl    $0x4,%r12d
movzbl 0x1(%r13),%edi
call   1030 <isdigit@plt>
movzbl 0x1(%r13),%edi
test   %rax,%rax
je     1373 <read_srec+0x1f3>
add    $0xffffffd0,%edi
jmp    137d <read_srec+0x1fd>
call   1060 <tolower@plt>
mov    %eax,%edi
add    $0xffffffa9,%edi
add    %r12d,%edi
or     %ebx,%edi
mov    %edi,(%rsp)
add    $0x2,%r13
add    $0xffffffff,%r14d
movzbl 0x0(%r13),%edi
call   1030 <isdigit@plt>
movzbl 0x0(%r13),%ebx
test   %rax,%rax
je     13a6 <read_srec+0x226>
add    $0xffffffd0,%ebx
jmp    13b2 <read_srec+0x232>
mov    %ebx,%edi
call   1060 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
shl    $0x4,%ebx
movzbl 0x1(%r13),%edi
call   1030 <isdigit@plt>
movzbl 0x1(%r13),%r12d
test   %rax,%rax
je     13cf <read_srec+0x24f>
add    $0xffffffd0,%r12d
jmp    13de <read_srec+0x25e>
mov    %r12d,%edi
call   1060 <tolower@plt>
mov    %eax,%r12d
add    $0xffffffa9,%r12d
add    %ebx,%r12d
shll   $0x10,(%rsp)
shl    $0x8,%r12d
movzbl 0x2(%r13),%edi
call   1030 <isdigit@plt>
movzbl 0x2(%r13),%ebx
test   %rax,%rax
je     1402 <read_srec+0x282>
add    $0xffffffd0,%ebx
jmp    140e <read_srec+0x28e>
mov    %ebx,%edi
call   1060 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
or     (%rsp),%r12d
shl    $0x4,%ebx
movzbl 0x3(%r13),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
movzbl 0x3(%r13),%eax
test   %rcx,%rcx
je     1431 <read_srec+0x2b1>
add    $0xffffffd0,%eax
jmp    143b <read_srec+0x2bb>
mov    %eax,%edi
call   1060 <tolower@plt>
add    $0xffffffa9,%eax
add    %ebx,%eax
or     %eax,%r12d
lea    (%r12,%r14,1),%eax
add    $0xfffffffe,%eax
cmp    $0x3ffff,%eax
jg     15a3 <read_srec+0x423>
cmp    $0x3,%r14d
jl     1502 <read_srec+0x382>
add    $0xfffffffe,%r14d
add    $0x4,%r13
movslq %r12d,%r12
jmp    1496 <read_srec+0x316>
nopl   0x0(%rax)
mov    %eax,%edi
call   1060 <tolower@plt>
add    $0xffffffa9,%eax
add    %ebx,%eax
mov    0x18(%rsp),%rcx
mov    %al,(%rcx,%r12,1)
add    $0x1,%r12
add    $0xffffffff,%r14d
add    $0x2,%r13
test   %r14d,%r14d
jle    1502 <read_srec+0x382>
mov    0x10(%rsp),%rax
movslq (%rax),%rax
cmp    %rax,%r12
jge    14ab <read_srec+0x32b>
mov    0x10(%rsp),%rax
mov    %r12d,(%rax)
movzbl 0x0(%r13),%edi
call   1030 <isdigit@plt>
movzbl 0x0(%r13),%ebx
test   %rax,%rax
je     14d0 <read_srec+0x350>
add    $0xffffffd0,%ebx
jmp    14dc <read_srec+0x35c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1060 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
shl    $0x4,%ebx
movzbl 0x1(%r13),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
movzbl 0x1(%r13),%eax
test   %rcx,%rcx
je     1470 <read_srec+0x2f0>
add    $0xffffffd0,%eax
jmp    147a <read_srec+0x2fa>
mov    0x4(%rsp),%r13d
cmp    %r12d,%r13d
cmovl  %r12d,%r13d
mov    0x8(%rsp),%r12
jmp    11c0 <read_srec+0x40>
mov    %r13d,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aac(%rip),%rax
mov    (%rax),%edi
lea    0xaca(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2a88(%rip),%rax
mov    (%rax),%edi
lea    0xabb(%rip),%rsi
lea    0x20(%rsp),%rcx
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2a5f(%rip),%rax
mov    (%rax),%edi
lea    0xa78(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r12,%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2a36(%rip),%rax
mov    (%rax),%edi
lea    0xa7d(%rip),%rsi
lea    0x20(%rsp),%rcx
mov    0x8(%rsp),%rdx
jmp    1569 <read_srec+0x3e9>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [5 x i8] c"\0A-- \00"
@.str.2 = [21 x i8] c"%s: bad file format\0A\00"
@.str.3 = [20 x i8] c"%s: bad record: %s\0A\00"
@.str.4 = [27 x i8] c"%s: address too large: %s\0A\00"
define i32 @read_srec(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [256 x i8]
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%13 = load i8*, i8** %4
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %7
%15 = load i32*, i32** %7
%16 = icmp ne i32* %15, null
br i1 %16, label %23, label %17
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8*, i8** %4
%21 = call i32 @perror(i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %3
store i32 0, i32* %12
br label %24
24: ; preds = %408, %34, %23
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%26 = load i32*, i32** %7
%27 = call i64 @fgets(i8* %25, i32 256, i32* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %409
29: ; preds = %24
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %29
br label %24
35: ; preds = %29
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = icmp ne i32 %38, 83
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i32, i32* @stderr
%42 = load i8*, i8** %4
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %42)
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %35
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 1
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = icmp eq i32 %48, 55
br i1 %49, label %60, label %50
50: ; preds = %45
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 1
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = icmp eq i32 %53, 56
br i1 %54, label %60, label %55
55: ; preds = %50
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 1
%57 = load i8, i8* %56
%58 = zext i8 %57 to i32
%59 = icmp eq i32 %58, 57
br i1 %59, label %60, label %61
60: ; preds = %55, %50, %45
br label %409
61: ; preds = %55
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 2
%63 = load i8, i8* %62
%64 = call i32 @isxdigit(i8 zeroext %63)
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %71
66: ; preds = %61
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 3
%68 = load i8, i8* %67
%69 = call i32 @isxdigit(i8 zeroext %68)
%70 = icmp ne i32 %69, 0
br i1 %70, label %77, label %71
71: ; preds = %66, %61
%72 = load i32, i32* @stderr
%73 = load i8*, i8** %4
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %73, i8* %74)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %66
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%79 = getelementptr inbounds i8, i8* %78, i64 2
%80 = getelementptr inbounds i8, i8* %79, i64 0
%81 = load i8, i8* %80
%82 = call i64 @isdigit(i8 zeroext %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %91
84: ; preds = %77
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%86 = getelementptr inbounds i8, i8* %85, i64 2
%87 = getelementptr inbounds i8, i8* %86, i64 0
%88 = load i8, i8* %87
%89 = zext i8 %88 to i32
%90 = sub nsw i32 %89, 48
br label %99
91: ; preds = %77
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%93 = getelementptr inbounds i8, i8* %92, i64 2
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = call i32 @tolower(i8 zeroext %95)
%97 = add nsw i32 %96, 10
%98 = sub nsw i32 %97, 97
br label %99
99: ; preds = %91, %84
%100 = phi i32 [ %90, %84 ], [ %98, %91 ]
%101 = shl i32 %100, 4
%102 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%103 = getelementptr inbounds i8, i8* %102, i64 2
%104 = getelementptr inbounds i8, i8* %103, i64 1
%105 = load i8, i8* %104
%106 = call i64 @isdigit(i8 zeroext %105)
%107 = icmp ne i64 %106, 0
br i1 %107, label %108, label %115
108: ; preds = %99
%109 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%110 = getelementptr inbounds i8, i8* %109, i64 2
%111 = getelementptr inbounds i8, i8* %110, i64 1
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = sub nsw i32 %113, 48
br label %123
115: ; preds = %99
%116 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%117 = getelementptr inbounds i8, i8* %116, i64 2
%118 = getelementptr inbounds i8, i8* %117, i64 1
%119 = load i8, i8* %118
%120 = call i32 @tolower(i8 zeroext %119)
%121 = add nsw i32 %120, 10
%122 = sub nsw i32 %121, 97
br label %123
123: ; preds = %115, %108
%124 = phi i32 [ %114, %108 ], [ %122, %115 ]
%125 = add nsw i32 %101, %124
store i32 %125, i32* %11
%126 = load i32, i32* %11
%127 = add nsw i32 %126, -1
store i32 %127, i32* %11
store i32 0, i32* %10
%128 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%129 = getelementptr inbounds i8, i8* %128, i64 4
store i8* %129, i8** %9
%130 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 1
%131 = load i8, i8* %130
%132 = zext i8 %131 to i32
switch i32 %132, label %408 [
i32 51, label %133
i32 50, label %180
i32 49, label %230
]
133: ; preds = %123
%134 = load i8*, i8** %9
%135 = getelementptr inbounds i8, i8* %134, i64 0
%136 = load i8, i8* %135
%137 = call i64 @isdigit(i8 zeroext %136)
%138 = icmp ne i64 %137, 0
br i1 %138, label %139, label %145
139: ; preds = %133
%140 = load i8*, i8** %9
%141 = getelementptr inbounds i8, i8* %140, i64 0
%142 = load i8, i8* %141
%143 = zext i8 %142 to i32
%144 = sub nsw i32 %143, 48
br label %152
145: ; preds = %133
%146 = load i8*, i8** %9
%147 = getelementptr inbounds i8, i8* %146, i64 0
%148 = load i8, i8* %147
%149 = call i32 @tolower(i8 zeroext %148)
%150 = add nsw i32 %149, 10
%151 = sub nsw i32 %150, 97
br label %152
152: ; preds = %145, %139
%153 = phi i32 [ %144, %139 ], [ %151, %145 ]
%154 = shl i32 %153, 4
%155 = load i8*, i8** %9
%156 = getelementptr inbounds i8, i8* %155, i64 1
%157 = load i8, i8* %156
%158 = call i64 @isdigit(i8 zeroext %157)
%159 = icmp ne i64 %158, 0
br i1 %159, label %160, label %166
160: ; preds = %152
%161 = load i8*, i8** %9
%162 = getelementptr inbounds i8, i8* %161, i64 1
%163 = load i8, i8* %162
%164 = zext i8 %163 to i32
%165 = sub nsw i32 %164, 48
br label %173
166: ; preds = %152
%167 = load i8*, i8** %9
%168 = getelementptr inbounds i8, i8* %167, i64 1
%169 = load i8, i8* %168
%170 = call i32 @tolower(i8 zeroext %169)
%171 = add nsw i32 %170, 10
%172 = sub nsw i32 %171, 97
br label %173
173: ; preds = %166, %160
%174 = phi i32 [ %165, %160 ], [ %172, %166 ]
%175 = add nsw i32 %154, %174
store i32 %175, i32* %10
%176 = load i8*, i8** %9
%177 = getelementptr inbounds i8, i8* %176, i64 2
store i8* %177, i8** %9
%178 = load i32, i32* %11
%179 = add nsw i32 %178, -1
store i32 %179, i32* %11
br label %180
180: ; preds = %123, %173
%181 = load i32, i32* %10
%182 = shl i32 %181, 8
%183 = load i8*, i8** %9
%184 = getelementptr inbounds i8, i8* %183, i64 0
%185 = load i8, i8* %184
%186 = call i64 @isdigit(i8 zeroext %185)
%187 = icmp ne i64 %186, 0
br i1 %187, label %188, label %194
188: ; preds = %180
%189 = load i8*, i8** %9
%190 = getelementptr inbounds i8, i8* %189, i64 0
%191 = load i8, i8* %190
%192 = zext i8 %191 to i32
%193 = sub nsw i32 %192, 48
br label %201
194: ; preds = %180
%195 = load i8*, i8** %9
%196 = getelementptr inbounds i8, i8* %195, i64 0
%197 = load i8, i8* %196
%198 = call i32 @tolower(i8 zeroext %197)
%199 = add nsw i32 %198, 10
%200 = sub nsw i32 %199, 97
br label %201
201: ; preds = %194, %188
%202 = phi i32 [ %193, %188 ], [ %200, %194 ]
%203 = shl i32 %202, 4
%204 = load i8*, i8** %9
%205 = getelementptr inbounds i8, i8* %204, i64 1
%206 = load i8, i8* %205
%207 = call i64 @isdigit(i8 zeroext %206)
%208 = icmp ne i64 %207, 0
br i1 %208, label %209, label %215
209: ; preds = %201
%210 = load i8*, i8** %9
%211 = getelementptr inbounds i8, i8* %210, i64 1
%212 = load i8, i8* %211
%213 = zext i8 %212 to i32
%214 = sub nsw i32 %213, 48
br label %222
215: ; preds = %201
%216 = load i8*, i8** %9
%217 = getelementptr inbounds i8, i8* %216, i64 1
%218 = load i8, i8* %217
%219 = call i32 @tolower(i8 zeroext %218)
%220 = add nsw i32 %219, 10
%221 = sub nsw i32 %220, 97
br label %222
222: ; preds = %215, %209
%223 = phi i32 [ %214, %209 ], [ %221, %215 ]
%224 = add nsw i32 %203, %223
%225 = or i32 %182, %224
store i32 %225, i32* %10
%226 = load i8*, i8** %9
%227 = getelementptr inbounds i8, i8* %226, i64 2
store i8* %227, i8** %9
%228 = load i32, i32* %11
%229 = add nsw i32 %228, -1
store i32 %229, i32* %11
br label %230
230: ; preds = %123, %222
%231 = load i32, i32* %10
%232 = shl i32 %231, 8
%233 = load i8*, i8** %9
%234 = getelementptr inbounds i8, i8* %233, i64 0
%235 = load i8, i8* %234
%236 = call i64 @isdigit(i8 zeroext %235)
%237 = icmp ne i64 %236, 0
br i1 %237, label %238, label %244
238: ; preds = %230
%239 = load i8*, i8** %9
%240 = getelementptr inbounds i8, i8* %239, i64 0
%241 = load i8, i8* %240
%242 = zext i8 %241 to i32
%243 = sub nsw i32 %242, 48
br label %251
244: ; preds = %230
%245 = load i8*, i8** %9
%246 = getelementptr inbounds i8, i8* %245, i64 0
%247 = load i8, i8* %246
%248 = call i32 @tolower(i8 zeroext %247)
%249 = add nsw i32 %248, 10
%250 = sub nsw i32 %249, 97
br label %251
251: ; preds = %244, %238
%252 = phi i32 [ %243, %238 ], [ %250, %244 ]
%253 = shl i32 %252, 4
%254 = load i8*, i8** %9
%255 = getelementptr inbounds i8, i8* %254, i64 1
%256 = load i8, i8* %255
%257 = call i64 @isdigit(i8 zeroext %256)
%258 = icmp ne i64 %257, 0
br i1 %258, label %259, label %265
259: ; preds = %251
%260 = load i8*, i8** %9
%261 = getelementptr inbounds i8, i8* %260, i64 1
%262 = load i8, i8* %261
%263 = zext i8 %262 to i32
%264 = sub nsw i32 %263, 48
br label %272
265: ; preds = %251
%266 = load i8*, i8** %9
%267 = getelementptr inbounds i8, i8* %266, i64 1
%268 = load i8, i8* %267
%269 = call i32 @tolower(i8 zeroext %268)
%270 = add nsw i32 %269, 10
%271 = sub nsw i32 %270, 97
br label %272
272: ; preds = %265, %259
%273 = phi i32 [ %264, %259 ], [ %271, %265 ]
%274 = add nsw i32 %253, %273
%275 = or i32 %232, %274
store i32 %275, i32* %10
%276 = load i8*, i8** %9
%277 = getelementptr inbounds i8, i8* %276, i64 2
store i8* %277, i8** %9
%278 = load i32, i32* %10
%279 = shl i32 %278, 8
%280 = load i8*, i8** %9
%281 = getelementptr inbounds i8, i8* %280, i64 0
%282 = load i8, i8* %281
%283 = call i64 @isdigit(i8 zeroext %282)
%284 = icmp ne i64 %283, 0
br i1 %284, label %285, label %291
285: ; preds = %272
%286 = load i8*, i8** %9
%287 = getelementptr inbounds i8, i8* %286, i64 0
%288 = load i8, i8* %287
%289 = zext i8 %288 to i32
%290 = sub nsw i32 %289, 48
br label %298
291: ; preds = %272
%292 = load i8*, i8** %9
%293 = getelementptr inbounds i8, i8* %292, i64 0
%294 = load i8, i8* %293
%295 = call i32 @tolower(i8 zeroext %294)
%296 = add nsw i32 %295, 10
%297 = sub nsw i32 %296, 97
br label %298
298: ; preds = %291, %285
%299 = phi i32 [ %290, %285 ], [ %297, %291 ]
%300 = shl i32 %299, 4
%301 = load i8*, i8** %9
%302 = getelementptr inbounds i8, i8* %301, i64 1
%303 = load i8, i8* %302
%304 = call i64 @isdigit(i8 zeroext %303)
%305 = icmp ne i64 %304, 0
br i1 %305, label %306, label %312
306: ; preds = %298
%307 = load i8*, i8** %9
%308 = getelementptr inbounds i8, i8* %307, i64 1
%309 = load i8, i8* %308
%310 = zext i8 %309 to i32
%311 = sub nsw i32 %310, 48
br label %319
312: ; preds = %298
%313 = load i8*, i8** %9
%314 = getelementptr inbounds i8, i8* %313, i64 1
%315 = load i8, i8* %314
%316 = call i32 @tolower(i8 zeroext %315)
%317 = add nsw i32 %316, 10
%318 = sub nsw i32 %317, 97
br label %319
319: ; preds = %312, %306
%320 = phi i32 [ %311, %306 ], [ %318, %312 ]
%321 = add nsw i32 %300, %320
%322 = or i32 %279, %321
store i32 %322, i32* %10
%323 = load i8*, i8** %9
%324 = getelementptr inbounds i8, i8* %323, i64 2
store i8* %324, i8** %9
%325 = load i32, i32* %11
%326 = sub nsw i32 %325, 2
store i32 %326, i32* %11
%327 = load i32, i32* %10
%328 = load i32, i32* %11
%329 = add nsw i32 %327, %328
%330 = icmp sge i32 %329, 262144
br i1 %330, label %331, label %337
331: ; preds = %319
%332 = load i32, i32* @stderr
%333 = load i8*, i8** %4
%334 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%335 = call i32 (i32, i8*, ...) @fprintf(i32 %332, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %333, i8* %334)
%336 = call i32 @exit(i32 1)
unreachable
337: ; preds = %319
br label %338
338: ; preds = %390, %337
%339 = load i32, i32* %11
%340 = add nsw i32 %339, -1
store i32 %340, i32* %11
%341 = icmp sgt i32 %339, 0
br i1 %341, label %342, label %401
342: ; preds = %338
%343 = load i32, i32* %10
%344 = load i32*, i32** %6
%345 = load i32, i32* %344
%346 = icmp slt i32 %343, %345
br i1 %346, label %347, label %350
347: ; preds = %342
%348 = load i32, i32* %10
%349 = load i32*, i32** %6
store i32 %348, i32* %349
br label %350
350: ; preds = %347, %342
%351 = load i8*, i8** %9
%352 = getelementptr inbounds i8, i8* %351, i64 0
%353 = load i8, i8* %352
%354 = call i64 @isdigit(i8 zeroext %353)
%355 = icmp ne i64 %354, 0
br i1 %355, label %356, label %362
356: ; preds = %350
%357 = load i8*, i8** %9
%358 = getelementptr inbounds i8, i8* %357, i64 0
%359 = load i8, i8* %358
%360 = zext i8 %359 to i32
%361 = sub nsw i32 %360, 48
br label %369
362: ; preds = %350
%363 = load i8*, i8** %9
%364 = getelementptr inbounds i8, i8* %363, i64 0
%365 = load i8, i8* %364
%366 = call i32 @tolower(i8 zeroext %365)
%367 = add nsw i32 %366, 10
%368 = sub nsw i32 %367, 97
br label %369
369: ; preds = %362, %356
%370 = phi i32 [ %361, %356 ], [ %368, %362 ]
%371 = shl i32 %370, 4
%372 = load i8*, i8** %9
%373 = getelementptr inbounds i8, i8* %372, i64 1
%374 = load i8, i8* %373
%375 = call i64 @isdigit(i8 zeroext %374)
%376 = icmp ne i64 %375, 0
br i1 %376, label %377, label %383
377: ; preds = %369
%378 = load i8*, i8** %9
%379 = getelementptr inbounds i8, i8* %378, i64 1
%380 = load i8, i8* %379
%381 = zext i8 %380 to i32
%382 = sub nsw i32 %381, 48
br label %390
383: ; preds = %369
%384 = load i8*, i8** %9
%385 = getelementptr inbounds i8, i8* %384, i64 1
%386 = load i8, i8* %385
%387 = call i32 @tolower(i8 zeroext %386)
%388 = add nsw i32 %387, 10
%389 = sub nsw i32 %388, 97
br label %390
390: ; preds = %383, %377
%391 = phi i32 [ %382, %377 ], [ %389, %383 ]
%392 = add nsw i32 %371, %391
%393 = trunc i32 %392 to i8
%394 = load i8*, i8** %5
%395 = load i32, i32* %10
%396 = add nsw i32 %395, 1
store i32 %396, i32* %10
%397 = sext i32 %395 to i64
%398 = getelementptr inbounds i8, i8* %394, i64 %397
store i8 %393, i8* %398
%399 = load i8*, i8** %9
%400 = getelementptr inbounds i8, i8* %399, i64 2
store i8* %400, i8** %9
br label %338
401: ; preds = %338
%402 = load i32, i32* %12
%403 = load i32, i32* %10
%404 = icmp slt i32 %402, %403
br i1 %404, label %405, label %407
405: ; preds = %401
%406 = load i32, i32* %10
store i32 %406, i32* %12
br label %407
407: ; preds = %405, %401
br label %408
408: ; preds = %123, %407
br label %24
409: ; preds = %60, %24
%410 = load i32, i32* %12
ret i32 %410
}

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