#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 */
int /*<<< orphan*/ inorder_tree_walk(struct node *);
struct node *make_binary_search_tree(struct node *);
int /*<<< orphan*/ postorder_tree_walk(struct node *);
int /*<<< orphan*/ preorder_tree_walk(struct node *);
int /*<<< orphan*/ printf(char *);
int main() {
  int i = 0;
  struct node *head, *p, *q;
  head = make_binary_search_tree(head);
  q = head;
  p = head;
  printf("Inorder\n");
  inorder_tree_walk(p);
  printf("Preorder\n");
  preorder_tree_walk(p);
  printf("Postorder\n");
  postorder_tree_walk(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <make_binary_search_tree@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe76(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <inorder_tree_walk@plt>
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <preorder_tree_walk@plt>
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <postorder_tree_walk@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1070 <make_binary_search_tree@plt>
mov    %rax,%rbx
lea    0xea0(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1040 <inorder_tree_walk@plt>
lea    0xe94(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <preorder_tree_walk@plt>
lea    0xe89(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1060 <postorder_tree_walk@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [9 x i8] c"Inorder\0A\00"
@.str.1 = [10 x i8] c"Preorder\0A\00"
@.str.2 = [11 x i8] c"Postorder\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = alloca %struct.node*
store i32 0, i32* %1
store i32 0, i32* %2
%6 = load %struct.node*, %struct.node** %3
%7 = call %struct.node* @make_binary_search_tree(%struct.node* %6)
store %struct.node* %7, %struct.node** %3
%8 = load %struct.node*, %struct.node** %3
store %struct.node* %8, %struct.node** %5
%9 = load %struct.node*, %struct.node** %3
store %struct.node* %9, %struct.node** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = load %struct.node*, %struct.node** %4
%12 = call i32 @inorder_tree_walk(%struct.node* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%14 = load %struct.node*, %struct.node** %4
%15 = call i32 @preorder_tree_walk(%struct.node* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%17 = load %struct.node*, %struct.node** %4
%18 = call i32 @postorder_tree_walk(%struct.node* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@str = [8 x i8] c"Inorder\00"
@str.3 = [9 x i8] c"Preorder\00"
@str.4 = [10 x i8] c"Postorder\00"
define i32 @main() {
%1 = tail call %struct.node* @make_binary_search_tree(%struct.node* undef)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @inorder_tree_walk(%struct.node* %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 @preorder_tree_walk(%struct.node* %1)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, i64 0, i64 0))
%7 = tail call i32 @postorder_tree_walk(%struct.node* %1)
ret i32 0
}