#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ parseFail();
int parseFile(int /*<<< orphan*/ *);
int /*<<< orphan*/ pauseProgram();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run();
int main(int argc, char *argv[]) {
  printf("\033[1m\033[35m"
         " ___                       _ _\n");
  printf("|_ _|_ __  ___  __ _ _ __ (_) |_ _   _\n");
  printf(" | || '_ \\/ __|/ _` | '_ \\| | __| | | |\n");
  printf(" | || | | \\__ \\ (_| | | | | | |_| |_| |\n");
  printf("|___|_| |_|___/\\__,_|_| |_|_|\\__|\\__, |\n");
  printf("       Programming Language      |___/\n"
         "\033[0m");
  printf("\033[33m"
         "\n     Created by Bryan McClain\n");
  printf("\033[32m"
         "       (C) Comprosoft 2017\n\n");
  for (int i = 1; i < argc; i++) {
    if (access(argv[i], F_OK) != -1) {
      printf("\033[37m"
             "\nProgram: %s\n\n",
             argv[i]);
      FILE *fp = fopen(argv[i], "rb");
      if (parseFile(fp) == 1) {
        pauseProgram();
        run();
      } else {
        parseFail();
      }
      fclose(fp);
    } else {
      printf("\033[1m\033[36m"
             "Error!"
             "\033[0m"
             " Invalid file %s\n\n",
             argv[i]);
    }
  }
  printf("\033[0m");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xf1e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12d9 <main+0x159>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2dac(%rip),%rax
mov    (%rax),%esi
call   1080 <access@plt>
cmp    $0xffffffff,%eax
je     12ac <main+0x12c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeea(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   10a0 <parseFile@plt>
cmp    $0x1,%eax
jne    1297 <main+0x117>
mov    $0x0,%al
call   1040 <pauseProgram@plt>
mov    $0x0,%al
call   1060 <run@plt>
jmp    129e <main+0x11e>
mov    $0x0,%al
call   1030 <parseFail@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    12c6 <main+0x146>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12cb <main+0x14b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120d <main+0x8d>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x20,%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,%rbx
mov    %edi,%ebp
lea    0xec2(%rip),%rdi
call   1050 <puts@plt>
lea    0xede(%rip),%rdi
call   1050 <puts@plt>
lea    0xef9(%rip),%rdi
call   1050 <puts@plt>
lea    0xf15(%rip),%rdi
call   1050 <puts@plt>
lea    0xf31(%rip),%rdi
call   1050 <puts@plt>
lea    0xe1d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xf3f(%rip),%rdi
call   1050 <puts@plt>
lea    0xf57(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x2,%ebp
jl     12b1 <main+0x121>
mov    %ebp,%r13d
mov    $0x1,%r14d
mov    0x2dbd(%rip),%r15
lea    0xe1e(%rip),%r12
jmp    1247 <main+0xb7>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     12b1 <main+0x121>
mov    (%rbx,%r14,8),%rdi
mov    (%r15),%esi
call   1090 <access@plt>
mov    (%rbx,%r14,8),%rsi
cmp    $0xffffffff,%eax
je     1230 <main+0xa0>
lea    0xdc9(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   10b0 <parseFile@plt>
cmp    $0x1,%eax
jne    12a0 <main+0x110>
xor    %eax,%eax
call   1040 <pauseProgram@plt>
xor    %eax,%eax
call   1070 <run@plt>
jmp    12a7 <main+0x117>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <parseFail@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
jmp    123e <main+0xae>
lea    0xd6f(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\1B[1m\1B[35m ___ _ _\0A\00"
@.str.1 = [40 x i8] c"|_ _|_ __ ___ __ _ _ __ (_) |_ _ _\0A\00"
@.str.2 = [41 x i8] c" | || '_ \\/ __|/ _` | '_ \\| | __| | | |\0A\00"
@.str.3 = [41 x i8] c" | || | | \\__ \\ (_| | | | | | |_| |_| |\0A\00"
@.str.4 = [41 x i8] c"|___|_| |_|___/\\__,_|_| |_|_|\\__|\\__, |\0A\00"
@.str.5 = [44 x i8] c" Programming Language |___/\0A\1B[0m\00"
@.str.6 = [37 x i8] c"\1B[33m\0A Created by Bryan McClain\0A\00"
@.str.7 = [34 x i8] c"\1B[32m (C) Comprosoft 2017\0A\0A\00"
@F_OK = global i32 0
@.str.8 = [20 x i8] c"\1B[37m\0AProgram: %s\0A\0A\00"
@.str.9 = [3 x i8] c"rb\00"
@.str.10 = [38 x i8] c"\1B[1m\1B[36mError!\1B[0m Invalid file %s\0A\0A\00"
@.str.11 = [5 x i8] c"\1B[0m\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %6
br label %16
16: ; preds = %61, %2
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %64
20: ; preds = %16
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = load i32, i32* @F_OK
%27 = call i32 @access(i8* %25, i32 %26)
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %53
29: ; preds = %20
%30 = load i8**, i8*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %34)
%36 = load i8**, i8*** %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
store i32* %41, i32** %7
%42 = load i32*, i32** %7
%43 = call i32 @parseFile(i32* %42)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %48
45: ; preds = %29
%46 = call i32 (...) @pauseProgram()
%47 = call i32 (...) @run()
br label %50
48: ; preds = %29
%49 = call i32 (...) @parseFail()
br label %50
50: ; preds = %48, %45
%51 = load i32*, i32** %7
%52 = call i32 @fclose(i32* %51)
br label %60
53: ; preds = %20
%54 = load i8**, i8*** %5
%55 = load i32, i32* %6
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %53, %50
br label %61
61: ; preds = %60
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %16
64: ; preds = %16
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [44 x i8] c" Programming Language |___/\0A\1B[0m\00"
@F_OK = global i32 0
@.str.8 = [20 x i8] c"\1B[37m\0AProgram: %s\0A\0A\00"
@.str.9 = [3 x i8] c"rb\00"
@.str.10 = [38 x i8] c"\1B[1m\1B[36mError!\1B[0m Invalid file %s\0A\0A\00"
@.str.11 = [5 x i8] c"\1B[0m\00"
@str = [40 x i8] c"\1B[1m\1B[35m ___ _ _\00"
@str.12 = [39 x i8] c"|_ _|_ __ ___ __ _ _ __ (_) |_ _ _\00"
@str.13 = [40 x i8] c" | || '_ \\/ __|/ _` | '_ \\| | __| | | |\00"
@str.14 = [40 x i8] c" | || | | \\__ \\ (_| | | | | | |_| |_| |\00"
@str.15 = [40 x i8] c"|___|_| |_|___/\\__,_|_| |_|_|\\__|\\__, |\00"
@str.16 = [36 x i8] c"\1B[33m\0A Created by Bryan McClain\00"
@str.17 = [33 x i8] c"\1B[32m (C) Comprosoft 2017\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.14, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.17, i64 0, i64 0))
%11 = icmp sgt i32 %0, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = zext i32 %0 to i64
br label %16
14: ; preds = %39, %2
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
16: ; preds = %12, %39
%17 = phi i64 [ 1, %12 ], [ %40, %39 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = load i32, i32* @F_OK
%21 = tail call i32 @access(i8* %19, i32 %20)
%22 = icmp eq i32 %21, -1
%23 = load i8*, i8** %18
br i1 %22, label %37, label %24
24: ; preds = %16
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %23)
%26 = load i8*, i8** %18
%27 = tail call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%28 = tail call i32 @parseFile(i32* %27)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = tail call i32 (...) @pauseProgram()
%32 = tail call i32 (...) @run()
br label %35
33: ; preds = %24
%34 = tail call i32 (...) @parseFail()
br label %35
35: ; preds = %33, %30
%36 = tail call i32 @fclose(i32* %27)
br label %39
37: ; preds = %16
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i8* %23)
br label %39
39: ; preds = %35, %37
%40 = add nuw nsw i64 %17, 1
%41 = icmp eq i64 %40, %13
br i1 %41, label %14, label %16
}