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

```asm
<lm_lmpar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,%ebp
  mov    %rsi,0x18(%rsp)
  mov    %edx,0x40(%rsp)
  mov    %rcx,0x20(%rsp)
  mov    %r8,%r12
  mov    %r9,0x38(%rsp)
  movsd  %xmm0,0x10(%rsp)
  mov    0x98(%rsp),%r15
  mov    0xa8(%rsp),%rbx
  mov    0xb0(%rsp),%r13
  test   %edi,%edi
  jle    L261
  mov    %r9,%r10
  movslq %edx,%rax
  lea    0x8(,%rax,8),%r9
  mov    %rsi,%rcx
  mov    %edi,%r8d
  mov    %edi,%r14d
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
  mov    $0x0,%edi
  movapd %xmm1,%xmm2
  jmp    L171
L489:
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  add    %r9,%rcx
  cmp    %r8,%rax
  je     L466
L171:
  movsd  (%r10,%rax,8),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  ucomisd (%rcx),%xmm1
  setnp  %dl
  cmovne %edi,%edx
  test   %dl,%dl
  je     L378
  cmp    %r14d,%ebp
  cmove  %eax,%r14d
L378:
  cmp    %ebp,%r14d
  jge    L489
  movapd %xmm2,%xmm0
  jmp    L489
L261:
  mov    %edi,%r14d
L466:
  mov    %r14d,%eax
  sub    $0x1,%eax
  js     L244
  movslq %eax,%rdx
  lea    (%rbx,%rdx,8),%rsi
  mov    0x40(%rsp),%ecx
  mov    %ecx,%r10d
  not    %r10d
  movslq %r10d,%r10
  shl    $0x3,%r10
  imul   %ecx,%eax
  cltq
  add    %rax,%rdx
  mov    0x18(%rsp),%r11
  lea    (%r11,%rdx,8),%r8
  lea    -0x2(%r14),%edi
  neg    %ecx
  movslq %ecx,%r9
  shl    $0x3,%r9
  lea    (%r11,%rax,8),%rdx
L200:
  movsd  (%rsi),%xmm2
  divsd  (%r8),%xmm2
  movsd  %xmm2,(%rsi)
  lea    0x1(%rdi),%eax
  test   %eax,%eax
  jle    L125
  mov    %edi,%ecx
  mov    $0x0,%eax
L178:
  movapd %xmm2,%xmm1
  mulsd  (%rdx,%rax,8),%xmm1
  movsd  (%rbx,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  mov    %rax,%r11
  add    $0x1,%rax
  cmp    %rcx,%r11
  jne    L178
L433:
  sub    $0x8,%rsi
  add    %r10,%r8
  sub    $0x1,%edi
  add    %r9,%rdx
  jmp    L200
L125:
  test   %edi,%edi
  jns    L433
L244:
  test   %ebp,%ebp
  jle    L553
  mov    %ebp,%edx
  mov    $0x0,%eax
  mov    0x20(%rsp),%rsi
L547:
  movsd  (%rbx,%rax,8),%xmm0
  movslq (%rsi,%rax,4),%rcx
  movsd  %xmm0,(%r15,%rcx,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L547
  mov    $0x0,%eax
L113:
  movsd  (%r12,%rax,8),%xmm0
  mulsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L113
L553:
  mov    %r13,%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_enorm@plt>
  pxor   %xmm7,%xmm7
  cvtsi2sd %eax,%xmm7
  movsd  %xmm7,(%rsp)
  movsd  0x10(%rsp),%xmm4
  subsd  %xmm4,%xmm7
  movsd  %xmm7,0x28(%rsp)
  mulsd  D17(%rip),%xmm4
  movsd  %xmm4,0x30(%rsp)
  comisd %xmm7,%xmm4
  jae    L265
  pxor   %xmm4,%xmm4
  movsd  %xmm4,0x8(%rsp)
  cmp    %r14d,%ebp
  jg     L239
  test   %ebp,%ebp
  jle    L389
  lea    -0x1(%rbp),%r10d
  mov    $0x0,%eax
  mov    0x20(%rsp),%rcx
L274:
  movslq (%rcx,%rax,4),%rdx
  movsd  (%r12,%rdx,8),%xmm0
  mulsd  0x0(%r13,%rdx,8),%xmm0
  divsd  (%rsp),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r10,%rdx
  jne    L274
  movslq 0x40(%rsp),%rax
  lea    0x8(,%rax,8),%r11
  mov    0x18(%rsp),%r14
  mov    %r14,%r8
  mov    $0x0,%r9d
  mov    $0x0,%edi
  jmp    L332
L265:
  mov    0x90(%rsp),%rax
  movq   $0x0,(%rax)
L69:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L362:
  lea    -0x1(%rdi),%esi
  movslq %r9d,%rax
  lea    (%r14,%rax,8),%rcx
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
L361:
  movsd  (%rcx,%rax,8),%xmm0
  mulsd  (%rbx,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %rsi,%rdx
  jne    L361
L183:
  movsd  (%rbx,%rdi,8),%xmm0
  subsd  %xmm1,%xmm0
  divsd  (%r8),%xmm0
  movsd  %xmm0,(%rbx,%rdi,8)
  lea    0x1(%rdi),%rax
  add    %r11,%r8
  add    0x40(%rsp),%r9d
  cmp    %r10,%rdi
  je     L389
  mov    %rax,%rdi
L332:
  pxor   %xmm1,%xmm1
  test   %edi,%edi
  jg     L362
  jmp    L183
L389:
  mov    %rbx,%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_enorm@plt>
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  0x28(%rsp),%xmm0
  divsd  0x10(%rsp),%xmm0
  divsd  %xmm1,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rsp)
L239:
  test   %ebp,%ebp
  jle    L364
  mov    %ebp,%r8d
  mov    $0x8,%edx
  mov    $0x0,%edi
  mov    $0x0,%esi
  mov    0x18(%rsp),%r14
  mov    0x40(%rsp),%r10d
  mov    0x20(%rsp),%r11
  mov    0x38(%rsp),%r9
  jmp    L358
L437:
  movslq %edi,%rax
  lea    (%r14,%rax,8),%rcx
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
L215:
  movsd  (%rcx,%rax,1),%xmm0
  mulsd  (%r9,%rax,1),%xmm0
  addsd  %xmm0,%xmm1
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L215
L31:
  movslq (%r11,%rsi,4),%rax
  divsd  (%r12,%rax,8),%xmm1
  movsd  %xmm1,(%rbx,%rsi,8)
  add    $0x1,%rsi
  add    %r10d,%edi
  add    $0x8,%rdx
  cmp    %r8,%rsi
  je     L364
L358:
  pxor   %xmm1,%xmm1
  test   %esi,%esi
  jns    L437
  jmp    L31
L364:
  mov    %rbx,%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_enorm@plt>
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movapd %xmm2,%xmm3
  movsd  0x10(%rsp),%xmm5
  divsd  %xmm5,%xmm3
  movsd  %xmm3,0x48(%rsp)
  ucomisd D4(%rip),%xmm3
  jp     L428
  jne    L428
  movapd %xmm5,%xmm0
  movsd  D17(%rip),%xmm1
  comisd %xmm5,%xmm1
  jae    L286
  movapd %xmm1,%xmm0
L286:
  movsd  D62(%rip),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x48(%rsp)
L428:
  mov    0x90(%rsp),%rax
  movsd  (%rax),%xmm0
  movsd  0x8(%rsp),%xmm5
  movapd %xmm5,%xmm1
  cmplesd %xmm0,%xmm1
  andpd  %xmm1,%xmm0
  andnpd %xmm5,%xmm1
  orpd   %xmm1,%xmm0
  movapd %xmm0,%xmm1
  movsd  0x48(%rsp),%xmm7
  cmplesd %xmm7,%xmm1
  andpd  %xmm1,%xmm0
  andnpd %xmm7,%xmm1
  orpd   %xmm1,%xmm0
  ucomisd D4(%rip),%xmm0
  jp     L175
  jne    L175
  divsd  (%rsp),%xmm2
  mov    0x90(%rsp),%rax
  movsd  %xmm2,(%rax)
  jmp    L179
L175:
  mov    0x90(%rsp),%rax
  movsd  %xmm0,(%rax)
L179:
  movslq 0x40(%rsp),%rax
  shl    $0x3,%rax
  mov    %rax,(%rsp)
  movl   $0xb,0x44(%rsp)
  jmp    L86
L166:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  jmp    L510
L29:
  mov    %rbx,%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_enorm@plt>
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movq   %r14,%xmm0
  divsd  0x10(%rsp),%xmm0
  divsd  %xmm1,%xmm0
  divsd  %xmm1,%xmm0
  movq   %r14,%xmm4
  comisd D4(%rip),%xmm4
  jbe    L81
  mov    0x90(%rsp),%rax
  movsd  (%rax),%xmm2
  movapd %xmm2,%xmm1
  movsd  0x8(%rsp),%xmm7
  cmplesd %xmm7,%xmm1
  movapd %xmm7,%xmm3
  andpd  %xmm1,%xmm3
  andnpd %xmm2,%xmm1
  orpd   %xmm3,%xmm1
  movsd  %xmm1,0x8(%rsp)
L161:
  mov    0x90(%rsp),%rax
  addsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  movsd  0x8(%rsp),%xmm6
  cmpnlesd %xmm6,%xmm1
  andpd  %xmm1,%xmm0
  andnpd %xmm6,%xmm1
  orpd   %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    %r14,0x28(%rsp)
L86:
  mov    0x90(%rsp),%rax
  pxor   %xmm7,%xmm7
  ucomisd (%rax),%xmm7
  jp     L255
  jne    L255
  movsd  0x48(%rsp),%xmm0
  mulsd  D14(%rip),%xmm0
  movsd  D62(%rip),%xmm1
  comisd %xmm0,%xmm1
  jb     L444
  movapd %xmm1,%xmm0
L444:
  mov    0x90(%rsp),%rax
  movsd  %xmm0,(%rax)
L255:
  mov    0x90(%rsp),%rax
  movsd  (%rax),%xmm1
  pxor   %xmm0,%xmm0
  ucomisd %xmm1,%xmm0
  ja     L166
  sqrtsd %xmm1,%xmm1
  movapd %xmm1,%xmm0
L510:
  test   %ebp,%ebp
  jle    L414
  mov    %ebp,%r14d
  mov    $0x0,%eax
L536:
  movapd %xmm0,%xmm1
  mulsd  (%r12,%rax,8),%xmm1
  movsd  %xmm1,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %r14,%rax
  jne    L536
  sub    $0x8,%rsp
  push   %r13
  push   0xb0(%rsp)
  push   %r15
  mov    0x58(%rsp),%r9
  mov    %rbx,%r8
  mov    0x40(%rsp),%rcx
  mov    0x60(%rsp),%edx
  mov    0x38(%rsp),%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_qrsolv@plt>
  add    $0x20,%rsp
  mov    $0x0,%eax
L402:
  movsd  (%r12,%rax,8),%xmm0
  mulsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  add    $0x1,%rax
  cmp    %r14,%rax
  jne    L402
L156:
  mov    %r13,%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_enorm@plt>
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movapd %xmm1,%xmm4
  subsd  0x10(%rsp),%xmm4
  movq   %xmm4,%r14
  movapd %xmm4,%xmm0
  andpd  D24(%rip),%xmm0
  movsd  0x30(%rsp),%xmm4
  comisd %xmm0,%xmm4
  jae    L69
  movsd  0x8(%rsp),%xmm5
  ucomisd D4(%rip),%xmm5
  jp     L144
  jne    L144
  movsd  0x28(%rsp),%xmm6
  movq   %r14,%xmm5
  comisd %xmm5,%xmm6
  jb     L144
  pxor   %xmm0,%xmm0
  comisd %xmm6,%xmm0
  ja     L69
L144:
  subl   $0x1,0x44(%rsp)
  je     L69
  test   %ebp,%ebp
  jle    L29
  mov    %ebp,%edi
  mov    $0x0,%eax
  mov    0x20(%rsp),%rcx
L558:
  movslq (%rcx,%rax,4),%rdx
  movsd  (%r12,%rdx,8),%xmm0
  mulsd  0x0(%r13,%rdx,8),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdi
  jne    L558
  mov    %rbx,%rsi
  mov    0x18(%rsp),%rdx
  mov    $0x1,%r8d
  mov    0xa0(%rsp),%r9
L150:
  mov    %rsi,%rcx
  movsd  (%rsi),%xmm0
  divsd  -0x8(%r9,%r8,8),%xmm0
  movsd  %xmm0,(%rsi)
  cmp    %r8,%rdi
  je     L29
  mov    %r8,%rax
L530:
  movsd  (%rdx,%rax,8),%xmm1
  mulsd  (%rcx),%xmm1
  movsd  (%rbx,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jg     L530
  add    $0x1,%r8
  add    $0x8,%rsi
  add    (%rsp),%rdx
  jmp    L150
L81:
  pxor   %xmm1,%xmm1
  comisd %xmm4,%xmm1
  jbe    L161
  mov    0x90(%rsp),%rax
  movsd  (%rax),%xmm2
  movsd  0x48(%rsp),%xmm6
  movapd %xmm6,%xmm1
  cmplesd %xmm2,%xmm1
  andpd  %xmm1,%xmm6
  andnpd %xmm2,%xmm1
  orpd   %xmm6,%xmm1
  movsd  %xmm1,0x48(%rsp)
  jmp    L161
L414:
  sub    $0x8,%rsp
  push   %r13
  push   0xb0(%rsp)
  push   %r15
  mov    0x58(%rsp),%r9
  mov    %rbx,%r8
  mov    0x40(%rsp),%rcx
  mov    0x60(%rsp),%edx
  mov    0x38(%rsp),%rsi
  mov    %ebp,%edi
  mov    $0x0,%eax
  call   <lm_qrsolv@plt>
  add    $0x20,%rsp
  jmp    L156
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D17
datatype: f64
name: extract_symbolic_data
arguments: data_label: D4
datatype: f64
name: extract_symbolic_data
arguments: data_label: D62
datatype: byte[8]
name: extract_symbolic_data
arguments: data_label: D14
datatype: f64
name: extract_symbolic_data
arguments: data_label: D24
datatype: qword[2]

tool: D17: 0.1

tool: D4: 0

tool: {"D62": [0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: D14: 0.001

tool: {"D24": [0x7fffffffffffffff,0x0000000000000000]}

assistant: ```c
void lm_lmpar(int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double delta, double *par, double *x, double *sdiag, double *wa1, double *wa2) {
  int i, iter, j, nsing;
  double dxnorm, fp, fp_old, gnorm, parc, parl, paru;
  double sum, temp;
  static double p1 = 0.1;
  static double p001 = 0.001;
  nsing = n;
  for (j = 0; j < n; j++) {
    wa1[j] = qtb[j];
    if (r[j * ldr + j] == 0 && nsing == n)
      nsing = j;
    if (nsing < n)
      wa1[j] = 0;
  }
  for (j = nsing - 1; j >= 0; j--) {
    wa1[j] = wa1[j] / r[j + ldr * j];
    temp = wa1[j];
    for (i = 0; i < j; i++)
      wa1[i] -= r[j * ldr + i] * temp;
  }
  for (j = 0; j < n; j++)
    x[ipvt[j]] = wa1[j];
  iter = 0;
  for (j = 0; j < n; j++)
    wa2[j] = diag[j] * x[j];
  dxnorm = lm_enorm(n, wa2);
  fp = dxnorm - delta;
  if (fp <= p1 * delta) {
    *par = 0;
    return;
  }
  parl = 0;
  if (nsing >= n) {
    for (j = 0; j < n; j++)
      wa1[j] = diag[ipvt[j]] * wa2[ipvt[j]] / dxnorm;
    for (j = 0; j < n; j++) {
      sum = 0.;
      for (i = 0; i < j; i++)
        sum += r[j * ldr + i] * wa1[i];
      wa1[j] = (wa1[j] - sum) / r[j + ldr * j];
    }
    temp = lm_enorm(n, wa1);
    parl = fp / delta / temp / temp;
  }
  for (j = 0; j < n; j++) {
    sum = 0;
    for (i = 0; i <= j; i++)
      sum += r[j * ldr + i] * qtb[i];
    wa1[j] = sum / diag[ipvt[j]];
  }
  gnorm = lm_enorm(n, wa1);
  paru = gnorm / delta;
  if (paru == 0.)
    paru = 9.9e-324 / (((delta) <= (p1)) ? (delta) : (p1));
  *par = (((*par) >= (parl)) ? (*par) : (parl));
  *par = (((*par) <= (paru)) ? (*par) : (paru));
  if (*par == 0.)
    *par = gnorm / dxnorm;
  for (;; iter++) {
    if (*par == 0.)
      *par = (((9.9e-324) >= (p001 * paru)) ? (9.9e-324) : (p001 * paru));
    temp = sqrt(*par);
    for (j = 0; j < n; j++)
      wa1[j] = temp * diag[j];
    lm_qrsolv(n, r, ldr, ipvt, wa1, qtb, x, sdiag, wa2);
    for (j = 0; j < n; j++)
      wa2[j] = diag[j] * x[j];
    dxnorm = lm_enorm(n, wa2);
    fp_old = fp;
    fp = dxnorm - delta;
    if (fabs(fp) <= p1 * delta || (parl == 0. && fp <= fp_old && fp_old < 0.) || iter == 10)
      break;
    for (j = 0; j < n; j++)
      wa1[j] = diag[ipvt[j]] * wa2[ipvt[j]] / dxnorm;
    for (j = 0; j < n; j++) {
      wa1[j] = wa1[j] / sdiag[j];
      for (i = j + 1; i < n; i++)
        wa1[i] -= r[j * ldr + i] * wa1[j];
    }
    temp = lm_enorm(n, wa1);
    parc = fp / delta / temp / temp;
    if (fp > 0)
      parl = (((parl) >= (*par)) ? (parl) : (*par));
    else if (fp < 0)
      paru = (((paru) <= (*par)) ? (paru) : (*par));
    *par = (((parl) >= (*par + parc)) ? (parl) : (*par + parc));
  }
}
```