// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/voro++/src/container.cc
// Function: voro::container::find_voronoi_cell(double, double, double, double&, double&, double&, int&)
bool container::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;

	// If the given vector lies outside the domain, but the container
	// is periodic, then remap it back into the domain
	if(!remap(ai,aj,ak,ci,cj,ck,x,y,z,ijk)) return false;
	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
		if(xperiodic) {ci+=w.di;if(ci<0||ci>=nx) ai+=step_div(ci,nx);}
		if(yperiodic) {cj+=w.dj;if(cj<0||cj>=ny) aj+=step_div(cj,ny);}
		if(zperiodic) {ck+=w.dk;if(ck<0||ck>=nz) ak+=step_div(ck,nz);}
		rx=p[w.ijk][3*w.l]+ai*(bx-ax);
		ry=p[w.ijk][3*w.l+1]+aj*(by-ay);
		rz=p[w.ijk][3*w.l+2]+ak*(bz-az);
		pid=id[w.ijk][w.l];
		return true;
	}

	// If no particle if found then just return false
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, 0x28(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
leaq 0x40(%rsp), %rax
movsd %xmm0, (%rax)
leaq 0x38(%rsp), %r10
movsd %xmm1, (%r10)
leaq 0x30(%rsp), %r11
movsd %xmm2, (%r11)
subq $0x8, %rsp
leaq 0x2c(%rsp), %rbp
leaq 0x14(%rsp), %rbx
leaq 0x28(%rsp), %rsi
leaq 0x24(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
pushq %rbp
pushq %r11
pushq %r10
pushq %rax
pushq %rbx
callq 0x159e2
addq $0x30, %rsp
testb %al, %al
je 0x14446
leaq 0xd8(%r15), %rdi
movsd 0x40(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
movl 0x24(%rsp), %r8d
subq $0x8, %rsp
leaq 0x68(%rsp), %rax
leaq 0x54(%rsp), %rbp
movq %rbp, %r9
pushq %rax
callq 0x1ad0a
addq $0x10, %rsp
movslq (%rbp), %rcx
cmpq $-0x1, %rcx
je 0x14446
cmpb $0x1, 0xa8(%r15)
jne 0x14458
movl 0x14(%rsp), %eax
addl 0x54(%rsp), %eax
movl %eax, 0x14(%rsp)
setns %dl
movl (%r15), %esi
cmpl %esi, %eax
setl %dil
testb %dil, %dl
jne 0x14458
testl %eax, %eax
js 0x1444d
cltd
idivl %esi
jmp 0x14454
xorl %eax, %eax
jmp 0x14574
incl %eax
cltd
idivl %esi
decl %eax
addl %eax, 0x20(%rsp)
cmpb $0x1, 0xa9(%r15)
jne 0x14494
movl 0x10(%rsp), %eax
addl 0x58(%rsp), %eax
movl %eax, 0x10(%rsp)
setns %dl
movl 0x4(%r15), %esi
cmpl %esi, %eax
setl %dil
testb %dil, %dl
jne 0x14494
testl %eax, %eax
js 0x14489
cltd
idivl %esi
jmp 0x14490
incl %eax
cltd
idivl %esi
decl %eax
addl %eax, 0x1c(%rsp)
cmpb $0x1, 0xaa(%r15)
jne 0x144d0
movl 0xc(%rsp), %eax
addl 0x5c(%rsp), %eax
movl %eax, 0xc(%rsp)
setns %dl
movl 0x8(%r15), %esi
cmpl %esi, %eax
setl %dil
testb %dil, %dl
jne 0x144d0
testl %eax, %eax
js 0x144c5
cltd
idivl %esi
jmp 0x144cc
incl %eax
cltd
idivl %esi
decl %eax
addl %eax, 0x18(%rsp)
movq 0xb8(%r15), %rax
movq (%rax,%rcx,8), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x20(%rsp), %xmm0
movslq 0x50(%rsp), %rdx
movsd 0x78(%r15), %xmm1
subsd 0x70(%r15), %xmm1
leaq (%rdx,%rdx,2), %rsi
mulsd %xmm0, %xmm1
addsd (%rax,%rsi,8), %xmm1
movsd %xmm1, (%r13)
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%rsp), %xmm0
movsd 0x88(%r15), %xmm1
subsd 0x80(%r15), %xmm1
mulsd %xmm0, %xmm1
addsd 0x8(%rax,%rsi,8), %xmm1
movsd %xmm1, (%r12)
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rsp), %xmm0
movsd 0x98(%r15), %xmm1
subsd 0x90(%r15), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rax,%rsi,8), %xmm1
movsd %xmm1, (%r14)
movq 0xb0(%r15), %rax
movq (%rax,%rcx,8), %rax
movl (%rax,%rdx,4), %eax
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
movb $0x1, %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop