#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*/ compile(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ read_line(int /*<<< orphan*/ *, char *);
void parse(char *fname) {
  char source[64000];
  FILE *fp;
  fp = fopen(fname, "r");
  if (fp == NULL)
    return;
  while (!feof(fp)) {
    read_line(fp, source);
    compile(source);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfa20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0xfa18(%rbp)
cmpq   $0x0,-0xfa18(%rbp)
jne    1189 <parse+0x39>
jmp    11df <parse+0x8f>
jmp    118e <parse+0x3e>
mov    -0xfa18(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11af <parse+0x5f>
jmp    11d3 <parse+0x83>
mov    -0xfa18(%rbp),%rdi
lea    -0xfa10(%rbp),%rsi
call   1060 <read_line@plt>
lea    -0xfa10(%rbp),%rdi
call   1040 <compile@plt>
jmp    118e <parse+0x3e>
mov    -0xfa18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0xfa20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %r14
push   %rbx
sub    $0xfa08,%rsp
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11a7 <parse+0x57>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    119f <parse+0x4f>
mov    %rsp,%r14
nopl   (%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <read_line@plt>
mov    %r14,%rdi
call   1040 <compile@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     1180 <parse+0x30>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0xfa08,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define void @parse(i8* %0) {
%2 = alloca i8*
%3 = alloca [64000 x i8]
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
br label %25
10: ; preds = %1
br label %11
11: ; preds = %16, %10
%12 = load i32*, i32** %4
%13 = call i32 @feof(i32* %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %22
16: ; preds = %11
%17 = load i32*, i32** %4
%18 = getelementptr inbounds [64000 x i8], [64000 x i8]* %3, i64 0, i64 0
%19 = call i32 @read_line(i32* %17, i8* %18)
%20 = getelementptr inbounds [64000 x i8], [64000 x i8]* %3, i64 0, i64 0
%21 = call i32 @compile(i8* %20)
br label %11
22: ; preds = %11
%23 = load i32*, i32** %4
%24 = call i32 @fclose(i32* %23)
br label %25
25: ; preds = %22, %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define void @parse(i8* nocapture %0) {
%2 = alloca [64000 x i8]
%3 = getelementptr inbounds [64000 x i8], [64000 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = call i32 @feof(i32* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6, %9
%10 = call i32 @read_line(i32* %4, i8* %3)
%11 = call i32 @compile(i8* %3)
%12 = call i32 @feof(i32* %4)
%13 = icmp eq i32 %12, 0
br i1 %13, label %9, label %14
14: ; preds = %9, %6
%15 = call i32 @fclose(i32* %4)
br label %16
16: ; preds = %1, %14
ret void
}