#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ memcmp(char *, char *, int);
int read32(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ traverse(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *,
                            int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  FILE *inbst = NULL, *inbstn = NULL;
  char buf[4];
  int bstoff, bstnoff;
  if (argc != 3) {
    fprintf(stderr, "arg!\n");
    return 1;
  }
  inbst = fopen(argv[1], "rb");
  if (!inbst) {
    fprintf(stderr, "failed open %s\n", argv[1]);
    return 1;
  }
  inbstn = fopen(argv[2], "rb");
  if (!inbstn) {
    fprintf(stderr, "failed open %s\n", argv[2]);
    return 1;
  }
  fread(buf, 1, 4, inbst);
  if (memcmp(buf, "BST ", 4)) {
    fprintf(stderr, "%s not recognized as BST\n", argv[1]);
    return 1;
  }
  fread(buf, 1, 4, inbstn);
  if (memcmp(buf, "BSTN", 4)) {
    fprintf(stderr, "%s not recognized as BSTN\n", argv[2]);
    return 1;
  }
  fread(buf, 1, 4, inbst);
  if (read32(buf)) {
    fprintf(stderr, "%s not recognized as BST\n", argv[1]);
    return 1;
  }
  fread(buf, 1, 4, inbstn);
  if (read32(buf)) {
    fprintf(stderr, "%s not recognized as BSTN\n", argv[1]);
    return 1;
  }
  fread(buf, 1, 4, inbst);
  if (read32(buf) != 0x01000000) {
    fprintf(stderr, "%s not recognized as BST\n", argv[1]);
    return 1;
  }
  fread(buf, 1, 4, inbstn);
  if (read32(buf) != 0x01000000) {
    fprintf(stderr, "%s not recognized as BSTN\n", argv[1]);
    return 1;
  }
  fread(buf, 1, 4, inbst);
  bstoff = read32(buf);
  fread(buf, 1, 4, inbstn);
  bstnoff = read32(buf);
  traverse(inbst, bstoff, inbstn, bstnoff, NULL, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11b3 <main+0x53>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe44(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1201 <main+0xa1>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe1b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdf6(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    124f <main+0xef>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
lea    0xda8(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     12b0 <main+0x150>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
lea    0xd66(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1311 <main+0x1b1>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
call   1080 <read32@plt>
cmp    $0x0,%eax
je     1365 <main+0x205>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xccc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
call   1080 <read32@plt>
cmp    $0x0,%eax
je     13b9 <main+0x259>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
call   1080 <read32@plt>
cmp    $0x1000000,%eax
je     140f <main+0x2af>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc22(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
call   1080 <read32@plt>
cmp    $0x1000000,%eax
je     1465 <main+0x305>
mov    0x2b9f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xbeb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x366>
lea    -0x24(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
call   1080 <read32@plt>
mov    %eax,-0x28(%rbp)
lea    -0x24(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
call   1080 <read32@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
call   1040 <traverse@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1201 <main+0xa1>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe84(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1223 <main+0xc3>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
lea    0xe68(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1232 <main+0xd2>
mov    %rax,%r12
lea    0x4(%rsp),%r13
mov    $0x1,%r14d
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
lea    0xe43(%rip),%rsi
mov    %r13,%rdi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     1255 <main+0xf5>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe22(%rip),%rsi
jmp    12a2 <main+0x142>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
lea    0xdef(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%r14d
jmp    12a9 <main+0x149>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
jmp    123f <main+0xdf>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xdc3(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%r14d
jmp    12a9 <main+0x149>
lea    0x4(%rsp),%r13
mov    $0x1,%r14d
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
lea    0xdbc(%rip),%rsi
mov    %r13,%rdi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     12bb <main+0x15b>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xd9b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x4(%rsp),%r13
mov    $0x1,%r14d
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
mov    %r13,%rdi
call   1080 <read32@plt>
test   %eax,%eax
jne    11e8 <main+0x88>
lea    0x4(%rsp),%r13
mov    $0x1,%r14d
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    %r13,%rdi
call   1080 <read32@plt>
test   %eax,%eax
je     1329 <main+0x1c9>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
jmp    129b <main+0x13b>
lea    0x4(%rsp),%r13
mov    $0x1,%r14d
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
mov    %r13,%rdi
call   1080 <read32@plt>
cmp    $0x1000000,%eax
jne    11e8 <main+0x88>
lea    0x4(%rsp),%r13
mov    $0x1,%r14d
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    %r13,%rdi
call   1080 <read32@plt>
cmp    $0x1000000,%eax
jne    1317 <main+0x1b7>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1080 <read32@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1080 <read32@plt>
xor    %r14d,%r14d
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r12,%rdx
mov    %eax,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <traverse@plt>
jmp    12a9 <main+0x149>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"arg!\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [16 x i8] c"failed open %s\0A\00"
@.str.3 = [5 x i8] c"BST \00"
@.str.4 = [26 x i8] c"%s not recognized as BST\0A\00"
@.str.5 = [5 x i8] c"BSTN\00"
@.str.6 = [27 x i8] c"%s not recognized as BSTN\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [4 x i8]
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32* null, i32** %7
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %136
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = load i32*, i32** %6
%22 = icmp ne i32* %21, null
br i1 %22, label %29, label %23
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %27)
store i32 1, i32* %3
br label %136
29: ; preds = %16
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %33, i32** %7
%34 = load i32*, i32** %7
%35 = icmp ne i32* %34, null
br i1 %35, label %42, label %36
36: ; preds = %29
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %40)
store i32 1, i32* %3
br label %136
42: ; preds = %29
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%44 = load i32*, i32** %6
%45 = call i32 @fread(i8* %43, i32 1, i32 4, i32* %44)
%46 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%47 = call i64 @memcmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %42
%50 = load i32, i32* @stderr
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %53)
store i32 1, i32* %3
br label %136
55: ; preds = %42
%56 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%57 = load i32*, i32** %7
%58 = call i32 @fread(i8* %56, i32 1, i32 4, i32* %57)
%59 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%60 = call i64 @memcmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %68
62: ; preds = %55
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 2
%66 = load i8*, i8** %65
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %66)
store i32 1, i32* %3
br label %136
68: ; preds = %55
%69 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%70 = load i32*, i32** %6
%71 = call i32 @fread(i8* %69, i32 1, i32 4, i32* %70)
%72 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%73 = call i32 @read32(i8* %72)
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %81
75: ; preds = %68
%76 = load i32, i32* @stderr
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 1
%79 = load i8*, i8** %78
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %79)
store i32 1, i32* %3
br label %136
81: ; preds = %68
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%83 = load i32*, i32** %7
%84 = call i32 @fread(i8* %82, i32 1, i32 4, i32* %83)
%85 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%86 = call i32 @read32(i8* %85)
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %94
88: ; preds = %81
%89 = load i32, i32* @stderr
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 1
%92 = load i8*, i8** %91
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %92)
store i32 1, i32* %3
br label %136
94: ; preds = %81
%95 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%96 = load i32*, i32** %6
%97 = call i32 @fread(i8* %95, i32 1, i32 4, i32* %96)
%98 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%99 = call i32 @read32(i8* %98)
%100 = icmp ne i32 %99, 16777216
br i1 %100, label %101, label %107
101: ; preds = %94
%102 = load i32, i32* @stderr
%103 = load i8**, i8*** %5
%104 = getelementptr inbounds i8*, i8** %103, i64 1
%105 = load i8*, i8** %104
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %105)
store i32 1, i32* %3
br label %136
107: ; preds = %94
%108 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%109 = load i32*, i32** %7
%110 = call i32 @fread(i8* %108, i32 1, i32 4, i32* %109)
%111 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%112 = call i32 @read32(i8* %111)
%113 = icmp ne i32 %112, 16777216
br i1 %113, label %114, label %120
114: ; preds = %107
%115 = load i32, i32* @stderr
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 1
%118 = load i8*, i8** %117
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %118)
store i32 1, i32* %3
br label %136
120: ; preds = %107
%121 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%122 = load i32*, i32** %6
%123 = call i32 @fread(i8* %121, i32 1, i32 4, i32* %122)
%124 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%125 = call i32 @read32(i8* %124)
store i32 %125, i32* %9
%126 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%127 = load i32*, i32** %7
%128 = call i32 @fread(i8* %126, i32 1, i32 4, i32* %127)
%129 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%130 = call i32 @read32(i8* %129)
store i32 %130, i32* %10
%131 = load i32*, i32** %6
%132 = load i32, i32* %9
%133 = load i32*, i32** %7
%134 = load i32, i32* %10
%135 = call i32 @traverse(i32* %131, i32 %132, i32* %133, i32 %134, i32* null, i32 0)
br label %136
136: ; preds = %120, %114, %101, %88, %75, %62, %49, %36, %23, %13
%137 = load i32, i32* %3
ret i32 %137
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"arg!\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [16 x i8] c"failed open %s\0A\00"
@.str.3 = [5 x i8] c"BST \00"
@.str.4 = [26 x i8] c"%s not recognized as BST\0A\00"
@.str.5 = [5 x i8] c"BSTN\00"
@.str.6 = [27 x i8] c"%s not recognized as BSTN\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %81
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %10
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %81
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %19
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %81
27: ; preds = %18
%28 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %12)
%29 = call i64 @memcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%30 = icmp eq i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %10
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %33)
br label %81
35: ; preds = %27
%36 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %21)
%37 = call i64 @memcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%38 = icmp eq i64 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %19
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %41)
br label %81
43: ; preds = %35
%44 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %12)
%45 = call i32 @read32(i8* %4)
%46 = icmp eq i32 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %10
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %49)
br label %81
51: ; preds = %43
%52 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %21)
%53 = call i32 @read32(i8* %4)
%54 = icmp eq i32 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %10
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %57)
br label %81
59: ; preds = %51
%60 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %12)
%61 = call i32 @read32(i8* %4)
%62 = icmp eq i32 %61, 16777216
br i1 %62, label %67, label %63
63: ; preds = %59
%64 = load i32, i32* @stderr
%65 = load i8*, i8** %10
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %65)
br label %81
67: ; preds = %59
%68 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %21)
%69 = call i32 @read32(i8* %4)
%70 = icmp eq i32 %69, 16777216
br i1 %70, label %75, label %71
71: ; preds = %67
%72 = load i32, i32* @stderr
%73 = load i8*, i8** %10
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %73)
br label %81
75: ; preds = %67
%76 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %12)
%77 = call i32 @read32(i8* %4)
%78 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %21)
%79 = call i32 @read32(i8* %4)
%80 = call i32 @traverse(i32* %12, i32 %77, i32* %21, i32 %79, i32* null, i32 0)
br label %81
81: ; preds = %75, %71, %63, %55, %47, %39, %31, %23, %14, %6
%82 = phi i32 [ 1, %6 ], [ 1, %31 ], [ 1, %39 ], [ 1, %47 ], [ 1, %55 ], [ 1, %63 ], [ 1, %71 ], [ 0, %75 ], [ 1, %23 ], [ 1, %14 ]
ret i32 %82
}