// File: Kingsford-Group[P]ghost2/include/Eigen/src/Core/Redux.h
// Function: Eigen::internal::redux_impl<Eigen::internal::scalar_sum_op<double>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs2_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const>, 3, 0>::run(Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs2_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> const&, Eigen::internal::scalar_sum_op<double> const&)
static Scalar run(const Derived& mat, const Func& func)
  {
    const Index size = mat.size();
    eigen_assert(size && "you are using an empty matrix");
    const Index packetSize = packet_traits<Scalar>::size;
    const Index alignedStart = internal::first_aligned(mat);
    enum {
      alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit)
                ? Aligned : Unaligned
    };
    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 = mat.template packet<alignment>(alignedStart);
      if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop
      {
        PacketScalar packet_res1 = mat.template packet<alignment>(alignedStart+packetSize);
        for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize)
        {
          packet_res0 = func.packetOp(packet_res0, mat.template packet<alignment>(index));
          packet_res1 = func.packetOp(packet_res1, mat.template packet<alignment>(index+packetSize));
        }

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

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

      for(Index index = alignedEnd; index < size; ++index)
        res = func(res,mat.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 = mat.coeff(0);
      for(Index index = 1; index < size; ++index)
        res = func(res,mat.coeff(index));
    }

    return res;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4c430
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0xe1(%rbp)
je 0x4c599
movb $0x1, %al
movb %al, -0xe1(%rbp)
jmp 0x4c599
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x4c5a5
jmp 0x4c5a7
jmp 0x4c5c6
leaq 0x7484f(%rip), %rdi     # 0xc0dfd
leaq 0x74870(%rip), %rsi     # 0xc0e25
movl $0xca, %edx
leaq 0x74883(%rip), %rcx     # 0xc0e44
callq 0x104a0
movq $0x2, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x22bc0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
subq -0x28(%rbp), %rax
movl $0x4, %ecx
cqto
idivq %rcx
shlq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
subq -0x28(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
shlq %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x4c853
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x4c8e0
movapd %xmm0, -0x60(%rbp)
cmpq $0x2, -0x38(%rbp)
jle 0x4c769
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x2, %rsi
callq 0x4c8e0
movapd %xmm0, -0x70(%rbp)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0x4c70b
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x4c8e0
movq -0xf8(%rbp), %rdi
movapd %xmm0, -0x90(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x4c940
movapd %xmm0, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x78(%rbp), %rsi
addq $0x2, %rsi
callq 0x4c8e0
movq -0xf0(%rbp), %rdi
movapd %xmm0, -0xa0(%rbp)
leaq -0x70(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x4c940
movapd %xmm0, -0x70(%rbp)
movq -0x78(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x78(%rbp)
jmp 0x4c670
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x4c940
movapd %xmm0, -0x60(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jle 0x4c767
movq -0x10(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x4c8e0
movq -0x100(%rbp), %rdi
movapd %xmm0, -0xb0(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x4c940
movapd %xmm0, -0x60(%rbp)
jmp 0x4c769
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4c970
movsd %xmm0, -0x50(%rbp)
movq $0x0, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x4c7e6
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x4c9c0
movq -0x108(%rbp), %rdi
movsd %xmm0, -0xc0(%rbp)
leaq -0x50(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x4c990
movsd %xmm0, -0x50(%rbp)
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x4c786
movq -0x48(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x4c851
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x4c9c0
movq -0x110(%rbp), %rdi
movsd %xmm0, -0xd0(%rbp)
leaq -0x50(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x4c990
movsd %xmm0, -0x50(%rbp)
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x4c7f1
jmp 0x4c8d2
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4c9c0
movsd %xmm0, -0x50(%rbp)
movq $0x1, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x4c8d0
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x4c9c0
movq -0x118(%rbp), %rdi
movsd %xmm0, -0xe0(%rbp)
leaq -0x50(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x4c990
movsd %xmm0, -0x50(%rbp)
movq -0xd8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd8(%rbp)
jmp 0x4c870
jmp 0x4c8d2
movsd -0x50(%rbp), %xmm0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq