// File: /workspace/github_cpp_makefile_star2_O1/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 0x2846
movaps %xmm0, 0x40(%rsp)
movq %r14, %rdi
callq 0x2846
movaps 0x40(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm1, %xmm1
addps 0x58c0(%rip), %xmm1     # 0xa4b0
movq %rbx, %rdi
movaps %xmm1, %xmm0
callq 0x3298
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 0x4c2c
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x4c39
movq %rsp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x6cba
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x4ed3
leaq 0x30(%rsp), %r15
leaq 0x20(%rsp), %rbp
leaq 0x57c7(%rip), %r12      # 0xa420
movq %r14, %rdi
callq 0x2644
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 0x57d6(%rip), %xmm1     # 0xa48c
movq %r15, %rdi
movq %rbp, %rsi
movss 0x57e0(%rip), %xmm2     # 0xa4a4
callq 0x856a
movss 0x13d0(%rbx), %xmm0
mulss 0x57cf(%rip), %xmm0     # 0xa4a8
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3372
movq 0x1390(%rbx), %rbp
cmpq 0x1398(%rbx), %rbp
je 0x4db8
movslq (%rbp), %rax
movq 0x13b8(%rbx), %rcx
movsd 0x20(%rsp), %xmm0
movsd (%rcx,%rax,8), %xmm1
subps %xmm0, %xmm1
cmpb $0x1, 0x13d4(%rbx)
jne 0x4d88
movaps %xmm1, %xmm0
movss 0x5757(%rip), %xmm2     # 0xa47c
ucomiss %xmm1, %xmm2
jbe 0x4d34
addss 0x5746(%rip), %xmm0     # 0xa478
jmp 0x4d45
ucomiss 0x5745(%rip), %xmm0     # 0xa480
jbe 0x4d45
addss 0x573f(%rip), %xmm0     # 0xa484
movaps %xmm1, %xmm2
shufps $0x55, %xmm1, %xmm2     # xmm2 = xmm2[1,1],xmm1[1,1]
movss 0x5728(%rip), %xmm3     # 0xa47c
ucomiss %xmm2, %xmm3
jbe 0x4d69
addss 0x5717(%rip), %xmm2     # 0xa478
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movaps %xmm0, %xmm1
jmp 0x4d88
ucomiss 0x5710(%rip), %xmm2     # 0xa480
movss %xmm0, %xmm1            # xmm1 = xmm0[0],xmm1[1,2,3]
jbe 0x4d88
addss 0x5706(%rip), %xmm2     # 0xa484
movlhps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
shufps $0xe2, %xmm1, %xmm2     # xmm2 = xmm2[2,0],xmm1[2,3]
movaps %xmm2, %xmm1
movsd 0x20(%rsp), %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 0x8658
addq $0x4, %rbp
jmp 0x4ceb
leaq 0x20(%rsp), %rbp
movq %rsp, %r13
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x4ebc
movq %r15, %rdi
movq %r14, %rsi
callq 0x88a6
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 0x4e0f
movss 0x567f(%rip), %xmm0     # 0xa47c
ucomiss %xmm2, %xmm0
jbe 0x4e14
movaps %xmm2, %xmm0
addss 0x566b(%rip), %xmm0     # 0xa478
jmp 0x4e2d
movaps %xmm2, %xmm0
jmp 0x4e55
ucomiss 0x5665(%rip), %xmm2     # 0xa480
jbe 0x4e2a
movaps %xmm2, %xmm0
addss 0x565c(%rip), %xmm0     # 0xa484
jmp 0x4e2d
movaps %xmm2, %xmm0
movss 0x5647(%rip), %xmm2     # 0xa47c
ucomiss %xmm1, %xmm2
jbe 0x4e44
addss 0x5636(%rip), %xmm1     # 0xa478
jmp 0x4e55
ucomiss 0x5635(%rip), %xmm1     # 0xa480
jbe 0x4e55
addss 0x562f(%rip), %xmm1     # 0xa484
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq %rbx, %rdi
callq 0x3298
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 0x4e91
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x4e9e
movq %r13, %rdi
leaq 0x2c(%rsp), %rdx
callq 0x6cba
movss 0x13d0(%rbx), %xmm1
addss %xmm1, %xmm1
movq %r15, %rdi
movaps 0x40(%rsp), %xmm0
callq 0x8658
jmp 0x4dc0
movq %r15, %rdi
callq 0x862a
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
jne 0x4c59
testq %rdi, %rdi
je 0x4ee5
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 0x4efa
jmp 0x4efa
jmp 0x4efa
movq %rax, %rbx
jmp 0x4f14
jmp 0x4f07
jmp 0x4f07
jmp 0x4f07
jmp 0x4f07
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x862a
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4f2a
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2310