#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 */
double fabs(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *, double *);
int sqrt(double);
main() {
  double a, b, c;
  double d;
  double re, im;
  printf("Coeficientes a, b y c de la ecuación: ");
  scanf("%lf %lf %lf", &a, &b, &c);
  printf("\n");
  if (a == 0 && b == 0)
    printf("La ecuación es degenerada\n");
  else if (a == 0)
    printf("La única raíz es: %.2lf\n", -c / b);
  else {
    re = -b / (2 * a);
    d = b * b - 4 * a * c;
    im = sqrt(fabs(d)) / (2 * a);
    if (d >= 0) {
      printf("Raíces reales:\n");
      printf("%.2lf    %.2lf\n", re + im, re - im);
    } else {
      printf("Raíces complejas:\n");
      printf("%.2lf + %.2lf j\n", re, fabs(im));
      printf("%.2lf - %.2lf j\n", re, fabs(im));
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <scanf@plt>
lea    0xf52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b6 <main+0x86>
jp     11b6 <main+0x86>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b6 <main+0x86>
jp     11b6 <main+0x86>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1348 <main+0x218>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1202 <main+0xd2>
jp     1202 <main+0xd2>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x18(%rbp),%xmm0
lea    0xe7a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1343 <main+0x213>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdda(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xdc2(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movaps 0xd90(%rip),%xmm1
pand   %xmm1,%xmm0
call   1050 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd6b(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12ea <main+0x1ba>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
lea    0xdbe(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    133e <main+0x20e>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movaps 0xd07(%rip),%xmm2
pand   %xmm2,%xmm1
lea    0xdac(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movaps 0xce4(%rip),%xmm2
pand   %xmm2,%xmm1
lea    0xd9a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1343 <main+0x213>
jmp    1348 <main+0x218>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x38(%rsp),%rdx
mov    %rsp,%rcx
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  0x38(%rsp),%xmm3
jne    11b6 <main+0x66>
jp     11b6 <main+0x66>
ucomisd %xmm1,%xmm3
jne    11b6 <main+0x66>
jp     11b6 <main+0x66>
lea    0xf20(%rip),%rdi
call   1040 <puts@plt>
jmp    12ce <main+0x17e>
ucomisd %xmm1,%xmm0
jne    11e2 <main+0x92>
jp     11e2 <main+0x92>
movsd  (%rsp),%xmm0
xorpd  0xe35(%rip),%xmm0
divsd  %xmm3,%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    12ce <main+0x17e>
movapd 0xe16(%rip),%xmm2
xorpd  %xmm3,%xmm2
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
mulsd  0xe18(%rip),%xmm0
mulsd  (%rsp),%xmm0
mulsd  %xmm3,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,0x40(%rsp)
movapd 0xded(%rip),%xmm0
andpd  %xmm3,%xmm0
call   1070 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
xorpd  %xmm0,%xmm0
movapd 0x40(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    129c <main+0x14c>
lea    0xe4b(%rip),%rdi
call   1040 <puts@plt>
movaps 0x10(%rsp),%xmm1
andps  0xda1(%rip),%xmm1
movaps %xmm1,0x10(%rsp)
lea    0xe0c(%rip),%rdi
movaps 0x20(%rsp),%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
lea    0xe0a(%rip),%rdi
movapd 0x20(%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
jmp    12c7 <main+0x177>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
movapd 0x20(%rsp),%xmm1
movapd %xmm1,%xmm0
movapd 0x10(%rsp),%xmm2
addsd  %xmm2,%xmm0
subsd  %xmm2,%xmm1
lea    0xdb0(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Coeficientes a, b y c de la ecuaci\C3\B3n: \00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [28 x i8] c"La ecuaci\C3\B3n es degenerada\0A\00"
@.str.4 = [27 x i8] c"La \C3\BAnica ra\C3\ADz es: %.2lf\0A\00"
@.str.5 = [17 x i8] c"Ra\C3\ADces reales:\0A\00"
@.str.6 = [16 x i8] c"%.2lf %.2lf\0A\00"
@.str.7 = [20 x i8] c"Ra\C3\ADces complejas:\0A\00"
@.str.8 = [17 x i8] c"%.2lf + %.2lf j\0A\00"
@.str.9 = [17 x i8] c"%.2lf - %.2lf j\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = load double, double* %2
%12 = fcmp oeq double %11, 0.000000e+00
br i1 %12, label %13, label %18
13: ; preds = %0
%14 = load double, double* %3
%15 = fcmp oeq double %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %71
18: ; preds = %13, %0
%19 = load double, double* %2
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load double, double* %4
%23 = fneg double %22
%24 = load double, double* %3
%25 = fdiv double %23, %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %25)
br label %70
27: ; preds = %18
%28 = load double, double* %3
%29 = fneg double %28
%30 = load double, double* %2
%31 = fmul double 2.000000e+00, %30
%32 = fdiv double %29, %31
store double %32, double* %6
%33 = load double, double* %3
%34 = load double, double* %3
%35 = load double, double* %2
%36 = fmul double 4.000000e+00, %35
%37 = load double, double* %4
%38 = fmul double %36, %37
%39 = fneg double %38
%40 = call double @llvm.fmuladd.f64(double %33, double %34, double %39)
store double %40, double* %5
%41 = load double, double* %5
%42 = call double @llvm.fabs.f64(double %41)
%43 = call i32 @sqrt(double %42)
%44 = sitofp i32 %43 to double
%45 = load double, double* %2
%46 = fmul double 2.000000e+00, %45
%47 = fdiv double %44, %46
store double %47, double* %7
%48 = load double, double* %5
%49 = fcmp oge double %48, 0.000000e+00
br i1 %49, label %50, label %59
50: ; preds = %27
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%52 = load double, double* %6
%53 = load double, double* %7
%54 = fadd double %52, %53
%55 = load double, double* %6
%56 = load double, double* %7
%57 = fsub double %55, %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %54, double %57)
br label %69
59: ; preds = %27
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%61 = load double, double* %6
%62 = load double, double* %7
%63 = call double @llvm.fabs.f64(double %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), double %61, double %63)
%65 = load double, double* %6
%66 = load double, double* %7
%67 = call double @llvm.fabs.f64(double %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), double %65, double %67)
br label %69
69: ; preds = %59, %50
br label %70
70: ; preds = %69, %21
br label %71
71: ; preds = %70, %16
%72 = load i32, i32* %1
ret i32 %72
}

LLVM IR (-O2):
@.str = [40 x i8] c"Coeficientes a, b y c de la ecuaci\C3\B3n: \00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.4 = [27 x i8] c"La \C3\BAnica ra\C3\ADz es: %.2lf\0A\00"
@.str.6 = [16 x i8] c"%.2lf %.2lf\0A\00"
@.str.8 = [17 x i8] c"%.2lf + %.2lf j\0A\00"
@.str.9 = [17 x i8] c"%.2lf - %.2lf j\0A\00"
@str = [19 x i8] c"Ra\C3\ADces complejas:\00"
@str.10 = [16 x i8] c"Ra\C3\ADces reales:\00"
@str.11 = [27 x i8] c"La ecuaci\C3\B3n es degenerada\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%9 = call i32 @putchar(i32 10)
%10 = load double, double* %1
%11 = fcmp oeq double %10, 0.000000e+00
%12 = load double, double* %2
%13 = fcmp oeq double %12, 0.000000e+00
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
br label %48
17: ; preds = %0
br i1 %11, label %18, label %23
18: ; preds = %17
%19 = load double, double* %3
%20 = fneg double %19
%21 = fdiv double %20, %12
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %21)
br label %48
23: ; preds = %17
%24 = fneg double %12
%25 = fmul double %10, 2.000000e+00
%26 = fdiv double %24, %25
%27 = load double, double* %3
%28 = fmul double %10, -4.000000e+00
%29 = fmul double %28, %27
%30 = call double @llvm.fmuladd.f64(double %12, double %12, double %29)
%31 = call double @llvm.fabs.f64(double %30)
%32 = call i32 @sqrt(double %31)
%33 = sitofp i32 %32 to double
%34 = load double, double* %1
%35 = fmul double %34, 2.000000e+00
%36 = fdiv double %33, %35
%37 = fcmp ult double %30, 0.000000e+00
br i1 %37, label %43, label %38
38: ; preds = %23
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.10, i64 0, i64 0))
%40 = fadd double %26, %36
%41 = fsub double %26, %36
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %40, double %41)
br label %48
43: ; preds = %23
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%45 = call double @llvm.fabs.f64(double %36)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), double %26, double %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), double %26, double %45)
br label %48
48: ; preds = %18, %43, %38, %15
ret i32 0
}