// File: 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:
subq $0x5b8, %rsp            # imm = 0x5B8
movq %rdi, 0x5b0(%rsp)
movl %esi, 0x5ac(%rsp)
leaq 0x590(%rsp), %rdi
callq 0x305b0
movq 0x5b0(%rsp), %rsi
leaq 0x88(%rsp), %rdi
callq 0x36550
movq 0x21709(%rip), %rdi     # 0x50fb8
leaq 0x88(%rsp), %rsi
callq 0x38ae0
movq 0x216f5(%rip), %rdi     # 0x50fb8
movl $0x20, %esi
callq 0x5300
movq %rax, 0x30(%rsp)
movl $0x2d, %edi
callq 0x305c0
movq 0x30(%rsp), %rdi
movb %al, 0x87(%rsp)
movzbl 0x87(%rsp), %esi
callq 0x5400
movq %rax, 0x38(%rsp)
movl $0x35, %edi
callq 0x257e0
movq 0x38(%rsp), %rdi
movl %eax, 0x80(%rsp)
movl 0x80(%rsp), %esi
callq 0x52f0
movq %rax, %rdi
leaq 0xcba(%rip), %rsi       # 0x305e0
callq 0x50c0
movq %rax, %rdi
movl $0x20, %esi
callq 0x5300
movq %rax, %rdi
movq 0x2164e(%rip), %rsi     # 0x50f90
callq 0x52c0
movq 0x2166a(%rip), %rdi     # 0x50fb8
leaq 0x138e7(%rip), %rsi     # 0x4323c
callq 0x5290
movq %rax, %rdi
movq 0x2162c(%rip), %rsi     # 0x50f90
callq 0x52c0
movq 0x21648(%rip), %rdi     # 0x50fb8
leaq 0x1126e(%rip), %rsi     # 0x40be5
callq 0x5290
movq %rax, 0x40(%rsp)
movl $0x2d, %edi
callq 0x305c0
movq 0x40(%rsp), %rdi
movb %al, 0x7f(%rsp)
movzbl 0x7f(%rsp), %esi
callq 0x5400
movq %rax, 0x48(%rsp)
movl $0x35, %edi
callq 0x257e0
movq 0x48(%rsp), %rdi
movl %eax, 0x78(%rsp)
movl 0x78(%rsp), %esi
callq 0x52f0
movq %rax, %rdi
leaq 0xc17(%rip), %rsi       # 0x305e0
callq 0x50c0
movq %rax, %rdi
leaq 0x1120d(%rip), %rsi     # 0x40be5
callq 0x5290
movq %rax, %rdi
movq 0x215a9(%rip), %rsi     # 0x50f90
callq 0x52c0
movl $0x2, 0x74(%rsp)
movl 0x74(%rsp), %eax
cmpl 0x5ac(%rsp), %eax
jg 0x2fc34
movl $0x0, 0x5a8(%rsp)
leaq 0x590(%rsp), %rdi
callq 0x30600
movl 0x74(%rsp), %esi
leaq 0x88(%rsp), %rdi
callq 0x2f640
movl %eax, 0x5a8(%rsp)
leaq 0x590(%rsp), %rdi
callq 0x30630
cvtsi2sd %rax, %xmm0
movsd 0x13651(%rip), %xmm1    # 0x430a0
divsd %xmm1, %xmm0
movsd %xmm0, 0x598(%rsp)
movq 0x21555(%rip), %rdi     # 0x50fb8
leaq 0x13809(%rip), %rsi     # 0x43273
callq 0x5290
movq %rax, 0x18(%rsp)
movl $0x20, %edi
callq 0x305c0
movq 0x18(%rsp), %rdi
movb %al, 0x73(%rsp)
movzbl 0x73(%rsp), %esi
callq 0x5400
movq %rax, 0x20(%rsp)
movl $0xa, %edi
callq 0x257e0
movq 0x20(%rsp), %rdi
movl %eax, 0x6c(%rsp)
movl 0x6c(%rsp), %esi
callq 0x52f0
movq %rax, %rdi
leaq 0xbc4(%rip), %rsi       # 0x30680
callq 0x50c0
movq %rax, %rdi
movl 0x74(%rsp), %esi
callq 0x5490
movq %rax, %rdi
leaq 0x1379c(%rip), %rsi     # 0x43273
callq 0x5290
movq %rax, 0x28(%rsp)
movl $0xc, %edi
callq 0x257e0
movq 0x28(%rsp), %rdi
movl %eax, 0x68(%rsp)
movl 0x68(%rsp), %esi
callq 0x52f0
movq %rax, %rdi
leaq 0xb79(%rip), %rsi       # 0x30680
callq 0x50c0
movq %rax, %rdi
movl 0x5a8(%rsp), %esi
callq 0x5490
movq %rax, %rdi
leaq 0x1374e(%rip), %rsi     # 0x43273
callq 0x5290
movsd 0x598(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2fbd7
movl $0x19, %edi
callq 0x257e0
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %esi
movq 0x2145f(%rip), %rdi     # 0x50fb8
callq 0x52f0
movq %rax, %rdi
leaq 0xb18(%rip), %rsi       # 0x30680
callq 0x50c0
movq %rax, %rdi
leaq 0xb29(%rip), %rsi       # 0x306a0
callq 0x50c0
movq %rax, 0x10(%rsp)
movl $0x2, %edi
callq 0x306c0
movq 0x10(%rsp), %rdi
movl %eax, 0x60(%rsp)
movl 0x60(%rsp), %esi
callq 0x5410
movq %rax, %rdi
cvtsi2sdl 0x5a8(%rsp), %xmm0
divsd 0x598(%rsp), %xmm0
callq 0x54f0
movq %rax, %rdi
leaq 0x11024(%rip), %rsi     # 0x40be5
callq 0x5290
movq %rax, %rdi
movq 0x213c0(%rip), %rsi     # 0x50f90
callq 0x52c0
jmp 0x2fc22
movl $0x1a, %edi
callq 0x257e0
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %esi
movq 0x213c8(%rip), %rdi     # 0x50fb8
callq 0x52f0
movq %rax, %rdi
leaq 0x9e1(%rip), %rsi       # 0x305e0
callq 0x50c0
movq %rax, %rdi
leaq 0x10fd7(%rip), %rsi     # 0x40be5
callq 0x5290
movq %rax, %rdi
movq 0x21373(%rip), %rsi     # 0x50f90
callq 0x52c0
jmp 0x2fc24
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x2f9f4
movq 0x2137d(%rip), %rdi     # 0x50fb8
movl $0x20, %esi
callq 0x5300
movq %rax, (%rsp)
movl $0x2d, %edi
callq 0x305c0
movq (%rsp), %rdi
movb %al, 0x5b(%rsp)
movzbl 0x5b(%rsp), %esi
callq 0x5400
movq %rax, 0x8(%rsp)
movl $0x35, %edi
callq 0x257e0
movq 0x8(%rsp), %rdi
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %esi
callq 0x52f0
movq %rax, %rdi
leaq 0x950(%rip), %rsi       # 0x305e0
callq 0x50c0
movq %rax, %rdi
movl $0x20, %esi
callq 0x5300
movq %rax, %rdi
movq 0x212e4(%rip), %rsi     # 0x50f90
callq 0x52c0
addq $0x5b8, %rsp            # imm = 0x5B8
retq
nopl (%rax)