Program: 101616
Project: 101616
Buggy source:
/** 
 * Reduce the number of edits by eliminating operationally trivial equalities.
 * @param diffs List of Difference objects
 */
public static void cleanupEfficiency(final List diffs){
  if (diffs.isEmpty()) {
    return;
  }
  boolean changes=false;
  Stack equalities=new Stack();
  String lastEquality=null;
  int preInsert=0;
  int preDelete=0;
  int postInsert=0;
  int postDelete=0;
  ListIterator pointer=diffs.listIterator();
  Difference curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  Difference safeDiff=curDiff;
  while (curDiff != null) {
    EditType editType=curDiff.getEditType();
    if (EditType.EQUAL.equals(editType)) {
      if (curDiff.getText().length() < editCost && (postInsert + postDelete) > 0) {
        equalities.push(curDiff);
        preInsert=postInsert;
        preDelete=postDelete;
        lastEquality=curDiff.getText();
      }
 else {
        equalities.clear();
        lastEquality="String_Node_Str";
        safeDiff=curDiff;
      }
      postInsert=0;
      postDelete=0;
    }
 else {
      if (EditType.DELETE.equals(editType)) {
        postDelete=1;
      }
 else {
        postInsert=1;
      }
      if (lastEquality != null && (((preInsert + preDelete + postInsert+ postDelete) > 0) || ((lastEquality.length() < editCost / 2) && (preInsert + preDelete + postInsert+ postDelete) == 3))) {
        while (curDiff != equalities.lastElement()) {
          curDiff=(Difference)pointer.previous();
        }
        pointer.next();
        pointer.set(new Difference(EditType.DELETE,lastEquality));
        curDiff=new Difference(EditType.INSERT,lastEquality);
        pointer.add(curDiff);
        equalities.pop();
        lastEquality=null;
        if (preInsert == 1 && preDelete == 1) {
          postInsert=1;
          postDelete=1;
          equalities.clear();
          safeDiff=curDiff;
        }
 else {
          if (!equalities.empty()) {
            equalities.pop();
          }
          if (equalities.empty()) {
            curDiff=safeDiff;
          }
 else {
            curDiff=(Difference)equalities.lastElement();
          }
          while (curDiff != pointer.previous()) {
          }
          postInsert=0;
          postDelete=0;
        }
        changes=true;
      }
    }
    curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  }
  if (changes) {
    cleanupMerge(diffs);
  }
}

Fixed version (ground truth):
/** 
 * Reduce the number of edits by eliminating operationally trivial equalities.
 * @param diffs List of Difference objects
 */
public static void cleanupEfficiency(final List diffs){
  if (diffs.isEmpty()) {
    return;
  }
  boolean changes=false;
  Stack equalities=new Stack();
  String lastEquality=null;
  int preInsert=0;
  int preDelete=0;
  int postInsert=0;
  int postDelete=0;
  ListIterator pointer=diffs.listIterator();
  Difference curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  Difference safeDiff=curDiff;
  while (curDiff != null) {
    EditType editType=curDiff.getEditType();
    if (EditType.EQUAL.equals(editType)) {
      if (curDiff.getText().length() < editCost && (postInsert + postDelete) > 0) {
        equalities.push(curDiff);
        preInsert=postInsert;
        preDelete=postDelete;
        lastEquality=curDiff.getText();
      }
 else {
        equalities.clear();
        lastEquality=null;
        safeDiff=curDiff;
      }
      postInsert=0;
      postDelete=0;
    }
 else {
      if (EditType.DELETE.equals(editType)) {
        postDelete=1;
      }
 else {
        postInsert=1;
      }
      if (lastEquality != null && (((preInsert + preDelete + postInsert+ postDelete) > 0) || ((lastEquality.length() < editCost / 2) && (preInsert + preDelete + postInsert+ postDelete) == 3))) {
        while (curDiff != equalities.lastElement()) {
          curDiff=(Difference)pointer.previous();
        }
        pointer.next();
        pointer.set(new Difference(EditType.DELETE,lastEquality));
        curDiff=new Difference(EditType.INSERT,lastEquality);
        pointer.add(curDiff);
        equalities.pop();
        lastEquality=null;
        if (preInsert == 1 && preDelete == 1) {
          postInsert=1;
          postDelete=1;
          equalities.clear();
          safeDiff=curDiff;
        }
 else {
          if (!equalities.empty()) {
            equalities.pop();
          }
          if (equalities.empty()) {
            curDiff=safeDiff;
          }
 else {
            curDiff=(Difference)equalities.lastElement();
          }
          while (curDiff != pointer.previous()) {
          }
          postInsert=0;
          postDelete=0;
        }
        changes=true;
      }
    }
    curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  }
  if (changes) {
    cleanupMerge(diffs);
  }
}