Program: 101009
Project: 101009
Buggy source:
private void build(Node node,int nodeIndex,FastBitSet bs,TermNodeListener listener){
  char[] letters=node.getLetters();
  int lettersLen=letters.length;
  for (int i=1; i < lettersLen; i++) {
    int cid=getCharId(letters[i]);
    int empty=findFirstEmptyCheck();
    setCheck(empty,nodeIndex);
    base[nodeIndex]=empty - cid;
    nodeIndex=empty;
  }
  if (node.isTerminate()) {
    bs.set(nodeIndex);
    listener.listen(node,nodeIndex);
  }
 else   if (bs.size() <= nodeIndex) {
    bs.unsetIfLE(nodeIndex);
  }
  Node[] children=node.getChildren();
  int childrenLen=children.length;
  if (childrenLen == 0)   return;
  int[] heads=new int[childrenLen];
  int maxHead=0;
  int minHead=Integer.MAX_VALUE;
  for (int i=0; i < childrenLen; i++) {
    heads[i]=getCharId(children[i].getLetters()[0]);
    maxHead=Math.max(maxHead,heads[i]);
    minHead=Math.min(minHead,heads[i]);
  }
  int offset=findInsertOffset(heads,minHead,maxHead);
  base[nodeIndex]=offset;
  for (  int cid : heads) {
    setCheck(offset + cid,nodeIndex);
  }
  Map<Integer,List<Pair<Node,Integer>>> nodes=new TreeMap<Integer,List<Pair<Node,Integer>>>(new Comparator<Integer>(){
    @Override public int compare(    Integer arg0,    Integer arg1){
      return arg1 - arg0;
    }
  }
);
  for (int i=0; i < children.length; i++) {
    Node[] c=children[i].getChildren();
    int n=0;
    if (c != null) {
      n=c.length;
    }
    List<Pair<Node,Integer>> p=nodes.get(n);
    if (p == null) {
      p=new ArrayList<Pair<Node,Integer>>();
      nodes.put(n,p);
    }
    p.add(Pair.create(children[i],heads[i]));
  }
  for (  Map.Entry<Integer,List<Pair<Node,Integer>>> e : nodes.entrySet()) {
    for (    Pair<Node,Integer> e2 : e.getValue()) {
      build(e2.getFirst(),e2.getSecond() + offset,bs,listener);
    }
  }
}

Fixed version (ground truth):
private void build(Node node,int nodeIndex,FastBitSet bs,TermNodeListener listener){
  char[] letters=node.getLetters();
  int lettersLen=letters.length;
  for (int i=1; i < lettersLen; i++) {
    bs.unsetIfLE(nodeIndex);
    int cid=getCharId(letters[i]);
    int empty=findFirstEmptyCheck();
    setCheck(empty,nodeIndex);
    base[nodeIndex]=empty - cid;
    nodeIndex=empty;
  }
  if (node.isTerminate()) {
    bs.set(nodeIndex);
    listener.listen(node,nodeIndex);
  }
 else   if (bs.size() <= nodeIndex) {
    bs.unsetIfLE(nodeIndex);
  }
  Node[] children=node.getChildren();
  int childrenLen=children.length;
  if (childrenLen == 0)   return;
  int[] heads=new int[childrenLen];
  int maxHead=0;
  int minHead=Integer.MAX_VALUE;
  for (int i=0; i < childrenLen; i++) {
    heads[i]=getCharId(children[i].getLetters()[0]);
    maxHead=Math.max(maxHead,heads[i]);
    minHead=Math.min(minHead,heads[i]);
  }
  int offset=findInsertOffset(heads,minHead,maxHead);
  base[nodeIndex]=offset;
  for (  int cid : heads) {
    setCheck(offset + cid,nodeIndex);
  }
  Map<Integer,List<Pair<Node,Integer>>> nodes=new TreeMap<Integer,List<Pair<Node,Integer>>>(new Comparator<Integer>(){
    @Override public int compare(    Integer arg0,    Integer arg1){
      return arg1 - arg0;
    }
  }
);
  for (int i=0; i < children.length; i++) {
    Node[] c=children[i].getChildren();
    int n=0;
    if (c != null) {
      n=c.length;
    }
    List<Pair<Node,Integer>> p=nodes.get(n);
    if (p == null) {
      p=new ArrayList<Pair<Node,Integer>>();
      nodes.put(n,p);
    }
    p.add(Pair.create(children[i],heads[i]));
  }
  for (  Map.Entry<Integer,List<Pair<Node,Integer>>> e : nodes.entrySet()) {
    for (    Pair<Node,Integer> e2 : e.getValue()) {
      build(e2.getFirst(),e2.getSecond() + offset,bs,listener);
    }
  }
}