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

```asm
<solve_degree_4>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  add    $0xffffffffffffff80,%rsp
  movsd  0x20(%rdi),%xmm6
  movsd  0x18(%rdi),%xmm1
  movsd  0x10(%rdi),%xmm5
  movsd  0x8(%rdi),%xmm3
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  divsd  %xmm6,%xmm1
  movsd  D128(%rip),%xmm0
  movsd  D164(%rip),%xmm7
  movsd  D65(%rip),%xmm4
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm7
  movapd %xmm1,%xmm2
  mulsd  %xmm1,%xmm2
  mulsd  %xmm2,%xmm0
  mulsd  %xmm2,%xmm4
  mulsd  %xmm1,%xmm0
  divsd  %xmm6,%xmm3
  mulsd  D98(%rip),%xmm1
  movsd  %xmm1,0x8(%rsp)
  mulsd  %xmm5,%xmm7
  addsd  %xmm5,%xmm4
  movsd  %xmm4,0x10(%rsp)
  subsd  %xmm7,%xmm0
  addsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm3
  movsd  %xmm0,0x18(%rsp)
  movapd %xmm0,%xmm7
  movsd  D29(%rip),%xmm0
  unpcklpd %xmm4,%xmm7
  mulsd  %xmm2,%xmm0
  movaps %xmm7,0x20(%rsp)
  mulsd  %xmm2,%xmm0
  mulsd  D78(%rip),%xmm2
  mulsd  %xmm5,%xmm2
  addsd  %xmm2,%xmm0
  movsd  (%rdi),%xmm2
  lea    0x38(%rsp),%rdi
  divsd  %xmm6,%xmm2
  subsd  %xmm3,%xmm0
  addsd  %xmm2,%xmm0
  movsd  %xmm0,0x38(%rsp)
  call   <zero@plt>
  movsd  0x8(%rsp),%xmm1
  movsd  0x10(%rsp),%xmm4
  test   %rax,%rax
  je     L192
  movapd 0x20(%rsp),%xmm7
  movapd D24(%rip),%xmm0
  lea    0x50(%rsp),%rdi
  mov    %rbx,%rsi
  movaps %xmm7,0x50(%rsp)
  movaps %xmm0,0x60(%rsp)
  call   <solve_degree_3@plt>
  movsd  0x8(%rsp),%xmm1
  movslq %eax,%rdx
  movq   $0x0,(%rbx,%rdx,8)
  lea    0x1(%rdx),%eax
L45:
  test   %eax,%eax
  jle    L160
  cmp    $0x1,%eax
  je     L165
  mov    %eax,%ecx
  movapd %xmm1,%xmm2
  mov    %rbx,%rdx
  shr    %ecx
  unpcklpd %xmm2,%xmm2
  sub    $0x1,%ecx
  shl    $0x4,%rcx
  lea    0x10(%rbx,%rcx,1),%rcx
L48:
  movupd (%rdx),%xmm0
  add    $0x10,%rdx
  subpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rdx)
  cmp    %rdx,%rcx
  jne    L48
  mov    %eax,%edx
  and    $0xfffffffe,%edx
  test   $0x1,%al
  je     L160
L2:
  movslq %edx,%rdx
  lea    (%rbx,%rdx,8),%rdx
  movsd  (%rdx),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx)
L160:
  mov    0x78(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L167
  sub    $0xffffffffffffff80,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L192:
  movsd  0x18(%rsp),%xmm6
  movsd  0x38(%rsp),%xmm3
  lea    0x50(%rsp),%rbp
  mov    %rbx,%rsi
  mov    D82(%rip),%rax
  movsd  D164(%rip),%xmm0
  mov    %rbp,%rdi
  movsd  %xmm1,0x20(%rsp)
  movsd  D128(%rip),%xmm2
  movsd  %xmm4,0x8(%rsp)
  mulsd  %xmm3,%xmm0
  xorpd  D84(%rip),%xmm3
  mov    %rax,0x68(%rsp)
  mulsd  %xmm6,%xmm2
  mulsd  %xmm4,%xmm0
  mulsd  %xmm6,%xmm2
  subsd  %xmm2,%xmm0
  unpcklpd %xmm3,%xmm0
  movaps %xmm0,0x50(%rsp)
  movapd %xmm4,%xmm0
  mulsd  D62(%rip),%xmm0
  movsd  %xmm0,0x60(%rsp)
  call   <solve_degree_3@plt>
  movsd  (%rbx),%xmm2
  movsd  0x8(%rsp),%xmm4
  lea    0x40(%rsp),%rdi
  movapd %xmm2,%xmm0
  movsd  %xmm2,0x10(%rsp)
  mulsd  %xmm2,%xmm0
  subsd  0x38(%rsp),%xmm0
  movsd  %xmm0,0x40(%rsp)
  movapd %xmm2,%xmm0
  addsd  %xmm2,%xmm0
  subsd  %xmm4,%xmm0
  movsd  %xmm0,0x48(%rsp)
  call   <zero@plt>
  movsd  0x40(%rsp),%xmm0
  pxor   %xmm3,%xmm3
  comisd %xmm0,%xmm3
  ja     L96
  comisd %xmm3,%xmm0
  movsd  0x10(%rsp),%xmm2
  movsd  0x20(%rsp),%xmm1
  ja     L91
L104:
  lea    0x48(%rsp),%rdi
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <zero@plt>
  movsd  0x48(%rsp),%xmm0
  pxor   %xmm3,%xmm3
  comisd %xmm0,%xmm3
  ja     L96
  comisd %xmm3,%xmm0
  movsd  0x8(%rsp),%xmm1
  movsd  0x10(%rsp),%xmm2
  ja     L103
L51:
  movapd %xmm2,%xmm4
  comisd 0x18(%rsp),%xmm3
  subsd  0x40(%rsp),%xmm4
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm4,0x50(%rsp)
  ja     L153
  mov    D82(%rip),%rax
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsd  %xmm0,0x58(%rsp)
  mov    %rax,0x60(%rsp)
  call   <solve_degree_2@plt>
  movsd  0x10(%rsp),%xmm2
  addsd  0x40(%rsp),%xmm2
  movsd  0x48(%rsp),%xmm0
  movsd  0x8(%rsp),%xmm1
  mov    %eax,%r12d
  xorpd  D84(%rip),%xmm0
  movsd  %xmm2,0x50(%rsp)
L166:
  mov    D82(%rip),%rax
  mov    %rbp,%rdi
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm0,0x58(%rsp)
  mov    %rax,0x60(%rsp)
  movslq %r12d,%rax
  lea    (%rbx,%rax,8),%rsi
  call   <solve_degree_2@plt>
  movsd  0x8(%rsp),%xmm1
  add    %r12d,%eax
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L96:
  xor    %eax,%eax
  jmp    L160
  nopw   0x0(%rax,%rax,1)
L103:
  ucomisd %xmm0,%xmm3
  ja     L208
  sqrtsd %xmm0,%xmm0
L105:
  movsd  %xmm0,0x48(%rsp)
  jmp    L51
  nopl   0x0(%rax)
L153:
  xorpd  D84(%rip),%xmm0
  mov    D82(%rip),%rax
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsd  %xmm0,0x58(%rsp)
  mov    %rax,0x60(%rsp)
  call   <solve_degree_2@plt>
  movsd  0x10(%rsp),%xmm2
  addsd  0x40(%rsp),%xmm2
  movsd  0x48(%rsp),%xmm0
  movsd  0x8(%rsp),%xmm1
  mov    %eax,%r12d
  movsd  %xmm2,0x50(%rsp)
  jmp    L166
  nopl   0x0(%rax,%rax,1)
L91:
  ucomisd %xmm0,%xmm3
  ja     L115
  sqrtsd %xmm0,%xmm0
L156:
  movsd  %xmm0,0x40(%rsp)
  jmp    L104
L165:
  xor    %edx,%edx
  jmp    L2
L167:
  call   <__stack_chk_fail@plt>
L115:
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x10(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm1
  jmp    L156
L208:
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x10(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm1
  pxor   %xmm3,%xmm3
  jmp    L105
```

tool_calls: name: unpack_data
arguments: data_label: D128
data_type: f32[2]
name: unpack_data
arguments: data_label: D164
data_type: f32[2]
name: unpack_data
arguments: data_label: D65
data_type: f32[2]
name: unpack_data
arguments: data_label: D98
data_type: f32[2]
name: unpack_data
arguments: data_label: D29
data_type: f32[2]
name: unpack_data
arguments: data_label: D78
data_type: f32[2]
name: unpack_data
arguments: data_label: D24
data_type: f32[4]
name: unpack_data
arguments: data_label: D82
data_type: f64
name: unpack_data
arguments: data_label: D84
data_type: f32[4]
name: unpack_data
arguments: data_label: D62
data_type: f32[2]

tool: {"D128": [0.0,1.5]}

tool: {"D164": [0.0,1.75]}

tool: {"D65": [0.0,-1.6875]}

tool: {"D98": [0.0,1.625]}

tool: {"D29": [0.0,-1.0625]}

tool: {"D78": [0.0,1.375]}

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

tool: D82: 1

tool: {"D84": [0.0,-0.0,0.0,0.0]}

tool: {"D62": [0.0,-1.75]}

assistant: ```c
int solve_degree_4(const double *c, double *x) {
  double coeffs[4];
  int num;
  double A = c[3] / c[4];
  double B = c[2] / c[4];
  double C = c[1] / c[4];
  double D = c[0] / c[4];
  double sq_A = A * A;
  double p = -3.0 / 8.0 * sq_A + B;
  double q = 1.0 / 8.0 * sq_A * A - 1.0 / 2.0 * A * B + C;
  double r = -3.0 / 256.0 * sq_A * sq_A + 1.0 / 16.0 * sq_A * B - 1.0 / 4.0 * A * C + D;
  if (zero(&r)) {
    coeffs[0] = q;
    coeffs[1] = p;
    coeffs[2] = 0.0;
    coeffs[3] = 1.0;
    num = solve_degree_3(coeffs, x);
    x[num++] = 0;
  } else {
    coeffs[0] = 1.0 / 2.0 * r * p - 1.0 / 8.0 * q * q;
    coeffs[1] = -r;
    coeffs[2] = -1.0 / 2.0 * p;
    coeffs[3] = 1.0;
    solve_degree_3(coeffs, x);
    double z = x[0];
    double u = z * z - r;
    double v = 2.0 * z - p;
    zero(&u);
    if (u < 0)
      return 0;
    else if (u > 0)
      u = sqrt(u);
    zero(&v);
    if (v < 0)
      return 0;
    else if (v > 0)
      v = sqrt(v);
    coeffs[0] = z - u;
    coeffs[1] = q < 0.0 ? -v : v;
    coeffs[2] = 1.0;
    num = solve_degree_2(coeffs, x);
    coeffs[0] = z + u;
    coeffs[1] = q < 0.0 ? v : -v;
    coeffs[2] = 1.0;
    num += solve_degree_2(coeffs, x + num);
  }
  double sub = 1.0 / 4.0 * A;
  for (int i = 0; i < num; i++)
    x[i] -= sub;
  return num;
}
```