// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/gtpagent.cpp
// Function: PentagoGTP::gtp_pns_params(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_pns_params(vecstr args){
	AgentPNS * pns =  dynamic_cast<AgentPNS *>(agent);

	if(args.size() == 0)
		return GTPResponse(true, string("\n") +
			"Update the pns solver settings, eg: pns_params -m 100 -s 0 -d 1 -e 0.25 -a 2 -l 0\n"
			"  -m --memory   Memory limit in Mb                                       [" + to_str(pns->memlimit/(1024*1024)) + "]\n"
			"  -t --threads  How many threads to run                                  [" + to_str(pns->numthreads) + "]\n"
			"  -s --ties     Which side to assign ties to, 0 = handle, 1 = p1, 2 = p2 [" + to_str(pns->ties) + "]\n"
			"  -d --df       Use depth-first thresholds                               [" + to_str(pns->df) + "]\n"
			"  -e --epsilon  How big should the threshold be                          [" + to_str(pns->epsilon) + "]\n"
//			"  -a --abdepth  Run an alpha-beta search of this size at each leaf       [" + to_str(pns->ab) + "]\n"
			);

	string errs;
	for(unsigned int i = 0; i < args.size(); i++) {
		string arg = args[i];

		if((arg == "-t" || arg == "--threads") && i+1 < args.size()){
			pns->numthreads = from_str<int>(args[++i]);
			pns->reset_threads();
		}else if((arg == "-m" || arg == "--memory") && i+1 < args.size()){
			uint64_t mem = from_str<uint64_t>(args[++i]);
			if(mem < 1) return GTPResponse(false, "Memory can't be less than 1mb");
			pns->set_memlimit(mem*1024*1024);
		}else if((arg == "-s" || arg == "--ties") && i+1 < args.size()){
			pns->ties = from_str<int>(args[++i]);
			pns->clear_mem();
		}else if((arg == "-d" || arg == "--df") && i+1 < args.size()){
			pns->df = from_str<bool>(args[++i]);
		}else if((arg == "-e" || arg == "--epsilon") && i+1 < args.size()){
			pns->epsilon = from_str<float>(args[++i]);
//		}else if((arg == "-a" || arg == "--abdepth") && i+1 < args.size()){
//			pns->ab = from_str<int>(args[++i]);
		}else{
			return GTPResponse(false, "Missing or unknown parameter");
		}
	}

	return GTPResponse(true, errs);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, 0x10(%rsp)
movq 0x90(%rsi), %rdi
movq %rdx, %r15
testq %rdi, %rdi
je 0xe8cb
leaq 0x1c368(%rip), %rdx     # 0x2ac20
leaq 0x1c1a9(%rip), %rsi     # 0x2aa68
xorl %ecx, %ecx
callq 0x4340
movq %rax, %r14
jmp 0xe8ce
xorl %r14d, %r14d
movq 0x8(%r15), %rax
cmpq (%r15), %rax
je 0xeb8b
leaq 0x28(%rsp), %rax
leaq 0x58(%rsp), %r12
leaq 0x258(%rsp), %r13
xorl %ebp, %ebp
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rcx
movl %ebp, %eax
subq %rsi, %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
jbe 0xee19
shlq $0x5, %rax
addq %rax, %rsi
movq %r12, %rdi
callq 0x43f0
leaq 0xf267(%rip), %rsi      # 0x1db91
movq %r12, %rdi
callq 0x6462
testb %al, %al
jne 0xe949
leaq 0xf257(%rip), %rsi      # 0x1db94
movq %r12, %rdi
callq 0x6462
testb %al, %al
je 0xe985
movq (%r15), %rdi
movq 0x8(%r15), %rax
leal 0x1(%rbp), %ebx
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0xe985
movq %rbx, %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0xac0f
movb $0x1, %r13b
movl %eax, 0xadc(%r14)
movq %r14, %rdi
callq 0x18700
jmp 0xeb69
leaq 0xec2c(%rip), %rsi      # 0x1d5b8
movq %r12, %rdi
callq 0x6462
testb %al, %al
jne 0xe9ab
leaq 0xf483(%rip), %rsi      # 0x1de22
movq %r12, %rdi
callq 0x6462
testb %al, %al
je 0xe9f1
movq (%r15), %rdi
movq 0x8(%r15), %rax
leal 0x1(%rbp), %ebx
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0xe9f1
movq %rbx, %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0xf23e
testq %rax, %rax
je 0xeb33
movq (%r14), %rcx
shlq $0x14, %rax
movb $0x1, %r13b
movq %r14, %rdi
movq %rax, %rsi
callq *0x30(%rcx)
jmp 0xeb69
leaq 0xebb5(%rip), %rsi      # 0x1d5ad
movq %r12, %rdi
callq 0x6462
testb %al, %al
jne 0xea17
leaq 0xf43e(%rip), %rsi      # 0x1de49
movq %r12, %rdi
callq 0x6462
testb %al, %al
je 0xea54
movq (%r15), %rdi
movq 0x8(%r15), %rax
leal 0x1(%rbp), %ebx
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0xea54
movq %rbx, %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0xac0f
movl %eax, 0xad8(%r14)
movb $0x1, %r13b
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
jmp 0xeb69
leaq 0xf3f5(%rip), %rsi      # 0x1de50
movq %r12, %rdi
callq 0x6462
testb %al, %al
jne 0xea7a
leaq 0xf3e5(%rip), %rsi      # 0x1de53
movq %r12, %rdi
callq 0x6462
testb %al, %al
je 0xeaa8
movq (%r15), %rdi
movq 0x8(%r15), %rax
leal 0x1(%rbp), %ebx
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0xeaa8
movq %rbx, %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0xf180
movb %al, 0xad0(%r14)
jmp 0xeafc
leaq 0xeaf4(%rip), %rsi      # 0x1d5a3
movq %r12, %rdi
callq 0x6462
testb %al, %al
jne 0xeace
leaq 0xf396(%rip), %rsi      # 0x1de58
movq %r12, %rdi
callq 0x6462
testb %al, %al
je 0xeb01
movq (%r15), %rdi
movq 0x8(%r15), %rax
leal 0x1(%rbp), %ebx
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0xeb01
movq %rbx, %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0xf11e
vmovss %xmm0, 0xad4(%r14)
movb $0x1, %r13b
jmp 0xeb69
leaq 0xeae8(%rip), %rsi      # 0x1d5f0
leaq 0x38(%rsp), %rdx
movq %r13, %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x761c
movq %r13, %rdi
callq 0x4130
xorl %r13d, %r13d
movl %ebp, %ebx
jmp 0xeb69
leaq 0x278(%rsp), %r13
leaq 0xf2e9(%rip), %rsi      # 0x1de2b
leaq 0x38(%rsp), %rdx
movq %r13, %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x761c
movq %r13, %rdi
callq 0x4130
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x4130
incl %ebx
movl %ebx, %ebp
testb %r13b, %r13b
leaq 0x258(%rsp), %r13
jne 0xe8fb
jmp 0xee44
leaq 0xdf26(%rip), %rsi      # 0x1cab8
leaq 0x138(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x40f0
leaq 0xf0a6(%rip), %rdx      # 0x1dc51
leaq 0x158(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x6821
movq 0x40(%r14), %rsi
shrq $0x14, %rsi
leaq 0x118(%rsp), %rdi
callq 0xaf8f
leaq 0x178(%rsp), %rdi
leaq 0x158(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x8365
leaq 0xf0f5(%rip), %rdx      # 0x1dcee
leaq 0x198(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x6821
movl 0xadc(%r14), %esi
leaq 0xf8(%rsp), %rdi
callq 0xaee1
leaq 0x1b8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x8365
leaq 0xf0f5(%rip), %rdx      # 0x1dd3b
leaq 0x1d8(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x6821
movl 0xad8(%r14), %esi
leaq 0xd8(%rsp), %rdi
callq 0xaee1
leaq 0x1f8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x8365
leaq 0xf0f5(%rip), %rdx      # 0x1dd88
leaq 0x218(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x6821
movzbl 0xad0(%r14), %esi
leaq 0xb8(%rsp), %rdi
callq 0xaf38
leaq 0x38(%rsp), %rdi
leaq 0x218(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x8365
leaq 0xf0f7(%rip), %rdx      # 0x1ddd5
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x6821
vmovss 0xad4(%r14), %xmm0
leaq 0x98(%rsp), %rdi
callq 0xf296
leaq 0x18(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x8365
leaq 0xe64a(%rip), %rdx      # 0x1d36b
leaq 0x238(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x6821
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rdi
leaq 0x238(%rsp), %rdx
callq 0x761c
leaq 0x238(%rsp), %rdi
callq 0x4130
leaq 0x18(%rsp), %rdi
callq 0x4130
leaq 0x98(%rsp), %rdi
callq 0x4130
leaq 0x58(%rsp), %rdi
callq 0x4130
leaq 0x38(%rsp), %rdi
callq 0x4130
leaq 0xb8(%rsp), %rdi
callq 0x4130
leaq 0x218(%rsp), %rdi
callq 0x4130
leaq 0x1f8(%rsp), %rdi
callq 0x4130
leaq 0xd8(%rsp), %rdi
callq 0x4130
leaq 0x1d8(%rsp), %rdi
callq 0x4130
leaq 0x1b8(%rsp), %rdi
callq 0x4130
leaq 0xf8(%rsp), %rdi
callq 0x4130
leaq 0x198(%rsp), %rdi
callq 0x4130
leaq 0x178(%rsp), %rdi
callq 0x4130
leaq 0x118(%rsp), %rdi
callq 0x4130
leaq 0x158(%rsp), %rdi
callq 0x4130
leaq 0x138(%rsp), %rdi
jmp 0xee49
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x43f0
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x761c
leaq 0x78(%rsp), %rdi
callq 0x4130
leaq 0x18(%rsp), %rdi
callq 0x4130
movq 0x10(%rsp), %rax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x78(%rsp), %rdi
movq %rax, %rbx
jmp 0xefe7
jmp 0xefda
leaq 0x238(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
jmp 0xee8c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x4130
jmp 0xee9b
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x4130
jmp 0xeead
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4130
jmp 0xeebc
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4130
leaq 0xb8(%rsp), %rdi
callq 0x4130
leaq 0x218(%rsp), %rdi
callq 0x4130
leaq 0x1f8(%rsp), %rdi
callq 0x4130
leaq 0xd8(%rsp), %rdi
callq 0x4130
leaq 0x1d8(%rsp), %rdi
callq 0x4130
leaq 0x1b8(%rsp), %rdi
callq 0x4130
leaq 0xf8(%rsp), %rdi
callq 0x4130
leaq 0x198(%rsp), %rdi
callq 0x4130
leaq 0x178(%rsp), %rdi
callq 0x4130
leaq 0x118(%rsp), %rdi
callq 0x4130
leaq 0x158(%rsp), %rdi
callq 0x4130
leaq 0x138(%rsp), %rdi
jmp 0xeff1
movq %rax, %rbx
jmp 0xeec6
movq %rax, %rbx
jmp 0xeed3
movq %rax, %rbx
jmp 0xeee0
movq %rax, %rbx
jmp 0xeeed
movq %rax, %rbx
jmp 0xeefa
movq %rax, %rbx
jmp 0xef07
movq %rax, %rbx
jmp 0xef14
movq %rax, %rbx
jmp 0xef21
movq %rax, %rbx
jmp 0xef2e
movq %rax, %rbx
jmp 0xef3b
movq %rax, %rbx
jmp 0xef48
movq %rax, %rbx
jmp 0xef55
movq %rax, %rbx
jmp 0xeff6
leaq 0x278(%rsp), %rdi
jmp 0xefcc
jmp 0xefdf
leaq 0x258(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
jmp 0xefe2
jmp 0xefdf
jmp 0xefdf
movq %rax, %rbx
jmp 0xefec
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4130
leaq 0x18(%rsp), %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x4590