#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*/ cadastrar();
int /*<<< orphan*/ consultar();
int /*<<< orphan*/ mostra_menu();
int /*<<< orphan*/ printf(char *);
int recebe_op();
int /*<<< orphan*/ remover();
int main() {
  int sair = 0;
  while (sair == 0) {
    mostra_menu();
    switch (recebe_op()) {
    case 1:
      cadastrar();
      break;
    case 2:
      consultar();
      break;
    case 3:
      remover();
      break;
    case 4:
      sair = 1;
      break;
    default:
      printf("Opcao nao existente.\n");
      break;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1205 <main+0xa5>
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1080 <mostra_menu@plt>
mov    -0x11(%rbp),%al
call   1060 <recebe_op@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11e8 <main+0x88>
mov    -0x10(%rbp),%rax
lea    0xe51(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <cadastrar@plt>
jmp    11f4 <main+0x94>
mov    $0x0,%al
call   1070 <consultar@plt>
jmp    11f4 <main+0x94>
mov    $0x0,%al
call   1030 <remover@plt>
jmp    11f4 <main+0x94>
movl   $0x1,-0x8(%rbp)
jmp    11f4 <main+0x94>
lea    0xe21(%rip),%rdi
call   1050 <printf@plt>
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
jmp    1176 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%r14
lea    0xe7e(%rip),%rbx
jmp    11a2 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1090 <mostra_menu@plt>
xor    %eax,%eax
call   1070 <recebe_op@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1190 <main+0x20>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <cadastrar@plt>
jmp    1198 <main+0x28>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <consultar@plt>
jmp    1198 <main+0x28>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <remover@plt>
jmp    1198 <main+0x28>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Opcao nao existente.\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = call i32 (...) @mostra_menu()
%8 = call i32 (...) @recebe_op()
switch i32 %8, label %16 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
]
9: ; preds = %6
%10 = call i32 (...) @cadastrar()
br label %18
11: ; preds = %6
%12 = call i32 (...) @consultar()
br label %18
13: ; preds = %6
%14 = call i32 (...) @remover()
br label %18
15: ; preds = %6
store i32 1, i32* %2
br label %18
16: ; preds = %6
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %15, %13, %11, %9
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %3
20: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"Opcao nao existente.\00"
define i32 @main() {
br label %1
1: ; preds = %12, %0
%2 = tail call i32 (...) @mostra_menu()
%3 = tail call i32 (...) @recebe_op()
switch i32 %3, label %10 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %14
]
4: ; preds = %1
%5 = tail call i32 (...) @cadastrar()
br label %12
6: ; preds = %1
%7 = tail call i32 (...) @consultar()
br label %12
8: ; preds = %1
%9 = tail call i32 (...) @remover()
br label %12
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %6, %4
%13 = tail call i32 @putchar(i32 10)
br label %1
14: ; preds = %1
%15 = tail call i32 @putchar(i32 10)
ret i32 0
}