#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*/ LC_ALL;
scalar_t__ exercicioExiste(int);
int /*<<< orphan*/ getExercicio(int);
int /*<<< orphan*/ layout();
int /*<<< orphan*/ limpaMemoria();
int /*<<< orphan*/ limpaTela();
int /*<<< orphan*/ pausa();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
renderizarMenu() {
  setlocale(LC_ALL, "");
  int opcao;
  while (opcao != 0) {
    layout();
    scanf("%d", &opcao);
    if (exercicioExiste(opcao)) {
      limpaTela();
      getExercicio(opcao);
      pausa();
    } else {
      if (opcao != 0) {
        limpaTela();
        printf("Opção: [%d] não existe, por favor registro-a com a função "
               "registrarOpcao();",
               opcao);
        pausa();
      } else {
        printf("Saindo......");
        limpaMemoria();
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<renderizarMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1080 <setlocale@plt>
cmpl   $0x0,-0x4(%rbp)
je     1248 <renderizarMenu+0xb8>
mov    $0x0,%al
call   1040 <layout@plt>
lea    0xe3b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <exercicioExiste@plt>
cmp    $0x0,%rax
je     11fb <renderizarMenu+0x6b>
mov    $0x0,%al
call   1070 <limpaTela@plt>
mov    -0x4(%rbp),%edi
call   1050 <getExercicio@plt>
mov    $0x0,%al
call   10b0 <pausa@plt>
jmp    1243 <renderizarMenu+0xb3>
cmpl   $0x0,-0x4(%rbp)
je     1229 <renderizarMenu+0x99>
mov    $0x0,%al
call   1070 <limpaTela@plt>
mov    -0x4(%rbp),%esi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   10b0 <pausa@plt>
jmp    123e <renderizarMenu+0xae>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <limpaMemoria@plt>
jmp    1243 <renderizarMenu+0xb3>
jmp    11ad <renderizarMenu+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<renderizarMenu>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1080 <setlocale@plt>
lea    0xe4c(%rip),%r14
lea    0x4(%rsp),%rbx
lea    0xe94(%rip),%r15
lea    0xe3c(%rip),%r12
jmp    11ee <renderizarMenu+0x5e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <limpaTela@plt>
mov    0x4(%rsp),%edi
call   1050 <getExercicio@plt>
xor    %eax,%eax
call   10b0 <pausa@plt>
cmpl   $0x0,0x4(%rsp)
je     1244 <renderizarMenu+0xb4>
xor    %eax,%eax
call   1040 <layout@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
call   10a0 <exercicioExiste@plt>
test   %rax,%rax
jne    11d0 <renderizarMenu+0x40>
cmpl   $0x0,0x4(%rsp)
je     122c <renderizarMenu+0x9c>
xor    %eax,%eax
call   1070 <limpaTela@plt>
mov    0x4(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e0 <renderizarMenu+0x50>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <limpaMemoria@plt>
cmpl   $0x0,0x4(%rsp)
jne    11ee <renderizarMenu+0x5e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [81 x i8] c"Op\C3\A7\C3\A3o: [%d] n\C3\A3o existe, por favor registro-a com a fun\C3\A7\C3\A3o registrarOpcao();\00"
@.str.3 = [13 x i8] c"Saindo......\00"
define i32 @renderizarMenu() {
%1 = alloca i32
%2 = load i32, i32* @LC_ALL
%3 = call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %30, %0
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %31
7: ; preds = %4
%8 = call i32 (...) @layout()
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = call i64 @exercicioExiste(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = call i32 (...) @limpaTela()
%15 = load i32, i32* %1
%16 = call i32 @getExercicio(i32 %15)
%17 = call i32 (...) @pausa()
br label %30
18: ; preds = %7
%19 = load i32, i32* %1
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = call i32 (...) @limpaTela()
%23 = load i32, i32* %1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = call i32 (...) @pausa()
br label %29
26: ; preds = %18
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 (...) @limpaMemoria()
br label %29
29: ; preds = %26, %21
br label %30
30: ; preds = %29, %13
br label %4
31: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [81 x i8] c"Op\C3\A7\C3\A3o: [%d] n\C3\A3o existe, por favor registro-a com a fun\C3\A7\C3\A3o registrarOpcao();\00"
@.str.3 = [13 x i8] c"Saindo......\00"
define i32 @renderizarMenu() {
%1 = alloca i32
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
br label %5
5: ; preds = %0, %27
%6 = call i32 (...) @layout()
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = call i64 @exercicioExiste(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %5
%12 = call i32 (...) @limpaTela()
%13 = load i32, i32* %1
%14 = call i32 @getExercicio(i32 %13)
%15 = call i32 (...) @pausa()
br label %27
16: ; preds = %5
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = call i32 (...) @limpaTela()
%21 = load i32, i32* %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = call i32 (...) @pausa()
br label %27
24: ; preds = %16
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 (...) @limpaMemoria()
br label %27
27: ; preds = %19, %24, %11
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %5
30: ; preds = %27
ret i32 0
}