user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mp_qrsolv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %r8,0x78(%rsp)
  mov    0xe8(%rsp),%r15
  mov    %edx,0x10(%rsp)
  mov    0xf0(%rsp),%r8
  mov    %rcx,0x70(%rsp)
  test   %edi,%edi
  jle    L152
  lea    0x1(%rdx),%eax
  mov    %edi,%r14d
  mov    %rsi,%r13
  mov    %eax,0x14(%rsp)
  cmp    $0x1,%edx
  jne    L345
  mov    %rsi,%rdx
  mov    0xe0(%rsp),%rsi
  lea    0x1(%rdi),%ecx
  mov    $0x1,%eax
  nopl   0x0(%rax)
L258:
  movsd  (%rdx),%xmm0
  add    $0x10,%rdx
  movsd  %xmm0,-0x8(%rsi,%rax,8)
  movsd  -0x8(%r9,%rax,8),%xmm0
  movsd  %xmm0,-0x8(%r8,%rax,8)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L258
L150:
  movslq 0x10(%rsp),%rax
  mov    %r13,0x50(%rsp)
  mov    $0x1,%r10d
  pxor   %xmm6,%xmm6
  mov    %r15,0x18(%rsp)
  mov    %r13,%rcx
  lea    0x8(,%rax,8),%rax
  movl   $0x0,0x64(%rsp)
  mov    %rax,0x80(%rsp)
  lea    -0x1(%r14),%eax
  add    $0x2,%rax
  mov    %r14d,0xc(%rsp)
  mov    %rax,0x88(%rsp)
  movl   $0x0,0x90(%rsp)
  mov    %r15,0xe8(%rsp)
  mov    %r8,0xf0(%rsp)
  jmp    L129
  nopl   0x0(%rax,%rax,1)
L352:
  mov    0x50(%rsp),%rax
  mov    0x18(%rsp),%rsi
  mov    0x80(%rsp),%rdi
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rsi)
  mov    0xe0(%rsp),%rsi
  movsd  -0x8(%rsi,%r10,8),%xmm0
  mov    0x14(%rsp),%esi
  add    $0x1,%r10
  add    %esi,0x64(%rsp)
  movsd  %xmm0,(%rax)
  add    %rdi,%rax
  mov    0x10(%rsp),%edi
  mov    %rax,0x50(%rsp)
  mov    0x48(%rsp),%rax
  add    %edi,0x90(%rsp)
  mov    %rax,0x18(%rsp)
  cmp    0x88(%rsp),%r10
  je     L311
L129:
  mov    0x70(%rsp),%rax
  mov    0x78(%rsp),%rdi
  mov    %r10d,%edx
  lea    -0x1(%r10),%esi
  movslq -0x4(%rax,%r10,4),%rax
  lea    (%rdi,%rax,8),%rbx
  ucomisd (%rbx),%xmm6
  jp     L171
  mov    0x18(%rsp),%rax
  lea    0x8(%rax),%rax
  mov    %rax,0x48(%rsp)
  je     L352
L171:
  mov    0xc(%rsp),%edi
  mov    0x18(%rsp),%r15
  mov    %rcx,0x28(%rsp)
  mov    %r10,0x20(%rsp)
  mov    %edi,%r13d
  sub    %edx,%r13d
  cmp    %esi,%edi
  mov    %r15,%rdi
  mov    %r13d,%eax
  lea    0x8(,%rax,8),%rdx
  mov    $0x8,%eax
  cmovle %rax,%rdx
  xor    %esi,%esi
  call   <memset@plt>
  movsd  (%rbx),%xmm0
  mov    0x64(%rsp),%esi
  mov    %r13d,%edi
  mov    0x20(%rsp),%r10
  add    $0x8,%rax
  pxor   %xmm6,%xmm6
  mov    0xe8(%rsp),%r8
  mov    %rax,0x48(%rsp)
  mov    0x90(%rsp),%r9d
  mov    %rax,%rbp
  movapd %xmm6,%xmm5
  mov    %r10,0x68(%rsp)
  sub    %r15,%r8
  mov    0x28(%rsp),%rcx
  mov    %r10,%rbx
  movsd  %xmm0,(%r15)
  mov    %esi,%r15d
  mov    0xf0(%rsp),%rsi
  nopl   (%rax)
L279:
  ucomisd -0x8(%rbp),%xmm6
  lea    -0x1(%rbx),%r13
  mov    %ebx,%r12d
  jp     L15
  je     L336
L15:
  movslq %r15d,%r14
  mov    %rsi,0xf0(%rsp)
  lea    0x0(,%r14,8),%rax
  mov    %edi,0x60(%rsp)
  lea    (%rcx,%rax,1),%r14
  mov    %r9d,0x40(%rsp)
  movsd  (%r14),%xmm0
  mov    %r8,0x38(%rsp)
  mov    %rcx,0x28(%rsp)
  movsd  %xmm5,0x30(%rsp)
  mov    %rax,0x58(%rsp)
  call   <fabs@plt>
  movsd  -0x8(%rbp),%xmm0
  mov    %rax,0x20(%rsp)
  call   <fabs@plt>
  cmp    %rax,0x20(%rsp)
  mov    0x28(%rsp),%rcx
  pxor   %xmm6,%xmm6
  movsd  0x30(%rsp),%xmm5
  mov    0x38(%rsp),%r8
  mov    0x40(%rsp),%r9d
  mov    0x60(%rsp),%edi
  mov    0xf0(%rsp),%rsi
  jge    L228
  movsd  (%r14),%xmm3
  movsd  -0x8(%rbp),%xmm4
  movsd  D56(%rip),%xmm0
  movapd %xmm3,%xmm1
  divsd  %xmm4,%xmm1
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  D56(%rip),%xmm0
  ucomisd %xmm0,%xmm6
  ja     L357
  sqrtsd %xmm0,%xmm0
L304:
  movsd  D13(%rip),%xmm2
  divsd  %xmm0,%xmm2
  mulsd  %xmm2,%xmm1
L88:
  mulsd  %xmm2,%xmm4
  movslq %ebx,%rdx
  mulsd  %xmm1,%xmm3
  addsd  %xmm4,%xmm3
  movapd %xmm2,%xmm4
  mulsd  %xmm5,%xmm4
  mulsd  %xmm1,%xmm5
  movsd  %xmm3,(%r14)
  movsd  -0x8(%rsi,%rbx,8),%xmm0
  movapd %xmm0,%xmm3
  mulsd  %xmm1,%xmm3
  addsd  %xmm4,%xmm3
  movapd %xmm2,%xmm4
  xorpd  D31(%rip),%xmm4
  mulsd  %xmm4,%xmm0
  movsd  %xmm3,-0x8(%rsi,%rbx,8)
  addsd  %xmm0,%xmm5
  cmp    %ebx,0xc(%rsp)
  jg     L293
L237:
  mov    0x68(%rsp),%r10
  jmp    L352
  nopw   0x0(%rax,%rax,1)
L336:
  cmp    %ebx,0xc(%rsp)
  jle    L237
L188:
  add    $0x1,%rbx
  add    0x14(%rsp),%r15d
  sub    $0x8,%r8
  sub    $0x1,%edi
  add    0x10(%rsp),%r9d
  add    $0x8,%rbp
  jmp    L279
  nopl   0x0(%rax)
L228:
  movsd  -0x8(%rbp),%xmm4
  movsd  (%r14),%xmm3
  movsd  D56(%rip),%xmm0
  movapd %xmm4,%xmm2
  divsd  %xmm3,%xmm2
  mulsd  %xmm2,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  D56(%rip),%xmm0
  ucomisd %xmm0,%xmm6
  ja     L73
  sqrtsd %xmm0,%xmm0
L33:
  movsd  D13(%rip),%xmm1
  divsd  %xmm0,%xmm1
  mulsd  %xmm1,%xmm2
  jmp    L88
  nopl   (%rax)
L293:
  movslq %r9d,%r11
  lea    0x1(%r15),%eax
  lea    0x3(%r13,%r11,1),%r11
  lea    0x10(%rbp),%r13
  shl    $0x3,%r11
  lea    -0x10(%rcx,%r11,1),%r10
  cmp    %r13,%r10
  setae  %r13b
  add    %rcx,%r11
  cmp    %r11,%rbp
  setae  %r11b
  or     %r13b,%r11b
  je     L98
  cmp    $0x1,%edi
  je     L98
  mov    %edi,%r11d
  movapd %xmm1,%xmm8
  movapd %xmm2,%xmm11
  xor    %edx,%edx
  movapd %xmm4,%xmm10
  shr    %r11d
  unpcklpd %xmm8,%xmm8
  unpcklpd %xmm11,%xmm11
  unpcklpd %xmm10,%xmm10
  shl    $0x4,%r11
  xchg   %ax,%ax
L24:
  movupd (%r10,%rdx,1),%xmm0
  movupd 0x0(%rbp,%rdx,1),%xmm3
  movapd %xmm8,%xmm9
  mulpd  %xmm3,%xmm9
  movapd %xmm0,%xmm7
  mulpd  %xmm10,%xmm7
  mulpd  %xmm8,%xmm0
  mulpd  %xmm11,%xmm3
  addpd  %xmm9,%xmm7
  addpd  %xmm3,%xmm0
  movups %xmm7,0x0(%rbp,%rdx,1)
  movups %xmm0,(%r10,%rdx,1)
  add    $0x10,%rdx
  cmp    %r11,%rdx
  jne    L24
  mov    %edi,%edx
  and    $0xfffffffe,%edx
  add    %edx,%r12d
  add    %edx,%eax
  cmp    %edi,%edx
  je     L188
  mov    0xe8(%rsp),%rdx
  movslq %r12d,%r12
  cltq
  lea    (%rcx,%rax,8),%rax
  lea    (%rdx,%r12,8),%rdx
  movsd  (%rax),%xmm3
  movsd  (%rdx),%xmm0
  mulsd  %xmm3,%xmm4
  mulsd  %xmm1,%xmm3
  movapd %xmm0,%xmm7
  mulsd  %xmm1,%xmm7
  mulsd  %xmm2,%xmm0
  addsd  %xmm7,%xmm4
  addsd  %xmm3,%xmm0
  movsd  %xmm4,(%rdx)
  movsd  %xmm0,(%rax)
  jmp    L188
  nopl   (%rax)
L98:
  mov    0x58(%rsp),%rax
  mov    0xc(%rsp),%r11d
  mov    0xe8(%rsp),%r10
  add    %r8,%rax
  add    %rcx,%rax
  nopl   0x0(%rax,%rax,1)
L42:
  movsd  (%rax,%rdx,8),%xmm3
  movsd  (%r10,%rdx,8),%xmm0
  movapd %xmm1,%xmm7
  movapd %xmm4,%xmm8
  mulsd  %xmm0,%xmm7
  mulsd  %xmm3,%xmm8
  mulsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm3
  addsd  %xmm8,%xmm7
  addsd  %xmm3,%xmm0
  movsd  %xmm7,(%r10,%rdx,8)
  movsd  %xmm0,(%rax,%rdx,8)
  add    $0x1,%rdx
  cmp    %edx,%r11d
  jg     L42
  jmp    L188
L203:
  mov    0xc(%rsp),%r14d
L164:
  mov    0x70(%rsp),%rcx
  mov    0xe0(%rsp),%rsi
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L320:
  movsd  (%r8,%rax,8),%xmm0
  movslq (%rcx,%rax,4),%rdx
  add    $0x1,%rax
  movsd  %xmm0,(%rsi,%rdx,8)
  cmp    %eax,%r14d
  jg     L320
L152:
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L311:
  mov    0xc(%rsp),%edi
  mov    0xe8(%rsp),%r15
  xor    %edx,%edx
  xor    %esi,%esi
  mov    0xf0(%rsp),%r8
  mov    %rcx,%r13
  mov    %rdi,%r14
  mov    %edi,%eax
L231:
  ucomisd (%r15,%rdx,8),%xmm6
  setnp  %cl
  cmovne %esi,%ecx
  test   %cl,%cl
  je     L116
  cmp    %eax,%r14d
  cmove  %edx,%eax
L116:
  cmp    %r14d,%eax
  jge    L165
  movq   $0x0,(%r8,%rdx,8)
L165:
  add    $0x1,%rdx
  cmp    %rdi,%rdx
  jne    L231
  test   %eax,%eax
  je     L164
  lea    -0x1(%rax),%r10d
  movslq %r10d,%rcx
  lea    (%r8,%rcx,8),%rdx
  movsd  (%rdx),%xmm0
  divsd  (%r15,%rcx,8),%xmm0
  movsd  %xmm0,(%rdx)
  cmp    $0x1,%eax
  je     L164
  mov    0x10(%rsp),%ecx
  lea    -0x2(%rax),%ebx
  movslq %eax,%r9
  mov    %r14d,0xc(%rsp)
  sub    $0x1,%r9
  mov    $0x1,%edi
  imul   %ecx,%ebx
  mov    %ecx,%r12d
  lea    (%r8,%r9,8),%rsi
  mov    %ecx,%r14d
  not    %r12d
  add    %ebx,%r10d
  jmp    L191
  nopl   0x0(%rax,%rax,1)
L413:
  movsd  -0x8(%rsi),%xmm1
  add    $0x1,%edi
  add    %r12d,%r10d
  sub    $0x8,%rsi
  sub    %r14d,%ebx
  subsd  %xmm0,%xmm1
  divsd  -0x8(%r15,%r9,8),%xmm1
  sub    $0x1,%r9
  movsd  %xmm1,(%rsi)
  cmp    %edi,%eax
  je     L203
L191:
  mov    %eax,%ecx
  movapd %xmm6,%xmm0
  sub    %edi,%ecx
  cmp    %eax,%ecx
  jge    L413
  mov    %r10d,%edx
  cmp    $0x1,%edi
  je     L184
  movslq %ebx,%rdx
  mov    %edi,%r11d
  add    %r9,%rdx
  shr    %r11d
  lea    0x0(%r13,%rdx,8),%rbp
  shl    $0x4,%r11
  xor    %edx,%edx
L83:
  movupd (%rsi,%rdx,1),%xmm2
  movupd 0x0(%rbp,%rdx,1),%xmm5
  add    $0x10,%rdx
  mulpd  %xmm5,%xmm2
  addsd  %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  cmp    %rdx,%r11
  jne    L83
  mov    %edi,%r11d
  and    $0xfffffffe,%r11d
  add    %r11d,%ecx
  lea    (%r10,%r11,1),%edx
  cmp    %r11d,%edi
  je     L413
L184:
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movsd  0x0(%r13,%rdx,8),%xmm1
  mulsd  (%r8,%rcx,8),%xmm1
  addsd  %xmm1,%xmm0
  jmp    L413
L345:
  movslq %eax,%r11
  mov    0xe0(%rsp),%rbp
  mov    %rsi,%r10
  movslq %edi,%rbx
  shl    $0x3,%r11
  xor    %edi,%edi
  lea    -0x8(%r11),%rsi
  nopw   0x0(%rax,%rax,1)
L105:
  mov    %edi,%ecx
  mov    %r10,%rdx
  mov    %r10,%rax
L338:
  movsd  (%rax),%xmm0
  add    $0x1,%ecx
  add    %rsi,%rax
  add    $0x8,%rdx
  movsd  %xmm0,-0x8(%rdx)
  cmp    %ecx,%r14d
  jg     L338
  movsd  (%r10),%xmm0
  add    %r11,%r10
  movsd  %xmm0,0x0(%rbp,%rdi,8)
  movsd  (%r9,%rdi,8),%xmm0
  movsd  %xmm0,(%r8,%rdi,8)
  add    $0x1,%rdi
  cmp    %rbx,%rdi
  jne    L105
  jmp    L150
L357:
  mov    %rsi,0xf0(%rsp)
  mov    %rcx,0x98(%rsp)
  mov    %edi,0x94(%rsp)
  mov    %r9d,0x60(%rsp)
  mov    %r8,0x40(%rsp)
  movsd  %xmm5,0x38(%rsp)
  movsd  %xmm1,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm3,0x20(%rsp)
  call   <sqrt@plt>
  mov    0x94(%rsp),%edi
  mov    0x60(%rsp),%r9d
  pxor   %xmm6,%xmm6
  mov    0xf0(%rsp),%rsi
  mov    0x98(%rsp),%rcx
  mov    0x40(%rsp),%r8
  movsd  0x38(%rsp),%xmm5
  movsd  0x30(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm3
  jmp    L304
L73:
  mov    %rsi,0xf0(%rsp)
  mov    %rcx,0x98(%rsp)
  mov    %edi,0x94(%rsp)
  mov    %r9d,0x60(%rsp)
  mov    %r8,0x40(%rsp)
  movsd  %xmm5,0x38(%rsp)
  movsd  %xmm2,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm3,0x20(%rsp)
  call   <sqrt@plt>
  mov    0x94(%rsp),%edi
  mov    0x60(%rsp),%r9d
  pxor   %xmm6,%xmm6
  mov    0xf0(%rsp),%rsi
  mov    0x98(%rsp),%rcx
  mov    0x40(%rsp),%r8
  movsd  0x38(%rsp),%xmm5
  movsd  0x30(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm3
  jmp    L33
```

tool_calls: name: parse_data
arguments: data_label: D56
type: f64
name: parse_data
arguments: data_label: D13
type: f64
name: parse_data
arguments: data_label: D31
type: f32[4]

tool: D56: 0.25

tool: D13: 0.5

tool: {"D31": [0.0,-0.0,0.0,0.0]}

assistant: ```c
void mp_qrsolv(int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double *x, double *sdiag, double *wa) {
  int i, ij, ik, kk, j, jp1, k, kp1, l, nsing;
  double cosx, cotan, qtbpj, sinx, sum, tanx, temp;
  static double zero = 0.0;
  static double p25 = 0.25;
  static double p5 = 0.5;
  kk = 0;
  for (j = 0; j < n; j++) {
    ij = kk;
    ik = kk;
    for (i = j; i < n; i++) {
      r[ij] = r[ik];
      ij += 1;
      ik += ldr;
    }
    x[j] = r[kk];
    wa[j] = qtb[j];
    kk += ldr + 1;
  }
  for (j = 0; j < n; j++) {
    l = ipvt[j];
    if (diag[l] == zero)
      goto L90;
    for (k = j; k < n; k++)
      sdiag[k] = zero;
    sdiag[j] = diag[l];
    qtbpj = zero;
    for (k = j; k < n; k++) {
      if (sdiag[k] == zero)
        continue;
      kk = k + ldr * k;
      if (fabs(r[kk]) < fabs(sdiag[k])) {
        cotan = r[kk] / sdiag[k];
        sinx = p5 / sqrt(p25 + p25 * cotan * cotan);
        cosx = sinx * cotan;
      } else {
        tanx = sdiag[k] / r[kk];
        cosx = p5 / sqrt(p25 + p25 * tanx * tanx);
        sinx = cosx * tanx;
      }
      r[kk] = cosx * r[kk] + sinx * sdiag[k];
      temp = cosx * wa[k] + sinx * qtbpj;
      qtbpj = -sinx * wa[k] + cosx * qtbpj;
      wa[k] = temp;
      kp1 = k + 1;
      if (n > kp1) {
        ik = kk + 1;
        for (i = kp1; i < n; i++) {
          temp = cosx * r[ik] + sinx * sdiag[i];
          sdiag[i] = -sinx * r[ik] + cosx * sdiag[i];
          r[ik] = temp;
          ik += 1;
        }
      }
    }
  L90:
    kk = j + ldr * j;
    sdiag[j] = r[kk];
    r[kk] = x[j];
  }
  nsing = n;
  for (j = 0; j < n; j++) {
    if ((sdiag[j] == zero) && (nsing == n))
      nsing = j;
    if (nsing < n)
      wa[j] = zero;
  }
  if (nsing < 1)
    goto L150;
  for (k = 0; k < nsing; k++) {
    j = nsing - k - 1;
    sum = zero;
    jp1 = j + 1;
    if (nsing > jp1) {
      ij = jp1 + ldr * j;
      for (i = jp1; i < nsing; i++) {
        sum += r[ij] * wa[i];
        ij += 1;
      }
    }
    wa[j] = (wa[j] - sum) / sdiag[j];
  }
L150:
  for (j = 0; j < n; j++) {
    l = ipvt[j];
    x[l] = wa[j];
  }
}
```