#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*/ atualiza();
int /*<<< orphan*/ exibe();
int /*<<< orphan*/ gera();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
void menu(void) {
  char op;
  do {
    printf("\nMenu de opcoes:\n");
    printf("------------------------------\n");
    printf("1 - Gerar arquivo\n");
    printf("2 - Exibir o arquivo\n");
    printf("3 - Atualizar o arquivo\n");
    printf("4 - Sair do programa\n");
    printf("Entre com o codigo da opcao: ");
    scanf("%d", &op);
    system("cls");
  } while (op < 1 || op > 4);
  if (op == 1) {
    gera();
  }
  if (op == 2) {
    exibe();
  }
  if (op == 3) {
    atualiza();
  }
  puts("\nEncerrando...");
  system("pause");
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
call   1060 <printf@plt>
lea    0xe87(%rip),%rdi
call   1060 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1060 <printf@plt>
lea    0xea2(%rip),%rdi
call   1060 <printf@plt>
lea    0xeac(%rip),%rdi
call   1060 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1060 <printf@plt>
lea    0xec3(%rip),%rdi
call   1060 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xec8(%rip),%rdi
call   1050 <system@plt>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x2(%rbp)
jl     1207 <menu+0x97>
movsbl -0x1(%rbp),%eax
cmp    $0x4,%eax
setg   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1178 <menu+0x8>
movsbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1226 <menu+0xb6>
mov    $0x0,%al
call   1090 <gera@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    123a <menu+0xca>
mov    $0x0,%al
call   1030 <exibe@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x3,%eax
jne    124e <menu+0xde>
mov    $0x0,%al
call   1080 <atualiza@plt>
lea    0xe5a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5d(%rip),%rdi
call   1050 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf0f(%rip),%rbx
lea    0xf20(%rip),%rbp
lea    0xe70(%rip),%r14
lea    0xe87(%rip),%r15
lea    0x7(%rsp),%r12
lea    0xe7e(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
mov    %r13,%rdi
call   1050 <system@plt>
movzbl 0x7(%rsp),%eax
lea    -0x5(%rax),%ecx
cmp    $0xfc,%cl
jb     11b0 <menu+0x40>
cmp    $0x1,%al
je     1252 <menu+0xe2>
cmp    $0x2,%al
je     1261 <menu+0xf1>
cmp    $0x3,%al
jne    122b <menu+0xbb>
xor    %eax,%eax
call   1080 <atualiza@plt>
lea    0xdf3(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf6(%rip),%rdi
call   1050 <system@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1090 <gera@plt>
mov    0x7(%rsp),%al
cmp    $0x2,%al
jne    1220 <menu+0xb0>
xor    %eax,%eax
call   1030 <exibe@plt>
mov    0x7(%rsp),%al
cmp    $0x3,%al
je     1224 <menu+0xb4>
jmp    122b <menu+0xbb>

LLVM IR (-O0):
@.str = [18 x i8] c"\0AMenu de opcoes:\0A\00"
@.str.1 = [32 x i8] c"------------------------------\0A\00"
@.str.2 = [19 x i8] c"1 - Gerar arquivo\0A\00"
@.str.3 = [22 x i8] c"2 - Exibir o arquivo\0A\00"
@.str.4 = [25 x i8] c"3 - Atualizar o arquivo\0A\00"
@.str.5 = [22 x i8] c"4 - Sair do programa\0A\00"
@.str.6 = [30 x i8] c"Entre com o codigo da opcao: \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [4 x i8] c"cls\00"
@.str.9 = [15 x i8] c"\0AEncerrando...\00"
@.str.10 = [6 x i8] c"pause\00"
define void @menu() {
%1 = alloca i8
br label %2
2: ; preds = %20, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 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 ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %1)
%11 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %12
12: ; preds = %2
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp slt i32 %14, 1
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8, i8* %1
%18 = sext i8 %17 to i32
%19 = icmp sgt i32 %18, 4
br label %20
20: ; preds = %16, %12
%21 = phi i1 [ true, %12 ], [ %19, %16 ]
br i1 %21, label %2, label %22
22: ; preds = %20
%23 = load i8, i8* %1
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (...) @gera()
br label %28
28: ; preds = %26, %22
%29 = load i8, i8* %1
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (...) @exibe()
br label %34
34: ; preds = %32, %28
%35 = load i8, i8* %1
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 3
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 (...) @atualiza()
br label %40
40: ; preds = %38, %34
%41 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%42 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.6 = [30 x i8] c"Entre com o codigo da opcao: \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [4 x i8] c"cls\00"
@.str.9 = [15 x i8] c"\0AEncerrando...\00"
@.str.10 = [6 x i8] c"pause\00"
@str = [17 x i8] c"\0AMenu de opcoes:\00"
@str.11 = [31 x i8] c"------------------------------\00"
@str.12 = [18 x i8] c"1 - Gerar arquivo\00"
@str.13 = [21 x i8] c"2 - Exibir o arquivo\00"
@str.14 = [24 x i8] c"3 - Atualizar o arquivo\00"
@str.15 = [21 x i8] c"4 - Sair do programa\00"
define void @menu() {
%1 = alloca i8
br label %2
2: ; preds = %2, %0
%3 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.11, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.12, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %1)
%11 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%12 = load i8, i8* %1
%13 = add i8 %12, -5
%14 = icmp ult i8 %13, -4
br i1 %14, label %2, label %15
15: ; preds = %2
%16 = icmp eq i8 %12, 1
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = call i32 (...) @gera()
%19 = load i8, i8* %1
br label %20
20: ; preds = %17, %15
%21 = phi i8 [ %19, %17 ], [ %12, %15 ]
%22 = icmp eq i8 %21, 2
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 (...) @exibe()
%25 = load i8, i8* %1
br label %26
26: ; preds = %23, %20
%27 = phi i8 [ %25, %23 ], [ %21, %20 ]
%28 = icmp eq i8 %27, 3
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @atualiza()
br label %31
31: ; preds = %29, %26
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
ret void
}