// File: /workspace/github_cpp_makefile_star2_O1/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 0x7270
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x2846
movaps %xmm0, 0x30(%rsp)
movq %r14, %rdi
callq 0x2846
movaps 0x30(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm1, %xmm1
addps 0x6125(%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, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x43c7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x43d6
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x6cba
movq 0x10(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
je 0x45eb
leaq 0x40(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r14, %rdi
callq 0x2644
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 0x6040(%rip), %xmm1     # 0xa498
callq 0x72c2
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x36b2
cmpl $0x0, 0x48(%rsp)
je 0x45db
movq 0x40(%rsp), %rbp
movq %r14, %rdi
callq 0x2644
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 0x2846
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 0x452b
movss 0x5f65(%rip), %xmm1     # 0xa47c
movaps 0x50(%rsp), %xmm2
ucomiss %xmm2, %xmm1
jbe 0x4532
addss 0x5f4f(%rip), %xmm2     # 0xa478
jmp 0x4543
movaps 0x50(%rsp), %xmm2
jmp 0x456b
ucomiss 0x5f47(%rip), %xmm2     # 0xa480
jbe 0x4543
addss 0x5f41(%rip), %xmm2     # 0xa484
movss 0x5f31(%rip), %xmm1     # 0xa47c
ucomiss %xmm0, %xmm1
jbe 0x455a
addss 0x5f20(%rip), %xmm0     # 0xa478
jmp 0x456b
ucomiss 0x5f1f(%rip), %xmm0     # 0xa480
jbe 0x456b
addss 0x5f19(%rip), %xmm0     # 0xa484
unpcklps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movq %rbx, %rdi
movaps %xmm2, %xmm0
callq 0x3298
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 0x45aa
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x45b5
movq %r12, %rdi
movq %r13, %rdx
callq 0x6cba
movss 0x30(%rsp), %xmm1
movaps %xmm1, %xmm0
addss 0x5ed6(%rip), %xmm0     # 0xa49c
addss 0x5ed2(%rip), %xmm1     # 0xa4a0
movq %r15, %rdi
callq 0x73d8
jmp 0x446a
movq 0x10(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
jne 0x43f5
testq %rdi, %rdi
je 0x45fd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x72d6
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4624
jmp 0x4624
jmp 0x4624
jmp 0x4624
jmp 0x4624
jmp 0x4624
jmp 0x4624
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x463e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x72d6
movq %rbx, %rdi
callq 0x2310