user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<fitLine>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rdx,0x48(%rsp)
  mov    %rcx,0x50(%rsp)
  mov    %r8d,0x40(%rsp)
  mov    %r9d,0x28(%rsp)
  pxor   %xmm7,%xmm7
  cvtsd2ss %xmm0,%xmm7
  movss  %xmm7,0x2c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  mov    $0x0,%ebx
  test   %esi,%esi
  jle    L162
  mov    %rdi,%r13
  mov    %esi,%ebp
  cmp    $0x1,%esi
  je     L79
  lea    -0x1(%rsi),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  D10(%rip),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x30(%rsp)
  movslq %esi,%rbx
  lea    0x0(,%rbx,4),%r12
  mov    %r12,%rdi
  call   <malloc@plt>
  mov    %rax,%r14
  mov    %r12,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <calloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %ebp,%edx
  mov    $0x0,%eax
  movsd  D21(%rip),%xmm1
L19:
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  0x30(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L19
  movq   $0x0,0x90(%rsp)
  mov    $0x0,%eax
  pxor   %xmm3,%xmm3
  movapd %xmm3,%xmm4
  movapd %xmm3,%xmm2
L89:
  pxor   %xmm0,%xmm0
  cvtss2sd (%r12,%rax,4),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd 0x0(%r13,%rax,4),%xmm1
  movapd %xmm0,%xmm5
  mulsd  %xmm0,%xmm5
  addsd  %xmm5,%xmm2
  mulsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm3
  addsd  %xmm1,%xmm4
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L89
  movsd  %xmm2,0x78(%rsp)
  movsd  %xmm3,0x80(%rsp)
  movsd  %xmm4,0x88(%rsp)
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm0
  divsd  %xmm0,%xmm4
  movsd  %xmm4,0x18(%rsp)
  movapd %xmm3,%xmm6
  divsd  %xmm2,%xmm6
  movsd  %xmm6,0x58(%rsp)
  mulsd  D32(%rip),%xmm0
  cvttsd2si %xmm0,%esi
  mov    $0x5,%eax
  cmp    %eax,%esi
  cmovge %esi,%eax
  mov    %eax,0x44(%rsp)
  cmpl   $0x0,0x28(%rsp)
  jle    L166
  movsd  %xmm6,0x20(%rsp)
  mov    %ebp,%ebx
  mov    $0x0,%r15d
  lea    0x70(%rsp),%rax
  mov    %rax,0x38(%rsp)
  jmp    L169
L79:
  movss  0x4(%rdi),%xmm0
  movss  %xmm0,(%rdx)
  movl   $0x0,(%rcx)
  mov    %esi,%ebx
  jmp    L162
L70:
  cmp    0x14(%rsp),%ebx
  jge    L31
  cmp    %ebx,0x44(%rsp)
  jg     L31
  add    $0x1,%r15d
  cmp    %r15d,0x28(%rsp)
  je     L31
L169:
  movsd  0x20(%rsp),%xmm1
  movsd  0x18(%rsp),%xmm0
  mov    %ebp,%ecx
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  mov    $0x2,%eax
  call   <flattenData@plt>
  lea    0x68(%rsp),%rcx
  mov    0x38(%rsp),%r8
  mov    %ebp,%edx
  mov    0x8(%rsp),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <computeSigma@plt>
  mov    %ebx,0x14(%rsp)
  pxor   %xmm0,%xmm0
  cvtss2sd 0x2c(%rsp),%xmm0
  mulsd  0x70(%rsp),%xmm0
  mov    0x40(%rsp),%eax
  push   %rax
  lea    0x90(%rsp),%rax
  push   %rax
  lea    0xa0(%rsp),%rax
  push   %rax
  lea    0x98(%rsp),%rax
  push   %rax
  lea    0x98(%rsp),%r9
  mov    %ebp,%r8d
  mov    0x28(%rsp),%rcx
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  mov    $0x1,%eax
  call   <rejectPixels@plt>
  mov    %eax,%ebx
  add    $0x20,%rsp
  test   %eax,%eax
  jle    L70
  movsd  0x90(%rsp),%xmm0
  movsd  0x78(%rsp),%xmm5
  movapd %xmm0,%xmm3
  divsd  %xmm5,%xmm3
  movsd  0x80(%rsp),%xmm2
  movapd %xmm2,%xmm6
  mulsd  %xmm3,%xmm6
  movsd  0x88(%rsp),%xmm1
  movapd %xmm1,%xmm4
  subsd  %xmm6,%xmm4
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  mulsd  %xmm0,%xmm3
  subsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm4
  movsd  %xmm4,0x18(%rsp)
  mulsd  %xmm4,%xmm0
  subsd  %xmm0,%xmm2
  divsd  %xmm5,%xmm2
  movsd  %xmm2,0x20(%rsp)
  jmp    L70
L166:
  movsd  0x58(%rsp),%xmm7
  movsd  %xmm7,0x20(%rsp)
  mov    %ebp,%ebx
L31:
  movsd  0x18(%rsp),%xmm0
  movsd  0x20(%rsp),%xmm7
  subsd  %xmm7,%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    0x48(%rsp),%rax
  movss  %xmm0,(%rax)
  mulsd  0x30(%rsp),%xmm7
  pxor   %xmm0,%xmm0
  cvtsd2ss %xmm7,%xmm0
  movaps %xmm0,%xmm1
  comiss D51(%rip),%xmm0
  jb     L5
L4:
  cvtss2sd %xmm1,%xmm1
  movsd  D53(%rip),%xmm2
  comisd %xmm1,%xmm2
  ja     L107
  mov    0x50(%rsp),%rax
  movss  %xmm0,(%rax)
L164:
  mov    %r14,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
L162:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L130
  mov    %ebx,%eax
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  xorps  D41(%rip),%xmm1
  jmp    L4
L107:
  movsd  0x30(%rsp),%xmm0
  mulsd  0x58(%rsp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    0x50(%rsp),%rax
  movss  %xmm0,(%rax)
  jmp    L164
L130:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D10
type: f64
name: extract_symbolic_data
arguments: label: D21
type: f64
name: extract_symbolic_data
arguments: label: D32
type: f64
name: extract_symbolic_data
arguments: label: D51
type: f64
name: extract_symbolic_data
arguments: label: D53
type: f64
name: extract_symbolic_data
arguments: label: D41
type: byte[16]

tool: D10: 2

tool: D21: 1

tool: D32: 0.5

tool: D51: 0

tool: D53: 0.001

tool: {"D41": [0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
int fitLine(data, npix, zstart, zslope, krej, ngrow, maxiter)
float *data;
int npix;
float *zstart;
float *zslope;
float krej;
int ngrow;
int maxiter;
{
  int i, ngoodpix, last_ngoodpix, minpix, niter;
  double xscale, z0, dz, o_dz, x, z, mean, sigma, threshold;
  double sumxsqr, sumxz, sumz, sumx, rowrat;
  float *flat, *normx;
  char *badpix;
  if (npix <= 0)
    return (0);
  else if (npix == 1) {
    *zstart = data[1];
    *zslope = 0.0;
    return (1);
  } else
    xscale = 2.0 / (npix - 1);
  flat = (float *)malloc(npix * sizeof(float));
  normx = (float *)malloc(npix * sizeof(float));
  badpix = (char *)calloc(npix, sizeof(char));
  for (i = 0; i < npix; i++)
    normx[i] = i * xscale - 1.0;
  sumxsqr = 0;
  sumxz = 0;
  sumx = 0;
  sumz = 0;
  for (i = 0; i < npix; i++) {
    x = normx[i];
    z = data[i];
    sumxsqr = sumxsqr + (x * x);
    sumxz = sumxz + z * x;
    sumz = sumz + z;
  }
  z0 = sumz / npix;
  dz = o_dz = sumxz / sumxsqr;
  ngoodpix = npix;
  minpix = ((5) > ((int)(npix * 0.5)) ? (5) : ((int)(npix * 0.5)));
  for (niter = 0; niter < maxiter; niter++) {
    last_ngoodpix = ngoodpix;
    flattenData(data, flat, normx, npix, z0, dz);
    ngoodpix = computeSigma(flat, badpix, npix, &mean, &sigma);
    threshold = sigma * krej;
    ngoodpix = rejectPixels(data, flat, normx, badpix, npix, &sumxsqr, &sumxz, &sumx, &sumz, threshold, ngrow);
    if (ngoodpix > 0) {
      rowrat = sumx / sumxsqr;
      z0 = (sumz - rowrat * sumxz) / (ngoodpix - rowrat * sumx);
      dz = (sumxz - z0 * sumx) / sumxsqr;
    }
    if (ngoodpix >= last_ngoodpix || ngoodpix < minpix)
      break;
  }
  *zstart = z0 - dz;
  *zslope = dz * xscale;
  if (((*zslope) >= 0 ? (*zslope) : -(*zslope)) < 0.001)
    *zslope = o_dz * xscale;
  free((float *)flat);
  free((float *)normx);
  free((char *)badpix);
  return (ngoodpix);
}
```