#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int menu;
  int num1, num2;
  int continuar;
  float resultado;
  do {
    printf("\nQual operação deseja?");
    printf("\n1 - adição");
    printf("\n2 - subtração");
    printf("\n3 - multiplicação");
    printf("\n4 - divisão");
    printf("\n\nOpção:");
    scanf("%d", &menu);
    printf("\nEntre com num1:");
    scanf("%d", &num1);
    printf("\nEntre com num2:");
    scanf("%d", &num2);
    switch (menu) {
    case 1:
      resultado = num1 + num2;
      printf("\nResultado : %d + %d = %.2f", num1, num2, resultado);
      break;
    case 2:
      resultado = num1 - num2;
      printf("\nResultado : %d - %d = %.2f", num1, num2, resultado);
      break;
    case 3:
      resultado = num1 * num2;
      printf("\nResultado : %d * %d = %.2f", num1, num2, resultado);
      break;
    case 4:
      resultado = (float)num1 / num2;
      printf("\nResultado : %d / %d = %.2f", num1, num2, resultado);
      break;
    default:
      printf("\nOpcao inválida!!!");
    }
    printf("\nDeseja continuar(1-s/2-n)?");
    scanf("%d", &continuar);
  } while (continuar == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x29(%rbp)
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %rdi,-0x28(%rbp)
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x29(%rbp),%al
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x29(%rbp),%al
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     12c9 <main+0x1a9>
mov    -0x20(%rbp),%rax
lea    0xe09(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1b7>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe61(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1b7>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1b7>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe32(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1b7>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8a(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
je     112f <main+0xf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf41(%rip),%r14
lea    0xf4e(%rip),%rbx
lea    0x8(%rsp),%rbp
lea    0xfd7(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xeac(%rip),%r13
jmp    11a5 <main+0x85>
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %esi,%eax
sub    %edx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf39(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
jne    12ea <main+0x1ca>
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1270 <main+0x150>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    (%rdx,%rsi,1),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe32(%rip),%rdi
jmp    117e <main+0x5e>
xchg   %ax,%ax
lea    0xe94(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1185 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %edx,%eax
imul   %esi,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe24(%rip),%rdi
jmp    117e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%rsp),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
mov    0x8(%rsp),%edx
xorps  %xmm1,%xmm1
cvtsi2ss %edx,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0a(%rip),%rdi
jmp    117e <main+0x5e>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0AQual opera\C3\A7\C3\A3o deseja?\00"
@.str.1 = [14 x i8] c"\0A1 - adi\C3\A7\C3\A3o\00"
@.str.2 = [17 x i8] c"\0A2 - subtra\C3\A7\C3\A3o\00"
@.str.3 = [21 x i8] c"\0A3 - multiplica\C3\A7\C3\A3o\00"
@.str.4 = [14 x i8] c"\0A4 - divis\C3\A3o\00"
@.str.5 = [11 x i8] c"\0A\0AOp\C3\A7\C3\A3o:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [17 x i8] c"\0AEntre com num1:\00"
@.str.8 = [17 x i8] c"\0AEntre com num2:\00"
@.str.9 = [28 x i8] c"\0AResultado : %d + %d = %.2f\00"
@.str.10 = [28 x i8] c"\0AResultado : %d - %d = %.2f\00"
@.str.11 = [28 x i8] c"\0AResultado : %d * %d = %.2f\00"
@.str.12 = [28 x i8] c"\0AResultado : %d / %d = %.2f\00"
@.str.13 = [20 x i8] c"\0AOpcao inv\C3\A1lida!!!\00"
@.str.14 = [28 x i8] c"\0ADeseja continuar(1-s/2-n)?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
br label %7
7: ; preds = %66, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %2
switch i32 %19, label %61 [
i32 1, label %20
i32 2, label %30
i32 3, label %40
i32 4, label %50
]
20: ; preds = %7
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
%24 = sitofp i32 %23 to float
store float %24, float* %6
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = load float, float* %6
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %25, i32 %26, double %28)
br label %63
30: ; preds = %7
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = sub nsw i32 %31, %32
%34 = sitofp i32 %33 to float
store float %34, float* %6
%35 = load i32, i32* %3
%36 = load i32, i32* %4
%37 = load float, float* %6
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %35, i32 %36, double %38)
br label %63
40: ; preds = %7
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = mul nsw i32 %41, %42
%44 = sitofp i32 %43 to float
store float %44, float* %6
%45 = load i32, i32* %3
%46 = load i32, i32* %4
%47 = load float, float* %6
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %45, i32 %46, double %48)
br label %63
50: ; preds = %7
%51 = load i32, i32* %3
%52 = sitofp i32 %51 to float
%53 = load i32, i32* %4
%54 = sitofp i32 %53 to float
%55 = fdiv float %52, %54
store float %55, float* %6
%56 = load i32, i32* %3
%57 = load i32, i32* %4
%58 = load float, float* %6
%59 = fpext float %58 to double
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %56, i32 %57, double %59)
br label %63
61: ; preds = %7
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %63
63: ; preds = %61, %50, %40, %30, %20
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%65 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %5)
br label %66
66: ; preds = %63
%67 = load i32, i32* %5
%68 = icmp eq i32 %67, 1
br i1 %68, label %7, label %69
69: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AQual opera\C3\A7\C3\A3o deseja?\00"
@.str.1 = [14 x i8] c"\0A1 - adi\C3\A7\C3\A3o\00"
@.str.2 = [17 x i8] c"\0A2 - subtra\C3\A7\C3\A3o\00"
@.str.3 = [21 x i8] c"\0A3 - multiplica\C3\A7\C3\A3o\00"
@.str.4 = [14 x i8] c"\0A4 - divis\C3\A3o\00"
@.str.5 = [11 x i8] c"\0A\0AOp\C3\A7\C3\A3o:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [17 x i8] c"\0AEntre com num1:\00"
@.str.8 = [17 x i8] c"\0AEntre com num2:\00"
@.str.9 = [28 x i8] c"\0AResultado : %d + %d = %.2f\00"
@.str.10 = [28 x i8] c"\0AResultado : %d - %d = %.2f\00"
@.str.11 = [28 x i8] c"\0AResultado : %d * %d = %.2f\00"
@.str.12 = [28 x i8] c"\0AResultado : %d / %d = %.2f\00"
@.str.13 = [20 x i8] c"\0AOpcao inv\C3\A1lida!!!\00"
@.str.14 = [28 x i8] c"\0ADeseja continuar(1-s/2-n)?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
br label %9
9: ; preds = %53, %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %1
switch i32 %21, label %51 [
i32 1, label %22
i32 2, label %29
i32 3, label %36
i32 4, label %43
]
22: ; preds = %9
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = add nsw i32 %24, %23
%26 = sitofp i32 %25 to float
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %23, i32 %24, double %27)
br label %53
29: ; preds = %9
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = sub nsw i32 %30, %31
%33 = sitofp i32 %32 to float
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %30, i32 %31, double %34)
br label %53
36: ; preds = %9
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = mul nsw i32 %38, %37
%40 = sitofp i32 %39 to float
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %37, i32 %38, double %41)
br label %53
43: ; preds = %9
%44 = load i32, i32* %2
%45 = sitofp i32 %44 to float
%46 = load i32, i32* %3
%47 = sitofp i32 %46 to float
%48 = fdiv float %45, %47
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %44, i32 %46, double %49)
br label %53
51: ; preds = %9
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %53
53: ; preds = %51, %43, %36, %29, %22
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 1
br i1 %57, label %9, label %58
58: ; preds = %53
ret i32 0
}