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

```asm
<kernel_dgecp_3_2_lib4>:
  endbr64
  xor    %eax,%eax
  cmp    $0x1,%edi
  mov    %edi,%r10d
  sete   %al
  lea    (%rsi,%rax,1),%edi
  test   %edi,%edi
  jle    L47
  shl    $0x2,%ecx
  push   %rbx
  movslq %ecx,%rcx
  lea    (%rdx,%rcx,8),%r11
  cmp    $0x3,%edi
  jle    L7
  lea    -0x4(%rdi),%eax
  mov    %r11,%rcx
  shr    $0x2,%eax
  lea    0x1(%rax),%ebx
  mov    %r8,%rax
  mov    %rbx,%r9
  shl    $0x7,%rbx
  lea    (%rdx,%rbx,1),%rsi
  nopl   0x0(%rax,%rax,1)
L85:
  movsd  0x10(%rdx),%xmm0
  sub    $0xffffffffffffff80,%rdx
  sub    $0xffffffffffffff80,%rcx
  sub    $0xffffffffffffff80,%rax
  movsd  %xmm0,-0x80(%rax)
  movsd  -0x68(%rdx),%xmm0
  movsd  %xmm0,-0x78(%rax)
  movsd  -0x80(%rcx),%xmm0
  movsd  %xmm0,-0x70(%rax)
  movsd  -0x50(%rdx),%xmm0
  movsd  %xmm0,-0x60(%rax)
  movsd  -0x48(%rdx),%xmm0
  movsd  %xmm0,-0x58(%rax)
  movsd  -0x60(%rcx),%xmm0
  movsd  %xmm0,-0x50(%rax)
  movsd  -0x30(%rdx),%xmm0
  movsd  %xmm0,-0x40(%rax)
  movsd  -0x28(%rdx),%xmm0
  movsd  %xmm0,-0x38(%rax)
  movsd  -0x40(%rcx),%xmm0
  movsd  %xmm0,-0x30(%rax)
  movsd  -0x10(%rdx),%xmm0
  movsd  %xmm0,-0x20(%rax)
  movsd  -0x8(%rdx),%xmm0
  movsd  %xmm0,-0x18(%rax)
  movsd  -0x20(%rcx),%xmm0
  movsd  %xmm0,-0x10(%rax)
  cmp    %rsi,%rdx
  jne    L85
  lea    0x0(,%r9,4),%eax
  add    %rbx,%r11
  add    %rbx,%r8
  cmp    %edi,%eax
  jge    L8
L46:
  movsd  0x10(%rsi),%xmm0
  lea    0x1(%rax),%edx
  movsd  %xmm0,(%r8)
  movsd  0x18(%rsi),%xmm0
  movsd  %xmm0,0x8(%r8)
  movsd  (%r11),%xmm0
  movsd  %xmm0,0x10(%r8)
  cmp    %edx,%edi
  jle    L84
  movsd  0x30(%rsi),%xmm0
  lea    0x2(%rax),%edx
  movsd  %xmm0,0x20(%r8)
  movsd  0x38(%rsi),%xmm0
  movsd  %xmm0,0x28(%r8)
  movsd  0x20(%r11),%xmm0
  movsd  %xmm0,0x30(%r8)
  cmp    %edx,%edi
  jle    L84
  movsd  0x50(%rsi),%xmm0
  lea    0x3(%rax),%edx
  movsd  %xmm0,0x40(%r8)
  movsd  0x58(%rsi),%xmm0
  movsd  %xmm0,0x48(%r8)
  movsd  0x40(%r11),%xmm0
  movsd  %xmm0,0x50(%r8)
  cmp    %edx,%edi
  jle    L84
  movsd  0x70(%rsi),%xmm0
  movsd  %xmm0,0x60(%r8)
  movsd  0x78(%rsi),%xmm0
  movsd  %xmm0,0x68(%r8)
  movsd  0x60(%r11),%xmm0
  movsd  %xmm0,0x70(%r8)
L84:
  lea    -0x1(%rdi),%edx
  sub    %eax,%edx
  add    $0x1,%rdx
  shl    $0x5,%rdx
  cmp    %eax,%edi
  mov    $0x20,%eax
  cmovle %rax,%rdx
  add    %rdx,%rsi
  add    %rdx,%r11
  add    %rdx,%r8
L8:
  cmp    $0x1,%r10d
  je     L76
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L76:
  movsd  0x18(%rsi),%xmm0
  pop    %rbx
  movsd  %xmm0,0x8(%r8)
  movsd  (%r11),%xmm0
  movsd  %xmm0,0x10(%r8)
  movsd  0x20(%r11),%xmm0
  movsd  %xmm0,0x30(%r8)
  ret
  nopl   0x0(%rax)
L47:
  ret
  nopl   0x0(%rax)
L7:
  mov    %rdx,%rsi
  xor    %eax,%eax
  jmp    L46
```

assistant: ```c
void kernel_dgecp_3_2_lib4(int tri, int kmax, double *A0, int sda, double *B) {
  if (tri == 1) {
    kmax += 1;
  }
  if (kmax <= 0)
    return;
  const int bs = 4;
  double *A1 = A0 + bs * sda;
  int k;
  for (k = 0; k < kmax - 3; k += 4) {
    B[0 + bs * 0] = A0[2 + bs * 0];
    B[1 + bs * 0] = A0[3 + bs * 0];
    B[2 + bs * 0] = A1[0 + bs * 0];
    B[0 + bs * 1] = A0[2 + bs * 1];
    B[1 + bs * 1] = A0[3 + bs * 1];
    B[2 + bs * 1] = A1[0 + bs * 1];
    B[0 + bs * 2] = A0[2 + bs * 2];
    B[1 + bs * 2] = A0[3 + bs * 2];
    B[2 + bs * 2] = A1[0 + bs * 2];
    B[0 + bs * 3] = A0[2 + bs * 3];
    B[1 + bs * 3] = A0[3 + bs * 3];
    B[2 + bs * 3] = A1[0 + bs * 3];
    A0 += 16;
    A1 += 16;
    B += 16;
  }
  for (; k < kmax; k++) {
    B[0 + bs * 0] = A0[2 + bs * 0];
    B[1 + bs * 0] = A0[3 + bs * 0];
    B[2 + bs * 0] = A1[0 + bs * 0];
    A0 += 4;
    A1 += 4;
    B += 4;
  }
  if (tri == 1) {
    B[1 + bs * 0] = A0[3 + bs * 0];
    B[2 + bs * 0] = A1[0 + bs * 0];
    B[2 + bs * 1] = A1[0 + bs * 1];
  }
}
```