// File: /workspace/github_cpp_makefile_star2_O3/icemiliang[P]vot/src/vot/../../include/Eigen/src/SparseCore/SparseMatrix.h
// Function: void Eigen::internal::set_from_triplets<__gnu_cxx::__normal_iterator<Eigen::Triplet<double, int>*, std::vector<Eigen::Triplet<double, int>, std::allocator<Eigen::Triplet<double, int>>>>, Eigen::SparseMatrix<double, 0, int>, Eigen::internal::scalar_sum_op<double, double>>(__gnu_cxx::__normal_iterator<Eigen::Triplet<double, int>*, std::vector<Eigen::Triplet<double, int>, std::allocator<Eigen::Triplet<double, int>>>> const&, __gnu_cxx::__normal_iterator<Eigen::Triplet<double, int>*, std::vector<Eigen::Triplet<double, int>, std::allocator<Eigen::Triplet<double, int>>>> const&, Eigen::SparseMatrix<double, 0, int>&, Eigen::internal::scalar_sum_op<double, double>)
void set_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, DupFunctor dup_func)
{
  enum { IsRowMajor = SparseMatrixType::IsRowMajor };
  typedef typename SparseMatrixType::Scalar Scalar;
  typedef typename SparseMatrixType::StorageIndex StorageIndex;
  SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor,StorageIndex> trMat(mat.rows(),mat.cols());

  if(begin!=end)
  {
    // pass 1: count the nnz per inner-vector
    typename SparseMatrixType::IndexVector wi(trMat.outerSize());
    wi.setZero();
    for(InputIterator it(begin); it!=end; ++it)
    {
      eigen_assert(it->row()>=0 && it->row()<mat.rows() && it->col()>=0 && it->col()<mat.cols());
      wi(IsRowMajor ? it->col() : it->row())++;
    }

    // pass 2: insert all the elements into trMat
    trMat.reserve(wi);
    for(InputIterator it(begin); it!=end; ++it)
      trMat.insertBackUncompressed(it->row(),it->col()) = it->value();

    // pass 3:
    trMat.collapseDuplicates(dup_func);
  }

  // pass 4: transposed copy -> implicit sorting
  mat = trMat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdx), %rdx
movq 0x10(%rbx), %rsi
leaq 0x20(%rsp), %rdi
movb $0x0, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x38(%rdi)
callq 0x14e06
movq (%r15), %rax
cmpq (%r14), %rax
je 0x14659
movq 0x28(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
testq %r12, %r12
js 0x1471f
je 0x1453b
movabsq $0x3ffffffffffffffc, %rbp # imm = 0x3FFFFFFFFFFFFFFC
leaq 0x3(%rbp), %rax
cmpq %rax, %r12
ja 0x146f1
leaq (,%r12,4), %rdi
callq 0x74c0
movq %rax, %r13
cmpq $0x4, %r12
setae %al
testb $0xf, %r13b
setne %cl
testb %cl, %al
jne 0x1473e
testq %r13, %r13
je 0x146f1
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
andq %r12, %rbp
cmpq $0x4, %r12
jb 0x14545
leaq -0x4(,%rbp,4), %rdx
andq $-0x10, %rdx
addq $0x10, %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x71e0
jmp 0x14545
movq %r12, 0x18(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpq %r12, %rbp
je 0x14569
shlq $0x2, %r12
movq %r12, %rax
andq $-0x10, %rax
addq %rax, %r13
andl $0xc, %r12d
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x71e0
movq (%r15), %rax
movq (%r14), %rcx
cmpq %rax, %rcx
je 0x145c4
movq 0x10(%rbx), %rdx
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdi
movslq (%rax), %r8
testq %r8, %r8
js 0x14694
cmpq %r8, %rdx
jle 0x14694
movslq 0x4(%rax), %r9
testq %r9, %r9
js 0x14694
cmpq %r9, 0x8(%rbx)
jle 0x14694
cmpq %r8, %rdi
jle 0x146d2
incl (%rsi,%r8,4)
addq $0x10, %rax
cmpq %rcx, %rax
jne 0x14582
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x14ed8
movq (%r15), %rax
movq (%r14), %rcx
cmpq %rax, %rcx
je 0x14640
movq 0x40(%rsp), %rdx
testq %rdx, %rdx
je 0x1475d
movq 0x38(%rsp), %rsi
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %r8
movslq (%rax), %r11
movl (%rdx,%r11,4), %r10d
movl (%rsi,%r11,4), %r9d
movl 0x4(%rsi,%r11,4), %ebp
subl %r9d, %ebp
cmpl %ebp, %r10d
jg 0x146b3
movl 0x4(%rax), %ebp
movsd 0x8(%rax), %xmm0
leal 0x1(%r10), %r14d
movl %r14d, (%rdx,%r11,4)
addl %r10d, %r9d
movslq %r9d, %r9
movl %ebp, (%rdi,%r9,4)
movsd %xmm0, (%r8,%r9,8)
addq $0x10, %rax
cmpq %rcx, %rax
jne 0x145fb
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rsi
callq 0x147b4
movq 0x10(%rsp), %rdi
callq 0x7430
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x14a06
leaq 0x48(%rsp), %rbx
movq -0x10(%rbx), %rdi
callq 0x7430
movq -0x8(%rbx), %rdi
callq 0x7430
movq %rbx, %rdi
callq 0x14eb6
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3678c(%rip), %rdi     # 0x4ae27
leaq 0x367d2(%rip), %rsi     # 0x4ae74
leaq 0x367fd(%rip), %rcx     # 0x4aea6
movl $0x3a6, %edx            # imm = 0x3A6
callq 0x7240
leaq 0x370a7(%rip), %rdi     # 0x4b761
leaq 0x367b3(%rip), %rsi     # 0x4ae74
leaq 0x37018(%rip), %rcx     # 0x4b6e0
movl $0x37c, %edx            # imm = 0x37C
callq 0x7240
leaq 0x36e9b(%rip), %rdi     # 0x4b574
leaq 0x36eb1(%rip), %rsi     # 0x4b591
leaq 0x36ed9(%rip), %rcx     # 0x4b5c0
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x7240
movl $0x8, %edi
callq 0x71b0
movq 0x4c87e(%rip), %rcx     # 0x60f80
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x4c890(%rip), %rsi     # 0x60fa0
movq 0x4c841(%rip), %rdx     # 0x60f58
movq %rax, %rdi
callq 0x7690
leaq 0x368c9(%rip), %rdi     # 0x4afef
leaq 0x3694c(%rip), %rsi     # 0x4b079
leaq 0x36974(%rip), %rcx     # 0x4b0a8
movl $0x138, %edx            # imm = 0x138
callq 0x7240
leaq 0x369cf(%rip), %rdi     # 0x4b114
leaq 0x36a82(%rip), %rsi     # 0x4b1ce
leaq 0x36aa6(%rip), %rcx     # 0x4b1f9
movl $0xa1, %edx
callq 0x7240
leaq 0x36f6c(%rip), %rdi     # 0x4b6d0
leaq 0x36709(%rip), %rsi     # 0x4ae74
leaq 0x36f6e(%rip), %rcx     # 0x4b6e0
movl $0x37b, %edx            # imm = 0x37B
callq 0x7240
jmp 0x1477e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x7430
jmp 0x14792
jmp 0x1478f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x14de2
jmp 0x147ab
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x14eb6
movq %rbx, %rdi
callq 0x76d0
nop