// File: /workspace/github_cpp_makefile_star2_O2/vygr[P]C-Chess/chess.cpp
// Function: score(score_board const&, int, int, int, int)
auto score(const score_board &sbrd, int colour, int alpha, int beta, int ply)
{
	static auto trans_table = std::unordered_map<std::string, int>{};
	static auto trans_lru = std::list<std::string>{};
	if (ply < 2) return score_impl(sbrd, colour, alpha, beta, ply);
	std::string key; key.reserve(90);
	key += sbrd.brd; key += ":";
	key += std::to_string(colour); key += ":";
	key += std::to_string(ply); key += ":";
	key += std::to_string(alpha); key += ":";
	key += std::to_string(beta);
	auto search = trans_table.find(key);
	if (search != end(trans_table)) return search->second;
	auto score = score_impl(sbrd, colour, alpha, beta, ply);
	if (score == timeout_value || score == -timeout_value) return score;
	trans_table[key] = score;
	trans_lru.push_back(key);
	if (trans_lru.size() > max_score_entries)
	{
		trans_table.erase(trans_lru.front());
		trans_lru.pop_front();
	}
	return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %r8d, %ebx
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
movb 0xad8b(%rip), %al       # 0xe470
testb %al, %al
je 0x38bd
movb 0xad9d(%rip), %al       # 0xe490
testb %al, %al
je 0x3938
cmpl $0x1, %ebx
jg 0x371f
movq %r12, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
movl %ebx, %r8d
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x39c1
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x20(%rsp), %rdi
pushq $0x5a
popq %rsi
callq 0x2280
leaq 0x8(%r12), %rsi
leaq 0x20(%rsp), %rdi
callq 0x2320
leaq 0x54e9(%rip), %rsi      # 0x8c3c
leaq 0x20(%rsp), %rdi
callq 0x2300
movq %rsp, %rdi
movl %r15d, %esi
callq 0x4f09
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2320
movq %rsp, %rdi
callq 0x20f0
leaq 0x54b8(%rip), %rsi      # 0x8c3c
leaq 0x20(%rsp), %rdi
callq 0x2300
movq %rsp, %rdi
movl %ebx, %esi
callq 0x4f09
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2320
movq %rsp, %rdi
callq 0x20f0
leaq 0x5488(%rip), %rsi      # 0x8c3c
leaq 0x20(%rsp), %rdi
callq 0x2300
movq %rsp, %rdi
movl %r14d, %esi
callq 0x4f09
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2320
movq %rsp, %rdi
callq 0x20f0
leaq 0x5457(%rip), %rsi      # 0x8c3c
leaq 0x20(%rsp), %rdi
callq 0x2300
movq %rsp, %rdi
movl %ebp, %esi
callq 0x4f09
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2320
movq %rsp, %rdi
callq 0x20f0
leaq 0xac23(%rip), %rdi      # 0xe438
leaq 0x20(%rsp), %rsi
callq 0x6e2a
testq %rax, %rax
je 0x3840
movl 0x28(%rax), %ebx
leaq 0x20(%rsp), %rdi
callq 0x20f0
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x39c1
movl %eax, %ebx
cmpl $0xfff9e580, %eax       # imm = 0xFFF9E580
je 0x3827
cmpl $0x61a80, %ebx          # imm = 0x61A80
je 0x3827
leaq 0xabcd(%rip), %rdi      # 0xe438
leaq 0x20(%rsp), %rsi
callq 0x6f46
movl %ebx, (%rax)
leaq 0xabfa(%rip), %rdi      # 0xe478
leaq 0x20(%rsp), %rsi
callq 0x4f62
cmpq $0x186a1, 0xabf5(%rip) # imm = 0x186A1
jb 0x3827
movq 0xabdc(%rip), %rsi      # 0xe478
addq $0x10, %rsi
leaq 0xab91(%rip), %rdi      # 0xe438
callq 0x73ae
leaq 0xabc5(%rip), %rdi      # 0xe478
callq 0x4f6e
jmp 0x3827
leaq 0xabac(%rip), %rdi      # 0xe470
callq 0x22f0
testl %eax, %eax
je 0x36ed
andq $0x0, 0xab7f(%rip)      # 0xe458
leaq 0xab58(%rip), %rsi      # 0xe438
leaq 0xab81(%rip), %rax      # 0xe468
movq %rax, 0xab4a(%rip)      # 0xe438
movq $0x1, 0xab47(%rip) # 0xe440
xorps %xmm0, %xmm0
movups %xmm0, 0xab45(%rip)     # 0xe448
movl $0x3f800000, 0xab4b(%rip) # imm = 0x3F800000
movups %xmm0, 0xab4c(%rip)     # 0xe460
leaq 0x15e3(%rip), %rdi      # 0x4efe
leaq 0xa87e(%rip), %rdx      # 0xe1a0
callq 0x2190
leaq 0xab42(%rip), %rdi      # 0xe470
callq 0x2130
jmp 0x36ed
leaq 0xab51(%rip), %rdi      # 0xe490
callq 0x22f0
testl %eax, %eax
je 0x36fb
leaq 0xab25(%rip), %rsi      # 0xe478
movq %rsi, 0xab26(%rip)      # 0xe480
movq %rsi, 0xab17(%rip)      # 0xe478
andq $0x0, 0xab1f(%rip)      # 0xe488
leaq 0x1594(%rip), %rdi      # 0x4f04
leaq 0xa829(%rip), %rdx      # 0xe1a0
callq 0x2190
leaq 0xab0d(%rip), %rdi      # 0xe490
callq 0x2130
jmp 0x36fb
jmp 0x39ac
jmp 0x39ac
jmp 0x399d
jmp 0x39ac
jmp 0x399d
jmp 0x39ac
jmp 0x399d
jmp 0x39ac
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20f0
jmp 0x39af
jmp 0x39ac
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x22e0