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

```asm
<qr_house>:
  endbr64
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,0x38(%rsp)
  mov    %esi,0x50(%rsp)
  mov    %rcx,0x68(%rsp)
  cmp    %edx,%esi
  jl     L122
L155:
  movslq 0x50(%rsp),%rbp
  movslq %r14d,%rbx
  lea    0x0(,%rbp,8),%r12d
  mov    %rbp,%r15
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %r12d,%edi
  mov    %rax,0x40(%rsp)
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %ebp,%edi
  imul   %r14d,%edi
  mov    %rax,0x18(%rsp)
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %ebp,%edi
  imul   %ebp,%edi
  mov    %rax,0x20(%rsp)
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,0x28(%rsp)
  test   %r14d,%r14d
  jle    L111
  sub    %r14d,%r15d
  lea    -0x1(%rbp),%eax
  movl   $0x0,0x34(%rsp)
  lea    0x0(,%rbp,8),%r11
  mov    %r15d,0x64(%rsp)
  lea    0x0(,%rbx,8),%r15
  sub    %rbp,%rbx
  mov    %r11,%rbp
  mov    %eax,0x10(%rsp)
  lea    0x0(,%rbx,8),%rax
  mov    %rax,0x70(%rsp)
  lea    0x8(%r13),%rax
  movq   $0x0,0x8(%rsp)
  mov    %rax,0x78(%rsp)
  nopl   0x0(%rax,%rax,1)
L127:
  mov    0x8(%rsp),%rsi
  mov    %r14d,%eax
  sub    %esi,%eax
  mov    %esi,%r12d
  mov    %eax,0x30(%rsp)
  mov    0x50(%rsp),%eax
  mov    %eax,%edi
  sub    0x10(%rsp),%edi
  mov    %edi,0x60(%rsp)
  mov    %eax,%edi
  sub    %esi,%edi
  mov    %edi,0x14(%rsp)
  cmp    %esi,%eax
  jle    L105
  movslq 0x34(%rsp),%rbx
  mov    0x8(%rsp),%rax
  mov    0x38(%rsp),%rdi
  mov    0x10(%rsp),%ecx
  add    %rbx,%rax
  lea    (%rdi,%rax,8),%rdx
  mov    0x78(%rsp),%rdi
  mov    0x40(%rsp),%rax
  lea    (%rdi,%rcx,8),%rcx
  nopw   0x0(%rax,%rax,1)
L52:
  movsd  (%rdx),%xmm0
  add    $0x8,%rax
  add    %r15,%rdx
  movsd  %xmm0,-0x8(%rax)
  cmp    %rcx,%rax
  jne    L52
  mov    0x14(%rsp),%esi
  mov    0x40(%rsp),%rdi
  mov    0x18(%rsp),%rdx
  call   <house@plt>
  mov    0x68(%rsp),%rax
  mov    0x8(%rsp),%rdi
  mov    %r12d,%r10d
  mov    0x20(%rsp),%rsi
  mov    0x50(%rsp),%r8d
  movsd  %xmm0,(%rax,%rdi,8)
  mov    0x38(%rsp),%rax
  mov    %rsi,%r13
  lea    (%rax,%rbx,8),%rbx
  mov    %rbx,%rcx
  nopl   0x0(%rax,%rax,1)
L84:
  mov    %rsi,%rdx
  mov    %rdi,%rax
  xchg   %ax,%ax
L113:
  movsd  (%rcx,%rax,8),%xmm1
  add    $0x1,%rax
  movsd  %xmm1,(%rdx)
  add    %rbp,%rdx
  cmp    %eax,%r14d
  jg     L113
  lea    0x1(%r10),%r11d
  add    $0x8,%rsi
  add    %r15,%rcx
  cmp    %r11d,%r8d
  je     L5
  mov    %r11d,%r10d
  jmp    L84
  nopw   0x0(%rax,%rax,1)
L5:
  mov    0x14(%rsp),%r8d
  mov    0x30(%rsp),%ecx
  mov    $0x1,%r9d
  mov    %r10d,0x54(%rsp)
  mov    0x28(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    %r11d,0x48(%rsp)
  mov    0x20(%rsp),%rdi
  movsd  %xmm0,0x58(%rsp)
  call   <mmult@plt>
  movsd  0x58(%rsp),%xmm0
  mov    0x30(%rsp),%esi
  mov    $0x1,%edx
  mov    0x28(%rsp),%rdi
  call   <scale@plt>
  mov    0x14(%rsp),%ecx
  mov    0x28(%rsp),%rsi
  mov    $0x1,%r8d
  mov    0x30(%rsp),%r9d
  mov    0x20(%rsp),%rdx
  mov    0x18(%rsp),%rdi
  call   <mmult@plt>
  mov    0x70(%rsp),%rax
  mov    0x48(%rsp),%r11d
  mov    0x54(%rsp),%r10d
  mov    0x8(%rsp),%rsi
  lea    0x0(%rbp,%rax,1),%rcx
  nopl   0x0(%rax,%rax,1)
L117:
  mov    %r13,%rdx
  mov    %rsi,%rax
  cs nopw 0x0(%rax,%rax,1)
L145:
  movsd  (%rbx,%rax,8),%xmm0
  subsd  (%rdx),%xmm0
  add    $0x8,%rdx
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r14d
  jg     L145
  lea    0x1(%r12),%eax
  add    %rcx,%r13
  add    %r15,%rbx
  cmp    %r12d,%r10d
  je     L51
  mov    %eax,%r12d
  jmp    L117
L51:
  cmp    0x60(%rsp),%r11d
  jle    L17
  mov    0x34(%rsp),%esi
  mov    0x38(%rsp),%rdi
  mov    0x18(%rsp),%rbx
  add    %r14d,%esi
  movslq %esi,%rdx
  add    0x8(%rsp),%rdx
  lea    0x8(%rbx),%rax
  lea    (%rdi,%rdx,8),%rdx
  mov    0x10(%rsp),%edi
  lea    -0x1(%rdi),%ecx
  mov    %rcx,%rdi
  lea    0x10(%rbx,%rcx,8),%rcx
  nopl   0x0(%rax,%rax,1)
L65:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  movsd  %xmm0,(%rdx)
  add    %r15,%rdx
  cmp    %rcx,%rax
  jne    L65
L73:
  mov    %esi,0x34(%rsp)
  sub    $0x8,%rbp
  mov    0x64(%rsp),%esi
  addq   $0x1,0x8(%rsp)
  cmp    %esi,0x10(%rsp)
  je     L111
  mov    %edi,0x10(%rsp)
  jmp    L127
L105:
  mov    0x14(%rsp),%ebx
  mov    0x18(%rsp),%r12
  mov    0x40(%rsp),%rdi
  mov    %ebx,%esi
  mov    %r12,%rdx
  call   <house@plt>
  mov    0x8(%rsp),%rdi
  mov    %ebx,%r8d
  mov    %r12,%rsi
  mov    0x68(%rsp),%rax
  mov    0x30(%rsp),%r13d
  mov    %ebx,0x14(%rsp)
  mov    $0x1,%r9d
  mov    0x28(%rsp),%rbx
  movsd  %xmm0,0x48(%rsp)
  movsd  %xmm0,(%rax,%rdi,8)
  mov    0x20(%rsp),%rdi
  mov    %r13d,%ecx
  mov    %rbx,%rdx
  call   <mmult@plt>
  mov    $0x1,%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  movsd  0x48(%rsp),%xmm0
  call   <scale@plt>
  mov    0x14(%rsp),%ecx
  mov    %r13d,%r9d
  mov    %rbx,%rsi
  mov    0x20(%rsp),%rdx
  mov    $0x1,%r8d
  mov    %r12,%rdi
  call   <mmult@plt>
L17:
  mov    0x34(%rsp),%eax
  lea    (%rax,%r14,1),%esi
  mov    0x10(%rsp),%eax
  lea    -0x1(%rax),%edi
  jmp    L73
L111:
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <free@plt>
L122:
  lea    D5(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L155
```

tool_calls: name: retrieve_data
arguments: label: D5
type: string

tool: D5: M should be greater than or equal to N

assistant: ```c
void qr_house(double *A, int M, int N, double *bvec) {
  int j, i, k, u, t;
  double *x, *v, *AT, *w;
  double beta;
  if (M < N) {
    printf("M should be greater than or equal to N");
    exit(1);
  }
  x = (double *)malloc(sizeof(double) * M);
  v = (double *)malloc(sizeof(double) * M);
  AT = (double *)malloc(sizeof(double) * M * N);
  w = (double *)malloc(sizeof(double) * M * M);
  for (j = 0; j < N; ++j) {
    for (i = j; i < M; ++i) {
      x[i - j] = A[i * N + j];
    }
    beta = house(x, M - j, v);
    bvec[j] = beta;
    for (i = j; i < M; i++) {
      t = i * N;
      u = 0;
      for (k = j; k < N; k++) {
        AT[u + i - j] = A[k + t];
        u += (M - j);
      }
    }
    mmult(AT, v, w, N - j, M - j, 1);
    scale(w, N - j, 1, beta);
    mmult(v, w, AT, M - j, 1, N - j);
    for (i = j; i < M; i++) {
      t = i * N;
      for (k = j; k < N; k++) {
        A[t + k] -= AT[(i - j) * (N - j) + k - j];
      }
    }
    if (j < M) {
      for (i = j + 1; i < M; ++i) {
        A[i * N + j] = v[i - j];
      }
    }
  }
  free(x);
  free(v);
  free(AT);
  free(w);
}
```