// File: tewalds[P]morat/gomoku/board.cpp
// Function: Morat::Gomoku::Board::to_s(bool, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> (Morat::Move)>) const
std::string Board::to_s(bool color, std::function<std::string(Move)> func) const {
	using std::string;
	string white = "O",
	       black = "@",
	       coord = "",
	       reset = "";
	if(color){
		string esc = "\033";
		reset = esc + "[0m";
		coord = esc + "[1;37m";
		white = esc + "[1;33m" + "@"; //yellow
		black = esc + "[1;34m" + "@"; //blue
	}

	string s;
	s += "  ";
	for(int i = 0; i < size_; i++)
		s += " " + coord + char('A' + i);
	s += "\n";

	for(int y = 0; y < size_; y++){
		if (y + 1 < 10)
			s += ' ';
		s += coord + to_str(y + 1);
		int end = line_end(y);
		for(int x = line_start(y); x < end; x++){
			s += (last_move_ == Move(x, y)   ? coord + "[" :
			      last_move_ == Move(x-1, y) ? coord + "]" : " ");
			Side p = get(x, y);
			if(     p == Side::NONE) s += reset + func(Move(x, y));
			else if(p == Side::P1)   s += white;
			else if(p == Side::P2)   s += black;
			else                     s += "?";
		}
		s += (last_move_ == Move(end-1, y) ? coord + "]" : " ");
		s += '\n';
	}

	s += reset;
	return s;
}

// Assembly:
subq $0x398, %rsp            # imm = 0x398
movq %rcx, 0x88(%rsp)
movq %rdi, 0x90(%rsp)
movb %dl, %al
movq %rdi, %rdx
movq %rdx, 0x98(%rsp)
movq %rdi, 0x390(%rsp)
movq %rsi, 0x388(%rsp)
andb $0x1, %al
movb %al, 0x387(%rsp)
movq %rcx, 0x378(%rsp)
movq 0x388(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x357(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x5770
movq 0xa8(%rsp), %rdx
leaq 0x17c88(%rip), %rsi     # 0x4b2b1
leaq 0x358(%rsp), %rdi
callq 0x5590
jmp 0x33638
leaq 0x357(%rsp), %rdi
callq 0x5450
leaq 0x31f(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x5770
movq 0x80(%rsp), %rdx
leaq 0x16e01(%rip), %rsi     # 0x4a46a
leaq 0x320(%rsp), %rdi
callq 0x5590
jmp 0x33678
leaq 0x31f(%rsp), %rdi
callq 0x5450
leaq 0x2f7(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x5770
movq 0x78(%rsp), %rdx
leaq 0x14215(%rip), %rsi     # 0x478b8
leaq 0x2f8(%rsp), %rdi
callq 0x5590
jmp 0x336b2
leaq 0x2f7(%rsp), %rdi
callq 0x5450
leaq 0x2cf(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x5770
movq 0x70(%rsp), %rdx
leaq 0x141db(%rip), %rsi     # 0x478b8
leaq 0x2d0(%rsp), %rdi
callq 0x5590
jmp 0x336ec
leaq 0x2cf(%rsp), %rdi
callq 0x5450
testb $0x1, 0x387(%rsp)
je 0x339d9
leaq 0x2a7(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x5770
movq 0x68(%rsp), %rdx
leaq 0x16d47(%rip), %rsi     # 0x4a46c
leaq 0x2a8(%rsp), %rdi
callq 0x5590
jmp 0x33734
leaq 0x2a7(%rsp), %rdi
callq 0x5450
leaq 0x16d26(%rip), %rdx     # 0x4a46e
leaq 0x280(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x25a90
jmp 0x3375f
leaq 0x2d0(%rsp), %rdi
leaq 0x280(%rsp), %rsi
movq %rsi, 0x60(%rsp)
callq 0x5500
movq 0x60(%rsp), %rdi
callq 0x5260
leaq 0x16ce8(%rip), %rdx     # 0x4a472
leaq 0x260(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x25a90
jmp 0x337a1
leaq 0x2f8(%rsp), %rdi
leaq 0x260(%rsp), %rsi
movq %rsi, 0x58(%rsp)
callq 0x5500
movq 0x58(%rsp), %rdi
callq 0x5260
leaq 0x16cad(%rip), %rdx     # 0x4a479
leaq 0x220(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x25a90
jmp 0x337e3
leaq 0x16c80(%rip), %rdx     # 0x4a46a
leaq 0x240(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0xb7e0
jmp 0x33801
leaq 0x358(%rsp), %rdi
leaq 0x240(%rsp), %rsi
movq %rsi, 0x50(%rsp)
callq 0x5500
movq 0x50(%rsp), %rdi
callq 0x5260
leaq 0x220(%rsp), %rdi
callq 0x5260
leaq 0x16c47(%rip), %rdx     # 0x4a480
leaq 0x1e0(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x25a90
jmp 0x33850
leaq 0x16c13(%rip), %rdx     # 0x4a46a
leaq 0x200(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0xb7e0
jmp 0x3386e
leaq 0x320(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x5500
leaq 0x200(%rsp), %rdi
callq 0x5260
leaq 0x1e0(%rsp), %rdi
callq 0x5260
leaq 0x2a8(%rsp), %rdi
callq 0x5260
jmp 0x339d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x357(%rsp), %rdi
callq 0x5450
jmp 0x3423b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x31f(%rsp), %rdi
callq 0x5450
jmp 0x3422e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x2f7(%rsp), %rdi
callq 0x5450
jmp 0x34221
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x2cf(%rsp), %rdi
callq 0x5450
jmp 0x34214
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x2a7(%rsp), %rdi
callq 0x5450
jmp 0x34207
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x339c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x5260
jmp 0x339c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x5260
leaq 0x2a8(%rsp), %rdi
callq 0x5260
jmp 0x34207
movq 0x90(%rsp), %rdi
movb $0x0, 0x1df(%rsp)
callq 0x55a0
movq 0x90(%rsp), %rdi
leaq 0x14982(%rip), %rsi     # 0x4837f
callq 0x53b0
jmp 0x33a04
movl $0x0, 0x1d8(%rsp)
movq 0xa0(%rsp), %rcx
movl 0x1d8(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x33b14
leaq 0x16f28(%rip), %rsi     # 0x4a958
leaq 0x198(%rsp), %rdi
leaq 0x2f8(%rsp), %rdx
callq 0xb830
jmp 0x33a47
movl 0x1d8(%rsp), %eax
addl $0x41, %eax
movsbl %al, %edx
leaq 0x1b8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x14b50
jmp 0x33a6b
movq 0x90(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x5520
jmp 0x33a82
leaq 0x1b8(%rsp), %rdi
callq 0x5260
leaq 0x198(%rsp), %rdi
callq 0x5260
movl 0x1d8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d8(%rsp)
jmp 0x33a0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x341fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x33b02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x5260
leaq 0x198(%rsp), %rdi
callq 0x5260
jmp 0x341fa
movq 0x90(%rsp), %rdi
leaq 0x13d94(%rip), %rsi     # 0x478b7
callq 0x53b0
jmp 0x33b2a
movl $0x0, 0x194(%rsp)
movq 0xa0(%rsp), %rcx
movl 0x194(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x34180
movl 0x194(%rsp), %eax
addl $0x1, %eax
cmpl $0xa, %eax
jge 0x33b74
movq 0x90(%rsp), %rdi
movl $0x20, %esi
callq 0x5270
jmp 0x33b72
jmp 0x33b74
movl 0x194(%rsp), %esi
incl %esi
leaq 0x150(%rsp), %rdi
callq 0x1a230
jmp 0x33b8c
leaq 0x170(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
leaq 0x150(%rsp), %rdx
callq 0x34650
jmp 0x33bab
movq 0x90(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x5520
jmp 0x33bc2
leaq 0x170(%rsp), %rdi
callq 0x5260
leaq 0x150(%rsp), %rdi
callq 0x5260
movq 0xa0(%rsp), %rdi
movl 0x194(%rsp), %esi
callq 0x1fc90
movl %eax, 0x4c(%rsp)
jmp 0x33bf6
movq 0xa0(%rsp), %rdi
movl 0x4c(%rsp), %eax
movl %eax, 0x14c(%rsp)
movl 0x194(%rsp), %esi
callq 0x1fc50
movl %eax, 0x48(%rsp)
jmp 0x33c1b
movl 0x48(%rsp), %eax
movl %eax, 0x148(%rsp)
movl 0x148(%rsp), %eax
cmpl 0x14c(%rsp), %eax
jge 0x34016
movq 0xa0(%rsp), %rax
addq $0x6, %rax
movq %rax, 0x40(%rsp)
movl 0x148(%rsp), %esi
movl 0x194(%rsp), %edx
movb $0x0, 0x122(%rsp)
leaq 0x126(%rsp), %rdi
callq 0x11460
jmp 0x33c70
movq 0x40(%rsp), %rdi
leaq 0x126(%rsp), %rsi
callq 0x1c1e0
movb %al, 0x3f(%rsp)
jmp 0x33c88
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x33c92
jmp 0x33cb5
leaq 0x17b0a(%rip), %rdx     # 0x4b7a3
leaq 0x128(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x25a90
jmp 0x33cb0
jmp 0x33d60
movq 0xa0(%rsp), %rax
addq $0x6, %rax
movq %rax, 0x30(%rsp)
movl 0x148(%rsp), %esi
decl %esi
movl 0x194(%rsp), %edx
leaq 0x124(%rsp), %rdi
callq 0x11460
jmp 0x33ce5
movq 0x30(%rsp), %rdi
leaq 0x124(%rsp), %rsi
callq 0x1c1e0
movb %al, 0x2f(%rsp)
jmp 0x33cfd
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x33d07
jmp 0x33d27
leaq 0x16325(%rip), %rdx     # 0x4a033
leaq 0x128(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x25a90
jmp 0x33d25
jmp 0x33d5e
leaq 0x123(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x5770
movq 0x20(%rsp), %rdx
movb $0x1, 0x122(%rsp)
leaq 0x16c0b(%rip), %rsi     # 0x4a958
leaq 0x128(%rsp), %rdi
callq 0x5590
jmp 0x33d5c
jmp 0x33d5e
jmp 0x33d60
movq 0x90(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x5520
jmp 0x33d77
leaq 0x128(%rsp), %rdi
callq 0x5260
testb $0x1, 0x122(%rsp)
jne 0x33d90
jmp 0x33d9d
leaq 0x123(%rsp), %rdi
callq 0x5450
movq 0xa0(%rsp), %rdi
movl 0x148(%rsp), %esi
movl 0x194(%rsp), %edx
callq 0x346a0
movb %al, 0x1f(%rsp)
jmp 0x33dbe
movb 0x1f(%rsp), %al
movb %al, 0x121(%rsp)
leaq 0x32703(%rip), %rsi     # 0x664d3
leaq 0x121(%rsp), %rdi
callq 0x1f7c0
movb %al, 0x1e(%rsp)
jmp 0x33de3
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x33df0
jmp 0x33f68
movl 0x148(%rsp), %esi
movl 0x194(%rsp), %edx
leaq 0xde(%rsp), %rdi
callq 0x11460
jmp 0x33e0d
movq 0x88(%rsp), %rsi
movzwl 0xde(%rsp), %edx
leaq 0xe0(%rsp), %rdi
callq 0x346f0
jmp 0x33e2c
leaq 0x100(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x34650
jmp 0x33e4b
movq 0x90(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x5520
jmp 0x33e62
leaq 0x100(%rsp), %rdi
callq 0x5260
leaq 0xe0(%rsp), %rdi
callq 0x5260
jmp 0x33ffe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x33eb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x5260
leaq 0x150(%rsp), %rdi
callq 0x5260
jmp 0x341fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x33f01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x5260
testb $0x1, 0x122(%rsp)
jne 0x33f0d
jmp 0x33f1a
leaq 0x123(%rsp), %rdi
callq 0x5450
jmp 0x341fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x33f56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x5260
leaq 0xe0(%rsp), %rdi
callq 0x5260
jmp 0x341fa
leaq 0x32565(%rip), %rsi     # 0x664d4
leaq 0x121(%rsp), %rdi
callq 0x1f7c0
movb %al, 0x1d(%rsp)
jmp 0x33f82
movb 0x1d(%rsp), %al
testb $0x1, %al
jne 0x33f8c
jmp 0x33fa5
movq 0x90(%rsp), %rdi
leaq 0x358(%rsp), %rsi
callq 0x5520
jmp 0x33fa3
jmp 0x33ffc
leaq 0x32529(%rip), %rsi     # 0x664d5
leaq 0x121(%rsp), %rdi
callq 0x1f7c0
movb %al, 0x1c(%rsp)
jmp 0x33fbf
movb 0x1c(%rsp), %al
testb $0x1, %al
jne 0x33fc9
jmp 0x33fe2
movq 0x90(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0x5520
jmp 0x33fe0
jmp 0x33ffa
movq 0x90(%rsp), %rdi
leaq 0x16496(%rip), %rsi     # 0x4a487
callq 0x53b0
jmp 0x33ff8
jmp 0x33ffa
jmp 0x33ffc
jmp 0x33ffe
jmp 0x34000
movl 0x148(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x148(%rsp)
jmp 0x33c26
movq 0xa0(%rsp), %rax
addq $0x6, %rax
movq %rax, 0x10(%rsp)
movl 0x14c(%rsp), %esi
decl %esi
movl 0x194(%rsp), %edx
movb $0x0, 0xb4(%rsp)
leaq 0xb6(%rsp), %rdi
callq 0x11460
jmp 0x3404e
movq 0x10(%rsp), %rdi
leaq 0xb6(%rsp), %rsi
callq 0x1c1e0
movb %al, 0xf(%rsp)
jmp 0x34066
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x34070
jmp 0x34090
leaq 0x15fbc(%rip), %rdx     # 0x4a033
leaq 0xb8(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x25a90
jmp 0x3408e
jmp 0x340c5
leaq 0xb5(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x5770
movq (%rsp), %rdx
movb $0x1, 0xb4(%rsp)
leaq 0x168a4(%rip), %rsi     # 0x4a958
leaq 0xb8(%rsp), %rdi
callq 0x5590
jmp 0x340c3
jmp 0x340c5
movq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x5520
jmp 0x340dc
leaq 0xb8(%rsp), %rdi
callq 0x5260
testb $0x1, 0xb4(%rsp)
jne 0x340f5
jmp 0x34102
leaq 0xb5(%rsp), %rdi
callq 0x5450
movq 0x90(%rsp), %rdi
movl $0xa, %esi
callq 0x5270
jmp 0x34116
jmp 0x34118
movl 0x194(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x194(%rsp)
jmp 0x33b35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
jmp 0x34165
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x348(%rsp)
movl %eax, 0x344(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x5260
testb $0x1, 0xb4(%rsp)
jne 0x34171
jmp 0x3417e
leaq 0xb5(%rsp), %rdi
callq 0x5450
jmp 0x341fa
movq 0x90(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0x5520
jmp 0x34197
movb $0x1, 0x1df(%rsp)
testb $0x1, 0x1df(%rsp)
jne 0x341b6
movq 0x90(%rsp), %rdi
callq 0x5260
leaq 0x2d0(%rsp), %rdi
callq 0x5260
leaq 0x2f8(%rsp), %rdi
callq 0x5260
leaq 0x320(%rsp), %rdi
callq 0x5260
leaq 0x358(%rsp), %rdi
callq 0x5260
movq 0x98(%rsp), %rax
addq $0x398, %rsp            # imm = 0x398
retq
movq 0x90(%rsp), %rdi
callq 0x5260
leaq 0x2d0(%rsp), %rdi
callq 0x5260
leaq 0x2f8(%rsp), %rdi
callq 0x5260
leaq 0x320(%rsp), %rdi
callq 0x5260
leaq 0x358(%rsp), %rdi
callq 0x5260
movq 0x348(%rsp), %rdi
callq 0x5760
nopl (%rax,%rax)