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

```asm
<mx_inv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  movsd  %xmm0,0x10(%rsp)
  test   %edi,%edi
  je     L168
  lea    0x1(%rdi),%eax
  mov    %edi,0x8(%rsp)
  xor    %r13d,%r13d
  mov    %edi,%ebx
  mov    %eax,0x1c(%rsp)
  mov    %r13d,%r14d
  mov    %rdx,%r12
  mov    %rcx,%rbp
  mov    %esi,0x18(%rsp)
  mov    %esi,%r13d
  movl   $0x0,0xc(%rsp)
  nopl   0x0(%rax,%rax,1)
L147:
  mov    0x8(%rsp),%edi
  mov    0xc(%rsp),%edx
  lea    0x1(%r14),%esi
  mov    %esi,0x4(%rsp)
  mov    %edi,%eax
  movsd  0x0(%rbp,%rdx,8),%xmm3
  sub    %ebx,%eax
  cmp    %esi,%ebx
  jbe    L178
  mov    %esi,%edx
  mov    %r14d,%r9d
  jmp    L42
  nopl   0x0(%rax)
L18:
  mov    %ebx,%r11d
  add    $0x1,%edx
  movapd %xmm2,%xmm0
  add    %ebx,%edi
  imul   %r9d,%r11d
  cmp    %edx,%ebx
  je     L231
L42:
  lea    (%r14,%rdi,1),%ecx
  movapd %xmm3,%xmm2
  andpd  D7(%rip),%xmm2
  movsd  0x0(%rbp,%rcx,8),%xmm1
  movapd %xmm1,%xmm0
  andpd  D7(%rip),%xmm0
  comisd %xmm2,%xmm0
  jbe    L18
  mov    %edx,%r9d
  add    $0x1,%edx
  movapd %xmm1,%xmm3
  mov    %edi,%r11d
  add    %ebx,%edi
  cmp    %edx,%ebx
  jne    L42
L231:
  movsd  0x10(%rsp),%xmm4
  comisd %xmm0,%xmm4
  ja     L7
L154:
  mov    0x8(%rsp),%esi
  mov    %ebx,%r10d
  sub    %esi,%r10d
  add    %r11d,%r10d
  nopl   0x0(%rax)
L136:
  mov    %eax,%edx
  lea    0x0(%rbp,%rdx,8),%rcx
  lea    (%r10,%rax,1),%edx
  add    $0x1,%eax
  lea    0x0(%rbp,%rdx,8),%rdx
  movsd  (%rcx),%xmm0
  movsd  (%rdx),%xmm1
  movsd  %xmm1,(%rcx)
  movsd  %xmm0,(%rdx)
  cmp    %eax,%esi
  jne    L136
  test   %r13d,%r13d
  je     L210
  mov    0x18(%rsp),%esi
  imul   %r13d,%r9d
  mov    %r13d,%edx
  mov    %esi,%eax
  sub    %esi,%edx
  sub    %r13d,%eax
  add    %edx,%r9d
  nopl   0x0(%rax)
L36:
  mov    %eax,%edx
  lea    (%r12,%rdx,8),%rcx
  lea    (%r9,%rax,1),%edx
  add    $0x1,%eax
  lea    (%r12,%rdx,8),%rdx
  movsd  (%rcx),%xmm0
  movsd  (%rdx),%xmm1
  movsd  %xmm1,(%rcx)
  movsd  %xmm0,(%rdx)
  cmp    %eax,%esi
  jne    L36
L210:
  cmp    0x4(%rsp),%ebx
  je     L93
  mov    0x4(%rsp),%r15d
  nopl   0x0(%rax)
L167:
  mov    %r15d,%r9d
  mov    %r14d,%r8d
  mov    %r13d,%ecx
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  add    $0x1,%r15d
  call   <calc@plt>
  cmp    %r15d,%ebx
  ja     L167
  mov    0x1c(%rsp),%edi
  add    %r13d,0x18(%rsp)
  add    %edi,0xc(%rsp)
  mov    0x4(%rsp),%r14d
  add    %ebx,0x8(%rsp)
  jmp    L147
  nopw   0x0(%rax,%rax,1)
L178:
  andpd  D7(%rip),%xmm3
  movsd  0x10(%rsp),%xmm4
  mov    %eax,%r11d
  mov    %r14d,%r9d
  movapd %xmm3,%xmm0
  comisd %xmm0,%xmm4
  jbe    L154
L7:
  add    $0x28,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L93:
  mov    %r13d,%eax
  mov    %r14d,%r13d
  mov    %eax,%r14d
  test   %r13d,%r13d
  js     L108
  lea    -0x1(%r13),%r15d
  je     L108
  mov    0x4(%rsp),%r13d
  mov    %ebx,0x8(%rsp)
  mov    %r15d,%ebx
L40:
  mov    %ebx,0x4(%rsp)
  lea    0x1(%rbx),%r15d
  nopl   0x0(%rax,%rax,1)
L123:
  mov    %ebx,%r9d
  mov    %r15d,%r8d
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <calc@plt>
  sub    $0x1,%ebx
  jae    L123
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%ebx
  test   %eax,%eax
  jne    L40
  mov    0x8(%rsp),%ebx
L108:
  movsd  D23(%rip),%xmm3
  mov    %r14d,%ecx
  xor    %r9d,%r9d
  xor    %edi,%edi
  mov    0x1c(%rsp),%r10d
  xor    %r8d,%r8d
  jmp    L209
  nopl   (%rax)
L141:
  add    $0x1,%edi
  add    %r10d,%r8d
  add    %r14d,%r9d
  add    %r14d,%ecx
  cmp    %edi,%ebx
  jbe    L168
L209:
  mov    %r8d,%eax
  lea    0x0(%rbp,%rax,8),%rsi
  movsd  (%rsi),%xmm2
  movapd %xmm2,%xmm0
  subsd  %xmm3,%xmm0
  andpd  D7(%rip),%xmm0
  comisd 0x10(%rsp),%xmm0
  jbe    L141
  movapd %xmm3,%xmm1
  mov    %r9d,%eax
  divsd  %xmm2,%xmm1
  test   %r14d,%r14d
  je     L6
  nopl   0x0(%rax)
L188:
  mov    %eax,%edx
  add    $0x1,%eax
  lea    (%r12,%rdx,8),%rdx
  movsd  (%rdx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx)
  cmp    %eax,%ecx
  jne    L188
L6:
  add    $0x1,%edi
  movsd  %xmm3,(%rsi)
  add    %r10d,%r8d
  add    %r14d,%r9d
  add    %r14d,%ecx
  cmp    %edi,%ebx
  ja     L209
L168:
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: data_label: D7
type_guessed: qword[2]
name: parse_data
arguments: data_label: D23
type_guessed: f64

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

tool: D23: 1

assistant: ```c
int mx_inv(unsigned int n, unsigned int r, double *b, double *a, double eps) {
  for (unsigned k = 0; k < n; k++) {
    unsigned int m = k;
    for (unsigned l = k + 1; l < n; l++) {
      if (fabs(a[l * n + k]) > fabs(a[m * n + k])) {
        m = l;
      }
    }
    if (fabs(a[m * n + k]) < eps) {
      return -1;
    }
    for (unsigned l = 0; l < n; l++) {
      double t = a[k * n + l];
      a[k * n + l] = a[m * n + l];
      a[m * n + l] = t;
    }
    for (unsigned l = 0; l < r; l++) {
      double t = b[k * r + l];
      b[k * r + l] = b[m * r + l];
      b[m * r + l] = t;
    }
    for (unsigned j = k + 1; j < n; j++) {
      calc(a, b, n, r, k, j);
    }
  }
  for (int k = n - 1; k >= 0; k--) {
    for (int j = k - 1; j >= 0; j--) {
      calc(a, b, n, r, k, j);
    }
  }
  for (unsigned k = 0; k < n; k++) {
    if (fabs(a[k * n + k] - 1.0) > eps) {
      double t = 1.0 / a[k * n + k];
      for (unsigned j = 0; j < r; j++) {
        b[k * r + j] *= t;
      }
      a[k * n + k] = 1.0;
    }
  }
  return 0;
}
```