// File: 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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rdi, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
movsd %xmm1, -0x30(%rbp)
movsd %xmm2, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
movq %r8, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movq %rdi, -0x98(%rbp)
leaq -0x5c(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x64(%rbp), %rcx
leaq -0x68(%rbp), %r8
leaq -0x6c(%rbp), %r9
leaq -0x70(%rbp), %r14
leaq -0x28(%rbp), %rbx
leaq -0x30(%rbp), %r11
leaq -0x38(%rbp), %r10
leaq -0x74(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x1eb90
testb $0x1, %al
jne 0x1d14e
movb $0x0, -0x11(%rbp)
jmp 0x1d377
movq -0x98(%rbp), %rdi
addq $0xd8, %rdi
movsd -0x28(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
movl -0x68(%rbp), %esi
movl -0x6c(%rbp), %edx
movl -0x70(%rbp), %ecx
movl -0x74(%rbp), %r8d
leaq -0x88(%rbp), %r9
leaq -0x90(%rbp), %rax
movq %rax, (%rsp)
callq 0x29370
cmpl $-0x1, -0x88(%rbp)
je 0x1d373
movq -0x98(%rbp), %rax
testb $0x1, 0xa8(%rax)
je 0x1d1e2
movl -0x80(%rbp), %eax
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x68(%rbp)
jl 0x1d1c9
movq -0x98(%rbp), %rcx
movl -0x68(%rbp), %eax
cmpl (%rcx), %eax
jl 0x1d1e0
movq -0x98(%rbp), %rdi
movl -0x68(%rbp), %esi
movl (%rdi), %edx
callq 0x1ee80
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0x1d1e2
movq -0x98(%rbp), %rax
testb $0x1, 0xa9(%rax)
je 0x1d22a
movl -0x7c(%rbp), %eax
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jl 0x1d210
movq -0x98(%rbp), %rcx
movl -0x6c(%rbp), %eax
cmpl 0x4(%rcx), %eax
jl 0x1d228
movq -0x98(%rbp), %rdi
movl -0x6c(%rbp), %esi
movl 0x4(%rdi), %edx
callq 0x1ee80
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x1d22a
movq -0x98(%rbp), %rax
testb $0x1, 0xaa(%rax)
je 0x1d272
movl -0x78(%rbp), %eax
addl -0x70(%rbp), %eax
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
jl 0x1d258
movq -0x98(%rbp), %rcx
movl -0x70(%rbp), %eax
cmpl 0x8(%rcx), %eax
jl 0x1d270
movq -0x98(%rbp), %rdi
movl -0x70(%rbp), %esi
movl 0x8(%rdi), %edx
callq 0x1ee80
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x1d272
movq -0x98(%rbp), %rax
movq 0xb8(%rax), %rcx
movslq -0x88(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
imull $0x3, -0x84(%rbp), %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm1
cvtsi2sdl -0x5c(%rbp), %xmm0
movsd 0x78(%rax), %xmm2
subsd 0x70(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x40(%rbp), %rcx
movsd %xmm0, (%rcx)
movq 0xb8(%rax), %rcx
movslq -0x88(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
imull $0x3, -0x84(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm1
cvtsi2sdl -0x60(%rbp), %xmm0
movsd 0x88(%rax), %xmm2
subsd 0x80(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x48(%rbp), %rcx
movsd %xmm0, (%rcx)
movq 0xb8(%rax), %rcx
movslq -0x88(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
imull $0x3, -0x84(%rbp), %edx
addl $0x2, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm1
cvtsi2sdl -0x64(%rbp), %xmm0
movsd 0x98(%rax), %xmm2
subsd 0x90(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x50(%rbp), %rcx
movsd %xmm0, (%rcx)
movq 0xb0(%rax), %rax
movslq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x84(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x11(%rbp)
jmp 0x1d377
movb $0x0, -0x11(%rbp)
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)