#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*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ parser(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int args, char **argv) {
  FILE *fp = fopen("parsertest.in", "r");
  if (fp) {
    printf("Estamos onde queriamos\n");
    parser(fp);
    return 0;
  } else {
    fprintf(stderr, "I can't open parsertest.in\n");
    return -1;
  }
}


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    0xea3(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1199 <main+0x59>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <parser@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <main+0x75>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1174 <main+0x34>
mov    %rax,%rbx
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <parser@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"parsertest.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"Estamos onde queriamos\0A\00"
@stderr = global i32 0
@.str.3 = [28 x i8] c"I can't open parsertest.in\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* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %6
%8 = load i32*, i32** %6
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32*, i32** %6
%13 = call i32 @parser(i32* %12)
store i32 0, i32* %3
br label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [14 x i8] c"parsertest.in\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [28 x i8] c"I can't open parsertest.in\0A\00"
@str = [23 x i8] c"Estamos onde queriamos\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @parser(i32* %3)
br label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ 0, %5 ], [ -1, %8 ]
ret i32 %12
}