// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r13
movsbl (%rdx), %edi
leaq 0x869f(%rip), %rsi      # 0xb21e
callq 0x2805
movb %al, 0xe1(%r13)
movq %r14, %rdi
callq 0x20d0
cmpq $0xe1, %rax
jb 0x2cf0
xorl %r12d, %r12d
leaq 0x86a6(%rip), %r15      # 0xb24f
cmpq $0xe1, %r12
je 0x2bc9
movsbl (%r14,%r12), %edi
movq %r15, %rsi
callq 0x2805
movb %al, (%r13,%r12)
incq %r12
jmp 0x2ba9
leaq 0x3928(%r13), %rax
addq $0x120, %r13            # imm = 0x120
xorl %ecx, %ecx
pushq $0x5
popq %r10
cmpq $0xf, %rcx
je 0x2ce1
leaq -0x7(%rcx), %rdx
negq %rdx
movq %rcx, %r8
subq $0x7, %r8
cmovbq %rdx, %r8
pushq $0xe
popq %r9
subq %rcx, %r9
cmpq $0x5, %r9
movq %r10, %rbx
cmovbq %r9, %rbx
cmpq %r10, %rcx
movq %r10, %r11
cmovbq %rcx, %r11
movq %r13, (%rsp)
movq %r13, %r14
pushq $0x7
popq %r15
xorl %r13d, %r13d
cmpq $0xf, %r13
je 0x2cca
movq %r13, %rdi
subq $0x7, %rdi
movq %rdi, %rdx
cmovbq %r15, %rdx
cmpq %r8, %rdx
cmovbeq %r8, %rdx
pushq $0x7
popq %rbp
subq %rdx, %rbp
movq %rbp, (%rax,%r13,8)
leaq 0x7(%r15), %rdx
cmpq %r10, %rdx
movq %r10, %rbp
cmovbq %rdx, %rbp
movq %rbp, -0x30(%r14)
cmpq %r10, %r13
movq %r10, %rsi
cmovbq %r13, %rsi
cmpq %r13, %r9
movq %r13, %r12
cmovbq %r9, %r12
movq %rsi, -0x38(%r14)
cmpq $0x6, %r12
cmovaeq %r10, %r12
movq %rbx, -0x20(%r14)
cmpq %rdx, %rcx
cmovbq %rcx, %rdx
movq %r11, -0x28(%r14)
cmpq $0x6, %rdx
cmovaeq %r10, %rdx
movq %r12, -0x10(%r14)
cmpq %r9, %rbp
cmovaeq %r9, %rbp
movq %rdx, -0x18(%r14)
cmpq %r13, %rcx
cmovbq %rcx, %r13
movq %rbp, (%r14)
cmpq $0x6, %r13
cmovaeq %r10, %r13
movq %r13, -0x8(%r14)
decq %r15
addq $0x40, %r14
leaq 0x8(%rdi), %r13
jmp 0x2c23
incq %rcx
movq (%rsp), %r13
addq $0x3c0, %r13            # imm = 0x3C0
addq $0x78, %rax
jmp 0x2bdd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x2110
movq %rax, %rbx
leaq 0x8532(%rip), %rsi      # 0xb234
movq %rax, %rdi
callq 0x2320
movq 0xd2bf(%rip), %rsi      # 0xffd0
movq 0xd2a0(%rip), %rdx      # 0xffb8
movq %rbx, %rdi
callq 0x22d0
movq %rax, %r14
movq %rbx, %rdi
callq 0x2160
movq %r14, %rdi
callq 0x22f0
nop