user: Converte this assembly snippet into its equivalent C code:

```asm
<splint>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  movsd  %xmm0,-0x58(%rbp)
  mov    %r8,-0x60(%rbp)
  movl   $0x1,-0x24(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  jmp    L27
L23:
  mov    -0x20(%rbp),%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x58(%rbp),%xmm0
  jbe    L0
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  jmp    L27
L0:
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x24(%rbp)
L27:
  mov    -0x20(%rbp),%eax
  sub    -0x24(%rbp),%eax
  cmp    $0x1,%eax
  jg     L23
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x18(%rbp),%xmm0
  jp     L9
  pxor   %xmm0,%xmm0
  ucomisd -0x18(%rbp),%xmm0
  jne    L9
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <nrerror@plt>
L9:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  subsd  -0x58(%rbp),%xmm0
  divsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x58(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x10(%rbp),%xmm1
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x8(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  movsd  -0x10(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  mulsd  -0x10(%rbp),%xmm0
  movapd %xmm0,%xmm2
  subsd  -0x10(%rbp),%xmm2
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  -0x8(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  mulsd  -0x8(%rbp),%xmm0
  movapd %xmm0,%xmm3
  subsd  -0x8(%rbp),%xmm3
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm3,%xmm0
  addsd  %xmm0,%xmm2
  movsd  -0x18(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  D2(%rip),%xmm2
  divsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x60(%rbp),%rax
  movsd  %xmm0,(%rax)
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D7
type_infered: string
name: unpack_data
arguments: tag: D2
type_infered: f64

tool: D7: Bad XA input to routine SPLINT

tool: D2: 6

assistant: ```c
void splint(xa, ya, y2a, n, x, y) double xa[], ya[], y2a[], x, *y;
int n;
{
  int klo, khi, k;
  double h, b, a;
  void nrerror();
  klo = 1;
  khi = n;
  while (khi - klo > 1) {
    k = (khi + klo) >> 1;
    if (xa[k] > x)
      khi = k;
    else
      klo = k;
  }
  h = xa[khi] - xa[klo];
  if (h == 0.0)
    nrerror("Bad XA input to routine SPLINT");
  a = (xa[khi] - x) / h;
  b = (x - xa[klo]) / h;
  *y = a * ya[klo] + b * ya[khi] + ((a * a * a - a) * y2a[klo] + (b * b * b - b) * y2a[khi]) * (h * h) / 6.0;
}
```