user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<invert_matrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_alloc@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L39
L115:
  mov    -0x4c(%rbp),%eax
  shl    $0x3,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  mov    (%rbx),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_alloc@plt>
  addl   $0x1,-0x34(%rbp)
L39:
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L115
  mov    -0x4c(%rbp),%eax
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_alloc@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L56
L53:
  mov    -0x4c(%rbp),%eax
  shl    $0x3,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x20(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  mov    (%rbx),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_alloc@plt>
  addl   $0x1,-0x34(%rbp)
L56:
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L53
  mov    -0x4c(%rbp),%eax
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_alloc@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L119
L31:
  movl   $0x0,-0x30(%rbp)
  jmp    L6
L40:
  mov    -0x34(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jne    L33
  movsd  D2(%rip),%xmm0
  jmp    L79
L33:
  pxor   %xmm0,%xmm0
L79:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  %xmm0,(%rax)
  movl   $0x0,-0x2c(%rbp)
  jmp    L142
L58:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L142:
  mov    -0x2c(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L58
  addl   $0x1,-0x30(%rbp)
L6:
  mov    -0x30(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L40
  mov    -0x4c(%rbp),%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <solvele@plt>
  movl   $0x0,-0x30(%rbp)
  jmp    L82
L29:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x30(%rbp)
L82:
  mov    -0x30(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L29
  addl   $0x1,-0x34(%rbp)
L119:
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L31
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L19
L65:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x34(%rbp)
L19:
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x4c(%rbp)
  ja     L65
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D2
datatype: f64

tool: D2: 1

assistant: ```c
double **invert_matrix(double **mat, unsigned int size) {
  int i, j, k;
  double **hmat, **imat, *vec;
  extern void solvele(double **, double *, unsigned int);
  check_alloc(hmat = (double **)malloc(sizeof(double *) * size));
  for (i = 0; i < size; i++) {
    check_alloc(hmat[i] = (double *)malloc(sizeof(double) * size));
  }
  check_alloc(imat = (double **)malloc(sizeof(double *) * size));
  for (i = 0; i < size; i++) {
    check_alloc(imat[i] = (double *)malloc(sizeof(double) * size));
  }
  check_alloc(vec = (double *)malloc(sizeof(double) * size));
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      vec[j] = (i == j) ? 1.0 : 0.0;
      for (k = 0; k < size; k++)
        hmat[j][k] = mat[j][k];
    }
    solvele(hmat, vec, size);
    for (j = 0; j < size; j++)
      imat[j][i] = vec[j];
  }
  free(vec);
  for (i = 0; i < size; i++)
    free(hmat[i]);
  free(hmat);
  return imat;
}
```