#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*/ doDelete();
int /*<<< orphan*/ doInOrder();
int /*<<< orphan*/ doInsert();
int /*<<< orphan*/ doSearch();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void showMenu() {
  printf("     ___   ___      _____ ___ ___ ___       \n");
  printf("     /_\\ \\ / / |    |_   _| _ \\ __| __|  \n");
  printf("    / _ \\ - /| |__    | | |   / _|| _|     \n");
  printf("   /_/ \\_\\_/ |____|   |_| |_|_\\___|___|  \n");
  printf("                     By: Raven G. Duran     \n");
  printf("\n\n");
  printf("(1) Insert a Node\n");
  printf("(2) Delete a Node\n");
  printf("(3) Search a Node\n");
  printf("(4) Print In Order\n");
  printf("(5) Exit\n");
  int choice;
  printf("\n\nChoice: ");
  scanf("%d", &choice);
  switch (choice) {
  case 1:
    doInsert();
    break;
  case 2:
    doDelete();
    break;
  case 3:
    doSearch();
    break;
  case 4:
    doInOrder();
    break;
  default:
    exit(0);
  }
}


x86 assembly (clang, -O0):
<showMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1050 <printf@plt>
lea    0xed2(%rip),%rdi
call   1050 <printf@plt>
lea    0xef3(%rip),%rdi
call   1050 <printf@plt>
lea    0xf12(%rip),%rdi
call   1050 <printf@plt>
lea    0xf34(%rip),%rdi
call   1050 <printf@plt>
lea    0xf2b(%rip),%rdi
call   1050 <printf@plt>
lea    0xf32(%rip),%rdi
call   1050 <printf@plt>
lea    0xf39(%rip),%rdi
call   1050 <printf@plt>
lea    0xf40(%rip),%rdi
call   1050 <printf@plt>
lea    0xf48(%rip),%rdi
call   1050 <printf@plt>
lea    0xf46(%rip),%rdi
call   1050 <printf@plt>
lea    0xf45(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1271 <showMenu+0x101>
mov    -0x10(%rbp),%rax
lea    0xdc8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <doInsert@plt>
jmp    1278 <showMenu+0x108>
mov    $0x0,%al
call   1060 <doDelete@plt>
jmp    1278 <showMenu+0x108>
mov    $0x0,%al
call   1070 <doSearch@plt>
jmp    1278 <showMenu+0x108>
mov    $0x0,%al
call   1040 <doInOrder@plt>
jmp    1278 <showMenu+0x108>
xor    %edi,%edi
call   1090 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showMenu>:
push   %rax
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
lea    0xef5(%rip),%rdi
call   1040 <puts@plt>
lea    0xf13(%rip),%rdi
call   1040 <puts@plt>
lea    0xf34(%rip),%rdi
call   1040 <puts@plt>
lea    0xf2a(%rip),%rdi
call   1040 <puts@plt>
lea    0xf30(%rip),%rdi
call   1040 <puts@plt>
lea    0xf36(%rip),%rdi
call   1040 <puts@plt>
lea    0xf3c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf43(%rip),%rdi
call   1040 <puts@plt>
lea    0xe04(%rip),%rdi
call   1060 <printf@plt>
lea    0xe03(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1262 <showMenu+0xe2>
lea    0xdcb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <doInsert@plt>
pop    %rax
ret
xor    %eax,%eax
call   1080 <doSearch@plt>
pop    %rax
ret
xor    %eax,%eax
call   1070 <doDelete@plt>
pop    %rax
ret
xor    %eax,%eax
call   1050 <doInOrder@plt>
pop    %rax
ret
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c" ___ ___ _____ ___ ___ ___ \0A\00"
@.str.1 = [43 x i8] c" /_\\ \\ / / | |_ _| _ \\ __| __| \0A\00"
@.str.2 = [45 x i8] c" / _ \\ - /| |__ | | | / _|| _| \0A\00"
@.str.3 = [43 x i8] c" /_/ \\_\\_/ |____| |_| |_|_\\___|___| \0A\00"
@.str.4 = [46 x i8] c" By: Raven G. Duran \0A\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
@.str.6 = [19 x i8] c"(1) Insert a Node\0A\00"
@.str.7 = [19 x i8] c"(2) Delete a Node\0A\00"
@.str.8 = [19 x i8] c"(3) Search a Node\0A\00"
@.str.9 = [20 x i8] c"(4) Print In Order\0A\00"
@.str.10 = [10 x i8] c"(5) Exit\0A\00"
@.str.11 = [11 x i8] c"\0A\0AChoice: \00"
@.str.12 = [3 x i8] c"%d\00"
define void @showMenu() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
switch i32 %15, label %24 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %22
]
16: ; preds = %0
%17 = call i32 (...) @doInsert()
br label %26
18: ; preds = %0
%19 = call i32 (...) @doDelete()
br label %26
20: ; preds = %0
%21 = call i32 (...) @doSearch()
br label %26
22: ; preds = %0
%23 = call i32 (...) @doInOrder()
br label %26
24: ; preds = %0
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %22, %20, %18, %16
ret void
}

LLVM IR (-O2):
@.str.11 = [11 x i8] c"\0A\0AChoice: \00"
@.str.12 = [3 x i8] c"%d\00"
@str = [45 x i8] c" ___ ___ _____ ___ ___ ___ \00"
@str.13 = [42 x i8] c" /_\\ \\ / / | |_ _| _ \\ __| __| \00"
@str.14 = [44 x i8] c" / _ \\ - /| |__ | | | / _|| _| \00"
@str.15 = [42 x i8] c" /_/ \\_\\_/ |____| |_| |_|_\\___|___| \00"
@str.16 = [45 x i8] c" By: Raven G. Duran \00"
@str.17 = [2 x i8] c"\0A\00"
@str.18 = [18 x i8] c"(1) Insert a Node\00"
@str.19 = [18 x i8] c"(2) Delete a Node\00"
@str.20 = [18 x i8] c"(3) Search a Node\00"
@str.21 = [19 x i8] c"(4) Print In Order\00"
@str.22 = [9 x i8] c"(5) Exit\00"
define void @showMenu() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.13, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.14, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.15, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.16, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.17, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.18, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.19, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.20, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.22, i64 0, i64 0))
%13 = bitcast i32* %1 to i8*
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
switch i32 %16, label %25 [
i32 1, label %17
i32 2, label %19
i32 3, label %21
i32 4, label %23
]
17: ; preds = %0
%18 = call i32 (...) @doInsert()
br label %27
19: ; preds = %0
%20 = call i32 (...) @doDelete()
br label %27
21: ; preds = %0
%22 = call i32 (...) @doSearch()
br label %27
23: ; preds = %0
%24 = call i32 (...) @doInOrder()
br label %27
25: ; preds = %0
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %23, %21, %19, %17
ret void
}