// File: SethKasmann[P]clever-girl/src/evaluation.cpp
// Function: Evaluate::evalAttacks(Color)
void Evaluate::evalAttacks(Color c)
{
    U64 attackedByPawn, hanging;
    // First check all enemy pieces attacked by a pawn.
    attackedByPawn = mPieceAttacksBB[!c][pawn] 
        & (mState.getOccupancyBB(c) ^ mState.getPieceBB<pawn>(c));

    while (attackedByPawn)
    {
        Square to = pop_lsb(attackedByPawn);
        if (mState.getAttackBB<pawn>(to, c) 
            & mState.getPieceBB<pawn>(!c) 
            & mAllAttacksBB[!c])
            mAttacks[c] += StrongPawnAttack;
        else
            mAttacks[c] += WeakPawnAttack;
    }

    // Check for hanging pieces - pieces that are attacked but not 
    // defended.
    hanging = mAllAttacksBB[!c] & mState.getOccupancyBB(c) 
            & ~mAllAttacksBB[c];

    mAttacks[c] += pop_count(hanging) * Hanging;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x48(%rsp)
addq $0x40, %rax
movq %rax, 0x40(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x40(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x24c40
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq (%rcx), %rcx
movq %rcx, 0x58(%rsp)
movq 0x8(%rax), %rdi
movl 0x7c(%rsp), %esi
callq 0x25740
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x50(%rsp)
movq 0x8(%rax), %rdi
movl 0x7c(%rsp), %esi
callq 0x24b80
movq 0x50(%rsp), %rcx
movq %rax, %rdx
movq 0x58(%rsp), %rax
xorq %rdx, %rcx
andq %rcx, %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x2372d
leaq 0x70(%rsp), %rdi
callq 0x25770
movl %eax, %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x64(%rsp)
movq 0x8(%rax), %rdi
movl 0x64(%rsp), %esi
movl 0x7c(%rsp), %edx
callq 0x257b0
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x28(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0x24b80
movq 0x28(%rsp), %rcx
movq %rax, %rdx
movq 0x48(%rsp), %rax
andq %rdx, %rcx
movq %rcx, 0x38(%rsp)
addq $0xa0, %rax
movq %rax, 0x30(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x30(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x24c70
movq %rax, %rcx
movq 0x38(%rsp), %rax
andq (%rcx), %rax
cmpq $0x0, %rax
je 0x2370d
movq 0x48(%rsp), %rdi
addq $0x34, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl (%rax), %ecx
addl $-0x50, %ecx
movl %ecx, (%rax)
jmp 0x23728
movq 0x48(%rsp), %rdi
addq $0x34, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl (%rax), %ecx
addl $-0x28, %ecx
movl %ecx, (%rax)
jmp 0x2364b
movq 0x48(%rsp), %rax
addq $0xa0, %rax
movq %rax, (%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq (%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x24c70
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq (%rcx), %rcx
movq %rcx, 0x8(%rsp)
movq 0x8(%rax), %rdi
movl 0x7c(%rsp), %esi
callq 0x25740
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movq 0x8(%rsp), %rax
andq %rcx, %rax
movq %rax, 0x10(%rsp)
addq $0xa0, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x24df0
movq 0x48(%rsp), %rdi
imull $-0x19, %eax, %eax
movl %eax, 0x1c(%rsp)
addq $0x34, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x1c(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)