// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
leaq 0xda3e(%rip), %rsi      # 0x244b6
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
movq %rcx, 0xa8(%rsp)
callq 0x5110
leaq 0xca72(%rip), %rsi      # 0x2350e
leaq 0xd8(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x5110
leaq 0x9df7(%rip), %rsi      # 0x208ac
leaq 0x60(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x5110
leaq 0x9dde(%rip), %rsi      # 0x208ac
leaq 0xb8(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x5110
testb %bpl, %bpl
je 0x16c24
leaq 0xca20(%rip), %rsi      # 0x23510
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x5110
leaq 0xca0c(%rip), %rdx      # 0x23512
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x10c31
leaq 0x18(%rsp), %r14
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0xc9dd(%rip), %rdx      # 0x23516
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x10c31
leaq 0x18(%rsp), %r14
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0xc9b4(%rip), %rdx      # 0x2351d
leaq 0x80(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x10c31
leaq 0xc98c(%rip), %rdx      # 0x2350e
leaq 0x18(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x7f8b
leaq 0x18(%rsp), %r14
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0x80(%rsp), %rdi
callq 0x5150
leaq 0xc95f(%rip), %rdx      # 0x23524
leaq 0x80(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x10c31
leaq 0xc930(%rip), %rdx      # 0x2350e
leaq 0x18(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x7f8b
leaq 0x18(%rsp), %r14
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0x80(%rsp), %rdi
callq 0x5150
leaq 0x38(%rsp), %rdi
callq 0x5150
movq 0x8(%rsp), %rdi
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0xa77f(%rip), %rsi      # 0x213bf
callq 0x56b0
leaq 0xcf12(%rip), %r14      # 0x23b5e
leaq 0x18(%rsp), %r12
leaq 0x60(%rsp), %r13
leaq 0x38(%rsp), %rbp
xorl %ebx, %ebx
movsbl (%r15), %eax
cmpl %eax, %ebx
jge 0x16ca5
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7faa
leal 0x41(%rbx), %eax
movsbl %al, %edx
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa2ef
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5700
movq %rbp, %rdi
callq 0x5150
movq %r12, %rdi
callq 0x5150
incl %ebx
jmp 0x16c5d
movq 0x8(%rsp), %rdi
leaq 0x9bfa(%rip), %rsi      # 0x208ab
callq 0x56b0
leaq 0x18(%rsp), %rbx
leaq 0x38(%rsp), %r13
xorl %r14d, %r14d
movsbl (%r15), %eax
cmpl %eax, %r14d
jge 0x16f16
cmpl $0x8, %r14d
ja 0x16ce3
movq 0x8(%rsp), %rdi
pushq $0x20
popq %rsi
callq 0x5290
leal 0x1(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd092
leaq 0x60(%rsp), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x17198
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl %ebp, 0x14(%rsp)
callq 0x5700
movq %r13, %rdi
callq 0x5150
movq %rbx, %rdi
callq 0x5150
movl (%r15), %eax
movl $0x0, %ecx
movq %r14, 0x58(%rsp)
testb %al, %al
movq %rax, 0xa0(%rsp)
cmovlel %ecx, %eax
movslq %r14d, %rcx
xorl %r12d, %r12d
movzbl %al, %ebp
movq %rcx, 0xb0(%rsp)
cmpl %r12d, %ebp
je 0x16e96
movb 0x6(%r15), %al
movb 0x7(%r15), %cl
movl %r12d, %edx
xorb 0x58(%rsp), %al
xorb %cl, %dl
orb %al, %dl
jne 0x16d81
leaq 0x60(%rsp), %rsi
leaq 0xdc22(%rip), %rdx      # 0x24999
movq %r13, %rdi
callq 0x10c31
jmp 0x16da0
leal -0x1(%r12), %edx
xorb %cl, %dl
orb %dl, %al
jne 0x16da4
leaq 0x60(%rsp), %rsi
leaq 0xc2eb(%rip), %rdx      # 0x23083
movq %r13, %rdi
callq 0x10c31
xorl %ebx, %ebx
jmp 0x16dbd
movb $0x1, %bl
leaq 0xcdb1(%rip), %rsi      # 0x23b5e
leaq 0x80(%rsp), %rdx
movq %r13, %rdi
callq 0x5110
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x5700
movq %r13, %rdi
callq 0x5150
movsbq (%r15), %rax
testb %bl, %bl
movq 0x10(%r15), %rcx
leaq 0xdd3e(%rip), %rdx      # 0x24b21
leaq 0x18(%rsp), %rbx
imulq 0xb0(%rsp), %rax
addq %r12, %rax
shlq $0x4, %rax
movb (%rcx,%rax), %al
cmpb (%rdx), %al
jne 0x16e44
movq 0xa8(%rsp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x171bc
leaq 0xb8(%rsp), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x17198
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x5700
movq %r13, %rdi
callq 0x5150
movq %rbx, %rdi
callq 0x5150
jmp 0x16e87
leaq 0xdcd7(%rip), %rcx      # 0x24b22
leaq 0xf8(%rsp), %rsi
cmpb (%rcx), %al
je 0x16e6a
leaq 0xdcc5(%rip), %rcx      # 0x24b23
leaq 0xd8(%rsp), %rsi
cmpb (%rcx), %al
jne 0x16e76
movq 0x8(%rsp), %rdi
callq 0x5700
jmp 0x16e87
movq 0x8(%rsp), %rdi
leaq 0xc6a9(%rip), %rsi      # 0x2352b
callq 0x56b0
incq %r12
addl $0x100, %r14d           # imm = 0x100
jmp 0x16d4d
movq 0xa0(%rsp), %rax
movb 0x6(%r15), %cl
xorb 0x58(%rsp), %cl
decl %eax
xorb 0x7(%r15), %al
orb %cl, %al
setne %bl
je 0x16ecd
leaq 0xcca4(%rip), %rsi      # 0x23b5e
leaq 0x13(%rsp), %rdx
movq %r13, %rdi
callq 0x5110
movl 0x14(%rsp), %ebp
jmp 0x16ee5
leaq 0x60(%rsp), %rsi
leaq 0xc1aa(%rip), %rdx      # 0x23083
movq %r13, %rdi
callq 0x10c31
movl 0x14(%rsp), %ebp
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x5700
movq %r13, %rdi
callq 0x5150
testb %bl, %bl
movq 0x8(%rsp), %rdi
pushq $0xa
popq %rsi
callq 0x5290
movl %ebp, %r14d
leaq 0x18(%rsp), %rbx
jmp 0x16cc3
movq 0x8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x5700
leaq 0xb8(%rsp), %rdi
callq 0x5150
leaq 0x60(%rsp), %rdi
callq 0x5150
leaq 0xd8(%rsp), %rdi
callq 0x5150
leaq 0xf8(%rsp), %rdi
callq 0x5150
movq 0x8(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x16f74
jmp 0x16f8a
leaq 0x80(%rsp), %rdi
movq %rax, %r14
callq 0x5150
jmp 0x16f8d
jmp 0x16f8a
jmp 0x16f8a
movq %rax, %r14
leaq 0x38(%rsp), %rdi
jmp 0x1701d
movq %rax, %r14
jmp 0x17022
movq %rax, %r14
jmp 0x1702f
movq %rax, %r14
jmp 0x17039
movq %rax, %r14
jmp 0x17046
jmp 0x16feb
jmp 0x16feb
jmp 0x16feb
jmp 0x16feb
jmp 0x16feb
leaq 0x38(%rsp), %rdi
movq %rax, %r14
callq 0x5150
testb %bl, %bl
jmp 0x17018
jmp 0x16ff0
jmp 0x16fe4
jmp 0x16feb
jmp 0x16ff0
jmp 0x16fe4
jmp 0x16feb
jmp 0x16feb
jmp 0x16feb
jmp 0x16feb
movq %rax, %r14
jmp 0x16ffd
jmp 0x16feb
movq %rax, %r14
jmp 0x17018
leaq 0x38(%rsp), %rdi
movq %rax, %r14
callq 0x5150
leaq 0x18(%rsp), %rdi
callq 0x5150
jmp 0x17018
leaq 0x38(%rsp), %rdi
movq %rax, %r14
callq 0x5150
testb %bl, %bl
movq 0x8(%rsp), %rdi
callq 0x5150
leaq 0xb8(%rsp), %rdi
callq 0x5150
leaq 0x60(%rsp), %rdi
callq 0x5150
leaq 0xd8(%rsp), %rdi
callq 0x5150
leaq 0xf8(%rsp), %rdi
callq 0x5150
movq %r14, %rdi
callq 0x5650
nop