#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 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 build_diag_page(const char *inp, unsigned char *mp_arr, int *mp_arr_len,
                    int max_arr_len) {
  int in_len, k, j, m;
  unsigned int h;
  const char *lcp;
  char *cp;
  char *c2p;
  if ((NULL == inp) || (NULL == mp_arr) || (NULL == mp_arr_len))
    return 1;
  lcp = inp;
  in_len = strlen(inp);
  if (0 == in_len)
    *mp_arr_len = 0;
  if ('-' == inp[0]) {
    char line[512];
    int off = 0;
    for (j = 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 ((k < in_len) && ('#' != lcp[k])) {
        fprintf(stderr,
                "build_diag_page: 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,
                    "build_diag_page: hex number "
                    "larger than 0xff in line %d, pos %d\n",
                    j + 1, (int)(lcp - line + 1));
            return 1;
          }
          if ((off + k) >= max_arr_len) {
            fprintf(stderr, "build_diag_page: array length "
                            "exceeded\n");
            return 1;
          }
          mp_arr[off + k] = h;
          lcp = strpbrk(lcp, " ,\t");
          if (NULL == lcp)
            break;
          lcp += strspn(lcp, " ,\t");
          if ('\0' == *lcp)
            break;
        } else {
          if ('#' == *lcp) {
            --k;
            break;
          }
          fprintf(stderr,
                  "build_diag_page: error in "
                  "line %d, at pos %d\n",
                  j + 1, (int)(lcp - line + 1));
          return 1;
        }
      }
      off += (k + 1);
    }
    *mp_arr_len = off;
  } else {
    k = strspn(inp, "0123456789aAbBcCdDeEfF, ");
    if (in_len != k) {
      fprintf(stderr, "build_diag_page: error at pos %d\n", k + 1);
      return 1;
    }
    for (k = 0; k < max_arr_len; ++k) {
      if (1 == sscanf(lcp, "%x", &h)) {
        if (h > 0xff) {
          fprintf(stderr,
                  "build_diag_page: hex number larger "
                  "than 0xff at pos %d\n",
                  (int)(lcp - inp + 1));
          return 1;
        }
        mp_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, "build_diag_page: error at pos %d\n",
                (int)(lcp - inp + 1));
        return 1;
      }
    }
    *mp_arr_len = k + 1;
    if (k == max_arr_len) {
      fprintf(stderr, "build_diag_page: array length exceeded\n");
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<build_diag_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     11ae <build_diag_page+0x3e>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     11ae <build_diag_page+0x3e>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    11ba <build_diag_page+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%eax
jne    11e3 <build_diag_page+0x73>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
jne    1541 <build_diag_page+0x3d1>
movl   $0x0,-0x254(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x200,-0x30(%rbp)
jge    1530 <build_diag_page+0x3c0>
lea    -0x250(%rbp),%rdi
mov    0x2dc5(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1242 <build_diag_page+0xd2>
jmp    1530 <build_diag_page+0x3c0>
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jle    1292 <build_diag_page+0x122>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x250(%rbp,%rax,1),%ecx
ff
mov    $0xa,%eax
cmp    %ecx,%eax
jne    128d <build_diag_page+0x11d>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
movb   $0x0,-0x250(%rbp,%rax,1)
jmp    1292 <build_diag_page+0x122>
xor    %eax,%eax
cmp    -0x28(%rbp),%eax
jne    12a2 <build_diag_page+0x132>
jmp    1522 <build_diag_page+0x3b2>
lea    -0x250(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xd48(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    12d1 <build_diag_page+0x161>
jmp    1522 <build_diag_page+0x3b2>
mov    -0x34(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    1306 <build_diag_page+0x196>
jmp    1522 <build_diag_page+0x3b2>
mov    -0x40(%rbp),%rdi
lea    0xcf2(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1370 <build_diag_page+0x200>
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
je     1370 <build_diag_page+0x200>
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
add    $0x1,%edx
mov    -0x34(%rbp),%ecx
add    -0x2c(%rbp),%ecx
add    $0x1,%ecx
lea    0xcc0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x400,-0x2c(%rbp)
jge    1510 <build_diag_page+0x3a0>
mov    -0x40(%rbp),%rdi
lea    0xcc0(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    149e <build_diag_page+0x32e>
cmpl   $0xff,-0x38(%rbp)
jbe    13f1 <build_diag_page+0x281>
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
add    $0x1,%edx
mov    -0x40(%rbp),%rax
lea    -0x250(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
lea    0xc74(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
mov    -0x254(%rbp),%eax
add    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jl     1426 <build_diag_page+0x2b6>
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
lea    0xc80(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
mov    -0x38(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x254(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
lea    0xbd0(%rip),%rsi
call   1090 <strpbrk@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmp    -0x40(%rbp),%rax
jne    1463 <build_diag_page+0x2f3>
jmp    1510 <build_diag_page+0x3a0>
mov    -0x40(%rbp),%rdi
lea    0xbab(%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    1499 <build_diag_page+0x329>
jmp    1510 <build_diag_page+0x3a0>
jmp    14fd <build_diag_page+0x38d>
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    14c0 <build_diag_page+0x350>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    1510 <build_diag_page+0x3a0>
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
add    $0x1,%edx
mov    -0x40(%rbp),%rax
lea    -0x250(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
lea    0xbd1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
jmp    1502 <build_diag_page+0x392>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1377 <build_diag_page+0x207>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
add    -0x254(%rbp),%eax
mov    %eax,-0x254(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1208 <build_diag_page+0x98>
mov    -0x254(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1712 <build_diag_page+0x5a2>
mov    -0x10(%rbp),%rdi
lea    0xb9d(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
je     1589 <build_diag_page+0x419>
mov    0x2a71(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
lea    0xb8c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    16d2 <build_diag_page+0x562>
mov    -0x40(%rbp),%rdi
lea    0xaa8(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    168b <build_diag_page+0x51b>
cmpl   $0xff,-0x38(%rbp)
jbe    1600 <build_diag_page+0x490>
mov    0x2a05(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
lea    0xb37(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
mov    -0x38(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x2c(%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    1648 <build_diag_page+0x4d8>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%rax
jne    1659 <build_diag_page+0x4e9>
jmp    16d2 <build_diag_page+0x562>
cmpq   $0x0,-0x50(%rbp)
je     167a <build_diag_page+0x50a>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jae    167a <build_diag_page+0x50a>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    16bf <build_diag_page+0x54f>
mov    0x2946(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
lea    0xa56(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
jmp    16c4 <build_diag_page+0x554>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1590 <build_diag_page+0x420>
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    170d <build_diag_page+0x59d>
mov    0x28e7(%rip),%rax
mov    (%rax),%edi
lea    0x999(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1719 <build_diag_page+0x5a9>
jmp    1712 <build_diag_page+0x5a2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_diag_page>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    $0x1,%r13d
test   %rdi,%rdi
je     1551 <build_diag_page+0x3e1>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1551 <build_diag_page+0x3e1>
mov    %rdx,%rbp
test   %rdx,%rdx
je     1551 <build_diag_page+0x3e1>
mov    %ecx,%r12d
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
test   %eax,%eax
je     139b <build_diag_page+0x22b>
cmpb   $0x2d,(%r14)
jne    13ac <build_diag_page+0x23c>
mov    %rbx,0x20(%rsp)
mov    %rbp,0x18(%rsp)
movslq %r12d,%rax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x2e00(%rip),%rbx
lea    0x30(%rsp),%rbp
lea    0xe25(%rip),%r12
xor    %r15d,%r15d
jmp    1216 <build_diag_page+0xa6>
nopl   0x0(%rax)
lea    0x30(%rsp),%rbp
add    $0x1,%r15d
cmp    $0x200,%r15d
je     14a7 <build_diag_page+0x337>
mov    (%rbx),%edx
mov    %rbp,%rdi
mov    $0x200,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     14a7 <build_diag_page+0x337>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
test   %eax,%eax
jle    1260 <build_diag_page+0xf0>
mov    %r14d,%eax
add    $0xffffffff,%eax
cmpb   $0xa,0x30(%rsp,%rax,1)
jne    126a <build_diag_page+0xfa>
movb   $0x0,0x30(%rsp,%rax,1)
jmp    1263 <build_diag_page+0xf3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14d,%eax
mov    %eax,%r14d
test   %eax,%eax
je     1205 <build_diag_page+0x95>
mov    %rbp,%rdi
lea    0xd8c(%rip),%rsi
call   1050 <strspn@plt>
sub    %eax,%r14d
je     1200 <build_diag_page+0x90>
mov    %eax,%r13d
cltq
cmpb   $0x23,0x30(%rsp,%rax,1)
je     1200 <build_diag_page+0x90>
lea    (%rsp,%rax,1),%rbx
add    $0x30,%rbx
mov    %rbx,%rdi
lea    0xd63(%rip),%rsi
call   1050 <strspn@plt>
cmp    %r14d,%eax
jge    12b7 <build_diag_page+0x147>
movslq %eax,%rcx
cmpb   $0x23,(%rbx,%rcx,1)
jne    1566 <build_diag_page+0x3f6>
mov    0x8(%rsp),%rbp
movslq %ebp,%rbp
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0xd75(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1350 <build_diag_page+0x1e0>
mov    0x14(%rsp),%eax
cmp    $0x100,%eax
jae    14bb <build_diag_page+0x34b>
cmp    0x28(%rsp),%rbp
jge    1534 <build_diag_page+0x3c4>
mov    0x20(%rsp),%rcx
mov    %al,(%rcx,%rbp,1)
mov    %rbx,%rdi
mov    %r12,%r13
mov    %r12,%rsi
call   1090 <strpbrk@plt>
test   %rax,%rax
je     135e <build_diag_page+0x1ee>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r13,%rsi
call   1050 <strspn@plt>
cltq
cmpb   $0x0,(%rbx,%rax,1)
je     1377 <build_diag_page+0x207>
add    %rax,%rbx
add    $0xffffffffffffffff,%r14
add    $0x1,%rbp
cmp    $0xfffffffffffffc00,%r14
jne    12d0 <build_diag_page+0x160>
mov    $0x400,%r14d
jmp    137a <build_diag_page+0x20a>
cmpb   $0x23,(%rbx)
jne    1589 <build_diag_page+0x419>
not    %r14d
jmp    137a <build_diag_page+0x20a>
neg    %r14d
mov    0x8(%rsp),%rax
mov    0x2c7b(%rip),%rbx
lea    0x30(%rsp),%rbp
mov    %r13,%r12
jmp    138b <build_diag_page+0x21b>
neg    %r14d
mov    0x8(%rsp),%rax
mov    0x2c62(%rip),%rbx
lea    0x30(%rsp),%rbp
add    %r14d,%eax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
jmp    1205 <build_diag_page+0x95>
movl   $0x0,0x0(%rbp)
cmpb   $0x2d,(%r14)
je     11c8 <build_diag_page+0x58>
lea    0xd36(%rip),%rsi
mov    %r14,%rdi
call   1050 <strspn@plt>
cmp    %eax,%r15d
jne    1490 <build_diag_page+0x320>
mov    %r12d,%edx
mov    %rbp,0x18(%rsp)
xor    %r13d,%r13d
mov    $0x0,%r15d
test   %r12d,%r12d
jle    1524 <build_diag_page+0x3b4>
mov    %rbx,%r12
mov    %edx,0x20(%rsp)
mov    %edx,%eax
mov    %rax,0x28(%rsp)
xor    %r15d,%r15d
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0xc45(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    14e7 <build_diag_page+0x377>
mov    0x14(%rsp),%eax
cmp    $0x100,%eax
jae    14ff <build_diag_page+0x38f>
mov    %al,(%r12,%r15,1)
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rbp,%rbp
cmove  %rax,%rbp
test   %rbp,%rbp
je     1520 <build_diag_page+0x3b0>
cmp    %rbp,%rax
mov    %rbp,%rbx
cmovb  %rax,%rbx
test   %rax,%rax
cmove  %rbp,%rbx
add    $0x1,%rbx
add    $0x1,%r15
cmp    %r15,0x28(%rsp)
jne    1400 <build_diag_page+0x290>
mov    0x20(%rsp),%ecx
add    $0x1,%ecx
mov    0x18(%rsp),%rax
mov    %ecx,(%rax)
jmp    1534 <build_diag_page+0x3c4>
mov    0x2b41(%rip),%rcx
mov    (%rcx),%edi
add    $0x1,%eax
lea    0xc5f(%rip),%rsi
mov    %eax,%edx
jmp    1517 <build_diag_page+0x3a7>
mov    0x18(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    %ecx,(%rax)
xor    %r13d,%r13d
jmp    1551 <build_diag_page+0x3e1>
mov    0x2b16(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r15d
lea    0x30(%rsp),%rax
sub    %eax,%ebx
add    $0x1,%ebx
lea    0xb79(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    154b <build_diag_page+0x3db>
mov    0x2aea(%rip),%rax
mov    (%rax),%edi
sub    %r14d,%ebx
add    $0x1,%ebx
lea    0xc05(%rip),%rsi
jmp    1515 <build_diag_page+0x3a5>
mov    0x2ad2(%rip),%rax
mov    (%rax),%edi
sub    %r14d,%ebx
add    $0x1,%ebx
lea    0xc0f(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    154b <build_diag_page+0x3db>
mov    0x20(%rsp),%edx
lea    0x1(%r15),%eax
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
cmp    %edx,%r15d
jne    1551 <build_diag_page+0x3e1>
mov    0x2a9d(%rip),%rax
mov    (%rax),%edi
lea    0xb4f(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%r13d
mov    %r13d,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a6b(%rip),%rcx
mov    (%rcx),%edi
add    $0x1,%r15d
lea    (%rax,%r13,1),%ecx
add    $0x1,%ecx
lea    0xa9c(%rip),%rsi
mov    %r15d,%edx
jmp    14de <build_diag_page+0x36e>
mov    0x2a48(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r15d
lea    0x30(%rsp),%rax
sub    %eax,%ebx
add    $0x1,%ebx
lea    0xb14(%rip),%rsi
jmp    14d9 <build_diag_page+0x369>

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

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