// File: /workspace/github_cpp_makefile_star2_O2/icemiliang[P]vot/src/vot/cell.cc
// Function: voro::voronoicell_base::centroid(double&, double&, double&)
void voronoicell_base::centroid(double &cx,double &cy,double &cz) {
    double tvol,vol=0;cx=cy=cz=0;
    int i,j,k,l,m,n;
    double ux,uy,uz,vx,vy,vz,wx,wy,wz;
    for(i=1;i<p;i++) {
        ux=*pts-pts[3*i];
        uy=pts[1]-pts[3*i+1];
        uz=pts[2]-pts[3*i+2];
        for(j=0;j<nu[i];j++) {
            k=ed[i][j];
            if(k>=0) {
                ed[i][j]=-1-k;
                l=cycle_up(ed[i][nu[i]+j],k);
                vx=pts[3*k]-*pts;
                vy=pts[3*k+1]-pts[1];
                vz=pts[3*k+2]-pts[2];
                m=ed[k][l];ed[k][l]=-1-m;
                while(m!=i) {
                    n=cycle_up(ed[k][nu[k]+l],m);
                    wx=pts[3*m]-*pts;
                    wy=pts[3*m+1]-pts[1];
                    wz=pts[3*m+2]-pts[2];
                    tvol=ux*vy*wz+uy*vz*wx+uz*vx*wy-uz*vy*wx-uy*vx*wz-ux*vz*wy;
                    vol+=tvol;
                    cx+=(wx+vx-ux)*tvol;
                    cy+=(wy+vy-uy)*tvol;
                    cz+=(wz+vz-uz)*tvol;
                    k=m;l=n;vx=wx;vy=wy;vz=wz;
                    m=ed[k][l];ed[k][l]=-1-m;
                }
            }
        }
    }
    reset_edges();
    if(vol>tolerance_sq) {
        vol=0.125/vol;
        cx=cx*vol+0.5*(*pts);
        cy=cy*vol+0.5*pts[1];
        cz=cz*vol+0.5*pts[2];
    } else cx=cy=cz=0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
andq $0x0, (%rcx)
movq %rdx, %r14
andq $0x0, (%rdx)
movq %rsi, %r15
andq $0x0, (%rsi)
movq %rdi, %r12
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %rcx
xorpd %xmm15, %xmm15
pushq $0x1
popq %rdx
movapd 0x26d53(%rip), %xmm0    # 0x3eb60
xorl %esi, %esi
movslq 0x18(%r12), %rdi
cmpq %rdi, %rdx
jge 0x18023
imulq $0x18, %rdx, %rdi
movsd (%rcx), %xmm1
movsd 0x8(%rcx), %xmm2
subsd (%rcx,%rdi), %xmm1
subsd 0x8(%rcx,%rdi), %xmm2
movsd 0x10(%rcx), %xmm3
subsd 0x10(%rcx,%rdi), %xmm3
movq 0x20(%r12), %rdi
movapd %xmm3, %xmm4
xorpd %xmm0, %xmm4
movapd %xmm2, %xmm5
xorpd %xmm0, %xmm5
movapd %xmm1, %xmm6
xorpd %xmm0, %xmm6
xorl %r8d, %r8d
movslq (%rax,%rdx,4), %r9
cmpq %r9, %r8
jge 0x1801b
movq (%rdi,%rdx,8), %r9
movl (%r9,%r8,4), %r13d
testl %r13d, %r13d
js 0x18013
movl %r13d, %r10d
notl %r10d
movl %r10d, (%r9,%r8,4)
movslq (%rax,%rdx,4), %r10
movslq %r8d, %r11
addq %r10, %r11
movl (%r9,%r11,4), %r10d
movl (%rax,%r13,4), %r11d
decl %r11d
leal 0x1(%r10), %r9d
cmpl %r10d, %r11d
cmovel %esi, %r9d
imulq $0x18, %r13, %r10
movupd (%rcx,%r10), %xmm8
movupd (%rcx), %xmm7
subpd %xmm7, %xmm8
movsd 0x10(%rcx,%r10), %xmm7
subsd 0x10(%rcx), %xmm7
movq %r13, %r10
movq (%rdi,%r10,8), %r10
movslq %r9d, %r9
movl (%r10,%r9,4), %r11d
movl %r11d, %ebp
notl %ebp
movl %ebp, (%r10,%r9,4)
cmpq %r11, %rdx
je 0x18013
movslq %r11d, %r10
movslq %r13d, %r13
movq (%rdi,%r13,8), %rbp
movslq (%rax,%r13,4), %r13
addq %r9, %r13
movl (%rbp,%r13,4), %r13d
movl (%rax,%r10,4), %ebp
decl %ebp
leal 0x1(%r13), %r9d
cmpl %r13d, %ebp
cmovel %esi, %r9d
leal (%r10,%r10,2), %ebp
movslq %ebp, %r13
movupd (%rcx,%r13,8), %xmm9
movupd (%rcx), %xmm10
subpd %xmm10, %xmm9
movsd 0x10(%rcx,%r13,8), %xmm10
subsd 0x10(%rcx), %xmm10
movapd %xmm8, %xmm12
unpckhpd %xmm8, %xmm12           # xmm12 = xmm12[1],xmm8[1]
movapd %xmm1, %xmm13
mulsd %xmm12, %xmm13
movapd %xmm2, %xmm11
mulsd %xmm7, %xmm11
mulsd %xmm9, %xmm11
mulsd %xmm10, %xmm13
addsd %xmm11, %xmm13
movapd %xmm3, %xmm14
mulsd %xmm8, %xmm14
movapd %xmm9, %xmm11
unpckhpd %xmm9, %xmm11           # xmm11 = xmm11[1],xmm9[1]
mulsd %xmm11, %xmm14
addsd %xmm13, %xmm14
movapd %xmm7, %xmm13
mulsd %xmm6, %xmm13
mulsd %xmm11, %xmm13
addsd %xmm12, %xmm11
mulsd %xmm4, %xmm12
mulsd %xmm9, %xmm12
addsd %xmm14, %xmm12
movapd %xmm8, %xmm14
mulsd %xmm5, %xmm14
mulsd %xmm10, %xmm14
addsd %xmm12, %xmm14
addsd %xmm14, %xmm13
addsd %xmm9, %xmm8
subsd %xmm1, %xmm8
mulsd %xmm13, %xmm8
addsd (%r15), %xmm8
addsd %xmm13, %xmm15
movsd %xmm8, (%r15)
subsd %xmm2, %xmm11
mulsd %xmm13, %xmm11
addsd (%r14), %xmm11
movsd %xmm11, (%r14)
addsd %xmm10, %xmm7
subsd %xmm3, %xmm7
mulsd %xmm13, %xmm7
addsd (%rbx), %xmm7
movsd %xmm7, (%rbx)
movl %r11d, %r13d
movapd %xmm10, %xmm7
movapd %xmm9, %xmm8
jmp 0x17eca
incq %r8
jmp 0x17e60
incq %rdx
jmp 0x17e0f
movq %r12, %rdi
movsd %xmm15, (%rsp)
callq 0x1ea08
movsd (%rsp), %xmm1
ucomisd 0x2c472(%rip), %xmm1    # 0x444b0
jbe 0x180a1
movsd 0x2c460(%rip), %xmm0    # 0x444a8
divsd %xmm1, %xmm0
movq 0x30(%r12), %rax
movsd 0x2c45f(%rip), %xmm1    # 0x444b8
movsd (%rax), %xmm2
mulsd %xmm1, %xmm2
movsd (%r15), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%r15)
movsd 0x8(%rax), %xmm2
mulsd %xmm1, %xmm2
movsd (%r14), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%r14)
mulsd 0x10(%rax), %xmm1
mulsd (%rbx), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
jmp 0x180ad
andq $0x0, (%rbx)
andq $0x0, (%r14)
andq $0x0, (%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq