// File: /workspace/github_cpp_makefile_star2_O3/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, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x2838
movaps %xmm0, 0x40(%rsp)
movq %r14, %rdi
callq 0x2838
movaps 0x40(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm1, %xmm1
addps 0x5994(%rip), %xmm1     # 0xa4a0
movq %rbx, %rdi
movaps %xmm1, %xmm0
callq 0x31f0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0x30(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x4b48
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x4b5a
movq %rsp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x6b76
movq 0x8(%rsp), %rsi
movq (%rsp), %rdi
cmpq %rdi, %rsi
je 0x4dec
leaq 0x30(%rsp), %r15
leaq 0x20(%rsp), %rbp
leaq 0x5898(%rip), %r12      # 0xa410
movq %r14, %rdi
callq 0x2634
movq (%rsp), %rcx
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
subq %rcx, %rdi
sarq $0x2, %rdi
xorl %edx, %edx
divq %rdi
movslq %edx, %rax
movslq (%rcx,%rax,4), %r13
movq 0x13b8(%rbx), %rdx
movq (%rdx,%r13,8), %rdx
movq %rdx, 0x20(%rsp)
movl -0x4(%rsi), %edx
movl %edx, (%rcx,%rax,4)
addq $-0x4, %rsi
movq %rsi, 0x8(%rsp)
movss 0x13d0(%rbx), %xmm1
movaps %xmm1, %xmm0
addss %xmm1, %xmm0
mulss 0x58a7(%rip), %xmm1     # 0xa47c
movq %r15, %rdi
movq %rbp, %rsi
movss 0x58ad(%rip), %xmm2     # 0xa490
callq 0x890a
movss 0x13d0(%rbx), %xmm0
mulss 0x589c(%rip), %xmm0     # 0xa494
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32bc
movq 0x1390(%rbx), %rbp
cmpq 0x1398(%rbx), %rbp
je 0x4cd1
movslq (%rbp), %rax
movq 0x13b8(%rbx), %rcx
movsd 0x20(%rsp), %xmm1
movsd (%rcx,%rax,8), %xmm0
subps %xmm1, %xmm0
cmpb $0x1, 0x13d4(%rbx)
jne 0x4ca7
movaps %xmm0, %xmm2
movss 0x5828(%rip), %xmm3     # 0xa46c
ucomiss %xmm0, %xmm3
jbe 0x4c53
addss 0x5817(%rip), %xmm2     # 0xa468
jmp 0x4c64
ucomiss 0x5816(%rip), %xmm2     # 0xa470
jbe 0x4c64
addss 0x5810(%rip), %xmm2     # 0xa474
movaps %xmm0, %xmm3
shufps $0x55, %xmm0, %xmm3     # xmm3 = xmm3[1,1],xmm0[1,1]
movss 0x57f9(%rip), %xmm4     # 0xa46c
ucomiss %xmm3, %xmm4
jbe 0x4c88
addss 0x57e8(%rip), %xmm3     # 0xa468
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movaps %xmm2, %xmm0
jmp 0x4ca7
ucomiss 0x57e1(%rip), %xmm3     # 0xa470
movss %xmm2, %xmm0            # xmm0 = xmm2[0],xmm0[1,2,3]
jbe 0x4ca7
addss 0x57d7(%rip), %xmm3     # 0xa474
movlhps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm3     # xmm3 = xmm3[2,0],xmm0[2,3]
movaps %xmm3, %xmm0
addps %xmm1, %xmm0
xorl %ecx, %ecx
cmpl %r13d, %eax
setl %cl
movss 0x13d0(%rbx), %xmm1
mulss (%r12,%rcx,4), %xmm1
movq %r15, %rdi
callq 0x89f6
addq $0x4, %rbp
jmp 0x4c0a
leaq 0x20(%rsp), %rbp
movq %rsp, %r13
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x4dd5
movq %r15, %rdi
movq %r14, %rsi
callq 0x8c44
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
cmpb $0x1, 0x13d4(%rbx)
movaps %xmm0, 0x40(%rsp)
jne 0x4d28
movss 0x5756(%rip), %xmm0     # 0xa46c
ucomiss %xmm2, %xmm0
jbe 0x4d2d
movaps %xmm2, %xmm0
addss 0x5742(%rip), %xmm0     # 0xa468
jmp 0x4d46
movaps %xmm2, %xmm0
jmp 0x4d6e
ucomiss 0x573c(%rip), %xmm2     # 0xa470
jbe 0x4d43
movaps %xmm2, %xmm0
addss 0x5733(%rip), %xmm0     # 0xa474
jmp 0x4d46
movaps %xmm2, %xmm0
movss 0x571e(%rip), %xmm2     # 0xa46c
ucomiss %xmm1, %xmm2
jbe 0x4d5d
addss 0x570d(%rip), %xmm1     # 0xa468
jmp 0x4d6e
ucomiss 0x570c(%rip), %xmm1     # 0xa470
jbe 0x4d6e
addss 0x5706(%rip), %xmm1     # 0xa474
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq %rbx, %rdi
callq 0x31f0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0x2c(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x4daa
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x4db7
movq %r13, %rdi
leaq 0x2c(%rsp), %rdx
callq 0x6b76
movss 0x13d0(%rbx), %xmm1
addss %xmm1, %xmm1
movq %r15, %rdi
movaps 0x40(%rsp), %xmm0
callq 0x89f6
jmp 0x4cd9
movq %r15, %rdi
callq 0x89ca
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
jne 0x4b78
testq %rdi, %rdi
je 0x4dfe
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e13
jmp 0x4e13
jmp 0x4e13
movq %rax, %rbx
jmp 0x4e2d
jmp 0x4e20
jmp 0x4e20
jmp 0x4e20
jmp 0x4e20
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x89ca
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4e43
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2310
nop