// File: /workspace/github_cpp_makefile_star2_O3/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 $0x528, %rsp            # imm = 0x528
movq %rsi, 0x10(%rsp)
movq %rdi, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x1655c
movq 0x10e4f(%rip), %r14     # 0x24fa0
movq %r14, %rdi
movq %r15, %rsi
callq 0x18775
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %r14, %rdi
callq 0x4290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rcx
leaq (%r15,%rcx), %r12
cmpb $0x0, 0xe1(%r15,%rcx)
jne 0x141a3
movq %r12, %rdi
movl $0x20, %esi
callq 0x4230
movb $0x1, 0xe1(%r12)
movq (%r15), %rax
movb $0x2d, 0xe0(%r12)
movq -0x18(%rax), %rcx
movq $0x35, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ebx       # imm = 0xFFFFFF4F
movl 0x18(%r15,%rax), %ecx
andl %ebx, %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%r15,%rax)
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %r15, %rdi
callq 0x4290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
leaq 0x9eba(%rip), %rsi      # 0x1e0d4
movl $0x36, %edx
movq %r14, %rdi
callq 0x4290
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
leaq 0x7bf0(%rip), %rsi      # 0x1be45
movl $0x1, %edx
movq %r14, %rdi
callq 0x4290
movq (%r14), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x14290
movq %r15, %rdi
movl $0x20, %esi
callq 0x4230
movb $0x1, 0xe1(%r15)
movq (%r14), %rax
movb $0x2d, 0xe0(%r15)
movq -0x18(%rax), %rcx
movq $0x35, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
andl 0x18(%r14,%rax), %ebx
orl $0x80, %ebx
movl %ebx, 0x18(%r14,%rax)
leaq 0x7b85(%rip), %rsi      # 0x1be45
movl $0x1, %edx
movq %r14, %rdi
callq 0x4290
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
cmpl $0x2, 0x10(%rsp)
jl 0x14519
movq 0x10(%rsp), %rax
negl %eax
movq %rax, 0x10(%rsp)
movl $0x2, %r12d
leaq 0x9df3(%rip), %r13      # 0x1e10b
movl $0xffffff4f, %ebx       # imm = 0xFFFFFF4F
callq 0x4060
movq %rax, %rbp
leaq 0x20(%rsp), %rdi
movl %r12d, %esi
callq 0x13f72
movl %eax, %r15d
callq 0x4060
subq %rbp, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
divsd 0x9bc8(%rip), %xmm0     # 0x1df30
movsd %xmm0, 0x18(%rsp)
movl $0x2, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x4290
movq (%r14), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %rbp
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x143ab
movq %rbp, %rdi
movl $0x20, %esi
callq 0x4230
movb $0x1, 0xe1(%rbp)
movq (%r14), %rax
movb $0x20, 0xe0(%rbp)
movq -0x18(%rax), %rcx
movq $0xa, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl %ebx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %r14, %rdi
movl %r12d, %esi
callq 0x43a0
movq %rax, %rbp
movl $0x2, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x4290
movq (%rbp), %rax
movq -0x18(%rax), %rcx
movq $0xc, 0x10(%rbp,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%rbp,%rax), %ecx
andl %ebx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%rbp,%rax)
movq %rbp, %rdi
movl %r15d, %esi
callq 0x43a0
movl $0x2, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x4290
movsd 0x18(%rsp), %xmm1
ucomisd 0x9afd(%rip), %xmm1     # 0x1df38
movq (%r14), %rax
movq -0x18(%rax), %rcx
jbe 0x144a1
movq $0x19, 0x10(%r14,%rcx)
movq -0x18(%rax), %rcx
movl 0x18(%r14,%rcx), %edx
andl %ebx, %edx
orl $0x20, %edx
movl %edx, 0x18(%r14,%rcx)
movq -0x18(%rax), %rcx
movl 0x18(%r14,%rcx), %edx
movl $0xfffffefb, %esi       # imm = 0xFFFFFEFB
andl %esi, %edx
orl $0x100, %edx            # imm = 0x100
movl %edx, 0x18(%r14,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x8(%r14,%rax)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x4350
movq %rax, %r15
jmp 0x144c3
movq $0x1a, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl %ebx, %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %r14, %r15
movl $0x1, %edx
movq %r15, %rdi
leaq 0x7973(%rip), %rsi      # 0x1be45
callq 0x4290
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
movq 0x10(%rsp), %rax
addl %r12d, %eax
incl %eax
movl %r12d, %ecx
incl %ecx
movl %ecx, %r12d
cmpl $0x1, %eax
jne 0x1431d
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movq 0x10a78(%rip), %rdi     # 0x24fa0
movl $0x1, %edx
callq 0x4290
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r14
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x14562
movq %r14, %rdi
movl $0x20, %esi
callq 0x4230
movb $0x1, 0xe1(%r14)
movq (%rbx), %rax
movb $0x2d, 0xe0(%r14)
movq -0x18(%rax), %rcx
movq $0x35, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ecx       # imm = 0xFFFFFF4F
andl 0x18(%rbx,%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x4290
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq