#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 */
struct no_tipdef {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fopen(char *, char *);
int /*<<< orphan*/ print_tree(struct no_tipdef *, int /*<<< orphan*/ *);
void imprime_tipos(struct no_tipdef *p) {
  FILE *tipfile;
  tipfile = (FILE *)fopen("tipos.tes", "w");
  if (tipfile == (FILE *)0)
    error("* * Erro Fatal: Nao consegui abri arquivo tipos.tes * *");
  print_tree(p, tipfile);
  fclose(tipfile);
}


x86 assembly (clang, -O0):
<imprime_tipos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117a <imprime_tipos+0x3a>
lea    0xe97(%rip),%rdi
call   1040 <error@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <print_tree@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime_tipos>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xeb2(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    116e <imprime_tipos+0x2e>
lea    0xea3(%rip),%rdi
call   1040 <error@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <print_tree@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
%struct.no_tipdef = type { i32 }
@.str = [10 x i8] c"tipos.tes\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [56 x i8] c"* * Erro Fatal: Nao consegui abri arquivo tipos.tes * *\00"
define void @imprime_tipos(%struct.no_tipdef* %0) {
%2 = alloca %struct.no_tipdef*
%3 = alloca i32*
store %struct.no_tipdef* %0, %struct.no_tipdef** %2
%4 = call i64 @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @error(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load %struct.no_tipdef*, %struct.no_tipdef** %2
%12 = load i32*, i32** %3
%13 = call i32 @print_tree(%struct.no_tipdef* %11, i32* %12)
%14 = load i32*, i32** %3
%15 = call i32 @fclose(i32* %14)
ret void
}

LLVM IR (-O2):
%struct.no_tipdef = type { i32 }
@.str = [10 x i8] c"tipos.tes\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [56 x i8] c"* * Erro Fatal: Nao consegui abri arquivo tipos.tes * *\00"
define void @imprime_tipos(%struct.no_tipdef* %0) {
%2 = tail call i64 @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = inttoptr i64 %2 to i32*
%4 = icmp eq i64 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @error(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @print_tree(%struct.no_tipdef* %0, i32* %3)
%9 = tail call i32 @fclose(i32* %3)
ret void
}