// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
movq 0x28(%rsp), %rax
orq 0x20(%rsp), %rax
jne 0x3ad0d
movq %rdx, %rdi
pushq $0x4
popq %r10
movq %r9, %rax
cqto
idivq %r10
xorl %r11d, %r11d
testq %r8, %r8
cmovleq %r11, %r8
leaq (,%rax,4), %rdx
leaq 0x10(%rdi), %rbx
shlq $0x3, %rcx
xorl %r10d, %r10d
cmpq %rdx, %r11
jge 0x3ac91
movq %rbx, %r14
movq %r8, %r15
subq $0x1, %r15
jb 0x3ac87
movups -0x10(%r14), %xmm0
movups (%r14), %xmm1
movaps %xmm0, (%rsi,%r10,8)
movaps %xmm1, 0x10(%rsi,%r10,8)
addq $0x4, %r10
addq %rcx, %r14
jmp 0x3ac64
addq $0x4, %r11
addq $0x20, %rbx
jmp 0x3ac59
movq %r9, %r11
subq %rdx, %r11
cmpq $0x2, %r11
jl 0x3acd7
shlq $0x5, %rax
addq %rdi, %rax
xorl %r11d, %r11d
cmpq %r8, %r11
je 0x3acd3
leaq (%rsi,%r10,8), %r14
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x3acc8
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, (%r14,%rbx,8)
incq %rbx
jmp 0x3acb2
incq %r11
addq %rbx, %r10
addq %rcx, %rax
jmp 0x3aca7
orq $0x2, %rdx
leaq (%rdi,%rdx,8), %rax
movq %rax, %rdi
movq %r8, %r11
cmpq %r9, %rdx
jge 0x3ad07
subq $0x1, %r11
jb 0x3acfe
movsd (%rdi), %xmm0
movsd %xmm0, (%rsi,%r10,8)
incq %r10
addq %rcx, %rdi
jmp 0x3ace6
incq %rdx
addq $0x8, %rax
jmp 0x3acdb
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1c894(%rip), %rdi     # 0x575a8
leaq 0x1c8e8(%rip), %rsi     # 0x57603
leaq 0x1c9fc(%rip), %rcx     # 0x5771e
movl $0x46d, %edx            # imm = 0x46D
callq 0xe380