LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tewalds[P]pentagod/string.cpp
// Function: explode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
vecstr explode(const string & str, const string & sep){
	vecstr ret;
	string::size_type old = 0, pos = 0;
	while((pos = str.find_first_of(sep, old)) != string::npos){
		ret.push_back(str.substr(old, pos - old));
		old = pos + sep.length();
	}
	ret.push_back(str.substr(old));
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%rdx), %rsi
movq 0x8(%rdx), %rcx
xorl %ebp, %ebp
movq %r14, %rdi
xorl %edx, %edx
callq 0x4470
cmpq $-0x1, %rax
je 0x159ea
movq %rax, %r12
xorl %ebp, %ebp
leaq 0x8(%rsp), %r13
movq %r12, %rcx
subq %rbp, %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4300
movq %rbx, %rdi
movq %r13, %rsi
callq 0x15b2e
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x159c9
callq 0x42b0
movq (%r15), %rsi
movq 0x8(%r15), %rcx
movq %r12, %rbp
addq %rcx, %rbp
movq %r14, %rdi
movq %rbp, %rdx
callq 0x4470
movq %rax, %r12
cmpq $-0x1, %rax
jne 0x15996
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq $-0x1, %rcx
callq 0x4300
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x15b2e
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15a21
callq 0x42b0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x15a55
jmp 0x15a43
movq %rax, %r14
jmp 0x15a5f
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15a5f
callq 0x42b0
movq %rbx, %rdi
callq 0x8f38
movq %r14, %rdi
callq 0x45b0
// File: /workspace/github_cpp_makefile_star2_O1/tewalds[P]pentagod/board.cpp
// Function: Board::Board(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Board::Board(string str) {
	sides[1] = 0;
	sides[2] = 0;
	nummoves = 0;
	outcome = -4;
	cached_score = default_score;
	cached_hash = 0;

	assert(str.length() == 36);
	int moved[3] = {0,0,0};
	for(int i = 0; i < 36; i++){
		int8_t side = str[i] - '0';
		assert(side >= 0 && side <= 2);

		if(side > 0){
			nummoves++;
			sides[side] |= xybits[i];
			moved[side]++;
		}
	}
	assert(moved[1] == moved[2] || moved[1] == moved[2] + 1); //even number of moves per player
	sides[0] = sides[1] | sides[2];
	to_play = (nummoves % 2) + 1;
}

// Assembly:
subq $0x18, %rsp
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0x8(%rdi)
movb $0x0, 0x18(%rdi)
movb $-0x4, 0x1a(%rdi)
movw $0xdead, 0x1c(%rdi)     # imm = 0xDEAD
movq $0x0, 0x20(%rdi)
cmpq $0x24, 0x8(%rsi)
jne 0x15e53
movl $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq (%rsi), %rax
movb 0x18(%rdi), %cl
xorl %edx, %edx
leaq 0x15206(%rip), %rsi     # 0x2afd0
movb (%rax), %r8b
addb $-0x30, %r8b
cmpb $0x3, %r8b
jae 0x15e34
testb %r8b, %r8b
je 0x15df2
incb %cl
movb %cl, 0x18(%rdi)
movq (%rdx,%rsi), %r9
movzbl %r8b, %r8d
orq %r9, (%rdi,%r8,8)
incl 0x8(%rsp,%r8,4)
addq $0x8, %rdx
incq %rax
cmpq $0x120, %rdx            # imm = 0x120
jne 0x15dca
movl 0xc(%rsp), %eax
movl 0x10(%rsp), %ecx
cmpl %ecx, %eax
sete %dl
incl %ecx
cmpl %ecx, %eax
sete %al
orb %dl, %al
je 0x15e72
movq 0x10(%rdi), %rax
orq 0x8(%rdi), %rax
movq %rax, (%rdi)
movb 0x18(%rdi), %al
andb $0x1, %al
incb %al
movb %al, 0x19(%rdi)
addq $0x18, %rsp
retq
leaq 0x163f7(%rip), %rdi     # 0x2c232
leaq 0x163d1(%rip), %rsi     # 0x2c213
leaq 0x163d4(%rip), %rcx     # 0x2c21d
movl $0x28, %edx
callq 0x41b0
leaq 0x163a6(%rip), %rdi     # 0x2c200
leaq 0x163b2(%rip), %rsi     # 0x2c213
leaq 0x163b5(%rip), %rcx     # 0x2c21d
movl $0x24, %edx
callq 0x41b0
leaq 0x163d0(%rip), %rdi     # 0x2c249
leaq 0x16393(%rip), %rsi     # 0x2c213
leaq 0x16396(%rip), %rcx     # 0x2c21d
movl $0x30, %edx
callq 0x41b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tewalds[P]pentagod/board.cpp
// Function: Board::state[abi:cxx11]() const
string Board::state() const {
	string s;
	for(int y = 0; y < 6; y++)
		for(int x = 0; x < 6; x++)
			s += to_str((int)get(x, y));
	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x8(%rsp)
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0x1510b(%rip), %rbp     # 0x2afd0
xorl %eax, %eax
movl $0x1, %r12d
leaq 0x18(%rsp), %r15
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
movq (%rbp,%r13,8), %rax
xorl %esi, %esi
testq %rax, 0x10(%r14)
setne %sil
addl %esi, %esi
testq %rax, 0x8(%r14)
cmovnel %r12d, %esi
movq %r15, %rdi
callq 0xd56b
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x40b0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x15f21
callq 0x42b0
incq %r13
cmpq $0x6, %r13
jne 0x15eda
movq 0x10(%rsp), %rax
incq %rax
addq $0x30, %rbp
cmpq $0x6, %rax
jne 0x15ed2
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x15f6a
callq 0x42b0
jmp 0x15f6a
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rbx), %rdi
cmpq %rax, %rdi
je 0x15f7c
callq 0x42b0
movq %r14, %rdi
callq 0x45b0
// File: /workspace/github_cpp_makefile_star2_O1/tewalds[P]pentagod/board.cpp
// Function: Board::won_str[abi:cxx11]() const
string Board::won_str() const {
	switch(won()){
		case -3: return "none";
		case -2: return "black_or_draw";
		case -1: return "white_or_draw";
		case 0:
		case 3:  return "draw";
		case 1:  return "white";
		case 2:  return "black";
	}
	return "unknown";
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpb $-0x4, 0x1a(%rsi)
jne 0x1716a
movq %r14, %rdi
callq 0xdab0
movb %al, 0x1a(%r14)
movzbl 0x1a(%r14), %eax
cmpl $0xfc, %eax
jg 0x171ab
cmpl $0x3, %eax
ja 0x1721c
movl %eax, %eax
leaq 0x13da8(%rip), %rcx     # 0x2af30
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x12e64(%rip), %rsi     # 0x2a003
leaq 0x12e61(%rip), %rdx     # 0x2a007
jmp 0x17248
cmpl $0xff, %eax
je 0x171d7
cmpl $0xfe, %eax
je 0x17233
cmpl $0xfd, %eax
jne 0x1721c
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x128d6(%rip), %rsi     # 0x29aa4
leaq 0x128d3(%rip), %rdx     # 0x29aa8
jmp 0x17248
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x12e15(%rip), %rsi     # 0x29ffa
leaq 0x12e1b(%rip), %rdx     # 0x2a007
jmp 0x17248
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x12357(%rip), %rsi     # 0x29553
leaq 0x12355(%rip), %rdx     # 0x29558
jmp 0x17248
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1236c(%rip), %rsi     # 0x2957f
leaq 0x1236a(%rip), %rdx     # 0x29584
jmp 0x17248
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x12872(%rip), %rsi     # 0x29a9c
leaq 0x12872(%rip), %rdx     # 0x29aa3
jmp 0x17248
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x12dab(%rip), %rsi     # 0x29fec
leaq 0x12db1(%rip), %rdx     # 0x29ff9
movq %rbx, %rdi
callq 0xa874
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tewalds[P]pentagod/board.cpp
// Function: gen_lookup3to2(unsigned int, unsigned int)
uint16_t * gen_lookup3to2(unsigned int inbits, unsigned int outbits){
	uint16_t * lookup = new uint16_t[1 << (inbits*2)];
	for(uint16_t i = 0; i < (1 << inbits);  i++){ //top bits
		for(uint16_t j = 0; j < (1 << inbits); j++){ //bottom bits
			uint16_t bi = i, bj = j, val = 0, exp = 1;
			while(bi || bj){
				if((bi & 1) && (bj & 1)){ //not base 3 if both are set
					val = 0;
					break;
				}
				val += exp * (2*(bi & 1) + (bj & 1));
				exp *= 3;
				bi >>= 1;
				bj >>= 1;
			}
			assert(val < (1 << outbits));
			lookup[(i << inbits) + j] = val;
//			printf("%5X, ", val);
//			if(j % 16 == 15)
//				printf("\n");
		}
	}
	return lookup;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
leal (%rbx,%rbx), %eax
movl $0x2, %ecx
shlxl %eax, %ecx, %edi
callq 0x4030
movq %rbx, (%rsp)
cmpl $0x1f, %ebx
je 0x1735c
movl $0x1, %edx
movq (%rsp), %rcx
shlxl %ecx, %edx, %ecx
shlxl %ebp, %edx, %edx
xorl %edi, %edi
xorl %esi, %esi
movq (%rsp), %r8
shlxl %r8d, %edi, %edi
xorl %r9d, %r9d
xorl %r8d, %r8d
movl %esi, %r10d
orw %r8w, %r10w
je 0x17328
movl $0x1, %r11d
xorl %r10d, %r10d
movl %r8d, %ebp
movl %esi, %r14d
movl %r14d, %r15d
andw $0x1, %r15w
sete %r13b
movl %ebp, %r12d
andw $0x1, %r12w
sete %bl
orb %r13b, %bl
cmpb $0x1, %bl
jne 0x17328
movzwl %r15w, %ebx
movzwl %r12w, %r15d
leal (%r15,%rbx,2), %ebx
imull %r11d, %ebx
leal (%r11,%r11,2), %r11d
addl %ebx, %r10d
movzwl %r14w, %ebx
shrl %ebx
movzwl %bp, %r15d
shrl %r15d
cmpw $0x2, %r14w
setae %r14b
cmpw $0x2, %bp
setae %bpl
orb %r14b, %bpl
movl %r15d, %ebp
movl %ebx, %r14d
jne 0x172c7
jmp 0x1732b
xorl %r10d, %r10d
movzwl %r10w, %r11d
cmpl %r11d, %edx
jle 0x1736b
addl %edi, %r9d
movslq %r9d, %r9
movw %r10w, (%rax,%r9,2)
incl %r8d
movzwl %r8w, %r9d
cmpl %r9d, %ecx
jg 0x172af
incl %esi
movzwl %si, %edi
cmpl %edi, %ecx
jg 0x172a0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14f5a(%rip), %rdi     # 0x2c2cc
leaq 0x14e9a(%rip), %rsi     # 0x2c213
leaq 0x14f61(%rip), %rcx     # 0x2c2e1
movl $0xe1, %edx
callq 0x41b0
// File: /workspace/github_cpp_makefile_star2_O1/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 %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq %rdx, %rdi
callq 0x973a
cmpq %r14, %rax
je 0x173c5
movq %rbx, %rdi
callq 0x973a
leaq 0x14f5e(%rip), %rdi     # 0x2c316
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4040
cmpq $0x0, 0x20(%rbx)
jne 0x173d4
movq %rbx, %rdi
callq 0x973a
cmpb %bpl, 0x1b(%rbx)
je 0x17402
movzbl %bpl, %r15d
cmpq $0x0, 0x20(%rbx)
jne 0x173ed
movq %rbx, %rdi
callq 0x973a
movzbl 0x1b(%rbx), %edx
leaq 0x14f3c(%rip), %rdi     # 0x2c334
movl %r15d, %esi
xorl %eax, %eax
callq 0x4040
movq %rbx, %rdi
callq 0x973a
cmpq %r14, %rax
jne 0x17424
cmpq $0x0, 0x20(%rbx)
jne 0x1741e
movq %rbx, %rdi
callq 0x973a
cmpb %bpl, 0x1b(%rbx)
je 0x1745c
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x15f84
movq (%r15), %rsi
leaq 0x14f0f(%rip), %rdi     # 0x2c352
xorl %eax, %eax
callq 0x4040
movq (%r15), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1745c
callq 0x42b0
movq %rbx, %rdi
callq 0x973a
cmpq %r14, %rax
jne 0x17489
cmpq $0x0, 0x20(%rbx)
jne 0x17478
movq %rbx, %rdi
callq 0x973a
cmpb %bpl, 0x1b(%rbx)
jne 0x174a8
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14ec5(%rip), %rdi     # 0x2c355
leaq 0x14d7c(%rip), %rsi     # 0x2c213
leaq 0x14ec5(%rip), %rcx     # 0x2c363
movl $0xf4, %edx
callq 0x41b0
leaq 0x14edb(%rip), %rdi     # 0x2c38a
leaq 0x14d5d(%rip), %rsi     # 0x2c213
leaq 0x14ea6(%rip), %rcx     # 0x2c363
movl $0xf5, %edx
callq 0x41b0
// File: /workspace/github_cpp_makefile_star2_O1/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
movl %esi, (%rsp)
movq %rdi, 0x8(%rsp)
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0x19(%rsp)
vmovaps %xmm0, 0x10(%rsp)
movw $0xfc01, 0x29(%rsp)     # imm = 0xFC01
movb $0x8, 0x2b(%rsp)
movw $0xdead, 0x2c(%rsp)     # imm = 0xDEAD
movq $0x0, 0x30(%rsp)
testq %rcx, %rcx
je 0x175f3
movq %rcx, %r14
movq %rdx, %r15
shlq $0x5, %r14
addq %rdx, %r14
leaq 0x48(%rsp), %rbp
leaq 0x38(%rsp), %r12
leaq 0x4(%rsp), %r13
leaq 0x10(%rsp), %rbx
movq %rbp, 0x38(%rsp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x8df0
movq %r13, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0xd110
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x9240
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x175ea
callq 0x42b0
addq $0x20, %r15
cmpq %r14, %r15
jne 0x175a8
movzbl (%rsp), %esi
leaq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x1738a
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17627
callq 0x42b0
movq %rbx, %rdi
callq 0x45b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
movl %ecx, %ebp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %rdx, %rsi
movl %ecx, %edx
callq 0xd110
movq %r12, %rdi
movl %ebx, %esi
callq 0x9370
leaq 0x8(%rsp), %rcx
movw %ax, (%rcx)
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0xd110
movq %r12, %rdi
movl %ebp, %esi
callq 0x9370
leaq 0xc(%rsp), %r12
movw %ax, (%r12)
movq %r14, 0x10(%rsp)
movq (%r14), %rsi
movq (%r15), %rcx
leaq 0x133ba(%rip), %rdi     # 0x2c4da
movl %ebx, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x4040
leaq 0x18(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x99d8
movq (%r13), %r13
movzwl (%r12), %r12d
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x99d8
shrl $0xc, %r12d
leaq 0x48(%rsp), %r14
movq -0x10(%r14), %rcx
movzwl 0x8(%rsp), %r8d
shrl $0xc, %r8d
leaq 0x13377(%rip), %rdi     # 0x2c4ed
movq %r13, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x4040
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x19191
callq 0x42b0
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x191a4
callq 0x42b0
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0xd110
movzwl 0xc(%rsp), %eax
cmpw (%r12), %ax
jne 0x191f0
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movl %ebx, %edx
callq 0xd110
movzwl 0x8(%rsp), %eax
cmpw (%r15), %ax
jne 0x1920f
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1330e(%rip), %rdi     # 0x2c505
leaq 0x13319(%rip), %rsi     # 0x2c517
leaq 0x1331b(%rip), %rcx     # 0x2c520
movl $0xc, %edx
callq 0x41b0
leaq 0x13345(%rip), %rdi     # 0x2c55b
leaq 0x132fa(%rip), %rsi     # 0x2c517
leaq 0x132fc(%rip), %rcx     # 0x2c520
movl $0xd, %edx
callq 0x41b0
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19244
callq 0x42b0
movq %rbx, %rdi
callq 0x45b0
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0xd110
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0xd110
movzwl (%r12), %esi
shrl $0xc, %esi
movq %r15, %rdi
callq 0x9370
movw %ax, (%rsp)
movzwl (%r15), %esi
shrl $0xc, %esi
movq %r12, %rdi
callq 0x9370
movw %ax, 0x4(%rsp)
cmpw %ax, (%r15)
jne 0x192c4
movzwl 0x8(%rsp), %eax
cmpw (%rsp), %ax
je 0x1938a
movq (%r14), %r14
leaq 0x10(%rsp), %r15
movq %rsp, %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x99d8
movq (%r15), %r15
movq (%rbx), %rbx
leaq 0x38(%rsp), %rdi
leaq 0x4(%rsp), %rsi
movl $0x1, %edx
callq 0x99d8
leaq 0x48(%rsp), %r12
movq -0x10(%r12), %r8
leaq 0x13266(%rip), %rdi     # 0x2c56d
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4040
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x19326
callq 0x42b0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19339
callq 0x42b0
vxorps %xmm0, %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
vmovups %xmm0, 0x9(%rsi)
vmovaps %xmm0, (%rsi)
movw $0xfc01, 0x19(%rsi)     # imm = 0xFC01
movb $0x8, 0x1b(%rsi)
movw $0xdead, 0x1c(%rsi)     # imm = 0xDEAD
movq $0x0, 0x20(%rsi)
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movl $0x1, %edx
callq 0x15f84
movq (%rbx), %rdi
callq 0x4490
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x1938a
callq 0x42b0
movzwl 0xc(%rsp), %eax
cmpw 0x4(%rsp), %ax
jne 0x193ad
movzwl 0x8(%rsp), %eax
cmpw (%rsp), %ax
jne 0x193cc
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x131cf(%rip), %rdi     # 0x2c583
leaq 0x1315c(%rip), %rsi     # 0x2c517
leaq 0x131ca(%rip), %rcx     # 0x2c58c
movl $0x19, %edx
callq 0x41b0
leaq 0x131ea(%rip), %rdi     # 0x2c5bd
leaq 0x1313d(%rip), %rsi     # 0x2c517
leaq 0x131ab(%rip), %rcx     # 0x2c58c
movl $0x1a, %edx
callq 0x41b0
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19401
callq 0x42b0
movq %rbx, %rdi
callq 0x45b0
// File: /workspace/github_cpp_makefile_star2_O1/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 %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x20(%rdx), %rcx
leaq 0x10(%rcx), %rax
xorl %r13d, %r13d
movl $0x0, %r12d
cmpq $0x2, %rcx
cmovaeq %rax, %r12
jb 0x1b28c
movzwl 0x6(%rcx), %ecx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %r13
cmpq %r13, %r12
je 0x1b380
movzbl 0x19(%r14), %eax
movl %eax, 0xc(%rsp)
leaq 0xf0(%r15), %rax
movq %rax, 0x20(%rsp)
addq $0x14, %r12
leaq 0x70(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0xd8(%r15), %rax
movq %rax, 0x10(%rsp)
movq 0xc(%r12), %rax
cmpq $0x2, %rax
jb 0x1b36b
cmpw $0x0, 0x6(%rax)
je 0x1b36b
leaq -0x14(%r12), %rbp
movb 0x12(%rbx), %al
testb %al, %al
js 0x1b310
movl 0x70(%r15), %ecx
cmpq %rcx, -0xc(%r12)
jbe 0x1b310
cmpb 0xc(%rsp), %al
jne 0x1b32e
movsbl -0x2(%r12), %ecx
testl %ecx, %ecx
sete %dl
cmpl 0xc(%rsp), %ecx
sete %cl
orb %dl, %cl
jne 0x1b32e
testb %al, %al
jns 0x1b355
cmpb $0x0, -0x2(%r12)
movq 0x18(%rsp), %rax
cmovsq 0x10(%rsp), %rax
movl (%rax), %eax
cmpq %rax, -0xc(%r12)
jbe 0x1b355
movl (%r12), %esi
movq %r14, %rdi
callq 0x9240
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x1b24e
movq %r14, %rdi
movq %r12, %rsi
callq 0x20424
jmp 0x1b36b
movq %rbp, %rdi
movq 0x20(%rsp), %rsi
callq 0x1f2c2
movl %eax, %eax
subq %rax, 0xd0(%r15)
leaq 0x28(%r12), %rax
addq $0x14, %r12
cmpq %r13, %r12
movq %rax, %r12
jne 0x1b2c3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1ce52
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x58(%rax)
leaq 0xaa0(%rbx), %rdi
callq 0x1e3ea
movl $0x1, %ecx
movl $0x6, %eax
lock
cmpxchgl %ecx, 0xa80(%rbx)
movl 0xa80(%rbx), %eax
cmpl $0x1, %eax
jne 0x1ce54
popq %rbx
retq
leaq 0xf8f2(%rip), %rdi      # 0x2c74d
leaq 0xf90c(%rip), %rsi      # 0x2c76e
leaq 0xfa80(%rip), %rcx      # 0x2c8e9
movl $0xdb, %edx
callq 0x41b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0x10(%rdi)
vmovups %xmm0, 0x19(%rdi)
movw $0xfc01, %ax            # imm = 0xFC01
movw %ax, 0x29(%rdi)
movb $0x8, %cl
movb %cl, 0x2b(%rdi)
movw $0xdead, %dx            # imm = 0xDEAD
movw %dx, 0x2c(%rdi)
xorl %esi, %esi
movq %rsi, 0x30(%rdi)
leaq 0x19b7b(%rip), %rdi     # 0x36a78
movq %rdi, (%rbx)
vmovups %xmm0, 0x80(%rbx)
vmovups %xmm0, 0x89(%rbx)
movw %ax, 0x99(%rbx)
movb %cl, 0x9b(%rbx)
movw %dx, 0x9c(%rbx)
vmovups %xmm0, 0xa0(%rbx)
vmovups %xmm0, 0xaa(%rbx)
movl $0x8efc00fd, 0xba(%rbx) # imm = 0x8EFC00FD
movw $0x8efc, 0xc0(%rbx)     # imm = 0x8EFC
movq %rsi, 0xc8(%rbx)
leaq 0xf0(%rbx), %r14
movq %r14, %rdi
callq 0x1f18e
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0xa88(%rbx)
movq $0x0, 0xa98(%rbx)
leaq 0xaa0(%rbx), %r12
movq %r12, %rdi
callq 0xd8b0
movl $0x1, 0xaf8(%rbx)
movl $0x0, 0xafc(%rbx)
leaq 0xb00(%rbx), %rdi
callq 0xd8b0
movl $0x1, %eax
movl %eax, 0xb58(%rbx)
xorl %ecx, %ecx
movl %ecx, 0xb5c(%rbx)
movq %rcx, 0xd0(%rbx)
movq %rcx, 0xe0(%rbx)
movl $0x5, 0xd8(%rbx)
movq %rcx, 0xb60(%rbx)
movw $0x100, 0x48(%rbx)      # imm = 0x100
movb $0x0, 0x38(%rbx)
movl %eax, 0x3c(%rbx)
movq $0x3e800000, 0x40(%rbx) # imm = 0x3E800000
movl $0x3f800000, 0x4c(%rbx) # imm = 0x3F800000
vbroadcastss 0xf656(%rip), %xmm0 # 0x2c650
movb $0x1, %dl
movb %dl, 0x50(%rbx)
vmovlps %xmm0, 0x54(%rbx)
movl $0xa, 0x5c(%rbx)
movb %dl, 0x60(%rbx)
movabsq $0x100000001, %rsi      # imm = 0x100000001
movq %rsi, 0x64(%rbx)
movb %dl, 0x6c(%rbx)
movabsq $0x1000186a0, %rdx      # imm = 0x1000186A0
movq %rdx, 0x70(%rbx)
movl %ecx, 0x78(%rbx)
movl %eax, 0xa80(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r15
movq %r12, %rdi
callq 0xd7d6
jmp 0x1d052
movq %rax, %r15
leaq 0xa88(%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1d066
callq 0x42b0
movq %r14, %rdi
callq 0x1f220
jmp 0x1d073
movq %rax, %r15
addq $0xa8, %rbx
movq %rbx, %rdi
callq 0x1f26a
movq %r15, %rdi
callq 0x45b0
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdi, %rbx
leaq 0x199df(%rip), %rax     # 0x36a78
movq %rax, (%rdi)
callq 0x1ce14
movl $0x0, 0x3c(%rbx)
movq %rbx, %rdi
callq 0x1d120
leaq 0xa8(%rbx), %r14
leaq 0xf0(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1f2c2
vxorps %xmm0, %xmm0, %xmm0
vxorps %xmm1, %xmm1, %xmm1
movq %r15, %rdi
callq 0x1e4a0
leaq 0xb00(%rbx), %rdi
callq 0xd7d6
leaq 0xaa0(%rbx), %rdi
callq 0xd7d6
movq 0xa88(%rbx), %rdi
testq %rdi, %rdi
je 0x1d102
callq 0x42b0
movq %r15, %rdi
callq 0x1f220
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1f26a
movq %rax, %rdi
callq 0x8d6e
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1d24c
movq %rdi, %rbx
movl $0x2, %ecx
movl $0x1, %eax
lock
cmpxchgl %ecx, 0xa80(%rdi)
jne 0x1d26b
leaq 0xaa0(%rbx), %r14
movq %r14, %rdi
callq 0x1e3ea
movq 0xa88(%rbx), %rax
movq 0xa90(%rbx), %rdx
cmpq %rax, %rdx
je 0x1d1ad
movl $0x1, %ebp
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
addq $0x10, %rdi
callq 0x20720
movl %ebp, %ecx
movq 0xa88(%rbx), %rax
movq 0xa90(%rbx), %rdx
movq %rdx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %ebp
cmpq %rcx, %rsi
ja 0x1d17f
cmpq %rax, %rdx
je 0x1d1b9
movq %rax, 0xa90(%rbx)
movl $0x1, 0xa80(%rbx)
movl 0x3c(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x1f364
leaq 0xb00(%rbx), %rdi
movl 0x3c(%rbx), %esi
callq 0x1f364
cmpl $0x0, 0x3c(%rbx)
jle 0x1d23f
leaq 0xa88(%rbx), %r14
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movl $0xf8, %edi
callq 0x42e0
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1f3a8
movq %r12, 0x8(%rsp)
movq 0xa90(%rbx), %rsi
cmpq 0xa98(%rbx), %rsi
je 0x1d22d
movq %r12, (%rsi)
addq $0x8, 0xa90(%rbx)
jmp 0x1d238
movq %r14, %rdi
movq %r15, %rdx
callq 0x20c7c
incl %ebp
cmpl 0x3c(%rbx), %ebp
jl 0x1d1f3
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf4fa(%rip), %rdi      # 0x2c74d
leaq 0xf514(%rip), %rsi      # 0x2c76e
leaq 0xf6c7(%rip), %rcx      # 0x2c928
movl $0xe6, %edx
callq 0x41b0
leaq 0xf6d6(%rip), %rdi      # 0x2c948
leaq 0xf4f5(%rip), %rsi      # 0x2c76e
leaq 0xf6a8(%rip), %rcx      # 0x2c928
movl $0xe9, %edx
callq 0x41b0
movq %rax, %rbx
movq %r12, %rdi
callq 0x42b0
movq %rbx, %rdi
callq 0x45b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdi, %rbx
movl 0xa80(%rsi), %eax
leaq 0x10(%rdi), %rcx
movq %rcx, (%rdi)
cmpq $0x6, %rax
ja 0x1d33d
leaq 0xf39c(%rip), %rcx      # 0x2c690
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xf564(%rip), %rsi      # 0x2c868
leaq 0xf572(%rip), %rdx      # 0x2c87d
jmp 0x1d37b
leaq 0xf595(%rip), %rsi      # 0x2c8a9
leaq 0xf597(%rip), %rdx      # 0x2c8b2
jmp 0x1d37b
leaq 0xf55a(%rip), %rsi      # 0x2c87e
leaq 0xf56e(%rip), %rdx      # 0x2c899
jmp 0x1d37b
leaq 0xf566(%rip), %rsi      # 0x2c89a
leaq 0xf56d(%rip), %rdx      # 0x2c8a8
jmp 0x1d37b
leaq 0xf58d(%rip), %rsi      # 0x2c8d1
leaq 0xf59d(%rip), %rdx      # 0x2c8e8
jmp 0x1d37b
leaq 0xf408(%rip), %rsi      # 0x2c75c
leaq 0xf412(%rip), %rdx      # 0x2c76d
jmp 0x1d37b
leaq 0xf54f(%rip), %rsi      # 0x2c8b3
leaq 0xf555(%rip), %rdx      # 0x2c8c0
jmp 0x1d37b
leaq 0xf54d(%rip), %rsi      # 0x2c8c1
leaq 0xf555(%rip), %rdx      # 0x2c8d0
movq %rbx, %rdi
callq 0xa874
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1d3aa
movq %rdi, %rbx
movb %sil, 0x38(%rdi)
callq 0x1ce14
cmpb $0x1, 0x38(%rbx)
jne 0x1d3aa
movq %rbx, %rdi
popq %rbx
jmp 0x1ce74
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1ce14
leaq 0xa8(%rbx), %r15
leaq 0xf0(%rbx), %rsi
movq %r15, %rdi
callq 0x1f2c2
movl %eax, %eax
subq %rax, 0xd0(%rbx)
vxorps %xmm0, %xmm0, %xmm0
movq %rsp, %rsi
vmovaps %xmm0, (%rsi)
movl $0xfd0000, 0x10(%rsi)   # imm = 0xFD0000
movw $0x8efc, %ax            # imm = 0x8EFC
movw %ax, 0x14(%rsi)
movw %ax, 0x18(%rsi)
movq $0x0, 0x20(%rsi)
movq %r15, %rdi
callq 0x1f57c
movq %rsp, %rdi
callq 0x1f26a
movl 0x68(%rbx), %eax
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)
movq %rbx, %rdi
vzeroupper
callq 0x1d120
cmpb $0x1, 0x38(%rbx)
jne 0x1d46c
movq %rbx, %rdi
callq 0x1ce74
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1f26a
movq %rbx, %rdi
callq 0x45b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
movq 0xa88(%rdi), %rcx
movq 0xa90(%rdi), %rdx
subq %rcx, %rdx
je 0x1dc5c
sarq $0x3, %rdx
xorl %esi, %esi
xorl %eax, %eax
xorl %edi, %edi
movq (%rcx,%rsi,8), %r8
addl 0xa0(%r8), %eax
addq 0xa8(%r8), %rdi
incq %rsi
movl %esi, %r8d
cmpq %r8, %rdx
ja 0x1dc37
vcvtusi2sd %rdi, %xmm0, %xmm0
jmp 0x1dc62
xorl %eax, %eax
vxorpd %xmm0, %xmm0, %xmm0
testl %eax, %eax
vcvtusi2sd %eax, %xmm1, %xmm1
sete %al
vdivsd %xmm1, %xmm0, %xmm0
kmovd %eax, %k1
vxorpd %xmm1, %xmm1, %xmm1
vmovsd %xmm1, %xmm0, %xmm0 {%k1}
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rsi, %r14
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movb 0x99(%rsi), %bpl
addq $0xa8, %r14
movq %rsp, %r15
movq 0x20(%r14), %rax
cmpq $0x2, %rax
jb 0x1dd4f
cmpw $0x0, 0x6(%rax)
je 0x1dd4f
movsbl %bpl, %edx
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x1dda8
movw %ax, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x1dcef
movl (%rsp), %eax
movl %eax, (%rsi)
addq $0x4, 0x8(%rbx)
jmp 0x1dcfa
movq %rbx, %rdi
movq %r15, %rdx
callq 0xdb72
movq 0x20(%r14), %rax
leaq 0x10(%rax), %rcx
cmpq $0x2, %rax
movl $0x0, %r14d
cmovaeq %rcx, %r14
movzwl (%rsp), %edx
cmpq $0x2, %rax
jb 0x1dd28
movzwl 0x6(%rax), %esi
leaq (%rsi,%rsi,4), %rsi
leaq (%rcx,%rsi,8), %rsi
jmp 0x1dd2a
xorl %esi, %esi
cmpq %rsi, %r14
je 0x1dd3c
cmpw %dx, 0x14(%r14)
je 0x1dd3f
addq $0x28, %r14
jmp 0x1dd14
xorl %r14d, %r14d
movb $0x3, %al
subb %bpl, %al
movl %eax, %ebp
testq %r14, %r14
jne 0x1dcae
movq 0x8(%rbx), %rsi
cmpq (%rbx), %rsi
jne 0x1dd7f
movw $0x8efe, 0x4(%rsp)      # imm = 0x8EFE
cmpq 0x10(%rbx), %rsi
je 0x1dd72
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, 0x8(%rbx)
jmp 0x1dd7f
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x20daa
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1dd8f
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1dd9f
callq 0x42b0
movq %r14, %rdi
callq 0x45b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %rax, (%rdi)
leaq 0xb8b7(%rip), %rdx      # 0x29ae3
movq %rdx, %rsi
callq 0xa874
addq $0xa8, %r14
movq (%r15), %rax
movq 0x8(%r15), %rcx
cmpq %rcx, %rax
je 0x1e2a4
movq 0x20(%r14), %rdx
leaq 0x10(%rdx), %rsi
cmpq $0x2, %rdx
movl $0x0, %r14d
cmovaeq %rsi, %r14
movzwl (%rax), %edi
cmpq $0x2, %rdx
jb 0x1e275
movzwl 0x6(%rdx), %r8d
leaq (%r8,%r8,4), %r8
leaq (%rsi,%r8,8), %r8
jmp 0x1e278
xorl %r8d, %r8d
cmpq %r8, %r14
je 0x1e28a
cmpw %di, 0x14(%r14)
je 0x1e28d
addq $0x28, %r14
jmp 0x1e260
xorl %r14d, %r14d
testq %r14, %r14
sete %dl
je 0x1e392
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x1e247
jmp 0x1e2a6
xorl %edx, %edx
testb %dl, %dl
jne 0x1e392
movq 0x20(%r14), %rcx
leaq 0x10(%rcx), %rax
xorl %r13d, %r13d
movl $0x0, %r14d
cmpq $0x2, %rcx
cmovaeq %rax, %r14
jb 0x1e2d5
movzwl 0x6(%rcx), %ecx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %r13
cmpq %r13, %r14
je 0x1e392
leaq 0x10(%rsp), %rbp
leaq 0x28(%rsp), %r15
leaq 0xb7f3(%rip), %r12      # 0x29ae2
cmpb $-0x3, 0x14(%r14)
je 0x1e385
movq %r15, %rdi
movq %r14, %rsi
callq 0x1f64e
movq %r15, %rdi
movq %r12, %rsi
callq 0x4610
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1e331
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1e33a
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x40b0
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x1e371
callq 0x42b0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1e385
callq 0x42b0
addq $0x28, %r14
cmpq %r13, %r14
jne 0x1e2ef
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x1e3ba
movq %rax, %r14
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x1e3ba
callq 0x42b0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1e3d3
callq 0x42b0
jmp 0x1e3d3
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x20(%rsp), %rdi
je 0x1e3e2
callq 0x42b0
movq %r14, %rdi
callq 0x45b0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x20780
movq %rdi, %rbx
addq $0x10, %rdi
callq 0x20824
movb $0x1, 0x8(%rbx)
leaq 0x11e(%rip), %rdx       # 0x20890
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
popq %rbx
jmp 0x45f0
leaq 0xc4e7(%rip), %rdi      # 0x2cc6e
leaq 0xc44d(%rip), %rsi      # 0x2cbdb
leaq 0xc4eb(%rip), %rcx      # 0x2cc80
movl $0x5d, %edx
callq 0x41b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, %rbx
movq 0x40(%rdi), %rax
cmpb $0x1, 0x48(%rax)
jne 0x20ec9
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x4500
vcvtsi2sdq (%r14), %xmm0, %xmm0
vcvtsi2sdq 0x8(%r14), %xmm1, %xmm1
vdivsd 0x8152(%rip), %xmm1, %xmm1 # 0x29008
vaddsd %xmm0, %xmm1, %xmm0
vmovsd %xmm0, 0xd8(%rbx)
movl $0x0, 0x70(%rbx)
movq 0x40(%rbx), %rax
vxorpd %xmm0, %xmm0, %xmm0
vmovupd %ymm0, 0x50(%rbx)
lock
incq 0xb0(%rax)
movq 0x40(%rbx), %rdx
movq 0xa0(%rdx), %rax
leaq 0x10(%rsp), %rsi
movq %rax, 0x20(%rsi)
vmovupd 0x80(%rdx), %ymm0
vmovupd %ymm0, (%rsi)
addq $0xa8, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
vzeroupper
callq 0x20fea
movq 0x40(%rbx), %rax
movzbl 0x99(%rax), %ecx
movl $0x2, %edx
subq %rcx, %rdx
shlq $0x4, %rdx
leaq 0x50(%rbx,%rdx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x20f3e
lock
addq %rdx, 0xa8(%rax)
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x20f4f
lock
addq %rcx, 0xb0(%rax)
movq 0x40(%rbx), %rax
cmpb $0x1, 0x48(%rax)
jne 0x20fe1
vmovupd 0xd8(%rbx), %xmm0
vmovupd 0xe0(%rbx), %xmm1
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)
movq %rsp, %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x4500
vcvtsi2sdq (%r14), %xmm2, %xmm0
vcvtsi2sdq 0x8(%r14), %xmm2, %xmm1
vdivsd 0x8043(%rip), %xmm1, %xmm1 # 0x29008
vaddsd %xmm0, %xmm1, %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_O1/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
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
vcvtusi2sdq 0x8(%rsi), %xmm0, %xmm0
callq 0x4240
movq 0x40(%r14), %rax
vmovss 0x4c(%rax), %xmm3
cmpb $0x1, 0x49(%rax)
jne 0x2143c
vcvtusi2ssq (%r15), %xmm1, %xmm1
vmulss 0xb22b(%rip), %xmm1, %xmm1 # 0x2c658
vcvtusi2ssq 0x8(%r15), %xmm2, %xmm2
vdivss %xmm2, %xmm1, %xmm1
vmulss %xmm1, %xmm3, %xmm3
movq 0x20(%r15), %rcx
leaq 0x10(%rcx), %rax
xorl %r13d, %r13d
movl $0x0, %r15d
cmpq $0x2, %rcx
cmovaeq %rax, %r15
jb 0x21463
movzwl 0x6(%rcx), %ecx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %r13
cmpq %r13, %r15
je 0x21547
vcvtsd2ss %xmm0, %xmm0, %xmm0
vmovss %xmm0, 0x14(%rsp)
vmovss 0xbc3a(%rip), %xmm2     # 0x2d0b8
xorl %r12d, %r12d
leaq 0xbc28(%rip), %rbp      # 0x2d0b0
vmovss %xmm3, 0x8(%rsp)
movsbl 0x12(%r15), %eax
testl %eax, %eax
js 0x214ae
cmpl %ebx, %eax
je 0x2154c
xorl %ecx, %ecx
testb %al, %al
sete %cl
vmovss (%rbp,%rcx,4), %xmm4
jmp 0x2152c
movq 0x40(%r14), %rax
movzbl 0x50(%rax), %esi
vmovss 0x58(%rax), %xmm0
movq %r15, %rdi
vmovss %xmm2, 0xc(%rsp)
callq 0x21d66
vmovss 0xc(%rsp), %xmm2
vmovaps %xmm0, %xmm4
vmovss 0x8(%rsp), %xmm3
vucomiss 0xbbdb(%rip), %xmm3     # 0x2d0bc
jbe 0x2152c
movq 0x8(%r15), %rax
incq %rax
vcvtusi2ss %rax, %xmm5, %xmm0
vmovss 0x14(%rsp), %xmm1
vdivss %xmm0, %xmm1, %xmm0
vucomiss 0xbbba(%rip), %xmm0     # 0x2d0bc
jb 0x2150a
vsqrtss %xmm0, %xmm0, %xmm0
jmp 0x21527
vmovss %xmm4, 0x10(%rsp)
callq 0x45e0
vmovss 0x10(%rsp), %xmm4
vmovss 0xc(%rsp), %xmm2
vmovss 0x8(%rsp), %xmm3
vfmadd231ss %xmm0, %xmm3, %xmm4 # xmm4 = (xmm3 * xmm0) + xmm4
vucomiss %xmm2, %xmm4
vmaxss %xmm2, %xmm4, %xmm2
cmovaq %r15, %r12
addq $0x28, %r15
cmpq %r13, %r15
jne 0x2148e
jmp 0x2154f
xorl %r12d, %r12d
jmp 0x2154f
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_O1/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
cmpb $-0x4, 0x1a(%r14)
jne 0x21aef
movq %r14, %rdi
callq 0xdab0
movb %al, 0x1a(%r14)
movsbl 0x1a(%r14), %ebp
testl %ebp, %ebp
jns 0x21b05
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21e8c
jmp 0x21adc
leaq 0x98(%rbx), %rdi
movzbl 0x18(%r14), %esi
callq 0x21d00
addq $0x50, %rbx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x21cd0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tewalds[P]pentagod/./agentmcts.h
// Function: AgentMCTS::Node::value(bool, float)
float value(bool knowledge, float fpurgency){
			float val = fpurgency;
			float expnum = exp.num();

			if(expnum > 0)
				val = exp.avg();

			if(knowledge && know != 0){
				if(expnum <= 1)
					val += 0.01f * know;
				else if(expnum < 1000) //knowledge is only useful with little experience
					val += 0.01f * know / sqrt(expnum);
			}

			return val;
		}

// Assembly:
vmovaps %xmm0, %xmm1
movq 0x8(%rdi), %rax
vcvtusi2ss %rax, %xmm2, %xmm0
testq %rax, %rax
sete %cl
vcvtusi2ssq (%rdi), %xmm2, %xmm2
vmulss 0xa8d0(%rip), %xmm2, %xmm2 # 0x2c658
vdivss %xmm0, %xmm2, %xmm2
kmovd %ecx, %k1
vmovss %xmm1, %xmm2, %xmm2 {%k1}
testl %esi, %esi
je 0x21e0f
movzwl 0x10(%rdi), %ecx
testw %cx, %cx
je 0x21e0f
cmpq $0x1, %rax
ja 0x21dbb
movswl %cx, %eax
vcvtsi2ss %eax, %xmm3, %xmm0
vfmadd231ss 0xb307(%rip), %xmm0, %xmm2 # xmm2 = (xmm0 * mem) + xmm2
jmp 0x21e0f
cmpq $0x3e7, %rax            # imm = 0x3E7
ja 0x21e0f
movswl %cx, %eax
vcvtsi2ss %eax, %xmm3, %xmm1
vmulss 0xb2ee(%rip), %xmm1, %xmm3 # 0x2d0c0
vxorps %xmm1, %xmm1, %xmm1
vucomiss %xmm1, %xmm0
jb 0x21de2
vsqrtss %xmm0, %xmm0, %xmm0
jmp 0x21e07
subq $0x28, %rsp
vmovaps %xmm2, 0x10(%rsp)
vmovss %xmm3, 0xc(%rsp)
callq 0x45e0
vmovss 0xc(%rsp), %xmm3
vmovaps 0x10(%rsp), %xmm2
addq $0x28, %rsp
vdivss %xmm0, %xmm3, %xmm0
vaddss %xmm0, %xmm2, %xmm2
vmovaps %xmm2, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %esi, %esi
leaq 0x92d9(%rip), %r8       # 0x2b100
leaq 0x92c2(%rip), %r9       # 0x2b0f0
xorl %edx, %edx
movq (%r8,%rsi,8), %r10
movq %r10, %r11
andq %rax, %r11
sete %bl
andq %rcx, %r10
setne %bpl
orb %bl, %bpl
je 0x21e6b
testq %r10, %r10
setne %bl
testq %r11, %r11
sete %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x21e75
popcntq %r10, %r10
subw (%r9,%r10,2), %dx
jmp 0x21e75
popcntq %r11, %r10
addw (%r9,%r10,2), %dx
incq %rsi
cmpq $0x20, %rsi
jne 0x21e30
movl %edx, %eax
negl %eax
cmpb $0x1, 0x19(%rdi)
cmovnel %edx, %eax
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movq (%rdi), %rax
notq %rax
movb $0x24, %cl
bzhiq %rcx, %rax, %rdx
movq (%rsi), %rcx
movq %rdx, %rax
movq %rcx, %rdx
shrq $0x11, %rdx
xorq %rcx, %rdx
movq %rdx, %r8
shlq $0x1f, %r8
xorq %rdx, %r8
movq %r8, %rcx
shrq $0x8, %rcx
xorq %r8, %rcx
movq %rcx, %rdx
andq %rax, %rdx
cmoveq %rax, %rdx
blsrq %rdx, %rax
jne 0x21e9c
movq %rcx, (%rsi)
movzbl 0x19(%rdi), %eax
orq %rdx, (%rdi,%rax,8)
movq %rcx, %rdx
shrq $0x24, %rdx
movabsq $0x4000000000, %rsi     # imm = 0x4000000000
andq %rcx, %rsi
movq %rsi, %rcx
shrq $0x26, %rcx
xorl %r8d, %r8d
testq %rsi, %rsi
sete %r8b
andb $0x3, %dl
movzbl %dl, %edx
leal (%rdx,%rdx,8), %edx
movl $0xff, %esi
shlxq %rdx, %rsi, %rdx
leaq 0x2(,%r8,4), %rsi
leaq 0x2(,%rcx,4), %rcx
vmovdqu 0x8(%rdi), %xmm0
vpbroadcastq %rdx, %xmm1
vpand %xmm1, %xmm0, %xmm2
vpbroadcastq %rsi, %xmm3
vpsrlq %xmm3, %xmm2, %xmm3
vpbroadcastq %rcx, %xmm4
vpsllq %xmm4, %xmm2, %xmm2
vpor %xmm2, %xmm3, %xmm2
vpternlogq $0xe2, %xmm0, %xmm1, %xmm2
vmovdqu %xmm2, 0x8(%rdi)
movq 0x10(%rdi), %rcx
orq 0x8(%rdi), %rcx
movq %rcx, (%rdi)
incb 0x18(%rdi)
movb $0x3, %cl
subb %al, %cl
movb %cl, 0x19(%rdi)
movl $0xdead08fc, 0x1a(%rdi) # imm = 0xDEAD08FC
movq $0x0, 0x20(%rdi)
movb $0x1, %al
retq
nop