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

```asm
<matrix_multiply>:
  endbr64
  push   %r15
  mov    %r8d,%r15d
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rdx,%r12
  mov    %ecx,%edx
  push   %rbp
  imul   %r8d,%edx
  push   %rbx
  mov    %ecx,%ebx
  shl    $0x3,%edx
  sub    $0x48,%rsp
  mov    %rsi,0x28(%rsp)
  xor    %esi,%esi
  mov    %ecx,0x1c(%rsp)
  call   <memset@plt>
  mov    %r15d,%eax
  or     %r14d,%eax
  or     %ebx,%eax
  test   $0x1f,%al
  jne    L4
  test   %r14d,%r14d
  je     L125
  mov    %r15d,%eax
  movl   $0x0,0x3c(%rsp)
  shl    $0x5,%eax
  movl   $0x0,0x38(%rsp)
  mov    %eax,0x30(%rsp)
  mov    %r14d,%eax
  shl    $0x5,%eax
  mov    %r12,0x8(%rsp)
  mov    %eax,0x34(%rsp)
  mov    %r13,(%rsp)
  mov    %r14d,%r13d
L69:
  mov    0x1c(%rsp),%eax
  mov    0x3c(%rsp),%r12d
  test   %eax,%eax
  je     L9
  mov    0x38(%rsp),%eax
  movl   $0x0,0x14(%rsp)
  movl   $0x0,0x18(%rsp)
  mov    %rax,0x20(%rsp)
  movl   $0x0,0x10(%rsp)
  nopl   0x0(%rax)
L15:
  mov    0x28(%rsp),%rbx
  mov    0x18(%rsp),%eax
  xor    %r14d,%r14d
  add    0x20(%rsp),%rax
  lea    (%rbx,%rax,8),%rbp
  mov    0x14(%rsp),%ebx
  test   %r15d,%r15d
  je     L52
  mov    %r13d,%eax
  mov    %r14d,%r13d
  mov    %r15d,%r14d
  mov    %eax,%r15d
  nopw   0x0(%rax,%rax,1)
L127:
  mov    0x8(%rsp),%rcx
  mov    (%rsp),%rsi
  mov    %r13d,%eax
  mov    %r14d,%r9d
  lea    (%r12,%rax,1),%rdx
  add    %rbx,%rax
  mov    %r15d,%r8d
  add    $0x20,%r13d
  lea    (%rcx,%rdx,8),%rdx
  lea    (%rsi,%rax,8),%rdi
  mov    %r14d,%ecx
  mov    %rbp,%rsi
  call   <matrix_multiply_block@plt>
  cmp    %r13d,%r14d
  ja     L127
  mov    %r15d,%r13d
  mov    %r14d,%r15d
L52:
  mov    0x34(%rsp),%ecx
  addl   $0x20,0x10(%rsp)
  add    %ecx,0x18(%rsp)
  mov    0x10(%rsp),%eax
  mov    0x30(%rsp),%ecx
  add    %ecx,0x14(%rsp)
  cmp    %eax,0x1c(%rsp)
  ja     L15
L9:
  addl   $0x20,0x38(%rsp)
  mov    0x38(%rsp),%eax
  mov    0x30(%rsp),%ecx
  add    %ecx,0x3c(%rsp)
  cmp    %eax,%r13d
  ja     L69
L125:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  test   %r14d,%r14d
  je     L125
  mov    0x28(%rsp),%rbp
  mov    0x1c(%rsp),%ebx
  mov    %r8d,(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L63:
  test   %ebx,%ebx
  je     L49
  mov    (%rsp),%r8d
  mov    %ecx,%r11d
  mov    %r15d,%edi
  xor    %r10d,%r10d
  nopl   0x0(%rax)
L47:
  test   %r15d,%r15d
  je     L43
  mov    %edi,%eax
  mov    %r11d,%edx
  sub    %r15d,%eax
  lea    0x0(%rbp,%rdx,8),%rsi
  nopw   0x0(%rax,%rax,1)
L123:
  mov    %eax,%edx
  lea    (%rax,%r8,1),%r9d
  add    $0x1,%eax
  movsd  (%r12,%r9,8),%xmm0
  lea    0x0(%r13,%rdx,8),%rdx
  mulsd  (%rsi),%xmm0
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%rdx)
  cmp    %eax,%edi
  jne    L123
L43:
  add    $0x1,%r10d
  sub    %r15d,%r8d
  add    %r15d,%edi
  add    %r14d,%r11d
  cmp    %r10d,%ebx
  jne    L47
L49:
  add    $0x1,%ecx
  add    %r15d,(%rsp)
  cmp    %ecx,%r14d
  jne    L63
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void matrix_multiply(double C[], const double A[], const double B[], const unsigned int m, const unsigned int n, const unsigned int q) {
  unsigned int i, j, k;
  memset(C, 0, m * n * sizeof(double));
  if (m % 32 || n % 32 || q % 32) {
    for (k = 0; k < q; ++k) {
      for (i = 0; i < m; ++i) {
        for (j = 0; j < n; ++j) {
          C[i * n + j] += A[i * q + k] * B[k * n + j];
        }
      }
    }
    return;
  }
  for (k = 0; k < q; k += 32) {
    const double *B_k = B + k * n;
    for (i = 0; i < m; i += 32) {
      const double *A_i_k = A + i * q + k;
      double *C_i = C + i * n;
      for (j = 0; j < n; j += 32) {
        matrix_multiply_block(C_i + j, A_i_k, B_k + j, n, q, n);
      }
    }
  }
}
```