// File: /workspace/github_c_makefile_star2_O0/ArchLuke[P]YouSuck/Engine.c
// Function: ProbeHashEntry
static
int ProbeHashEntry(S_BOARD *pos, int *move, int *score, int alpha, int beta, int depth) {

    int index = pos->posKey % pos->HashTable->numEntries;
    
    
    if( pos->HashTable->pTable[index].posKey == pos->posKey ) {
        *move = pos->HashTable->pTable[index].move;
        if(pos->HashTable->pTable[index].depth >= depth){
            pos->HashTable->hit++;
            
            *score = pos->HashTable->pTable[index].score;
            if(*score > ISMATE) *score -= pos->ply;
            else if(*score < -ISMATE) *score += pos->ply;
            
            switch(pos->HashTable->pTable[index].flags) {
                

                case HFALPHA: if(*score<=alpha) {
                    *score=alpha;
                    return TRUE;
                    }
                    break;
                case HFBETA: if(*score>=beta) {
                    *score=beta;
                    return TRUE;
                    }
                    break;
                case HFEXACT:
                    return TRUE;
                    break;
                default: break;
            }
        }
    }
    
    return FALSE;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movq %rdx, -0x20(%rsp)
movl %ecx, -0x24(%rsp)
movl %r8d, -0x28(%rsp)
movl %r9d, -0x2c(%rsp)
movq -0x10(%rsp), %rax
movq 0x220(%rax), %rax
movq -0x10(%rsp), %rcx
movslq 0xc480(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x30(%rsp)
movq -0x10(%rsp), %rax
movq 0xc478(%rax), %rax
movslq -0x30(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x10(%rsp), %rcx
cmpq 0x220(%rcx), %rax
jne 0x7884
movq -0x10(%rsp), %rax
movq 0xc478(%rax), %rax
movslq -0x30(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x18(%rsp), %rax
movl %ecx, (%rax)
movq -0x10(%rsp), %rax
movq 0xc478(%rax), %rax
movslq -0x30(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
cmpl -0x2c(%rsp), %eax
jl 0x7882
movq -0x10(%rsp), %rax
movl 0xc48c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc48c(%rax)
movq -0x10(%rsp), %rax
movq 0xc478(%rax), %rax
movslq -0x30(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0x20(%rsp), %rax
movl %ecx, (%rax)
movq -0x20(%rsp), %rax
cmpl $0x74f0, (%rax)         # imm = 0x74F0
jle 0x77cf
movq -0x10(%rsp), %rax
movl 0x20c(%rax), %edx
movq -0x20(%rsp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
jmp 0x77f2
movq -0x20(%rsp), %rax
cmpl $0xffff8b10, (%rax)     # imm = 0xFFFF8B10
jge 0x77f0
movq -0x10(%rsp), %rax
movl 0x20c(%rax), %ecx
movq -0x20(%rsp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x77f2
movq -0x10(%rsp), %rax
movq 0xc478(%rax), %rax
movslq -0x30(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movl 0x14(%rax,%rcx,8), %eax
movl %eax, -0x34(%rsp)
subl $0x1, %eax
je 0x782c
jmp 0x7816
movl -0x34(%rsp), %eax
subl $0x2, %eax
je 0x7850
jmp 0x7821
movl -0x34(%rsp), %eax
subl $0x3, %eax
je 0x7874
jmp 0x787e
movq -0x20(%rsp), %rax
movl (%rax), %eax
cmpl -0x24(%rsp), %eax
jg 0x784e
movl -0x24(%rsp), %ecx
movq -0x20(%rsp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rsp)
jmp 0x788c
jmp 0x7880
movq -0x20(%rsp), %rax
movl (%rax), %eax
cmpl -0x28(%rsp), %eax
jl 0x7872
movl -0x28(%rsp), %ecx
movq -0x20(%rsp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rsp)
jmp 0x788c
jmp 0x7880
movl $0x1, -0x4(%rsp)
jmp 0x788c
jmp 0x7880
jmp 0x7882
jmp 0x7884
movl $0x0, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)