// File: smallHW89[P]gobang/GoBang_ChessBoard.cpp
// Function: ChessBoard::GetPossbilePos(char, std::vector<StPos, std::allocator<StPos>>&)
int ChessBoard::GetPossbilePos(ChessSide side, std::vector<StPos >  &list)
{
    for(int i =1; i<=m_size; i++ )
        for(int j=1; j<=m_size; j++ )
        {
            if( m_board[i][j] !=  Chess_Empty )    
                continue;
            int dist  = m_size;
            for(int k=0; k< m_chessList.size(); k++ )
            {
                int xx = i - m_chessList[k].x;
                int yy = j - m_chessList[k].y;
                if(xx<0 ) xx = -xx;
                if(yy<0 ) yy = -yy;
                int tt = (xx>yy)?xx:yy;
                dist = (tt<dist )?tt:dist;
                if(dist <=2)
                    break;
            }
            if( dist<=2 )
            {
                StPos pos(i,j,side);
                list.push_back(pos);
            }
        }
    return  list.size();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x1, -0x1c(%rbp)
movq -0x58(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl 0x194(%rcx), %eax
jg 0x3930
movl $0x1, -0x20(%rbp)
movq -0x58(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl 0x194(%rcx), %eax
jg 0x3920
movq -0x58(%rbp), %rax
addq $0x4, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x65, %eax
je 0x37f7
jmp 0x3912
movq -0x58(%rbp), %rax
movl 0x194(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x58(%rbp), %rdi
movslq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
addq $0x240, %rdi            # imm = 0x240
callq 0x4ec0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x38ea
movq -0x58(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x68(%rbp)
addq $0x240, %rdi            # imm = 0x240
movslq -0x28(%rbp), %rsi
callq 0x4ef0
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl -0x68(%rbp), %eax
subl (%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x64(%rbp)
addq $0x240, %rdi            # imm = 0x240
movslq -0x28(%rbp), %rsi
callq 0x4ef0
movq %rax, %rcx
movl -0x64(%rbp), %eax
subl 0x4(%rcx), %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x388c
xorl %eax, %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x30(%rbp)
jge 0x389a
xorl %eax, %eax
subl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jle 0x38aa
movl -0x2c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x38b0
movl -0x30(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x38c6
movl -0x34(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x38cc
movl -0x24(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x2, -0x24(%rbp)
jg 0x38da
jmp 0x38ea
jmp 0x38dc
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x380b
cmpl $0x2, -0x24(%rbp)
jg 0x3910
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
leaq -0x50(%rbp), %rdi
movsbl -0x9(%rbp), %ecx
callq 0x4de0
movq -0x18(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4e20
jmp 0x3912
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x37bf
jmp 0x3922
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x37a5
movq -0x18(%rbp), %rdi
callq 0x4ec0
addq $0x70, %rsp
popq %rbp
retq
nop