LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/lzma/C/Lzma2Dec.c
// Function: Lzma2Dec_DecodeToBuf
SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
{
  SizeT outSize = *destLen, inSize = *srcLen;
  *srcLen = *destLen = 0;
  
  for (;;)
  {
    SizeT inCur = inSize, outCur, dicPos;
    ELzmaFinishMode curFinishMode;
    SRes res;
    
    if (p->decoder.dicPos == p->decoder.dicBufSize)
      p->decoder.dicPos = 0;
    dicPos = p->decoder.dicPos;
    curFinishMode = LZMA_FINISH_ANY;
    outCur = p->decoder.dicBufSize - dicPos;
    
    if (outCur >= outSize)
    {
      outCur = outSize;
      curFinishMode = finishMode;
    }

    res = Lzma2Dec_DecodeToDic(p, dicPos + outCur, src, &inCur, curFinishMode, status);
    
    src += inCur;
    inSize -= inCur;
    *srcLen += inCur;
    outCur = p->decoder.dicPos - dicPos;
    memcpy(dest, p->decoder.dic + dicPos, outCur);
    dest += outCur;
    outSize -= outCur;
    *destLen += outCur;
    if (res != 0)
      return res;
    if (outCur == 0 || outSize == 0)
      return SZ_OK;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %rbp
movq (%rdx), %rax
movq (%r8), %rsi
xorl %r9d, %r9d
movq %rdx, 0x20(%rsp)
movq %r9, (%rdx)
movq %r8, 0x28(%rsp)
movq %r9, (%r8)
movq %rsi, 0x30(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x30(%rbp), %rsi
movq 0x38(%rbp), %r15
cmpq %rsi, %r15
jne 0x57e92
movq $0x0, 0x38(%rbp)
xorl %r15d, %r15d
subq %r15, %rsi
cmpq %rax, %rsi
movq %rax, 0x38(%rsp)
cmovaeq %rax, %rsi
movl 0x8(%rsp), %r8d
movl $0x0, %eax
cmovbl %eax, %r8d
addq %r15, %rsi
movq %rbp, %rdi
movq %rcx, 0x40(%rsp)
movq %rcx, %rdx
leaq 0x18(%rsp), %rcx
movq 0x80(%rsp), %r9
callq 0x57800
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %r13
movq 0x28(%rsp), %rax
addq %r13, (%rax)
movq 0x38(%rbp), %rbx
movq %rbx, %r14
subq %r15, %r14
movq %rbp, %r12
movq 0x28(%rbp), %rsi
addq %r15, %rsi
movq 0x10(%rsp), %rdi
movq %r14, %rdx
callq 0x4290
movl 0xc(%rsp), %edx
movq 0x20(%rsp), %rax
addq %r14, (%rax)
testl %edx, %edx
jne 0x57f3f
cmpq %r15, %rbx
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rsi
je 0x57f3f
movq %r12, %rbp
subq %r14, %rax
addq %r14, 0x10(%rsp)
subq %r13, %rsi
addq %r13, %rcx
testq %rax, %rax
jne 0x57e70
movl %edx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/lzma/C/Lzma2Dec.c
// Function: Lzma2Decode
SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
    Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAllocPtr alloc)
{
  CLzma2Dec p;
  SRes res;
  SizeT outSize = *destLen, inSize = *srcLen;
  *destLen = *srcLen = 0;
  *status = LZMA_STATUS_NOT_SPECIFIED;
  Lzma2Dec_CONSTRUCT(&p)
  RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc))
  p.decoder.dic = dest;
  p.decoder.dicBufSize = outSize;
  Lzma2Dec_Init(&p);
  *srcLen = inSize;
  res = Lzma2Dec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
  *destLen = p.decoder.dicPos;
  if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
    res = SZ_ERROR_INPUT_EOF;
  Lzma2Dec_FreeProbs(&p, alloc);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %r9d, 0x4(%rsp)
movq %rcx, %r12
movq %rdx, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, %rbp
movq 0xe8(%rsp), %rdx
movq 0xe0(%rsp), %rax
movq (%rsi), %r14
movq (%rcx), %rcx
movq %rcx, 0x8(%rsp)
xorl %ebx, %ebx
movq %rbx, (%r12)
movq %rbx, (%rsi)
movl $0x0, (%rax)
leaq 0x18(%rsp), %rdi
movq %rbx, 0x28(%rdi)
movq %rbx, 0x18(%rdi)
movl %r8d, %esi
callq 0x57734
movl %eax, %r13d
testl %eax, %eax
jne 0x58043
leaq 0x28(%rsp), %rax
movq %rbp, 0x18(%rax)
movq %rax, %rbp
movq %r14, 0x20(%rax)
movl %ebx, -0x10(%rax)
movw $0xe0, -0xb(%rax)
movl %ebx, -0x4(%rax)
movq %rax, %rdi
callq 0x54fe1
movq 0x8(%rsp), %rax
movq %rax, (%r12)
leaq 0x18(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
movl 0x4(%rsp), %r8d
movq 0xe0(%rsp), %rbx
movq %rbx, %r9
callq 0x57800
movq 0x38(%r13), %rcx
movq %rcx, (%r15)
movl $0x1, %r13d
testl %eax, %eax
jne 0x58033
xorl %eax, %eax
cmpl $0x3, (%rbx)
movl $0x6, %r13d
cmovnel %eax, %r13d
movq %rbp, %rdi
movq 0xe8(%rsp), %rsi
callq 0x57311
movl %r13d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: diagMasks(int, unsigned long)
bitboard diagMasks (int sq, bitboard occupied){
    int iter = sq;
   bitboard bb = squareBitMask[sq];
    
    //Diagonal
    //north east
    bitboard diag = bb;
    while( (square_to_rank(square(iter)) < numOfRank-1) && (square_to_file(square(iter)) < numOfFile-1) )
    {
        
        iter += noEa;
        diag |= (diag << noEa);
        if( squareBitMask[iter] & occupied) break;
    }
    
    //south west
    iter = sq;
    while( (square_to_rank(square(iter)) >= 0) && (square_to_file(square(iter)) > 0) && iter >= 0 )
    {
        iter +=soWe;
        diag |= (diag >> -soWe);
        if( squareBitMask[iter] & occupied) break;
    }
    
    //diagonalBitMask[sq] = diag;
    
    return diag;
}

// Assembly:
movslq %edi, %rcx
leaq 0x930a(%rip), %rdx      # 0xbde0
leaq (%rdx,%rcx,8), %r8
addq $0x48, %r8
movq -0x48(%r8), %rax
movl %edi, %r9d
notl %r9d
testb $0x38, %r9b
je 0x2b14
movl %edi, %r9d
andl $0x7, %r9d
cmpl $0x7, %r9d
je 0x2b14
movq %rax, %r9
shlq $0x9, %r9
orq %r9, %rax
addl $0x9, %edi
leaq 0x48(%r8), %r9
testq %rsi, (%r8)
movq %r9, %r8
je 0x2ae2
testq %rcx, %rcx
js 0x2b38
movl %ecx, %edi
andl $0x7, %edi
je 0x2b38
leaq -0x9(%rcx), %rdi
movq %rax, %r8
shrq $0x9, %r8
orq %r8, %rax
testq %rsi, -0x48(%rdx,%rcx,8)
movq %rdi, %rcx
je 0x2b14
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: antidiagMasks(int, unsigned long)
bitboard antidiagMasks (int sq, bitboard occupied){
    
    bitboard antiDiag = squareBitMask[sq];
    int iter = sq;
    while( (square_to_rank(square(iter)) < numOfRank-1) && (square_to_file(square(iter)) > 0) )
    {
        iter += noWe;
        antiDiag |= (antiDiag << noWe);
        if( squareBitMask[iter] & occupied) break;
    }
    
    //south east
    iter = sq;
    while( (square_to_rank(square(iter)) >= 0) && (square_to_file(square(iter)) < numOfFile-1) )
    {
        iter += soEa;
        antiDiag |= (antiDiag >> -soEa);
        if( squareBitMask[iter] & occupied) break;
        
    }
    
    return antiDiag;
}

// Assembly:
movslq %edi, %rdx
leaq 0x929d(%rip), %rcx      # 0xbde0
leaq (%rcx,%rdx,8), %r8
addq $0x38, %r8
movq -0x38(%r8), %rax
movl %edi, %r9d
notl %r9d
testb $0x38, %r9b
je 0x2b97
movl %edi, %r9d
andl $0x7, %r9d
je 0x2b97
movq %rax, %r9
shlq $0x7, %r9
orq %r9, %rax
addl $0x7, %edi
leaq 0x38(%r8), %r9
testq %rsi, (%r8)
movq %r9, %r8
je 0x2b4f
jmp 0x2b97
leaq -0x7(%rdx), %rdi
movq %rax, %r8
shrq $0x7, %r8
orq %r8, %rax
testq %rsi, -0x38(%rcx,%rdx,8)
movq %rdi, %rdx
jne 0x2ba1
movl %edx, %edi
notl %edi
testb $0x7, %dil
jne 0x2b7f
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: allPawnAttacks()
void allPawnAttacks(){
    bitboard pawnA = 0ULL, pawnH = 0ULL, pawnAttacks = 0ULL;
    square sq = a1;
    
    for(rank rk = rank_1; rk<numOfRank-1; rk++)
    {
        for(file f = file_a; f<numOfFile; f++)
        {
            sq = rankFile_to_sq(rk, f);
            pawnA = squareBitMask[sq] & clearFile[file_a];
            pawnH = squareBitMask[sq] & clearFile[file_h];
            
            pawnAttacks |= (pawnA << noWe);
            pawnAttacks |= (pawnH << noEa);
            
            //printBitboard(pawnAttacks);
            openBoardPawnAttacks[0][sq] = pawnAttacks;
            pawnAttacks = 0ULL;
        }
    }
    
    for(rank rk = rank_8; rk > rank_1; rk--)
    {
        for(file f = file_a; f<numOfFile; f++)
        {
            sq = rankFile_to_sq(rk, f);
            pawnA = squareBitMask[sq] & clearFile[file_a];
            pawnH = squareBitMask[sq] & clearFile[file_h];
            
            pawnAttacks |= (pawnA >> -soWe);
            pawnAttacks |= (pawnH >> -soEa);
            
            //printBitboard(pawnAttacks);
            openBoardPawnAttacks[1][sq] = pawnAttacks;
            pawnAttacks = 0ULL;
        }
    }
}

// Assembly:
movq 0x98b6(%rip), %xmm0     # 0xc460
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movq 0x98e1(%rip), %xmm1     # 0xc498
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
xorl %eax, %eax
leaq 0x921b(%rip), %rcx      # 0xbde0
leaq 0xa514(%rip), %rdx      # 0xd0e0
xorl %esi, %esi
xorl %edi, %edi
leaq (%rax,%rdi), %r8
movdqa (%rcx,%r8), %xmm2
movdqa %xmm0, %xmm3
pand %xmm2, %xmm3
pand %xmm1, %xmm2
psllq $0x7, %xmm3
psllq $0x9, %xmm2
por %xmm3, %xmm2
movdqa %xmm2, (%rdx,%r8)
addq $0x10, %rdi
cmpq $0x40, %rdi
jne 0x2bd0
incq %rsi
addq $0x40, %rax
cmpq $0x7, %rsi
jne 0x2bce
movl $0x7, %edx
leaq 0xa883(%rip), %rax      # 0xd4a0
leaq 0x937c(%rip), %rcx      # 0xbfa0
xorl %esi, %esi
movdqa (%rcx,%rsi,8), %xmm2
movdqa %xmm0, %xmm3
pand %xmm2, %xmm3
pand %xmm1, %xmm2
psrlq $0x9, %xmm3
psrlq $0x7, %xmm2
por %xmm3, %xmm2
movdqa %xmm2, (%rax,%rsi,8)
addq $0x2, %rsi
cmpq $0x8, %rsi
jne 0x2c26
leaq -0x1(%rdx), %rsi
addq $-0x40, %rax
addq $-0x40, %rcx
cmpq $0x1, %rdx
movq %rsi, %rdx
ja 0x2c24
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: allKingAttacks()
void allKingAttacks(){
    bitboard kingA = 0ULL, kingH = 0ULL, kingMoves = 0ULL, king = 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);
            kingA = squareBitMask[sq] & clearFile[file_a];
            kingH = squareBitMask[sq] & clearFile[file_h];
            king  = squareBitMask[sq];
            
            kingMoves |= (kingA << noWe);
            kingMoves |= (king  << nort);
            kingMoves |= (kingH << noEa);
            kingMoves |= (kingH << east);
            kingMoves |= (kingH >> -soEa);
            kingMoves |= (king  >> -south);
            kingMoves |= (kingA >> -soWe);
            kingMoves |= (kingA >> -west);
            
           // printBitboard(kingMoves);
            openBoardAttacks[p_king][sq] = kingMoves;
            kingMoves = 0ULL;
        }
        
    }
}

// Assembly:
pshufd $0x44, 0x97ed(%rip), %xmm0 # xmm0 = mem[0,1,0,1]
movq 0x981d(%rip), %xmm1     # 0xc498
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
leaq 0xa259(%rip), %rax      # 0xcee0
leaq 0x9152(%rip), %rcx      # 0xbde0
xorl %edx, %edx
xorl %esi, %esi
movdqa (%rcx,%rsi,8), %xmm3
movdqa %xmm0, %xmm2
pand %xmm3, %xmm2
movdqa %xmm1, %xmm4
pand %xmm3, %xmm4
movdqa %xmm2, %xmm5
psllq $0x7, %xmm5
movdqa %xmm3, %xmm6
psllq $0x8, %xmm6
movdqa %xmm4, %xmm7
psllq $0x9, %xmm7
movdqa %xmm4, %xmm8
paddq %xmm4, %xmm8
por %xmm7, %xmm8
psrlq $0x7, %xmm4
por %xmm8, %xmm4
psrlq $0x8, %xmm3
por %xmm6, %xmm3
por %xmm5, %xmm3
movdqa %xmm2, %xmm5
psrlq $0x9, %xmm5
psrlq $0x1, %xmm2
por %xmm5, %xmm2
por %xmm3, %xmm2
por %xmm4, %xmm2
movdqa %xmm2, (%rax,%rsi,8)
addq $0x2, %rsi
cmpq $0x8, %rsi
jne 0x2c92
incq %rdx
addq $0x40, %rax
addq $0x40, %rcx
cmpq $0x8, %rdx
jne 0x2c90
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
movdqu 0x9739(%rip), %xmm2     # 0xc468
pshufd $0x44, 0x9728(%rip), %xmm0 # xmm0 = mem[0,1,0,1]
movq 0x9758(%rip), %xmm1     # 0xc498
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
pshufd $0x44, %xmm2, %xmm2     # xmm2 = xmm2[0,1,0,1]
leaq 0x998f(%rip), %rax      # 0xc6e0
leaq 0x9088(%rip), %rcx      # 0xbde0
pshufd $0x44, 0x972f(%rip), %xmm3 # xmm3 = mem[0,1,0,1]
xorl %edx, %edx
xorl %esi, %esi
movdqa (%rcx,%rsi,8), %xmm7
movdqa %xmm0, %xmm5
pand %xmm7, %xmm5
movdqa %xmm1, %xmm4
pand %xmm7, %xmm4
movdqa %xmm5, %xmm6
pand %xmm2, %xmm6
movdqa %xmm6, %xmm8
psllq $0x6, %xmm8
movdqa %xmm5, %xmm9
psllq $0xf, %xmm9
movdqa %xmm4, %xmm10
psllq $0x11, %xmm10
pand %xmm3, %xmm7
pand %xmm1, %xmm7
movdqa %xmm7, %xmm11
psllq $0xa, %xmm11
psrlq $0x6, %xmm7
por %xmm11, %xmm7
psrlq $0xf, %xmm4
por %xmm7, %xmm4
psrlq $0x11, %xmm5
por %xmm9, %xmm5
por %xmm8, %xmm5
psrlq $0xa, %xmm6
por %xmm10, %xmm6
por %xmm5, %xmm6
por %xmm4, %xmm6
movdqa %xmm6, (%rax,%rsi,8)
addq $0x2, %rsi
cmpq $0x8, %rsi
jne 0x2d65
incq %rdx
addq $0x40, %rax
addq $0x40, %rcx
cmpq $0x8, %rdx
jne 0x2d63
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: allBishopAttacks()
void allBishopAttacks(){
    for(square sq= a1; sq<numOfSq; sq++){
     
        magicBishopMask[sq] = clearEdges &( squareBitMask[sq] ^(diagonalBitMask[sq] | antiDiagonalBitMask[sq]));
        openBoardAttacks[p_bishop][sq] =  squareBitMask[sq] ^(diagonalBitMask[sq] | antiDiagonalBitMask[sq]);
       // printBitboard(openBoardAttacks[p_bishop][sq]);
    }
}

// Assembly:
xorl %eax, %eax
leaq 0x8fc4(%rip), %rcx      # 0xbde0
leaq 0x923d(%rip), %rdx      # 0xc060
leaq 0x9436(%rip), %rsi      # 0xc260
movaps 0x523f(%rip), %xmm0     # 0x8070
leaq 0xe2ca8(%rip), %rdi     # 0xe5ae0
leaq 0x96a1(%rip), %r8       # 0xc4e0
movaps (%rax,%rsi), %xmm1
orps (%rax,%rdx), %xmm1
xorps (%rax,%rcx), %xmm1
movaps %xmm1, 0x400(%rax,%r8)
andps %xmm0, %xmm1
movaps %xmm1, (%rax,%rdi)
addq $0x10, %rax
cmpq $0x200, %rax            # imm = 0x200
jne 0x2e3f
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: allRookAttacks()
void allRookAttacks(){
    bitboard rookMoves = 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);
            rookMoves = fileBitMask[f] | rankBitMask[rk];
            openBoardAttacks[p_rook][sq] = rookMoves ^ squareBitMask[sq];
           
            if ( (sq == a1) || (sq == a8) || (sq == h1) || (sq == h8) )
            {
                magicRookMask[sq] = (rookMoves & clearCorners);
            }
            else if(rk == rank_1)
                magicRookMask[sq] = squareBitMask[sq] ^ (rookMoves & (clearEdges | (rank1 & clearCorners)));
            else if (rk == rank_8)
                magicRookMask[sq] = squareBitMask[sq] ^ (rookMoves & (clearEdges | (rank8 & clearCorners)));
            else if (f == file_a)
                magicRookMask[sq] = squareBitMask[sq] ^ (rookMoves & (clearEdges | (fileA & clearCorners)));
            else if (f == file_h)
                magicRookMask[sq] = squareBitMask[sq] ^ (rookMoves & (clearEdges | (fileH & clearCorners)));
            else
            {
                magicRookMask[sq] = squareBitMask[sq] ^ (rookMoves & clearEdges );
            }
                
            //printBitboard( openBoardAttacks[p_rook][sq]);
            //printBitboard(magicRookMask[sq]);
            rookMoves = 0ULL;
            
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x8f67(%rip), %rax      # 0xbde0
leaq 0x9c60(%rip), %rcx      # 0xcae0
leaq 0x1a659(%rip), %rdx     # 0x1d4e0
movabsq $0x7e7e7e7e7e7e00, %rsi # imm = 0x7E7E7E7E7E7E00
xorl %edi, %edi
movabsq $0x7e7e7e7e7e7e7e00, %r10 # imm = 0x7E7E7E7E7E7E7E00
leaq 0x7e(%rsi), %r11
movabsq $-0x7effffffffffff7f, %r15 # imm = 0x8100000000000081
movabsq $0x7effffffffffff7e, %r12 # imm = 0x7EFFFFFFFFFFFF7E
xorl %r13d, %r13d
leaq 0x9161(%rip), %rsi      # 0xc020
movq (%rsi,%r13,8), %rbp
leaq 0x9116(%rip), %r9       # 0xbfe0
xorl %ebx, %ebx
movq (%r9), %r14
orq %rbp, %r14
movq (%rax,%rbx,8), %r8
movq %r14, %rsi
xorq %r8, %rsi
movq %rsi, (%rcx,%rbx,8)
leaq (%rdi,%rbx), %rsi
cmpl $0x3f, %esi
ja 0x2f07
movl %esi, %esi
btq %rsi, %r15
jae 0x2f07
andq %r12, %r14
movq %r14, (%rdx,%rbx,8)
incq %rbx
addq $0x8, %r9
cmpq $0x8, %rbx
jne 0x2ecc
jmp 0x2f4f
cmpl $0x7, %r13d
je 0x2f17
testl %r13d, %r13d
jne 0x2f1c
andq %r11, %r14
jmp 0x2f4a
andq %r10, %r14
jmp 0x2f4a
cmpl $0x7, %ebx
je 0x2f31
testl %ebx, %ebx
jne 0x2f3d
movabsq $0x7f7f7f7f7f7f00, %rsi # imm = 0x7F7F7F7F7F7F00
jmp 0x2f47
movabsq $0xfefefefefefe00, %rsi # imm = 0xFEFEFEFEFEFE00
jmp 0x2f47
movabsq $0x7e7e7e7e7e7e00, %rsi # imm = 0x7E7E7E7E7E7E00
andq %rsi, %r14
xorq %r8, %r14
jmp 0x2ef4
incq %r13
addq $0x40, %rax
addq $0x40, %rcx
addq $0x40, %rdx
addq $0x8, %rdi
cmpq $0x8, %r13
jne 0x2eb8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: vertMasks(int, unsigned long)
bitboard vertMasks (int sq, bitboard occupied){
    int iter = sq;
    bitboard bb = squareBitMask[sq];
    
    //vertical
    //north
    bitboard vert = bb;
    while( square_to_rank(square(iter)) < numOfRank-1 )
    {
        
        iter += nort;
        vert |= (vert << nort);
        if( squareBitMask[iter] & occupied) break;
    }
    
    //south
    iter = sq;
    while( square_to_rank(square(iter)) > 0)
    {
        iter +=south;
        vert |= (vert >> -south);
        if( squareBitMask[iter] & occupied) break;
    }
    
    return vert;
}

// Assembly:
movslq %edi, %rdx
leaq 0x88f2(%rip), %rcx      # 0xbde0
movq (%rcx,%rdx,8), %rax
movq %rdx, %rdi
movl %edi, %r8d
notl %r8d
testb $0x38, %r8b
je 0x3533
leaq 0x8(%rdi), %r8
movq %rax, %r9
shlq $0x8, %r9
orq %r9, %rax
testq %rsi, 0x40(%rcx,%rdi,8)
movq %r8, %rdi
je 0x34f5
jmp 0x3533
leaq -0x8(%rdx), %rdi
movq %rax, %r8
shrq $0x8, %r8
orq %r8, %rax
testq %rsi, -0x40(%rcx,%rdx,8)
movq %rdi, %rdx
jne 0x3538
testb $0x38, %dl
jne 0x351b
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/bitboard.cpp
// Function: printBitboard(unsigned long)
void printBitboard(bitboard board)
{
    std::cout << "---------------\n";
    for(rank r = rank_8; r>=0; r--)
    {
        for(file f = file_a; f<numOfFile; f++)
        {
            if(board & squareBitMask[rankFile_to_sq(r, f)]) std::cout << "# ";
            else std::cout << "- ";
        }
        std::cout <<"\n";
    }
    std::cout << "---------------\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x79b4(%rip), %r14      # 0xafc0
leaq 0x4a6d(%rip), %rsi      # 0x8080
movl $0x10, %edx
movq %r14, %rdi
callq 0x2180
movl $0x7, %eax
leaq 0x8974(%rip), %r13      # 0xbfa0
leaq 0x4a61(%rip), %rbp      # 0x8094
leaq 0x4a57(%rip), %r15      # 0x8091
movq %rax, (%rsp)
xorl %r12d, %r12d
movq %rbp, %rsi
testq %rbx, (%r13,%r12,8)
je 0x364e
movq %r15, %rsi
movl $0x2, %edx
movq %r14, %rdi
callq 0x2180
incq %r12
cmpq $0x8, %r12
jne 0x3641
movl $0x1, %edx
movq %r14, %rdi
leaq 0x4d96(%rip), %rsi      # 0x8409
callq 0x2180
addq $-0x40, %r13
movq (%rsp), %rax
subq $0x1, %rax
jae 0x363a
movq 0x7933(%rip), %rdi      # 0xafc0
leaq 0x49ec(%rip), %rsi      # 0x8080
movl $0x10, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2180
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: generateQuiet(position const&, candidate*)
candidate* generateQuiet(const position& pos, candidate* moveList){
    player us = pos.get_sideToPlay();
    player them = player(!us);
    bitboard quiets = ~(pos.get_pieces());
    bitboard clear7Rank = us == white ? clearRank[rank_8] : clearRank[rank_1];
    
    moveList = sliderMoves(pos, quiets, moveList);
    moveList = pawnPushMoves(pos, pos.get_pieces(us, p_pawn), us, quiets & clear7Rank, moveList);
    moveList = kingMoves(pos, quiets, moveList);
    moveList = knightMoves(pos.get_pieces(us, p_knight), quiets, moveList);
    
    
    return moveList;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rdx
movq %rdi, %rbx
movl 0x17c(%rdi), %ebp
leaq 0x100(%rdi), %rax
leaq 0x138(%rdi), %rcx
leaq 0x108(%rdi), %r12
testl %ebp, %ebp
cmovneq %rcx, %r12
leaq 0x130(%rdi), %r13
testl %ebp, %ebp
leaq 0x8dad(%rip), %rcx      # 0xc4a0
cmoveq %rax, %r13
leaq 0x38(%rcx), %rax
testl %ebp, %ebp
movq 0x170(%rdi), %r14
notq %r14
cmovneq %rcx, %rax
movq (%rax), %r15
andq %r14, %r15
movq %r14, %rsi
callq 0x3e7a
movq (%r13), %rsi
movq %rbx, %rdi
movl %ebp, %edx
movq %r15, %rcx
movq %rax, %r8
callq 0x3fcc
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x409f
movq (%r12), %rdi
movq %r14, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4108
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: generateCapture(position const&, candidate*)
candidate* generateCapture(const position& pos, candidate* moveList)
{
    
    player us = pos.get_sideToPlay();
    player them = player(!us);
    bitboard captures = pos.get_pieces(them);
    bitboard pawnCaptures = us == white ? captures & clearRank[rank_8] : captures & clearRank[rank_1];
    
    moveList = kingMoves(pos, captures, moveList);
    moveList = knightMoves(pos.get_pieces(us, p_knight), captures, moveList);
    moveList = pawnAttackMoves(pos.get_pieces(us, p_pawn), us, pawnCaptures , moveList);
    moveList = sliderMoves(pos, captures, moveList);
    
    
    
    return moveList;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rdx
movq %rdi, %rbx
movl 0x17c(%rdi), %ebp
xorl %eax, %eax
testl %ebp, %ebp
sete %al
movq 0x160(%rdi,%rax,8), %r14
leaq 0x8d1a(%rip), %rax      # 0xc4a0
je 0x37b6
movq (%rax), %r15
andq %r14, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x409f
movq 0x138(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4108
movq 0x130(%rbx), %rdi
movl %ebp, %esi
jmp 0x37e3
movq 0x38(%rax), %r15
andq %r14, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x409f
movq 0x108(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4108
movq 0x100(%rbx), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0x414d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3e7a
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: generateNonEvasions(position const&, candidate*)
candidate* generateNonEvasions(const position& pos, candidate* moveList)
{
    moveList = generateCapture(pos, moveList);
    moveList = generatePromotions(pos, moveList);
    moveList = generateQuiet(pos, moveList);
    if(pos.get_castlingRights(pos.get_sideToPlay()))moveList = generateCastling(pos, moveList);
    if(pos.get_enPassent() != empty) moveList = generateEnPassent(pos, moveList);

return moveList;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x375d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3aa1
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36b1
xorl %edx, %edx
cmpl $0x0, 0x17c(%rbx)
setne %dl
movq 0x188(%rbx), %rcx
leal (%rdx,%rdx,8), %edx
addl $0x3, %edx
testl %edx, 0x8(%rcx)
je 0x3a8d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b30
movq 0x188(%rbx), %rcx
cmpl $0x40, 0x4(%rcx)
jne 0x3a95
popq %rbx
retq
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
jmp 0x3d34
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: generatePromotions(position const&, candidate*)
candidate* generatePromotions(const position& pos, candidate* moveList){
 
    
    player us = pos.get_sideToPlay();
    player them = player(!us);
    bitboard quiets = ~(pos.get_pieces());
    bitboard captures = pos.get_pieces(them);
    bitboard rank7Sq = us == white ? rankBitMask[rank_7] : rankBitMask[rank_2];
    bitboard rank8Sq = us == white ? rankBitMask[rank_8] : rankBitMask[rank_1];
    
    moveList = pawnPushMoves(pos, pos.get_pieces(us, p_pawn) & rank7Sq, us, quiets & rank8Sq, moveList);
    
    moveList = pawnAttackMoves(pos.get_pieces(us, p_pawn) & rank7Sq, us, captures & rank8Sq, moveList);
    
    return moveList;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r8
movl 0x17c(%rdi), %ebx
leaq 0x8567(%rip), %rax      # 0xc020
leaq 0x30(%rax), %rdx
leaq 0x8(%rax), %rsi
leaq 0x38(%rax), %r9
leaq 0x130(%rdi), %r10
leaq 0x100(%rdi), %r12
xorl %r11d, %r11d
testl %ebx, %ebx
sete %r11b
movq 0x170(%rdi), %rcx
cmoveq %rdx, %rsi
notq %rcx
movq (%rsi), %r14
cmovneq %rax, %r9
movq (%r9), %r15
cmovneq %r10, %r12
movq (%r12), %rsi
andq %r14, %rsi
andq %r15, %rcx
andq 0x160(%rdi,%r11,8), %r15
movl %ebx, %edx
callq 0x3fcc
andq (%r12), %r14
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %rax, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x414d
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: generateAllLegal(position const&, candidate*)
candidate* generateAllLegal (const position& pos, candidate* moveList)
{
   
    if(pos.get_pieces(player(!(pos.get_sideToPlay()))) & pos.squareAttackedBy(pos.get_king_sq(pos.get_sideToPlay()))) {
       //std::cout <<"inside evasion\n";
       // printBitboard(pos.get_pieces(player(!(pos.get_sideToPlay())))&pos.squareAttackedBy(pos.get_king_sq(pos.get_sideToPlay())));
       // pos.printBoard();
        
        return generateEvasion(pos, moveList);
    }
    else{
       //  std::cout <<"inside else\n";
    
    moveList = generateCapture(pos, moveList);
    moveList = generatePromotions(pos, moveList);
    moveList = generateQuiet(pos, moveList);
    if(pos.get_castlingRights(pos.get_sideToPlay()))moveList = generateCastling(pos, moveList);
    if(pos.get_enPassent() != empty) moveList = generateEnPassent(pos, moveList);
    }
   
    
    return moveList;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
bsfq 0x128(%rdi), %rcx
bsfq 0x158(%rdi), %rax
movq %rsi, %r14
xorl %edx, %edx
cmpl $0x0, 0x17c(%rdi)
sete %dl
movq 0x160(%rdi,%rdx,8), %r15
cmovel %ecx, %eax
movl %eax, %esi
callq 0x57e6
testq %r15, %rax
je 0x3e0d
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x380b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x375d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3aa1
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36b1
xorl %edx, %edx
cmpl $0x0, 0x17c(%rbx)
setne %dl
movq 0x188(%rbx), %rcx
leal (%rdx,%rdx,8), %edx
addl $0x3, %edx
testl %edx, 0x8(%rcx)
je 0x3e5e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b30
movq 0x188(%rbx), %rcx
cmpl $0x40, 0x4(%rcx)
jne 0x3e6a
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x3d34
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: pawnAttackMoves(unsigned long, player, unsigned long, candidate*)
candidate* pawnAttackMoves (bitboard pawns, player color ,bitboard target, candidate* moveList){
    
    bitboard squares = 0;
    square from = empty, to = empty;
    move mov = none;
    bitboard rank8Sq = color == white ? rankBitMask[rank_8] : rankBitMask[rank_1];
    
    while(pawns)
    {
        from = lsb_sq(pawns);
        //check now if the from square is absolute pinned
        squares = target & openBoardPawnAttacks[color][from];
        while(squares)
        {
            //could check here if the to square places their king in check
            to  = lsb_sq(squares);
            
            if (squareBitMask[to]  & rank8Sq) {
               moveList = makePromotionMoves(from, to, moveList);
            }
            else{
                mov = make_move(from, to);
                (*moveList++).mv = mov;
            }
            pop_lsb(&squares);
        }
        pop_lsb(&pawns);
        
    }
    
    return moveList;
}

// Assembly:
pushq %rbp
pushq %rbx
movq %rcx, %rax
leaq 0x7ec7(%rip), %r8       # 0xc020
leaq 0x38(%r8), %rcx
testl %esi, %esi
cmovneq %r8, %rcx
testq %rdi, %rdi
je 0x41c2
movq (%rcx), %rcx
movl %esi, %esi
shlq $0x9, %rsi
addq 0x6e50(%rip), %rsi      # 0xafc8
leaq 0x7c61(%rip), %r8       # 0xbde0
bsfq %rdi, %r9
movq (%rsi,%r9,8), %r10
andq %rdx, %r10
je 0x41b9
bsfq %r10, %r11
movl %r11d, %ebx
shll $0x6, %ebx
leal (%rbx,%r9), %ebp
addl $0xf000, %ebp           # imm = 0xF000
orl %r9d, %ebx
testq %rcx, (%r8,%r11,8)
cmovel %ebx, %ebp
movl %ebp, (%rax)
addq $0x8, %rax
leaq -0x1(%r10), %r11
andq %r11, %r10
jne 0x418c
leaq -0x1(%rdi), %r9
andq %r9, %rdi
jne 0x417f
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/moveGen.cpp
// Function: printmove(move)
void printmove (move m)
{
   /* square from ,to;
    char mv [4];
    
        from = source_sq(m);
    to = destination_sq(m);
        mv[0] = square_to_file(from) + 'A';
        mv[1] = square_to_rank(from) + '1';
        mv[2] = square_to_file(to) + 'A';
        mv[3] = square_to_rank(to) + '1';
        std::cout << mv[0] << mv[1] << mv[2] << mv[3] << "\n";
    
    */
    std::string pieceletters = "_NBRQ";
    std::string flagletters = "_recp";
    square from ,to;
    char mv [7];
    
    from = source_sq(m);
    to = destination_sq(m);
    mv[0] = square_to_file(from) + 'A';
    mv[1] = square_to_rank(from) + '1';
    mv[2] = square_to_file(to) + 'A';
    mv[3] = square_to_rank(to) + '1';
    mv[4] = ' ';
    mv[5] = pieceletters[promo_pieceType(m)] ;
    mv[6] = flagletters[move_flag(m)+1]; //for non promotions, shows up at N because the offset of piece promotion
    std::cout << mv[0] << mv[1] << mv[2] << mv[3] << mv[4] << mv[5] << mv[6]  << "\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movl %edi, %ebx
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x40ab(%rip), %rsi      # 0x82a0
leaq 0x40a9(%rip), %rdx      # 0x82a5
leaq 0x30(%rsp), %rdi
callq 0x4592
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4090(%rip), %rsi      # 0x82a6
leaq 0x408e(%rip), %rdx      # 0x82ab
leaq 0x10(%rsp), %rdi
callq 0x4592
movl %ebx, %eax
andb $0x7, %al
addb $0x41, %al
movl %ebx, %ecx
shrl $0xc, %ecx
andl $0x3, %ecx
movq 0x30(%rsp), %rdx
movb 0x1(%rdx,%rcx), %r12b
movl %ebx, %ecx
shrl $0xe, %ecx
andl $0x3, %ecx
movq 0x10(%rsp), %rdx
movb 0x1(%rdx,%rcx), %bpl
leaq 0xf(%rsp), %rsi
movb %al, (%rsi)
movq 0x6d61(%rip), %rdi      # 0xafc0
movl $0x1, %edx
callq 0x2180
movl %ebx, %ecx
shrb $0x3, %cl
andb $0x7, %cl
addb $0x31, %cl
leaq 0xf(%rsp), %rsi
movb %cl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movl %ebx, %ecx
shrl $0x6, %ecx
andb $0x7, %cl
addb $0x41, %cl
leaq 0xf(%rsp), %rsi
movb %cl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
shrl $0x9, %ebx
andb $0x7, %bl
addb $0x31, %bl
leaq 0xf(%rsp), %rsi
movb %bl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0xf(%rsp), %rsi
movb %r12b, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0xf(%rsp), %rsi
movb %bpl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x40ff(%rip), %rsi      # 0x8409
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x432e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2160
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x4345
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2160
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4371
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x4371
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2160
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x4388
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2230
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::reset()
void position::reset(){
   
    state = new returnState();
    
    //reset return state, its ok to do it twice at start up, this is for reset by gui
    state ->captured = not_piece;
    state -> m = none;
    state -> prev = NULL;
    
    
    //these could be overwritten by the fen called in setboard
    ply = 0;
    sideToPlay = white;
    nodes = 0;
    
    //all pieces and square realted things should be handdled in setboard()
    setboard();
    update_material(state);
    update_check_boards(state);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x48, %edi
callq 0x2150
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
xorl %ecx, %ecx
movq %rcx, 0x40(%rax)
movq %rax, 0x188(%rbx)
movaps 0x3c79(%rip), %xmm1     # 0x82e0
movups %xmm1, (%rax)
movl $0x0, 0x10(%rax)
movq %rcx, 0x18(%rax)
movups %xmm0, 0x178(%rbx)
movq %rbx, %rdi
callq 0x4be4
movq 0x188(%rbx), %rsi
movq %rbx, %rdi
callq 0x4b30
movq 0x188(%rbx), %rsi
movq %rbx, %rdi
popq %rbx
jmp 0x4b9c
nop
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::updatePositionFen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void position::updatePositionFen(std::string fen)
{
    returnState *newState = new returnState();
    newState ->prev = state;
    state = newState;
    
    
    //Code ripped from the setboard function below.
    for(square sq =a1; sq < numOfSq; sq++)
    {
        board[sq] = not_piece;
    }
    
    for(piece p = w_pawn; p<numOfPieces ; p++ )
    {
        pieces[p] = 0ULL;
    }
    allWhitePieces = 0ULL;
    allBlackPieces = 0ULL;
    allPieces = allWhitePieces | allBlackPieces;
    
    nodes = 0;
    
    fenParser(fen);
    update_material(state);
    update_check_boards(state);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x48, %edi
callq 0x2150
movaps 0x3c21(%rip), %xmm0     # 0x82e0
movups %xmm0, (%rax)
movl $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movq $0x0, 0x40(%rax)
movq 0x188(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x188(%rbx)
xorl %eax, %eax
movaps 0x3bf9(%rip), %xmm0     # 0x82f0
movups %xmm0, (%rbx,%rax,4)
addq $0x4, %rax
cmpq $0x40, %rax
jne 0x46f7
xorl %eax, %eax
movq %rax, 0x180(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x100(%rbx)
movups %xmm0, 0x110(%rbx)
movups %xmm0, 0x120(%rbx)
movups %xmm0, 0x130(%rbx)
movups %xmm0, 0x140(%rbx)
movups %xmm0, 0x150(%rbx)
movups %xmm0, 0x160(%rbx)
movq %rax, 0x170(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x477a
movq 0x188(%rbx), %rsi
movq %rbx, %rdi
callq 0x4b30
movq 0x188(%rbx), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4b9c
nop
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::update_material(returnState*)
void position::update_material(returnState *state)
{
    bitboard pieces = 0;
   //white
    //have to increment pt+1 due to indexing
    for( piece pt = w_pawn ; pt < w_king; pt++)
    {
        pieces = get_pieces(pt);
        state -> material[white]  = state -> material[white] +(popcount(pieces) * pieceValue[pt+1]);
    }
    //black
    for( piece pt = b_pawn ; pt < b_king; pt++)
    {
        pieces = get_pieces(pt);
        state -> material[black]  =  state -> material[black] + (popcount(pieces) * pieceValue[pt-5]);
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x40(%rsi), %ebp
xorl %r12d, %r12d
leaq 0x6615(%rip), %r15      # 0xb160
movq 0x100(%r14,%r12,8), %rdi
callq 0x28c9
imull 0x4(%r15,%r12,4), %eax
incq %r12
addl %eax, %ebp
movl %ebp, 0x40(%rbx)
cmpq $0x5, %r12
jne 0x4b4b
movl 0x44(%rbx), %ebp
xorl %r12d, %r12d
movq 0x130(%r14,%r12,8), %rdi
callq 0x28c9
imull 0x4(%r15,%r12,4), %eax
addl %eax, %ebp
movl %ebp, 0x44(%rbx)
incq %r12
cmpq $0x5, %r12
jne 0x4b72
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::update_check_boards(returnState*)
void position::update_check_boards(returnState *state)
{
   
    //these are our own pieces pinned due to blocking the attacks on the king
    //The function also passes in pinners which is the their pieces causing the pin
    state -> absolutePinned[white] = pinningBoards(get_king_sq(white), state->pinners[black], white);
   
    state -> absolutePinned[black] = pinningBoards(get_king_sq(black), state->pinners[white], black);

    
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
bsfq 0x128(%rdi), %rsi
leaq 0x30(%rbx), %r15
leaq 0x38(%rbx), %rdx
xorl %ecx, %ecx
callq 0x5630
movq %rax, 0x20(%rbx)
bsfq 0x158(%r14), %rsi
movq %r14, %rdi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x5630
movq %rax, 0x28(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::place_piece(square, piece)
void position::place_piece(square sq, piece pt)
{
    //do not erase data by placing empty pieces. that is reserved for remove_piece
    player color = neither;
    if(pt != not_piece){
        board[sq] = pt;
        pieces[pt] = pieces[pt] | squareBitMask[sq];
        pt < 6 ? color = white : color = black;
        color == white ? allWhitePieces |= squareBitMask[sq] : allBlackPieces |= squareBitMask[sq];
        allPieces = allWhitePieces | allBlackPieces;
    }
}

// Assembly:
cmpl $0xc, %edx
je 0x4d15
movl %esi, %eax
movl %edx, (%rdi,%rax,4)
movl %edx, %ecx
leaq 0x7119(%rip), %rsi      # 0xbde0
movq (%rsi,%rax,8), %r8
orq %r8, 0x100(%rdi,%rcx,8)
movq (%rsi,%rax,8), %rax
cmpl $0x5, %edx
jg 0x4cf3
orq 0x160(%rdi), %rax
movq %rax, 0x160(%rdi)
movq 0x168(%rdi), %rcx
jmp 0x4d0b
orq 0x168(%rdi), %rax
movq %rax, 0x168(%rdi)
movq %rax, %rcx
movq 0x160(%rdi), %rax
orq %rax, %rcx
movq %rcx, 0x170(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::printBoard() const
void position::printBoard() const{
    std::cout <<"Current Board: \n";
    std::cout << "---------------\n";
    for(rank r = rank_8; r>=0; r--)
    {
        for(file f = file_a; f<numOfFile; f++)
        {
            std::cout<< pieceChar [ board[rankFile_to_sq(r, f)] ] << " ";
        }
        std::cout <<"\n";
    }
    std::cout << "---------------\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x5d13(%rip), %r14      # 0xafc0
leaq 0x318d(%rip), %rsi      # 0x8441
movl $0x10, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x2db8(%rip), %rsi      # 0x8080
movl $0x10, %edx
movq %r14, %rdi
callq 0x2180
addq $0xe0, %rbx
movl $0x7, %ebp
leaq 0x7(%rsp), %r15
leaq 0x3382(%rip), %r12      # 0x866f
xorl %r13d, %r13d
movl (%rbx,%r13,4), %eax
movq 0xeb215(%rip), %rcx     # 0xf0510
movb (%rcx,%rax), %al
movb %al, 0x7(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2180
incq %r13
cmpq $0x8, %r13
jne 0x52f0
movl $0x1, %edx
movq %r14, %rdi
leaq 0x30cf(%rip), %rsi      # 0x8409
callq 0x2180
addq $-0x20, %rbx
subq $0x1, %rbp
jae 0x52ed
movq 0x5c70(%rip), %rdi      # 0xafc0
leaq 0x2d29(%rip), %rsi      # 0x8080
movl $0x10, %edx
callq 0x2180
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::remove_piece(square, piece)
void position::remove_piece(square sq, piece pt)
{
        
    player color = neither;
    if(pt != not_piece){
        board[sq] = not_piece;
        pieces[pt] = pieces[pt] ^ squareBitMask[sq];
        pt < 6 ? color = white : color = black;
        color == white ? allWhitePieces ^= squareBitMask[sq] : allBlackPieces ^= squareBitMask[sq];
        allPieces = allWhitePieces | allBlackPieces;
    }
}

// Assembly:
cmpl $0xc, %edx
je 0x53d5
movl %esi, %eax
movl $0xc, (%rdi,%rax,4)
movl %edx, %ecx
leaq 0x6a59(%rip), %rsi      # 0xbde0
movq (%rsi,%rax,8), %r8
xorq %r8, 0x100(%rdi,%rcx,8)
movq (%rsi,%rax,8), %rax
cmpl $0x5, %edx
jg 0x53b3
xorq 0x160(%rdi), %rax
movq %rax, 0x160(%rdi)
movq 0x168(%rdi), %rcx
jmp 0x53cb
xorq 0x168(%rdi), %rax
movq %rax, 0x168(%rdi)
movq %rax, %rcx
movq 0x160(%rdi), %rax
orq %rax, %rcx
movq %rcx, 0x170(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::squareAttackedBy(square) const
bitboard position::squareAttackedBy (square sq) const
{
    
  //  printBitboard((attacksFromPawn(sq, black)      & get_pieces(white, p_pawn)));
   // printBitboard((attacksFromPawn(sq, white)    & get_pieces(black, p_pawn)));
    // printBitboard((attacksFrom (sq, p_knight)         & get_pieces(p_knight)));
  //   printBitboard((attacksFrom (sq, p_king)           & get_pieces(p_king)));
 //    printBitboard((attacksFrom (sq, p_rook) & get_pieces(  p_rook, p_queen)));
  //   printBitboard((attacksFrom (sq, p_bishop) & get_pieces(p_bishop, p_queen)));
    bitboard attacks =    (attacksFromPawn(sq, black)      & get_pieces(white, p_pawn))
                        | (attacksFromPawn(sq, white)    & get_pieces(black, p_pawn))
                        | (attacksFrom (sq, p_knight)         & get_pieces(p_knight))
                        | (attacksFrom (sq, p_king)           & get_pieces(p_king))
                        | (attacksFrom (sq, p_rook) & get_pieces(  p_rook, p_queen))
                        | (attacksFrom (sq, p_bishop) & get_pieces(p_bishop, p_queen));
    return attacks;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %eax
leaq 0x78e5(%rip), %rcx      # 0xd0e0
movq 0x100(%rdi), %rdx
movq 0x130(%rdi), %rsi
andq 0x200(%rcx,%rax,8), %rdx
andq (%rcx,%rax,8), %rsi
movq 0x138(%rdi), %rcx
orq 0x108(%rdi), %rcx
leaq 0x6cb6(%rip), %rdi      # 0xc4e0
andq 0x200(%rdi,%rax,8), %rcx
movq 0x158(%rbx), %r15
orq 0x128(%rbx), %r15
andq 0xa00(%rdi,%rax,8), %r15
orq %rdx, %rsi
orq %rcx, %r15
orq %rsi, %r15
movq 0x170(%rbx), %rsi
movl %ebp, %edi
movl $0x3, %edx
callq 0x357e
movq %rax, %r14
movq 0x148(%rbx), %rax
orq 0x118(%rbx), %rax
orq 0x120(%rbx), %rax
movq 0x170(%rbx), %rsi
orq 0x150(%rbx), %rax
andq %rax, %r14
movl %ebp, %edi
movl $0x2, %edx
callq 0x357e
movq 0x140(%rbx), %rcx
orq 0x110(%rbx), %rcx
orq 0x120(%rbx), %rcx
orq 0x150(%rbx), %rcx
andq %rcx, %rax
orq %r14, %rax
orq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/position.cpp
// Function: position::printAllBitboards() const
void position::printAllBitboards() const{
    
   
    for(piece p = w_pawn; p<numOfPieces; p++)
    {
        std::cout <<  "Piece: " << pieceChar[p] << "\n";
        printBitboard(pieces[p]);
        std::cout <<  "\n\n\n";
    }
    
    std::cout <<  "all White Pieces: \n";
    printBitboard(allWhitePieces);
    std::cout <<  "\n\n\n";
    
    std::cout <<  "all Black Pieces: \n";
    printBitboard(allBlackPieces);
    std::cout <<  "\n\n\n";
    
    std::cout <<  "ALL Pieces: \n";
    printBitboard(allPieces);
    std::cout <<  "\n\n\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r15d, %r15d
movq 0x54d2(%rip), %r14      # 0xafc0
leaq 0x7(%rsp), %r12
leaq 0x290f(%rip), %r13      # 0x8409
leaq 0x2906(%rip), %rbp      # 0x8407
movl $0x7, %edx
movq %r14, %rdi
leaq 0x28ef(%rip), %rsi      # 0x83ff
callq 0x2180
movq 0xea9f4(%rip), %rax     # 0xf0510
movb (%rax,%r15), %al
movb %al, 0x7(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2180
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq 0x100(%rbx,%r15,8), %rdi
callq 0x35f7
movl $0x3, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2180
incq %r15
cmpq $0xc, %r15
jne 0x5b01
movq 0x544f(%rip), %r14      # 0xafc0
leaq 0x2893(%rip), %rsi      # 0x840b
movl $0x13, %edx
movq %r14, %rdi
callq 0x2180
movq 0x160(%rbx), %rdi
callq 0x35f7
leaq 0x286f(%rip), %r15      # 0x8407
movl $0x3, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x2870(%rip), %rsi      # 0x841f
movl $0x13, %edx
movq %r14, %rdi
callq 0x2180
movq 0x168(%rbx), %rdi
callq 0x35f7
movl $0x3, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x2854(%rip), %rsi      # 0x8433
movl $0xd, %edx
movq %r14, %rdi
callq 0x2180
movq 0x170(%rbx), %rdi
callq 0x35f7
movl $0x3, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/search.cpp
// Function: perftDivide(int, position&)
bitboard perftDivide (int depth, position& pos)
{
    
    candMoveList movs;
    
    movs.end = generateAllLegal(pos, movs.end);
    returnState state = returnState();
    bitboard nodes = 0;
    bitboard totalNodes =0;
    while( movs.start != movs.end)
    {
        if(pos.legal(movs.start -> mv))
        {
            pos.do_move(movs.start -> mv, state);
            nodes = perft(depth -1, pos);
            totalNodes += nodes;
         //   printmove(movs.start->mv);
          //  std::cout << "nodes: " << nodes << "\n\n";
            pos.undo_move(movs.start -> mv);
        }
        
        movs.start ++;
        
    }
    return totalNodes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x858, %rsp            # imm = 0x858
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
movq %r14, -0x8(%r14)
movq %rsi, %rdi
movq %r14, %rsi
callq 0x3dbf
movq %rax, -0x10(%r14)
movaps 0x22a3(%rip), %xmm0     # 0x82e0
movaps %xmm0, (%rsp)
movl $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movups %xmm0, 0x28(%rsp)
movups %xmm0, 0x38(%rsp)
movq -0x8(%r14), %rcx
cmpq %rax, %rcx
je 0x60bf
decl %ebp
xorl %r14d, %r14d
movq %rsp, %r15
movl (%rcx), %esi
movq %rbx, %rdi
callq 0x5952
testb %al, %al
je 0x60a8
movq 0x50(%rsp), %rax
movl (%rax), %esi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4d16
movl %ebp, %edi
movq %rbx, %rsi
callq 0x5c18
addq %rax, %r14
movq 0x50(%rsp), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x53d6
movq 0x50(%rsp), %rcx
addq $0x8, %rcx
movq %rcx, 0x50(%rsp)
cmpq 0x48(%rsp), %rcx
jne 0x606c
jmp 0x60c2
xorl %r14d, %r14d
movq %r14, %rax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/evaluate.cpp
// Function: evaluation::init()
void evaluation::init(){
   
    for(square sq = a1; sq < numOfSq; sq++)
    {
        oppSq[sq] = square(sq ^ (black * 56));
    }
    
    int totalMaterial = (8 * pawnVal) + (2 * knightVal) + (2 * bishopVal) +  (2 * rookVal) + queenVal;
    gamePhaseCutoff = 2 * totalMaterial - 2 * (rookVal * 2);
    
}

// Assembly:
movdqa 0x2110(%rip), %xmm0     # 0x84d0
xorl %eax, %eax
movdqa 0x2116(%rip), %xmm1     # 0x84e0
leaq 0xea5ff(%rip), %rcx     # 0xf09d0
movdqa 0x2117(%rip), %xmm2     # 0x84f0
movdqa %xmm0, %xmm3
pxor %xmm1, %xmm3
movdqa %xmm3, (%rax,%rcx)
paddd %xmm2, %xmm0
addq $0x10, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x63d9
movl $0x1a7c, 0xea6d0(%rip)  # imm = 0x1A7C
retq