#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*/ runFile(int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ runRepl();
int /*<<< orphan*/ stderr;
int main(int argc, const char *argv[]) {
  if (argc < 1 || argc > 2) {
    fprintf(stderr, "Usage: wren [file]\n");
    return 64;
  }
  if (argc == 1) {
    runRepl();
  } else if (argc == 2) {
    runFile(NULL, argv[1]);
  }
  return 0;
}


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   $0x1,-0x8(%rbp)
jl     115a <main+0x2a>
cmpl   $0x2,-0x8(%rbp)
jle    117b <main+0x4b>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x40,-0x4(%rbp)
jmp    11b8 <main+0x88>
cmpl   $0x1,-0x8(%rbp)
jne    1191 <main+0x61>
mov    $0x0,%al
call   1040 <runRepl@plt>
jmp    11b1 <main+0x81>
cmpl   $0x2,-0x8(%rbp)
jne    11ac <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1050 <runFile@plt>
jmp    11b1 <main+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    -0x3(%rdi),%eax
cmp    $0xfffffffd,%eax
ja     1155 <main+0x25>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x40,%ebx
jmp    1172 <main+0x42>
cmp    $0x1,%edi
jne    1165 <main+0x35>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <runRepl@plt>
jmp    1172 <main+0x42>
mov    0x8(%rsi),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <runFile@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: wren [file]\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 = load i32, i32* %4
%7 = icmp slt i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %8, %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 64, i32* %3
br label %29
14: ; preds = %8
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (...) @runRepl()
br label %28
19: ; preds = %14
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @runFile(i32* null, i8* %25)
br label %27
27: ; preds = %22, %19
br label %28
28: ; preds = %27, %17
store i32 0, i32* %3
br label %29
29: ; preds = %28, %11
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: wren [file]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -3
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %16
8: ; preds = %2
%9 = icmp eq i32 %0, 1
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 (...) @runRepl()
br label %16
12: ; preds = %8
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @runFile(i32* null, i8* %14)
br label %16
16: ; preds = %10, %12, %5
%17 = phi i32 [ 64, %5 ], [ 0, %12 ], [ 0, %10 ]
ret i32 %17
}