#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 BSTreeNode {
  int dummy;
};

/* Variables and functions */
struct BSTreeNode *BSTreeNodeInit(int);
int /*<<< orphan*/ PrintTree(struct BSTreeNode *);
int /*<<< orphan*/ print_by_level(struct BSTreeNode *);
int /*<<< orphan*/ print_by_level_2(struct BSTreeNode *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int number;
  struct BSTreeNode *node;
  printf("Please input number:");
  scanf("%d", &number);
  node = BSTreeNodeInit(number);
  PrintTree(node);
  printf("\n");
  print_by_level(node);
  printf("\n");
  print_by_level_2(node);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1070 <BSTreeNodeInit@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <PrintTree@plt>
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <print_by_level@plt>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <print_by_level_2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1090 <scanf@plt>
mov    0xc(%rsp),%edi
call   1080 <BSTreeNodeInit@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <PrintTree@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1070 <print_by_level@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <print_by_level_2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.BSTreeNode = type { i32 }
@.str = [21 x i8] c"Please input number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.BSTreeNode*
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call %struct.BSTreeNode* @BSTreeNodeInit(i32 %5)
store %struct.BSTreeNode* %6, %struct.BSTreeNode** %2
%7 = load %struct.BSTreeNode*, %struct.BSTreeNode** %2
%8 = call i32 @PrintTree(%struct.BSTreeNode* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = load %struct.BSTreeNode*, %struct.BSTreeNode** %2
%11 = call i32 @print_by_level(%struct.BSTreeNode* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = load %struct.BSTreeNode*, %struct.BSTreeNode** %2
%14 = call i32 @print_by_level_2(%struct.BSTreeNode* %13)
ret i32 0
}

LLVM IR (-O2):
%struct.BSTreeNode = type { i32 }
@.str = [21 x i8] c"Please input number:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call %struct.BSTreeNode* @BSTreeNodeInit(i32 %5)
%7 = call i32 @PrintTree(%struct.BSTreeNode* %6)
%8 = call i32 @putchar(i32 10)
%9 = call i32 @print_by_level(%struct.BSTreeNode* %6)
%10 = call i32 @putchar(i32 10)
%11 = call i32 @print_by_level_2(%struct.BSTreeNode* %6)
ret i32 0
}