// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x38(%rsi), %r15
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x91ca
cmpb $-0x4, 0x1a(%r13)
jne 0xf8a8
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0xdab0
movb %al, 0x1a(%r13)
cmpb $0x0, 0x2a(%rsp)
js 0xf910
leaq 0x128(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1a1ec(%rip), %rsi     # 0x29aae
leaq 0x1a1eb(%rip), %rdx     # 0x29ab4
leaq 0x118(%rsp), %r14
movq %r14, %rdi
callq 0xa874
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x8d7a
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0xf8fb
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 0xf92d
addq $0x20, %rdi
callq 0x153df
jmp 0xf935
movq %r14, %rdi
callq 0xf6e6
vmovsd %xmm0, 0x8(%rsp)
cmpl $0x0, 0x50(%r14)
jne 0xfa29
leaq 0x10(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x4500
movq (%r12), %r13
movq 0x8(%r12), %rbp
movq 0x90(%r14), %rdi
movslq 0x7c(%r14), %rsi
movl 0x50(%r14), %edx
movq (%rdi), %rax
vmovsd 0x8(%rsp), %xmm0
callq *0x10(%rax)
leaq 0x10(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x4500
vmovdqa (%r12), %xmm0
vpbroadcastq 0x8(%r12), %xmm1
vpinsrq $0x1, %r13, %xmm0, %xmm0
vcvtqq2pd %xmm0, %xmm0
vpinsrq $0x1, %rbp, %xmm1, %xmm1
vcvtqq2pd %xmm1, %xmm1
vdivpd 0x19651(%rip){1to2}, %xmm1, %xmm1 # 0x29008
vaddpd %xmm0, %xmm1, %xmm0
vhsubpd %xmm0, %xmm0, %xmm0
movq %r14, %rdi
callq 0xf7b8
movq 0x90(%r14), %rdi
movl 0x50(%r14), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movw %ax, 0x38(%rsp)
cmpl $0x2, 0x50(%r14)
jge 0xfa88
leaq 0x138(%rsp), %r14
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x99d8
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x8d7a
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0xf8f6
jmp 0xf8fb
vmovsd 0x80(%r14), %xmm0
leaq 0x158(%rsp), %r12
movq %r12, %rdi
movl $0x1, %esi
callq 0x1579c
leaq 0x1abff(%rip), %rcx     # 0x2a64d
movl $0xd, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4330
leaq 0xe8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xfadd
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r12)
jmp 0xfaf0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x91ca
movzbl 0x54(%r14), %edx
leaq 0x58(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x15f84
leaq 0x1a02c(%rip), %rsi     # 0x29ae2
movq %r14, %rdi
callq 0x4610
leaq 0x178(%rsp), %rdi
leaq 0x58(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rax, %rsi
callq 0x477a
jmp 0xf9e8
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 0x1ab45(%rip), %rsi     # 0x2a65b
callq 0x4610
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xfb42
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r13)
jmp 0xfb52
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)
leaq 0xb8(%rsp), %rdi
vmovsd 0x8(%rsp), %xmm0
movl $0x3, %esi
callq 0x1579c
movq 0x78(%rsp), %rcx
movq 0x80(%rsp), %r8
movq 0xc0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r13, %rcx
je 0xfbb0
movq 0x88(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xfbd5
leaq 0xc8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0xfbd0
movq 0xc8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xfbe9
movq 0xb8(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0x40b0
jmp 0xfbfa
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4330
leaq 0x48(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
jne 0xfc19
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0xfc26
movq %rsi, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x1aa1a(%rip), %rsi     # 0x2a664
leaq 0x38(%rsp), %rdi
callq 0x4610
leaq 0x68(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xfc77
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rbp)
jmp 0xfc84
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 0xd56b
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %r8
movq 0xa0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %rbp, %rcx
je 0xfcd2
movq 0x68(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xfcf7
leaq 0xa8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0xfcf2
movq 0xa8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xfd0b
movq 0x98(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x40b0
jmp 0xfd1c
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4330
leaq 0x20(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
jne 0xfd3b
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0xfd48
movq %rsi, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x18(%rsp)
movq %rcx, (%rax)
movq %r12, %r13
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x19d73(%rip), %rsi     # 0x29ae2
leaq 0x10(%rsp), %rdi
callq 0x4610
leaq 0x108(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xfda1
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r12)
jmp 0xfdb4
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 0x2720a(%rip), %rax     # 0x36fe0
movq (%rax), %rsi
movq 0xf8(%rsp), %rdi
callq 0x4320
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0xfdf8
callq 0x42b0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe0b
callq 0x42b0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe21
callq 0x42b0
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfe30
callq 0x42b0
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x88(%rsp), %r12
je 0xfe4b
callq 0x42b0
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe61
callq 0x42b0
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0xfe70
callq 0x42b0
movq 0xd8(%rsp), %rdi
cmpq %r13, %rdi
je 0xfe82
callq 0x42b0
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf946
callq 0x42b0
jmp 0xf946
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfebf
callq 0x42b0
jmp 0xfebf
movq %r12, %r13
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfedd
callq 0x42b0
jmp 0xfedd
movq %r12, %r13
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfef4
callq 0x42b0
jmp 0xfef4
movq %r12, %r13
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xff0f
callq 0x42b0
jmp 0xff0f
movq %r12, %r13
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xff2d
callq 0x42b0
jmp 0xff2d
movq %r12, %r13
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xff4c
callq 0x42b0
jmp 0xff4c
movq %r12, %r13
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r13, %rdi
je 0xff6d
callq 0x42b0
jmp 0xff6d
movq %rax, %rbx
leaq 0x68(%rsp), %rax
jmp 0xff75
movq %rax, %rbx
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xff83
callq 0x42b0
movq %rbx, %rdi
callq 0x45b0
movq %rax, %rbx
leaq 0x148(%rsp), %rax
jmp 0xff75
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
jne 0xff7e
jmp 0xff83