Program: 49752
Project: 49752
Buggy source:
public int generateMoves(Board board,int[] moves,int mIndex){
  this.moves=moves;
  bbAttacks=BitboardAttacks.getInstance();
  moveIndex=mIndex;
  all=board.getAll();
  mines=board.getMines();
  others=board.getOthers();
  byte index=0;
  long square=0x1L;
  while (square != 0) {
    if (board.getTurn() == ((square & board.whites) != 0)) {
      if ((square & board.rooks) != 0) {
        generateMovesFromAttacks(Move.ROOK,index,bbAttacks.getRookAttacks(index,all));
      }
 else       if ((square & board.bishops) != 0) {
        generateMovesFromAttacks(Move.BISHOP,index,bbAttacks.getBishopAttacks(index,all));
      }
 else       if ((square & board.queens) != 0) {
        generateMovesFromAttacks(Move.QUEEN,index,bbAttacks.getRookAttacks(index,all));
        generateMovesFromAttacks(Move.QUEEN,index,bbAttacks.getBishopAttacks(index,all));
      }
 else       if ((square & board.kings) != 0) {
        generateMovesFromAttacks(Move.KING,index,bbAttacks.king[index]);
      }
 else       if ((square & board.knights) != 0) {
        generateMovesFromAttacks(Move.KNIGHT,index,bbAttacks.knight[index]);
      }
 else       if ((square & board.pawns) != 0) {
        if ((square & board.whites) != 0) {
          if (((square << 8) & all) == 0) {
            addMoves(Move.PAWN,index,index + 8,(square << 8),false,true,0);
            if (((square & BitboardUtils.b2_d) != 0) && (((square << 16) & all) == 0))             addMoves(Move.PAWN,index,index + 16,(square << 16),false,false,0);
          }
          generatePawnCapturesFromAttacks(index,bbAttacks.pawnUpwards[index],board.getPassantSquare());
        }
 else {
          if (((square >>> 8) & all) == 0) {
            addMoves(Move.PAWN,index,index - 8,(square >>> 8),false,true,0);
            if (((square & BitboardUtils.b2_u) != 0) && (((square >>> 16) & all) == 0))             addMoves(Move.PAWN,index,index - 16,(square >>> 16),false,false,0);
          }
          generatePawnCapturesFromAttacks(index,bbAttacks.pawnDownwards[index],board.getPassantSquare());
        }
      }
    }
    square<<=1;
    index++;
  }
  square=board.kings & mines;
  byte myKingIndex=-1;
  if ((((all & (board.getTurn() ? 0x06L : 0x0600000000000000L)) == 0 && (board.getTurn() ? board.getWhiteKingsideCastling() : board.getBlackKingsideCastling())))) {
    myKingIndex=BitboardUtils.square2Index(square);
    if (!board.getCheck() && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex - 1),board.getTurn()) && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex - 2),board.getTurn()))     addMoves(Move.KING,myKingIndex,myKingIndex - 2,0,false,false,Move.TYPE_KINGSIDE_CASTLING);
  }
  if ((((all & (board.getTurn() ? 0x70L : 0x7000000000000000L)) == 0 && (board.getTurn() ? board.getWhiteQueensideCastling() : board.getBlackQueensideCastling())))) {
    if (myKingIndex == -1) {
      myKingIndex=BitboardUtils.square2Index(square);
    }
    if (!board.getCheck() && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex + 1),board.getTurn()) && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex + 2),board.getTurn()))     addMoves(Move.KING,myKingIndex,myKingIndex + 2,0,false,false,Move.TYPE_QUEENSIDE_CASTLING);
  }
  return moveIndex;
}

Fixed version (ground truth):
public int generateMoves(Board board,int[] moves,int mIndex){
  this.moves=moves;
  bbAttacks=BitboardAttacks.getInstance();
  moveIndex=mIndex;
  all=board.getAll();
  mines=board.getMines();
  others=board.getOthers();
  byte index=0;
  long square=0x1L;
  while (square != 0) {
    if (board.getTurn() == ((square & board.whites) != 0)) {
      if ((square & board.rooks) != 0) {
        generateMovesFromAttacks(Move.ROOK,index,bbAttacks.getRookAttacks(index,all));
      }
 else       if ((square & board.bishops) != 0) {
        generateMovesFromAttacks(Move.BISHOP,index,bbAttacks.getBishopAttacks(index,all));
      }
 else       if ((square & board.queens) != 0) {
        generateMovesFromAttacks(Move.QUEEN,index,bbAttacks.getRookAttacks(index,all));
        generateMovesFromAttacks(Move.QUEEN,index,bbAttacks.getBishopAttacks(index,all));
      }
 else       if ((square & board.kings) != 0) {
        generateMovesFromAttacks(Move.KING,index,bbAttacks.king[index]);
      }
 else       if ((square & board.knights) != 0) {
        generateMovesFromAttacks(Move.KNIGHT,index,bbAttacks.knight[index]);
      }
 else       if ((square & board.pawns) != 0) {
        if ((square & board.whites) != 0) {
          if (((square << 8) & all) == 0) {
            addMoves(Move.PAWN,index,index + 8,(square << 8),false,true,0);
            if (((square & BitboardUtils.b2_d) != 0) && (((square << 16) & all) == 0))             addMoves(Move.PAWN,index,index + 16,(square << 16),false,false,0);
          }
          generatePawnCapturesFromAttacks(index,bbAttacks.pawnUpwards[index],board.getPassantSquare());
        }
 else {
          if (((square >>> 8) & all) == 0) {
            addMoves(Move.PAWN,index,index - 8,(square >>> 8),false,true,0);
            if (((square & BitboardUtils.b2_u) != 0) && (((square >>> 16) & all) == 0))             addMoves(Move.PAWN,index,index - 16,(square >>> 16),false,false,0);
          }
          generatePawnCapturesFromAttacks(index,bbAttacks.pawnDownwards[index],board.getPassantSquare());
        }
      }
    }
    square<<=1;
    index++;
  }
  square=board.kings & mines;
  int myKingIndex=-1;
  if ((((all & (board.getTurn() ? 0x06L : 0x0600000000000000L)) == 0 && (board.getTurn() ? board.getWhiteKingsideCastling() : board.getBlackKingsideCastling())))) {
    myKingIndex=BitboardUtils.square2Index(square);
    if (!board.getCheck() && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex - 1),board.getTurn()) && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex - 2),board.getTurn()))     addMoves(Move.KING,myKingIndex,myKingIndex - 2,0,false,false,Move.TYPE_KINGSIDE_CASTLING);
  }
  if ((((all & (board.getTurn() ? 0x70L : 0x7000000000000000L)) == 0 && (board.getTurn() ? board.getWhiteQueensideCastling() : board.getBlackQueensideCastling())))) {
    if (myKingIndex == -1) {
      myKingIndex=BitboardUtils.square2Index(square);
    }
    if (!board.getCheck() && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex + 1),board.getTurn()) && !bbAttacks.isIndexAttacked(board,(byte)(myKingIndex + 2),board.getTurn()))     addMoves(Move.KING,myKingIndex,myKingIndex + 2,0,false,false,Move.TYPE_QUEENSIDE_CASTLING);
  }
  return moveIndex;
}