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

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int readInput(char *);
int /*<<< orphan*/ walk();
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("USAGE: ./a.out <INPUT.txt>\n");
    return 0;
  }
  int eCheck = readInput(argv[1]);
  if (eCheck == 1)
    return 1;
  else if (eCheck == 2) {
    printf("NO");
    return 1;
  } else {
    walk();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c3 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <readInput@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    118e <main+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <main+0x93>
cmpl   $0x2,-0x14(%rbp)
jne    11b0 <main+0x80>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <main+0x93>
mov    $0x0,%al
call   1050 <walk@plt>
jmp    11bc <main+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    116e <main+0x2e>
mov    0x8(%rsi),%rdi
call   1050 <readInput@plt>
mov    %eax,%ebx
cmp    $0x1,%eax
je     1187 <main+0x47>
cmp    $0x2,%ebx
jne    117e <main+0x3e>
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    1187 <main+0x47>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    1187 <main+0x47>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <walk@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"USAGE: ./a.out <INPUT.txt>\0A\00"
@.str.1 = [3 x i8] c"NO\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %28
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @readInput(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 1, i32* %3
br label %28
19: ; preds = %11
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %28
24: ; preds = %19
%25 = call i32 (...) @walk()
br label %26
26: ; preds = %24
br label %27
27: ; preds = %26
store i32 0, i32* %3
br label %28
28: ; preds = %27, %22, %18, %9
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"NO\00"
@str = [27 x i8] c"USAGE: ./a.out <INPUT.txt>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %14
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @readInput(i8* %8)
switch i32 %9, label %12 [
i32 1, label %14
i32 2, label %10
]
10: ; preds = %6
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %6
%13 = tail call i32 (...) @walk()
br label %14
14: ; preds = %10, %12, %6, %4
%15 = phi i32 [ 0, %4 ], [ 1, %10 ], [ 0, %12 ], [ %9, %6 ]
ret i32 %15
}