// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: bitboards::init()
void bitboards::init(){

  // std::cout << "Generating Bitboard Masks... \n";
    for(int i=0; i<numOfSq; i++)
    {
          squareBitMask[i] = (1ULL << i);
    }
    
    //diagonal and antiDiagonal bit masks
    for(int i=0; i<numOfSq; i++)
    {
        
        
        diagonalBitMask[i]  = diagMasks(i, 0) ;//& clearEdges;
        
       
        antiDiagonalBitMask[i] = antidiagMasks(i, 0);// & clearEdges;
        
        
    }
    
    for( int i = 0; i < numOfFile; i++)
    {
        fileBitMask[i] = fileA << i;
        clearFile[i] = ~fileBitMask[i];
    }
    
    for( int i = 0; i < numOfRank; i++)
    {
        rankBitMask[i] = rank1 << (8*i);
        clearRank[i] = ~rankBitMask[i];
    }
    // std::cout << "Generating Piece Attacks... \n";
     allPawnAttacks();
     allKingAttacks();
     allKnightAttacks();
     allBishopAttacks();
     allRookAttacks();
     allQueenAttacks();
     //std::cout << "Generating Magic Bishop Boards... \n";
     initMagicBishop();
     //std::cout << "Generating Magic Rook Boards... \n";
     initMagicRook();
     inBetweenBitMask();
     //std::cout << "Generating Bitboards Complete... \n";
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movdqa 0x5733(%rip), %xmm0     # 0x8020
xorl %eax, %eax
movdqa 0x5739(%rip), %xmm1     # 0x8030
leaq 0x94e2(%rip), %r14      # 0xbde0
movdqa %xmm1, %xmm2
psllq %xmm0, %xmm2
pshufd $0xee, %xmm0, %xmm3     # xmm3 = xmm0[2,3,2,3]
movdqa %xmm1, %xmm4
psllq %xmm3, %xmm4
movsd %xmm2, %xmm4            # xmm4 = xmm2[0],xmm4[1]
movapd %xmm4, (%rax,%r14)
paddq 0x571b(%rip), %xmm0     # 0x8040
addq $0x10, %rax
cmpq $0x200, %rax            # imm = 0x200
jne 0x28fe
xorl %r13d, %r13d
leaq 0x9725(%rip), %r15      # 0xc060
leaq 0x991e(%rip), %r12      # 0xc260
xorl %ebx, %ebx
movl %ebx, %edi
xorl %esi, %esi
callq 0x2acc
movq %rax, (%r13,%r15)
movl %ebx, %edi
xorl %esi, %esi
callq 0x2b39
movq %rax, (%r13,%r12)
incq %rbx
addq $0x8, %r13
cmpq $0x40, %rbx
jne 0x2944
movdqa 0x56ab(%rip), %xmm0     # 0x8020
xorl %eax, %eax
movdqa 0x56d1(%rip), %xmm1     # 0x8050
leaq 0x965a(%rip), %rcx      # 0xbfe0
pcmpeqd %xmm2, %xmm2
leaq 0x9acf(%rip), %rdx      # 0xc460
movdqa 0x56a7(%rip), %xmm6     # 0x8040
movdqa %xmm1, %xmm3
psllq %xmm0, %xmm3
pshufd $0xee, %xmm0, %xmm4     # xmm4 = xmm0[2,3,2,3]
movdqa %xmm1, %xmm5
psllq %xmm4, %xmm5
movsd %xmm3, %xmm5            # xmm5 = xmm3[0],xmm5[1]
movapd %xmm5, (%rax,%rcx)
xorpd %xmm2, %xmm5
movapd %xmm5, (%rax,%rdx)
paddq %xmm6, %xmm0
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x2999
movdqa 0x564a(%rip), %xmm0     # 0x8020
xorl %eax, %eax
movdqa 0x5680(%rip), %xmm1     # 0x8060
leaq 0x9639(%rip), %rcx      # 0xc020
pcmpeqd %xmm2, %xmm2
leaq 0x9aae(%rip), %rdx      # 0xc4a0
movdqa %xmm0, %xmm3
psllq $0x3, %xmm3
movdqa %xmm1, %xmm4
psllq %xmm3, %xmm4
pshufd $0xee, %xmm3, %xmm3     # xmm3 = xmm3[2,3,2,3]
movdqa %xmm1, %xmm5
psllq %xmm3, %xmm5
movsd %xmm4, %xmm5            # xmm5 = xmm4[0],xmm5[1]
movapd %xmm5, (%rax,%rcx)
xorpd %xmm2, %xmm5
movapd %xmm5, (%rax,%rdx)
paddq %xmm6, %xmm0
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x29f2
callq 0x2ba2
callq 0x2c6a
callq 0x2d27
xorl %eax, %eax
movdqa 0x5627(%rip), %xmm0     # 0x8070
leaq 0xe3090(%rip), %rcx     # 0xe5ae0
leaq 0x9a89(%rip), %rbx      # 0xc4e0
movdqa (%rax,%r12), %xmm1
por (%rax,%r15), %xmm1
pxor (%rax,%r14), %xmm1
movdqa %xmm1, 0x400(%rax,%rbx)
pand %xmm0, %xmm1
movdqa %xmm1, (%rax,%rcx)
addq $0x10, %rax
cmpq $0x200, %rax            # imm = 0x200
jne 0x2a57
callq 0x2e68
movq $-0x40, %rax
movdqa 0x800(%rbx,%rax,8), %xmm0
por 0x600(%rbx,%rax,8), %xmm0
movdqa %xmm0, 0xa00(%rbx,%rax,8)
addq $0x2, %rax
jne 0x2a93
callq 0x2fa4
callq 0x316a
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3330