#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int operador;
  int operandoa;
  int operandob;
  int resultado;
  scanf("%d", &operador);
  scanf("%d", &operandoa);
  scanf("%d", &operandob);
  if (operador == 1) {
    resultado = operandoa + operandob;
  } else if (operador == 2) {
    resultado = operandoa - operandob;
  } else if (operador == 3) {
    resultado = operandoa / operandob;
  } else if (operador == 4) {
    resultado = operandoa * operandob;
  }
  printf("Resultado: %d\n", resultado);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1177 <main+0x57>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11cb <main+0xab>
cmpl   $0x2,-0x8(%rbp)
jne    118f <main+0x6f>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0xa6>
cmpl   $0x3,-0x8(%rbp)
jne    11a8 <main+0x88>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x14(%rbp)
jmp    11c1 <main+0xa1>
cmpl   $0x4,-0x8(%rbp)
jne    11bc <main+0x9c>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11c1 <main+0xa1>
jmp    11c6 <main+0xa6>
jmp    11cb <main+0xab>
mov    -0x14(%rbp),%esi
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
lea    0xe9f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x4(%rsp),%esi
add    0x8(%rsp),%esi
jmp    1194 <main+0x74>
mov    0x8(%rsp),%eax
cltd
idivl  0x4(%rsp)
mov    %eax,%esi
jmp    1194 <main+0x74>
mov    0x4(%rsp),%esi
imul   0x8(%rsp),%esi
jmp    1194 <main+0x74>
mov    0x8(%rsp),%esi
sub    0x4(%rsp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c"Resultado: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
store i32 %14, i32* %5
br label %39
15: ; preds = %0
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %5
br label %38
22: ; preds = %15
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = sdiv i32 %26, %27
store i32 %28, i32* %5
br label %37
29: ; preds = %22
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 4
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = mul nsw i32 %33, %34
store i32 %35, i32* %5
br label %36
36: ; preds = %32, %29
br label %37
37: ; preds = %36, %25
br label %38
38: ; preds = %37, %18
br label %39
39: ; preds = %38, %11
%40 = load i32, i32* %5
%41 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c"Resultado: %d\0A\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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %1
switch i32 %10, label %27 [
i32 1, label %11
i32 2, label %15
i32 3, label %19
i32 4, label %23
]
11: ; preds = %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, %12
br label %28
15: ; preds = %0
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
br label %28
19: ; preds = %0
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = sdiv i32 %20, %21
br label %28
23: ; preds = %0
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = mul nsw i32 %25, %24
br label %28
27: ; preds = %0
unreachable
28: ; preds = %15, %23, %19, %11
%29 = phi i32 [ %14, %11 ], [ %18, %15 ], [ %22, %19 ], [ %26, %23 ]
%30 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %29)
ret i32 0
}