#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 *add_node(struct node *, int /*<<< orphan*/);
int /*<<< orphan*/ del_node(struct node *);
int /*<<< orphan*/ new_node(int);
int /*<<< orphan*/ print_tree(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  struct node *root = NULL;
  int entered_number;
  for (;;) {
    printf("> ");
    if (!scanf("%d", &entered_number))
      break;
    root = add_node(root, new_node(entered_number));
    print_tree(root);
  }
  del_node(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,-0x18(%rbp)
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%eax
jne    11a8 <main+0x48>
jmp    11d5 <main+0x75>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
call   1080 <new_node@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1040 <add_node@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <print_tree@plt>
jmp    117e <main+0x1e>
mov    -0x18(%rbp),%rdi
call   1060 <del_node@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    0xe91(%rip),%rdi
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     11d5 <main+0x75>
lea    0xe6e(%rip),%r14
lea    0xe6a(%rip),%r15
lea    0x4(%rsp),%r12
xchg   %ax,%ax
mov    0x4(%rsp),%edi
call   1080 <new_node@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <add_node@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <print_tree@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jne    11a0 <main+0x40>
mov    %rbx,%rdi
call   1060 <del_node@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"> \00"
@.str.1 = [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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %6
br label %8
8: ; preds = %13, %2
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8
br label %20
13: ; preds = %8
%14 = load %struct.node*, %struct.node** %6
%15 = load i32, i32* %7
%16 = call i32 @new_node(i32 %15)
%17 = call %struct.node* @add_node(%struct.node* %14, i32 %16)
store %struct.node* %17, %struct.node** %6
%18 = load %struct.node*, %struct.node** %6
%19 = call i32 @print_tree(%struct.node* %18)
br label %8
20: ; preds = %12
%21 = load %struct.node*, %struct.node** %6
%22 = call i32 @del_node(%struct.node* %21)
ret i32 0
}

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