// File: /workspace/github_cpp_makefile_star2_O2/ddunbar[P]PDSample/PDSampling.cpp
// Function: LinearPureSampler::complete()
void LinearPureSampler::complete()
{
	IntVector candidates;

	addPoint(randomPoint());
	candidates.push_back((int) points.size()-1);

	while (candidates.size()) {
		int c = m_rng.getInt32()%candidates.size();
		int index = candidates[c];
		Vec2 candidate = points[index];
		candidates[c] = candidates[candidates.size()-1];
		candidates.pop_back();

		ScallopedRegion sr(candidate, radius*2, radius*4);
		findNeighbors(candidate, radius*8);
		
		for (IntVector::const_iterator it=m_neighbors.begin(); it!=m_neighbors.end(); it++) {
			int nIdx = *it;
			Vec2 &n = points[nIdx];
			Vec2 nClose = candidate + getTiled(n-candidate);

			if (nIdx<index) {
				sr.subtractDisk(nClose, radius*4);
			} else {
				sr.subtractDisk(nClose, radius*2);
			}
		}

		while (!sr.isEmpty()) {
			Vec2 p = sr.sample(m_rng);
			Vec2 pt = getTiled(p);

			addPoint(pt);
			candidates.push_back((int) points.size()-1);

			sr.subtractDisk(p, radius*2);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
callq 0x2f7c
movq %rbx, %rdi
callq 0x30c0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
leaq 0x48(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x622e
leaq 0x8(%rbx), %r14
leaq 0x48(%rsp), %r15
movq %rsp, %r13
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x4690
movq %r14, %rdi
callq 0x254e
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rsi
movq %rsi, %rdi
subq %rcx, %rdi
sarq $0x2, %rdi
xorl %edx, %edx
divq %rdi
movslq %edx, %rax
movslq (%rcx,%rax,4), %r12
movq 0x13b8(%rbx), %rdx
movq (%rdx,%r12,8), %rdx
movq %rdx, (%rsp)
movl -0x4(%rsi), %edx
movl %edx, (%rcx,%rax,4)
addq $-0x4, %rsi
movq %rsi, 0x18(%rsp)
movss 0x13d0(%rbx), %xmm1
movaps %xmm1, %xmm0
addss %xmm1, %xmm0
mulss 0x4efe(%rip), %xmm1     # 0x947c
movq %r15, %rdi
movq %r13, %rsi
movss 0x4f04(%rip), %xmm2     # 0x9490
callq 0x78e0
movss 0x13d0(%rbx), %xmm0
mulss 0x4ef3(%rip), %xmm0     # 0x9494
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3166
movq 0x1390(%rbx), %r13
cmpq 0x1398(%rbx), %r13
je 0x4675
movslq (%r13), %rax
xorl %ebp, %ebp
cmpl %r12d, %eax
setl %bpl
movq 0x13b8(%rbx), %rcx
movsd (%rsp), %xmm1
movaps %xmm1, 0x30(%rsp)
movsd (%rcx,%rax,8), %xmm0
subps %xmm1, %xmm0
movq %rbx, %rdi
callq 0x2fb6
addps 0x30(%rsp), %xmm0
movss 0x13d0(%rbx), %xmm1
leaq 0x4e0e(%rip), %rax      # 0x9410
mulss (%rax,%rbp,4), %xmm1
movq %r15, %rdi
callq 0x7998
addq $0x4, %r13
jmp 0x45b3
movq %r15, %rdi
movq %r14, %rsi
callq 0x7b78
movq %rbx, %rdi
movaps %xmm0, 0x30(%rsp)
callq 0x2fb6
movq %rbx, %rdi
callq 0x30c0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x622e
movss 0x13d0(%rbx), %xmm1
addss %xmm1, %xmm1
movq %r15, %rdi
movaps 0x30(%rsp), %xmm0
callq 0x7998
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
jne 0x4615
movq %r15, %rdi
callq 0x797a
jmp 0x450e
leaq 0x10(%rsp), %rdi
callq 0x5f20
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x46af
jmp 0x46af
jmp 0x46af
movq %rax, %rbx
jmp 0x46c9
jmp 0x46bc
jmp 0x46bc
jmp 0x46bc
jmp 0x46bc
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x797a
leaq 0x10(%rsp), %rdi
callq 0x5f20
movq %rbx, %rdi
callq 0x2300
nop