#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 pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void solve_equation() {
  float a, b, c;
  float raiz, x1, x2;
  printf("Introduce a: ");
  scanf("%f", &a);
  printf("Introduce b: ");
  scanf("%f", &b);
  printf("Introduce c: ");
  scanf("%f", &c);
  raiz = pow(b, 2) - (4 * a * c);
  if (raiz < 0) {
    printf("El resultado no entra dentro de los reales\n");
    return;
  } else {
    x1 = (-b + raiz) / (2. * a);
    x2 = (-b - raiz) / (2. * a);
    printf("x1: %.3f, x2: %.3f\n", x1, x2);
  }
}


x86 assembly (clang, -O0):
<solve_equation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
cvtsi2ss %eax,%xmm1
movss  0xe53(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11f1 <solve_equation+0xc1>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128b <solve_equation+0x15b>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xdeb(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xdae(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xde5(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_equation>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
cvtsi2ss %eax,%xmm2
movss  0xc(%rsp),%xmm0
movss  0xe41(%rip),%xmm1
mulss  %xmm0,%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm2,%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
jbe    11e3 <solve_equation+0xa3>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
jmp    123a <solve_equation+0xfa>
movss  0x4(%rsp),%xmm2
movaps 0xe20(%rip),%xmm3
xorps  %xmm2,%xmm3
subss  %xmm1,%xmm3
subss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
divsd  %xmm0,%xmm2
cvtsd2ss %xmm2,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xe1a(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Introduce a: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"Introduce b: \00"
@.str.3 = [14 x i8] c"Introduce c: \00"
@.str.4 = [44 x i8] c"El resultado no entra dentro de los reales\0A\00"
@.str.5 = [20 x i8] c"x1: %.3f, x2: %.3f\0A\00"
define void @solve_equation() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %2
%14 = call i32 @pow(float %13, i32 2)
%15 = sitofp i32 %14 to float
%16 = load float, float* %1
%17 = fmul float 4.000000e+00, %16
%18 = load float, float* %3
%19 = fneg float %17
%20 = call float @llvm.fmuladd.f32(float %19, float %18, float %15)
store float %20, float* %4
%21 = load float, float* %4
%22 = fcmp olt float %21, 0.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
br label %51
25: ; preds = %0
%26 = load float, float* %2
%27 = fneg float %26
%28 = load float, float* %4
%29 = fadd float %27, %28
%30 = fpext float %29 to double
%31 = load float, float* %1
%32 = fpext float %31 to double
%33 = fmul double 2.000000e+00, %32
%34 = fdiv double %30, %33
%35 = fptrunc double %34 to float
store float %35, float* %5
%36 = load float, float* %2
%37 = fneg float %36
%38 = load float, float* %4
%39 = fsub float %37, %38
%40 = fpext float %39 to double
%41 = load float, float* %1
%42 = fpext float %41 to double
%43 = fmul double 2.000000e+00, %42
%44 = fdiv double %40, %43
%45 = fptrunc double %44 to float
store float %45, float* %6
%46 = load float, float* %5
%47 = fpext float %46 to double
%48 = load float, float* %6
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %47, double %49)
br label %51
51: ; preds = %23, %25
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Introduce a: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"Introduce b: \00"
@.str.3 = [14 x i8] c"Introduce c: \00"
@.str.5 = [20 x i8] c"x1: %.3f, x2: %.3f\0A\00"
@str = [43 x i8] c"El resultado no entra dentro de los reales\00"
define void @solve_equation() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %2
%14 = call i32 @pow(float %13, i32 2)
%15 = sitofp i32 %14 to float
%16 = load float, float* %1
%17 = load float, float* %3
%18 = fmul float %16, -4.000000e+00
%19 = call float @llvm.fmuladd.f32(float %18, float %17, float %15)
%20 = fcmp olt float %19, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
br label %39
23: ; preds = %0
%24 = load float, float* %2
%25 = fneg float %24
%26 = fsub float %19, %24
%27 = fpext float %26 to double
%28 = fpext float %16 to double
%29 = fmul double %28, 2.000000e+00
%30 = fdiv double %27, %29
%31 = fptrunc double %30 to float
%32 = fsub float %25, %19
%33 = fpext float %32 to double
%34 = fdiv double %33, %29
%35 = fptrunc double %34 to float
%36 = fpext float %31 to double
%37 = fpext float %35 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %36, double %37)
br label %39
39: ; preds = %23, %21
ret void
}