#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 SolveCubic(double *, double *);
int SolveQuadric(double *, double *);
double sqrt(double);
int SolveQuartic(double c[5], double s[4]) {
  double coeffs[4];
  double z, u, v, sub;
  double A, B, C, D;
  double sq_A, p, q, r;
  int i, num;
  A = c[3] / c[4];
  B = c[2] / c[4];
  C = c[1] / c[4];
  D = c[0] / c[4];
  sq_A = A * A;
  p = -3.0 / 8 * sq_A + B;
  q = 1.0 / 8 * sq_A * A - 1.0 / 2 * A * B + C;
  r = -3.0 / 256 * sq_A * sq_A + 1.0 / 16 * sq_A * B - 1.0 / 4 * A * C + D;
  if (((r) > -1e-9 && (r) < 1e-9)) {
    coeffs[0] = q;
    coeffs[1] = p;
    coeffs[2] = 0;
    coeffs[3] = 1;
    num = SolveCubic(coeffs, s);
    s[num++] = 0;
  } else {
    coeffs[0] = 1.0 / 2 * r * p - 1.0 / 8 * q * q;
    coeffs[1] = -r;
    coeffs[2] = -1.0 / 2 * p;
    coeffs[3] = 1;
    (void)SolveCubic(coeffs, s);
    z = s[0];
    u = z * z - r;
    v = 2 * z - p;
    if (((u) > -1e-9 && (u) < 1e-9))
      u = 0;
    else if (u > 0)
      u = sqrt(u);
    else
      return 0;
    if (((v) > -1e-9 && (v) < 1e-9))
      v = 0;
    else if (v > 0)
      v = sqrt(v);
    else
      return 0;
    coeffs[0] = z - u;
    coeffs[1] = q < 0 ? -v : v;
    coeffs[2] = 1;
    num = SolveQuadric(coeffs, s);
    coeffs[0] = z + u;
    coeffs[1] = q < 0 ? v : -v;
    coeffs[2] = 1;
    num += SolveQuadric(coeffs, s + num);
  }
  sub = 1.0 / 4 * A;
  for (i = 0; i < num; ++i)
    s[i] -= sub;
  return num;
}


x86 assembly (clang, -O0):
<SolveQuartic>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm1
movsd  0xe6b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe4b(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm2
movsd  0xe2e(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xde8(%rip),%xmm1
mulsd  -0x88(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  0xdc8(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x70(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xda3(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xd55(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1332 <SolveQuartic+0x202>
movsd  0xd7b(%rip),%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jbe    1332 <SolveQuartic+0x202>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd4b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <SolveCubic@plt>
mov    %eax,-0xa8(%rbp)
mov    -0x18(%rbp),%rax
mov    -0xa8(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xa8(%rbp)
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1643 <SolveQuartic+0x513>
movsd  0xce6(%rip),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  0xcd6(%rip),%xmm1
mulsd  -0x98(%rbp),%xmm1
ff
mulsd  -0x98(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xc96(%rip),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x30(%rbp)
movsd  0xc79(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <SolveCubic@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0xa0(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x90(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xba6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1484 <SolveQuartic+0x354>
movsd  0xbcc(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1484 <SolveQuartic+0x354>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    14bb <SolveQuartic+0x38b>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    14aa <SolveQuartic+0x37a>
movsd  -0x50(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
jmp    14b6 <SolveQuartic+0x386>
movl   $0x0,-0x4(%rbp)
jmp    16ac <SolveQuartic+0x57c>
jmp    14bb <SolveQuartic+0x38b>
movsd  -0x58(%rbp),%xmm0
movsd  0xb38(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14f2 <SolveQuartic+0x3c2>
movsd  0xb5e(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    14f2 <SolveQuartic+0x3c2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1529 <SolveQuartic+0x3f9>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1518 <SolveQuartic+0x3e8>
movsd  -0x58(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
jmp    1524 <SolveQuartic+0x3f4>
movl   $0x0,-0x4(%rbp)
jmp    16ac <SolveQuartic+0x57c>
jmp    1529 <SolveQuartic+0x3f9>
movsd  -0x48(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x98(%rbp),%xmm0
ff
jbe    1572 <SolveQuartic+0x442>
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    157f <SolveQuartic+0x44f>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
movsd  0xaac(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <SolveQuadric@plt>
mov    %eax,-0xa8(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x98(%rbp),%xmm0
ff
jbe    15de <SolveQuartic+0x4ae>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    1602 <SolveQuartic+0x4d2>
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
movsd  0xa29(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0xa8(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <SolveQuadric@plt>
add    -0xa8(%rbp),%eax
mov    %eax,-0xa8(%rbp)
movsd  0x9bd(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0xa8(%rbp),%eax
jge    16a3 <SolveQuartic+0x573>
movsd  -0x60(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    165f <SolveQuartic+0x52f>
mov    -0xa8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SolveQuartic>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
movsd  0x18(%rdi),%xmm4
movsd  0x20(%rdi),%xmm3
divsd  %xmm3,%xmm4
movsd  0x10(%rdi),%xmm2
divsd  %xmm3,%xmm2
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
divsd  %xmm3,%xmm1
divsd  %xmm3,%xmm0
movapd %xmm4,%xmm7
mulsd  %xmm4,%xmm7
movsd  0xe87(%rip),%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm2,%xmm6
movsd  0xe7f(%rip),%xmm5
mulsd  %xmm7,%xmm5
movsd  0xe7b(%rip),%xmm3
mulsd  %xmm4,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm4,%xmm5
addsd  %xmm3,%xmm5
addsd  %xmm1,%xmm5
movsd  0xe67(%rip),%xmm3
mulsd  %xmm7,%xmm3
mulsd  %xmm7,%xmm3
mulsd  0xe5f(%rip),%xmm7
mulsd  %xmm2,%xmm7
addsd  %xmm3,%xmm7
mulsd  0xe57(%rip),%xmm4
movapd %xmm4,0x60(%rsp)
mulsd  %xmm4,%xmm1
subsd  %xmm1,%xmm7
addsd  %xmm0,%xmm7
ucomisd 0xe45(%rip),%xmm7
jbe    1245 <SolveQuartic+0x115>
movsd  0xe43(%rip),%xmm0
ucomisd %xmm7,%xmm0
jbe    1245 <SolveQuartic+0x115>
movsd  %xmm5,0x10(%rsp)
movsd  %xmm6,0x18(%rsp)
xorpd  %xmm0,%xmm0
movhpd 0xe3d(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <SolveCubic@plt>
mov    %eax,%r14d
cltq
add    $0x1,%r14d
movq   $0x0,(%rbx,%rax,8)
test   %r14d,%r14d
jg     1451 <SolveQuartic+0x321>
jmp    1537 <SolveQuartic+0x407>
movsd  0xdf3(%rip),%xmm0
mulsd  %xmm7,%xmm0
movsd  0xdef(%rip),%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm6,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0xde9(%rip),%xmm0
xorpd  %xmm7,%xmm0
movlpd %xmm0,0x18(%rsp)
movsd  0xd87(%rip),%xmm0
movsd  %xmm6,0x50(%rsp)
mulsd  %xmm6,%xmm0
movsd  %xmm0,0x20(%rsp)
movabs $0x3ff0000000000000,%r12
mov    %r12,0x28(%rsp)
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
movapd %xmm5,0x40(%rsp)
movapd %xmm7,0x30(%rsp)
call   1040 <SolveCubic@plt>
movapd 0x40(%rsp),%xmm2
movsd  (%rbx),%xmm3
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
subsd  0x30(%rsp),%xmm0
ucomisd 0xd4f(%rip),%xmm0
jbe    133b <SolveQuartic+0x20b>
xorpd  %xmm4,%xmm4
movsd  0xd49(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    133b <SolveQuartic+0x20b>
movapd %xmm3,%xmm0
addsd  %xmm3,%xmm0
subsd  0x50(%rsp),%xmm0
ucomisd 0xd25(%rip),%xmm0
jbe    131f <SolveQuartic+0x1ef>
xorpd  %xmm5,%xmm5
movsd  0xd1f(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     139b <SolveQuartic+0x26b>
xor    %r14d,%r14d
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1537 <SolveQuartic+0x407>
jb     1374 <SolveQuartic+0x244>
xorps  %xmm5,%xmm5
sqrtsd %xmm0,%xmm5
jmp    139b <SolveQuartic+0x26b>
xor    %r14d,%r14d
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1537 <SolveQuartic+0x407>
jb     1357 <SolveQuartic+0x227>
xorps  %xmm4,%xmm4
sqrtsd %xmm0,%xmm4
jmp    12f5 <SolveQuartic+0x1c5>
movsd  %xmm3,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
movapd 0x40(%rsp),%xmm2
movapd %xmm0,%xmm4
jmp    12f5 <SolveQuartic+0x1c5>
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x30(%rsp)
call   1050 <sqrt@plt>
movsd  0x30(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movapd 0x40(%rsp),%xmm2
movapd %xmm0,%xmm5
movsd  %xmm4,0x30(%rsp)
movsd  %xmm3,0x8(%rsp)
movapd %xmm3,%xmm0
subsd  %xmm4,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
movapd 0xc9b(%rip),%xmm0
xorpd  %xmm5,%xmm0
movapd %xmm0,0x50(%rsp)
ja     13d5 <SolveQuartic+0x2a5>
movapd %xmm5,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %r12,0x20(%rsp)
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
movapd %xmm5,0x70(%rsp)
call   1030 <SolveQuadric@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x40(%rsp),%xmm0
cmpltsd 0xc41(%rip),%xmm0
movapd 0x70(%rsp),%xmm1
andpd  %xmm0,%xmm1
andnpd 0x50(%rsp),%xmm0
orpd   %xmm1,%xmm0
movlpd %xmm0,0x18(%rsp)
mov    %r12,0x20(%rsp)
movslq %eax,%r14
lea    (%rbx,%r14,8),%rsi
mov    %r15,%rdi
call   1030 <SolveQuadric@plt>
add    %eax,%r14d
test   %r14d,%r14d
jle    1537 <SolveQuartic+0x407>
mov    %r14d,%eax
cmp    $0x4,%r14d
jae    1467 <SolveQuartic+0x337>
xor    %ecx,%ecx
movapd 0x60(%rsp),%xmm5
jmp    1520 <SolveQuartic+0x3f0>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd 0x60(%rsp),%xmm5
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1549 <SolveQuartic+0x419>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd (%rbx,%rdx,8),%xmm1
movupd 0x10(%rbx,%rdx,8),%xmm2
movupd 0x20(%rbx,%rdx,8),%xmm3
movupd 0x30(%rbx,%rdx,8),%xmm4
subpd  %xmm0,%xmm1
subpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rdx,8)
movupd %xmm2,0x10(%rbx,%rdx,8)
subpd  %xmm0,%xmm3
subpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rbx,%rdx,8)
movupd %xmm4,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    14a0 <SolveQuartic+0x370>
test   $0x1,%sil
je     150c <SolveQuartic+0x3dc>
movupd (%rbx,%rdx,8),%xmm1
movupd 0x10(%rbx,%rdx,8),%xmm2
subpd  %xmm0,%xmm1
subpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rdx,8)
movupd %xmm2,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
je     1537 <SolveQuartic+0x407>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rcx,8),%xmm0
subsd  %xmm5,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1520 <SolveQuartic+0x3f0>
mov    %r14d,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %edx,%edx
test   $0x1,%sil
jne    14ee <SolveQuartic+0x3be>
jmp    150c <SolveQuartic+0x3dc>

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

LLVM IR (-O2):
define i32 @SolveQuartic(double* nocapture %0, double* %1) {
%3 = alloca [4 x double]
%4 = bitcast [4 x double]* %3 to i8*
%5 = getelementptr inbounds double, double* %0, i64 3
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %0, i64 4
%8 = load double, double* %7
%9 = fdiv double %6, %8
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = fdiv double %11, %8
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = fdiv double %14, %8
%16 = load double, double* %0
%17 = fdiv double %16, %8
%18 = fmul double %9, %9
%19 = tail call double @llvm.fmuladd.f64(double %18, double -3.750000e-01, double %12)
%20 = fmul double %18, 1.250000e-01
%21 = fmul double %9, -5.000000e-01
%22 = fmul double %21, %12
%23 = tail call double @llvm.fmuladd.f64(double %20, double %9, double %22)
%24 = fadd double %15, %23
%25 = fmul double %18, 0xBF88000000000000
%26 = fmul double %18, 6.250000e-02
%27 = fmul double %12, %26
%28 = tail call double @llvm.fmuladd.f64(double %25, double %18, double %27)
%29 = fmul double %9, 2.500000e-01
%30 = fneg double %29
%31 = tail call double @llvm.fmuladd.f64(double %30, double %15, double %28)
%32 = fadd double %17, %31
%33 = fcmp ogt double %32, -1.000000e-09
%34 = fcmp olt double %32, 1.000000e-09
%35 = and i1 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %2
%37 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
store double %24, double* %37
%38 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 1
store double %19, double* %38
%39 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 2
%40 = bitcast double* %39 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %40
%41 = call i32 @SolveCubic(double* %37, double* %1)
%42 = add nsw i32 %41, 1
%43 = sext i32 %41 to i64
%44 = getelementptr inbounds double, double* %1, i64 %43
store double 0.000000e+00, double* %44
br label %90
45: ; preds = %2
%46 = fmul double %32, 5.000000e-01
%47 = fmul double %24, -1.250000e-01
%48 = fmul double %24, %47
%49 = tail call double @llvm.fmuladd.f64(double %46, double %19, double %48)
%50 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
store double %49, double* %50
%51 = fneg double %32
%52 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 1
store double %51, double* %52
%53 = fmul double %19, -5.000000e-01
%54 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 2
store double %53, double* %54
%55 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 3
store double 1.000000e+00, double* %55
%56 = call i32 @SolveCubic(double* %50, double* %1)
%57 = load double, double* %1
%58 = call double @llvm.fmuladd.f64(double %57, double %57, double %51)
%59 = fneg double %19
%60 = call double @llvm.fmuladd.f64(double %57, double 2.000000e+00, double %59)
%61 = fcmp ogt double %58, -1.000000e-09
%62 = fcmp olt double %58, 1.000000e-09
%63 = and i1 %61, %62
br i1 %63, label %68, label %64
64: ; preds = %45
%65 = fcmp ogt double %58, 0.000000e+00
br i1 %65, label %66, label %161
66: ; preds = %64
%67 = call double @sqrt(double %58)
br label %68
68: ; preds = %45, %66
%69 = phi double [ %67, %66 ], [ 0.000000e+00, %45 ]
%70 = fcmp ogt double %60, -1.000000e-09
%71 = fcmp olt double %60, 1.000000e-09
%72 = and i1 %70, %71
br i1 %72, label %77, label %73
73: ; preds = %68
%74 = fcmp ogt double %60, 0.000000e+00
br i1 %74, label %75, label %161
75: ; preds = %73
%76 = call double @sqrt(double %60)
br label %77
77: ; preds = %68, %75
%78 = phi double [ %76, %75 ], [ 0.000000e+00, %68 ]
%79 = fsub double %57, %69
store double %79, double* %50
%80 = fcmp olt double %24, 0.000000e+00
%81 = fneg double %78
%82 = select i1 %80, double %81, double %78
store double %82, double* %52
store double 1.000000e+00, double* %54
%83 = call i32 @SolveQuadric(double* %50, double* %1)
%84 = fadd double %57, %69
store double %84, double* %50
%85 = select i1 %80, double %78, double %81
store double %85, double* %52
store double 1.000000e+00, double* %54
%86 = sext i32 %83 to i64
%87 = getelementptr inbounds double, double* %1, i64 %86
%88 = call i32 @SolveQuadric(double* %50, double* %87)
%89 = add nsw i32 %88, %83
br label %90
90: ; preds = %77, %36
%91 = phi i32 [ %42, %36 ], [ %89, %77 ]
%92 = icmp sgt i32 %91, 0
br i1 %92, label %93, label %161
93: ; preds = %90
%94 = zext i32 %91 to i64
%95 = icmp ult i32 %91, 4
br i1 %95, label %152, label %96
96: ; preds = %93
%97 = and i64 %94, 4294967292
%98 = insertelement <2 x double> poison, double %29, i64 0
%99 = shufflevector <2 x double> %98, <2 x double> poison, <2 x i32> zeroinitializer
%100 = insertelement <2 x double> poison, double %29, i64 0
%101 = shufflevector <2 x double> %100, <2 x double> poison, <2 x i32> zeroinitializer
%102 = add nsw i64 %97, -4
%103 = lshr exact i64 %102, 2
%104 = add nuw nsw i64 %103, 1
%105 = and i64 %104, 1
%106 = icmp eq i64 %102, 0
br i1 %106, label %136, label %107
107: ; preds = %96
%108 = and i64 %104, 9223372036854775806
br label %109
109: ; preds = %109, %107
%110 = phi i64 [ 0, %107 ], [ %133, %109 ]
%111 = phi i64 [ 0, %107 ], [ %134, %109 ]
%112 = getelementptr inbounds double, double* %1, i64 %110
%113 = bitcast double* %112 to <2 x double>*
%114 = load <2 x double>, <2 x double>* %113
%115 = getelementptr inbounds double, double* %112, i64 2
%116 = bitcast double* %115 to <2 x double>*
%117 = load <2 x double>, <2 x double>* %116
%118 = fsub <2 x double> %114, %99
%119 = fsub <2 x double> %117, %101
%120 = bitcast double* %112 to <2 x double>*
store <2 x double> %118, <2 x double>* %120
%121 = bitcast double* %115 to <2 x double>*
store <2 x double> %119, <2 x double>* %121
%122 = or i64 %110, 4
%123 = getelementptr inbounds double, double* %1, i64 %122
%124 = bitcast double* %123 to <2 x double>*
%125 = load <2 x double>, <2 x double>* %124
%126 = getelementptr inbounds double, double* %123, i64 2
%127 = bitcast double* %126 to <2 x double>*
%128 = load <2 x double>, <2 x double>* %127
%129 = fsub <2 x double> %125, %99
%130 = fsub <2 x double> %128, %101
%131 = bitcast double* %123 to <2 x double>*
store <2 x double> %129, <2 x double>* %131
%132 = bitcast double* %126 to <2 x double>*
store <2 x double> %130, <2 x double>* %132
%133 = add nuw i64 %110, 8
%134 = add i64 %111, 2
%135 = icmp eq i64 %134, %108
br i1 %135, label %136, label %109
136: ; preds = %109, %96
%137 = phi i64 [ 0, %96 ], [ %133, %109 ]
%138 = icmp eq i64 %105, 0
br i1 %138, label %150, label %139
139: ; preds = %136
%140 = getelementptr inbounds double, double* %1, i64 %137
%141 = bitcast double* %140 to <2 x double>*
%142 = load <2 x double>, <2 x double>* %141
%143 = getelementptr inbounds double, double* %140, i64 2
%144 = bitcast double* %143 to <2 x double>*
%145 = load <2 x double>, <2 x double>* %144
%146 = fsub <2 x double> %142, %99
%147 = fsub <2 x double> %145, %101
%148 = bitcast double* %140 to <2 x double>*
store <2 x double> %146, <2 x double>* %148
%149 = bitcast double* %143 to <2 x double>*
store <2 x double> %147, <2 x double>* %149
br label %150
150: ; preds = %136, %139
%151 = icmp eq i64 %97, %94
br i1 %151, label %161, label %152
152: ; preds = %93, %150
%153 = phi i64 [ 0, %93 ], [ %97, %150 ]
br label %154
154: ; preds = %152, %154
%155 = phi i64 [ %159, %154 ], [ %153, %152 ]
%156 = getelementptr inbounds double, double* %1, i64 %155
%157 = load double, double* %156
%158 = fsub double %157, %29
store double %158, double* %156
%159 = add nuw nsw i64 %155, 1
%160 = icmp eq i64 %159, %94
br i1 %160, label %161, label %154
161: ; preds = %154, %150, %90, %73, %64
%162 = phi i32 [ 0, %64 ], [ 0, %73 ], [ %91, %90 ], [ %91, %150 ], [ %91, %154 ]
ret i32 %162
}