#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__ u_long;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int map_file(char *, int *, scalar_t__ *, scalar_t__ *, char **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ unmap_file(char *, int, scalar_t__);
int main(int argc, char **argv) {
  char resmergefile[80], mergefile[80], taintfile[80];
  int resmergefd, mergefd, taintfd;
  u_long resmergedatasize, resmergemapsize, mergedatasize, mergemapsize,
      taintdatasize, taintmapsize;
  char *resmergebuf, *mergebuf, *taintbuf;
  int i, rc;
  int epoch_cnt = 0, zeros = 0, values = 0, resolved = 0;
  u_long addr;
  u_long *mgbuf, *tout;
  if (argc != 2) {
    printf("format: mergedump <dir #>\n");
    exit(0);
  }
  sprintf(mergefile, "/tmp/%s/merge-outputs", argv[1]);
  sprintf(resmergefile, "/tmp/%s/dataflow.result", argv[1]);
  sprintf(taintfile, "/tmp/%s/taint_structures", argv[1]);
  rc = map_file(resmergefile, &resmergefd, &resmergedatasize, &resmergemapsize,
                &resmergebuf);
  if (rc < 0)
    return rc;
  rc = map_file(mergefile, &mergefd, &mergedatasize, &mergemapsize, &mergebuf);
  if (rc < 0)
    return rc;
  rc = map_file(taintfile, &taintfd, &taintdatasize, &taintmapsize, &taintbuf);
  if (rc < 0)
    return rc;
  mgbuf = (u_long *)mergebuf;
  while ((u_long)mgbuf < (u_long)mergebuf + mergedatasize) {
    epoch_cnt++;
    if (*mgbuf == 0)
      zeros++;
    do {
      if (*mgbuf) {
        values++;
        if (*mgbuf > 0xc0000000) {
          resolved++;
        } else {
          printf("%lx\n", *mgbuf);
        }
        mgbuf++;
      } else {
        mgbuf++;
        break;
      }
    } while (1);
  }
  printf("%d out of %d are zeros, %d values, %d resolved\n", zeros, epoch_cnt,
         values, resolved);
  zeros = epoch_cnt = 0;
  unmap_file((char *)mergebuf, mergefd, mergemapsize);
  sprintf(mergefile, "/tmp/%s/merge-addrs", argv[1]);
  rc = map_file(mergefile, &mergefd, &mergedatasize, &mergemapsize, &mergebuf);
  if (rc < 0)
    return rc;
  mgbuf = (u_long *)mergebuf;
  tout = (u_long *)taintbuf;
  for (i = 0; i < taintdatasize / (sizeof(u_long) * 2); i++) {
    addr = tout[2 * i];
    epoch_cnt++;
    printf("addr %lx %lx\n", addr, *mgbuf);
    mgbuf++;
    if (*mgbuf == 0)
      zeros++;
    do {
      if (*mgbuf) {
        mgbuf++;
      } else {
        mgbuf++;
        break;
      }
    } while (1);
  }
  printf("%d out of %d are zeros\n", zeros, epoch_cnt);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x164(%rbp)
movl   $0x0,-0x168(%rbp)
movl   $0x0,-0x16c(%rbp)
movl   $0x0,-0x170(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11b0 <main+0x60>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe55(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe53(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe50(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x104(%rbp),%rsi
lea    -0x118(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    -0x148(%rbp),%r8
call   1030 <map_file@plt>
mov    %eax,-0x160(%rbp)
cmpl   $0x0,-0x160(%rbp)
jge    1244 <main+0xf4>
mov    -0x160(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <main+0x497>
lea    -0xb0(%rbp),%rdi
lea    -0x108(%rbp),%rsi
lea    -0x128(%rbp),%rdx
lea    -0x130(%rbp),%rcx
lea    -0x150(%rbp),%r8
call   1030 <map_file@plt>
mov    %eax,-0x160(%rbp)
cmpl   $0x0,-0x160(%rbp)
jge    128d <main+0x13d>
mov    -0x160(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <main+0x497>
lea    -0x100(%rbp),%rdi
lea    -0x10c(%rbp),%rsi
lea    -0x138(%rbp),%rdx
lea    -0x140(%rbp),%rcx
lea    -0x158(%rbp),%r8
call   1030 <map_file@plt>
mov    %eax,-0x160(%rbp)
cmpl   $0x0,-0x160(%rbp)
jge    12d6 <main+0x186>
mov    -0x160(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <main+0x497>
mov    -0x150(%rbp),%rax
mov    %rax,-0x180(%rbp)
mov    -0x180(%rbp),%rax
mov    -0x150(%rbp),%rcx
add    -0x128(%rbp),%rcx
cmp    %rcx,%rax
jge    13de <main+0x28e>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
mov    -0x180(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1331 <main+0x1e1>
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
jmp    1336 <main+0x1e6>
mov    -0x180(%rbp),%rax
cmpq   $0x0,(%rax)
je     13ae <main+0x25e>
mov    -0x16c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x16c(%rbp)
mov    -0x180(%rbp),%rax
mov    $0xc0000000,%ecx
cmp    %rcx,(%rax)
jle    137f <main+0x22f>
mov    -0x170(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x170(%rbp)
jmp    1397 <main+0x247>
mov    -0x180(%rbp),%rax
mov    (%rax),%rsi
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x180(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x180(%rbp)
jmp    13c5 <main+0x275>
mov    -0x180(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x180(%rbp)
jmp    13d9 <main+0x289>
jmp    13ca <main+0x27a>
mov    $0x1,%al
test   $0x1,%al
jne    1336 <main+0x1e6>
jmp    13d9 <main+0x289>
jmp    12e4 <main+0x194>
mov    -0x168(%rbp),%esi
mov    -0x164(%rbp),%edx
mov    -0x16c(%rbp),%ecx
mov    -0x170(%rbp),%r8d
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x164(%rbp)
movl   $0x0,-0x168(%rbp)
mov    -0x150(%rbp),%rdi
mov    -0x108(%rbp),%esi
mov    -0x130(%rbp),%rdx
call   1050 <unmap_file@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc4a(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x108(%rbp),%rsi
lea    -0x128(%rbp),%rdx
lea    -0x130(%rbp),%rcx
lea    -0x150(%rbp),%r8
call   1030 <map_file@plt>
mov    %eax,-0x160(%rbp)
cmpl   $0x0,-0x160(%rbp)
jge    1496 <main+0x346>
mov    -0x160(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <main+0x497>
mov    -0x150(%rbp),%rax
mov    %rax,-0x180(%rbp)
mov    -0x158(%rbp),%rax
mov    %rax,-0x188(%rbp)
movl   $0x0,-0x15c(%rbp)
movslq -0x15c(%rbp),%rax
mov    -0x138(%rbp),%rcx
shr    $0x4,%rcx
cmp    %rcx,%rax
jae    15c6 <main+0x476>
mov    -0x188(%rbp),%rax
mov    -0x15c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x178(%rbp)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
mov    -0x178(%rbp),%rsi
mov    -0x180(%rbp),%rax
mov    (%rax),%rdx
lea    0xb8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x180(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x180(%rbp)
mov    -0x180(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1555 <main+0x405>
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
jmp    155a <main+0x40a>
mov    -0x180(%rbp),%rax
cmpq   $0x0,(%rax)
je     1582 <main+0x432>
mov    -0x180(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x180(%rbp)
jmp    1599 <main+0x449>
mov    -0x180(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x180(%rbp)
jmp    15ad <main+0x45d>
jmp    159e <main+0x44e>
mov    $0x1,%al
test   $0x1,%al
jne    155a <main+0x40a>
jmp    15ad <main+0x45d>
jmp    15b2 <main+0x462>
mov    -0x15c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x15c(%rbp)
jmp    14bc <main+0x36c>
mov    -0x168(%rbp),%esi
mov    -0x164(%rbp),%edx
lea    0xadb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
cmp    $0x2,%edi
jne    1400 <main+0x2a0>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdx
lea    0xe78(%rip),%rsi
lea    0x70(%rsp),%rdi
call   1070 <sprintf@plt>
mov    0x8(%rbp),%rdx
lea    0xe79(%rip),%rsi
lea    0x110(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
mov    0x8(%rbp),%rdx
lea    0xe76(%rip),%rsi
lea    0xc0(%rsp),%rdi
call   1070 <sprintf@plt>
lea    0x4c(%rsp),%rsi
lea    0x68(%rsp),%rdx
lea    0x60(%rsp),%rcx
lea    0x50(%rsp),%r8
mov    %rbx,%rdi
call   1040 <map_file@plt>
test   %eax,%eax
js     1373 <main+0x213>
lea    0x70(%rsp),%rdi
lea    0x1c(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x10(%rsp),%r8
call   1040 <map_file@plt>
test   %eax,%eax
js     1373 <main+0x213>
lea    0xc0(%rsp),%rdi
lea    0x48(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x58(%rsp),%rcx
lea    0x40(%rsp),%r8
call   1040 <map_file@plt>
test   %eax,%eax
js     1373 <main+0x213>
mov    %rbp,0x38(%rsp)
mov    0x20(%rsp),%rdi
test   %rdi,%rdi
jle    12d8 <main+0x178>
mov    0x10(%rsp),%rcx
mov    $0xc0000001,%r14d
mov    %rcx,%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    1296 <main+0x136>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp),%rcx
mov    0x20(%rsp),%rdi
add    $0x1,%r12d
xor    %edx,%edx
mov    0xf(%rsp),%al
mov    %al,%dl
add    %edx,%r13d
add    $0x8,%r15
lea    (%rdi,%rcx,1),%rdx
cmp    %r15,%rdx
jle    12e2 <main+0x182>
mov    (%r15),%rsi
test   %rsi,%rsi
sete   0xf(%rsp)
jne    12ce <main+0x16e>
jmp    127a <main+0x11a>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r15),%rsi
add    $0x8,%r15
add    $0x1,%ebx
test   %rsi,%rsi
je     1270 <main+0x110>
cmp    %r14,%rsi
jl     12b0 <main+0x150>
add    $0x1,%ebp
jmp    12be <main+0x15e>
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
lea    0xd5e(%rip),%rdi
xor    %r15d,%r15d
mov    %r13d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
mov    0x1c(%rsp),%esi
mov    0x30(%rsp),%rdx
call   1060 <unmap_file@plt>
mov    0x38(%rsp),%rax
mov    0x8(%rax),%rdx
lea    0xd56(%rip),%rsi
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
lea    0x1c(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
call   1040 <map_file@plt>
test   %eax,%eax
js     1373 <main+0x213>
cmpq   $0x10,0x28(%rsp)
mov    $0x0,%ebx
jae    1385 <main+0x225>
lea    0xd37(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x40(%rsp),%r12
mov    0x10(%rsp),%rbp
lea    0xcf5(%rip),%r14
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    13bc <main+0x25c>
nopl   (%rax)
mov    %rbp,%rcx
mov    %dl,%al
add    %eax,%ebx
add    $0x10,%rcx
mov    0x28(%rsp),%rax
shr    $0x4,%rax
mov    %rcx,%rbp
cmp    %r15,%rax
jbe    135b <main+0x1fb>
mov    %r15,%rax
shl    $0x4,%rax
mov    (%r12,%rax,1),%rsi
add    $0x1,%r15
mov    0x0(%rbp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbp),%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %dl
je     13a0 <main+0x240>
nopw   0x0(%rax,%rax,1)
lea    0x8(%rbp),%rcx
cmpq   $0x0,0x10(%rbp)
mov    %rcx,%rbp
jne    13f0 <main+0x290>
jmp    13a3 <main+0x243>
lea    0xcaa(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"format: mergedump <dir #>\0A\00"
@.str.1 = [22 x i8] c"/tmp/%s/merge-outputs\00"
@.str.2 = [24 x i8] c"/tmp/%s/dataflow.result\00"
@.str.3 = [25 x i8] c"/tmp/%s/taint_structures\00"
@.str.4 = [5 x i8] c"%lx\0A\00"
@.str.5 = [48 x i8] c"%d out of %d are zeros, %d values, %d resolved\0A\00"
@.str.6 = [20 x i8] c"/tmp/%s/merge-addrs\00"
@.str.7 = [14 x i8] c"addr %lx %lx\0A\00"
@.str.8 = [24 x i8] c"%d out of %d are zeros\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca [80 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i64
%28 = alloca i64*
%29 = alloca i64*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %23
store i32 0, i32* %24
store i32 0, i32* %25
store i32 0, i32* %26
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 2
br i1 %31, label %32, label %35
32: ; preds = %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %2
%36 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 @sprintf(i8* %46, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%52 = call i32 @map_file(i8* %51, i32* %9, i64* %12, i64* %13, i8** %18)
store i32 %52, i32* %22
%53 = load i32, i32* %22
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %35
%56 = load i32, i32* %22
store i32 %56, i32* %3
br label %192
57: ; preds = %35
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%59 = call i32 @map_file(i8* %58, i32* %10, i64* %14, i64* %15, i8** %19)
store i32 %59, i32* %22
%60 = load i32, i32* %22
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = load i32, i32* %22
store i32 %63, i32* %3
br label %192
64: ; preds = %57
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%66 = call i32 @map_file(i8* %65, i32* %11, i64* %16, i64* %17, i8** %20)
store i32 %66, i32* %22
%67 = load i32, i32* %22
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = load i32, i32* %22
store i32 %70, i32* %3
br label %192
71: ; preds = %64
%72 = load i8*, i8** %19
%73 = bitcast i8* %72 to i64*
store i64* %73, i64** %28
br label %74
74: ; preds = %117, %71
%75 = load i64*, i64** %28
%76 = ptrtoint i64* %75 to i64
%77 = load i8*, i8** %19
%78 = ptrtoint i8* %77 to i64
%79 = load i64, i64* %14
%80 = add nsw i64 %78, %79
%81 = icmp slt i64 %76, %80
br i1 %81, label %82, label %118
82: ; preds = %74
%83 = load i32, i32* %23
%84 = add nsw i32 %83, 1
store i32 %84, i32* %23
%85 = load i64*, i64** %28
%86 = load i64, i64* %85
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %82
%89 = load i32, i32* %24
%90 = add nsw i32 %89, 1
store i32 %90, i32* %24
br label %91
91: ; preds = %88, %82
br label %92
92: ; preds = %116, %91
%93 = load i64*, i64** %28
%94 = load i64, i64* %93
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %112
96: ; preds = %92
%97 = load i32, i32* %25
%98 = add nsw i32 %97, 1
store i32 %98, i32* %25
%99 = load i64*, i64** %28
%100 = load i64, i64* %99
%101 = icmp sgt i64 %100, 3221225472
br i1 %101, label %102, label %105
102: ; preds = %96
%103 = load i32, i32* %26
%104 = add nsw i32 %103, 1
store i32 %104, i32* %26
br label %109
105: ; preds = %96
%106 = load i64*, i64** %28
%107 = load i64, i64* %106
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %107)
br label %109
109: ; preds = %105, %102
%110 = load i64*, i64** %28
%111 = getelementptr inbounds i64, i64* %110, i32 1
store i64* %111, i64** %28
br label %115
112: ; preds = %92
%113 = load i64*, i64** %28
%114 = getelementptr inbounds i64, i64* %113, i32 1
store i64* %114, i64** %28
br label %117
115: ; preds = %109
br label %116
116: ; preds = %115
br i1 true, label %92, label %117
117: ; preds = %116, %112
br label %74
118: ; preds = %74
%119 = load i32, i32* %24
%120 = load i32, i32* %23
%121 = load i32, i32* %25
%122 = load i32, i32* %26
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %119, i32 %120, i32 %121, i32 %122)
store i32 0, i32* %23
store i32 0, i32* %24
%124 = load i8*, i8** %19
%125 = load i32, i32* %10
%126 = load i64, i64* %15
%127 = call i32 @unmap_file(i8* %124, i32 %125, i64 %126)
%128 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = call i32 @sprintf(i8* %128, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %131)
%133 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%134 = call i32 @map_file(i8* %133, i32* %10, i64* %14, i64* %15, i8** %19)
store i32 %134, i32* %22
%135 = load i32, i32* %22
%136 = icmp slt i32 %135, 0
br i1 %136, label %137, label %139
137: ; preds = %118
%138 = load i32, i32* %22
store i32 %138, i32* %3
br label %192
139: ; preds = %118
%140 = load i8*, i8** %19
%141 = bitcast i8* %140 to i64*
store i64* %141, i64** %28
%142 = load i8*, i8** %20
%143 = bitcast i8* %142 to i64*
store i64* %143, i64** %29
store i32 0, i32* %21
br label %144
144: ; preds = %185, %139
%145 = load i32, i32* %21
%146 = sext i32 %145 to i64
%147 = load i64, i64* %16
%148 = udiv i64 %147, 16
%149 = icmp ult i64 %146, %148
br i1 %149, label %150, label %188
150: ; preds = %144
%151 = load i64*, i64** %29
%152 = load i32, i32* %21
%153 = mul nsw i32 2, %152
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i64, i64* %151, i64 %154
%156 = load i64, i64* %155
store i64 %156, i64* %27
%157 = load i32, i32* %23
%158 = add nsw i32 %157, 1
store i32 %158, i32* %23
%159 = load i64, i64* %27
%160 = load i64*, i64** %28
%161 = load i64, i64* %160
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i64 %159, i64 %161)
%163 = load i64*, i64** %28
%164 = getelementptr inbounds i64, i64* %163, i32 1
store i64* %164, i64** %28
%165 = load i64*, i64** %28
%166 = load i64, i64* %165
%167 = icmp eq i64 %166, 0
br i1 %167, label %168, label %171
168: ; preds = %150
%169 = load i32, i32* %24
%170 = add nsw i32 %169, 1
store i32 %170, i32* %24
br label %171
171: ; preds = %168, %150
br label %172
172: ; preds = %183, %171
%173 = load i64*, i64** %28
%174 = load i64, i64* %173
%175 = icmp ne i64 %174, 0
br i1 %175, label %176, label %179
176: ; preds = %172
%177 = load i64*, i64** %28
%178 = getelementptr inbounds i64, i64* %177, i32 1
store i64* %178, i64** %28
br label %182
179: ; preds = %172
%180 = load i64*, i64** %28
%181 = getelementptr inbounds i64, i64* %180, i32 1
store i64* %181, i64** %28
br label %184
182: ; preds = %176
br label %183
183: ; preds = %182
br i1 true, label %172, label %184
184: ; preds = %183, %179
br label %185
185: ; preds = %184
%186 = load i32, i32* %21
%187 = add nsw i32 %186, 1
store i32 %187, i32* %21
br label %144
188: ; preds = %144
%189 = load i32, i32* %24
%190 = load i32, i32* %23
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32 %189, i32 %190)
store i32 1, i32* %3
br label %192
192: ; preds = %188, %137, %69, %62, %55
%193 = load i32, i32* %3
ret i32 %193
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"/tmp/%s/merge-outputs\00"
@.str.2 = [24 x i8] c"/tmp/%s/dataflow.result\00"
@.str.3 = [25 x i8] c"/tmp/%s/taint_structures\00"
@.str.4 = [5 x i8] c"%lx\0A\00"
@.str.5 = [48 x i8] c"%d out of %d are zeros, %d values, %d resolved\0A\00"
@.str.6 = [20 x i8] c"/tmp/%s/merge-addrs\00"
@.str.7 = [14 x i8] c"addr %lx %lx\0A\00"
@.str.8 = [24 x i8] c"%d out of %d are zeros\0A\00"
@str = [26 x i8] c"format: mergedump <dir #>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca [80 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%21 = bitcast i32* %6 to i8*
%22 = bitcast i32* %7 to i8*
%23 = bitcast i32* %8 to i8*
%24 = bitcast i64* %9 to i8*
%25 = bitcast i64* %10 to i8*
%26 = bitcast i64* %11 to i8*
%27 = bitcast i64* %12 to i8*
%28 = bitcast i64* %13 to i8*
%29 = bitcast i64* %14 to i8*
%30 = bitcast i8** %15 to i8*
%31 = bitcast i8** %16 to i8*
%32 = bitcast i8** %17 to i8*
%33 = icmp eq i32 %0, 2
br i1 %33, label %37, label %34
34: ; preds = %2
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%36 = tail call i32 @exit(i32 0)
unreachable
37: ; preds = %2
%38 = getelementptr inbounds i8*, i8** %1, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @sprintf(i8* %19, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %38
%42 = call i32 @sprintf(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %38
%44 = call i32 @sprintf(i8* %20, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = call i32 @map_file(i8* %18, i32* %6, i64* %9, i64* %10, i8** %15)
%46 = icmp slt i32 %45, 0
br i1 %46, label %156, label %47
47: ; preds = %37
%48 = call i32 @map_file(i8* %19, i32* %7, i64* %11, i64* %12, i8** %16)
%49 = icmp slt i32 %48, 0
br i1 %49, label %156, label %50
50: ; preds = %47
%51 = call i32 @map_file(i8* %20, i32* %8, i64* %13, i64* %14, i8** %17)
%52 = icmp slt i32 %51, 0
br i1 %52, label %156, label %53
53: ; preds = %50
%54 = bitcast i8** %16 to i64**
%55 = load i64*, i64** %54
%56 = load i64, i64* %11
%57 = icmp sgt i64 %56, 0
br i1 %57, label %58, label %103
58: ; preds = %53
%59 = bitcast i64* %55 to i8*
br label %60
60: ; preds = %58, %92
%61 = phi i64 [ %93, %92 ], [ %56, %58 ]
%62 = phi i8* [ %94, %92 ], [ %59, %58 ]
%63 = phi i64* [ %98, %92 ], [ %55, %58 ]
%64 = phi i32 [ %96, %92 ], [ 0, %58 ]
%65 = phi i32 [ %95, %92 ], [ 0, %58 ]
%66 = phi i32 [ %72, %92 ], [ 0, %58 ]
%67 = phi i32 [ %68, %92 ], [ 0, %58 ]
%68 = add nuw nsw i32 %67, 1
%69 = load i64, i64* %63
%70 = icmp eq i64 %69, 0
%71 = zext i1 %70 to i32
%72 = add nuw nsw i32 %66, %71
br i1 %70, label %92, label %73
73: ; preds = %60, %84
%74 = phi i64* [ %86, %84 ], [ %63, %60 ]
%75 = phi i32 [ %85, %84 ], [ %64, %60 ]
%76 = phi i32 [ %78, %84 ], [ %65, %60 ]
%77 = phi i64 [ %87, %84 ], [ %69, %60 ]
%78 = add nsw i32 %76, 1
%79 = icmp sgt i64 %77, 3221225472
br i1 %79, label %80, label %82
80: ; preds = %73
%81 = add nsw i32 %75, 1
br label %84
82: ; preds = %73
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %77)
br label %84
84: ; preds = %82, %80
%85 = phi i32 [ %81, %80 ], [ %75, %82 ]
%86 = getelementptr inbounds i64, i64* %74, i64 1
%87 = load i64, i64* %86
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %73
89: ; preds = %84
%90 = load i8*, i8** %16
%91 = load i64, i64* %11
br label %92
92: ; preds = %89, %60
%93 = phi i64 [ %61, %60 ], [ %91, %89 ]
%94 = phi i8* [ %62, %60 ], [ %90, %89 ]
%95 = phi i32 [ %65, %60 ], [ %78, %89 ]
%96 = phi i32 [ %64, %60 ], [ %85, %89 ]
%97 = phi i64* [ %63, %60 ], [ %86, %89 ]
%98 = getelementptr inbounds i64, i64* %97, i64 1
%99 = ptrtoint i64* %98 to i64
%100 = ptrtoint i8* %94 to i64
%101 = add nsw i64 %93, %100
%102 = icmp sgt i64 %101, %99
br i1 %102, label %60, label %103
103: ; preds = %92, %53
%104 = phi i32 [ 0, %53 ], [ %68, %92 ]
%105 = phi i32 [ 0, %53 ], [ %72, %92 ]
%106 = phi i32 [ 0, %53 ], [ %95, %92 ]
%107 = phi i32 [ 0, %53 ], [ %96, %92 ]
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %105, i32 %104, i32 %106, i32 %107)
%109 = load i8*, i8** %16
%110 = load i32, i32* %7
%111 = load i64, i64* %12
%112 = call i32 @unmap_file(i8* %109, i32 %110, i64 %111)
%113 = load i8*, i8** %38
%114 = call i32 @sprintf(i8* %19, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %113)
%115 = call i32 @map_file(i8* %19, i32* %7, i64* %11, i64* %12, i8** %16)
%116 = icmp slt i32 %115, 0
br i1 %116, label %156, label %117
117: ; preds = %103
%118 = bitcast i8** %17 to i64**
%119 = load i64*, i64** %118
%120 = load i64, i64* %13
%121 = icmp ult i64 %120, 16
br i1 %121, label %152, label %122
122: ; preds = %117
%123 = load i64*, i64** %54
br label %124
124: ; preds = %122, %144
%125 = phi i64 [ 0, %122 ], [ %131, %144 ]
%126 = phi i64* [ %123, %122 ], [ %146, %144 ]
%127 = phi i32 [ 0, %122 ], [ %138, %144 ]
%128 = shl nuw nsw i64 %125, 1
%129 = getelementptr inbounds i64, i64* %119, i64 %128
%130 = load i64, i64* %129
%131 = add nuw nsw i64 %125, 1
%132 = load i64, i64* %126
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i64 %130, i64 %132)
%134 = getelementptr inbounds i64, i64* %126, i64 1
%135 = load i64, i64* %134
%136 = icmp eq i64 %135, 0
%137 = zext i1 %136 to i32
%138 = add nuw nsw i32 %127, %137
br i1 %136, label %144, label %139
139: ; preds = %124, %139
%140 = phi i64* [ %141, %139 ], [ %134, %124 ]
%141 = getelementptr inbounds i64, i64* %140, i64 1
%142 = load i64, i64* %141
%143 = icmp eq i64 %142, 0
br i1 %143, label %144, label %139
144: ; preds = %139, %124
%145 = phi i64* [ %126, %124 ], [ %140, %139 ]
%146 = getelementptr inbounds i64, i64* %145, i64 2
%147 = load i64, i64* %13
%148 = lshr i64 %147, 4
%149 = icmp ugt i64 %148, %131
br i1 %149, label %124, label %150
150: ; preds = %144
%151 = trunc i64 %131 to i32
br label %152
152: ; preds = %150, %117
%153 = phi i32 [ 0, %117 ], [ %151, %150 ]
%154 = phi i32 [ 0, %117 ], [ %138, %150 ]
%155 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32 %154, i32 %153)
br label %156
156: ; preds = %103, %50, %47, %37, %152
%157 = phi i32 [ 1, %152 ], [ %45, %37 ], [ %48, %47 ], [ %51, %50 ], [ %115, %103 ]
ret i32 %157
}