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

```asm
<kernel_dgemm_dtrsm_nt_2x2_vs_lib4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  mov    %edx,%esi
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    0x38(%rsp),%rdi
  mov    0x40(%rsp),%rdx
  mov    0x48(%rsp),%rax
  mov    0x58(%rsp),%r14
  mov    0x60(%rsp),%r15
  test   %ecx,%ecx
  jle    L181
  mov    %ecx,%r13d
  cmp    $0x1,%esi
  je     L105
  pxor   %xmm1,%xmm1
  xor    %ebx,%ebx
  movapd %xmm1,%xmm4
  movapd %xmm1,%xmm0
  movapd %xmm1,%xmm3
L171:
  lea    -0x3(%r13),%ecx
  cmp    %ecx,%ebx
  jge    L82
  lea    -0x4(%r13),%ecx
  sub    %ebx,%ecx
  mov    %ecx,%r10d
  shr    $0x2,%r10d
  cmp    $0x3,%ecx
  jbe    L81
  mov    %r9,%rsi
  mov    %rdi,%rcx
  xor    %r11d,%r11d
  nop
L131:
  movupd (%rcx),%xmm12
  movupd (%rsi),%xmm10
  add    $0x1,%r11d
  sub    $0xffffffffffffff80,%rsi
  movupd -0x60(%rsi),%xmm6
  movlpd -0x78(%rsi),%xmm6
  sub    $0xffffffffffffff80,%rcx
  movhpd -0x60(%rcx),%xmm12
  movupd -0x40(%rsi),%xmm7
  movupd -0x20(%rsi),%xmm5
  movhpd -0x60(%rsi),%xmm10
  movapd %xmm12,%xmm2
  movupd -0x60(%rcx),%xmm13
  movlpd -0x78(%rcx),%xmm13
  mulpd  %xmm10,%xmm2
  movupd -0x40(%rcx),%xmm8
  movlpd -0x38(%rsi),%xmm5
  movhpd -0x20(%rsi),%xmm7
  mulpd  %xmm6,%xmm12
  mulpd  %xmm13,%xmm10
  movhpd -0x20(%rcx),%xmm8
  mulpd  %xmm13,%xmm6
  movapd %xmm8,%xmm9
  mulpd  %xmm5,%xmm8
  addsd  %xmm2,%xmm3
  mulpd  %xmm7,%xmm9
  unpckhpd %xmm2,%xmm2
  addsd  %xmm10,%xmm0
  unpckhpd %xmm10,%xmm10
  addsd  %xmm2,%xmm3
  movapd %xmm12,%xmm2
  unpckhpd %xmm12,%xmm12
  addsd  %xmm4,%xmm2
  addsd  %xmm6,%xmm1
  unpckhpd %xmm6,%xmm6
  addsd  %xmm10,%xmm0
  addsd  %xmm9,%xmm3
  unpckhpd %xmm9,%xmm9
  addsd  %xmm12,%xmm2
  movupd -0x20(%rcx),%xmm12
  addsd  %xmm6,%xmm1
  movlpd -0x38(%rcx),%xmm12
  mulpd  %xmm12,%xmm7
  addsd  %xmm9,%xmm3
  mulpd  %xmm12,%xmm5
  addsd  %xmm8,%xmm2
  unpckhpd %xmm8,%xmm8
  movapd %xmm2,%xmm4
  addsd  %xmm7,%xmm0
  unpckhpd %xmm7,%xmm7
  addsd  %xmm8,%xmm4
  addsd  %xmm5,%xmm1
  unpckhpd %xmm5,%xmm5
  addsd  %xmm7,%xmm0
  addsd  %xmm5,%xmm1
  cmp    %r10d,%r11d
  jb     L131
  mov    %r10d,%ecx
  shl    $0x7,%rcx
  lea    (%r9,%rcx,1),%rsi
  add    %rdi,%rcx
L95:
  movsd  (%rsi),%xmm5
  movsd  0x8(%rcx),%xmm8
  lea    0x4(%rbx,%r10,4),%ebx
  movsd  (%rcx),%xmm6
  movsd  0x8(%rsi),%xmm2
  movapd %xmm5,%xmm7
  movsd  0x28(%rcx),%xmm9
  mulsd  %xmm6,%xmm7
  mulsd  %xmm2,%xmm6
  mulsd  %xmm8,%xmm2
  mulsd  %xmm8,%xmm5
  addsd  %xmm3,%xmm7
  movsd  0x20(%rcx),%xmm3
  addsd  %xmm4,%xmm6
  addsd  %xmm1,%xmm2
  movsd  0x20(%rsi),%xmm1
  addsd  %xmm0,%xmm5
  movsd  0x28(%rsi),%xmm0
  movapd %xmm1,%xmm8
  mulsd  %xmm3,%xmm8
  mulsd  %xmm9,%xmm1
  mulsd  %xmm0,%xmm3
  mulsd  %xmm9,%xmm0
  movsd  0x48(%rcx),%xmm9
  addsd  %xmm7,%xmm8
  addsd  %xmm1,%xmm5
  addsd  %xmm6,%xmm3
  movapd %xmm0,%xmm1
  movsd  0x48(%rsi),%xmm0
  addsd  %xmm2,%xmm1
  movsd  0x40(%rsi),%xmm2
  movapd %xmm3,%xmm4
  movsd  0x40(%rcx),%xmm3
  movapd %xmm2,%xmm7
  mulsd  %xmm9,%xmm2
  mulsd  %xmm3,%xmm7
  mulsd  %xmm0,%xmm3
  mulsd  %xmm9,%xmm0
  addsd  %xmm5,%xmm2
  addsd  %xmm8,%xmm7
  movsd  0x68(%rcx),%xmm8
  addsd  %xmm3,%xmm4
  movapd %xmm0,%xmm5
  movsd  0x60(%rsi),%xmm0
  movapd %xmm2,%xmm6
  movsd  0x60(%rcx),%xmm2
  addsd  %xmm1,%xmm5
  movsd  0x68(%rsi),%xmm1
  lea    0x1(%r10),%ecx
  movapd %xmm0,%xmm3
  shl    $0x7,%rcx
  mulsd  %xmm2,%xmm3
  add    %rcx,%r9
  add    %rcx,%rdi
  mulsd  %xmm1,%xmm2
  mulsd  %xmm8,%xmm0
  mulsd  %xmm8,%xmm1
  addsd  %xmm7,%xmm3
  addsd  %xmm2,%xmm4
  addsd  %xmm6,%xmm0
  addsd  %xmm5,%xmm1
L82:
  cmp    %ebx,%r13d
  jle    L34
  sub    %ebx,%r13d
  cmp    $0x1,%r13d
  je     L88
  movupd (%rdi),%xmm5
  unpcklpd %xmm4,%xmm1
  unpcklpd %xmm3,%xmm0
  lea    -0x1(%r13),%ecx
  movupd (%r9),%xmm2
  shufpd $0x1,%xmm5,%xmm5
  unpckhpd %xmm2,%xmm2
  mulpd  %xmm5,%xmm2
  movapd %xmm2,%xmm4
  movupd (%r9),%xmm2
  addpd  %xmm1,%xmm4
  unpcklpd %xmm2,%xmm2
  mulpd  %xmm5,%xmm2
  addpd  %xmm0,%xmm2
  cmp    $0x2,%r13d
  je     L101
  movupd 0x20(%r9),%xmm0
  movupd 0x20(%rdi),%xmm1
  unpckhpd %xmm0,%xmm0
  shufpd $0x1,%xmm1,%xmm1
  mulpd  %xmm1,%xmm0
  addpd  %xmm0,%xmm4
  movupd 0x20(%r9),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm1,%xmm0
  addpd  %xmm0,%xmm2
  cmp    $0x2,%ecx
  je     L101
  movupd 0x40(%r9),%xmm0
  movupd 0x40(%rdi),%xmm1
  unpckhpd %xmm0,%xmm0
  shufpd $0x1,%xmm1,%xmm1
  mulpd  %xmm1,%xmm0
  addpd  %xmm0,%xmm4
  movupd 0x40(%r9),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm1,%xmm0
  addpd  %xmm0,%xmm2
L101:
  shl    $0x5,%rcx
  movapd %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  movapd %xmm4,%xmm1
  movapd %xmm2,%xmm3
  unpckhpd %xmm4,%xmm4
  add    %rcx,%r9
  add    %rcx,%rdi
L88:
  movsd  (%rdi),%xmm6
  movsd  (%r9),%xmm5
  movsd  0x8(%r9),%xmm2
  movsd  0x8(%rdi),%xmm7
  movapd %xmm6,%xmm8
  mulsd  %xmm5,%xmm8
  mulsd  %xmm2,%xmm6
  mulsd  %xmm7,%xmm5
  mulsd  %xmm7,%xmm2
  addsd  %xmm8,%xmm3
  addsd  %xmm6,%xmm4
  addsd  %xmm5,%xmm0
  addsd  %xmm2,%xmm1
L34:
  cmp    $0x3,%r8d
  jle    L106
  sub    $0x4,%r8d
  mov    %r8d,%r9d
  shr    $0x2,%r9d
  cmp    $0x3,%r8d
  jbe    L60
  movapd %xmm1,%xmm5
  movapd %xmm0,%xmm2
  mov    %rax,%rsi
  mov    %rdx,%rcx
  unpcklpd %xmm4,%xmm5
  unpcklpd %xmm3,%xmm2
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L125:
  movupd (%rcx),%xmm0
  movupd (%rsi),%xmm6
  add    $0x1,%edi
  sub    $0xffffffffffffff80,%rsi
  movupd -0x60(%rsi),%xmm4
  movupd -0x40(%rsi),%xmm3
  sub    $0xffffffffffffff80,%rcx
  unpckhpd %xmm0,%xmm0
  shufpd $0x1,%xmm6,%xmm6
  movupd -0x20(%rsi),%xmm1
  mulpd  %xmm6,%xmm0
  shufpd $0x1,%xmm4,%xmm4
  shufpd $0x1,%xmm3,%xmm3
  shufpd $0x1,%xmm1,%xmm1
  subpd  %xmm0,%xmm5
  movupd -0x60(%rcx),%xmm0
  unpckhpd %xmm0,%xmm0
  mulpd  %xmm4,%xmm0
  subpd  %xmm0,%xmm5
  movupd -0x40(%rcx),%xmm0
  unpckhpd %xmm0,%xmm0
  mulpd  %xmm3,%xmm0
  subpd  %xmm0,%xmm5
  movupd -0x20(%rcx),%xmm0
  unpckhpd %xmm0,%xmm0
  mulpd  %xmm1,%xmm0
  subpd  %xmm0,%xmm5
  movupd -0x80(%rcx),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm6,%xmm0
  subpd  %xmm0,%xmm2
  movupd -0x60(%rcx),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm4,%xmm0
  subpd  %xmm0,%xmm2
  movupd -0x40(%rcx),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm3,%xmm0
  subpd  %xmm0,%xmm2
  movupd -0x20(%rcx),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm1,%xmm0
  subpd  %xmm0,%xmm2
  cmp    %r9d,%edi
  jb     L125
  shl    $0x7,%r9
  movapd %xmm5,%xmm1
  movapd %xmm2,%xmm0
  unpckhpd %xmm5,%xmm5
  unpckhpd %xmm2,%xmm2
  add    %r9,%rdx
  add    %r9,%rax
  movapd %xmm5,%xmm4
  movapd %xmm2,%xmm3
L60:
  movsd  (%rax),%xmm2
  movsd  (%rdx),%xmm6
  movsd  0x8(%rdx),%xmm8
  movsd  0x8(%rax),%xmm5
  movapd %xmm2,%xmm7
  mulsd  %xmm6,%xmm7
  mulsd  %xmm5,%xmm6
  mulsd  %xmm8,%xmm5
  subsd  %xmm7,%xmm3
  movapd %xmm2,%xmm7
  mulsd  %xmm8,%xmm7
  subsd  %xmm6,%xmm0
  movsd  0x20(%rax),%xmm6
  subsd  %xmm5,%xmm1
  movsd  0x20(%rdx),%xmm5
  movapd %xmm6,%xmm8
  mulsd  %xmm5,%xmm8
  subsd  %xmm7,%xmm4
  movsd  0x28(%rdx),%xmm7
  mulsd  %xmm7,%xmm6
  movapd %xmm4,%xmm2
  movsd  0x28(%rax),%xmm4
  subsd  %xmm8,%xmm3
  mulsd  %xmm4,%xmm5
  mulsd  %xmm7,%xmm4
  movsd  0x48(%rdx),%xmm7
  subsd  %xmm6,%xmm2
  movsd  0x40(%rax),%xmm6
  movapd %xmm6,%xmm8
  subsd  %xmm5,%xmm0
  movsd  0x40(%rdx),%xmm5
  mulsd  %xmm7,%xmm6
  subsd  %xmm4,%xmm1
  movsd  0x48(%rax),%xmm4
  mulsd  %xmm5,%xmm8
  mulsd  %xmm4,%xmm5
  mulsd  %xmm7,%xmm4
  subsd  %xmm6,%xmm2
  movsd  0x60(%rdx),%xmm6
  subsd  %xmm8,%xmm3
  movsd  0x68(%rdx),%xmm8
  subsd  %xmm5,%xmm0
  movsd  0x68(%rax),%xmm5
  subsd  %xmm4,%xmm1
  movsd  0x60(%rax),%xmm4
  movapd %xmm4,%xmm7
  mulsd  %xmm6,%xmm7
  mulsd  %xmm8,%xmm4
  mulsd  %xmm5,%xmm6
  mulsd  %xmm8,%xmm5
  subsd  %xmm7,%xmm3
  movapd %xmm4,%xmm7
  movapd %xmm2,%xmm4
  subsd  %xmm7,%xmm4
  subsd  %xmm6,%xmm0
  subsd  %xmm5,%xmm1
L106:
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  je     L153
  mov    0x50(%rsp),%rax
  addsd  (%rax),%xmm3
  addsd  0x8(%rax),%xmm4
  addsd  0x20(%rax),%xmm0
  addsd  0x28(%rax),%xmm1
L153:
  movsd  (%r15),%xmm2
  mulsd  %xmm2,%xmm3
  movsd  %xmm3,(%r14)
  cmp    $0x1,%ebp
  jle    L24
  mulsd  %xmm4,%xmm2
  movsd  %xmm2,0x8(%r14)
  cmp    $0x1,%r12d
  je     L133
  movsd  0x8(%r15),%xmm5
  movsd  0x10(%r15),%xmm4
  mulsd  %xmm5,%xmm3
  mulsd  %xmm5,%xmm2
  subsd  %xmm3,%xmm0
  subsd  %xmm2,%xmm1
  mulsd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm4
  movsd  %xmm0,0x20(%r14)
  movsd  %xmm4,0x28(%r14)
L133:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L105:
  movsd  (%r9),%xmm0
  movsd  (%rdi),%xmm3
  pxor   %xmm5,%xmm5
  mulsd  %xmm0,%xmm3
  mulsd  0x8(%rdi),%xmm0
  addsd  %xmm5,%xmm3
  addsd  %xmm5,%xmm0
  cmp    $0x1,%ecx
  je     L37
  movsd  0x20(%r9),%xmm6
  movsd  0x28(%r9),%xmm1
  add    $0x40,%rdi
  add    $0x40,%r9
  movsd  -0x20(%rdi),%xmm2
  movsd  -0x18(%rdi),%xmm7
  mov    $0x2,%ebx
  movapd %xmm6,%xmm4
  mulsd  %xmm2,%xmm4
  mulsd  %xmm1,%xmm2
  mulsd  %xmm7,%xmm6
  mulsd  %xmm7,%xmm1
  addsd  %xmm4,%xmm3
  movapd %xmm2,%xmm4
  addsd  %xmm5,%xmm4
  addsd  %xmm6,%xmm0
  addsd  %xmm5,%xmm1
  jmp    L171
  nopw   0x0(%rax,%rax,1)
L24:
  cmp    $0x1,%r12d
  je     L133
  mulsd  0x8(%r15),%xmm3
  subsd  %xmm3,%xmm0
  mulsd  0x10(%r15),%xmm0
  movsd  %xmm0,0x20(%r14)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L181:
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm4
  movapd %xmm1,%xmm0
  movapd %xmm1,%xmm3
  jmp    L34
L37:
  movapd %xmm5,%xmm1
  movapd %xmm5,%xmm4
  jmp    L34
L81:
  mov    %rdi,%rcx
  mov    %r9,%rsi
  jmp    L95
```

assistant: ```c
void kernel_dgemm_dtrsm_nt_2x2_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, c_00 = 0, c_01 = 0, c_10 = 0, c_11 = 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];
        c_00 += a_0 * b_0;
        c_01 += a_0 * b_1;
        a_0 = Ap[0 + bs * 1];
        a_1 = Ap[1 + bs * 1];
        b_0 = Bp[0 + bs * 1];
        b_1 = Bp[1 + 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;
        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];
        c_00 += a_0 * b_0;
        c_01 += a_0 * b_1;
        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];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      a_0 = Ap[0 + bs * 1];
      a_1 = Ap[1 + bs * 1];
      b_0 = Bp[0 + bs * 1];
      b_1 = Bp[1 + 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;
      a_0 = Ap[0 + bs * 2];
      a_1 = Ap[1 + bs * 2];
      b_0 = Bp[0 + bs * 2];
      b_1 = Bp[1 + 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;
      a_0 = Ap[0 + bs * 3];
      a_1 = Ap[1 + bs * 3];
      b_0 = Bp[0 + bs * 3];
      b_1 = Bp[1 + 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;
      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];
      c_00 += a_0 * b_0;
      c_10 += a_1 * b_0;
      c_01 += a_0 * b_1;
      c_11 += a_1 * b_1;
      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];
    c_00 -= a_0 * b_0;
    c_10 -= a_1 * b_0;
    c_01 -= a_0 * b_1;
    c_11 -= a_1 * b_1;
    a_0 = Am[0 + bs * 1];
    a_1 = Am[1 + bs * 1];
    b_0 = Bm[0 + bs * 1];
    b_1 = Bm[1 + 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;
    a_0 = Am[0 + bs * 2];
    a_1 = Am[1 + bs * 2];
    b_0 = Bm[0 + bs * 2];
    b_1 = Bm[1 + 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;
    a_0 = Am[0 + bs * 3];
    a_1 = Am[1 + bs * 3];
    b_0 = Bm[0 + bs * 3];
    b_1 = Bm[1 + 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;
    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];
  }
  double a_00, a_10, a_11;
  a_00 = fact[0];
  c_00 *= a_00;
  c_10 *= a_00;
  D[0 + bs * 0] = c_00;
  if (km >= 2)
    D[1 + bs * 0] = c_10;
  if (kn == 1)
    return;
  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 >= 2)
    D[1 + bs * 1] = c_11;
}
```