LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/board.cpp
// Function: check(unsigned long, unsigned char, Board&)
void check(uint64_t h, uint8_t o, Board &b){
	if(h != b.hash())
		printf("expected hash: %lu, got: %lu\n", h, b.hash());
	if(o != b.orient())
		printf("expected orient: %i, got: %i\n", o, b.orient());
	if(h != b.hash() || o != b.orient())
		printf("%s", b.to_s().c_str());
	assert(h == b.hash());
	assert(o == b.orient());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq %rdx, %rdi
movq %rdx, %rbx
movl %esi, %ebp
callq 0x7f14
cmpq %r14, %rax
je 0x10579
movq %rbx, %rdi
callq 0x7f14
leaq 0xed2a(%rip), %rdi      # 0x1f296
movq %rax, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x4040
movq %rbx, %rdi
movzbl %bpl, %ebp
callq 0x7bf8
cmpl %ebp, %eax
je 0x105a3
movq %rbx, %rdi
callq 0x7bf8
leaq 0xed1c(%rip), %rdi      # 0x1f2b4
movl %eax, %edx
movl %ebp, %esi
xorl %eax, %eax
callq 0x4040
movq %rbx, %rdi
callq 0x7f14
cmpq %r14, %rax
jne 0x105bc
movq %rbx, %rdi
callq 0x7bf8
cmpl %ebp, %eax
je 0x105e8
leaq 0x8(%rsp), %r15
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xf8fc
movq (%r15), %rsi
leaq 0xecf9(%rip), %rdi      # 0x1f2d2
xorl %eax, %eax
callq 0x4040
movq %r15, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x7f14
cmpq %r14, %rax
jne 0x1060c
movq %rbx, %rdi
callq 0x7bf8
cmpl %ebp, %eax
jne 0x1062b
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xecc2(%rip), %rdi      # 0x1f2d5
leaq 0xeb79(%rip), %rsi      # 0x1f193
leaq 0xecc2(%rip), %rcx      # 0x1f2e3
movl $0xf4, %edx
callq 0x41c0
leaq 0xecd8(%rip), %rdi      # 0x1f30a
leaq 0xeb5a(%rip), %rsi      # 0x1f193
leaq 0xeca3(%rip), %rcx      # 0x1f2e3
movl $0xf5, %edx
callq 0x41c0
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/board.cpp
// Function: check(unsigned long, unsigned char, std::initializer_list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>)
void check(uint64_t h, uint8_t o, std::initializer_list<string> moves){
	Board b;
	for(string m : moves){
		b.move(m);
	}
	check(h, o, b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
vxorps %xmm0, %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movq %rcx, %r14
shlq $0x5, %r14
leaq 0x10(%rsp), %r13
leaq 0x4(%rsp), %rbx
movq %rdx, %r15
movl %esi, (%rsp)
movq %rdi, 0x8(%rsp)
vmovups %xmm0, 0x9(%r12)
vmovaps %xmm0, (%r12)
movw $0xfc01, 0x19(%r12)     # imm = 0xFC01
movb $0x8, 0x1b(%r12)
movw $0xdead, 0x1c(%r12)     # imm = 0xDEAD
andq $0x0, 0x20(%r12)
pushq $0x8
popq %rbp
testq %r14, %r14
je 0x1075a
movq %r13, %rdi
movq %r15, %rsi
callq 0x43f0
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0xaa8c
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x7ada
movq %r13, %rdi
callq 0x4130
addq $0x20, %r15
addq $-0x20, %r14
jmp 0x1071f
movzbl (%rsp), %esi
movq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x1053e
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
movq %rbx, %rdi
callq 0x4590
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/move.cpp
// Function: check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void check(const std::string a, int ao, const std::string b, int bo) {
	Move am = Move(b, bo).rotate(ao);
	Move bm = Move(a, ao).rotate(bo);
	printf("%s %2i <=> %s %2i ", a.c_str(), ao, b.c_str(), bo);
	printf("  :  %s %2i <=> %s %2i\n", bm.to_s().c_str(), bm.o, am.to_s().c_str(), am.o);
	assert(bm == Move(b, bo));
	assert(am == Move(a, ao));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x18(%rsp), %r12
movl %esi, %ebx
movq %rdi, %r14
movl %ecx, %ebp
movq %rdx, %r15
movq %rdx, %rsi
movl %ecx, %edx
movq %r12, %rdi
callq 0xaa8c
movq %r12, %rdi
movl %ebx, %esi
callq 0x7c12
leaq 0x8(%rsp), %rcx
leaq 0x18(%rsp), %r12
movq %r14, %rsi
movl %ebx, %edx
movq %r12, %rdi
movw %ax, (%rcx)
callq 0xaa8c
movq %r12, %rdi
movl %ebp, %esi
callq 0x7c12
leaq 0xc(%rsp), %r12
leaq 0xd81a(%rip), %rdi      # 0x1f45a
movq %r14, 0x10(%rsp)
movl %ebx, %edx
movl %ebp, %r8d
movw %ax, (%r12)
xorl %eax, %eax
movq (%r14), %rsi
movq (%r15), %rcx
callq 0x4040
leaq 0x18(%rsp), %r13
movq %r12, %rsi
xorl %edx, %edx
movq %r13, %rdi
callq 0x8178
movq (%r13), %r13
movzwl (%r12), %r12d
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x8178
movzwl 0x8(%rsp), %r8d
leaq 0x38(%rsp), %r14
shrl $0xc, %r12d
leaq 0xd7cf(%rip), %rdi      # 0x1f46d
movq %r13, %rsi
xorl %eax, %eax
movq (%r14), %rcx
movl %r12d, %edx
shrl $0xc, %r8d
callq 0x4040
movq %r14, %rdi
callq 0x4130
leaq 0x18(%rsp), %rdi
callq 0x4130
leaq 0x18(%rsp), %r14
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rdi
callq 0xaa8c
movzwl 0xc(%rsp), %eax
cmpw (%r14), %ax
jne 0x11d0f
movq 0x10(%rsp), %rsi
leaq 0x18(%rsp), %r14
movl %ebx, %edx
movq %r14, %rdi
callq 0xaa8c
movzwl 0x8(%rsp), %eax
cmpw (%r14), %ax
jne 0x11d28
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd76f(%rip), %rdi      # 0x1f485
leaq 0xd77a(%rip), %rsi      # 0x1f497
leaq 0xd77c(%rip), %rcx      # 0x1f4a0
pushq $0xc
jmp 0x11d3f
leaq 0xd7ac(%rip), %rdi      # 0x1f4db
leaq 0xd761(%rip), %rsi      # 0x1f497
leaq 0xd763(%rip), %rcx      # 0x1f4a0
pushq $0xd
popq %rdx
callq 0x41c0
leaq 0x18(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
movq %rbx, %rdi
callq 0x4590
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/move.cpp
// Function: check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void check(const std::string a, const std::string b) {
	Move ma(a);
	Move mb(b);
	Move ar = ma.rotate(mb.orientation());
	Move br = mb.rotate(ma.orientation());
	if(ma != br || mb != ar){
		printf("%s => %s    %s => %s\n", a.c_str(),  ar.to_s(true).c_str(), b.c_str(), br.to_s(true).c_str());
		printf("%s\n", Board().to_s(true).c_str());
	}
	assert(ma == br);
	assert(mb == ar);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %r15
pushq $0x8
popq %rbp
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xaa8c
leaq 0x8(%rsp), %r12
movq %rbx, %rsi
movl %ebp, %edx
movq %r12, %rdi
callq 0xaa8c
movzwl (%r12), %esi
movq %r15, %rdi
shrl $0xc, %esi
callq 0x7c12
movzwl (%r15), %esi
movl %eax, %ebp
movw %bp, 0x4(%rsp)
movq %r12, %rdi
shrl $0xc, %esi
callq 0x7c12
movw %ax, (%rsp)
cmpw %ax, (%r15)
jne 0x11dce
cmpw %bp, 0x8(%rsp)
je 0x11e84
movq (%r14), %r14
leaq 0x10(%rsp), %r15
leaq 0x4(%rsp), %rsi
pushq $0x1
popq %rbp
movq %r15, %rdi
movl %ebp, %edx
callq 0x8178
movq (%r15), %r15
movq (%rbx), %rbx
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
movl %ebp, %edx
callq 0x8178
leaq 0x40(%rsp), %r12
leaq 0xd6e4(%rip), %rdi      # 0x1f4ed
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
movq (%r12), %r8
callq 0x4040
movq %r12, %rdi
callq 0x4130
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4130
vxorps %xmm0, %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
vmovups %xmm0, 0x9(%rbx)
vmovaps %xmm0, (%rbx)
movw $0xfc01, 0x19(%rbx)     # imm = 0xFC01
movb $0x8, 0x1b(%rbx)
movw $0xdead, 0x1c(%rbx)     # imm = 0xDEAD
andq $0x0, 0x20(%rbx)
leaq 0x40(%rsp), %rbx
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xf8fc
movq (%rbx), %rdi
callq 0x4480
movq %rbx, %rdi
callq 0x4130
movzwl 0xc(%rsp), %eax
cmpw (%rsp), %ax
jne 0x11eb6
movzwl 0x8(%rsp), %eax
cmpw 0x4(%rsp), %ax
jne 0x11e9d
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd699(%rip), %rdi      # 0x1f53d
leaq 0xd5ec(%rip), %rsi      # 0x1f497
leaq 0xd65a(%rip), %rcx      # 0x1f50c
pushq $0x1a
jmp 0x11ecd
leaq 0xd646(%rip), %rdi      # 0x1f503
leaq 0xd5d3(%rip), %rsi      # 0x1f497
leaq 0xd641(%rip), %rcx      # 0x1f50c
pushq $0x19
popq %rdx
callq 0x41c0
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
movq %rbx, %rdi
callq 0x4590
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/move.cpp
// Function: check_many(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::initializer_list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>)
void check_many(std::string in, std::initializer_list<std::string> moves){
	assert(moves.size() == 8);
	int r = 0;
	for(std::string out : moves){
		check(in, out + ":" + to_str(r));
		r++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
cmpq $0x8, %rdx
jne 0x11fda
leaq 0x78(%rsp), %rbp
leaq 0x58(%rsp), %r13
leaq 0x98(%rsp), %rbx
xorl %r15d, %r15d
xorl %r14d, %r14d
cmpq $0x100, %r15            # imm = 0x100
je 0x11fc8
movq 0x10(%rsp), %rax
leaq 0x38(%rsp), %r12
movq %r12, %rdi
leaq (%rax,%r15), %rsi
callq 0x43f0
movq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x43f0
leaq 0xab2d(%rip), %rdx      # 0x1ca8b
movq %rbp, %rdi
movq %r12, %rsi
callq 0x11b6b
movq %r13, %rdi
movl %r14d, %esi
callq 0xaee1
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x8365
leaq 0x18(%rsp), %r12
movq %rbx, %rsi
movq %r12, %rdi
callq 0x11d5a
movq %rbx, %rdi
callq 0x4130
movq %r13, %rdi
callq 0x4130
movq %rbp, %rdi
callq 0x4130
movq %r12, %rdi
callq 0x4130
leaq 0x38(%rsp), %rdi
incl %r14d
callq 0x4130
addq $0x20, %r15
jmp 0x11f25
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd565(%rip), %rdi      # 0x1f546
leaq 0xd4af(%rip), %rsi      # 0x1f497
leaq 0xd569(%rip), %rcx      # 0x1f558
pushq $0x1f
popq %rdx
callq 0x41c0
movq %rax, %rbx
jmp 0x1202a
movq %rax, %rbx
jmp 0x12020
movq %rax, %rbx
jmp 0x12016
leaq 0x98(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
leaq 0x58(%rsp), %rdi
callq 0x4130
leaq 0x78(%rsp), %rdi
callq 0x4130
leaq 0x18(%rsp), %rdi
callq 0x4130
jmp 0x12039
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x4590
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::garbage_collect(Board&, AgentMCTS::Node*)
void AgentMCTS::garbage_collect(Board & board, Node * node){
	Node * child = node->children.begin(),
		 * end = node->children.end();

	int toplay = board.toplay();
	for( ; child != end; child++){
		if(child->children.num() == 0)
			continue;

		if(	(node->outcome >= 0 && child->exp.num() > gcsolved && (node->outcome != toplay || child->outcome == toplay || child->outcome == 0)) || //parent is solved, only keep the proof tree, plus heavy draws
			(node->outcome <  0 && child->exp.num() > (child->outcome >= 0 ? gcsolved : gclimit)) ){ // only keep heavy nodes, with different cutoffs for solved and unsolved
			board.move(child->move);
			garbage_collect(board, child);
			board.undo(child->move);
		}else{
			nodes -= child->dealloc(ctmem);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x20(%rdx), %rcx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %r13d, %r13d
movl $0x0, %r12d
leaq 0x10(%rcx), %rax
cmpq $0x2, %rcx
cmovaeq %rax, %r12
jb 0x13222
movzwl 0x6(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, %r13
movzbl 0x19(%r14), %eax
leaq 0xf0(%r15), %rcx
addq $0x14, %r12
leaq 0x70(%r15), %rdx
movq %rcx, 0x20(%rsp)
leaq 0xd8(%r15), %rcx
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movl %eax, 0xc(%rsp)
leaq -0x14(%r12), %rbp
cmpq %r13, %rbp
je 0x13307
movq 0xc(%r12), %rax
cmpq $0x2, %rax
jb 0x132fe
cmpw $0x0, 0x6(%rax)
je 0x132fe
movb 0x12(%rbx), %al
movq -0xc(%r12), %rcx
testb %al, %al
js 0x132c1
movl 0x70(%r15), %edx
cmpq %rdx, %rcx
jbe 0x132a9
cmpb 0xc(%rsp), %al
jne 0x132d9
movsbl -0x2(%r12), %eax
testl %eax, %eax
sete %cl
cmpl 0xc(%rsp), %eax
sete %al
orb %cl, %al
jne 0x132d9
movq 0x20(%rsp), %rsi
movq %rbp, %rdi
callq 0x1580e
movl %eax, %eax
subq %rax, 0xd0(%r15)
jmp 0x132fe
cmpb $0x0, -0x2(%r12)
movq 0x18(%rsp), %rax
cmovsq 0x10(%rsp), %rax
movl (%rax), %eax
cmpq %rax, %rcx
jbe 0x132a9
movl (%r12), %esi
movq %r14, %rdi
callq 0x7ada
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x131e2
movq %r14, %rdi
movq %r12, %rsi
callq 0x15fd8
addq $0x28, %r12
jmp 0x13250
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::stop_threads()
void AgentMCTS::stop_threads(){
	if(threadstate != Thread_Wait_Start){
		timedout();
		runbarrier.wait();
		CAS(threadstate, Thread_Wait_End, Thread_Wait_Start);
		assert(threadstate == Thread_Wait_Start);
	}
}

// Assembly:
pushq %rbx
movl 0xa80(%rdi), %eax
cmpl $0x1, %eax
je 0x14014
movq (%rdi), %rax
movq %rdi, %rbx
callq *0x58(%rax)
leaq 0xaa0(%rbx), %rdi
callq 0x14eda
pushq $0x6
popq %rax
pushq $0x1
popq %rcx
lock
cmpxchgl %ecx, 0xa80(%rbx)
movl 0xa80(%rbx), %eax
cmpl $0x1, %eax
jne 0x14016
popq %rbx
retq
leaq 0xb694(%rip), %rdi      # 0x1f6b1
leaq 0xb6ae(%rip), %rsi      # 0x1f6d2
leaq 0xb822(%rip), %rcx      # 0x1f84d
movl $0xdb, %edx
callq 0x41c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::AgentMCTS()
AgentMCTS::AgentMCTS() {
	nodes = 0;
	runs = 0;
	gclimit = 5;
	time_used = 0;

	profile     = false;
	ponder      = false;
//#ifdef SINGLE_THREAD ... make sure only 1 thread
	numthreads  = 1;
	maxmem      = 1000*1024*1024;

	explore     = 1;
	parentexplore = true;
	knowledge   = true;
	useexplore  = 1;
	fpurgency   = 1;
	rollouts    = 10;

	keeptree    = true;
	minimax     = 1;
	visitexpand = 1;
	prunesymmetry = true;
	gcsolved    = 100000;

	win_score = 1;

	instantwin  = 0;

	//no threads started until a board is set
	threadstate = Thread_Wait_Start;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
vxorps %xmm0, %xmm0, %xmm0
movw $0xfc01, %ax            # imm = 0xFC01
movb $0x8, %cl
movw $0xdead, %dx            # imm = 0xDEAD
leaq 0x169eb(%rip), %rsi     # 0x2aa88
leaq 0xf0(%rdi), %r14
movq %rdi, %rbx
vmovups %xmm0, 0x19(%rdi)
vmovups %xmm0, 0x10(%rdi)
movw %ax, 0x29(%rdi)
movb %cl, 0x2b(%rdi)
movw %dx, 0x2c(%rdi)
andq $0x0, 0x30(%rdi)
movq %rsi, (%rdi)
vmovups %xmm0, 0x80(%rdi)
vmovups %xmm0, 0x89(%rdi)
movw %ax, 0x99(%rdi)
movb %cl, 0x9b(%rdi)
movw %dx, 0x9c(%rdi)
vmovups %xmm0, 0xa0(%rdi)
vmovups %xmm0, 0xaa(%rdi)
movl $0x8efc00fd, 0xba(%rdi) # imm = 0x8EFC00FD
movw $0x8efc, 0xc0(%rdi)     # imm = 0x8EFC
andq $0x0, 0xc8(%rdi)
movq %r14, %rdi
callq 0x1572e
andq $0x0, 0xa98(%rbx)
vxorps %xmm0, %xmm0, %xmm0
leaq 0xaa0(%rbx), %r12
vmovups %xmm0, 0xa88(%rbx)
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0xb048
leaq 0xb00(%rbx), %rdi
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0xb048
vbroadcastss 0xb441(%rip), %xmm0 # 0x1f59c
movb $0x1, %al
movabsq $0x100000001, %rcx      # imm = 0x100000001
andq $0x0, 0xd0(%rbx)
andq $0x0, 0xe0(%rbx)
movl $0x5, 0xd8(%rbx)
andq $0x0, 0xb60(%rbx)
movw $0x100, 0x48(%rbx)      # imm = 0x100
movb $0x0, 0x38(%rbx)
movl %ebp, 0x3c(%rbx)
movq $0x3e800000, 0x40(%rbx) # imm = 0x3E800000
movl $0x3f800000, 0x4c(%rbx) # imm = 0x3F800000
movb %al, 0x50(%rbx)
vmovlps %xmm0, 0x54(%rbx)
movl $0xa, 0x5c(%rbx)
movb %al, 0x60(%rbx)
movq %rcx, 0x64(%rbx)
movabsq $0x1000186a0, %rcx      # imm = 0x1000186A0
movb %al, 0x6c(%rbx)
movq %rcx, 0x70(%rbx)
andl $0x0, 0x78(%rbx)
movl %ebp, 0xa80(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq %rax, %r15
callq 0xb0a2
jmp 0x141ef
movq %rax, %r15
leaq 0xa88(%rbx), %rdi
callq 0x16962
movq %r14, %rdi
callq 0x1578c
jmp 0x14208
movq %rax, %r15
addq $0xa8, %rbx
movq %rbx, %rdi
callq 0x157d4
movq %r15, %rdi
callq 0x4590
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::~AgentMCTS()
AgentMCTS::~AgentMCTS(){
	stop_threads();

	numthreads = 0;
	reset_threads(); //shut down the theads properly

	root.dealloc(ctmem);
	ctmem.compact();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x1685c(%rip), %rax     # 0x2aa88
movq %rdi, %rbx
movq %rax, (%rdi)
callq 0x13fda
andl $0x0, 0x3c(%rbx)
movq %rbx, %rdi
callq 0x142b0
leaq 0xa8(%rbx), %r14
leaq 0xf0(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1580e
vxorps %xmm0, %xmm0, %xmm0
vxorps %xmm1, %xmm1, %xmm1
movq %r15, %rdi
callq 0x14f66
leaq 0xb00(%rbx), %rdi
callq 0xb0a2
leaq 0xaa0(%rbx), %rdi
callq 0xb0a2
addq $0xa88, %rbx            # imm = 0xA88
movq %rbx, %rdi
callq 0x16962
movq %r15, %rdi
callq 0x1578c
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x157d4
movq %rax, %rdi
callq 0x7611
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::reset_threads()
void AgentMCTS::reset_threads(){ //start and end with threadstate = Thread_Wait_Start
	assert(threadstate == Thread_Wait_Start);

//wait for them to all get to the barrier
	assert(CAS(threadstate, Thread_Wait_Start, Thread_Wait_Start_Cancelled));
	runbarrier.wait();

//make sure they exited cleanly
	for(unsigned int i = 0; i < threads.size(); i++)
		threads[i]->join();

	threads.clear();

	threadstate = Thread_Wait_Start;

	runbarrier.reset(numthreads + 1);
	gcbarrier.reset(numthreads);

//start new threads
	for(int i = 0; i < numthreads; i++)
		threads.push_back(new MCTSThread(this));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl 0xa80(%rdi), %eax
cmpl $0x1, %eax
jne 0x143a5
movq %rdi, %rbx
pushq $0x1
popq %rax
pushq $0x2
popq %rcx
lock
cmpxchgl %ecx, 0xa80(%rdi)
jne 0x143c4
leaq 0xaa0(%rbx), %r15
movq %r15, %rdi
callq 0x14eda
leaq 0xa88(%rbx), %r14
xorl %eax, %eax
movl %eax, %r12d
movq 0xa90(%rbx), %rcx
movq 0xa88(%rbx), %rax
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0x1432e
movq (%rax,%r12,8), %rdi
addq $0x10, %rdi
callq 0x162fa
leal 0x1(%r12), %eax
jmp 0x142fa
cmpq %rax, %rcx
je 0x1433a
movq %rax, 0xa90(%rbx)
movl $0x1, 0xa80(%rbx)
movq %r15, %rdi
movl 0x3c(%rbx), %esi
incl %esi
callq 0x15888
movl 0x3c(%rbx), %esi
leaq 0xb00(%rbx), %rdi
callq 0x15888
leaq 0x8(%rsp), %r15
xorl %ebp, %ebp
cmpl 0x3c(%rbx), %ebp
jge 0x14398
movl $0xf8, %edi
callq 0x42f0
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x158cc
movq %r12, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x16970
incl %ebp
jmp 0x14367
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb305(%rip), %rdi      # 0x1f6b1
leaq 0xb31f(%rip), %rsi      # 0x1f6d2
leaq 0xb4d2(%rip), %rcx      # 0x1f88c
movl $0xe6, %edx
callq 0x41c0
leaq 0xb4e1(%rip), %rdi      # 0x1f8ac
leaq 0xb300(%rip), %rsi      # 0x1f6d2
leaq 0xb4b3(%rip), %rcx      # 0x1f88c
movl $0xe9, %edx
callq 0x41c0
movq %r12, %rdi
movq %rax, %rbx
callq 0x42c0
movq %rbx, %rdi
callq 0x4590
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::statestring[abi:cxx11]()
string AgentMCTS::statestring(){
	switch(threadstate){
	case Thread_Cancelled:  return "Thread_Wait_Cancelled";
	case Thread_Wait_Start: return "Thread_Wait_Start";
	case Thread_Wait_Start_Cancelled: return "Thread_Wait_Start_Cancelled";
	case Thread_Running:    return "Thread_Running";
	case Thread_GC:         return "Thread_GC";
	case Thread_GC_End:     return "Thread_GC_End";
	case Thread_Wait_End:   return "Thread_Wait_End";
	}
	return "Thread_State_Unknown!!!";
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl 0xa80(%rsi), %eax
movq %rdi, %rbx
cmpq $0x6, %rax
ja 0x14482
leaq 0xb1b3(%rip), %rcx      # 0x1f5f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb37b(%rip), %rsi      # 0x1f7cc
leaq 0xf(%rsp), %rdx
jmp 0x144b8
leaq 0xb3ae(%rip), %rsi      # 0x1f80d
leaq 0xb(%rsp), %rdx
jmp 0x144b8
leaq 0xb375(%rip), %rsi      # 0x1f7e2
leaq 0xd(%rsp), %rdx
jmp 0x144b8
leaq 0xb383(%rip), %rsi      # 0x1f7fe
leaq 0xc(%rsp), %rdx
jmp 0x144b8
leaq 0xb3ac(%rip), %rsi      # 0x1f835
leaq 0x8(%rsp), %rdx
jmp 0x144b8
leaq 0xb229(%rip), %rsi      # 0x1f6c0
leaq 0xe(%rsp), %rdx
jmp 0x144b8
leaq 0xb372(%rip), %rsi      # 0x1f817
leaq 0xa(%rsp), %rdx
jmp 0x144b8
leaq 0xb372(%rip), %rsi      # 0x1f825
leaq 0x9(%rsp), %rdx
movq %rbx, %rdi
callq 0x40f0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::set_ponder(bool)
void AgentMCTS::set_ponder(bool p){
	if(ponder != p){
		ponder = p;
		stop_threads();

		if(ponder)
			start_threads();
	}
}

// Assembly:
pushq %rbx
cmpb %sil, 0x38(%rdi)
je 0x144ec
movq %rdi, %rbx
movb %sil, 0x38(%rdi)
callq 0x13fda
cmpb $0x1, 0x38(%rbx)
jne 0x144ec
movq %rbx, %rdi
popq %rbx
jmp 0x14036
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::set_board(Board const&, bool)
void AgentMCTS::set_board(const Board & board, bool clear){
	stop_threads();

	nodes -= root.dealloc(ctmem);
	root = Node();
	root.exp.addwins(visitexpand+1);

	rootboard = board;

	reset_threads(); //needed since the threads aren't started before a board it set

	if(ponder)
		start_threads();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x13fda
leaq 0xa8(%rbx), %r15
leaq 0xf0(%rbx), %rsi
movq %r15, %rdi
callq 0x1580e
vxorps %xmm0, %xmm0, %xmm0
movw $0x8efc, %cx            # imm = 0x8EFC
movl %eax, %eax
subq %rax, 0xd0(%rbx)
movq %rsp, %rsi
movl $0xfd0000, 0x10(%rsi)   # imm = 0xFD0000
vmovaps %xmm0, (%rsi)
movw %cx, 0x14(%rsi)
movw %cx, 0x18(%rsi)
andq $0x0, 0x20(%rsi)
movq %r15, %rdi
callq 0x159f6
movq %rsp, %rdi
callq 0x157d4
movl 0x68(%rbx), %eax
movq %rbx, %rdi
incl %eax
vmovq %rax, %xmm0
addq %rax, %rax
vmovq %rax, %xmm1
vpunpcklqdq %xmm0, %xmm1, %xmm0 # xmm0 = xmm1[0],xmm0[0]
vpaddq 0xa8(%rbx), %xmm0, %xmm0
vmovdqu %xmm0, 0xa8(%rbx)
vmovups (%r14), %ymm0
vmovups %ymm0, 0x80(%rbx)
movq 0x20(%r14), %rax
movq %rax, 0xa0(%rbx)
vzeroupper
callq 0x142b0
cmpb $0x1, 0x38(%rbx)
jne 0x145ab
movq %rbx, %rdi
callq 0x14036
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rsp, %rdi
movq %rax, %rbx
callq 0x157d4
movq %rbx, %rdi
callq 0x4590
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::gamelen() const
double AgentMCTS::gamelen() const {
	DepthStats len;
	for(unsigned int i = 0; i < threads.size(); i++)
		len += threads[i]->gamelen;
	return len.avg();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x8(%rsp), %r14
vxorpd %xmm0, %xmm0, %xmm0
movl $0x98, %r15d
movq %rdi, %rbx
xorl %eax, %eax
andl $0x0, 0x8(%r14)
movq $0x3b9aca00, (%r14)     # imm = 0x3B9ACA00
vmovupd %xmm0, 0x10(%r14)
movl %eax, %r12d
movq 0xa88(%rbx), %rax
movq 0xa90(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x14a5e
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
addq %r15, %rsi
callq 0x15426
leal 0x1(%r12), %eax
jmp 0x14a2b
movl 0x10(%rsp), %eax
vcvtusi2sd %eax, %xmm1, %xmm0
vcvtusi2sdq 0x18(%rsp), %xmm1, %xmm1
testl %eax, %eax
sete %cl
kmovd %ecx, %k1
vdivsd %xmm0, %xmm1, %xmm0
vxorpd %xmm1, %xmm1, %xmm1
vmovsd %xmm1, %xmm0, %xmm0 {%k1}
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::get_pv() const
vector<Move> AgentMCTS::get_pv() const {
	vector<Move> pv;

	const Node * n = & root;
	char turn = rootboard.toplay();
	while(n && !n->children.empty()){
		Move m = return_move(n, turn);
		pv.push_back(m);
		n = find_child(n, m);
		turn = 3 - turn;
	}

	if(pv.size() == 0)
		pv.push_back(Move(M_RESIGN));

	return pv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
vxorps %xmm0, %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
movq %rsi, %r14
addq $0xa8, %r14
movq %rdi, %rbx
movq %rsp, %r15
vmovups %xmm0, (%rdi)
movb 0x99(%rsi), %bpl
testq %r14, %r14
je 0x14b09
movq 0x20(%r14), %rax
cmpq $0x2, %rax
jb 0x14b09
cmpw $0x0, 0x6(%rax)
je 0x14b09
movsbl %bpl, %edx
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x14b48
movw %ax, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb4c4
movq %r14, %rsi
movq %r15, %rdx
callq 0x14d80
movb $0x3, %cl
movq %rax, %r14
subb %bpl, %cl
movl %ecx, %ebp
jmp 0x14abf
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
jne 0x14b24
leaq 0x4(%rsp), %rsi
movw $0x8efe, (%rsi)         # imm = 0x8EFE
movq %rbx, %rdi
callq 0x16aca
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14b34
movq %rbx, %rdi
movq %rax, %r14
callq 0x8958
movq %r14, %rdi
callq 0x4590
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmcts.cpp
// Function: AgentMCTS::move_stats[abi:cxx11](std::vector<Move, std::allocator<Move>>) const
string AgentMCTS::move_stats(vector<Move> moves) const {
	string s = "";
	const Node * node = & root;

	for(vector<Move>::iterator m = moves.begin(); node && m != moves.end(); ++m)
		node = find_child(node, *m);

	if(node){
		Node * child = node->children.begin(),
		     * childend = node->children.end();
		for( ; child != childend; child++)
			if(child->move != M_NONE)
				s += child->to_s() + "\n";
	}
	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r12
movq %rsi, %r14
leaq 0x7ce0(%rip), %rsi      # 0x1cab9
leaq 0x8(%rsp), %rdx
movq %rdi, %rbx
callq 0x40f0
movq (%r12), %r15
movq 0x8(%r12), %r12
addq $0xa8, %r14
testq %r14, %r14
je 0x14e97
cmpq %r12, %r15
je 0x14e18
movq %r14, %rsi
movq %r15, %rdx
callq 0x14d80
movq %rax, %r14
addq $0x4, %r15
jmp 0x14df6
movq 0x20(%r14), %rcx
xorl %ebp, %ebp
movl $0x0, %r14d
leaq 0x10(%rcx), %rax
cmpq $0x2, %rcx
cmovaeq %rax, %r14
jb 0x14e40
movzwl 0x6(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, %rbp
leaq 0x28(%rsp), %r15
leaq 0x7c6c(%rip), %r12      # 0x1cab8
leaq 0x8(%rsp), %r13
cmpq %rbp, %r14
je 0x14e97
cmpb $-0x3, 0x14(%r14)
je 0x14e91
movq %r15, %rdi
movq %r14, %rsi
callq 0x15ab0
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6821
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4610
movq %r13, %rdi
callq 0x4130
movq %r15, %rdi
callq 0x4130
addq $0x28, %r14
jmp 0x14e51
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x14ec0
movq %rax, %r14
jmp 0x14eca
leaq 0x8(%rsp), %rdi
movq %rax, %r14
callq 0x4130
leaq 0x28(%rsp), %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x4130
movq %r14, %rdi
callq 0x4590
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./agentmcts.h
// Function: AgentMCTS::MCTSThread::reset()
void reset(){
			treelen.reset();
			gamelen.reset();
			use_explore = false;
			for(int a = 0; a < 4; a++)
				times[a] = 0;
		}

// Assembly:
movl $0x3b9aca00, %eax       # imm = 0x3B9ACA00
vxorps %xmm0, %xmm0, %xmm0
andl $0x0, 0x80(%rdi)
movq %rax, 0x78(%rdi)
vmovups %xmm0, 0x88(%rdi)
andl $0x0, 0xa0(%rdi)
movq %rax, 0x98(%rdi)
vmovups %xmm0, 0xa8(%rdi)
xorl %eax, %eax
movb $0x0, 0x48(%rdi)
cmpq $0x4, %rax
je 0x15362
andq $0x0, 0xb8(%rdi,%rax,8)
incq %rax
jmp 0x1534e
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./board.h
// Function: Board::undo(Move const&)
bool undo(const Move & m) {
		if(valid_move(m))
			return false;

		if(m == M_SWAP){
			swap(sides[1], sides[2]);
			to_play = 1;
			return true;
		}

		to_play = 3 - to_play;
		nummoves--;

		if (m.direction() == 0) {
			sides[1] = rotate_quad_cw(sides[1], m.quadrant());
			sides[2] = rotate_quad_cw(sides[2], m.quadrant());
		} else {
			sides[1] = rotate_quad_ccw(sides[1], m.quadrant());
			sides[2] = rotate_quad_ccw(sides[2], m.quadrant());
		}

		sides[to_play] &= ~xybits[m.l];

		sides[0] = sides[1] | sides[2];

		outcome = -4;
		cached_score = default_score;
		cached_hash = 0;
		orientation = 8;

		return true;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x7ea6
movl %eax, %ebp
testb %al, %al
jne 0x160a2
cmpb $-0x1, (%r14)
jne 0x1600f
vpermilps $0x4e, 0x8(%rbx), %xmm0 # xmm0 = mem[2,3,0,1]
movb $0x1, %al
vmovups %xmm0, 0x8(%rbx)
pushq $0x19
jmp 0x1609e
movb $0x3, %al
subb 0x19(%rbx), %al
movl $0x309, %r15d           # imm = 0x309
movb %al, 0x19(%rbx)
decb 0x18(%rbx)
movl (%r14), %eax
movq 0x8(%rbx), %rdi
bextrl %r15d, %eax, %esi
btl $0x8, %eax
jb 0x1604b
callq 0x7ee8
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
bextrl %r15d, (%r14), %esi
callq 0x7ee8
jmp 0x16062
callq 0x7ebe
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
bextrl %r15d, (%r14), %esi
callq 0x7ebe
movq %rax, 0x10(%rbx)
leaq 0x7ee3(%rip), %rcx      # 0x1df50
movsbq (%r14), %rax
movq (%rcx,%rax,8), %rax
movzbl 0x19(%rbx), %ecx
notq %rax
andq %rax, (%rbx,%rcx,8)
movq 0x10(%rbx), %rax
orq 0x8(%rbx), %rax
movq %rax, (%rbx)
movb $-0x4, 0x1a(%rbx)
movw $0xdead, 0x1c(%rbx)     # imm = 0xDEAD
andq $0x0, 0x20(%rbx)
movb $0x8, %al
pushq $0x1b
popq %rcx
movb %al, (%rbx,%rcx)
xorb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./thread.h
// Function: Thread::operator()(std::function<void ()>)
int operator()(function<void()> fn){
		assert(destruct == false);

		func = fn;
		destruct = true;
		return pthread_create(&thread, NULL, (void* (*)(void*)) &Thread::runner, this);
	}

// Assembly:
pushq %rbx
cmpb $0x0, 0x8(%rdi)
jne 0x16358
movq %rdi, %rbx
addq $0x10, %rdi
callq 0x16430
movb $0x1, 0x8(%rbx)
leaq 0x13e(%rip), %rdx       # 0x16488
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
popq %rbx
jmp 0x45d0
leaq 0x9873(%rip), %rdi      # 0x1fbd2
leaq 0x97d9(%rip), %rsi      # 0x1fb3f
leaq 0x9877(%rip), %rcx      # 0x1fbe4
pushq $0x5d
popq %rdx
callq 0x41c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmctsthread.cpp
// Function: AgentMCTS::MCTSThread::iterate()
void AgentMCTS::MCTSThread::iterate(){
	if(player->profile){
		timestamps[0] = Time();
		stage = 0;
	}

	movelist.reset(&(player->rootboard));
	player->root.exp.addvloss();
	Board copy = player->rootboard;
	walk_tree(copy, & player->root, 0);
	player->root.exp.addv(movelist.getexp(3-player->rootboard.toplay()));

	if(player->profile){
		times[0] += timestamps[1] - timestamps[0];
		times[1] += timestamps[2] - timestamps[1];
		times[2] += timestamps[3] - timestamps[2];
		times[3] += Time() - timestamps[3];
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq 0x40(%rdi), %rax
movq %rdi, %rbx
cmpb $0x1, 0x48(%rax)
jne 0x16bcf
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x4c50
movq (%r14), %rax
movq %rax, 0xd8(%rbx)
andl $0x0, 0x70(%rbx)
movq 0x40(%rbx), %rax
vxorps %xmm0, %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
vmovups %ymm0, 0x50(%rbx)
lock
incq 0xb0(%rax)
movq 0x40(%rbx), %rdx
movq 0xa0(%rdx), %rax
movq %rax, 0x20(%rsi)
vmovupd 0x80(%rdx), %ymm0
addq $0xa8, %rdx
vmovupd %ymm0, (%rsi)
vzeroupper
callq 0x16cd4
movq 0x40(%rbx), %rax
movzbl 0x99(%rax), %ecx
pushq $0x2
popq %rdx
subq %rcx, %rdx
shlq $0x4, %rdx
leaq 0x50(%rbx,%rdx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x16c3e
lock
addq %rdx, 0xa8(%rax)
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x16c4f
lock
addq %rcx, 0xb0(%rax)
movq 0x40(%rbx), %rax
cmpb $0x1, 0x48(%rax)
jne 0x16ccb
vmovupd 0xd8(%rbx), %xmm0
vmovupd 0xe0(%rbx), %xmm1
leaq 0x8(%rsp), %r14
movq %r14, %rdi
vunpcklpd %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm1[0]
vsubpd %xmm0, %xmm1, %xmm0
vaddpd 0xb8(%rbx), %xmm0, %xmm0
vmovupd %xmm0, 0xb8(%rbx)
vmovsd 0xf0(%rbx), %xmm0
vsubsd 0xe8(%rbx), %xmm0, %xmm0
vaddsd 0xc8(%rbx), %xmm0, %xmm0
vmovsd %xmm0, 0xc8(%rbx)
callq 0x4c50
vmovsd (%r14), %xmm0
vsubsd 0xf0(%rbx), %xmm0, %xmm0
vaddsd 0xd0(%rbx), %xmm0, %xmm0
vmovsd %xmm0, 0xd0(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmctsthread.cpp
// Function: AgentMCTS::MCTSThread::choose_move(AgentMCTS::Node const*, int) const
AgentMCTS::Node * AgentMCTS::MCTSThread::choose_move(const Node * node, int toplay) const {
	float val, maxval = -1000000000;
	float logvisits = log(node->exp.num());

	float explore = player->explore;
	if(player->parentexplore)
		explore *= node->exp.avg();

	Node * ret = NULL,
		 * child = node->children.begin(),
		 * end   = node->children.end();

	for(; child != end; child++){
		if(child->outcome >= 0){
			if(child->outcome == toplay) //return a win immediately
				return child;

			val = (child->outcome == 0 ? -1 : -2); //-1 for tie so any unknown is better, -2 for loss so it's even worse
		}else{
			val = child->value(player->knowledge, player->fpurgency);
			if(explore > 0)
				val += explore*sqrt(logvisits/(child->exp.num() + 1));
		}

		if(maxval < val){
			maxval = val;
			ret = child;
		}
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq 0x8(%rsi), %rdi
movl %edx, %ebx
movq %rsi, %r15
callq 0x1776c
movq 0x40(%r14), %rax
vmovss 0x4c(%rax), %xmm3
cmpb $0x1, 0x49(%rax)
jne 0x1703f
vcvtusi2ssq (%r15), %xmm1, %xmm1
vcvtusi2ssq 0x8(%r15), %xmm2, %xmm2
vmulss 0x856d(%rip), %xmm1, %xmm1 # 0x1f5a4
vdivss %xmm2, %xmm1, %xmm1
vmulss %xmm1, %xmm3, %xmm3
movq 0x20(%r15), %rcx
xorl %r13d, %r13d
movl $0x0, %r15d
leaq 0x10(%rcx), %rax
cmpq $0x2, %rcx
cmovaeq %rax, %r15
jb 0x17068
movzwl 0x6(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, %r13
vcvtsd2ss %xmm0, %xmm0, %xmm0
leaq 0x8f9d(%rip), %rbp      # 0x20010
xorl %r12d, %r12d
vmovss %xmm3, 0xc(%rsp)
vmovss %xmm0, 0x14(%rsp)
vmovss 0x8f8e(%rip), %xmm0     # 0x20018
cmpq %r13, %r15
je 0x17149
movsbl 0x12(%r15), %eax
vmovss %xmm0, 0x8(%rsp)
testl %eax, %eax
js 0x170b9
cmpl %ebx, %eax
je 0x17146
xorl %ecx, %ecx
testb %al, %al
sete %cl
vmovss (%rbp,%rcx,4), %xmm2
jmp 0x1712b
movq 0x40(%r14), %rax
movq %r15, %rdi
vmovss 0x58(%rax), %xmm0
movzbl 0x50(%rax), %esi
callq 0x17778
vmovss 0xc(%rsp), %xmm3
vmovaps %xmm0, %xmm2
vucomiss 0x8f3c(%rip), %xmm3     # 0x2001c
vmovss 0x8(%rsp), %xmm0
jbe 0x17131
movq 0x8(%r15), %rax
vmovss 0x14(%rsp), %xmm1
incq %rax
vcvtusi2ss %rax, %xmm4, %xmm0
vdivss %xmm0, %xmm1, %xmm0
vucomiss 0x8f15(%rip), %xmm0     # 0x2001c
jb 0x1710f
vsqrtss %xmm0, %xmm0, %xmm0
jmp 0x17126
vmovss %xmm2, 0x10(%rsp)
callq 0x45c0
vmovss 0x10(%rsp), %xmm2
vmovss 0xc(%rsp), %xmm3
vfmadd231ss %xmm0, %xmm3, %xmm2 # xmm2 = (xmm3 * xmm0) + xmm2
vmovss 0x8(%rsp), %xmm0
vucomiss %xmm0, %xmm2
vmaxss %xmm0, %xmm2, %xmm0
cmovaq %r15, %r12
addq $0x28, %r15
jmp 0x1708a
movq %r15, %r12
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentmctsthread.cpp
// Function: AgentMCTS::MCTSThread::rollout(Board&, Move, int)
int AgentMCTS::MCTSThread::rollout(Board & board, Move move, int depth){
	int won;
	while((won = board.won()) < 0) {
		board.move_rand(rand64);
	}
	gamelen.add(board.num_moves());
	movelist.finishrollout(won);
	return won;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %r14, %rdi
callq 0xae70
testb %al, %al
jns 0x17681
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1786e
jmp 0x17668
movzbl 0x18(%r14), %esi
leaq 0x98(%rbx), %rdi
movzbl %al, %ebp
callq 0x17708
addq $0x50, %rbx
movl %ebp, %esi
movq %rbx, %rdi
callq 0x176de
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./board.h
// Function: Board::score_calc() const
int16_t score_calc() const {
		int16_t s = 0;
		uint64_t ws = sides[1];
		uint64_t bs = sides[2];

		//calculate score from white's perspective
		for(int i = 0; i < 32; i++){
			uint64_t wm = winmaps[i];
			uint64_t w = (ws & wm);
			uint64_t b = (bs & wm);

			if     (w && !b) s += scoremap[bitcount(w)];
			else if(!w && b) s -= scoremap[bitcount(b)];
		}
		//return the score from the perspective of the player that just played
		//ie not the player whose turn it is now
		return (to_play == 1 ? -s : s);
	}

// Assembly:
pushq %rbp
pushq %rbx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
leaq 0x687b(%rip), %r8       # 0x1e080
leaq 0x6864(%rip), %r9       # 0x1e070
xorl %esi, %esi
xorl %edx, %edx
cmpq $0x20, %rsi
je 0x17860
movq (%r8,%rsi,8), %r10
movq %r10, %r11
andq %rax, %r11
sete %bl
andq %rcx, %r10
setne %bpl
orb %bl, %bpl
je 0x17851
testq %r10, %r10
setne %bl
testq %r11, %r11
sete %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x1785b
popcntq %r10, %r10
subw (%r9,%r10,2), %dx
jmp 0x1785b
popcntq %r11, %r10
addw (%r9,%r10,2), %dx
incq %rsi
jmp 0x17810
movl %edx, %eax
negl %eax
cmpb $0x1, 0x19(%rdi)
cmovnel %edx, %eax
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./board.h
// Function: Board::move_rand(XORShift_uint64&)
bool move_rand(XORShift_uint64 & rand){
		//find an empty space, this should take log2(bits set) to converge, assuming a good and fast RNG
		uint64_t move = (~sides[0]) & 0xFFFFFFFFFULL; // bits set for all empty positions
		uint64_t mask;
		do {
			mask = rand();
			if((move & mask) > 0) // don't let it drop to no bits set
				move &= mask;
		} while(move & (move-1));
//		} while(bitcount(move) > 1); // if there's only one bit left, that's our move

		sides[to_play] |= move;

		uint64_t rotation = (mask >> 36); //mask is already a random number, so just re-use the unused high bits
		uint64_t direction = rotation & 0x4;
		uint64_t quadrant = rotation & 0x3;

		if (direction) {
			sides[1] = rotate_quad_ccw(sides[1], quadrant);
			sides[2] = rotate_quad_ccw(sides[2], quadrant);
		} else {
			sides[1] = rotate_quad_cw(sides[1], quadrant);
			sides[2] = rotate_quad_cw(sides[2], quadrant);
		}
		sides[0] = sides[1] | sides[2];

		nummoves++;
		to_play = 3 - to_play;
		outcome = -4;
		cached_score = default_score;
		cached_hash = 0;
		orientation = 8;

		return true;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rax
movb $0x24, %cl
movq %rsi, %r14
movq %rdi, %rbx
notq %rax
bzhiq %rcx, %rax, %rcx
movq %r14, %rdi
movq %rcx, %r15
callq 0x1791a
movq %rax, %rcx
andq %r15, %rcx
cmoveq %r15, %rcx
blsrq %rcx, %rdx
jne 0x17886
movzbl 0x19(%rbx), %edx
movq %rax, %r14
shrq $0x24, %r14
andl $0x3, %r14d
movl %r14d, %esi
orq %rcx, (%rbx,%rdx,8)
btq $0x26, %rax
movq 0x8(%rbx), %rdi
jb 0x178da
callq 0x7ee8
movq %rax, 0x8(%rbx)
movl %r14d, %esi
movq 0x10(%rbx), %rdi
callq 0x7ee8
jmp 0x178ef
callq 0x7ebe
movq %rax, 0x8(%rbx)
movl %r14d, %esi
movq 0x10(%rbx), %rdi
callq 0x7ebe
movq %rax, 0x10(%rbx)
orq 0x8(%rbx), %rax
movq %rax, (%rbx)
incb 0x18(%rbx)
movb $0x3, %al
subb 0x19(%rbx), %al
movb %al, 0x19(%rbx)
movl $0xdead08fc, 0x1a(%rbx) # imm = 0xDEAD08FC
andq $0x0, 0x20(%rbx)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./xorshift.h
// Function: XORShift_uint64::rand()
uint64_t rand(){
		r ^= (r >> 17);
		r ^= (r << 31);
		r ^= (r >>  8);
		return r;
	}

// Assembly:
movq (%rdi), %rax
movq %rax, %rcx
shrq $0x11, %rcx
xorq %rax, %rcx
movq %rcx, %rdx
shlq $0x1f, %rdx
xorq %rcx, %rdx
movq %rdx, %rax
shrq $0x8, %rax
xorq %rdx, %rax
movq %rax, (%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentpns.cpp
// Function: AgentPNS::search(double, unsigned long, int)
void AgentPNS::search(double time, uint64_t maxiters, int verbose){
	if(rootboard.won() >= 0)
		return;

	start_threads();

	timeout = false;
	Alarm timer(time, std::bind(&AgentPNS::timedout, this));

	//wait for the timer to stop them
	runbarrier.wait();
	CAS(threadstate, Thread_Wait_End, Thread_Wait_Start);
	assert(threadstate == Thread_Wait_Start);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
addq $0x10, %rdi
vmovsd %xmm0, 0x8(%rsp)
callq 0xae70
testb %al, %al
jns 0x17c3b
movq %rbx, %rdi
callq 0x17c84
movb $0x0, 0x8(%rbx)
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %r14
movq $0x59, (%rsi)
andq $0x0, 0x8(%rsi)
movq %r14, %rdi
movq %rbx, 0x10(%rsi)
callq 0x18c4a
vmovsd 0x8(%rsp), %xmm0
leaq 0x4(%rsp), %rdi
movq %r14, %rsi
callq 0x18c92
leaq 0x10(%rsp), %rdi
callq 0x70f8
leaq 0xa10(%rbx), %rdi
callq 0x14eda
pushq $0x6
popq %rax
pushq $0x1
popq %rcx
lock
cmpxchgl %ecx, 0x9f0(%rbx)
movl 0x9f0(%rbx), %eax
cmpl $0x1, %eax
jne 0x17c43
leaq 0x4(%rsp), %rdi
callq 0x1571e
addq $0x48, %rsp
popq %rbx
popq %r14
retq
leaq 0x7a67(%rip), %rdi      # 0x1f6b1
leaq 0x8723(%rip), %rsi      # 0x20374
leaq 0x8729(%rip), %rcx      # 0x20381
pushq $0x14
popq %rdx
callq 0x41c0
leaq 0x4(%rsp), %rdi
movq %rax, %rbx
callq 0x1571e
jmp 0x17c7c
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x70f8
movq %rbx, %rdi
callq 0x4590
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentpns.cpp
// Function: AgentPNS::reset_threads()
void AgentPNS::reset_threads(){ //start and end with threadstate = Thread_Wait_Start
	assert(threadstate == Thread_Wait_Start);

//wait for them to all get to the barrier
	assert(CAS(threadstate, Thread_Wait_Start, Thread_Wait_Start_Cancelled));
	runbarrier.wait();

//make sure they exited cleanly
	for(unsigned int i = 0; i < threads.size(); i++)
		threads[i]->join();

	threads.clear();

	threadstate = Thread_Wait_Start;

	runbarrier.reset(numthreads + 1);
	gcbarrier.reset(numthreads);

//start new threads
	for(int i = 0; i < numthreads; i++)
		threads.push_back(new PNSThread(this));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x9f0(%rdi), %eax
cmpl $0x1, %eax
jne 0x187fe
movq %rdi, %rbx
pushq $0x1
popq %rax
pushq $0x2
popq %rcx
lock
cmpxchgl %ecx, 0x9f0(%rdi)
jne 0x18817
leaq 0xa10(%rbx), %r15
movq %r15, %rdi
callq 0x14eda
leaq 0x9f8(%rbx), %r14
xorl %eax, %eax
movl %eax, %r12d
movq 0xa00(%rbx), %rcx
movq 0x9f8(%rbx), %rax
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0x1877d
movq (%rax,%r12,8), %rdi
addq $0x8, %rdi
callq 0x162fa
leal 0x1(%r12), %eax
jmp 0x18749
cmpq %rax, %rcx
je 0x18789
movq %rax, 0xa00(%rbx)
movl $0x1, 0x9f0(%rbx)
movq %r15, %rdi
movl 0xadc(%rbx), %esi
incl %esi
callq 0x15888
movl 0xadc(%rbx), %esi
leaq 0xa70(%rbx), %rdi
callq 0x15888
xorl %ebp, %ebp
pushq $0x48
popq %r15
movq %rsp, %r12
cmpl 0xadc(%rbx), %ebp
jge 0x187ef
movq %r15, %rdi
callq 0x42f0
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1909a
movq %r13, (%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x1a23c
incl %ebp
jmp 0x187be
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6eac(%rip), %rdi      # 0x1f6b1
leaq 0x7b68(%rip), %rsi      # 0x20374
leaq 0x7bff(%rip), %rcx      # 0x20412
pushq $0x76
jmp 0x1882e
leaq 0x708e(%rip), %rdi      # 0x1f8ac
leaq 0x7b4f(%rip), %rsi      # 0x20374
leaq 0x7be6(%rip), %rcx      # 0x20412
pushq $0x79
popq %rdx
callq 0x41c0
movq %r13, %rdi
movq %rax, %rbx
callq 0x42c0
movq %rbx, %rdi
callq 0x4590
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/agentpns.cpp
// Function: AgentPNS::return_move(AgentPNS::Node const*, int, int) const
Move AgentPNS::return_move(const Node * node, int toplay, int verbose) const {
	double val, maxval = -1000000000000.0; //1 trillion

	Node * ret = NULL,
		 * child = node->children.begin(),
		 * end = node->children.end();

	for( ; child != end; child++){
		int outcome = child->to_outcome(toplay);
		if(outcome >= 0){
			if(outcome == toplay) val =  800000000000.0 - (double)child->work; //shortest win
			else if(outcome == 0) val = -400000000000.0 + (double)child->work; //longest tie
			else                  val = -800000000000.0 + (double)child->work; //longest loss
		}else{ //not proven
			val = child->work;
		}

		if(maxval < val){
			maxval = val;
			ret = child;
		}
	}

	assert(ret);

	if(verbose)
		logerr(ret->to_s() + "\n");

	return ret->move;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movl %ecx, %ebp
movq 0x18(%rsi), %rcx
movl %edx, %r14d
xorl %r12d, %r12d
movl $0x0, %r15d
leaq 0x10(%rcx), %rax
cmpq $0x2, %rcx
cmovaeq %rax, %r15
jb 0x189dd
movzwl 0x6(%rcx), %ecx
shll $0x5, %ecx
addq %rcx, %rax
movq %rax, %r12
vmovsd 0x6bd3(%rip), %xmm1     # 0x1f5b8
xorl %ebx, %ebx
cmpq %r12, %r15
je 0x18a5f
vmovsd %xmm1, 0x8(%rsp)
movq %r15, %rdi
movl %r14d, %esi
callq 0x195de
testl %eax, %eax
js 0x18a21
vmovsd 0x8(%rsp), %xmm1
cmpl %r14d, %eax
jne 0x18a30
vcvtusi2sdq 0x8(%r15), %xmm3, %xmm0
vmovsd 0x6bb5(%rip), %xmm2     # 0x1f5d0
vsubsd %xmm0, %xmm2, %xmm0
jmp 0x18a4d
vcvtusi2sdq 0x8(%r15), %xmm3, %xmm0
vmovsd 0x8(%rsp), %xmm1
jmp 0x18a4d
vcvtusi2sdq 0x8(%r15), %xmm3, %xmm0
testl %eax, %eax
je 0x18a45
vaddsd 0x6b7d(%rip), %xmm0, %xmm0 # 0x1f5c0
jmp 0x18a4d
vaddsd 0x6b7b(%rip), %xmm0, %xmm0 # 0x1f5c8
vucomisd %xmm1, %xmm0
vmaxsd %xmm1, %xmm0, %xmm1
cmovaq %r15, %rbx
addq $0x20, %r15
jmp 0x189e7
testq %rbx, %rbx
je 0x18abb
testl %ebp, %ebp
je 0x18aab
leaq 0x10(%rsp), %r14
movq %rbx, %rsi
movq %r14, %rdi
callq 0x19300
leaq 0x4039(%rip), %rdx      # 0x1cab8
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x6821
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0xac65
movq %r14, %rdi
callq 0x4130
leaq 0x10(%rsp), %rdi
callq 0x4130
movl 0x14(%rbx), %eax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6ea3(%rip), %rdi      # 0x1f965
leaq 0x78ab(%rip), %rsi      # 0x20374
leaq 0x79af(%rip), %rcx      # 0x2047f
movl $0x142, %edx            # imm = 0x142
callq 0x41c0
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x4130
movq %rbx, %rdi
callq 0x4590
nop
// File: /workspace/github_cpp_makefile_star2_O2/tewalds[P]pentagod/./agent.h
// Function: Agent::solve1ply(Board const&, unsigned int&)
static int solve1ply(const Board & board, unsigned int & nodes) {
		int outcome = -4;
		int turn = board.toplay();
		for(MoveIterator move(board); !move.done(); ++move){
			++nodes;
			int won = move.board().won();

			if(won == turn)
				return won;
			else if(won == 0)
				outcome = 0;
			else if(outcome == 3 - turn || outcome == -4)
				outcome = won;
		}
		return outcome;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movzbl 0x19(%rdi), %r15d
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x8(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0xac78
pushq $0x3
popq %r13
subl %r15d, %r13d
pushq $-0x4
popq %r12
xorl %r14d, %r14d
cmpb $0x23, 0x38(%rsp)
jg 0x191f9
incl (%rbx)
leaq 0x10(%rsp), %rdi
callq 0xae70
movsbl %al, %eax
cmpl %r15d, %eax
je 0x191f6
cmpl $-0x4, %r12d
movl %r12d, %ebp
cmovel %eax, %ebp
cmpl %r13d, %r12d
cmovel %eax, %ebp
testb %al, %al
cmovel %r14d, %ebp
leaq 0x8(%rsp), %rdi
callq 0xad32
movl %ebp, %r12d
jmp 0x191b6
movl %r15d, %r12d
leaq 0x40(%rsp), %rdi
callq 0xb368
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19217
leaq 0x40(%rsp), %rdi
movq %rax, %rbx
callq 0xb368
movq %rbx, %rdi
callq 0x4590