// File: tewalds[P]morat/havannah/board.h
// Function: Morat::Havannah::Board::update_hash(Morat::MoveValid const&, Morat::Side)
void update_hash(const MoveValid & pos, Side side) {
		int turn = side.to_i();
		if(num_moves_ > unique_depth){ //simple update, no rotations/symmetry
			hash.update(0, 3 * pos.xy + turn);
			return;
		}

		//mirror is simply flip x,y
		int x = pos.x - size_r_m1_,
		    y = pos.y - size_r_m1_,
		    z = y - x;

//x,y; y,z; z,-x; -x,-y; -y,-z; -z,x
//y,x; z,y; -x,z; -y,-x; -z,-y; x,-z

		hash.update(0,  3*xyc( x,  y) + turn);
		hash.update(1,  3*xyc( y,  z) + turn);
		hash.update(2,  3*xyc( z, -x) + turn);
		hash.update(3,  3*xyc(-x, -y) + turn);
		hash.update(4,  3*xyc(-y, -z) + turn);
		hash.update(5,  3*xyc(-z,  x) + turn);
		hash.update(6,  3*xyc( y,  x) + turn);
		hash.update(7,  3*xyc( z,  y) + turn);
		hash.update(8,  3*xyc(-x,  z) + turn);
		hash.update(9,  3*xyc(-y, -x) + turn);
		hash.update(10, 3*xyc(-z, -y) + turn);
		hash.update(11, 3*xyc( x, -z) + turn);
	}

// Assembly:
subq $0x98, %rsp
movb %dl, %al
movb %al, 0x97(%rsp)
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x97(%rsp), %rdi
callq 0x20210
movb %al, %cl
movq 0x68(%rsp), %rax
movsbl %cl, %ecx
movl %ecx, 0x7c(%rsp)
movswl 0x6(%rax), %eax
cmpl $0x5, %eax
jle 0x1fa89
movq 0x68(%rsp), %rdi
addq $0x28, %rdi
movq 0x80(%rsp), %rax
movswl 0x2(%rax), %eax
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
xorl %esi, %esi
callq 0x20220
jmp 0x1fd45
movq 0x68(%rsp), %rdi
movq 0x80(%rsp), %rax
movsbl 0x1(%rax), %eax
movsbl 0x2(%rdi), %ecx
subl %ecx, %eax
movl %eax, 0x78(%rsp)
movq 0x80(%rsp), %rax
movsbl (%rax), %eax
movsbl 0x2(%rdi), %ecx
subl %ecx, %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
subl 0x78(%rsp), %eax
movl %eax, 0x70(%rsp)
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x8(%rsp)
movl 0x78(%rsp), %esi
movl 0x74(%rsp), %edx
callq 0x20250
movq 0x8(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
xorl %esi, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x10(%rsp)
movl 0x74(%rsp), %esi
movl 0x70(%rsp), %edx
callq 0x20250
movq 0x10(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x1, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x18(%rsp)
movl 0x70(%rsp), %esi
xorl %edx, %edx
subl 0x78(%rsp), %edx
callq 0x20250
movq 0x18(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x2, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x20(%rsp)
xorl %esi, %esi
subl 0x78(%rsp), %esi
xorl %edx, %edx
subl 0x74(%rsp), %edx
callq 0x20250
movq 0x20(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x3, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x28(%rsp)
xorl %esi, %esi
subl 0x74(%rsp), %esi
xorl %edx, %edx
subl 0x70(%rsp), %edx
callq 0x20250
movq 0x28(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x4, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x30(%rsp)
xorl %esi, %esi
subl 0x70(%rsp), %esi
movl 0x78(%rsp), %edx
callq 0x20250
movq 0x30(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x5, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x38(%rsp)
movl 0x74(%rsp), %esi
movl 0x78(%rsp), %edx
callq 0x20250
movq 0x38(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x6, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x40(%rsp)
movl 0x70(%rsp), %esi
movl 0x74(%rsp), %edx
callq 0x20250
movq 0x40(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x7, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x48(%rsp)
xorl %esi, %esi
subl 0x78(%rsp), %esi
movl 0x70(%rsp), %edx
callq 0x20250
movq 0x48(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x8, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x50(%rsp)
xorl %esi, %esi
subl 0x74(%rsp), %esi
xorl %edx, %edx
subl 0x78(%rsp), %edx
callq 0x20250
movq 0x50(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0x9, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x58(%rsp)
xorl %esi, %esi
subl 0x70(%rsp), %esi
xorl %edx, %edx
subl 0x74(%rsp), %edx
callq 0x20250
movq 0x58(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0xa, %esi
callq 0x20220
movq 0x68(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x60(%rsp)
movl 0x78(%rsp), %esi
xorl %edx, %edx
subl 0x70(%rsp), %edx
callq 0x20250
movq 0x60(%rsp), %rdi
imull $0x3, %eax, %edx
addl 0x7c(%rsp), %edx
movl $0xb, %esi
callq 0x20220
addq $0x98, %rsp
retq
nopl (%rax)