// File: j-faria[P]kima/DNest4/code/Level.cpp
// Function: DNest4::Level::renormalise_visits(std::vector<DNest4::Level, std::allocator<DNest4::Level>>&, unsigned int)
void Level::renormalise_visits(vector<Level>& levels,
									unsigned int regularisation)
{
	for(auto& level: levels)
	{
		if(level.tries >= regularisation)
		{
			level.accepts = ((double)(level.accepts+1)/(double)(level.tries+1))*regularisation;
			level.tries = regularisation;
		}
		if(level.visits >= regularisation)
		{
			level.exceeds = ((double)(level.exceeds+1)/(double)(level.visits+1))*regularisation;
			level.visits = regularisation;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xaaeb0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0xaaee0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xb1880
testb $0x1, %al
jne 0xb15b7
jmp 0xb1734
leaq -0x20(%rbp), %rdi
callq 0xace30
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
cmpq %rcx, %rax
jb 0xb1674
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rcx
movq 0x30(%rax), %rax
incq %rcx
movq %rcx, %xmm0
movaps 0x5a1d(%rip), %xmm3     # 0xb7010
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x5a21(%rip), %xmm2     # 0xb7020
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
incq %rax
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movl -0xc(%rbp), %eax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
movsd 0x1a5b8(%rip), %xmm1    # 0xcbc08
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0xc(%rbp), %eax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl -0xc(%rbp), %ecx
cmpq %rcx, %rax
jb 0xb1724
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
incq %rcx
movq %rcx, %xmm0
movaps 0x596d(%rip), %xmm3     # 0xb7010
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x5971(%rip), %xmm2     # 0xb7020
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
incq %rax
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movl -0xc(%rbp), %eax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
movsd 0x1a508(%rip), %xmm1    # 0xcbc08
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0xc(%rbp), %eax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0xb1726
leaq -0x20(%rbp), %rdi
callq 0xb18c0
jmp 0xb15a1
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)