// File: icemiliang[P]vot/src/vot/container_prd.cc
// Function: voro::container_periodic_base::put_locate_block(int&, double&, double&, double&, int&, int&, int&)
void container_periodic_base::put_locate_block(int &ijk,double &x,double &y,double &z,int &ai,int &aj,int &ak) {

	// Remap particle in the z direction if necessary
	int k=step_int(z*zsp);
	if(k<0||k>=nz) {
		ak=step_div(k,nz);
		z-=ak*bz;y-=ak*byz;x-=ak*bxz;k-=ak*nz;
	} else ak=0;

	// Remap particle in the y direction if necessary
	int j=step_int(y*ysp);
	if(j<0||j>=ny) {
		aj=step_div(j,ny);
		y-=aj*by;x-=aj*bxy;j-=aj*ny;
	} else aj=0;

	// Remap particle in the x direction if necessary
	ijk=step_int(x*xsp);
	if(ijk<0||ijk>=nx) {
		ai=step_div(ijk,nx);
		x-=ai*bx;ijk-=ai*nx;
	} else ai=0;

	// 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 $0x40, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq %rax, %rdi
addq $0xe0, %rdi
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x120(%rax), %xmm0
callq 0x593d0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x861ab
movq -0x40(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0xe8(%rcx), %eax
jl 0x86292
movq -0x40(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movl -0x34(%rbp), %esi
movl 0xe8(%rax), %edx
callq 0x58ce0
movl %eax, %edx
movq -0x40(%rbp), %rax
movq 0x18(%rbp), %rcx
movl %edx, (%rcx)
movq 0x18(%rbp), %rcx
cvtsi2sdl (%rcx), %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)
movq 0x18(%rbp), %rcx
cvtsi2sdl (%rcx), %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)
movq 0x18(%rbp), %rcx
cvtsi2sdl (%rcx), %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)
movq 0x18(%rbp), %rcx
movl (%rcx), %ecx
imull 0xe8(%rax), %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
jmp 0x8629c
movq 0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movq -0x20(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x118(%rax), %xmm0
callq 0x593d0
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x862db
movq -0x40(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0xe4(%rcx), %eax
jl 0x8638a
movq -0x40(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movl -0x38(%rbp), %esi
movl 0xe4(%rax), %edx
callq 0x58ce0
movl %eax, %edx
movq -0x40(%rbp), %rax
movq 0x10(%rbp), %rcx
movl %edx, (%rcx)
movq 0x10(%rbp), %rcx
cvtsi2sdl (%rcx), %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)
movq 0x10(%rbp), %rcx
cvtsi2sdl (%rcx), %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)
movq 0x10(%rbp), %rcx
movl (%rcx), %ecx
imull 0xe4(%rax), %ecx
movl -0x38(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x38(%rbp)
jmp 0x86394
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%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 0x863da
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movl (%rax), %eax
cmpl 0xe0(%rcx), %eax
jl 0x86455
movq -0x40(%rbp), %rax
movq %rax, %rdi
addq $0xe0, %rdi
movq -0x10(%rbp), %rcx
movl (%rcx), %esi
movl 0xe0(%rax), %edx
callq 0x58ce0
movl %eax, %edx
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movl %edx, (%rcx)
movq -0x30(%rbp), %rcx
cvtsi2sdl (%rcx), %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)
movq -0x30(%rbp), %rcx
movl (%rcx), %edx
imull 0xe0(%rax), %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
jmp 0x8645f
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%rbp), %rcx
movl 0x130(%rcx), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl 0x134(%rcx), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl 0xe0(%rcx), %edx
movl -0x38(%rbp), %eax
movl 0x140(%rcx), %esi
imull -0x34(%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 0x864ce
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x86880
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)