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

```asm
<mp_qrfac>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %edi,0x18(%rsp)
  mov    %esi,0x38(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    %r8d,0x1c(%rsp)
  mov    %r9,0x68(%rsp)
  mov    0xc8(%rsp),%r14
  mov    0xd0(%rsp),%r13
  test   %esi,%esi
  jle    L329
  movslq %edi,%r12
  shl    $0x3,%r12
  mov    %rdx,%rbp
  mov    %esi,%r15d
  mov    $0x0,%ebx
  mov    %r12,(%rsp)
  mov    0xd8(%rsp),%r12
  jmp    L254
L48:
  add    $0x1,%rbx
  add    (%rsp),%rbp
  cmp    %r15,%rbx
  je     L329
L254:
  mov    %rbp,%rsi
  mov    0x18(%rsp),%edi
  call   <mp_enorm@plt>
  movsd  %xmm0,0x0(%r13,%rbx,8)
  movsd  %xmm0,(%r14,%rbx,8)
  movsd  %xmm0,(%r12,%rbx,8)
  cmpl   $0x0,0x1c(%rsp)
  je     L48
  mov    0x68(%rsp),%rax
  mov    %ebx,(%rax,%rbx,4)
  jmp    L48
L329:
  mov    0x38(%rsp),%esi
  mov    0x18(%rsp),%ebx
  mov    %ebx,%edi
  call   <mp_min0@plt>
  test   %eax,%eax
  jle    L12
  mov    %ebx,%edx
  lea    -0x1(%rbx),%esi
  mov    %esi,0x74(%rsp)
  lea    0x1(%rbx),%ebx
  mov    %ebx,0x3c(%rsp)
  movslq %edx,%rcx
  mov    %rcx,0x60(%rsp)
  lea    0x1(%rcx),%rdi
  mov    %rdi,0x40(%rsp)
  mov    %eax,%eax
  mov    %rax,0x48(%rsp)
  lea    0x0(,%rcx,8),%rax
  mov    %rax,0x50(%rsp)
  mov    %edx,0x2c(%rsp)
  mov    %ebx,0x34(%rsp)
  mov    %esi,0x28(%rsp)
  movq   $0x0,0x8(%rsp)
  mov    $0x0,%r15d
  jmp    L110
L319:
  movslq %edx,%rdx
  movsd  (%r14,%r15,8),%xmm0
  movsd  %xmm0,(%r14,%rdx,8)
  mov    0xd8(%rsp),%rax
  movsd  (%rax,%r15,8),%xmm0
  movsd  %xmm0,(%rax,%rdx,8)
  mov    0x68(%rsp),%rsi
  mov    (%rsi,%r15,4),%ecx
  lea    (%rsi,%rdx,4),%rax
  mov    (%rax),%edx
  mov    %edx,(%rsi,%r15,4)
  mov    %ecx,(%rax)
L7:
  mov    0x10(%rsp),%rax
  mov    0x8(%rsp),%rcx
  lea    (%rax,%rcx,8),%rsi
  mov    %rsi,0x20(%rsp)
  mov    0x18(%rsp),%edi
  sub    %r13d,%edi
  call   <mp_enorm@plt>
  movsd  %xmm0,(%rsp)
  ucomisd D50(%rip),%xmm0
  jp     L3
  jne    L3
L236:
  movsd  (%rsp),%xmm0
  xorpd  D14(%rip),%xmm0
  movsd  %xmm0,(%r14,%r15,8)
  add    $0x1,%r15
  subl   $0x1,0x28(%rsp)
  mov    0x3c(%rsp),%esi
  add    %esi,0x34(%rsp)
  mov    0x18(%rsp),%ecx
  add    %ecx,0x2c(%rsp)
  mov    0x40(%rsp),%rdi
  add    %rdi,0x8(%rsp)
  cmp    0x48(%rsp),%r15
  je     L12
L110:
  mov    %r15d,%r13d
  mov    %r15d,%edx
  cmpl   $0x0,0x1c(%rsp)
  je     L7
  mov    %r15d,%esi
  mov    0x38(%rsp),%edi
  cmp    %r15d,%edi
  jle    L7
  mov    %r15,%rax
L157:
  movslq %edx,%rcx
  movsd  (%r14,%rax,8),%xmm0
  ucomisd (%r14,%rcx,8),%xmm0
  cmova  %eax,%edx
  add    $0x1,%rax
  cmp    %eax,%edi
  jg     L157
  cmp    %esi,%edx
  je     L7
  mov    0x2c(%rsp),%edi
  mov    0x18(%rsp),%eax
  sub    %eax,%edi
  mov    %eax,%ecx
  imul   %edx,%ecx
  test   %eax,%eax
  jle    L319
  movslq %edi,%rdi
  mov    0x10(%rsp),%rbx
  lea    (%rbx,%rdi,8),%rax
  mov    0x74(%rsp),%esi
  add    %rdi,%rsi
  lea    0x8(%rbx,%rsi,8),%rsi
  movslq %ecx,%rcx
  sub    %rdi,%rcx
L139:
  movsd  (%rax),%xmm0
  movsd  (%rax,%rcx,8),%xmm1
  movsd  %xmm1,(%rax)
  movsd  %xmm0,(%rax,%rcx,8)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L139
  jmp    L319
L3:
  pxor   %xmm0,%xmm0
  mov    0x10(%rsp),%rax
  mov    0x8(%rsp),%rdx
  comisd (%rax,%rdx,8),%xmm0
  jbe    L26
  movsd  (%rsp),%xmm5
  xorpd  D14(%rip),%xmm5
  movsd  %xmm5,(%rsp)
L26:
  mov    %r15d,0x30(%rsp)
  cmp    %r15d,0x18(%rsp)
  jle    L328
  mov    0x28(%rsp),%eax
  add    0x8(%rsp),%rax
  mov    0x10(%rsp),%rcx
  lea    0x8(%rcx,%rax,8),%rdx
  mov    0x20(%rsp),%rax
L256:
  movsd  (%rax),%xmm0
  divsd  (%rsp),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L256
L328:
  movsd  D17(%rip),%xmm0
  mov    0x10(%rsp),%rax
  mov    0x8(%rsp),%rdi
  addsd  (%rax,%rdi,8),%xmm0
  movsd  %xmm0,(%rax,%rdi,8)
  lea    0x1(%r13),%eax
  cmp    %eax,0x38(%rsp)
  jle    L236
  lea    0x1(%r15),%rdi
  movslq 0x2c(%rsp),%rbx
  lea    (%rbx,%r15,1),%rax
  mov    0x10(%rsp),%rcx
  lea    (%rcx,%rax,8),%r10
  mov    0x8(%rsp),%rsi
  mov    %rsi,%rbp
  sub    %r15,%rbp
  sub    %rbx,%rbp
  mov    0x28(%rsp),%eax
  add    $0x8,%rcx
  lea    (%rbx,%rax,1),%rdx
  add    %r15,%rdx
  lea    (%rcx,%rdx,8),%r12
  sub    %rsi,%rbx
  add    %r15,%rbx
  mov    0x38(%rsp),%edx
  sub    $0x2,%edx
  sub    %r13d,%edx
  lea    0x2(%r15,%rdx,1),%rdx
  mov    %rdx,0x58(%rsp)
  add    %rsi,%rax
  lea    (%rcx,%rax,8),%r13
  mov    0x34(%rsp),%eax
  mov    %eax,0x70(%rsp)
  mov    %r15,0x78(%rsp)
  mov    %r10,%r15
  mov    %r14,0xc8(%rsp)
  mov    %rdi,%r14
  jmp    L302
L189:
  call   <sqrt@plt>
  jmp    L152
L53:
  add    $0x1,%r14
  mov    0x18(%rsp),%ecx
  add    %ecx,0x70(%rsp)
  mov    0x50(%rsp),%rdi
  add    %rdi,%r15
  mov    0x60(%rsp),%rax
  sub    %rax,%rbp
  add    %rdi,%r12
  add    %rax,%rbx
  cmp    0x58(%rsp),%r14
  je     L333
L302:
  mov    0x30(%rsp),%esi
  cmp    %esi,0x18(%rsp)
  jle    L268
  mov    0x20(%rsp),%rax
  pxor   %xmm1,%xmm1
L88:
  movsd  (%rax),%xmm0
  mulsd  (%rax,%rbx,8),%xmm0
  addsd  %xmm0,%xmm1
  add    $0x8,%rax
  cmp    %r13,%rax
  jne    L88
  mov    0x10(%rsp),%rax
  mov    0x8(%rsp),%rsi
  divsd  (%rax,%rsi,8),%xmm1
  mov    %r15,%rax
L63:
  movapd %xmm1,%xmm2
  mulsd  (%rax,%rbp,8),%xmm2
  movsd  (%rax),%xmm0
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %r12,%rax
  jne    L63
L268:
  cmpl   $0x0,0x1c(%rsp)
  je     L53
  mov    0xc8(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm0
  ucomisd D50(%rip),%xmm0
  jp     L162
  je     L53
L162:
  movsd  (%r15),%xmm1
  divsd  %xmm0,%xmm1
  mulsd  %xmm1,%xmm1
  movsd  D17(%rip),%xmm6
  subsd  %xmm1,%xmm6
  movapd %xmm6,%xmm1
  pxor   %xmm0,%xmm0
  call   <mp_dmax1@plt>
  pxor   %xmm7,%xmm7
  ucomisd %xmm0,%xmm7
  ja     L189
  sqrtsd %xmm0,%xmm0
L152:
  mov    0xc8(%rsp),%rax
  mulsd  (%rax,%r14,8),%xmm0
  movsd  %xmm0,(%rax,%r14,8)
  mov    0xd8(%rsp),%rax
  divsd  (%rax,%r14,8),%xmm0
  movapd %xmm0,%xmm1
  mulsd  D15(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  D19(%rip),%xmm1
  comisd %xmm0,%xmm1
  jb     L53
  movslq 0x70(%rsp),%rax
  mov    0x10(%rsp),%rdx
  lea    (%rdx,%rax,8),%rsi
  mov    0x28(%rsp),%edi
  call   <mp_enorm@plt>
  mov    0xc8(%rsp),%rax
  movsd  %xmm0,(%rax,%r14,8)
  mov    0xd8(%rsp),%rax
  movsd  %xmm0,(%rax,%r14,8)
  jmp    L53
L333:
  mov    0x78(%rsp),%r15
  mov    0xc8(%rsp),%r14
  jmp    L236
L12:
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: label: D50
data_type: f64
name: retrieve_data
arguments: label: D14
data_type: byte[16]
name: retrieve_data
arguments: label: D17
data_type: f64
name: retrieve_data
arguments: label: D15
data_type: f64
name: retrieve_data
arguments: label: D19
data_type: byte[8]

tool: D50: 0

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

tool: D17: 1

tool: D15: 0.05

tool: {"D19": [0xa3,0x8d,0x17,0xf4,0xff,0xff,0xaf,0x3c]}

assistant: ```c
void mp_qrfac(int m, int n, double *a, int lda, int pivot, int *ipvt, int lipvt, double *rdiag, double *acnorm, double *wa) {
  int i, ij, jj, j, jp1, k, kmax, minmn;
  double ajnorm, sum, temp;
  static double zero = 0.0;
  static double one = 1.0;
  static double p05 = 0.05;
  lda = 0;
  lipvt = 0;
  if (lda) {
  }
  if (lipvt) {
  }
  ij = 0;
  for (j = 0; j < n; j++) {
    acnorm[j] = mp_enorm(m, &a[ij]);
    rdiag[j] = acnorm[j];
    wa[j] = rdiag[j];
    if (pivot != 0)
      ipvt[j] = j;
    ij += m;
  }
  minmn = mp_min0(m, n);
  for (j = 0; j < minmn; j++) {
    if (pivot == 0)
      goto L40;
    kmax = j;
    for (k = j; k < n; k++) {
      if (rdiag[k] > rdiag[kmax])
        kmax = k;
    }
    if (kmax == j)
      goto L40;
    ij = m * j;
    jj = m * kmax;
    for (i = 0; i < m; i++) {
      temp = a[ij];
      a[ij] = a[jj];
      a[jj] = temp;
      ij += 1;
      jj += 1;
    }
    rdiag[kmax] = rdiag[j];
    wa[kmax] = wa[j];
    k = ipvt[j];
    ipvt[j] = ipvt[kmax];
    ipvt[kmax] = k;
  L40:
    jj = j + m * j;
    ajnorm = mp_enorm(m - j, &a[jj]);
    if (ajnorm == zero)
      goto L100;
    if (a[jj] < zero)
      ajnorm = -ajnorm;
    ij = jj;
    for (i = j; i < m; i++) {
      a[ij] /= ajnorm;
      ij += 1;
    }
    a[jj] += one;
    jp1 = j + 1;
    if (jp1 < n) {
      for (k = jp1; k < n; k++) {
        sum = zero;
        ij = j + m * k;
        jj = j + m * j;
        for (i = j; i < m; i++) {
          sum += a[jj] * a[ij];
          ij += 1;
          jj += 1;
        }
        temp = sum / a[j + m * j];
        ij = j + m * k;
        jj = j + m * j;
        for (i = j; i < m; i++) {
          a[ij] -= temp * a[jj];
          ij += 1;
          jj += 1;
        }
        if ((pivot != 0) && (rdiag[k] != zero)) {
          temp = a[j + m * k] / rdiag[k];
          temp = mp_dmax1(zero, one - temp * temp);
          rdiag[k] *= sqrt(temp);
          temp = rdiag[k] / wa[k];
          if ((p05 * temp * temp) <= 2.2204460e-16) {
            rdiag[k] = mp_enorm(m - j - 1, &a[jp1 + m * k]);
            wa[k] = rdiag[k];
          }
        }
      }
    }
  L100:
    rdiag[j] = -ajnorm;
  }
}
```