#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 fabs(double);
double sqrt(double);
int solve_2nd_order(double *t1, double *t2, double A, double B, double C) {
  int ret = 0;
  if (!t1)
    return 0;
  *t1 = 0;
  if (t2)
    *t2 = 0;
  if (fabs(A) < 1E-10) {
    if (B) {
      *t1 = -C / B;
      ret = 1;
      if (t2)
        *t2 = *t1;
    }
  } else {
    double D;
    D = B * B - 4 * A * C;
    if (D >= 0) {
      double sD, dt1, dt2;
      sD = sqrt(D);
      dt1 = (-B + sD) / 2 / A;
      dt2 = (-B - sD) / 2 / A;
      if (fabs(dt1) < 1e-10)
        dt1 = 0.0;
      if (fabs(dt2) < 1e-10)
        dt2 = 0.0;
      if (dt1 <= 0.0 && dt2 > 0.0)
        ret = 2;
      else if (dt2 <= 0.0 && dt1 > 0.0)
        ret = 1;
      else if (dt1 > 0.0 && dt2 > 0.0) {
        if (dt1 < dt2)
          ret = 1;
        else
          ret = 2;
      }
      if (ret == 1) {
        *t1 = dt1;
        if (t2)
          *t2 = dt2;
      } else {
        *t1 = dt2;
        if (t2)
          *t2 = dt1;
      }
      ret = 2;
    }
  }
  return (ret);
}


x86 assembly (clang, -O0):
<solve_2nd_order>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <solve_2nd_order+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1451 <solve_2nd_order+0x331>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     117e <solve_2nd_order+0x5e>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe6c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1210 <solve_2nd_order+0xf0>
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11bb <solve_2nd_order+0x9b>
jp     11bb <solve_2nd_order+0x9b>
jmp    120b <solve_2nd_order+0xeb>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x34(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1206 <solve_2nd_order+0xe6>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    120b <solve_2nd_order+0xeb>
jmp    144b <solve_2nd_order+0x32b>
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xde6(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x30(%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
jb     1446 <solve_2nd_order+0x326>
movsd  -0x40(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  0xd76(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  0xd3f(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xd0b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1307 <solve_2nd_order+0x1e7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xce3(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    132f <solve_2nd_order+0x20f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jb     135b <solve_2nd_order+0x23b>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    135b <solve_2nd_order+0x23b>
movl   $0x2,-0x34(%rbp)
jmp    13e1 <solve_2nd_order+0x2c1>
xorps  %xmm0,%xmm0
ucomisd -0x58(%rbp),%xmm0
jb     1387 <solve_2nd_order+0x267>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1387 <solve_2nd_order+0x267>
movl   $0x1,-0x34(%rbp)
jmp    13dc <solve_2nd_order+0x2bc>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13d7 <solve_2nd_order+0x2b7>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13d7 <solve_2nd_order+0x2b7>
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13cb <solve_2nd_order+0x2ab>
movl   $0x1,-0x34(%rbp)
jmp    13d2 <solve_2nd_order+0x2b2>
movl   $0x2,-0x34(%rbp)
jmp    13d7 <solve_2nd_order+0x2b7>
jmp    13dc <solve_2nd_order+0x2bc>
jmp    13e1 <solve_2nd_order+0x2c1>
cmpl   $0x1,-0x34(%rbp)
jne    1415 <solve_2nd_order+0x2f5>
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1410 <solve_2nd_order+0x2f0>
movsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    143f <solve_2nd_order+0x31f>
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     143a <solve_2nd_order+0x31a>
movsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    143f <solve_2nd_order+0x31f>
movl   $0x2,-0x34(%rbp)
jmp    144b <solve_2nd_order+0x32b>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_2nd_order>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
xor    %ebp,%ebp
test   %rdi,%rdi
je     1289 <solve_2nd_order+0x169>
mov    %rsi,%r14
mov    %rdi,%rbx
movaps %xmm1,0x10(%rsp)
movaps %xmm2,(%rsp)
movq   $0x0,(%rdi)
test   %rsi,%rsi
je     1155 <solve_2nd_order+0x35>
movq   $0x0,(%r14)
movsd  %xmm0,0x28(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    11a3 <solve_2nd_order+0x83>
movsd  0xe94(%rip),%xmm1
movsd  0x28(%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  (%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1289 <solve_2nd_order+0x169>
jb     11e1 <solve_2nd_order+0xc1>
sqrtsd %xmm0,%xmm0
jmp    11f2 <solve_2nd_order+0xd2>
xorpd  %xmm0,%xmm0
movapd 0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd (%rsp),%xmm2
jne    11be <solve_2nd_order+0x9e>
jnp    1289 <solve_2nd_order+0x169>
xorpd  0xe5a(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx)
mov    $0x1,%ebp
test   %r14,%r14
jne    1284 <solve_2nd_order+0x164>
jmp    1289 <solve_2nd_order+0x169>
call   1040 <sqrt@plt>
movsd  0x28(%rsp),%xmm3
movapd 0x10(%rsp),%xmm2
movapd %xmm0,%xmm4
subsd  %xmm2,%xmm4
xorpd  0xe1e(%rip),%xmm2
movsd  0xdfe(%rip),%xmm1
mulsd  %xmm1,%xmm4
divsd  %xmm3,%xmm4
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm3,%xmm2
movapd %xmm2,0x10(%rsp)
movsd  %xmm4,(%rsp)
movapd %xmm4,%xmm0
call   1030 <fabs@plt>
xorpd  %xmm0,%xmm0
test   %eax,%eax
jle    123f <solve_2nd_order+0x11f>
movsd  (%rsp),%xmm0
movapd %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <fabs@plt>
xorpd  %xmm0,%xmm0
test   %eax,%eax
jle    125d <solve_2nd_order+0x13d>
movapd 0x10(%rsp),%xmm0
movapd (%rsp),%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm2,%xmm1
jb     1294 <solve_2nd_order+0x174>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1294 <solve_2nd_order+0x174>
movsd  %xmm0,(%rbx)
mov    $0x2,%ebp
test   %r14,%r14
je     1289 <solve_2nd_order+0x169>
movsd  %xmm2,(%r14)
mov    %ebp,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jb     12a4 <solve_2nd_order+0x184>
ucomisd %xmm1,%xmm2
ja     12ba <solve_2nd_order+0x19a>
ucomisd %xmm1,%xmm2
jbe    1276 <solve_2nd_order+0x156>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1276 <solve_2nd_order+0x156>
ucomisd %xmm2,%xmm0
jbe    1276 <solve_2nd_order+0x156>
movsd  %xmm2,(%rbx)
mov    $0x2,%ebp
movapd %xmm0,%xmm2
test   %r14,%r14
jne    1284 <solve_2nd_order+0x164>
jmp    1289 <solve_2nd_order+0x169>

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

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