#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*/ create();
int /*<<< orphan*/ erase();
char getchar();
scalar_t__ isspace(char);
int /*<<< orphan*/ list();
int /*<<< orphan*/ menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ search();
int tolower(char);
int main(int argc, char const *argv[]) {
  char command = 'c';
  while (command != 's') {
    menu();
    printf("Comando>> ");
    do
      command = getchar();
    while (isspace(command));
    switch (tolower(command)) {
    case 'i':
      create();
      break;
    case 'v':
      list();
      break;
    case 'o':
      erase();
      break;
    case 'u':
      search();
      break;
    case 's':
      printf("\nGracias y hasta la vista!!!\n");
      break;
    default:
      printf("Comando desconocido!\n");
      break;
    }
  }
  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)
movb   $0x63,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x73,%eax
je     1268 <main+0xd8>
mov    $0x0,%al
call   1030 <menu@plt>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
jne    11ca <main+0x3a>
movsbl -0x11(%rbp),%edi
call   10b0 <tolower@plt>
add    $0xffffff97,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xd,%eax
ja     1257 <main+0xc7>
mov    -0x20(%rbp),%rax
lea    0xdf3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <create@plt>
jmp    1263 <main+0xd3>
mov    $0x0,%al
call   10a0 <list@plt>
jmp    1263 <main+0xd3>
mov    $0x0,%al
call   1050 <erase@plt>
jmp    1263 <main+0xd3>
mov    $0x0,%al
call   1060 <search@plt>
jmp    1263 <main+0xd3>
lea    0xdf6(%rip),%rdi
call   1040 <printf@plt>
jmp    1263 <main+0xd3>
lea    0xe03(%rip),%rdi
call   1040 <printf@plt>
jmp    11aa <main+0x1a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe86(%rip),%r12
lea    0xea7(%rip),%r14
lea    0xe40(%rip),%r13
lea    0xe7c(%rip),%r15
jmp    11d6 <main+0x36>
mov    %r14,%rdi
call   1030 <puts@plt>
cmp    $0x73,%bl
je     124a <main+0xaa>
xor    %eax,%eax
call   1040 <menu@plt>
mov    %r12,%rdi
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   10a0 <getchar@plt>
mov    %eax,%ebx
movsbl %al,%ebp
mov    %ebp,%edi
call   1080 <isspace@plt>
test   %rax,%rax
jne    11f0 <main+0x50>
mov    %ebp,%edi
call   10c0 <tolower@plt>
add    $0xffffff97,%eax
cmp    $0xd,%eax
ja     11c9 <main+0x29>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <create@plt>
jmp    11d1 <main+0x31>
xor    %eax,%eax
call   1060 <erase@plt>
jmp    11d1 <main+0x31>
mov    %r15,%rdi
jmp    11cc <main+0x2c>
xor    %eax,%eax
call   1070 <search@plt>
jmp    11d1 <main+0x31>
xor    %eax,%eax
call   10b0 <list@plt>
jmp    11d1 <main+0x31>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Comando>> \00"
@.str.1 = [30 x i8] c"\0AGracias y hasta la vista!!!\0A\00"
@.str.2 = [22 x i8] c"Comando desconocido!\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
store i8 99, i8* %6
br label %7
7: ; preds = %35, %2
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 115
br i1 %10, label %11, label %36
11: ; preds = %7
%12 = call i32 (...) @menu()
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %16, %11
%15 = call signext i8 (...) @getchar()
store i8 %15, i8* %6
br label %16
16: ; preds = %14
%17 = load i8, i8* %6
%18 = call i64 @isspace(i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %14, label %20
20: ; preds = %16
%21 = load i8, i8* %6
%22 = call i32 @tolower(i8 signext %21)
switch i32 %22, label %33 [
i32 105, label %23
i32 118, label %25
i32 111, label %27
i32 117, label %29
i32 115, label %31
]
23: ; preds = %20
%24 = call i32 (...) @create()
br label %35
25: ; preds = %20
%26 = call i32 (...) @list()
br label %35
27: ; preds = %20
%28 = call i32 (...) @erase()
br label %35
29: ; preds = %20
%30 = call i32 (...) @search()
br label %35
31: ; preds = %20
%32 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %35
33: ; preds = %20
%34 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %29, %27, %25, %23
br label %7
36: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Comando>> \00"
@str = [29 x i8] c"\0AGracias y hasta la vista!!!\00"
@str.3 = [21 x i8] c"Comando desconocido!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %24
%4 = tail call i32 (...) @menu()
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %3
%7 = tail call signext i8 (...) @getchar()
%8 = tail call i64 @isspace(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %6
10: ; preds = %6
%11 = tail call i32 @tolower(i8 signext %7)
switch i32 %11, label %22 [
i32 105, label %12
i32 118, label %14
i32 111, label %16
i32 117, label %18
i32 115, label %20
]
12: ; preds = %10
%13 = tail call i32 (...) @create()
br label %24
14: ; preds = %10
%15 = tail call i32 (...) @list()
br label %24
16: ; preds = %10
%17 = tail call i32 (...) @erase()
br label %24
18: ; preds = %10
%19 = tail call i32 (...) @search()
br label %24
20: ; preds = %10
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %24
22: ; preds = %10
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %20, %18, %16, %14, %12
%25 = icmp eq i8 %7, 115
br i1 %25, label %26, label %3
26: ; preds = %24
ret i32 0
}