// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]morat/havannah/board.cpp
// Function: Morat::Havannah::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 += string(size_r_ + 3, ' ');
	for(int i = 0; i < size_r_; i++)
		s += " " + coord + char('A' + i);
	s += "\n";

	for(int y = 0; y < size_; y++){
		s += string(abs(size_r_m1_ - y) + (y + 1 < 10) + 1, ' ');
		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 + "]" : " ");
		if(y < size_r_m1_)
			s += coord + char('A' + size_r_ + y);
		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 0x10725(%rip), %rsi     # 0x29227
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
movq %rcx, 0xa8(%rsp)
callq 0x5110
leaq 0xf207(%rip), %rsi      # 0x27d2d
leaq 0xd8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x5110
leaq 0xbdc0(%rip), %rsi      # 0x248ff
leaq 0x68(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x5110
leaq 0xbda7(%rip), %rsi      # 0x248ff
leaq 0xb8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x5110
testb %bpl, %bpl
je 0x18cae
leaq 0xf1b5(%rip), %rsi      # 0x27d2f
leaq 0x20(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x5110
leaq 0xf1a1(%rip), %rdx      # 0x27d31
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x11269
leaq 0x48(%rsp), %r14
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0xf172(%rip), %rdx      # 0x27d35
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x11269
leaq 0x48(%rsp), %r14
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0xf149(%rip), %rdx      # 0x27d3c
leaq 0x88(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x11269
leaq 0xf121(%rip), %rdx      # 0x27d2d
leaq 0x48(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x8061
leaq 0x48(%rsp), %r14
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0x88(%rsp), %rdi
callq 0x5150
leaq 0xf0f4(%rip), %rdx      # 0x27d43
leaq 0x88(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x11269
leaq 0xf0c5(%rip), %rdx      # 0x27d2d
leaq 0x48(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x8061
leaq 0x48(%rsp), %r14
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5150
leaq 0x88(%rsp), %rdi
callq 0x5150
leaq 0x20(%rsp), %rdi
callq 0x5150
movq 0x8(%rsp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
leaq 0x30(%rsp), %rax
movsbq 0x1(%r15), %rsi
movq %rax, -0x10(%rax)
addq $0x3, %rsi
leaq 0x20(%rsp), %rdi
pushq $0x20
popq %rdx
callq 0x53b0
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x5700
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x5150
leaq 0xf74f(%rip), %r12      # 0x28452
leaq 0x48(%rsp), %r13
leaq 0x68(%rsp), %rbp
xorl %ebx, %ebx
movsbl 0x1(%r15), %eax
cmpl %eax, %ebx
jge 0x18d58
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x8080
leal 0x41(%rbx), %eax
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0xa4e9
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x5700
movq %r14, %rdi
callq 0x5150
movq %r13, %rdi
callq 0x5150
incl %ebx
jmp 0x18d0f
movq 0x8(%rsp), %rdi
leaq 0xbb9a(%rip), %rsi      # 0x248fe
callq 0x56b0
leaq 0x20(%rsp), %rbp
leaq 0x48(%rsp), %r12
xorl %ecx, %ecx
movsbl (%r15), %eax
cmpl %eax, %ecx
jge 0x1903e
movsbl 0x2(%r15), %eax
movq %rcx, 0x18(%rsp)
subl %ecx, %eax
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
cmpl $0x9, %ecx
leaq 0x30(%rsp), %rax
adcl $0x1, %esi
movq %rax, 0x20(%rsp)
movq %rbp, %rdi
pushq $0x20
popq %rdx
callq 0x53b0
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5700
movq 0x18(%rsp), %rax
movq %rbp, %rdi
leal 0x1(%rax), %ebx
callq 0x5150
movq %r12, %rdi
movl %ebx, %esi
callq 0xd3b2
leaq 0x68(%rsp), %rsi
movq %rbp, %rdi
movq %r12, %rdx
callq 0x198b1
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movl %ebx, 0x44(%rsp)
callq 0x5700
movq %rbp, %rdi
callq 0x5150
movq %r12, %rdi
callq 0x5150
movq 0x18(%rsp), %rdx
movsbl 0x1(%r15), %eax
movsbl 0x2(%r15), %ecx
movsbl (%r15), %r13d
movl %edx, %r14d
subl %ecx, %r14d
leal (%rdx,%rax), %ecx
cmpl %eax, %edx
movslq %edx, %rax
cmovll %ecx, %r13d
movl $0x0, %ecx
movq %rax, 0xb0(%rsp)
cmovll %ecx, %r14d
movslq %r14d, %rbx
shll $0x8, %r14d
addl %edx, %r14d
cmpl %r13d, %ebx
jge 0x18f93
movb 0x8(%r15), %cl
movb 0x9(%r15), %al
movq 0x18(%rsp), %rdx
cmpb %dl, %cl
jne 0x18e7b
cmpb %al, %bl
jne 0x18e7b
leaq 0x68(%rsp), %rsi
leaq 0x10a0a(%rip), %rdx     # 0x2987b
movq %rbp, %rdi
callq 0x11269
jmp 0x18e9a
cmpb %dl, %cl
jne 0x18e9f
leal -0x1(%rbx), %ecx
cmpb %al, %cl
jne 0x18e9f
leaq 0x68(%rsp), %rsi
leaq 0xe521(%rip), %rdx      # 0x273b3
movq %rbp, %rdi
callq 0x11269
xorl %r12d, %r12d
jmp 0x18eb9
movb $0x1, %r12b
leaq 0xf5a9(%rip), %rsi      # 0x28452
leaq 0x88(%rsp), %rdx
movq %rbp, %rdi
callq 0x5110
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5700
movq %rbp, %rdi
callq 0x5150
movsbq (%r15), %rax
testb %r12b, %r12b
movq 0x10(%r15), %rcx
leaq 0x10b21(%rip), %rdx     # 0x29a01
leaq 0x48(%rsp), %r12
imulq 0xb0(%rsp), %rax
addq %rbx, %rax
shlq $0x4, %rax
movb (%rcx,%rax), %al
cmpb (%rdx), %al
jne 0x18f41
movq 0xa8(%rsp), %rsi
movq %r12, %rdi
movl %r14d, %edx
callq 0x198d6
leaq 0xb8(%rsp), %rsi
movq %rbp, %rdi
movq %r12, %rdx
callq 0x198b1
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5700
movq %rbp, %rdi
callq 0x5150
movq %r12, %rdi
callq 0x5150
jmp 0x18f84
leaq 0x10aba(%rip), %rcx     # 0x29a02
leaq 0xf8(%rsp), %rsi
cmpb (%rcx), %al
je 0x18f67
leaq 0x10aa8(%rip), %rcx     # 0x29a03
leaq 0xd8(%rsp), %rsi
cmpb (%rcx), %al
jne 0x18f73
movq 0x8(%rsp), %rdi
callq 0x5700
jmp 0x18f84
movq 0x8(%rsp), %rdi
leaq 0xedcb(%rip), %rsi      # 0x27d4a
callq 0x56b0
addl $0x100, %r14d           # imm = 0x100
incq %rbx
jmp 0x18e47
movb 0x8(%r15), %al
decb %r13b
xorb 0x9(%r15), %r13b
xorb 0x18(%rsp), %al
orb %al, %r13b
setne %bl
je 0x18fc0
leaq 0xf4a1(%rip), %rsi      # 0x28452
leaq 0x17(%rsp), %rdx
movq %rbp, %rdi
callq 0x5110
jmp 0x18fd4
leaq 0x68(%rsp), %rsi
leaq 0xe3e7(%rip), %rdx      # 0x273b3
movq %rbp, %rdi
callq 0x11269
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5700
movq %rbp, %rdi
callq 0x5150
testb %bl, %bl
movsbl 0x2(%r15), %eax
movq 0x18(%rsp), %rcx
movl 0x44(%rsp), %ebx
cmpl %eax, %ecx
jge 0x1902a
movb 0x1(%r15), %al
addb %cl, %al
addb $0x41, %al
movsbl %al, %edx
leaq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x19900
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5700
movq %rbp, %rdi
callq 0x5150
movq 0x8(%rsp), %rdi
pushq $0xa
popq %rsi
callq 0x5290
movl %ebx, %ecx
jmp 0x18d75
movq 0x8(%rsp), %rbx
leaq 0xb8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5700
leaq 0xb8(%rsp), %rdi
callq 0x5150
leaq 0x68(%rsp), %rdi
callq 0x5150
leaq 0xd8(%rsp), %rdi
callq 0x5150
leaq 0xf8(%rsp), %rdi
callq 0x5150
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1909d
jmp 0x190b3
leaq 0x88(%rsp), %rdi
movq %rax, %r14
callq 0x5150
jmp 0x190b6
jmp 0x190b3
jmp 0x190b3
movq %rax, %r14
leaq 0x20(%rsp), %rdi
jmp 0x19159
movq %rax, %r14
jmp 0x1915e
jmp 0x19103
jmp 0x1913f
movq %rax, %r14
jmp 0x1916b
movq %rax, %r14
jmp 0x19175
movq %rax, %r14
jmp 0x19182
jmp 0x1913f
jmp 0x1913f
jmp 0x1913f
jmp 0x19103
jmp 0x1913f
jmp 0x1913f
leaq 0x20(%rsp), %rdi
movq %rax, %r14
callq 0x5150
testb %bl, %bl
jmp 0x19154
jmp 0x1913f
leaq 0x20(%rsp), %rdi
movq %rax, %r14
jmp 0x19136
jmp 0x1911f
jmp 0x1912e
jmp 0x1913f
jmp 0x1911f
jmp 0x1912e
jmp 0x1913f
jmp 0x1913f
jmp 0x1913f
jmp 0x1913f
leaq 0x20(%rsp), %rdi
movq %rax, %r14
callq 0x5150
jmp 0x19131
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x5150
jmp 0x19154
jmp 0x1913f
movq %rax, %r14
jmp 0x19154
leaq 0x20(%rsp), %rdi
movq %rax, %r14
callq 0x5150
testb %r12b, %r12b
movq 0x8(%rsp), %rdi
callq 0x5150
leaq 0xb8(%rsp), %rdi
callq 0x5150
leaq 0x68(%rsp), %rdi
callq 0x5150
leaq 0xd8(%rsp), %rdi
callq 0x5150
leaq 0xf8(%rsp), %rdi
callq 0x5150
movq %r14, %rdi
callq 0x5650
nop