#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);
double sqrt(double);
void quadeq(double a, double b, double c, double *x1, double *x2, int *nr,
            int *nc) {
  double dis, q;
  if ((fabs((double)a - (double)0.0) <= (double)1.0E-15)) {
    *nc = 0;
    if ((fabs((double)b - (double)0.0) <= (double)1.0E-15)) {
      *nr = 0;
      *x1 = 0.0;
    } else {
      *nr = 1;
      *x1 = -c / b;
    }
    *x2 = *x1;
  } else {
    dis = b * b - 4.0 * a * c;
    if (dis > 0.0) {
      *nr = 2;
      *nc = 0;
      dis = sqrt(dis);
      if (b < 0.0)
        dis = -dis;
      q = -0.5 * (b + dis);
      *x1 = q / a;
      *x2 = c / q;
      if (*x1 > *x2) {
        q = *x1;
        *x1 = *x2;
        *x2 = q;
      }
    } else if ((fabs((double)dis - (double)0.0) <= (double)1.0E-15)) {
      *nr = 1;
      *nc = 0;
      *x1 = -0.5 * b / a;
      *x2 = *x1;
    } else {
      *nr = 0;
      *nc = 2;
      *x1 = -0.5 * b / a;
      *x2 = 0.5 * sqrt(-dis) / a;
    }
  }
}


x86 assembly (clang, -O0):
<quadeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm0,%xmm1
movaps 0xed6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11f5 <quadeq+0xe5>
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
movsd  -0x10(%rbp),%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm0,%xmm1
movaps 0xea3(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe77(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11ad <quadeq+0x9d>
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11e0 <quadeq+0xd0>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13fe <quadeq+0x2ee>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  0xe01(%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,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    131d <quadeq+0x20d>
mov    -0x30(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
movsd  -0x40(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1299 <quadeq+0x189>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
movsd  0xd6d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1318 <quadeq+0x208>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13f9 <quadeq+0x2e9>
movsd  -0x40(%rbp),%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm0,%xmm1
movaps 0xcf0(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xcc4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1389 <quadeq+0x279>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
movsd  0xcb6(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13f4 <quadeq+0x2e4>
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x38(%rbp),%rax
movl   $0x2,(%rax)
movsd  0xc73(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xc2d(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13f9 <quadeq+0x2e9>
jmp    13fe <quadeq+0x2ee>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadeq>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm5
movapd 0xed7(%rip),%xmm0
andpd  %xmm5,%xmm0
movsd  0xeeb(%rip),%xmm3
ucomisd %xmm0,%xmm3
jae    1180 <quadeq+0x70>
movsd  0xee5(%rip),%xmm4
mulsd  %xmm5,%xmm4
mulsd  %xmm2,%xmm4
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm4,%xmm0
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
jbe    11b7 <quadeq+0xa7>
movl   $0x2,(%rdx)
movl   $0x0,(%rcx)
ucomisd %xmm4,%xmm0
jb     1223 <quadeq+0x113>
sqrtsd %xmm0,%xmm0
jmp    124a <quadeq+0x13a>
movl   $0x0,(%rcx)
movapd 0xe72(%rip),%xmm0
andpd  %xmm1,%xmm0
ucomisd %xmm0,%xmm3
jae    1210 <quadeq+0x100>
movl   $0x1,(%rdx)
xorpd  0xe6a(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx)
movapd %xmm2,%xmm1
jmp    12dd <quadeq+0x1cd>
movapd 0xe41(%rip),%xmm2
andpd  %xmm0,%xmm2
ucomisd %xmm2,%xmm3
jae    129c <quadeq+0x18c>
movl   $0x0,(%rdx)
mulsd  0xe55(%rip),%xmm1
movl   $0x2,(%rcx)
divsd  %xmm5,%xmm1
movsd  %xmm1,(%rbx)
movapd 0xe1f(%rip),%xmm1
xorpd  %xmm0,%xmm1
movsd  0xe3b(%rip),%xmm2
ucomisd %xmm0,%xmm2
jb     12ba <quadeq+0x1aa>
sqrtsd %xmm1,%xmm1
jmp    12d1 <quadeq+0x1c1>
movl   $0x0,(%rdx)
xorpd  %xmm1,%xmm1
movsd  %xmm1,(%rbx)
jmp    12dd <quadeq+0x1cd>
movapd %xmm1,0x20(%rsp)
movapd %xmm5,(%rsp)
movapd %xmm2,0x10(%rsp)
call   1030 <sqrt@plt>
movapd 0x10(%rsp),%xmm2
movapd (%rsp),%xmm5
movapd 0x20(%rsp),%xmm1
movapd 0xdbe(%rip),%xmm4
xorpd  %xmm0,%xmm4
xorpd  %xmm6,%xmm6
movapd %xmm1,%xmm3
cmpltsd %xmm6,%xmm3
andpd  %xmm3,%xmm4
andnpd %xmm0,%xmm3
orpd   %xmm4,%xmm3
addsd  %xmm1,%xmm3
mulsd  0xdb5(%rip),%xmm3
divsd  %xmm3,%xmm2
divsd  %xmm5,%xmm3
movsd  %xmm3,(%rbx)
movsd  %xmm2,(%r14)
movsd  (%rbx),%xmm1
ucomisd %xmm2,%xmm1
jbe    12e2 <quadeq+0x1d2>
movsd  %xmm2,(%rbx)
jmp    12dd <quadeq+0x1cd>
movl   $0x1,(%rdx)
movl   $0x0,(%rcx)
mulsd  0xd80(%rip),%xmm1
divsd  %xmm5,%xmm1
movsd  %xmm1,(%rbx)
jmp    12dd <quadeq+0x1cd>
movapd %xmm1,%xmm0
movapd %xmm5,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm5
movapd %xmm0,%xmm1
mulsd  0xd67(%rip),%xmm1
divsd  %xmm5,%xmm1
movsd  %xmm1,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @quadeq(double %0, double %1, double %2, double* %3, double* %4, i32* %5, i32* %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca double
%16 = alloca double
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double* %3, double** %11
store double* %4, double** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%17 = load double, double* %8
%18 = fsub double %17, 0.000000e+00
%19 = call double @llvm.fabs.f64(double %18)
%20 = fcmp ole double %19, 1.000000e-15
br i1 %20, label %21, label %41
21: ; preds = %7
%22 = load i32*, i32** %14
store i32 0, i32* %22
%23 = load double, double* %9
%24 = fsub double %23, 0.000000e+00
%25 = call double @llvm.fabs.f64(double %24)
%26 = fcmp ole double %25, 1.000000e-15
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = load i32*, i32** %13
store i32 0, i32* %28
%29 = load double*, double** %11
store double 0.000000e+00, double* %29
br label %37
30: ; preds = %21
%31 = load i32*, i32** %13
store i32 1, i32* %31
%32 = load double, double* %10
%33 = fneg double %32
%34 = load double, double* %9
%35 = fdiv double %33, %34
%36 = load double*, double** %11
store double %35, double* %36
br label %37
37: ; preds = %30, %27
%38 = load double*, double** %11
%39 = load double, double* %38
%40 = load double*, double** %12
store double %39, double* %40
br label %122
41: ; preds = %7
%42 = load double, double* %9
%43 = load double, double* %9
%44 = load double, double* %8
%45 = fmul double 4.000000e+00, %44
%46 = load double, double* %10
%47 = fmul double %45, %46
%48 = fneg double %47
%49 = call double @llvm.fmuladd.f64(double %42, double %43, double %48)
store double %49, double* %15
%50 = load double, double* %15
%51 = fcmp ogt double %50, 0.000000e+00
br i1 %51, label %52, label %89
52: ; preds = %41
%53 = load i32*, i32** %13
store i32 2, i32* %53
%54 = load i32*, i32** %14
store i32 0, i32* %54
%55 = load double, double* %15
%56 = call double @sqrt(double %55)
store double %56, double* %15
%57 = load double, double* %9
%58 = fcmp olt double %57, 0.000000e+00
br i1 %58, label %59, label %62
59: ; preds = %52
%60 = load double, double* %15
%61 = fneg double %60
store double %61, double* %15
br label %62
62: ; preds = %59, %52
%63 = load double, double* %9
%64 = load double, double* %15
%65 = fadd double %63, %64
%66 = fmul double -5.000000e-01, %65
store double %66, double* %16
%67 = load double, double* %16
%68 = load double, double* %8
%69 = fdiv double %67, %68
%70 = load double*, double** %11
store double %69, double* %70
%71 = load double, double* %10
%72 = load double, double* %16
%73 = fdiv double %71, %72
%74 = load double*, double** %12
store double %73, double* %74
%75 = load double*, double** %11
%76 = load double, double* %75
%77 = load double*, double** %12
%78 = load double, double* %77
%79 = fcmp ogt double %76, %78
br i1 %79, label %80, label %88
80: ; preds = %62
%81 = load double*, double** %11
%82 = load double, double* %81
store double %82, double* %16
%83 = load double*, double** %12
%84 = load double, double* %83
%85 = load double*, double** %11
store double %84, double* %85
%86 = load double, double* %16
%87 = load double*, double** %12
store double %86, double* %87
br label %88
88: ; preds = %80, %62
br label %121
89: ; preds = %41
%90 = load double, double* %15
%91 = fsub double %90, 0.000000e+00
%92 = call double @llvm.fabs.f64(double %91)
%93 = fcmp ole double %92, 1.000000e-15
br i1 %93, label %94, label %105
94: ; preds = %89
%95 = load i32*, i32** %13
store i32 1, i32* %95
%96 = load i32*, i32** %14
store i32 0, i32* %96
%97 = load double, double* %9
%98 = fmul double -5.000000e-01, %97
%99 = load double, double* %8
%100 = fdiv double %98, %99
%101 = load double*, double** %11
store double %100, double* %101
%102 = load double*, double** %11
%103 = load double, double* %102
%104 = load double*, double** %12
store double %103, double* %104
br label %120
105: ; preds = %89
%106 = load i32*, i32** %13
store i32 0, i32* %106
%107 = load i32*, i32** %14
store i32 2, i32* %107
%108 = load double, double* %9
%109 = fmul double -5.000000e-01, %108
%110 = load double, double* %8
%111 = fdiv double %109, %110
%112 = load double*, double** %11
store double %111, double* %112
%113 = load double, double* %15
%114 = fneg double %113
%115 = call double @sqrt(double %114)
%116 = fmul double 5.000000e-01, %115
%117 = load double, double* %8
%118 = fdiv double %116, %117
%119 = load double*, double** %12
store double %118, double* %119
br label %120
120: ; preds = %105, %94
br label %121
121: ; preds = %120, %88
br label %122
122: ; preds = %121, %37
ret void
}

LLVM IR (-O2):
define void @quadeq(double %0, double %1, double %2, double* nocapture %3, double* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = tail call double @llvm.fabs.f64(double %0)
%9 = fcmp ugt double %8, 1.000000e-15
br i1 %9, label %19, label %10
10: ; preds = %7
store i32 0, i32* %6
%11 = tail call double @llvm.fabs.f64(double %1)
%12 = fcmp ugt double %11, 1.000000e-15
br i1 %12, label %14, label %13
13: ; preds = %10
store i32 0, i32* %5
br label %17
14: ; preds = %10
store i32 1, i32* %5
%15 = fneg double %2
%16 = fdiv double %15, %1
br label %17
17: ; preds = %14, %13
%18 = phi double [ %16, %14 ], [ 0.000000e+00, %13 ]
store double %18, double* %3
br label %49
19: ; preds = %7
%20 = fmul double %0, -4.000000e+00
%21 = fmul double %20, %2
%22 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %21)
%23 = fcmp ogt double %22, 0.000000e+00
br i1 %23, label %24, label %36
24: ; preds = %19
store i32 2, i32* %5
store i32 0, i32* %6
%25 = tail call double @sqrt(double %22)
%26 = fcmp olt double %1, 0.000000e+00
%27 = fneg double %25
%28 = select i1 %26, double %27, double %25
%29 = fadd double %28, %1
%30 = fmul double %29, -5.000000e-01
%31 = fdiv double %30, %0
store double %31, double* %3
%32 = fdiv double %2, %30
store double %32, double* %4
%33 = load double, double* %3
%34 = fcmp ogt double %33, %32
br i1 %34, label %35, label %51
35: ; preds = %24
store double %32, double* %3
br label %49
36: ; preds = %19
%37 = tail call double @llvm.fabs.f64(double %22)
%38 = fcmp ugt double %37, 1.000000e-15
br i1 %38, label %42, label %39
39: ; preds = %36
store i32 1, i32* %5
store i32 0, i32* %6
%40 = fmul double %1, -5.000000e-01
%41 = fdiv double %40, %0
store double %41, double* %3
br label %49
42: ; preds = %36
store i32 0, i32* %5
store i32 2, i32* %6
%43 = fmul double %1, -5.000000e-01
%44 = fdiv double %43, %0
store double %44, double* %3
%45 = fneg double %22
%46 = tail call double @sqrt(double %45)
%47 = fmul double %46, 5.000000e-01
%48 = fdiv double %47, %0
br label %49
49: ; preds = %17, %39, %42, %35
%50 = phi double [ %33, %35 ], [ %48, %42 ], [ %41, %39 ], [ %18, %17 ]
store double %50, double* %4
br label %51
51: ; preds = %49, %24
ret void
}