// File: icemiliang[P]vot/src/vot/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 $0xe0, %rdi
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x120(%rax), %xmm0
callq 0x593d0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x85c3f
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0xe8(%rcx), %eax
jl 0x85d15
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movl -0x2c(%rbp), %esi
movl 0xe8(%rax), %edx
callq 0x58ce0
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 0xe8(%rax), %ecx
movl -0x2c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movq -0x20(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x118(%rax), %xmm0
callq 0x593d0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x85d54
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0xe4(%rcx), %eax
jl 0x85df5
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movl -0x34(%rbp), %esi
movl 0xe4(%rax), %edx
callq 0x58ce0
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 0xe4(%rax), %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movq -0x18(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x110(%rax), %xmm0
callq 0x593d0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x85e3b
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movl (%rax), %eax
cmpl 0xe0(%rcx), %eax
jl 0x85eab
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movq -0x10(%rbp), %rcx
movl (%rcx), %esi
movl 0xe0(%rax), %edx
callq 0x58ce0
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 0xe0(%rax), %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
movq -0x48(%rbp), %rcx
movl 0x130(%rcx), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl 0x134(%rcx), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl 0xe0(%rcx), %edx
movl -0x34(%rbp), %eax
movl 0x140(%rcx), %esi
imull -0x2c(%rbp), %esi
addl %esi, %eax
imull %eax, %edx
movq -0x10(%rbp), %rax
addl (%rax), %edx
movl %edx, (%rax)
movq 0x160(%rcx), %rax
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movq 0x168(%rcx), %rcx
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x85f1a
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x86880
addq $0x50, %rsp
popq %rbp
retq