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

/* Variables and functions */
int /*<<< orphan*/ inorder_traverse(struct tree_node *, int /*<<< orphan*/ *);
int /*<<< orphan*/ postorder_traverse(struct tree_node *, int /*<<< orphan*/ *);
int /*<<< orphan*/ preorder_traverse(struct tree_node *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void traverse_binary_tree(struct tree_node *root) {
  printf("preorder: ");
  preorder_traverse(root, NULL);
  printf("\n");
  printf("inorder: ");
  inorder_traverse(root, NULL);
  printf("\n");
  printf("postorder: ");
  postorder_traverse(root, NULL);
  printf("\n");
}


x86 assembly (clang, -O0):
<traverse_binary_tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <preorder_traverse@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <inorder_traverse@plt>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <postorder_traverse@plt>
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<traverse_binary_tree>:
push   %rbx
mov    %rdi,%rbx
lea    0xea5(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <preorder_traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <inorder_traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe7a(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <postorder_traverse@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.tree_node = type { i32 }
@.str = [11 x i8] c"preorder: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [10 x i8] c"inorder: \00"
@.str.3 = [12 x i8] c"postorder: \00"
define void @traverse_binary_tree(%struct.tree_node* %0) {
%2 = alloca %struct.tree_node*
store %struct.tree_node* %0, %struct.tree_node** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.tree_node*, %struct.tree_node** %2
%5 = call i32 @preorder_traverse(%struct.tree_node* %4, i32* null)
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%8 = load %struct.tree_node*, %struct.tree_node** %2
%9 = call i32 @inorder_traverse(%struct.tree_node* %8, i32* null)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%12 = load %struct.tree_node*, %struct.tree_node** %2
%13 = call i32 @postorder_traverse(%struct.tree_node* %12, i32* null)
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.tree_node = type { i32 }
@.str = [11 x i8] c"preorder: \00"
@.str.2 = [10 x i8] c"inorder: \00"
@.str.3 = [12 x i8] c"postorder: \00"
define void @traverse_binary_tree(%struct.tree_node* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @preorder_traverse(%struct.tree_node* %0, i32* null)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @inorder_traverse(%struct.tree_node* %0, i32* null)
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @postorder_traverse(%struct.tree_node* %0, i32* null)
%10 = tail call i32 @putchar(i32 10)
ret void
}