// File: Luthaf[P]zeopp/voro++/src/container_prd.cc
// Function: voro::container_periodic_base::put_locate_block(int&, double&, double&, double&)
void container_periodic_base::put_locate_block(int &ijk,double &x,double &y,double &z) {

	// Remap particle in the z direction if necessary
	int k=step_int(z*zsp);
	if(k<0||k>=nz) {
		int ak=step_div(k,nz);
		z-=ak*bz;y-=ak*byz;x-=ak*bxz;k-=ak*nz;
	}

	// Remap particle in the y direction if necessary
	int j=step_int(y*ysp);
	if(j<0||j>=ny) {
		int aj=step_div(j,ny);
		y-=aj*by;x-=aj*bxy;j-=aj*ny;
	}

	// Remap particle in the x direction if necessary
	ijk=step_int(x*xsp);
	if(ijk<0||ijk>=nx) {
		int ai=step_div(ijk,nx);
		x-=ai*bx;ijk-=ai*nx;
	}

	// Compute the block index and check memory allocation
	j+=ey;k+=ez;
	ijk+=nx*(j+oy*k);
	if(co[ijk]==mem[ijk]) add_particle_memory(ijk);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x168(%rax), %xmm0
callq 0x1f4a0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x4e41f
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x130(%rcx), %eax
jl 0x4e4f5
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movl -0x2c(%rbp), %esi
movl 0x130(%rax), %edx
callq 0x1ee80
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, -0x30(%rbp)
cvtsi2sdl -0x30(%rbp), %xmm0
movsd 0x28(%rax), %xmm2
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
cvtsi2sdl -0x30(%rbp), %xmm0
movsd 0x20(%rax), %xmm2
movq -0x20(%rbp), %rcx
movsd (%rcx), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
cvtsi2sdl -0x30(%rbp), %xmm0
movsd 0x18(%rax), %xmm2
movq -0x18(%rbp), %rcx
movsd (%rcx), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
movl -0x30(%rbp), %ecx
imull 0x130(%rax), %ecx
movl -0x2c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movq -0x20(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x160(%rax), %xmm0
callq 0x1f4a0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x4e534
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0x12c(%rcx), %eax
jl 0x4e5d5
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movl -0x34(%rbp), %esi
movl 0x12c(%rax), %edx
callq 0x1ee80
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, -0x38(%rbp)
cvtsi2sdl -0x38(%rbp), %xmm0
movsd 0x10(%rax), %xmm2
movq -0x20(%rbp), %rcx
movsd (%rcx), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
cvtsi2sdl -0x38(%rbp), %xmm0
movsd 0x8(%rax), %xmm2
movq -0x18(%rbp), %rcx
movsd (%rcx), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
movl -0x38(%rbp), %ecx
imull 0x12c(%rax), %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movq -0x18(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x158(%rax), %xmm0
callq 0x1f4a0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x4e61b
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movl (%rax), %eax
cmpl 0x128(%rcx), %eax
jl 0x4e68b
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movq -0x10(%rbp), %rcx
movl (%rcx), %esi
movl 0x128(%rax), %edx
callq 0x1ee80
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, -0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp), %xmm0
movsd (%rax), %xmm2
movq -0x18(%rbp), %rcx
movsd (%rcx), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
movl -0x3c(%rbp), %edx
imull 0x128(%rax), %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
movq -0x48(%rbp), %rcx
movl 0x180(%rcx), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl 0x184(%rcx), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl 0x128(%rcx), %edx
movl -0x34(%rbp), %eax
movl 0x190(%rcx), %esi
imull -0x2c(%rbp), %esi
addl %esi, %eax
imull %eax, %edx
movq -0x10(%rbp), %rax
addl (%rax), %edx
movl %edx, (%rax)
movq 0x1b0(%rcx), %rax
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movq 0x1b8(%rcx), %rcx
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x4e6fa
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x4f1d0
addq $0x50, %rsp
popq %rbp
retq