Program: 125172
Project: 125172
Buggy source:
public static int getClusterCoalNum_unrooted(Tree tr,STITreeCluster cluster){
  Map map=new HashMap();
  List taxalist=new ArrayList();
  String[] taxa=tr.getLeaves();
  int ntaxa=taxa.length;
  for (  String leaf : taxa) {
    taxalist.add(leaf);
  }
  STITreeCluster concluster=new STITreeCluster();
  for (  String leaf : cluster.getClusterLeaves()) {
    if (taxalist.contains(leaf)) {
      concluster.addLeaf(leaf);
    }
  }
  if (concluster.getClusterSize() == ntaxa) {
    return 0;
  }
  Object coveragelist=new ArrayList();
  for (int i=concluster.getBitSet().nextSetBit(0); i >= 0; i=concluster.getBitSet().nextSetBit(i + 1)) {
    BitSet bs=new BitSet(ntaxa);
    ((BitSet)bs).set(i);
    ((List)coveragelist).add(bs);
  }
  int intersect;
  BitSet virtualbs;
  for (Object tn=tr.postTraverse().iterator(); ((Iterator)tn).hasNext(); ) {
    TNode node=(TNode)((Iterator)tn).next();
    if (((List)coveragelist).size() <= 1) {
      break;
    }
    BitSet bs=new BitSet(ntaxa);
    intersect=0;
    virtualbs=new BitSet(ntaxa);
    if (node.isLeaf()) {
      int index=taxalist.indexOf(node.getName());
      bs.set(index);
      map.put(node,bs);
    }
 else {
      for (      TNode child : node.getChildren()) {
        BitSet v=(BitSet)map.get(child);
        bs.or(v);
        if (concluster.containsCluster(v)) {
          intersect++;
          virtualbs.or(v);
        }
      }
      if ((concluster.containsCluster(bs)) || (intersect > 1)) {
        if (concluster.containsCluster(bs)) {
          virtualbs=bs;
        }
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)virtualbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(virtualbs);
      }
      map.put(node,bs);
    }
    if (!node.isRoot()) {
      BitSet complementbs=(BitSet)bs.clone();
      complementbs.flip(0,taxa.length);
      if (intersect > 0) {
        complementbs.or(virtualbs);
      }
      if (concluster.containsCluster(complementbs)) {
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)complementbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(complementbs);
        break;
      }
    }
  }
  return Math.max(0,((List)coveragelist).size() - 1);
}

Fixed version (ground truth):
public static int getClusterCoalNum_unrooted(Tree tr,STITreeCluster cluster){
  Map map=new HashMap();
  List taxalist=new ArrayList();
  String[] taxa=tr.getLeaves();
  int ntaxa=taxa.length;
  for (  String leaf : taxa) {
    taxalist.add(leaf);
  }
  STITreeCluster concluster=new STITreeCluster();
  for (  Integer leaf : cluster) {
    if (taxalist.contains(GlobalMaps.taxonIdentifier.getTaxonName(leaf))) {
      concluster.addLeaf(leaf);
    }
  }
  if (concluster.getClusterSize() == ntaxa) {
    return 0;
  }
  Object coveragelist=new ArrayList();
  for (int i=concluster.getBitSet().nextSetBit(0); i >= 0; i=concluster.getBitSet().nextSetBit(i + 1)) {
    BitSet bs=new BitSet(ntaxa);
    ((BitSet)bs).set(i);
    ((List)coveragelist).add(bs);
  }
  int intersect;
  BitSet virtualbs;
  for (Object tn=tr.postTraverse().iterator(); ((Iterator)tn).hasNext(); ) {
    TNode node=(TNode)((Iterator)tn).next();
    if (((List)coveragelist).size() <= 1) {
      break;
    }
    BitSet bs=new BitSet(ntaxa);
    intersect=0;
    virtualbs=new BitSet(ntaxa);
    if (node.isLeaf()) {
      int index=taxalist.indexOf(node.getName());
      bs.set(index);
      map.put(node,bs);
    }
 else {
      for (      TNode child : node.getChildren()) {
        BitSet v=(BitSet)map.get(child);
        bs.or(v);
        if (concluster.containsCluster(v)) {
          intersect++;
          virtualbs.or(v);
        }
      }
      if ((concluster.containsCluster(bs)) || (intersect > 1)) {
        if (concluster.containsCluster(bs)) {
          virtualbs=bs;
        }
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)virtualbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(virtualbs);
      }
      map.put(node,bs);
    }
    if (!node.isRoot()) {
      BitSet complementbs=(BitSet)bs.clone();
      complementbs.flip(0,taxa.length);
      if (intersect > 0) {
        complementbs.or(virtualbs);
      }
      if (concluster.containsCluster(complementbs)) {
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)complementbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(complementbs);
        break;
      }
    }
  }
  return Math.max(0,((List)coveragelist).size() - 1);
}