user: Please show me the C implementation that matches the assembly code listed below:

```asm
<dgemm_opt>:
  endbr64
  push   %r15
  mov    %ecx,%eax
  push   %r14
  imul   %r9d,%eax
  push   %r13
  push   %r12
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x68,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %ecx,0x30(%rsp)
  mov    %r8d,0x34(%rsp)
  test   %eax,%eax
  jle    L49
  cltq
  mov    %rdx,%rdi
  xor    %esi,%esi
  lea    0x0(,%rax,8),%rdx
  call   <memset@plt>
L49:
  mov    0x30(%rsp),%eax
  test   %eax,%eax
  jle    L22
  mov    0x34(%rsp),%edi
  test   %edi,%edi
  jle    L22
  test   %ebp,%ebp
  jle    L22
  movslq %ebp,%rax
  movl   $0x0,0x1c(%rsp)
  mov    %ebp,%r9d
  mov    %rax,0x58(%rsp)
  lea    0x0(,%rax,8),%r15
  mov    %ebp,%eax
  and    $0xfffffffe,%r9d
  shr    %eax
  movl   $0x0,0x18(%rsp)
  lea    -0x1(%rax),%r12d
  mov    0x28(%rsp),%rax
  movl   $0x0,0x14(%rsp)
  add    $0x1,%r12
  add    $0x8,%rax
  shl    $0x4,%r12
  mov    %rax,0x48(%rsp)
  mov    0x20(%rsp),%rax
  add    $0x8,%rax
  mov    %rax,0x50(%rsp)
  lea    -0x1(%rdi),%eax
  mov    %rax,0x38(%rsp)
  lea    -0x1(%rbp),%eax
  mov    %rax,0x40(%rsp)
  nopl   0x0(%rax)
L15:
  movslq 0x18(%rsp),%rax
  mov    0x28(%rsp),%rdi
  xor    %r8d,%r8d
  mov    0x48(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  lea    (%rdi,%rax,8),%r11
  add    0x38(%rsp),%rax
  mov    0x20(%rsp),%rsi
  mov    %rbx,%rdi
  lea    (%rcx,%rax,8),%r14
  movslq 0x1c(%rsp),%rcx
  add    %rcx,%rdx
  lea    (%rsi,%rcx,8),%rax
  lea    (%rsi,%rdx,8),%rdx
  mov    %rdx,0x8(%rsp)
  lea    (%r9,%rcx,1),%edx
  add    0x40(%rsp),%rcx
  movslq %edx,%rdx
  lea    (%rsi,%rdx,8),%rdx
  mov    0x50(%rsp),%rsi
  lea    (%rsi,%rcx,8),%r13
  nopw   0x0(%rax,%rax,1)
L101:
  lea    0x8(%rdi),%rsi
  mov    %r11,%rcx
  add    $0x8,%r11
  cmp    %rsi,%rax
  setne  %r10b
  cmp    $0x1,%ebp
  setne  %sil
  test   %sil,%r10b
  je     L86
  cmp    %rcx,0x8(%rsp)
  setbe  %r10b
  cmp    %r11,%rax
  setae  %sil
  or     %r10b,%sil
  je     L86
  movsd  (%rcx),%xmm1
  xor    %esi,%esi
  unpcklpd %xmm1,%xmm1
  nopl   (%rax)
L91:
  movupd (%rdi,%rsi,1),%xmm0
  movupd (%rax,%rsi,1),%xmm2
  mulpd  %xmm1,%xmm0
  addpd  %xmm2,%xmm0
  movups %xmm0,(%rax,%rsi,1)
  add    $0x10,%rsi
  cmp    %r12,%rsi
  jne    L91
  cmp    %ebp,%r9d
  je     L40
  lea    (%r8,%r9,1),%esi
  movslq %esi,%rsi
  movsd  (%rbx,%rsi,8),%xmm0
  mulsd  (%rcx),%xmm0
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%rdx)
L40:
  add    %r15,%rdi
  add    %ebp,%r8d
  cmp    %r14,%r11
  jne    L101
  addl   $0x1,0x14(%rsp)
  mov    0x34(%rsp),%ecx
  add    %ebp,0x1c(%rsp)
  mov    0x14(%rsp),%eax
  add    %ecx,0x18(%rsp)
  cmp    %eax,0x30(%rsp)
  jne    L15
L22:
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L86:
  mov    %rdi,%r10
  mov    %rax,%rsi
  cs nopw 0x0(%rax,%rax,1)
L39:
  movsd  (%r10),%xmm0
  mulsd  (%rcx),%xmm0
  add    $0x8,%rsi
  add    $0x8,%r10
  addsd  -0x8(%rsi),%xmm0
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rsi,%r13
  jne    L39
  jmp    L40
```

assistant: ```c
void dgemm_opt(double *a, double *b, double *c, int n, int m, int q) {
  for (int i = 0; i < n * q; i++)
    c[i] = 0;
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < m; k++) {
      for (int j = 0; j < q; j++)
        c[i * q + j] += a[i * m + k] * b[k * q + j];
    }
  }
}
```