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

```asm
<kernel_dgemm_nn_2x2_vs_lib4>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%r10d
  mov    %edx,%r11d
  mov    %rcx,%rax
  mov    0x28(%rsp),%r12d
  mov    0x30(%rsp),%rbp
  mov    0x38(%rsp),%rbx
  cmp    $0x3,%edx
  jle    L71
  shl    $0x2,%r9d
  movslq %r9d,%rsi
  shl    $0x3,%rsi
  lea    -0x4(%rdx),%r9d
  shr    $0x2,%r9d
  lea    0x1(%r9),%r13d
  mov    %r13d,%r13d
  mov    %r13,%rcx
  shl    $0x7,%rcx
  add    %rax,%rcx
  mov    %r8,%rdx
  pxor   %xmm0,%xmm0
  movapd %xmm0,%xmm2
  movapd %xmm0,%xmm3
  movapd %xmm0,%xmm6
L6:
  movsd  (%rax),%xmm4
  movsd  0x8(%rax),%xmm1
  movsd  (%rdx),%xmm5
  movsd  0x20(%rdx),%xmm8
  movapd %xmm4,%xmm7
  mulsd  %xmm5,%xmm7
  addsd  %xmm6,%xmm7
  mulsd  %xmm1,%xmm5
  addsd  %xmm2,%xmm5
  mulsd  %xmm8,%xmm4
  addsd  %xmm3,%xmm4
  mulsd  %xmm8,%xmm1
  addsd  %xmm0,%xmm1
  movsd  0x20(%rax),%xmm2
  movsd  0x28(%rax),%xmm0
  movsd  0x8(%rdx),%xmm3
  movsd  0x28(%rdx),%xmm8
  movapd %xmm2,%xmm6
  mulsd  %xmm3,%xmm6
  addsd  %xmm7,%xmm6
  mulsd  %xmm0,%xmm3
  addsd  %xmm3,%xmm5
  mulsd  %xmm8,%xmm2
  addsd  %xmm2,%xmm4
  mulsd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  movsd  0x40(%rax),%xmm2
  movsd  0x48(%rax),%xmm0
  movsd  0x10(%rdx),%xmm3
  movsd  0x30(%rdx),%xmm8
  movapd %xmm2,%xmm7
  mulsd  %xmm3,%xmm7
  addsd  %xmm6,%xmm7
  mulsd  %xmm0,%xmm3
  addsd  %xmm3,%xmm5
  mulsd  %xmm8,%xmm2
  addsd  %xmm2,%xmm4
  mulsd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  movsd  0x60(%rax),%xmm3
  movsd  0x68(%rax),%xmm0
  movsd  0x18(%rdx),%xmm2
  movsd  0x38(%rdx),%xmm8
  movapd %xmm3,%xmm6
  mulsd  %xmm2,%xmm6
  addsd  %xmm7,%xmm6
  mulsd  %xmm0,%xmm2
  addsd  %xmm5,%xmm2
  mulsd  %xmm8,%xmm3
  addsd  %xmm4,%xmm3
  mulsd  %xmm8,%xmm0
  addsd  %xmm1,%xmm0
  sub    $0xffffffffffffff80,%rax
  add    %rsi,%rdx
  cmp    %rcx,%rax
  jne    L6
  imul   %r13,%rsi
  add    %rsi,%r8
  lea    0x4(,%r9,4),%edx
L189:
  cmp    %edx,%r11d
  jle    L11
  lea    -0x1(%r11),%eax
  sub    %edx,%eax
  lea    0x8(%r8,%rax,8),%rax
L60:
  movsd  (%rcx),%xmm4
  movsd  0x8(%rcx),%xmm1
  movsd  (%r8),%xmm5
  movsd  0x20(%r8),%xmm7
  movapd %xmm4,%xmm8
  mulsd  %xmm5,%xmm8
  addsd  %xmm8,%xmm6
  mulsd  %xmm1,%xmm5
  addsd  %xmm5,%xmm2
  mulsd  %xmm7,%xmm4
  addsd  %xmm4,%xmm3
  mulsd  %xmm7,%xmm1
  addsd  %xmm1,%xmm0
  add    $0x20,%rcx
  add    $0x8,%r8
  cmp    %rax,%r8
  jne    L60
L11:
  test   %r12d,%r12d
  jne    L143
  cmpl   $0x0,0x48(%rsp)
  je     L7
L145:
  cmp    $0x1,%r10d
  jle    L188
  movsd  %xmm6,(%rbx)
  movsd  %xmm3,0x8(%rbx)
  cmp    $0x1,%edi
  jle    L89
  movsd  %xmm2,0x20(%rbx)
  movsd  %xmm0,0x28(%rbx)
  jmp    L89
L71:
  pxor   %xmm0,%xmm0
  movapd %xmm0,%xmm2
  movapd %xmm0,%xmm3
  movapd %xmm0,%xmm6
  mov    $0x0,%edx
  jmp    L189
L143:
  cmpl   $0x0,0x40(%rsp)
  jne    L32
  movsd  0x0(%rbp),%xmm7
  movsd  0x8(%rbp),%xmm5
  movsd  0x20(%rbp),%xmm4
  movsd  0x28(%rbp),%xmm1
L160:
  cmp    $0x1,%r12d
  je     L178
  subsd  %xmm6,%xmm7
  movapd %xmm7,%xmm6
  subsd  %xmm2,%xmm5
  movapd %xmm5,%xmm2
  subsd  %xmm3,%xmm4
  movapd %xmm4,%xmm3
  subsd  %xmm0,%xmm1
  movapd %xmm1,%xmm0
L158:
  cmpl   $0x0,0x48(%rsp)
  jne    L145
L7:
  cmp    $0x1,%edi
  jle    L47
  movsd  %xmm6,(%rbx)
  movsd  %xmm2,0x8(%rbx)
  cmp    $0x1,%r10d
  jle    L89
  movsd  %xmm3,0x20(%rbx)
  movsd  %xmm0,0x28(%rbx)
L89:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L32:
  movsd  0x0(%rbp),%xmm7
  movsd  0x8(%rbp),%xmm4
  movsd  0x20(%rbp),%xmm5
  movsd  0x28(%rbp),%xmm1
  jmp    L160
L178:
  addsd  %xmm7,%xmm6
  addsd  %xmm5,%xmm2
  addsd  %xmm4,%xmm3
  addsd  %xmm1,%xmm0
  jmp    L158
L47:
  movsd  %xmm6,(%rbx)
  cmp    $0x1,%r10d
  jle    L89
  movsd  %xmm3,0x20(%rbx)
  jmp    L89
L188:
  movsd  %xmm6,(%rbx)
  cmp    $0x1,%edi
  jle    L89
  movsd  %xmm2,0x20(%rbx)
  jmp    L89
```

assistant: ```c
void kernel_dgemm_nn_2x2_vs_lib4(int km, int kn, int kmax, double *A, double *B, int sdb, int alg, double *C, double *D, int tc, int td) {
  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;
  for (k = 0; k < kmax - 3; k += 4) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + 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 = A[0 + bs * 1];
    a_1 = A[1 + bs * 1];
    b_0 = B[1 + bs * 0];
    b_1 = B[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 = A[0 + bs * 2];
    a_1 = A[1 + bs * 2];
    b_0 = B[2 + bs * 0];
    b_1 = B[2 + 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 = A[0 + bs * 3];
    a_1 = A[1 + bs * 3];
    b_0 = B[3 + bs * 0];
    b_1 = B[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;
    A += 16;
    B += 4 * sdb;
  }
  for (; k < kmax; k++) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + 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 += 4;
    B += 1;
  }
  double d_00, d_01, d_10, d_11;
  if (alg == 0) {
    if (td == 0) {
      goto store_n;
    } else {
      goto store_t;
    }
  } else {
    if (tc == 0) {
      d_00 = C[0 + bs * 0];
      d_10 = C[1 + bs * 0];
      d_01 = C[0 + bs * 1];
      d_11 = C[1 + bs * 1];
    } else {
      d_00 = C[0 + bs * 0];
      d_01 = C[1 + bs * 0];
      d_10 = C[0 + bs * 1];
      d_11 = C[1 + bs * 1];
    }
    if (alg == 1) {
      c_00 = d_00 + c_00;
      c_10 = d_10 + c_10;
      c_01 = d_01 + c_01;
      c_11 = d_11 + c_11;
    } else {
      c_00 = d_00 - c_00;
      c_10 = d_10 - c_10;
      c_01 = d_01 - c_01;
      c_11 = d_11 - c_11;
    }
    if (td == 0) {
      goto store_n;
    } else {
      goto store_t;
    }
  }
store_n:
  if (km >= 2) {
    D[0 + bs * 0] = c_00;
    D[1 + bs * 0] = c_10;
    if (kn >= 2) {
      D[0 + bs * 1] = c_01;
      D[1 + bs * 1] = c_11;
    }
  } else {
    D[0 + bs * 0] = c_00;
    if (kn >= 2) {
      D[0 + bs * 1] = c_01;
    }
  }
  return;
store_t:
  if (kn >= 2) {
    D[0 + bs * 0] = c_00;
    D[1 + bs * 0] = c_01;
    if (km >= 2) {
      D[0 + bs * 1] = c_10;
      D[1 + bs * 1] = c_11;
    }
  } else {
    D[0 + bs * 0] = c_00;
    if (km >= 2) {
      D[0 + bs * 1] = c_10;
    }
  }
  return;
}
```