user: 请将以下的汇编代码转换成C语言代码：

```asm
<matmat>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x8(%rsp)
  movsd  %xmm0,0x28(%rsp)
  movsd  %xmm1,0x20(%rsp)
  mov    %ecx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movb   $0x74,0x3e(%rsp)
  movb   $0x74,0x3f(%rsp)
  mov    %ecx,0x40(%rsp)
  mov    %ecx,0x44(%rsp)
  mov    %ecx,0x48(%rsp)
  mov    %ecx,0x4c(%rsp)
  mov    %ecx,0x50(%rsp)
  mov    %ecx,0x54(%rsp)
  movslq %ecx,%rbx
  mov    %ecx,%edi
  imul   %ecx,%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %r12d,%r12d
  jle    L133
  mov    %rax,%r13
  shl    $0x3,%rbx
  mov    0x8(%rsp),%rax
  lea    0x8(%rax),%r15
  lea    -0x1(%r12),%eax
  lea    (%r15,%rax,8),%rcx
  mov    %r14,%rsi
  mov    $0x0,%ebp
  mov    %r12d,%edi
  neg    %rdi
  shl    $0x3,%rdi
L83:
  lea    (%rdi,%rcx,1),%rax
  mov    %rsi,%rdx
L1:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  add    $0x8,%rax
  add    %rbx,%rdx
  cmp    %rcx,%rax
  jne    L1
  lea    0x1(%rbp),%eax
  add    $0x8,%rsi
  add    %rbx,%rcx
  cmp    %eax,%r12d
  je     L107
  mov    %eax,%ebp
  jmp    L83
L107:
  mov    %r14,%rsi
  mov    $0x0,%edi
  mov    0x8(%rsp),%r12
  sub    %r13,%r12
L0:
  mov    %rsi,%rax
  mov    $0x0,%edx
L45:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%r12,%rax,1)
  mov    %edx,%ecx
  add    $0x1,%edx
  add    %rbx,%rax
  cmp    %ecx,%ebp
  jne    L45
  lea    0x1(%rdi),%eax
  add    $0x8,%rsi
  cmp    %edi,%ebp
  je     L35
  mov    %eax,%edi
  jmp    L0
L128:
  mov    $0x0,%esi
L37:
  mov    %r13,%rax
  mov    $0x0,%edx
L124:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%r12,%rax,1)
  mov    %edx,%ecx
  add    $0x1,%edx
  add    %rbx,%rax
  cmp    %ecx,%ebp
  jne    L124
  lea    0x1(%rsi),%eax
  add    $0x8,%r13
  cmp    %esi,%ebp
  je     L84
  mov    %eax,%esi
  jmp    L37
L35:
  lea    0x44(%rsp),%rcx
  lea    0x40(%rsp),%rdx
  lea    0x3f(%rsp),%rsi
  lea    0x3e(%rsp),%rdi
  sub    $0x8,%rsp
  lea    0x5c(%rsp),%rax
  push   %rax
  push   0x18(%rsp)
  lea    0x38(%rsp),%rax
  push   %rax
  lea    0x70(%rsp),%rax
  push   %rax
  push   0x40(%rsp)
  lea    0x7c(%rsp),%rax
  push   %rax
  push   0x48(%rsp)
  lea    0x68(%rsp),%r9
  lea    0x88(%rsp),%r8
  call   <dgemm_@plt>
  mov    %ebp,%r8d
  lea    (%r15,%r8,8),%rcx
  add    $0x40,%rsp
  mov    %r14,%rsi
  mov    $0x0,%edi
  not    %r8
  shl    $0x3,%r8
L52:
  lea    (%r8,%rcx,1),%rax
  mov    %rsi,%rdx
L105:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  add    $0x8,%rax
  add    %rbx,%rdx
  cmp    %rcx,%rax
  jne    L105
  lea    0x1(%rdi),%eax
  add    $0x8,%rsi
  add    %rbx,%rcx
  cmp    %edi,%ebp
  je     L128
  mov    %eax,%edi
  jmp    L52
L133:
  lea    0x44(%rsp),%rcx
  lea    0x40(%rsp),%rdx
  lea    0x3f(%rsp),%rsi
  lea    0x3e(%rsp),%rdi
  sub    $0x8,%rsp
  lea    0x5c(%rsp),%rax
  push   %rax
  push   0x18(%rsp)
  lea    0x38(%rsp),%rax
  push   %rax
  lea    0x70(%rsp),%rax
  push   %rax
  push   0x40(%rsp)
  lea    0x7c(%rsp),%rax
  push   %rax
  push   0x48(%rsp)
  lea    0x68(%rsp),%r9
  lea    0x88(%rsp),%r8
  call   <dgemm_@plt>
  add    $0x40,%rsp
L84:
  mov    %r14,%rdi
  call   <free@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L69
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L69:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void matmat(double *A, double *B, double *C, double alpha, double beta, int nA) {
  int i, j;
  char TRANSA = 't';
  char TRANSB = 't';
  int m = nA;
  int n = nA;
  int k = nA;
  int LDA = nA;
  int LDB = nA;
  int LDC = nA;
  double *work = (double *)malloc(sizeof(double) * nA * nA);
  for (i = 0; i < nA; i++) {
    for (j = 0; j < nA; j++)
      work[i + nA * j] = C[j + nA * i];
  }
  for (i = 0; i < nA; i++) {
    for (j = 0; j < nA; j++)
      C[i + nA * j] = work[i + nA * j];
  }
  dgemm_(&TRANSA, &TRANSB, &m, &n, &k, &alpha, A, &LDA, B, &LDB, &beta, C, &LDC);
  for (i = 0; i < nA; i++) {
    for (j = 0; j < nA; j++)
      work[i + nA * j] = C[j + nA * i];
  }
  for (i = 0; i < nA; i++) {
    for (j = 0; j < nA; j++)
      C[i + nA * j] = work[i + nA * j];
  }
  free(work);
  return;
}
```