#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_cbt(int /*<<< orphan*/, int, int *, struct node *);
int /*<<< orphan*/ inorder(struct node *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int n;
  struct node *root = NULL;
  int i;
  int *arr = NULL;
  scanf("%d", &n);
  arr = (int *)malloc(sizeof(int) * n);
  i = 0;
  while (i <= n - 1) {
    scanf("%d", &arr[i]);
    i++;
  }
  root = create_cbt(0, n, arr, root);
  printf("created cbt\n");
  inorder(root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
lea    0xe83(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11da <main+0x8a>
mov    -0x30(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe39(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a0 <main+0x50>
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %edi,%edi
call   1040 <create_cbt@plt>
mov    %rax,-0x20(%rbp)
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <inorder@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11ad <main+0x5d>
xor    %r12d,%r12d
lea    0xe76(%rip),%r15
mov    %r14,%rbx
nopl   (%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r12
movslq 0x4(%rsp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r12
jl     1190 <main+0x40>
xor    %edi,%edi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1040 <create_cbt@plt>
mov    %rax,%rbx
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <inorder@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"created cbt\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.node*
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %7
store i32* null, i32** %9
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = mul i64 4, %12
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i32*
store i32* %16, i32** %9
store i32 0, i32* %8
br label %17
17: ; preds = %22, %2
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = sub nsw i32 %19, 1
%21 = icmp sle i32 %18, %20
br i1 %21, label %22, label %30
22: ; preds = %17
%23 = load i32*, i32** %9
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %17
30: ; preds = %17
%31 = load i32, i32* %6
%32 = load i32*, i32** %9
%33 = load %struct.node*, %struct.node** %7
%34 = call %struct.node* @create_cbt(i32 0, i32 %31, i32* %32, %struct.node* %33)
store %struct.node* %34, %struct.node** %7
%35 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%36 = load %struct.node*, %struct.node** %7
%37 = call i32 @inorder(%struct.node* %36)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@str = [12 x i8] c"created cbt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = shl i32 %6, 2
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %2, %12
%13 = phi i64 [ %16, %12 ], [ 0, %2 ]
%14 = getelementptr inbounds i32, i32* %9, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %20
20: ; preds = %12, %2
%21 = phi i32 [ %10, %2 ], [ %17, %12 ]
%22 = call %struct.node* @create_cbt(i32 0, i32 %21, i32* %9, %struct.node* null)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%24 = call i32 @inorder(%struct.node* %22)
ret i32 0
}