// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]morat/hex/gtpagent.cpp
// Function: Morat::Hex::GTP::gtp_genmove(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 GTP::gtp_genmove(vecstr args){
	if(hist->outcome() >= 0)
		return GTPResponse(true, "resign");

	double use_time = (args.size() >= 2 ? from_str<double>(args[1]) : 0);
	if (use_time == 0)
		use_time = time_control.get_time(hist.len(), hist->moves_remain(), agent->gamelen());

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

	Time start;
	agent->search(use_time, time_control.max_sims, verbose);
	time_control.use(Time() - start);


	Move best = agent->return_move(verbose);

	move(best);

	if(verbose >= 2)
		logerr(hist->to_s(colorboard) + "\n");

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movb 0x89(%rsi), %al
movq %rdi, %rbx
testb %al, %al
js 0x18cd1
leaq 0xa949(%rip), %rsi      # 0x235e8
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5110
pushq $0x1
popq %rsi
leaq 0xe8(%rsp), %rdx
movq %rbx, %rdi
callq 0x8d00
leaq 0xe8(%rsp), %rdi
jmp 0x18f9c
movq (%rdx), %rdi
movq 0x8(%rdx), %rcx
movq %rsi, %r14
subq %rdi, %rcx
cmpq $0x21, %rcx
jb 0x18d00
addq $0x20, %rdi
callq 0x1c89a
vxorpd %xmm1, %xmm1, %xmm1
vucomisd %xmm1, %xmm0
jne 0x18d4d
jp 0x18d4d
movb 0x89(%r14), %al
movq 0x70(%r14), %r12
movq 0xd8(%r14), %rdi
leaq 0xe19f(%rip), %rcx      # 0x26eb1
movswl 0x82(%r14), %edx
movswl 0x84(%r14), %esi
xorl %ebp, %ebp
leaq 0x30(%r14), %r15
subq 0x68(%r14), %r12
subl %esi, %edx
shrq %r12
cmpb (%rcx), %al
movq (%rdi), %rax
cmovll %edx, %ebp
callq *0x50(%rax)
vcvttsd2si %xmm0, %ecx
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1c8fa
cmpl $0x0, 0xc8(%r14)
vmovsd %xmm0, (%rsp)
je 0x18ea0
vmovsd 0x60(%r14), %xmm0
leaq 0x128(%rsp), %r15
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x20e6c
leaq 0xc8f3(%rip), %rsi      # 0x25673
leaq 0xa8(%rsp), %rdi
movq %r15, %rdx
callq 0xcf8b
leaq 0xc8f2(%rip), %rdx      # 0x25689
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x8051
leaq 0x88(%rsp), %rdi
pushq $0x3
popq %rsi
vmovsd (%rsp), %xmm0
callq 0x20e6c
leaq 0x28(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0xcf24
leaq 0xc888(%rip), %rdx      # 0x2566a
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x8051
movq 0x58(%r14), %rsi
leaq 0x68(%rsp), %rdi
callq 0x1c96d
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0xcf24
leaq 0x9ac2(%rip), %rdx      # 0x228dc
leaq 0x168(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8051
leaq 0x168(%rsp), %r15
movq %r15, %rdi
callq 0xd451
movq %r15, %rdi
callq 0x5150
leaq 0x8(%rsp), %rdi
callq 0x5150
leaq 0x68(%rsp), %rdi
callq 0x5150
leaq 0x48(%rsp), %rdi
callq 0x5150
leaq 0x28(%rsp), %rdi
callq 0x5150
leaq 0x88(%rsp), %rdi
callq 0x5150
leaq 0xc8(%rsp), %rdi
callq 0x5150
leaq 0xa8(%rsp), %rdi
callq 0x5150
leaq 0x128(%rsp), %rdi
callq 0x5150
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x5ca0
movq 0xd8(%r14), %rdi
vmovsd (%rsp), %xmm0
movq 0x58(%r14), %rsi
movl 0xc8(%r14), %edx
leaq 0x30(%r14), %r12
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x5ca0
vmovsd (%r13), %xmm0
movq %r12, %rdi
vsubsd (%r15), %xmm0, %xmm0
callq 0x1c9c8
movq 0xd8(%r14), %rdi
movl 0xc8(%r14), %esi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
movw %ax, (%rsi)
callq 0x1c9fa
cmpl $0x2, 0xc8(%r14)
jl 0x18f71
movzbl 0xcd(%r14), %edx
subq $-0x80, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x17dc6
leaq 0x999d(%rip), %rdx      # 0x228dc
leaq 0x148(%rsp), %rdi
movq %r15, %rsi
callq 0x8051
leaq 0x148(%rsp), %r14
movq %r14, %rdi
callq 0xd451
movq %r14, %rdi
callq 0x5150
leaq 0x8(%rsp), %rdi
callq 0x5150
leaq 0x108(%rsp), %r14
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0xcfb0
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8d00
leaq 0x108(%rsp), %rdi
callq 0x5150
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
jmp 0x19051
leaq 0x8(%rsp), %rdi
movq %rax, %rbx
callq 0x5150
jmp 0x18fd2
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5150
jmp 0x18fe1
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5150
jmp 0x18ff0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5150
jmp 0x18fff
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x5150
leaq 0xc8(%rsp), %rdi
callq 0x5150
leaq 0xa8(%rsp), %rdi
callq 0x5150
leaq 0x128(%rsp), %rdi
jmp 0x19054
movq %rax, %rbx
jmp 0x1900c
movq %rax, %rbx
jmp 0x19019
movq %rax, %rbx
jmp 0x19026
leaq 0x108(%rsp), %rdi
jmp 0x19051
leaq 0xe8(%rsp), %rdi
movq %rax, %rbx
callq 0x5150
movq %rbx, %rdi
callq 0x5650
movq %rax, %rbx
jmp 0x19059