#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 *createTree(int *, int *, int, int);
int /*<<< orphan*/ levelOrder(struct node *);
int /*<<< orphan*/ printf(char *);
int main() {
  int in[] = {4, 8, 2, 5, 1, 6, 3, 7};
  int post[] = {8, 4, 5, 2, 6, 7, 3, 1};
  int n = 8;
  int t = 1;
  struct node *root = createTree(post, in, n, t);
  printf("\nLEVEL ORDER TRAVERSAL--------------\n");
  levelOrder(root);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb2(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x8,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
call   1030 <createTree@plt>
mov    %rax,-0x50(%rbp)
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1050 <levelOrder@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
mov    $0x8,%edx
mov    $0x1,%ecx
call   1030 <createTree@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <levelOrder@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@__const.main.in = [8 x i32] [i32 4, i32 8, i32 2, i32 5, i32 1, i32 6, i32 3, i32 7]
@__const.main.post = [8 x i32] [i32 8, i32 4, i32 5, i32 2, i32 6, i32 7, i32 3, i32 1]
@.str = [38 x i8] c"\0ALEVEL ORDER TRAVERSAL--------------\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.node*
%6 = bitcast [8 x i32]* %1 to i8*
%7 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
store i32 1, i32* %4
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call %struct.node* @createTree(i32* %8, i32* %9, i32 %10, i32 %11)
store %struct.node* %12, %struct.node** %5
%13 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%14 = load %struct.node*, %struct.node** %5
%15 = call i32 @levelOrder(%struct.node* %14)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@__const.main.in = [8 x i32] [i32 4, i32 8, i32 2, i32 5, i32 1, i32 6, i32 3, i32 7]
@__const.main.post = [8 x i32] [i32 8, i32 4, i32 5, i32 2, i32 6, i32 7, i32 3, i32 1]
@str = [37 x i8] c"\0ALEVEL ORDER TRAVERSAL--------------\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%7 = call %struct.node* @createTree(i32* %5, i32* %6, i32 8, i32 1)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%9 = call i32 @levelOrder(%struct.node* %7)
ret i32 0
}