// File: codeandkey[P]neocortex/src/position.cpp
// Function: neocortex::Position::dump[abi:cxx11]()
std::string Position::dump() {
	std::string output;

	output += "board: \n";
	output += board.to_pretty();
	output += "\n";

	output += "history: ";

	for (unsigned i = 1; i < ply.size(); ++i) {
		output += ply[i].last_move.to_uci() + " ";
	}

	output += "\n";

	output += "check: " + std::string(check() ? "yes" : "no") + std::string("\n");
	output += "test_check(ctm): " + std::string(test_check(color_to_move) ? "yes" : "no") + std::string("\n");
	output += "test_check(!ctm): " + std::string(test_check(!color_to_move) ? "yes" : "no") + std::string("\n");

	Move moves[MAX_PL_MOVES];
	int num_moves = pseudolegal_moves(moves);

	output += "pseudolegal moves: ";

	for (int i = 0; i < num_moves; ++i) {
		output += moves[i].to_uci() + " ";
	}

	output += "\n";

	return output;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7e0, %rsp            # imm = 0x7E0
movq %rdi, -0x740(%rbp)
movq %rdi, %rax
movq %rax, -0x750(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x748(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x5540
movq -0x740(%rbp), %rdi
leaq 0x13c53(%rip), %rsi     # 0x27d49
callq 0x53f0
jmp 0x140fd
movq -0x748(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x8280
jmp 0x1410f
movq -0x740(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x54f0
jmp 0x14121
leaq -0x48(%rbp), %rdi
callq 0x5230
movq -0x740(%rbp), %rdi
leaq 0x13c18(%rip), %rsi     # 0x27d50
callq 0x53f0
jmp 0x1413f
movq -0x740(%rbp), %rdi
leaq 0x13c05(%rip), %rsi     # 0x27d52
callq 0x53f0
jmp 0x14154
movl $0x1, -0x4c(%rbp)
movq -0x748(%rbp), %rdi
movl -0x4c(%rbp), %eax
movq %rax, -0x758(%rbp)
addq $0x158, %rdi            # imm = 0x158
callq 0x14c10
movq %rax, %rcx
movq -0x758(%rbp), %rax
cmpq %rcx, %rax
jae 0x14261
movq -0x748(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x14fb0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0xabb0
jmp 0x141b4
leaq 0x13dd4(%rip), %rdx     # 0x27f8f
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x14fd0
jmp 0x141cd
movq -0x740(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x54f0
jmp 0x141df
leaq -0x70(%rbp), %rdi
callq 0x5230
leaq -0x90(%rbp), %rdi
callq 0x5230
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1415b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1494c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5230
jmp 0x1494c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x14250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5230
leaq -0x90(%rbp), %rdi
callq 0x5230
jmp 0x1494c
movq -0x740(%rbp), %rdi
leaq 0x13ae1(%rip), %rsi     # 0x27d50
callq 0x53f0
jmp 0x14276
movq -0x748(%rbp), %rdi
callq 0xbc10
movb %al, -0x759(%rbp)
jmp 0x1428a
movb -0x759(%rbp), %dl
leaq 0x13acd(%rip), %rcx     # 0x27d64
leaq 0x13aca(%rip), %rax     # 0x27d68
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x770(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x768(%rbp)
callq 0x56d0
movq -0x770(%rbp), %rsi
movq -0x768(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x89b0
jmp 0x142db
leaq 0x13a7a(%rip), %rsi     # 0x27d5c
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
callq 0x150f0
jmp 0x142f7
leaq -0x119(%rbp), %rdi
movq %rdi, -0x778(%rbp)
callq 0x56d0
movq -0x778(%rbp), %rdx
leaq 0x13a38(%rip), %rsi     # 0x27d50
leaq -0x118(%rbp), %rdi
callq 0x89b0
jmp 0x14326
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x15020
jmp 0x14342
movq -0x740(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x54f0
jmp 0x14357
leaq -0xb0(%rbp), %rdi
callq 0x5230
leaq -0x118(%rbp), %rdi
callq 0x5230
leaq -0x119(%rbp), %rdi
callq 0x5480
leaq -0xd0(%rbp), %rdi
callq 0x5230
leaq -0xf0(%rbp), %rdi
callq 0x5230
leaq -0xf1(%rbp), %rdi
callq 0x5480
movq -0x748(%rbp), %rdi
movl 0x170(%rdi), %esi
callq 0x14b90
movb %al, -0x779(%rbp)
jmp 0x143b9
movb -0x779(%rbp), %dl
leaq 0x1399e(%rip), %rcx     # 0x27d64
leaq 0x1399b(%rip), %rax     # 0x27d68
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x790(%rbp)
leaq -0x181(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0x56d0
movq -0x790(%rbp), %rsi
movq -0x788(%rbp), %rdx
leaq -0x180(%rbp), %rdi
callq 0x89b0
jmp 0x1440a
leaq 0x1395a(%rip), %rsi     # 0x27d6b
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rdx
callq 0x150f0
jmp 0x14426
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x798(%rbp)
callq 0x56d0
movq -0x798(%rbp), %rdx
leaq 0x13909(%rip), %rsi     # 0x27d50
leaq -0x1a8(%rbp), %rdi
callq 0x89b0
jmp 0x14455
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
callq 0x15020
jmp 0x14471
movq -0x740(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x54f0
jmp 0x14486
leaq -0x140(%rbp), %rdi
callq 0x5230
leaq -0x1a8(%rbp), %rdi
callq 0x5230
leaq -0x1a9(%rbp), %rdi
callq 0x5480
leaq -0x160(%rbp), %rdi
callq 0x5230
leaq -0x180(%rbp), %rdi
callq 0x5230
leaq -0x181(%rbp), %rdi
callq 0x5480
movq -0x748(%rbp), %rdi
movl 0x170(%rdi), %eax
testl %eax, %eax
sete %al
movzbl %al, %esi
callq 0x14b90
movb %al, -0x799(%rbp)
jmp 0x144f0
movb -0x799(%rbp), %dl
leaq 0x13867(%rip), %rcx     # 0x27d64
leaq 0x13864(%rip), %rax     # 0x27d68
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x7b0(%rbp)
leaq -0x211(%rbp), %rdi
movq %rdi, -0x7a8(%rbp)
callq 0x56d0
movq -0x7b0(%rbp), %rsi
movq -0x7a8(%rbp), %rdx
leaq -0x210(%rbp), %rdi
callq 0x89b0
jmp 0x14541
leaq 0x13835(%rip), %rsi     # 0x27d7d
leaq -0x1f0(%rbp), %rdi
leaq -0x210(%rbp), %rdx
callq 0x150f0
jmp 0x1455d
leaq -0x239(%rbp), %rdi
movq %rdi, -0x7b8(%rbp)
callq 0x56d0
movq -0x7b8(%rbp), %rdx
leaq 0x137d2(%rip), %rsi     # 0x27d50
leaq -0x238(%rbp), %rdi
callq 0x89b0
jmp 0x1458c
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
leaq -0x238(%rbp), %rdx
callq 0x15020
jmp 0x145a8
movq -0x740(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x54f0
jmp 0x145bd
leaq -0x1d0(%rbp), %rdi
callq 0x5230
leaq -0x238(%rbp), %rdi
callq 0x5230
leaq -0x239(%rbp), %rdi
callq 0x5480
leaq -0x1f0(%rbp), %rdi
callq 0x5230
leaq -0x210(%rbp), %rdi
callq 0x5230
leaq -0x211(%rbp), %rdi
callq 0x5480
leaq -0x6f0(%rbp), %rax
movq %rax, %rcx
addq $0x4b0, %rcx            # imm = 0x4B0
movq %rcx, -0x7c8(%rbp)
movq %rax, -0x7c0(%rbp)
movq -0x7c0(%rbp), %rdi
movq %rdi, -0x7d0(%rbp)
callq 0xa870
jmp 0x14639
movq -0x7c8(%rbp), %rcx
movq -0x7d0(%rbp), %rax
addq $0xc, %rax
cmpq %rcx, %rax
movq %rax, -0x7c0(%rbp)
jne 0x14624
movq -0x748(%rbp), %rdi
leaq -0x6f0(%rbp), %rsi
callq 0xe050
movl %eax, -0x7d4(%rbp)
jmp 0x14672
movq -0x740(%rbp), %rdi
movl -0x7d4(%rbp), %eax
movl %eax, -0x6f4(%rbp)
leaq 0x13704(%rip), %rsi     # 0x27d90
callq 0x53f0
jmp 0x14693
movl $0x0, -0x6f8(%rbp)
movl -0x6f8(%rbp), %eax
cmpl -0x6f4(%rbp), %eax
jge 0x14911
movslq -0x6f8(%rbp), %rax
leaq (%rax,%rax,2), %rax
leaq -0x6f0(%rbp,%rax,4), %rsi
leaq -0x738(%rbp), %rdi
callq 0xabb0
jmp 0x146d0
leaq 0x138b8(%rip), %rdx     # 0x27f8f
leaq -0x718(%rbp), %rdi
leaq -0x738(%rbp), %rsi
callq 0x14fd0
jmp 0x146ec
movq -0x740(%rbp), %rdi
leaq -0x718(%rbp), %rsi
callq 0x54f0
jmp 0x14701
leaq -0x718(%rbp), %rdi
callq 0x5230
leaq -0x738(%rbp), %rdi
callq 0x5230
movl -0x6f8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f8(%rbp)
jmp 0x1469d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x147ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x147a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x14789
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1477d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x5230
leaq -0x118(%rbp), %rdi
callq 0x5230
leaq -0x119(%rbp), %rdi
callq 0x5480
leaq -0xd0(%rbp), %rdi
callq 0x5230
leaq -0xf0(%rbp), %rdi
callq 0x5230
leaq -0xf1(%rbp), %rdi
callq 0x5480
jmp 0x1494c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1483e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x14832
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1481a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1480e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x5230
leaq -0x1a8(%rbp), %rdi
callq 0x5230
leaq -0x1a9(%rbp), %rdi
callq 0x5480
leaq -0x160(%rbp), %rdi
callq 0x5230
leaq -0x180(%rbp), %rdi
callq 0x5230
leaq -0x181(%rbp), %rdi
callq 0x5480
jmp 0x1494c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x148cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x148c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x148ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1489f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x5230
leaq -0x238(%rbp), %rdi
callq 0x5230
leaq -0x239(%rbp), %rdi
callq 0x5480
leaq -0x1f0(%rbp), %rdi
callq 0x5230
leaq -0x210(%rbp), %rdi
callq 0x5230
leaq -0x211(%rbp), %rdi
callq 0x5480
jmp 0x1494c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x14903
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x718(%rbp), %rdi
callq 0x5230
leaq -0x738(%rbp), %rdi
callq 0x5230
jmp 0x1494c
movq -0x740(%rbp), %rdi
leaq 0x13431(%rip), %rsi     # 0x27d50
callq 0x53f0
jmp 0x14926
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x1493c
movq -0x740(%rbp), %rdi
callq 0x5230
movq -0x750(%rbp), %rax
addq $0x7e0, %rsp            # imm = 0x7E0
popq %rbp
retq
movq -0x740(%rbp), %rdi
callq 0x5230
movq -0x20(%rbp), %rdi
callq 0x56c0
nopw %cs:(%rax,%rax)