// File: SethKasmann[P]clever-girl/src/state.cpp
// Function: State::setPins(Color)
void State::setPins(Color c)
{
    U64 pinners, ray;
    Square kingSq = getKingSquare(c);
    mPinned[c] = 0;

    pinners = bishopMoves[kingSq] & (getPieceBB<bishop>(!c) | getPieceBB<queen>(!c));

    while (pinners)
    {
        ray = between_dia[pop_lsb(pinners)][kingSq] & getOccupancyBB();
        if (pop_count(ray) == 1)
            mPinned[c] |= ray & getOccupancyBB(c);
    }

    pinners = rookMoves[kingSq] & (getPieceBB<rook>(!c) | getPieceBB<queen>(!c));

    while (pinners)
    {
        ray = between_hor[pop_lsb(pinners)][kingSq] & getOccupancyBB();
        if (pop_count(ray) == 1)
            mPinned[c] |= ray & getOccupancyBB(c);
    }
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movq 0x80(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movl 0x7c(%rsp), %esi
callq 0x24ea0
movq 0x48(%rsp), %rdi
movl %eax, 0x64(%rsp)
addq $0x68, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq $0x0, (%rax)
movl 0x64(%rsp), %eax
movl %eax, %ecx
leaq 0x13fadb(%rip), %rax    # 0x176720
movq (%rax,%rcx,8), %rax
movq %rax, 0x58(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x48(%rsp), %rdi
movl %eax, %esi
callq 0x25bf0
movq %rax, 0x50(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x48(%rsp), %rdi
movl %eax, %esi
callq 0x2b3d0
movq 0x50(%rsp), %rcx
movq %rax, %rdx
movq 0x58(%rsp), %rax
orq %rdx, %rcx
andq %rcx, %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x36d3f
leaq 0x70(%rsp), %rdi
callq 0x25770
movq 0x48(%rsp), %rdi
movl %eax, %eax
movl %eax, %ecx
leaq 0x11f055(%rip), %rax    # 0x155d10
shlq $0x9, %rcx
addq %rcx, %rax
movl 0x64(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x40(%rsp)
callq 0x24bc0
movq %rax, %rcx
movq 0x40(%rsp), %rax
andq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x24df0
cmpl $0x1, %eax
jne 0x36d3a
movq 0x48(%rsp), %rdi
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0x7c(%rsp), %esi
callq 0x25740
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movq 0x30(%rsp), %rax
andq %rcx, %rax
movq %rax, 0x38(%rsp)
addq $0x68, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq 0x38(%rsp), %rcx
orq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x36c95
movl 0x64(%rsp), %eax
movl %eax, %ecx
leaq 0x13fbd4(%rip), %rax    # 0x176920
movq (%rax,%rcx,8), %rax
movq %rax, 0x28(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x48(%rsp), %rdi
movl %eax, %esi
callq 0x2b410
movq %rax, 0x20(%rsp)
movl 0x7c(%rsp), %edi
callq 0x24ce0
movq 0x48(%rsp), %rdi
movl %eax, %esi
callq 0x2b3d0
movq 0x20(%rsp), %rcx
movq %rax, %rdx
movq 0x28(%rsp), %rax
orq %rdx, %rcx
andq %rcx, %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x36e46
leaq 0x70(%rsp), %rdi
callq 0x25770
movq 0x48(%rsp), %rdi
movl %eax, %eax
movl %eax, %ecx
leaq 0x126f4e(%rip), %rax    # 0x15dd10
shlq $0x9, %rcx
addq %rcx, %rax
movl 0x64(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
callq 0x24bc0
movq %rax, %rcx
movq 0x18(%rsp), %rax
andq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x24df0
cmpl $0x1, %eax
jne 0x36e41
movq 0x48(%rsp), %rdi
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
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 $0x68, %rdi
movl 0x7c(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq 0x10(%rsp), %rcx
orq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x36d9c
addq $0x88, %rsp
retq
nop