#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 acos(double);
double cos(double);
double pow(double, int);
double sin(double);
double sqrt(int);
int solve_cubic_equation(double c3, double c2, double c1, double c0, double *x1,
                         double *x2, double *x3) {
  double a2 = c2 / c3;
  double a1 = c1 / c3;
  double a0 = c0 / c3;
  double q = a1 / 3.0 - a2 * a2 / 9.0;
  double r = (a1 * a2 - 3.0 * a0) / 6.0 - a2 * a2 * a2 / 27.0;
  double delta = q * q * q + r * r;
  if (delta > 0.0) {
    double s1 = r + sqrt(delta);
    s1 = (s1 >= 0.0) ? pow(s1, 1. / 3.) : -pow(-s1, 1. / 3.);
    double s2 = r - sqrt(delta);
    s2 = (s2 >= 0.0) ? pow(s2, 1. / 3.) : -pow(-s2, 1. / 3.);
    *x1 = (s1 + s2) - a2 / 3.0;
    *x2 = *x3 = -0.5 * (s1 + s2) - a2 / 3.0;
    return 1;
  } else if (delta < 0.0) {
    double theta = acos(r / sqrt(-q * q * q)) / 3.0;
    double costh = cos(theta);
    double sinth = sin(theta);
    double sq = sqrt(-q);
    *x1 = 2.0 * sq * costh - a2 / 3.0;
    *x2 = -sq * costh - a2 / 3.0 - sqrt(3.) * sq * sinth;
    *x3 = -sq * costh - a2 / 3.0 + sqrt(3.) * sq * sinth;
    return 3;
  } else {
    double s = (r >= 0.0) ? pow(r, 1. / 3.) : -pow(-r, 1. / 3.);
    *x1 = 2.0 * s - a2 / 3.0;
    *x2 = *x3 = -s - a2 / 3.0;
    return 3;
  }
}


x86 assembly (clang, -O0):
<solve_cubic_equation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xe5b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movsd  0xe4d(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  0xe26(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdf2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movsd  0xdcf(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1445 <solve_cubic_equation+0x2f5>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
cvttsd2si -0x70(%rbp),%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12cc <solve_cubic_equation+0x17c>
movsd  -0x78(%rbp),%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    130e <solve_cubic_equation+0x1be>
movsd  -0x78(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
cvttsd2si -0x70(%rbp),%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1371 <solve_cubic_equation+0x221>
movsd  -0x80(%rbp),%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    13b3 <solve_cubic_equation+0x263>
movsd  -0x80(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  0xc39(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x78(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  0xc12(%rip),%xmm2
divsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xc07(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    17ab <solve_cubic_equation+0x65b>
xorps  %xmm0,%xmm0
ucomisd -0x70(%rbp),%xmm0
jbe    16a3 <solve_cubic_equation+0x553>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xe0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
call   1030 <acos@plt>
movsd  0xb65(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1050 <cos@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1040 <sin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xb0a(%rip),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x48(%rbp),%xmm1
movsd  0xadd(%rip),%xmm3
divsd  %xmm3,%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  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x48(%rbp),%xmm1
movsd  0xa7e(%rip),%xmm3
divsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
mov    $0x3,%edi
call   1070 <sqrt@plt>
movsd  -0xd8(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x48(%rbp),%xmm1
movsd  0x9d6(%rip),%xmm3
divsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    $0x3,%edi
call   1070 <sqrt@plt>
movsd  -0xd0(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x3,-0x4(%rbp)
jmp    17ab <solve_cubic_equation+0x65b>
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     16ce <solve_cubic_equation+0x57e>
movsd  -0x68(%rbp),%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movsd  %xmm0,-0xe8(%rbp)
ff
jmp    1710 <solve_cubic_equation+0x5c0>
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0x48(%rbp),%xmm1
movsd  0x8db(%rip),%xmm2
divsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%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  -0x48(%rbp),%xmm1
movsd  0x884(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_cubic_equation>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
divsd  %xmm0,%xmm1
divsd  %xmm0,%xmm3
movapd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
shufpd $0x2,0xe8d(%rip),%xmm0
unpcklpd %xmm4,%xmm2
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
divsd  0xea9(%rip),%xmm0
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movapd %xmm2,%xmm5
unpckhpd %xmm2,%xmm5
mulsd  0xe98(%rip),%xmm3
subsd  %xmm5,%xmm0
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm1,%xmm4
unpcklpd %xmm4,%xmm2
divpd  0xe4e(%rip),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
subsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
jbe    1231 <solve_cubic_equation+0xe1>
cvttsd2si %xmm1,%ebp
mov    %ebp,%edi
movapd %xmm2,0x10(%rsp)
call   1070 <sqrt@plt>
addsd  0x10(%rsp),%xmm0
ucomisd 0xe39(%rip),%xmm0
jae    133c <solve_cubic_equation+0x1ec>
xorpd  0xe03(%rip),%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
xorpd  0xdf4(%rip),%xmm0
jmp    1343 <solve_cubic_equation+0x1f3>
ucomisd %xmm1,%xmm3
jbe    1381 <solve_cubic_equation+0x231>
movapd 0xddd(%rip),%xmm3
xorpd  %xmm0,%xmm3
movapd %xmm3,0x20(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
movapd %xmm2,0x10(%rsp)
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <acos@plt>
divsd  0xdad(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
cvttsd2si 0x20(%rsp),%edi
call   1070 <sqrt@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x20(%rsp)
addsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm1
divsd  0xd6c(%rip),%xmm1
movsd  0x30(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx)
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    $0x3,%ebx
mov    $0x3,%edi
call   1070 <sqrt@plt>
mulsd  0x20(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r15)
mov    $0x3,%edi
call   1070 <sqrt@plt>
mulsd  0x20(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
jmp    1438 <solve_cubic_equation+0x2e8>
xor    %edi,%edi
call   1060 <pow@plt>
movapd %xmm0,0x20(%rsp)
mov    %ebp,%edi
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jae    13a8 <solve_cubic_equation+0x258>
xorpd  0xcb4(%rip),%xmm1
movapd %xmm1,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
xorpd  0xca1(%rip),%xmm0
jmp    13b3 <solve_cubic_equation+0x263>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jae    13f4 <solve_cubic_equation+0x2a4>
xorpd  0xc8d(%rip),%xmm2
movapd %xmm2,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
xorpd  0xc7a(%rip),%xmm0
jmp    13ff <solve_cubic_equation+0x2af>
movapd %xmm1,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movapd 0x20(%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm1
divsd  0xc65(%rip),%xmm1
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
mulsd  0xc61(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%r14)
movsd  %xmm2,(%r15)
mov    $0x1,%ebx
jmp    1438 <solve_cubic_equation+0x2e8>
movapd %xmm2,%xmm0
xor    %edi,%edi
call   1060 <pow@plt>
movsd  0x8(%rsp),%xmm2
divsd  0xc23(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rbx)
xorpd  0xbfb(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,(%r14)
movsd  %xmm0,(%r15)
mov    $0x3,%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @solve_cubic_equation(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = fdiv double %1, %0
%9 = fdiv double %3, %0
%10 = fmul double %8, %8
%11 = insertelement <2 x double> poison, double %2, i64 0
%12 = insertelement <2 x double> %11, double %10, i64 1
%13 = insertelement <2 x double> <double poison, double 9.000000e+00>, double %0, i64 0
%14 = fdiv <2 x double> %12, %13
%15 = extractelement <2 x double> %14, i64 0
%16 = fdiv double %15, 3.000000e+00
%17 = extractelement <2 x double> %14, i64 1
%18 = fsub double %16, %17
%19 = fmul double %9, -3.000000e+00
%20 = tail call double @llvm.fmuladd.f64(double %15, double %8, double %19)
%21 = fmul double %8, %10
%22 = insertelement <2 x double> poison, double %20, i64 0
%23 = insertelement <2 x double> %22, double %21, i64 1
%24 = fdiv <2 x double> %23, <double 6.000000e+00, double 2.700000e+01>
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%26 = fsub <2 x double> %24, %25
%27 = extractelement <2 x double> %26, i64 0
%28 = fmul double %18, %18
%29 = fmul <2 x double> %26, %26
%30 = extractelement <2 x double> %29, i64 0
%31 = tail call double @llvm.fmuladd.f64(double %28, double %18, double %30)
%32 = fcmp ogt double %31, 0.000000e+00
br i1 %32, label %33, label %62
33: ; preds = %7
%34 = fptosi double %31 to i32
%35 = tail call double @sqrt(i32 %34)
%36 = fadd double %27, %35
%37 = fcmp ult double %36, 0.000000e+00
br i1 %37, label %40, label %38
38: ; preds = %33
%39 = tail call double @pow(double %36, i32 0)
br label %44
40: ; preds = %33
%41 = fneg double %36
%42 = tail call double @pow(double %41, i32 0)
%43 = fneg double %42
br label %44
44: ; preds = %40, %38
%45 = phi double [ %39, %38 ], [ %43, %40 ]
%46 = tail call double @sqrt(i32 %34)
%47 = fsub double %27, %46
%48 = fcmp ult double %47, 0.000000e+00
br i1 %48, label %51, label %49
49: ; preds = %44
%50 = tail call double @pow(double %47, i32 0)
br label %55
51: ; preds = %44
%52 = fneg double %47
%53 = tail call double @pow(double %52, i32 0)
%54 = fneg double %53
br label %55
55: ; preds = %51, %49
%56 = phi double [ %50, %49 ], [ %54, %51 ]
%57 = fadd double %45, %56
%58 = fdiv double %8, 3.000000e+00
%59 = fsub double %57, %58
store double %59, double* %4
%60 = fneg double %58
%61 = tail call double @llvm.fmuladd.f64(double %57, double -5.000000e-01, double %60)
store double %61, double* %6
store double %61, double* %5
br label %104
62: ; preds = %7
%63 = fcmp olt double %31, 0.000000e+00
br i1 %63, label %64, label %89
64: ; preds = %62
%65 = fneg double %18
%66 = fmul double %18, %65
%67 = fmul double %18, %66
%68 = fptosi double %67 to i32
%69 = tail call double @sqrt(i32 %68)
%70 = fdiv double %27, %69
%71 = tail call double @acos(double %70)
%72 = fdiv double %71, 3.000000e+00
%73 = tail call double @cos(double %72)
%74 = tail call double @sin(double %72)
%75 = fptosi double %65 to i32
%76 = tail call double @sqrt(i32 %75)
%77 = fmul double %76, 2.000000e+00
%78 = fdiv double %8, -3.000000e+00
%79 = tail call double @llvm.fmuladd.f64(double %77, double %73, double %78)
store double %79, double* %4
%80 = fneg double %76
%81 = tail call double @llvm.fmuladd.f64(double %80, double %73, double %78)
%82 = tail call double @sqrt(i32 3)
%83 = fneg double %82
%84 = fmul double %76, %83
%85 = tail call double @llvm.fmuladd.f64(double %84, double %74, double %81)
store double %85, double* %5
%86 = tail call double @sqrt(i32 3)
%87 = fmul double %76, %86
%88 = tail call double @llvm.fmuladd.f64(double %87, double %74, double %81)
store double %88, double* %6
br label %104
89: ; preds = %62
%90 = fcmp ult double %27, 0.000000e+00
br i1 %90, label %93, label %91
91: ; preds = %89
%92 = tail call double @pow(double %27, i32 0)
br label %97
93: ; preds = %89
%94 = fneg double %27
%95 = tail call double @pow(double %94, i32 0)
%96 = fneg double %95
br label %97
97: ; preds = %93, %91
%98 = phi double [ %92, %91 ], [ %96, %93 ]
%99 = fdiv double %8, 3.000000e+00
%100 = fneg double %99
%101 = tail call double @llvm.fmuladd.f64(double %98, double 2.000000e+00, double %100)
store double %101, double* %4
%102 = fneg double %98
%103 = fsub double %102, %99
store double %103, double* %6
store double %103, double* %5
br label %104
104: ; preds = %97, %64, %55
%105 = phi i32 [ 1, %55 ], [ 3, %64 ], [ 3, %97 ]
ret i32 %105
}