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

```asm
<kernel_dgemm_dtrsm_nt_2x2_vs_lib4>:
  endbr64
  mov    %edi,%r11d
  mov    %ecx,%edi
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  mov    0x38(%rsp),%rcx
  mov    %edx,%esi
  mov    0x48(%rsp),%rax
  mov    0x40(%rsp),%rdx
  mov    0x58(%rsp),%rbp
  mov    0x60(%rsp),%r14
  test   %edi,%edi
  jle    L160
  cmp    $0x1,%esi
  je     L71
  pxor   %xmm1,%xmm1
  xor    %r15d,%r15d
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm0
  movapd %xmm1,%xmm2
L165:
  lea    -0x3(%rdi),%esi
  cmp    %esi,%r15d
  jge    L69
  lea    -0x4(%rdi),%r12d
  mov    %r9,%rsi
  sub    %r15d,%r12d
  shr    $0x2,%r12d
  lea    0x1(%r12),%r13d
  shl    $0x7,%r13
  lea    (%rcx,%r13,1),%r10
  nopl   0x0(%rax,%rax,1)
L96:
  movsd  (%rsi),%xmm5
  movsd  (%rcx),%xmm6
  sub    $0xffffffffffffff80,%rcx
  sub    $0xffffffffffffff80,%rsi
  movsd  -0x78(%rcx),%xmm7
  movsd  -0x78(%rsi),%xmm4
  movapd %xmm5,%xmm8
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm8
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  movsd  -0x58(%rcx),%xmm7
  addsd  %xmm5,%xmm0
  movsd  -0x60(%rsi),%xmm5
  addsd  %xmm8,%xmm2
  addsd  %xmm6,%xmm3
  movsd  -0x60(%rcx),%xmm6
  movapd %xmm5,%xmm8
  addsd  %xmm4,%xmm1
  movsd  -0x58(%rsi),%xmm4
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm8
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  addsd  %xmm5,%xmm0
  movsd  -0x40(%rsi),%xmm5
  addsd  %xmm8,%xmm2
  movsd  -0x38(%rcx),%xmm8
  addsd  %xmm6,%xmm3
  movsd  -0x40(%rcx),%xmm6
  movapd %xmm5,%xmm7
  addsd  %xmm4,%xmm1
  movsd  -0x38(%rsi),%xmm4
  mulsd  %xmm8,%xmm5
  mulsd  %xmm6,%xmm7
  mulsd  %xmm4,%xmm6
  mulsd  %xmm8,%xmm4
  movsd  -0x18(%rcx),%xmm8
  addsd  %xmm0,%xmm5
  movsd  -0x20(%rsi),%xmm0
  addsd  %xmm2,%xmm7
  addsd  %xmm3,%xmm6
  movsd  -0x20(%rcx),%xmm3
  movapd %xmm0,%xmm2
  addsd  %xmm1,%xmm4
  movsd  -0x18(%rsi),%xmm1
  mulsd  %xmm8,%xmm0
  mulsd  %xmm3,%xmm2
  mulsd  %xmm1,%xmm3
  mulsd  %xmm8,%xmm1
  addsd  %xmm5,%xmm0
  addsd  %xmm7,%xmm2
  addsd  %xmm6,%xmm3
  addsd  %xmm4,%xmm1
  cmp    %r10,%rcx
  jne    L96
  add    %r13,%r9
  lea    0x4(%r15,%r12,4),%r15d
L112:
  cmp    %r15d,%edi
  jle    L97
  lea    -0x1(%rdi),%esi
  xor    %ecx,%ecx
  sub    %r15d,%esi
  add    $0x1,%rsi
  shl    $0x5,%rsi
L48:
  movsd  (%r9,%rcx,1),%xmm5
  movsd  0x8(%r9,%rcx,1),%xmm4
  movsd  (%r10,%rcx,1),%xmm6
  movsd  0x8(%r10,%rcx,1),%xmm7
  add    $0x20,%rcx
  movapd %xmm5,%xmm8
  mulsd  %xmm6,%xmm8
  mulsd  %xmm7,%xmm5
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  addsd  %xmm8,%xmm2
  addsd  %xmm5,%xmm0
  addsd  %xmm6,%xmm3
  addsd  %xmm4,%xmm1
  cmp    %rcx,%rsi
  jne    L48
L97:
  cmp    $0x3,%r8d
  jle    L167
  lea    -0x4(%r8),%ecx
  shr    $0x2,%ecx
  add    $0x1,%ecx
  shl    $0x7,%rcx
  add    %rax,%rcx
  nopl   (%rax)
L136:
  movsd  (%rdx),%xmm5
  movsd  (%rax),%xmm6
  sub    $0xffffffffffffff80,%rax
  sub    $0xffffffffffffff80,%rdx
  movsd  -0x78(%rax),%xmm7
  movsd  -0x78(%rdx),%xmm4
  movapd %xmm5,%xmm8
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm8
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  movsd  -0x58(%rax),%xmm7
  subsd  %xmm5,%xmm0
  movsd  -0x60(%rdx),%xmm5
  subsd  %xmm8,%xmm2
  subsd  %xmm6,%xmm3
  movsd  -0x60(%rax),%xmm6
  movapd %xmm5,%xmm8
  subsd  %xmm4,%xmm1
  movsd  -0x58(%rdx),%xmm4
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm8
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  movsd  -0x38(%rax),%xmm7
  subsd  %xmm5,%xmm0
  movsd  -0x40(%rdx),%xmm5
  subsd  %xmm8,%xmm2
  subsd  %xmm6,%xmm3
  movsd  -0x40(%rax),%xmm6
  movapd %xmm5,%xmm8
  subsd  %xmm4,%xmm1
  movsd  -0x38(%rdx),%xmm4
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm8
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  movsd  -0x18(%rax),%xmm7
  subsd  %xmm5,%xmm0
  movsd  -0x20(%rdx),%xmm5
  subsd  %xmm8,%xmm2
  subsd  %xmm6,%xmm3
  movsd  -0x20(%rax),%xmm6
  movapd %xmm5,%xmm8
  subsd  %xmm4,%xmm1
  movsd  -0x18(%rdx),%xmm4
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm8
  mulsd  %xmm4,%xmm6
  mulsd  %xmm7,%xmm4
  subsd  %xmm5,%xmm0
  subsd  %xmm8,%xmm2
  subsd  %xmm6,%xmm3
  subsd  %xmm4,%xmm1
  cmp    %rcx,%rax
  jne    L136
L167:
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  je     L142
  mov    0x50(%rsp),%rax
  addsd  (%rax),%xmm2
  addsd  0x8(%rax),%xmm3
  addsd  0x20(%rax),%xmm0
  addsd  0x28(%rax),%xmm1
L142:
  movsd  (%r14),%xmm4
  mulsd  %xmm4,%xmm2
  movsd  %xmm2,0x0(%rbp)
  cmp    $0x1,%r11d
  jle    L13
  mulsd  %xmm4,%xmm3
  movsd  %xmm3,0x8(%rbp)
  cmp    $0x1,%ebx
  je     L56
  movsd  0x8(%r14),%xmm5
  movsd  0x10(%r14),%xmm4
  mulsd  %xmm5,%xmm2
  mulsd  %xmm5,%xmm3
  subsd  %xmm2,%xmm0
  subsd  %xmm3,%xmm1
  mulsd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm4
  movsd  %xmm0,0x20(%rbp)
  movsd  %xmm4,0x28(%rbp)
L56:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L71:
  movsd  (%r9),%xmm0
  movsd  (%rcx),%xmm2
  pxor   %xmm4,%xmm4
  mulsd  %xmm0,%xmm2
  mulsd  0x8(%rcx),%xmm0
  addsd  %xmm4,%xmm2
  addsd  %xmm4,%xmm0
  cmp    $0x1,%edi
  je     L162
  movsd  0x20(%r9),%xmm5
  movsd  0x28(%r9),%xmm1
  add    $0x40,%rcx
  add    $0x40,%r9
  movsd  -0x20(%rcx),%xmm3
  movsd  -0x18(%rcx),%xmm6
  mov    $0x2,%r15d
  movapd %xmm5,%xmm7
  mulsd  %xmm3,%xmm7
  mulsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm3
  mulsd  %xmm6,%xmm1
  addsd  %xmm7,%xmm2
  addsd  %xmm5,%xmm0
  addsd  %xmm4,%xmm3
  addsd  %xmm4,%xmm1
  jmp    L165
  nopl   0x0(%rax)
L13:
  cmp    $0x1,%ebx
  je     L56
  mulsd  0x8(%r14),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  0x10(%r14),%xmm0
  movsd  %xmm0,0x20(%rbp)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L160:
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm0
  movapd %xmm1,%xmm2
  jmp    L97
L162:
  movapd %xmm4,%xmm1
  movapd %xmm4,%xmm3
  jmp    L97
L69:
  mov    %rcx,%r10
  jmp    L112
```

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;
}
```