#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*/ cEhPositivo(int);
int /*<<< orphan*/ ehPar(int, int);
int escolheOpcao();
int /*<<< orphan*/ escolheValores(int *, int *, int *);
int /*<<< orphan*/ finalizaMenu();
int /*<<< orphan*/ imprimeRange(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ soma(int, int, int);
int /*<<< orphan*/ system(char *);
int main() {
  int a = 0, b = 0, c = 0, opt = 0;
  printf("Exercício pratico 01\n\n");
  escolheValores(&a, &b, &c);
  do {
    opt = escolheOpcao();
    switch (opt) {
    case 1:
      soma(a, b, c);
      break;
    case 2:
      ehPar(a, b);
      break;
    case 3:
      cEhPositivo(c);
      break;
    case 4:
      imprimeRange(a, b, c);
      break;
    case 5:
      escolheValores(&a, &b, &c);
      break;
    case 6:
      finalizaMenu();
      break;
    default:
      printf("Escolha uma opcao valida!");
      break;
    }
    printf("\n");
    system("pause");
    system("cls");
  } while (opt != 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe56(%rip),%rdi
call   1080 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   10b0 <escolheValores@plt>
xor    %eax,%eax
call   1050 <escolheOpcao@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     1270 <main+0xe0>
mov    -0x20(%rbp),%rax
lea    0xdfe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1090 <soma@plt>
jmp    127c <main+0xec>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <ehPar@plt>
jmp    127c <main+0xec>
mov    -0x10(%rbp),%edi
call   1070 <cEhPositivo@plt>
jmp    127c <main+0xec>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   10a0 <imprimeRange@plt>
jmp    127c <main+0xec>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   10b0 <escolheValores@plt>
jmp    127c <main+0xec>
mov    $0x0,%al
call   1040 <finalizaMenu@plt>
jmp    127c <main+0xec>
lea    0xdb9(%rip),%rdi
call   1080 <printf@plt>
lea    0xdab(%rip),%rdi
call   1080 <printf@plt>
lea    0xdbb(%rip),%rdi
call   1060 <system@plt>
lea    0xdb5(%rip),%rdi
call   1060 <system@plt>
cmpl   $0x6,-0x14(%rbp)
jne    11d8 <main+0x48>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xe5f(%rip),%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r13
mov    %r15,%rsi
mov    %r13,%rdx
call   10d0 <escolheValores@plt>
lea    0xe2f(%rip),%rbx
lea    0xe2e(%rip),%rbp
lea    0xdef(%rip),%r14
jmp    1240 <main+0x90>
lea    0xdfe(%rip),%rdi
call   10a0 <printf@plt>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1080 <system@plt>
mov    %rbp,%rdi
call   1080 <system@plt>
cmp    $0x6,%r12d
je     12be <main+0x10e>
xor    %eax,%eax
call   1070 <escolheOpcao@plt>
mov    %eax,%r12d
lea    -0x1(%r12),%eax
cmp    $0x5,%eax
ja     1213 <main+0x63>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0xc(%rsp),%edi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
call   10b0 <soma@plt>
jmp    1220 <main+0x70>
mov    0xc(%rsp),%edi
mov    0x14(%rsp),%esi
call   1040 <ehPar@plt>
jmp    1220 <main+0x70>
mov    0x10(%rsp),%edi
call   1090 <cEhPositivo@plt>
jmp    1220 <main+0x70>
mov    0xc(%rsp),%edi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
call   10c0 <imprimeRange@plt>
jmp    1220 <main+0x70>
lea    0xc(%rsp),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   10d0 <escolheValores@plt>
jmp    1220 <main+0x70>
xor    %eax,%eax
call   1060 <finalizaMenu@plt>
jmp    1220 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Exerc\C3\ADcio pratico 01\0A\0A\00"
@.str.1 = [26 x i8] c"Escolha uma opcao valida!\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [6 x i8] c"pause\00"
@.str.4 = [4 x i8] c"cls\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @escolheValores(i32* %2, i32* %3, i32* %4)
br label %8
8: ; preds = %38, %0
%9 = call i32 (...) @escolheOpcao()
store i32 %9, i32* %5
%10 = load i32, i32* %5
switch i32 %10, label %32 [
i32 1, label %11
i32 2, label %16
i32 3, label %20
i32 4, label %23
i32 5, label %28
i32 6, label %30
]
11: ; preds = %8
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @soma(i32 %12, i32 %13, i32 %14)
br label %34
16: ; preds = %8
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 @ehPar(i32 %17, i32 %18)
br label %34
20: ; preds = %8
%21 = load i32, i32* %4
%22 = call i32 @cEhPositivo(i32 %21)
br label %34
23: ; preds = %8
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 @imprimeRange(i32 %24, i32 %25, i32 %26)
br label %34
28: ; preds = %8
%29 = call i32 @escolheValores(i32* %2, i32* %3, i32* %4)
br label %34
30: ; preds = %8
%31 = call i32 (...) @finalizaMenu()
br label %34
32: ; preds = %8
%33 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %30, %28, %23, %20, %16, %11
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %34
%39 = load i32, i32* %5
%40 = icmp ne i32 %39, 6
br i1 %40, label %8, label %41
41: ; preds = %38
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"Escolha uma opcao valida!\00"
@.str.3 = [6 x i8] c"pause\00"
@.str.4 = [4 x i8] c"cls\00"
@str = [23 x i8] c"Exerc\C3\ADcio pratico 01\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%8 = call i32 @escolheValores(i32* %1, i32* %2, i32* %3)
br label %9
9: ; preds = %34, %0
%10 = call i32 (...) @escolheOpcao()
switch i32 %10, label %32 [
i32 1, label %11
i32 2, label %16
i32 3, label %20
i32 4, label %23
i32 5, label %28
i32 6, label %30
]
11: ; preds = %9
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @soma(i32 %12, i32 %13, i32 %14)
br label %34
16: ; preds = %9
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @ehPar(i32 %17, i32 %18)
br label %34
20: ; preds = %9
%21 = load i32, i32* %3
%22 = call i32 @cEhPositivo(i32 %21)
br label %34
23: ; preds = %9
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 @imprimeRange(i32 %24, i32 %25, i32 %26)
br label %34
28: ; preds = %9
%29 = call i32 @escolheValores(i32* %1, i32* %2, i32* %3)
br label %34
30: ; preds = %9
%31 = call i32 (...) @finalizaMenu()
br label %34
32: ; preds = %9
%33 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %30, %28, %23, %20, %16, %11
%35 = call i32 @putchar(i32 10)
%36 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i32 %10, 6
br i1 %38, label %39, label %9
39: ; preds = %34
ret i32 0
}