#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("\n");
  printf(" ___                       _ _\n");
  printf("|_ _|_ __  ___  __ _ _ __ (_) |_ _   _\n");
  printf(" | || '_ \\/ __|/ _` | '_ \\| | __| | | |\n");
  printf(" | || | | \\__ \\ (_| | | | | | |_| |_| |\n");
  printf("|___|_| |_|___/\\__,_|_| |_|_|\\__|\\__, |\n");
  printf("       Programming Language      |___/\n");
  printf("\n     Created by Bryan McClain\n");
  printf("       (C) Comprosoft 2017\n\n");
  for (int i = 1; i < argc; i++) {
    if (access(argv[i], F_OK) != -1) {
      printf("\nProgram: %s\n\n", argv[i]);
      FILE *fp = fopen(argv[i], "rb");
      if (parseFile(fp) == 1) {
        pauseProgram();
        run();
      } else {
        parseFail();
      }
      fclose(fp);
    } else {
      printf("Error! Invalid file %s\n\n", argv[i]);
    }
  }
  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    0xf89(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12e7 <main+0x167>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
call   1080 <access@plt>
cmp    $0xffffffff,%eax
je     12ba <main+0x13a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xec0(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   10a0 <parseFile@plt>
cmp    $0x1,%eax
jne    12a5 <main+0x125>
mov    $0x0,%al
call   1040 <pauseProgram@plt>
mov    $0x0,%al
call   1060 <run@plt>
jmp    12ac <main+0x12c>
mov    $0x0,%al
call   1030 <parseFail@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    12d4 <main+0x154>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12d9 <main+0x159>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    121b <main+0x9b>
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
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe6a(%rip),%rdi
call   1060 <puts@plt>
lea    0xe7d(%rip),%rdi
call   1060 <puts@plt>
lea    0xe98(%rip),%rdi
call   1060 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1060 <puts@plt>
lea    0xed0(%rip),%rdi
call   1060 <puts@plt>
lea    0xeec(%rip),%rdi
call   1060 <puts@plt>
lea    0xf07(%rip),%rdi
call   1060 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1060 <puts@plt>
cmp    $0x2,%ebp
jl     12c1 <main+0x121>
mov    %ebp,%r13d
mov    $0x1,%r14d
mov    0x2da5(%rip),%r15
lea    0xdd5(%rip),%r12
jmp    1257 <main+0xb7>
nopl   0x0(%rax)
lea    0xdcb(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     12c1 <main+0x121>
mov    (%rbx,%r14,8),%rdi
mov    (%r15),%esi
call   10a0 <access@plt>
mov    (%rbx,%r14,8),%rsi
cmp    $0xffffffff,%eax
je     1240 <main+0xa0>
lea    0xd8d(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   10c0 <parseFile@plt>
cmp    $0x1,%eax
jne    12b0 <main+0x110>
xor    %eax,%eax
call   1050 <pauseProgram@plt>
xor    %eax,%eax
call   1080 <run@plt>
jmp    12b7 <main+0x117>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <parseFail@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
jmp    124e <main+0xae>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@F_OK = global i32 0
@.str.9 = [15 x i8] c"\0AProgram: %s\0A\0A\00"
@.str.10 = [3 x i8] c"rb\00"
@.str.11 = [25 x i8] c"Error! Invalid file %s\0A\0A\00"
@str = [31 x i8] c" ___ _ _\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 = [39 x i8] c" Programming Language |___/\00"
@str.17 = [31 x i8] c"\0A Created by Bryan McClain\00"
@str.18 = [28 x i8] c" (C) Comprosoft 2017\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.14, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.16, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.17, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.18, i64 0, i64 0))
%12 = icmp sgt i32 %0, 1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = zext i32 %0 to i64
br label %16
15: ; preds = %39, %2
ret i32 0
16: ; preds = %13, %39
%17 = phi i64 [ 1, %13 ], [ %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 ([15 x i8], [15 x i8]* @.str.9, 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.10, 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 ([25 x i8], [25 x i8]* @.str.11, 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, %14
br i1 %41, label %15, label %16
}