// File: /workspace/github_cpp_makefile_star2_O1/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 $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
cmpb $0x0, 0x89(%rsi)
js 0x20e0a
leaq 0x128(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x119d0(%rip), %rsi     # 0x3278c
leaq 0x119cf(%rip), %rdx     # 0x32792
leaq 0x118(%rsp), %r14
movq %r14, %rdi
callq 0xb0e0
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0xa7f0
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0x20df5
callq 0x52e0
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
movq (%rdx), %rdi
movq 0x8(%rdx), %rax
subq %rdi, %rax
vxorpd %xmm1, %xmm1, %xmm1
vxorpd %xmm0, %xmm0, %xmm0
cmpq $0x21, %rax
jb 0x20e32
addq $0x20, %rdi
callq 0x28e1e
vxorpd %xmm1, %xmm1, %xmm1
vucomisd %xmm1, %xmm0
jne 0x20e8e
jp 0x20e8e
leaq 0x30(%r14), %r15
movq 0x70(%r14), %r12
subq 0x68(%r14), %r12
shrq %r12
movb 0x89(%r14), %al
leaq 0x1555a(%rip), %rcx     # 0x363b1
movswl 0x82(%r14), %edx
movswl 0x84(%r14), %esi
subl %esi, %edx
xorl %ebp, %ebp
cmpb (%rcx), %al
cmovll %edx, %ebp
movq 0xd8(%r14), %rdi
movq (%rdi), %rax
callq *0x50(%rax)
vcvttsd2si %xmm0, %ecx
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x28ea8
vmovsd %xmm0, 0x28(%rsp)
movq %rbx, 0x90(%rsp)
cmpl $0x0, 0xc8(%r14)
jne 0x20fbf
leaq 0x68(%r14), %r15
movq %rsp, %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x55b0
movq (%r12), %rbp
movq 0x8(%r12), %rbx
movq 0xd8(%r14), %rdi
leaq 0x30(%r14), %r12
movq 0x58(%r14), %rsi
movl 0xc8(%r14), %edx
movq (%rdi), %rax
vmovsd 0x28(%rsp), %xmm0
callq *0x10(%rax)
movq %rsp, %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0x55b0
vmovdqa (%r13), %xmm0
vpbroadcastq 0x8(%r13), %xmm1
vpinsrq $0x1, %rbp, %xmm0, %xmm0
vcvtqq2pd %xmm0, %xmm0
vpinsrq $0x1, %rbx, %xmm1, %xmm1
vcvtqq2pd %xmm1, %xmm1
vdivpd 0x100e7(%rip){1to2}, %xmm1, %xmm1 # 0x31008
vaddpd %xmm0, %xmm1, %xmm0
vhsubpd %xmm0, %xmm0, %xmm0
movq %r12, %rdi
callq 0x28f98
movq 0xd8(%r14), %rdi
movl 0xc8(%r14), %esi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x30(%rsp), %r12
movw %ax, (%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x291d8
movq 0xd8(%r14), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x28(%rax)
cmpl $0x2, 0xc8(%r14)
movq 0x90(%rsp), %rbx
jge 0x21019
leaq 0x138(%rsp), %r14
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x10cdc
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0xa7f0
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x20df0
jmp 0x20df5
vmovsd 0x60(%r14), %xmm0
leaq 0x158(%rsp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2f81c
leaq 0x13b41(%rip), %rcx     # 0x34b22
movl $0x15, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x2105a
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r15)
jmp 0x2106d
movzbl 0xcd(%r14), %edx
subq $-0x80, %r14
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1f6ee
leaq 0x108cc(%rip), %rsi     # 0x31906
movq %r15, %rdi
callq 0x56e0
leaq 0x178(%rsp), %rdi
movq %rsp, %rdx
movq %rax, %rsi
callq 0x5b21
jmp 0x20f80
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 0x13aa5(%rip), %rsi     # 0x34b38
callq 0x56e0
leaq 0x80(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x210c0
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r12)
jmp 0x210d0
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
vmovsd 0x28(%rsp), %xmm0
movq 0x8(%rax), %rdx
movq %rdx, 0x78(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xb8(%rsp), %rdi
movl $0x3, %esi
callq 0x2f81c
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %r8
movq 0xc0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x21128
movq 0x80(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x2114d
leaq 0xc8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x21148
movq 0xc8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x21161
movq 0xb8(%rsp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x50c0
jmp 0x21172
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
leaq 0x60(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
jne 0x21191
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0x2119e
movq %rsi, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x13957(%rip), %rsi     # 0x34b19
leaq 0x50(%rsp), %rdi
callq 0x56e0
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x211f0
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%r13)
jmp 0x211fd
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x58(%r14), %rsi
leaq 0x98(%rsp), %rdi
callq 0x28f15
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %r8
movq 0xa0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r13, %rcx
je 0x2124b
movq 0x40(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x21270
leaq 0xa8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x2126b
movq 0xa8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x21284
movq 0x98(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x50c0
jmp 0x21295
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
leaq 0x10(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
jne 0x212b4
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0x212c0
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x10622(%rip), %rsi     # 0x31906
movq %rsp, %rdi
callq 0x56e0
leaq 0x108(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x21312
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rbp)
jmp 0x21325
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 0x28c89(%rip), %rax     # 0x49fd0
movq (%rax), %rsi
movq 0xf8(%rsp), %rdi
callq 0x5370
movq 0xf8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x21369
callq 0x52e0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2137c
callq 0x52e0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21392
callq 0x52e0
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x213a1
callq 0x52e0
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x213b4
callq 0x52e0
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x213ca
callq 0x52e0
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x213d9
callq 0x52e0
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x213eb
callq 0x52e0
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x20eaa
callq 0x52e0
jmp 0x20eaa
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21425
callq 0x52e0
jmp 0x21425
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21440
callq 0x52e0
jmp 0x21440
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x21454
callq 0x52e0
jmp 0x21454
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2146c
callq 0x52e0
jmp 0x2146c
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21487
callq 0x52e0
jmp 0x21487
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x2149b
callq 0x52e0
jmp 0x2149b
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x214bc
callq 0x52e0
jmp 0x214bc
movq %rax, %rbx
leaq 0x10(%rsp), %rax
jmp 0x214c4
movq %rax, %rbx
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x214d2
callq 0x52e0
movq %rbx, %rdi
callq 0x5670
movq %rax, %rbx
leaq 0x148(%rsp), %rax
jmp 0x214c4
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
jne 0x214cd
jmp 0x214d2
nop