// File: /workspace/github_cpp_makefile_star2_O2/canzarlab[P]Trajan/./Eigen/src/Core/products/TriangularSolverMatrix.h
// Function: Eigen::internal::triangular_solve_matrix<double, long, 2, 2, false, 1, 0>::run(long, long, double const*, long, double*, long, Eigen::internal::level3_blocking<double, double>&)
EIGEN_DONT_INLINE void triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorageOrder,ColMajor>::run(
    Index size, Index otherSize,
    const Scalar* _tri, Index triStride,
    Scalar* _other, Index otherStride,
    level3_blocking<Scalar,Scalar>& blocking)
  {
    Index rows = otherSize;
    typedef typename NumTraits<Scalar>::Real RealScalar;

    typedef blas_data_mapper<Scalar, Index, ColMajor> LhsMapper;
    typedef const_blas_data_mapper<Scalar, Index, TriStorageOrder> RhsMapper;
    LhsMapper lhs(_other, otherStride);
    RhsMapper rhs(_tri, triStride);

    typedef gebp_traits<Scalar,Scalar> Traits;
    enum {
      RhsStorageOrder   = TriStorageOrder,
      SmallPanelWidth   = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
      IsLower = (Mode&Lower) == Lower
    };

    Index kc = blocking.kc();                   // cache block size along the K direction
    Index mc = (std::min)(rows,blocking.mc());  // cache block size along the M direction

    std::size_t sizeA = kc*mc;
    std::size_t sizeB = kc*size;

    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, sizeA, blocking.blockA());
    ei_declare_aligned_stack_constructed_variable(Scalar, blockB, sizeB, blocking.blockB());

    conj_if<Conjugate> conj;
    gebp_kernel<Scalar, Scalar, Index, LhsMapper, Traits::mr, Traits::nr, false, Conjugate> gebp_kernel;
    gemm_pack_rhs<Scalar, Index, RhsMapper, Traits::nr, RhsStorageOrder> pack_rhs;
    gemm_pack_rhs<Scalar, Index, RhsMapper, Traits::nr, RhsStorageOrder,false,true> pack_rhs_panel;
    gemm_pack_lhs<Scalar, Index, LhsMapper, Traits::mr, Traits::LhsProgress, ColMajor, false, true> pack_lhs_panel;

    for(Index k2=IsLower ? size : 0;
        IsLower ? k2>0 : k2<size;
        IsLower ? k2-=kc : k2+=kc)
    {
      const Index actual_kc = (std::min)(IsLower ? k2 : size-k2, kc);
      Index actual_k2 = IsLower ? k2-actual_kc : k2 ;

      Index startPanel = IsLower ? 0 : k2+actual_kc;
      Index rs = IsLower ? actual_k2 : size - actual_k2 - actual_kc;
      Scalar* geb = blockB+actual_kc*actual_kc;

      if (rs>0) pack_rhs(geb, rhs.getSubMapper(actual_k2,startPanel), actual_kc, rs);

      // triangular packing (we only pack the panels off the diagonal,
      // neglecting the blocks overlapping the diagonal
      {
        for (Index j2=0; j2<actual_kc; j2+=SmallPanelWidth)
        {
          Index actualPanelWidth = std::min<Index>(actual_kc-j2, SmallPanelWidth);
          Index actual_j2 = actual_k2 + j2;
          Index panelOffset = IsLower ? j2+actualPanelWidth : 0;
          Index panelLength = IsLower ? actual_kc-j2-actualPanelWidth : j2;

          if (panelLength>0)
          pack_rhs_panel(blockB+j2*actual_kc,
                         rhs.getSubMapper(actual_k2+panelOffset, actual_j2),
                         panelLength, actualPanelWidth,
                         actual_kc, panelOffset);
        }
      }

      for(Index i2=0; i2<rows; i2+=mc)
      {
        const Index actual_mc = (std::min)(mc,rows-i2);

        // triangular solver kernel
        {
          // for each small block of the diagonal (=> vertical panels of rhs)
          for (Index j2 = IsLower
                      ? (actual_kc - ((actual_kc%SmallPanelWidth) ? Index(actual_kc%SmallPanelWidth)
                                                                  : Index(SmallPanelWidth)))
                      : 0;
               IsLower ? j2>=0 : j2<actual_kc;
               IsLower ? j2-=SmallPanelWidth : j2+=SmallPanelWidth)
          {
            Index actualPanelWidth = std::min<Index>(actual_kc-j2, SmallPanelWidth);
            Index absolute_j2 = actual_k2 + j2;
            Index panelOffset = IsLower ? j2+actualPanelWidth : 0;
            Index panelLength = IsLower ? actual_kc - j2 - actualPanelWidth : j2;

            // GEBP
            if(panelLength>0)
            {
              gebp_kernel(lhs.getSubMapper(i2,absolute_j2),
                          blockA, blockB+j2*actual_kc,
                          actual_mc, panelLength, actualPanelWidth,
                          Scalar(-1),
                          actual_kc, actual_kc, // strides
                          panelOffset, panelOffset); // offsets
            }

            // unblocked triangular solve
            for (Index k=0; k<actualPanelWidth; ++k)
            {
              Index j = IsLower ? absolute_j2+actualPanelWidth-k-1 : absolute_j2+k;

              Scalar* r = &lhs(i2,j);
              for (Index k3=0; k3<k; ++k3)
              {
                Scalar b = conj(rhs(IsLower ? j+1+k3 : absolute_j2+k3,j));
                Scalar* a = &lhs(i2,IsLower ? j+1+k3 : absolute_j2+k3);
                for (Index i=0; i<actual_mc; ++i)
                  r[i] -= a[i] * b;
              }
              if((Mode & UnitDiag)==0)
              {
                Scalar inv_rjj = RealScalar(1)/conj(rhs(j,j));
                for (Index i=0; i<actual_mc; ++i)
                  r[i] *= inv_rjj;
              }
            }

            // pack the just computed part of lhs to A
            pack_lhs_panel(blockA, LhsMapper(_other+absolute_j2*otherStride+i2, otherStride),
                           actualPanelWidth, actual_mc,
                           actual_kc, j2);
          }
        }

        if (rs>0)
          gebp_kernel(lhs.getSubMapper(i2, startPanel), blockA, geb,
                      actual_mc, actual_kc, rs, Scalar(-1),
                      -1, -1, 0, 0);
      }
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %r9, -0x60(%rbp)
movq %r8, -0xa0(%rbp)
movq %rcx, %r15
movq %rdx, -0x80(%rbp)
movq %rdi, -0x90(%rbp)
movq 0x10(%rbp), %r12
movq 0x10(%r12), %rax
movq 0x20(%r12), %rcx
cmpq %rsi, %rax
movq %rsi, -0xb0(%rbp)
movq %rsi, %rbx
movq %rax, -0x120(%rbp)
cmovlq %rax, %rbx
movq %rbx, -0xa8(%rbp)
movq %rcx, -0x88(%rbp)
imulq %rcx, %rbx
movq %rbx, %rax
shrq $0x3d, %rax
je 0x22f23
callq 0xe355
movabsq $0x1fffffffffffffff, %r13 # imm = 0x1FFFFFFFFFFFFFFF
movq -0x88(%rbp), %r14
imulq -0x90(%rbp), %r14
movq (%r12), %rax
leaq (,%rbx,8), %rdi
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x22f5f
cmpq $0x20001, %rdi          # imm = 0x20001
setae %al
xorl %ecx, %ecx
jmp 0x22f97
cmpq $0x20000, %rdi          # imm = 0x20000
ja 0x22f81
movq %rsp, %rcx
addq $0x1e, %rdi
andq $-0x10, %rdi
subq %rdi, %rcx
movq %rcx, %rsp
xorl %eax, %eax
movq %rcx, -0x58(%rbp)
jmp 0x22f97
callq 0xe382
xorl %ecx, %ecx
cmpq $0x0, (%r12)
movq %rax, -0x58(%rbp)
cmoveq %rax, %rcx
movb $0x1, %al
movq %rcx, -0x170(%rbp)
movq %rbx, -0x168(%rbp)
movb %al, -0x160(%rbp)
cmpq %r13, %r14
jbe 0x22fb5
callq 0xe355
movq 0x8(%r12), %rax
leaq (,%r14,8), %rbx
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x22fcf
xorl %edx, %edx
jmp 0x23007
cmpq $0x20000, %rbx          # imm = 0x20000
ja 0x22fef
movq %rsp, %rdx
leaq 0x1e(%rbx), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, %rsp
movq %rdx, -0x50(%rbp)
jmp 0x23007
movq %rbx, %rdi
callq 0xe382
xorl %edx, %edx
cmpq $0x0, 0x8(%r12)
movq %rax, -0x50(%rbp)
cmoveq %rax, %rdx
cmpq $0x20001, %rbx          # imm = 0x20001
movq %rdx, -0x158(%rbp)
movq %r14, -0x150(%rbp)
setae -0x148(%rbp)
movq -0x88(%rbp), %rcx
leaq (,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
movq %rcx, %rdx
movq -0x60(%rbp), %rax
imulq %rax, %rdx
shlq $0x3, %rdx
movq %rdx, -0xe0(%rbp)
movq -0xa8(%rbp), %rdx
leaq (,%rdx,8), %rdx
movq %rdx, -0x108(%rbp)
movq %rax, %rdx
shlq $0x5, %rdx
movq %rdx, -0x138(%rbp)
leaq (,%rax,8), %r14
movsd 0x3079d(%rip), %xmm3    # 0x53820
movq -0xa0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x80(%rbp), %r12
movq -0x90(%rbp), %r13
xorl %ebx, %ebx
cmpq %r13, %rcx
movq %r13, %rax
cmovlq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x90(%rbp), %r8
subq %rbx, %r8
movq -0x50(%rbp), %rdx
jle 0x2355a
cmpq %r8, %rcx
movq %r8, %r9
cmovlq %rcx, %r9
leaq (%r9,%rbx), %rcx
movq %r9, %rax
imulq %r9, %rax
leaq (%rdx,%rax,8), %rsi
subq %r9, %r8
movq %r8, -0x118(%rbp)
movq %r9, -0x68(%rbp)
movq %rsi, -0x110(%rbp)
movq %rcx, -0x70(%rbp)
movq %r13, -0xf8(%rbp)
movq %rbx, -0xc8(%rbp)
jle 0x2314a
imulq %r15, %rbx
movq -0x80(%rbp), %rax
leaq (%rax,%rbx,8), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq %r15, -0x38(%rbp)
subq $0x8, %rsp
leaq -0x2c(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movq %r9, %rcx
xorl %r9d, %r9d
pushq $0x0
callq 0x196d8
popq %rax
popq %rcx
movsd 0x306e0(%rip), %xmm3    # 0x53820
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rcx
jmp 0x2314e
imulq %r15, %rbx
movq -0xb8(%rbp), %rax
movq %rax, %rdx
shlq $0x5, %rdx
movq %rdx, -0x78(%rbp)
movq %r12, -0xf0(%rbp)
leaq (%r12,%rbx,8), %rdx
movq -0x50(%rbp), %rsi
xorl %r13d, %r13d
cmpq %r9, %r13
jge 0x231de
testq %r13, %r13
je 0x231cc
cmpq $0x4, %rax
pushq $0x4
popq %r8
movq %rax, -0x48(%rbp)
cmovlq %rax, %r8
movq %rdx, %rbx
movq %rdx, -0x40(%rbp)
movq %r15, -0x38(%rbp)
subq $0x8, %rsp
leaq -0x2b(%rbp), %rdi
movq %rsi, %r12
leaq -0x40(%rbp), %rdx
movq %r13, %rcx
pushq $0x0
callq 0x235b4
popq %rax
popq %rcx
movsd 0x30666(%rip), %xmm3    # 0x53820
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rcx
movq %rbx, %rdx
movq %r12, %rsi
movq -0x48(%rbp), %rax
addq $0x4, %r13
addq $0x20, %rdx
addq -0x78(%rbp), %rsi
addq $-0x4, %rax
jmp 0x23172
imulq -0x60(%rbp), %rcx
movq -0xa0(%rbp), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, -0x100(%rbp)
movq -0x98(%rbp), %rdx
movq -0xb0(%rbp), %r12
xorl %esi, %esi
pushq $0x4
popq %r13
movq -0xb0(%rbp), %rax
movq -0x120(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, %rbx
cmovlq %rcx, %rbx
cmpq %r12, %rbx
cmovgeq %r12, %rbx
testq %rbx, %rbx
movl $0x0, %ecx
cmovleq %rcx, %rbx
movq %rax, %r8
subq %rsi, %r8
jle 0x23517
movq %r12, -0x130(%rbp)
movq -0xa8(%rbp), %rax
cmpq %rax, %r8
cmovgeq %rax, %r8
movq -0xa0(%rbp), %rax
movq %rsi, -0xc0(%rbp)
leaq (%rax,%rsi,8), %rax
movq %rax, -0xd8(%rbp)
movq %rdx, -0x128(%rbp)
movq %rdx, -0x48(%rbp)
movq -0xb8(%rbp), %rcx
xorl %edx, %edx
movq %r8, -0xd0(%rbp)
cmpq $0x4, %rcx
movq %r13, %r12
cmovlq %rcx, %r12
testq %r12, %r12
movl $0x0, %eax
cmovleq %rax, %r12
movq %r9, %rax
subq %rdx, %rax
jle 0x23473
movq %rcx, -0x140(%rbp)
cmpq $0x4, %rax
cmovgeq %r13, %rax
movq %rax, -0x70(%rbp)
movq -0xc8(%rbp), %rax
leaq (%rdx,%rax), %r13
movq %rdx, -0x78(%rbp)
testq %rdx, %rdx
je 0x23359
movq %r13, %rax
movq -0x60(%rbp), %rcx
imulq %rcx, %rax
movq -0xd8(%rbp), %rdx
leaq (%rdx,%rax,8), %rax
movq %rax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
movq -0x78(%rbp), %r10
movq %r10, %rax
imulq %r9, %rax
movq -0x50(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
subq $0x30, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq %r9, 0x10(%rsp)
movq %r9, 0x8(%rsp)
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
leaq -0x29(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %r10, %r9
movsd 0x2e0a3(%rip), %xmm0    # 0x513e0
callq 0x179fe
addq $0x30, %rsp
movsd 0x304d2(%rip), %xmm3    # 0x53820
movq -0x68(%rbp), %r9
movq -0xd0(%rbp), %r8
movq -0x48(%rbp), %rax
xorl %ecx, %ecx
cmpq %r12, %rcx
je 0x233fa
leaq (%rcx,%r13), %rdx
movq -0x80(%rbp), %rsi
leaq (%rsi,%rdx,8), %rsi
movq -0x48(%rbp), %rdi
xorl %r11d, %r11d
cmpq %rcx, %r11
je 0x233bd
leaq (%r11,%r13), %r10
imulq %r15, %r10
movsd (%rsi,%r10,8), %xmm0
xorl %r10d, %r10d
cmpq %r10, %rbx
je 0x233b5
movsd (%rax,%r10,8), %xmm1
movsd (%rdi,%r10,8), %xmm2
mulsd %xmm0, %xmm2
subsd %xmm2, %xmm1
movsd %xmm1, (%rax,%r10,8)
incq %r10
jmp 0x23391
incq %r11
addq %r14, %rdi
jmp 0x2337b
movq %rdx, %rsi
imulq %r15, %rsi
movq -0x80(%rbp), %rdi
leaq (%rdi,%rsi,8), %rsi
movapd %xmm3, %xmm0
divsd (%rsi,%rdx,8), %xmm0
xorl %edx, %edx
cmpq %rdx, %rbx
je 0x233ef
movsd (%rax,%rdx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rdx,8)
incq %rdx
jmp 0x233d7
incq %rcx
addq %r14, %rax
jmp 0x2335f
movq -0x60(%rbp), %rcx
imulq %rcx, %r13
movq -0xd8(%rbp), %rax
leaq (%rax,%r13,8), %rax
movq %rax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
subq $0x8, %rsp
leaq -0x2a(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r12
pushq %r12
callq 0x23718
popq %rax
popq %rcx
addq $0x4, %r12
movq -0x140(%rbp), %rcx
addq $-0x4, %rcx
movq -0x48(%rbp), %rax
addq -0x138(%rbp), %rax
movq %rax, -0x48(%rbp)
pushq $0x4
popq %r13
movsd 0x303c0(%rip), %xmm3    # 0x53820
movq -0x68(%rbp), %r9
movq -0xd0(%rbp), %r8
movq %r12, %rdx
jmp 0x23289
movq -0x118(%rbp), %rdx
testq %rdx, %rdx
movq -0x110(%rbp), %rcx
movq -0x130(%rbp), %r12
jle 0x234f0
movq -0x100(%rbp), %rax
movq -0xc0(%rbp), %rsi
leaq (%rax,%rsi,8), %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
subq $0x30, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
orq $-0x1, 0x10(%rsp)
orq $-0x1, 0x8(%rsp)
movq %rdx, (%rsp)
leaq -0x29(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x58(%rbp), %rdx
movsd 0x2df05(%rip), %xmm0    # 0x513e0
callq 0x179fe
addq $0x30, %rsp
movsd 0x30334(%rip), %xmm3    # 0x53820
movq -0x68(%rbp), %r9
movq -0xa8(%rbp), %rax
movq -0xc0(%rbp), %rsi
addq %rax, %rsi
subq %rax, %r12
movq -0x128(%rbp), %rdx
addq -0x108(%rbp), %rdx
jmp 0x23209
movq -0x88(%rbp), %rcx
movq -0xc8(%rbp), %rbx
addq %rcx, %rbx
movq -0xf8(%rbp), %r13
subq %rcx, %r13
movq -0xf0(%rbp), %r12
addq -0xe8(%rbp), %r12
movq -0x98(%rbp), %rax
addq -0xe0(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x2309e
leaq -0x158(%rbp), %rdi
callq 0x15448
leaq -0x170(%rbp), %rdi
callq 0x15448
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x23583
movq %rax, %rbx
jmp 0x2359f
jmp 0x23590
jmp 0x23590
jmp 0x23590
jmp 0x23590
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x15448
leaq -0x170(%rbp), %rdi
callq 0x15448
movq %rbx, %rdi
callq 0x9640
nop