// File: tewalds[P]morat/hex/agentpns.h
// Function: Morat::Hex::AgentPNS::start_gc()
void start_gc() {
		Time starttime;
		logerr("Starting GC with limit " + to_str(gclimit) + " ... ");

		garbage_collect(& root);

		Time gctime;
		ctmem.compact(1.0, 0.75);

		Time compacttime;
		logerr(to_str(100.0*ctmem.meminuse()/memlimit, 1) + " % of tree remains - " +
			to_str((gctime - starttime)*1000, 0)  + " msec gc, " + to_str((compacttime - gctime)*1000, 0) + " msec compact\n");

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

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x6780
movq 0x18(%rsp), %rax
movl 0x68(%rax), %esi
leaq 0x148(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x1a4d0
movq 0x20(%rsp), %rdx
leaq 0x1b39f(%rip), %rsi     # 0x4ec0e
leaq 0x168(%rsp), %rdi
callq 0x19f30
jmp 0x3387e
leaq 0x1a82c(%rip), %rdx     # 0x4e0b1
leaq 0x188(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0xb910
jmp 0x3389c
leaq 0x188(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x1a9b0
movq (%rsp), %rdi
callq 0x5260
leaq 0x168(%rsp), %rdi
callq 0x5260
leaq 0x148(%rsp), %rdi
callq 0x5260
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
addq $0x1540, %rsi           # imm = 0x1540
callq 0x2f6f0
leaq 0x130(%rsp), %rdi
callq 0x6780
movq 0x18(%rsp), %rdi
addq $0x70, %rdi
movq %rdi, 0x8(%rsp)
vmovss 0x19909(%rip), %xmm0    # 0x4d210
vmovss 0x19921(%rip), %xmm1    # 0x4d230
callq 0x321a0
leaq 0x128(%rsp), %rdi
callq 0x6780
movq 0x8(%rsp), %rdi
callq 0x33c90
movq %rax, %rcx
movq 0x18(%rsp), %rax
vcvtusi2sd %rcx, %xmm0, %xmm0
vmovsd 0x19897(%rip), %xmm1    # 0x4d1d8
vmulsd %xmm1, %xmm0, %xmm0
vcvtusi2sdq 0x60(%rax), %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x68(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl $0x1, %esi
callq 0x48780
movq 0x10(%rsp), %rsi
leaq 0x1a747(%rip), %rdx     # 0x4e0b7
leaq 0x88(%rsp), %rdi
callq 0xb910
jmp 0x3397f
leaq 0x130(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x1ad50
vmovsd 0x19834(%rip), %xmm1    # 0x4d1d0
vmulsd %xmm1, %xmm0, %xmm0
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x48780
jmp 0x339ae
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x19e40
jmp 0x339ca
leaq 0x1a6fc(%rip), %rdx     # 0x4e0cd
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xb910
jmp 0x339e8
leaq 0x128(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x1ad50
vmovsd 0x197cb(%rip), %xmm1    # 0x4d1d0
vmulsd %xmm1, %xmm0, %xmm0
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x48780
jmp 0x33a17
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x19e40
jmp 0x33a33
leaq 0x1a69e(%rip), %rdx     # 0x4e0d8
leaq 0x108(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xb910
jmp 0x33a51
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 $0x70, %rdi
callq 0x33c90
movq 0x18(%rsp), %rcx
movq 0x60(%rcx), %rcx
shrq %rcx
cmpq %rcx, %rax
jb 0x33c44
movq 0x18(%rsp), %rax
vcvtusi2sdl 0x68(%rax), %xmm0, %xmm0
vmovsd 0x19714(%rip), %xmm1    # 0x4d208
vmulsd %xmm1, %xmm0, %xmm0
vcvttsd2usi %xmm0, %ecx
movl %ecx, 0x68(%rax)
jmp 0x33c72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33b3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x5260
leaq 0x148(%rsp), %rdi
callq 0x5260
jmp 0x33c7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33c38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33c2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33c21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33c14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33c07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x33bfd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%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 0x33c7a
movq 0x18(%rsp), %rax
cmpl $0x5, 0x68(%rax)
jbe 0x33c70
movq 0x18(%rsp), %rax
vcvtusi2sdl 0x68(%rax), %xmm0, %xmm0
vmovsd 0x1959d(%rip), %xmm1    # 0x4d200
vmulsd %xmm1, %xmm0, %xmm0
vcvttsd2usi %xmm0, %ecx
movl %ecx, 0x68(%rax)
jmp 0x33c72
addq $0x1b8, %rsp            # imm = 0x1B8
retq
movq 0x140(%rsp), %rdi
callq 0x5760
nopw (%rax,%rax)