#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*/ cgGenerateImage();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ parser_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ save_image();
int main(int argc, char const *argv[]) {
  if (argc == 1) {
    printf("No file available\n");
    return -1;
  } else {
    FILE *fp = fopen(argv[1], "r");
    parser_init(fp);
    fclose(fp);
    cgGenerateImage();
    save_image();
  }
  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   $0x1,-0x8(%rbp)
jne    1198 <main+0x38>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <parser_init@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x0,%al
call   1060 <cgGenerateImage@plt>
mov    $0x0,%al
call   1050 <save_image@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jne    1179 <main+0x19>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    11ac <main+0x4c>
mov    0x8(%rsi),%rdi
lea    0xe7c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <parser_init@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <cgGenerateImage@plt>
xor    %eax,%eax
call   1050 <save_image@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"No file available\0A\00"
@.str.1 = [2 x i8] c"r\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 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %23
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = call i32 @parser_init(i32* %16)
%18 = load i32*, i32** %6
%19 = call i32 @fclose(i32* %18)
%20 = call i32 (...) @cgGenerateImage()
%21 = call i32 (...) @save_image()
br label %22
22: ; preds = %11
store i32 0, i32* %3
br label %23
23: ; preds = %22, %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@str = [18 x i8] c"No file available\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %14
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @parser_init(i32* %9)
%11 = tail call i32 @fclose(i32* %9)
%12 = tail call i32 (...) @cgGenerateImage()
%13 = tail call i32 (...) @save_image()
br label %14
14: ; preds = %6, %4
%15 = phi i32 [ -1, %4 ], [ 0, %6 ]
ret i32 %15
}