// File: YSRKEN[P]Shioi/I401/main.cpp
// Function: Board::IsGameEndImpl(Stone, Direction)
bool IsGameEndImpl(const Stone turn, Direction d) {
		const auto outer_loop_max = Board_helper::CalcOuterLoopMaxByDirection(d);
		for (size_t c : rep(outer_loop_max.second)) {
			for (size_t i : rep(outer_loop_max.first[c])) {
				size_t len = 0;
				const auto inner_loop_max = Board_helper::CalcInnerLoopMaxByDirection(d, i);
				assert(inner_loop_max.second == outer_loop_max.second);
				for (size_t j : rep(inner_loop_max.first[c])) {
					const auto ps = Board_helper::ToPositionByDirection(d, i, j);
					assert(ps.second == outer_loop_max.second);
					const size_t p = ps.first[c];
					if (board_[p] == turn) {
						++len;
						if (len == 5) return true;
					}
					else {
						len = 0;
					}
				}
			}
		}
		return false;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movb %dl, %al
movb %sil, %cl
movq %rdi, -0x10(%rbp)
movb %cl, -0x11(%rbp)
movb %al, -0x12(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x30(%rbp), %rdi
movzbl -0x12(%rbp), %esi
callq 0xda20
movq -0x20(%rbp), %rdi
callq 0x54a0
movq %rax, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
leaq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x54e0
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5510
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x5550
testb $0x1, %al
jne 0xd7bb
jmp 0xd9ff
leaq -0x50(%rbp), %rdi
callq 0x5580
movq (%rax), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xdaf0
movq (%rax), %rdi
callq 0x54a0
movq %rax, -0x78(%rbp)
movq %rdx, -0x70(%rbp)
leaq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x54e0
movq %rax, -0x80(%rbp)
movq -0x68(%rbp), %rdi
callq 0x5510
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5550
testb $0x1, %al
jne 0xd826
jmp 0xd9ef
leaq -0x80(%rbp), %rdi
callq 0x5580
movq (%rax), %rax
movq %rax, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movb -0x12(%rbp), %al
movq -0x90(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
movzbl %al, %esi
callq 0xdb20
movq -0xa0(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0xd86c
jmp 0xd88b
leaq 0x10a3c(%rip), %rdi     # 0x1e2af
leaq 0x10a64(%rip), %rsi     # 0x1e2de
movl $0x40, %edx
leaq 0x10a61(%rip), %rcx     # 0x1e2e7
callq 0x2170
leaq -0xb0(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xdaf0
movq (%rax), %rdi
callq 0x54a0
movq %rax, -0xc8(%rbp)
movq %rdx, -0xc0(%rbp)
leaq -0xc8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
callq 0x54e0
movq %rax, -0xd0(%rbp)
movq -0xb8(%rbp), %rdi
callq 0x5510
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x5550
testb $0x1, %al
jne 0xd901
jmp 0xd9df
leaq -0xd0(%rbp), %rdi
callq 0x5580
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movb -0x12(%rbp), %al
movq -0x90(%rbp), %rdx
movq -0xe0(%rbp), %rcx
leaq -0xf8(%rbp), %rdi
movzbl %al, %esi
callq 0xdc10
movq -0xe8(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0xd946
jmp 0xd965
leaq 0x109cc(%rip), %rdi     # 0x1e319
leaq 0x1098a(%rip), %rsi     # 0x1e2de
movl $0x43, %edx
leaq 0x10987(%rip), %rcx     # 0x1e2e7
callq 0x2170
leaq -0xf8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xdaf0
movq -0x108(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rsi
callq 0x5590
movzbl (%rax), %eax
movzbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jne 0xd9c1
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
cmpq $0x5, -0x98(%rbp)
jne 0xd9bf
movb $0x1, -0x1(%rbp)
jmp 0xda03
jmp 0xd9cc
movq $0x0, -0x98(%rbp)
jmp 0xd9ce
leaq -0xd0(%rbp), %rdi
callq 0x55c0
jmp 0xd8e5
jmp 0xd9e1
leaq -0x80(%rbp), %rdi
callq 0x55c0
jmp 0xd80d
jmp 0xd9f1
leaq -0x50(%rbp), %rdi
callq 0x55c0
jmp 0xd7a5
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)