user: 请从给定的汇编指令推导出C源代码:

```asm
<polyfit>:
  endbr64
  push   %r15
  mov    %rsi,%r11
  mov    %rdi,%r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  lea    (%r9,%r9,1),%r12d
  push   %rbp
  lea    -0x1(%r12),%r8d
  mov    %r9d,%ebp
  push   %rbx
  sub    $0x48,%rsp
  mov    0x88(%rsp),%rax
  mov    %rdx,0x18(%rsp)
  mov    0x80(%rsp),%rcx
  mov    0x90(%rsp),%rbx
  movsd  %xmm1,0x8(%rsp)
  mov    %rax,0x10(%rsp)
  test   %r8d,%r8d
  jle    L132
  lea    -0x2(%r12),%eax
  mov    %rsi,0x28(%rsp)
  mov    %rbx,%rdi
  xor    %esi,%esi
  lea    0x8(,%rax,8),%rdx
  mov    %rcx,0x38(%rsp)
  mov    %r8d,0x20(%rsp)
  movsd  %xmm0,0x30(%rsp)
  call   <memset@plt>
  mov    0x38(%rsp),%rcx
  movsd  0x30(%rsp),%xmm0
  mov    0x28(%rsp),%r11
  mov    0x20(%rsp),%r8d
L132:
  test   %ebp,%ebp
  jle    L124
  movslq %ebp,%r9
  xor    %esi,%esi
  mov    %rcx,%rdi
  mov    %r11,0x30(%rsp)
  lea    0x0(,%r9,8),%rdx
  mov    %r8d,0x28(%rsp)
  mov    %r9,0x20(%rsp)
  movsd  %xmm0,0x38(%rsp)
  call   <memset@plt>
  test   %r13d,%r13d
  mov    0x20(%rsp),%r9
  mov    0x28(%rsp),%r8d
  mov    0x30(%rsp),%r11
  movsd  0x38(%rsp),%xmm0
  mov    %rax,%rcx
  jle    L145
L152:
  lea    -0x2(%rbp),%eax
  mov    0x18(%rsp),%r9
  xor    %edx,%edx
  lea    0x10(%rcx,%rax,8),%rsi
  lea    -0x3(%r12),%eax
  lea    0x10(%rbx,%rax,8),%rdi
  jmp    L5
  cs nopw 0x0(%rax,%rax,1)
L94:
  add    $0x1,%rdx
  cmp    %edx,%r13d
  jle    L37
L5:
  movsd  (%r14,%rdx,8),%xmm4
  comisd %xmm0,%xmm4
  jbe    L94
  movsd  (%r11,%rdx,8),%xmm2
  movapd %xmm4,%xmm1
  divsd  (%r9,%rdx,8),%xmm1
  movsd  (%r15,%rdx,8),%xmm3
  mulsd  %xmm1,%xmm1
  subsd  0x8(%rsp),%xmm3
  divsd  %xmm4,%xmm2
  movsd  (%rcx),%xmm4
  mulsd  %xmm1,%xmm2
  addsd  %xmm2,%xmm4
  movsd  %xmm4,(%rcx)
  cmp    $0x1,%ebp
  jle    L71
  lea    0x8(%rcx),%rax
  cs nopw 0x0(%rax,%rax,1)
L96:
  mulsd  %xmm3,%xmm2
  movsd  (%rax),%xmm4
  add    $0x8,%rax
  addsd  %xmm2,%xmm4
  movsd  %xmm4,-0x8(%rax)
  cmp    %rax,%rsi
  jne    L96
L71:
  movsd  (%rbx),%xmm2
  addsd  %xmm1,%xmm2
  movsd  %xmm2,(%rbx)
  cmp    $0x1,%r8d
  jle    L94
  lea    0x8(%rbx),%rax
  nopl   0x0(%rax)
L66:
  mulsd  %xmm3,%xmm1
  movsd  (%rax),%xmm2
  add    $0x8,%rax
  addsd  %xmm1,%xmm2
  movsd  %xmm2,-0x8(%rax)
  cmp    %rax,%rdi
  jne    L66
  add    $0x1,%rdx
  cmp    %edx,%r13d
  jg     L5
L37:
  movslq %ebp,%r9
  test   %ebp,%ebp
  jle    L50
L145:
  mov    0x10(%rsp),%rsi
  lea    0x0(,%r9,8),%r12
  xor    %edi,%edi
  nopl   (%rax)
L58:
  mov    %rsi,%rdx
  xor    %eax,%eax
  nopl   (%rax)
L0:
  movsd  (%rbx,%rax,8),%xmm1
  add    $0x1,%rax
  movsd  %xmm1,(%rdx)
  add    %r12,%rdx
  cmp    %eax,%ebp
  jg     L0
  add    $0x1,%edi
  add    $0x8,%rsi
  add    $0x8,%rbx
  cmp    %edi,%ebp
  jg     L58
L50:
  mov    0x10(%rsp),%rdi
  mov    %ebp,%edx
  mov    %rcx,%rsi
  mov    %r11,0x28(%rsp)
  mov    %rcx,0x20(%rsp)
  movsd  %xmm0,0x30(%rsp)
  call   <cholsol@plt>
  test   %eax,%eax
  je     L79
  movsd  D3(%rip),%xmm0
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L79:
  mov    0x20(%rsp),%rcx
  mov    0x18(%rsp),%rdx
  mov    %ebp,%r9d
  mov    %r13d,%r8d
  movsd  0x8(%rsp),%xmm1
  movsd  0x30(%rsp),%xmm0
  mov    %r15,%rdi
  mov    %rcx,0x80(%rsp)
  mov    0x28(%rsp),%rsi
  mov    %r14,%rcx
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <chisq@plt>
L124:
  test   %r13d,%r13d
  jg     L152
  jmp    L50
```

tool_calls: name: read_data
arguments: data_tag: D3
type_guessed: f32[2]

tool: {"D3": [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);
}
```