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

```asm
<CalcQuarticCoeffs>:
  endbr64
  push   %rbx
  mov    %edx,%ebx
  mov    (%rdi),%r11
  mov    %rcx,%rdx
  mov    0x8(%rdi),%r10
  mov    0x10(%rdi),%r9
  mov    (%rsi),%r8
  mov    0x8(%rsi),%rdi
  mov    0x10(%rsi),%rcx
  test   %ebx,%ebx
  jle    L37
  cmp    $0x1,%ebx
  je     L38
  mov    %ebx,%esi
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  movapd %xmm0,%xmm1
  shr    %esi
  movapd %xmm0,%xmm15
  movapd %xmm0,%xmm3
  movapd %xmm0,%xmm2
  shl    $0x4,%rsi
  movapd %xmm0,%xmm5
  movapd %xmm0,%xmm4
  movapd %xmm0,%xmm6
  movapd %xmm0,%xmm7
L39:
  movupd (%r8,%rax,1),%xmm10
  movupd (%r11,%rax,1),%xmm12
  movupd (%rdi,%rax,1),%xmm9
  movupd (%rcx,%rax,1),%xmm8
  movapd %xmm10,%xmm14
  movupd (%r10,%rax,1),%xmm11
  mulpd  %xmm12,%xmm14
  movapd %xmm14,%xmm13
  unpckhpd %xmm14,%xmm14
  addsd  %xmm7,%xmm13
  movapd %xmm14,%xmm7
  addsd  %xmm13,%xmm7
  movapd %xmm9,%xmm13
  mulpd  %xmm12,%xmm13
  mulpd  %xmm8,%xmm12
  movapd %xmm13,%xmm14
  unpckhpd %xmm13,%xmm13
  addsd  %xmm12,%xmm4
  unpckhpd %xmm12,%xmm12
  addsd  %xmm6,%xmm14
  movapd %xmm13,%xmm6
  addsd  %xmm12,%xmm4
  movapd %xmm10,%xmm12
  addsd  %xmm14,%xmm6
  mulpd  %xmm11,%xmm12
  addsd  %xmm12,%xmm5
  unpckhpd %xmm12,%xmm12
  addsd  %xmm12,%xmm5
  movapd %xmm9,%xmm12
  mulpd  %xmm11,%xmm12
  mulpd  %xmm8,%xmm11
  addsd  %xmm12,%xmm2
  unpckhpd %xmm12,%xmm12
  addsd  %xmm11,%xmm3
  unpckhpd %xmm11,%xmm11
  addsd  %xmm12,%xmm2
  addsd  %xmm11,%xmm3
  movupd (%r9,%rax,1),%xmm11
  mulpd  %xmm11,%xmm10
  movapd %xmm10,%xmm11
  unpckhpd %xmm10,%xmm10
  addsd  %xmm15,%xmm11
  movapd %xmm10,%xmm15
  movupd (%r9,%rax,1),%xmm10
  mulpd  %xmm10,%xmm9
  addsd  %xmm11,%xmm15
  addsd  %xmm9,%xmm1
  unpckhpd %xmm9,%xmm9
  addsd  %xmm9,%xmm1
  movupd (%r9,%rax,1),%xmm9
  add    $0x10,%rax
  mulpd  %xmm9,%xmm8
  addsd  %xmm8,%xmm0
  unpckhpd %xmm8,%xmm8
  addsd  %xmm8,%xmm0
  cmp    %rax,%rsi
  jne    L39
  mov    %ebx,%eax
  movsd  %xmm15,-0x58(%rsp)
  and    $0xfffffffe,%eax
  and    $0x1,%ebx
  je     L10
L47:
  cltq
  movsd  (%r8,%rax,8),%xmm10
  movsd  (%r11,%rax,8),%xmm13
  movsd  (%rdi,%rax,8),%xmm9
  movsd  (%rcx,%rax,8),%xmm8
  movapd %xmm10,%xmm14
  movsd  (%r10,%rax,8),%xmm11
  movsd  (%r9,%rax,8),%xmm12
  mulsd  %xmm13,%xmm14
  addsd  %xmm14,%xmm7
  movapd %xmm9,%xmm14
  mulsd  %xmm13,%xmm14
  mulsd  %xmm8,%xmm13
  addsd  %xmm14,%xmm6
  addsd  %xmm13,%xmm4
  movapd %xmm10,%xmm13
  mulsd  %xmm11,%xmm13
  mulsd  %xmm12,%xmm10
  addsd  -0x58(%rsp),%xmm10
  addsd  %xmm13,%xmm5
  movapd %xmm9,%xmm13
  movsd  %xmm10,-0x58(%rsp)
  mulsd  %xmm11,%xmm13
  mulsd  %xmm12,%xmm9
  mulsd  %xmm8,%xmm11
  mulsd  %xmm12,%xmm8
  addsd  %xmm13,%xmm2
  addsd  %xmm9,%xmm1
  addsd  %xmm11,%xmm3
  addsd  %xmm8,%xmm0
L10:
  movapd %xmm3,%xmm9
  movapd %xmm6,%xmm10
  movapd %xmm2,%xmm8
  mulsd  %xmm3,%xmm9
  movapd %xmm7,%xmm15
  movapd %xmm0,%xmm11
  mulsd  %xmm6,%xmm10
  movapd %xmm5,%xmm13
  movapd %xmm4,%xmm14
  mulsd  %xmm2,%xmm8
  mulsd  %xmm7,%xmm15
  mulsd  %xmm0,%xmm11
  movsd  %xmm9,-0x50(%rsp)
  mulsd  %xmm5,%xmm13
  mulsd  %xmm4,%xmm14
  movapd %xmm10,%xmm9
  movsd  -0x58(%rsp),%xmm10
  movapd %xmm10,%xmm12
  mulsd  %xmm10,%xmm12
  movapd %xmm1,%xmm10
  mulsd  %xmm1,%xmm10
  movsd  %xmm12,-0x48(%rsp)
  movapd %xmm8,%xmm12
  addsd  %xmm11,%xmm8
  addsd  %xmm15,%xmm12
  subsd  %xmm15,%xmm8
  movsd  -0x58(%rsp),%xmm15
  addsd  -0x50(%rsp),%xmm8
  addsd  %xmm11,%xmm12
  movapd %xmm7,%xmm11
  subsd  %xmm2,%xmm11
  addsd  %xmm10,%xmm8
  addsd  %xmm9,%xmm12
  addsd  %xmm14,%xmm9
  addsd  %xmm13,%xmm12
  subsd  %xmm13,%xmm9
  movapd %xmm3,%xmm13
  subsd  -0x48(%rsp),%xmm9
  subsd  %xmm1,%xmm13
  addsd  %xmm14,%xmm12
  addsd  -0x48(%rsp),%xmm12
  movapd %xmm1,%xmm14
  addsd  -0x50(%rsp),%xmm12
  mulsd  %xmm3,%xmm14
  movsd  %xmm9,-0x18(%rsp)
  movsd  %xmm13,-0x48(%rsp)
  movapd %xmm11,%xmm13
  addsd  %xmm0,%xmm11
  subsd  %xmm0,%xmm13
  addsd  %xmm10,%xmm12
  mulsd  D31(%rip),%xmm12
  movsd  %xmm11,-0x38(%rsp)
  movapd %xmm2,%xmm11
  movapd %xmm14,%xmm9
  movapd %xmm15,%xmm14
  addsd  %xmm7,%xmm11
  movsd  %xmm13,-0x40(%rsp)
  addsd  %xmm4,%xmm14
  movapd %xmm6,%xmm13
  subsd  %xmm5,%xmm13
  movq   %xmm12,%rax
  movapd %xmm0,%xmm12
  mulsd  %xmm2,%xmm12
  movapd %xmm14,%xmm10
  movsd  %xmm14,-0x10(%rsp)
  movapd %xmm11,%xmm14
  addsd  %xmm0,%xmm14
  subsd  %xmm0,%xmm11
  movsd  %xmm14,-0x28(%rsp)
  subsd  %xmm12,%xmm9
  movsd  %xmm11,-0x30(%rsp)
  movq   D2(%rip),%xmm12
  movapd %xmm5,%xmm11
  addsd  %xmm6,%xmm11
  xorpd  %xmm12,%xmm10
  movsd  %xmm10,-0x50(%rsp)
  movapd %xmm4,%xmm10
  addsd  %xmm9,%xmm9
  subsd  %xmm15,%xmm10
  movapd %xmm10,%xmm15
  movsd  %xmm10,-0x8(%rsp)
  movapd %xmm1,%xmm10
  xorpd  %xmm12,%xmm15
  xorpd  %xmm13,%xmm12
  addsd  %xmm3,%xmm10
  movsd  %xmm12,-0x20(%rsp)
  movsd  -0x50(%rsp),%xmm12
  mulsd  -0x48(%rsp),%xmm12
  movapd %xmm12,%xmm14
  movsd  -0x40(%rsp),%xmm12
  mulsd  %xmm13,%xmm12
  mulsd  -0x38(%rsp),%xmm13
  addsd  %xmm12,%xmm14
  movapd %xmm15,%xmm12
  mulsd  %xmm10,%xmm12
  addsd  %xmm13,%xmm12
  movapd %xmm9,%xmm13
  addsd  %xmm8,%xmm13
  subsd  %xmm9,%xmm8
  movsd  -0x18(%rsp),%xmm9
  mulsd  %xmm9,%xmm9
  mulsd  %xmm13,%xmm8
  movsd  -0x48(%rsp),%xmm13
  mulsd  %xmm14,%xmm12
  movsd  -0x10(%rsp),%xmm14
  mulsd  %xmm13,%xmm15
  addsd  %xmm9,%xmm8
  movsd  -0x50(%rsp),%xmm9
  mulsd  %xmm10,%xmm9
  addsd  %xmm12,%xmm8
  movsd  -0x30(%rsp),%xmm12
  mulsd  %xmm11,%xmm12
  subsd  %xmm12,%xmm9
  movsd  -0x28(%rsp),%xmm12
  mulsd  %xmm11,%xmm12
  subsd  %xmm12,%xmm15
  mulsd  %xmm15,%xmm9
  addsd  %xmm8,%xmm9
  movapd %xmm10,%xmm8
  mulsd  %xmm11,%xmm8
  mulsd  %xmm13,%xmm11
  movapd %xmm8,%xmm12
  movsd  -0x38(%rsp),%xmm8
  mulsd  %xmm14,%xmm8
  addsd  %xmm12,%xmm8
  movsd  -0x20(%rsp),%xmm12
  mulsd  -0x28(%rsp),%xmm14
  mov    %rax,0x10(%rdx)
  mulsd  -0x20(%rsp),%xmm10
  movsd  -0x58(%rsp),%xmm15
  mulsd  %xmm13,%xmm12
  addsd  %xmm14,%xmm12
  movsd  -0x8(%rsp),%xmm14
  mulsd  %xmm12,%xmm8
  addsd  %xmm8,%xmm9
  movsd  -0x40(%rsp),%xmm8
  mulsd  %xmm14,%xmm8
  addsd  %xmm11,%xmm8
  movsd  -0x30(%rsp),%xmm11
  pop    %rbx
  mulsd  %xmm14,%xmm11
  addsd  %xmm11,%xmm10
  movapd %xmm3,%xmm11
  mulsd  %xmm7,%xmm11
  mulsd  %xmm10,%xmm8
  mulsd  %xmm1,%xmm11
  mulsd  %xmm5,%xmm1
  addsd  %xmm8,%xmm9
  movapd %xmm15,%xmm8
  mulsd  %xmm2,%xmm8
  mulsd  %xmm7,%xmm2
  mulsd  %xmm4,%xmm1
  mulsd  %xmm4,%xmm8
  mulsd  %xmm0,%xmm2
  addsd  %xmm8,%xmm11
  movapd %xmm0,%xmm8
  movapd %xmm15,%xmm0
  mulsd  %xmm6,%xmm8
  mulsd  %xmm3,%xmm0
  mulsd  %xmm5,%xmm8
  mulsd  %xmm6,%xmm0
  addsd  %xmm8,%xmm11
  subsd  %xmm2,%xmm11
  subsd  %xmm0,%xmm11
  subsd  %xmm1,%xmm11
  mulsd  D39(%rip),%xmm11
  unpcklpd %xmm11,%xmm9
  movups %xmm9,(%rdx)
  ret
  cs nopw 0x0(%rax,%rax,1)
L37:
  mov    D2(%rip),%rax
  pxor   %xmm9,%xmm9
  pop    %rbx
  movups %xmm9,(%rdx)
  mov    %rax,0x10(%rdx)
  ret
L38:
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  movapd %xmm0,%xmm1
  movsd  %xmm0,-0x58(%rsp)
  movapd %xmm0,%xmm3
  movapd %xmm0,%xmm2
  movapd %xmm0,%xmm5
  movapd %xmm0,%xmm4
  movapd %xmm0,%xmm6
  movapd %xmm0,%xmm7
  jmp    L47
```

tool_calls: name: unpack_data
arguments: label: D31
type: f32[2]
name: unpack_data
arguments: label: D2
type: f32[2]
name: unpack_data
arguments: label: D39
type: f64

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

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

tool: D39: 8

assistant: ```c
void CalcQuarticCoeffs(const double **coords1, const double **coords2, const int len, double *coeff) {
  double Sxx, Sxy, Sxz, Syx, Syy, Syz, Szx, Szy, Szz;
  double Szz2, Syy2, Sxx2, Sxy2, Syz2, Sxz2, Syx2, Szy2, Szx2, SyzSzymSyySzz2, Sxx2Syy2Szz2Syz2Szy2, Sxy2Sxz2Syx2Szx2, SxzpSzx, SyzpSzy, SxypSyx, SyzmSzy, SxzmSzx, SxymSyx, SxxpSyy, SxxmSyy;
  double x1, x2, y1, y2, z1, z2;
  const double *fx1 = coords1[0], *fy1 = coords1[1], *fz1 = coords1[2], *fx2 = coords2[0], *fy2 = coords2[1], *fz2 = coords2[2];
  int i;
  Sxx = Sxy = Sxz = Syx = Syy = Syz = Szx = Szy = Szz = 0.0;
  for (i = 0; i < len; ++i) {
    x1 = fx1[i];
    y1 = fy1[i];
    z1 = fz1[i];
    x2 = fx2[i];
    y2 = fy2[i];
    z2 = fz2[i];
    Sxx += (x1 * x2);
    Sxy += (x1 * y2);
    Sxz += (x1 * z2);
    Syx += (y1 * x2);
    Syy += (y1 * y2);
    Syz += (y1 * z2);
    Szx += (z1 * x2);
    Szy += (z1 * y2);
    Szz += (z1 * z2);
  }
  Sxx2 = Sxx * Sxx;
  Syy2 = Syy * Syy;
  Szz2 = Szz * Szz;
  Sxy2 = Sxy * Sxy;
  Syz2 = Syz * Syz;
  Sxz2 = Sxz * Sxz;
  Syx2 = Syx * Syx;
  Szy2 = Szy * Szy;
  Szx2 = Szx * Szx;
  SyzSzymSyySzz2 = 2.0 * (Syz * Szy - Syy * Szz);
  Sxx2Syy2Szz2Syz2Szy2 = Syy2 + Szz2 - Sxx2 + Syz2 + Szy2;
  coeff[2] = -2.0 * (Sxx2 + Syy2 + Szz2 + Sxy2 + Syx2 + Sxz2 + Szx2 + Syz2 + Szy2);
  coeff[1] = 8.0 * (Sxx * Syz * Szy + Syy * Szx * Sxz + Szz * Sxy * Syx - Sxx * Syy * Szz - Syz * Szx * Sxy - Szy * Syx * Sxz);
  SxzpSzx = Sxz + Szx;
  SyzpSzy = Syz + Szy;
  SxypSyx = Sxy + Syx;
  SyzmSzy = Syz - Szy;
  SxzmSzx = Sxz - Szx;
  SxymSyx = Sxy - Syx;
  SxxpSyy = Sxx + Syy;
  SxxmSyy = Sxx - Syy;
  Sxy2Sxz2Syx2Szx2 = Sxy2 + Sxz2 - Syx2 - Szx2;
  coeff[0] = Sxy2Sxz2Syx2Szx2 * Sxy2Sxz2Syx2Szx2 + (Sxx2Syy2Szz2Syz2Szy2 + SyzSzymSyySzz2) * (Sxx2Syy2Szz2Syz2Szy2 - SyzSzymSyySzz2) + (-(SxzpSzx) * (SyzmSzy) + (SxymSyx) * (SxxmSyy - Szz)) * (-(SxzmSzx) * (SyzpSzy) + (SxymSyx) * (SxxmSyy + Szz)) + (-(SxzpSzx) * (SyzpSzy) - (SxypSyx) * (SxxpSyy - Szz)) * (-(SxzmSzx) * (SyzmSzy) - (SxypSyx) * (SxxpSyy + Szz)) + (+(SxypSyx) * (SyzpSzy) + (SxzpSzx) * (SxxmSyy + Szz)) * (-(SxymSyx) * (SyzmSzy) + (SxzpSzx) * (SxxpSyy + Szz)) + (+(SxypSyx) * (SyzmSzy) + (SxzmSzx) * (SxxmSyy - Szz)) * (-(SxymSyx) * (SyzpSzy) + (SxzmSzx) * (SxxpSyy - Szz));
}
```