user: Please show me the C implementation that matches the assembly code listed below:

```asm
<SolveCubic>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rsi,%rbx
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsp)
  fldl   (%rsp)
  fstpt  0x10(%rsp)
  fldt   0x10(%rsp)
  divsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsp)
  fldl   (%rsp)
  fld    %st(1)
  fmul   %st(2),%st
  flds   0xe38(%rip)        # 2028 <_fini+0xaf0>
  fmul   %st(2),%st
  fsubrp %st,%st(1)
  flds   0xe32(%rip)        # 202c <_fini+0xaf4>
  fdivr  %st,%st(1)
  fxch   %st(1)
  fld    %st(0)
  fstpt  0x20(%rsp)
  fld    %st(3)
  fadd   %st(4),%st
  fmul   %st(4),%st
  fmul   %st(4),%st
  fxch   %st(4)
  fmulp  %st,%st(2)
  fxch   %st(2)
  fmulp  %st,%st(1)
  fsubrp %st,%st(2)
  divsd  %xmm0,%xmm3
  movsd  %xmm3,(%rsp)
  flds   0xe0b(%rip)        # 2030 <_fini+0xaf8>
  fmull  (%rsp)
  faddp  %st,%st(2)
  fxch   %st(1)
  fdivs  0xe02(%rip)        # 2034 <_fini+0xafc>
  fld    %st(0)
  fstpt  (%rsp)
  fld    %st(1)
  fmul   %st(2),%st
  fmulp  %st,%st(2)
  fld    %st(0)
  fmulp  %st,%st(1)
  fsub   %st(1),%st
  fstpl  0x38(%rsp)
  movsd  0x38(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  jae    L18
  fstp   %st(0)
  movl   $0x1,(%rdi)
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L57
  sqrtsd %xmm0,%xmm0
  movsd  %xmm0,0x38(%rsp)
L76:
  push   0x8(%rsp)
  push   0x8(%rsp)
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  addsd  0x48(%rsp),%xmm0
  cvttsd2si %xmm0,%rdi
  mov    $0x0,%esi
  call   <pow@plt>
  movsd  %xmm0,0x48(%rsp)
  fldl   0x48(%rsp)
  fldt   0x30(%rsp)
  fdiv   %st(1),%st
  faddp  %st,%st(1)
  fstpl  0x30(%rsp)
  movsd  0x30(%rsp),%xmm1
  add    $0x10,%rsp
  movsd  D43(%rip),%xmm0
  fldt   (%rsp)
  fldz
  fcomip %st(1),%st
  fstp   %st(0)
  ja     L80
  movsd  D28(%rip),%xmm0
L80:
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsp)
  fldt   0x10(%rsp)
  fdivs  0xd34(%rip)        # 2028 <_fini+0xaf0>
  fsubrl (%rsp)
  fstpl  (%rbx)
L42:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  ret
L18:
  movl   $0x3,(%rdi)
  fstpl  0x38(%rsp)
  movsd  0x38(%rsp),%xmm0
  ucomisd %xmm0,%xmm1
  ja     L71
  sqrtsd %xmm0,%xmm0
  movsd  %xmm0,0x38(%rsp)
L70:
  fldt   (%rsp)
  fdivl  0x38(%rsp)
  lea    -0x10(%rsp),%rsp
  fstpt  (%rsp)
  call   <acos@plt>
  movapd %xmm0,%xmm5
  movsd  %xmm0,0x10(%rsp)
  fldt   0x30(%rsp)
  fstpl  0x30(%rsp)
  movsd  0x30(%rsp),%xmm4
  add    $0x10,%rsp
  pxor   %xmm0,%xmm0
  ucomisd %xmm4,%xmm0
  ja     L73
  sqrtsd %xmm4,%xmm4
  movq   %xmm4,%rbp
  movapd %xmm4,%xmm6
  mulsd  D31(%rip),%xmm6
  movsd  %xmm6,0x20(%rsp)
  movapd %xmm5,%xmm0
  divsd  D41(%rip),%xmm0
  call   <cos@plt>
  fldt   0x10(%rsp)
  fdivs  0xc90(%rip)        # 2028 <_fini+0xaf0>
  movapd %xmm0,%xmm7
  mulsd  0x20(%rsp),%xmm7
  movsd  %xmm7,0x38(%rsp)
  fld    %st(0)
  fstpt  0x10(%rsp)
  fsubrl 0x38(%rsp)
  fstpl  (%rbx)
  mov    $0x1,%edi
  call   <atan@plt>
  shl    $0x2,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  addsd  %xmm0,%xmm0
  addsd  (%rsp),%xmm0
  divsd  D41(%rip),%xmm0
  call   <cos@plt>
  mulsd  0x20(%rsp),%xmm0
  movsd  %xmm0,0x20(%rsp)
  fldt   0x10(%rsp)
  fsubrl 0x20(%rsp)
  fstpl  0x8(%rbx)
L82:
  mov    $0x1,%edi
  call   <atan@plt>
  shl    $0x2,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  D105(%rip),%xmm0
  addsd  (%rsp),%xmm0
  divsd  D41(%rip),%xmm0
  call   <cos@plt>
  movapd %xmm0,%xmm1
  movq   %rbp,%xmm0
  mulsd  D31(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rsp)
  fldt   0x10(%rsp)
  fsubrl (%rsp)
  fstpl  0x10(%rbx)
  jmp    L42
L71:
  call   <sqrt@plt>
  movsd  %xmm0,0x38(%rsp)
  jmp    L70
L73:
  movsd  0x20(%rsp),%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rbp
  movsd  (%rsp),%xmm7
  divsd  D41(%rip),%xmm7
  movapd %xmm7,%xmm0
  call   <cos@plt>
  fldt   0x10(%rsp)
  fdivs  0xb9a(%rip)        # 2028 <_fini+0xaf0>
  movq   %rbp,%xmm6
  mulsd  D31(%rip),%xmm6
  mulsd  %xmm0,%xmm6
  movsd  %xmm6,0x38(%rsp)
  fld    %st(0)
  fstpt  0x10(%rsp)
  fsubrl 0x38(%rsp)
  fstpl  (%rbx)
  movsd  0x20(%rsp),%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rbp
  mov    $0x1,%edi
  call   <atan@plt>
  shl    $0x2,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  addsd  %xmm0,%xmm0
  addsd  (%rsp),%xmm0
  divsd  D41(%rip),%xmm0
  call   <cos@plt>
  movsd  D31(%rip),%xmm7
  movq   %rbp,%xmm5
  mulsd  %xmm5,%xmm7
  mulsd  %xmm0,%xmm7
  movsd  %xmm7,0x38(%rsp)
  fldt   0x10(%rsp)
  fsubrl 0x38(%rsp)
  fstpl  0x8(%rbx)
  movsd  0x20(%rsp),%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rbp
  jmp    L82
L57:
  call   <sqrt@plt>
  movsd  %xmm0,0x38(%rsp)
  jmp    L76
```

tool_calls: name: read_data
arguments: data_tag: D43
type_guessed: f32[2]
name: read_data
arguments: data_tag: D28
type_guessed: f32[2]
name: read_data
arguments: data_tag: D31
type_guessed: f32[2]
name: read_data
arguments: data_tag: D41
type_guessed: f32[2]
name: read_data
arguments: data_tag: D105
type_guessed: f64

tool: {"D43": [0.0,1.875]}

tool: {"D28": [0.0,-1.875]}

tool: {"D31": [0.0,-2.0]}

tool: {"D41": [0.0,2.125]}

tool: D105: 4

assistant: ```c
void SolveCubic(double a, double b, double c, double d, int *solutions, double *x) {
  long double a1 = b / a, a2 = c / a, a3 = d / a;
  long double Q = (a1 * a1 - 3.0 * a2) / 9.0;
  long double R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0;
  double R2_Q3 = R * R - Q * Q * Q;
  double theta;
  if (R2_Q3 <= 0) {
    *solutions = 3;
    theta = acos(R / sqrt(Q * Q * Q));
    x[0] = -2.0 * sqrt(Q) * cos(theta / 3.0) - a1 / 3.0;
    x[1] = -2.0 * sqrt(Q) * cos((theta + 2.0 * (4 * atan(1))) / 3.0) - a1 / 3.0;
    x[2] = -2.0 * sqrt(Q) * cos((theta + 4.0 * (4 * atan(1))) / 3.0) - a1 / 3.0;
  } else {
    *solutions = 1;
    x[0] = pow(sqrt(R2_Q3) + fabs(R), 1 / 3.0);
    x[0] += Q / x[0];
    x[0] *= (R < 0.0) ? 1 : -1;
    x[0] -= a1 / 3.0;
  }
}
```