// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/perft.cpp
// Function: printPerft(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
void printPerft(const std::string& fen, int maxDepth)
{
	int nodes;
	double nps, time;
	Clock clock;
	State s(fen);

	std::cout << s;
	std::cout << ' ' << std::setfill('-') << std::setw(53) << std::right << ' '
		      << std::endl;
	std::cout << "| perft     | nodes       | nps                      |"
	          << std::endl;
    std::cout << "|" << std::setfill('-') << std::setw(53) << std::right << "|"
	          << std::endl;
	for (int depth = 2; depth <= maxDepth; ++depth)
	{
		nodes = 0;
		clock.set();
		nodes = MTperft(s, depth);
		time = clock.elapsed<std::chrono::microseconds>() / static_cast<double>(1000000);
		std::cout << "| " << std::setfill(' ') << std::setw(10) << std::left << depth
		          << "| " << std::setw(12) << std::left << nodes
		          << "| ";
		if (time > 0.0)
			std::cout << std::setw(25) << std::left << std::scientific 
		              << std::setprecision(2) 
		              << static_cast<double>(nodes) / time
		              << "|" << std::endl;
		else
			std::cout << std::setw(26) << std::right << "|" << std::endl;
	}

    std::cout << ' ' << std::setfill('-') << std::setw(53) << std::right << ' '
	          << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movl %esi, %ebx
movq %rdi, %rsi
movq %rsp, %rax
andq $0x0, (%rax)
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x12a50
movq 0x124ff(%rip), %r12     # 0x22f98
movq %r12, %rdi
movq %r14, %rsi
callq 0x13a3f
pushq $0x20
popq %rbp
movq %r12, %rdi
movl %ebp, %esi
callq 0x4290
pushq $0x2d
popq %rsi
movq %rax, %rdi
callq 0x4340
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
pushq $0x35
popq %r14
movq %r14, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %r13d      # imm = 0xFFFFFF4F
movl 0x18(%rax,%rcx), %edx
andl %r13d, %edx
movl $0x80, %r15d
orl %r15d, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movl %ebp, %esi
callq 0x4290
movq %rax, %rdi
callq 0x4120
leaq 0x8611(%rip), %rsi      # 0x19114
movq %r12, %rdi
callq 0x4240
movq %rax, %rdi
callq 0x4120
leaq 0x5fbb(%rip), %rbp      # 0x16ad5
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4240
movq %rax, %rdi
pushq $0x2d
popq %rsi
callq 0x4340
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq %r14, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl %r13d, %edx
orl %r15d, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x4240
movq %rax, %rdi
callq 0x4120
pushq $0x2
popq %r14
leaq 0x85df(%rip), %r15      # 0x1914b
cmpl %ebx, %r14d
jg 0x10cde
callq 0x4050
movq %rax, (%rsp)
leaq 0x10(%rsp), %rdi
movl %r14d, %esi
callq 0x108ed
movl %eax, %ebp
movq %rsp, %rdi
callq 0x1102a
cvtsi2sd %rax, %xmm0
divsd 0x83ce(%rip), %xmm0     # 0x18f70
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x4240
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x4340
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq $0xa, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl %r13d, %edx
orl $0x20, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movl %r14d, %esi
callq 0x43c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4240
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq $0xc, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl %r13d, %edx
orl $0x20, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movl %ebp, %esi
callq 0x43c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4240
movsd 0x8(%rsp), %xmm1
ucomisd 0x833d(%rip), %xmm1     # 0x18f78
movq (%r12), %rax
movq -0x18(%rax), %rcx
jbe 0x10c9f
movq $0x19, 0x10(%r12,%rcx)
movq -0x18(%rax), %rcx
movl 0x18(%r12,%rcx), %edx
andl %r13d, %edx
orl $0x20, %edx
movl %edx, 0x18(%r12,%rcx)
movq -0x18(%rax), %rcx
movl 0x18(%r12,%rcx), %edx
movl $0xfffffefb, %esi       # imm = 0xFFFFFEFB
andl %esi, %edx
orl $0x100, %edx            # imm = 0x100
movl %edx, 0x18(%r12,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x8(%r12,%rax)
cvtsi2sd %ebp, %xmm0
divsd %xmm1, %xmm0
movq %r12, %rdi
callq 0x4360
movq %rax, %rdi
jmp 0x10cc2
movq $0x1a, 0x10(%r12,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r12,%rax), %ecx
andl %r13d, %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%r12,%rax)
movq %r12, %rdi
leaq 0x5e0c(%rip), %rsi      # 0x16ad5
callq 0x4240
movq %rax, %rdi
callq 0x4120
incl %r14d
jmp 0x10b6c
movq 0x122b3(%rip), %rdi     # 0x22f98
pushq $0x20
popq %rbx
movl %ebx, %esi
callq 0x4290
pushq $0x2d
popq %rsi
movq %rax, %rdi
callq 0x4340
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq $0x35, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rax,%rcx), %edx
orl $0x80, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movl %ebx, %esi
callq 0x4290
movq %rax, %rdi
callq 0x4120
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq