#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*/ exit_();
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ insert();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ save();
int /*<<< orphan*/ show();
int /*<<< orphan*/ sort_();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ update();
void command(void) {
  char buffer[100];
  printf(">");
  fscanf(stdin, "%s", buffer);
  if (!strcmp(buffer, "insert")) {
    insert();
    return;
  } else if (!strcmp(buffer, "update")) {
    update();
    return;
  } else if (!strcmp(buffer, "delete")) {
    delete_();
    return;
  } else if (!strcmp(buffer, "sort")) {
    sort_();
    return;
  } else if (!strcmp(buffer, "show")) {
    show();
    return;
  } else if (!strcmp(buffer, "save")) {
    save();
    return;
  } else if (!strcmp(buffer, "exit")) {
    exit_();
    return;
  } else {
    printf("Wrong command!\n");
    return;
  }
}


x86 assembly (clang, -O0):
<command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xe3a(%rip),%rsi
call   1070 <fscanf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    11f2 <command+0x52>
mov    $0x0,%al
call   10b0 <insert@plt>
jmp    12dc <command+0x13c>
lea    -0x70(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1217 <command+0x77>
mov    $0x0,%al
call   1030 <update@plt>
jmp    12dc <command+0x13c>
lea    -0x70(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    123c <command+0x9c>
mov    $0x0,%al
call   10a0 <delete_@plt>
jmp    12dc <command+0x13c>
lea    -0x70(%rbp),%rdi
lea    0xdd3(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1261 <command+0xc1>
mov    $0x0,%al
call   1040 <sort_@plt>
jmp    12dc <command+0x13c>
lea    -0x70(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1286 <command+0xe6>
mov    $0x0,%al
call   1080 <show@plt>
jmp    12dc <command+0x13c>
lea    -0x70(%rbp),%rdi
lea    0xd93(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    12ab <command+0x10b>
mov    $0x0,%al
call   1060 <save@plt>
jmp    12dc <command+0x13c>
lea    -0x70(%rbp),%rdi
lea    0xd73(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    12d0 <command+0x130>
mov    $0x0,%al
call   10c0 <exit_@plt>
jmp    12dc <command+0x13c>
lea    0xd57(%rip),%rdi
call   1050 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command>:
sub    $0x68,%rsp
mov    $0x3e,%edi
call   1050 <putchar@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
mov    %rsp,%rdx
call   1080 <fscanf@plt>
mov    $0x65736e69,%eax
xor    (%rsp),%eax
mov    $0x747265,%ecx
xor    0x3(%rsp),%ecx
or     %eax,%ecx
je     125a <command+0xba>
mov    $0x61647075,%eax
xor    (%rsp),%eax
mov    $0x657461,%ecx
xor    0x3(%rsp),%ecx
or     %eax,%ecx
je     1266 <command+0xc6>
mov    $0x656c6564,%eax
xor    (%rsp),%eax
mov    $0x657465,%ecx
xor    0x3(%rsp),%ecx
or     %eax,%ecx
je     1272 <command+0xd2>
mov    $0x74726f73,%eax
xor    (%rsp),%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     127e <command+0xde>
mov    $0x776f6873,%eax
xor    (%rsp),%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     128a <command+0xea>
mov    $0x65766173,%eax
xor    (%rsp),%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     1296 <command+0xf6>
mov    $0x74697865,%eax
xor    (%rsp),%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     12a2 <command+0x102>
lea    0xddc(%rip),%rdi
call   1060 <puts@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   10b0 <insert@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   1030 <update@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   10a0 <delete_@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   1040 <sort_@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   1090 <show@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   1070 <save@plt>
add    $0x68,%rsp
ret
xor    %eax,%eax
call   10c0 <exit_@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c">\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"insert\00"
@.str.3 = [7 x i8] c"update\00"
@.str.4 = [7 x i8] c"delete\00"
@.str.5 = [5 x i8] c"sort\00"
@.str.6 = [5 x i8] c"show\00"
@.str.7 = [5 x i8] c"save\00"
@.str.8 = [5 x i8] c"exit\00"
@.str.9 = [16 x i8] c"Wrong command!\0A\00"
define void @command() {
%1 = alloca [100 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @fscanf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 (...) @insert()
br label %49
11: ; preds = %0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 (...) @update()
br label %49
17: ; preds = %11
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = call i32 (...) @delete_()
br label %49
23: ; preds = %17
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 (...) @sort_()
br label %49
29: ; preds = %23
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%31 = call i32 @strcmp(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %29
%34 = call i32 (...) @show()
br label %49
35: ; preds = %29
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %35
%40 = call i32 (...) @save()
br label %49
41: ; preds = %35
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %41
%46 = call i32 (...) @exit_()
br label %49
47: ; preds = %41
%48 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
br label %49
49: ; preds = %47, %45, %39, %33, %27, %21, %15, %9
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"insert\00"
@.str.3 = [7 x i8] c"update\00"
@.str.4 = [7 x i8] c"delete\00"
@.str.5 = [5 x i8] c"sort\00"
@.str.6 = [5 x i8] c"show\00"
@.str.7 = [5 x i8] c"save\00"
@.str.8 = [5 x i8] c"exit\00"
@str = [15 x i8] c"Wrong command!\00"
define void @command() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @putchar(i32 62)
%4 = load i32, i32* @stdin
%5 = call i32 @fscanf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @bcmp(i8* dereferenceable(7) %2, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 7)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @insert()
br label %42
10: ; preds = %0
%11 = call i32 @bcmp(i8* dereferenceable(7) %2, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @update()
br label %42
15: ; preds = %10
%16 = call i32 @bcmp(i8* dereferenceable(7) %2, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 7)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @delete_()
br label %42
20: ; preds = %15
%21 = call i32 @bcmp(i8* dereferenceable(5) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 5)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @sort_()
br label %42
25: ; preds = %20
%26 = call i32 @bcmp(i8* dereferenceable(5) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 5)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @show()
br label %42
30: ; preds = %25
%31 = call i32 @bcmp(i8* dereferenceable(5) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 5)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (...) @save()
br label %42
35: ; preds = %30
%36 = call i32 @bcmp(i8* dereferenceable(5) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 5)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (...) @exit_()
br label %42
40: ; preds = %35
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %42
42: ; preds = %40, %38, %33, %28, %23, %18, %13, %8
ret void
}