// File: /workspace/github_c_makefile_star2_O0/ArchLuke[P]YouSuck/Engine.c
// Function: Search
static int Search(int trap)
{
    int bestMove = NOMOVE;
    int bestScore = -INFINITE;
    int currentDepth = 0;
    int pvMoves = 0;
    int pvNum = 0;
    
    ClearForSearch(pos,info);
    
    // iterative deepening
    for( currentDepth = 1; currentDepth <= info->depth; ++currentDepth ) {
    S_MOVELIST list[1];
                            // alpha     beta
        bestScore = AlphaBeta(-INFINITE, INFINITE, currentDepth, pos, info,TRUE, list, FALSE);
        
        if(info->stopped == TRUE) {
            break;
        }
        
        pvMoves = GetPvLine(currentDepth, pos);
        bestMove = pos->PvArray[0];
        
        printf("info score cp %d depth %d nodes %ld time %d ",
            bestScore,currentDepth,info->nodes,GetTimeMs()-info->starttime);
            
        pvMoves = GetPvLine(currentDepth, pos);    
        printf("pv");        
        for(pvNum = 0; pvNum < pvMoves; ++pvNum) {
            printf(" %s",PrMove(pos->PvArray[pvNum]));
        }
        printf("\n");
        printf("Hits: %d Overwrite:%d NewWrite:%d Cut:%d\n",pos->HashTable->hit, pos->HashTable->overWrite,pos->HashTable->newWrite, pos->HashTable->cut);
        // printf("Ordering:%.2f\n",(info->fhf/info->fh));
    }
    return bestMove;
}

// Assembly:
subq $0x848, %rsp            # imm = 0x848
movl %edi, 0x844(%rsp)
movl $0x0, 0x840(%rsp)
movl $0xffff8ad0, 0x83c(%rsp) # imm = 0xFFFF8AD0
movl $0x0, 0x838(%rsp)
movl $0x0, 0x834(%rsp)
movl $0x0, 0x830(%rsp)
leaq 0x9a84(%rip), %rdi      # 0xfc90
leaq 0x24f4d(%rip), %rsi     # 0x2b160
callq 0x63e0
movl $0x1, 0x838(%rsp)
movl 0x838(%rsp), %eax
cmpl 0x24f38(%rip), %eax     # 0x2b168
jg 0x63c9
movl 0x838(%rsp), %edx
leaq 0x20(%rsp), %rax
movl $0xffff8ad0, %edi       # imm = 0xFFFF8AD0
movl $0x7530, %esi           # imm = 0x7530
leaq 0x9a3d(%rip), %rcx      # 0xfc90
leaq 0x24f06(%rip), %r8      # 0x2b160
movl $0x1, %r9d
xorl %r10d, %r10d
movq %rax, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x68e0
movl %eax, 0x83c(%rsp)
cmpl $0x1, 0x24efe(%rip)     # 0x2b180
jne 0x6289
jmp 0x63c9
movl 0x838(%rsp), %edi
leaq 0x99f9(%rip), %rsi      # 0xfc90
callq 0x70b0
movl %eax, 0x834(%rsp)
movl 0x15e9f(%rip), %eax     # 0x1c148
movl %eax, 0x840(%rsp)
movl 0x83c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x838(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x24eab(%rip), %rax     # 0x2b178
movq %rax, 0x18(%rsp)
callq 0x6000
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
movq 0x18(%rsp), %rcx
movl %eax, %r8d
subl 0x24e72(%rip), %r8d     # 0x2b160
leaq 0x5ad8(%rip), %rdi      # 0xbdcd
movb $0x0, %al
callq 0x1060
movl 0x838(%rsp), %edi
leaq 0x9986(%rip), %rsi      # 0xfc90
callq 0x70b0
movl %eax, 0x834(%rsp)
leaq 0x5add(%rip), %rdi      # 0xbdfa
movb $0x0, %al
callq 0x1060
movl $0x0, 0x830(%rsp)
movl 0x830(%rsp), %eax
cmpl 0x834(%rsp), %eax
jge 0x637e
movslq 0x830(%rsp), %rcx
leaq 0x9942(%rip), %rax      # 0xfc90
movl 0xc4b8(%rax,%rcx,4), %edi
callq 0x6040
movq %rax, %rsi
leaq 0x5a99(%rip), %rdi      # 0xbdfd
movb $0x0, %al
callq 0x1060
movl 0x830(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x830(%rsp)
jmp 0x632f
leaq 0x5854(%rip), %rdi      # 0xbbd9
movb $0x0, %al
callq 0x1060
movl 0x15d8a(%rip), %esi     # 0x1c11c
movl 0x15d80(%rip), %edx     # 0x1c118
movl 0x15d76(%rip), %ecx     # 0x1c114
movl 0x15d7b(%rip), %r8d     # 0x1c120
leaq 0x5a55(%rip), %rdi      # 0xbe01
movb $0x0, %al
callq 0x1060
movl 0x838(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x838(%rsp)
jmp 0x6223
movl 0x840(%rsp), %eax
addq $0x848, %rsp            # imm = 0x848
retq
nopl (%rax,%rax)