#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*/ error(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ heap_init();
int /*<<< orphan*/ loadfile(int /*<<< orphan*/ *);
int /*<<< orphan*/ maketerminal();
int /*<<< orphan*/ ops_init();
int /*<<< orphan*/ parser_init();
int /*<<< orphan*/ sys_init();
int main(int argc, char **argv) {
  ops_init();
  sys_init();
  heap_init();
  parser_init();
  if (argc > 1) {
    FILE *src = fopen(argv[1], "r");
    loadfile(src);
    maketerminal();
  } else {
    error("error: no source file specified\n");
  }
  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)
mov    $0x0,%al
call   1040 <ops_init@plt>
mov    $0x0,%al
call   1030 <sys_init@plt>
mov    $0x0,%al
call   1090 <heap_init@plt>
mov    $0x0,%al
call   10a0 <parser_init@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11e9 <main+0x69>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe35(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <loadfile@plt>
mov    $0x0,%al
call   1080 <maketerminal@plt>
jmp    11f5 <main+0x75>
lea    0xe12(%rip),%rdi
call   1060 <error@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <ops_init@plt>
xor    %eax,%eax
call   1030 <sys_init@plt>
xor    %eax,%eax
call   1090 <heap_init@plt>
xor    %eax,%eax
call   10a0 <parser_init@plt>
cmp    $0x2,%ebp
jl     11ca <main+0x4a>
mov    0x8(%rbx),%rdi
lea    0xe4c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rdi
call   1050 <loadfile@plt>
xor    %eax,%eax
call   1080 <maketerminal@plt>
jmp    11d6 <main+0x56>
lea    0xe31(%rip),%rdi
call   1060 <error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [33 x i8] c"error: no source file specified\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @ops_init()
%8 = call i32 (...) @sys_init()
%9 = call i32 (...) @heap_init()
%10 = call i32 (...) @parser_init()
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i32*, i32** %6
%19 = call i32 @loadfile(i32* %18)
%20 = call i32 (...) @maketerminal()
br label %23
21: ; preds = %2
%22 = call i32 @error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %13
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [33 x i8] c"error: no source file specified\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @ops_init()
%4 = tail call i32 (...) @sys_init()
%5 = tail call i32 (...) @heap_init()
%6 = tail call i32 (...) @parser_init()
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %14
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, i64 0, i64 0))
%12 = tail call i32 @loadfile(i32* %11)
%13 = tail call i32 (...) @maketerminal()
br label %16
14: ; preds = %2
%15 = tail call i32 @error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
ret i32 0
}