// File: j-faria[P]kima/examples/trends/../../DNest4/code/SamplerImpl.h
// Function: DNest4::Sampler<RVmodel>::save_particle()
void Sampler<ModelType>::save_particle()
{
	++count_saves;
    count_mcmc_steps_since_save = 0;

	if(!save_to_disk)
		return;

	if(count_saves % thin_print == 0)
		std::cout<<"# Saving particle to disk. N = "<<count_saves<<"."<<std::endl;

	// Output file
	std::fstream fout;

	int which = rngs[0].rand_int(particles.size());
	fout.open(options.sample_file, std::ios::out|std::ios::app);
	particles[which].print(fout);
	fout<<std::endl;
	fout.close();

	fout.open(options.sample_info_file, std::ios::out|std::ios::app);
	fout<<std::setprecision(12);

	fout<<level_assignments[which]<<' ';
	fout<<log_likelihoods[which].get_value()<<' ';
	fout<<log_likelihoods[which].get_tiebreaker()<<' ';
	fout<<which<<std::endl;
	fout.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x238(%rbp)
movl 0x690(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x690(%rax)
movl $0x0, 0x694(%rax)
testb $0x1, (%rax)
jne 0xad9dd
jmp 0xadcef
movq -0x238(%rbp), %rcx
movl 0x690(%rcx), %eax
xorl %edx, %edx
divl 0x4(%rcx)
cmpl $0x0, %edx
jne 0xada3a
movq 0x6c59d(%rip), %rdi     # 0x119f98
leaq 0x1dd78(%rip), %rsi     # 0xcb77a
callq 0x64f0
movq %rax, %rdi
movq -0x238(%rbp), %rax
movl 0x690(%rax), %esi
callq 0x6650
movq %rax, %rdi
leaq 0x1e591(%rip), %rsi     # 0xcbfb7
callq 0x64f0
movq %rax, %rdi
movq 0x6c4e3(%rip), %rsi     # 0x119f18
callq 0x6530
leaq -0x218(%rbp), %rdi
callq 0x65b0
movq -0x238(%rbp), %rdi
addq $0x678, %rdi            # imm = 0x678
xorl %eax, %eax
movl %eax, %esi
callq 0xa8770
movq -0x238(%rbp), %rdi
movq %rax, -0x248(%rbp)
addq $0xc8, %rdi
callq 0xa8a50
movq -0x248(%rbp), %rdi
movl %eax, %esi
callq 0xb28c0
movl %eax, -0x23c(%rbp)
jmp 0xada8d
movq -0x238(%rbp), %rax
movl -0x23c(%rbp), %ecx
movl %ecx, -0x21c(%rbp)
addq $0x68, %rax
movq %rax, -0x258(%rbp)
movl $0x10, %edi
movl $0x1, %esi
callq 0x156e0
movl %eax, -0x24c(%rbp)
jmp 0xadac2
movl -0x24c(%rbp), %edx
movq -0x258(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x66a0
jmp 0xadadd
movq -0x238(%rbp), %rdi
addq $0xc8, %rdi
movslq -0x21c(%rbp), %rsi
callq 0xa1e50
movq %rax, %rdi
leaq -0x208(%rbp), %rsi
callq 0x24110
jmp 0xadb08
leaq -0x208(%rbp), %rdi
movq 0x6c402(%rip), %rsi     # 0x119f18
callq 0x6530
jmp 0xadb1d
leaq -0x218(%rbp), %rdi
callq 0x6060
jmp 0xadb2b
movq -0x238(%rbp), %rax
addq $0x88, %rax
movq %rax, -0x268(%rbp)
movl $0x10, %edi
movl $0x1, %esi
callq 0x156e0
movl %eax, -0x25c(%rbp)
jmp 0xadb56
movl -0x25c(%rbp), %edx
movq -0x268(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x66a0
jmp 0xadb71
leaq -0x208(%rbp), %rax
movq %rax, -0x270(%rbp)
movl $0xc, %edi
callq 0xa9350
movq -0x270(%rbp), %rdi
movl %eax, -0x230(%rbp)
movl -0x230(%rbp), %esi
callq 0x6750
jmp 0xadba3
movq -0x238(%rbp), %rdi
leaq -0x208(%rbp), %rax
movq %rax, -0x280(%rbp)
addq $0xf8, %rdi
movslq -0x21c(%rbp), %rsi
callq 0xabd30
movq -0x280(%rbp), %rdi
movl (%rax), %esi
callq 0x6650
movq %rax, -0x278(%rbp)
jmp 0xadbe2
movq -0x278(%rbp), %rdi
movl $0x20, %esi
callq 0x6590
jmp 0xadbf5
movq -0x238(%rbp), %rdi
leaq -0x208(%rbp), %rax
movq %rax, -0x290(%rbp)
addq $0xe0, %rdi
movslq -0x21c(%rbp), %rsi
callq 0xa2260
movq %rax, %rdi
callq 0xa93a0
movq -0x290(%rbp), %rdi
callq 0x68f0
movq %rax, -0x288(%rbp)
jmp 0xadc3a
movq -0x288(%rbp), %rdi
movl $0x20, %esi
callq 0x6590
jmp 0xadc4d
movq -0x238(%rbp), %rdi
leaq -0x208(%rbp), %rax
movq %rax, -0x2a0(%rbp)
addq $0xe0, %rdi
movslq -0x21c(%rbp), %rsi
callq 0xa2260
movq %rax, %rdi
callq 0xa93c0
movq -0x2a0(%rbp), %rdi
callq 0x68f0
movq %rax, -0x298(%rbp)
jmp 0xadc92
movq -0x298(%rbp), %rdi
movl $0x20, %esi
callq 0x6590
jmp 0xadca5
leaq -0x208(%rbp), %rdi
movl -0x21c(%rbp), %esi
callq 0x6810
movq %rax, -0x2a8(%rbp)
jmp 0xadcc0
movq -0x2a8(%rbp), %rdi
movq 0x6c24a(%rip), %rsi     # 0x119f18
callq 0x6530
jmp 0xadcd5
leaq -0x218(%rbp), %rdi
callq 0x6060
jmp 0xadce3
leaq -0x218(%rbp), %rdi
callq 0x60f0
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x60f0
movq -0x228(%rbp), %rdi
callq 0x6830
nopw %cs:(%rax,%rax)
nopl (%rax)