#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*/ insert();
int /*<<< orphan*/ print();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ search();
int /*<<< orphan*/ update();
int main(void) {
  char code;
  while (true) {
    printf("Enter operation code: ");
    scanf(" %c", &code);
    switch (code) {
    case 'i':
      insert();
      break;
    case 's':
      search();
      break;
    case 'u':
      update();
      break;
    case 'p':
      print();
      break;
    case 'q':
      return 0;
    default:
      printf("Illegal code\n");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1070 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffff97,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xc,%eax
ja     11ed <main+0x8d>
mov    -0x10(%rbp),%rax
lea    0xe54(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <insert@plt>
jmp    11f9 <main+0x99>
mov    $0x0,%al
call   1050 <search@plt>
jmp    11f9 <main+0x99>
mov    $0x0,%al
call   1030 <update@plt>
jmp    11f9 <main+0x99>
mov    $0x0,%al
call   1060 <print@plt>
jmp    11f9 <main+0x99>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
jmp    116f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xea0(%rip),%r14
lea    0xeb0(%rip),%r15
lea    0xf(%rsp),%r13
lea    0xea8(%rip),%r12
lea    0xe52(%rip),%rbx
jmp    11ca <main+0x4a>
mov    %r12,%rdi
call   1050 <puts@plt>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1090 <scanf@plt>
movsbl 0xf(%rsp),%eax
add    $0xffffff97,%eax
cmp    $0xc,%eax
ja     11b0 <main+0x30>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <insert@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1080 <print@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1070 <search@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1030 <update@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter operation code: \00"
@.str.1 = [4 x i8] c" %c\00"
@.str.2 = [14 x i8] c"Illegal code\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %0, %19
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
switch i32 %7, label %17 [
i32 105, label %8
i32 115, label %10
i32 117, label %12
i32 112, label %14
i32 113, label %16
]
8: ; preds = %3
%9 = call i32 (...) @insert()
br label %19
10: ; preds = %3
%11 = call i32 (...) @search()
br label %19
12: ; preds = %3
%13 = call i32 (...) @update()
br label %19
14: ; preds = %3
%15 = call i32 (...) @print()
br label %19
16: ; preds = %3
ret i32 0
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %14, %12, %10, %8
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter operation code: \00"
@.str.1 = [4 x i8] c" %c\00"
@str = [13 x i8] c"Illegal code\00"
define i32 @main() {
%1 = alloca i8
br label %2
2: ; preds = %18, %0
%3 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
switch i32 %6, label %16 [
i32 105, label %7
i32 115, label %9
i32 117, label %11
i32 112, label %13
i32 113, label %15
]
7: ; preds = %2
%8 = call i32 (...) @insert()
br label %18
9: ; preds = %2
%10 = call i32 (...) @search()
br label %18
11: ; preds = %2
%12 = call i32 (...) @update()
br label %18
13: ; preds = %2
%14 = call i32 (...) @print()
br label %18
15: ; preds = %2
ret i32 0
16: ; preds = %2
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13, %11, %9, %7
%19 = call i32 @putchar(i32 10)
br label %2
}