// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movq %rdi, %rbx
leaq 0x30(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x68d4
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %rbx, %rdi
callq 0x2f7c
movq %rbx, %rdi
callq 0x30c0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x622e
leaq 0x8(%rbx), %r14
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x40d2
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), %rbp
movq 0x13b8(%rbx), %rdx
movsd (%rdx,%rbp,8), %xmm0
movaps %xmm0, 0x50(%rsp)
movl -0x4(%rsi), %edx
movl %edx, (%rcx,%rax,4)
addq $-0x4, %rsi
movq %rsi, 0x18(%rsp)
xorps %xmm0, %xmm0
movq %r15, %rdi
movss 0x54c7(%rip), %xmm1     # 0x9484
callq 0x6924
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x346e
cmpl $0x0, 0x38(%rsp)
je 0x3f57
movq 0x30(%rsp), %rbp
movq %r14, %rdi
callq 0x254e
movslq 0x38(%rsp), %rcx
xorl %edx, %edx
divq %rcx
movss (%rbp,%rdx,8), %xmm0
movss %xmm0, 0x40(%rsp)
movss 0x4(%rbp,%rdx,8), %xmm0
movss %xmm0, 0x8(%rsp)
movq %r14, %rdi
callq 0x274a
movss 0x8(%rsp), %xmm2
movss 0x40(%rsp), %xmm1
subss %xmm1, %xmm2
mulss %xmm0, %xmm2
addss %xmm1, %xmm2
movss %xmm2, 0x8(%rsp)
movaps %xmm2, %xmm0
callq 0x2110
movaps %xmm0, 0x60(%rsp)
movss 0x13d0(%rbx), %xmm0
movaps %xmm0, 0x40(%rsp)
movss 0x8(%rsp), %xmm0
callq 0x2160
movaps 0x60(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm1, %xmm1
movaps %xmm1, %xmm2
movss 0x13d0(%rbx), %xmm0
movaps 0x40(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
mulps %xmm2, %xmm1
addps 0x50(%rsp), %xmm1
movaps %xmm1, %xmm0
movq %rbx, %rdi
callq 0x2fb6
movq %rbx, %rdi
callq 0x30c0
movq 0x13c0(%rbx), %rax
subq 0x13b8(%rbx), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0xc(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x622e
movss 0x8(%rsp), %xmm1
movaps %xmm1, %xmm0
addss 0x53cb(%rip), %xmm0     # 0x9488
addss 0x53c7(%rip), %xmm1     # 0x948c
movq %r15, %rdi
callq 0x6a44
jmp 0x3fcf
leaq 0x10(%rsp), %rdi
callq 0x5f20
leaq 0x30(%rsp), %rdi
callq 0x6938
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4103
jmp 0x4103
jmp 0x4103
jmp 0x4103
jmp 0x4103
jmp 0x4103
jmp 0x4103
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x5f20
leaq 0x30(%rsp), %rdi
callq 0x6938
movq %rbx, %rdi
callq 0x2300