#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*/ doShowHeight();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getch();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void showMenu() {
  system("cls");
  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) Show Heights of Root\n");
  printf("(6) Exit\n");
  switch (getch()) {
  case '1':
    doInsert();
    break;
  case '2':
    doDelete();
    break;
  case '3':
    doSearch();
    break;
  case '4':
    doInOrder();
    break;
  case '5':
    doShowHeight();
    break;
  default:
    exit(0);
  }
}


x86 assembly (clang, -O0):
<showMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe75(%rip),%rdi
call   1050 <system@plt>
lea    0xe6d(%rip),%rdi
call   1060 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1060 <printf@plt>
lea    0xeae(%rip),%rdi
call   1060 <printf@plt>
lea    0xecf(%rip),%rdi
call   1060 <printf@plt>
lea    0xeee(%rip),%rdi
call   1060 <printf@plt>
lea    0xf10(%rip),%rdi
call   1060 <printf@plt>
lea    0xf07(%rip),%rdi
call   1060 <printf@plt>
lea    0xf0e(%rip),%rdi
call   1060 <printf@plt>
lea    0xf15(%rip),%rdi
call   1060 <printf@plt>
lea    0xf1c(%rip),%rdi
call   1060 <printf@plt>
lea    0xf24(%rip),%rdi
call   1060 <printf@plt>
lea    0xf32(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x8(%rbp)
sub    $0x4,%eax
ja     129d <showMenu+0x10d>
mov    -0x8(%rbp),%rax
lea    0xda8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <doInsert@plt>
jmp    12a4 <showMenu+0x114>
mov    $0x0,%al
call   1080 <doDelete@plt>
jmp    12a4 <showMenu+0x114>
mov    $0x0,%al
call   1090 <doSearch@plt>
jmp    12a4 <showMenu+0x114>
mov    $0x0,%al
call   1040 <doInOrder@plt>
jmp    12a4 <showMenu+0x114>
mov    $0x0,%al
call   1070 <doShowHeight@plt>
jmp    12a4 <showMenu+0x114>
xor    %edi,%edi
call   10b0 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showMenu>:
push   %rax
lea    0xe7c(%rip),%rdi
call   1060 <system@plt>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
lea    0xe95(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
lea    0xef1(%rip),%rdi
call   1040 <puts@plt>
lea    0xf12(%rip),%rdi
call   1040 <puts@plt>
lea    0xf08(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0e(%rip),%rdi
call   1040 <puts@plt>
lea    0xf14(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1040 <puts@plt>
lea    0xf21(%rip),%rdi
call   1040 <puts@plt>
lea    0xf2e(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
add    $0xffffffcf,%eax
cmp    $0x4,%eax
ja     1274 <showMenu+0xe4>
lea    0xdbd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
pop    %rcx
jmp    1030 <doInsert@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <doDelete@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <doSearch@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <doInOrder@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <doShowHeight@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"cls\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 = [25 x i8] c"(5) Show Heights of Root\00"
@str.23 = [9 x i8] c"(6) Exit\00"
define void @showMenu() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%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 ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.23, i64 0, i64 0))
%14 = tail call i32 (...) @getch()
switch i32 %14, label %25 [
i32 49, label %15
i32 50, label %17
i32 51, label %19
i32 52, label %21
i32 53, label %23
]
15: ; preds = %0
%16 = tail call i32 (...) @doInsert()
br label %27
17: ; preds = %0
%18 = tail call i32 (...) @doDelete()
br label %27
19: ; preds = %0
%20 = tail call i32 (...) @doSearch()
br label %27
21: ; preds = %0
%22 = tail call i32 (...) @doInOrder()
br label %27
23: ; preds = %0
%24 = tail call i32 (...) @doShowHeight()
br label %27
25: ; preds = %0
%26 = tail call i32 @exit(i32 0)
unreachable
27: ; preds = %23, %21, %19, %17, %15
ret void
}