#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*/ hash_function();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rbtree_function();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ tree_function();
void menu() {
  int choice;
  do {
    printf("0) Exit\n");
    printf("1) hash_function\n");
    printf("2) tree_function\n");
    printf("3) rbtree_function\n");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      hash_function();
      break;
    case 2:
      tree_function();
      break;
    case 3:
      rbtree_function();
      break;
    }
  } while (choice);
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     11ce <menu+0x7e>
jmp    11ac <menu+0x5c>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11da <menu+0x8a>
jmp    11bd <menu+0x6d>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     11e6 <menu+0x96>
jmp    11ed <menu+0x9d>
mov    $0x0,%al
call   1070 <hash_function@plt>
jmp    11ed <menu+0x9d>
mov    $0x0,%al
call   1050 <tree_function@plt>
jmp    11ed <menu+0x9d>
mov    $0x0,%al
call   1030 <rbtree_function@plt>
jmp    11f2 <menu+0xa2>
cmpl   $0x0,-0x4(%rbp)
jne    1158 <menu+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%r14
lea    0xea2(%rip),%r15
lea    0xeac(%rip),%r12
lea    0xeb6(%rip),%r13
lea    0xe82(%rip),%rbx
lea    0x4(%rsp),%rbp
jmp    119f <menu+0x4f>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <tree_function@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11f9 <menu+0xa9>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11f0 <menu+0xa0>
cmp    $0x2,%eax
je     1190 <menu+0x40>
cmp    $0x1,%eax
jne    119b <menu+0x4b>
xor    %eax,%eax
call   1070 <hash_function@plt>
jmp    1197 <menu+0x47>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rbtree_function@plt>
jmp    1197 <menu+0x47>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"0) Exit\0A\00"
@.str.1 = [18 x i8] c"1) hash_function\0A\00"
@.str.2 = [18 x i8] c"2) tree_function\0A\00"
@.str.3 = [20 x i8] c"3) rbtree_function\0A\00"
@.str.4 = [3 x i8] c"%d\00"
define void @menu() {
%1 = alloca i32
br label %2
2: ; preds = %16, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
]
9: ; preds = %2
%10 = call i32 (...) @hash_function()
br label %15
11: ; preds = %2
%12 = call i32 (...) @tree_function()
br label %15
13: ; preds = %2
%14 = call i32 (...) @rbtree_function()
br label %15
15: ; preds = %2, %13, %11, %9
br label %16
16: ; preds = %15
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, 0
br i1 %18, label %2, label %19
19: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str.4 = [3 x i8] c"%d\00"
@str = [8 x i8] c"0) Exit\00"
@str.5 = [17 x i8] c"1) hash_function\00"
@str.6 = [17 x i8] c"2) tree_function\00"
@str.7 = [19 x i8] c"3) rbtree_function\00"
define void @menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %18, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %18 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
10: ; preds = %3
%11 = call i32 (...) @hash_function()
br label %16
12: ; preds = %3
%13 = call i32 (...) @tree_function()
br label %16
14: ; preds = %3
%15 = call i32 (...) @rbtree_function()
br label %16
16: ; preds = %14, %12, %10
%17 = load i32, i32* %1
br label %18
18: ; preds = %16, %3
%19 = phi i32 [ %17, %16 ], [ %9, %3 ]
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %3
21: ; preds = %18
ret void
}