// File: j-faria[P]kima/DNest4/code/RJObject/RJObjectImpl.h
// Function: DNest4::RJObject<RVConditionalPrior>::perturb_components(DNest4::RNG&)
double RJObject<ConditionalPrior>::perturb_components(RNG& rng)
{
	if(num_components == 0)
		return 0.;

    double chance = pow(10.0, -3*std::abs(rng.randt2()));

	// A flag for whether each component gets changed or not
	std::vector<bool> change(num_components, false);
	int count = 0;
	for(int i=0; i<num_components; i++)
	{
		if(rng.rand() <= chance)
		{
			change[i] = true;
			count++;
		}
	}
	// At least do one...
	if(count == 0)
		change[rng.rand_int(num_components)] = true;

	for(int i=0; i<num_components; i++)
	{
		if(change[i])
		{
			// Accumulate added/removed component info
			removed.push_back(components[i]);

			// Perturb
			for(int j=0; j<num_dimensions; j++)
			{
				u_components[i][j] += rng.randh();
				u_components[i][j] = DNest4::mod(
							u_components[i][j], 1.0);
				components[i][j] = u_components[i][j];
			}
			conditional_prior.from_uniform(components[i]);

			// Accumulate added/removed component info
			added.push_back(components[i]);
		}
	}

	return 0.;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpl $0x0, 0xb4(%rax)
jne 0x317c4
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x31c43
movq -0x18(%rbp), %rdi
callq 0xb2750
callq 0x2b830
movaps %xmm0, %xmm1
movsd 0x85f4b(%rip), %xmm0    # 0xb7728
mulsd %xmm0, %xmm1
movsd 0x85f47(%rip), %xmm0    # 0xb7730
callq 0x6820
movq -0xb0(%rbp), %rax
movsd %xmm0, -0x20(%rbp)
movslq 0xb4(%rax), %rax
movq %rax, -0xc0(%rbp)
movb $0x0, -0x49(%rbp)
leaq -0x4a(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x32b80
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rcx
leaq -0x48(%rbp), %rdi
leaq -0x49(%rbp), %rdx
callq 0x32ba0
jmp 0x31839
leaq -0x4a(%rbp), %rdi
callq 0x32c20
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x64(%rbp), %eax
cmpl 0xb4(%rcx), %eax
jge 0x31920
movq -0x18(%rbp), %rdi
callq 0xb26f0
movsd %xmm0, -0xc8(%rbp)
jmp 0x31879
movsd -0xc8(%rbp), %xmm1
movsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x31910
movslq -0x64(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x32c40
movq %rdx, -0xd8(%rbp)
movq %rax, -0xd0(%rbp)
jmp 0x318ad
movq -0xd8(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq %rax, -0x70(%rbp)
leaq -0x78(%rbp), %rdi
movl $0x1, %esi
callq 0x32ca0
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x31910
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x4a(%rbp), %rdi
callq 0x32c20
jmp 0x31c51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x32d20
jmp 0x31c51
jmp 0x31912
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x31850
cmpl $0x0, -0x60(%rbp)
jne 0x31990
movq -0xb0(%rbp), %rax
movq -0x18(%rbp), %rdi
movl 0xb4(%rax), %esi
callq 0xb28c0
movl %eax, -0xdc(%rbp)
jmp 0x31944
movl -0xdc(%rbp), %eax
movslq %eax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x32c40
movq %rdx, -0xf0(%rbp)
movq %rax, -0xe8(%rbp)
jmp 0x31966
movq -0xf0(%rbp), %rax
movq -0xe8(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
leaq -0x88(%rbp), %rdi
movl $0x1, %esi
callq 0x32ca0
movl $0x0, -0x8c(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x8c(%rbp), %eax
cmpl 0xb4(%rcx), %eax
jge 0x31c32
movslq -0x8c(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x32c40
movq %rdx, -0x100(%rbp)
movq %rax, -0xf8(%rbp)
jmp 0x319d3
movq -0x100(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movq %rax, -0x98(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x32cf0
testb $0x1, %al
jne 0x31a04
jmp 0x31c1c
movq -0xb0(%rbp), %rdi
movq %rdi, %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x108(%rbp)
addq $0xb8, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq -0x108(%rbp), %rdi
movq %rax, %rsi
callq 0x15770
jmp 0x31a3f
movl $0x0, -0xa4(%rbp)
movq -0xb0(%rbp), %rcx
movl -0xa4(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x31ba6
movq -0x18(%rbp), %rdi
callq 0xb27b0
movsd %xmm0, -0x110(%rbp)
jmp 0x31a72
movq -0xb0(%rbp), %rdi
addq $0xd0, %rdi
movq %rdi, -0x120(%rbp)
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq %rax, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xc6a0
movsd -0x110(%rbp), %xmm1
movq -0x120(%rbp), %rdi
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq %rax, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xc6a0
movsd (%rax), %xmm0
movsd 0x8554c(%rip), %xmm1    # 0xb7030
callq 0xb3360
movsd %xmm0, -0x118(%rbp)
jmp 0x31af3
movq -0xb0(%rbp), %rdi
addq $0xd0, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq %rax, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xc6a0
movsd -0x118(%rbp), %xmm0
movq -0xb0(%rbp), %rdi
movsd %xmm0, (%rax)
addq $0xd0, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq %rax, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xc6a0
movq -0xb0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x128(%rbp)
addq $0xb8, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq %rax, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xc6a0
movsd -0x128(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x31a49
movq -0xb0(%rbp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, -0x130(%rbp)
addq $0xb8, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq -0x130(%rbp), %rdi
movq %rax, %rsi
callq 0xbbe0
jmp 0x31bdf
movq -0xb0(%rbp), %rdi
movq %rdi, %rax
addq $0xe8, %rax
movq %rax, -0x138(%rbp)
addq $0xb8, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x15d30
movq -0x138(%rbp), %rdi
movq %rax, %rsi
callq 0x15770
jmp 0x31c1a
jmp 0x31c1c
jmp 0x31c1e
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x3199a
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x32d20
movsd -0x8(%rbp), %xmm0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x6830
nopw (%rax,%rax)