// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %ebx
movl %ecx, 0x2c(%rsp)
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, 0x50(%rsp)
movb 0xaa60(%rip), %al       # 0xe458
testb %al, %al
je 0x3ea1
movb 0xaa72(%rip), %al       # 0xe478
testb %al, %al
je 0x3eab
cmpl $0x1, %ebx
jg 0x3a38
movq 0x50(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
movl 0x2c(%rsp), %ecx
movl %ebx, %r8d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3f0f
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x30(%rsp), %rdi
movl $0x5a, %esi
callq 0x2260
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
leaq 0x30(%rsp), %rdi
callq 0x20b0
leaq 0x61af(%rip), %rsi      # 0x9c28
leaq 0x30(%rsp), %rdi
callq 0x22f0
movl %r15d, %r13d
negl %r13d
cmovsl %r15d, %r13d
movl $0x1, %r12d
cmpl $0xa, %r13d
jb 0x3ae3
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0x3ada
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x3ae0
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x3ae3
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x3aa7
addl $-0x3, %r12d
jmp 0x3ae3
addl $-0x2, %r12d
jmp 0x3ae3
decl %r12d
movl %r15d, %ebp
shrl $0x1f, %ebp
leal (%r12,%rbp), %esi
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8(%rsp), %rdi
movl $0x2d, %edx
callq 0x21e0
movl %ebp, %edi
addq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x69d4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rdi
callq 0x20b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3b47
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x60da(%rip), %rsi      # 0x9c28
leaq 0x30(%rsp), %rdi
callq 0x22f0
movl $0x1, %r12d
cmpl $0xa, %ebx
jb 0x3bac
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0x3ba3
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x3ba9
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x3bac
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x3b70
addl $-0x3, %r12d
jmp 0x3bac
addl $-0x2, %r12d
jmp 0x3bac
decl %r12d
movl %r12d, %esi
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movl $0x2d, %edx
callq 0x21e0
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x69d4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rdi
callq 0x20b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3c05
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x601c(%rip), %rsi      # 0x9c28
leaq 0x30(%rsp), %rdi
callq 0x22f0
movl %r14d, %r13d
negl %r13d
cmovsl %r14d, %r13d
movl $0x1, %r12d
cmpl $0xa, %r13d
jb 0x3c76
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0x3c6d
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x3c73
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x3c76
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x3c3a
addl $-0x3, %r12d
jmp 0x3c76
addl $-0x2, %r12d
jmp 0x3c76
decl %r12d
movl %r14d, %ebp
shrl $0x1f, %ebp
leal (%r12,%rbp), %esi
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movl $0x2d, %edx
callq 0x21e0
movl %ebp, %edi
addq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x69d4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rdi
callq 0x20b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3cd9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x5f48(%rip), %rsi      # 0x9c28
leaq 0x30(%rsp), %rdi
callq 0x22f0
movl 0x2c(%rsp), %eax
movl %eax, %r13d
negl %r13d
cmovsl %eax, %r13d
movl $0x1, %r12d
cmpl $0xa, %r13d
jb 0x3d4e
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0x3d45
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x3d4b
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x3d4e
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x3d12
addl $-0x3, %r12d
jmp 0x3d4e
addl $-0x2, %r12d
jmp 0x3d4e
decl %r12d
movl 0x2c(%rsp), %eax
movl %eax, %ebp
shrl $0x1f, %ebp
leal (%r12,%rbp), %esi
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movl $0x2d, %edx
callq 0x21e0
movl %ebp, %edi
addq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x69d4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rdi
callq 0x20b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3db4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0xa665(%rip), %rdi      # 0xe420
leaq 0x30(%rsp), %rsi
callq 0x809e
testq %rax, %rax
je 0x3dfa
movl 0x28(%rax), %ebx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3de9
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21a0
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
movl 0x2c(%rsp), %ecx
movl %ebx, %r8d
callq 0x3f0f
movl %eax, %ebx
cmpl $0xfff9e580, %eax       # imm = 0xFFF9E580
je 0x3dcd
cmpl $0x61a80, %ebx          # imm = 0x61A80
je 0x3dcd
leaq 0xa5f7(%rip), %rdi      # 0xe420
leaq 0x30(%rsp), %rsi
callq 0x81b6
movl %ebx, (%rax)
leaq 0xa624(%rip), %rdi      # 0xe460
leaq 0x30(%rsp), %rsi
callq 0x8512
leaq 0xa613(%rip), %rsi      # 0xe460
movq %rax, %rdi
callq 0x2050
movq 0xa614(%rip), %rax      # 0xe470
incq %rax
movq %rax, 0xa60a(%rip)      # 0xe470
cmpq $0x186a1, %rax          # imm = 0x186A1
jb 0x3dcd
movq 0xa5e7(%rip), %rsi      # 0xe460
addq $0x10, %rsi
leaq 0xa59c(%rip), %rdi      # 0xe420
callq 0x8564
movq 0xa5d0(%rip), %rsi      # 0xe460
leaq 0xa5c9(%rip), %rdi      # 0xe460
callq 0x865c
jmp 0x3dcd
callq 0x2310
jmp 0x3a00
callq 0x2394
jmp 0x3a0e
jmp 0x3ee8
jmp 0x3ee8
jmp 0x3ec5
jmp 0x3ee8
jmp 0x3ec5
jmp 0x3ee8
jmp 0x3ec5
jmp 0x3ee8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3eeb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3eeb
jmp 0x3ee8
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3f07
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x22c0