// File: /workspace/github_cpp_makefile_star2_O3/Kingsford-Group[P]ghost2/include/Eigen/src/Core/products/GeneralBlockPanelKernel.h
// Function: Eigen::internal::gemm_pack_lhs<double, long, 4, 2, 0, false, false>::operator()(double*, double const*, long, long, long, long, long)
EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, Pack1, Pack2, StorageOrder, Conjugate, PanelMode>
  ::operator()(Scalar* blockA, const Scalar* EIGEN_RESTRICT _lhs, Index lhsStride, Index depth, Index rows, Index stride, Index offset)
{
  typedef typename packet_traits<Scalar>::type Packet;
  enum { PacketSize = packet_traits<Scalar>::size };

  EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK LHS");
  EIGEN_UNUSED_VARIABLE(stride)
  EIGEN_UNUSED_VARIABLE(offset)
  eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
  eigen_assert( (StorageOrder==RowMajor) || ((Pack1%PacketSize)==0 && Pack1<=4*PacketSize) );
  conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
  const_blas_data_mapper<Scalar, Index, StorageOrder> lhs(_lhs,lhsStride);
  Index count = 0;
  Index peeled_mc = (rows/Pack1)*Pack1;
  for(Index i=0; i<peeled_mc; i+=Pack1)
  {
    if(PanelMode) count += Pack1 * offset;

    if(StorageOrder==ColMajor)
    {
      for(Index k=0; k<depth; k++)
      {
        Packet A, B, C, D;
        if(Pack1>=1*PacketSize) A = ploadu<Packet>(&lhs(i+0*PacketSize, k));
        if(Pack1>=2*PacketSize) B = ploadu<Packet>(&lhs(i+1*PacketSize, k));
        if(Pack1>=3*PacketSize) C = ploadu<Packet>(&lhs(i+2*PacketSize, k));
        if(Pack1>=4*PacketSize) D = ploadu<Packet>(&lhs(i+3*PacketSize, k));
        if(Pack1>=1*PacketSize) { pstore(blockA+count, cj.pconj(A)); count+=PacketSize; }
        if(Pack1>=2*PacketSize) { pstore(blockA+count, cj.pconj(B)); count+=PacketSize; }
        if(Pack1>=3*PacketSize) { pstore(blockA+count, cj.pconj(C)); count+=PacketSize; }
        if(Pack1>=4*PacketSize) { pstore(blockA+count, cj.pconj(D)); count+=PacketSize; }
      }
    }
    else
    {
      for(Index k=0; k<depth; k++)
      {
        // TODO add a vectorized transpose here
        Index w=0;
        for(; w<Pack1-3; w+=4)
        {
          Scalar a(cj(lhs(i+w+0, k))),
                  b(cj(lhs(i+w+1, k))),
                  c(cj(lhs(i+w+2, k))),
                  d(cj(lhs(i+w+3, k)));
          blockA[count++] = a;
          blockA[count++] = b;
          blockA[count++] = c;
          blockA[count++] = d;
        }
        if(Pack1%4)
          for(;w<Pack1;++w)
            blockA[count++] = cj(lhs(i+w, k));
      }
    }
    if(PanelMode) count += Pack1 * (stride-offset-depth);
  }
  if(rows-peeled_mc>=Pack2)
  {
    if(PanelMode) count += Pack2*offset;
    for(Index k=0; k<depth; k++)
      for(Index w=0; w<Pack2; w++)
        blockA[count++] = cj(lhs(peeled_mc+w, k));
    if(PanelMode) count += Pack2 * (stride-offset-depth);
    peeled_mc += Pack2;
  }
  for(Index i=peeled_mc; i<rows; i++)
  {
    if(PanelMode) count += offset;
    for(Index k=0; k<depth; k++)
      blockA[count++] = cj(lhs(i, k));
    if(PanelMode) count += (stride-offset-depth);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x38(%rsp), %rax
orq 0x30(%rsp), %rax
jne 0x413f5
leaq 0x3(%r9), %r10
testq %r9, %r9
cmovnsq %r9, %r10
movq %r10, %rax
andq $-0x4, %rax
cmpq $0x4, %r9
jl 0x4136f
leaq 0x10(%rdx), %r11
leaq (,%rcx,8), %rbx
xorl %edi, %edi
xorl %r14d, %r14d
movq %r11, %r15
movq %r8, %r12
testq %r8, %r8
jle 0x41360
movups -0x10(%r15), %xmm0
movups (%r15), %xmm1
movaps %xmm0, (%rsi,%rdi,8)
movaps %xmm1, 0x10(%rsi,%rdi,8)
addq $0x4, %rdi
addq %rbx, %r15
decq %r12
jne 0x41342
addq $0x4, %r14
addq $0x20, %r11
cmpq %rax, %r14
jl 0x41337
jmp 0x41371
xorl %edi, %edi
movq %r9, %r11
subq %rax, %r11
cmpq $0x2, %r11
jl 0x413b0
testq %r8, %r8
jle 0x413ac
sarq $0x2, %r10
shlq $0x5, %r10
leaq (,%rcx,8), %r11
addq %rdx, %r10
movq %r8, %rbx
movups (%r10), %xmm0
movups %xmm0, (%rsi,%rdi,8)
addq $0x2, %rdi
addq %r11, %r10
decq %rbx
jne 0x41398
orq $0x2, %rax
cmpq %r9, %rax
jge 0x413e9
leaq (%rdx,%rax,8), %rdx
shlq $0x3, %rcx
movq %rdx, %r10
movq %r8, %r11
testq %r8, %r8
jle 0x413dd
movsd (%r10), %xmm0
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
addq %rcx, %r10
decq %r11
jne 0x413c8
incq %rax
addq $0x8, %rdx
cmpq %r9, %rax
jne 0x413bd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1b02c(%rip), %rdi     # 0x5c428
leaq 0x1b080(%rip), %rsi     # 0x5c483
leaq 0x1b194(%rip), %rcx     # 0x5c59e
movl $0x46d, %edx            # imm = 0x46D
callq 0xc340