// File: /workspace/github_cpp_makefile_star2_O3/ddunbar[P]PDSample/PDSampling.cpp
// Function: BoundarySampler::complete()
void BoundarySampler::complete()
{
	RangeList rl(0,0);
	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();

		rl.reset(0, (float) M_PI*2);
		findNeighborRanges(index, rl);
		while (rl.numRanges) {
			RangeEntry &re = rl.ranges[m_rng.getInt32()%rl.numRanges];
			float angle = re.min + (re.max-re.min)*m_rng.getFloatL();
			Vec2 pt = getTiled(Vec2(candidate.x + cos(angle)*2*radius,
									candidate.y + sin(angle)*2*radius));

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

			rl.subtract(angle - (float) M_PI/3, angle + (float) M_PI/3);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x40(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x711c
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x2838
movaps %xmm0, 0x30(%rsp)
movq %r14, %rdi
callq 0x2838
movaps 0x30(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm1, %xmm1
addps 0x61fd(%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, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x42df
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x42f3
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x6b76
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
cmpq %rdi, %rsi
je 0x4506
leaq 0x40(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r14, %rdi
callq 0x2634
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), %rbp
movq 0x13b8(%rbx), %rdx
movss (%rdx,%rbp,8), %xmm0
movss %xmm0, 0x2c(%rsp)
movss 0x4(%rdx,%rbp,8), %xmm0
movss %xmm0, 0x28(%rsp)
movl -0x4(%rsi), %edx
movl %edx, (%rcx,%rax,4)
addq $-0x4, %rsi
movq %rsi, 0x18(%rsp)
xorps %xmm0, %xmm0
movq %r15, %rdi
movss 0x6111(%rip), %xmm1     # 0xa484
callq 0x716e
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x35fc
cmpl $0x0, 0x48(%rsp)
je 0x44f6
movq 0x40(%rsp), %rbp
movq %r14, %rdi
callq 0x2634
movslq 0x48(%rsp), %rcx
xorl %edx, %edx
divq %rcx
movss (%rbp,%rdx,8), %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x4(%rbp,%rdx,8), %xmm0
movss %xmm0, 0x30(%rsp)
movq %r14, %rdi
callq 0x2838
movss 0x30(%rsp), %xmm1
movss 0x50(%rsp), %xmm2
subss %xmm2, %xmm1
mulss %xmm0, %xmm1
addss %xmm2, %xmm1
movss %xmm1, 0x30(%rsp)
movaps %xmm1, %xmm0
callq 0x2120
addss %xmm0, %xmm0
mulss 0x13d0(%rbx), %xmm0
addss 0x2c(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movss 0x30(%rsp), %xmm0
callq 0x2170
addss %xmm0, %xmm0
mulss 0x13d0(%rbx), %xmm0
addss 0x28(%rsp), %xmm0
cmpb $0x1, 0x13d4(%rbx)
jne 0x4446
movss 0x603a(%rip), %xmm1     # 0xa46c
movaps 0x50(%rsp), %xmm2
ucomiss %xmm2, %xmm1
jbe 0x444d
addss 0x6024(%rip), %xmm2     # 0xa468
jmp 0x445e
movaps 0x50(%rsp), %xmm2
jmp 0x4486
ucomiss 0x601c(%rip), %xmm2     # 0xa470
jbe 0x445e
addss 0x6016(%rip), %xmm2     # 0xa474
movss 0x6006(%rip), %xmm1     # 0xa46c
ucomiss %xmm0, %xmm1
jbe 0x4475
addss 0x5ff5(%rip), %xmm0     # 0xa468
jmp 0x4486
ucomiss 0x5ff4(%rip), %xmm0     # 0xa470
jbe 0x4486
addss 0x5fee(%rip), %xmm0     # 0xa474
unpcklps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movq %rbx, %rdi
movaps %xmm2, %xmm0
callq 0x31f0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x44c5
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x44d0
movq %r12, %rdi
movq %r13, %rdx
callq 0x6b76
movss 0x30(%rsp), %xmm1
movaps %xmm1, %xmm0
addss 0x5fa7(%rip), %xmm0     # 0xa488
addss 0x5fa3(%rip), %xmm1     # 0xa48c
movq %r15, %rdi
callq 0x7292
jmp 0x4385
movq 0x10(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
jne 0x4310
testq %rdi, %rdi
je 0x4518
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x7182
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x453f
jmp 0x453f
jmp 0x453f
jmp 0x453f
jmp 0x453f
jmp 0x453f
jmp 0x453f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4559
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x7182
movq %rbx, %rdi
callq 0x2310
nop