// File: /workspace/github_cpp_makefile_star2_O3/tewalds[P]pentagod/./move.h
// Function: Move::rotate(unsigned int) const
Move rotate(unsigned int other) const {
		if(l < 0) //special
			return *this;

		assert(o <= 8 && other <= 8);

		if(other == o) //already the correct orientation
			return *this;

		if(o == 8 && other < 8) //unoriented move, default to board
			return Move(l, r, other);

		if(o == 8 || other == 8){ // oriented moves are incompatible with unoriented boards
			printf("rotate %s to %i\n", to_s(true).c_str(), other);
			assert(o <= 7 && other <= 7);
		}

/*
flip move:  Move(y, x, (9-r)&7). Works because (9-1)&7=8&7=0, (9-1)&7=8&7=0
rotate cw:  Move(5-y,   x, (r+2)&7)
rotate 180: Move(5-x, 5-y, (r+4)&7)
rotate ccw: Move(  y, 5-x, (r+6)&7)
*/

		unsigned int c = o*8 + other;
		switch(c){
		case  0: case 011: case 022: case 033: case 044: case 055: case 066: case 077: return *this;
		                                                                                    //Move(  x(),   y(),       r, other);
		case 01: case 012: case 023: case 030: case 047: case 054: case 065: case 076: return Move(5-y(),   x(), (r+2)&7, other);
		case 02: case 013: case 020: case 031: case 046: case 057: case 064: case 075: return Move(5-x(), 5-y(), (r+4)&7, other);
		case 03: case 010: case 021: case 032: case 045: case 056: case 067: case 074: return Move(  y(), 5-x(), (r+6)&7, other);

		case 04: case 015: case 026: case 037: case 040: case 051: case 062: case 073: return Move(  y(),   x(), ( 9-r)&7, other);
		case 07: case 014: case 025: case 036: case 041: case 052: case 063: case 070: return Move(5-x(),   y(), (11-r)&7, other);
		case 06: case 017: case 024: case 035: case 042: case 053: case 060: case 071: return Move(5-y(), 5-x(), (13-r)&7, other);
		case 05: case 016: case 027: case 034: case 043: case 050: case 061: case 072: return Move(  x(), 5-y(), (15-r)&7, other);
		default:
			printf("o: %i, other: %i, c: %#4x", o, other, c);
			assert(false && "Bad orientation?!?");
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movzwl (%rdi), %eax
movq %rdi, %r14
movsbl %al, %ecx
testw %cx, %cx
js 0x93f6
movl %esi, %ebx
cmpl $0x8, %esi
ja 0x9691
cmpw $0x9000, %ax            # imm = 0x9000
jae 0x9691
movzwl %ax, %edx
shrl $0xc, %edx
cmpl %ebx, %edx
jne 0x9410
movl (%r14), %eax
movl %eax, %ecx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
movzwl %ax, %eax
orl %ecx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpw $0x8, %dx
setne %sil
cmpl $0x8, %ebx
setae %dil
orb %sil, %dil
jne 0x9437
andl $0xf00, %eax            # imm = 0xF00
shll $0xc, %ebx
orl %eax, %ebx
movswl %cx, %eax
xorl %ecx, %ecx
orl %ebx, %eax
jmp 0x9401
cmpw $0x8, %dx
setne %cl
cmpl $0x8, %ebx
setne %dl
testb %cl, %dl
jne 0x9496
movl $0x1, %edx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x999a
movq (%r15), %rsi
leaq 0x1f5d9(%rip), %rdi     # 0x28a3e
movl %ebx, %edx
xorl %eax, %eax
callq 0x4040
movq (%r15), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9480
callq 0x42b0
cmpl $0x7, %ebx
ja 0x96b0
movzwl (%r14), %eax
testw %ax, %ax
js 0x96b0
movzwl %ax, %esi
shrl $0xc, %esi
leal (%rbx,%rsi,8), %ecx
cmpb $0x3f, %cl
ja 0x96cf
movzbl %cl, %ecx
leaq 0x1eb8e(%rip), %rdx     # 0x28040
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movsbl %al, %edx
movl $0xffff, %edi           # imm = 0xFFFF
addl $0x200, %eax            # imm = 0x200
imull $-0x2b, %edx, %ecx
movl %ecx, %esi
andl %edi, %ecx
shrl $0x8, %esi
shrl $0xf, %ecx
addb %sil, %cl
imull $0x2b, %edx, %esi
movl %esi, %r8d
andl %edi, %esi
shrl $0x8, %r8d
shrl $0xf, %esi
addb %r8b, %sil
movzbl %sil, %esi
addl %esi, %esi
leal (%rsi,%rsi,2), %esi
subb %sil, %dl
movzbl %dl, %edx
addl %edx, %edx
leal (%rdx,%rdx,2), %edx
addb %cl, %dl
addb $0x5, %dl
movzbl %dl, %ecx
jmp 0x959e
movsbl %al, %ecx
movl %eax, %esi
addl %eax, %eax
movl $0x100, %edi            # imm = 0x100
shll $0xc, %ebx
imull $0x2b, %ecx, %ecx
leal (%rax,%rax,2), %eax
movzwl %cx, %edx
shrl $0x8, %ecx
shrl $0xf, %edx
addb %cl, %dl
movzbl %dl, %ecx
movl $0x700, %edx            # imm = 0x700
imull $-0x23, %ecx, %ecx
andl %edx, %esi
subl %esi, %edi
andl %edx, %edi
addb %al, %cl
movzbl %cl, %eax
orl %eax, %edi
jmp 0x9686
movl $0x23, %ecx
shll $0xc, %ebx
subl %eax, %ecx
andl $0x700, %eax            # imm = 0x700
movzbl %cl, %ecx
orl %eax, %ecx
orl %ecx, %ebx
xorl $0x400, %ebx            # imm = 0x400
jmp 0x9688
movsbl %al, %ecx
addl $0x600, %eax            # imm = 0x600
imull $0x2b, %ecx, %edx
movzwl %dx, %esi
shrl $0x8, %edx
shrl $0xf, %esi
addb %dl, %sil
movzbl %sil, %edx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,2), %esi
subb %cl, %sil
movzbl %sil, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
addb %cl, %dl
addb $0x1e, %dl
movzbl %dl, %ecx
andl $0x700, %eax            # imm = 0x700
shll $0xc, %ebx
orl %ecx, %eax
orl %eax, %ebx
jmp 0x9688
movsbl %al, %ecx
movl $0x300, %edi            # imm = 0x300
shll $0xc, %ebx
imull $0x2b, %ecx, %edx
movzwl %dx, %esi
shrl $0x8, %edx
shrl $0xf, %esi
addb %dl, %sil
movzbl %sil, %edx
movl %ecx, %esi
addl %edx, %edx
leal (%rdx,%rdx,2), %edx
subb %dl, %sil
movl $0x700, %edx            # imm = 0x700
addb %sil, %sil
andl %edx, %eax
subb %sil, %cl
subl %eax, %edi
addb $0x5, %cl
andl %edx, %edi
movzbl %cl, %ecx
jmp 0x9684
movsbl %al, %ecx
shll $0xc, %ebx
imull $0x2b, %ecx, %edx
movzwl %dx, %esi
shrl $0x8, %edx
shrl $0xf, %esi
addb %dl, %sil
movzbl %sil, %edx
movl $0x700, %esi            # imm = 0x700
addl %edx, %edx
andl %esi, %eax
leal (%rdx,%rdx,2), %edx
subb %dl, %cl
subb %dl, %cl
addb $0x1e, %cl
movzbl %cl, %ecx
orl %eax, %ecx
orl %ecx, %ebx
xorl %esi, %ebx
jmp 0x9688
movsbl %al, %edx
movl $0xffff, %edi           # imm = 0xFFFF
shll $0xc, %ebx
imull $-0x2b, %edx, %ecx
movl %ecx, %esi
andl %edi, %ecx
shrl $0x8, %esi
shrl $0xf, %ecx
addb %sil, %cl
imull $0x2b, %edx, %esi
movl %esi, %r8d
andl %edi, %esi
shrl $0x8, %r8d
movl $0x500, %edi            # imm = 0x500
shrl $0xf, %esi
addb %r8b, %sil
movzbl %sil, %esi
addl %esi, %esi
leal (%rsi,%rsi,2), %esi
subb %dl, %sil
movzbl %sil, %edx
movl $0x700, %esi            # imm = 0x700
addl %edx, %edx
andl %esi, %eax
leal (%rdx,%rdx,2), %edx
subl %eax, %edi
andl %esi, %edi
addb %cl, %dl
addb $0x23, %dl
movzbl %dl, %ecx
orl %ecx, %edi
orl %edi, %ebx
xorl %ecx, %ecx
movl %ebx, %eax
jmp 0x9401
leaq 0x1f362(%rip), %rdi     # 0x289fa
leaq 0x1f370(%rip), %rsi     # 0x28a0f
leaq 0x1f372(%rip), %rcx     # 0x28a18
movl $0x5d, %edx
callq 0x41b0
leaq 0x1f398(%rip), %rdi     # 0x28a4f
leaq 0x1f351(%rip), %rsi     # 0x28a0f
leaq 0x1f353(%rip), %rcx     # 0x28a18
movl $0x67, %edx
callq 0x41b0
leaq 0x1f38e(%rip), %rdi     # 0x28a64
movl %ebx, %edx
xorl %eax, %eax
callq 0x4040
leaq 0x1f398(%rip), %rdi     # 0x28a7e
leaq 0x1f322(%rip), %rsi     # 0x28a0f
leaq 0x1f324(%rip), %rcx     # 0x28a18
movl $0x7f, %edx
callq 0x41b0