// File: Pyboon[P]sage/./Eigen/src/Core/products/GeneralBlockPanelKernel.h
// Function: Eigen::internal::gemm_pack_rhs<std::complex<double>, long, Eigen::internal::blas_data_mapper<std::complex<double>, long, 0, 0>, 4, 0, false, true>::operator()(std::complex<double>*, Eigen::internal::blas_data_mapper<std::complex<double>, long, 0, 0> const&, long, long, long, long)
EIGEN_DONT_INLINE void gemm_pack_rhs<Scalar, Index, DataMapper, nr, ColMajor, Conjugate, PanelMode>
  ::operator()(Scalar* blockB, const DataMapper& rhs, Index depth, Index cols, Index stride, Index offset)
{
  EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK RHS COLMAJOR");
  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;
  const Index peeled_k = (depth/PacketSize)*PacketSize;
//   if(nr>=8)
//   {
//     for(Index j2=0; j2<packet_cols8; j2+=8)
//     {
//       // skip what we have before
//       if(PanelMode) count += 8 * offset;
//       const Scalar* b0 = &rhs[(j2+0)*rhsStride];
//       const Scalar* b1 = &rhs[(j2+1)*rhsStride];
//       const Scalar* b2 = &rhs[(j2+2)*rhsStride];
//       const Scalar* b3 = &rhs[(j2+3)*rhsStride];
//       const Scalar* b4 = &rhs[(j2+4)*rhsStride];
//       const Scalar* b5 = &rhs[(j2+5)*rhsStride];
//       const Scalar* b6 = &rhs[(j2+6)*rhsStride];
//       const Scalar* b7 = &rhs[(j2+7)*rhsStride];
//       Index k=0;
//       if(PacketSize==8) // TODO enbale vectorized transposition for PacketSize==4
//       {
//         for(; k<peeled_k; k+=PacketSize) {
//           PacketBlock<Packet> kernel;
//           for (int p = 0; p < PacketSize; ++p) {
//             kernel.packet[p] = ploadu<Packet>(&rhs[(j2+p)*rhsStride+k]);
//           }
//           ptranspose(kernel);
//           for (int p = 0; p < PacketSize; ++p) {
//             pstoreu(blockB+count, cj.pconj(kernel.packet[p]));
//             count+=PacketSize;
//           }
//         }
//       }
//       for(; k<depth; k++)
//       {
//         blockB[count+0] = cj(b0[k]);
//         blockB[count+1] = cj(b1[k]);
//         blockB[count+2] = cj(b2[k]);
//         blockB[count+3] = cj(b3[k]);
//         blockB[count+4] = cj(b4[k]);
//         blockB[count+5] = cj(b5[k]);
//         blockB[count+6] = cj(b6[k]);
//         blockB[count+7] = cj(b7[k]);
//         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;
      const LinearMapper dm0 = rhs.getLinearMapper(0, j2 + 0);
      const LinearMapper dm1 = rhs.getLinearMapper(0, j2 + 1);
      const LinearMapper dm2 = rhs.getLinearMapper(0, j2 + 2);
      const LinearMapper dm3 = rhs.getLinearMapper(0, j2 + 3);

      Index k=0;
      if((PacketSize%4)==0) // TODO enable vectorized transposition for PacketSize==2 ??
      {
        for(; k<peeled_k; k+=PacketSize) {
          PacketBlock<Packet,(PacketSize%4)==0?4:PacketSize> kernel;
          kernel.packet[0] = dm0.loadPacket(k);
          kernel.packet[1%PacketSize] = dm1.loadPacket(k);
          kernel.packet[2%PacketSize] = dm2.loadPacket(k);
          kernel.packet[3%PacketSize] = dm3.loadPacket(k);
          ptranspose(kernel);
          pstoreu(blockB+count+0*PacketSize, cj.pconj(kernel.packet[0]));
          pstoreu(blockB+count+1*PacketSize, cj.pconj(kernel.packet[1%PacketSize]));
          pstoreu(blockB+count+2*PacketSize, cj.pconj(kernel.packet[2%PacketSize]));
          pstoreu(blockB+count+3*PacketSize, cj.pconj(kernel.packet[3%PacketSize]));
          count+=4*PacketSize;
        }
      }
      for(; k<depth; k++)
      {
        blockB[count+0] = cj(dm0(k));
        blockB[count+1] = cj(dm1(k));
        blockB[count+2] = cj(dm2(k));
        blockB[count+3] = cj(dm3(k));
        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;
    const LinearMapper dm0 = rhs.getLinearMapper(0, j2);
    for(Index k=0; k<depth; k++)
    {
      blockB[count] = cj(dm0(k));
      count += 1;
    }
    if(PanelMode) count += (stride-offset-depth);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq 0x10(%rbp), %rax
movq %rdi, -0x1c0(%rbp)
movq %rsi, -0x1c8(%rbp)
movq %rdx, -0x1d0(%rbp)
movq %rcx, -0x1d8(%rbp)
movq %r8, -0x1e0(%rbp)
movq %r9, -0x1e8(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x3df20
leaq 0x10(%rbp), %rdi
callq 0x3df20
movq -0x1e8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x1d8(%rbp), %rcx
movb %al, -0x259(%rbp)
jl 0x5399a
movq 0x10(%rbp), %rax
cmpq -0x1e8(%rbp), %rax
setle %al
movb %al, -0x259(%rbp)
movb -0x259(%rbp), %al
testb $0x1, %al
jne 0x539a6
jmp 0x539a8
jmp 0x539c7
leaq 0x2411a(%rip), %rdi     # 0x77ac9
leaq 0x2416e(%rip), %rsi     # 0x77b24
movl $0x772, %edx            # imm = 0x772
leaq 0x29de4(%rip), %rcx     # 0x7d7a6
callq 0x94c0
movq $0x0, -0x1f8(%rbp)
movq -0x1e0(%rbp), %rax
movl $0x4, %ecx
cqto
idivq %rcx
shlq $0x2, %rax
movq %rax, -0x200(%rbp)
movq $0x0, -0x208(%rbp)
movq -0x1d8(%rbp), %rax
movl $0x1, %ecx
cqto
idivq %rcx
shlq $0x0, %rax
movq %rax, -0x210(%rbp)
movq -0x1f8(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x218(%rbp), %rax
cmpq -0x200(%rbp), %rax
jge 0x53ef0
movq 0x10(%rbp), %rax
shlq $0x2, %rax
addq -0x208(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x1d0(%rbp), %rcx
movq -0x218(%rbp), %rax
addq $0x0, %rax
movq %rcx, -0x128(%rbp)
movq $0x0, -0x130(%rbp)
movq %rax, -0x138(%rbp)
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rcx
movq -0x138(%rbp), %rax
movq %rdx, -0x108(%rbp)
movq %rcx, -0x110(%rbp)
movq %rax, -0x118(%rbp)
movq -0x108(%rbp), %rsi
movq (%rsi), %rax
movq -0x110(%rbp), %rcx
movq -0x118(%rbp), %rdx
imulq 0x8(%rsi), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
leaq -0x120(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq %rcx, (%rax)
movq -0x120(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x1d0(%rbp), %rcx
movq -0x218(%rbp), %rax
addq $0x1, %rax
movq %rcx, -0x148(%rbp)
movq $0x0, -0x150(%rbp)
movq %rax, -0x158(%rbp)
movq -0x148(%rbp), %rdx
movq -0x150(%rbp), %rcx
movq -0x158(%rbp), %rax
movq %rdx, -0xf0(%rbp)
movq %rcx, -0xf8(%rbp)
movq %rax, -0x100(%rbp)
movq -0xf0(%rbp), %rsi
movq (%rsi), %rax
movq -0xf8(%rbp), %rcx
movq -0x100(%rbp), %rdx
imulq 0x8(%rsi), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
leaq -0x140(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rcx, (%rax)
movq -0x140(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x1d0(%rbp), %rcx
movq -0x218(%rbp), %rax
addq $0x2, %rax
movq %rcx, -0x168(%rbp)
movq $0x0, -0x170(%rbp)
movq %rax, -0x178(%rbp)
movq -0x168(%rbp), %rdx
movq -0x170(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rdx, -0xd8(%rbp)
movq %rcx, -0xe0(%rbp)
movq %rax, -0xe8(%rbp)
movq -0xd8(%rbp), %rsi
movq (%rsi), %rax
movq -0xe0(%rbp), %rcx
movq -0xe8(%rbp), %rdx
imulq 0x8(%rsi), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
leaq -0x160(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rcx, (%rax)
movq -0x160(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x1d0(%rbp), %rcx
movq -0x218(%rbp), %rax
addq $0x3, %rax
movq %rcx, -0x188(%rbp)
movq $0x0, -0x190(%rbp)
movq %rax, -0x198(%rbp)
movq -0x188(%rbp), %rdx
movq -0x190(%rbp), %rcx
movq -0x198(%rbp), %rax
movq %rdx, -0xc0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %rax, -0xd0(%rbp)
movq -0xc0(%rbp), %rsi
movq (%rsi), %rax
movq -0xc8(%rbp), %rcx
movq -0xd0(%rbp), %rdx
imulq 0x8(%rsi), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
leaq -0x180(%rbp), %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, (%rax)
movq -0x180(%rbp), %rax
movq %rax, -0x238(%rbp)
movq $0x0, -0x240(%rbp)
movq -0x240(%rbp), %rax
cmpq -0x1d8(%rbp), %rax
jge 0x53eb5
movq -0x240(%rbp), %rax
leaq -0x220(%rbp), %rcx
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x1e9(%rbp), %rdi
callq 0x42900
movq %rax, %rcx
movq -0x1c8(%rbp), %rax
movq -0x208(%rbp), %rdx
addq $0x0, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x240(%rbp), %rax
leaq -0x228(%rbp), %rcx
movq %rcx, -0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x1e9(%rbp), %rdi
callq 0x42900
movq %rax, %rcx
movq -0x1c8(%rbp), %rax
movq -0x208(%rbp), %rdx
addq $0x1, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x240(%rbp), %rax
leaq -0x230(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x1e9(%rbp), %rdi
callq 0x42900
movq %rax, %rcx
movq -0x1c8(%rbp), %rax
movq -0x208(%rbp), %rdx
addq $0x2, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x240(%rbp), %rax
leaq -0x238(%rbp), %rcx
movq %rcx, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x1e9(%rbp), %rdi
callq 0x42900
movq %rax, %rcx
movq -0x1c8(%rbp), %rax
movq -0x208(%rbp), %rdx
addq $0x3, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x208(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x208(%rbp)
movq -0x240(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x240(%rbp)
jmp 0x53d00
movq -0x1e8(%rbp), %rax
subq 0x10(%rbp), %rax
subq -0x1d8(%rbp), %rax
shlq $0x2, %rax
addq -0x208(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x218(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x218(%rbp)
jmp 0x53a23
movq -0x200(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rax
cmpq -0x1e0(%rbp), %rax
jge 0x5409d
movq 0x10(%rbp), %rax
addq -0x208(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x1d0(%rbp), %rcx
movq -0x248(%rbp), %rax
movq %rcx, -0x1a8(%rbp)
movq $0x0, -0x1b0(%rbp)
movq %rax, -0x1b8(%rbp)
movq -0x1a8(%rbp), %rdx
movq -0x1b0(%rbp), %rcx
movq -0x1b8(%rbp), %rax
movq %rdx, -0xa8(%rbp)
movq %rcx, -0xb0(%rbp)
movq %rax, -0xb8(%rbp)
movq -0xa8(%rbp), %rsi
movq (%rsi), %rax
movq -0xb0(%rbp), %rcx
movq -0xb8(%rbp), %rdx
imulq 0x8(%rsi), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
leaq -0x1a0(%rbp), %rcx
movq %rcx, -0x58(%rbp)
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
movq -0x1a0(%rbp), %rax
movq %rax, -0x250(%rbp)
movq $0x0, -0x258(%rbp)
movq -0x258(%rbp), %rax
cmpq -0x1d8(%rbp), %rax
jge 0x54066
movq -0x258(%rbp), %rax
leaq -0x250(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq -0x50(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x1e9(%rbp), %rdi
callq 0x42900
movq %rax, %rcx
movq -0x1c8(%rbp), %rax
movq -0x208(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x208(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x208(%rbp)
movq -0x258(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x258(%rbp)
jmp 0x53fcf
movq -0x1e8(%rbp), %rax
subq 0x10(%rbp), %rax
subq -0x1d8(%rbp), %rax
addq -0x208(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x248(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x248(%rbp)
jmp 0x53efe
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
nopw %cs:(%rax,%rax)