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

```asm
<arrayf_get_lsq_slope>:
  endbr64
  push   %r15
  movslq %r8d,%r15
  push   %r14
  lea    D9(%rip),%r14
  push   %r13
  push   %r12
  mov    %r15,%r12
  push   %rbp
  mov    %rcx,%rbp
  mov    $0xa,%ecx
  push   %rbx
  mov    %rdx,%rbx
  mov    %r14,%rdx
  sub    $0x68,%rsp
  mov    %rdi,(%rsp)
  lea    0x38(%rsp),%r13
  mov    %rsi,0x8(%rsp)
  mov    %r15d,%esi
  mov    %r13,%rdi
  shl    $0x3,%r15
  movaps %xmm4,0x20(%rsp)
  shl    $0x4,%esi
  movaps %xmm3,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  call   <willus_mem_alloc_warn@plt>
  mov    0x38(%rsp),%rdi
  lea    (%rdi,%r15,1),%rsi
  test   %r12d,%r12d
  jle    L26
  pxor   %xmm0,%xmm0
  movaps 0x20(%rsp),%xmm4
  movaps 0x10(%rsp),%xmm3
  xor    %eax,%eax
  lea    -0x1(%r12),%ecx
  mov    %r12d,%edx
  movapd %xmm0,%xmm1
  nopl   (%rax)
L0:
  pxor   %xmm2,%xmm2
  cvtss2sd (%rbx,%rax,4),%xmm2
  addsd  %xmm2,%xmm1
  pxor   %xmm2,%xmm2
  cvtss2sd 0x0(%rbp,%rax,4),%xmm2
  add    $0x1,%rax
  addsd  %xmm2,%xmm0
  cmp    %rdx,%rax
  jne    L0
  pxor   %xmm2,%xmm2
  sub    $0x8,%r15
  cvtsi2sd %r12d,%xmm2
  divsd  %xmm2,%xmm1
  divsd  %xmm2,%xmm0
  cmp    $0x10,%r15
  jbe    L16
  cmp    $0x2,%ecx
  jbe    L16
  mov    %r12d,%edx
  movapd %xmm1,%xmm7
  movapd %xmm0,%xmm6
  xor    %eax,%eax
  shr    $0x2,%edx
  unpcklpd %xmm7,%xmm7
  unpcklpd %xmm6,%xmm6
  shl    $0x4,%rdx
L7:
  movups (%rbx,%rax,1),%xmm5
  cvtps2pd %xmm5,%xmm2
  subpd  %xmm7,%xmm2
  movhlps %xmm5,%xmm3
  movups 0x0(%rbp,%rax,1),%xmm5
  movhlps %xmm5,%xmm4
  movups %xmm2,(%rdi,%rax,2)
  cvtps2pd %xmm3,%xmm2
  subpd  %xmm7,%xmm2
  movups %xmm2,0x10(%rdi,%rax,2)
  cvtps2pd %xmm5,%xmm2
  subpd  %xmm6,%xmm2
  movups %xmm2,(%rsi,%rax,2)
  cvtps2pd %xmm4,%xmm2
  subpd  %xmm6,%xmm2
  movups %xmm2,0x10(%rsi,%rax,2)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L7
  mov    %r12d,%edx
  and    $0xfffffffc,%edx
  test   $0x3,%r12b
  je     L2
  mov    %edx,%eax
  pxor   %xmm2,%xmm2
  cvtss2sd (%rbx,%rax,4),%xmm2
  subsd  %xmm1,%xmm2
  lea    0x0(,%rax,4),%r8
  lea    0x0(,%rax,8),%rcx
  movsd  %xmm2,(%rdi,%rax,8)
  pxor   %xmm2,%xmm2
  cvtss2sd 0x0(%rbp,%rax,4),%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsi,%rax,8)
  lea    0x1(%rdx),%eax
  cmp    %eax,%r12d
  jle    L2
  pxor   %xmm2,%xmm2
  add    $0x2,%edx
  cvtss2sd 0x4(%rbx,%r8,1),%xmm2
  subsd  %xmm1,%xmm2
  movsd  %xmm2,0x8(%rdi,%rcx,1)
  pxor   %xmm2,%xmm2
  cvtss2sd 0x4(%rbp,%r8,1),%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rsi,%rcx,1)
  cmp    %edx,%r12d
  jle    L2
  pxor   %xmm2,%xmm2
  cvtss2sd 0x8(%rbx,%r8,1),%xmm2
  subsd  %xmm1,%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x8(%rbp,%r8,1),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm2,0x10(%rdi,%rcx,1)
  movsd  %xmm1,0x10(%rsi,%rcx,1)
L2:
  lea    0x40(%rsp),%r8
  mov    $0x1,%ecx
  mov    %r12d,%edx
  movsd  %xmm0,0x10(%rsp)
  call   <gslpolyfit@plt>
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <willus_mem_free@plt>
  mov    (%rsp),%rax
  movsd  0x10(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  addsd  0x40(%rsp),%xmm0
  cvtsd2ss 0x48(%rsp),%xmm1
  movss  %xmm1,(%rax)
  mov    0x8(%rsp),%rax
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L16:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L73:
  pxor   %xmm2,%xmm2
  cvtss2sd (%rbx,%rax,4),%xmm2
  subsd  %xmm1,%xmm2
  movsd  %xmm2,(%rdi,%rax,8)
  pxor   %xmm2,%xmm2
  cvtss2sd 0x0(%rbp,%rax,4),%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsi,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L73
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L26:
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %r12d,%xmm1
  divsd  %xmm1,%xmm0
  jmp    L2
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D9
type: string

tool: D9: arrayf_get_lsq_slope

assistant: ```c
void arrayf_get_lsq_slope(float *m, float *b, float *x, float *y, int n) {
  double c[2];
  double *tx, *ty;
  double xoff, yoff;
  int i;
  willus_mem_alloc_warn((void **)&tx, sizeof(double) * 2 * n, "arrayf_get_lsq_slope", 10);
  ty = &tx[n];
  for (xoff = yoff = 0., i = 0; i < n; i++) {
    xoff += x[i];
    yoff += y[i];
  }
  xoff /= n;
  yoff /= n;
  for (i = 0; i < n; i++) {
    tx[i] = x[i] - xoff;
    ty[i] = y[i] - yoff;
  }
  gslpolyfit(tx, ty, n, 1, c);
  willus_mem_free((double **)&tx, "arrayf_get_lsq_slope");
  (*m) = (float)c[1];
  (*b) = (float)(c[0] + yoff);
}
```