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

```asm
<matprod_trans12_sub>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x78,%rsp
  mov    %rsi,-0x58(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %r8d,-0x5c(%rbp)
  mov    %r9d,-0x60(%rbp)
  mov    %rdi,-0x90(%rbp)
  mov    $0x1,%edi
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,-0x98(%rbp)
  call   <assert@plt>
  mov    $0x1,%edi
  call   <assert@plt>
  mov    $0x1,%edi
  call   <assert@plt>
  xor    %edi,%edi
  cmp    $0x1,%ebx
  setg   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    $0x1,%r14d
  setg   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    $0x1,%r15d
  setg   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmpl   $0x1,0x10(%rbp)
  setg   %dil
  call   <assert@plt>
  cmp    $0x2,%ebx
  je     L25
  cmpl   $0x7f,0x10(%rbp)
  jg     L147
  mov    $0x800,%eax
  mov    %rsp,%rcx
  cltd
  idivl  0x10(%rbp)
  mov    -0x4c(%rbp),%edx
  and    $0xfffffffc,%eax
  cmp    %edx,%eax
  cmovg  %edx,%eax
  mov    %eax,-0x50(%rbp)
  imul   0x10(%rbp),%eax
  add    $0x3,%eax
  cltq
  lea    0xf(,%rax,8),%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rcx
  and    $0xfffffffffffffff0,%rax
  cmp    %rcx,%rsp
  je     L139
L204:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L204
L139:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L146
  orq    $0x0,-0x8(%rsp,%rax,1)
L146:
  mov    0x10(%rbp),%eax
  mov    %rsp,%r14
  mov    %eax,-0x84(%rbp)
  test   %eax,%eax
  jg     L249
L67:
  mov    -0x98(%rbp),%rsp
L252:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L166
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L147:
  mov    -0x4c(%rbp),%edx
  mov    $0x10,%eax
  mov    %rsp,%rcx
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x50(%rbp)
  shl    $0x7,%eax
  add    $0x3,%eax
  cltq
  lea    0xf(,%rax,8),%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rcx
  and    $0xfffffffffffffff0,%rax
  cmp    %rcx,%rsp
  je     L148
L114:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L114
L148:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L27
  orq    $0x0,-0x8(%rsp,%rax,1)
L27:
  movl   $0x80,-0x84(%rbp)
  mov    %rsp,%r14
L249:
  movslq -0x5c(%rbp),%rax
  movslq -0x4c(%rbp),%rbx
  lea    0x8(%r14),%r11
  mov    %r14,%rdx
  movl   $0x0,-0x70(%rbp)
  mov    %r12,%r14
  mov    %rax,-0x68(%rbp)
  shl    $0x3,%rbx
L130:
  mov    0x10(%rbp),%r12d
  mov    -0x70(%rbp),%esi
  mov    -0x84(%rbp),%edi
  sub    %esi,%r12d
  cmp    %edi,%r12d
  jle    L60
  mov    %r12d,%eax
  sub    %edi,%eax
  cmp    $0x2,%eax
  jle    L175
  add    %edi,%esi
  mov    %edi,%r12d
  mov    %esi,-0x70(%rbp)
L167:
  mov    -0x4c(%rbp),%r8d
  test   %r8d,%r8d
  jle    L243
L245:
  mov    -0x90(%rbp),%rax
  xor    %r15d,%r15d
  mov    %rax,-0x48(%rbp)
  lea    -0x1(%r12),%eax
  mov    %eax,-0x6c(%rbp)
L165:
  mov    -0x4c(%rbp),%r13d
  mov    -0x50(%rbp),%edi
  mov    %r11,-0x80(%rbp)
  sub    %r15d,%r13d
  cmp    %edi,%r13d
  jle    L77
  mov    %r13d,%eax
  sar    %r13d
  push   %r12
  mov    -0x48(%rbp),%rsi
  sub    %edi,%eax
  mov    -0x5c(%rbp),%r8d
  mov    -0x60(%rbp),%ecx
  push   %r12
  cmp    $0x3,%eax
  mov    %rdx,-0x78(%rbp)
  cmovge %edi,%r13d
  mov    -0x58(%rbp),%rdi
  mov    %r13d,%r9d
  call   <matprod_mat_mat_sub_xrows@plt>
  test   %r13d,%r13d
  pop    %rsi
  mov    -0x78(%rbp),%rdx
  mov    -0x80(%rbp),%r11
  lea    0x0(%r13,%r15,1),%r10d
  pop    %rdi
  jle    L137
L219:
  mov    -0x6c(%rbp),%r9d
  xor    %r8d,%r8d
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L82:
  test   %r12d,%r12d
  je     L183
  movslq %r8d,%rsi
  lea    (%rdi,%r15,1),%ecx
  lea    (%rdx,%rsi,8),%rax
  movslq %ecx,%rcx
  add    %r9,%rsi
  lea    (%r14,%rcx,8),%rcx
  lea    (%r11,%rsi,8),%rsi
  cs nopw 0x0(%rax,%rax,1)
L200:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  movsd  %xmm0,(%rcx)
  add    %rbx,%rcx
  cmp    %rsi,%rax
  jne    L200
L183:
  add    $0x1,%edi
  add    %r12d,%r8d
  cmp    %r13d,%edi
  jl     L82
L137:
  movslq %r13d,%r13
  imul   -0x68(%rbp),%r13
  mov    -0x48(%rbp),%rax
  lea    (%rax,%r13,8),%rax
  mov    %rax,-0x48(%rbp)
  cmp    %r10d,-0x4c(%rbp)
  jle    L243
  mov    %r10d,%r15d
  jmp    L165
L77:
  mov    -0x60(%rbp),%ecx
  mov    -0x5c(%rbp),%r8d
  push   %r12
  mov    %r13d,%r9d
  mov    -0x48(%rbp),%rsi
  mov    -0x58(%rbp),%rdi
  push   %r12
  mov    %rdx,-0x78(%rbp)
  call   <matprod_mat_mat_sub_xrows@plt>
  pop    %rdx
  mov    -0x4c(%rbp),%r10d
  mov    -0x78(%rbp),%rdx
  mov    -0x80(%rbp),%r11
  pop    %rcx
  jmp    L219
L243:
  mov    -0x58(%rbp),%rax
  movslq %r12d,%r12
  lea    (%rax,%r12,8),%rax
  imul   %rbx,%r12
  mov    %rax,-0x58(%rbp)
  mov    -0x70(%rbp),%eax
  add    %r12,%r14
  cmp    0x10(%rbp),%eax
  jl     L130
  jmp    L67
L60:
  mov    -0x4c(%rbp),%eax
  test   %eax,%eax
  jle    L67
  mov    0x10(%rbp),%eax
  mov    %eax,-0x70(%rbp)
  jmp    L245
L175:
  sar    %r12d
  and    $0xfffffffc,%r12d
  add    %r12d,-0x70(%rbp)
  jmp    L167
L25:
  xor    %edi,%edi
  cmpl   $0x2,0x10(%rbp)
  sete   %dil
  call   <assert@plt>
  mov    -0x5c(%rbp),%r8d
  mov    -0x4c(%rbp),%ecx
  mov    %r12,%rdx
  mov    -0x58(%rbp),%rsi
  mov    -0x90(%rbp),%rdi
  call   <matprod_trans12_m2@plt>
  jmp    L252
L166:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void matprod_trans12_sub(double *restrict x, double *restrict y, double *restrict z, int n, int k, int m, int zcols) {
  assert(((uintptr_t)(x) & (1 - 1)) == 0);
  assert(((uintptr_t)(y) & (1 - 1)) == 0);
  assert(((uintptr_t)(z) & (1 - 1)) == 0);
  x = (x);
  y = (y);
  z = (z);
  assert(m >= 2);
  assert(k >= 2);
  assert(n >= 2);
  assert(zcols >= 2);
  if (m == 2) {
    assert(zcols == 2);
    matprod_trans12_m2(x, y, z, n, k);
    return;
  }
  int zr, zc;
  zc = 128;
  if (zc > zcols) {
    zc = zcols;
  }
  zr = (2048 / zc) & ~3;
  if (zr > n) {
    zr = n;
  }
  double zelem[zr * zc + 3];
  double *ztmp = zelem;
  while ((((uintptr_t)ztmp) & (1 - 1)) != 0) {
    ztmp += 1;
  }
  int j = 0;
  while (j < zcols) {
    int remaining_cols = zcols - j;
    int zzc = remaining_cols <= zc ? remaining_cols : remaining_cols - zc < 3 ? (remaining_cols / 2) & ~3 : zc;
    double *xx = x;
    int i = 0;
    while (i < n) {
      int remaining_rows = n - i;
      int zzr = remaining_rows <= zr ? remaining_rows : remaining_rows - zr < 3 ? remaining_rows / 2 : zr;
      matprod_mat_mat_sub_xrows(y, xx, ztmp, m, k, zzr, zzc, zzc);
      int ii, jj;
      for (ii = 0; ii < zzr; ii++) {
        for (jj = 0; jj < zzc; jj++) {
          z[i + ii + (size_t)jj * n] = ztmp[jj + ii * zzc];
        }
      }
      xx += (size_t)zzr * k;
      i += zzr;
    }
    y += zzc;
    z += (size_t)zzc * n;
    j += zzc;
  }
}
```