// File: tewalds[P]morat/havannah/board.h
// Function: Morat::Havannah::Board::test_outcome(Morat::MoveValid const&, Morat::Side) const
Outcome test_outcome(const MoveValid & pos, Side turn) const {
		if(test_local(pos, turn)){
			Cell testcell = cells_[find_group(pos.xy)];
			int numgroups = 0;
			auto it = neighbors_small(pos);
			for (const MoveValid *i = it.begin(), *e = it.end(); i < e; i++) {
				if(i->on_board() && turn == get(i->xy)){
					const Cell * g = & cells_[find_group(i->xy)];
					testcell.corner |= g->corner;
					testcell.edge   |= g->edge;
					testcell.size   += g->size;
					i++; //skip the next one
					numgroups++;
				}
			}

			if(testcell.numcorners() >= 2 || testcell.numedges() >= 3 || (check_rings && numgroups >= 2 && testcell.size >= 6 && checkring_o1(pos, turn)))
				return +turn;
		}

		if(num_moves_+1 == num_cells_)
			return Outcome::DRAW;

		return Outcome::UNKNOWN;
	}

// Assembly:
subq $0x98, %rsp
movb %dl, %al
movb %al, 0x96(%rsp)
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq 0x88(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movq 0x80(%rsp), %rsi
movb 0x96(%rsp), %al
movb %al, 0x7f(%rsp)
movzbl 0x7f(%rsp), %edx
callq 0x2b9a0
testb $0x1, %al
jne 0x2a043
jmp 0x2a248
movq 0x20(%rsp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rax
movswl 0x2(%rax), %esi
callq 0x20080
movq 0x18(%rsp), %rdi
movslq %eax, %rsi
callq 0x20300
movq 0x20(%rsp), %rdi
movq (%rax), %rcx
movq %rcx, 0x68(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
movl $0x0, 0x64(%rsp)
movq 0x80(%rsp), %rsi
callq 0x1fe50
movq %rax, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x11810
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x11820
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
jae 0x2a1c3
movq 0x48(%rsp), %rdi
callq 0x11830
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x17(%rsp)
jne 0x2a0ee
jmp 0x2a11b
movq 0x20(%rsp), %rdi
movq 0x48(%rsp), %rax
movswl 0x2(%rax), %esi
callq 0x1fed0
movb %al, 0x3f(%rsp)
leaq 0x96(%rsp), %rdi
leaq 0x3f(%rsp), %rsi
callq 0x1fe90
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x2a128
jmp 0x2a1ae
movq 0x20(%rsp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rax
movswl 0x2(%rax), %esi
callq 0x20080
movq 0x8(%rsp), %rdi
movslq %eax, %rsi
callq 0x20300
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x4(%rax), %ecx
movzbl 0x6c(%rsp), %eax
orl %ecx, %eax
movb %al, 0x6c(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x5(%rax), %ecx
movzbl 0x6d(%rsp), %eax
orl %ecx, %eax
movb %al, 0x6d(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x1(%rax), %ecx
movzbl 0x69(%rsp), %eax
addl %ecx, %eax
movb %al, 0x69(%rsp)
movq 0x48(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x48(%rsp)
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x2a1b0
movq 0x48(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x48(%rsp)
jmp 0x2a0c5
leaq 0x68(%rsp), %rdi
callq 0x20180
cmpl $0x2, %eax
jge 0x2a228
leaq 0x68(%rsp), %rdi
callq 0x20130
cmpl $0x3, %eax
jge 0x2a228
movq 0x20(%rsp), %rax
testb $0x1, 0x98(%rax)
je 0x2a246
cmpl $0x2, 0x64(%rsp)
jl 0x2a246
movzbl 0x69(%rsp), %eax
cmpl $0x6, %eax
jl 0x2a246
movq 0x20(%rsp), %rdi
movq 0x80(%rsp), %rsi
movb 0x96(%rsp), %al
movb %al, 0x2f(%rsp)
movzbl 0x2f(%rsp), %edx
callq 0x38af0
testb $0x1, %al
jne 0x2a228
jmp 0x2a246
movb 0x96(%rsp), %al
movb %al, 0x2e(%rsp)
movzbl 0x2e(%rsp), %edi
callq 0x20150
movb %al, 0x97(%rsp)
jmp 0x2a27e
jmp 0x2a248
movq 0x20(%rsp), %rcx
movswl 0x6(%rcx), %eax
addl $0x1, %eax
movswl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jne 0x2a26e
leaq 0x45280(%rip), %rax     # 0x6f4e3
movb (%rax), %al
movb %al, 0x97(%rsp)
jmp 0x2a27e
leaq 0x4526b(%rip), %rax     # 0x6f4e0
movb (%rax), %al
movb %al, 0x97(%rsp)
movb 0x97(%rsp), %al
addq $0x98, %rsp
retq
nopl (%rax)