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    $0x88,%rsp
  mov    %rsi,0x38(%rsp)
  mov    %edx,0x7c(%rsp)
  mov    %rcx,0x58(%rsp)
  mov    %r8,0x68(%rsp)
  mov    0xc8(%rsp),%r14
  test   %edi,%edi
  jle    L258
  mov    %edi,%r15d
  mov    %rsi,%rax
  movslq %edx,%rsi
  lea    0x1(%rsi),%rbx
  lea    -0x1(%rdi),%ecx
  mov    %ecx,0x78(%rsp)
  mov    %ecx,%r10d
  add    $0x2,%r10
  shl    $0x3,%rsi
  mov    $0x0,%r8d
  mov    $0x1,%edi
  lea    0x8(%rax),%r11
  mov    %rax,%rbp
  mov    0xc0(%rsp),%r12
  mov    0xd0(%rsp),%r13
  jmp    L67
L376:
  lea    0x0(%rbp,%r8,8),%rdx
  mov    %r15d,%eax
  sub    %edi,%eax
  add    %r8,%rax
  lea    (%r11,%rax,8),%rcx
  mov    %rdx,%rax
L241:
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  add    %rsi,%rdx
  add    $0x8,%rax
  cmp    %rcx,%rax
  jne    L241
L87:
  movsd  0x0(%rbp,%r8,8),%xmm0
  movsd  %xmm0,-0x8(%r12,%rdi,8)
  movsd  -0x8(%r9,%rdi,8),%xmm0
  movsd  %xmm0,-0x8(%r13,%rdi,8)
  add    $0x1,%rdi
  add    %rbx,%r8
  cmp    %r10,%rdi
  je     L190
L67:
  lea    -0x1(%rdi),%eax
  cmp    %eax,%r15d
  jg     L376
  jmp    L87
L190:
  lea    0x8(%rsi),%rax
  mov    %rax,0x70(%rsp)
  mov    0x38(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0x7c(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x50(%rsp)
  mov    %r15d,%eax
  mov    %rax,0x60(%rsp)
  mov    %r14,0x30(%rsp)
  movl   $0x0,0x54(%rsp)
  movq   $0x0,0x18(%rsp)
  mov    %r15d,%r13d
  jmp    L326
L139:
  call   <sqrt@plt>
  jmp    L183
L312:
  mov    0x8(%rsp),%rax
  movsd  (%rax),%xmm0
  divsd  0x0(%rbp),%xmm0
  movapd %xmm0,%xmm6
  movsd  %xmm0,0x20(%rsp)
  mulsd  D12(%rip),%xmm0
  mulsd  %xmm6,%xmm0
  addsd  D12(%rip),%xmm0
  pxor   %xmm4,%xmm4
  ucomisd %xmm0,%xmm4
  ja     L353
  sqrtsd %xmm0,%xmm0
L262:
  movsd  D30(%rip),%xmm2
  divsd  %xmm0,%xmm2
  movsd  0x20(%rsp),%xmm4
  mulsd  %xmm2,%xmm4
  jmp    L20
L353:
  call   <sqrt@plt>
  jmp    L262
L217:
  movapd %xmm4,%xmm6
  xorpd  D47(%rip),%xmm6
  movslq %r15d,%rax
  mov    %r14,%rdx
  sub    %rbx,%rdx
  add    0x40(%rsp),%rdx
  add    0x38(%rsp),%rdx
L159:
  movsd  (%rdx,%rax,8),%xmm0
  movsd  (%r14,%rax,8),%xmm1
  movapd %xmm6,%xmm3
  mulsd  %xmm0,%xmm3
  movapd %xmm1,%xmm5
  mulsd  %xmm2,%xmm5
  addsd  %xmm5,%xmm3
  movsd  %xmm3,(%r14,%rax,8)
  mulsd  %xmm2,%xmm0
  mulsd  %xmm4,%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r13d
  jg     L159
  mulsd  0x28(%rsp),%xmm2
  mulsd  %xmm6,%xmm7
  addsd  %xmm2,%xmm7
  movsd  %xmm7,0x28(%rsp)
  jmp    L209
L237:
  cmp    %r15d,%r13d
  jle    L130
L209:
  add    $0x8,%rbx
  add    $0x1,%r15d
  mov    0x50(%rsp),%edi
  add    %edi,0x14(%rsp)
  add    $0x8,%r12
L310:
  mov    %rbx,0x8(%rsp)
  pxor   %xmm6,%xmm6
  ucomisd (%rbx),%xmm6
  jp     L276
  je     L237
L276:
  movslq 0x14(%rsp),%rax
  shl    $0x3,%rax
  mov    %rax,0x40(%rsp)
  mov    0x38(%rsp),%rbp
  add    %rax,%rbp
  movsd  0x0(%rbp),%xmm0
  call   <fabs@plt>
  mov    %rax,0x20(%rsp)
  mov    0x8(%rsp),%rdi
  movsd  (%rdi),%xmm0
  call   <fabs@plt>
  cmp    %rax,0x20(%rsp)
  jge    L312
  movsd  0x0(%rbp),%xmm0
  mov    0x8(%rsp),%rax
  divsd  (%rax),%xmm0
  movapd %xmm0,%xmm7
  movsd  %xmm0,0x20(%rsp)
  movsd  D12(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  mulsd  %xmm7,%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L139
  sqrtsd %xmm0,%xmm0
L183:
  movsd  D30(%rip),%xmm4
  divsd  %xmm0,%xmm4
  movsd  0x20(%rsp),%xmm2
  mulsd  %xmm4,%xmm2
L20:
  movapd %xmm2,%xmm0
  mulsd  0x0(%rbp),%xmm0
  mov    0x8(%rsp),%rax
  movapd %xmm4,%xmm1
  mulsd  (%rax),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%rbp)
  movsd  (%r12),%xmm7
  movapd %xmm7,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  0x28(%rsp),%xmm1
  mulsd  %xmm4,%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  cmp    %r15d,%r13d
  jg     L217
L130:
  mov    0x48(%rsp),%rax
  movsd  (%rax),%xmm0
  mov    0x30(%rsp),%rbx
  movsd  %xmm0,(%rbx)
  mov    0xc0(%rsp),%rdi
  mov    0x18(%rsp),%rsi
  movsd  (%rdi,%rsi,8),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x1,%rsi
  mov    %rsi,0x18(%rsp)
  mov    0x70(%rsp),%rcx
  add    %rcx,%rax
  mov    %rax,0x48(%rsp)
  add    $0x8,%rbx
  mov    %rbx,0x30(%rsp)
  mov    0x50(%rsp),%edi
  add    %edi,0x54(%rsp)
  cmp    0x60(%rsp),%rsi
  je     L94
L326:
  mov    0x18(%rsp),%rax
  mov    %eax,%esi
  mov    0x58(%rsp),%rdi
  movslq (%rdi,%rax,4),%rax
  mov    0x68(%rsp),%rdi
  lea    (%rdi,%rax,8),%rcx
  movsd  (%rcx),%xmm0
  pxor   %xmm7,%xmm7
  ucomisd %xmm7,%xmm0
  jp     L180
  je     L130
L180:
  mov    0x18(%rsp),%rbx
  cmp    %ebx,%r13d
  jle    L230
  mov    0x78(%rsp),%eax
  sub    %esi,%eax
  add    %rbx,%rax
  lea    0x8(%r14,%rax,8),%rdx
  mov    0x30(%rsp),%rax
L170:
  movq   $0x0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L170
  movsd  (%rcx),%xmm0
  mov    0x30(%rsp),%rbx
  movsd  %xmm0,(%rbx)
  lea    0x1(%rsi),%r15d
  mov    0xd0(%rsp),%rax
  mov    0x18(%rsp),%rcx
  lea    (%rax,%rcx,8),%r12
  mov    0x54(%rsp),%eax
  mov    %eax,0x14(%rsp)
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x28(%rsp)
  jmp    L310
L94:
  mov    %r13d,%r15d
  mov    %r13d,%edx
  mov    $0x0,%eax
  pxor   %xmm0,%xmm0
  mov    $0x0,%edi
  mov    0x60(%rsp),%r8
  mov    0xd0(%rsp),%r9
  jmp    L182
L143:
  add    $0x1,%rax
  cmp    %r8,%rax
  je     L291
L182:
  ucomisd (%r14,%rax,8),%xmm0
  setnp  %cl
  cmovne %edi,%ecx
  test   %cl,%cl
  je     L280
  cmp    %edx,%r15d
  cmove  %eax,%edx
L280:
  cmp    %r15d,%edx
  jge    L143
  movq   $0x0,(%r9,%rax,8)
  jmp    L143
L228:
  sub    $0x1,%rcx
  add    %r9d,%esi
  add    $0x8,%rdi
L68:
  movsd  (%r10,%rcx,8),%xmm0
  subsd  %xmm1,%xmm0
  divsd  (%r14,%rcx,8),%xmm0
  movsd  %xmm0,(%r10,%rcx,8)
  cmp    %r8,%rcx
  je     L348
  pxor   %xmm1,%xmm1
  cmp    %ecx,%edx
  jle    L228
  movslq %esi,%rax
  lea    (%rdi,%rax,8),%r11
  add    0x38(%rsp),%r11
  mov    %rcx,%rax
L202:
  movsd  (%r11,%rax,8),%xmm0
  mulsd  (%r10,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L202
  jmp    L228
L348:
  mov    $0x0,%eax
  mov    0x58(%rsp),%rcx
  mov    0xc0(%rsp),%rsi
  mov    0xd0(%rsp),%rdi
L35:
  movsd  (%rdi,%rax,8),%xmm0
  movslq (%rcx,%rax,4),%rdx
  movsd  %xmm0,(%rsi,%rdx,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L35
L258:
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L291:
  test   %edx,%edx
  jle    L348
  lea    -0x1(%rdx),%eax
  movslq %eax,%rcx
  mov    0x7c(%rsp),%edi
  mov    %edi,%r9d
  not    %r9d
  lea    -0x2(%rdx),%esi
  imul   %edi,%esi
  add    %eax,%esi
  movslq %edx,%r8
  mov    %r8,%rdi
  neg    %rdi
  lea    0x8(,%rdi,8),%rdi
  sub    $0x1,%r8
  mov    %eax,%eax
  sub    %rax,%r8
  pxor   %xmm1,%xmm1
  mov    0xd0(%rsp),%r10
  jmp    L68
L230:
  mov    0x30(%rsp),%rax
  movsd  %xmm0,(%rax)
  jmp    L130
```

tool_calls: name: parse_data
arguments: data_label: D12
data_type: f64
name: parse_data
arguments: data_label: D30
data_type: f64
name: parse_data
arguments: data_label: D47
data_type: f32[4]

tool: D12: 0.25

tool: D30: 0.5

tool: {"D47": [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 cs, cotan, qtbpj, sn, sum, tn, 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];
        sn = p5 / sqrt(p25 + p25 * cotan * cotan);
        cs = sn * cotan;
      } else {
        tn = sdiag[k] / r[kk];
        cs = p5 / sqrt(p25 + p25 * tn * tn);
        sn = cs * tn;
      }
      r[kk] = cs * r[kk] + sn * sdiag[k];
      temp = cs * wa[k] + sn * qtbpj;
      qtbpj = -sn * wa[k] + cs * qtbpj;
      wa[k] = temp;
      kp1 = k + 1;
      if (n > kp1) {
        ik = kk + 1;
        for (i = kp1; i < n; i++) {
          temp = cs * r[ik] + sn * sdiag[i];
          sdiag[i] = -sn * r[ik] + cs * 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];
  }
}
```