#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 NAN;
double sqrt(double);
double nquadratic(double a, double b, double c) {
  double d = b * b - 4 * a * c;
  return (a == 0) ? ((b == 0 && c == 0) ? NAN : -(c / b))
                  : ((d < 0) ? NAN : (-b - sqrt(d)) / (2 * a));
}


x86 assembly (clang, -O0):
<nquadratic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  0xec7(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f9 <nquadratic+0xe9>
jp     11f9 <nquadratic+0xe9>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c4 <nquadratic+0xb4>
jp     11c4 <nquadratic+0xb4>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c4 <nquadratic+0xb4>
jp     11c4 <nquadratic+0xb4>
mov    0x2e42(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11ea <nquadratic+0xda>
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1273 <nquadratic+0x163>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    121c <nquadratic+0x10c>
mov    0x2dea(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1269 <nquadratic+0x159>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xdad(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nquadratic>:
sub    $0x28,%rsp
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
jne    1142 <nquadratic+0x32>
jp     1142 <nquadratic+0x32>
ucomisd %xmm4,%xmm1
jne    1134 <nquadratic+0x24>
jp     1134 <nquadratic+0x24>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1134 <nquadratic+0x24>
jnp    1168 <nquadratic+0x58>
xorpd  0xed4(%rip),%xmm2
divsd  %xmm1,%xmm2
jmp    11ba <nquadratic+0xaa>
movapd %xmm0,%xmm5
movsd  0xeb2(%rip),%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
ucomisd %xmm0,%xmm4
jbe    1175 <nquadratic+0x65>
mov    0x2e89(%rip),%rax
movsd  (%rax),%xmm2
jmp    11ba <nquadratic+0xaa>
xorpd  0xe93(%rip),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     118d <nquadratic+0x7d>
sqrtsd %xmm0,%xmm0
jmp    11aa <nquadratic+0x9a>
movapd %xmm1,0x10(%rsp)
movsd  %xmm5,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm5
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
addsd  %xmm5,%xmm5
divsd  %xmm5,%xmm1
movapd %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@NAN = global double 0.000000e+00
define double @nquadratic(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = load double, double* %5
%10 = load double, double* %4
%11 = fmul double 4.000000e+00, %10
%12 = load double, double* %6
%13 = fmul double %11, %12
%14 = fneg double %13
%15 = call double @llvm.fmuladd.f64(double %8, double %9, double %14)
store double %15, double* %7
%16 = load double, double* %4
%17 = fcmp oeq double %16, 0.000000e+00
br i1 %17, label %18, label %33
18: ; preds = %3
%19 = load double, double* %5
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load double, double* %6
%23 = fcmp oeq double %22, 0.000000e+00
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load double, double* @NAN
br label %31
26: ; preds = %21, %18
%27 = load double, double* %6
%28 = load double, double* %5
%29 = fdiv double %27, %28
%30 = fneg double %29
br label %31
31: ; preds = %26, %24
%32 = phi double [ %25, %24 ], [ %30, %26 ]
br label %49
33: ; preds = %3
%34 = load double, double* %7
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = load double, double* @NAN
br label %47
38: ; preds = %33
%39 = load double, double* %5
%40 = fneg double %39
%41 = load double, double* %7
%42 = call double @sqrt(double %41)
%43 = fsub double %40, %42
%44 = load double, double* %4
%45 = fmul double 2.000000e+00, %44
%46 = fdiv double %43, %45
br label %47
47: ; preds = %38, %36
%48 = phi double [ %37, %36 ], [ %46, %38 ]
br label %49
49: ; preds = %47, %31
%50 = phi double [ %32, %31 ], [ %48, %47 ]
ret double %50
}

LLVM IR (-O2):
@NAN = global double 0.000000e+00
define double @nquadratic(double %0, double %1, double %2) {
%4 = fmul double %0, -4.000000e+00
%5 = fmul double %4, %2
%6 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %5)
%7 = fcmp oeq double %0, 0.000000e+00
br i1 %7, label %8, label %17
8: ; preds = %3
%9 = fcmp oeq double %1, 0.000000e+00
%10 = fcmp oeq double %2, 0.000000e+00
%11 = and i1 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = load double, double* @NAN
br label %27
14: ; preds = %8
%15 = fneg double %2
%16 = fdiv double %15, %1
br label %27
17: ; preds = %3
%18 = fcmp olt double %6, 0.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = load double, double* @NAN
br label %27
21: ; preds = %17
%22 = fneg double %1
%23 = tail call double @sqrt(double %6)
%24 = fsub double %22, %23
%25 = fmul double %0, 2.000000e+00
%26 = fdiv double %24, %25
br label %27
27: ; preds = %19, %21, %12, %14
%28 = phi double [ %13, %12 ], [ %16, %14 ], [ %20, %19 ], [ %26, %21 ]
ret double %28
}