// File: /workspace/github_c_makefile_star2_O0/ArchLuke[P]YouSuck/Engine.c
// Function: ParseMove
static
int ParseMove(char *ptrChar, S_BOARD *pos) {
    if(ptrChar[1] > '8' || ptrChar[1] < '1') return NOMOVE;
    if(ptrChar[3] > '8' || ptrChar[3] < '1') return NOMOVE;
    if(ptrChar[0] > 'h' || ptrChar[0] < 'a') return NOMOVE;
    if(ptrChar[2] > 'h' || ptrChar[2] < 'a') return NOMOVE;

    int from = FR2SQ(ptrChar[0] - 'a', ptrChar[1] - '1');
    int to = FR2SQ(ptrChar[2] - 'a', ptrChar[3] - '1');    
    
    
    S_MOVELIST list[1];
    GenerateAllMoves(pos,list,0);      
    int MoveNum = 0;
    int Move = 0;
    int PromPce = EMPTY;
    
    for(MoveNum = 0; MoveNum < list->count; ++MoveNum) {    
        Move = list->moves[MoveNum].move;
        if(FROMSQ(Move)==from && TOSQ(Move)==to) {
            PromPce = PROMOTED(Move);
            if(PromPce!=EMPTY) {
                if(IsRQ(PromPce) && !IsBQ(PromPce) && ptrChar[4]=='r') {
                    return Move;
                } else if(!IsRQ(PromPce) && IsBQ(PromPce) && ptrChar[4]=='b') {
                    return Move;
                } else if(IsRQ(PromPce) && IsBQ(PromPce) && ptrChar[4]=='q') {
                    return Move;
                } else if(IsKn(PromPce)&& ptrChar[4]=='n') {
                    return Move;
                }
                continue;
            }
            return Move;
        }
    }
printf("returned a move\n");    
    return NOMOVE;    
}

// Assembly:
subq $0x838, %rsp            # imm = 0x838
movq %rdi, 0x828(%rsp)
movq %rsi, 0x820(%rsp)
movq 0x828(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x38, %eax
jg 0x3939
movq 0x828(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x31, %eax
jge 0x3949
movl $0x0, 0x834(%rsp)
jmp 0x3c08
movq 0x828(%rsp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x38, %eax
jg 0x396b
movq 0x828(%rsp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x31, %eax
jge 0x397b
movl $0x0, 0x834(%rsp)
jmp 0x3c08
movq 0x828(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x68, %eax
jg 0x399b
movq 0x828(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jge 0x39ab
movl $0x0, 0x834(%rsp)
jmp 0x3c08
movq 0x828(%rsp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x68, %eax
jg 0x39cd
movq 0x828(%rsp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x61, %eax
jge 0x39dd
movl $0x0, 0x834(%rsp)
jmp 0x3c08
movq 0x828(%rsp), %rax
movsbl (%rax), %eax
subl $0x61, %eax
addl $0x15, %eax
movq 0x828(%rsp), %rcx
movsbl 0x1(%rcx), %ecx
subl $0x31, %ecx
imull $0xa, %ecx, %ecx
addl %ecx, %eax
movl %eax, 0x81c(%rsp)
movq 0x828(%rsp), %rax
movsbl 0x2(%rax), %eax
subl $0x61, %eax
addl $0x15, %eax
movq 0x828(%rsp), %rcx
movsbl 0x3(%rcx), %ecx
subl $0x31, %ecx
imull $0xa, %ecx, %ecx
addl %ecx, %eax
movl %eax, 0x818(%rsp)
movq 0x820(%rsp), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x45e0
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x810(%rsp), %eax
jge 0x3bef
movslq 0xc(%rsp), %rax
movl 0x10(%rsp,%rax,8), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
andl $0x7f, %eax
cmpl 0x81c(%rsp), %eax
jne 0x3bdd
movl 0x8(%rsp), %eax
sarl $0x7, %eax
andl $0x7f, %eax
cmpl 0x818(%rsp), %eax
jne 0x3bdd
movl 0x8(%rsp), %eax
sarl $0x14, %eax
andl $0xf, %eax
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x3bd0
movslq 0x4(%rsp), %rcx
leaq 0x8038(%rip), %rax      # 0xbb10
cmpl $0x0, (%rax,%rcx,4)
je 0x3b11
movslq 0x4(%rsp), %rcx
leaq 0x7f26(%rip), %rax      # 0xba10
cmpl $0x0, (%rax,%rcx,4)
jne 0x3b11
movq 0x828(%rsp), %rax
movsbl 0x4(%rax), %eax
cmpl $0x72, %eax
jne 0x3b11
movl 0x8(%rsp), %eax
movl %eax, 0x834(%rsp)
jmp 0x3c08
movslq 0x4(%rsp), %rcx
leaq 0x7ff3(%rip), %rax      # 0xbb10
cmpl $0x0, (%rax,%rcx,4)
jne 0x3b56
movslq 0x4(%rsp), %rcx
leaq 0x7ee1(%rip), %rax      # 0xba10
cmpl $0x0, (%rax,%rcx,4)
je 0x3b56
movq 0x828(%rsp), %rax
movsbl 0x4(%rax), %eax
cmpl $0x62, %eax
jne 0x3b56
movl 0x8(%rsp), %eax
movl %eax, 0x834(%rsp)
jmp 0x3c08
movslq 0x4(%rsp), %rcx
leaq 0x7fae(%rip), %rax      # 0xbb10
cmpl $0x0, (%rax,%rcx,4)
je 0x3b98
movslq 0x4(%rsp), %rcx
leaq 0x7e9c(%rip), %rax      # 0xba10
cmpl $0x0, (%rax,%rcx,4)
je 0x3b98
movq 0x828(%rsp), %rax
movsbl 0x4(%rax), %eax
cmpl $0x71, %eax
jne 0x3b98
movl 0x8(%rsp), %eax
movl %eax, 0x834(%rsp)
jmp 0x3c08
movslq 0x4(%rsp), %rcx
leaq 0x7eec(%rip), %rax      # 0xba90
cmpl $0x0, (%rax,%rcx,4)
je 0x3bc8
movq 0x828(%rsp), %rax
movsbl 0x4(%rax), %eax
cmpl $0x6e, %eax
jne 0x3bc8
movl 0x8(%rsp), %eax
movl %eax, 0x834(%rsp)
jmp 0x3c08
jmp 0x3bca
jmp 0x3bcc
jmp 0x3bce
jmp 0x3bdf
movl 0x8(%rsp), %eax
movl %eax, 0x834(%rsp)
jmp 0x3c08
jmp 0x3bdf
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x3a6a
leaq 0x80e4(%rip), %rdi      # 0xbcda
movb $0x0, %al
callq 0x1060
movl $0x0, 0x834(%rsp)
movl 0x834(%rsp), %eax
addq $0x838, %rsp            # imm = 0x838
retq
nopw (%rax,%rax)