#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 node {
  int dummy;
};

/* Variables and functions */
struct node *create_tree();
struct node *tree_add_left(struct node *);
struct node *tree_add_right(struct node *);
int /*<<< orphan*/ tree_dispose(struct node *);
struct node *tree_get_parent(struct node *);
int main() {
  struct node *node0 = create_tree();
  struct node *node = node0;
  node = tree_add_left(node);
  node = tree_add_right(node);
  node = tree_get_parent(node);
  node = tree_add_left(node);
  node = tree_get_parent(node);
  node = tree_get_parent(node);
  tree_dispose(node);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <create_tree@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <tree_add_left@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <tree_add_right@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <tree_add_left@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <tree_dispose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <create_tree@plt>
mov    %rax,%rdi
call   1030 <tree_add_left@plt>
mov    %rax,%rdi
call   1070 <tree_add_right@plt>
mov    %rax,%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,%rdi
call   1030 <tree_add_left@plt>
mov    %rax,%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,%rdi
call   1060 <tree_dispose@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca %struct.node*
store i32 0, i32* %1
%4 = call %struct.node* (...) @create_tree()
store %struct.node* %4, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
store %struct.node* %5, %struct.node** %3
%6 = load %struct.node*, %struct.node** %3
%7 = call %struct.node* @tree_add_left(%struct.node* %6)
store %struct.node* %7, %struct.node** %3
%8 = load %struct.node*, %struct.node** %3
%9 = call %struct.node* @tree_add_right(%struct.node* %8)
store %struct.node* %9, %struct.node** %3
%10 = load %struct.node*, %struct.node** %3
%11 = call %struct.node* @tree_get_parent(%struct.node* %10)
store %struct.node* %11, %struct.node** %3
%12 = load %struct.node*, %struct.node** %3
%13 = call %struct.node* @tree_add_left(%struct.node* %12)
store %struct.node* %13, %struct.node** %3
%14 = load %struct.node*, %struct.node** %3
%15 = call %struct.node* @tree_get_parent(%struct.node* %14)
store %struct.node* %15, %struct.node** %3
%16 = load %struct.node*, %struct.node** %3
%17 = call %struct.node* @tree_get_parent(%struct.node* %16)
store %struct.node* %17, %struct.node** %3
%18 = load %struct.node*, %struct.node** %3
%19 = call i32 @tree_dispose(%struct.node* %18)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = tail call %struct.node* (...) @create_tree()
%2 = tail call %struct.node* @tree_add_left(%struct.node* %1)
%3 = tail call %struct.node* @tree_add_right(%struct.node* %2)
%4 = tail call %struct.node* @tree_get_parent(%struct.node* %3)
%5 = tail call %struct.node* @tree_add_left(%struct.node* %4)
%6 = tail call %struct.node* @tree_get_parent(%struct.node* %5)
%7 = tail call %struct.node* @tree_get_parent(%struct.node* %6)
%8 = tail call i32 @tree_dispose(%struct.node* %7)
ret i32 0
}