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

```asm
<kernel_dgetr_2_lib4>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  mov    %r9d,-0x20(%rbp)
  cmpl   $0x1,-0x14(%rbp)
  jne    L95
  addl   $0x1,-0x18(%rbp)
L95:
  movl   $0x4,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L68
  cmpl   $0x0,-0x1c(%rbp)
  jle    L45
  jmp    L70
L1:
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  addq   $0x8,-0x30(%rbp)
  mov    -0x4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x28(%rbp)
  addl   $0x1,-0x8(%rbp)
L70:
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L1
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  imul   -0x4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x30(%rbp)
  jmp    L45
L94:
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  add    $0x2,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  add    $0x3,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  imul   -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x30(%rbp)
  mov    -0x4(%rbp),%eax
  imul   %eax,%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x28(%rbp)
  addl   $0x4,-0x8(%rbp)
L45:
  mov    -0x18(%rbp),%eax
  sub    $0x3,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L94
  jmp    L53
L68:
  nop
L53:
  jmp    L93
L91:
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  addq   $0x8,-0x30(%rbp)
  mov    -0x4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x28(%rbp)
  addl   $0x1,-0x8(%rbp)
L93:
  mov    -0x8(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L91
  cmpl   $0x1,-0x14(%rbp)
  jne    L98
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdx)
L98:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void kernel_dgetr_2_lib4(int tri, int kmax, int kna, double *A, double *C, int sdc) {
  if (tri == 1) {
    kmax += 1;
  }
  const int bs = 4;
  int k;
  k = 0;
  if (kmax < kna)
    goto cleanup_loop;
  if (kna > 0) {
    for (; k < kna; k++) {
      C[0 + bs * 0] = A[0 + bs * 0];
      C[0 + bs * 1] = A[1 + bs * 0];
      C += 1;
      A += bs;
    }
    C += bs * (sdc - 1);
  }
  for (; k < kmax - 3; k += 4) {
    C[0 + bs * 0] = A[0 + bs * 0];
    C[0 + bs * 1] = A[1 + bs * 0];
    C[1 + bs * 0] = A[0 + bs * 1];
    C[1 + bs * 1] = A[1 + bs * 1];
    C[2 + bs * 0] = A[0 + bs * 2];
    C[2 + bs * 1] = A[1 + bs * 2];
    C[3 + bs * 0] = A[0 + bs * 3];
    C[3 + bs * 1] = A[1 + bs * 3];
    C += bs * sdc;
    A += bs * bs;
  }
cleanup_loop:
  for (; k < kmax; k++) {
    C[0 + bs * 0] = A[0 + bs * 0];
    C[0 + bs * 1] = A[1 + bs * 0];
    C += 1;
    A += bs;
  }
  if (tri == 1) {
    C[0 + bs * 1] = A[1 + bs * 0];
  }
}
```