// File: SethKasmann[P]clever-girl/src/state.h
// Function: State::getAttackBB(PieceType, Square, unsigned long long) const
inline
U64 State::getAttackBB(PieceType pPiece, Square pSquare, U64 pOcc) const
{
    assert(pPiece != pawn);
    assert(pPiece != king);
    return pPiece == knight ? getAttackBB<knight>(pSquare) :
           pPiece == bishop ? Bmagic(pSquare, pOcc)        :
           pPiece == rook   ? Rmagic(pSquare, pOcc)        :
                              Qmagic(pSquare, pOcc);
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpl $0x1, 0x3c(%rsp)
jne 0x3a774
movq 0x28(%rsp), %rdi
movl 0x38(%rsp), %esi
xorl %edx, %edx
callq 0x25160
movq %rax, 0x20(%rsp)
jmp 0x3a980
cmpl $0x2, 0x3c(%rsp)
jne 0x3a7ea
movl 0x38(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x54(%rsp)
movq %rax, 0x48(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x16b26(%rip), %rax     # 0x512c0
movq (%rax,%rcx,8), %rax
movq 0x48(%rsp), %rdx
movl 0x54(%rsp), %ecx
movl %ecx, %esi
leaq 0x6120(%rip), %rcx      # 0x408d0
andq (%rcx,%rsi,8), %rdx
movl 0x54(%rsp), %ecx
movl %ecx, %esi
leaq 0x5f0f(%rip), %rcx      # 0x406d0
imulq (%rcx,%rsi,8), %rdx
movl 0x54(%rsp), %ecx
movl %ecx, %esi
leaq 0x5dfd(%rip), %rcx      # 0x405d0
movl (%rcx,%rsi,4), %ecx
shrq %cl, %rdx
movq %rdx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
jmp 0x3a976
cmpl $0x3, 0x3c(%rsp)
jne 0x3a860
movl 0x38(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x64(%rsp)
movq %rax, 0x58(%rsp)
movl 0x64(%rsp), %eax
movl %eax, %ecx
leaq 0x16cb0(%rip), %rax     # 0x514c0
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rdx
movl 0x64(%rsp), %ecx
movl %ecx, %esi
leaq 0x5baa(%rip), %rcx      # 0x403d0
andq (%rcx,%rsi,8), %rdx
movl 0x64(%rsp), %ecx
movl %ecx, %esi
leaq 0x5999(%rip), %rcx      # 0x401d0
imulq (%rcx,%rsi,8), %rdx
movl 0x64(%rsp), %ecx
movl %ecx, %esi
leaq 0x5887(%rip), %rcx      # 0x400d0
movl (%rcx,%rsi,4), %ecx
shrq %cl, %rdx
movq %rdx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
jmp 0x3a96c
movl 0x38(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x74(%rsp)
movq %rax, 0x68(%rsp)
movl 0x74(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x84(%rsp)
movq %rax, 0x78(%rsp)
movl 0x84(%rsp), %eax
movl %eax, %ecx
leaq 0x16a29(%rip), %rax     # 0x512c0
movq (%rax,%rcx,8), %rax
movq 0x78(%rsp), %rdx
movl 0x84(%rsp), %ecx
movl %ecx, %esi
leaq 0x6020(%rip), %rcx      # 0x408d0
andq (%rcx,%rsi,8), %rdx
movl 0x84(%rsp), %ecx
movl %ecx, %esi
leaq 0x5e0c(%rip), %rcx      # 0x406d0
imulq (%rcx,%rsi,8), %rdx
movl 0x84(%rsp), %ecx
movl %ecx, %esi
leaq 0x5cf7(%rip), %rcx      # 0x405d0
movl (%rcx,%rsi,4), %ecx
shrq %cl, %rdx
movq %rdx, %rcx
movq (%rax,%rcx,8), %rax
movl 0x74(%rsp), %edx
movq 0x68(%rsp), %rcx
movl %edx, 0x94(%rsp)
movq %rcx, 0x88(%rsp)
movl 0x94(%rsp), %ecx
movl %ecx, %edx
leaq 0x16bb2(%rip), %rcx     # 0x514c0
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x8(%rsp)
movq 0x88(%rsp), %rdx
movl 0x94(%rsp), %ecx
movl %ecx, %esi
leaq 0x5aa1(%rip), %rcx      # 0x403d0
andq (%rcx,%rsi,8), %rdx
movl 0x94(%rsp), %ecx
movl %ecx, %esi
leaq 0x588d(%rip), %rcx      # 0x401d0
imulq (%rcx,%rsi,8), %rdx
movl 0x94(%rsp), %ecx
movl %ecx, %esi
leaq 0x5778(%rip), %rcx      # 0x400d0
movl (%rcx,%rsi,4), %ecx
shrq %cl, %rdx
movq 0x8(%rsp), %rcx
orq (%rcx,%rdx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x98, %rsp
retq
nopl (%rax)