#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*/ alloca(size_t);
int /*<<< orphan*/ crsx_setenv(char const *, char *);
char *memcpy(int /*<<< orphan*/, char const *, size_t);
int printUsage(int /*<<< orphan*/ *);
int run();
int runCompile(int, int, char **);
int runLinter(int, int, char **);
int runReport(int, int, char **);
char *strchr(char const *, char);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  crsx_setenv("execname", argv[0]);
  if (argc <= 1)
    return printUsage(NULL);
  char *command = argv[1];
  if (strcmp(command, "compile") == 0)
    return runCompile(2, argc, argv);
  if (strcmp(command, "lint") == 0)
    return runLinter(2, argc, argv);
  if (strcmp(command, "report") == 0)
    return runReport(2, argc, argv);
  int i;
  for (i = 0; i < argc; ++i) {
    const char *arg = argv[i];
    char *eq = strchr(arg, '=');
    if (eq) {
      size_t keyz = eq - arg;
      char *key = memcpy(alloca(keyz + 1), arg, keyz);
      key[keyz] = '\0';
      crsx_setenv(key, eq + 1);
    } else {
      crsx_setenv(arg, "");
    }
  }
  return run();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe3c(%rip),%rdi
call   1040 <crsx_setenv@plt>
cmpl   $0x1,-0x8(%rbp)
jg     11e4 <main+0x44>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <printUsage@plt>
mov    %eax,-0x4(%rbp)
jmp    1347 <main+0x1a7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1223 <main+0x83>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
call   1070 <runCompile@plt>
mov    %eax,-0x4(%rbp)
jmp    1347 <main+0x1a7>
mov    -0x18(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1256 <main+0xb6>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
call   10b0 <runLinter@plt>
mov    %eax,-0x4(%rbp)
jmp    1347 <main+0x1a7>
mov    -0x18(%rbp),%rdi
lea    0xdb5(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1289 <main+0xe9>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
call   1030 <runReport@plt>
mov    %eax,-0x4(%rbp)
jmp    1347 <main+0x1a7>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    133d <main+0x19d>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     131a <main+0x17a>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
add    $0x1,%rdi
call   1090 <alloca@plt>
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   10a0 <memcpy@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
add    $0x1,%rsi
call   1040 <crsx_setenv@plt>
jmp    132a <main+0x18a>
mov    -0x28(%rbp),%rdi
lea    0xceb(%rip),%rsi
call   1040 <crsx_setenv@plt>
jmp    132f <main+0x18f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1290 <main+0xf0>
mov    $0x0,%al
call   1050 <run@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
mov    (%rsi),%rsi
lea    0xe46(%rip),%rdi
call   1040 <crsx_setenv@plt>
cmp    $0x1,%ebp
jg     11d9 <main+0x39>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <printUsage@plt>
mov    0x8(%r15),%r14
lea    0xe25(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     128d <main+0xed>
lea    0xe15(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12bf <main+0x11f>
lea    0xe02(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x13c>
mov    %ebp,%r13d
xor    %r14d,%r14d
jmp    1248 <main+0xa8>
nopl   (%rax)
mov    %r12,%rdi
lea    0xdd6(%rip),%rsi
call   1040 <crsx_setenv@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     12aa <main+0x10a>
mov    (%r15,%r14,8),%r12
mov    %r12,%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1230 <main+0x90>
mov    %rax,%rbx
mov    %rax,%rbp
sub    %r12,%rbp
lea    0x1(%rbp),%rdi
call   1090 <alloca@plt>
mov    %eax,%edi
mov    %r12,%rsi
mov    %rbp,%rdx
call   10a0 <memcpy@plt>
movb   $0x0,(%rax,%rbp,1)
add    $0x1,%rbx
mov    %rax,%rdi
mov    %rbx,%rsi
jmp    123a <main+0x9a>
mov    $0x2,%edi
mov    %ebp,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <runCompile@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <run@plt>
mov    $0x2,%edi
mov    %ebp,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <runLinter@plt>
mov    $0x2,%edi
mov    %ebp,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <runReport@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"execname\00"
@.str.1 = [8 x i8] c"compile\00"
@.str.2 = [5 x i8] c"lint\00"
@.str.3 = [7 x i8] c"report\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @crsx_setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %4
%17 = icmp sle i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @printUsage(i32* null)
store i32 %19, i32* %3
br label %90
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %20
%28 = load i32, i32* %4
%29 = load i8**, i8*** %5
%30 = call i32 @runCompile(i32 2, i32 %28, i8** %29)
store i32 %30, i32* %3
br label %90
31: ; preds = %20
%32 = load i8*, i8** %6
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i32, i32* %4
%37 = load i8**, i8*** %5
%38 = call i32 @runLinter(i32 2, i32 %36, i8** %37)
store i32 %38, i32* %3
br label %90
39: ; preds = %31
%40 = load i8*, i8** %6
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i32, i32* %4
%45 = load i8**, i8*** %5
%46 = call i32 @runReport(i32 2, i32 %44, i8** %45)
store i32 %46, i32* %3
br label %90
47: ; preds = %39
store i32 0, i32* %7
br label %48
48: ; preds = %85, %47
%49 = load i32, i32* %7
%50 = load i32, i32* %4
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %88
52: ; preds = %48
%53 = load i8**, i8*** %5
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
store i8* %57, i8** %8
%58 = load i8*, i8** %8
%59 = call i8* @strchr(i8* %58, i8 signext 61)
store i8* %59, i8** %9
%60 = load i8*, i8** %9
%61 = icmp ne i8* %60, null
br i1 %61, label %62, label %81
62: ; preds = %52
%63 = load i8*, i8** %9
%64 = load i8*, i8** %8
%65 = ptrtoint i8* %63 to i64
%66 = ptrtoint i8* %64 to i64
%67 = sub i64 %65, %66
store i64 %67, i64* %10
%68 = load i64, i64* %10
%69 = add i64 %68, 1
%70 = call i32 @alloca(i64 %69)
%71 = load i8*, i8** %8
%72 = load i64, i64* %10
%73 = call i8* @memcpy(i32 %70, i8* %71, i64 %72)
store i8* %73, i8** %11
%74 = load i8*, i8** %11
%75 = load i64, i64* %10
%76 = getelementptr inbounds i8, i8* %74, i64 %75
store i8 0, i8* %76
%77 = load i8*, i8** %11
%78 = load i8*, i8** %9
%79 = getelementptr inbounds i8, i8* %78, i64 1
%80 = call i32 @crsx_setenv(i8* %77, i8* %79)
br label %84
81: ; preds = %52
%82 = load i8*, i8** %8
%83 = call i32 @crsx_setenv(i8* %82, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %84
84: ; preds = %81, %62
br label %85
85: ; preds = %84
%86 = load i32, i32* %7
%87 = add nsw i32 %86, 1
store i32 %87, i32* %7
br label %48
88: ; preds = %48
%89 = call i32 (...) @run()
store i32 %89, i32* %3
br label %90
90: ; preds = %88, %43, %35, %27, %18
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
@.str = [9 x i8] c"execname\00"
@.str.1 = [8 x i8] c"compile\00"
@.str.2 = [5 x i8] c"lint\00"
@.str.3 = [7 x i8] c"report\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @crsx_setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @printUsage(i32* null)
br label %50
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @runCompile(i32 2, i32 %0, i8** %1)
br label %50
15: ; preds = %8
%16 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @runLinter(i32 2, i32 %0, i8** %1)
br label %50
20: ; preds = %15
%21 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = zext i32 %0 to i64
br label %27
25: ; preds = %20
%26 = tail call i32 @runReport(i32 2, i32 %0, i8** %1)
br label %50
27: ; preds = %23, %45
%28 = phi i64 [ 0, %23 ], [ %46, %45 ]
%29 = getelementptr inbounds i8*, i8** %1, i64 %28
%30 = load i8*, i8** %29
%31 = tail call i8* @strchr(i8* dereferenceable(1) %30, i8 signext 61)
%32 = icmp eq i8* %31, null
br i1 %32, label %43, label %33
33: ; preds = %27
%34 = ptrtoint i8* %31 to i64
%35 = ptrtoint i8* %30 to i64
%36 = sub i64 %34, %35
%37 = add i64 %36, 1
%38 = tail call i32 @alloca(i64 %37)
%39 = tail call i8* @memcpy(i32 %38, i8* %30, i64 %36)
%40 = getelementptr inbounds i8, i8* %39, i64 %36
store i8 0, i8* %40
%41 = getelementptr inbounds i8, i8* %31, i64 1
%42 = tail call i32 @crsx_setenv(i8* %39, i8* %41)
br label %45
43: ; preds = %27
%44 = tail call i32 @crsx_setenv(i8* %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %43, %33
%46 = add nuw nsw i64 %28, 1
%47 = icmp eq i64 %46, %24
br i1 %47, label %48, label %27
48: ; preds = %45
%49 = tail call i32 (...) @run()
br label %50
50: ; preds = %13, %18, %25, %48, %6
%51 = phi i32 [ %7, %6 ], [ %14, %13 ], [ %19, %18 ], [ %26, %25 ], [ %49, %48 ]
ret i32 %51
}