// File: Luthaf[P]zeopp/voro++/src/unitcell.cc
// Function: voro::unitcell::images(std::vector<int, std::allocator<int>>&, std::vector<double, std::allocator<double>>&)
void unitcell::images(std::vector<int> &vi,std::vector<double> &vd) {
	const int ms2=max_unit_voro_shells*2+1,mss=ms2*ms2*ms2;
	bool *a=new bool[mss],*ac=a+max_unit_voro_shells*(1+ms2*(1+ms2)),*ap=a;
	int i,j,k;
	double vol;

	// Initialize mask
	while(ap<ac) *(ap++)=true;
	*(ap++)=false;
	while(ap<a+mss) *(ap++)=true;

	// Set up the queue and add (0,0,0) image to it
	std::queue<int> q;
	q.push(0);q.push(0);q.push(0);

	while(!q.empty()) {

		// Read the next entry on the queue
		i=q.front();q.pop();
		j=q.front();q.pop();
		k=q.front();q.pop();

		// Check intersection of this image
		if(intersects_image(i,j,k,vol)) {

			// Add this entry to the output vectors
			vi.push_back(i);
			vi.push_back(j);
			vi.push_back(k);
			vd.push_back(vol);

			// Add neighbors to the queue if they have not been
			// tested
			ap=ac+i+ms2*(j+ms2*k);
			if(k>-max_unit_voro_shells&&*(ap-ms2*ms2)) {q.push(i);q.push(j);q.push(k-1);*(ap-ms2*ms2)=false;}
			if(j>-max_unit_voro_shells&&*(ap-ms2)) {q.push(i);q.push(j-1);q.push(k);*(ap-ms2)=false;}
			if(i>-max_unit_voro_shells&&*(ap-1)) {q.push(i-1);q.push(j);q.push(k);*(ap-1)=false;}
			if(i<max_unit_voro_shells&&*(ap+1)) {q.push(i+1);q.push(j);q.push(k);*(ap+1)=false;}
			if(j<max_unit_voro_shells&&*(ap+ms2)) {q.push(i);q.push(j+1);q.push(k);*(ap+ms2)=false;}
			if(k<max_unit_voro_shells&&*(ap+ms2*ms2)) {q.push(i);q.push(j);q.push(k+1);*(ap+ms2*ms2)=false;}
		}
	}

	// Remove mask memory
	delete [] a;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl $0x15, -0x1c(%rbp)
movl $0x242d, -0x20(%rbp)    # imm = 0x242D
movl $0x242d, %edi           # imm = 0x242D
callq 0x2030
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1216, %rax           # imm = 0x1216
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x537b2
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x1, (%rax)
jmp 0x53794
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x242d, %rcx           # imm = 0x242D
cmpq %rcx, %rax
jae 0x537ec
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x1, (%rax)
jmp 0x537c4
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x542b0
movq -0xe8(%rbp), %rdi
movl $0x0, -0xa4(%rbp)
leaq -0xa4(%rbp), %rsi
callq 0x542e0
jmp 0x5381e
movl $0x0, -0xb8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x542e0
jmp 0x5383d
movl $0x0, -0xbc(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xbc(%rbp), %rsi
callq 0x542e0
jmp 0x5385c
jmp 0x5385e
leaq -0xa0(%rbp), %rdi
callq 0x54310
movb %al, -0xe9(%rbp)
jmp 0x53872
movb -0xe9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x53883
jmp 0x53c07
leaq -0xa0(%rbp), %rdi
callq 0x54330
movq %rax, -0xf8(%rbp)
jmp 0x53898
movq -0xf8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x54350
jmp 0x538b2
leaq -0xa0(%rbp), %rdi
callq 0x54330
movq %rax, -0x100(%rbp)
jmp 0x538c7
movq -0x100(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x54350
jmp 0x538e1
leaq -0xa0(%rbp), %rdi
callq 0x54330
movq %rax, -0x108(%rbp)
jmp 0x538f6
movq -0x108(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x54350
jmp 0x53910
movq -0xe0(%rbp), %rdi
cvtsi2sdl -0x3c(%rbp), %xmm0
cvtsi2sdl -0x40(%rbp), %xmm1
cvtsi2sdl -0x44(%rbp), %xmm2
leaq -0x50(%rbp), %rsi
callq 0x53330
movb %al, -0x109(%rbp)
jmp 0x53937
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x53946
jmp 0x53c02
movq -0x10(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x17020
jmp 0x53955
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x17020
jmp 0x53964
movq -0x10(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x17020
jmp 0x53973
movq -0x18(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x54370
jmp 0x53982
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addq %rcx, %rax
movl -0x40(%rbp), %ecx
imull $0x15, -0x44(%rbp), %edx
addl %edx, %ecx
imull $0x15, %ecx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpl $-0xa, -0x44(%rbp)
jle 0x53a2e
movq -0x38(%rbp), %rax
testb $0x1, -0x1b9(%rax)
je 0x53a2e
leaq -0xa0(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x543e0
jmp 0x539cc
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x543e0
jmp 0x539de
movl -0x44(%rbp), %eax
decl %eax
movl %eax, -0xc0(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x542e0
jmp 0x539fe
movq -0x38(%rbp), %rax
movb $0x0, -0x1b9(%rax)
jmp 0x53a2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x54410
jmp 0x53c39
cmpl $-0xa, -0x40(%rbp)
jle 0x53a8a
movq -0x38(%rbp), %rax
testb $0x1, -0x15(%rax)
je 0x53a8a
leaq -0xa0(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x543e0
jmp 0x53a50
movl -0x40(%rbp), %eax
decl %eax
movl %eax, -0xc4(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
callq 0x542e0
jmp 0x53a70
leaq -0xa0(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x543e0
jmp 0x53a82
movq -0x38(%rbp), %rax
movb $0x0, -0x15(%rax)
cmpl $-0xa, -0x3c(%rbp)
jle 0x53ae6
movq -0x38(%rbp), %rax
testb $0x1, -0x1(%rax)
je 0x53ae6
movl -0x3c(%rbp), %eax
decl %eax
movl %eax, -0xc8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x542e0
jmp 0x53aba
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x543e0
jmp 0x53acc
leaq -0xa0(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x543e0
jmp 0x53ade
movq -0x38(%rbp), %rax
movb $0x0, -0x1(%rax)
cmpl $0xa, -0x3c(%rbp)
jge 0x53b42
movq -0x38(%rbp), %rax
testb $0x1, 0x1(%rax)
je 0x53b42
movl -0x3c(%rbp), %eax
incl %eax
movl %eax, -0xcc(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
callq 0x542e0
jmp 0x53b16
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x543e0
jmp 0x53b28
leaq -0xa0(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x543e0
jmp 0x53b3a
movq -0x38(%rbp), %rax
movb $0x0, 0x1(%rax)
cmpl $0xa, -0x40(%rbp)
jge 0x53b9e
movq -0x38(%rbp), %rax
testb $0x1, 0x15(%rax)
je 0x53b9e
leaq -0xa0(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x543e0
jmp 0x53b64
movl -0x40(%rbp), %eax
incl %eax
movl %eax, -0xd0(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x542e0
jmp 0x53b84
leaq -0xa0(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x543e0
jmp 0x53b96
movq -0x38(%rbp), %rax
movb $0x0, 0x15(%rax)
cmpl $0xa, -0x44(%rbp)
jge 0x53c00
movq -0x38(%rbp), %rax
testb $0x1, 0x1b9(%rax)
je 0x53c00
leaq -0xa0(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x543e0
jmp 0x53bc3
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x543e0
jmp 0x53bd5
movl -0x44(%rbp), %eax
incl %eax
movl %eax, -0xd4(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0x542e0
jmp 0x53bf5
movq -0x38(%rbp), %rax
movb $0x0, 0x1b9(%rax)
jmp 0x53c02
jmp 0x5385e
movq -0x28(%rbp), %rax
movq %rax, -0x118(%rbp)
cmpq $0x0, %rax
je 0x53c24
movq -0x118(%rbp), %rdi
callq 0x2180
leaq -0xa0(%rbp), %rdi
callq 0x54410
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0xb0(%rbp), %rdi
callq 0x2220
nopw %cs:(%rax,%rax)