// File: /workspace/github_cpp_makefile_star2_O2/icemiliang[P]vot/src/vot/./container.hh
// Function: voro::container_poly::update_diagram(std::vector<vot::Dirac, std::allocator<vot::Dirac>>&, Eigen::SparseMatrix<double, 0, int>&)
inline void update_diagram(std::vector<vot::Dirac> &diracs, 
                                   Eigen::SparseMatrix<double>& pHessian) {
            c_loop_all vl(*this);
            voronoicell_neighbor c;
            if (vl.start()) {
                std::vector<Eigen::Triplet<double>> kijs;
                kijs.reserve(diracs.size());
                do {
                    // Update current cell
                    compute_cell(c, vl);

                    // Compute Hessian
                    int idx = id[vl.ijk][vl.q];
                    // Coordinates of the current Centroid
                    double *pp; 
                    pp = p[vl.ijk] + ps*vl.q;

                    std::vector<int> nids;
                    std::vector<double> face_areas;
                    c.neighbors(nids);
                    c.face_areas(face_areas);
                    ASSERT_VOT(nids.size() == face_areas.size(), 
                           "Number of neighbor ids not equal to number of neighbor faces.");

                   for (int i = 0; i < (int)nids.size(); i++) {
                       if (nids[i] < 0) continue;
                       vot::Point tmp = vot::Point(diracs[nids[i]].x() - pp[0], 
                                                   diracs[nids[i]].y() - pp[1], 
                                                   diracs[nids[i]].z() - pp[2]);
                       double dist = tmp.norm();
                       ASSERT_VOT(dist > vot::otTOLERANCE, "Distance equals zero.");
                       kijs.push_back(Eigen::Triplet<double>(idx, nids[i], -face_areas[i] / dist));
                   }
                } while (vl.inc());

                // Put kijs into Hessian
                pHessian.setFromTriplets(kijs.begin(), kijs.end());
                // Fill up diagonal
               for (int iCol = 0; iCol < (int)diracs.size(); iCol++){
                   double sum = pHessian.col(iCol).sum();
                   pHessian.coeffRef(iCol,iCol) = -sum;
                }
                // Hessian may not be symmetric because kij may not equal kji.
                // Face areas at the two sizes of a same plane, computed by voro++, could be different .
                // Need average.
                Eigen::SparseMatrix<double> tmp = pHessian.transpose();
                pHessian = pHessian + tmp;
                pHessian = pHessian * 0.5;
            }
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xf812
leaq 0x108(%rsp), %rdi
callq 0x19ec0
movq %r12, %rdi
callq 0xf85c
testb %al, %al
je 0xf1a2
movq %rbx, 0x68(%rsp)
xorpd %xmm0, %xmm0
leaq 0x50(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x8(%r14), %rax
subq (%r14), %rax
pushq $0x30
popq %rcx
cqto
idivq %rcx
movq %rax, %rsi
callq 0xf9d8
leaq 0x108(%rsp), %r13
leaq 0xc0(%rsp), %rbx
movq %r15, 0x40(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xfa80
movslq 0xfc(%rsp), %rax
movq 0xa8(%r15), %rcx
movq 0xb0(%r15), %rdx
movq (%rcx,%rax,8), %rcx
movslq 0x100(%rsp), %rbp
movl (%rcx,%rbp,4), %ebx
movq (%rdx,%rax,8), %r12
movslq 0xc8(%r15), %r15
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %r13, %rdi
leaq 0x70(%rsp), %rsi
callq 0x1a01a
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x17a1c
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
cmpq %rsi, %rdx
jne 0xf22a
imulq %rbp, %r15
xorl %ebp, %ebp
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
movslq %edx, %rdx
cmpq %rdx, %rbp
jge 0xf077
movslq (%rax,%rbp,4), %rdx
testq %rdx, %rdx
js 0xf06f
movq (%r14), %rcx
imulq $0x30, %rdx, %rdx
movsd (%rcx,%rdx), %xmm0
movsd 0x8(%rcx,%rdx), %xmm1
subsd (%r12,%r15,8), %xmm0
subsd 0x8(%r12,%r15,8), %xmm1
movsd 0x10(%rcx,%rdx), %xmm2
subsd 0x10(%r12,%r15,8), %xmm2
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
sqrtsd %xmm2, %xmm0
ucomisd 0x2fb24(%rip), %xmm0    # 0x3eb50
jbe 0xf1c1
movq 0x10(%rsp), %rcx
movsd (%rcx,%rbp,8), %xmm1
xorpd 0x2fb1c(%rip), %xmm1    # 0x3eb60
divsd %xmm0, %xmm1
movl %ebx, (%rsp)
movl (%rax,%rbp,4), %eax
movl %eax, 0x4(%rsp)
movsd %xmm1, 0x8(%rsp)
leaq 0x50(%rsp), %rdi
movq %rsp, %rsi
callq 0xfd9a
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
incq %rbp
jmp 0xefbd
leaq 0x10(%rsp), %rdi
callq 0x12b6a
leaq 0x70(%rsp), %rdi
callq 0xfede
leaq 0xc0(%rsp), %rbx
movq %rbx, %rdi
callq 0xf8ba
testb %al, %al
movq 0x40(%rsp), %r15
jne 0xef15
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
leaq 0x70(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x10(%rsp), %rdx
movq %rcx, (%rdx)
movq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0xfaa6
xorl %r15d, %r15d
leaq 0x70(%rsp), %r12
pushq $0x30
popq %r13
movq 0x8(%r14), %rax
subq (%r14), %rax
cqto
idivq %r13
cltq
cmpq %rax, %r15
jge 0xf12f
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x110b4
movq %r12, %rdi
callq 0xfac0
movapd %xmm0, 0x40(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0xfb52
movapd 0x40(%rsp), %xmm0
xorpd 0x2fa3a(%rip), %xmm0    # 0x3eb60
movlpd %xmm0, (%rax)
incq %r15
jmp 0xf0db
leaq 0x10(%rsp), %rsi
movb $0x0, (%rsi)
movq %rbx, 0x8(%rsi)
leaq 0x70(%rsp), %rdi
callq 0xfc36
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
movq %rbx, %rsi
callq 0xfc78
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xfc94
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rsp, %rdx
movq %rax, (%rdx)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xfcc4
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xfd18
leaq 0x70(%rsp), %rdi
callq 0xf37a
leaq 0x50(%rsp), %rdi
callq 0x12b4c
leaq 0x108(%rsp), %rdi
callq 0x19fa8
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4be18(%rip), %rdi     # 0x5afe0
leaq 0x2fbaf(%rip), %rsi     # 0x3ed7e
callq 0x7360
leaq 0x2fb56(%rip), %rsi     # 0x3ed31
movq %rax, %rdi
callq 0x7360
leaq 0x2fac9(%rip), %rsi     # 0x3ecb3
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
movl $0x2bc, %esi            # imm = 0x2BC
callq 0x7690
leaq 0x2f24d(%rip), %rsi     # 0x3e453
movq %rax, %rdi
callq 0x7360
leaq 0x2fb9c(%rip), %rsi     # 0x3edb1
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71c0
callq 0x7130
movq 0x4bdaf(%rip), %rdi     # 0x5afe0
leaq 0x2fabd(%rip), %rsi     # 0x3ecf5
callq 0x7360
leaq 0x2faed(%rip), %rsi     # 0x3ed31
movq %rax, %rdi
callq 0x7360
leaq 0x2fa60(%rip), %rsi     # 0x3ecb3
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
movl $0x2b4, %esi            # imm = 0x2B4
callq 0x7690
leaq 0x2f1e4(%rip), %rsi     # 0x3e453
movq %rax, %rdi
callq 0x7360
leaq 0x2fac2(%rip), %rsi     # 0x3ed40
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71c0
jmp 0xf225
jmp 0xf2b2
jmp 0xf2b2
jmp 0xf2b2
jmp 0xf298
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xf37a
jmp 0xf2d2
movq %rax, %rbx
jmp 0xf2dc
jmp 0xf2b2
jmp 0xf2bb
jmp 0xf2b2
movq %rax, %rbx
jmp 0xf2d2
jmp 0xf2bb
jmp 0xf2bb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x12b6a
leaq 0x70(%rsp), %rdi
callq 0xfede
leaq 0x50(%rsp), %rdi
callq 0x12b4c
leaq 0x108(%rsp), %rdi
callq 0x19fa8
movq %rbx, %rdi
callq 0x76c0
nop