// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/v_network.cc
// Function: void voronoi_network::add_to_network_rectangular_internal<voro::voronoicell>(voro::voronoicell&, int, double, double, double, double, int*)
void voronoi_network::add_to_network_rectangular_internal(v_cell &c,int idn,double x,double y,double z,double rad,int *cmap) {
	int i,j,k,ijk,l,q,ai,aj,ak,*vmp(cmap);
	double vx,vy,vz,crad,*cp(c.pts);
	
	for(l=0;l<c.p;l++,vmp+=4) {
		vx=x+cp[4*l]*0.5;vy=y+cp[4*l+1]*0.5;vz=z+cp[4*l+2]*0.5;
		crad=0.5*sqrt(cp[4*l]*cp[4*l]+cp[4*l+1]*cp[4*l+1]+cp[4*l+2]*cp[4*l+2])-rad;
		if(safe_search_previous_rect(vx,vy,vz,ijk,q,vmp[1],vmp[2],vmp[3])) {
			*vmp=idmem[ijk][q];

			// Store this radius if it smaller than the current
			// value
			if(pts[ijk][4*q+3]>crad) pts[ijk][4*q+3]=crad;			
		} else {
			k=step_int(vz*zsp);
			if(k<0||k>=nz) {
				ak=step_div(k,nz);
				vz-=ak*bz;vy-=ak*byz;vx-=ak*bxz;k-=ak*nz;
			} else ak=0;
			j=step_int(vy*ysp);
			if(j<0||j>=ny) {
				aj=step_div(j,ny);
				vy-=aj*by;vx-=aj*bxy;j-=aj*ny;
			} else aj=0;
			i=step_int(vx*xsp);
			if(i<0||i>=nx) {
				ai=step_div(i,nx);
				vx-=ai*bx;i-=ai*nx;
			} else ai=0;
			vmp[1]=ai;
			vmp[2]=aj;
			vmp[3]=ak;
			ijk=i+nx*(j+ny*k);
			if(edc==edmem) add_edge_network_memory();
			if(ptsc[ijk]==ptsmem[ijk]) add_network_memory(ijk);
			reg[edc]=ijk;regp[edc]=ptsc[ijk];
			pts[ijk][4*ptsc[ijk]]=vx;
			pts[ijk][4*ptsc[ijk]+1]=vy;
			pts[ijk][4*ptsc[ijk]+2]=vz;
			pts[ijk][4*ptsc[ijk]+3]=crad;
			idmem[ijk][ptsc[ijk]++]=edc;
			*vmp=edc++;
		}

		add_neighbor(*vmp,idn);
	}

	add_edges_to_network(c,x,y,z,rad,cmap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, 0x40(%rsp)
movapd %xmm3, 0x70(%rsp)
movsd %xmm2, 0x58(%rsp)
movsd %xmm1, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movq %rdi, %r15
movq %rsi, 0x30(%rsp)
cmpl $0x0, 0x1c(%rsi)
jle 0x83ba6
movl %edx, %ebp
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x60(%rsp)
movapd 0xcfeaa(%rip), %xmm0    # 0x1535b0
xorpd 0x70(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
xorl %r14d, %r14d
movq 0x40(%rsp), %r12
movq %r14, %rax
shlq $0x5, %rax
movq 0x60(%rsp), %rcx
movsd (%rcx,%rax), %xmm4
movsd 0x8(%rcx,%rax), %xmm1
movsd 0x10(%rcx,%rax), %xmm2
movapd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movapd %xmm4, %xmm3
mulsd %xmm4, %xmm3
addsd %xmm0, %xmm3
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
ucomisd 0xcfb5e(%rip), %xmm0    # 0x1532c0
jb 0x8376d
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
jmp 0x8379a
movsd %xmm2, 0x18(%rsp)
movsd %xmm1, 0x10(%rsp)
movsd %xmm4, 0x8(%rsp)
callq 0x4350
movsd 0x8(%rsp), %xmm4
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movapd %xmm0, %xmm3
movsd 0xcb896(%rip), %xmm0    # 0x14f038
mulsd %xmm0, %xmm4
addsd 0x48(%rsp), %xmm4
mulsd %xmm0, %xmm1
addsd 0x50(%rsp), %xmm1
mulsd %xmm0, %xmm2
addsd 0x58(%rsp), %xmm2
mulsd %xmm0, %xmm3
addsd 0x80(%rsp), %xmm3
movsd %xmm3, 0x20(%rsp)
leaq 0x4(%r12), %rbx
leaq 0x8(%r12), %r13
leaq 0xc(%r12), %r9
movq %r15, %rdi
movsd %xmm4, 0x8(%rsp)
movapd %xmm4, %xmm0
movsd %xmm1, 0x10(%rsp)
movsd %xmm2, 0x18(%rsp)
leaq 0x2c(%rsp), %rsi
leaq 0x3c(%rsp), %rdx
movq %rbx, %rcx
movq %r13, %r8
movq %r9, 0x68(%rsp)
callq 0x81f5a
testb %al, %al
je 0x8386a
movq 0x68(%r15), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movslq 0x3c(%rsp), %rax
movl (%rdx,%rax,4), %edx
movl %edx, (%r12)
movq 0x60(%r15), %rdx
movq (%rdx,%rcx,8), %rcx
leaq (,%rax,4), %rdx
movsd 0x18(%rcx,%rdx,8), %xmm0
movsd 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x83b18
leaq 0x3(,%rax,4), %rax
movsd %xmm1, (%rcx,%rax,8)
jmp 0x83b18
movq %rbx, %r11
movsd 0x50(%r15), %xmm0
movsd 0x18(%rsp), %xmm2
mulsd %xmm2, %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
cvttsd2si %xmm0, %ebx
subl %eax, %ebx
setns %al
movl 0x38(%r15), %edi
cmpl %edi, %ebx
setl %dl
xorl %ecx, %ecx
testb %dl, %al
je 0x838b2
xorl %esi, %esi
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm4
jmp 0x83907
testl %ebx, %ebx
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm4
js 0x838cb
movl %ebx, %eax
cltd
idivl %edi
movl %eax, %esi
jmp 0x838d5
leal 0x1(%rbx), %eax
cltd
idivl %edi
movl %eax, %esi
decl %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd 0x28(%r15), %xmm1
mulsd %xmm0, %xmm1
subsd %xmm1, %xmm2
movsd 0x20(%r15), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x18(%r15), %xmm0
subsd %xmm1, %xmm3
subsd %xmm0, %xmm4
imull %esi, %edi
subl %edi, %ebx
movsd 0x48(%r15), %xmm0
mulsd %xmm3, %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
cvttsd2si %xmm0, %edi
subl %eax, %edi
setns %al
movl 0x34(%r15), %r8d
cmpl %r8d, %edi
setl %dl
testb %dl, %al
jne 0x83974
testl %edi, %edi
js 0x83943
movl %edi, %eax
cltd
idivl %r8d
movl %eax, %ecx
jmp 0x8394e
leal 0x1(%rdi), %eax
cltd
idivl %r8d
movl %eax, %ecx
decl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x10(%r15), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x8(%r15), %xmm0
subsd %xmm1, %xmm3
subsd %xmm0, %xmm4
imull %ecx, %r8d
subl %r8d, %edi
movsd 0x40(%r15), %xmm0
mulsd %xmm4, %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
cvttsd2si %xmm0, %r8d
subl %eax, %r8d
setns %dl
movl 0x30(%r15), %r9d
cmpl %r9d, %r8d
setl %r10b
xorl %eax, %eax
testb %r10b, %dl
je 0x839b0
movsd 0x20(%rsp), %xmm1
jmp 0x839e5
testl %r8d, %r8d
movsd 0x20(%rsp), %xmm1
js 0x839c4
movl %r8d, %eax
cltd
idivl %r9d
jmp 0x839ce
leal 0x1(%r8), %eax
cltd
idivl %r9d
decl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd (%r15), %xmm0
subsd %xmm0, %xmm4
imull %eax, %r9d
subl %r9d, %r8d
movl %eax, (%r11)
movl %ecx, (%r13)
movq 0x68(%rsp), %rax
movl %esi, (%rax)
imull 0x34(%r15), %ebx
addl %edi, %ebx
imull 0x30(%r15), %ebx
addl %r8d, %ebx
movl %ebx, 0x2c(%rsp)
movl 0xa0(%r15), %eax
cmpl 0xa4(%r15), %eax
movsd %xmm2, 0x18(%rsp)
movsd %xmm3, 0x10(%rsp)
movsd %xmm4, 0x8(%rsp)
jne 0x83a48
movq %r15, %rdi
callq 0x80bea
movsd 0x8(%rsp), %xmm4
movsd 0x10(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movsd 0x20(%rsp), %xmm1
movslq %ebx, %r13
movq 0x70(%r15), %rax
movq 0x78(%r15), %rcx
movl (%rax,%r13,4), %eax
cmpl (%rcx,%r13,4), %eax
jne 0x83a7f
movq %r15, %rdi
movl %ebx, %esi
callq 0x80ada
movsd 0x8(%rsp), %xmm4
movsd 0x10(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movsd 0x20(%rsp), %xmm1
movq 0xc0(%r15), %rax
movslq 0xa0(%r15), %rcx
movl %ebx, (%rax,%rcx,4)
movq 0x70(%r15), %rax
movq 0xc8(%r15), %rcx
movl (%rax,%r13,4), %edx
movslq 0xa0(%r15), %rsi
movl %edx, (%rcx,%rsi,4)
movq 0x60(%r15), %rcx
movq (%rcx,%r13,8), %rcx
movslq (%rax,%r13,4), %rdx
leaq (,%rdx,4), %rsi
movq %rdx, %rdi
shlq $0x5, %rdi
movsd %xmm4, (%rcx,%rdi)
leal 0x1(%rsi), %edi
movslq %edi, %rdi
movsd %xmm3, (%rcx,%rdi,8)
leal 0x2(%rsi), %edi
movslq %edi, %rdi
movsd %xmm2, (%rcx,%rdi,8)
orl $0x3, %esi
movslq %esi, %rsi
movsd %xmm1, (%rcx,%rsi,8)
movl 0xa0(%r15), %ecx
movq 0x68(%r15), %rsi
movq (%rsi,%r13,8), %rsi
leal 0x1(%rdx), %edi
movl %edi, (%rax,%r13,4)
movl %ecx, (%rsi,%rdx,4)
movl 0xa0(%r15), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xa0(%r15)
movl %eax, (%r12)
movslq (%r12), %rbx
movq 0xb0(%r15), %rax
movslq (%rax,%rbx,4), %rax
testq %rax, %rax
jle 0x83b58
movq 0x88(%r15), %rcx
movq (%rcx,%rbx,8), %rcx
cmpl %ebp, (%rcx)
je 0x83b8d
leaq -0x1(%rax), %rdx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x83b58
leaq 0x1(%rsi), %rdi
cmpl %ebp, 0x4(%rcx,%rsi,4)
movq %rdi, %rsi
jne 0x83b41
cmpq %rax, %rdi
jb 0x83b8d
movq 0xb8(%r15), %rcx
cmpl (%rcx,%rbx,4), %eax
jne 0x83b6e
movq %r15, %rdi
movl %ebx, %esi
callq 0x80fa6
movq 0x88(%r15), %rax
movq 0xb0(%r15), %rcx
movq (%rax,%rbx,8), %rax
movslq (%rcx,%rbx,4), %rdx
leal 0x1(%rdx), %esi
movl %esi, (%rcx,%rbx,4)
movl %ebp, (%rax,%rdx,4)
incq %r14
addq $0x10, %r12
movq 0x30(%rsp), %rax
movslq 0x1c(%rax), %rax
cmpq %rax, %r14
jl 0x8371d
movq %r15, %rdi
movq 0x30(%rsp), %rsi
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
movsd 0x58(%rsp), %xmm2
movaps 0x70(%rsp), %xmm3
movq 0x40(%rsp), %rdx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x84374