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

```asm
<kernel_dsyrk_nn_4x4_lib4>:
  endbr64
  push   %rbp
  mov    %rsi,%r11
  mov    %edi,%r10d
  mov    %rdx,%rsi
  push   %rbx
  mov    0x18(%rsp),%ebp
  cmp    $0x3,%edi
  jle    L17
  shl    $0x2,%ecx
  lea    -0x4(%r10),%ebx
  pxor   %xmm5,%xmm5
  mov    %r11,%rax
  pxor   %xmm15,%xmm15
  movslq %ecx,%rdi
  shr    $0x2,%ebx
  xor    %ecx,%ecx
  movsd  %xmm15,-0x18(%rsp)
  shl    $0x3,%rdi
  add    $0x1,%ebx
  movsd  %xmm15,-0x10(%rsp)
  movapd %xmm5,%xmm15
  movaps %xmm5,-0x48(%rsp)
  movaps %xmm5,-0x38(%rsp)
  movaps %xmm5,-0x28(%rsp)
L32:
  movupd (%rax),%xmm1
  movupd (%rdx),%xmm10
  add    $0x1,%ecx
  sub    $0xffffffffffffff80,%rax
  movupd -0x60(%rax),%xmm8
  movlpd -0x78(%rax),%xmm8
  movhpd -0x60(%rax),%xmm1
  movupd -0x40(%rax),%xmm0
  movupd 0x10(%rdx),%xmm9
  mulpd  %xmm10,%xmm1
  movapd %xmm8,%xmm14
  movupd -0x20(%rax),%xmm7
  movlpd -0x38(%rax),%xmm7
  mulpd  %xmm10,%xmm14
  movhpd -0x20(%rax),%xmm0
  movupd -0x70(%rax),%xmm4
  movupd -0x50(%rax),%xmm6
  mulpd  %xmm9,%xmm0
  movapd %xmm7,%xmm13
  movlpd -0x68(%rax),%xmm6
  movupd -0x30(%rax),%xmm3
  mulpd  %xmm9,%xmm13
  movhpd -0x50(%rax),%xmm4
  movupd -0x10(%rax),%xmm5
  movlpd -0x28(%rax),%xmm5
  movapd %xmm4,%xmm12
  movhpd -0x10(%rax),%xmm3
  mulpd  %xmm10,%xmm12
  movapd %xmm1,%xmm2
  movapd %xmm3,%xmm11
  mulpd  %xmm6,%xmm10
  unpcklpd %xmm14,%xmm2
  addpd  -0x28(%rsp),%xmm2
  mulpd  %xmm9,%xmm11
  unpckhpd %xmm14,%xmm1
  mulpd  %xmm5,%xmm9
  addpd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  unpckhpd %xmm13,%xmm0
  unpcklpd %xmm13,%xmm1
  addpd  %xmm2,%xmm1
  movapd %xmm1,%xmm2
  movapd %xmm11,%xmm1
  unpckhpd %xmm9,%xmm11
  addpd  %xmm0,%xmm2
  movapd %xmm12,%xmm0
  unpckhpd %xmm10,%xmm12
  unpcklpd %xmm10,%xmm0
  unpcklpd %xmm9,%xmm1
  movapd %xmm3,%xmm10
  addpd  %xmm15,%xmm0
  movaps %xmm2,-0x28(%rsp)
  movupd 0x50(%rdx),%xmm2
  addpd  %xmm12,%xmm0
  mulpd  %xmm2,%xmm3
  addpd  %xmm1,%xmm0
  movupd 0x20(%rdx),%xmm1
  mulpd  %xmm1,%xmm8
  addpd  %xmm11,%xmm0
  movapd %xmm4,%xmm11
  mulpd  %xmm1,%xmm11
  mulpd  %xmm6,%xmm1
  movapd %xmm0,%xmm15
  movupd 0x30(%rdx),%xmm0
  movapd %xmm8,%xmm9
  mulpd  %xmm0,%xmm7
  mulpd  %xmm0,%xmm10
  unpcklpd %xmm11,%xmm9
  unpckhpd %xmm11,%xmm8
  addpd  -0x38(%rsp),%xmm9
  mulpd  %xmm5,%xmm0
  addpd  %xmm8,%xmm9
  movapd %xmm7,%xmm8
  unpcklpd %xmm10,%xmm8
  unpckhpd %xmm10,%xmm7
  movupd 0x40(%rdx),%xmm10
  addpd  %xmm8,%xmm9
  mulpd  %xmm6,%xmm10
  addpd  %xmm7,%xmm9
  movsd  -0x18(%rsp),%xmm7
  addsd  %xmm1,%xmm7
  unpckhpd %xmm1,%xmm1
  movaps %xmm9,-0x38(%rsp)
  movupd 0x40(%rdx),%xmm9
  mulpd  %xmm4,%xmm9
  addsd  %xmm1,%xmm7
  movapd %xmm2,%xmm1
  mulpd  %xmm5,%xmm1
  addsd  %xmm0,%xmm7
  unpckhpd %xmm0,%xmm0
  movapd %xmm9,%xmm4
  unpckhpd %xmm10,%xmm9
  unpcklpd %xmm10,%xmm4
  addpd  -0x48(%rsp),%xmm4
  addsd  %xmm0,%xmm7
  addpd  %xmm9,%xmm4
  movapd %xmm3,%xmm9
  unpckhpd %xmm1,%xmm3
  unpcklpd %xmm1,%xmm9
  addpd  %xmm9,%xmm4
  addpd  %xmm3,%xmm4
  movupd 0x70(%rdx),%xmm3
  mulpd  %xmm5,%xmm3
  movaps %xmm4,-0x48(%rsp)
  movupd 0x60(%rdx),%xmm4
  movsd  -0x10(%rsp),%xmm1
  add    %rdi,%rdx
  movsd  %xmm7,-0x18(%rsp)
  mulpd  %xmm6,%xmm4
  addsd  %xmm4,%xmm1
  unpckhpd %xmm4,%xmm4
  addsd  %xmm4,%xmm1
  movapd %xmm1,%xmm0
  addsd  %xmm3,%xmm0
  unpckhpd %xmm3,%xmm3
  addsd  %xmm3,%xmm0
  movsd  %xmm0,-0x10(%rsp)
  cmp    %ecx,%ebx
  ja     L32
  mov    %ebx,%eax
  movapd -0x28(%rsp),%xmm2
  movapd %xmm15,%xmm12
  shl    $0x2,%ebx
  imul   %rax,%rdi
  mov    %rax,%rdx
  movapd %xmm0,%xmm15
  shl    $0x7,%rdx
  add    %rdx,%r11
  add    %rdi,%rsi
L21:
  cmp    %ebx,%r10d
  jle    L73
  sub    %ebx,%r10d
  cmp    $0x1,%r10d
  je     L6
  movupd (%r11),%xmm1
  movupd 0x10(%r11),%xmm0
  mov    %r10d,%eax
  movlpd 0x8(%r11),%xmm0
  movupd 0x20(%r11),%xmm7
  shr    %eax
  movupd 0x30(%r11),%xmm4
  movupd (%rsi),%xmm6
  movhpd 0x10(%r11),%xmm1
  movlpd 0x28(%r11),%xmm4
  movhpd 0x30(%r11),%xmm7
  movapd %xmm0,%xmm5
  movapd %xmm1,%xmm3
  unpcklpd %xmm7,%xmm1
  unpckhpd %xmm7,%xmm3
  unpcklpd %xmm4,%xmm5
  movapd %xmm3,%xmm7
  unpckhpd %xmm4,%xmm0
  movupd 0x20(%rsi),%xmm4
  mulpd  %xmm6,%xmm1
  movapd %xmm5,%xmm8
  mulpd  %xmm6,%xmm8
  mulpd  %xmm6,%xmm7
  mulpd  %xmm0,%xmm6
  mulpd  %xmm4,%xmm5
  movapd %xmm1,%xmm9
  unpcklpd %xmm8,%xmm9
  unpckhpd %xmm8,%xmm1
  addpd  %xmm9,%xmm2
  movapd %xmm7,%xmm8
  unpcklpd %xmm6,%xmm8
  unpckhpd %xmm6,%xmm7
  addpd  %xmm12,%xmm8
  addpd  %xmm1,%xmm2
  movapd %xmm8,%xmm12
  movapd %xmm2,%xmm1
  addpd  %xmm7,%xmm12
  movapd %xmm2,%xmm10
  unpckhpd %xmm1,%xmm1
  movapd %xmm1,%xmm9
  movapd %xmm3,%xmm1
  mulpd  %xmm4,%xmm1
  movapd %xmm12,%xmm6
  movapd %xmm12,%xmm8
  mulpd  %xmm0,%xmm4
  unpckhpd %xmm6,%xmm6
  movapd %xmm6,%xmm7
  movapd %xmm5,%xmm6
  unpcklpd %xmm1,%xmm6
  unpckhpd %xmm1,%xmm5
  movsd  -0x18(%rsp),%xmm1
  addpd  -0x38(%rsp),%xmm6
  addsd  %xmm4,%xmm1
  unpckhpd %xmm4,%xmm4
  addpd  %xmm5,%xmm6
  addsd  %xmm1,%xmm4
  movupd 0x40(%rsi),%xmm1
  movapd %xmm6,%xmm5
  movaps %xmm6,-0x38(%rsp)
  mulpd  %xmm1,%xmm3
  unpckhpd %xmm5,%xmm5
  mulpd  %xmm0,%xmm1
  movsd  %xmm4,-0x18(%rsp)
  movapd -0x48(%rsp),%xmm4
  movapd %xmm3,%xmm13
  unpcklpd %xmm1,%xmm13
  unpckhpd %xmm1,%xmm3
  addpd  %xmm13,%xmm4
  movapd %xmm4,%xmm1
  addpd  %xmm3,%xmm1
  movupd 0x60(%rsi),%xmm3
  mulpd  %xmm3,%xmm0
  movaps %xmm1,-0x48(%rsp)
  movapd %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm15,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm15
  cmp    $0x1,%eax
  je     L99
  movupd 0x50(%r11),%xmm0
  movlpd 0x48(%r11),%xmm0
  movupd 0x70(%r11),%xmm11
  movlpd 0x68(%r11),%xmm11
  movapd %xmm0,%xmm13
  movupd 0x40(%r11),%xmm3
  movupd 0x60(%r11),%xmm2
  unpcklpd %xmm11,%xmm13
  unpckhpd %xmm11,%xmm0
  movupd 0x30(%rsi),%xmm14
  movapd %xmm13,%xmm4
  movhpd 0x50(%r11),%xmm3
  movupd 0x10(%rsi),%xmm13
  movhpd 0x70(%r11),%xmm2
  movapd %xmm3,%xmm1
  unpckhpd %xmm2,%xmm3
  unpcklpd %xmm2,%xmm1
  movapd %xmm13,%xmm12
  mulpd  %xmm13,%xmm1
  mulpd  %xmm4,%xmm12
  mulpd  %xmm14,%xmm4
  movapd %xmm1,%xmm2
  unpckhpd %xmm1,%xmm1
  movapd %xmm12,%xmm11
  addsd  %xmm10,%xmm2
  unpckhpd %xmm12,%xmm12
  addsd  %xmm9,%xmm11
  addsd  %xmm4,%xmm6
  unpckhpd %xmm4,%xmm4
  addsd  %xmm1,%xmm2
  addsd  %xmm12,%xmm11
  addsd  %xmm4,%xmm6
  unpcklpd %xmm11,%xmm2
  movapd %xmm13,%xmm11
  mulpd  %xmm3,%xmm11
  mulpd  %xmm0,%xmm13
  movapd %xmm11,%xmm9
  unpckhpd %xmm11,%xmm11
  movapd %xmm13,%xmm1
  addsd  %xmm8,%xmm9
  movapd %xmm13,%xmm10
  addsd  %xmm7,%xmm1
  movapd %xmm14,%xmm7
  unpckhpd %xmm10,%xmm10
  mulpd  %xmm3,%xmm7
  addsd  %xmm11,%xmm9
  mulpd  %xmm0,%xmm14
  addsd  %xmm10,%xmm1
  movapd %xmm9,%xmm12
  addsd  %xmm7,%xmm5
  unpcklpd %xmm1,%xmm12
  movapd %xmm7,%xmm1
  unpckhpd %xmm1,%xmm1
  movapd %xmm6,%xmm7
  movupd 0x50(%rsi),%xmm6
  addsd  %xmm1,%xmm5
  mulpd  %xmm6,%xmm3
  movsd  -0x18(%rsp),%xmm1
  mulpd  %xmm0,%xmm6
  addsd  %xmm14,%xmm1
  unpckhpd %xmm14,%xmm14
  unpcklpd %xmm5,%xmm7
  movupd 0x70(%rsi),%xmm5
  movaps %xmm7,-0x38(%rsp)
  mulpd  %xmm5,%xmm0
  addsd  %xmm1,%xmm14
  movapd %xmm3,%xmm4
  unpcklpd %xmm6,%xmm4
  addpd  -0x48(%rsp),%xmm4
  unpckhpd %xmm6,%xmm3
  movsd  %xmm14,-0x18(%rsp)
  addpd  %xmm3,%xmm4
  movapd %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm15,%xmm1
  movaps %xmm4,-0x48(%rsp)
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm15
L99:
  mov    %r10d,%eax
  and    $0xfffffffe,%eax
  mov    %eax,%edx
  mov    %rdx,%rcx
  lea    (%rsi,%rdx,8),%rsi
  shl    $0x5,%rcx
  add    %rcx,%r11
  cmp    %r10d,%eax
  je     L73
L6:
  movupd (%rsi),%xmm0
  movupd (%r11),%xmm4
  movupd 0x10(%r11),%xmm3
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm0,%xmm4
  movapd %xmm3,%xmm6
  mulpd  %xmm3,%xmm0
  unpckhpd %xmm6,%xmm6
  movapd %xmm6,%xmm1
  mulsd  0x60(%rsi),%xmm1
  addpd  %xmm4,%xmm2
  movupd 0x20(%rsi),%xmm4
  addpd  %xmm0,%xmm12
  movupd 0x8(%r11),%xmm0
  unpcklpd %xmm4,%xmm4
  mulpd  %xmm4,%xmm0
  addsd  %xmm1,%xmm15
  addpd  -0x38(%rsp),%xmm0
  movaps %xmm0,-0x38(%rsp)
  movupd 0x40(%rsi),%xmm0
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm3,%xmm0
  addpd  -0x48(%rsp),%xmm0
  movaps %xmm0,-0x48(%rsp)
  movsd  0x20(%rsi),%xmm0
  mulsd  %xmm6,%xmm0
  addsd  -0x18(%rsp),%xmm0
  movsd  %xmm0,-0x18(%rsp)
L73:
  test   %ebp,%ebp
  je     L63
  movupd (%r8),%xmm4
  movupd 0x10(%r8),%xmm3
  movupd 0x28(%r8),%xmm5
  movsd  0x38(%r8),%xmm1
  movupd 0x50(%r8),%xmm6
  movsd  0x78(%r8),%xmm0
  cmp    $0x1,%ebp
  je     L25
  subpd  -0x48(%rsp),%xmm6
  subpd  -0x38(%rsp),%xmm5
  subpd  %xmm2,%xmm4
  subpd  %xmm12,%xmm3
  subsd  -0x18(%rsp),%xmm1
  subsd  %xmm15,%xmm0
  movaps %xmm6,-0x48(%rsp)
  movaps %xmm5,-0x38(%rsp)
  movapd %xmm4,%xmm2
  movapd %xmm3,%xmm12
  movsd  %xmm1,-0x18(%rsp)
  movapd %xmm0,%xmm15
L63:
  movapd -0x38(%rsp),%xmm5
  movups %xmm2,(%r9)
  movups %xmm12,0x10(%r9)
  movups %xmm5,0x28(%r9)
  movsd  -0x18(%rsp),%xmm5
  movsd  %xmm15,0x78(%r9)
  movsd  %xmm5,0x38(%r9)
  movapd -0x48(%rsp),%xmm5
  pop    %rbx
  pop    %rbp
  movups %xmm5,0x50(%r9)
  ret
L25:
  addpd  -0x48(%rsp),%xmm6
  addpd  -0x38(%rsp),%xmm5
  addsd  -0x18(%rsp),%xmm1
  addpd  %xmm4,%xmm2
  addpd  %xmm3,%xmm12
  addsd  %xmm0,%xmm15
  movaps %xmm6,-0x48(%rsp)
  movaps %xmm5,-0x38(%rsp)
  movsd  %xmm1,-0x18(%rsp)
  jmp    L63
  nopw   0x0(%rax,%rax,1)
L17:
  pxor   %xmm5,%xmm5
  pxor   %xmm15,%xmm15
  xor    %ebx,%ebx
  movaps %xmm5,-0x48(%rsp)
  movapd %xmm5,%xmm12
  movapd %xmm5,%xmm2
  movaps %xmm5,-0x38(%rsp)
  movsd  %xmm15,-0x18(%rsp)
  jmp    L21
```

assistant: ```c
void kernel_dsyrk_nn_4x4_lib4(int kmax, double *A, double *B, int sdb, double *C, double *D, int alg) {
  const int bs = 4;
  int k;
  double a_0, a_1, a_2, a_3, b_0, b_1, b_2, b_3, c_00 = 0, c_10 = 0, c_11 = 0, c_20 = 0, c_21 = 0, c_22 = 0, c_30 = 0, c_31 = 0, c_32 = 0, c_33 = 0;
  for (k = 0; k < kmax - 3; k += 4) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    a_2 = A[2 + bs * 0];
    a_3 = A[3 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + bs * 1];
    b_2 = B[0 + bs * 2];
    b_3 = B[0 + bs * 3];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_20 += a_2 * b_0;
    c_30 += a_3 * b_0;
    c_11 += a_1 * b_1;
    c_21 += a_2 * b_1;
    c_31 += a_3 * b_1;
    c_22 += a_2 * b_2;
    c_32 += a_3 * b_2;
    c_33 += a_3 * b_3;
    a_0 = A[0 + bs * 1];
    a_1 = A[1 + bs * 1];
    a_2 = A[2 + bs * 1];
    a_3 = A[3 + bs * 1];
    b_0 = B[1 + bs * 0];
    b_1 = B[1 + bs * 1];
    b_2 = B[1 + bs * 2];
    b_3 = B[1 + bs * 3];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_20 += a_2 * b_0;
    c_30 += a_3 * b_0;
    c_11 += a_1 * b_1;
    c_21 += a_2 * b_1;
    c_31 += a_3 * b_1;
    c_22 += a_2 * b_2;
    c_32 += a_3 * b_2;
    c_33 += a_3 * b_3;
    a_0 = A[0 + bs * 2];
    a_1 = A[1 + bs * 2];
    a_2 = A[2 + bs * 2];
    a_3 = A[3 + bs * 2];
    b_0 = B[2 + bs * 0];
    b_1 = B[2 + bs * 1];
    b_2 = B[2 + bs * 2];
    b_3 = B[2 + bs * 3];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_20 += a_2 * b_0;
    c_30 += a_3 * b_0;
    c_11 += a_1 * b_1;
    c_21 += a_2 * b_1;
    c_31 += a_3 * b_1;
    c_22 += a_2 * b_2;
    c_32 += a_3 * b_2;
    c_33 += a_3 * b_3;
    a_0 = A[0 + bs * 3];
    a_1 = A[1 + bs * 3];
    a_2 = A[2 + bs * 3];
    a_3 = A[3 + bs * 3];
    b_0 = B[3 + bs * 0];
    b_1 = B[3 + bs * 1];
    b_2 = B[3 + bs * 2];
    b_3 = B[3 + bs * 3];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_20 += a_2 * b_0;
    c_30 += a_3 * b_0;
    c_11 += a_1 * b_1;
    c_21 += a_2 * b_1;
    c_31 += a_3 * b_1;
    c_22 += a_2 * b_2;
    c_32 += a_3 * b_2;
    c_33 += a_3 * b_3;
    A += 16;
    B += 4 * sdb;
  }
  for (; k < kmax; k++) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    a_2 = A[2 + bs * 0];
    a_3 = A[3 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + bs * 1];
    b_2 = B[0 + bs * 2];
    b_3 = B[0 + bs * 3];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_20 += a_2 * b_0;
    c_30 += a_3 * b_0;
    c_11 += a_1 * b_1;
    c_21 += a_2 * b_1;
    c_31 += a_3 * b_1;
    c_22 += a_2 * b_2;
    c_32 += a_3 * b_2;
    c_33 += a_3 * b_3;
    A += 4;
    B += 1;
  }
  double d_00, d_10, d_11, d_20, d_21, d_22, d_30, d_31, d_32, d_33;
  if (alg == 0) {
    D[0 + bs * 0] = c_00;
    D[1 + bs * 0] = c_10;
    D[2 + bs * 0] = c_20;
    D[3 + bs * 0] = c_30;
    D[1 + bs * 1] = c_11;
    D[2 + bs * 1] = c_21;
    D[3 + bs * 1] = c_31;
    D[2 + bs * 2] = c_22;
    D[3 + bs * 2] = c_32;
    D[3 + bs * 3] = c_33;
  } else {
    d_00 = C[0 + bs * 0];
    d_10 = C[1 + bs * 0];
    d_20 = C[2 + bs * 0];
    d_30 = C[3 + bs * 0];
    d_11 = C[1 + bs * 1];
    d_21 = C[2 + bs * 1];
    d_31 = C[3 + bs * 1];
    d_22 = C[2 + bs * 2];
    d_32 = C[3 + bs * 2];
    d_33 = C[3 + bs * 3];
    if (alg == 1) {
      d_00 += c_00;
      d_10 += c_10;
      d_20 += c_20;
      d_30 += c_30;
      d_11 += c_11;
      d_21 += c_21;
      d_31 += c_31;
      d_22 += c_22;
      d_32 += c_32;
      d_33 += c_33;
    } else {
      d_00 -= c_00;
      d_10 -= c_10;
      d_20 -= c_20;
      d_30 -= c_30;
      d_11 -= c_11;
      d_21 -= c_21;
      d_31 -= c_31;
      d_22 -= c_22;
      d_32 -= c_32;
      d_33 -= c_33;
    }
    D[0 + bs * 0] = d_00;
    D[1 + bs * 0] = d_10;
    D[2 + bs * 0] = d_20;
    D[3 + bs * 0] = d_30;
    D[1 + bs * 1] = d_11;
    D[2 + bs * 1] = d_21;
    D[3 + bs * 1] = d_31;
    D[2 + bs * 2] = d_22;
    D[3 + bs * 2] = d_32;
    D[3 + bs * 3] = d_33;
  }
}
```