// File: ddunbar[P]PDSample/PDSampling.cpp
// Function: PDSampler::maximize()
void PDSampler::maximize()
{
	RangeList rl(0,0);
	int i, N = (int) points.size();

	for (i=0; i<N; i++) {
		Vec2 &candidate = points[i];

		rl.reset(0, (float) M_PI*2);
		findNeighborRanges(i, rl);
		while (rl.numRanges) {
			RangeEntry &re = rl.ranges[m_rng.getInt31()%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);
			rl.subtract(angle - (float) M_PI/3, angle + (float) M_PI/3);
		}
	}
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x90(%rsp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xfc90
movq 0x40(%rsp), %rdi
addq $0x13b8, %rdi           # imm = 0x13B8
callq 0x3970
movl %eax, 0x88(%rsp)
movl $0x0, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
cmpl 0x88(%rsp), %eax
jge 0x4c0d
movq 0x40(%rsp), %rdi
addq $0x13b8, %rdi           # imm = 0x13B8
movslq 0x8c(%rsp), %rsi
callq 0x3990
movq %rax, 0x80(%rsp)
leaq 0x90(%rsp), %rdi
xorps %xmm0, %xmm0
movss 0x11ade(%rip), %xmm1    # 0x164d8
callq 0xfd00
jmp 0x4a01
movq 0x40(%rsp), %rdi
movl 0x8c(%rsp), %esi
leaq 0x90(%rsp), %rdx
callq 0x4460
jmp 0x4a1c
jmp 0x4a1e
cmpl $0x0, 0x98(%rsp)
je 0x4bf5
movq 0x40(%rsp), %rdi
movq 0x90(%rsp), %rax
movq %rax, 0x30(%rsp)
addq $0x8, %rdi
callq 0x2c10
movq %rax, 0x38(%rsp)
jmp 0x4a4e
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movslq 0x98(%rsp), %rcx
cqto
idivq %rcx
movq 0x30(%rsp), %rax
leaq (%rax,%rdx,8), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movss (%rax), %xmm1
movss %xmm1, 0x24(%rsp)
movss 0x4(%rax), %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x28(%rsp)
addq $0x8, %rdi
callq 0x2d90
movss %xmm0, 0x2c(%rsp)
jmp 0x4aa2
movss 0x24(%rsp), %xmm1
movss 0x2c(%rsp), %xmm2
movss 0x28(%rsp), %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x64(%rsp)
movq 0x80(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x64(%rsp), %xmm0
callq 0x6e00
movss %xmm0, 0x20(%rsp)
jmp 0x4ae7
movss 0x1c(%rsp), %xmm1
movq 0x40(%rsp), %rax
movss 0x20(%rsp), %xmm0
addss %xmm0, %xmm0
movss 0x13d0(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
movq 0x80(%rsp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, 0x14(%rsp)
movss 0x64(%rsp), %xmm0
callq 0x6e20
movss %xmm0, 0x18(%rsp)
jmp 0x4b38
movss 0x10(%rsp), %xmm0
movss 0x14(%rsp), %xmm2
movq 0x40(%rsp), %rax
movss 0x18(%rsp), %xmm1
addss %xmm1, %xmm1
movss 0x13d0(%rax), %xmm3
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
leaq 0x54(%rsp), %rdi
callq 0x6b60
jmp 0x4b6f
movq 0x40(%rsp), %rdi
movsd 0x54(%rsp), %xmm0
callq 0x3d20
movaps %xmm0, (%rsp)
jmp 0x4b85
movq 0x40(%rsp), %rdi
movaps (%rsp), %xmm0
movlpd %xmm0, 0x5c(%rsp)
movq 0x5c(%rsp), %rax
movq %rax, 0x48(%rsp)
movsd 0x48(%rsp), %xmm0
callq 0x3f10
jmp 0x4bab
movss 0x64(%rsp), %xmm1
movss 0x11923(%rip), %xmm2    # 0x164dc
movaps %xmm1, %xmm0
subss %xmm2, %xmm0
addss %xmm2, %xmm1
leaq 0x90(%rsp), %rdi
callq 0xff20
jmp 0x4bd3
jmp 0x4a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x90(%rsp), %rdi
callq 0xfd40
jmp 0x4c22
jmp 0x4bf7
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x49b2
leaq 0x90(%rsp), %rdi
callq 0xfd40
addq $0xa8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x22f0
nopl (%rax)