#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 num1, num2, opcao, res2;
  float res;
  do {
    printf("insira o primeiro numero:");
    scanf("%d", &num1);
    printf("insira o segundo numero:");
    scanf("%d", &num2);
    printf("Qual operação deseja?\n\n1 - Adição\n2 - Subtração\n3 - "
           "Multiplicação\n4 - divisão\n");
    scanf("%d", &opcao);
    if (opcao == 1) {
      res = num1 + num2;
      printf("%d + %d = %.2f", num1, num2, res);
    } else if (opcao == 2) {
      res = num1 - num2;
      printf("%d - %d = %.2f", num1, num2, res);
    } else if (opcao == 3) {
      res = num1 * num2;
      printf("%d X %d = %.2f", num1, num2, res);
    } else if (opcao == 4) {
      res = num1 / num2;
      printf("%d / %d = %.2f", num1, num2, res);
    }
    printf("deseja continuar?(1-s//2-n)");
    scanf("%d", &res2);
  } while (res2 == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    11c4 <main+0xa4>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1281 <main+0x161>
cmpl   $0x2,-0x10(%rbp)
jne    11ff <main+0xdf>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    127c <main+0x15c>
cmpl   $0x3,-0x10(%rbp)
jne    123b <main+0x11b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1277 <main+0x157>
cmpl   $0x4,-0x10(%rbp)
jne    1272 <main+0x152>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe50(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1277 <main+0x157>
jmp    127c <main+0x15c>
jmp    1281 <main+0x161>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd84(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
je     112f <main+0xf>
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
lea    0xee5(%rip),%rbx
lea    0xf52(%rip),%rbp
lea    0x14(%rsp),%r14
lea    0xf2a(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xe9c(%rip),%r13
jmp    11b8 <main+0x88>
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
mov    %esi,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee4(%rip),%rdi
mov    %ecx,%edx
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
jne    1294 <main+0x164>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1198 <main+0x68>
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    0xe12(%rip),%rdi
jmp    1191 <main+0x61>
nopl   0x0(%rax)
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %esi,%eax
sub    %edx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf7(%rip),%rdi
jmp    1191 <main+0x61>
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    0xdd5(%rip),%rdi
jmp    1191 <main+0x61>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"insira o primeiro numero:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"insira o segundo numero:\00"
@.str.3 = [88 x i8] c"Qual opera\C3\A7\C3\A3o deseja?\0A\0A1 - Adi\C3\A7\C3\A3o\0A2 - Subtra\C3\A7\C3\A3o\0A3 - Multiplica\C3\A7\C3\A3o\0A4 - divis\C3\A3o\0A\00"
@.str.4 = [15 x i8] c"%d + %d = %.2f\00"
@.str.5 = [15 x i8] c"%d - %d = %.2f\00"
@.str.6 = [15 x i8] c"%d X %d = %.2f\00"
@.str.7 = [15 x i8] c"%d / %d = %.2f\00"
@.str.8 = [28 x i8] c"deseja 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 = %71, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %26
16: ; preds = %7
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
%20 = sitofp i32 %19 to float
store float %20, float* %6
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = load float, float* %6
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %21, i32 %22, double %24)
br label %68
26: ; preds = %7
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = sub nsw i32 %30, %31
%33 = sitofp i32 %32 to float
store float %33, float* %6
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = load float, float* %6
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32 %35, double %37)
br label %67
39: ; preds = %26
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 3
br i1 %41, label %42, label %52
42: ; preds = %39
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = mul nsw i32 %43, %44
%46 = sitofp i32 %45 to float
store float %46, float* %6
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = load float, float* %6
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %47, i32 %48, double %50)
br label %66
52: ; preds = %39
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 4
br i1 %54, label %55, label %65
55: ; preds = %52
%56 = load i32, i32* %2
%57 = load i32, i32* %3
%58 = sdiv i32 %56, %57
%59 = sitofp i32 %58 to float
store float %59, float* %6
%60 = load i32, i32* %2
%61 = load i32, i32* %3
%62 = load float, float* %6
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %60, i32 %61, double %63)
br label %65
65: ; preds = %55, %52
br label %66
66: ; preds = %65, %42
br label %67
67: ; preds = %66, %29
br label %68
68: ; preds = %67, %16
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%70 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %71
71: ; preds = %68
%72 = load i32, i32* %5
%73 = icmp eq i32 %72, 1
br i1 %73, label %7, label %74
74: ; preds = %71
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"insira o primeiro numero:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"insira o segundo numero:\00"
@.str.4 = [15 x i8] c"%d + %d = %.2f\00"
@.str.5 = [15 x i8] c"%d - %d = %.2f\00"
@.str.6 = [15 x i8] c"%d X %d = %.2f\00"
@.str.7 = [15 x i8] c"%d / %d = %.2f\00"
@.str.8 = [28 x i8] c"deseja continuar?(1-s//2-n)\00"
@str = [87 x i8] c"Qual opera\C3\A7\C3\A3o deseja?\0A\0A1 - Adi\C3\A7\C3\A3o\0A2 - Subtra\C3\A7\C3\A3o\0A3 - Multiplica\C3\A7\C3\A3o\0A4 - divis\C3\A3o\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 = %45, %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([87 x i8], [87 x i8]* @str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
switch i32 %16, label %45 [
i32 1, label %17
i32 2, label %24
i32 3, label %31
i32 4, label %38
]
17: ; preds = %9
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = add nsw i32 %19, %18
%21 = sitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %19, double %22)
br label %45
24: ; preds = %9
%25 = load i32, i32* %1
%26 = load i32, i32* %2
%27 = sub nsw i32 %25, %26
%28 = sitofp i32 %27 to float
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %25, i32 %26, double %29)
br label %45
31: ; preds = %9
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = mul nsw i32 %33, %32
%35 = sitofp i32 %34 to float
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %32, i32 %33, double %36)
br label %45
38: ; preds = %9
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = sdiv i32 %39, %40
%42 = sitofp i32 %41 to float
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %39, i32 %40, double %43)
br label %45
45: ; preds = %9, %24, %38, %31, %17
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 1
br i1 %49, label %9, label %50
50: ; preds = %45
ret i32 0
}