// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/voro++/src/container_prd.cc
// Function: voro::container_periodic::find_voronoi_cell(double, double, double, double&, double&, double&, int&)
bool container_periodic::find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid) {
	int ai,aj,ak,ci,cj,ck,ijk;
	particle_record w;
	double mrs;

	// Remap the vector into the primary domain and then search for the
	// Voronoi cell that it is within
	remap(ai,aj,ak,ci,cj,ck,x,y,z,ijk);
	vc.find_voronoi_cell(x,y,z,ci,cj,ck,ijk,w,mrs);

	if(w.ijk!=-1) {

		// Assemble the position vector of the particle to be returned,
		// applying a periodic remapping if necessary
		ci+=w.di;if(ci<0||ci>=nx) ai+=step_div(ci,nx);
		rx=p[w.ijk][3*w.l]+ak*bxz+aj*bxy+ai*bx;
		ry=p[w.ijk][3*w.l+1]+ak*byz+aj*by;
		rz=p[w.ijk][3*w.l+2]+ak*bz;
		pid=id[w.ijk][w.l];
		return true;
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
movsd 0x168(%rdi), %xmm3
mulsd %xmm2, %xmm3
xorpd %xmm4, %xmm4
xorl %eax, %eax
ucomisd %xmm3, %xmm4
seta %al
cvttsd2si %xmm3, %ecx
movapd %xmm0, %xmm3
subl %eax, %ecx
setns %al
movl 0x130(%rdi), %esi
cmpl %esi, %ecx
setl %dl
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
testb %dl, %al
je 0x31af4
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
jmp 0x31b39
testl %ecx, %ecx
js 0x31aff
movl %ecx, %eax
cltd
idivl %esi
jmp 0x31b07
leal 0x1(%rcx), %eax
cltd
idivl %esi
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x28(%r15), %xmm0
mulsd %xmm1, %xmm0
subsd %xmm0, %xmm2
movupd 0x18(%r15), %xmm0
movapd %xmm1, 0x20(%rsp)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
subpd %xmm1, %xmm3
imull %eax, %esi
subl %esi, %ecx
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
mulsd 0x160(%r15), %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm4
seta %al
cvttsd2si %xmm0, %r9d
subl %eax, %r9d
setns %al
movl 0x12c(%r15), %esi
cmpl %esi, %r9d
setl %dl
testb %dl, %al
jne 0x31ba8
testl %r9d, %r9d
js 0x31b7c
movl %r9d, %eax
cltd
idivl %esi
jmp 0x31b85
leal 0x1(%r9), %eax
cltd
idivl %esi
decl %eax
xorps %xmm4, %xmm4
cvtsi2sd %eax, %xmm4
movupd 0x8(%r15), %xmm0
movapd %xmm4, %xmm1
unpcklpd %xmm4, %xmm1            # xmm1 = xmm1[0],xmm4[0]
mulpd %xmm0, %xmm1
subpd %xmm1, %xmm3
imull %eax, %esi
subl %esi, %r9d
movsd 0x158(%r15), %xmm0
mulsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
cvttsd2si %xmm0, %ebx
subl %eax, %ebx
setns %al
movl 0x128(%r15), %esi
cmpl %esi, %ebx
setl %dl
testb %dl, %al
movapd %xmm4, 0x30(%rsp)
je 0x31be9
xorl %ebp, %ebp
movapd %xmm3, %xmm0
jmp 0x31c1b
testl %ebx, %ebx
js 0x31bf6
movl %ebx, %eax
cltd
idivl %esi
movl %eax, %ebp
jmp 0x31c00
leal 0x1(%rbx), %eax
cltd
idivl %esi
movl %eax, %ebp
decl %ebp
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
mulsd (%r15), %xmm1
movapd %xmm3, %xmm0
subsd %xmm1, %xmm0
movl %ebp, %eax
imull %esi, %eax
subl %eax, %ebx
addl 0x180(%r15), %r9d
addl 0x184(%r15), %ecx
movl 0x190(%r15), %r8d
imull %ecx, %r8d
addl %r9d, %r8d
imull %esi, %r8d
addl %ebx, %r8d
leaq 0x1d0(%r15), %rdi
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
leaq 0x60(%rsp), %rax
movq %rax, (%rsp)
leaq 0x4c(%rsp), %r14
movapd %xmm3, %xmm1
movl %ebx, %esi
movl %r9d, %edx
movq %r14, %r9
callq 0x273d4
movslq (%r14), %rcx
cmpq $-0x1, %rcx
je 0x31d47
addl 0x54(%rsp), %ebx
setns %al
movl 0x128(%r15), %esi
cmpl %esi, %ebx
setl %dl
testb %dl, %al
je 0x31c94
movapd 0x30(%rsp), %xmm2
jmp 0x31cb0
testl %ebx, %ebx
movapd 0x30(%rsp), %xmm2
js 0x31ca5
movl %ebx, %eax
cltd
idivl %esi
jmp 0x31cae
incl %ebx
movl %ebx, %eax
cltd
idivl %esi
decl %eax
addl %eax, %ebp
movq 0x1a8(%r15), %rax
movq (%rax,%rcx,8), %rdx
movslq 0x50(%rsp), %rax
leaq (%rax,%rax,2), %rsi
movsd 0x18(%r15), %xmm0
movapd 0x20(%rsp), %xmm3
mulsd %xmm3, %xmm0
addsd (%rdx,%rsi,8), %xmm0
movsd 0x8(%r15), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd (%r15), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r13)
movsd 0x20(%r15), %xmm0
mulsd %xmm3, %xmm0
addsd 0x8(%rdx,%rsi,8), %xmm0
mulsd 0x10(%r15), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, (%r12)
mulsd 0x28(%r15), %xmm3
addsd 0x10(%rdx,%rsi,8), %xmm3
movq 0x10(%rsp), %rdx
movsd %xmm3, (%rdx)
movq 0x1a0(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
movl (%rdx,%rax,4), %eax
movq 0x18(%rsp), %rdx
movl %eax, (%rdx)
cmpl $-0x1, %ecx
setne %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq