// File: Laakeri[P]maxpre/src/log.cpp
// Function: maxPreprocessor::Log::newRequest(maxPreprocessor::Log::Technique)
void Log::newRequest(Technique t) {
	askHistory.push_back(t);
	if (totalTimer.getTime().count() > timeLimit) return; // timelimit anyway
	if (tTimer[t].getTime().count() < tTimeLimit[t]) return; // has time left
	// try to allocate more time
	map<Technique, double> excessTime;
	for (int i = (int)askHistory.size() - 2; i >= 0; i--) {
		if (askHistory[i] == t) break;
		if (excessTime.count(askHistory[i]) == 0) {
			Technique tt = askHistory[i];
			if (tTimeLimit[tt] - tTimer[tt].getTime().count() > 0) {
				excessTime[tt] = tTimeLimit[tt] - tTimer[tt].getTime().count();
			}
		}
	}
	for (auto et : excessTime) {
		// magic constant
		tTimeLimit[t] += et.second/3; // reallocate third of the excess
		tTimeLimit[et.first] -= et.second/3;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
addq $0x30, %rdi
leaq -0xc(%rbp), %rsi
callq 0x62f50
movq -0xa8(%rbp), %rdi
addq $0x68, %rdi
callq 0x60a80
movsd %xmm0, -0x18(%rbp)
leaq -0x18(%rbp), %rdi
callq 0xabd0
movq -0xa8(%rbp), %rax
ucomisd 0x58(%rax), %xmm0
jbe 0x6266b
jmp 0x629db
movq -0xa8(%rbp), %rdi
addq $0x98, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x62c70
movq %rax, %rdi
callq 0x60a80
movsd %xmm0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xabd0
movq -0xa8(%rbp), %rdi
movsd %xmm0, -0xb0(%rbp)
addq $0x18, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x62d40
movsd -0xb0(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x626cd
jmp 0x629db
leaq -0x50(%rbp), %rdi
callq 0x62fc0
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x62ef0
subl $0x2, %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jl 0x628d3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
movslq -0x54(%rbp), %rsi
callq 0x62fe0
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x62716
jmp 0x628d3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
movslq -0x54(%rbp), %rsi
callq 0x62fe0
movq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x63000
movq %rax, -0xb8(%rbp)
jmp 0x6273f
movq -0xb8(%rbp), %rax
cmpq $0x0, %rax
jne 0x628c3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
movslq -0x54(%rbp), %rsi
callq 0x62fe0
movq -0xa8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x68(%rbp)
addq $0x18, %rdi
movl -0x68(%rbp), %eax
movl %eax, %esi
callq 0x62d40
movq -0xa8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xc8(%rbp)
addq $0x98, %rdi
movl -0x68(%rbp), %eax
movl %eax, %esi
callq 0x62c70
movq %rax, %rdi
callq 0x60a80
movsd %xmm0, -0xc0(%rbp)
jmp 0x627b4
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xabd0
movsd %xmm0, -0xd0(%rbp)
jmp 0x627d4
movsd -0xd0(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x628c1
movq -0xa8(%rbp), %rdi
addq $0x18, %rdi
movl -0x68(%rbp), %eax
movl %eax, %esi
callq 0x62d40
movq -0xa8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
addq $0x98, %rdi
movl -0x68(%rbp), %eax
movl %eax, %esi
callq 0x62c70
movq %rax, %rdi
callq 0x60a80
movsd %xmm0, -0xd8(%rbp)
jmp 0x62840
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xabd0
movsd %xmm0, -0xe8(%rbp)
jmp 0x62860
movsd -0xe8(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x63060
movq %rax, -0xf0(%rbp)
jmp 0x62892
movq -0xf0(%rbp), %rax
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x628c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x63220
jmp 0x629e4
jmp 0x628c3
jmp 0x628c5
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x626ec
leaq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x63140
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0x63170
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x631a0
testb $0x1, %al
jne 0x62917
jmp 0x629d2
leaq -0x88(%rbp), %rdi
callq 0x631d0
movq -0xa8(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
movsd 0x24f29(%rip), %xmm1    # 0x87878
divsd %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
addq $0x18, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x62d40
movsd -0x108(%rbp), %xmm0
movq -0xa8(%rbp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd -0x98(%rbp), %xmm0
movsd 0x24ee8(%rip), %xmm1    # 0x87878
divsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
addq $0x18, %rdi
movl -0xa0(%rbp), %eax
movl %eax, %esi
callq 0x62d40
movsd -0x100(%rbp), %xmm1
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
leaq -0x88(%rbp), %rdi
callq 0x631f0
jmp 0x628fb
leaq -0x50(%rbp), %rdi
callq 0x63220
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x4610
nopl (%rax)