// File: j-faria[P]kima/eigen/Eigen/src/Core/Redux.h
// Function: double Eigen::internal::redux_impl<Eigen::internal::scalar_sum_op<double, double>, Eigen::internal::redux_evaluator<Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<double>, Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, 1, true>, -1, 1, false> const>>, 3, 0>::run<Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<double>, Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, 1, true>, -1, 1, false> const>>(Eigen::internal::redux_evaluator<Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<double>, Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, 1, true>, -1, 1, false> const>> const&, Eigen::internal::scalar_sum_op<double, double> const&, Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<double>, Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, 1, true>, -1, 1, false> const> const&)
static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr)
  {
    const Index size = xpr.size();
    
    const Index packetSize = redux_traits<Func, Evaluator>::PacketSize;
    const int packetAlignment = unpacket_traits<PacketScalar>::alignment;
    enum {
      alignment0 = (bool(Evaluator::Flags & DirectAccessBit) && bool(packet_traits<Scalar>::AlignedOnScalar)) ? int(packetAlignment) : int(Unaligned),
      alignment = EIGEN_PLAIN_ENUM_MAX(alignment0, Evaluator::Alignment)
    };
    const Index alignedStart = internal::first_default_aligned(xpr);
    const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize);
    const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize);
    const Index alignedEnd2 = alignedStart + alignedSize2;
    const Index alignedEnd  = alignedStart + alignedSize;
    Scalar res;
    if(alignedSize)
    {
      PacketScalar packet_res0 = eval.template packet<alignment,PacketScalar>(alignedStart);
      if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop
      {
        PacketScalar packet_res1 = eval.template packet<alignment,PacketScalar>(alignedStart+packetSize);
        for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize)
        {
          packet_res0 = func.packetOp(packet_res0, eval.template packet<alignment,PacketScalar>(index));
          packet_res1 = func.packetOp(packet_res1, eval.template packet<alignment,PacketScalar>(index+packetSize));
        }

        packet_res0 = func.packetOp(packet_res0,packet_res1);
        if(alignedEnd>alignedEnd2)
          packet_res0 = func.packetOp(packet_res0, eval.template packet<alignment,PacketScalar>(alignedEnd2));
      }
      res = func.predux(packet_res0);

      for(Index index = 0; index < alignedStart; ++index)
        res = func(res,eval.coeff(index));

      for(Index index = alignedEnd; index < size; ++index)
        res = func(res,eval.coeff(index));
    }
    else // too small to vectorize anything.
         // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize.
    {
      res = eval.coeff(0);
      for(Index index = 1; index < size; ++index)
        res = func(res,eval.coeff(index));
    }

    return res;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x34f60
movq %rax, -0x20(%rbp)
movq $0x2, -0x28(%rbp)
movl $0x10, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x26870
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
subq -0x38(%rbp), %rax
movl $0x4, %ecx
cqto
idivq %rcx
shlq $0x2, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
subq -0x38(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
shlq %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x3548a
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x358c0
movapd %xmm0, -0x70(%rbp)
cmpq $0x2, -0x48(%rbp)
jle 0x353a0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x2, %rsi
callq 0x358c0
movapd %xmm0, -0x80(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x50(%rbp), %rax
jge 0x35342
movq -0x10(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x358c0
movq -0x100(%rbp), %rdi
movapd %xmm0, -0xa0(%rbp)
leaq -0x70(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x35910
movapd %xmm0, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq $0x2, %rsi
callq 0x358c0
movq -0xf8(%rbp), %rdi
movapd %xmm0, -0xb0(%rbp)
leaq -0x80(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x35910
movapd %xmm0, -0x80(%rbp)
movq -0x88(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x88(%rbp)
jmp 0x35298
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x35910
movapd %xmm0, -0x70(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jle 0x3539e
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x358c0
movq -0x108(%rbp), %rdi
movapd %xmm0, -0xc0(%rbp)
leaq -0x70(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x35910
movapd %xmm0, -0x70(%rbp)
jmp 0x353a0
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x35940
movsd %xmm0, -0x60(%rbp)
movq $0x0, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x3541d
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x35990
movq -0x110(%rbp), %rdi
movsd %xmm0, -0xd0(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x35960
movsd %xmm0, -0x60(%rbp)
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x353bd
movq -0x58(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x35488
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x35990
movq -0x118(%rbp), %rdi
movsd %xmm0, -0xe0(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x35960
movsd %xmm0, -0x60(%rbp)
movq -0xd8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd8(%rbp)
jmp 0x35428
jmp 0x35509
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x35990
movsd %xmm0, -0x60(%rbp)
movq $0x1, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x35507
movq -0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x8(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x35990
movq -0x120(%rbp), %rdi
movsd %xmm0, -0xf0(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x35960
movsd %xmm0, -0x60(%rbp)
movq -0xe8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe8(%rbp)
jmp 0x354a7
jmp 0x35509
movsd -0x60(%rbp), %xmm0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw (%rax,%rax)