#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*/ delete ();
int /*<<< orphan*/ insert();
int /*<<< orphan*/ modify();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ search();
void menu() {
  int choice;
  printf("\n*** Enter ***\n1 to insert\n2 to delete\n3 to modify\n4 to "
         "search\n5 to escape\nChoice: ");
  scanf("%d", &choice);
  switch (choice) {
  case 1:
    insert();
    menu();
    break;
  case 2:
    delete ();
    menu();
    break;
  case 3:
    modify();
    menu();
    break;
  case 4:
    search();
    menu();
    break;
  case 5:
    break;
  default:
    printf("wish you knew how to count\n");
    menu();
  }
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     1206 <menu+0x96>
mov    -0x10(%rbp),%rax
lea    0xe4c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <insert@plt>
call   1040 <menu@plt>
jmp    1217 <menu+0xa7>
mov    $0x0,%al
call   1090 <delete@plt>
call   1040 <menu@plt>
jmp    1217 <menu+0xa7>
mov    $0x0,%al
call   1030 <modify@plt>
call   1040 <menu@plt>
jmp    1217 <menu+0xa7>
mov    $0x0,%al
call   1060 <search@plt>
call   1040 <menu@plt>
jmp    1217 <menu+0xa7>
jmp    1217 <menu+0xa7>
lea    0xe5e(%rip),%rdi
call   1050 <printf@plt>
call   1040 <menu@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rax
lea    0xe8c(%rip),%rdi
call   1060 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11c3 <menu+0x43>
lea    0xe4f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <insert@plt>
jmp    11ea <menu+0x6a>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
jmp    11ea <menu+0x6a>
xor    %eax,%eax
call   10a0 <delete@plt>
jmp    11ea <menu+0x6a>
xor    %eax,%eax
call   1030 <modify@plt>
jmp    11ea <menu+0x6a>
xor    %eax,%eax
call   1070 <search@plt>
call   1050 <menu@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [84 x i8] c"\0A*** Enter ***\0A1 to insert\0A2 to delete\0A3 to modify\0A4 to search\0A5 to escape\0AChoice: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"wish you knew how to count\0A\00"
define void @menu() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
switch i32 %4, label %14 [
i32 1, label %5
i32 2, label %7
i32 3, label %9
i32 4, label %11
i32 5, label %13
]
5: ; preds = %0
%6 = call i32 (...) @insert()
br label %16
7: ; preds = %0
%8 = call i32 (...) @delete()
br label %16
9: ; preds = %0
%10 = call i32 (...) @modify()
br label %16
11: ; preds = %0
%12 = call i32 (...) @search()
br label %16
13: ; preds = %0
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %13, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [84 x i8] c"\0A*** Enter ***\0A1 to insert\0A2 to delete\0A3 to modify\0A4 to search\0A5 to escape\0AChoice: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"wish you knew how to count\00"
define void @menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %14 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %17
]
6: ; preds = %0
%7 = call i32 (...) @insert()
br label %16
8: ; preds = %0
%9 = call i32 (...) @delete()
br label %16
10: ; preds = %0
%11 = call i32 (...) @modify()
br label %16
12: ; preds = %0
%13 = call i32 (...) @search()
br label %16
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %6, %8, %10, %12, %14
br label %17
17: ; preds = %16, %0
ret void
}