// File: bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: allKnightAttacks()
void allKnightAttacks(){
    bitboard knightA = 0ULL, knightB = 0ULL, knightG = 0ULL, knightH = 0ULL;
    bitboard knightMoves = 0ULL, knight = 0ULL;
    square sq = a1;
    for(rank rk = rank_1; rk<numOfRank; rk++)
    {
        for(file f = file_a; f<numOfFile; f++)
        {
            sq = rankFile_to_sq(rk, f);
            knightA = squareBitMask[sq] & clearFile[file_a];
            knightB = squareBitMask[sq] & clearFile[file_b];
            knightG = squareBitMask[sq] & clearFile[file_g];
            knightH = squareBitMask[sq] & clearFile[file_h];
            knight  = squareBitMask[sq];
            
            knightMoves |= ((knightA & knightB) << noWeWe);
            knightMoves |= (knightA  << noNoWe);
            knightMoves |= (knightH << noNoEa);
            knightMoves |= ((knightG & knightH) << noEaEa);
            knightMoves |= ((knightG & knightH) >> -soEaEa);
            knightMoves |= (knightH  >> -soSoEa);
            knightMoves |= (knightA >> -soSoWe);
            knightMoves |= ((knightA & knightB) >> -soWeWe);
            
           // printBitboard(knightMoves);
            openBoardAttacks[p_knight][sq] = knightMoves;
            knightMoves = 0ULL;
        }
        
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
cmpl $0x8, -0x38(%rbp)
jge 0x4871
movl $0x0, -0x3c(%rbp)
cmpl $0x8, -0x3c(%rbp)
jge 0x485f
movl -0x38(%rbp), %edi
movl -0x3c(%rbp), %esi
callq 0x5a00
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0xe775(%rip), %rax      # 0x12ea0
movq (%rax,%rcx,8), %rax
andq 0xedea(%rip), %rax      # 0x13520
movq %rax, -0x8(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0xe75a(%rip), %rax      # 0x12ea0
movq (%rax,%rcx,8), %rax
andq 0xedd7(%rip), %rax      # 0x13528
movq %rax, -0x10(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0xe73f(%rip), %rax      # 0x12ea0
movq (%rax,%rcx,8), %rax
andq 0xede4(%rip), %rax      # 0x13550
movq %rax, -0x18(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0xe724(%rip), %rax      # 0x12ea0
movq (%rax,%rcx,8), %rax
andq 0xedd1(%rip), %rax      # 0x13558
movq %rax, -0x20(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0xe709(%rip), %rax      # 0x12ea0
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
andq -0x10(%rbp), %rax
shlq $0x6, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
shlq $0xf, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
shlq $0x11, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
andq -0x20(%rbp), %rax
shlq $0xa, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
andq -0x20(%rbp), %rax
shrq $0x6, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
shrq $0xf, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
shrq $0x11, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
andq -0x10(%rbp), %rax
shrq $0xa, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdx
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0xed61(%rip), %rax      # 0x135a0
movq %rdx, 0x200(%rax,%rcx,8)
movq $0x0, -0x28(%rbp)
leaq -0x3c(%rbp), %rdi
xorl %esi, %esi
callq 0x5a20
jmp 0x4707
jmp 0x4861
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x5a40
jmp 0x46f6
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)