#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 */
char getchar();
int /*<<< orphan*/ insert();
int /*<<< orphan*/ print();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ search();
int /*<<< orphan*/ update();
int main(int argc, const char *argv[]) {
  char code;
  for (;;) {
    printf("Enter operation code: ");
    scanf(" %c", &code);
    while (getchar() != '\n')
      ;
    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");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11ba <main+0x4a>
jmp    11a2 <main+0x32>
movsbl -0x11(%rbp),%eax
add    $0xffffff97,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xc,%eax
ja     121c <main+0xac>
mov    -0x20(%rbp),%rax
lea    0xe25(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <insert@plt>
jmp    1228 <main+0xb8>
mov    $0x0,%al
call   1050 <search@plt>
jmp    1228 <main+0xb8>
mov    $0x0,%al
call   1030 <update@plt>
jmp    1228 <main+0xb8>
mov    $0x0,%al
call   1060 <print@plt>
jmp    1228 <main+0xb8>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
jmp    1186 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe90(%rip),%r14
lea    0xea0(%rip),%r15
lea    0xf(%rsp),%r13
lea    0xe98(%rip),%r12
lea    0xe42(%rip),%rbx
jmp    11da <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   10a0 <scanf@plt>
nopl   (%rax)
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0xa,%al
jne    11f0 <main+0x60>
movsbl 0xf(%rsp),%eax
add    $0xffffff97,%eax
cmp    $0xc,%eax
ja     11c0 <main+0x30>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   10b0 <insert@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1080 <print@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1070 <search@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1030 <update@plt>
jmp    11d0 <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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %29, %2
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %10
10: ; preds = %14, %7
%11 = call signext i8 (...) @getchar()
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %10
br label %10
15: ; preds = %10
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
switch i32 %17, label %27 [
i32 105, label %18
i32 115, label %20
i32 117, label %22
i32 112, label %24
i32 113, label %26
]
18: ; preds = %15
%19 = call i32 (...) @insert()
br label %29
20: ; preds = %15
%21 = call i32 (...) @search()
br label %29
22: ; preds = %15
%23 = call i32 (...) @update()
br label %29
24: ; preds = %15
%25 = call i32 (...) @print()
br label %29
26: ; preds = %15
ret i32 0
27: ; preds = %15
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24, %22, %20, %18
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %7
}

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(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
br label %4
4: ; preds = %24, %2
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %7
7: ; preds = %7, %4
%8 = call signext i8 (...) @getchar()
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %7
10: ; preds = %7
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
switch i32 %12, label %22 [
i32 105, label %13
i32 115, label %15
i32 117, label %17
i32 112, label %19
i32 113, label %21
]
13: ; preds = %10
%14 = call i32 (...) @insert()
br label %24
15: ; preds = %10
%16 = call i32 (...) @search()
br label %24
17: ; preds = %10
%18 = call i32 (...) @update()
br label %24
19: ; preds = %10
%20 = call i32 (...) @print()
br label %24
21: ; preds = %10
ret i32 0
22: ; preds = %10
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %22, %19, %17, %15, %13
%25 = call i32 @putchar(i32 10)
br label %4
}