#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*/ fopen(char *, char *);
int /*<<< orphan*/ parse(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Usage: %s <file.bf> [output]\n", argv[0]);
  }
  if (argc >= 3) {
    parse(fopen(argv[1], "r"), argv[2]);
  } else {
    parse(fopen(argv[1], "r"), "a.out");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1163 <main+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jl     1195 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea2(%rip),%rsi
call   1040 <fopen@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1050 <parse@plt>
jmp    11b7 <main+0x87>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <fopen@plt>
mov    %eax,%edi
lea    0xe6e(%rip),%rsi
call   1050 <parse@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     114a <main+0x1a>
mov    (%rbx),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0x1f>
cmp    $0x2,%edi
jne    1168 <main+0x38>
mov    0x8(%rbx),%rdi
lea    0xec4(%rip),%rsi
call   1040 <fopen@plt>
lea    0xeba(%rip),%rsi
jmp    117c <main+0x4c>
mov    0x8(%rbx),%rdi
lea    0xeab(%rip),%rsi
call   1040 <fopen@plt>
mov    0x10(%rbx),%rsi
mov    %eax,%edi
call   1050 <parse@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Usage: %s <file.bf> [output]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"a.out\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %8, %2
%14 = load i32, i32* %4
%15 = icmp sge i32 %14, 3
br i1 %15, label %16, label %25
16: ; preds = %13
%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 ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @parse(i32 %20, i8* %23)
br label %31
25: ; preds = %13
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @parse(i32 %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %25, %16
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [30 x i8] c"Usage: %s <file.bf> [output]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"a.out\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %16
7: ; preds = %2
%8 = icmp eq i32 %0, 2
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @parse(i32 %12, i8* %14)
br label %21
16: ; preds = %4, %7
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @parse(i32 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %16, %9
ret i32 0
}