// File: /workspace/github_cpp_makefile_star2_O1/YSRKEN[P]Shioi/I401/main.cpp
// Function: Board::Board(char const*, char const*)
Board(const char board_text[], const char turn_text[]) 
		: turn_(turn_text[0] | toStone("Can't read turn data."))
	{
		// Read board-text
		if (strlen(board_text) < kBoardSize * kBoardSize) {
			throw std::invalid_argument("Too short board-text size!");
		}
		for (size_t p : rep(kBoardSize * kBoardSize)) {
			board_[p] = board_text[p] | toStone("Can't read board data.");
		}
		// Initialize IterateTable
		constexpr size_t kTengen = kBoardSize / 2;
		for (size_t y : rep(kBoardSize)) {
			for (size_t x : rep(kBoardSize)) {
				const auto p = ToPosition(x, y);
				kTenGenDist[p] = kTengen - std::max(safe_dist(x, kTengen), safe_dist(y, kTengen));
				// Row(─)
				kIterateTable[p][Direction::Row][Side::Right] = std::min(kBoardSize - x - 1, kSearchWidth);
				kIterateTable[p][Direction::Row][Side::Left ] = std::min(x, kSearchWidth);
				// Column(│)
				kIterateTable[p][Direction::Column][Side::Right] = std::min(kBoardSize - y - 1, kSearchWidth);
				kIterateTable[p][Direction::Column][Side::Left ] = std::min(y, kSearchWidth);
				// Diagonally right(／)
				kIterateTable[p][Direction::DiagR][Side::Right] = min(x, kBoardSize - y - 1, kSearchWidth);
				kIterateTable[p][Direction::DiagR][Side::Left] = min(kBoardSize - x - 1, y, kSearchWidth);
				// Diagonally left(＼)
				kIterateTable[p][Direction::DiagL][Side::Right] = min(kBoardSize - x - 1, kBoardSize - y - 1, kSearchWidth);
				kIterateTable[p][Direction::DiagL][Side::Left] = min(x, y, kSearchWidth);
			}
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movsbl (%rdx), %edi
leaq 0x91b5(%rip), %rsi      # 0xc21e
callq 0x2b6a
movb %al, 0xe1(%rbx)
movq %r14, %rdi
callq 0x20e0
cmpq $0xe1, %rax
jb 0x31b2
xorl %r12d, %r12d
leaq 0x91bd(%rip), %r15      # 0xc24f
movsbl (%r14,%r12), %edi
movq %r15, %rsi
callq 0x2b6a
movb %al, (%rbx,%r12)
incq %r12
cmpq $0xe1, %r12
jne 0x3092
leaq 0x3928(%rbx), %rax
addq $0x120, %rbx            # imm = 0x120
xorl %ecx, %ecx
movl $0x5, %edx
leaq -0x7(%rcx), %rdi
negq %rdi
movq %rcx, %rsi
subq $0x7, %rsi
cmovbq %rdi, %rsi
movl $0xe, %edi
subq %rcx, %rdi
cmpq $0x5, %rdi
movl $0x5, %r8d
cmovbq %rdi, %r8
cmpq %rdx, %rcx
movl $0x5, %r9d
cmovbq %rcx, %r9
movl $0x7, %r10d
movq %rbx, %r11
xorl %r14d, %r14d
movq %r14, %r15
subq $0x7, %r15
movq %r15, %r12
cmovbq %r10, %r12
cmpq %rsi, %r12
cmovbeq %rsi, %r12
movl $0x7, %r13d
subq %r12, %r13
movq %r13, (%rax,%r14,8)
leaq 0x7(%r10), %r12
cmpq $0x5, %r12
cmovaeq %rdx, %r12
movq %r12, -0x30(%r11)
cmpq %rdx, %r14
cmovaeq %rdx, %r14
movq %r14, -0x38(%r11)
movq %r8, -0x20(%r11)
movq %r9, -0x28(%r11)
cmpq %rdi, %r14
movq %rdi, %r13
cmovbq %r14, %r13
movq %r13, -0x10(%r11)
cmpq %rcx, %r12
movq %rcx, %r13
cmovbq %r12, %r13
movq %r13, -0x18(%r11)
cmpq %rdi, %r12
cmovaeq %rdi, %r12
movq %r12, (%r11)
cmpq %rcx, %r14
cmovaeq %rcx, %r14
movq %r14, -0x8(%r11)
addq $0x40, %r11
decq %r10
leaq 0x8(%r15), %r14
cmpq $0xf, %r14
jne 0x3105
incq %rcx
addq $0x3c0, %rbx            # imm = 0x3C0
addq $0x78, %rax
cmpq $0xf, %rcx
jne 0x30c4
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x2100
movq %rax, %rbx
leaq 0x906e(%rip), %rsi      # 0xc234
movq %rax, %rdi
callq 0x2370
movq 0xcdfb(%rip), %rsi      # 0xffd0
movq 0xcddc(%rip), %rdx      # 0xffb8
movq %rbx, %rdi
callq 0x2310
movq %rax, %r14
movq %rbx, %rdi
callq 0x2170
movq %r14, %rdi
callq 0x2330
nop