// File: tewalds[P]morat/hex/board.cpp
// Function: Morat::Hex::Board::gen_neighbor_list() const
std::shared_ptr<MoveValid> Board::gen_neighbor_list() const {
	std::shared_ptr<MoveValid> list(new MoveValid[vec_size()*18]);
	MoveValid * a = list.get();
	for(int y = 0; y < size_; y++){
		for(int x = 0; x < size_; x++){
			Move pos(x,y);

			for(int i = 0; i < 18; i++){
				Move loc = pos + neighbor_offsets[i];
				*a = MoveValid(loc, (on_board(loc) ? xy(loc) : -1) );
				++a;
			}
		}
	}

	return list;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x28(%rsp)
movq %rdi, %rax
movq %rax, 0x30(%rsp)
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x88(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movb $0x0, 0x87(%rsp)
callq 0x102d0
imull $0x12, %eax, %eax
cltq
movq %rax, 0x40(%rsp)
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x5030
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x48(%rsp)
cmpq $0x0, %rax
je 0x37088
movq 0x48(%rsp), %rax
movq 0x40(%rsp), %rdx
shlq $0x2, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x1fdf0
jmp 0x37070
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
addq $0x4, %rax
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x3705a
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x37500
movq 0x28(%rsp), %rdi
callq 0x11830
movq %rax, 0x68(%rsp)
movl $0x0, 0x64(%rsp)
movq 0x38(%rsp), %rcx
movl 0x64(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x3720f
movl $0x0, 0x60(%rsp)
movq 0x38(%rsp), %rcx
movl 0x60(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x371fd
movl 0x60(%rsp), %esi
movl 0x64(%rsp), %edx
leaq 0x5e(%rsp), %rdi
callq 0x11600
jmp 0x370f2
movl $0x0, 0x58(%rsp)
cmpl $0x12, 0x58(%rsp)
jge 0x371eb
movslq 0x58(%rsp), %rcx
leaq 0x3635f(%rip), %rax     # 0x6d470
leaq (%rax,%rcx,4), %rsi
leaq 0x5e(%rsp), %rdi
callq 0x37530
movw %ax, 0xe(%rsp)
jmp 0x37126
movq 0x38(%rsp), %rdi
movw 0xe(%rsp), %ax
movw %ax, 0x56(%rsp)
leaq 0x56(%rsp), %rsi
callq 0x37570
movb %al, 0xd(%rsp)
jmp 0x37145
movb 0xd(%rsp), %al
testb $0x1, %al
jne 0x3714f
jmp 0x3716e
movq 0x38(%rsp), %rdi
leaq 0x56(%rsp), %rsi
callq 0x11630
movl %eax, 0x8(%rsp)
jmp 0x37164
movl 0x8(%rsp), %eax
movl %eax, 0x4(%rsp)
jmp 0x37179
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x4(%rsp)
jmp 0x37179
movl 0x4(%rsp), %edx
leaq 0x52(%rsp), %rdi
leaq 0x56(%rsp), %rsi
callq 0x11660
jmp 0x3718e
movq 0x68(%rsp), %rax
movl 0x52(%rsp), %ecx
movl %ecx, (%rax)
movq 0x68(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x68(%rsp)
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x370fa
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x5530
jmp 0x37238
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x10060
jmp 0x37238
jmp 0x371ed
movl 0x60(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x60(%rsp)
jmp 0x370ca
jmp 0x371ff
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x370ae
movb $0x1, 0x87(%rsp)
testb $0x1, 0x87(%rsp)
jne 0x3722b
movq 0x28(%rsp), %rdi
callq 0x10060
movq 0x30(%rsp), %rax
addq $0x98, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x5760
nopw %cs:(%rax,%rax)
nopl (%rax)