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

```asm
<matinv>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  push   %r13
  movslq %edi,%r13
  push   %r12
  lea    0x0(,%r13,4),%r12d
  push   %rbp
  movslq %r12d,%r12
  push   %rbx
  mov    %r12,%rdi
  mov    %rsi,%rbx
  sub    $0xa8,%rsp
  call   <malloc@plt>
  mov    %rax,0x68(%rsp)
  test   %rax,%rax
  je     L320
  mov    %r12,%rdi
  call   <malloc@plt>
  mov    %rax,0x60(%rsp)
  test   %rax,%rax
  je     L312
  lea    0x0(,%r13,8),%r12d
  mov    %r13,%rbp
  movslq %r12d,%rdi
  call   <malloc@plt>
  mov    %rax,0x98(%rsp)
  test   %rax,%rax
  je     L39
  imul   %r13d,%r12d
  movslq %r12d,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L51
  test   %r13d,%r13d
  jle    L251
  lea    -0x1(%r13),%eax
  mov    %r13d,%r8d
  mov    0x68(%rsp),%r9
  xor    %ecx,%ecx
  mov    %eax,0x4c(%rsp)
  xor    %esi,%esi
  pxor   %xmm4,%xmm4
  movq   D9(%rip),%xmm3
  mov    %rax,0x28(%rsp)
  mov    0x98(%rsp),%rdi
  mov    %r8,0x58(%rsp)
  nopl   0x0(%rax)
L316:
  movslq %esi,%rdx
  mov    %ecx,(%r9,%rcx,4)
  movapd %xmm4,%xmm2
  movq   $0x0,(%rdi,%rcx,8)
  lea    0x0(,%rdx,8),%rax
  add    %r8,%rdx
  shl    $0x3,%rdx
  nopw   0x0(%rax,%rax,1)
L369:
  movsd  (%rbx,%rax,1),%xmm0
  movapd %xmm0,%xmm1
  andpd  %xmm3,%xmm1
  comisd %xmm2,%xmm1
  jbe    L281
  movsd  %xmm1,(%rdi,%rcx,8)
  movapd %xmm1,%xmm2
L281:
  movsd  %xmm0,(%r12,%rax,1)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L369
  add    %ebp,%esi
  ucomisd %xmm4,%xmm2
  jp     L54
  je     L301
L54:
  add    $0x1,%rcx
  cmp    %r8,%rcx
  jne    L316
  lea    0x8(%r12),%rdi
  mov    %r12,0x8(%rsp)
  mov    %ebp,%edx
  mov    %r12,%r8
  mov    %rdi,0x30(%rsp)
  lea    0x0(%rbp,%rbp,1),%edi
  lea    0x8(,%r13,8),%rax
  mov    0x98(%rsp),%r9
  mov    %edi,0x20(%rsp)
  lea    0x0(,%r13,8),%rbx
  mov    $0x1,%r14d
  xor    %r11d,%r11d
  movq   $0x0,0x10(%rsp)
  mov    %rax,0x18(%rsp)
  lea    -0x2(%rbp),%eax
  mov    %r15,0x38(%rsp)
  mov    %eax,%r15d
L351:
  movsd  (%r8),%xmm1
  movsd  (%r9,%r11,8),%xmm2
  mov    %edx,%edi
  mov    %r14d,%esi
  sub    %ebp,%edi
  lea    -0x1(%r14),%eax
  andpd  %xmm3,%xmm1
  mov    %edi,(%rsp)
  divsd  %xmm2,%xmm1
  cmp    %r14d,%ebp
  jle    L94
  mov    0x8(%rsp),%rdi
  movslq %edx,%rdx
  mov    %r14,%rcx
  add    %r11,%rdx
  lea    (%rdi,%rdx,8),%rdi
  nopl   0x0(%rax,%rax,1)
L336:
  movsd  (%rdi),%xmm0
  andpd  %xmm3,%xmm0
  divsd  (%r9,%rcx,8),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  cmova  %ecx,%eax
  add    $0x1,%rcx
  movapd %xmm0,%xmm1
  add    %rbx,%rdi
  movslq %eax,%rdx
  cmp    %ecx,%ebp
  jg     L336
  cmp    %r11d,%eax
  jg     L74
L94:
  cmp    0x58(%rsp),%r14
  je     L315
L221:
  mov    %r14,%r10
  mov    %r13,%rcx
  mov    %r15d,%eax
  add    %r13,0x10(%rsp)
  sub    %r11,%r10
  lea    (%rbx,%r8,1),%rdx
  neg    %rcx
  shl    $0x3,%r10
  lea    0x10(,%rax,8),%r12
  jmp    L15
  nopl   (%rax)
L24:
  add    $0x1,%esi
  add    %rbx,%rdx
  sub    %r13,%rcx
  cmp    %esi,%ebp
  je     L185
L15:
  movsd  (%rdx),%xmm0
  ucomisd %xmm4,%xmm0
  jp     L260
  je     L24
L260:
  divsd  (%r8),%xmm0
  lea    (%rdx,%r10,1),%rax
  movsd  %xmm0,(%rdx)
  lea    (%r12,%rdx,1),%rdi
  jmp    L238
  nopl   0x0(%rax)
L366:
  movsd  (%rdx),%xmm0
L238:
  mulsd  (%rax,%rcx,8),%xmm0
  movsd  (%rax),%xmm1
  add    $0x8,%rax
  subsd  %xmm0,%xmm1
  movsd  %xmm1,-0x8(%rax)
  cmp    %rdi,%rax
  jne    L366
  add    $0x1,%esi
  add    %rbx,%rdx
  sub    %r13,%rcx
  cmp    %esi,%ebp
  jne    L15
L185:
  mov    (%rsp),%edx
  add    $0x1,%r11
  add    $0x1,%r14
  add    0x18(%rsp),%r8
  add    0x20(%rsp),%edx
  sub    $0x1,%r15d
  jmp    L351
  nopl   0x0(%rax)
L43:
  mov    (%rsp),%r14
L78:
  mov    0x78(%rsp),%r12
  mov    0x74(%rsp),%r11d
  mov    %ebp,%edi
  mov    0x80(%rsp),%r8
  mov    0x70(%rsp),%r10d
  mov    0x88(%rsp),%r9
  nopl   (%rax)
L30:
  cmp    0x10(%rsp),%edi
  jge    L381
  lea    0x0(%r13,%r10,1),%eax
  mov    0x40(%rsp),%rsi
  movslq %r11d,%rdx
  add    0x8(%rsp),%rdx
  cltq
  lea    (%r15,%rdx,8),%rdx
  lea    (%r15,%rax,8),%rcx
  movslq %edi,%rax
  add    %r8,%rax
  movsd  (%rcx),%xmm1
  lea    (%rsi,%rax,8),%rax
  mov    0x4c(%rsp),%esi
  mov    %rax,(%rsp)
  mov    0x50(%rsp),%rax
  sub    %edi,%esi
  add    %r12,%rsi
  lea    (%rax,%rsi,8),%rsi
  mov    (%rsp),%rax
  nopw   0x0(%rax,%rax,1)
L355:
  movsd  (%rax),%xmm0
  mulsd  (%rdx),%xmm0
  add    $0x8,%rax
  add    %rbx,%rdx
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rcx)
  cmp    %rsi,%rax
  jne    L355
L381:
  movsd  (%r14,%r8,8),%xmm0
  add    0x28(%rsp),%r10d
  divsd  (%r9),%xmm0
  sub    %ebp,%r11d
  movsd  %xmm0,(%r14,%r8,8)
  add    0x20(%rsp),%r9
  add    0x30(%rsp),%r8
  add    0x38(%rsp),%r12
  sub    $0x1,%edi
  jne    L30
  addq   $0x1,0x8(%rsp)
  add    $0x8,%r14
  mov    0x8(%rsp),%rax
  cmp    0x58(%rsp),%rax
  jne    L216
  mov    0x40(%rsp),%r12
L251:
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    0x98(%rsp),%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  xor    %eax,%eax
L319:
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L74:
  imul   %ebp,%eax
  mov    0x8(%rsp),%rdi
  mov    0x30(%rsp),%r10
  cltq
  lea    (%rdi,%rax,8),%rcx
  mov    0x28(%rsp),%rdi
  add    %rax,%rdi
  lea    (%r10,%rdi,8),%r10
  mov    0x10(%rsp),%rdi
  sub    %rax,%rdi
L233:
  movsd  (%rcx),%xmm0
  movsd  (%rcx,%rdi,8),%xmm1
  movsd  %xmm1,(%rcx)
  movsd  %xmm0,(%rcx,%rdi,8)
  add    $0x8,%rcx
  cmp    %r10,%rcx
  jne    L233
  mov    0x68(%rsp),%rdi
  lea    (%r9,%rdx,8),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm2,(%rax)
  lea    (%rdi,%rdx,4),%rax
  mov    (%rdi,%r11,4),%ecx
  mov    (%rax),%edx
  movsd  %xmm0,(%r9,%r11,8)
  mov    %ecx,(%rax)
  mov    %edx,(%rdi,%r11,4)
  cmp    0x58(%rsp),%r14
  jne    L221
L315:
  mov    0x8(%rsp),%r12
  mov    0x38(%rsp),%r15
  xor    %eax,%eax
  mov    0x68(%rsp),%rcx
  mov    0x60(%rsp),%rsi
  mov    0x58(%rsp),%rdi
  nopl   0x0(%rax,%rax,1)
L205:
  movslq (%rcx,%rax,4),%rdx
  mov    %eax,(%rsi,%rdx,4)
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L205
  mov    0x58(%rsp),%rax
  xor    %r14d,%r14d
  mov    %r12,(%rsp)
  mov    %r14d,%r12d
  mov    %rbx,%r14
  lea    0x0(,%rax,8),%r13
  xor    %eax,%eax
  mov    %eax,%ebx
  xchg   %ax,%ax
L261:
  movslq %r12d,%rax
  mov    %r13,%rdx
  xor    %esi,%esi
  add    %ebp,%r12d
  lea    (%r15,%rax,8),%rdi
  call   <memset@plt>
  mov    %ebx,%eax
  add    $0x1,%ebx
  cmp    %ebx,%ebp
  jne    L261
  mov    %eax,%edi
  mov    %eax,0x18(%rsp)
  mov    %ebp,%eax
  mov    (%rsp),%r12
  not    %eax
  movsd  D5(%rip),%xmm2
  mov    %ebx,0x10(%rsp)
  mov    %r14,%rbx
  cltq
  mov    %r12,0x40(%rsp)
  mov    %r15,%r14
  movq   $0x0,0x8(%rsp)
  shl    $0x3,%rax
  mov    %rax,0x20(%rsp)
  mov    0x4c(%rsp),%eax
  imul   %ebp,%eax
  movslq %eax,%rcx
  mov    %eax,0x70(%rsp)
  movslq %edi,%rax
  not    %edi
  add    %rcx,%rax
  mov    %rcx,0x80(%rsp)
  mov    %rax,0x78(%rsp)
  lea    (%r12,%rax,8),%rax
  mov    %rax,0x88(%rsp)
  mov    %ebp,%eax
  imul   %ebp,%eax
  mov    %edi,0x28(%rsp)
  mov    %eax,0x74(%rsp)
  lea    0x8(%r12),%rax
  mov    %rax,0x90(%rsp)
  movslq %edi,%rax
  mov    %rax,0x30(%rsp)
  sub    $0x1,%rax
  mov    %rax,0x38(%rsp)
  lea    0x10(%r12),%rax
  mov    %rax,0x50(%rsp)
  nopw   0x0(%rax,%rax,1)
L216:
  mov    0x8(%rsp),%rcx
  mov    0x60(%rsp),%rax
  mov    (%rax,%rcx,4),%r9d
  mov    0x10(%rsp),%eax
  mov    %ecx,%r13d
  imul   %r9d,%eax
  lea    0x1(%r9),%edi
  lea    (%rax,%rcx,1),%edx
  movslq %edx,%rdx
  movsd  %xmm2,(%r15,%rdx,8)
  cmp    0x18(%rsp),%r9d
  jge    L78
  mov    %edi,%r8d
  cltq
  mov    %r14,(%rsp)
  mov    0x40(%rsp),%r12
  imul   %ebp,%r8d
  add    %rcx,%rax
  mov    0x90(%rsp),%r14
  movslq %r9d,%r10
  lea    (%r15,%rax,8),%r11
  nopl   0x0(%rax,%rax,1)
L1:
  cmp    %edi,%r9d
  jge    L318
  lea    0x0(%r13,%r8,1),%eax
  mov    %edi,%esi
  movslq %r8d,%rdx
  cltq
  sub    %r9d,%esi
  add    %r10,%rdx
  lea    (%r15,%rax,8),%rcx
  sub    $0x1,%esi
  lea    (%r12,%rdx,8),%rax
  add    %rdx,%rsi
  movsd  (%rcx),%xmm1
  mov    %r11,%rdx
  lea    (%r14,%rsi,8),%rsi
L375:
  movsd  (%rax),%xmm0
  mulsd  (%rdx),%xmm0
  add    $0x8,%rax
  add    %rbx,%rdx
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rcx)
  cmp    %rax,%rsi
  jne    L375
L318:
  lea    0x1(%rdi),%eax
  add    %ebp,%r8d
  cmp    %edi,0x18(%rsp)
  je     L43
  mov    %eax,%edi
  jmp    L1
L301:
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    0x98(%rsp),%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    $0x2,%eax
  jmp    L319
L51:
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    0x98(%rsp),%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L319
L39:
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L319
L312:
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L319
L320:
  mov    $0x1,%eax
  jmp    L319
```

tool_calls: name: parse_data
arguments: data_label: D9
type_infered: qword
name: parse_data
arguments: data_label: D5
type_infered: f64

tool: D9: 9223372036854775807

tool: D5: 1

assistant: ```c
int matinv(n, mat, inv) const int n;
const double mat[];
double inv[];
{
  register int i, ij, ik, j, k, kj, pj;
  int itemp, mem, *mxl, *lxm, pivot;
  double colmax, *lu, *rowmax, dtemp;
  mem = n * sizeof(int);
  if ((mxl = (int *)malloc(mem)) == (int *)0)
    return 1;
  if ((lxm = (int *)malloc(mem)) == (int *)0) {
    free(mxl);
    return 1;
  }
  mem = n * sizeof(double);
  if ((rowmax = (double *)malloc(mem)) == (double *)0) {
    free(mxl);
    free(lxm);
    return 1;
  }
  mem *= n;
  if ((lu = (double *)malloc(mem)) == (double *)0) {
    free(mxl);
    free(lxm);
    free(rowmax);
    return 1;
  }
  for (i = 0, ij = 0; i < n; i++) {
    mxl[i] = i;
    rowmax[i] = 0.0;
    for (j = 0; j < n; j++, ij++) {
      dtemp = fabs(mat[ij]);
      if (dtemp > rowmax[i])
        rowmax[i] = dtemp;
      lu[ij] = mat[ij];
    }
    if (rowmax[i] == 0.0) {
      free(mxl);
      free(lxm);
      free(rowmax);
      free(lu);
      return 2;
    }
  }
  for (k = 0; k < n; k++) {
    colmax = fabs(lu[k * n + k]) / rowmax[k];
    pivot = k;
    for (i = k + 1; i < n; i++) {
      ik = i * n + k;
      dtemp = fabs(lu[ik]) / rowmax[i];
      if (dtemp > colmax) {
        colmax = dtemp;
        pivot = i;
      }
    }
    if (pivot > k) {
      for (j = 0, pj = pivot * n, kj = k * n; j < n; j++, pj++, kj++) {
        dtemp = lu[pj];
        lu[pj] = lu[kj];
        lu[kj] = dtemp;
      }
      dtemp = rowmax[pivot];
      rowmax[pivot] = rowmax[k];
      rowmax[k] = dtemp;
      itemp = mxl[pivot];
      mxl[pivot] = mxl[k];
      mxl[k] = itemp;
    }
    for (i = k + 1; i < n; i++) {
      ik = i * n + k;
      if (lu[ik] != 0.0) {
        lu[ik] /= lu[k * n + k];
        for (j = k + 1; j < n; j++) {
          lu[i * n + j] -= lu[ik] * lu[k * n + j];
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    lxm[mxl[i]] = i;
  }
  for (i = 0, ij = 0; i < n; i++) {
    for (j = 0; j < n; j++, ij++) {
      inv[ij] = 0.0;
    }
  }
  for (k = 0; k < n; k++) {
    inv[lxm[k] * n + k] = 1.0;
    for (i = lxm[k] + 1; i < n; i++) {
      for (j = lxm[k]; j < i; j++) {
        inv[i * n + k] -= lu[i * n + j] * inv[j * n + k];
      }
    }
    for (i = n - 1; i >= 0; i--) {
      for (j = i + 1; j < n; j++) {
        inv[i * n + k] -= lu[i * n + j] * inv[j * n + k];
      }
      inv[i * n + k] /= lu[i * n + i];
    }
  }
  free(mxl);
  free(lxm);
  free(rowmax);
  free(lu);
  return 0;
}
```