#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ init();
int /*<<< orphan*/ load_file_scm(char *);
int /*<<< orphan*/ open_file(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int yyparse();
int main(int argc, char **argv) {
  init();
  if (strcmp(argv[1], "-repl") == 0) {
    load_file_scm(argv[2]);
    return 0;
  }
  if (argc > 1) {
    open_file(argv[1]);
  } else {
    fprintf(stderr, "Please provide file to run\n");
  }
  return yyparse();
}


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)
mov    $0x0,%al
call   1080 <init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11b4 <main+0x54>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <load_file_scm@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ef <main+0x8f>
cmpl   $0x1,-0x8(%rbp)
jle    11d0 <main+0x70>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <open_file@plt>
jmp    11e5 <main+0x85>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe26(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1030 <yyparse@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <init@plt>
mov    0x8(%rbx),%rdi
lea    0xe86(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1194 <main+0x34>
cmp    $0x2,%ebp
jl     11a6 <main+0x46>
mov    0x8(%rbx),%rdi
call   1040 <open_file@plt>
jmp    11bb <main+0x5b>
mov    0x10(%rbx),%rdi
call   1050 <load_file_scm@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <yyparse@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"-repl\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"Please provide file to run\0A\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 = call i32 (...) @init()
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @load_file_scm(i8* %15)
store i32 0, i32* %3
br label %30
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @open_file(i8* %23)
br label %28
25: ; preds = %17
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %25, %20
%29 = call i32 (...) @yyparse()
store i32 %29, i32* %3
br label %30
30: ; preds = %28, %12
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [6 x i8] c"-repl\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"Please provide file to run\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @init()
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @load_file_scm(i8* %10)
br label %22
12: ; preds = %2
%13 = icmp sgt i32 %0, 1
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = load i8*, i8** %4
%16 = tail call i32 @open_file(i8* %15)
br label %20
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %14
%21 = tail call i32 (...) @yyparse()
br label %22
22: ; preds = %20, %8
%23 = phi i32 [ 0, %8 ], [ %21, %20 ]
ret i32 %23
}