#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 main0() {
  struct node *node = create_tree();
  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):
<main0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <create_tree@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <tree_add_left@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <tree_add_right@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <tree_add_left@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <tree_dispose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main0>:
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 @main0() {
%1 = alloca %struct.node*
%2 = call %struct.node* (...) @create_tree()
store %struct.node* %2, %struct.node** %1
%3 = load %struct.node*, %struct.node** %1
%4 = call %struct.node* @tree_add_left(%struct.node* %3)
store %struct.node* %4, %struct.node** %1
%5 = load %struct.node*, %struct.node** %1
%6 = call %struct.node* @tree_add_right(%struct.node* %5)
store %struct.node* %6, %struct.node** %1
%7 = load %struct.node*, %struct.node** %1
%8 = call %struct.node* @tree_get_parent(%struct.node* %7)
store %struct.node* %8, %struct.node** %1
%9 = load %struct.node*, %struct.node** %1
%10 = call %struct.node* @tree_add_left(%struct.node* %9)
store %struct.node* %10, %struct.node** %1
%11 = load %struct.node*, %struct.node** %1
%12 = call %struct.node* @tree_get_parent(%struct.node* %11)
store %struct.node* %12, %struct.node** %1
%13 = load %struct.node*, %struct.node** %1
%14 = call %struct.node* @tree_get_parent(%struct.node* %13)
store %struct.node* %14, %struct.node** %1
%15 = load %struct.node*, %struct.node** %1
%16 = call i32 @tree_dispose(%struct.node* %15)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main0() {
%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
}