#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*/ adicao(int, int);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ multiplicao(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ subtracao(int, int);
int /*<<< orphan*/ system(char *);
main() {
  int x, y, s;
  printf("Entre com dois numeros inteiros: ");
  scanf("%d %d", &x, &y);
  printf("Selecione a operacao desejada:\n1 - adicao\n2 - subtracao\n3 - "
         "multiplicacao\n");
  scanf("%d", &s);
  switch (s) {
  case 1:
    adicao(x, y);
    break;
  case 2:
    subtracao(x, y);
    break;
  case 3:
    multiplicao(x, y);
    break;
  default:
    printf("\nEntrada invalida!");
    break;
    return 0;
  }
  system("pause");
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1060 <printf@plt>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1080 <scanf@plt>
lea    0xe7d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xe6b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11f9 <main+0x89>
jmp    11d7 <main+0x67>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1209 <main+0x99>
jmp    11e8 <main+0x78>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1219 <main+0xa9>
jmp    1229 <main+0xb9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <adicao@plt>
jmp    1235 <main+0xc5>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <subtracao@plt>
jmp    1235 <main+0xc5>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <multiplicao@plt>
jmp    1235 <main+0xc5>
lea    0xe43(%rip),%rdi
call   1060 <printf@plt>
lea    0xe4a(%rip),%rdi
call   1050 <system@plt>
mov    $0x0,%al
call   1090 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xe75(%rip),%rdi
call   1070 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6a(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x3,%eax
je     11e9 <main+0x69>
cmp    $0x2,%eax
je     11f8 <main+0x78>
cmp    $0x1,%eax
jne    1207 <main+0x87>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <adicao@plt>
jmp    1213 <main+0x93>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1030 <multiplicao@plt>
jmp    1213 <main+0x93>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1080 <subtracao@plt>
jmp    1213 <main+0x93>
lea    0xe1a(%rip),%rdi
call   1070 <printf@plt>
lea    0xe21(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Entre com dois numeros inteiros: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [75 x i8] c"Selecione a operacao desejada:\0A1 - adicao\0A2 - subtracao\0A3 - multiplicacao\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [19 x i8] c"\0AEntrada invalida!\00"
@.str.5 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %4
switch i32 %9, label %22 [
i32 1, label %10
i32 2, label %14
i32 3, label %18
]
10: ; preds = %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @adicao(i32 %11, i32 %12)
br label %24
14: ; preds = %0
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @subtracao(i32 %15, i32 %16)
br label %24
18: ; preds = %0
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @multiplicao(i32 %19, i32 %20)
br label %24
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %18, %14, %10
%25 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Entre com dois numeros inteiros: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [19 x i8] c"\0AEntrada invalida!\00"
@.str.5 = [6 x i8] c"pause\00"
@str = [74 x i8] c"Selecione a operacao desejada:\0A1 - adicao\0A2 - subtracao\0A3 - multiplicacao\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 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
switch i32 %11, label %24 [
i32 1, label %12
i32 2, label %16
i32 3, label %20
]
12: ; preds = %0
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @adicao(i32 %13, i32 %14)
br label %26
16: ; preds = %0
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @subtracao(i32 %17, i32 %18)
br label %26
20: ; preds = %0
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = call i32 @multiplicao(i32 %21, i32 %22)
br label %26
24: ; preds = %0
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %20, %16, %12
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%28 = call i32 (...) @getch()
ret i32 0
}