// File: /workspace/github_c_makefile_star2_O3/ArchLuke[P]YouSuck/Engine.c
// Function: Quiescence
static
int Quiescence(int alpha, int beta, S_BOARD *pos, S_SEARCHINFO *info) {
if(( info->nodes & 2047 ) == 0) {
        CheckUp(info);
    }
    
    info->nodes++;
    
    if(IsRepetition(pos) || pos->fiftyMove >= 100) {
        return 0;
    }
    
    if(pos->ply > MAXDEPTH - 1) {
        return EvalPosition(pos);
    }
    
    int Score = EvalPosition(pos);
    
    if(Score >= beta) {
        return beta;
    }
    
    if(Score > alpha) {
        alpha = Score;
    }
    
    S_MOVELIST list[1];
        GenerateAllMoves(pos,list,TRUE);
      
        int MoveNum = 0;
    int Legal = 0;
    int OldAlpha = alpha;
    int BestMove = NOMOVE;
    Score = -INFINITE;
    
    for(MoveNum = 0; MoveNum < list->count; ++MoveNum) {    
            
        PickNextMove(MoveNum, list);    
        
        if ( !MakeMove(pos,list->moves[MoveNum].move))  {
            continue;
        }
        
        Legal++;
        Score = -Quiescence( -beta, -alpha, pos, info);        
        TakeMove(pos);
        
        if(info->stopped == TRUE) {
            return 0;
        }
        
        if(Score > alpha) {
            if(Score >= beta) {
                if(Legal==1) {
                    info->fhf++;
                }
                info->fh++;    
                return beta;
            }
            alpha = Score;
            BestMove = list->moves[MoveNum].move;
        }        
    }
    
    return alpha;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %esi, %ebx
movl %edi, %ebp
movq 0x22036(%rip), %rax     # 0x27188
testl $0x7ff, %eax            # imm = 0x7FF
jne 0x5165
callq 0x5313
movq 0x22023(%rip), %rax     # 0x27188
incq %rax
movq %rax, 0x22019(%rip)     # 0x27188
movslq 0x6d3a(%rip), %rsi      # 0xbeb0
movslq 0x6d2b(%rip), %rax      # 0xbea8
movl %esi, %ecx
subl %eax, %ecx
leal -0x1(%rsi), %edx
cmpl %edx, %ecx
jge 0x51c7
movq 0x6d31(%rip), %rcx      # 0xbec0
leaq 0x6b0a(%rip), %rdi      # 0xbca0
leal -0x1(%rax), %edx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (,%rax,8), %r8
leaq (%r8,%r8,2), %r8
subq %r8, %rsi
addq %rdi, %rsi
addq $0x280, %rsi            # imm = 0x280
cmpq (%rsi), %rcx
je 0x51cc
addq $0x18, %rsi
decl %edx
jne 0x51ba
cmpl $0x63, %eax
jle 0x51d4
xorl %r15d, %r15d
jmp 0x52fe
movl 0x6cd1(%rip), %r14d     # 0xbeac
callq 0x5433
movl %eax, %r15d
cmpl $0x3f, %r14d
jg 0x52fe
cmpl %ebx, %r15d
jge 0x52fb
cmpl %ebp, %r15d
cmovgl %r15d, %ebp
movq %rsp, %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x3966
movl 0x800(%r14), %eax
testl %eax, %eax
jle 0x52c1
movl %ebx, %r14d
negl %r14d
xorl %r12d, %r12d
xorl %r13d, %r13d
cltq
movq %r12, %rdx
movl %r12d, %ecx
xorl %esi, %esi
movl 0x4(%rsp,%rdx,8), %edi
cmpl %esi, %edi
cmovgl %edi, %esi
cmovgl %edx, %ecx
incq %rdx
cmpq %rdx, %rax
jne 0x5232
movslq %ecx, %rax
movq (%rsp,%r12,8), %rcx
movq (%rsp,%rax,8), %rdx
movq %rdx, (%rsp,%r12,8)
movq %rcx, (%rsp,%rax,8)
movl (%rsp,%r12,8), %edi
callq 0x36cf
testl %eax, %eax
je 0x529a
movl %ebp, %esi
negl %esi
movl %r14d, %edi
callq 0x5136
movl %eax, %r15d
callq 0x4889
cmpl $0x1, 0x21f0f(%rip)     # 0x27190
je 0x51cc
leal 0x1(%r13), %ecx
negl %r15d
cmpl %r15d, %ebp
jge 0x52a2
cmpl %ebx, %r15d
jl 0x52a5
jmp 0x52c6
movl %ebp, %r15d
movl %r13d, %ecx
jmp 0x52a5
movl %ebp, %r15d
incq %r12
movslq 0x800(%rsp), %rax
movl %ecx, %r13d
movl %r15d, %ebp
cmpq %rax, %r12
jl 0x5228
jmp 0x52fe
movl %ebp, %r15d
jmp 0x52fe
testl %r13d, %r13d
jne 0x52e3
movss 0x21ec5(%rip), %xmm0    # 0x27198
addss 0x28f9(%rip), %xmm0     # 0x7bd4
movss %xmm0, 0x21eb5(%rip)    # 0x27198
movss 0x21ea9(%rip), %xmm0    # 0x27194
addss 0x28e1(%rip), %xmm0     # 0x7bd4
movss %xmm0, 0x21e99(%rip)    # 0x27194
movl %ebx, %r15d
movl %r15d, %eax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq