// File: Luthaf[P]zeopp/voro++/src/v_base.cc
// Function: voro::voro_base::voro_base(int, int, int, double, double, double)
voro_base::voro_base(int nx_,int ny_,int nz_,double boxx_,double boxy_,double boxz_) :
	nx(nx_), ny(ny_), nz(nz_), nxy(nx_*ny_), nxyz(nxy*nz_), boxx(boxx_), boxy(boxy_), boxz(boxz_),
	xsp(1/boxx_), ysp(1/boxy_), zsp(1/boxz_), mrad(new double[wl_hgridcu*wl_seq_length]) {
	const unsigned int b1=1<<21,b2=1<<22,b3=1<<24,b4=1<<25,b5=1<<27,b6=1<<28;
	const double xstep=boxx/wl_fgrid,ystep=boxy/wl_fgrid,zstep=boxz/wl_fgrid;
	int i,j,k,lx,ly,lz,q;
	unsigned int f,*e=const_cast<unsigned int*> (wl);
	double xlo,ylo,zlo,xhi,yhi,zhi,minr,*radp=mrad;
	for(zlo=0,zhi=zstep,lz=0;lz<wl_hgrid;zlo=zhi,zhi+=zstep,lz++) {
		for(ylo=0,yhi=ystep,ly=0;ly<wl_hgrid;ylo=yhi,yhi+=ystep,ly++) {
			for(xlo=0,xhi=xstep,lx=0;lx<wl_hgrid;xlo=xhi,xhi+=xstep,lx++) {
				minr=large_number;
				for(q=e[0]+1;q<wl_seq_length;q++) {
					f=e[q];
					i=(f&127)-64;
					j=(f>>7&127)-64;
					k=(f>>14&127)-64;
					if((f&b2)==b2) {
						compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i-1,j,k);
						if((f&b1)==0) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i+1,j,k);
					} else if((f&b1)==b1) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i+1,j,k);
					if((f&b4)==b4) {
						compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j-1,k);
						if((f&b3)==0) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j+1,k);
					} else if((f&b3)==b3) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j+1,k);
					if((f&b6)==b6) {
						compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k-1);
						if((f&b5)==0) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k+1);
					} else if((f&b5)==b5) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k+1);
				}
				q--;
				while(q>0) {
					radp[q]=minr;
					f=e[q];
					i=(f&127)-64;
					j=(f>>7&127)-64;
					k=(f>>14&127)-64;
					compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k);
					q--;
				}
				*radp=minr;
				e+=wl_seq_length;
				radp+=wl_seq_length;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movsd %xmm0, -0x30(%rbp)
movsd %xmm1, -0x38(%rbp)
movsd %xmm2, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl -0x1c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x20(%rbp), %ecx
movl %ecx, 0x4(%rax)
movl -0x24(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x1c(%rbp), %ecx
imull -0x20(%rbp), %ecx
movl %ecx, 0xc(%rax)
movl 0xc(%rax), %ecx
imull -0x24(%rbp), %ecx
movl %ecx, 0x10(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x18(%rax)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x28(%rax)
movsd 0xb8a0(%rip), %xmm0     # 0x56010
divsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x30(%rax)
movsd 0xb88e(%rip), %xmm0     # 0x56010
divsd -0x38(%rbp), %xmm0
movsd %xmm0, 0x38(%rax)
movsd 0xb87c(%rip), %xmm0     # 0x56010
divsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x40(%rax)
movl $0x8000, %edi           # imm = 0x8000
callq 0x2030
movq %rax, %rcx
movq -0xe0(%rbp), %rax
movq %rcx, 0x48(%rax)
movl $0x200000, -0x44(%rbp)  # imm = 0x200000
movl $0x400000, -0x48(%rbp)  # imm = 0x400000
movl $0x1000000, -0x4c(%rbp) # imm = 0x1000000
movl $0x2000000, -0x50(%rbp) # imm = 0x2000000
movl $0x8000000, -0x54(%rbp) # imm = 0x8000000
movl $0x10000000, -0x58(%rbp) # imm = 0x10000000
movsd 0x18(%rax), %xmm0
movsd 0xd80b(%rip), %xmm1     # 0x57ff8
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd 0x20(%rax), %xmm0
movsd 0xd7f5(%rip), %xmm1     # 0x57ff8
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd 0x28(%rax), %xmm0
movsd 0xd7df(%rip), %xmm1     # 0x57ff8
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
leaq 0xd9d7(%rip), %rcx      # 0x58200
movq %rcx, -0x98(%rbp)
movq 0x48(%rax), %rax
movq %rax, -0xd8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movl $0x0, -0x88(%rbp)
cmpl $0x4, -0x88(%rbp)
jge 0x4af55
xorps %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movl $0x0, -0x84(%rbp)
cmpl $0x4, -0x84(%rbp)
jge 0x4af1a
xorps %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movl $0x0, -0x80(%rbp)
cmpl $0x4, -0x80(%rbp)
jge 0x4aedf
movsd 0xd736(%rip), %xmm0     # 0x58000
movsd %xmm0, -0xd0(%rbp)
movq -0x98(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
cmpl $0x40, -0x8c(%rbp)
jge 0x4ad7d
movq -0x98(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
andl $0x7f, %eax
subl $0x40, %eax
movl %eax, -0x74(%rbp)
movl -0x90(%rbp), %eax
shrl $0x7, %eax
andl $0x7f, %eax
subl $0x40, %eax
movl %eax, -0x78(%rbp)
movl -0x90(%rbp), %eax
shrl $0xe, %eax
andl $0x7f, %eax
subl $0x40, %eax
movl %eax, -0x7c(%rbp)
movl -0x90(%rbp), %eax
andl $0x400000, %eax         # imm = 0x400000
cmpl $0x400000, %eax         # imm = 0x400000
jne 0x4aa29
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
subl $0x1, %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
movl -0x90(%rbp), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
jne 0x4aa27
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
addl $0x1, %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
jmp 0x4aaa0
movl -0x90(%rbp), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x200000, %eax         # imm = 0x200000
jne 0x4aa9e
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
addl $0x1, %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
jmp 0x4aaa0
movl -0x90(%rbp), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x2000000, %eax        # imm = 0x2000000
jne 0x4ab8e
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
subl $0x1, %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
movl -0x90(%rbp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
jne 0x4ab8c
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
addl $0x1, %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
jmp 0x4ac05
movl -0x90(%rbp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x1000000, %eax        # imm = 0x1000000
jne 0x4ac03
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
addl $0x1, %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
jmp 0x4ac05
movl -0x90(%rbp), %eax
andl $0x10000000, %eax       # imm = 0x10000000
cmpl $0x10000000, %eax       # imm = 0x10000000
jne 0x4acf1
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
subl $0x1, %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
movl -0x90(%rbp), %eax
andl $0x8000000, %eax        # imm = 0x8000000
cmpl $0x0, %eax
jne 0x4acef
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
addl $0x1, %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
jmp 0x4ad67
movl -0x90(%rbp), %eax
andl $0x8000000, %eax        # imm = 0x8000000
cmpl $0x8000000, %eax        # imm = 0x8000000
jne 0x4ad65
movq -0xe0(%rbp), %rdi
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
addl $0x1, %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
jmp 0x4ad67
jmp 0x4ad69
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x4a8e4
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jle 0x4ae71
movq -0xe0(%rbp), %rdi
movsd -0xd0(%rbp), %xmm0
movq -0xd8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x98(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
andl $0x7f, %eax
subl $0x40, %eax
movl %eax, -0x74(%rbp)
movl -0x90(%rbp), %eax
shrl $0x7, %eax
andl $0x7f, %eax
subl $0x40, %eax
movl %eax, -0x78(%rbp)
movl -0x90(%rbp), %eax
shrl $0xe, %eax
andl $0x7f, %eax
subl $0x40, %eax
movl %eax, -0x7c(%rbp)
movl -0x74(%rbp), %r11d
movl -0x78(%rbp), %r10d
movl -0x7c(%rbp), %eax
leaq -0xd0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xc0(%rbp), %r9
leaq -0xb0(%rbp), %r14
leaq -0xc8(%rbp), %rbx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x4af70
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x4ad8c
movsd -0xd0(%rbp), %xmm0
movq -0xd8(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x98(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x98(%rbp)
movq -0xd8(%rbp), %rax
addq $0x200, %rax            # imm = 0x200
movq %rax, -0xd8(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x60(%rbp), %xmm0
addsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x4a8b8
jmp 0x4aee1
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x68(%rbp), %xmm0
addsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x4a88c
jmp 0x4af1c
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x70(%rbp), %xmm0
addsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x4a85d
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)