// File: tewalds[P]morat/pentago/board.h
// Function: Morat::Pentago::Board::move(Morat::Pentago::Move)
bool move(Move m){
		assert(outcome_ < 0);

		//TODO: only call valid_move if the move didn't come from an iterator?
		if(!valid_move(m))
			return false;

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

		sides[to_play_.to_i()] |= xybits[m.l];

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

		num_moves_++;
		to_play_ = ~to_play_;
		outcome_ = Outcome::UNDEF;
		cached_score = default_score;
		cached_hash = 0;

		return true;
	}

// Assembly:
subq $0x58, %rsp
movw %si, %ax
movw %ax, 0x55(%rsp)
movq %rdi, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
addq $0x1a, %rax
movq %rax, 0x30(%rsp)
movb $0x0, 0x46(%rsp)
leaq 0x47(%rsp), %rdi
leaq 0x46(%rsp), %rsi
callq 0x14160
movq 0x30(%rsp), %rdi
leaq 0x47(%rsp), %rsi
callq 0x163d0
testb $0x1, %al
jne 0x14cbd
jmp 0x14cbf
jmp 0x14cde
leaq 0x2f5e5(%rip), %rdi     # 0x442ab
leaq 0x2f5eb(%rip), %rsi     # 0x442b8
movl $0xa3, %edx
leaq 0x2f5ef(%rip), %rcx     # 0x442c8
callq 0x52d0
movq 0x28(%rsp), %rdi
leaq 0x55(%rsp), %rsi
callq 0x16410
testb $0x1, %al
jne 0x14cfb
movb $0x0, 0x57(%rsp)
jmp 0x14eab
movl $0xffffffff, 0x40(%rsp) # imm = 0xFFFFFFFF
leaq 0x55(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x15970
testb $0x1, %al
jne 0x14d18
jmp 0x14d4f
movq 0x28(%rsp), %rsi
movq %rsi, %rdi
addq $0x8, %rdi
addq $0x10, %rsi
callq 0x16470
movq 0x28(%rsp), %rdi
movb $0x1, 0x3f(%rsp)
addq $0x19, %rdi
leaq 0x3f(%rsp), %rsi
callq 0x164b0
movb $0x1, 0x57(%rsp)
jmp 0x14eab
movq 0x28(%rsp), %rdi
movsbq 0x55(%rsp), %rcx
leaq 0x31abf(%rip), %rax     # 0x46820
movq (%rax,%rcx,8), %rax
movq %rax, 0x20(%rsp)
addq $0x19, %rdi
callq 0x16220
movq 0x20(%rsp), %rdx
movb %al, %cl
movq 0x28(%rsp), %rax
movsbq %cl, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
leaq 0x55(%rsp), %rdi
callq 0x164d0
cmpl $0x0, %eax
jne 0x14df7
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x55(%rsp), %rdi
callq 0x16550
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x164f0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
leaq 0x55(%rsp), %rdi
callq 0x16550
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x164f0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0x14e50
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
leaq 0x55(%rsp), %rdi
callq 0x16550
movq (%rsp), %rdi
movl %eax, %esi
callq 0x16570
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x55(%rsp), %rdi
callq 0x16550
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x16570
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rcx
orq 0x10(%rax), %rcx
movq %rcx, (%rax)
movb 0x18(%rax), %cl
addb $0x1, %cl
movb %cl, 0x18(%rax)
movb 0x19(%rax), %al
movb %al, 0x3d(%rsp)
movzbl 0x3d(%rsp), %edi
callq 0x165d0
movb %al, %cl
movq 0x28(%rsp), %rax
movb %cl, 0x3e(%rsp)
movb 0x3e(%rsp), %cl
movb %cl, 0x19(%rax)
leaq 0x46984(%rip), %rcx     # 0x5b817
movb (%rcx), %cl
movb %cl, 0x1a(%rax)
movw $0xdead, 0x1c(%rax)     # imm = 0xDEAD
movq $0x0, 0x20(%rax)
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)