#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  FILE *fp;
  char letter;
  if (argc != 2) {
    printf("Correct Usage: parser filename\n");
    exit(EXIT_FAILURE);
  } else {
    fp = fopen(argv[1], "r");
    printf("%s\n", argv[1]);
    if (fp == NULL) {
      printf("ERROR LOADING FILE\n");
      exit(EXIT_FAILURE);
    }
    int j = 100;
    while (!feof(fp)) {
      letter = getc(fp);
    }
  }
  fclose(fp);
  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)
cmpl   $0x2,-0x8(%rbp)
je     119c <main+0x3c>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    11f1 <main+0x91>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
movl   $0x64,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1216 <main+0xb6>
jmp    1227 <main+0xc7>
mov    -0x18(%rbp),%rdi
call   1080 <getc@plt>
mov    %al,-0x19(%rbp)
jmp    11f8 <main+0x98>
jmp    122c <main+0xcc>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11b8 <main+0x58>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe89(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x8(%r14),%rdi
call   1030 <puts@plt>
test   %rbx,%rbx
je     11c1 <main+0x61>
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    11a6 <main+0x46>
mov    %rbx,%rdi
call   1080 <getc@plt>
jmp    1190 <main+0x30>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe56(%rip),%rdi
jmp    11c8 <main+0x68>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Correct Usage: parser filename\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [20 x i8] c"ERROR LOADING FILE\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = load i32*, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %30
26: ; preds = %15
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %15
store i32 100, i32* %8
br label %31
31: ; preds = %36, %30
%32 = load i32*, i32** %6
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i32*, i32** %6
%38 = call signext i8 @getc(i32* %37)
store i8 %38, i8* %7
br label %31
39: ; preds = %31
br label %40
40: ; preds = %39
%41 = load i32*, i32** %6
%42 = call i32 @fclose(i32* %41)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@str = [19 x i8] c"ERROR LOADING FILE\00"
@str.4 = [31 x i8] c"Correct Usage: parser filename\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.4, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %9
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
%14 = icmp eq i32* %11, null
br i1 %14, label %18, label %15
15: ; preds = %8
%16 = tail call i32 @feof(i32* %11)
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %26
18: ; preds = %8
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %15, %22
%23 = tail call signext i8 @getc(i32* %11)
%24 = tail call i32 @feof(i32* %11)
%25 = icmp eq i32 %24, 0
br i1 %25, label %22, label %26
26: ; preds = %22, %15
%27 = tail call i32 @fclose(i32* %11)
ret i32 0
}