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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ line;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int sscanf(char const *, char *, unsigned int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strchr(char const *, char);
int strlen(char const *);
char *strpbrk(char const *, char *);
int strspn(char const *, char *);
int read_hex(const char *inp, unsigned char *arr, int *arr_len) {
  int in_len, k, j, m, off;
  unsigned int h;
  const char *lcp;
  char *cp;
  char *c2p;
  char line[512];
  if ((NULL == inp) || (NULL == arr) || (NULL == arr_len))
    return 1;
  lcp = inp;
  in_len = strlen(inp);
  if (0 == in_len) {
    *arr_len = 0;
  }
  if ('-' == inp[0]) {
    for (j = 0, off = 0; j < 512; ++j) {
      if (NULL == fgets(line, sizeof(line), stdin))
        break;
      in_len = strlen(line);
      if (in_len > 0) {
        if ('\n' == line[in_len - 1]) {
          --in_len;
          line[in_len] = '\0';
        }
      }
      if (0 == in_len)
        continue;
      lcp = line;
      m = strspn(lcp, " \t");
      if (m == in_len)
        continue;
      lcp += m;
      in_len -= m;
      if ('#' == *lcp)
        continue;
      k = strspn(lcp, "0123456789aAbBcCdDeEfF ,\t");
      if (in_len != k) {
        fprintf(stderr,
                "read_hex: syntax error at "
                "line %d, pos %d\n",
                j + 1, m + k + 1);
        return 1;
      }
      for (k = 0; k < 1024; ++k) {
        if (1 == sscanf(lcp, "%x", &h)) {
          if (h > 0xff) {
            fprintf(stderr,
                    "read_hex: hex number "
                    "larger than 0xff in line %d, pos %d\n",
                    j + 1, (int)(lcp - line + 1));
            return 1;
          }
          arr[off + k] = h;
          lcp = strpbrk(lcp, " ,\t");
          if (NULL == lcp)
            break;
          lcp += strspn(lcp, " ,\t");
          if ('\0' == *lcp)
            break;
        } else {
          fprintf(stderr,
                  "read_hex: error in "
                  "line %d, at pos %d\n",
                  j + 1, (int)(lcp - line + 1));
          return 1;
        }
      }
      off += k + 1;
    }
    *arr_len = off;
  } else {
    k = strspn(inp, "0123456789aAbBcCdDeEfF, ");
    if (in_len != k) {
      fprintf(stderr, "read_hex: error at pos %d\n", k + 1);
      return 1;
    }
    for (k = 0; k < 1024; ++k) {
      if (1 == sscanf(lcp, "%x", &h)) {
        if (h > 0xff) {
          fprintf(stderr,
                  "read_hex: hex number larger "
                  "than 0xff at pos %d\n",
                  (int)(lcp - inp + 1));
          return 1;
        }
        arr[k] = h;
        cp = strchr(lcp, ',');
        c2p = strchr(lcp, ' ');
        if (NULL == cp)
          cp = c2p;
        if (NULL == cp)
          break;
        if (c2p && (c2p < cp))
          cp = c2p;
        lcp = cp + 1;
      } else {
        fprintf(stderr, "read_hex: error at pos %d\n", (int)(lcp - inp + 1));
        return 1;
      }
    }
    *arr_len = k + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<read_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     11ab <read_hex+0x3b>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     11ab <read_hex+0x3b>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    11b7 <read_hex+0x47>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmp    -0x24(%rbp),%eax
jne    11e0 <read_hex+0x70>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
jne    14bf <read_hex+0x34f>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x200,-0x2c(%rbp)
jge    14b1 <read_hex+0x341>
lea    -0x250(%rbp),%rdi
mov    0x2dcb(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    123c <read_hex+0xcc>
jmp    14b1 <read_hex+0x341>
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    128c <read_hex+0x11c>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x250(%rbp,%rax,1),%ecx
ff
mov    $0xa,%eax
cmp    %ecx,%eax
jne    1287 <read_hex+0x117>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movb   $0x0,-0x250(%rbp,%rax,1)
jmp    128c <read_hex+0x11c>
xor    %eax,%eax
cmp    -0x24(%rbp),%eax
jne    129c <read_hex+0x12c>
jmp    14a3 <read_hex+0x333>
lea    -0x250(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xd4e(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    12cb <read_hex+0x15b>
jmp    14a3 <read_hex+0x333>
mov    -0x30(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    1300 <read_hex+0x190>
jmp    14a3 <read_hex+0x333>
mov    -0x40(%rbp),%rdi
lea    0xcf8(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     1351 <read_hex+0x1e1>
mov    0x2cb2(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x30(%rbp),%ecx
add    -0x28(%rbp),%ecx
add    $0x1,%ecx
lea    0xcdf(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
movl   $0x0,-0x28(%rbp)
cmpl   $0x400,-0x28(%rbp)
jge    1497 <read_hex+0x327>
mov    -0x40(%rbp),%rdi
lea    0xcd8(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    1447 <read_hex+0x2d7>
cmpl   $0xff,-0x38(%rbp)
jbe    13d2 <read_hex+0x262>
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x40(%rbp),%rax
lea    -0x250(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
lea    0xc8c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
mov    -0x38(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
lea    0xc27(%rip),%rsi
call   1090 <strpbrk@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmp    -0x40(%rbp),%rax
jne    140c <read_hex+0x29c>
jmp    1497 <read_hex+0x327>
mov    -0x40(%rbp),%rdi
lea    0xc02(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1442 <read_hex+0x2d2>
jmp    1497 <read_hex+0x327>
jmp    1484 <read_hex+0x314>
mov    0x2b8a(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x40(%rbp),%rax
lea    -0x250(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
lea    0xc14(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
jmp    1489 <read_hex+0x319>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1358 <read_hex+0x1e8>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1202 <read_hex+0x92>
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    165d <read_hex+0x4ed>
mov    -0x10(%rbp),%rdi
lea    0xbe2(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     1507 <read_hex+0x397>
mov    0x2af3(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
add    $0x1,%edx
lea    0xbd1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
movl   $0x0,-0x28(%rbp)
cmpl   $0x400,-0x28(%rbp)
jge    1651 <read_hex+0x4e1>
mov    -0x40(%rbp),%rdi
lea    0xb22(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    160a <read_hex+0x49a>
cmpl   $0xff,-0x38(%rbp)
jbe    157f <read_hex+0x40f>
mov    0x2a86(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
lea    0xb74(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
mov    -0x38(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
mov    %rax,-0x50(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%rax
jne    15c7 <read_hex+0x457>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%rax
jne    15d8 <read_hex+0x468>
jmp    1651 <read_hex+0x4e1>
cmpq   $0x0,-0x50(%rbp)
je     15f9 <read_hex+0x489>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jae    15f9 <read_hex+0x489>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    163e <read_hex+0x4ce>
mov    0x29c7(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
lea    0xa9a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1664 <read_hex+0x4f4>
jmp    1643 <read_hex+0x4d3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    150e <read_hex+0x39e>
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_hex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    $0x1,%r14d
test   %rdi,%rdi
je     14c8 <read_hex+0x358>
mov    %rsi,%rbx
test   %rsi,%rsi
je     14c8 <read_hex+0x358>
mov    %rdx,%rbp
test   %rdx,%rdx
je     14c8 <read_hex+0x358>
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%r12d
test   %eax,%eax
je     11e8 <read_hex+0x78>
cmpb   $0x2d,(%r15)
jne    11f5 <read_hex+0x85>
mov    %rbx,0x18(%rsp)
mov    %rbp,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x2e13(%rip),%rbp
lea    0x20(%rsp),%r14
lea    0xe38(%rip),%r13
xor    %ebx,%ebx
jmp    12df <read_hex+0x16f>
movl   $0x0,0x0(%rbp)
cmpb   $0x2d,(%r15)
je     11bd <read_hex+0x4d>
lea    0xeb0(%rip),%rsi
mov    %r15,%rdi
call   1050 <strspn@plt>
cmp    %eax,%r12d
jne    13fc <read_hex+0x28c>
mov    %rbx,%r14
mov    %rbp,0x10(%rsp)
xor    %r13d,%r13d
lea    0x4(%rsp),%r12
mov    %r15,%rbp
mov    %rbp,%rdi
lea    0xe1e(%rip),%rsi
mov    %r12,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1471 <read_hex+0x301>
mov    0x4(%rsp),%eax
cmp    $0x100,%eax
jae    1489 <read_hex+0x319>
mov    %al,(%r14,%r13,1)
mov    %rbp,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rbx,%rbx
cmove  %rax,%rbx
test   %rbx,%rbx
je     14b0 <read_hex+0x340>
cmp    %rbx,%rax
mov    %rbx,%rbp
cmovb  %rax,%rbp
test   %rax,%rax
cmove  %rbx,%rbp
add    $0x1,%rbp
add    $0x1,%r13
cmp    $0x400,%r13
jne    1220 <read_hex+0xb0>
mov    $0x401,%eax
mov    %rax,0x8(%rsp)
jmp    14b9 <read_hex+0x349>
lea    0x20(%rsp),%r14
mov    0x8(%rsp),%rax
add    %ebp,%eax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    0x2d21(%rip),%rbp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x200,%ebx
je     14b9 <read_hex+0x349>
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    $0x200,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     14b9 <read_hex+0x349>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
test   %eax,%eax
jle    1320 <read_hex+0x1b0>
mov    %r15d,%eax
add    $0xffffffff,%eax
cmpb   $0xa,0x20(%rsp,%rax,1)
jne    132a <read_hex+0x1ba>
movb   $0x0,0x20(%rsp,%rax,1)
jmp    1323 <read_hex+0x1b3>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%eax
mov    %eax,%r15d
test   %eax,%eax
je     12d0 <read_hex+0x160>
mov    %r14,%rdi
lea    0xccc(%rip),%rsi
call   1050 <strspn@plt>
sub    %eax,%r15d
je     12d0 <read_hex+0x160>
mov    %eax,%r12d
cltq
cmpb   $0x23,0x20(%rsp,%rax,1)
je     12d0 <read_hex+0x160>
lea    (%rsp,%rax,1),%r14
add    $0x20,%r14
mov    %r14,%rdi
lea    0xca7(%rip),%rsi
call   1050 <strspn@plt>
cmp    %eax,%r15d
jne    14dd <read_hex+0x36d>
movslq 0x8(%rsp),%r15
add    0x18(%rsp),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
lea    0xcbe(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    141d <read_hex+0x2ad>
mov    0x4(%rsp),%eax
cmp    $0x100,%eax
jae    143e <read_hex+0x2ce>
mov    %al,(%r15,%rbp,1)
mov    %r14,%rdi
mov    %r13,%r12
mov    %r13,%rsi
call   1090 <strpbrk@plt>
test   %rax,%rax
je     12ac <read_hex+0x13c>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r12,%rsi
call   1050 <strspn@plt>
cltq
cmpb   $0x0,(%r14,%rax,1)
je     12ac <read_hex+0x13c>
add    %rax,%r14
add    $0x1,%rbp
cmp    $0x400,%rbp
jne    1380 <read_hex+0x210>
mov    $0x400,%ebp
jmp    12ac <read_hex+0x13c>
mov    0x2bd5(%rip),%rcx
mov    (%rcx),%edi
add    $0x1,%eax
lea    0xcb6(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    14c8 <read_hex+0x358>
mov    0x2bb4(%rip),%rax
mov    (%rax),%edi
add    $0x1,%ebx
lea    0x20(%rsp),%rax
sub    %eax,%r14d
add    $0x1,%r14d
lea    0xc49(%rip),%rsi
jmp    145d <read_hex+0x2ed>
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
add    $0x1,%ebx
lea    0x20(%rsp),%rax
sub    %eax,%r14d
add    $0x1,%r14d
lea    0xbee(%rip),%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%r14d
jmp    14c8 <read_hex+0x358>
mov    0x2b60(%rip),%rax
mov    (%rax),%edi
sub    %r15d,%ebp
add    $0x1,%ebp
lea    0xc3e(%rip),%rsi
jmp    149f <read_hex+0x32f>
mov    0x2b48(%rip),%rax
mov    (%rax),%edi
sub    %r15d,%ebp
add    $0x1,%ebp
lea    0xc41(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%r14d
jmp    14c8 <read_hex+0x358>
add    $0x1,%r13d
mov    %r13,0x8(%rsp)
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    %ecx,(%rax)
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2af4(%rip),%rcx
mov    (%rcx),%edi
add    $0x1,%ebx
lea    (%r12,%rax,1),%ecx
add    $0x1,%ecx
lea    0xb26(%rip),%rsi
mov    %ebx,%edx
jmp    1462 <read_hex+0x2f2>

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c" \09\00"
@.str.1 = [26 x i8] c"0123456789aAbBcCdDeEfF ,\09\00"
@stderr = global i32 0
@.str.2 = [43 x i8] c"read_hex: syntax error at line %d, pos %d\0A\00"
@.str.3 = [3 x i8] c"%x\00"
@.str.4 = [58 x i8] c"read_hex: hex number larger than 0xff in line %d, pos %d\0A\00"
@.str.5 = [4 x i8] c" ,\09\00"
@.str.6 = [39 x i8] c"read_hex: error in line %d, at pos %d\0A\00"
@.str.7 = [25 x i8] c"0123456789aAbBcCdDeEfF, \00"
@.str.8 = [27 x i8] c"read_hex: error at pos %d\0A\00"
@.str.9 = [49 x i8] c"read_hex: hex number larger than 0xff at pos %d\0A\00"
define i32 @read_hex(i8* %0, i8* writeonly %1, i32* writeonly %2) {
%4 = alloca i32
%5 = alloca [512 x i8]
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%8 = icmp eq i8* %0, null
%9 = icmp eq i8* %1, null
%10 = or i1 %8, %9
%11 = icmp eq i32* %2, null
%12 = or i1 %10, %11
br i1 %12, label %165, label %13
13: ; preds = %3
%14 = tail call i32 @strlen(i8* %0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 0, i32* %2
br label %17
17: ; preds = %16, %13
%18 = load i8, i8* %0
%19 = icmp eq i8 %18, 45
br i1 %19, label %20, label %113
20: ; preds = %17, %109
%21 = phi i32 [ %110, %109 ], [ 0, %17 ]
%22 = phi i32 [ %111, %109 ], [ 0, %17 ]
%23 = load i32, i32* @stdin
%24 = call i32* @fgets(i8* %7, i32 512, i32 %23)
%25 = icmp eq i32* %24, null
br i1 %25, label %163, label %26
26: ; preds = %20
%27 = call i32 @strlen(i8* %7)
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = add nsw i32 %27, -1
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 10
br i1 %34, label %35, label %39
35: ; preds = %29
store i8 0, i8* %32
br label %36
36: ; preds = %35, %26
%37 = phi i32 [ %30, %35 ], [ %27, %26 ]
%38 = icmp eq i32 %37, 0
br i1 %38, label %109, label %39
39: ; preds = %29, %36
%40 = phi i32 [ %37, %36 ], [ %27, %29 ]
%41 = call i32 @strspn(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%42 = icmp eq i32 %40, %41
br i1 %42, label %109, label %43
43: ; preds = %39
%44 = sext i32 %41 to i64
%45 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = icmp eq i8 %46, 35
br i1 %47, label %109, label %48
48: ; preds = %43
%49 = sub nsw i32 %40, %41
%50 = call i32 @strspn(i8* %45, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = sext i32 %21 to i64
br label %60
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = add nuw nsw i32 %22, 1
%57 = add i32 %41, 1
%58 = add i32 %57, %50
%59 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %56, i32 %58)
br label %165
60: ; preds = %52, %98
%61 = phi i64 [ 0, %52 ], [ %99, %98 ]
%62 = phi i8* [ %45, %52 ], [ %86, %98 ]
%63 = call i32 @sscanf(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %89
65: ; preds = %60
%66 = load i32, i32* %4
%67 = icmp ugt i32 %66, 255
br i1 %67, label %68, label %77
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = add nuw nsw i32 %22, 1
%71 = ptrtoint i8* %62 to i64
%72 = ptrtoint [512 x i8]* %5 to i64
%73 = sub i64 %71, %72
%74 = trunc i64 %73 to i32
%75 = add i32 %74, 1
%76 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %70, i32 %75)
br label %165
77: ; preds = %65
%78 = trunc i32 %66 to i8
%79 = add nsw i64 %61, %53
%80 = getelementptr inbounds i8, i8* %1, i64 %79
store i8 %78, i8* %80
%81 = call i8* @strpbrk(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%82 = icmp eq i8* %81, null
br i1 %82, label %103, label %83
83: ; preds = %77
%84 = call i32 @strspn(i8* %81, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %81, i64 %85
%87 = load i8, i8* %86
%88 = icmp eq i8 %87, 0
br i1 %88, label %101, label %98
89: ; preds = %60
%90 = load i32, i32* @stderr
%91 = add nuw nsw i32 %22, 1
%92 = ptrtoint i8* %62 to i64
%93 = ptrtoint [512 x i8]* %5 to i64
%94 = sub i64 %92, %93
%95 = trunc i64 %94 to i32
%96 = add i32 %95, 1
%97 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %91, i32 %96)
br label %165
98: ; preds = %83
%99 = add nuw nsw i64 %61, 1
%100 = icmp eq i64 %99, 1024
br i1 %100, label %105, label %60
101: ; preds = %83
%102 = trunc i64 %61 to i32
br label %105
103: ; preds = %77
%104 = trunc i64 %61 to i32
br label %105
105: ; preds = %98, %103, %101
%106 = phi i32 [ %102, %101 ], [ %104, %103 ], [ 1024, %98 ]
%107 = add i32 %106, %21
%108 = add i32 %107, 1
br label %109
109: ; preds = %43, %39, %36, %105
%110 = phi i32 [ %21, %36 ], [ %21, %39 ], [ %21, %43 ], [ %108, %105 ]
%111 = add nuw nsw i32 %22, 1
%112 = icmp eq i32 %111, 512
br i1 %112, label %163, label %20
113: ; preds = %17
%114 = tail call i32 @strspn(i8* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%115 = icmp eq i32 %14, %114
br i1 %115, label %120, label %116
116: ; preds = %113
%117 = load i32, i32* @stderr
%118 = add nsw i32 %114, 1
%119 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %118)
br label %165
120: ; preds = %113, %144
%121 = phi i64 [ %150, %144 ], [ 0, %113 ]
%122 = phi i8* [ %149, %144 ], [ %0, %113 ]
%123 = call i32 @sscanf(i8* %122, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%124 = icmp eq i32 %123, 1
br i1 %124, label %125, label %152
125: ; preds = %120
%126 = load i32, i32* %4
%127 = icmp ugt i32 %126, 255
br i1 %127, label %128, label %136
128: ; preds = %125
%129 = load i32, i32* @stderr
%130 = ptrtoint i8* %122 to i64
%131 = ptrtoint i8* %0 to i64
%132 = sub i64 %130, %131
%133 = trunc i64 %132 to i32
%134 = add i32 %133, 1
%135 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %129, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i32 %134)
br label %165
136: ; preds = %125
%137 = trunc i32 %126 to i8
%138 = getelementptr inbounds i8, i8* %1, i64 %121
store i8 %137, i8* %138
%139 = call i8* @strchr(i8* %122, i8 signext 44)
%140 = call i8* @strchr(i8* %122, i8 signext 32)
%141 = icmp eq i8* %139, null
%142 = select i1 %141, i8* %140, i8* %139
%143 = icmp eq i8* %142, null
br i1 %143, label %160, label %144
144: ; preds = %136
%145 = icmp ne i8* %140, null
%146 = icmp ult i8* %140, %142
%147 = select i1 %145, i1 %146, i1 false
%148 = select i1 %147, i8* %140, i8* %142
%149 = getelementptr inbounds i8, i8* %148, i64 1
%150 = add nuw nsw i64 %121, 1
%151 = icmp eq i64 %150, 1024
br i1 %151, label %163, label %120
152: ; preds = %120
%153 = load i32, i32* @stderr
%154 = ptrtoint i8* %122 to i64
%155 = ptrtoint i8* %0 to i64
%156 = sub i64 %154, %155
%157 = trunc i64 %156 to i32
%158 = add i32 %157, 1
%159 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %153, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %158)
br label %165
160: ; preds = %136
%161 = trunc i64 %121 to i32
%162 = add i32 %161, 1
br label %163
163: ; preds = %144, %109, %20, %160
%164 = phi i32 [ %162, %160 ], [ %21, %20 ], [ %110, %109 ], [ 1025, %144 ]
store i32 %164, i32* %2
br label %165
165: ; preds = %3, %163, %152, %128, %116, %89, %68, %54
%166 = phi i32 [ 0, %163 ], [ 1, %54 ], [ 1, %68 ], [ 1, %89 ], [ 1, %116 ], [ 1, %128 ], [ 1, %152 ], [ 1, %3 ]
ret i32 %166
}