// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
leaq 0x38(%rsi), %r15
leaq 0x10(%rsp), %r13
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
xorl %edx, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x920c
movb 0x1a(%r13), %al
cmpb $-0x4, %al
jne 0xf78c
leaq 0x10(%rsp), %rdi
callq 0xd9e4
testb %al, %al
js 0xf7f1
leaq 0x128(%rsp), %r15
leaq 0x118(%rsp), %r14
leaq 0x19307(%rip), %rsi     # 0x28aae
leaq 0x19306(%rip), %rdx     # 0x28ab4
movq %r14, %rdi
movq %r15, -0x10(%r15)
callq 0xa810
movl $0x1, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8dba
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0xf7dc
callq 0x42b0
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rdi
movq 0x8(%r12), %rax
subq %rdi, %rax
cmpq $0x21, %rax
jb 0xf80e
addq $0x20, %rdi
callq 0x152db
jmp 0xf816
movq %r14, %rdi
callq 0xf5f2
cmpl $0x0, 0x50(%r14)
vmovsd %xmm0, 0x8(%rsp)
jne 0xf936
leaq 0x10(%rsp), %r12
xorl %esi, %esi
movq %r12, %rdi
callq 0x4500
movq 0x90(%r14), %rdi
vmovsd 0x8(%rsp), %xmm0
movslq 0x7c(%r14), %rsi
movl 0x50(%r14), %edx
movq (%r12), %r13
movq 0x8(%r12), %rbp
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0x10(%rsp), %r12
xorl %esi, %esi
movq %r12, %rdi
callq 0x4500
vpbroadcastq 0x8(%r12), %xmm1
vmovdqa (%r12), %xmm0
vpinsrq $0x1, %rbp, %xmm1, %xmm1
vpinsrq $0x1, %r13, %xmm0, %xmm0
vcvtqq2pd %xmm1, %xmm1
vdivpd 0x18776(%rip){1to2}, %xmm1, %xmm1 # 0x28008
vcvtqq2pd %xmm0, %xmm0
kmovb 0x78(%r14), %k1
vaddpd %xmm0, %xmm1, %xmm0
vmovsd 0x70(%r14), %xmm1
vhsubpd %xmm0, %xmm0, %xmm0
vsubsd %xmm0, %xmm1, %xmm0
vxorpd %xmm1, %xmm1, %xmm1
vminsd %xmm1, %xmm0, %xmm2
vmovsd %xmm0, %xmm2, %xmm2 {%k1}
vaddsd 0x80(%r14), %xmm2, %xmm0
vmaxsd %xmm0, %xmm1, %xmm0
vmovsd %xmm0, 0x80(%r14)
movq 0x90(%r14), %rdi
movl 0x50(%r14), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movw %ax, 0x38(%rsp)
cmpl $0x2, 0x50(%r14)
jge 0xf995
leaq 0x138(%rsp), %r14
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
movq %r14, %rdi
callq 0x999a
movl $0x1, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8dba
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0xf7d7
jmp 0xf7dc
vmovsd 0x80(%r14), %xmm0
leaq 0x158(%rsp), %r12
movl $0x1, %esi
movq %r12, %rdi
callq 0x15694
leaq 0x19ce2(%rip), %rcx     # 0x2963d
movl $0xd, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4330
leaq 0xe8(%rsp), %r12
movq %rax, %rcx
addq $0x10, %rcx
movq %r12, -0x10(%r12)
movq (%rax), %rdx
cmpq %rcx, %rdx
jne 0xf9ea
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r12)
jmp 0xf9fd
leaq 0x10(%rsp), %r12
movq %r15, %rsi
xorl %edx, %edx
movq %r12, %rdi
callq 0x920c
movzbl 0x54(%r14), %edx
leaq 0x58(%rsp), %r14
movq %r12, %rsi
movq %r14, %rdi
callq 0x15e7a
leaq 0x1911f(%rip), %rsi     # 0x28ae2
movq %r14, %rdi
callq 0x4610
leaq 0x178(%rsp), %rdi
leaq 0x58(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rax, %rsi
callq 0x4778
jmp 0xf8f5
movq %rdx, 0xd8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe8(%rsp)
movq 0x8(%rax), %rdx
leaq 0xd8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x19c28(%rip), %rsi     # 0x2964b
callq 0x4610
leaq 0x88(%rsp), %r13
movq %rax, %rcx
addq $0x10, %rcx
movq %r13, -0x10(%r13)
movq (%rax), %rdx
cmpq %rcx, %rdx
jne 0xfa4f
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r13)
jmp 0xfa5f
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x80(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
vmovsd 0x8(%rsp), %xmm0
leaq 0xb8(%rsp), %rdi
movl $0x3, %esi
callq 0x15694
movq 0x80(%rsp), %r8
movq 0xc0(%rsp), %rdx
movq 0x78(%rsp), %rcx
movl $0xf, %edi
leaq (%rdx,%r8), %rax
cmpq %r13, %rcx
je 0xfabd
movq 0x88(%rsp), %rdi
movq 0xb8(%rsp), %rsi
cmpq %rdi, %rax
jbe 0xfae9
leaq 0xc8(%rsp), %r9
movl $0xf, %edi
cmpq %r9, %rsi
je 0xfae4
movq 0xc8(%rsp), %rdi
cmpq %rdi, %rax
jbe 0xfaf5
leaq 0x78(%rsp), %rdi
callq 0x40b0
jmp 0xfb06
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4330
leaq 0x48(%rsp), %rdx
leaq 0x10(%rax), %rcx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
cmpq %rcx, %rsi
jne 0xfb25
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0xfb32
movq %rsi, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
movq 0x8(%rax), %rsi
movq %rax, %rdx
addq $0x8, %rdx
movq %rsi, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x19afe(%rip), %rsi     # 0x29654
leaq 0x38(%rsp), %rdi
callq 0x4610
leaq 0x68(%rsp), %rbp
movq %rax, %rcx
addq $0x10, %rcx
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
cmpq %rcx, %rdx
jne 0xfb83
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rbp)
jmp 0xfb90
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x7c(%r14), %esi
leaq 0x98(%rsp), %rdi
callq 0xd4eb
movq 0x60(%rsp), %r8
movq 0xa0(%rsp), %rdx
movq 0x58(%rsp), %rcx
movl $0xf, %edi
leaq (%rdx,%r8), %rax
cmpq %rbp, %rcx
je 0xfbde
movq 0x68(%rsp), %rdi
movq 0x98(%rsp), %rsi
cmpq %rdi, %rax
jbe 0xfc0a
leaq 0xa8(%rsp), %r9
movl $0xf, %edi
cmpq %r9, %rsi
je 0xfc05
movq 0xa8(%rsp), %rdi
cmpq %rdi, %rax
jbe 0xfc16
leaq 0x58(%rsp), %rdi
callq 0x40b0
jmp 0xfc27
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4330
leaq 0x20(%rsp), %rdx
leaq 0x10(%rax), %rcx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
cmpq %rcx, %rsi
jne 0xfc46
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0xfc53
movq %rsi, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
movq 0x8(%rax), %rsi
movq %rax, %rdx
addq $0x8, %rdx
movq %r12, %r13
movq %rsi, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x18e68(%rip), %rsi     # 0x28ae2
leaq 0x10(%rsp), %rdi
callq 0x4610
leaq 0x108(%rsp), %r12
movq %rax, %rcx
addq $0x10, %rcx
movq %r12, -0x10(%r12)
movq (%rax), %rdx
cmpq %rcx, %rdx
jne 0xfcac
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r12)
jmp 0xfcbf
movq %rdx, 0xf8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x108(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x100(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x262ff(%rip), %rax     # 0x35fe0
movq 0xf8(%rsp), %rdi
movq (%rax), %rsi
callq 0x4320
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0xfd03
callq 0x42b0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfd16
callq 0x42b0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfd2c
callq 0x42b0
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfd3b
callq 0x42b0
leaq 0x48(%rsp), %rax
leaq 0x88(%rsp), %r12
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfd56
callq 0x42b0
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfd6c
callq 0x42b0
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0xfd7b
callq 0x42b0
movq 0xd8(%rsp), %rdi
cmpq %r13, %rdi
je 0xfd8d
callq 0x42b0
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf827
callq 0x42b0
jmp 0xf827
leaq 0x20(%rsp), %rcx
movq %rax, %rbx
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0xfdca
callq 0x42b0
jmp 0xfdca
movq %r12, %r13
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfde8
callq 0x42b0
jmp 0xfde8
movq %r12, %r13
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfdff
callq 0x42b0
jmp 0xfdff
movq %r12, %r13
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe1a
callq 0x42b0
jmp 0xfe1a
movq %r12, %r13
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe38
callq 0x42b0
jmp 0xfe38
movq %r12, %r13
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xfe57
callq 0x42b0
jmp 0xfe57
movq %r12, %r13
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r13, %rdi
je 0xfe78
callq 0x42b0
jmp 0xfe78
movq %rax, %rbx
leaq 0x68(%rsp), %rax
jmp 0xfe80
movq %rax, %rbx
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe8e
callq 0x42b0
movq %rbx, %rdi
callq 0x45b0
movq %rax, %rbx
leaq 0x148(%rsp), %rax
jmp 0xfe80
movq 0x118(%rsp), %rdi
movq %rax, %rbx
cmpq %r15, %rdi
jne 0xfe89
jmp 0xfe8e
nop