// File: /workspace/github_cpp_makefile_star2_O3/tewalds[P]morat/hex/../lib/lbdist.h
// Function: Morat::LBDistsBase<Morat::Hex::LBDists, Morat::Hex::Board>::flood(int, Morat::Side, bool)
void flood(int edge, Side player, bool crossvcs){
		Side otherplayer = ~player;

		MoveDist cur;
		while(Q.pop(cur)){
			const MoveValid* neighbors = board->neighbors(cur.pos);
			for(int i = 5; i <= 7; i++){
				int nd = (cur.dir + i) % 6;
				MoveDist next(neighbors[nd], cur.dist, nd);

				if(board->on_board(next.pos)){
					Side colour = board->get(next.pos);

					if(colour == otherplayer)
						continue;

					if(colour == Side::NONE){
						if(!crossvcs && //forms a vc
						   board->get(neighbors[(nd + 5) % 6]) == otherplayer &&
						   board->get(neighbors[(nd + 7) % 6]) == otherplayer)
							continue;

						next.dist++;
					}

					if( dist(edge, player, next.pos) > next.dist){
						dist(edge, player, next.pos) = next.dist;
						Q.push(next);
					}
				}
			}
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r12d
movq %rdi, %r14
leaq 0x4(%rsp), %rsi
addq $0x2710, %rdi           # imm = 0x2710
movl %ecx, (%rsp)
movl %edx, %ebp
movl $0xffff78fc, (%rsi)     # imm = 0xFFFF78FC
movq %rdi, 0x10(%rsp)
callq 0x187ce
testb %al, %al
je 0x187bf
movslq %r12d, %rax
movsbq %bpl, %rcx
movb $0x3, %r13b
imulq $0x1388, %rax, %rax     # imm = 0x1388
decq %rcx
subb %bpl, %r13b
imulq $0x9c4, %rcx, %r12      # imm = 0x9C4
addq %r14, %rax
addq %rax, %r12
movswq 0x6(%rsp), %rax
movq 0x9c58(%r14), %rcx
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ebp
xorl %edi, %edi
leaq (%rax,%rax,8), %rax
leal 0x1(%rbp), %esi
addl $0x5, %edx
shlq $0x3, %rax
addq 0x38(%rcx), %rax
leal (%rdx,%rdi), %ecx
movslq %ecx, %r8
imulq $0x2aaaaaab, %r8, %rcx  # imm = 0x2AAAAAAB
movq %rcx, %r9
shrq $0x3f, %r9
shrq $0x20, %rcx
addl %r9d, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %r8d
movslq %r8d, %rcx
movl (%rax,%rcx,4), %r9d
movl %r9d, %ecx
shrl $0x10, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x1879d
movq 0x9c58(%r14), %r11
movswq %cx, %r10
movq %r10, %rcx
shlq $0x4, %rcx
movq 0x10(%r11), %r11
movb (%r11,%rcx), %r15b
cmpb %r13b, %r15b
je 0x1879d
leaq 0x1dccb(%rip), %rbx     # 0x363a9
movl %ebp, %ecx
cmpb (%rbx), %r15b
setne %r15b
jne 0x186eb
movl %esi, %ecx
orb (%rsp), %r15b
jne 0x18743
leal 0x5(%r8), %ecx
leal -0x1(%r8), %r15d
cmpl $0x6, %ecx
cmovbl %ecx, %r15d
movl %esi, %ecx
movswq 0x2(%rax,%r15,4), %r15
shlq $0x4, %r15
cmpb %r13b, (%r11,%r15)
jne 0x18743
leal 0x7(%r8), %ecx
movzbl %cl, %ecx
imull $0xab, %ecx, %r15d
shrl $0xa, %r15d
addl %r15d, %r15d
leal (%r15,%r15,2), %r15d
subb %r15b, %cl
movzbl %cl, %ecx
movswq 0x2(%rax,%rcx,4), %r15
movl %esi, %ecx
shlq $0x4, %r15
cmpb %r13b, (%r11,%r15)
je 0x1879d
cmpl %ecx, (%r12,%r10,4)
jle 0x1879d
leal 0x3(%rcx), %ebx
testl %ecx, %ecx
leaq (%r12,%r10,4), %r10
movl %ecx, %r11d
cmovnsl %ecx, %ebx
andl $-0x4, %ebx
movl %ecx, (%r10)
subl %ebx, %r11d
movslq %r11d, %r10
movslq 0x9c40(%r14,%r10,4), %r11
leal 0x1(%r11), %r15d
leaq (%r11,%r11,2), %r11
movl %r15d, 0x9c40(%r14,%r10,4)
imulq $0x1d4c, %r10, %r10     # imm = 0x1D4C
addq 0x10(%rsp), %r10
movl %r9d, (%r10,%r11,4)
movl %ecx, 0x4(%r10,%r11,4)
movl %r8d, 0x8(%r10,%r11,4)
incl 0x9c54(%r14)
incl %edi
cmpl $0x3, %edi
jne 0x18678
movq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x187ce
testb %al, %al
jne 0x1864f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq