#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*/ aula_04();
int /*<<< orphan*/ aula_20170928();
int /*<<< orphan*/ aula_file2();
int /*<<< orphan*/ aux_isNumber(char);
int /*<<< orphan*/ batalha_naval();
int /*<<< orphan*/ campo_minado();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ gasolina();
char getchar();
int /*<<< orphan*/ jogo_da_velha();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char, int /*<<< orphan*/);
int /*<<< orphan*/ strupr(char);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ testa_isNumber();
int menu() {
  char escolha;
  while (escolha != '0') {
    system("cls");
    printf("========== MENU ===========\n");
    printf("1. Jogo da Velha\n");
    printf("2. Campo Minado\n");
    printf("3. Batalha Naval\n");
    printf("4. Aula de Ponteiros\n");
    printf("5. Aula 28/09\n");
    printf("6. \n");
    printf("7. \n");
    printf("8. Teste da nova funcionalidade\n");
    printf("9. teste do meu amor\n");
    printf("G. Segunda aula de File\n");
    printf("0. Sair\n");
    printf("===========================\n");
    printf("Digite uma opção [1 - 0]: ");
    escolha = getchar();
    if (!aux_isNumber(escolha)) {
      strcat(escolha, strupr(escolha));
    }
    switch (escolha) {
    case '0':
      return 0;
    case '1':
      jogo_da_velha();
      break;
    case '2':
      campo_minado();
      break;
    case '3':
      batalha_naval();
      break;
    case '4':
      aula_04();
      break;
    case '5':
      aula_20170928();
      break;
    case '6':
    case '7':
    case '8':
      testa_isNumber();
      break;
    case 'G':
      aula_file2();
      break;
    case '9':
      gasolina();
      break;
    }
    fflush(stdin);
  }
  return escolha;
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
je     1395 <menu+0x1a5>
lea    0xe54(%rip),%rdi
call   1050 <system@plt>
lea    0xe4c(%rip),%rdi
call   1060 <printf@plt>
lea    0xe5d(%rip),%rdi
call   1060 <printf@plt>
lea    0xe63(%rip),%rdi
call   1060 <printf@plt>
lea    0xe68(%rip),%rdi
call   1060 <printf@plt>
lea    0xe6e(%rip),%rdi
call   1060 <printf@plt>
lea    0xe78(%rip),%rdi
call   1060 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1060 <printf@plt>
lea    0xe74(%rip),%rdi
call   1060 <printf@plt>
lea    0xe6d(%rip),%rdi
call   1060 <printf@plt>
lea    0xe82(%rip),%rdi
call   1060 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1060 <printf@plt>
lea    0xe99(%rip),%rdi
call   1060 <printf@plt>
lea    0xe96(%rip),%rdi
call   1060 <printf@plt>
lea    0xea7(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1040 <aux_isNumber@plt>
cmp    $0x0,%eax
jne    12f1 <menu+0x101>
mov    -0x5(%rbp),%al
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%edi
call   10b0 <strupr@plt>
mov    %eax,%esi
mov    -0x6(%rbp),%al
movsbl %al,%edi
call   1100 <strcat@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x17,%eax
ja     1382 <menu+0x192>
mov    -0x10(%rbp),%rax
lea    0xcee(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    139c <menu+0x1ac>
mov    $0x0,%al
call   10e0 <jogo_da_velha@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   10d0 <campo_minado@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   1070 <batalha_naval@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   10f0 <aula_04@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   10a0 <aula_20170928@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   1030 <testa_isNumber@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   1090 <aula_file2@plt>
jmp    1382 <menu+0x192>
mov    $0x0,%al
call   1110 <gasolina@plt>
mov    0x2c5f(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
jmp    11f8 <menu+0x8>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
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    0xf3d(%rip),%r15
lea    0xe4b(%rip),%r12
mov    0x2dc8(%rip),%rbp
lea    0xdd9(%rip),%r14
jmp    1242 <menu+0x42>
xor    %eax,%eax
call   1120 <gasolina@plt>
mov    0x0(%rbp),%edi
call   10d0 <fflush@plt>
cmp    $0x30,%r13b
je     1381 <menu+0x181>
lea    0xe17(%rip),%rdi
call   1060 <system@plt>
lea    0xe2c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe41(%rip),%rdi
call   1040 <puts@plt>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
lea    0xe55(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
lea    0xe62(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1070 <printf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%r13d
movsbl %al,%ebx
mov    %ebx,%edi
call   1050 <aux_isNumber@plt>
test   %eax,%eax
jne    1316 <menu+0x116>
mov    %ebx,%edi
call   10c0 <strupr@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1110 <strcat@plt>
add    $0xffffffd0,%ebx
cmp    $0x17,%ebx
ja     1230 <menu+0x30>
xor    %eax,%eax
movslq (%r14,%rbx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1030 <testa_isNumber@plt>
jmp    1230 <menu+0x30>
xor    %eax,%eax
call   10f0 <jogo_da_velha@plt>
jmp    1230 <menu+0x30>
xor    %eax,%eax
call   10e0 <campo_minado@plt>
jmp    1230 <menu+0x30>
xor    %eax,%eax
call   1080 <batalha_naval@plt>
jmp    1230 <menu+0x30>
xor    %eax,%eax
call   1100 <aula_04@plt>
jmp    1230 <menu+0x30>
xor    %eax,%eax
call   10b0 <aula_20170928@plt>
jmp    1230 <menu+0x30>
xor    %eax,%eax
call   10a0 <aula_file2@plt>
jmp    1230 <menu+0x30>
mov    $0x30,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [29 x i8] c"========== MENU ===========\0A\00"
@.str.2 = [18 x i8] c"1. Jogo da Velha\0A\00"
@.str.3 = [17 x i8] c"2. Campo Minado\0A\00"
@.str.4 = [18 x i8] c"3. Batalha Naval\0A\00"
@.str.5 = [22 x i8] c"4. Aula de Ponteiros\0A\00"
@.str.6 = [15 x i8] c"5. Aula 28/09\0A\00"
@.str.7 = [5 x i8] c"6. \0A\00"
@.str.8 = [5 x i8] c"7. \0A\00"
@.str.9 = [33 x i8] c"8. Teste da nova funcionalidade\0A\00"
@.str.10 = [22 x i8] c"9. teste do meu amor\0A\00"
@.str.11 = [25 x i8] c"G. Segunda aula de File\0A\00"
@.str.12 = [9 x i8] c"0. Sair\0A\00"
@.str.13 = [29 x i8] c"===========================\0A\00"
@.str.14 = [29 x i8] c"Digite uma op\C3\A7\C3\A3o [1 - 0]: \00"
@stdin = global i32 0
define i32 @menu() {
%1 = alloca i32
%2 = alloca i8
br label %3
3: ; preds = %52, %0
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 48
br i1 %6, label %7, label %55
7: ; preds = %3
%8 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
%23 = call signext i8 (...) @getchar()
store i8 %23, i8* %2
%24 = load i8, i8* %2
%25 = call i32 @aux_isNumber(i8 signext %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %32, label %27
27: ; preds = %7
%28 = load i8, i8* %2
%29 = load i8, i8* %2
%30 = call i32 @strupr(i8 signext %29)
%31 = call i32 @strcat(i8 signext %28, i32 %30)
br label %32
32: ; preds = %27, %7
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
switch i32 %34, label %52 [
i32 48, label %35
i32 49, label %36
i32 50, label %38
i32 51, label %40
i32 52, label %42
i32 53, label %44
i32 54, label %46
i32 55, label %46
i32 56, label %46
i32 71, label %48
i32 57, label %50
]
35: ; preds = %32
store i32 0, i32* %1
br label %58
36: ; preds = %32
%37 = call i32 (...) @jogo_da_velha()
br label %52
38: ; preds = %32
%39 = call i32 (...) @campo_minado()
br label %52
40: ; preds = %32
%41 = call i32 (...) @batalha_naval()
br label %52
42: ; preds = %32
%43 = call i32 (...) @aula_04()
br label %52
44: ; preds = %32
%45 = call i32 (...) @aula_20170928()
br label %52
46: ; preds = %32, %32, %32
%47 = call i32 (...) @testa_isNumber()
br label %52
48: ; preds = %32
%49 = call i32 (...) @aula_file2()
br label %52
50: ; preds = %32
%51 = call i32 (...) @gasolina()
br label %52
52: ; preds = %32, %50, %48, %46, %44, %42, %40, %38, %36
%53 = load i32, i32* @stdin
%54 = call i32 @fflush(i32 %53)
br label %3
55: ; preds = %3
%56 = load i8, i8* %2
%57 = sext i8 %56 to i32
store i32 %57, i32* %1
br label %58
58: ; preds = %55, %35
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.14 = [29 x i8] c"Digite uma op\C3\A7\C3\A3o [1 - 0]: \00"
@stdin = global i32 0
@str = [28 x i8] c"========== MENU ===========\00"
@str.15 = [17 x i8] c"1. Jogo da Velha\00"
@str.16 = [16 x i8] c"2. Campo Minado\00"
@str.17 = [17 x i8] c"3. Batalha Naval\00"
@str.18 = [21 x i8] c"4. Aula de Ponteiros\00"
@str.19 = [14 x i8] c"5. Aula 28/09\00"
@str.20 = [4 x i8] c"6. \00"
@str.21 = [4 x i8] c"7. \00"
@str.22 = [32 x i8] c"8. Teste da nova funcionalidade\00"
@str.23 = [21 x i8] c"9. teste do meu amor\00"
@str.24 = [24 x i8] c"G. Segunda aula de File\00"
@str.25 = [8 x i8] c"0. Sair\00"
@str.26 = [28 x i8] c"===========================\00"
define i32 @menu() {
br label %1
1: ; preds = %0, %41
%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 ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.21, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.22, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.24, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.25, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.26, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
%17 = tail call signext i8 (...) @getchar()
%18 = tail call i32 @aux_isNumber(i8 signext %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %1
%21 = tail call i32 @strupr(i8 signext %17)
%22 = tail call i32 @strcat(i8 signext %17, i32 %21)
br label %23
23: ; preds = %20, %1
%24 = sext i8 %17 to i32
switch i32 %24, label %41 [
i32 48, label %45
i32 49, label %25
i32 50, label %27
i32 51, label %29
i32 52, label %31
i32 53, label %33
i32 54, label %35
i32 55, label %35
i32 56, label %35
i32 71, label %37
i32 57, label %39
]
25: ; preds = %23
%26 = tail call i32 (...) @jogo_da_velha()
br label %41
27: ; preds = %23
%28 = tail call i32 (...) @campo_minado()
br label %41
29: ; preds = %23
%30 = tail call i32 (...) @batalha_naval()
br label %41
31: ; preds = %23
%32 = tail call i32 (...) @aula_04()
br label %41
33: ; preds = %23
%34 = tail call i32 (...) @aula_20170928()
br label %41
35: ; preds = %23, %23, %23
%36 = tail call i32 (...) @testa_isNumber()
br label %41
37: ; preds = %23
%38 = tail call i32 (...) @aula_file2()
br label %41
39: ; preds = %23
%40 = tail call i32 (...) @gasolina()
br label %41
41: ; preds = %23, %39, %37, %35, %33, %31, %29, %27, %25
%42 = load i32, i32* @stdin
%43 = tail call i32 @fflush(i32 %42)
%44 = icmp eq i8 %17, 48
br i1 %44, label %45, label %1
45: ; preds = %23, %41
%46 = phi i32 [ 0, %23 ], [ 48, %41 ]
ret i32 %46
}