#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 */
int /*<<< orphan*/ bfs(struct node *);
int /*<<< orphan*/ insert(int, struct node **);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  struct node *root = NULL;
  int n;
  int input;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &input);
    insert(input, &root);
  }
  bfs(root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1193 <main+0x63>
lea    0xe87(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x20(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1050 <insert@plt>
jmp    115e <main+0x2e>
mov    -0x18(%rbp),%rdi
call   1030 <bfs@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xeb7(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
subl   $0x1,(%rsp)
jae    115b <main+0x2b>
xor    %edi,%edi
jmp    1192 <main+0x62>
lea    0xe9e(%rip),%r14
lea    0x4(%rsp),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1050 <insert@plt>
subl   $0x1,(%rsp)
jae    1170 <main+0x40>
mov    0x8(%rsp),%rdi
call   1030 <bfs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.node*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %6
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %10
10: ; preds = %14, %2
%11 = load i32, i32* %7
%12 = add nsw i32 %11, -1
store i32 %12, i32* %7
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%16 = load i32, i32* %8
%17 = call i32 @insert(i32 %16, %struct.node** %6)
br label %10
18: ; preds = %10
%19 = load %struct.node*, %struct.node** %6
%20 = call i32 @bfs(%struct.node* %19)
ret i32 0
}

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