// File: /workspace/github_cpp_makefile_star2_O2/YSRKEN[P]Shioi/I401/main.cpp
// Function: Board::NextMove(unsigned long, bool)
int NextMove(const size_t depth, bool debug_flg = false) {
		//PutBoard();
		// If the game is end, you don't move.
		if (IsGameEnd()) return -1;
		// Opening move
		if (debug_flg) std::cerr << "Opening" << endl;
		auto result = GetOpeningMove(turn_);
		if (result.second) return result.first;
		// Book move
		if (debug_flg) std::cerr << "Book" << endl;
		auto book_data = book.GetBookData(board_);
		if (book_data.size() != 0) return book_data[RandInt(book_data.size())];
		// If you can make Go-ren, you must do.
		if (debug_flg) std::cerr << "Goren" << endl;
		result = FindGorenMove(turn_);
		if (result.second) return result.first;
		// If enemy can make Go-ren, you must block it.
		if (debug_flg) std::cerr << "Stop Goren" << endl;
		result = FindGorenMove(EnemyTurn(turn_));
		if (result.second) {
			if(turn_ == Stone::White || IsValidMove(result.first)) return result.first;
		}
		// Search of quadruplex's problem(Shioi Tsume)
		if (debug_flg) std::cerr << "Shioi" << endl;
		result = FindShioiMove(turn_, kShioiDepth1);
		if (result.second) return result.first;
		// Search of attack's problem (Oi Tsume)
		if (debug_flg) std::cerr << "Oite" << endl;
		result = FindOiteMove(turn_, kOiteDepth1);
		if (result.second) return result.first;
		// Normal move search
		if (debug_flg) std::cerr << "Normal" << endl;
		result = FindNormalMove(depth, debug_flg);
		if (result.second) return result.first;
		if (result.first >= kBoardSize * kBoardSize) return -2;
		return -1;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4200
testb %al, %al
je 0x30d4
pushq $-0x1
popq %r15
jmp 0x3276
testb %bpl, %bpl
je 0x30f4
movq 0xcf08(%rip), %rdi      # 0xffe8
leaq 0x81b2(%rip), %rsi      # 0xb299
callq 0x21b0
movq %rax, %rdi
callq 0x2100
movzbl 0xe1(%r14), %esi
movq %r14, %rdi
callq 0x4220
testb $0x1, %dl
je 0x3111
movq %rax, %r15
jmp 0x3276
testb %bpl, %bpl
je 0x3131
movq 0xcecb(%rip), %rdi      # 0xffe8
leaq 0x817d(%rip), %rsi      # 0xb2a1
callq 0x21b0
movq %rax, %rdi
callq 0x2100
leaq 0xf7b0(%rip), %rsi      # 0x128e8
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x42c4
movq 0x8(%r15), %rdi
subq (%r15), %rdi
je 0x3165
sarq $0x3, %rdi
callq 0x4374
movq (%rsp), %rcx
movl (%rcx,%rax,8), %r15d
jmp 0x326e
testb %bpl, %bpl
je 0x3185
movq 0xce77(%rip), %rdi      # 0xffe8
leaq 0x8133(%rip), %rsi      # 0xb2ab
callq 0x21b0
movq %rax, %rdi
callq 0x2100
movzbl 0xe1(%r14), %esi
movq %r14, %rdi
callq 0x439c
testb $0x1, %dl
jne 0x326b
testb %bpl, %bpl
je 0x31be
movq 0xce3e(%rip), %rdi      # 0xffe8
leaq 0x80f5(%rip), %rsi      # 0xb2a6
callq 0x21b0
movq %rax, %rdi
callq 0x2100
xorl %esi, %esi
cmpb $0x1, 0xe1(%r14)
sete %sil
incl %esi
movq %r14, %rdi
callq 0x439c
testb $0x1, %dl
je 0x31fb
movq %rax, %r15
cmpb $0x2, 0xe1(%r14)
je 0x326e
movq %r14, %rdi
movq %r15, %rsi
callq 0x4884
testb %al, %al
jne 0x326e
testb %bpl, %bpl
je 0x321b
movq 0xcde1(%rip), %rdi      # 0xffe8
leaq 0x80a3(%rip), %rsi      # 0xb2b1
callq 0x21b0
movq %rax, %rdi
callq 0x2100
movzbl 0xe1(%r14), %esi
pushq $0x14
popq %rdx
movq %r14, %rdi
callq 0x4974
testb $0x1, %dl
jne 0x326b
testb %bpl, %bpl
je 0x3253
movq 0xcda9(%rip), %rdi      # 0xffe8
leaq 0x8071(%rip), %rsi      # 0xb2b7
callq 0x21b0
movq %rax, %rdi
callq 0x2100
movzbl 0xe1(%r14), %esi
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x4cfe
testb $0x1, %dl
je 0x3284
movq %rax, %r15
movq %rsp, %rdi
callq 0x412c
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testb %bpl, %bpl
je 0x32a4
movq 0xcd58(%rip), %rdi      # 0xffe8
leaq 0x8025(%rip), %rsi      # 0xb2bc
callq 0x21b0
movq %rax, %rdi
callq 0x2100
movzbl %bpl, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x50ae
movq %rax, %r15
testb $0x1, %dl
jne 0x326e
xorl %eax, %eax
cmpq $0xe1, %r15
adcl $-0x2, %eax
movl %eax, %r15d
jmp 0x326e
jmp 0x32d6
jmp 0x32d6
jmp 0x32d6
jmp 0x32d6
jmp 0x32d6
movq %rax, %rbx
movq %rsp, %rdi
callq 0x412c
movq %rbx, %rdi
callq 0x22f0