Program: 2261
Project: 2261
Buggy source:
public EndpointState unfairTransform(){
  EndpointState init=this.clone();
  EndpointState term=ModelState.getTerminal(init);
  Set<EndpointState> seen=new HashSet<>();
  Set<EndpointState> todo=new LinkedHashSet<>();
  todo.add(init);
  while (!todo.isEmpty()) {
    Iterator<EndpointState> i=todo.iterator();
    EndpointState curr=i.next();
    i.remove();
    if (seen.contains(curr)) {
      continue;
    }
    seen.add(curr);
    if (curr.getStateKind() == Kind.OUTPUT && curr.getAllTakeable().size() > 1) {
{
        Iterator<IOAction> as=curr.getAllTakeable().iterator();
        Iterator<EndpointState> ss=curr.getSuccessors().iterator();
        List<IOAction> cloneas=new LinkedList<>();
        List<EndpointState> cloness=new LinkedList<>();
        Map<EndpointState,IOAction> toRemove=new HashMap<>();
        while (as.hasNext()) {
          IOAction a=as.next();
          EndpointState s=ss.next();
          if (!s.canReach(curr)) {
            todo.add(s);
          }
 else {
            EndpointState clone=curr.unfairClone(term,a,s);
            cloneas.add(a);
            cloness.add(clone);
            toRemove.put(s,a);
          }
        }
        if (!cloneas.isEmpty()) {
          for (          EndpointState s : toRemove.keySet()) {
            try {
              curr.removeEdge(toRemove.get(s),s);
            }
 catch (            ScribbleException e) {
              throw new RuntimeException(e);
            }
          }
          Iterator<IOAction> icloneas=cloneas.iterator();
          Iterator<EndpointState> icloness=cloness.iterator();
          while (icloneas.hasNext()) {
            IOAction a=icloneas.next();
            EndpointState s=icloness.next();
            curr.addEdge(a,s);
            todo.add(s);
          }
        }
      }
    }
 else {
      todo.addAll(curr.getSuccessors());
    }
  }
  return init;
}

Fixed version (ground truth):
public EndpointState unfairTransform(){
  EndpointState init=this.clone();
  EndpointState term=ModelState.getTerminal(init);
  Set<EndpointState> seen=new HashSet<>();
  Set<EndpointState> todo=new LinkedHashSet<>();
  todo.add(init);
  while (!todo.isEmpty()) {
    Iterator<EndpointState> i=todo.iterator();
    EndpointState curr=i.next();
    i.remove();
    if (seen.contains(curr)) {
      continue;
    }
    seen.add(curr);
    if (curr.getStateKind() == Kind.OUTPUT && curr.getAllTakeable().size() > 1) {
{
        Iterator<IOAction> as=curr.getAllTakeable().iterator();
        Iterator<EndpointState> ss=curr.getSuccessors().iterator();
        List<IOAction> cloneas=new LinkedList<>();
        List<EndpointState> cloness=new LinkedList<>();
        Map<EndpointState,List<IOAction>> toRemove=new HashMap<>();
        while (as.hasNext()) {
          IOAction a=as.next();
          EndpointState s=ss.next();
          if (!s.canReach(curr)) {
            todo.add(s);
          }
 else {
            EndpointState clone=curr.unfairClone(term,a,s);
            cloneas.add(a);
            cloness.add(clone);
            List<IOAction> tmp=toRemove.get(s);
            if (tmp == null) {
              tmp=new LinkedList<>();
              toRemove.put(s,tmp);
            }
            tmp.add(a);
          }
        }
        if (!cloneas.isEmpty()) {
          for (          EndpointState s : toRemove.keySet()) {
            try {
              for (              IOAction tmp : toRemove.get(s)) {
                curr.removeEdge(tmp,s);
              }
            }
 catch (            ScribbleException e) {
              throw new RuntimeException(e);
            }
          }
          Iterator<IOAction> icloneas=cloneas.iterator();
          Iterator<EndpointState> icloness=cloness.iterator();
          while (icloneas.hasNext()) {
            IOAction a=icloneas.next();
            EndpointState s=icloness.next();
            curr.addEdge(a,s);
            todo.add(s);
          }
        }
      }
    }
 else {
      todo.addAll(curr.getSuccessors());
    }
  }
  return init;
}