user: Translate the below assembly code into C programming language:

```asm
<mx_inv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  movsd  %xmm0,0x20(%rsp)
  test   %edi,%edi
  je     L222
  mov    %edi,%ebx
  mov    %rdx,%r13
  mov    %rcx,%rbp
  lea    0x1(%rdi),%eax
  mov    %eax,0x2c(%rsp)
  lea    -0x1(%rdi),%eax
  mov    %eax,0x28(%rsp)
  mov    %esi,0x18(%rsp)
  mov    %edi,0x14(%rsp)
  mov    $0x0,%r14d
  mov    %esi,0xc(%rsp)
  mov    %edi,%r15d
L164:
  lea    0x1(%r14),%eax
  mov    %eax,0x10(%rsp)
  cmp    %eax,%ebx
  jbe    L183
  mov    0x14(%rsp),%ecx
  mov    %r14d,%edx
L219:
  mov    %ecx,%esi
  movsd  0x0(%rbp,%rsi,8),%xmm1
  andpd  D23(%rip),%xmm1
  mov    %ebx,%esi
  imul   %edx,%esi
  lea    (%rsi,%r14,1),%esi
  movsd  0x0(%rbp,%rsi,8),%xmm0
  andpd  D23(%rip),%xmm0
  ucomisd %xmm0,%xmm1
  cmova  %eax,%edx
  add    $0x1,%eax
  add    %ebx,%ecx
  cmp    %eax,%ebx
  jne    L219
L155:
  mov    %ebx,%ecx
  imul   %edx,%ecx
  lea    (%rcx,%r14,1),%eax
  movsd  0x0(%rbp,%rax,8),%xmm0
  andpd  D23(%rip),%xmm0
  movsd  0x20(%rsp),%xmm7
  comisd %xmm0,%xmm7
  ja     L198
  mov    %r15d,%eax
  sub    %ebx,%eax
  mov    %ebx,%edi
  sub    %r15d,%edi
  add    %ecx,%edi
L145:
  mov    %eax,%ecx
  lea    0x0(%rbp,%rcx,8),%rsi
  movsd  (%rsi),%xmm0
  lea    (%rdi,%rax,1),%ecx
  lea    0x0(%rbp,%rcx,8),%rcx
  movsd  (%rcx),%xmm1
  movsd  %xmm1,(%rsi)
  movsd  %xmm0,(%rcx)
  add    $0x1,%eax
  cmp    %eax,%r15d
  jne    L145
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  je     L168
  mov    0x18(%rsp),%edi
  mov    %edi,%eax
  sub    %esi,%eax
  imul   %esi,%edx
  sub    %edi,%esi
  add    %edx,%esi
L95:
  mov    %eax,%edx
  lea    0x0(%r13,%rdx,8),%rcx
  movsd  (%rcx),%xmm0
  lea    (%rsi,%rax,1),%edx
  lea    0x0(%r13,%rdx,8),%rdx
  movsd  (%rdx),%xmm1
  movsd  %xmm1,(%rcx)
  movsd  %xmm0,(%rdx)
  add    $0x1,%eax
  cmp    %eax,%edi
  jne    L95
L168:
  cmp    0x28(%rsp),%r14d
  je     L217
  mov    0x10(%rsp),%r12d
  mov    %r15d,0x1c(%rsp)
  mov    0xc(%rsp),%r15d
L180:
  mov    %r12d,%r9d
  mov    %r14d,%r8d
  mov    %r15d,%ecx
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <calc@plt>
  add    $0x1,%r12d
  cmp    %r12d,%ebx
  ja     L180
  mov    0x1c(%rsp),%r15d
  add    %ebx,%r15d
  mov    0x2c(%rsp),%edi
  add    %edi,0x14(%rsp)
  mov    0xc(%rsp),%edi
  add    %edi,0x18(%rsp)
  mov    0x10(%rsp),%r14d
  jmp    L164
L183:
  mov    %r14d,%edx
  jmp    L155
L141:
  lea    0x1(%rbx),%r10d
  mov    %r15d,%ecx
  mov    $0x0,%r8d
  mov    $0x0,%edi
  mov    $0x0,%esi
  movsd  D27(%rip),%xmm4
  movq   D23(%rip),%xmm3
  movapd %xmm4,%xmm6
  movapd %xmm4,%xmm5
  jmp    L64
L177:
  movsd  %xmm5,(%r9)
L220:
  add    $0x1,%esi
  add    %r10d,%edi
  add    %r15d,%r8d
  add    %r15d,%ecx
  cmp    %esi,%ebx
  jbe    L57
L64:
  mov    %edi,%eax
  lea    0x0(%rbp,%rax,8),%r9
  movsd  (%r9),%xmm2
  movapd %xmm2,%xmm0
  subsd  %xmm4,%xmm0
  andpd  %xmm3,%xmm0
  comisd 0x20(%rsp),%xmm0
  jbe    L220
  movapd %xmm6,%xmm1
  divsd  %xmm2,%xmm1
  test   %r15d,%r15d
  je     L177
  mov    %r8d,%eax
L204:
  mov    %eax,%edx
  lea    0x0(%r13,%rdx,8),%rdx
  movapd %xmm1,%xmm0
  mulsd  (%rdx),%xmm0
  movsd  %xmm0,(%rdx)
  add    $0x1,%eax
  cmp    %eax,%ecx
  jne    L204
  jmp    L177
L57:
  mov    $0x0,%eax
  jmp    L85
L222:
  mov    $0x0,%eax
  jmp    L85
L198:
  mov    $0xffffffff,%eax
L85:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L217:
  mov    0xc(%rsp),%r15d
  mov    %r14d,0xc(%rsp)
  test   %r14d,%r14d
  js     L141
L143:
  mov    0xc(%rsp),%r12d
  mov    %r12d,%r14d
  sub    $0x1,%r12d
  mov    %r12d,0xc(%rsp)
  js     L141
L30:
  mov    %r12d,%r9d
  mov    %r14d,%r8d
  mov    %r15d,%ecx
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <calc@plt>
  sub    $0x1,%r12d
  cmp    $0xffffffff,%r12d
  jne    L30
  jmp    L143
```

tool_calls: name: retrieve_data
arguments: tag: D23
type: qword[2]
name: retrieve_data
arguments: tag: D27
type: f64

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

tool: D27: 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;
}
```