// File: /workspace/github_cpp_makefile_star2_O1/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 0x16640
movq 0x10d6b(%rip), %r14     # 0x24fa0
movq %r14, %rdi
movq %r15, %rsi
callq 0x18888
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %r14, %rdi
callq 0x4290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %r12
cmpb $0x0, 0xe1(%r15,%rax)
jne 0x1428c
movq %r12, %rdi
movl $0x20, %esi
callq 0x4230
movb %al, 0xe0(%r12)
movb $0x1, 0xe1(%r12)
movb $0x2d, 0xe0(%r12)
movq (%r15), %rax
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 0x9ece(%rip), %rsi      # 0x1e1d4
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 0x7c04(%rip), %rsi      # 0x1bf45
movl $0x1, %edx
movq %r14, %rdi
callq 0x4290
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %r15
cmpb $0x0, 0xe1(%r14,%rax)
jne 0x14380
movq %r15, %rdi
movl $0x20, %esi
callq 0x4230
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x2d, 0xe0(%r15)
movq (%r14), %rax
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 0x7b92(%rip), %rsi      # 0x1bf45
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 0x14612
movq 0x10(%rsp), %rax
negl %eax
movq %rax, 0x10(%rsp)
movl $0x2, %r12d
leaq 0x9e00(%rip), %r13      # 0x1e20b
movl $0xffffff4f, %ebx       # imm = 0xFFFFFF4F
callq 0x4060
movq %rax, %rbp
leaq 0x20(%rsp), %rdi
movl %r12d, %esi
callq 0x14056
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 0x9bd5(%rip), %xmm0     # 0x1e030
movsd %xmm0, 0x18(%rsp)
movl $0x2, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x4290
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rbp
cmpb $0x0, 0xe1(%r14,%rax)
jne 0x144a1
movq %rbp, %rdi
movl $0x20, %esi
callq 0x4230
movb %al, 0xe0(%rbp)
movb $0x1, 0xe1(%rbp)
movb $0x20, 0xe0(%rbp)
movq (%r14), %rax
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 0x9b04(%rip), %xmm1     # 0x1e038
movq (%r14), %rax
movq -0x18(%rax), %rcx
jbe 0x1459a
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 0x145bc
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 0x797a(%rip), %rsi      # 0x1bf45
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 0x14410
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movq 0x1097f(%rip), %rdi     # 0x24fa0
movl $0x1, %edx
callq 0x4290
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %r14
cmpb $0x0, 0xe1(%rbx,%rax)
jne 0x1465f
movq %r14, %rdi
movl $0x20, %esi
callq 0x4230
movb %al, 0xe0(%r14)
movb $0x1, 0xe1(%r14)
movb $0x2d, 0xe0(%r14)
movq (%rbx), %rax
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