// File: tewalds[P]pentagod/gtpagent.cpp
// Function: PentagoGTP::gtp_solve(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
GTPResponse PentagoGTP::gtp_solve(vecstr args){
	if(game.getboard().won() >= 0)
		return GTPResponse(true, "resign");

	double use_time = (args.size() >= 2 ? from_str<double>(args[1]) : get_time());

	if(verbose)
		logerr("time remain: " + to_str(time_remain, 1) + ", time: " + to_str(use_time, 3) + ", sims: " + to_str(time.max_sims) + "\n");

	Time start;
	agent->search(use_time, time.max_sims, verbose);
	time_used(Time() - start);


	//TODO: find the outcome, not the best move...

	Move best = agent->return_move(verbose);

	if(verbose >= 2)
		logerr(game.getboard().to_s(colorboard) + "\n");

	return GTPResponse(true, best.to_s());
}

// Assembly:
subq $0x298, %rsp            # imm = 0x298
movq %rdx, 0x38(%rsp)
movq %rdi, 0x40(%rsp)
movq %rdi, %rax
movq %rax, 0x48(%rsp)
movq %rdi, 0x290(%rsp)
movq %rsi, 0x288(%rsp)
movq %rdx, 0x280(%rsp)
movq 0x288(%rsp), %rsi
movq %rsi, 0x50(%rsp)
addq $0x38, %rsi
leaq 0x258(%rsp), %rdi
xorl %edx, %edx
callq 0xcf40
leaq 0x258(%rsp), %rdi
callq 0x15fb0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x197c8
leaq 0x237(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x4670
movq 0x30(%rsp), %rdx
leaq 0x24344(%rip), %rsi     # 0x3da7c
leaq 0x238(%rsp), %rdi
callq 0x44d0
jmp 0x19747
movq 0x40(%rsp), %rdi
movl $0x1, %esi
leaq 0x238(%rsp), %rdx
callq 0xb680
jmp 0x19760
leaq 0x238(%rsp), %rdi
callq 0x4210
leaq 0x237(%rsp), %rdi
callq 0x43f0
jmp 0x19cb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x197b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
leaq 0x238(%rsp), %rdi
callq 0x4210
leaq 0x237(%rsp), %rdi
callq 0x43f0
jmp 0x19cc0
movq 0x38(%rsp), %rdi
callq 0xcbe0
cmpq $0x2, %rax
jb 0x197f7
movq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0xcc00
movq %rax, %rdi
callq 0x1e430
vmovsd %xmm0, 0x28(%rsp)
jmp 0x19807
movq 0x50(%rsp), %rdi
callq 0x19410
vmovsd %xmm0, 0x28(%rsp)
movq 0x50(%rsp), %rax
vmovsd 0x28(%rsp), %xmm0
vmovsd %xmm0, 0x218(%rsp)
cmpl $0x0, 0x50(%rax)
je 0x19b06
movq 0x50(%rsp), %rax
vmovsd 0x80(%rax), %xmm0
leaq 0x138(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movl $0x1, %esi
callq 0x1e870
movq 0x20(%rsp), %rdx
leaq 0x24da8(%rip), %rsi     # 0x3e5fd
leaq 0x158(%rsp), %rdi
callq 0xe5f0
jmp 0x19864
leaq 0x24da0(%rip), %rdx     # 0x3e60b
leaq 0x178(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x93b0
jmp 0x19882
vmovsd 0x218(%rsp), %xmm0
leaq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x1e870
jmp 0x1989f
leaq 0x198(%rsp), %rdi
leaq 0x178(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0xe470
jmp 0x198be
leaq 0x24d4f(%rip), %rdx     # 0x3e614
leaq 0x1b8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x93b0
jmp 0x198dc
movq 0x50(%rsp), %rax
movl 0x7c(%rax), %esi
leaq 0xf8(%rsp), %rdi
callq 0x16070
jmp 0x198f3
leaq 0x1d8(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0xe470
jmp 0x19912
leaq 0x24197(%rip), %rdx     # 0x3dab0
leaq 0x1f8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x93b0
jmp 0x19930
leaq 0x1f8(%rsp), %rdi
callq 0x15ad0
jmp 0x1993f
leaq 0x1f8(%rsp), %rdi
callq 0x4210
leaq 0x1d8(%rsp), %rdi
callq 0x4210
leaq 0xf8(%rsp), %rdi
callq 0x4210
leaq 0x1b8(%rsp), %rdi
callq 0x4210
leaq 0x198(%rsp), %rdi
callq 0x4210
leaq 0x118(%rsp), %rdi
callq 0x4210
leaq 0x178(%rsp), %rdi
callq 0x4210
leaq 0x158(%rsp), %rdi
callq 0x4210
leaq 0x138(%rsp), %rdi
callq 0x4210
jmp 0x19b06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19af4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19ae7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19ada
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19acd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19ac0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19ab3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19aa6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19a99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x4210
leaq 0x1d8(%rsp), %rdi
callq 0x4210
leaq 0xf8(%rsp), %rdi
callq 0x4210
leaq 0x1b8(%rsp), %rdi
callq 0x4210
leaq 0x198(%rsp), %rdi
callq 0x4210
leaq 0x118(%rsp), %rdi
callq 0x4210
leaq 0x178(%rsp), %rdi
callq 0x4210
leaq 0x158(%rsp), %rdi
callq 0x4210
leaq 0x138(%rsp), %rdi
callq 0x4210
jmp 0x19cc0
leaq 0xf0(%rsp), %rdi
callq 0x5500
movq 0x50(%rsp), %rax
movq 0x90(%rax), %rdi
vmovsd 0x218(%rsp), %xmm0
movslq 0x7c(%rax), %rsi
movl 0x50(%rax), %edx
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0xe8(%rsp), %rdi
callq 0x5500
leaq 0xe8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x116e0
movq 0x50(%rsp), %rdi
callq 0x19570
movq 0x50(%rsp), %rax
movq 0x90(%rax), %rdi
movl 0x50(%rax), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, %ecx
movq 0x50(%rsp), %rax
movw %cx, 0xe4(%rsp)
cmpl $0x2, 0x50(%rax)
jl 0x19c58
movq 0x50(%rsp), %rsi
addq $0x38, %rsi
leaq 0x78(%rsp), %rdi
movq %rdi, 0x10(%rsp)
xorl %edx, %edx
callq 0xcf40
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rsi
movzbl 0x54(%rax), %edx
andl $0x1, %edx
leaq 0xa0(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x1f740
movq 0x18(%rsp), %rsi
leaq 0x23ed8(%rip), %rdx     # 0x3dab0
leaq 0xc0(%rsp), %rdi
callq 0x93b0
jmp 0x19be7
leaq 0xc0(%rsp), %rdi
callq 0x15ad0
jmp 0x19bf6
leaq 0xc0(%rsp), %rdi
callq 0x4210
leaq 0xa0(%rsp), %rdi
callq 0x4210
jmp 0x19c58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
jmp 0x19c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x4210
leaq 0xa0(%rsp), %rdi
callq 0x4210
jmp 0x19cc0
leaq 0x58(%rsp), %rdi
movq %rdi, 0x8(%rsp)
leaq 0xe4(%rsp), %rsi
xorl %edx, %edx
callq 0xdec0
movq 0x40(%rsp), %rdi
movq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xb680
jmp 0x19c87
leaq 0x58(%rsp), %rdi
callq 0x4210
jmp 0x19cb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x228(%rsp)
movl %eax, 0x224(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x4210
jmp 0x19cc0
movq 0x48(%rsp), %rax
addq $0x298, %rsp            # imm = 0x298
retq
movq 0x228(%rsp), %rdi
callq 0x4660
nopl (%rax)