#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, char *, int *);
int main(int argc, char **argv) {
  int a, b, resultado;
  char operacion;
  printf("Introduce dos numeros enteros para hacer las operacions: ");
  scanf("%d %c %d", &a, &operacion, &b);
  switch (operacion) {
  case '+':
    printf("La suma de %d y %d es %d", a, b, a + b);
    break;
  case '-':
    printf("La resta de %d y %d es %d", a, b, a - b);
    break;
  case '*':
    printf("El producto de %d y %d es %d", a, b, a * b);
    break;
  case '/':
    printf("La división de %d y %d es %d", a, b, a / b);
    break;
  case '%':
    printf("El modulo de %d y %d es %d", a, b, a % b);
    break;
  default:
    printf("La operación introducida no es correcta.");
    break;
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeef(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1b(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x1d(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x1d(%rbp),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0xa,%eax
ja     1234 <main+0x114>
mov    -0x28(%rbp),%rax
lea    0xe83(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
imul   -0x18(%rbp),%ecx
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    -0x2c(%rbp),%edx
mov    %eax,%ecx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,%ecx
mov    -0x30(%rbp),%edx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf01(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf2d(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <scanf@plt>
movsbl 0xf(%rsp),%eax
add    $0xffffffdb,%eax
cmp    $0xa,%eax
ja     1187 <main+0x67>
lea    0xe9f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%r8d
mov    %esi,%eax
cltd
idiv   %r8d
mov    %edx,%ecx
lea    0xf5b(%rip),%rdi
mov    %r8d,%edx
jmp    11ee <main+0xce>
lea    0xf6a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %edx,%ecx
imul   %esi,%ecx
lea    0xef7(%rip),%rdi
jmp    11ee <main+0xce>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    (%rdx,%rsi,1),%ecx
lea    0xeb0(%rip),%rdi
jmp    11ee <main+0xce>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %esi,%ecx
sub    %edx,%ecx
lea    0xeb4(%rip),%rdi
jmp    11ee <main+0xce>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
mov    %esi,%eax
cltd
idiv   %ecx
lea    0xed5(%rip),%rdi
mov    %ecx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Introduce dos numeros enteros para hacer las operacions: \00"
@.str.1 = [9 x i8] c"%d %c %d\00"
@.str.2 = [25 x i8] c"La suma de %d y %d es %d\00"
@.str.3 = [26 x i8] c"La resta de %d y %d es %d\00"
@.str.4 = [29 x i8] c"El producto de %d y %d es %d\00"
@.str.5 = [30 x i8] c"La divisi\C3\B3n de %d y %d es %d\00"
@.str.6 = [27 x i8] c"El modulo de %d y %d es %d\00"
@.str.7 = [42 x i8] c"La operaci\C3\B3n introducida no es correcta.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %6, i8* %9, i32* %7)
%12 = load i8, i8* %9
%13 = sext i8 %12 to i32
switch i32 %13, label %49 [
i32 43, label %14
i32 45, label %21
i32 42, label %28
i32 47, label %35
i32 37, label %42
]
14: ; preds = %2
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = add nsw i32 %17, %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16, i32 %19)
br label %51
21: ; preds = %2
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = sub nsw i32 %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %23, i32 %26)
br label %51
28: ; preds = %2
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = mul nsw i32 %31, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %29, i32 %30, i32 %33)
br label %51
35: ; preds = %2
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = load i32, i32* %6
%39 = load i32, i32* %7
%40 = sdiv i32 %38, %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %36, i32 %37, i32 %40)
br label %51
42: ; preds = %2
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = srem i32 %45, %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %43, i32 %44, i32 %47)
br label %51
49: ; preds = %2
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %51
51: ; preds = %49, %42, %35, %28, %21, %14
%52 = load i32, i32* @EXIT_SUCCESS
ret i32 %52
}

LLVM IR (-O2):
@.str = [58 x i8] c"Introduce dos numeros enteros para hacer las operacions: \00"
@.str.1 = [9 x i8] c"%d %c %d\00"
@.str.2 = [25 x i8] c"La suma de %d y %d es %d\00"
@.str.3 = [26 x i8] c"La resta de %d y %d es %d\00"
@.str.4 = [29 x i8] c"El producto de %d y %d es %d\00"
@.str.5 = [30 x i8] c"La divisi\C3\B3n de %d y %d es %d\00"
@.str.6 = [27 x i8] c"El modulo de %d y %d es %d\00"
@.str.7 = [42 x i8] c"La operaci\C3\B3n introducida no es correcta.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3, i8* %5, i32* %4)
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
switch i32 %11, label %37 [
i32 43, label %12
i32 45, label %17
i32 42, label %22
i32 47, label %27
i32 37, label %32
]
12: ; preds = %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = add nsw i32 %14, %13
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
br label %39
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = sub nsw i32 %18, %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %19, i32 %20)
br label %39
22: ; preds = %2
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = mul nsw i32 %24, %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
br label %39
27: ; preds = %2
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = sdiv i32 %28, %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
br label %39
32: ; preds = %2
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = srem i32 %33, %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
br label %39
37: ; preds = %2
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %37, %32, %27, %22, %17, %12
%40 = load i32, i32* @EXIT_SUCCESS
ret i32 %40
}