#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 *add_node_spec(struct node *, int);
int /*<<< orphan*/ inorder(struct node *, int *);
int /*<<< orphan*/ postorder(struct node *, int *);
int /*<<< orphan*/ preorder(struct node *, int *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char const *argv[]) {
  {
    struct node *root = NULL;
    int nums[10] = {10, 5, 12, 12, 15};
    int arr[20] = {0};
    int len = 5;
    for (int i = 0; i < 5; i++) {
      root = add_node_spec(root, nums[i]);
    }
    printf("\nInorder: \n");
    inorder(root, arr);
    printf("\nPreordrer\n");
    preorder(root, arr);
    printf("\nPostorder: \n");
    postorder(root, arr);
  }
  {
    printf("\n\t\t\tTest2\n");
    int arr[2] = {0};
    inorder(NULL, arr);
    preorder(NULL, arr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movl   $0xa,-0x40(%rbp)
movl   $0x5,-0x3c(%rbp)
movl   $0xc,-0x38(%rbp)
movl   $0xc,-0x34(%rbp)
movl   $0xf,-0x30(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
movl   $0x5,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
cmpl   $0x5,-0x98(%rbp)
jge    1214 <main+0xb4>
mov    -0x18(%rbp),%rdi
movslq -0x98(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
call   1080 <add_node_spec@plt>
mov    %rax,-0x18(%rbp)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    11db <main+0x7b>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1070 <inorder@plt>
lea    0xdd5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <preorder@plt>
lea    0xdc5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <postorder@plt>
lea    0xdb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
lea    -0xa0(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <inorder@plt>
lea    -0xa0(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <preorder@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %edi,%edi
mov    $0xa,%esi
call   1070 <add_node_spec@plt>
mov    %rax,%rdi
mov    $0x5,%esi
call   1070 <add_node_spec@plt>
mov    %rax,%rdi
mov    $0xc,%esi
call   1070 <add_node_spec@plt>
mov    %rax,%rdi
mov    $0xc,%esi
call   1070 <add_node_spec@plt>
mov    %rax,%rdi
mov    $0xf,%esi
call   1070 <add_node_spec@plt>
mov    %rax,%rbx
lea    0xe44(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <inorder@plt>
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <preorder@plt>
lea    0xe29(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <postorder@plt>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,(%rsp)
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <inorder@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <preorder@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [12 x i8] c"\0AInorder: \0A\00"
@.str.1 = [12 x i8] c"\0APreordrer\0A\00"
@.str.2 = [14 x i8] c"\0APostorder: \0A\00"
@.str.3 = [11 x i8] c"\0A\09\09\09Test2\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.node*
%7 = alloca [10 x i32]
%8 = alloca [20 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca [2 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %6
%12 = bitcast [10 x i32]* %7 to i8*
%13 = bitcast i8* %12 to [10 x i32]*
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 0
store i32 10, i32* %14
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 1
store i32 5, i32* %15
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 2
store i32 12, i32* %16
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 3
store i32 12, i32* %17
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 4
store i32 15, i32* %18
%19 = bitcast [20 x i32]* %8 to i8*
store i32 5, i32* %9
store i32 0, i32* %10
br label %20
20: ; preds = %30, %2
%21 = load i32, i32* %10
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load %struct.node*, %struct.node** %6
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call %struct.node* @add_node_spec(%struct.node* %24, i32 %28)
store %struct.node* %29, %struct.node** %6
br label %30
30: ; preds = %23
%31 = load i32, i32* %10
%32 = add nsw i32 %31, 1
store i32 %32, i32* %10
br label %20
33: ; preds = %20
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%35 = load %struct.node*, %struct.node** %6
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%37 = call i32 @inorder(%struct.node* %35, i32* %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%39 = load %struct.node*, %struct.node** %6
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%41 = call i32 @preorder(%struct.node* %39, i32* %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%43 = load %struct.node*, %struct.node** %6
%44 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%45 = call i32 @postorder(%struct.node* %43, i32* %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%47 = bitcast [2 x i32]* %11 to i8*
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%49 = call i32 @inorder(%struct.node* null, i32* %48)
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%51 = call i32 @preorder(%struct.node* null, i32* %50)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@str = [11 x i8] c"\0AInorder: \00"
@str.4 = [11 x i8] c"\0APreordrer\00"
@str.5 = [13 x i8] c"\0APostorder: \00"
@str.6 = [10 x i8] c"\0A\09\09\09Test2\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i32]
%4 = alloca i64
%5 = bitcast [20 x i32]* %3 to i8*
%6 = tail call %struct.node* @add_node_spec(%struct.node* null, i32 10)
%7 = tail call %struct.node* @add_node_spec(%struct.node* %6, i32 5)
%8 = tail call %struct.node* @add_node_spec(%struct.node* %7, i32 12)
%9 = tail call %struct.node* @add_node_spec(%struct.node* %8, i32 12)
%10 = tail call %struct.node* @add_node_spec(%struct.node* %9, i32 15)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%13 = call i32 @inorder(%struct.node* %10, i32* %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
%15 = call i32 @preorder(%struct.node* %10, i32* %12)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
%17 = call i32 @postorder(%struct.node* %10, i32* %12)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0))
%19 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%20 = bitcast i64* %4 to i32*
%21 = call i32 @inorder(%struct.node* null, i32* %20)
%22 = call i32 @preorder(%struct.node* null, i32* %20)
ret i32 0
}