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

```asm
<CINTdmat_transpose>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,-0x28(%rsp)
  mov    %ecx,-0x20(%rsp)
  cmp    $0x3,%ecx
  jle    L78
  movslq %edx,%r14
  movslq %ecx,%r10
  mov    %rbp,-0x10(%rsp)
  mov    %rsi,%rbx
  lea    (%r14,%r14,2),%rax
  lea    0x0(,%rdx,4),%r12d
  lea    (%rdi,%rax,8),%rdi
  lea    -0x4(%r10),%eax
  movslq %r12d,%r12
  shl    $0x3,%r10
  shr    $0x2,%eax
  lea    0x0(,%r14,8),%r15
  shl    $0x3,%r12
  lea    -0x1(%r13),%r11d
  mov    %eax,-0x1c(%rsp)
  shl    $0x4,%r14
  mov    %rax,-0x18(%rsp)
  shl    $0x5,%rax
  lea    0x20(%rsi,%rax,1),%rax
  mov    %rbp,%rsi
  mov    %rax,%rbp
  xchg   %ax,%ax
L77:
  lea    (%r15,%rsi,1),%r9
  lea    (%rsi,%r14,1),%r8
  mov    %rbx,%rdx
  xor    %eax,%eax
  test   %r13d,%r13d
  jle    L63
  nopw   0x0(%rax,%rax,1)
L135:
  movsd  (%rdx),%xmm0
  mov    %rax,%rcx
  movsd  %xmm0,(%rsi,%rax,8)
  movsd  0x8(%rdx),%xmm0
  movsd  %xmm0,(%r9,%rax,8)
  movsd  0x10(%rdx),%xmm0
  movsd  %xmm0,(%r8,%rax,8)
  movsd  0x18(%rdx),%xmm0
  add    %r10,%rdx
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %r11,%rcx
  jne    L135
L63:
  add    $0x20,%rbx
  add    %r12,%rsi
  add    %r12,%rdi
  cmp    %rbp,%rbx
  jne    L77
  mov    -0x18(%rsp),%rax
  mov    -0x10(%rsp),%rbp
  mov    -0x20(%rsp),%edx
  add    $0x1,%rax
  imul   %r12,%rax
  add    %rax,%rbp
  mov    -0x1c(%rsp),%eax
  lea    0x4(,%rax,4),%eax
  sub    %eax,%edx
L228:
  cmp    $0x2,%edx
  je     L96
  cmp    $0x3,%edx
  je     L62
  cmp    $0x1,%edx
  je     L184
L226:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L96:
  movslq %r13d,%rsi
  test   %r13d,%r13d
  jle    L226
  movslq -0x20(%rsp),%rdx
  mov    -0x28(%rsp),%rbx
  cltq
  mov    %r13d,%r13d
  lea    0x0(%rbp,%r13,8),%rcx
  shl    $0x3,%rdx
  lea    (%rbx,%rax,8),%rax
  nopl   0x0(%rax)
L79:
  movsd  (%rax),%xmm0
  movsd  %xmm0,0x0(%rbp)
  movsd  0x8(%rax),%xmm0
  add    %rdx,%rax
  movsd  %xmm0,0x0(%rbp,%rsi,8)
  add    $0x8,%rbp
  cmp    %rcx,%rbp
  jne    L79
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L184:
  test   %r13d,%r13d
  jle    L226
  cmpl   $0x1,-0x20(%rsp)
  jne    L166
  lea    0x1(%rax),%edx
  mov    -0x28(%rsp),%rbx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    (%rbx,%rdx,1),%rcx
  cmp    %rcx,%rbp
  je     L109
  lea    -0x1(%r13),%ecx
  cmp    $0x2,%ecx
  jbe    L109
  mov    %r13d,%ecx
  lea    -0x8(%rbx,%rdx,1),%rsi
  xor    %edx,%edx
  shr    %ecx
  shl    $0x4,%rcx
  nopl   0x0(%rax)
L190:
  movupd (%rsi,%rdx,1),%xmm1
  movups %xmm1,0x0(%rbp,%rdx,1)
  add    $0x10,%rdx
  cmp    %rdx,%rcx
  jne    L190
  mov    %r13d,%edx
  and    $0xfffffffe,%edx
  add    %edx,%eax
  cmp    %r13d,%edx
  je     L226
  mov    -0x28(%rsp),%rbx
  cltq
  movsd  (%rbx,%rax,8),%xmm0
  mov    %edx,%eax
  movsd  %xmm0,0x0(%rbp,%rax,8)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L62:
  movslq %r13d,%r8
  lea    0x0(,%r8,8),%rsi
  lea    0x0(%rbp,%rsi,1),%rdi
  test   %r13d,%r13d
  jle    L226
  movslq -0x20(%rsp),%rcx
  mov    -0x28(%rsp),%rbx
  cltq
  add    %rdi,%rsi
  lea    (%rbx,%rax,8),%rdx
  shl    $0x3,%rcx
  xor    %eax,%eax
  nopl   (%rax)
L123:
  movsd  (%rdx),%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,8)
  movsd  0x8(%rdx),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  movsd  0x10(%rdx),%xmm0
  add    %rcx,%rdx
  movsd  %xmm0,(%rsi,%rax,8)
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L123
  jmp    L226
L78:
  mov    %ecx,%edx
  xor    %eax,%eax
  jmp    L228
L166:
  movslq -0x20(%rsp),%rdx
  mov    -0x28(%rsp),%rbx
  cltq
  mov    %r13d,%r13d
  lea    0x0(%rbp,%r13,8),%rcx
  shl    $0x3,%rdx
  lea    (%rbx,%rax,8),%rax
L209:
  movsd  (%rax),%xmm0
  add    $0x8,%rbp
  add    %rdx,%rax
  movsd  %xmm0,-0x8(%rbp)
  cmp    %rbp,%rcx
  jne    L209
  jmp    L226
L109:
  mov    -0x28(%rsp),%rax
  mov    %r13d,%r13d
  lea    -0x8(%rax,%rdx,1),%rdx
  xor    %eax,%eax
L40:
  movsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%r13
  jne    L40
  jmp    L226
```

assistant: ```c
void CINTdmat_transpose(double *a_t, const double *a, const int m, const int n) {
  int i, j, k;
  double *pa1, *pa2, *pa3;
  for (j = 0; j < n - 3; j += 4) {
    pa1 = a_t + m;
    pa2 = pa1 + m;
    pa3 = pa2 + m;
    for (i = 0, k = j; i < m; i++, k += n) {
      a_t[i] = a[k + 0];
      pa1[i] = a[k + 1];
      pa2[i] = a[k + 2];
      pa3[i] = a[k + 3];
    }
    a_t += m * 4;
  }
  switch (n - j) {
  case 1:
    for (i = 0, k = j; i < m; i++, k += n) {
      a_t[i] = a[k];
    }
    break;
  case 2:
    pa1 = a_t + m;
    for (i = 0, k = j; i < m; i++, k += n) {
      a_t[i] = a[k + 0];
      pa1[i] = a[k + 1];
    }
    break;
  case 3:
    pa1 = a_t + m;
    pa2 = pa1 + m;
    for (i = 0, k = j; i < m; i++, k += n) {
      a_t[i] = a[k + 0];
      pa1[i] = a[k + 1];
      pa2[i] = a[k + 2];
    }
    break;
  }
}
```