// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]morat/gomoku/agentmctsthread.cpp
// Function: Morat::Gomoku::AgentMCTS::AgentThread::rollout(Morat::Gomoku::Board&, Morat::Move, int)
Outcome AgentMCTS::AgentThread::rollout(Board & board, Move move, int depth){
	Outcome won;

	random_policy.rollout_start(board);

	while((won = board.outcome()) < Outcome::DRAW){
		Side turn = board.to_play();

		move = rollout_choose_move(board, move);

		movelist.addrollout(move, turn);

		assert2(board.move(move, true, false), "\n" + board.to_s(true) + "\n" + move.to_s());
		depth++;
	}

	gamelen.add(depth);

	if(won > Outcome::DRAW)
		win_types[won.to_i() - 1][(int)board.win_type()].add(depth);

	//update the last good reply table
	if(agent->lastgoodreply)
		last_good_reply.rollout_end(board, movelist, won);

	movelist.finishrollout(won);
	return won;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
leaq 0x6(%rsp), %r15
leaq 0x5d48(%rdi), %r13
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movw %dx, (%r15)
movl 0xefc(%rdi), %eax
movl %eax, 0xf00(%rdi)
movsbq 0x9(%rbx), %r12
leaq 0x12dda(%rip), %rax     # 0x24b29
cmpb (%rax), %r12b
jge 0x11dad
movb 0x8(%rbx), %r12b
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x12018
movw %ax, 0x6(%rsp)
movq %rbx, %rdi
movslq 0x64a0(%r14), %rdx
movslq 0x649c(%r14), %rcx
addq %rdx, %rcx
leal 0x1(%rdx), %esi
leaq (%rcx,%rcx,2), %rcx
movl %esi, 0x64a0(%r14)
movq %r15, %rsi
movw %ax, (%r13,%rcx)
movb %r12b, 0x2(%r13,%rcx)
pushq $0x1
popq %rdx
xorl %ecx, %ecx
callq 0xe0ba
testb %al, %al
je 0x11e27
incl %ebp
jmp 0x11d43
leaq 0x64d8(%r14), %rdi
movl %ebp, %esi
callq 0x121da
leaq 0x12d67(%rip), %rax     # 0x24b29
cmpb (%rax), %r12b
jle 0x11ddd
movq %r12, %rax
shlq $0x5, %rax
movl %ebp, %esi
leaq 0x64d8(%rax,%r14), %rdi
callq 0x121da
movq 0x40(%r14), %rax
cmpl $0x0, 0xb8(%rax)
je 0x11e00
leaq 0x4c(%r14), %rdi
leaq 0xf08(%r14), %rdx
movq %rbx, %rsi
movl %r12d, %ecx
callq 0x12262
addq $0xf08, %r14            # imm = 0xF08
movl %r12d, %esi
movq %r14, %rdi
callq 0x1212e
movl %r12d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x271c2(%rip), %rdi     # 0x38ff0
leaq 0x108f0(%rip), %rsi     # 0x22725
callq 0x5320
leaq 0x10770(%rip), %rsi     # 0x225b1
movq %rax, %rdi
callq 0x5320
leaq 0x1090a(%rip), %rsi     # 0x2275a
movq %rax, %rdi
callq 0x5320
movl $0x168, %esi            # imm = 0x168
movq %rax, %rdi
callq 0x5610
leaq 0xf4e9(%rip), %rsi      # 0x21355
movq %rax, %rdi
callq 0x5320
movq %rax, %r14
leaq 0x88(%rsp), %r15
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x169fc
leaq 0xea17(%rip), %rsi      # 0x208ab
leaq 0x28(%rsp), %rdi
movq %r15, %rdx
callq 0xce5f
leaq 0xea03(%rip), %rdx      # 0x208ab
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x7f8b
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rsi
callq 0xce84
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0xcdf8
leaq 0x68(%rsp), %rsi
movq %r14, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5170
leaq 0x68(%rsp), %rdi
callq 0x5150
leaq 0x8(%rsp), %rdi
callq 0x5150
leaq 0x48(%rsp), %rdi
callq 0x5150
leaq 0x28(%rsp), %rdi
callq 0x5150
leaq 0x88(%rsp), %rdi
callq 0x5150
pushq $0x1
popq %rdi
callq 0x5430
leaq 0x68(%rsp), %rdi
movq %rax, %rbx
callq 0x5150
jmp 0x11f3e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5150
jmp 0x11f4d
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5150
jmp 0x11f5c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5150
jmp 0x11f6b
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x5150
movq %rbx, %rdi
callq 0x5650