#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 main(void) {
  printf("\n\nCaso 1 Errores de redondeo al trabajar con enteros (int).\n\n");
  int a_int_caso_2 = 10;
  int b_int_caso_2 = 15;
  int c_int_caso_2_multiplicacion = a_int_caso_2 * b_int_caso_2;
  int c_int_caso_2_suma = a_int_caso_2 + b_int_caso_2;
  int c_int_caso_2_resta = a_int_caso_2 - b_int_caso_2;
  printf("Si obtenemos el resultado esperado: %d * %d= %d\n", a_int_caso_2,
         b_int_caso_2, c_int_caso_2_multiplicacion);
  printf("Si obtenemos el resultado esperado: %d + %d= %d\n", a_int_caso_2,
         b_int_caso_2, c_int_caso_2_suma);
  printf("Si obtenemos el resultado esperado: %d - %d= %d\n", a_int_caso_2,
         b_int_caso_2, c_int_caso_2_resta);
  int c_int_caso_2_division = a_int_caso_2 / b_int_caso_2;
  printf("\n¡Cuidado!\n\n");
  printf("No obtenemos el resultado esperado: %d / %d= %d\n\n", a_int_caso_2,
         b_int_caso_2, c_int_caso_2_division);
  printf("Pero si utilizamos variables de tipo float, \n\n");
  float a_float_caso_2 = 10;
  float b_float_caso_2 = 15;
  float c_float_caso_2_division = a_float_caso_2 / b_float_caso_2;
  printf("Si obtenemos el resultado esperado: %f / %f= %f\n\n", a_float_caso_2,
         b_float_caso_2, c_float_caso_2_division);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x1c(%rbp)
lea    0xf2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  0xe23(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe12(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
divss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x28(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xf24(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xfe7(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
mov    $0xa,%esi
mov    $0xf,%edx
mov    $0x96,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef8(%rip),%rdi
mov    $0xa,%esi
mov    $0xf,%edx
mov    $0x19,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0c(%rip),%rdi
mov    $0xa,%esi
mov    $0xf,%edx
mov    $0xfffffffb,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfc1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf14(%rip),%rdi
mov    $0xa,%esi
mov    $0xf,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfa8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf20(%rip),%rdi
movsd  0xe3b(%rip),%xmm0
movsd  0xe3b(%rip),%xmm1
movsd  0xe3b(%rip),%xmm2
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [62 x i8] c"\0A\0ACaso 1 Errores de redondeo al trabajar con enteros (int).\0A\0A\00"
@.str.1 = [49 x i8] c"Si obtenemos el resultado esperado: %d * %d= %d\0A\00"
@.str.2 = [49 x i8] c"Si obtenemos el resultado esperado: %d + %d= %d\0A\00"
@.str.3 = [49 x i8] c"Si obtenemos el resultado esperado: %d - %d= %d\0A\00"
@.str.4 = [14 x i8] c"\0A\C2\A1Cuidado!\0A\0A\00"
@.str.5 = [50 x i8] c"No obtenemos el resultado esperado: %d / %d= %d\0A\0A\00"
@.str.6 = [47 x i8] c"Pero si utilizamos variables de tipo float, \0A\0A\00"
@.str.7 = [50 x i8] c"Si obtenemos el resultado esperado: %f / %f= %f\0A\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 float
%9 = alloca float
%10 = alloca float
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
store i32 10, i32* %2
store i32 15, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = mul nsw i32 %12, %13
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
store i32 %17, i32* %5
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %6
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = load i32, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = sdiv i32 %33, %34
store i32 %35, i32* %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = load i32, i32* %7
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
store float 1.000000e+01, float* %8
store float 1.500000e+01, float* %9
%42 = load float, float* %8
%43 = load float, float* %9
%44 = fdiv float %42, %43
store float %44, float* %10
%45 = load float, float* %8
%46 = fpext float %45 to double
%47 = load float, float* %9
%48 = fpext float %47 to double
%49 = load float, float* %10
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), double %46, double %48, double %50)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [49 x i8] c"Si obtenemos el resultado esperado: %d * %d= %d\0A\00"
@.str.2 = [49 x i8] c"Si obtenemos el resultado esperado: %d + %d= %d\0A\00"
@.str.3 = [49 x i8] c"Si obtenemos el resultado esperado: %d - %d= %d\0A\00"
@.str.5 = [50 x i8] c"No obtenemos el resultado esperado: %d / %d= %d\0A\0A\00"
@.str.7 = [50 x i8] c"Si obtenemos el resultado esperado: %f / %f= %f\0A\0A\00"
@str = [61 x i8] c"\0A\0ACaso 1 Errores de redondeo al trabajar con enteros (int).\0A\00"
@str.8 = [13 x i8] c"\0A\C2\A1Cuidado!\0A\00"
@str.9 = [46 x i8] c"Pero si utilizamos variables de tipo float, \0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 15, i32 150)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 15, i32 25)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 10, i32 15, i32 -5)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 10, i32 15, i32 0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), double 1.000000e+01, double 1.500000e+01, double 0x3FE5555560000000)
ret i32 0
}