#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 Sqrt(double);
scalar_t__ isinf(double);
scalar_t__ isnan(double);
double qsolv(double a, double b, double c, double *x1, double *x2) {
  *x1 = (-b + Sqrt(b * b - 4 * a * c)) / (2 * a);
  *x2 = (-b - Sqrt(b * b - 4 * a * c)) / (2 * a);
  if (isinf(-b + Sqrt(b * b - 4 * a * c)) ||
      isinf(-b - Sqrt(b * b - 4 * a * c)))
    return 4.0;
  if (isnan(a) || isnan(b) || isnan(c))
    return 3.0;
  if (b * b < 4 * a * c)
    return 2.0;
  return 0;
}


x86 assembly (clang, -O0):
<qsolv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe7e(%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
call   1030 <Sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe44(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xdf8(%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
call   1030 <Sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xdbe(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xd72(%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
call   1030 <Sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1050 <isinf@plt>
cmp    $0x0,%rax
jne    1353 <qsolv+0x223>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xcf6(%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
call   1030 <Sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1050 <isinf@plt>
cmp    $0x0,%rax
je     1365 <qsolv+0x235>
movsd  0xca5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13f3 <qsolv+0x2c3>
movsd  -0x10(%rbp),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
jne    13a1 <qsolv+0x271>
movsd  -0x18(%rbp),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
jne    13a1 <qsolv+0x271>
movsd  -0x20(%rbp),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
je     13b3 <qsolv+0x283>
movsd  0xc67(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13f3 <qsolv+0x2c3>
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xc3b(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13eb <qsolv+0x2bb>
movsd  0xc27(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13f3 <qsolv+0x2c3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsolv>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd 0xeaf(%rip),%xmm3
xorpd  %xmm1,%xmm3
movapd %xmm3,0x50(%rsp)
movsd  0xead(%rip),%xmm4
movapd %xmm0,%xmm3
mulsd  %xmm4,%xmm3
movsd  %xmm2,0x40(%rsp)
mulsd  %xmm2,%xmm3
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x60(%rsp)
movsd  %xmm3,0x38(%rsp)
subsd  %xmm3,%xmm0
movapd %xmm0,0x20(%rsp)
call   1030 <Sqrt@plt>
subsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x48(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
movapd 0x20(%rsp),%xmm0
call   1030 <Sqrt@plt>
movapd 0x50(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x48(%rsp),%xmm1
movsd  %xmm1,(%r14)
movapd 0x20(%rsp),%xmm0
call   1030 <Sqrt@plt>
subsd  0x10(%rsp),%xmm0
call   1050 <isinf@plt>
test   %rax,%rax
je     11fe <qsolv+0xce>
movsd  0xe17(%rip),%xmm0
jmp    128b <qsolv+0x15b>
movapd 0x20(%rsp),%xmm0
call   1030 <Sqrt@plt>
movapd 0x50(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <isinf@plt>
test   %rax,%rax
movsd  0xde9(%rip),%xmm0
jne    128b <qsolv+0x15b>
movsd  0x8(%rsp),%xmm0
call   1040 <isnan@plt>
movsd  0xddc(%rip),%xmm0
test   %rax,%rax
jne    128b <qsolv+0x15b>
movaps 0x10(%rsp),%xmm0
call   1040 <isnan@plt>
test   %rax,%rax
je     125a <qsolv+0x12a>
movsd  0xdc0(%rip),%xmm0
jmp    128b <qsolv+0x15b>
movsd  0x40(%rsp),%xmm0
call   1040 <isnan@plt>
test   %rax,%rax
movsd  0xda8(%rip),%xmm0
jne    128b <qsolv+0x15b>
movapd 0x60(%rsp),%xmm1
cmpltsd 0x38(%rsp),%xmm1
movsd  0xd99(%rip),%xmm0
andpd  %xmm1,%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @qsolv(double %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double* %3, double** %10
store double* %4, double** %11
%12 = load double, double* %8
%13 = fneg double %12
%14 = load double, double* %8
%15 = load double, double* %8
%16 = load double, double* %7
%17 = fmul double 4.000000e+00, %16
%18 = load double, double* %9
%19 = fmul double %17, %18
%20 = fneg double %19
%21 = call double @llvm.fmuladd.f64(double %14, double %15, double %20)
%22 = call double @Sqrt(double %21)
%23 = fadd double %13, %22
%24 = load double, double* %7
%25 = fmul double 2.000000e+00, %24
%26 = fdiv double %23, %25
%27 = load double*, double** %10
store double %26, double* %27
%28 = load double, double* %8
%29 = fneg double %28
%30 = load double, double* %8
%31 = load double, double* %8
%32 = load double, double* %7
%33 = fmul double 4.000000e+00, %32
%34 = load double, double* %9
%35 = fmul double %33, %34
%36 = fneg double %35
%37 = call double @llvm.fmuladd.f64(double %30, double %31, double %36)
%38 = call double @Sqrt(double %37)
%39 = fsub double %29, %38
%40 = load double, double* %7
%41 = fmul double 2.000000e+00, %40
%42 = fdiv double %39, %41
%43 = load double*, double** %11
store double %42, double* %43
%44 = load double, double* %8
%45 = fneg double %44
%46 = load double, double* %8
%47 = load double, double* %8
%48 = load double, double* %7
%49 = fmul double 4.000000e+00, %48
%50 = load double, double* %9
%51 = fmul double %49, %50
%52 = fneg double %51
%53 = call double @llvm.fmuladd.f64(double %46, double %47, double %52)
%54 = call double @Sqrt(double %53)
%55 = fadd double %45, %54
%56 = call i64 @isinf(double %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %73, label %58
58: ; preds = %5
%59 = load double, double* %8
%60 = fneg double %59
%61 = load double, double* %8
%62 = load double, double* %8
%63 = load double, double* %7
%64 = fmul double 4.000000e+00, %63
%65 = load double, double* %9
%66 = fmul double %64, %65
%67 = fneg double %66
%68 = call double @llvm.fmuladd.f64(double %61, double %62, double %67)
%69 = call double @Sqrt(double %68)
%70 = fsub double %60, %69
%71 = call i64 @isinf(double %70)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %58, %5
store double 4.000000e+00, double* %6
br label %98
74: ; preds = %58
%75 = load double, double* %7
%76 = call i64 @isnan(double %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %86, label %78
78: ; preds = %74
%79 = load double, double* %8
%80 = call i64 @isnan(double %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %86, label %82
82: ; preds = %78
%83 = load double, double* %9
%84 = call i64 @isnan(double %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %82, %78, %74
store double 3.000000e+00, double* %6
br label %98
87: ; preds = %82
%88 = load double, double* %8
%89 = load double, double* %8
%90 = fmul double %88, %89
%91 = load double, double* %7
%92 = fmul double 4.000000e+00, %91
%93 = load double, double* %9
%94 = fmul double %92, %93
%95 = fcmp olt double %90, %94
br i1 %95, label %96, label %97
96: ; preds = %87
store double 2.000000e+00, double* %6
br label %98
97: ; preds = %87
store double 0.000000e+00, double* %6
br label %98
98: ; preds = %97, %96, %86, %73
%99 = load double, double* %6
ret double %99
}

LLVM IR (-O2):
define double @qsolv(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = fneg double %1
%7 = fmul double %0, 4.000000e+00
%8 = fmul double %7, %2
%9 = fneg double %8
%10 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %9)
%11 = tail call double @Sqrt(double %10)
%12 = fsub double %11, %1
%13 = fmul double %0, 2.000000e+00
%14 = fdiv double %12, %13
store double %14, double* %3
%15 = tail call double @Sqrt(double %10)
%16 = fsub double %6, %15
%17 = fdiv double %16, %13
store double %17, double* %4
%18 = tail call double @Sqrt(double %10)
%19 = fsub double %18, %1
%20 = tail call i64 @isinf(double %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %40
22: ; preds = %5
%23 = tail call double @Sqrt(double %10)
%24 = fsub double %6, %23
%25 = tail call i64 @isinf(double %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %40
27: ; preds = %22
%28 = tail call i64 @isnan(double %0)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = tail call i64 @isnan(double %1)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %40
33: ; preds = %30
%34 = tail call i64 @isnan(double %2)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = fmul double %1, %1
%38 = fcmp olt double %37, %8
%39 = select i1 %38, double 2.000000e+00, double 0.000000e+00
br label %40
40: ; preds = %36, %27, %30, %33, %5, %22
%41 = phi double [ 4.000000e+00, %22 ], [ 4.000000e+00, %5 ], [ 3.000000e+00, %33 ], [ 3.000000e+00, %30 ], [ 3.000000e+00, %27 ], [ %39, %36 ]
ret double %41
}