user: 请将以下的汇编代码转换成C语言代码：

```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    L49
  lea    -0x4(%rdi),%r9d
  mov    %r11,%rcx
  mov    %r8,%rax
  shr    $0x2,%r9d
  lea    0x1(%r9),%ebx
  mov    %rbx,%r9
  shl    $0x7,%rbx
  lea    (%rdx,%rbx,1),%rsi
  nopl   0x0(%rax,%rax,1)
L17:
  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    L17
  lea    0x0(,%r9,4),%edx
  add    %rbx,%r11
  add    %rbx,%r8
  cmp    %edx,%edi
  jle    L6
L21:
  mov    %edx,%ecx
  xor    %eax,%eax
L66:
  movsd  0x10(%rsi,%rax,1),%xmm0
  add    $0x1,%ecx
  movsd  %xmm0,(%r8,%rax,1)
  movsd  0x18(%rsi,%rax,1),%xmm0
  movsd  %xmm0,0x8(%r8,%rax,1)
  movsd  (%r11,%rax,1),%xmm0
  movsd  %xmm0,0x10(%r8,%rax,1)
  add    $0x20,%rax
  cmp    %ecx,%edi
  jg     L66
  lea    -0x1(%rdi),%eax
  sub    %edx,%eax
  add    $0x1,%rax
  shl    $0x5,%rax
  cmp    %edx,%edi
  mov    $0x20,%edx
  cmovle %rdx,%rax
  add    %rax,%rsi
  add    %rax,%r11
  add    %rax,%r8
L6:
  cmp    $0x1,%r10d
  je     L64
  pop    %rbx
  ret
  nopl   (%rax)
L64:
  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)
L49:
  mov    %rdx,%rsi
  xor    %edx,%edx
  jmp    L21
```

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