// File: tewalds[P]morat/havannah/lbdist.h
// Function: Morat::Havannah::LBDists::isdraw()
Outcome isdraw() {
		Outcome outcome = Outcome::DRAW;  // assume neither side can win
		for(int y = 0; y < board->lines(); y++) {
			for(int x = board->line_start(y); x < board->line_end(y); x++) {
				MoveValid pos(x, y, board->xy(x, y));

				if(board->encirclable(pos, Side::P1) || get(pos.xy, Side::P1) < maxdist-5)
					outcome |= Outcome::P1; // P1 can win
				if(board->encirclable(pos, Side::P2) || get(pos.xy, Side::P2) < maxdist-5)
					outcome |= Outcome::P2; // P2 can win

				if(outcome == Outcome::DRAW2) // both can win
					return Outcome::UNKNOWN;  // so nothing is known
			}
		}
		return -outcome; // this isn't certainty, so negate
	}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x45789(%rip), %rax     # 0x6f4e3
movb (%rax), %al
movb %al, 0x37(%rsp)
movl $0x0, 0x30(%rsp)
movq 0x10(%rsp), %rax
movl 0x30(%rsp), %ecx
movl %ecx, 0xc(%rsp)
movq 0xcb28(%rax), %rdi
callq 0x20490
movl %eax, %ecx
movl 0xc(%rsp), %eax
cmpl %ecx, %eax
jge 0x29f3c
movq 0x10(%rsp), %rax
movq 0xcb28(%rax), %rdi
movl 0x30(%rsp), %esi
callq 0x204b0
movl %eax, 0x2c(%rsp)
movq 0x10(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, 0x8(%rsp)
movq 0xcb28(%rax), %rdi
movl 0x30(%rsp), %esi
callq 0x20520
movl %eax, %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
jge 0x29f2a
movq 0x10(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, (%rsp)
movl 0x30(%rsp), %ecx
movl %ecx, 0x4(%rsp)
movq 0xcb28(%rax), %rdi
movl 0x2c(%rsp), %esi
movl 0x30(%rsp), %edx
callq 0x20290
movl (%rsp), %esi
movl 0x4(%rsp), %edx
movl %eax, %ecx
leaq 0x28(%rsp), %rdi
callq 0x2b3f0
movq 0x10(%rsp), %rax
movq 0xcb28(%rax), %rdi
movw 0x28(%rsp), %ax
movw %ax, 0x26(%rsp)
leaq 0x456b1(%rip), %rax     # 0x6f4dc
movb (%rax), %al
movb %al, 0x25(%rsp)
movw 0x26(%rsp), %ax
movzwl %ax, %esi
movzbl 0x25(%rsp), %edx
callq 0x2b430
testb $0x1, %al
jne 0x29e6f
movq 0x10(%rsp), %rdi
movswl 0x2a(%rsp), %esi
leaq 0x45684(%rip), %rax     # 0x6f4dc
movb (%rax), %al
movb %al, 0x24(%rsp)
movzbl 0x24(%rsp), %edx
callq 0x2b5c0
cmpl $0x3e3, %eax            # imm = 0x3E3
jge 0x29e80
leaq 0x37(%rsp), %rdi
leaq 0x45669(%rip), %rsi     # 0x6f4e4
callq 0x2b600
movq 0x10(%rsp), %rax
movq 0xcb28(%rax), %rdi
movw 0x28(%rsp), %ax
movw %ax, 0x22(%rsp)
leaq 0x45640(%rip), %rax     # 0x6f4dd
movb (%rax), %al
movb %al, 0x21(%rsp)
movw 0x22(%rsp), %ax
movzwl %ax, %esi
movzbl 0x21(%rsp), %edx
callq 0x2b430
testb $0x1, %al
jne 0x29ee1
movq 0x10(%rsp), %rdi
movswl 0x2a(%rsp), %esi
leaq 0x45613(%rip), %rax     # 0x6f4dd
movb (%rax), %al
movb %al, 0x20(%rsp)
movzbl 0x20(%rsp), %edx
callq 0x2b5c0
cmpl $0x3e3, %eax            # imm = 0x3E3
jge 0x29ef2
leaq 0x37(%rsp), %rdi
leaq 0x455f8(%rip), %rsi     # 0x6f4e5
callq 0x2b600
leaq 0x37(%rsp), %rdi
leaq 0x455e8(%rip), %rsi     # 0x6f4e6
callq 0x1c9e0
testb $0x1, %al
jne 0x29f09
jmp 0x29f18
leaq 0x455d0(%rip), %rax     # 0x6f4e0
movb (%rax), %al
movb %al, 0x47(%rsp)
jmp 0x29f52
jmp 0x29f1a
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x29da8
jmp 0x29f2c
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x29d68
movb 0x37(%rsp), %al
movb %al, 0x1f(%rsp)
movzbl 0x1f(%rsp), %edi
callq 0x2b640
movb %al, 0x47(%rsp)
movb 0x47(%rsp), %al
addq $0x48, %rsp
retq
nopl (%rax,%rax)