#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*/ exit(int /*<<< orphan*/);
char getch();
int /*<<< orphan*/ listar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remover();
int /*<<< orphan*/ system(char *);
void opicoesInicio() {
  char opt;
  while (1) {
    system("cls");
    printf("==================================================================="
           "=============\n");
    printf("||                         AGENDA APS                              "
           "           ||\n");
    printf("==================================================================="
           "=============\n\n");
    printf("1 - Inserir Contatos\n");
    printf("2 - Remover Contatos\n");
    printf("3 - Listar Contatos\n");
    printf("4 - Buscar Contatos\n");
    printf("F - Fechar Agenda\n\n");
    opt = getch();
    switch (opt) {
    case ('1'):
      cadastrar();
      break;
    case ('2'):
      remover();
      break;
    case ('3'):
      listar();
      break;
    case ('4'):
      break;
    case ('F'):
    case ('f'):
      exit(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<opicoesInicio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xf59(%rip),%rdi
call   1050 <system@plt>
lea    0xf51(%rip),%rdi
call   1060 <printf@plt>
lea    0xf97(%rip),%rdi
call   1060 <printf@plt>
lea    0xfdd(%rip),%rdi
call   1060 <printf@plt>
lea    0x1024(%rip),%rdi
call   1060 <printf@plt>
lea    0x102e(%rip),%rdi
call   1060 <printf@plt>
lea    0x1038(%rip),%rdi
call   1060 <printf@plt>
lea    0x1041(%rip),%rdi
call   1060 <printf@plt>
lea    0x104a(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getch@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x35,%eax
ja     1248 <opicoesInicio+0xd8>
mov    -0x10(%rbp),%rax
lea    0xdf1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <cadastrar@plt>
jmp    1248 <opicoesInicio+0xd8>
mov    $0x0,%al
call   1030 <remover@plt>
jmp    1248 <opicoesInicio+0xd8>
mov    $0x0,%al
call   1090 <listar@plt>
jmp    1248 <opicoesInicio+0xd8>
jmp    1248 <opicoesInicio+0xd8>
xor    %edi,%edi
call   1080 <exit@plt>
jmp    1178 <opicoesInicio+0x8>

x86 assembly (clang, -O2):
<opicoesInicio>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xfce(%rip),%rbx
lea    0xfdc(%rip),%rbp
lea    0xfea(%rip),%r14
lea    0xff7(%rip),%r15
lea    0x1004(%rip),%r12
lea    0xe5b(%rip),%r13
jmp    11b7 <opicoesInicio+0x47>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <listar@plt>
lea    0xe9a(%rip),%rdi
call   1060 <system@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getch@plt>
movsbl %al,%eax
lea    -0x31(%rax),%ecx
cmp    $0x15,%ecx
ja     124c <opicoesInicio+0xdc>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
xor    %eax,%eax
call   1050 <cadastrar@plt>
jmp    11b7 <opicoesInicio+0x47>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <remover@plt>
jmp    11b7 <opicoesInicio+0x47>
cmp    $0x66,%eax
jne    11b7 <opicoesInicio+0x47>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [82 x i8] c"================================================================================\0A\00"
@.str.2 = [82 x i8] c"|| AGENDA APS ||\0A\00"
@.str.3 = [83 x i8] c"================================================================================\0A\0A\00"
@.str.4 = [22 x i8] c"1 - Inserir Contatos\0A\00"
@.str.5 = [22 x i8] c"2 - Remover Contatos\0A\00"
@.str.6 = [21 x i8] c"3 - Listar Contatos\0A\00"
@.str.7 = [21 x i8] c"4 - Buscar Contatos\0A\00"
@.str.8 = [20 x i8] c"F - Fechar Agenda\0A\0A\00"
define void @opicoesInicio() {
%1 = alloca i8
br label %2
2: ; preds = %0, %24
%3 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%12 = call signext i8 (...) @getch()
store i8 %12, i8* %1
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
switch i32 %14, label %24 [
i32 49, label %15
i32 50, label %17
i32 51, label %19
i32 52, label %21
i32 70, label %22
i32 102, label %22
]
15: ; preds = %2
%16 = call i32 (...) @cadastrar()
br label %24
17: ; preds = %2
%18 = call i32 (...) @remover()
br label %24
19: ; preds = %2
%20 = call i32 (...) @listar()
br label %24
21: ; preds = %2
br label %24
22: ; preds = %2, %2
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2, %21, %19, %17, %15
br label %2
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@str = [81 x i8] c"================================================================================\00"
@str.9 = [81 x i8] c"|| AGENDA APS ||\00"
@str.10 = [82 x i8] c"================================================================================\0A\00"
@str.11 = [21 x i8] c"1 - Inserir Contatos\00"
@str.12 = [21 x i8] c"2 - Remover Contatos\00"
@str.13 = [20 x i8] c"3 - Listar Contatos\00"
@str.14 = [20 x i8] c"4 - Buscar Contatos\00"
@str.15 = [19 x i8] c"F - Fechar Agenda\0A\00"
define void @opicoesInicio() {
br label %1
1: ; preds = %13, %0
%2 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.14, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.15, i64 0, i64 0))
%11 = tail call signext i8 (...) @getch()
%12 = sext i8 %11 to i32
switch i32 %12, label %13 [
i32 49, label %14
i32 50, label %16
i32 51, label %18
i32 102, label %20
i32 70, label %20
]
13: ; preds = %1, %18, %16, %14
br label %1
14: ; preds = %1
%15 = tail call i32 (...) @cadastrar()
br label %13
16: ; preds = %1
%17 = tail call i32 (...) @remover()
br label %13
18: ; preds = %1
%19 = tail call i32 (...) @listar()
br label %13
20: ; preds = %1, %1
%21 = tail call i32 @exit(i32 0)
unreachable
}