#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ inorder(int);
int /*<<< orphan*/ insert();
int /*<<< orphan*/ postorder(int);
int /*<<< orphan*/ preorder(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int ch;
  do {
    printf("\nMENU\n.......\n1.Insert\n2.Preorder Traversal\n3.Inorder "
           "Traversal\n4.Postorder Traversal\n5.Exit\nEnter your choice:  ");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      insert();
      break;
    case 2:
      preorder(1);
      break;
    case 3:
      inorder(1);
      break;
    case 4:
      postorder(1);
      break;
    case 5:
      exit(0);
    default:
      printf("Invalid choice!!!\n");
    }
  } while (1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     1204 <main+0x94>
mov    -0x10(%rbp),%rax
lea    0xe45(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <insert@plt>
jmp    1210 <main+0xa0>
mov    $0x1,%edi
call   1030 <preorder@plt>
jmp    1210 <main+0xa0>
mov    $0x1,%edi
call   1060 <inorder@plt>
jmp    1210 <main+0xa0>
mov    $0x1,%edi
call   1050 <postorder@plt>
jmp    1210 <main+0xa0>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
jmp    1215 <main+0xa5>
mov    $0x1,%al
test   $0x1,%al
jne    117f <main+0xf>
jmp    1224 <main+0xb4>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe80(%rip),%r14
lea    0xeeb(%rip),%r15
lea    0xc(%rsp),%r13
lea    0xee2(%rip),%r12
lea    0xe52(%rip),%rbx
jmp    11c0 <main+0x40>
mov    $0x1,%edi
call   1060 <postorder@plt>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11fd <main+0x7d>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <insert@plt>
jmp    11c0 <main+0x40>
mov    $0x1,%edi
call   1070 <inorder@plt>
jmp    11c0 <main+0x40>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    11c0 <main+0x40>
mov    $0x1,%edi
call   1040 <preorder@plt>
jmp    11c0 <main+0x40>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [114 x i8] c"\0AMENU\0A.......\0A1.Insert\0A2.Preorder Traversal\0A3.Inorder Traversal\0A4.Postorder Traversal\0A5.Exit\0AEnter your choice: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Invalid choice!!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %20, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
switch i32 %6, label %17 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
]
7: ; preds = %3
%8 = call i32 (...) @insert()
br label %19
9: ; preds = %3
%10 = call i32 @preorder(i32 1)
br label %19
11: ; preds = %3
%12 = call i32 @inorder(i32 1)
br label %19
13: ; preds = %3
%14 = call i32 @postorder(i32 1)
br label %19
15: ; preds = %3
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %13, %11, %9, %7
br label %20
20: ; preds = %19
br i1 true, label %3, label %21
21: ; preds = %20
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [114 x i8] c"\0AMENU\0A.......\0A1.Insert\0A2.Preorder Traversal\0A3.Inorder Traversal\0A4.Postorder Traversal\0A5.Exit\0AEnter your choice: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [18 x i8] c"Invalid choice!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %9, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %18 [
i32 1, label %7
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 5, label %16
]
7: ; preds = %3
%8 = call i32 (...) @insert()
br label %9
9: ; preds = %7, %10, %12, %14, %18
br label %3
10: ; preds = %3
%11 = call i32 @preorder(i32 1)
br label %9
12: ; preds = %3
%13 = call i32 @inorder(i32 1)
br label %9
14: ; preds = %3
%15 = call i32 @postorder(i32 1)
br label %9
16: ; preds = %3
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %3
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %9
}