#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*/ print_help();
int /*<<< orphan*/ print_version();
int run_file(char *);
int run_repl();
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc >= 2 &&
      (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)) {
    print_help();
    return 0;
  }
  if (argc >= 2 &&
      (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-v") == 0)) {
    print_version();
    return 0;
  }
  if (argc >= 2) {
    return run_file(argv[1]);
  } else {
    return run_repl();
  }
}


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)
jl     11bf <main+0x6f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ac <main+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11bf <main+0x6f>
mov    $0x0,%al
call   1070 <print_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1241 <main+0xf1>
cmpl   $0x2,-0x8(%rbp)
jl     1218 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1205 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1218 <main+0xc8>
mov    $0x0,%al
call   1040 <print_version@plt>
movl   $0x0,-0x4(%rbp)
jmp    1241 <main+0xf1>
cmpl   $0x2,-0x8(%rbp)
jl     1237 <main+0xe7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <run_file@plt>
mov    %eax,-0x4(%rbp)
jmp    1241 <main+0xf1>
mov    $0x0,%al
call   1060 <run_repl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     11b7 <main+0x67>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11bf <main+0x6f>
mov    0x8(%rbx),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11bf <main+0x6f>
mov    0x8(%rbx),%rdi
lea    0xe7c(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c8 <main+0x78>
mov    0x8(%rbx),%rdi
lea    0xe71(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c8 <main+0x78>
mov    0x8(%rbx),%rdi
pop    %rbx
jmp    1030 <run_file@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <run_repl@plt>
xor    %eax,%eax
call   1070 <print_help@plt>
jmp    11cf <main+0x7f>
xor    %eax,%eax
call   1040 <print_version@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [10 x i8] c"--version\00"
@.str.3 = [3 x i8] c"-v\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 sge i32 %6, 2
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14, %8
%21 = call i32 (...) @print_help()
store i32 0, i32* %3
br label %49
22: ; preds = %14, %2
%23 = load i32, i32* %4
%24 = icmp sge i32 %23, 2
br i1 %24, label %25, label %39
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %31, %25
%38 = call i32 (...) @print_version()
store i32 0, i32* %3
br label %49
39: ; preds = %31, %22
%40 = load i32, i32* %4
%41 = icmp sge i32 %40, 2
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @run_file(i8* %45)
store i32 %46, i32* %3
br label %49
47: ; preds = %39
%48 = call i32 (...) @run_repl()
store i32 %48, i32* %3
br label %49
49: ; preds = %47, %42, %37, %20
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [10 x i8] c"--version\00"
@.str.3 = [3 x i8] c"-v\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9, %4
%14 = tail call i32 (...) @print_help()
br label %30
15: ; preds = %9
%16 = load i8*, i8** %5
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8*, i8** %5
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19, %15
%24 = tail call i32 (...) @print_version()
br label %30
25: ; preds = %19
%26 = load i8*, i8** %5
%27 = tail call i32 @run_file(i8* %26)
br label %30
28: ; preds = %2
%29 = tail call i32 (...) @run_repl()
br label %30
30: ; preds = %28, %25, %23, %13
%31 = phi i32 [ 0, %13 ], [ 0, %23 ], [ %27, %25 ], [ %29, %28 ]
ret i32 %31
}