// File: tewalds[P]pentagod/./board.h
// Function: Board::move(Move)
bool move(Move mo){
		assert(outcome < 0);

		orient();
		Move m = mo.rotate(orientation);

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

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

		sides[to_play] |= 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];

		nummoves++;
		to_play = 3 - to_play;
		outcome = -4;
		cached_score = default_score;
		cached_hash = 0;
		orientation = 8; //start with an unoriented board


//		if(m != mo)
//			logerr(mo.to_s(true) + " -> " + m.to_s(true) + " -> " + to_str(orient()) + "\n");

		return true;
	}

// Assembly:
subq $0x48, %rsp
movl %esi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movsbl 0x1a(%rax), %eax
cmpl $0x0, %eax
jge 0xd062
jmp 0xd081
leaq 0x30932(%rip), %rdi     # 0x3d99b
leaq 0x30937(%rip), %rsi     # 0x3d9a7
movl $0x9d, %edx
leaq 0x30935(%rip), %rcx     # 0x3d9b1
callq 0x4250
movq 0x28(%rsp), %rdi
callq 0xd270
movq 0x28(%rsp), %rax
movzbl 0x1b(%rax), %esi
leaq 0x40(%rsp), %rdi
callq 0xd2b0
movq 0x28(%rsp), %rdi
movw %ax, 0x34(%rsp)
leaq 0x34(%rsp), %rsi
callq 0xd7f0
testb $0x1, %al
jne 0xd0c0
movb $0x0, 0x47(%rsp)
jmp 0xd23d
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
leaq 0x34(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xd870
testb $0x1, %al
jne 0xd0dd
jmp 0xd105
movq 0x28(%rsp), %rsi
movq %rsi, %rdi
addq $0x8, %rdi
addq $0x10, %rsi
callq 0xd8a0
movq 0x28(%rsp), %rax
movb $0x1, 0x19(%rax)
movb $0x1, 0x47(%rsp)
jmp 0xd23d
movq 0x28(%rsp), %rax
movw 0x34(%rsp), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
movslq %ecx, %rdx
leaq 0x31e1c(%rip), %rcx     # 0x3ef40
movq (%rcx,%rdx,8), %rdx
movzbl 0x19(%rax), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
leaq 0x34(%rsp), %rdi
callq 0xd8e0
cmpl $0x0, %eax
jne 0xd1a0
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
leaq 0x34(%rsp), %rdi
callq 0xd960
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0xd900
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
leaq 0x34(%rsp), %rdi
callq 0xd960
movq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0xd900
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0xd1fb
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x34(%rsp), %rdi
callq 0xd960
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0xd980
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x34(%rsp), %rdi
callq 0xd960
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0xd980
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)
movzbl 0x19(%rax), %edx
movl $0x3, %ecx
subl %edx, %ecx
movb %cl, 0x19(%rax)
movb $-0x4, 0x1a(%rax)
movw $0xdead, 0x1c(%rax)     # imm = 0xDEAD
movq $0x0, 0x20(%rax)
movb $0x8, 0x1b(%rax)
movb $0x1, 0x47(%rsp)
movb 0x47(%rsp), %al
andb $0x1, %al
addq $0x48, %rsp
retq
nopl (%rax,%rax)