// File: tewalds[P]morat/hex/agentmcts.h
// Function: Morat::Hex::AgentMCTS::start_gc()
void start_gc() {
		Time starttime;
		logerr("Starting player GC with limit " + to_str(gclimit) + " ... ");
		uint64_t nodesbefore = nodes;
		garbage_collect(root, rootboard.to_play());
		Time gctime;
		ctmem.compact(1.0, 0.75);
		Time compacttime;
		logerr(to_str(100.0*nodes/nodesbefore, 1) + " % of tree remains - " +
			to_str((gctime - starttime)*1000, 0)  + " msec gc, " + to_str((compacttime - gctime)*1000, 0) + " msec compact\n");

		if(ctmem.meminuse() >= maxmem/2)
			gclimit = (int)(gclimit*1.3);
		else if(gclimit > rollouts*5)
			gclimit = (int)(gclimit*0.9); //slowly decay to a minimum of 5
	}

// Assembly:
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, 0x1c0(%rsp)
movq 0x1c0(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x6780
movq 0x18(%rsp), %rax
movl 0x4118(%rax), %esi
leaq 0x158(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x1a430
movq 0x20(%rsp), %rdx
leaq 0x29820(%rip), %rsi     # 0x4e092
leaq 0x178(%rsp), %rdi
callq 0x19f30
jmp 0x24881
leaq 0x29829(%rip), %rdx     # 0x4e0b1
leaq 0x198(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0xb910
jmp 0x2489f
leaq 0x198(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x1a9b0
movq (%rsp), %rdi
callq 0x5260
leaq 0x178(%rsp), %rdi
callq 0x5260
leaq 0x158(%rsp), %rdi
callq 0x5260
movq 0x18(%rsp), %rdi
movq 0x4110(%rdi), %rax
movq %rax, 0x140(%rsp)
movq %rdi, %rax
addq $0x40e0, %rax           # imm = 0x40E0
movq %rax, 0x8(%rsp)
addq $0x10, %rdi
callq 0x1a8a0
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rdi
movb %al, 0x13f(%rsp)
movzbl 0x13f(%rsp), %edx
callq 0x19590
leaq 0x130(%rsp), %rdi
callq 0x6780
movq 0x18(%rsp), %rdi
addq $0x4130, %rdi           # imm = 0x4130
vmovss 0x288d3(%rip), %xmm0    # 0x4d210
vmovss 0x288eb(%rip), %xmm1    # 0x4d230
callq 0x1bbe0
leaq 0x128(%rsp), %rdi
callq 0x6780
movq 0x18(%rsp), %rax
vcvtusi2sdq 0x4110(%rax), %xmm0, %xmm0
vmovsd 0x2886a(%rip), %xmm1    # 0x4d1d8
vmulsd %xmm1, %xmm0, %xmm0
vcvtusi2sdq 0x140(%rsp), %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x68(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl $0x1, %esi
callq 0x48780
movq 0x10(%rsp), %rsi
leaq 0x29719(%rip), %rdx     # 0x4e0b7
leaq 0x88(%rsp), %rdi
callq 0xb910
jmp 0x249ad
leaq 0x130(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x1ad50
vmovsd 0x28806(%rip), %xmm1    # 0x4d1d0
vmulsd %xmm1, %xmm0, %xmm0
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x48780
jmp 0x249dc
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x19e40
jmp 0x249f8
leaq 0x296ce(%rip), %rdx     # 0x4e0cd
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xb910
jmp 0x24a16
leaq 0x128(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x1ad50
vmovsd 0x2879d(%rip), %xmm1    # 0x4d1d0
vmulsd %xmm1, %xmm0, %xmm0
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x48780
jmp 0x24a45
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x19e40
jmp 0x24a61
leaq 0x29670(%rip), %rdx     # 0x4e0d8
leaq 0x108(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xb910
jmp 0x24a7f
leaq 0x108(%rsp), %rdi
callq 0x1a9b0
leaq 0x108(%rsp), %rdi
callq 0x5260
leaq 0xe8(%rsp), %rdi
callq 0x5260
leaq 0x28(%rsp), %rdi
callq 0x5260
leaq 0xc8(%rsp), %rdi
callq 0x5260
leaq 0xa8(%rsp), %rdi
callq 0x5260
leaq 0x48(%rsp), %rdi
callq 0x5260
leaq 0x88(%rsp), %rdi
callq 0x5260
leaq 0x68(%rsp), %rdi
callq 0x5260
movq 0x18(%rsp), %rdi
addq $0x4130, %rdi           # imm = 0x4130
callq 0x24cf0
movq 0x18(%rsp), %rcx
movq 0x60(%rcx), %rcx
shrq %rcx
cmpq %rcx, %rax
jb 0x24c77
movq 0x18(%rsp), %rax
vcvtsi2sdl 0x4118(%rax), %xmm0, %xmm0
vmovsd 0x286e2(%rip), %xmm1    # 0x4d208
vmulsd %xmm1, %xmm0, %xmm0
vcvttsd2si %xmm0, %ecx
movl %ecx, 0x4118(%rax)
jmp 0x24cb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24b70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x5260
leaq 0x158(%rsp), %rdi
callq 0x5260
jmp 0x24cba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24c6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24c5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24c54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24c47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x24c30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x5260
leaq 0x28(%rsp), %rdi
callq 0x5260
leaq 0xc8(%rsp), %rdi
callq 0x5260
leaq 0xa8(%rsp), %rdi
callq 0x5260
leaq 0x48(%rsp), %rdi
callq 0x5260
leaq 0x88(%rsp), %rdi
callq 0x5260
leaq 0x68(%rsp), %rdi
callq 0x5260
jmp 0x24cba
movq 0x18(%rsp), %rcx
movl 0x4118(%rcx), %eax
imull $0x5, 0x94(%rcx), %ecx
cmpl %ecx, %eax
jle 0x24cb0
movq 0x18(%rsp), %rax
vcvtsi2sdl 0x4118(%rax), %xmm0, %xmm0
vmovsd 0x2855e(%rip), %xmm1    # 0x4d200
vmulsd %xmm1, %xmm0, %xmm0
vcvttsd2si %xmm0, %ecx
movl %ecx, 0x4118(%rax)
jmp 0x24cb2
addq $0x1c8, %rsp            # imm = 0x1C8
retq
movq 0x150(%rsp), %rdi
callq 0x5760
nopw (%rax,%rax)