// File: /workspace/github_c_makefile_star2_O1/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
movzwl 0x21f51(%rip), %eax     # 0x27188
testl $0x7ff, %eax            # imm = 0x7FF
jne 0x5243
callq 0x5408
incq 0x21f3e(%rip)           # 0x27188
movslq 0x6c5f(%rip), %rdi      # 0xbeb0
movslq 0x6c50(%rip), %rax      # 0xbea8
movl %edi, %ecx
subl %eax, %ecx
leal -0x1(%rdi), %edx
xorl %r14d, %r14d
movl $0x0, %esi
cmpl %edx, %ecx
jge 0x52b6
movq 0x6c4e(%rip), %rcx      # 0xbec0
leaq 0x6a27(%rip), %rsi      # 0xbca0
leal -0x2(%rax), %edx
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (,%rax,8), %r8
leaq (%r8,%r8,2), %r8
subq %r8, %rdi
addq %rsi, %rdi
addq $0x280, %rdi            # imm = 0x280
subl $0x1, %edx
setb %r8b
cmpq (%rdi), %rcx
sete %sil
je 0x52b6
addq $0x18, %rdi
testb %r8b, %r8b
je 0x529d
cmpl $0x63, %eax
jg 0x53f3
testb %sil, %sil
jne 0x53f3
movl 0x6bdd(%rip), %r15d     # 0xbeac
callq 0x5528
movl %eax, %r14d
cmpl $0x3f, %r15d
jg 0x53f3
cmpl %ebx, %r14d
jge 0x53f0
cmpl %ebp, %r14d
cmovgl %r14d, %ebp
movq %rsp, %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x39ab
movl 0x800(%r14), %eax
testl %eax, %eax
jle 0x53b1
movl %ebx, %r15d
negl %r15d
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 0x5326
movq (%rsp,%r12,8), %rax
movslq %ecx, %rcx
movq (%rsp,%rcx,8), %rdx
movq %rdx, (%rsp,%r12,8)
movq %rax, (%rsp,%rcx,8)
movl (%rsp,%r12,8), %edi
callq 0x3701
testl %eax, %eax
je 0x538a
movl %ebp, %esi
negl %esi
movl %r15d, %edi
callq 0x521b
movl %eax, %r14d
callq 0x48bd
cmpl $0x1, 0x21e1b(%rip)     # 0x27190
je 0x53b6
leal 0x1(%r13), %ecx
negl %r14d
cmpl %r14d, %ebp
jge 0x5392
cmpl %ebx, %r14d
jl 0x5395
jmp 0x53bb
movl %ebp, %r14d
movl %r13d, %ecx
jmp 0x5395
movl %ebp, %r14d
incq %r12
movslq 0x800(%rsp), %rax
movl %ecx, %r13d
movl %r14d, %ebp
cmpq %rax, %r12
jl 0x531c
jmp 0x53f3
movl %ebp, %r14d
jmp 0x53f3
xorl %r14d, %r14d
jmp 0x53f3
testl %r13d, %r13d
jne 0x53d8
movss 0x21dd0(%rip), %xmm0    # 0x27198
addss 0x2804(%rip), %xmm0     # 0x7bd4
movss %xmm0, 0x21dc0(%rip)    # 0x27198
movss 0x21db4(%rip), %xmm0    # 0x27194
addss 0x27ec(%rip), %xmm0     # 0x7bd4
movss %xmm0, 0x21da4(%rip)    # 0x27194
movl %ebx, %r14d
movl %r14d, %eax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq