// File: j-faria[P]kima/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
// Function: Eigen::internal::gemm_pack_rhs<double, long, Eigen::internal::const_blas_data_mapper<double, long, 1>, 4, 1, false, true>::operator()(double*, Eigen::internal::const_blas_data_mapper<double, long, 1> const&, long, long, long, long)
EIGEN_DONT_INLINE void gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMode>
  ::operator()(Scalar* blockB, const DataMapper& rhs, Index depth, Index cols, Index stride, Index offset)
{
  EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK RHS ROWMAJOR");
  EIGEN_UNUSED_VARIABLE(stride);
  EIGEN_UNUSED_VARIABLE(offset);
  eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
  conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
  Index packet_cols8 = nr>=8 ? (cols/8) * 8 : 0;
  Index packet_cols4 = nr>=4 ? (cols/4) * 4 : 0;
  Index count = 0;

//   if(nr>=8)
//   {
//     for(Index j2=0; j2<packet_cols8; j2+=8)
//     {
//       // skip what we have before
//       if(PanelMode) count += 8 * offset;
//       for(Index k=0; k<depth; k++)
//       {
//         if (PacketSize==8) {
//           Packet A = ploadu<Packet>(&rhs[k*rhsStride + j2]);
//           pstoreu(blockB+count, cj.pconj(A));
//         } else if (PacketSize==4) {
//           Packet A = ploadu<Packet>(&rhs[k*rhsStride + j2]);
//           Packet B = ploadu<Packet>(&rhs[k*rhsStride + j2 + PacketSize]);
//           pstoreu(blockB+count, cj.pconj(A));
//           pstoreu(blockB+count+PacketSize, cj.pconj(B));
//         } else {
//           const Scalar* b0 = &rhs[k*rhsStride + j2];
//           blockB[count+0] = cj(b0[0]);
//           blockB[count+1] = cj(b0[1]);
//           blockB[count+2] = cj(b0[2]);
//           blockB[count+3] = cj(b0[3]);
//           blockB[count+4] = cj(b0[4]);
//           blockB[count+5] = cj(b0[5]);
//           blockB[count+6] = cj(b0[6]);
//           blockB[count+7] = cj(b0[7]);
//         }
//         count += 8;
//       }
//       // skip what we have after
//       if(PanelMode) count += 8 * (stride-offset-depth);
//     }
//   }
  if(nr>=4)
  {
    for(Index j2=packet_cols8; j2<packet_cols4; j2+=4)
    {
      // skip what we have before
      if(PanelMode) count += 4 * offset;
      for(Index k=0; k<depth; k++)
      {
        if (PacketSize==4) {
          Packet A = rhs.template loadPacket<Packet>(k, j2);
          pstoreu(blockB+count, cj.pconj(A));
          count += PacketSize;
        } else {
          const LinearMapper dm0 = rhs.getLinearMapper(k, j2);
          blockB[count+0] = cj(dm0(0));
          blockB[count+1] = cj(dm0(1));
          blockB[count+2] = cj(dm0(2));
          blockB[count+3] = cj(dm0(3));
          count += 4;
        }
      }
      // skip what we have after
      if(PanelMode) count += 4 * (stride-offset-depth);
    }
  }
  // copy the remaining columns one at a time (nr==1)
  for(Index j2=packet_cols4; j2<cols; ++j2)
  {
    if(PanelMode) count += offset;
    for(Index k=0; k<depth; k++)
    {
      blockB[count] = cj(rhs(k, j2));
      count += 1;
    }
    if(PanelMode) count += stride-offset-depth;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq 0x10(%rbp), %rax
movq %rdi, -0xb0(%rbp)
movq %rsi, -0xb8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %r9, -0xd8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x2fc00
leaq 0x10(%rbp), %rdi
callq 0x2fc00
movq -0xd8(%rbp), %rcx
xorl %eax, %eax
cmpq -0xc8(%rbp), %rcx
movb %al, -0x121(%rbp)
jl 0x42aca
movq 0x10(%rbp), %rax
cmpq -0xd8(%rbp), %rax
setle %al
movb %al, -0x121(%rbp)
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x42ad6
jmp 0x42ad8
jmp 0x42af7
leaq 0x79c81(%rip), %rdi     # 0xbc760
leaq 0x79cd5(%rip), %rsi     # 0xbc7bb
movl $0xa68, %edx            # imm = 0xA68
leaq 0x79eff(%rip), %rcx     # 0xbc9f1
callq 0x6340
movq $0x0, -0xe8(%rbp)
movq -0xd0(%rbp), %rax
movl $0x4, %ecx
cqto
idivq %rcx
shlq $0x2, %rax
movq %rax, -0xf0(%rbp)
movq $0x0, -0xf8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jge 0x42dba
movq 0x10(%rbp), %rax
shlq $0x2, %rax
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq $0x0, -0x108(%rbp)
movq -0x108(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jge 0x42d7f
movq -0xc0(%rbp), %rdx
movq -0x108(%rbp), %rcx
movq -0x100(%rbp), %rax
movq %rdx, -0x80(%rbp)
movq %rcx, -0x88(%rbp)
movq %rax, -0x90(%rbp)
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %rcx
movq -0x90(%rbp), %rax
movq %rdx, -0x60(%rbp)
movq %rcx, -0x68(%rbp)
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rsi
movq (%rsi), %rax
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rdx
imulq 0x8(%rsi), %rdx
addq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
leaq -0x78(%rbp), %rcx
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq $0x1, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
cmpq $0x1, -0x18(%rbp)
je 0x42c28
leaq 0x78033(%rip), %rdi     # 0xbac43
leaq 0x78034(%rip), %rsi     # 0xbac4b
movl $0xa9, %edx
leaq 0x79d2f(%rip), %rcx     # 0xbc952
callq 0x6340
movq -0x78(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0x110(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0xd9(%rbp), %rdi
callq 0x46140
movsd (%rax), %xmm0
movq -0xb8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
leaq -0x110(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x1, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0xd9(%rbp), %rdi
callq 0x46140
movsd (%rax), %xmm0
movq -0xb8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movsd %xmm0, 0x8(%rax,%rcx,8)
leaq -0x110(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x2, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rsi
movq -0x48(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0xd9(%rbp), %rdi
callq 0x46140
movsd (%rax), %xmm0
movq -0xb8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movsd %xmm0, 0x10(%rax,%rcx,8)
leaq -0x110(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x3, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0xd9(%rbp), %rdi
callq 0x46140
movsd (%rax), %xmm0
movq -0xb8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movsd %xmm0, 0x18(%rax,%rcx,8)
movq -0xf8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xf8(%rbp)
movq -0x108(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x108(%rbp)
jmp 0x42b6c
movq -0xd8(%rbp), %rax
subq 0x10(%rbp), %rax
subq -0xc8(%rbp), %rax
shlq $0x2, %rax
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x100(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x100(%rbp)
jmp 0x42b37
movq -0xf0(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jge 0x42ee1
movq 0x10(%rbp), %rax
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq $0x0, -0x120(%rbp)
movq -0x120(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jge 0x42eaa
movq -0xc0(%rbp), %rdx
movq -0x120(%rbp), %rcx
movq -0x118(%rbp), %rax
movq %rdx, -0x98(%rbp)
movq %rcx, -0xa0(%rbp)
movq %rax, -0xa8(%rbp)
movq -0x98(%rbp), %rdx
movq (%rdx), %rsi
movq -0xa8(%rbp), %rax
movq -0xa0(%rbp), %rcx
imulq 0x8(%rdx), %rcx
addq %rcx, %rax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0xd9(%rbp), %rdi
callq 0x46140
movsd (%rax), %xmm0
movq -0xb8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0xf8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf8(%rbp)
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
jmp 0x42df9
movq -0xd8(%rbp), %rax
subq 0x10(%rbp), %rax
subq -0xc8(%rbp), %rax
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
jmp 0x42dc8
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)