// File: Luthaf[P]zeopp/voro++/src/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 $0x128, %rdi            # imm = 0x128
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm0
mulsd 0x168(%rax), %xmm0
callq 0x1f4a0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x4ea8b
movq -0x40(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0x130(%rcx), %eax
jl 0x4eb72
movq -0x40(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movl -0x34(%rbp), %esi
movl 0x130(%rax), %edx
callq 0x1ee80
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 0x130(%rax), %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
jmp 0x4eb7c
movq 0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%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, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x4ebbb
movq -0x40(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0x12c(%rcx), %eax
jl 0x4ec6a
movq -0x40(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movl -0x38(%rbp), %esi
movl 0x12c(%rax), %edx
callq 0x1ee80
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 0x12c(%rax), %ecx
movl -0x38(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x38(%rbp)
jmp 0x4ec74
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%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 0x4ecba
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movl (%rax), %eax
cmpl 0x128(%rcx), %eax
jl 0x4ed35
movq -0x40(%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, %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 0x128(%rax), %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
jmp 0x4ed3f
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%rbp), %rcx
movl 0x180(%rcx), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl 0x184(%rcx), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl 0x128(%rcx), %edx
movl -0x38(%rbp), %eax
movl 0x190(%rcx), %esi
imull -0x34(%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 0x4edae
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x4f1d0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)