user: What would the C source look like for the assembly code provided here:

```asm
<d_copy_pmat_panel>:
  endbr64
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L122
  test   %esi,%esi
  jle    L122
  mov    %edx,%eax
  sar    $0x1f,%eax
  shr    $0x1e,%eax
  add    %eax,%edx
  and    $0x3,%edx
  sub    %edx,%eax
  lea    0x4(%rax),%r10d
  cmp    %r10d,%edi
  cmovle %edi,%r10d
  mov    %edi,%r11d
  sub    %r10d,%r11d
  mov    %r8,%rax
  mov    %rsp,%rdx
  lea    -0x1(%r10),%ebx
  lea    0x8(%r8,%rbx,8),%rbx
L303:
  mov    %rax,(%rdx)
  add    $0x8,%rax
  add    $0x8,%rdx
  cmp    %rbx,%rax
  jne    L303
  test   %r11d,%r11d
  jle    L53
  movslq %r10d,%r10
  lea    -0x4(,%r9,4),%eax
  cltq
  add    %r10,%rax
  lea    (%r8,%rax,8),%rdx
  lea    (%rsp,%r10,8),%r8
  mov    $0x0,%eax
L130:
  mov    %rdx,(%r8,%rax,8)
  add    $0x1,%rax
  add    $0x8,%rdx
  cmp    %eax,%r11d
  jg     L130
L53:
  cmp    $0x1,%edi
  je     L263
  cmp    $0x2,%edi
  je     L259
  cmp    $0x3,%edi
  je     L171
  mov    $0x0,%eax
  cmp    $0x3,%esi
  jle    L222
  mov    (%rsp),%r10
  mov    0x8(%rsp),%r9
  mov    0x10(%rsp),%r8
  mov    0x18(%rsp),%rdi
  mov    %rcx,%rdx
  lea    -0x4(%rsi),%ebx
  shr    $0x2,%ebx
  lea    0x1(%rbx),%r11d
  mov    %r11d,%r11d
  shl    $0x7,%r11
  mov    $0x0,%eax
L175:
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%r10,%rax,1)
  movsd  0x8(%rdx),%xmm0
  movsd  %xmm0,(%r9,%rax,1)
  movsd  0x10(%rdx),%xmm0
  movsd  %xmm0,(%r8,%rax,1)
  movsd  0x18(%rdx),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  movsd  0x20(%rdx),%xmm0
  movsd  %xmm0,0x20(%r10,%rax,1)
  movsd  0x28(%rdx),%xmm0
  movsd  %xmm0,0x20(%r9,%rax,1)
  movsd  0x30(%rdx),%xmm0
  movsd  %xmm0,0x20(%r8,%rax,1)
  movsd  0x18(%rdx),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  movsd  0x40(%rdx),%xmm0
  movsd  %xmm0,0x40(%r10,%rax,1)
  movsd  0x48(%rdx),%xmm0
  movsd  %xmm0,0x40(%r9,%rax,1)
  movsd  0x50(%rdx),%xmm0
  movsd  %xmm0,0x40(%r8,%rax,1)
  movsd  0x18(%rdx),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  movsd  0x60(%rdx),%xmm0
  movsd  %xmm0,0x60(%r10,%rax,1)
  movsd  0x68(%rdx),%xmm0
  movsd  %xmm0,0x60(%r9,%rax,1)
  movsd  0x70(%rdx),%xmm0
  movsd  %xmm0,0x60(%r8,%rax,1)
  movsd  0x18(%rdx),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  sub    $0xffffffffffffff80,%rdx
  sub    $0xffffffffffffff80,%rax
  cmp    %r11,%rax
  jne    L175
  lea    0x4(,%rbx,4),%eax
  cmp    %eax,%esi
  jle    L122
L222:
  mov    (%rsp),%r10
  mov    0x8(%rsp),%r9
  mov    0x10(%rsp),%r8
  mov    0x18(%rsp),%rdi
  movslq %eax,%rdx
  shl    $0x2,%eax
  cltq
  shl    $0x3,%rax
L170:
  movsd  (%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r10,%rax,1)
  movsd  0x8(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r9,%rax,1)
  movsd  0x10(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r8,%rax,1)
  movsd  0x18(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  add    $0x1,%rdx
  add    $0x20,%rax
  cmp    %edx,%esi
  jg     L170
  jmp    L122
L263:
  cmp    $0x3,%esi
  jle    L144
  mov    %rcx,%rax
  mov    (%rsp),%rdx
  lea    -0x4(%rsi),%r8d
  shr    $0x2,%r8d
  mov    %r8d,%edi
  shl    $0x7,%rdi
  lea    0x80(%rcx,%rdi,1),%rdi
L3:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  movsd  0x20(%rax),%xmm0
  movsd  %xmm0,0x20(%rdx)
  movsd  0x40(%rax),%xmm0
  movsd  %xmm0,0x40(%rdx)
  movsd  0x60(%rax),%xmm0
  movsd  %xmm0,0x60(%rdx)
  sub    $0xffffffffffffff80,%rax
  sub    $0xffffffffffffff80,%rdx
  cmp    %rdi,%rax
  jne    L3
  lea    0x4(,%r8,4),%eax
  cmp    %eax,%esi
  jle    L122
L136:
  mov    (%rsp),%rdi
  cltq
L252:
  mov    %rax,%rdx
  shl    $0x5,%rdx
  movsd  (%rcx,%rdx,1),%xmm0
  movsd  %xmm0,(%rdi,%rdx,1)
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L252
L122:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x30,%rsp
  pop    %rbx
  ret
L144:
  mov    $0x0,%eax
  jmp    L136
L259:
  cmp    $0x3,%esi
  jle    L163
  mov    %rcx,%rax
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%rdx
  lea    -0x4(%rsi),%r9d
  shr    $0x2,%r9d
  mov    %r9d,%r8d
  shl    $0x7,%r8
  lea    0x80(%rcx,%r8,1),%r8
L100:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdi)
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  movsd  0x20(%rax),%xmm0
  movsd  %xmm0,0x20(%rdi)
  movsd  0x28(%rax),%xmm0
  movsd  %xmm0,0x20(%rdx)
  movsd  0x40(%rax),%xmm0
  movsd  %xmm0,0x40(%rdi)
  movsd  0x48(%rax),%xmm0
  movsd  %xmm0,0x40(%rdx)
  movsd  0x60(%rax),%xmm0
  movsd  %xmm0,0x60(%rdi)
  movsd  0x68(%rax),%xmm0
  movsd  %xmm0,0x60(%rdx)
  sub    $0xffffffffffffff80,%rax
  sub    $0xffffffffffffff80,%rdi
  sub    $0xffffffffffffff80,%rdx
  cmp    %r8,%rax
  jne    L100
  lea    0x4(,%r9,4),%eax
  cmp    %eax,%esi
  jle    L122
L5:
  mov    (%rsp),%r8
  mov    0x8(%rsp),%rdi
  movslq %eax,%rdx
  shl    $0x2,%eax
  cltq
  shl    $0x3,%rax
L39:
  movsd  (%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r8,%rax,1)
  movsd  0x8(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  add    $0x1,%rdx
  add    $0x20,%rax
  cmp    %edx,%esi
  jg     L39
  jmp    L122
L163:
  mov    $0x0,%eax
  jmp    L5
L171:
  cmp    $0x3,%esi
  jle    L106
  mov    %rcx,%rax
  mov    (%rsp),%r8
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%rdx
  lea    -0x4(%rsi),%r10d
  shr    $0x2,%r10d
  mov    %r10d,%r9d
  shl    $0x7,%r9
  lea    0x80(%rcx,%r9,1),%r9
L185:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%r8)
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdi)
  movsd  0x10(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  movsd  0x20(%rax),%xmm0
  movsd  %xmm0,0x20(%r8)
  movsd  0x28(%rax),%xmm0
  movsd  %xmm0,0x20(%rdi)
  movsd  0x30(%rax),%xmm0
  movsd  %xmm0,0x20(%rdx)
  movsd  0x40(%rax),%xmm0
  movsd  %xmm0,0x40(%r8)
  movsd  0x48(%rax),%xmm0
  movsd  %xmm0,0x40(%rdi)
  movsd  0x50(%rax),%xmm0
  movsd  %xmm0,0x40(%rdx)
  movsd  0x60(%rax),%xmm0
  movsd  %xmm0,0x60(%r8)
  movsd  0x68(%rax),%xmm0
  movsd  %xmm0,0x60(%rdi)
  movsd  0x70(%rax),%xmm0
  movsd  %xmm0,0x60(%rdx)
  sub    $0xffffffffffffff80,%rax
  sub    $0xffffffffffffff80,%r8
  sub    $0xffffffffffffff80,%rdi
  sub    $0xffffffffffffff80,%rdx
  cmp    %r9,%rax
  jne    L185
  lea    0x4(,%r10,4),%eax
  cmp    %eax,%esi
  jle    L122
L257:
  mov    (%rsp),%r9
  mov    0x8(%rsp),%r8
  mov    0x10(%rsp),%rdi
  movslq %eax,%rdx
  shl    $0x2,%eax
  cltq
  shl    $0x3,%rax
L58:
  movsd  (%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r9,%rax,1)
  movsd  0x8(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r8,%rax,1)
  movsd  0x10(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  add    $0x1,%rdx
  add    $0x20,%rax
  cmp    %edx,%esi
  jg     L58
  jmp    L122
L106:
  mov    $0x0,%eax
  jmp    L257
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void d_copy_pmat_panel(int row, int col, int offset, double *A, double *B, int sdb) {
  if (row <= 0 || col <= 0)
    return;
  const int bs = 4;
  int i, ii;
  int row0 = bs - offset % bs;
  row0 = row0 > row ? row : row0;
  int row1 = row - row0;
  double *(ptrB[4]);
  for (i = 0; i < row0; i++)
    ptrB[i] = B + i;
  for (i = 0; i < row1; i++)
    ptrB[row0 + i] = B + row0 + (sdb - 1) * bs + i;
  if (row == 1) {
    i = 0;
    for (; i < col - 3; i += 4) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[0][(i + 1) * bs] = A[0 + (i + 1) * bs];
      ptrB[0][(i + 2) * bs] = A[0 + (i + 2) * bs];
      ptrB[0][(i + 3) * bs] = A[0 + (i + 3) * bs];
    }
    for (; i < col; i++) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
    }
  } else if (row == 2) {
    i = 0;
    for (; i < col - 3; i += 4) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[1][(i + 0) * bs] = A[1 + (i + 0) * bs];
      ptrB[0][(i + 1) * bs] = A[0 + (i + 1) * bs];
      ptrB[1][(i + 1) * bs] = A[1 + (i + 1) * bs];
      ptrB[0][(i + 2) * bs] = A[0 + (i + 2) * bs];
      ptrB[1][(i + 2) * bs] = A[1 + (i + 2) * bs];
      ptrB[0][(i + 3) * bs] = A[0 + (i + 3) * bs];
      ptrB[1][(i + 3) * bs] = A[1 + (i + 3) * bs];
    }
    for (; i < col; i++) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[1][(i + 0) * bs] = A[1 + (i + 0) * bs];
    }
  } else if (row == 3) {
    i = 0;
    for (; i < col - 3; i += 4) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[1][(i + 0) * bs] = A[1 + (i + 0) * bs];
      ptrB[2][(i + 0) * bs] = A[2 + (i + 0) * bs];
      ptrB[0][(i + 1) * bs] = A[0 + (i + 1) * bs];
      ptrB[1][(i + 1) * bs] = A[1 + (i + 1) * bs];
      ptrB[2][(i + 1) * bs] = A[2 + (i + 1) * bs];
      ptrB[0][(i + 2) * bs] = A[0 + (i + 2) * bs];
      ptrB[1][(i + 2) * bs] = A[1 + (i + 2) * bs];
      ptrB[2][(i + 2) * bs] = A[2 + (i + 2) * bs];
      ptrB[0][(i + 3) * bs] = A[0 + (i + 3) * bs];
      ptrB[1][(i + 3) * bs] = A[1 + (i + 3) * bs];
      ptrB[2][(i + 3) * bs] = A[2 + (i + 3) * bs];
    }
    for (; i < col; i++) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[1][(i + 0) * bs] = A[1 + (i + 0) * bs];
      ptrB[2][(i + 0) * bs] = A[2 + (i + 0) * bs];
    }
  } else {
    i = 0;
    for (; i < col - 3; i += 4) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[1][(i + 0) * bs] = A[1 + (i + 0) * bs];
      ptrB[2][(i + 0) * bs] = A[2 + (i + 0) * bs];
      ptrB[3][(i + 0) * bs] = A[3 + (i + 0) * bs];
      ptrB[0][(i + 1) * bs] = A[0 + (i + 1) * bs];
      ptrB[1][(i + 1) * bs] = A[1 + (i + 1) * bs];
      ptrB[2][(i + 1) * bs] = A[2 + (i + 1) * bs];
      ptrB[3][(i + 0) * bs] = A[3 + (i + 0) * bs];
      ptrB[0][(i + 2) * bs] = A[0 + (i + 2) * bs];
      ptrB[1][(i + 2) * bs] = A[1 + (i + 2) * bs];
      ptrB[2][(i + 2) * bs] = A[2 + (i + 2) * bs];
      ptrB[3][(i + 0) * bs] = A[3 + (i + 0) * bs];
      ptrB[0][(i + 3) * bs] = A[0 + (i + 3) * bs];
      ptrB[1][(i + 3) * bs] = A[1 + (i + 3) * bs];
      ptrB[2][(i + 3) * bs] = A[2 + (i + 3) * bs];
      ptrB[3][(i + 0) * bs] = A[3 + (i + 0) * bs];
    }
    for (; i < col; i++) {
      ptrB[0][(i + 0) * bs] = A[0 + (i + 0) * bs];
      ptrB[1][(i + 0) * bs] = A[1 + (i + 0) * bs];
      ptrB[2][(i + 0) * bs] = A[2 + (i + 0) * bs];
      ptrB[3][(i + 0) * bs] = A[3 + (i + 0) * bs];
    }
  }
}
```