#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 */

/* Variables and functions */
int /*<<< orphan*/ createbtree(int *, int *, int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int btree[16];
  int data[10] = {0, 5, 6, 4, 8, 2, 3, 7, 1, 9};
  int i;
  for (i = 1; i < 16; i++) {
    btree[i] = 0;
  }
  createbtree(btree, data, 9);
  for (i = 1; i < 16; i++) {
    printf("%2d：[%d]\n", i, btree[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x1,-0x84(%rbp)
cmpl   $0x10,-0x84(%rbp)
jge    1191 <main+0x61>
movslq -0x84(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1161 <main+0x31>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x9,%edx
call   1040 <createbtree@plt>
movl   $0x1,-0x84(%rbp)
cmpl   $0x10,-0x84(%rbp)
jge    11eb <main+0xbb>
mov    -0x84(%rbp),%esi
movslq -0x84(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11ad <main+0x7d>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x4(%rsp)
movups %xmm0,0x14(%rsp)
movups %xmm0,0x24(%rsp)
movups %xmm0,0x30(%rsp)
mov    %rsp,%rdi
lea    0x40(%rsp),%rsi
mov    $0x9,%edx
call   1040 <createbtree@plt>
mov    0x4(%rsp),%edx
lea    0xeab(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    0x2c(%rsp),%edx
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
mov    0x30(%rsp),%edx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    0x34(%rsp),%edx
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
mov    0x38(%rsp),%edx
mov    %rbx,%rdi
mov    $0xe,%esi
call   1030 <printf@plt>
mov    0x3c(%rsp),%edx
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.data = [10 x i32] [i32 0, i32 5, i32 6, i32 4, i32 8, i32 2, i32 3, i32 7, i32 1, i32 9]
@.str = [12 x i8] c"%2d\EF\BC\9A[%d]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i32]
%3 = alloca [10 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %3 to i8*
store i32 1, i32* %4
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
%17 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%19 = call i32 @createbtree(i32* %17, i32* %18, i32 9)
store i32 1, i32* %4
br label %20
20: ; preds = %30, %16
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 16
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %28)
br label %30
30: ; preds = %23
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %20
33: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = [10 x i32] [i32 0, i32 5, i32 6, i32 4, i32 8, i32 2, i32 3, i32 7, i32 1, i32 9]
@.str = [12 x i8] c"%2d\EF\BC\9A[%d]\0A\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = alloca [10 x i32]
%3 = bitcast [16 x i32]* %1 to i8*
%4 = bitcast [10 x i32]* %2 to i8*
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 1
%6 = bitcast i32* %5 to i8*
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call i32 @createbtree(i32* %7, i32* %8, i32 9)
%10 = load i32, i32* %5
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1, i32 %10)
%12 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 2
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 %13)
%15 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 3
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 3, i32 %16)
%18 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 4
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 4, i32 %19)
%21 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 5
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 5, i32 %22)
%24 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 6
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 6, i32 %25)
%27 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 7
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 7, i32 %28)
%30 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 8
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 8, i32 %31)
%33 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 9
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 9, i32 %34)
%36 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 10
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10, i32 %37)
%39 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 11
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11, i32 %40)
%42 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 12
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 12, i32 %43)
%45 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 13
%46 = load i32, i32* %45
%47 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 13, i32 %46)
%48 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 14
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 14, i32 %49)
%51 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 15
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 15, i32 %52)
ret i32 0
}