int solve_cubic(double c0, double c1, double c2, double c3, double root[3]) {
  double p, q, r, a, b, Q, x0;
  p = c2 / c3;
  q = c1 / c3;
  r = c0 / c3;
  a = (3 * q - p * p) / 3;
  b = (2 * ((p) * (p) * (p)) - 9 * p * q + 27 * r) / 27;
  Q = b * b / 4 + ((a) * (a) * (a)) / 27;
  x0 = p / 3;
  if (Q > 0) {
    double sQ = sqrt(Q);
    double t1 = my_cbrt(-b / 2 + sQ) + my_cbrt(-b / 2 - sQ);
    root[0] = t1 - x0;
    return 1;
  } else if (Q == 0) {
    double t1 = my_cbrt(b / 2);
    double x1 = t1 - x0;
    root[0] = x1;
    root[1] = x1;
    root[2] = -2 * t1 - x0;
    return 3;
  } else {
    double sQ = sqrt(-Q);
    double rho = hypot(-b / 2, sQ);
    double th = atan2(sQ, -b / 2);
    double cbrho = my_cbrt(rho);
    double c = cos(th / 3);
    double s = sin(th / 3);
    double sqr3 = sqrt(3);
    root[0] = 2 * cbrho * c - x0;
    root[1] = -cbrho * (c + sqr3 * s) - x0;
    root[2] = -cbrho * (c - sqr3 * s) - x0;
    return 3;
  }
}


x86 assembly (clang, -O0):
<solve_cubic>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe22(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe12(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  0xe0a(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xdc4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  0xda1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  0xd7e(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xd5c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    136d <solve_cubic+0x20d>
movsd  -0x60(%rbp),%xmm0
call   1080 <sqrt@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd2e(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x70(%rbp),%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
mov    %eax,-0xc4(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xcf4(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x70(%rbp),%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
mov    %eax,%ecx
mov    -0xc4(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1666 <solve_cubic+0x506>
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1417 <solve_cubic+0x2b7>
jp     1417 <solve_cubic+0x2b7>
movsd  -0x58(%rbp),%xmm0
movsd  0xc8e(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x80(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x3,-0x4(%rbp)
jmp    1666 <solve_cubic+0x506>
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1080 <sqrt@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xbbc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x90(%rbp),%xmm1
ff
call   1060 <hypot@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xb77(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1040 <atan2@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
mov    $0x1,%al
call   1030 <my_cbrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xb1b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xafa(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xae1(%rip),%xmm0
call   1080 <sqrt@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xaec(%rip),%xmm0
mulsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xa8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm2
ff
movsd  -0xb8(%rbp),%xmm3
ff
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0xa8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm2
ff
movsd  -0xb8(%rbp),%xmm3
ff
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_cubic>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
divsd  %xmm3,%xmm2
unpcklpd %xmm0,%xmm1
unpcklpd %xmm3,%xmm3
divpd  %xmm3,%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm2,%xmm4
mulsd  %xmm0,%xmm4
xorpd  0xe72(%rip),%xmm0
movsd  0xe8a(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm4
addsd  %xmm3,%xmm4
unpcklpd %xmm4,%xmm0
movapd 0xe5e(%rip),%xmm3
mulpd  %xmm3,%xmm1
addpd  %xmm0,%xmm1
divpd  %xmm3,%xmm1
movapd %xmm1,%xmm3
movapd %xmm1,%xmm0
movhpd 0xe5a(%rip),%xmm0
mulpd  %xmm1,%xmm3
mulpd  %xmm3,%xmm0
movapd %xmm0,%xmm3
divsd  0xe4e(%rip),%xmm3
mov    %rdi,%rbx
unpckhpd %xmm0,%xmm0
divsd  0xe47(%rip),%xmm2
addsd  %xmm3,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
movapd %xmm2,0x30(%rsp)
jbe    1210 <solve_cubic+0xb0>
jb     125e <solve_cubic+0xfe>
xorps  %xmm2,%xmm2
sqrtsd %xmm0,%xmm2
jmp    1271 <solve_cubic+0x111>
jne    12c8 <solve_cubic+0x168>
jp     12c8 <solve_cubic+0x168>
unpckhpd %xmm1,%xmm1
mulsd  0xe38(%rip),%xmm1
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,%xmm1
movapd 0x30(%rsp),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rbx)
mulsd  0xe14(%rip),%xmm0
movsd  %xmm1,0x8(%rbx)
jmp    13e7 <solve_cubic+0x287>
movapd %xmm1,(%rsp)
call   1080 <sqrt@plt>
movapd (%rsp),%xmm1
movapd %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
unpckhpd %xmm1,%xmm1
mulsd  0xdc5(%rip),%xmm1
movapd %xmm1,(%rsp)
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
mov    %eax,%ebp
movapd (%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%rbx)
mov    $0x1,%eax
jmp    13f5 <solve_cubic+0x295>
movapd 0xd30(%rip),%xmm3
xorpd  %xmm0,%xmm3
movsd  0xd64(%rip),%xmm2
ucomisd %xmm0,%xmm2
jb     12eb <solve_cubic+0x18b>
xorps  %xmm2,%xmm2
sqrtsd %xmm3,%xmm2
jmp    1302 <solve_cubic+0x1a2>
movapd %xmm3,%xmm0
movapd %xmm1,(%rsp)
call   1080 <sqrt@plt>
movapd (%rsp),%xmm1
movapd %xmm0,%xmm2
unpckhpd %xmm1,%xmm1
mulsd  0xd3a(%rip),%xmm1
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
movsd  %xmm2,0x20(%rsp)
movapd %xmm2,%xmm1
call   1060 <hypot@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
movaps (%rsp),%xmm1
call   1040 <atan2@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <my_cbrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
divsd  0xcd1(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1070 <cos@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1050 <sin@plt>
movapd 0x20(%rsp),%xmm3
movapd %xmm3,%xmm1
addsd  %xmm3,%xmm1
xorpd  0xc69(%rip),%xmm3
movsd  0xcb1(%rip),%xmm2
mulsd  %xmm0,%xmm2
movapd 0x10(%rsp),%xmm5
addsd  %xmm5,%xmm2
unpcklpd %xmm3,%xmm1
movapd %xmm3,%xmm4
movapd %xmm5,%xmm3
unpcklpd %xmm2,%xmm3
mulpd  %xmm1,%xmm3
movapd 0x30(%rsp),%xmm2
movapd %xmm2,%xmm1
unpcklpd %xmm2,%xmm1
subpd  %xmm1,%xmm3
movupd %xmm3,(%rbx)
mulsd  0xc79(%rip),%xmm0
addsd  %xmm5,%xmm0
mulsd  %xmm4,%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rbx)
mov    $0x3,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @solve_cubic(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 double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = 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
%30 = load double, double* %9
%31 = load double, double* %10
%32 = fdiv double %30, %31
store double %32, double* %12
%33 = load double, double* %8
%34 = load double, double* %10
%35 = fdiv double %33, %34
store double %35, double* %13
%36 = load double, double* %7
%37 = load double, double* %10
%38 = fdiv double %36, %37
store double %38, double* %14
%39 = load double, double* %13
%40 = load double, double* %12
%41 = load double, double* %12
%42 = fmul double %40, %41
%43 = fneg double %42
%44 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %39, double %43)
%45 = fdiv double %44, 3.000000e+00
store double %45, double* %15
%46 = load double, double* %12
%47 = load double, double* %12
%48 = fmul double %46, %47
%49 = load double, double* %12
%50 = fmul double %48, %49
%51 = load double, double* %12
%52 = fmul double 9.000000e+00, %51
%53 = load double, double* %13
%54 = fmul double %52, %53
%55 = fneg double %54
%56 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %50, double %55)
%57 = load double, double* %14
%58 = call double @llvm.fmuladd.f64(double 2.700000e+01, double %57, double %56)
%59 = fdiv double %58, 2.700000e+01
store double %59, double* %16
%60 = load double, double* %16
%61 = load double, double* %16
%62 = fmul double %60, %61
%63 = fdiv double %62, 4.000000e+00
%64 = load double, double* %15
%65 = load double, double* %15
%66 = fmul double %64, %65
%67 = load double, double* %15
%68 = fmul double %66, %67
%69 = fdiv double %68, 2.700000e+01
%70 = fadd double %63, %69
store double %70, double* %17
%71 = load double, double* %12
%72 = fdiv double %71, 3.000000e+00
store double %72, double* %18
%73 = load double, double* %17
%74 = fcmp ogt double %73, 0.000000e+00
br i1 %74, label %75, label %97
75: ; preds = %5
%76 = load double, double* %17
%77 = call double @sqrt(double %76)
store double %77, double* %19
%78 = load double, double* %16
%79 = fneg double %78
%80 = fdiv double %79, 2.000000e+00
%81 = load double, double* %19
%82 = fadd double %80, %81
%83 = call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %82)
%84 = load double, double* %16
%85 = fneg double %84
%86 = fdiv double %85, 2.000000e+00
%87 = load double, double* %19
%88 = fsub double %86, %87
%89 = call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %88)
%90 = add nsw i32 %83, %89
%91 = sitofp i32 %90 to double
store double %91, double* %20
%92 = load double, double* %20
%93 = load double, double* %18
%94 = fsub double %92, %93
%95 = load double*, double** %11
%96 = getelementptr inbounds double, double* %95, i64 0
store double %94, double* %96
store i32 1, i32* %6
br label %175
97: ; preds = %5
%98 = load double, double* %17
%99 = fcmp oeq double %98, 0.000000e+00
br i1 %99, label %100, label %120
100: ; preds = %97
%101 = load double, double* %16
%102 = fdiv double %101, 2.000000e+00
%103 = call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %102)
%104 = sitofp i32 %103 to double
store double %104, double* %21
%105 = load double, double* %21
%106 = load double, double* %18
%107 = fsub double %105, %106
store double %107, double* %22
%108 = load double, double* %22
%109 = load double*, double** %11
%110 = getelementptr inbounds double, double* %109, i64 0
store double %108, double* %110
%111 = load double, double* %22
%112 = load double*, double** %11
%113 = getelementptr inbounds double, double* %112, i64 1
store double %111, double* %113
%114 = load double, double* %21
%115 = load double, double* %18
%116 = fneg double %115
%117 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %114, double %116)
%118 = load double*, double** %11
%119 = getelementptr inbounds double, double* %118, i64 2
store double %117, double* %119
store i32 3, i32* %6
br label %175
120: ; preds = %97
%121 = load double, double* %17
%122 = fneg double %121
%123 = call double @sqrt(double %122)
store double %123, double* %23
%124 = load double, double* %16
%125 = fneg double %124
%126 = fdiv double %125, 2.000000e+00
%127 = load double, double* %23
%128 = call double @hypot(double %126, double %127)
store double %128, double* %24
%129 = load double, double* %23
%130 = load double, double* %16
%131 = fneg double %130
%132 = fdiv double %131, 2.000000e+00
%133 = call double @atan2(double %129, double %132)
store double %133, double* %25
%134 = load double, double* %24
%135 = call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %134)
%136 = sitofp i32 %135 to double
store double %136, double* %26
%137 = load double, double* %25
%138 = fdiv double %137, 3.000000e+00
%139 = call double @cos(double %138)
store double %139, double* %27
%140 = load double, double* %25
%141 = fdiv double %140, 3.000000e+00
%142 = call double @sin(double %141)
store double %142, double* %28
%143 = call double @sqrt(double 3.000000e+00)
store double %143, double* %29
%144 = load double, double* %26
%145 = fmul double 2.000000e+00, %144
%146 = load double, double* %27
%147 = load double, double* %18
%148 = fneg double %147
%149 = call double @llvm.fmuladd.f64(double %145, double %146, double %148)
%150 = load double*, double** %11
%151 = getelementptr inbounds double, double* %150, i64 0
store double %149, double* %151
%152 = load double, double* %26
%153 = fneg double %152
%154 = load double, double* %27
%155 = load double, double* %29
%156 = load double, double* %28
%157 = call double @llvm.fmuladd.f64(double %155, double %156, double %154)
%158 = load double, double* %18
%159 = fneg double %158
%160 = call double @llvm.fmuladd.f64(double %153, double %157, double %159)
%161 = load double*, double** %11
%162 = getelementptr inbounds double, double* %161, i64 1
store double %160, double* %162
%163 = load double, double* %26
%164 = fneg double %163
%165 = load double, double* %27
%166 = load double, double* %29
%167 = load double, double* %28
%168 = fneg double %166
%169 = call double @llvm.fmuladd.f64(double %168, double %167, double %165)
%170 = load double, double* %18
%171 = fneg double %170
%172 = call double @llvm.fmuladd.f64(double %164, double %169, double %171)
%173 = load double*, double** %11
%174 = getelementptr inbounds double, double* %173, i64 2
store double %172, double* %174
store i32 3, i32* %6
br label %175
175: ; preds = %120, %100, %75
%176 = load i32, i32* %6
ret i32 %176
}

LLVM IR (-O2):
define i32 @solve_cubic(double %0, double %1, double %2, double %3, double* nocapture writeonly %4) {
%6 = fdiv double %2, %3
%7 = insertelement <2 x double> poison, double %1, i64 0
%8 = insertelement <2 x double> %7, double %0, i64 1
%9 = insertelement <2 x double> poison, double %3, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fdiv <2 x double> %8, %10
%12 = fmul double %6, %6
%13 = fneg double %12
%14 = fmul double %6, %12
%15 = fmul double %6, -9.000000e+00
%16 = extractelement <2 x double> %11, i64 0
%17 = fmul double %16, %15
%18 = tail call double @llvm.fmuladd.f64(double %14, double 2.000000e+00, double %17)
%19 = insertelement <2 x double> poison, double %13, i64 0
%20 = insertelement <2 x double> %19, double %18, i64 1
%21 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> <double 3.000000e+00, double 2.700000e+01>, <2 x double> %20)
%22 = fdiv <2 x double> %21, <double 3.000000e+00, double 2.700000e+01>
%23 = fmul <2 x double> %22, %22
%24 = insertelement <2 x double> %22, double 2.500000e-01, i64 1
%25 = fmul <2 x double> %23, %24
%26 = extractelement <2 x double> %25, i64 0
%27 = fdiv double %26, 2.700000e+01
%28 = extractelement <2 x double> %25, i64 1
%29 = fadd double %27, %28
%30 = fdiv double %6, 3.000000e+00
%31 = fcmp ogt double %29, 0.000000e+00
br i1 %31, label %32, label %43
32: ; preds = %5
%33 = tail call double @sqrt(double %29)
%34 = extractelement <2 x double> %22, i64 1
%35 = fmul double %34, -5.000000e-01
%36 = fadd double %35, %33
%37 = tail call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %36)
%38 = fsub double %35, %33
%39 = tail call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %38)
%40 = add nsw i32 %39, %37
%41 = sitofp i32 %40 to double
%42 = fsub double %41, %30
store double %42, double* %4
br label %82
43: ; preds = %5
%44 = fcmp oeq double %29, 0.000000e+00
br i1 %44, label %45, label %55
45: ; preds = %43
%46 = extractelement <2 x double> %22, i64 1
%47 = fmul double %46, 5.000000e-01
%48 = tail call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %47)
%49 = sitofp i32 %48 to double
%50 = fsub double %49, %30
store double %50, double* %4
%51 = getelementptr inbounds double, double* %4, i64 1
store double %50, double* %51
%52 = fneg double %30
%53 = tail call double @llvm.fmuladd.f64(double %49, double -2.000000e+00, double %52)
%54 = getelementptr inbounds double, double* %4, i64 2
store double %53, double* %54
br label %82
55: ; preds = %43
%56 = fneg double %29
%57 = tail call double @sqrt(double %56)
%58 = extractelement <2 x double> %22, i64 1
%59 = fmul double %58, -5.000000e-01
%60 = tail call double @hypot(double %59, double %57)
%61 = tail call double @atan2(double %57, double %59)
%62 = tail call i32 (double, ...) bitcast (i32 (...)* @my_cbrt to i32 (double, ...)*)(double %60)
%63 = sitofp i32 %62 to double
%64 = fdiv double %61, 3.000000e+00
%65 = tail call double @cos(double %64)
%66 = tail call double @sin(double %64)
%67 = fmul double %63, 2.000000e+00
%68 = fneg double %30
%69 = fneg double %63
%70 = tail call double @llvm.fmuladd.f64(double %66, double 0x3FFBB67AE8584CAA, double %65)
%71 = insertelement <2 x double> poison, double %67, i64 0
%72 = insertelement <2 x double> %71, double %69, i64 1
%73 = insertelement <2 x double> poison, double %65, i64 0
%74 = insertelement <2 x double> %73, double %70, i64 1
%75 = insertelement <2 x double> poison, double %68, i64 0
%76 = shufflevector <2 x double> %75, <2 x double> poison, <2 x i32> zeroinitializer
%77 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %72, <2 x double> %74, <2 x double> %76)
%78 = bitcast double* %4 to <2 x double>*
store <2 x double> %77, <2 x double>* %78
%79 = tail call double @llvm.fmuladd.f64(double %66, double 0xBFFBB67AE8584CAA, double %65)
%80 = tail call double @llvm.fmuladd.f64(double %69, double %79, double %68)
%81 = getelementptr inbounds double, double* %4, i64 2
store double %80, double* %81
br label %82
82: ; preds = %55, %45, %32
%83 = phi i32 [ 1, %32 ], [ 3, %45 ], [ 3, %55 ]
ret i32 %83
}