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

```asm
<kernel_dgemm_diag_left_3_lib4>:
  endbr64
  mov    %rsi,%r10
  mov    %rdx,%rax
  mov    %rcx,%rsi
  test   %edi,%edi
  jle    L64
  movsd  (%r10),%xmm0
  movsd  0x8(%r10),%xmm1
  lea    -0x3(%rdi),%edx
  movsd  0x10(%r10),%xmm2
  cmp    $0xffffffff,%r9d
  je     L20
  test   %r9d,%r9d
  jne    L44
  test   %edx,%edx
  jle    L33
  lea    -0x4(%rdi),%r9d
  mov    %r8,%rdx
  shr    $0x2,%r9d
  lea    0x1(%r9),%esi
  mov    %rsi,%r9
  shl    $0x7,%rsi
  lea    (%rax,%rsi,1),%rcx
  xchg   %ax,%ax
L34:
  movsd  0x8(%rax),%xmm4
  movsd  (%rax),%xmm5
  sub    $0xffffffffffffff80,%rax
  sub    $0xffffffffffffff80,%rdx
  movsd  -0x70(%rax),%xmm3
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  mulsd  %xmm0,%xmm5
  movsd  %xmm4,-0x78(%rdx)
  movsd  %xmm3,-0x70(%rdx)
  movsd  %xmm5,-0x80(%rdx)
  movsd  -0x58(%rax),%xmm4
  movsd  -0x50(%rax),%xmm3
  movsd  -0x60(%rax),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  mulsd  %xmm0,%xmm5
  movsd  %xmm4,-0x58(%rdx)
  movsd  %xmm3,-0x50(%rdx)
  movsd  %xmm5,-0x60(%rdx)
  movsd  -0x38(%rax),%xmm4
  movsd  -0x30(%rax),%xmm3
  movsd  -0x40(%rax),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  mulsd  %xmm0,%xmm5
  movsd  %xmm4,-0x38(%rdx)
  movsd  %xmm3,-0x30(%rdx)
  movsd  %xmm5,-0x40(%rdx)
  movsd  -0x18(%rax),%xmm4
  movsd  -0x10(%rax),%xmm3
  movsd  -0x20(%rax),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  mulsd  %xmm0,%xmm5
  movsd  %xmm4,-0x18(%rdx)
  movsd  %xmm3,-0x10(%rdx)
  movsd  %xmm5,-0x20(%rdx)
  cmp    %rax,%rcx
  jne    L34
  shl    $0x2,%r9d
  add    %rsi,%r8
  cmp    %r9d,%edi
  jle    L88
L2:
  movsd  (%rcx),%xmm5
  add    $0x1,%r9d
  add    $0x20,%rcx
  add    $0x20,%r8
  movsd  -0x18(%rcx),%xmm4
  movsd  -0x10(%rcx),%xmm3
  mulsd  %xmm0,%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  movsd  %xmm5,-0x20(%r8)
  movsd  %xmm4,-0x18(%r8)
  movsd  %xmm3,-0x10(%r8)
  cmp    %r9d,%edi
  jg     L2
  ret
  cs nopw 0x0(%rax,%rax,1)
L20:
  movq   D2(%rip),%xmm3
  xorpd  %xmm3,%xmm0
  xorpd  %xmm3,%xmm1
  xorpd  %xmm3,%xmm2
L44:
  mov    %r8,%r9
  xor    %r10d,%r10d
  test   %edx,%edx
  jle    L101
  lea    -0x4(%rdi),%r10d
  mov    %rsi,%rcx
  mov    %rax,%rdx
  shr    $0x2,%r10d
  lea    0x1(%r10),%r11d
  mov    %r11,%r10
  shl    $0x7,%r11
  lea    (%r8,%r11,1),%r9
  nop
L11:
  movsd  (%rdx),%xmm5
  sub    $0xffffffffffffff80,%r8
  sub    $0xffffffffffffff80,%rdx
  sub    $0xffffffffffffff80,%rcx
  movsd  -0x78(%rdx),%xmm4
  movsd  -0x70(%rdx),%xmm3
  mulsd  %xmm0,%xmm5
  mulsd  %xmm1,%xmm4
  addsd  -0x80(%rcx),%xmm5
  mulsd  %xmm2,%xmm3
  addsd  -0x78(%rcx),%xmm4
  addsd  -0x70(%rcx),%xmm3
  movsd  %xmm5,-0x80(%r8)
  movsd  %xmm4,-0x78(%r8)
  movsd  %xmm3,-0x70(%r8)
  movsd  -0x58(%rdx),%xmm4
  movsd  -0x50(%rdx),%xmm3
  movsd  -0x60(%rdx),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  addsd  -0x58(%rcx),%xmm4
  mulsd  %xmm0,%xmm5
  addsd  -0x50(%rcx),%xmm3
  addsd  -0x60(%rcx),%xmm5
  movsd  %xmm4,-0x58(%r8)
  movsd  %xmm3,-0x50(%r8)
  movsd  %xmm5,-0x60(%r8)
  movsd  -0x38(%rdx),%xmm4
  movsd  -0x30(%rdx),%xmm3
  movsd  -0x40(%rdx),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  addsd  -0x38(%rcx),%xmm4
  mulsd  %xmm0,%xmm5
  addsd  -0x30(%rcx),%xmm3
  addsd  -0x40(%rcx),%xmm5
  movsd  %xmm4,-0x38(%r8)
  movsd  %xmm3,-0x30(%r8)
  movsd  %xmm5,-0x40(%r8)
  movsd  -0x18(%rdx),%xmm4
  movsd  -0x10(%rdx),%xmm3
  movsd  -0x20(%rdx),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  addsd  -0x18(%rcx),%xmm4
  mulsd  %xmm0,%xmm5
  addsd  -0x10(%rcx),%xmm3
  addsd  -0x20(%rcx),%xmm5
  movsd  %xmm4,-0x18(%r8)
  movsd  %xmm3,-0x10(%r8)
  movsd  %xmm5,-0x20(%r8)
  cmp    %r9,%r8
  jne    L11
  shl    $0x2,%r10d
  add    %r11,%rax
  add    %r11,%rsi
  cmp    %r10d,%edi
  jle    L64
L101:
  xor    %edx,%edx
L94:
  movsd  0x8(%rax,%rdx,1),%xmm4
  movsd  0x10(%rax,%rdx,1),%xmm3
  add    $0x1,%r10d
  movsd  (%rax,%rdx,1),%xmm5
  mulsd  %xmm1,%xmm4
  mulsd  %xmm2,%xmm3
  addsd  0x8(%rsi,%rdx,1),%xmm4
  mulsd  %xmm0,%xmm5
  addsd  0x10(%rsi,%rdx,1),%xmm3
  addsd  (%rsi,%rdx,1),%xmm5
  movsd  %xmm4,0x8(%r9,%rdx,1)
  movsd  %xmm3,0x10(%r9,%rdx,1)
  movsd  %xmm5,(%r9,%rdx,1)
  add    $0x20,%rdx
  cmp    %r10d,%edi
  jg     L94
L64:
  ret
  nopl   (%rax)
L88:
  ret
  nopl   0x0(%rax)
L33:
  mov    %rax,%rcx
  jmp    L2
```

tool_calls: name: parse_data
arguments: tag: D2
datatype: byte[8]

tool: {"D2": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

assistant: ```c
void kernel_dgemm_diag_left_3_lib4(int kmax, double *A, double *B, double *C, double *D, int alg) {
  if (kmax <= 0)
    return;
  const int bs = 4;
  int k;
  double a_0, a_1, a_2, b_0, b_1, b_2, c_0, c_1, c_2;
  if (alg == -1) {
    a_0 = -A[0];
    a_1 = -A[1];
    a_2 = -A[2];
  } else {
    a_0 = A[0];
    a_1 = A[1];
    a_2 = A[2];
  }
  if (alg == 0) {
    for (k = 0; k < kmax - 3; k += 4) {
      b_0 = B[0 + bs * 0];
      b_1 = B[1 + bs * 0];
      b_2 = B[2 + bs * 0];
      c_0 = a_0 * b_0;
      c_1 = a_1 * b_1;
      c_2 = a_2 * b_2;
      D[0 + bs * 0] = c_0;
      D[1 + bs * 0] = c_1;
      D[2 + bs * 0] = c_2;
      b_0 = B[0 + bs * 1];
      b_1 = B[1 + bs * 1];
      b_2 = B[2 + bs * 1];
      c_0 = a_0 * b_0;
      c_1 = a_1 * b_1;
      c_2 = a_2 * b_2;
      D[0 + bs * 1] = c_0;
      D[1 + bs * 1] = c_1;
      D[2 + bs * 1] = c_2;
      b_0 = B[0 + bs * 2];
      b_1 = B[1 + bs * 2];
      b_2 = B[2 + bs * 2];
      c_0 = a_0 * b_0;
      c_1 = a_1 * b_1;
      c_2 = a_2 * b_2;
      D[0 + bs * 2] = c_0;
      D[1 + bs * 2] = c_1;
      D[2 + bs * 2] = c_2;
      b_0 = B[0 + bs * 3];
      b_1 = B[1 + bs * 3];
      b_2 = B[2 + bs * 3];
      c_0 = a_0 * b_0;
      c_1 = a_1 * b_1;
      c_2 = a_2 * b_2;
      D[0 + bs * 3] = c_0;
      D[1 + bs * 3] = c_1;
      D[2 + bs * 3] = c_2;
      B += 16;
      D += 16;
    }
    for (; k < kmax; k++) {
      b_0 = B[0 + bs * 0];
      b_1 = B[1 + bs * 0];
      b_2 = B[2 + bs * 0];
      c_0 = a_0 * b_0;
      c_1 = a_1 * b_1;
      c_2 = a_2 * b_2;
      D[0 + bs * 0] = c_0;
      D[1 + bs * 0] = c_1;
      D[2 + bs * 0] = c_2;
      B += 4;
      D += 4;
    }
  } else {
    for (k = 0; k < kmax - 3; k += 4) {
      b_0 = B[0 + bs * 0];
      b_1 = B[1 + bs * 0];
      b_2 = B[2 + bs * 0];
      c_0 = C[0 + bs * 0] + a_0 * b_0;
      c_1 = C[1 + bs * 0] + a_1 * b_1;
      c_2 = C[2 + bs * 0] + a_2 * b_2;
      D[0 + bs * 0] = c_0;
      D[1 + bs * 0] = c_1;
      D[2 + bs * 0] = c_2;
      b_0 = B[0 + bs * 1];
      b_1 = B[1 + bs * 1];
      b_2 = B[2 + bs * 1];
      c_0 = C[0 + bs * 1] + a_0 * b_0;
      c_1 = C[1 + bs * 1] + a_1 * b_1;
      c_2 = C[2 + bs * 1] + a_2 * b_2;
      D[0 + bs * 1] = c_0;
      D[1 + bs * 1] = c_1;
      D[2 + bs * 1] = c_2;
      b_0 = B[0 + bs * 2];
      b_1 = B[1 + bs * 2];
      b_2 = B[2 + bs * 2];
      c_0 = C[0 + bs * 2] + a_0 * b_0;
      c_1 = C[1 + bs * 2] + a_1 * b_1;
      c_2 = C[2 + bs * 2] + a_2 * b_2;
      D[0 + bs * 2] = c_0;
      D[1 + bs * 2] = c_1;
      D[2 + bs * 2] = c_2;
      b_0 = B[0 + bs * 3];
      b_1 = B[1 + bs * 3];
      b_2 = B[2 + bs * 3];
      c_0 = C[0 + bs * 3] + a_0 * b_0;
      c_1 = C[1 + bs * 3] + a_1 * b_1;
      c_2 = C[2 + bs * 3] + a_2 * b_2;
      D[0 + bs * 3] = c_0;
      D[1 + bs * 3] = c_1;
      D[2 + bs * 3] = c_2;
      B += 16;
      C += 16;
      D += 16;
    }
    for (; k < kmax; k++) {
      b_0 = B[0 + bs * 0];
      b_1 = B[1 + bs * 0];
      b_2 = B[2 + bs * 0];
      c_0 = C[0 + bs * 0] + a_0 * b_0;
      c_1 = C[1 + bs * 0] + a_1 * b_1;
      c_2 = C[2 + bs * 0] + a_2 * b_2;
      D[0 + bs * 0] = c_0;
      D[1 + bs * 0] = c_1;
      D[2 + bs * 0] = c_2;
      B += 4;
      C += 4;
      D += 4;
    }
  }
}
```