#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 /*<<< orphan*/ scanf(char *, float *);
float sqrt(int);
int main() {
  float a, b, c, d;
  printf("Ingrese a, b, y c, para un polinomio ax^2 + bx + c.\n");
  printf("a:");
  scanf("%f", &a);
  printf("b:");
  scanf("%f", &b);
  printf("c:");
  scanf("%f", &c);
  d = sqrt(4 * a * c);
  if (d < 0) {
    printf("ERROR: No es posible obtener las raices del polinomio dado. "
           "Imposible continuar.\n");
    printf("%f\n", d);
    return 1;
  }
  float x1, x2;
  x1 = ((b * -1) + d) / (2 * a);
  x2 = ((b * -1) - d) / (2 * a);
  printf("Las raices son %f y %f.\n", x1, x2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xe51(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1050 <sqrt@plt>
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1205 <main+0xd5>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1281 <main+0x151>
movss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xde9(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  %xmm1,%xmm0
movss  0xdb8(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe2c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
mulss  0xe46(%rip),%xmm0
mulss  0x10(%rsp),%xmm0
cvttss2si %xmm0,%edi
call   1060 <sqrt@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    1202 <main+0xc2>
lea    0xea5(%rip),%rdi
movss  %xmm0,0xc(%rsp)
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe38(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    1245 <main+0x105>
movss  0x14(%rsp),%xmm1
movaps %xmm0,%xmm3
subss  %xmm1,%xmm3
xorps  0xdfa(%rip),%xmm1
movss  0x8(%rsp),%xmm2
addss  %xmm2,%xmm2
divss  %xmm2,%xmm3
subss  %xmm0,%xmm1
divss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xdf2(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Ingrese a, b, y c, para un polinomio ax^2 + bx + c.\0A\00"
@.str.1 = [3 x i8] c"a:\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"b:\00"
@.str.4 = [3 x i8] c"c:\00"
@.str.5 = [82 x i8] c"ERROR: No es posible obtener las raices del polinomio dado. Imposible continuar.\0A\00"
@.str.6 = [4 x i8] c"%f\0A\00"
@.str.7 = [25 x i8] c"Las raices son %f y %f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%15 = load float, float* %2
%16 = fmul float 4.000000e+00, %15
%17 = load float, float* %4
%18 = fmul float %16, %17
%19 = fptosi float %18 to i32
%20 = call float @sqrt(i32 %19)
store float %20, float* %5
%21 = load float, float* %5
%22 = fcmp olt float %21, 0.000000e+00
br i1 %22, label %23, label %28
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.5, i64 0, i64 0))
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), double %26)
store i32 1, i32* %1
br label %47
28: ; preds = %0
%29 = load float, float* %3
%30 = load float, float* %5
%31 = call float @llvm.fmuladd.f32(float %29, float -1.000000e+00, float %30)
%32 = load float, float* %2
%33 = fmul float 2.000000e+00, %32
%34 = fdiv float %31, %33
store float %34, float* %6
%35 = load float, float* %3
%36 = load float, float* %5
%37 = fneg float %36
%38 = call float @llvm.fmuladd.f32(float %35, float -1.000000e+00, float %37)
%39 = load float, float* %2
%40 = fmul float 2.000000e+00, %39
%41 = fdiv float %38, %40
store float %41, float* %7
%42 = load float, float* %6
%43 = fpext float %42 to double
%44 = load float, float* %7
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), double %43, double %45)
store i32 0, i32* %1
br label %47
47: ; preds = %28, %23
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"a:\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"b:\00"
@.str.4 = [3 x i8] c"c:\00"
@.str.6 = [4 x i8] c"%f\0A\00"
@.str.7 = [25 x i8] c"Las raices son %f y %f.\0A\00"
@str = [52 x i8] c"Ingrese a, b, y c, para un polinomio ax^2 + bx + c.\00"
@str.8 = [81 x i8] c"ERROR: No es posible obtener las raices del polinomio dado. Imposible continuar.\00"
define i32 @main() {
%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 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%14 = load float, float* %1
%15 = fmul float %14, 4.000000e+00
%16 = load float, float* %3
%17 = fmul float %15, %16
%18 = fptosi float %17 to i32
%19 = call float @sqrt(i32 %18)
%20 = fcmp olt float %19, 0.000000e+00
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.8, i64 0, i64 0))
%23 = fpext float %19 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), double %23)
br label %37
25: ; preds = %0
%26 = load float, float* %2
%27 = call float @llvm.fmuladd.f32(float %26, float -1.000000e+00, float %19)
%28 = load float, float* %1
%29 = fmul float %28, 2.000000e+00
%30 = fdiv float %27, %29
%31 = fneg float %19
%32 = call float @llvm.fmuladd.f32(float %26, float -1.000000e+00, float %31)
%33 = fdiv float %32, %29
%34 = fpext float %30 to double
%35 = fpext float %33 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), double %34, double %35)
br label %37
37: ; preds = %25, %21
%38 = phi i32 [ 1, %21 ], [ 0, %25 ]
ret i32 %38
}