#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*/ inorder(int *, int);
int /*<<< orphan*/ printf(char *, ...);
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);
  printf("二叉查找树的内容：");
  for (i = 1; i < 16; i++) {
    printf("[%d]", btree[i]);
  }
  printf("\n输出的排序结果：");
  inorder(btree, 1);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
movl   $0x1,-0x84(%rbp)
cmpl   $0x10,-0x84(%rbp)
jge    11a1 <main+0x61>
movslq -0x84(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1171 <main+0x31>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x9,%edx
call   1040 <createbtree@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x84(%rbp)
cmpl   $0x10,-0x84(%rbp)
jge    1205 <main+0xc5>
movslq -0x84(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11cb <main+0x8b>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
call   1050 <inorder@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    0xed2(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe9a(%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,%r14
lea    0x40(%rsp),%rsi
mov    %r14,%rdi
mov    $0x9,%edx
call   1050 <createbtree@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1060 <inorder@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
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 = [28 x i8] c"\E4\BA\8C\E5\8F\89\E6\9F\A5\E6\89\BE\E6\A0\91\E7\9A\84\E5\86\85\E5\AE\B9\EF\BC\9A\00"
@.str.1 = [5 x i8] c"[%d]\00"
@.str.2 = [26 x i8] c"\0A\E8\BE\93\E5\87\BA\E7\9A\84\E6\8E\92\E5\BA\8F\E7\BB\93\E6\9E\9C\EF\BC\9A\00"
@.str.3 = [2 x i8] c"\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)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %21
21: ; preds = %30, %16
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 16
br i1 %23, label %24, label %33
24: ; preds = %21
%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 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %24
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %21
33: ; preds = %21
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%35 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%36 = call i32 @inorder(i32* %35, i32 1)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
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 = [28 x i8] c"\E4\BA\8C\E5\8F\89\E6\9F\A5\E6\89\BE\E6\A0\91\E7\9A\84\E5\86\85\E5\AE\B9\EF\BC\9A\00"
@.str.1 = [5 x i8] c"[%d]\00"
@.str.2 = [26 x i8] c"\0A\E8\BE\93\E5\87\BA\E7\9A\84\E6\8E\92\E5\BA\8F\E7\BB\93\E6\9E\9C\EF\BC\9A\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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 2
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 3
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 4
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 5
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 6
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 7
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 8
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 9
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 10
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 11
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 12
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 13
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 14
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 15
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%56 = call i32 @inorder(i32* %7, i32 1)
%57 = call i32 @putchar(i32 10)
ret i32 0
}