user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<matinv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %edi,%r12d
  mov    %rsi,%r13
  mov    %rdx,%rbp
  movslq %edi,%rax
  mov    %rax,0x8(%rsp)
  lea    0x0(,%rdi,4),%ebx
  movslq %ebx,%rbx
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,0x48(%rsp)
  test   %rax,%rax
  je     L242
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,0x40(%rsp)
  test   %rax,%rax
  je     L172
  lea    0x0(,%r12,8),%ebx
  movslq %ebx,%rdi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L359
  imul   %r12d,%ebx
  movslq %ebx,%rdi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L121
  test   %r12d,%r12d
  jle    L434
  mov    %r14,%rdi
  lea    -0x1(%r12),%eax
  mov    %rax,0x50(%rsp)
  mov    %r12d,%r15d
  mov    $0x0,%esi
  mov    $0x0,%r8d
  movq   D17(%rip),%xmm2
  pxor   %xmm4,%xmm4
  movapd %xmm4,%xmm3
  mov    0x48(%rsp),%r9
  jmp    L321
L172:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L195
L359:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L195
L121:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L195
L425:
  movsd  %xmm0,(%rbx,%rax,1)
  add    $0x8,%rax
  cmp    %rcx,%rax
  je     L378
L395:
  movsd  0x0(%r13,%rax,1),%xmm0
  movapd %xmm0,%xmm1
  andpd  %xmm2,%xmm1
  comisd (%rdx),%xmm1
  jbe    L425
  movsd  %xmm1,(%rdx)
  jmp    L425
L378:
  add    %r12d,%r8d
  ucomisd (%rdx),%xmm4
  jp     L411
  ucomisd (%rdx),%xmm3
  je     L422
L411:
  add    $0x1,%rsi
  add    $0x8,%rdi
  cmp    %r15,%rsi
  je     L332
L321:
  mov    %esi,(%r9,%rsi,4)
  mov    %rdi,%rdx
  movq   $0x0,(%rdi)
  movslq %r8d,%rcx
  lea    0x0(,%rcx,8),%rax
  add    %r15,%rcx
  shl    $0x3,%rcx
  jmp    L395
L422:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x2,%eax
  jmp    L195
L332:
  mov    0x8(%rsp),%rax
  lea    0x8(,%rax,8),%rcx
  mov    %rcx,0x38(%rsp)
  lea    -0x2(%r12),%ecx
  mov    %ecx,0x10(%rsp)
  lea    0x0(,%rax,8),%rcx
  mov    %r12d,%edx
  mov    %rbx,%r11
  movq   $0x0,0x28(%rsp)
  mov    $0x1,%r10d
  mov    $0x0,%r13d
  movq   D17(%rip),%xmm5
  movapd %xmm5,%xmm3
  lea    0x8(%rbx),%rdi
  mov    %rdi,0x58(%rsp)
  pxor   %xmm2,%xmm2
  movapd %xmm2,%xmm4
  mov    %rbx,0x20(%rsp)
  mov    %r15,0x30(%rsp)
  mov    %rax,%r15
  mov    %rbp,0x60(%rsp)
  jmp    L176
L42:
  mov    %eax,%r9d
  imul   %r12d,%r9d
  movslq %r9d,%r9
  mov    0x20(%rsp),%rbx
  lea    (%rbx,%r9,8),%rdx
  mov    0x50(%rsp),%rbx
  lea    (%r9,%rbx,1),%rsi
  mov    0x58(%rsp),%rbx
  lea    (%rbx,%rsi,8),%rdi
  mov    0x28(%rsp),%rsi
  sub    %r9,%rsi
L63:
  movsd  (%rdx),%xmm0
  movsd  (%rdx,%rsi,8),%xmm1
  movsd  %xmm1,(%rdx)
  movsd  %xmm0,(%rdx,%rsi,8)
  add    $0x8,%rdx
  cmp    %rdi,%rdx
  jne    L63
  cltq
  lea    (%r14,%rax,8),%rdx
  movsd  (%rdx),%xmm0
  movsd  %xmm6,(%rdx)
  movsd  %xmm0,(%r14,%r13,8)
  mov    0x48(%rsp),%rbx
  lea    (%rbx,%rax,4),%rax
  mov    (%rax),%edx
  mov    (%rbx,%r13,4),%esi
  mov    %esi,(%rax)
  mov    %edx,(%rbx,%r13,4)
  jmp    L310
L315:
  add    $0x1,%r8d
  add    %rcx,%rdx
  sub    %r15,%rsi
  cmp    %r8d,%r12d
  je     L154
L249:
  mov    %rdx,%rdi
  movsd  (%rdx),%xmm0
  ucomisd %xmm2,%xmm0
  jp     L117
  ucomisd %xmm4,%xmm0
  je     L315
L117:
  divsd  0x0(%rbp),%xmm0
  movsd  %xmm0,(%rdi)
  mov    0x8(%rsp),%rax
  add    %rdx,%rax
  lea    (%rbx,%rdx,1),%r9
L231:
  movsd  (%rdi),%xmm1
  mulsd  (%rax,%rsi,8),%xmm1
  movsd  (%rax),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %r9,%rax
  jne    L231
  jmp    L315
L154:
  add    $0x1,%r13
  add    $0x1,%r10
  add    0x38(%rsp),%r11
  mov    0x18(%rsp),%eax
  lea    (%rax,%r8,2),%edx
  subl   $0x1,0x10(%rsp)
L176:
  lea    -0x1(%r10),%eax
  mov    %edx,%ebx
  sub    %r12d,%ebx
  mov    %ebx,0x18(%rsp)
  mov    %r11,%rbp
  movsd  (%r14,%r13,8),%xmm6
  movsd  (%r11),%xmm1
  andpd  %xmm5,%xmm1
  divsd  %xmm6,%xmm1
  mov    %r10d,%r8d
  cmp    %r10d,%r12d
  jle    L310
  movslq %edx,%rdx
  add    %r13,%rdx
  mov    0x20(%rsp),%rbx
  lea    (%rbx,%rdx,8),%rsi
  mov    %r10,%rdx
L105:
  movsd  (%rsi),%xmm0
  andpd  %xmm3,%xmm0
  divsd  (%r14,%rdx,8),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  cmova  %edx,%eax
  add    $0x1,%rdx
  add    %rcx,%rsi
  cmp    %edx,%r12d
  jg     L105
  cmp    %r13d,%eax
  jg     L42
L310:
  cmp    0x30(%rsp),%r10
  je     L186
  lea    (%rcx,%r11,1),%rdx
  add    %r15,0x28(%rsp)
  mov    %r15,%rsi
  neg    %rsi
  mov    %r10,%rbx
  sub    %r13,%rbx
  lea    0x0(,%rbx,8),%rax
  mov    %rax,0x8(%rsp)
  mov    0x10(%rsp),%eax
  lea    0x10(,%rax,8),%rbx
  jmp    L249
L186:
  mov    0x20(%rsp),%rbx
  mov    0x30(%rsp),%r15
  mov    0x60(%rsp),%rbp
  mov    $0x0,%eax
  mov    0x48(%rsp),%rsi
  mov    0x40(%rsp),%rdi
L274:
  movslq (%rsi,%rax,4),%rdx
  mov    %eax,(%rdi,%rdx,4)
  add    $0x1,%rax
  cmp    %r15,%rax
  jne    L274
  mov    $0x0,%esi
  mov    $0x0,%r15d
  lea    0x8(%rbp),%rdi
  mov    0x50(%rsp),%r8
L120:
  movslq %esi,%rdx
  lea    0x0(%rbp,%rdx,8),%rax
  add    %r8,%rdx
  lea    (%rdi,%rdx,8),%rdx
L289:
  movq   $0x0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L289
  add    %r12d,%esi
  lea    0x1(%r15),%r10d
  cmp    %r10d,%r12d
  je     L283
  mov    %r10d,%r15d
  jmp    L120
L283:
  mov    %r10d,%eax
  imul   %r15d,%eax
  mov    %eax,0x6c(%rsp)
  cltq
  lea    0x0(%rbp,%rax,8),%rdi
  mov    %rdi,0x30(%rsp)
  mov    %r15d,0x60(%rsp)
  mov    %r15d,%edi
  mov    %rdi,0x58(%rsp)
  mov    %r10d,%edx
  neg    %edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rdi
  mov    %rdi,0x20(%rsp)
  mov    %r10d,%edx
  not    %edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rdi
  mov    %rdi,0x18(%rsp)
  movslq %r15d,%rdx
  add    %rdx,%rax
  lea    (%rbx,%rax,8),%rax
  mov    %rax,0x50(%rsp)
  movq   $0x0,0x10(%rsp)
  movsd  D9(%rip),%xmm2
  lea    0x8(%rbx),%rax
  mov    %rax,0x70(%rsp)
  lea    0x10(%rbx),%rax
  mov    %rax,0x28(%rsp)
  mov    %r14,0x78(%rsp)
  jmp    L353
L341:
  mov    0x8(%rsp),%eax
  add    %r9d,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%rsi
  movslq %r9d,%rdx
  add    %r13,%rdx
  lea    (%rbx,%rdx,8),%rax
  mov    %r8d,%edi
  sub    %r11d,%edi
  lea    -0x1(%rdi),%edi
  add    %rdx,%rdi
  lea    (%r14,%rdi,8),%rdi
  mov    %r12,%rdx
L4:
  movsd  (%rax),%xmm1
  mulsd  (%rdx),%xmm1
  movsd  (%rsi),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rsi)
  add    $0x8,%rax
  add    %rcx,%rdx
  cmp    %rdi,%rax
  jne    L4
L41:
  lea    0x1(%r8),%eax
  add    %r10d,%r9d
  cmp    %r8d,%r15d
  je     L204
  mov    %eax,%r8d
L327:
  cmp    %r8d,%r11d
  jl     L341
  jmp    L41
L204:
  movslq %r15d,%r13
  mov    0x6c(%rsp),%r9d
  mov    0x50(%rsp),%r12
  mov    0x30(%rsp),%r11
  mov    %r10d,%r8d
  mov    %r15d,0x38(%rsp)
  mov    0x60(%rsp),%r15d
L135:
  cmp    %r10d,%r8d
  jge    L456
  mov    0x8(%rsp),%eax
  add    %r9d,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%rsi
  movslq %r9d,%rdi
  movslq %r8d,%rax
  add    %rdi,%rax
  lea    (%rbx,%rax,8),%rax
  lea    (%r9,%r10,1),%edx
  movslq %edx,%rdx
  add    0x10(%rsp),%rdx
  lea    0x0(%rbp,%rdx,8),%rdx
  add    %r13,%rdi
  mov    %r15d,%r14d
  sub    %r8d,%r14d
  add    %r14,%rdi
  mov    0x28(%rsp),%r14
  lea    (%r14,%rdi,8),%rdi
L23:
  movsd  (%rax),%xmm1
  mulsd  (%rdx),%xmm1
  movsd  (%rsi),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rsi)
  add    $0x8,%rax
  add    %rcx,%rdx
  cmp    %rax,%rdi
  jne    L23
L456:
  movsd  (%r11),%xmm0
  divsd  (%r12),%xmm0
  movsd  %xmm0,(%r11)
  sub    $0x1,%r13
  add    0x20(%rsp),%r11
  add    0x18(%rsp),%r12
  sub    %r10d,%r9d
  sub    $0x1,%r8d
  jne    L135
  mov    0x38(%rsp),%r15d
  mov    0x10(%rsp),%rdi
  lea    0x1(%rdi),%rax
  addq   $0x8,0x30(%rsp)
  cmp    0x58(%rsp),%rdi
  je     L78
  mov    %rax,0x10(%rsp)
L353:
  mov    0x10(%rsp),%rdi
  mov    %edi,0x8(%rsp)
  mov    0x40(%rsp),%rax
  mov    (%rax,%rdi,4),%r11d
  mov    %r11d,%eax
  imul   %r10d,%eax
  add    %edi,%eax
  cltq
  movsd  %xmm2,0x0(%rbp,%rax,8)
  lea    0x1(%r11),%r8d
  cmp    %r15d,%r11d
  jge    L204
  mov    %r8d,%r9d
  imul   %r10d,%r9d
  mov    %r11d,%eax
  imul   %r10d,%eax
  cltq
  add    %rdi,%rax
  lea    0x0(%rbp,%rax,8),%r12
  movslq %r11d,%r13
  mov    0x70(%rsp),%r14
  jmp    L327
L78:
  mov    0x78(%rsp),%r14
L434:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
L195:
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L242:
  mov    $0x1,%eax
  jmp    L195
```

tool_calls: name: read_data
arguments: data_label: D17
type: qword
name: read_data
arguments: data_label: D9
type: f64

tool: D17: 9223372036854775807

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