// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdx), %rdx
movq 0x10(%rbx), %rsi
leaq 0x28(%rsp), %rdi
callq 0x10084
movq (%r15), %rax
cmpq (%r14), %rax
je 0x10014
movq 0x30(%rsp), %rax
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x100c6
leaq 0x8(%rsp), %rdi
callq 0x100f6
movq (%r15), %r13
leaq 0x8(%rsp), %r12
cmpq (%r14), %r13
je 0xffb1
movslq (%r13), %rsi
testq %rsi, %rsi
js 0x10039
cmpq %rsi, 0x10(%rbx)
jle 0x10039
movslq 0x4(%r13), %rax
testq %rax, %rax
js 0x10039
cmpq %rax, 0x8(%rbx)
jle 0x10039
movq %r12, %rdi
callq 0x10106
incl (%rax)
addq $0x10, %r13
jmp 0xff6e
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x10990
movq (%r15), %r12
leaq 0x28(%rsp), %r15
cmpq (%r14), %r12
je 0xfffb
movsd 0x8(%r12), %xmm0
movsd %xmm0, 0x18(%rsp)
movslq (%r12), %rsi
movslq 0x4(%r12), %rdx
movq %r15, %rdi
callq 0x1013c
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
addq $0x10, %r12
jmp 0xffc8
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rsi
callq 0x101c0
movq 0x8(%rsp), %rdi
callq 0x7410
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x10394
leaq 0x28(%rsp), %rdi
callq 0x10566
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x2ed97(%rip), %rdi     # 0x3edd7
leaq 0x2eddd(%rip), %rsi     # 0x3ee24
leaq 0x2ee08(%rip), %rcx     # 0x3ee56
movl $0x3a6, %edx            # imm = 0x3A6
callq 0x7270
jmp 0x10065
jmp 0x1005c
movq %rax, %rbx
jmp 0x10072
jmp 0x10065
jmp 0x10065
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x7410
leaq 0x28(%rsp), %rdi
callq 0x10566
movq %rbx, %rdi
callq 0x76c0