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

```asm
<kernel_dgemm_dtrsm_nt_2x4_vs_lib4>:
  endbr64
  push   %r15
  mov    %ecx,%r10d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    0x40(%rsp),%rcx
  mov    0x48(%rsp),%rax
  mov    0x50(%rsp),%r12
  mov    0x58(%rsp),%rbp
  mov    0x60(%rsp),%r11
  mov    %esi,-0x4(%rsp)
  mov    %edx,%esi
  mov    0x38(%rsp),%rdx
  test   %r10d,%r10d
  jle    L166
  cmp    $0x1,%esi
  je     L178
  pxor   %xmm0,%xmm0
  xor    %r15d,%r15d
  movapd %xmm0,%xmm4
  movapd %xmm0,%xmm6
  movapd %xmm0,%xmm7
  movapd %xmm0,%xmm2
  movapd %xmm0,%xmm8
  movapd %xmm0,%xmm9
  movapd %xmm0,%xmm10
L27:
  lea    -0x3(%r10),%esi
  cmp    %r15d,%esi
  jle    L82
  lea    -0x4(%r10),%r13d
  mov    %r9,%rsi
  sub    %r15d,%r13d
  shr    $0x2,%r13d
  lea    0x1(%r13),%r14d
  shl    $0x7,%r14
  lea    (%rdx,%r14,1),%rdi
  cs nopw 0x0(%rax,%rax,1)
L84:
  movsd  (%rsi),%xmm3
  movsd  0x8(%rsi),%xmm1
  sub    $0xffffffffffffff80,%rdx
  sub    $0xffffffffffffff80,%rsi
  movsd  -0x80(%rdx),%xmm13
  movsd  -0x78(%rdx),%xmm12
  movapd %xmm3,%xmm14
  movsd  -0x70(%rdx),%xmm5
  movsd  -0x68(%rdx),%xmm11
  mulsd  %xmm13,%xmm14
  mulsd  %xmm1,%xmm13
  addsd  %xmm14,%xmm10
  movsd  -0x58(%rdx),%xmm14
  addsd  %xmm13,%xmm7
  movapd %xmm3,%xmm13
  mulsd  %xmm12,%xmm13
  mulsd  %xmm1,%xmm12
  addsd  %xmm13,%xmm9
  movsd  -0x48(%rdx),%xmm13
  addsd  %xmm12,%xmm6
  movapd %xmm3,%xmm12
  mulsd  %xmm5,%xmm12
  mulsd  %xmm11,%xmm3
  mulsd  %xmm1,%xmm5
  mulsd  %xmm11,%xmm1
  movsd  -0x58(%rsi),%xmm11
  addsd  %xmm12,%xmm8
  movsd  -0x60(%rsi),%xmm12
  addsd  %xmm3,%xmm2
  movsd  -0x60(%rdx),%xmm3
  addsd  %xmm5,%xmm4
  movapd %xmm12,%xmm5
  mulsd  %xmm3,%xmm5
  addsd  %xmm1,%xmm0
  movsd  -0x50(%rdx),%xmm1
  mulsd  %xmm11,%xmm3
  addsd  %xmm10,%xmm5
  movapd %xmm14,%xmm10
  addsd  %xmm7,%xmm3
  mulsd  %xmm11,%xmm10
  movapd %xmm12,%xmm7
  mulsd  %xmm14,%xmm7
  addsd  %xmm6,%xmm10
  movapd %xmm12,%xmm6
  addsd  %xmm7,%xmm9
  movsd  -0x40(%rsi),%xmm7
  mulsd  %xmm1,%xmm6
  mulsd  %xmm13,%xmm12
  mulsd  %xmm11,%xmm1
  movapd %xmm7,%xmm15
  movapd %xmm7,%xmm14
  mulsd  %xmm13,%xmm11
  movsd  -0x40(%rdx),%xmm13
  mulsd  %xmm13,%xmm15
  addsd  %xmm6,%xmm8
  movsd  -0x38(%rsi),%xmm6
  addsd  %xmm2,%xmm12
  movsd  -0x28(%rdx),%xmm2
  addsd  %xmm4,%xmm1
  movsd  -0x38(%rdx),%xmm4
  addsd  %xmm0,%xmm11
  movsd  -0x30(%rdx),%xmm0
  mulsd  %xmm4,%xmm14
  addsd  %xmm5,%xmm15
  mulsd  %xmm6,%xmm4
  movapd %xmm13,%xmm5
  mulsd  %xmm6,%xmm5
  movapd %xmm7,%xmm13
  mulsd  %xmm2,%xmm7
  mulsd  %xmm0,%xmm13
  mulsd  %xmm6,%xmm0
  addsd  %xmm9,%xmm14
  mulsd  %xmm2,%xmm6
  movsd  -0x20(%rsi),%xmm2
  addsd  %xmm3,%xmm5
  movapd %xmm4,%xmm3
  movsd  -0x10(%rdx),%xmm4
  addsd  %xmm12,%xmm7
  movsd  -0x18(%rsi),%xmm12
  addsd  %xmm10,%xmm3
  movapd %xmm2,%xmm9
  addsd  %xmm8,%xmm13
  movapd %xmm2,%xmm8
  movapd %xmm2,%xmm10
  mulsd  %xmm4,%xmm8
  addsd  %xmm1,%xmm0
  mulsd  %xmm12,%xmm4
  addsd  %xmm6,%xmm11
  movapd %xmm7,%xmm1
  movsd  -0x18(%rdx),%xmm6
  movsd  -0x20(%rdx),%xmm7
  mulsd  -0x8(%rdx),%xmm2
  mulsd  %xmm6,%xmm9
  mulsd  %xmm7,%xmm10
  mulsd  %xmm12,%xmm6
  addsd  %xmm13,%xmm8
  addsd  %xmm0,%xmm4
  movsd  -0x8(%rdx),%xmm0
  mulsd  %xmm12,%xmm7
  addsd  %xmm1,%xmm2
  mulsd  %xmm12,%xmm0
  addsd  %xmm14,%xmm9
  addsd  %xmm15,%xmm10
  addsd  %xmm3,%xmm6
  addsd  %xmm5,%xmm7
  addsd  %xmm11,%xmm0
  cmp    %rdi,%rdx
  jne    L84
  add    %r14,%r9
  lea    0x4(%r15,%r13,4),%r15d
L158:
  cmp    %r10d,%r15d
  jge    L113
  lea    -0x1(%r10),%edx
  sub    %r15d,%edx
  add    $0x1,%rdx
  shl    $0x5,%rdx
  add    %rdi,%rdx
L134:
  movsd  (%r9),%xmm3
  movsd  0x8(%r9),%xmm1
  add    $0x20,%rdi
  add    $0x20,%r9
  movsd  -0x20(%rdi),%xmm13
  movsd  -0x18(%rdi),%xmm11
  movapd %xmm3,%xmm14
  movsd  -0x10(%rdi),%xmm5
  movsd  -0x8(%rdi),%xmm12
  mulsd  %xmm13,%xmm14
  mulsd  %xmm1,%xmm13
  addsd  %xmm14,%xmm10
  addsd  %xmm13,%xmm7
  movapd %xmm3,%xmm13
  mulsd  %xmm11,%xmm13
  mulsd  %xmm1,%xmm11
  addsd  %xmm13,%xmm9
  addsd  %xmm11,%xmm6
  movapd %xmm3,%xmm11
  mulsd  %xmm5,%xmm11
  mulsd  %xmm12,%xmm3
  mulsd  %xmm1,%xmm5
  mulsd  %xmm12,%xmm1
  addsd  %xmm11,%xmm8
  addsd  %xmm3,%xmm2
  addsd  %xmm5,%xmm4
  addsd  %xmm1,%xmm0
  cmp    %rdx,%rdi
  jne    L134
L113:
  cmp    $0x3,%r8d
  jle    L173
  lea    -0x4(%r8),%edx
  shr    $0x2,%edx
  add    $0x1,%edx
  shl    $0x7,%rdx
  add    %rax,%rdx
  nopl   0x0(%rax,%rax,1)
L102:
  movsd  (%rcx),%xmm3
  movsd  0x8(%rcx),%xmm1
  sub    $0xffffffffffffff80,%rax
  sub    $0xffffffffffffff80,%rcx
  movsd  -0x80(%rax),%xmm13
  movsd  -0x78(%rax),%xmm12
  movapd %xmm3,%xmm14
  movsd  -0x68(%rax),%xmm11
  movsd  -0x70(%rax),%xmm5
  mulsd  %xmm13,%xmm14
  mulsd  %xmm1,%xmm13
  subsd  %xmm14,%xmm10
  subsd  %xmm13,%xmm7
  movapd %xmm3,%xmm13
  mulsd  %xmm12,%xmm13
  mulsd  %xmm1,%xmm12
  subsd  %xmm13,%xmm9
  movsd  -0x60(%rax),%xmm13
  subsd  %xmm12,%xmm6
  movapd %xmm3,%xmm12
  mulsd  %xmm11,%xmm3
  mulsd  %xmm5,%xmm12
  mulsd  %xmm1,%xmm5
  mulsd  %xmm11,%xmm1
  movsd  -0x48(%rax),%xmm11
  subsd  %xmm3,%xmm2
  movsd  -0x60(%rcx),%xmm3
  subsd  %xmm12,%xmm8
  movsd  -0x58(%rax),%xmm12
  movapd %xmm3,%xmm14
  subsd  %xmm5,%xmm4
  movsd  -0x50(%rax),%xmm5
  subsd  %xmm1,%xmm0
  movsd  -0x58(%rcx),%xmm1
  mulsd  %xmm13,%xmm14
  mulsd  %xmm1,%xmm13
  subsd  %xmm14,%xmm10
  subsd  %xmm13,%xmm7
  movapd %xmm3,%xmm13
  mulsd  %xmm12,%xmm13
  mulsd  %xmm1,%xmm12
  subsd  %xmm13,%xmm9
  movsd  -0x28(%rax),%xmm13
  subsd  %xmm12,%xmm6
  movapd %xmm3,%xmm12
  mulsd  %xmm11,%xmm3
  mulsd  %xmm5,%xmm12
  mulsd  %xmm1,%xmm5
  mulsd  %xmm11,%xmm1
  movsd  -0x38(%rax),%xmm11
  subsd  %xmm3,%xmm2
  movsd  -0x40(%rcx),%xmm3
  subsd  %xmm12,%xmm8
  movsd  -0x40(%rax),%xmm12
  movapd %xmm3,%xmm14
  subsd  %xmm5,%xmm4
  movsd  -0x30(%rax),%xmm5
  subsd  %xmm1,%xmm0
  movsd  -0x38(%rcx),%xmm1
  mulsd  %xmm12,%xmm14
  mulsd  %xmm1,%xmm12
  subsd  %xmm14,%xmm10
  subsd  %xmm12,%xmm7
  movapd %xmm3,%xmm12
  mulsd  %xmm11,%xmm12
  mulsd  %xmm1,%xmm11
  subsd  %xmm12,%xmm9
  movsd  -0x18(%rax),%xmm12
  subsd  %xmm11,%xmm6
  movapd %xmm3,%xmm11
  mulsd  %xmm13,%xmm3
  mulsd  %xmm5,%xmm11
  mulsd  %xmm1,%xmm5
  mulsd  %xmm13,%xmm1
  movsd  -0x20(%rax),%xmm13
  subsd  %xmm3,%xmm2
  movsd  -0x20(%rcx),%xmm3
  subsd  %xmm11,%xmm8
  movsd  -0x10(%rax),%xmm11
  movapd %xmm3,%xmm14
  subsd  %xmm5,%xmm4
  movsd  -0x8(%rax),%xmm5
  subsd  %xmm1,%xmm0
  movsd  -0x18(%rcx),%xmm1
  mulsd  %xmm13,%xmm14
  mulsd  %xmm1,%xmm13
  subsd  %xmm14,%xmm10
  subsd  %xmm13,%xmm7
  movapd %xmm3,%xmm13
  mulsd  %xmm12,%xmm13
  mulsd  %xmm1,%xmm12
  subsd  %xmm13,%xmm9
  subsd  %xmm12,%xmm6
  movapd %xmm3,%xmm12
  mulsd  %xmm11,%xmm12
  mulsd  %xmm5,%xmm3
  mulsd  %xmm1,%xmm11
  mulsd  %xmm5,%xmm1
  subsd  %xmm12,%xmm8
  subsd  %xmm3,%xmm2
  subsd  %xmm11,%xmm4
  subsd  %xmm1,%xmm0
  cmp    %rdx,%rax
  jne    L102
L173:
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  je     L76
  addsd  (%r12),%xmm10
  addsd  0x8(%r12),%xmm7
  addsd  0x20(%r12),%xmm9
  addsd  0x28(%r12),%xmm6
  addsd  0x40(%r12),%xmm8
  addsd  0x48(%r12),%xmm4
  addsd  0x60(%r12),%xmm2
  addsd  0x68(%r12),%xmm0
L76:
  movsd  (%r11),%xmm1
  mulsd  %xmm1,%xmm10
  mulsd  %xmm7,%xmm1
  movsd  %xmm10,0x0(%rbp)
  cmp    $0x3,%ebx
  jle    L60
  movsd  %xmm1,0x8(%rbp)
  movsd  0x8(%r11),%xmm3
  movapd %xmm10,%xmm7
  movsd  0x10(%r11),%xmm5
  movapd %xmm10,%xmm11
  mulsd  %xmm3,%xmm7
  mulsd  %xmm1,%xmm3
  subsd  %xmm7,%xmm9
  subsd  %xmm3,%xmm6
  mulsd  %xmm5,%xmm9
  mulsd  %xmm5,%xmm6
  movsd  %xmm9,0x20(%rbp)
  movsd  %xmm6,0x28(%rbp)
  movsd  0x18(%r11),%xmm5
  movsd  0x20(%r11),%xmm3
  movsd  0x28(%r11),%xmm7
  mulsd  %xmm5,%xmm11
  mulsd  %xmm1,%xmm5
  subsd  %xmm11,%xmm8
  subsd  %xmm5,%xmm4
  movapd %xmm3,%xmm5
  mulsd  %xmm9,%xmm5
  mulsd  %xmm6,%xmm3
  subsd  %xmm5,%xmm8
  subsd  %xmm3,%xmm4
  mulsd  %xmm7,%xmm8
  mulsd  %xmm7,%xmm4
  movsd  %xmm8,0x40(%rbp)
  movsd  %xmm4,0x48(%rbp)
L11:
  cmpl   $0x3,-0x4(%rsp)
  je     L39
  movsd  0x30(%r11),%xmm11
  movsd  0x38(%r11),%xmm7
  movsd  0x40(%r11),%xmm5
  movsd  0x48(%r11),%xmm3
  mulsd  %xmm11,%xmm10
  mulsd  %xmm7,%xmm9
  mulsd  %xmm5,%xmm8
  subsd  %xmm10,%xmm2
  subsd  %xmm9,%xmm2
  subsd  %xmm8,%xmm2
  mulsd  %xmm3,%xmm2
  movsd  %xmm2,0x60(%rbp)
  cmp    $0x3,%ebx
  jle    L39
  mulsd  %xmm1,%xmm11
  mulsd  %xmm6,%xmm7
  mulsd  %xmm4,%xmm5
  subsd  %xmm11,%xmm0
  subsd  %xmm7,%xmm0
  subsd  %xmm5,%xmm0
  mulsd  %xmm0,%xmm3
  movsd  %xmm3,0x68(%rbp)
L39:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L178:
  movsd  (%r9),%xmm2
  movsd  (%rdx),%xmm10
  pxor   %xmm1,%xmm1
  movsd  0x8(%rdx),%xmm9
  movsd  0x10(%rdx),%xmm8
  mulsd  %xmm2,%xmm10
  mulsd  %xmm2,%xmm9
  mulsd  %xmm2,%xmm8
  mulsd  0x18(%rdx),%xmm2
  addsd  %xmm1,%xmm10
  addsd  %xmm1,%xmm9
  addsd  %xmm1,%xmm8
  addsd  %xmm1,%xmm2
  cmp    $0x1,%r10d
  je     L8
  movsd  0x20(%r9),%xmm3
  movsd  0x20(%rdx),%xmm7
  add    $0x40,%r9
  add    $0x40,%rdx
  movsd  -0x18(%rdx),%xmm6
  movsd  -0x10(%rdx),%xmm4
  mov    $0x2,%r15d
  movapd %xmm3,%xmm11
  movsd  -0x18(%r9),%xmm0
  movsd  -0x8(%rdx),%xmm5
  mulsd  %xmm7,%xmm11
  mulsd  %xmm0,%xmm7
  addsd  %xmm11,%xmm10
  movapd %xmm3,%xmm11
  mulsd  %xmm6,%xmm11
  addsd  %xmm1,%xmm7
  mulsd  %xmm0,%xmm6
  addsd  %xmm11,%xmm9
  movapd %xmm3,%xmm11
  mulsd  %xmm4,%xmm11
  addsd  %xmm1,%xmm6
  mulsd  %xmm0,%xmm4
  mulsd  %xmm5,%xmm3
  mulsd  %xmm5,%xmm0
  addsd  %xmm11,%xmm8
  addsd  %xmm1,%xmm4
  addsd  %xmm3,%xmm2
  addsd  %xmm1,%xmm0
  jmp    L27
  nopl   0x0(%rax,%rax,1)
L60:
  movsd  0x8(%r11),%xmm3
  movapd %xmm10,%xmm7
  movsd  0x10(%r11),%xmm5
  movapd %xmm10,%xmm11
  mulsd  %xmm3,%xmm7
  mulsd  %xmm1,%xmm3
  subsd  %xmm7,%xmm9
  subsd  %xmm3,%xmm6
  mulsd  %xmm5,%xmm9
  mulsd  %xmm5,%xmm6
  movsd  %xmm9,0x20(%rbp)
  movsd  0x18(%r11),%xmm7
  movsd  0x20(%r11),%xmm3
  movsd  0x28(%r11),%xmm5
  mulsd  %xmm7,%xmm11
  mulsd  %xmm1,%xmm7
  subsd  %xmm11,%xmm8
  subsd  %xmm7,%xmm4
  movapd %xmm3,%xmm7
  mulsd  %xmm9,%xmm7
  mulsd  %xmm6,%xmm3
  subsd  %xmm7,%xmm8
  subsd  %xmm3,%xmm4
  mulsd  %xmm5,%xmm8
  mulsd  %xmm5,%xmm4
  movsd  %xmm8,0x40(%rbp)
  jmp    L11
  nopl   0x0(%rax)
L166:
  pxor   %xmm0,%xmm0
  movapd %xmm0,%xmm4
  movapd %xmm0,%xmm6
  movapd %xmm0,%xmm7
  movapd %xmm0,%xmm2
  movapd %xmm0,%xmm8
  movapd %xmm0,%xmm9
  movapd %xmm0,%xmm10
  jmp    L113
L8:
  movapd %xmm1,%xmm0
  movapd %xmm1,%xmm4
  movapd %xmm1,%xmm6
  movapd %xmm1,%xmm7
  jmp    L113
L82:
  mov    %rdx,%rdi
  jmp    L158
```

assistant: ```c
void kernel_dgemm_dtrsm_nt_2x4_vs_lib4(int km, int kn, int tri, int kadd, int ksub, double *Ap, double *Bp, double *Am, double *Bm, double *C, double *D, double *fact, int alg) {
  const int bs = 4;
  int k;
  double a_0, a_1, b_0, b_1, b_2, b_3, c_00 = 0, c_01 = 0, c_02 = 0, c_03 = 0, c_10 = 0, c_11 = 0, c_12 = 0, c_13 = 0;
  k = 0;
  if (kadd > 0) {
    if (tri == 1) {
      if (kadd >= 2) {
        a_0 = Ap[0 + bs * 0];
        b_0 = Bp[0 + bs * 0];
        b_1 = Bp[1 + bs * 0];
        b_2 = Bp[2 + bs * 0];
        b_3 = Bp[3 + bs * 0];
        c_00 += a_0 * b_0;
        c_01 += a_0 * b_1;
        c_02 += a_0 * b_2;
        c_03 += a_0 * b_3;
        a_0 = Ap[0 + bs * 1];
        a_1 = Ap[1 + bs * 1];
        b_0 = Bp[0 + bs * 1];
        b_1 = Bp[1 + bs * 1];
        b_2 = Bp[2 + bs * 1];
        b_3 = Bp[3 + bs * 1];
        c_00 += a_0 * b_0;
        c_10 += a_1 * b_0;
        c_01 += a_0 * b_1;
        c_11 += a_1 * b_1;
        c_02 += a_0 * b_2;
        c_12 += a_1 * b_2;
        c_03 += a_0 * b_3;
        c_13 += a_1 * b_3;
        Ap += 8;
        Bp += 8;
        k += 2;
      } else {
        a_0 = Ap[0 + bs * 0];
        b_0 = Bp[0 + bs * 0];
        b_1 = Bp[1 + bs * 0];
        b_2 = Bp[2 + bs * 0];
        b_3 = Bp[3 + bs * 0];
        c_00 += a_0 * b_0;
        c_01 += a_0 * b_1;
        c_02 += a_0 * b_2;
        c_03 += a_0 * b_3;
        k += 1;
      }
    }
    for (; k < kadd - 3; k += 4) {
      a_0 = Ap[0 + bs * 0];
      a_1 = Ap[1 + bs * 0];
      b_0 = Bp[0 + bs * 0];
      b_1 = Bp[1 + bs * 0];
      b_2 = Bp[2 + bs * 0];
      b_3 = Bp[3 + bs * 0];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      c_02 += a_0 * b_2;
      c_12 += a_1 * b_2;
      c_03 += a_0 * b_3;
      c_13 += a_1 * b_3;
      a_0 = Ap[0 + bs * 1];
      a_1 = Ap[1 + bs * 1];
      b_0 = Bp[0 + bs * 1];
      b_1 = Bp[1 + bs * 1];
      b_2 = Bp[2 + bs * 1];
      b_3 = Bp[3 + bs * 1];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      c_02 += a_0 * b_2;
      c_12 += a_1 * b_2;
      c_03 += a_0 * b_3;
      c_13 += a_1 * b_3;
      a_0 = Ap[0 + bs * 2];
      a_1 = Ap[1 + bs * 2];
      b_0 = Bp[0 + bs * 2];
      b_1 = Bp[1 + bs * 2];
      b_2 = Bp[2 + bs * 2];
      b_3 = Bp[3 + bs * 2];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      c_02 += a_0 * b_2;
      c_12 += a_1 * b_2;
      c_03 += a_0 * b_3;
      c_13 += a_1 * b_3;
      a_0 = Ap[0 + bs * 3];
      a_1 = Ap[1 + bs * 3];
      b_0 = Bp[0 + bs * 3];
      b_1 = Bp[1 + bs * 3];
      b_2 = Bp[2 + bs * 3];
      b_3 = Bp[3 + bs * 3];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      c_02 += a_0 * b_2;
      c_12 += a_1 * b_2;
      c_03 += a_0 * b_3;
      c_13 += a_1 * b_3;
      Ap += 16;
      Bp += 16;
    }
    for (; k < kadd; k++) {
      a_0 = Ap[0 + bs * 0];
      a_1 = Ap[1 + bs * 0];
      b_0 = Bp[0 + bs * 0];
      b_1 = Bp[1 + bs * 0];
      b_2 = Bp[2 + bs * 0];
      b_3 = Bp[3 + bs * 0];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      c_02 += a_0 * b_2;
      c_12 += a_1 * b_2;
      c_03 += a_0 * b_3;
      c_13 += a_1 * b_3;
      Ap += 4;
      Bp += 4;
    }
  }
  for (k = 0; k < ksub - 3; k += 4) {
    a_0 = Am[0 + bs * 0];
    a_1 = Am[1 + bs * 0];
    b_0 = Bm[0 + bs * 0];
    b_1 = Bm[1 + bs * 0];
    b_2 = Bm[2 + bs * 0];
    b_3 = Bm[3 + bs * 0];
    c_00 -= a_0 * b_0;
    c_10 -= a_1 * b_0;
    c_01 -= a_0 * b_1;
    c_11 -= a_1 * b_1;
    c_02 -= a_0 * b_2;
    c_12 -= a_1 * b_2;
    c_03 -= a_0 * b_3;
    c_13 -= a_1 * b_3;
    a_0 = Am[0 + bs * 1];
    a_1 = Am[1 + bs * 1];
    b_0 = Bm[0 + bs * 1];
    b_1 = Bm[1 + bs * 1];
    b_2 = Bm[2 + bs * 1];
    b_3 = Bm[3 + bs * 1];
    c_00 -= a_0 * b_0;
    c_10 -= a_1 * b_0;
    c_01 -= a_0 * b_1;
    c_11 -= a_1 * b_1;
    c_02 -= a_0 * b_2;
    c_12 -= a_1 * b_2;
    c_03 -= a_0 * b_3;
    c_13 -= a_1 * b_3;
    a_0 = Am[0 + bs * 2];
    a_1 = Am[1 + bs * 2];
    b_0 = Bm[0 + bs * 2];
    b_1 = Bm[1 + bs * 2];
    b_2 = Bm[2 + bs * 2];
    b_3 = Bm[3 + bs * 2];
    c_00 -= a_0 * b_0;
    c_10 -= a_1 * b_0;
    c_01 -= a_0 * b_1;
    c_11 -= a_1 * b_1;
    c_02 -= a_0 * b_2;
    c_12 -= a_1 * b_2;
    c_03 -= a_0 * b_3;
    c_13 -= a_1 * b_3;
    a_0 = Am[0 + bs * 3];
    a_1 = Am[1 + bs * 3];
    b_0 = Bm[0 + bs * 3];
    b_1 = Bm[1 + bs * 3];
    b_2 = Bm[2 + bs * 3];
    b_3 = Bm[3 + bs * 3];
    c_00 -= a_0 * b_0;
    c_10 -= a_1 * b_0;
    c_01 -= a_0 * b_1;
    c_11 -= a_1 * b_1;
    c_02 -= a_0 * b_2;
    c_12 -= a_1 * b_2;
    c_03 -= a_0 * b_3;
    c_13 -= a_1 * b_3;
    Am += 16;
    Bm += 16;
  }
  if (alg != 0) {
    c_00 += C[0 + bs * 0];
    c_10 += C[1 + bs * 0];
    c_01 += C[0 + bs * 1];
    c_11 += C[1 + bs * 1];
    c_02 += C[0 + bs * 2];
    c_12 += C[1 + bs * 2];
    c_03 += C[0 + bs * 3];
    c_13 += C[1 + bs * 3];
  }
  double a_00, a_10, a_20, a_30, a_11, a_21, a_31, a_22, a_32, a_33;
  a_00 = fact[0];
  c_00 *= a_00;
  c_10 *= a_00;
  D[0 + bs * 0] = c_00;
  if (km >= 4)
    D[1 + bs * 0] = c_10;
  a_10 = fact[1];
  a_11 = fact[2];
  c_01 -= c_00 * a_10;
  c_11 -= c_10 * a_10;
  c_01 *= a_11;
  c_11 *= a_11;
  D[0 + bs * 1] = c_01;
  if (km >= 4)
    D[1 + bs * 1] = c_11;
  a_20 = fact[3];
  a_21 = fact[4];
  a_22 = fact[5];
  c_02 -= c_00 * a_20;
  c_12 -= c_10 * a_20;
  c_02 -= c_01 * a_21;
  c_12 -= c_11 * a_21;
  c_02 *= a_22;
  c_12 *= a_22;
  D[0 + bs * 2] = c_02;
  if (km >= 4)
    D[1 + bs * 2] = c_12;
  if (kn == 3)
    return;
  a_30 = fact[6];
  a_31 = fact[7];
  a_32 = fact[8];
  a_33 = fact[9];
  c_03 -= c_00 * a_30;
  c_13 -= c_10 * a_30;
  c_03 -= c_01 * a_31;
  c_13 -= c_11 * a_31;
  c_03 -= c_02 * a_32;
  c_13 -= c_12 * a_32;
  c_03 *= a_33;
  c_13 *= a_33;
  D[0 + bs * 3] = c_03;
  if (km >= 4)
    D[1 + bs * 3] = c_13;
}
```