#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 scalar_t__ uint64_t;
typedef scalar_t__ uint32_t;
typedef int /*<<< orphan*/ line;
typedef int int64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int get_llnum(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int strlen(char const *);
char *strpbrk(char *, char *);
int strspn(char *, char *);
int build_joint_arr(const char *file_name, uint64_t *lba_arr, uint32_t *num_arr,
                    int *arr_len, int max_arr_len) {
  char line[512];
  int off = 0;
  int in_len, k, j, m, have_stdin, ind, bit0;
  char *lcp;
  FILE *fp;
  int64_t ll;
  have_stdin = ((1 == strlen(file_name)) && ('-' == file_name[0]));
  if (have_stdin)
    fp = stdin;
  else {
    fp = fopen(file_name, "r");
    if (NULL == fp) {
      fprintf(stderr, "build_joint_arr: unable to open %s\n", file_name);
      return 1;
    }
  }
  for (j = 0; j < 512; ++j) {
    if (NULL == fgets(line, sizeof(line), fp))
      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, "0123456789aAbBcCdDeEfFhHxX ,\t");
    if ((k < in_len) && ('#' != lcp[k])) {
      fprintf(stderr,
              "build_joint_arr: syntax error at "
              "line %d, pos %d\n",
              j + 1, m + k + 1);
      return 1;
    }
    for (k = 0; k < 1024; ++k) {
      ll = get_llnum(lcp);
      if (-1 != ll) {
        ind = ((off + k) >> 1);
        bit0 = 0x1 & (off + k);
        if (ind >= max_arr_len) {
          fprintf(stderr, "build_joint_arr: array length "
                          "exceeded\n");
          return 1;
        }
        if (bit0)
          num_arr[ind] = (uint32_t)ll;
        else
          lba_arr[ind] = (uint64_t)ll;
        lcp = strpbrk(lcp, " ,\t");
        if (NULL == lcp)
          break;
        lcp += strspn(lcp, " ,\t");
        if ('\0' == *lcp)
          break;
      } else {
        if ('#' == *lcp) {
          --k;
          break;
        }
        fprintf(stderr,
                "build_joint_arr: error in "
                "line %d, at pos %d\n",
                j + 1, (int)(lcp - line + 1));
        return 1;
      }
    }
    off += (k + 1);
  }
  if (0x1 & off) {
    fprintf(stderr,
            "build_joint_arr: expect LBA,NUM pairs but decoded "
            "odd number\n  from %s\n",
            have_stdin ? "stdin" : file_name);
    return 1;
  }
  *arr_len = off >> 1;
  return 0;
}


x86 assembly (clang, -O0):
<build_joint_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
movl   $0x0,-0x234(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0x265(%rbp)
jne    11d0 <build_joint_arr+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x265(%rbp)
mov    -0x265(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x248(%rbp)
cmpl   $0x0,-0x248(%rbp)
je     1204 <build_joint_arr+0x94>
mov    0x2df3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x260(%rbp)
jmp    1256 <build_joint_arr+0xe6>
mov    -0x10(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x260(%rbp)
xor    %eax,%eax
cmp    -0x260(%rbp),%rax
jne    1251 <build_joint_arr+0xe1>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16a2 <build_joint_arr+0x532>
jmp    1256 <build_joint_arr+0xe6>
movl   $0x0,-0x240(%rbp)
cmpl   $0x200,-0x240(%rbp)
jge    1619 <build_joint_arr+0x4a9>
lea    -0x230(%rbp),%rdi
mov    -0x260(%rbp),%rdx
mov    $0x200,%esi
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    129b <build_joint_arr+0x12b>
jmp    1619 <build_joint_arr+0x4a9>
lea    -0x230(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x238(%rbp)
cmpl   $0x0,-0x238(%rbp)
jle    12fd <build_joint_arr+0x18d>
mov    -0x238(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x230(%rbp,%rax,1),%ecx
ff
mov    $0xa,%eax
cmp    %ecx,%eax
jne    12f8 <build_joint_arr+0x188>
mov    -0x238(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x238(%rbp)
movslq -0x238(%rbp),%rax
movb   $0x0,-0x230(%rbp,%rax,1)
jmp    12fd <build_joint_arr+0x18d>
xor    %eax,%eax
cmp    -0x238(%rbp),%eax
jne    1310 <build_joint_arr+0x1a0>
jmp    1605 <build_joint_arr+0x495>
lea    -0x230(%rbp),%rax
mov    %rax,-0x258(%rbp)
mov    -0x258(%rbp),%rdi
lea    0xcfa(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x244(%rbp)
mov    -0x244(%rbp),%eax
cmp    -0x238(%rbp),%eax
jne    134e <build_joint_arr+0x1de>
jmp    1605 <build_joint_arr+0x495>
mov    -0x244(%rbp),%ecx
mov    -0x258(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x258(%rbp)
mov    -0x244(%rbp),%ecx
mov    -0x238(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x238(%rbp)
mov    -0x258(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    1398 <build_joint_arr+0x228>
jmp    1605 <build_joint_arr+0x495>
mov    -0x258(%rbp),%rdi
lea    0xc83(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x23c(%rbp)
mov    -0x23c(%rbp),%eax
cmp    -0x238(%rbp),%eax
jge    141d <build_joint_arr+0x2ad>
mov    -0x258(%rbp),%rax
movslq -0x23c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
je     141d <build_joint_arr+0x2ad>
mov    0x2bef(%rip),%rax
mov    (%rax),%edi
mov    -0x240(%rbp),%edx
add    $0x1,%edx
mov    -0x244(%rbp),%ecx
add    -0x23c(%rbp),%ecx
add    $0x1,%ecx
lea    0xc3d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16a2 <build_joint_arr+0x532>
movl   $0x0,-0x23c(%rbp)
cmpl   $0x400,-0x23c(%rbp)
jge    15f0 <build_joint_arr+0x480>
mov    -0x258(%rbp),%rdi
call   1030 <get_llnum@plt>
mov    %eax,-0x264(%rbp)
mov    $0xffffffff,%eax
cmp    -0x264(%rbp),%eax
je     1569 <build_joint_arr+0x3f9>
mov    -0x234(%rbp),%eax
add    -0x23c(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x24c(%rbp)
mov    -0x234(%rbp),%eax
add    -0x23c(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x250(%rbp)
mov    -0x24c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jl     14b6 <build_joint_arr+0x346>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
lea    0xbd6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16a2 <build_joint_arr+0x532>
cmpl   $0x0,-0x250(%rbp)
je     14de <build_joint_arr+0x36e>
movslq -0x264(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x24c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    14f4 <build_joint_arr+0x384>
movslq -0x264(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x24c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x258(%rbp),%rdi
lea    0xb41(%rip),%rsi
call   1080 <strpbrk@plt>
mov    %rax,-0x258(%rbp)
xor    %eax,%eax
cmp    -0x258(%rbp),%rax
jne    1522 <build_joint_arr+0x3b2>
jmp    15f0 <build_joint_arr+0x480>
mov    -0x258(%rbp),%rdi
lea    0xb13(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,%ecx
mov    -0x258(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x258(%rbp)
mov    -0x258(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1564 <build_joint_arr+0x3f4>
jmp    15f0 <build_joint_arr+0x480>
jmp    15d7 <build_joint_arr+0x467>
mov    -0x258(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    1594 <build_joint_arr+0x424>
mov    -0x23c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x23c(%rbp)
jmp    15f0 <build_joint_arr+0x480>
mov    0x2a3d(%rip),%rax
mov    (%rax),%edi
mov    -0x240(%rbp),%edx
add    $0x1,%edx
mov    -0x258(%rbp),%rax
lea    -0x230(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
lea    0xadd(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16a2 <build_joint_arr+0x532>
jmp    15dc <build_joint_arr+0x46c>
mov    -0x23c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x23c(%rbp)
jmp    1427 <build_joint_arr+0x2b7>
mov    -0x23c(%rbp),%eax
add    $0x1,%eax
add    -0x234(%rbp),%eax
mov    %eax,-0x234(%rbp)
mov    -0x240(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x240(%rbp)
jmp    1260 <build_joint_arr+0xf0>
mov    -0x234(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     168c <build_joint_arr+0x51c>
mov    0x29a6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x26c(%rbp)
cmpl   $0x0,-0x248(%rbp)
je     165a <build_joint_arr+0x4ea>
lea    0xac9(%rip),%rax
mov    %rax,-0x278(%rbp)
jmp    1665 <build_joint_arr+0x4f5>
mov    -0x10(%rbp),%rax
mov    %rax,-0x278(%rbp)
mov    -0x26c(%rbp),%edi
mov    -0x278(%rbp),%rdx
lea    0xa56(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16a2 <build_joint_arr+0x532>
mov    -0x234(%rbp),%ecx
sar    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_joint_arr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %r8d,0xc(%rsp)
mov    %rcx,%rbp
mov    %rdx,0x28(%rsp)
mov    %rsi,0x20(%rsp)
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x1,%eax
jne    11c2 <build_joint_arr+0x52>
cmpb   $0x2d,(%rbx)
jne    11c2 <build_joint_arr+0x52>
mov    %rbp,0x10(%rsp)
mov    0x2e37(%rip),%rax
mov    (%rax),%r13
lea    0xf5c(%rip),%rax
mov    %rax,0x18(%rsp)
jmp    11e7 <build_joint_arr+0x77>
lea    0xe37(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1366 <build_joint_arr+0x1f6>
mov    %rax,%r13
mov    %rbp,0x10(%rsp)
mov    %rbx,0x18(%rsp)
xor    %r12d,%r12d
lea    0x30(%rsp),%rbp
lea    0xe4d(%rip),%r14
xor    %ebx,%ebx
mov    %r13,(%rsp)
jmp    1217 <build_joint_arr+0xa7>
xchg   %ax,%ax
mov    %r15,%r14
lea    0x30(%rsp),%rbp
add    $0x1,%ebx
cmp    $0x200,%ebx
je     1351 <build_joint_arr+0x1e1>
mov    %rbp,%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1351 <build_joint_arr+0x1e1>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1260 <build_joint_arr+0xf0>
mov    %ebp,%eax
add    $0xffffffff,%eax
cmpb   $0xa,0x30(%rsp,%rax,1)
jne    1268 <build_joint_arr+0xf8>
movb   $0x0,0x30(%rsp,%rax,1)
jmp    1262 <build_joint_arr+0xf2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
mov    %eax,%ebp
test   %eax,%eax
je     1203 <build_joint_arr+0x93>
mov    %r14,%r15
lea    0x30(%rsp),%rdi
lea    0xdaf(%rip),%rsi
call   1050 <strspn@plt>
sub    %eax,%ebp
je     1200 <build_joint_arr+0x90>
mov    %eax,%r14d
cltq
cmpb   $0x23,0x30(%rsp,%rax,1)
je     1200 <build_joint_arr+0x90>
lea    (%rsp,%rax,1),%r13
add    $0x30,%r13
mov    %r13,%rdi
lea    0xd87(%rip),%rsi
call   1050 <strspn@plt>
cmp    %ebp,%eax
jge    12ba <build_joint_arr+0x14a>
movslq %eax,%rcx
cmpb   $0x23,0x0(%r13,%rcx,1)
jne    13c7 <build_joint_arr+0x257>
xor    %ebp,%ebp
mov    %r15,%r14
nop
mov    %r13,%rdi
call   1030 <get_llnum@plt>
cmp    $0xffffffff,%eax
je     1333 <build_joint_arr+0x1c3>
lea    (%r12,%rbp,1),%edx
mov    %edx,%ecx
sar    %ecx
cmp    0xc(%rsp),%ecx
jge    137b <build_joint_arr+0x20b>
test   $0x1,%dl
cltq
movslq %ecx,%rcx
mov    0x28(%rsp),%rdx
cmove  0x20(%rsp),%rdx
mov    %rax,(%rdx,%rcx,8)
mov    %r13,%rdi
mov    %r14,%rsi
call   1080 <strpbrk@plt>
test   %rax,%rax
je     1341 <build_joint_arr+0x1d1>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strspn@plt>
cltq
cmpb   $0x0,0x0(%r13,%rax,1)
je     1341 <build_joint_arr+0x1d1>
add    %rax,%r13
add    $0x1,%ebp
cmp    $0x400,%ebp
jne    12c0 <build_joint_arr+0x150>
mov    $0x400,%ebp
jmp    1341 <build_joint_arr+0x1d1>
cmpb   $0x23,0x0(%r13)
jne    13e5 <build_joint_arr+0x275>
add    $0xffffffff,%ebp
mov    (%rsp),%r13
add    %ebp,%r12d
add    $0x1,%r12d
jmp    1203 <build_joint_arr+0x93>
test   $0x1,%r12b
jne    1394 <build_joint_arr+0x224>
sar    %r12d
mov    0x10(%rsp),%rax
mov    %r12d,(%rax)
xor    %eax,%eax
jmp    13b5 <build_joint_arr+0x245>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
lea    0xc8c(%rip),%rsi
mov    %rbx,%rdx
jmp    13a9 <build_joint_arr+0x239>
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
lea    0xcee(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13b0 <build_joint_arr+0x240>
mov    0x2c3d(%rip),%rax
mov    (%rax),%edi
lea    0xd2b(%rip),%rsi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c0a(%rip),%rcx
mov    (%rcx),%edi
add    $0x1,%ebx
lea    (%r14,%rax,1),%ecx
add    $0x1,%ecx
lea    0xc66(%rip),%rsi
mov    %ebx,%edx
jmp    1409 <build_joint_arr+0x299>
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
add    $0x1,%ebx
lea    0x30(%rsp),%rax
sub    %eax,%r13d
add    $0x1,%r13d
lea    0xc9d(%rip),%rsi
mov    %ebx,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13b0 <build_joint_arr+0x240>

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

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [36 x i8] c"build_joint_arr: unable to open %s\0A\00"
@.str.2 = [3 x i8] c" \09\00"
@.str.3 = [30 x i8] c"0123456789aAbBcCdDeEfFhHxX ,\09\00"
@.str.4 = [50 x i8] c"build_joint_arr: syntax error at line %d, pos %d\0A\00"
@.str.5 = [40 x i8] c"build_joint_arr: array length exceeded\0A\00"
@.str.6 = [4 x i8] c" ,\09\00"
@.str.7 = [46 x i8] c"build_joint_arr: error in line %d, at pos %d\0A\00"
@.str.8 = [72 x i8] c"build_joint_arr: expect LBA,NUM pairs but decoded odd number\0A from %s\0A\00"
@.str.9 = [6 x i8] c"stdin\00"
define i32 @build_joint_arr(i8* %0, i64* nocapture writeonly %1, i64* nocapture writeonly %2, i32* nocapture writeonly %3, i32 %4) {
%6 = alloca [512 x i8]
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = load i8, i8* %0
%12 = icmp eq i8 %11, 45
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32*, i32** @stdin
br label %21
15: ; preds = %5, %10
%16 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %128
21: ; preds = %15, %13
%22 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), %13 ], [ %0, %15 ]
%23 = phi i32* [ %14, %13 ], [ %16, %15 ]
br label %24
24: ; preds = %21, %115
%25 = phi i32 [ 0, %21 ], [ %116, %115 ]
%26 = phi i32 [ 0, %21 ], [ %117, %115 ]
%27 = call i32* @fgets(i8* %7, i32 512, i32* %23)
%28 = icmp eq i32* %27, null
br i1 %28, label %119, label %29
29: ; preds = %24
%30 = call i32 @strlen(i8* %7)
%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 %115, label %42
42: ; preds = %32, %39
%43 = phi i32 [ %40, %39 ], [ %30, %32 ]
%44 = call i32 @strspn(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%45 = icmp eq i32 %43, %44
br i1 %45, label %115, 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 %115, label %51
51: ; preds = %46
%52 = sub nsw i32 %43, %44
%53 = call i32 @strspn(i8* %48, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%54 = icmp slt i32 %53, %52
br i1 %54, label %56, label %55
55: ; preds = %56, %51
br label %67
56: ; preds = %51
%57 = sext i32 %53 to i64
%58 = getelementptr inbounds i8, i8* %48, i64 %57
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 35
br i1 %60, label %55, label %61
61: ; preds = %56
%62 = load i32, i32* @stderr
%63 = add nuw nsw i32 %26, 1
%64 = add i32 %44, 1
%65 = add i32 %64, %53
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %63, i32 %65)
br label %128
67: ; preds = %55, %108
%68 = phi i8* [ %91, %108 ], [ %48, %55 ]
%69 = phi i32 [ %109, %108 ], [ 0, %55 ]
%70 = call i32 @get_llnum(i8* %68)
%71 = icmp eq i32 %70, -1
br i1 %71, label %94, label %72
72: ; preds = %67
%73 = add nsw i32 %69, %25
%74 = ashr i32 %73, 1
%75 = icmp slt i32 %74, %4
br i1 %75, label %79, label %76
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %128
79: ; preds = %72
%80 = and i32 %73, 1
%81 = icmp eq i32 %80, 0
%82 = sext i32 %70 to i64
%83 = sext i32 %74 to i64
%84 = select i1 %81, i64* %1, i64* %2
%85 = getelementptr inbounds i64, i64* %84, i64 %83
store i64 %82, i64* %85
%86 = call i8* @strpbrk(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%87 = icmp eq i8* %86, null
br i1 %87, label %111, label %88
88: ; preds = %79
%89 = call i32 @strspn(i8* %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %86, i64 %90
%92 = load i8, i8* %91
%93 = icmp eq i8 %92, 0
br i1 %93, label %111, label %108
94: ; preds = %67
%95 = load i8, i8* %68
%96 = icmp eq i8 %95, 35
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = add nsw i32 %69, -1
br label %111
99: ; preds = %94
%100 = load i32, i32* @stderr
%101 = add nuw nsw i32 %26, 1
%102 = ptrtoint i8* %68 to i64
%103 = ptrtoint [512 x i8]* %6 to i64
%104 = sub i64 %102, %103
%105 = trunc i64 %104 to i32
%106 = add i32 %105, 1
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i32 %101, i32 %106)
br label %128
108: ; preds = %88
%109 = add nuw nsw i32 %69, 1
%110 = icmp eq i32 %109, 1024
br i1 %110, label %111, label %67
111: ; preds = %88, %79, %108, %97
%112 = phi i32 [ %98, %97 ], [ 1024, %108 ], [ %69, %79 ], [ %69, %88 ]
%113 = add i32 %25, 1
%114 = add i32 %113, %112
br label %115
115: ; preds = %46, %42, %39, %111
%116 = phi i32 [ %25, %39 ], [ %25, %42 ], [ %25, %46 ], [ %114, %111 ]
%117 = add nuw nsw i32 %26, 1
%118 = icmp eq i32 %117, 512
br i1 %118, label %119, label %24
119: ; preds = %24, %115
%120 = phi i32 [ %25, %24 ], [ %116, %115 ]
%121 = and i32 %120, 1
%122 = icmp eq i32 %121, 0
br i1 %122, label %126, label %123
123: ; preds = %119
%124 = load i32, i32* @stderr
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.8, i64 0, i64 0), i8* %22)
br label %128
126: ; preds = %119
%127 = ashr i32 %120, 1
store i32 %127, i32* %3
br label %128
128: ; preds = %126, %123, %99, %76, %61, %18
%129 = phi i32 [ 1, %123 ], [ 0, %126 ], [ 1, %61 ], [ 1, %76 ], [ 1, %99 ], [ 1, %18 ]
ret i32 %129
}