#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 decisao, num1, num2, subtracao, multi, div;
  printf("Calculadora em fase de Teste >>> Versão 0.1\n");
  printf("Qual operação deseja fazer?\n(1) Soma\n(2) Subtração\n(3) "
         "Multiplicação\n(4) Divisão\n ");
  scanf("%i", &decisao);
  if (decisao == 1) {
    printf("Digite os númeors a serem somados:\n ");
    scanf("%i%i", &num1, &num2);
    int soma = num1 + num2;
    printf("%i\n", soma);
  }
  if (decisao == 2) {
    printf("Digite os números a serem subtraidos:\n ");
    scanf("%i%i", &num1, &num2);
    int subtracao = num1 - num2;
    printf("%i\n", subtracao);
  }
  if (decisao == 3) {
    printf("Digite os números a serem multiplicados:\n ");
    scanf("%i%i", &num1, &num2);
    int multi = num1 * num2;
    printf("%i\n", multi);
  }
  if (decisao == 4) {
    printf("Digite os números a serem divididos:\n ");
    scanf("%i%i", &num1, &num2);
    int div = num1 / num2;
    printf("%i\n", div);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf5e(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11a5 <main+0x85>
lea    0xf1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf32(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11ed <main+0xcd>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    1236 <main+0x116>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
jne    127f <main+0x15f>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xfcb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2d(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x1,%eax
je     11c7 <main+0x97>
cmp    $0x2,%eax
je     1210 <main+0xe0>
cmp    $0x3,%eax
je     1259 <main+0x129>
cmp    $0x4,%eax
jne    11c0 <main+0x90>
lea    0xf56(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeea(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
cltd
idivl  0xc(%rsp)
lea    0xece(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
add    0x10(%rsp),%esi
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
jne    1173 <main+0x43>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5b(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%esi
sub    0xc(%rsp),%esi
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%eax
cmp    $0x3,%eax
jne    117c <main+0x4c>
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe12(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
imul   0x10(%rsp),%esi
lea    0xdf6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%eax
cmp    $0x4,%eax
je     1181 <main+0x51>
jmp    11c0 <main+0x90>

LLVM IR (-O0):
@.str = [46 x i8] c"Calculadora em fase de Teste >>> Vers\C3\A3o 0.1\0A\00"
@.str.1 = [90 x i8] c"Qual opera\C3\A7\C3\A3o deseja fazer?\0A(1) Soma\0A(2) Subtra\C3\A7\C3\A3o\0A(3) Multiplica\C3\A7\C3\A3o\0A(4) Divis\C3\A3o\0A \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [38 x i8] c"Digite os n\C3\BAmeors a serem somados:\0A \00"
@.str.4 = [5 x i8] c"%i%i\00"
@.str.5 = [4 x i8] c"%i\0A\00"
@.str.6 = [41 x i8] c"Digite os n\C3\BAmeros a serem subtraidos:\0A \00"
@.str.7 = [44 x i8] c"Digite os n\C3\BAmeros a serem multiplicados:\0A \00"
@.str.8 = [40 x i8] c"Digite os n\C3\BAmeros a serem divididos:\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %25
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %4)
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %17, %0
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %36
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %4)
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = sub nsw i32 %31, %32
store i32 %33, i32* %9
%34 = load i32, i32* %9
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %28, %25
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 3
br i1 %38, label %39, label %47
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
%41 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %4)
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = mul nsw i32 %42, %43
store i32 %44, i32* %10
%45 = load i32, i32* %10
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %39, %36
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 4
br i1 %49, label %50, label %58
50: ; preds = %47
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%52 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %4)
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = sdiv i32 %53, %54
store i32 %55, i32* %11
%56 = load i32, i32* %11
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %50, %47
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [90 x i8] c"Qual opera\C3\A7\C3\A3o deseja fazer?\0A(1) Soma\0A(2) Subtra\C3\A7\C3\A3o\0A(3) Multiplica\C3\A7\C3\A3o\0A(4) Divis\C3\A3o\0A \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [38 x i8] c"Digite os n\C3\BAmeors a serem somados:\0A \00"
@.str.4 = [5 x i8] c"%i%i\00"
@.str.5 = [4 x i8] c"%i\0A\00"
@.str.6 = [41 x i8] c"Digite os n\C3\BAmeros a serem subtraidos:\0A \00"
@.str.7 = [44 x i8] c"Digite os n\C3\BAmeros a serem multiplicados:\0A \00"
@.str.8 = [40 x i8] c"Digite os n\C3\BAmeros a serem divididos:\0A \00"
@str = [45 x i8] c"Calculadora em fase de Teste >>> Vers\C3\A3o 0.1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([90 x i8], [90 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %1
br label %20
20: ; preds = %12, %0
%21 = phi i32 [ %19, %12 ], [ %10, %0 ]
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3)
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = sub nsw i32 %26, %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %1
br label %31
31: ; preds = %23, %20
%32 = phi i32 [ %30, %23 ], [ %21, %20 ]
%33 = icmp eq i32 %32, 3
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3)
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = mul nsw i32 %38, %37
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %1
br label %42
42: ; preds = %34, %31
%43 = phi i32 [ %41, %34 ], [ %32, %31 ]
%44 = icmp eq i32 %43, 4
br i1 %44, label %45, label %52
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3)
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = sdiv i32 %48, %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %45, %42
ret i32 0
}