#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 uint8_t;
typedef size_t uint32_t;
typedef int uint16_t;
typedef int int32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(int *, int, int, int /*<<< orphan*/ *);
int hex2int(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int32_t readHex(FILE *inputfile, uint8_t *outputData, uint32_t outputDataSize) {
  uint8_t scanstate = 0;
  uint8_t recordSize = 0;
  uint16_t recordAddr = 0;
  uint8_t recordType = 0;
  uint8_t recordData[256];
  memset(recordData, 0, 256);
  uint8_t recordDataIdx = 0;
  uint8_t checksum = 0;
  uint8_t recordCheck = 0;
  uint32_t extSegAddr = 0;
  uint32_t linBaseAddr = 0;
  uint32_t maxAddrUsed = 0;
  while (1) {
    uint8_t readBuffer[4096];
    uint32_t nrOfBytes = fread(readBuffer, 1, 4096, inputfile);
    uint8_t needMoreData = 0;
    uint32_t readIdx = 0;
    while (!needMoreData) {
      switch (scanstate) {
      case 0: {
        while ((readIdx < nrOfBytes) && (readBuffer[readIdx] != 0x3A))
          readIdx++;
        if (readIdx < nrOfBytes) {
          readIdx++;
          scanstate = 1;
          memset(recordData, 0, 256);
        } else {
          needMoreData = 1;
        }
      } break;
      case 1: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in high nibble of size!\n");
          recordSize = (val & 0x0F) << 4;
          scanstate = 2;
        } else {
          needMoreData = 1;
        }
      } break;
      case 2: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in low nibble of size!\n");
          recordSize |= (val & 0x0F);
          recordCheck = recordSize;
          scanstate = 3;
        } else {
          needMoreData = 1;
        }
      } break;
      case 3: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in high nibble of high byte of "
                   "address!\n");
          recordAddr = (val & 0x0F) << 12;
          scanstate = 4;
        } else {
          needMoreData = 1;
        }
      } break;
      case 4: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in low nibble of high byte of "
                   "address!\n");
          recordAddr |= (val & 0x0F) << 8;
          recordCheck += (recordAddr >> 8) & 0xFF;
          scanstate = 5;
        } else {
          needMoreData = 1;
        }
      } break;
      case 5: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in high nibble of low byte of "
                   "address!\n");
          recordAddr |= (val & 0x0F) << 4;
          scanstate = 6;
        } else {
          needMoreData = 1;
        }
      } break;
      case 6: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in low nibble of low byte of "
                   "address!\n");
          recordAddr |= (val & 0x0F);
          recordCheck += recordAddr & 0xFF;
          scanstate = 7;
        } else {
          needMoreData = 1;
        }
      } break;
      case 7: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in high nibble of type!\n");
          recordType = (val & 0x0F) << 4;
          scanstate = 8;
        } else {
          needMoreData = 1;
        }
      } break;
      case 8: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in low nibble of type!\n");
          recordType |= (val & 0x0F);
          recordCheck += recordType;
          recordDataIdx = 0;
          scanstate = 9;
        } else {
          needMoreData = 1;
        }
      } break;
      case 9: {
        if (recordDataIdx < recordSize) {
          if (readIdx < nrOfBytes) {
            uint8_t dval = readBuffer[readIdx++];
            uint8_t val = hex2int(dval);
            if (val > 15)
              printf("Warning: no hex value in high nibble of data: %u, %u!\n",
                     val, recordDataIdx);
            recordData[recordDataIdx] = (val & 0x0F) << 4;
            scanstate = 10;
          } else {
            needMoreData = 1;
          }
        } else {
          scanstate = 11;
        }
      } break;
      case 10: {
        if (readIdx < nrOfBytes) {
          uint8_t dval = readBuffer[readIdx++];
          uint8_t val = hex2int(dval);
          if (val > 15)
            printf("Warning: no hex value in low nibble of data!\n");
          recordData[recordDataIdx] |= (val & 0x0F);
          recordCheck += recordData[recordDataIdx++];
          scanstate = 9;
        } else {
          needMoreData = 1;
        }
      } break;
      case 11: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in high nibble of checksum!\n");
          checksum = (val & 0x0F) << 4;
          scanstate = 12;
        } else {
          needMoreData = 1;
        }
      } break;
      case 12: {
        if (readIdx < nrOfBytes) {
          uint8_t val = hex2int(readBuffer[readIdx++]);
          if (val > 15)
            printf("Warning: no hex value in low nibble of checksum!\n");
          checksum |= (val & 0x0F);
          recordCheck += checksum;
          if (recordCheck != 0) {
            printf("Checksum Error! %u, %u, %u, %u, %u\n", recordCheck,
                   recordAddr, recordType, recordSize, recordDataIdx);
            int k;
            for (k = 0; k < recordSize; ++k)
              printf("%u, ", recordData[k]);
            printf("\n");
            return -1;
          }
          scanstate = 13 + recordType;
        } else {
          needMoreData = 1;
        }
      } break;
      case 13: {
        uint32_t targetAddr = linBaseAddr | (extSegAddr + recordAddr);
        if (targetAddr + recordSize <= outputDataSize) {
          memcpy(outputData + targetAddr, recordData, recordSize);
          if (maxAddrUsed < targetAddr + recordSize)
            maxAddrUsed = targetAddr + recordSize;
        } else {
          printf("Error: target address to big\n");
          return -3;
        }
        scanstate = 0;
      } break;
      case 14: {
        return maxAddrUsed;
      } break;
      case 15: {
        extSegAddr = (recordData[0] << 8 | recordData[1]) * 16;
        scanstate = 0;
      } break;
      case 16: {
        printf("Warning: Start Segment Address Records not supported\n");
        scanstate = 0;
      } break;
      case 17: {
        linBaseAddr = (recordData[0] << 24) | (recordData[1] << 16);
        scanstate = 0;
      } break;
      case 18: {
        printf("Warning: Start Linear Address Records not supported\n");
        scanstate = 0;
      } break;
      default: {
        printf("Unknwon scanstate %i!\n", scanstate);
        return -2;
      } break;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<readHex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x44d0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
movl   $0x0,-0x434(%rbp)
movl   $0x0,-0x438(%rbp)
movl   $0x0,-0x43c(%rbp)
movq   $0x0,-0x448(%rbp)
movq   $0x0,-0x450(%rbp)
movq   $0x0,-0x458(%rbp)
lea    -0x4460(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %rax,-0x4468(%rbp)
movl   $0x0,-0x446c(%rbp)
movq   $0x0,-0x4478(%rbp)
cmpl   $0x0,-0x446c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1224 <readHex+0xd4>
jmp    1bf5 <readHex+0xaa5>
mov    -0x24(%rbp),%eax
mov    %rax,-0x44c8(%rbp)
sub    $0x12,%rax
ja     1bd3 <readHex+0xa83>
mov    -0x44c8(%rbp),%rax
lea    0xdba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1254 <readHex+0x104>
mov    -0x4478(%rbp),%rcx
xor    %eax,%eax
cmp    -0x4468(%rbp),%rcx
mov    %al,-0x44c9(%rbp)
jae    1288 <readHex+0x138>
mov    -0x4478(%rbp),%rax
cmpl   $0x3a,-0x4460(%rbp,%rax,4)
3a
setne  %al
mov    %al,-0x44c9(%rbp)
mov    -0x44c9(%rbp),%al
test   $0x1,%al
jne    129b <readHex+0x14b>
jmp    12b2 <readHex+0x162>
mov    -0x4478(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4478(%rbp)
jmp    1254 <readHex+0x104>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    12f7 <readHex+0x1a7>
mov    -0x4478(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4478(%rbp)
movl   $0x1,-0x24(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
jmp    1301 <readHex+0x1b1>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    1377 <readHex+0x227>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x447c(%rbp)
cmpl   $0xf,-0x447c(%rbp)
jle    135c <readHex+0x20c>
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x447c(%rbp),%eax
and    $0xf,%eax
shl    $0x4,%eax
mov    %eax,-0x28(%rbp)
movl   $0x2,-0x24(%rbp)
jmp    1381 <readHex+0x231>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    1400 <readHex+0x2b0>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x4480(%rbp)
cmpl   $0xf,-0x4480(%rbp)
jle    13dc <readHex+0x28c>
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4480(%rbp),%eax
and    $0xf,%eax
or     -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x43c(%rbp)
movl   $0x3,-0x24(%rbp)
jmp    140a <readHex+0x2ba>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    1480 <readHex+0x330>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x4484(%rbp)
cmpl   $0xf,-0x4484(%rbp)
jle    1465 <readHex+0x315>
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4484(%rbp),%eax
and    $0xf,%eax
shl    $0xc,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x4,-0x24(%rbp)
jmp    148a <readHex+0x33a>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    151a <readHex+0x3ca>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x4488(%rbp)
cmpl   $0xf,-0x4488(%rbp)
jle    14e5 <readHex+0x395>
lea    0xc0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4488(%rbp),%eax
and    $0xf,%eax
shl    $0x8,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
add    -0x43c(%rbp),%eax
mov    %eax,-0x43c(%rbp)
movl   $0x5,-0x24(%rbp)
jmp    1524 <readHex+0x3d4>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    159d <readHex+0x44d>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x448c(%rbp)
cmpl   $0xf,-0x448c(%rbp)
jle    157f <readHex+0x42f>
lea    0xbae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x448c(%rbp),%eax
and    $0xf,%eax
shl    $0x4,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x6,-0x24(%rbp)
jmp    15a7 <readHex+0x457>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    1631 <readHex+0x4e1>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x4490(%rbp)
cmpl   $0xf,-0x4490(%rbp)
jle    1602 <readHex+0x4b2>
lea    0xb69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4490(%rbp),%eax
and    $0xf,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
add    -0x43c(%rbp),%eax
mov    %eax,-0x43c(%rbp)
movl   $0x7,-0x24(%rbp)
jmp    163b <readHex+0x4eb>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    16b1 <readHex+0x561>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x4494(%rbp)
cmpl   $0xf,-0x4494(%rbp)
jle    1696 <readHex+0x546>
lea    0xb12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4494(%rbp),%eax
and    $0xf,%eax
shl    $0x4,%eax
mov    %eax,-0x30(%rbp)
movl   $0x8,-0x24(%rbp)
jmp    16bb <readHex+0x56b>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    174a <readHex+0x5fa>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x4498(%rbp)
cmpl   $0xf,-0x4498(%rbp)
jle    1716 <readHex+0x5c6>
lea    0xac1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4498(%rbp),%eax
and    $0xf,%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
add    -0x43c(%rbp),%eax
mov    %eax,-0x43c(%rbp)
movl   $0x0,-0x434(%rbp)
movl   $0x9,-0x24(%rbp)
jmp    1754 <readHex+0x604>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x434(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    180b <readHex+0x6bb>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    17fc <readHex+0x6ac>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%eax
mov    %eax,-0x449c(%rbp)
mov    -0x449c(%rbp),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x44a0(%rbp)
cmpl   $0xf,-0x44a0(%rbp)
jle    17d6 <readHex+0x686>
mov    -0x44a0(%rbp),%esi
mov    -0x434(%rbp),%edx
lea    0xa2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44a0(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
movslq -0x434(%rbp),%rax
mov    %ecx,-0x430(%rbp,%rax,4)
movl   $0xa,-0x24(%rbp)
jmp    1806 <readHex+0x6b6>
movl   $0x1,-0x446c(%rbp)
jmp    1812 <readHex+0x6c2>
movl   $0xb,-0x24(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    18c9 <readHex+0x779>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%eax
mov    %eax,-0x44a4(%rbp)
mov    -0x44a4(%rbp),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x44a8(%rbp)
cmpl   $0xf,-0x44a8(%rbp)
jle    1879 <readHex+0x729>
lea    0x9c3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44a8(%rbp),%ecx
and    $0xf,%ecx
movslq -0x434(%rbp),%rax
or     -0x430(%rbp,%rax,4),%ecx
mov    %ecx,-0x430(%rbp,%rax,4)
mov    -0x434(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x434(%rbp)
cltq
mov    -0x430(%rbp,%rax,4),%eax
add    -0x43c(%rbp),%eax
mov    %eax,-0x43c(%rbp)
movl   $0x9,-0x24(%rbp)
jmp    18d3 <readHex+0x783>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    194c <readHex+0x7fc>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x44ac(%rbp)
cmpl   $0xf,-0x44ac(%rbp)
jle    192e <readHex+0x7de>
lea    0x93c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44ac(%rbp),%eax
and    $0xf,%eax
shl    $0x4,%eax
mov    %eax,-0x438(%rbp)
movl   $0xc,-0x24(%rbp)
jmp    1956 <readHex+0x806>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x4478(%rbp),%rax
cmp    -0x4468(%rbp),%rax
jae    1a7b <readHex+0x92b>
mov    -0x4478(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x4478(%rbp)
mov    -0x4460(%rbp,%rax,4),%edi
call   1050 <hex2int@plt>
mov    %eax,-0x44b0(%rbp)
cmpl   $0xf,-0x44b0(%rbp)
jle    19b1 <readHex+0x861>
lea    0x8ec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44b0(%rbp),%eax
and    $0xf,%eax
or     -0x438(%rbp),%eax
mov    %eax,-0x438(%rbp)
mov    -0x438(%rbp),%eax
add    -0x43c(%rbp),%eax
mov    %eax,-0x43c(%rbp)
cmpl   $0x0,-0x43c(%rbp)
je     1a6d <readHex+0x91d>
mov    -0x43c(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x434(%rbp),%r9d
lea    0x8c5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x44b4(%rbp)
mov    -0x44b4(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1a53 <readHex+0x903>
movslq -0x44b4(%rbp),%rax
mov    -0x430(%rbp,%rax,4),%esi
lea    0x8b4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44b4(%rbp)
jmp    1a14 <readHex+0x8c4>
lea    0x807(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1bfa <readHex+0xaaa>
mov    -0x30(%rbp),%eax
add    $0xd,%eax
mov    %eax,-0x24(%rbp)
jmp    1a85 <readHex+0x935>
movl   $0x1,-0x446c(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x450(%rbp),%rax
mov    -0x448(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
add    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x44c0(%rbp)
mov    -0x44c0(%rbp),%rax
movslq -0x28(%rbp),%rcx
add    %rcx,%rax
cmp    -0x20(%rbp),%rax
ja     1b1a <readHex+0x9ca>
mov    -0x18(%rbp),%rdi
mov    -0x44c0(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x430(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1070 <memcpy@plt>
mov    -0x458(%rbp),%rax
mov    -0x44c0(%rbp),%rcx
movslq -0x28(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1b15 <readHex+0x9c5>
mov    -0x44c0(%rbp),%rax
movslq -0x28(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x458(%rbp)
jmp    1b34 <readHex+0x9e4>
lea    0x7d0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1bfa <readHex+0xaaa>
movl   $0x0,-0x24(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x458(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1bfa <readHex+0xaaa>
mov    -0x430(%rbp),%eax
shl    $0x8,%eax
or     -0x42c(%rbp),%eax
shl    $0x4,%eax
cltq
mov    %rax,-0x448(%rbp)
movl   $0x0,-0x24(%rbp)
jmp    1bf0 <readHex+0xaa0>
lea    0x792(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x430(%rbp),%eax
shl    $0x18,%eax
mov    -0x42c(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x450(%rbp)
movl   $0x0,-0x24(%rbp)
jmp    1bf0 <readHex+0xaa0>
lea    0x785(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
jmp    1bf0 <readHex+0xaa0>
mov    -0x24(%rbp),%esi
lea    0x79d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1bfa <readHex+0xaaa>
jmp    120b <readHex+0xbb>
jmp    11d5 <readHex+0x85>
mov    -0x4(%rbp),%eax
add    $0x44d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readHex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4458,%rsp
mov    %rdx,0x48(%rsp)
mov    %rsi,0x38(%rsp)
mov    %rdi,0x40(%rsp)
lea    0x50(%rsp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
lea    0xe58(%rip),%r12
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x8(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,0x10(%rsp)
xor    %r14d,%r14d
nop
lea    0x450(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    0x40(%rsp),%rcx
call   1050 <fread@plt>
mov    %rax,%r15
mov    %rax,%rbp
neg    %rbp
xor    %r13d,%r13d
jmp    1230 <readHex+0xc0>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
nopl   0x0(%rax)
cmp    $0x12,%r14d
ja     175b <readHex+0x5eb>
mov    %r14d,%eax
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %r14d,%r14d
cmp    %r15,%r13
jae    11f0 <readHex+0x80>
add    $0x1,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpl   $0x3a,0x44c(%rsp,%r13,4)
je     16bb <readHex+0x54b>
lea    0x1(,%r13,1),%rax
add    %rbp,%rax
add    $0x1,%r13
cmp    $0x1,%rax
jne    1260 <readHex+0xf0>
jmp    11f0 <readHex+0x80>
cmp    %r15,%r13
jae    16d7 <readHex+0x567>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     12b2 <readHex+0x142>
lea    0x10a8(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
shl    $0x4,%ebx
movzbl %bl,%eax
mov    %eax,0x10(%rsp)
mov    $0x2,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    16e2 <readHex+0x572>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     12f4 <readHex+0x184>
lea    0x1039(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
and    $0xf,%ebx
mov    0x10(%rsp),%eax
or     %ebx,%eax
mov    $0x3,%r14d
mov    %eax,0x10(%rsp)
mov    %eax,0xc(%rsp)
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    16ed <readHex+0x57d>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     133d <readHex+0x1cd>
lea    0xfb2(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
shl    $0xc,%ebx
movzwl %bx,%eax
mov    %eax,0x4(%rsp)
mov    $0x4,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    16f8 <readHex+0x588>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     137f <readHex+0x20f>
lea    0xf33(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
and    $0xf,%ebx
shl    $0x8,%ebx
mov    0x4(%rsp),%eax
or     %ebx,%eax
mov    %eax,0x4(%rsp)
movzbl %ah,%eax
add    %eax,0xc(%rsp)
mov    $0x5,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    1703 <readHex+0x593>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     13ce <readHex+0x25e>
lea    0xea7(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
shl    $0x4,%ebx
movzbl %bl,%eax
or     %eax,0x4(%rsp)
mov    $0x6,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    170e <readHex+0x59e>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     1410 <readHex+0x2a0>
lea    0xe29(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
and    $0xf,%ebx
mov    0x4(%rsp),%eax
or     %ebx,%eax
mov    %eax,0x4(%rsp)
movzbl %al,%eax
add    %eax,0xc(%rsp)
mov    $0x7,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    1719 <readHex+0x5a9>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     145c <readHex+0x2ec>
lea    0xdaf(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
shl    $0x4,%ebx
movzbl %bl,%eax
mov    %rax,0x18(%rsp)
mov    $0x8,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    1724 <readHex+0x5b4>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     149f <readHex+0x32f>
lea    0xd3f(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
and    $0xf,%ebx
mov    0x18(%rsp),%rax
or     %ebx,%eax
mov    %rax,0x18(%rsp)
add    %eax,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x9,%r14d
jmp    1230 <readHex+0xc0>
mov    $0xb,%r14d
mov    0x8(%rsp),%eax
cmp    0x10(%rsp),%eax
jge    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    1750 <readHex+0x5e0>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     150e <readHex+0x39e>
lea    0xb4b(%rip),%rdi
mov    %ebx,%esi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r13
shl    $0x4,%ebx
movzbl %bl,%eax
movslq 0x8(%rsp),%rcx
mov    %eax,0x50(%rsp,%rcx,4)
mov    $0xa,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    172f <readHex+0x5bf>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     1555 <readHex+0x3e5>
lea    0xc5c(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
and    $0xf,%ebx
mov    0x8(%rsp),%ecx
movslq %ecx,%rax
or     0x50(%rsp,%rax,4),%ebx
mov    %ebx,0x50(%rsp,%rax,4)
add    $0x1,%ecx
mov    %ecx,0x8(%rsp)
add    %ebx,0xc(%rsp)
mov    $0x9,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    173a <readHex+0x5ca>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     15aa <readHex+0x43a>
lea    0xbd5(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13
shl    $0x4,%ebx
movzbl %bl,%eax
mov    %eax,0x14(%rsp)
mov    $0xc,%r14d
jmp    1230 <readHex+0xc0>
cmp    %r15,%r13
jae    1745 <readHex+0x5d5>
mov    0x450(%rsp,%r13,4),%edi
call   1070 <hex2int@plt>
mov    %eax,%ebx
cmp    $0x10,%eax
jl     15ec <readHex+0x47c>
lea    0xb62(%rip),%rdi
call   1040 <puts@plt>
and    $0xf,%ebx
mov    0x14(%rsp),%eax
or     %ebx,%eax
mov    0xc(%rsp),%esi
add    %eax,%esi
jne    178d <readHex+0x61d>
mov    %eax,0x14(%rsp)
add    $0x1,%r13
mov    0x18(%rsp),%rax
lea    0xd(%rax),%r14d
movl   $0x0,0xc(%rsp)
jmp    1230 <readHex+0xc0>
movslq 0x4(%rsp),%rax
add    0x28(%rsp),%rax
or     0x30(%rsp),%rax
mov    0x10(%rsp),%edx
movslq %edx,%rbx
add    %rax,%rbx
cmp    0x48(%rsp),%rbx
ja     177a <readHex+0x60a>
mov    0x38(%rsp),%rcx
lea    (%rcx,%rax,4),%rdi
lea    0x50(%rsp),%rsi
call   1090 <memcpy@plt>
mov    0x20(%rsp),%rax
cmp    %rbx,%rax
cmovb  %rbx,%rax
mov    %rax,0x20(%rsp)
xor    %r14d,%r14d
jmp    1230 <readHex+0xc0>
mov    0x50(%rsp),%eax
mov    0x54(%rsp),%ecx
shl    $0xc,%eax
shl    $0x4,%ecx
or     %eax,%ecx
movslq %ecx,%rax
mov    %rax,0x28(%rsp)
xor    %r14d,%r14d
jmp    1230 <readHex+0xc0>
mov    0x50(%rsp),%eax
mov    0x54(%rsp),%ecx
shl    $0x18,%eax
shl    $0x10,%ecx
or     %eax,%ecx
movslq %ecx,%rax
mov    %rax,0x30(%rsp)
xor    %r14d,%r14d
jmp    1230 <readHex+0xc0>
lea    0xa0d(%rip),%rdi
jmp    1221 <readHex+0xb1>
lea    0x50(%rsp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
mov    $0x1,%r14d
jmp    1230 <readHex+0xc0>
mov    $0x1,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x2,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x3,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x4,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x5,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x6,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x7,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x8,%r14d
jmp    11f0 <readHex+0x80>
mov    $0xa,%r14d
jmp    11f0 <readHex+0x80>
mov    $0xb,%r14d
jmp    11f0 <readHex+0x80>
mov    $0xc,%r14d
jmp    11f0 <readHex+0x80>
mov    $0x9,%r14d
jmp    11f0 <readHex+0x80>
lea    0x94a(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xfffffffe,%eax
jmp    17e6 <readHex+0x676>
mov    0x20(%rsp),%rax
jmp    17e6 <readHex+0x676>
lea    0x9ab(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfffffffd,%eax
jmp    17e6 <readHex+0x676>
lea    0x8ef(%rip),%rdi
mov    0x4(%rsp),%edx
mov    0x18(%rsp),%rcx
mov    0x10(%rsp),%ebx
mov    %ebx,%r8d
mov    0x8(%rsp),%r9d
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebx,%ebx
jle    17d7 <readHex+0x667>
mov    %ebx,%ebp
lea    0x8ea(%rip),%r14
xor    %ebx,%ebx
nop
mov    0x50(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    17c0 <readHex+0x650>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%eax
add    $0x4458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Warning: no hex value in high nibble of size!\0A\00"
@.str.1 = [46 x i8] c"Warning: no hex value in low nibble of size!\0A\00"
@.str.2 = [63 x i8] c"Warning: no hex value in high nibble of high byte of address!\0A\00"
@.str.3 = [62 x i8] c"Warning: no hex value in low nibble of high byte of address!\0A\00"
@.str.4 = [62 x i8] c"Warning: no hex value in high nibble of low byte of address!\0A\00"
@.str.5 = [61 x i8] c"Warning: no hex value in low nibble of low byte of address!\0A\00"
@.str.6 = [47 x i8] c"Warning: no hex value in high nibble of type!\0A\00"
@.str.7 = [46 x i8] c"Warning: no hex value in low nibble of type!\0A\00"
@.str.8 = [55 x i8] c"Warning: no hex value in high nibble of data: %u, %u!\0A\00"
@.str.9 = [46 x i8] c"Warning: no hex value in low nibble of data!\0A\00"
@.str.10 = [51 x i8] c"Warning: no hex value in high nibble of checksum!\0A\00"
@.str.11 = [50 x i8] c"Warning: no hex value in low nibble of checksum!\0A\00"
@.str.12 = [36 x i8] c"Checksum Error! %u, %u, %u, %u, %u\0A\00"
@.str.13 = [5 x i8] c"%u, \00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [30 x i8] c"Error: target address to big\0A\00"
@.str.16 = [54 x i8] c"Warning: Start Segment Address Records not supported\0A\00"
@.str.17 = [53 x i8] c"Warning: Start Linear Address Records not supported\0A\00"
@.str.18 = [23 x i8] c"Unknwon scanstate %i!\0A\00"
define i32 @readHex(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [256 x i32]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca [4096 x i32]
%20 = alloca i64
%21 = alloca i32
%22 = alloca i64
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i64
store i32* %0, i32** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%39 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 0
%40 = call i32 @memset(i32* %39, i32 0, i32 256)
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i64 0, i64* %16
store i64 0, i64* %17
store i64 0, i64* %18
br label %41
41: ; preds = %3, %456
%42 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 0
%43 = load i32*, i32** %5
%44 = call i64 @fread(i32* %42, i32 1, i32 4096, i32* %43)
store i64 %44, i64* %20
store i32 0, i32* %21
store i64 0, i64* %22
br label %45
45: ; preds = %455, %41
%46 = load i32, i32* %21
%47 = icmp ne i32 %46, 0
%48 = xor i1 %47, true
br i1 %48, label %49, label %456
49: ; preds = %45
%50 = load i32, i32* %8
switch i32 %50, label %452 [
i32 0, label %51
i32 1, label %77
i32 2, label %97
i32 3, label %119
i32 4, label %139
i32 5, label %166
i32 6, label %188
i32 7, label %213
i32 8, label %233
i32 9, label %257
i32 10, label %289
i32 11, label %321
i32 12, label %341
i32 13, label %392
i32 14, label %427
i32 15, label %430
i32 16, label %439
i32 17, label %441
i32 18, label %450
]
51: ; preds = %49
br label %52
52: ; preds = %63, %51
%53 = load i64, i64* %22
%54 = load i64, i64* %20
%55 = icmp ult i64 %53, %54
br i1 %55, label %56, label %61
56: ; preds = %52
%57 = load i64, i64* %22
%58 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = icmp ne i32 %59, 58
br label %61
61: ; preds = %56, %52
%62 = phi i1 [ false, %52 ], [ %60, %56 ]
br i1 %62, label %63, label %66
63: ; preds = %61
%64 = load i64, i64* %22
%65 = add i64 %64, 1
store i64 %65, i64* %22
br label %52
66: ; preds = %61
%67 = load i64, i64* %22
%68 = load i64, i64* %20
%69 = icmp ult i64 %67, %68
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = load i64, i64* %22
%72 = add i64 %71, 1
store i64 %72, i64* %22
store i32 1, i32* %8
%73 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 0
%74 = call i32 @memset(i32* %73, i32 0, i32 256)
br label %76
75: ; preds = %66
store i32 1, i32* %21
br label %76
76: ; preds = %75, %70
br label %455
77: ; preds = %49
%78 = load i64, i64* %22
%79 = load i64, i64* %20
%80 = icmp ult i64 %78, %79
br i1 %80, label %81, label %95
81: ; preds = %77
%82 = load i64, i64* %22
%83 = add i64 %82, 1
store i64 %83, i64* %22
%84 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %82
%85 = load i32, i32* %84
%86 = call i32 @hex2int(i32 %85)
store i32 %86, i32* %23
%87 = load i32, i32* %23
%88 = icmp sgt i32 %87, 15
br i1 %88, label %89, label %91
89: ; preds = %81
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %91
91: ; preds = %89, %81
%92 = load i32, i32* %23
%93 = and i32 %92, 15
%94 = shl i32 %93, 4
store i32 %94, i32* %9
store i32 2, i32* %8
br label %96
95: ; preds = %77
store i32 1, i32* %21
br label %96
96: ; preds = %95, %91
br label %455
97: ; preds = %49
%98 = load i64, i64* %22
%99 = load i64, i64* %20
%100 = icmp ult i64 %98, %99
br i1 %100, label %101, label %117
101: ; preds = %97
%102 = load i64, i64* %22
%103 = add i64 %102, 1
store i64 %103, i64* %22
%104 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %102
%105 = load i32, i32* %104
%106 = call i32 @hex2int(i32 %105)
store i32 %106, i32* %24
%107 = load i32, i32* %24
%108 = icmp sgt i32 %107, 15
br i1 %108, label %109, label %111
109: ; preds = %101
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %111
111: ; preds = %109, %101
%112 = load i32, i32* %24
%113 = and i32 %112, 15
%114 = load i32, i32* %9
%115 = or i32 %114, %113
store i32 %115, i32* %9
%116 = load i32, i32* %9
store i32 %116, i32* %15
store i32 3, i32* %8
br label %118
117: ; preds = %97
store i32 1, i32* %21
br label %118
118: ; preds = %117, %111
br label %455
119: ; preds = %49
%120 = load i64, i64* %22
%121 = load i64, i64* %20
%122 = icmp ult i64 %120, %121
br i1 %122, label %123, label %137
123: ; preds = %119
%124 = load i64, i64* %22
%125 = add i64 %124, 1
store i64 %125, i64* %22
%126 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %124
%127 = load i32, i32* %126
%128 = call i32 @hex2int(i32 %127)
store i32 %128, i32* %25
%129 = load i32, i32* %25
%130 = icmp sgt i32 %129, 15
br i1 %130, label %131, label %133
131: ; preds = %123
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
br label %133
133: ; preds = %131, %123
%134 = load i32, i32* %25
%135 = and i32 %134, 15
%136 = shl i32 %135, 12
store i32 %136, i32* %10
store i32 4, i32* %8
br label %138
137: ; preds = %119
store i32 1, i32* %21
br label %138
138: ; preds = %137, %133
br label %455
139: ; preds = %49
%140 = load i64, i64* %22
%141 = load i64, i64* %20
%142 = icmp ult i64 %140, %141
br i1 %142, label %143, label %164
143: ; preds = %139
%144 = load i64, i64* %22
%145 = add i64 %144, 1
store i64 %145, i64* %22
%146 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %144
%147 = load i32, i32* %146
%148 = call i32 @hex2int(i32 %147)
store i32 %148, i32* %26
%149 = load i32, i32* %26
%150 = icmp sgt i32 %149, 15
br i1 %150, label %151, label %153
151: ; preds = %143
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
br label %153
153: ; preds = %151, %143
%154 = load i32, i32* %26
%155 = and i32 %154, 15
%156 = shl i32 %155, 8
%157 = load i32, i32* %10
%158 = or i32 %157, %156
store i32 %158, i32* %10
%159 = load i32, i32* %10
%160 = ashr i32 %159, 8
%161 = and i32 %160, 255
%162 = load i32, i32* %15
%163 = add nsw i32 %162, %161
store i32 %163, i32* %15
store i32 5, i32* %8
br label %165
164: ; preds = %139
store i32 1, i32* %21
br label %165
165: ; preds = %164, %153
br label %455
166: ; preds = %49
%167 = load i64, i64* %22
%168 = load i64, i64* %20
%169 = icmp ult i64 %167, %168
br i1 %169, label %170, label %186
170: ; preds = %166
%171 = load i64, i64* %22
%172 = add i64 %171, 1
store i64 %172, i64* %22
%173 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %171
%174 = load i32, i32* %173
%175 = call i32 @hex2int(i32 %174)
store i32 %175, i32* %27
%176 = load i32, i32* %27
%177 = icmp sgt i32 %176, 15
br i1 %177, label %178, label %180
178: ; preds = %170
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
br label %180
180: ; preds = %178, %170
%181 = load i32, i32* %27
%182 = and i32 %181, 15
%183 = shl i32 %182, 4
%184 = load i32, i32* %10
%185 = or i32 %184, %183
store i32 %185, i32* %10
store i32 6, i32* %8
br label %187
186: ; preds = %166
store i32 1, i32* %21
br label %187
187: ; preds = %186, %180
br label %455
188: ; preds = %49
%189 = load i64, i64* %22
%190 = load i64, i64* %20
%191 = icmp ult i64 %189, %190
br i1 %191, label %192, label %211
192: ; preds = %188
%193 = load i64, i64* %22
%194 = add i64 %193, 1
store i64 %194, i64* %22
%195 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %193
%196 = load i32, i32* %195
%197 = call i32 @hex2int(i32 %196)
store i32 %197, i32* %28
%198 = load i32, i32* %28
%199 = icmp sgt i32 %198, 15
br i1 %199, label %200, label %202
200: ; preds = %192
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
br label %202
202: ; preds = %200, %192
%203 = load i32, i32* %28
%204 = and i32 %203, 15
%205 = load i32, i32* %10
%206 = or i32 %205, %204
store i32 %206, i32* %10
%207 = load i32, i32* %10
%208 = and i32 %207, 255
%209 = load i32, i32* %15
%210 = add nsw i32 %209, %208
store i32 %210, i32* %15
store i32 7, i32* %8
br label %212
211: ; preds = %188
store i32 1, i32* %21
br label %212
212: ; preds = %211, %202
br label %455
213: ; preds = %49
%214 = load i64, i64* %22
%215 = load i64, i64* %20
%216 = icmp ult i64 %214, %215
br i1 %216, label %217, label %231
217: ; preds = %213
%218 = load i64, i64* %22
%219 = add i64 %218, 1
store i64 %219, i64* %22
%220 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %218
%221 = load i32, i32* %220
%222 = call i32 @hex2int(i32 %221)
store i32 %222, i32* %29
%223 = load i32, i32* %29
%224 = icmp sgt i32 %223, 15
br i1 %224, label %225, label %227
225: ; preds = %217
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
br label %227
227: ; preds = %225, %217
%228 = load i32, i32* %29
%229 = and i32 %228, 15
%230 = shl i32 %229, 4
store i32 %230, i32* %11
store i32 8, i32* %8
br label %232
231: ; preds = %213
store i32 1, i32* %21
br label %232
232: ; preds = %231, %227
br label %455
233: ; preds = %49
%234 = load i64, i64* %22
%235 = load i64, i64* %20
%236 = icmp ult i64 %234, %235
br i1 %236, label %237, label %255
237: ; preds = %233
%238 = load i64, i64* %22
%239 = add i64 %238, 1
store i64 %239, i64* %22
%240 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %238
%241 = load i32, i32* %240
%242 = call i32 @hex2int(i32 %241)
store i32 %242, i32* %30
%243 = load i32, i32* %30
%244 = icmp sgt i32 %243, 15
br i1 %244, label %245, label %247
245: ; preds = %237
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
br label %247
247: ; preds = %245, %237
%248 = load i32, i32* %30
%249 = and i32 %248, 15
%250 = load i32, i32* %11
%251 = or i32 %250, %249
store i32 %251, i32* %11
%252 = load i32, i32* %11
%253 = load i32, i32* %15
%254 = add nsw i32 %253, %252
store i32 %254, i32* %15
store i32 0, i32* %13
store i32 9, i32* %8
br label %256
255: ; preds = %233
store i32 1, i32* %21
br label %256
256: ; preds = %255, %247
br label %455
257: ; preds = %49
%258 = load i32, i32* %13
%259 = load i32, i32* %9
%260 = icmp slt i32 %258, %259
br i1 %260, label %261, label %287
261: ; preds = %257
%262 = load i64, i64* %22
%263 = load i64, i64* %20
%264 = icmp ult i64 %262, %263
br i1 %264, label %265, label %285
265: ; preds = %261
%266 = load i64, i64* %22
%267 = add i64 %266, 1
store i64 %267, i64* %22
%268 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %266
%269 = load i32, i32* %268
store i32 %269, i32* %31
%270 = load i32, i32* %31
%271 = call i32 @hex2int(i32 %270)
store i32 %271, i32* %32
%272 = load i32, i32* %32
%273 = icmp sgt i32 %272, 15
br i1 %273, label %274, label %278
274: ; preds = %265
%275 = load i32, i32* %32
%276 = load i32, i32* %13
%277 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i32 %275, i32 %276)
br label %278
278: ; preds = %274, %265
%279 = load i32, i32* %32
%280 = and i32 %279, 15
%281 = shl i32 %280, 4
%282 = load i32, i32* %13
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 %283
store i32 %281, i32* %284
store i32 10, i32* %8
br label %286
285: ; preds = %261
store i32 1, i32* %21
br label %286
286: ; preds = %285, %278
br label %288
287: ; preds = %257
store i32 11, i32* %8
br label %288
288: ; preds = %287, %286
br label %455
289: ; preds = %49
%290 = load i64, i64* %22
%291 = load i64, i64* %20
%292 = icmp ult i64 %290, %291
br i1 %292, label %293, label %319
293: ; preds = %289
%294 = load i64, i64* %22
%295 = add i64 %294, 1
store i64 %295, i64* %22
%296 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %294
%297 = load i32, i32* %296
store i32 %297, i32* %33
%298 = load i32, i32* %33
%299 = call i32 @hex2int(i32 %298)
store i32 %299, i32* %34
%300 = load i32, i32* %34
%301 = icmp sgt i32 %300, 15
br i1 %301, label %302, label %304
302: ; preds = %293
%303 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0))
br label %304
304: ; preds = %302, %293
%305 = load i32, i32* %34
%306 = and i32 %305, 15
%307 = load i32, i32* %13
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 %308
%310 = load i32, i32* %309
%311 = or i32 %310, %306
store i32 %311, i32* %309
%312 = load i32, i32* %13
%313 = add nsw i32 %312, 1
store i32 %313, i32* %13
%314 = sext i32 %312 to i64
%315 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 %314
%316 = load i32, i32* %315
%317 = load i32, i32* %15
%318 = add nsw i32 %317, %316
store i32 %318, i32* %15
store i32 9, i32* %8
br label %320
319: ; preds = %289
store i32 1, i32* %21
br label %320
320: ; preds = %319, %304
br label %455
321: ; preds = %49
%322 = load i64, i64* %22
%323 = load i64, i64* %20
%324 = icmp ult i64 %322, %323
br i1 %324, label %325, label %339
325: ; preds = %321
%326 = load i64, i64* %22
%327 = add i64 %326, 1
store i64 %327, i64* %22
%328 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %326
%329 = load i32, i32* %328
%330 = call i32 @hex2int(i32 %329)
store i32 %330, i32* %35
%331 = load i32, i32* %35
%332 = icmp sgt i32 %331, 15
br i1 %332, label %333, label %335
333: ; preds = %325
%334 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.10, i64 0, i64 0))
br label %335
335: ; preds = %333, %325
%336 = load i32, i32* %35
%337 = and i32 %336, 15
%338 = shl i32 %337, 4
store i32 %338, i32* %14
store i32 12, i32* %8
br label %340
339: ; preds = %321
store i32 1, i32* %21
br label %340
340: ; preds = %339, %335
br label %455
341: ; preds = %49
%342 = load i64, i64* %22
%343 = load i64, i64* %20
%344 = icmp ult i64 %342, %343
br i1 %344, label %345, label %390
345: ; preds = %341
%346 = load i64, i64* %22
%347 = add i64 %346, 1
store i64 %347, i64* %22
%348 = getelementptr inbounds [4096 x i32], [4096 x i32]* %19, i64 0, i64 %346
%349 = load i32, i32* %348
%350 = call i32 @hex2int(i32 %349)
store i32 %350, i32* %36
%351 = load i32, i32* %36
%352 = icmp sgt i32 %351, 15
br i1 %352, label %353, label %355
353: ; preds = %345
%354 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0))
br label %355
355: ; preds = %353, %345
%356 = load i32, i32* %36
%357 = and i32 %356, 15
%358 = load i32, i32* %14
%359 = or i32 %358, %357
store i32 %359, i32* %14
%360 = load i32, i32* %14
%361 = load i32, i32* %15
%362 = add nsw i32 %361, %360
store i32 %362, i32* %15
%363 = load i32, i32* %15
%364 = icmp ne i32 %363, 0
br i1 %364, label %365, label %387
365: ; preds = %355
%366 = load i32, i32* %15
%367 = load i32, i32* %10
%368 = load i32, i32* %11
%369 = load i32, i32* %9
%370 = load i32, i32* %13
%371 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i32 %366, i32 %367, i32 %368, i32 %369, i32 %370)
store i32 0, i32* %37
br label %372
372: ; preds = %382, %365
%373 = load i32, i32* %37
%374 = load i32, i32* %9
%375 = icmp slt i32 %373, %374
br i1 %375, label %376, label %385
376: ; preds = %372
%377 = load i32, i32* %37
%378 = sext i32 %377 to i64
%379 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 %378
%380 = load i32, i32* %379
%381 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %380)
br label %382
382: ; preds = %376
%383 = load i32, i32* %37
%384 = add nsw i32 %383, 1
store i32 %384, i32* %37
br label %372
385: ; preds = %372
%386 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 -1, i32* %4
br label %457
387: ; preds = %355
%388 = load i32, i32* %11
%389 = add nsw i32 13, %388
store i32 %389, i32* %8
br label %391
390: ; preds = %341
store i32 1, i32* %21
br label %391
391: ; preds = %390, %387
br label %455
392: ; preds = %49
%393 = load i64, i64* %17
%394 = load i64, i64* %16
%395 = load i32, i32* %10
%396 = sext i32 %395 to i64
%397 = add i64 %394, %396
%398 = or i64 %393, %397
store i64 %398, i64* %38
%399 = load i64, i64* %38
%400 = load i32, i32* %9
%401 = sext i32 %400 to i64
%402 = add i64 %399, %401
%403 = load i64, i64* %7
%404 = icmp ule i64 %402, %403
br i1 %404, label %405, label %424
405: ; preds = %392
%406 = load i32*, i32** %6
%407 = load i64, i64* %38
%408 = getelementptr inbounds i32, i32* %406, i64 %407
%409 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 0
%410 = load i32, i32* %9
%411 = call i32 @memcpy(i32* %408, i32* %409, i32 %410)
%412 = load i64, i64* %18
%413 = load i64, i64* %38
%414 = load i32, i32* %9
%415 = sext i32 %414 to i64
%416 = add i64 %413, %415
%417 = icmp ult i64 %412, %416
br i1 %417, label %418, label %423
418: ; preds = %405
%419 = load i64, i64* %38
%420 = load i32, i32* %9
%421 = sext i32 %420 to i64
%422 = add i64 %419, %421
store i64 %422, i64* %18
br label %423
423: ; preds = %418, %405
br label %426
424: ; preds = %392
%425 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0))
store i32 -3, i32* %4
br label %457
426: ; preds = %423
store i32 0, i32* %8
br label %455
427: ; preds = %49
%428 = load i64, i64* %18
%429 = trunc i64 %428 to i32
store i32 %429, i32* %4
br label %457
430: ; preds = %49
%431 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 0
%432 = load i32, i32* %431
%433 = shl i32 %432, 8
%434 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 1
%435 = load i32, i32* %434
%436 = or i32 %433, %435
%437 = mul nsw i32 %436, 16
%438 = sext i32 %437 to i64
store i64 %438, i64* %16
store i32 0, i32* %8
br label %455
439: ; preds = %49
%440 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.16, i64 0, i64 0))
store i32 0, i32* %8
br label %455
441: ; preds = %49
%442 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 0
%443 = load i32, i32* %442
%444 = shl i32 %443, 24
%445 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0, i64 1
%446 = load i32, i32* %445
%447 = shl i32 %446, 16
%448 = or i32 %444, %447
%449 = sext i32 %448 to i64
store i64 %449, i64* %17
store i32 0, i32* %8
br label %455
450: ; preds = %49
%451 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0))
store i32 0, i32* %8
br label %455
452: ; preds = %49
%453 = load i32, i32* %8
%454 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i32 %453)
store i32 -2, i32* %4
br label %457
455: ; preds = %450, %441, %439, %430, %426, %391, %340, %320, %288, %256, %232, %212, %187, %165, %138, %118, %96, %76
br label %45
456: ; preds = %45
br label %41
457: ; preds = %452, %427, %424, %385
%458 = load i32, i32* %4
ret i32 %458
}

LLVM IR (-O2):
@.str.8 = [55 x i8] c"Warning: no hex value in high nibble of data: %u, %u!\0A\00"
@.str.12 = [36 x i8] c"Checksum Error! %u, %u, %u, %u, %u\0A\00"
@.str.13 = [5 x i8] c"%u, \00"
@.str.18 = [23 x i8] c"Unknwon scanstate %i!\0A\00"
@str = [52 x i8] c"Warning: Start Linear Address Records not supported\00"
@str.19 = [53 x i8] c"Warning: Start Segment Address Records not supported\00"
@str.20 = [29 x i8] c"Error: target address to big\00"
@str.21 = [49 x i8] c"Warning: no hex value in low nibble of checksum!\00"
@str.22 = [50 x i8] c"Warning: no hex value in high nibble of checksum!\00"
@str.23 = [45 x i8] c"Warning: no hex value in low nibble of data!\00"
@str.24 = [45 x i8] c"Warning: no hex value in low nibble of type!\00"
@str.25 = [46 x i8] c"Warning: no hex value in high nibble of type!\00"
@str.26 = [60 x i8] c"Warning: no hex value in low nibble of low byte of address!\00"
@str.27 = [61 x i8] c"Warning: no hex value in high nibble of low byte of address!\00"
@str.28 = [61 x i8] c"Warning: no hex value in low nibble of high byte of address!\00"
@str.29 = [62 x i8] c"Warning: no hex value in high nibble of high byte of address!\00"
@str.30 = [45 x i8] c"Warning: no hex value in low nibble of size!\00"
@str.31 = [46 x i8] c"Warning: no hex value in high nibble of size!\00"
define i32 @readHex(i32* nocapture %0, i32* %1, i64 %2) {
%4 = alloca [256 x i32]
%5 = alloca [4096 x i32]
%6 = bitcast [256 x i32]* %4 to i8*
%7 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 0
%8 = call i32 @memset(i32* %7, i32 0, i32 256)
%9 = bitcast [4096 x i32]* %5 to i8*
%10 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 0
%11 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 1
br label %12
12: ; preds = %285, %3
%13 = phi i64 [ 0, %3 ], [ %34, %285 ]
%14 = phi i64 [ 0, %3 ], [ %33, %285 ]
%15 = phi i64 [ 0, %3 ], [ %32, %285 ]
%16 = phi i32 [ 0, %3 ], [ %31, %285 ]
%17 = phi i32 [ 0, %3 ], [ %30, %285 ]
%18 = phi i32 [ 0, %3 ], [ %29, %285 ]
%19 = phi i32 [ 0, %3 ], [ %28, %285 ]
%20 = phi i32 [ 0, %3 ], [ %27, %285 ]
%21 = phi i32 [ 0, %3 ], [ %26, %285 ]
%22 = phi i32 [ 0, %3 ], [ %286, %285 ]
%23 = call i64 @fread(i32* %10, i32 1, i32 4096, i32* %0)
br label %24
24: ; preds = %251, %12
%25 = phi i32 [ %22, %12 ], [ %252, %251 ]
%26 = phi i32 [ %21, %12 ], [ %253, %251 ]
%27 = phi i32 [ %20, %12 ], [ %254, %251 ]
%28 = phi i32 [ %19, %12 ], [ %255, %251 ]
%29 = phi i32 [ %18, %12 ], [ %256, %251 ]
%30 = phi i32 [ %17, %12 ], [ %257, %251 ]
%31 = phi i32 [ %16, %12 ], [ %258, %251 ]
%32 = phi i64 [ %15, %12 ], [ %259, %251 ]
%33 = phi i64 [ %14, %12 ], [ %260, %251 ]
%34 = phi i64 [ %13, %12 ], [ %261, %251 ]
%35 = phi i64 [ 0, %12 ], [ %262, %251 ]
switch i32 %25, label %283 [
i32 0, label %36
i32 1, label %48
i32 2, label %61
i32 3, label %74
i32 4, label %87
i32 5, label %104
i32 6, label %118
i32 7, label %133
i32 8, label %146
i32 9, label %160
i32 10, label %177
i32 11, label %195
i32 12, label %208
i32 13, label %237
i32 14, label %263
i32 15, label %265
i32 16, label %272
i32 17, label %274
i32 18, label %281
]
36: ; preds = %24
%37 = icmp ult i64 %35, %23
br i1 %37, label %38, label %285
38: ; preds = %36, %44
%39 = phi i64 [ %43, %44 ], [ %35, %36 ]
%40 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 58
%43 = add i64 %39, 1
br i1 %42, label %46, label %44
44: ; preds = %38
%45 = icmp eq i64 %43, %23
br i1 %45, label %285, label %38
46: ; preds = %38
%47 = call i32 @memset(i32* %7, i32 0, i32 256)
br label %251
48: ; preds = %24
%49 = icmp ult i64 %35, %23
br i1 %49, label %50, label %285
50: ; preds = %48
%51 = add nuw i64 %35, 1
%52 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%53 = load i32, i32* %52
%54 = call i32 @hex2int(i32 %53)
%55 = icmp sgt i32 %54, 15
br i1 %55, label %56, label %58
56: ; preds = %50
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.31, i64 0, i64 0))
br label %58
58: ; preds = %56, %50
%59 = shl i32 %54, 4
%60 = and i32 %59, 240
br label %251
61: ; preds = %24
%62 = icmp ult i64 %35, %23
br i1 %62, label %63, label %285
63: ; preds = %61
%64 = add nuw i64 %35, 1
%65 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%66 = load i32, i32* %65
%67 = call i32 @hex2int(i32 %66)
%68 = icmp sgt i32 %67, 15
br i1 %68, label %69, label %71
69: ; preds = %63
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.30, i64 0, i64 0))
br label %71
71: ; preds = %69, %63
%72 = and i32 %67, 15
%73 = or i32 %72, %26
br label %251
74: ; preds = %24
%75 = icmp ult i64 %35, %23
br i1 %75, label %76, label %285
76: ; preds = %74
%77 = add nuw i64 %35, 1
%78 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%79 = load i32, i32* %78
%80 = call i32 @hex2int(i32 %79)
%81 = icmp sgt i32 %80, 15
br i1 %81, label %82, label %84
82: ; preds = %76
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.29, i64 0, i64 0))
br label %84
84: ; preds = %82, %76
%85 = shl i32 %80, 12
%86 = and i32 %85, 61440
br label %251
87: ; preds = %24
%88 = icmp ult i64 %35, %23
br i1 %88, label %89, label %285
89: ; preds = %87
%90 = add nuw i64 %35, 1
%91 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%92 = load i32, i32* %91
%93 = call i32 @hex2int(i32 %92)
%94 = icmp sgt i32 %93, 15
br i1 %94, label %95, label %97
95: ; preds = %89
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.28, i64 0, i64 0))
br label %97
97: ; preds = %95, %89
%98 = shl i32 %93, 8
%99 = and i32 %98, 3840
%100 = or i32 %99, %27
%101 = lshr i32 %100, 8
%102 = and i32 %101, 255
%103 = add nsw i32 %102, %31
br label %251
104: ; preds = %24
%105 = icmp ult i64 %35, %23
br i1 %105, label %106, label %285
106: ; preds = %104
%107 = add nuw i64 %35, 1
%108 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%109 = load i32, i32* %108
%110 = call i32 @hex2int(i32 %109)
%111 = icmp sgt i32 %110, 15
br i1 %111, label %112, label %114
112: ; preds = %106
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.27, i64 0, i64 0))
br label %114
114: ; preds = %112, %106
%115 = shl i32 %110, 4
%116 = and i32 %115, 240
%117 = or i32 %116, %27
br label %251
118: ; preds = %24
%119 = icmp ult i64 %35, %23
br i1 %119, label %120, label %285
120: ; preds = %118
%121 = add nuw i64 %35, 1
%122 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%123 = load i32, i32* %122
%124 = call i32 @hex2int(i32 %123)
%125 = icmp sgt i32 %124, 15
br i1 %125, label %126, label %128
126: ; preds = %120
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.26, i64 0, i64 0))
br label %128
128: ; preds = %126, %120
%129 = and i32 %124, 15
%130 = or i32 %129, %27
%131 = and i32 %130, 255
%132 = add nsw i32 %131, %31
br label %251
133: ; preds = %24
%134 = icmp ult i64 %35, %23
br i1 %134, label %135, label %285
135: ; preds = %133
%136 = add nuw i64 %35, 1
%137 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%138 = load i32, i32* %137
%139 = call i32 @hex2int(i32 %138)
%140 = icmp sgt i32 %139, 15
br i1 %140, label %141, label %143
141: ; preds = %135
%142 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.25, i64 0, i64 0))
br label %143
143: ; preds = %141, %135
%144 = shl i32 %139, 4
%145 = and i32 %144, 240
br label %251
146: ; preds = %24
%147 = icmp ult i64 %35, %23
br i1 %147, label %148, label %285
148: ; preds = %146
%149 = add nuw i64 %35, 1
%150 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%151 = load i32, i32* %150
%152 = call i32 @hex2int(i32 %151)
%153 = icmp sgt i32 %152, 15
br i1 %153, label %154, label %156
154: ; preds = %148
%155 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0))
br label %156
156: ; preds = %154, %148
%157 = and i32 %152, 15
%158 = or i32 %157, %28
%159 = add nsw i32 %158, %31
br label %251
160: ; preds = %24
%161 = icmp slt i32 %29, %26
br i1 %161, label %162, label %251
162: ; preds = %160
%163 = icmp ult i64 %35, %23
br i1 %163, label %164, label %285
164: ; preds = %162
%165 = add nuw i64 %35, 1
%166 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%167 = load i32, i32* %166
%168 = call i32 @hex2int(i32 %167)
%169 = icmp sgt i32 %168, 15
br i1 %169, label %170, label %172
170: ; preds = %164
%171 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i32 %168, i32 %29)
br label %172
172: ; preds = %170, %164
%173 = shl i32 %168, 4
%174 = and i32 %173, 240
%175 = sext i32 %29 to i64
%176 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %175
store i32 %174, i32* %176
br label %251
177: ; preds = %24
%178 = icmp ult i64 %35, %23
br i1 %178, label %179, label %285
179: ; preds = %177
%180 = add nuw i64 %35, 1
%181 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%182 = load i32, i32* %181
%183 = call i32 @hex2int(i32 %182)
%184 = icmp sgt i32 %183, 15
br i1 %184, label %185, label %187
185: ; preds = %179
%186 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.23, i64 0, i64 0))
br label %187
187: ; preds = %185, %179
%188 = and i32 %183, 15
%189 = sext i32 %29 to i64
%190 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %189
%191 = load i32, i32* %190
%192 = or i32 %191, %188
store i32 %192, i32* %190
%193 = add nsw i32 %29, 1
%194 = add nsw i32 %192, %31
br label %251
195: ; preds = %24
%196 = icmp ult i64 %35, %23
br i1 %196, label %197, label %285
197: ; preds = %195
%198 = add nuw i64 %35, 1
%199 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%200 = load i32, i32* %199
%201 = call i32 @hex2int(i32 %200)
%202 = icmp sgt i32 %201, 15
br i1 %202, label %203, label %205
203: ; preds = %197
%204 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.22, i64 0, i64 0))
br label %205
205: ; preds = %203, %197
%206 = shl i32 %201, 4
%207 = and i32 %206, 240
br label %251
208: ; preds = %24
%209 = icmp ult i64 %35, %23
br i1 %209, label %210, label %285
210: ; preds = %208
%211 = add nuw i64 %35, 1
%212 = getelementptr inbounds [4096 x i32], [4096 x i32]* %5, i64 0, i64 %35
%213 = load i32, i32* %212
%214 = call i32 @hex2int(i32 %213)
%215 = icmp sgt i32 %214, 15
br i1 %215, label %216, label %218
216: ; preds = %210
%217 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.21, i64 0, i64 0))
br label %218
218: ; preds = %216, %210
%219 = and i32 %214, 15
%220 = or i32 %219, %30
%221 = add nsw i32 %220, %31
%222 = icmp eq i32 %221, 0
br i1 %222, label %235, label %223
223: ; preds = %218
%224 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i32 %221, i32 %27, i32 %28, i32 %26, i32 %29)
%225 = icmp sgt i32 %26, 0
br i1 %225, label %226, label %287
226: ; preds = %223
%227 = zext i32 %26 to i64
br label %228
228: ; preds = %226, %228
%229 = phi i64 [ 0, %226 ], [ %233, %228 ]
%230 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %229
%231 = load i32, i32* %230
%232 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %231)
%233 = add nuw nsw i64 %229, 1
%234 = icmp eq i64 %233, %227
br i1 %234, label %287, label %228
235: ; preds = %218
%236 = add nsw i32 %28, 13
br label %251
237: ; preds = %24
%238 = sext i32 %27 to i64
%239 = add i64 %32, %238
%240 = or i64 %239, %33
%241 = sext i32 %26 to i64
%242 = add i64 %240, %241
%243 = icmp ugt i64 %242, %2
br i1 %243, label %244, label %246
244: ; preds = %237
%245 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.20, i64 0, i64 0))
br label %289
246: ; preds = %237
%247 = getelementptr inbounds i32, i32* %1, i64 %240
%248 = call i32 @memcpy(i32* %247, i32* %7, i32 %26)
%249 = icmp ult i64 %34, %242
%250 = select i1 %249, i64 %242, i64 %34
br label %251
251: ; preds = %246, %235, %160, %205, %187, %172, %156, %143, %128, %114, %97, %84, %71, %58, %46, %281, %274, %272, %265
%252 = phi i32 [ 0, %281 ], [ 0, %274 ], [ 0, %272 ], [ 0, %265 ], [ 0, %246 ], [ 12, %205 ], [ 9, %187 ], [ 10, %172 ], [ 9, %156 ], [ 8, %143 ], [ 7, %128 ], [ 6, %114 ], [ 5, %97 ], [ 4, %84 ], [ 3, %71 ], [ 2, %58 ], [ 1, %46 ], [ 11, %160 ], [ %236, %235 ]
%253 = phi i32 [ %26, %281 ], [ %26, %274 ], [ %26, %272 ], [ %26, %265 ], [ %26, %246 ], [ %26, %205 ], [ %26, %187 ], [ %26, %172 ], [ %26, %156 ], [ %26, %143 ], [ %26, %128 ], [ %26, %114 ], [ %26, %97 ], [ %26, %84 ], [ %73, %71 ], [ %60, %58 ], [ %26, %46 ], [ %26, %160 ], [ %26, %235 ]
%254 = phi i32 [ %27, %281 ], [ %27, %274 ], [ %27, %272 ], [ %27, %265 ], [ %27, %246 ], [ %27, %205 ], [ %27, %187 ], [ %27, %172 ], [ %27, %156 ], [ %27, %143 ], [ %130, %128 ], [ %117, %114 ], [ %100, %97 ], [ %86, %84 ], [ %27, %71 ], [ %27, %58 ], [ %27, %46 ], [ %27, %160 ], [ %27, %235 ]
%255 = phi i32 [ %28, %281 ], [ %28, %274 ], [ %28, %272 ], [ %28, %265 ], [ %28, %246 ], [ %28, %205 ], [ %28, %187 ], [ %28, %172 ], [ %158, %156 ], [ %145, %143 ], [ %28, %128 ], [ %28, %114 ], [ %28, %97 ], [ %28, %84 ], [ %28, %71 ], [ %28, %58 ], [ %28, %46 ], [ %28, %160 ], [ %28, %235 ]
%256 = phi i32 [ %29, %281 ], [ %29, %274 ], [ %29, %272 ], [ %29, %265 ], [ %29, %246 ], [ %29, %205 ], [ %193, %187 ], [ %29, %172 ], [ 0, %156 ], [ %29, %143 ], [ %29, %128 ], [ %29, %114 ], [ %29, %97 ], [ %29, %84 ], [ %29, %71 ], [ %29, %58 ], [ %29, %46 ], [ %29, %160 ], [ %29, %235 ]
%257 = phi i32 [ %30, %281 ], [ %30, %274 ], [ %30, %272 ], [ %30, %265 ], [ %30, %246 ], [ %207, %205 ], [ %30, %187 ], [ %30, %172 ], [ %30, %156 ], [ %30, %143 ], [ %30, %128 ], [ %30, %114 ], [ %30, %97 ], [ %30, %84 ], [ %30, %71 ], [ %30, %58 ], [ %30, %46 ], [ %30, %160 ], [ %220, %235 ]
%258 = phi i32 [ %31, %281 ], [ %31, %274 ], [ %31, %272 ], [ %31, %265 ], [ %31, %246 ], [ %31, %205 ], [ %194, %187 ], [ %31, %172 ], [ %159, %156 ], [ %31, %143 ], [ %132, %128 ], [ %31, %114 ], [ %103, %97 ], [ %31, %84 ], [ %73, %71 ], [ %31, %58 ], [ %31, %46 ], [ %31, %160 ], [ 0, %235 ]
%259 = phi i64 [ %32, %281 ], [ %32, %274 ], [ %32, %272 ], [ %271, %265 ], [ %32, %246 ], [ %32, %205 ], [ %32, %187 ], [ %32, %172 ], [ %32, %156 ], [ %32, %143 ], [ %32, %128 ], [ %32, %114 ], [ %32, %97 ], [ %32, %84 ], [ %32, %71 ], [ %32, %58 ], [ %32, %46 ], [ %32, %160 ], [ %32, %235 ]
%260 = phi i64 [ %33, %281 ], [ %280, %274 ], [ %33, %272 ], [ %33, %265 ], [ %33, %246 ], [ %33, %205 ], [ %33, %187 ], [ %33, %172 ], [ %33, %156 ], [ %33, %143 ], [ %33, %128 ], [ %33, %114 ], [ %33, %97 ], [ %33, %84 ], [ %33, %71 ], [ %33, %58 ], [ %33, %46 ], [ %33, %160 ], [ %33, %235 ]
%261 = phi i64 [ %34, %281 ], [ %34, %274 ], [ %34, %272 ], [ %34, %265 ], [ %250, %246 ], [ %34, %205 ], [ %34, %187 ], [ %34, %172 ], [ %34, %156 ], [ %34, %143 ], [ %34, %128 ], [ %34, %114 ], [ %34, %97 ], [ %34, %84 ], [ %34, %71 ], [ %34, %58 ], [ %34, %46 ], [ %34, %160 ], [ %34, %235 ]
%262 = phi i64 [ %35, %281 ], [ %35, %274 ], [ %35, %272 ], [ %35, %265 ], [ %35, %246 ], [ %198, %205 ], [ %180, %187 ], [ %165, %172 ], [ %149, %156 ], [ %136, %143 ], [ %121, %128 ], [ %107, %114 ], [ %90, %97 ], [ %77, %84 ], [ %64, %71 ], [ %51, %58 ], [ %43, %46 ], [ %35, %160 ], [ %211, %235 ]
br label %24
263: ; preds = %24
%264 = trunc i64 %34 to i32
br label %289
265: ; preds = %24
%266 = load i32, i32* %7
%267 = load i32, i32* %11
%268 = shl i32 %266, 12
%269 = shl i32 %267, 4
%270 = or i32 %269, %268
%271 = sext i32 %270 to i64
br label %251
272: ; preds = %24
%273 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.19, i64 0, i64 0))
br label %251
274: ; preds = %24
%275 = load i32, i32* %7
%276 = shl i32 %275, 24
%277 = load i32, i32* %11
%278 = shl i32 %277, 16
%279 = or i32 %278, %276
%280 = sext i32 %279 to i64
br label %251
281: ; preds = %24
%282 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
br label %251
283: ; preds = %24
%284 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i32 %25)
br label %289
285: ; preds = %48, %61, %74, %87, %104, %118, %133, %146, %162, %177, %195, %208, %36, %44
%286 = phi i32 [ 0, %44 ], [ 1, %48 ], [ 2, %61 ], [ 3, %74 ], [ 4, %87 ], [ 5, %104 ], [ 6, %118 ], [ 7, %133 ], [ 8, %146 ], [ 9, %162 ], [ 10, %177 ], [ 11, %195 ], [ 12, %208 ], [ 0, %36 ]
br label %12
287: ; preds = %228, %223
%288 = call i32 @putchar(i32 10)
br label %289
289: ; preds = %287, %283, %263, %244
%290 = phi i32 [ -3, %244 ], [ %264, %263 ], [ -2, %283 ], [ -1, %287 ]
ret i32 %290
}