// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
leaq 0x38(%rsi), %r15
leaq 0x28(%rsp), %r13
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
xorl %edx, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x7a62
movq %r13, %rdi
callq 0xae70
testb %al, %al
js 0xc49a
leaq 0x1061c(%rip), %rsi     # 0x1ca84
leaq 0xf0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x40f0
pushq $0x1
popq %rsi
leaq 0xf0(%rsp), %rdx
movq %rbx, %rdi
callq 0x761c
leaq 0xf0(%rsp), %rdi
jmp 0xc704
movq (%r12), %rdi
movq 0x8(%r12), %rax
subq %rdi, %rax
cmpq $0x21, %rax
jb 0xc4b7
addq $0x20, %rdi
callq 0xf0be
jmp 0xc4bf
movq %r14, %rdi
callq 0xc2e4
cmpl $0x0, 0x50(%r14)
vmovsd %xmm0, (%rsp)
je 0xc612
vmovsd 0x80(%r14), %xmm0
leaq 0x130(%rsp), %r12
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0xf350
leaq 0x1111b(%rip), %rsi     # 0x1d60d
leaq 0xd0(%rsp), %rdi
movq %r12, %rdx
callq 0x8423
leaq 0x11112(%rip), %rdx     # 0x1d61b
leaq 0x50(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x6821
leaq 0xb0(%rsp), %rdi
pushq $0x3
popq %rsi
vmovsd (%rsp), %xmm0
callq 0xf350
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x8365
leaq 0x110d6(%rip), %rdx     # 0x1d624
leaq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x6821
movl 0x7c(%r14), %esi
leaq 0x90(%rsp), %rdi
callq 0xaee1
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x8365
leaq 0x1052c(%rip), %rdx     # 0x1cab8
leaq 0x170(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x6821
leaq 0x170(%rsp), %r12
movq %r12, %rdi
callq 0xac65
movq %r12, %rdi
callq 0x4130
leaq 0x28(%rsp), %rdi
callq 0x4130
leaq 0x90(%rsp), %rdi
callq 0x4130
leaq 0x8(%rsp), %rdi
callq 0x4130
leaq 0x70(%rsp), %rdi
callq 0x4130
leaq 0xb0(%rsp), %rdi
callq 0x4130
leaq 0x50(%rsp), %rdi
callq 0x4130
leaq 0xd0(%rsp), %rdi
callq 0x4130
leaq 0x130(%rsp), %rdi
callq 0x4130
leaq 0x70(%rsp), %r12
movq %r12, %rdi
callq 0x4c50
movq 0x90(%r14), %rdi
vmovsd (%rsp), %xmm0
movslq 0x7c(%r14), %rsi
movl 0x50(%r14), %edx
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x4c50
vmovsd (%r13), %xmm0
movq %r14, %rdi
vsubsd (%r12), %xmm0, %xmm0
callq 0xc394
movq 0x90(%r14), %rdi
movl 0x50(%r14), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movw %ax, 0x50(%rsp)
cmpl $0x2, 0x50(%r14)
jl 0xc6d7
leaq 0x28(%rsp), %r12
movq %r15, %rsi
xorl %edx, %edx
movq %r12, %rdi
callq 0x7a62
movzbl 0x54(%r14), %edx
leaq 0x8(%rsp), %r14
movq %r12, %rsi
movq %r14, %rdi
callq 0xf8fc
leaq 0x10413(%rip), %rdx     # 0x1cab8
leaq 0x150(%rsp), %rdi
movq %r14, %rsi
callq 0x6821
leaq 0x150(%rsp), %r14
movq %r14, %rdi
callq 0xac65
movq %r14, %rdi
callq 0x4130
leaq 0x8(%rsp), %rdi
callq 0x4130
leaq 0x110(%rsp), %r14
leaq 0x50(%rsp), %rsi
xorl %edx, %edx
movq %r14, %rdi
callq 0x8178
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x761c
leaq 0x110(%rsp), %rdi
callq 0x4130
movq %rbx, %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x8(%rsp), %rdi
jmp 0xc7b8
leaq 0x28(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
jmp 0xc739
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x4130
jmp 0xc74b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4130
jmp 0xc75a
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4130
jmp 0xc769
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x4130
leaq 0x50(%rsp), %rdi
callq 0x4130
leaq 0xd0(%rsp), %rdi
callq 0x4130
leaq 0x130(%rsp), %rdi
jmp 0xc7bb
movq %rax, %rbx
jmp 0xc776
movq %rax, %rbx
jmp 0xc780
movq %rax, %rbx
jmp 0xc78d
leaq 0x110(%rsp), %rdi
jmp 0xc7b8
leaq 0xf0(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
movq %rbx, %rdi
callq 0x4590
movq %rax, %rbx
jmp 0xc7c0
nop