// File: smallHW89[P]gobang/GoBang_ChessBoard.cpp
// Function: ChessBoard::CalculatePosLeft(int, int, char)
BoardType  ChessBoard:: CalculatePosLeft(int x, int y, ChessSide side)
{
    if( x==0 || y== 0 || x > m_size || y> m_size )  
        return 0;

    char line[30];
    int  kk =0;
    int  pos = 0;
    if( x>=y ) // (x-y,0), (x-y+1,1) (x-y+2,2) ...... 
    {
       int  xx = x-y;
       int  yy = 0;
       for(kk=0 ; xx <=m_size +2; xx ++, kk++, yy++ )
       {
            line[kk] = m_board[xx][yy];
            if( xx == x )
                pos = kk;
       }
    }
    else //(0, y-x) , (1, y-x +1), (2, y-x+2)
    {
        int xx =  0; 
        int yy = y-x; 
        for( kk=0; yy<=m_size+2; xx++, yy++, kk++ )
        {
            line[kk] = m_board[xx][yy];
            if(xx == x )
                pos = kk;
        }
    }
    int rr, rl;
    return CalculateLine( line, m_size+2, pos,rl, rr );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x3479
cmpl $0x0, -0x18(%rbp)
je 0x3479
movq -0x68(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x194(%rcx), %eax
jg 0x3479
movq -0x68(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x194(%rcx), %eax
jle 0x3485
movl $0x0, -0x4(%rbp)
jmp 0x35b7
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x3517
movl -0x14(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x68(%rbp), %rcx
movl -0x4c(%rbp), %eax
movl 0x194(%rcx), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jg 0x3515
movq -0x68(%rbp), %rax
addq $0x4, %rax
movslq -0x4c(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x50(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x44(%rbp), %rax
movb %cl, -0x40(%rbp,%rax)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x34f6
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x34f8
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x34b2
jmp 0x3593
movl $0x0, -0x54(%rbp)
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x58(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x68(%rbp), %rcx
movl -0x58(%rbp), %eax
movl 0x194(%rcx), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jg 0x3591
movq -0x68(%rbp), %rax
addq $0x4, %rax
movslq -0x54(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x58(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x44(%rbp), %rax
movb %cl, -0x40(%rbp,%rax)
movl -0x54(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x3572
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x3574
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x352e
jmp 0x3593
movq -0x68(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl 0x194(%rdi), %edx
addl $0x2, %edx
movl -0x48(%rbp), %ecx
leaq -0x60(%rbp), %r8
leaq -0x5c(%rbp), %r9
callq 0x30c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq