user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<polyfit>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  movsd  %xmm0,-0x68(%rbp)
  mov    %r8d,-0x6c(%rbp)
  movsd  %xmm1,-0x78(%rbp)
  mov    %r9d,-0x70(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L146
L78:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L146:
  mov    -0x70(%rbp),%eax
  add    %eax,%eax
  sub    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L78
  movl   $0x0,-0x34(%rbp)
  jmp    L14
L108:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L14:
  mov    -0x34(%rbp),%eax
  cmp    -0x70(%rbp),%eax
  jl     L108
  movl   $0x0,-0x38(%rbp)
  jmp    L145
L2:
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x68(%rbp),%xmm0
  jbe    L92
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  subsd  -0x78(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  addsd  -0x30(%rbp),%xmm0
  mov    -0x28(%rbp),%rax
  movsd  %xmm0,(%rax)
  movl   $0x1,-0x34(%rbp)
  jmp    L76
L24:
  movsd  -0x30(%rbp),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movsd  -0x30(%rbp),%xmm1
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L76:
  mov    -0x34(%rbp),%eax
  cmp    -0x70(%rbp),%eax
  jl     L24
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm0
  addsd  -0x30(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  movsd  %xmm0,(%rax)
  movl   $0x1,-0x34(%rbp)
  jmp    L65
L82:
  movsd  -0x30(%rbp),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movsd  -0x30(%rbp),%xmm1
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L65:
  mov    -0x70(%rbp),%eax
  add    %eax,%eax
  sub    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L82
L92:
  addl   $0x1,-0x38(%rbp)
L145:
  mov    -0x38(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jl     L2
  movl   $0x0,-0x34(%rbp)
  jmp    L3
L121:
  movl   $0x0,-0x38(%rbp)
  jmp    L120
L80:
  mov    -0x34(%rbp),%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x70(%rbp),%eax
  imul   -0x38(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x34(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x38(%rbp)
L120:
  mov    -0x38(%rbp),%eax
  cmp    -0x70(%rbp),%eax
  jl     L80
  addl   $0x1,-0x34(%rbp)
L3:
  mov    -0x34(%rbp),%eax
  cmp    -0x70(%rbp),%eax
  jl     L121
  mov    -0x70(%rbp),%edx
  mov    -0x28(%rbp),%rcx
  mov    0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <cholsol@plt>
  mov    %eax,-0x38(%rbp)
  cmpl   $0x0,-0x38(%rbp)
  je     L87
  mov    D1(%rip),%rax
  jmp    L66
L87:
  mov    -0x70(%rbp),%r9d
  movsd  -0x78(%rbp),%xmm0
  mov    -0x6c(%rbp),%r8d
  mov    -0x68(%rbp),%rdi
  mov    -0x60(%rbp),%rcx
  mov    -0x58(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x48(%rbp),%rax
  sub    $0x8,%rsp
  push   0x10(%rbp)
  movapd %xmm0,%xmm1
  movq   %rdi,%xmm0
  mov    %rax,%rdi
  call   <chisq@plt>
  add    $0x10,%rsp
  movq   %xmm0,%rax
L66:
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D1
data_type: f32[2]

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

assistant: ```c
double polyfit(double *wave, double *flux, double *ferr, double *fmod, double ind, int n, double wcen, int deg, double *p, double *lhs, double *covar) {
  int i, k;
  double xi, yi, wi, *b = p, *A = covar, mom;
  for (k = 0; k < 2 * deg - 1; ++k)
    A[k] = 0.;
  for (k = 0; k < deg; ++k)
    b[k] = 0.;
  for (i = 0; i < n; ++i) {
    if (fmod[i] > ind) {
      xi = wave[i] - wcen;
      yi = flux[i] / fmod[i];
      wi = fmod[i] / ferr[i];
      wi *= wi;
      mom = wi * yi;
      b[0] += mom;
      for (k = 1; k < deg; ++k)
        b[k] += (mom *= xi);
      mom = wi;
      A[0] += mom;
      for (k = 1; k < 2 * deg - 1; ++k)
        A[k] += (mom *= xi);
    }
  }
  for (k = 0; k < deg; ++k)
    for (i = 0; i < deg; ++i)
      lhs[k + deg * i] = A[k + i];
  i = cholsol(lhs, b, deg);
  if (i)
    return -1.0;
  return chisq(wave, flux, ferr, fmod, ind, n, wcen, deg, p);
}
```