// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/v_network.cc
// Function: voronoi_network::search_previous(double, double, double, double, double, int&, int&, int&, int&, int&)
bool voronoi_network::search_previous(double gx,double gy,double x,double y,double z,int &ijk,int &q,int &pi,int &pj,int &pk) {
	int ai=step_int((gx-net_tol)*xsp),bi=step_int((gx+net_tol)*xsp);
	int aj=step_int((gy-net_tol)*ysp),bj=step_int((gy+net_tol)*ysp);
	int ak=step_int((z-net_tol)*zsp),bk=step_int((z+net_tol)*zsp);
	int i,j,k,mi,mj,mk;
	double px,py,pz,px2,py2,px3,*pp;

	for(k=ak;k<=bk;k++) {
		pk=step_div(k,nz);px=pk*bxz;py=pk*byz;pz=pk*bz;mk=k-nz*pk;
		for(j=aj;j<=bj;j++) {
			pj=step_div(j,ny);px2=px+pj*bxy;py2=py+pj*by;mj=j-ny*pj;
			for(i=ai;i<=bi;i++) {
				pi=step_div(i,nx);px3=px2+pi*bx;mi=i-nx*pi;
				ijk=mi+nx*(mj+ny*mk);
				pp=pts[ijk];
				for(q=0;q<ptsc[ijk];q++,pp+=4) if(fabs(*pp+px3-x)<net_tol&&fabs(pp[1]+py2-y)<net_tol&&fabs(pp[2]+pz-z)<net_tol) return true;
			}
		}
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x18(%rsp)
movq %r8, -0x10(%rsp)
movq %rcx, -0x8(%rsp)
movq %rdx, %r10
movsd 0x58(%rdi), %xmm5
movapd %xmm0, %xmm7
subsd %xmm5, %xmm7
movsd 0x40(%rdi), %xmm8
mulsd %xmm8, %xmm7
xorpd %xmm6, %xmm6
xorl %eax, %eax
ucomisd %xmm7, %xmm6
seta %al
cvttsd2si %xmm7, %ecx
subl %eax, %ecx
movl %ecx, -0x30(%rsp)
addsd %xmm5, %xmm0
mulsd %xmm8, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm6
seta %al
cvttsd2si %xmm0, %r15d
subl %eax, %r15d
movapd %xmm5, %xmm0
addsd %xmm1, %xmm0
subsd %xmm5, %xmm1
movsd 0x48(%rdi), %xmm7
mulsd %xmm7, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm6
seta %al
cvttsd2si %xmm1, %ecx
subl %eax, %ecx
movl %ecx, -0x34(%rsp)
mulsd %xmm7, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm6
seta %al
cvttsd2si %xmm0, %ecx
subl %eax, %ecx
movl %ecx, -0x2c(%rsp)
movapd %xmm4, %xmm0
subsd %xmm5, %xmm0
movsd 0x50(%rdi), %xmm1
mulsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm6
seta %al
cvttsd2si %xmm0, %r11d
subl %eax, %r11d
movapd %xmm5, %xmm0
addsd %xmm4, %xmm0
mulsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm6
seta %al
cvttsd2si %xmm0, %ecx
subl %eax, %ecx
movsd 0x18(%rdi), %xmm0
movsd %xmm0, -0x20(%rsp)
movsd 0x20(%rdi), %xmm1
movsd 0x28(%rdi), %xmm0
movsd %xmm0, -0x28(%rsp)
movapd 0x9b3fa(%rip), %xmm7    # 0xfc0a0
cmpl %ecx, %r11d
jg 0x60e4b
movl 0x38(%rdi), %r8d
testl %r11d, %r11d
js 0x60cc1
movl %r11d, %eax
cltd
idivl %r8d
jmp 0x60ccb
leal 0x1(%r11), %eax
cltd
idivl %r8d
decl %eax
movq -0x18(%rsp), %rdx
movl %eax, (%rdx)
cvtsi2sd %eax, %xmm8
movsd -0x20(%rsp), %xmm9
mulsd %xmm8, %xmm9
movapd %xmm1, %xmm10
mulsd %xmm8, %xmm10
mulsd -0x28(%rsp), %xmm8
imull 0x38(%rdi), %eax
movl %r11d, %r9d
subl %eax, %r9d
movsd 0x8(%rdi), %xmm11
movsd 0x10(%rdi), %xmm12
movl -0x34(%rsp), %eax
movl %eax, %ebx
cmpl -0x2c(%rsp), %ebx
jg 0x60e43
movl 0x34(%rdi), %r8d
testl %ebx, %ebx
js 0x60d2a
movl %ebx, %eax
cltd
idivl %r8d
jmp 0x60d33
leal 0x1(%rbx), %eax
cltd
idivl %r8d
decl %eax
movq -0x10(%rsp), %rdx
movl %eax, (%rdx)
cvtsi2sd %eax, %xmm13
movapd %xmm13, %xmm14
mulsd %xmm11, %xmm14
addsd %xmm9, %xmm14
mulsd %xmm12, %xmm13
addsd %xmm10, %xmm13
imull 0x34(%rdi), %eax
movl %ebx, %r8d
subl %eax, %r8d
movsd (%rdi), %xmm15
movq 0x60(%rdi), %r12
movq 0x70(%rdi), %r13
movl -0x30(%rsp), %eax
movl %eax, %r14d
cmpl %r15d, %r14d
jg 0x60e3c
movl 0x30(%rdi), %ebp
testl %r14d, %r14d
js 0x60d8f
movl %r14d, %eax
cltd
idivl %ebp
jmp 0x60d98
leal 0x1(%r14), %eax
cltd
idivl %ebp
decl %eax
cvtsi2sd %eax, %xmm6
movq -0x8(%rsp), %rdx
movl %eax, (%rdx)
movl 0x30(%rdi), %edx
imull %edx, %eax
movl %r14d, %ebp
subl %eax, %ebp
movl 0x34(%rdi), %eax
imull %r9d, %eax
addl %r8d, %eax
imull %edx, %eax
addl %ebp, %eax
movl %eax, (%rsi)
cltq
movq (%r12,%rax,8), %rax
andl $0x0, (%r10)
mulsd %xmm15, %xmm6
addsd %xmm14, %xmm6
addq $0x10, %rax
xorl %edx, %edx
movslq (%rsi), %rbp
cmpl (%r13,%rbp,4), %edx
jge 0x60e34
movsd -0x10(%rax), %xmm0
addsd %xmm6, %xmm0
subsd %xmm2, %xmm0
andpd %xmm7, %xmm0
ucomisd %xmm0, %xmm5
jbe 0x60e29
movsd -0x8(%rax), %xmm0
addsd %xmm13, %xmm0
subsd %xmm3, %xmm0
andpd %xmm7, %xmm0
ucomisd %xmm0, %xmm5
jbe 0x60e29
movsd (%rax), %xmm0
addsd %xmm8, %xmm0
subsd %xmm4, %xmm0
andpd %xmm7, %xmm0
ucomisd %xmm0, %xmm5
ja 0x60e4b
incl %edx
movl %edx, (%r10)
addq $0x20, %rax
jmp 0x60dd9
incl %r14d
jmp 0x60d76
incl %ebx
jmp 0x60d10
incl %r11d
jmp 0x60ca6
cmpl %ecx, %r11d
setle %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq