#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 tree {
  int dummy;
};
struct listHeader {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(unsigned int *);
int /*<<< orphan*/ freeList(struct listHeader *);
struct tree *makePathTree(struct listHeader *);
int /*<<< orphan*/ printTree(struct tree *);
unsigned int *readFileToVector(char const *);
struct listHeader *vectorToListOfTrees(unsigned int *);
int compacta(const char *filename) {
  unsigned int *vec = readFileToVector(filename);
  struct listHeader *lista_de_pesos = vectorToListOfTrees(vec);
  struct tree *raiz_da_arvore = makePathTree(lista_de_pesos);
  printTree(raiz_da_arvore);
  free(vec);
  freeList(lista_de_pesos);
  return 0;
}


x86 assembly (clang, -O0):
<compacta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <readFileToVector@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <vectorToListOfTrees@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <makePathTree@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <printTree@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <freeList@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compacta>:
push   %r14
push   %rbx
push   %rax
call   1060 <readFileToVector@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <vectorToListOfTrees@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <makePathTree@plt>
mov    %rax,%rdi
call   1050 <printTree@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1040 <freeList@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.listHeader = type { i32 }
%struct.tree = type { i32 }
define i32 @compacta(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca %struct.listHeader*
%5 = alloca %struct.tree*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32* @readFileToVector(i8* %6)
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = call %struct.listHeader* @vectorToListOfTrees(i32* %8)
store %struct.listHeader* %9, %struct.listHeader** %4
%10 = load %struct.listHeader*, %struct.listHeader** %4
%11 = call %struct.tree* @makePathTree(%struct.listHeader* %10)
store %struct.tree* %11, %struct.tree** %5
%12 = load %struct.tree*, %struct.tree** %5
%13 = call i32 @printTree(%struct.tree* %12)
%14 = load i32*, i32** %3
%15 = call i32 @free(i32* %14)
%16 = load %struct.listHeader*, %struct.listHeader** %4
%17 = call i32 @freeList(%struct.listHeader* %16)
ret i32 0
}

LLVM IR (-O2):
%struct.listHeader = type { i32 }
%struct.tree = type { i32 }
define i32 @compacta(i8* %0) {
%2 = tail call i32* @readFileToVector(i8* %0)
%3 = tail call %struct.listHeader* @vectorToListOfTrees(i32* %2)
%4 = tail call %struct.tree* @makePathTree(%struct.listHeader* %3)
%5 = tail call i32 @printTree(%struct.tree* %4)
%6 = tail call i32 @free(i32* %2)
%7 = tail call i32 @freeList(%struct.listHeader* %3)
ret i32 0
}