// File: 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
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 0x51c50
movq -0x98(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
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 0x3e270
cmpl $-0x1, -0x88(%rbp)
je 0x4f6a0
movl -0x80(%rbp), %eax
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x68(%rbp)
jl 0x4f560
movq -0x98(%rbp), %rcx
movl -0x68(%rbp), %eax
cmpl 0x128(%rcx), %eax
jl 0x4f585
movq -0x98(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movl -0x68(%rbp), %esi
movl 0x128(%rax), %edx
callq 0x1ee80
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x98(%rbp), %rax
movq 0x1a8(%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 -0x64(%rbp), %xmm0
movsd 0x18(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl -0x60(%rbp), %xmm1
movsd 0x8(%rax), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvtsi2sdl -0x5c(%rbp), %xmm0
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x40(%rbp), %rcx
movsd %xmm0, (%rcx)
movq 0x1a8(%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), %xmm0
cvtsi2sdl -0x64(%rbp), %xmm1
movsd 0x20(%rax), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvtsi2sdl -0x60(%rbp), %xmm0
movsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x48(%rbp), %rcx
movsd %xmm0, (%rcx)
movq 0x1a8(%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 0x28(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x50(%rbp), %rcx
movsd %xmm0, (%rcx)
movq 0x1a0(%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 0x4f6a4
movb $0x0, -0x11(%rbp)
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)