nus-yam/ex-repair huggingface dataset:
Program: 186971
Project: 186971
Buggy source:
public void putStack(int index,BoundedSet<SymbolicAddress> bs){
  this.put(new Location(index),bs);
}

Fixed version (ground truth):
public void putStack(int index,BoundedSet<SymbolicAddress> bs){
  if (this == TOP)   return;
  this.put(new Location(index),bs);
}
Program: 186972
Project: 186972
Buggy source:
public BoundedSet<SymbolicAddress> getStack(int index){
  if (this == TOP)   throw new AssertionError("String_Node_Str");
  Location stackLoc=new Location(index);
  BoundedSet<SymbolicAddress> val=map.get(stackLoc);
  if (val == null)   throw new AssertionError("String_Node_Str" + index);
  return val;
}

Fixed version (ground truth):
public BoundedSet<SymbolicAddress> getStack(int index){
  if (this == TOP)   return bsFactory.top();
  Location stackLoc=new Location(index);
  BoundedSet<SymbolicAddress> val=map.get(stackLoc);
  if (val == null)   throw new AssertionError("String_Node_Str" + index);
  return val;
}
Program: 186973
Project: 186973
Buggy source:
private void checkScope(InstructionHandle stmt){
  if (scopes.get(stmt) == null) {
    ValueMapping.scope=++ValueMapping.scopeCnt;
    scopes.put(stmt,new Integer(ValueMapping.scope));
  }
}

Fixed version (ground truth):
private void checkScope(Context context,InstructionHandle stmt){
  if (scopes.get(stmt) == null) {
    scopes.put(stmt,new ContextMap<CallString,Integer>(context,new HashMap<CallString,Integer>()));
  }
  if (scopes.get(stmt).get(context.callString) == null) {
    ValueMapping.scope=++ValueMapping.scopeCnt;
    scopes.get(stmt).put(context.callString,new Integer(ValueMapping.scope));
  }
}
Program: 186975
Project: 186975
Buggy source:
public int getBound(DFAAppInfo program,InstructionHandle instr){
  ContextMap<CallString,Pair<ValueMapping>> r=bounds.get(instr);
  if (r == null) {
    return -1;
  }
  int maxValue=-1;
  for (Iterator<CallString> k=r.keySet().iterator(); k.hasNext(); ) {
    CallString callString=k.next();
    Pair<ValueMapping> bounds=r.get(callString);
    LoopBounds.ValueMapping first=bounds.getFirst();
    LoopBounds.ValueMapping second=bounds.getSecond();
    if (scopes.get(instr).intValue() <= first.defscope || scopes.get(instr).intValue() <= second.defscope) {
      return -1;
    }
    int val=ValueMapping.computeBound(first,second);
    if (val < 0) {
      return -1;
    }
 else {
      maxValue=Math.max(maxValue,val);
    }
  }
  return maxValue;
}

Fixed version (ground truth):
public int getBound(DFAAppInfo program,InstructionHandle instr){
  ContextMap<CallString,Pair<ValueMapping>> r=bounds.get(instr);
  if (r == null) {
    return -1;
  }
  int maxValue=-1;
  for (Iterator<CallString> k=r.keySet().iterator(); k.hasNext(); ) {
    CallString callString=k.next();
    Pair<ValueMapping> bounds=r.get(callString);
    LoopBounds.ValueMapping first=bounds.getFirst();
    LoopBounds.ValueMapping second=bounds.getSecond();
    InstructionHandle target=((BranchInstruction)instr.getInstruction()).getTarget();
    if (scopes.get(target) != null) {
      if (scopes.get(target).get(callString).intValue() <= first.defscope || scopes.get(target).get(callString).intValue() <= second.defscope) {
        return -1;
      }
    }
    if (scopes.get(instr).get(callString).intValue() <= first.defscope || scopes.get(instr).get(callString).intValue() <= second.defscope) {
      return -1;
    }
    int val=ValueMapping.computeBound(first,second);
    if (val < 0) {
      return -1;
    }
 else {
      maxValue=Math.max(maxValue,val);
    }
  }
  return maxValue;
}
Program: 186977
Project: 186977
Buggy source:
public List<Type> getObjectFields(String className){
  List<Type> l=new LinkedList<Type>();
  ClassInfo cli=project.getWcetAppInfo().getClassInfo(className);
  if (cli.superClass != null) {
    l.addAll(getObjectFields(cli.superClass.toString()));
  }
  Field[] f=cli.clazz.getFields();
  for (int i=0; i < f.length; i++) {
    l.add(f[i].getType());
  }
  return l;
}

Fixed version (ground truth):
public List<Type> getObjectFields(String className){
  List<Type> l=new LinkedList<Type>();
  ClassInfo cli=project.getWcetAppInfo().getClassInfo(className);
  if (cli.superClass != null) {
    l.addAll(getObjectFields(cli.superClass.toString()));
  }
  Field[] f=cli.clazz.getFields();
  for (int i=0; i < f.length; i++) {
    if (!f[i].isStatic()) {
      l.add(f[i].getType());
    }
  }
  return l;
}
Program: 186981
Project: 186981
Buggy source:
private static int f_multianewarray(){
  JVMHelp.wr("String_Node_Str");
  JVMHelp.wr("String_Node_Str");
  int ret=0;
  int i, j;
  int sp=Native.getSP();
  int fp=sp - 4;
  int pc=Native.rdIntMem(fp + 1);
  pc+=2;
  int mp=Native.rdIntMem(fp + 4);
  int start=Native.rdMem(mp) >>> 10;
  int dim=Native.rdMem(start + (pc >> 2));
  for (i=(pc & 0x03); i < 3; ++i)   dim>>=8;
  dim&=0xff;
  Native.wrIntMem(pc + 1,fp + 1);
  sp=Native.rdIntMem(fp);
  sp-=dim;
  Native.wrIntMem(sp,fp);
  if (dim != 2) {
    System.out.print(dim);
    System.out.println("String_Node_Str");
    JVMHelp.noim();
  }
  int cnt=Native.rdIntMem(sp + 1);
  int cnt2=Native.rdIntMem(sp + 2);
  ret=f_anewarray(cnt,0);
  int ref=Native.rdMem(ret);
  for (i=0; i < cnt; ++i) {
    Native.wrMem(f_newarray(cnt2,10),ref + i);
  }
  return ret;
}

Fixed version (ground truth):
private static int f_multianewarray(){
  JVMHelp.wr("String_Node_Str");
  JVMHelp.wr("String_Node_Str");
  int ret=0;
  int i, j;
  int sp=Native.getSP();
  int fp=sp - 4;
  int pc=Native.rdIntMem(fp + 1);
  pc+=2;
  int mp=Native.rdIntMem(fp + 4);
  int start=Native.rdMem(mp) >>> 10;
  int dim=Native.rdMem(start + (pc >> 2));
  for (i=(pc & 0x03); i < 3; ++i)   dim>>=8;
  dim&=0xff;
  Native.wrIntMem(pc + 1,fp + 1);
  sp=Native.rdIntMem(fp);
  sp-=dim;
  Native.wrIntMem(sp,fp);
  if (dim != 2) {
    System.out.print(dim);
    System.out.println("String_Node_Str");
    JVMHelp.noim();
  }
  int cnt=Native.rdIntMem(sp + 1);
  int cnt2=Native.rdIntMem(sp + 2);
  ret=f_anewarray(cnt,0);
  for (i=0; i < cnt; ++i) {
    int arr=f_newarray(cnt2,10);
synchronized (GC.mutex) {
      Native.wrMem(arr,Native.rdMem(ret) + i);
    }
  }
  return ret;
}
Program: 186982
Project: 186982
Buggy source:
/** 
 * Remove problematic characters from a method name  Note that fully qualified methods might become non-unique, so use an additional unique identifier if you need unique names. 
 */
public static String sanitizeFileName(String str){
  StringBuffer sanitized=new StringBuffer(str.length());
  for (int i=0; i < str.length(); i++) {
    if (Character.isLetterOrDigit(str.charAt(i)) || str.charAt(i) == '.') {
      sanitized.append(str.charAt(i));
    }
 else {
      sanitized.append('_');
    }
  }
  return sanitized.toString();
}

Fixed version (ground truth):
/** 
 * Remove problematic characters from a method name Note that fully qualified methods might become non-unique, so use an additional unique identifier if you need unique names. 
 */
public static String sanitizeFileName(String str){
  StringBuffer sanitized=new StringBuffer(str.length());
  for (int i=0; i < str.length(); i++) {
    if (Character.isLetterOrDigit(str.charAt(i)) || str.charAt(i) == '.') {
      sanitized.append(str.charAt(i));
    }
 else {
      sanitized.append('_');
    }
  }
  return sanitized.toString();
}
Program: 186983
Project: 186983
Buggy source:
public static <V,E>List<V> topologicalOrder(DirectedGraph<V,E> acyclicGraph){
  TopologicalOrderIterator<V,E> topo=new TopologicalOrderIterator<V,E>(acyclicGraph);
  List<V> topoList=new ArrayList<V>();
  while (topo.hasNext()) {
    topoList.add(topo.next());
  }
  return topoList;
}

Fixed version (ground truth):
public static <V,E>List<V> topologicalOrder(DirectedGraph<V,E> acyclicGraph){
  List<V> topoList=new ArrayList<V>();
  if (acyclicGraph.vertexSet().size() > 0) {
    TopologicalOrderIterator<V,E> topo=new TopologicalOrderIterator<V,E>(acyclicGraph);
    while (topo.hasNext()) {
      topoList.add(topo.next());
    }
  }
  return topoList;
}
Program: 186984
Project: 186984
Buggy source:
public int hashCode(){
  return method.getMethod().hashCode();
}

Fixed version (ground truth):
public int hashCode(){
  return method.hashCode();
}
Program: 186985
Project: 186985
Buggy source:
private void build() throws MethodNotFoundException {
  this.buildGraph();
  classInfos=new HashSet<ClassInfo>();
  for (  CallGraphNode cgn : callGraph.vertexSet()) {
    classInfos.add(cgn.getReferencedMethod().getReceiver());
  }
  Pair<List<CallGraphNode>,List<CallGraphNode>> cycle=DirectedCycleDetector.findCycle(callGraph,rootNode);
  if (cycle != null) {
    throw new AssertionError(cyclicCallGraphMsg(cycle));
  }
  invalidate();
}

Fixed version (ground truth):
private void build() throws MethodNotFoundException {
  this.buildGraph();
  classInfos=new HashSet<ClassInfo>();
  for (  CallGraphNode cgn : callGraph.vertexSet()) {
    classInfos.add(cgn.getReferencedMethod().getReceiver());
  }
  Pair<List<CallGraphNode>,List<CallGraphNode>> cycle=DirectedCycleDetector.findCycle(callGraph,rootNode);
  if (cycle != null) {
    for (    DefaultEdge e : callGraph.edgeSet()) {
      CallGraphNode src=callGraph.getEdgeSource(e);
      CallGraphNode target=callGraph.getEdgeTarget(e);
      System.err.println("String_Node_Str" + src + "String_Node_Str"+ target);
    }
    throw new AssertionError(cyclicCallGraphMsg(cycle));
  }
  invalidate();
}
Program: 186986
Project: 186986
Buggy source:
public boolean equals(Object that){
  return (that instanceof CallGraphNode) ? (method.getMethod().equals(((CallGraphNode)that).method.getMethod())) : false;
}

Fixed version (ground truth):
public boolean equals(Object that){
  return (that instanceof CallGraphNode) ? (method.equals(((CallGraphNode)that).method)) : false;
}
Program: 186987
Project: 186987
Buggy source:
/** 
 * Method getFunctionOutput, which will return the functional output for point p.
 * @param p - the point index
 * @param parallel - true if to be done in parallel
 * @return the functinal output
 */
static float getFunctionOutputFloat(int p,boolean parallel){
  float functionalOutput_fp=0;
  SVMHelp.p=p;
  if (parallel) {
    SVMHelp.functionalOutput_fp=0.0f;
    ParallelExecutor pe=new ParallelExecutor();
    System.out.print("String_Node_Str");
    System.out.println(m);
    pe.executeParallel(new SVMHelp(),m);
    SVMHelp.functionalOutput_fp-=bias_fp;
    functionalOutput_fp=SVMHelp.functionalOutput_fp;
  }
 else {
    for (int i=0; i < m; i++) {
      if (alph[i] > 0) {
        functionalOutput_fp+=target[i] * alph[i] * getKernelOutputFloat(i,p);
      }
    }
    functionalOutput_fp-=bias_fp;
  }
  return functionalOutput_fp;
}

Fixed version (ground truth):
/** 
 * Method getFunctionOutput, which will return the functional output for point p.
 * @param p - the point index
 * @param parallel - true if to be done in parallel
 * @return the functinal output
 */
static float getFunctionOutputFloat(int p,boolean parallel){
  float functionalOutput_fp=0;
  SVMHelp.p=p;
  if (parallel) {
    SVMHelp.functionalOutput_fp=0.0f;
    System.out.print("String_Node_Str");
    System.out.println(m);
    pe.executeParallel(new SVMHelp(),m);
    SVMHelp.functionalOutput_fp-=bias_fp;
    functionalOutput_fp=SVMHelp.functionalOutput_fp;
  }
 else {
    for (int i=0; i < m; i++) {
      if (alph[i] > 0) {
        functionalOutput_fp+=target[i] * alph[i] * getKernelOutputFloat(i,p);
      }
    }
    functionalOutput_fp-=bias_fp;
  }
  return functionalOutput_fp;
}
Program: 186988
Project: 186988
Buggy source:
public void read(){
  for (int i=0; i < aDat.length; i++) {
    aDat[i]=(i + 30) % SIZE;
  }
}

Fixed version (ground truth):
public void read(){
  for (i=0; i < aDat.length; i++) {
    aDat[i]=(i + 30) % SIZE;
  }
}
Program: 186989
Project: 186989
Buggy source:
public void sort(){
  i=0;
  while (i < aDat.length) {
    j=aDat.length - 1;
    while (j >= i) {
      cond=aDat[j] < aDat[j - 1];
      temp=aDat[j];
      aDat[j]=Native.condMove(aDat[j - 1],aDat[j],cond);
      aDat[j - 1]=Native.condMove(temp,aDat[j - 1],cond);
      j=j - 1;
    }
    i=i + 1;
  }
}

Fixed version (ground truth):
public void sort(){
  i=0;
  while (i < aDat.length) {
    j=aDat.length - 1;
    while (j > i) {
      cond=aDat[j] < aDat[j - 1];
      temp=aDat[j];
      aDat[j]=Native.condMove(aDat[j - 1],aDat[j],cond);
      aDat[j - 1]=Native.condMove(temp,aDat[j - 1],cond);
      j=j - 1;
    }
    i=i + 1;
  }
}
Program: 186990
Project: 186990
Buggy source:
public void write(){
}

Fixed version (ground truth):
public void write(){
  for (i=0; i < aDat.length; i++) {
    System.out.println("String_Node_Str" + i + "String_Node_Str"+ aDat[i]+ "String_Node_Str");
  }
}
Program: 186992
Project: 186992
Buggy source:
private boolean implementsInterface(String ifname){
  ClassInfo cli=this;
  do {
    String[] interfaces=cli.clazz.getInterfaceNames();
    for (int i=0; i < interfaces.length; i++) {
      if (ifname.equals(interfaces[i])) {
        return true;
      }
 else {
        boolean match=((JopClassInfo)appInfo.cliMap.get(interfaces[i])).implementsInterface(ifname);
        if (match) {
          return true;
        }
      }
    }
    cli=(ClassInfo)cli.superClass;
  }
 while (cli != null);
  return false;
}

Fixed version (ground truth):
private boolean implementsInterface(String ifname){
  ClassInfo cli=this;
  do {
    String[] interfaces=cli.clazz.getInterfaceNames();
    for (int i=0; i < interfaces.length; i++) {
      if (ifname.equals(interfaces[i])) {
        return true;
      }
 else {
        JopClassInfo superCli=(JopClassInfo)appInfo.cliMap.get(interfaces[i]);
        boolean match=superCli.implementsInterface(ifname);
        if (match) {
          return true;
        }
      }
    }
    cli=(ClassInfo)cli.superClass;
  }
 while (cli != null);
  return false;
}
Program: 186993
Project: 186993
Buggy source:
public void Start(){
  final int max_mac_size=10000;
  final int max_cycles=100000;
  int[] array1=new int[max_mac_size];
  int[] array2=new int[max_mac_size];
  System.out.println("String_Node_Str");
  mac_coprocessor m=new mac_coprocessor();
  int ts=Native.rdMem(Const.IO_CNT);
  int te=Native.rdMem(Const.IO_CNT);
  int to=te - ts;
  int icount=0;
  for (int mac_size=1; mac_size < max_mac_size; icount++) {
    int i, j, time, out, expect=0;
    boolean error=false;
    int max_time=0;
    int min_time=1 << 30;
    int total_time=0;
    for (i=0; i < mac_size; i++) {
      array1[i]=mac_size + 123 + (i * 99)+ (i * i * 12);
      array2[i]=mac_size + 456 + (i * 78)+ (i * i * 9);
      expect+=array1[i] * array2[i];
    }
    System.out.print(mac_size);
    System.out.print("String_Node_Str");
    out=m.mac1(mac_size,array1,array2);
    for (i=0; i < max_cycles; i++) {
      ts=Native.rdMem(Const.IO_CNT);
      out=m.mac1(mac_size,array1,array2);
      te=Native.rdMem(Const.IO_CNT);
      time=te - ts - to;
      if (time > max_time) {
        max_time=time;
      }
      if (time < min_time) {
        min_time=time;
      }
      total_time+=time;
      if (out != expect) {
        error=true;
        break;
      }
    }
    if (error) {
      System.out.println("String_Node_Str");
      break;
    }
    System.out.print(min_time);
    System.out.print("String_Node_Str");
    System.out.print(total_time / max_cycles);
    System.out.print("String_Node_Str");
    System.out.println(max_time);
    mac_size++;
    if (icount > 100) {
      mac_size+=mac_size / 4;
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void Start(){
  array1=new int[max_mac_size + 1];
  array2=new int[max_mac_size + 1];
  System.out.println("String_Node_Str");
  m=new mac_coprocessor();
  int icount=0;
  boolean error=false;
  for (int mac_size=1; (mac_size < max_mac_size) && !error; icount++) {
    error=Measure(mac_size);
    mac_size++;
    if (icount > 100) {
      mac_size+=mac_size / 4;
    }
  }
  if (!error) {
    Measure(max_mac_size);
  }
  System.out.println("String_Node_Str");
}
Program: 186994
Project: 186994
Buggy source:
public int search_max(int size,int[] data){
  int max=0;
  for (int i=0; i < size; i++) {
    int d=data[i];
    if (d > max)     max=d;
  }
  return max;
}

Fixed version (ground truth):
public int search_max(int size,int[] data){
  int max=0;
  int one=1;
  for (int i=0; i < size; i+=one) {
    int d=data[i];
    if (d > max)     max=d;
  }
  return max;
}
Program: 186996
Project: 186996
Buggy source:
public int bit_count2(int size,int[] data){
  int count=0;
  for (int i=0; i < size; i++) {
    int d=data[i];
    for (int j=0; j < 4; j++) {
      count+=lut[d & 255];
      d=d >> 8;
    }
  }
  return count;
}

Fixed version (ground truth):
public int bit_count2(int size,int[] data){
  int count=0;
  int one=1;
  for (int i=0; i < size; i+=one) {
    int d=data[i];
    for (int j=0; j < 4; j+=one) {
      count+=lut[d & 255];
      d=d >> 8;
    }
  }
  return count;
}
Program: 186997
Project: 186997
Buggy source:
public int bit_count1(int size,int[] data){
  int count=0;
  for (int i=0; i < size; i++) {
    int d=data[i];
    for (int j=0; j < 32; j++) {
      if ((d & 1) == 1)       count++;
      d=d >> 1;
    }
  }
  return count;
}

Fixed version (ground truth):
public int bit_count1(int size,int[] data){
  int count=0;
  int one=1;
  for (int i=0; i < size; i+=one) {
    int d=data[i];
    for (int j=0; j < 32; j+=one) {
      if ((d & 1) == 1)       count+=one;
      d=d >> 1;
    }
  }
  return count;
}
Program: 186998
Project: 186998
Buggy source:
public static int measure(){
  int val=-expect;
  for (int i=0; i < mac_size; i++) {
    val+=array1[i] * array2[i];
  }
  return val;
}

Fixed version (ground truth):
public static void measure(){
  hwm.mac(hwm.max_test_size,hwm.test_vector,hwm.test_vector);
}
Program: 186999
Project: 186999
Buggy source:
public static void main(String[] args){
  measure();
}

Fixed version (ground truth):
public static void main(String[] args){
  hwm=new HWMethTest();
  hwm.Prepare_Noisy_Vector(hwm.max_test_size);
  measure();
}
Program: 187000
Project: 187000
Buggy source:
public int measure(){
  return m.mac1(mac_size,array1,array2) - expect;
}

Fixed version (ground truth):
public static void measure(){
  m.mac1(hwm.max_test_size,hwm.test_vector,hwm.test_vector);
}
Program: 187001
Project: 187001
Buggy source:
public static void main(String[] args){
  MacTestHW mt=new MacTestHW();
  mt.measure();
}

Fixed version (ground truth):
public static void main(String[] args){
  hwm=new HWMethTest();
  hwm.Prepare_Noisy_Vector(hwm.max_test_size);
  m=mac_coprocessor.getInstance();
  measure();
}
Program: 187004
Project: 187004
Buggy source:
private void computeMethodNestingDepths(){
  this.methodMNDs=new HashMap<MethodInfo,Integer>();
  for (  MethodInfo m : project.getCallGraph().getImplementedMethods()) {
    int maxCaller=0;
    ControlFlowGraph cfgInvoked=project.getFlowGraph(m);
    for (    Pair<SuperInvokeEdge,SuperReturnEdge> callSite : superGraph.getCallSites(cfgInvoked)) {
      InvokeNode callSiteNode=callSite.fst().getInvokeNode();
      ControlFlowGraph cfgInvoker=callSiteNode.invokerFlowGraph();
      int callerRootDepth=methodMNDs.get(cfgInvoker.getMethodInfo());
      int nestingDepth=cfgInvoker.getLoopColoring().getLoopColor(callSiteNode).size();
      maxCaller=Math.max(maxCaller,callerRootDepth + nestingDepth);
    }
    methodMNDs.put(m,maxCaller);
  }
  if (config.debug)   MiscUtils.printMap(System.out,methodMNDs,30);
}

Fixed version (ground truth):
private void computeMethodNestingDepths(){
  this.methodMNDs=new HashMap<MethodInfo,Integer>();
  for (  MethodInfo m : project.getCallGraph().getImplementedMethods(project.getTargetMethod())) {
    int maxCaller=0;
    ControlFlowGraph cfgInvoked=project.getFlowGraph(m);
    for (    Pair<SuperInvokeEdge,SuperReturnEdge> callSite : superGraph.getCallSites(cfgInvoked)) {
      InvokeNode callSiteNode=callSite.fst().getInvokeNode();
      ControlFlowGraph cfgInvoker=callSiteNode.invokerFlowGraph();
      int callerRootDepth=methodMNDs.get(cfgInvoker.getMethodInfo());
      int nestingDepth=cfgInvoker.getLoopColoring().getLoopColor(callSiteNode).size();
      maxCaller=Math.max(maxCaller,callerRootDepth + nestingDepth);
    }
    methodMNDs.put(m,maxCaller);
  }
  if (config.debug)   MiscUtils.printMap(System.out,methodMNDs,30);
}
Program: 187005
Project: 187005
Buggy source:
private void calculateDepthAndHeight(){
  if (this.maxDistanceToRoot != null)   return;
  this.maxDistanceToRoot=new HashMap<CallGraphNode,Integer>();
  this.maxCallStackLeaf=this.getRootNode();
  this.maxCallstackDAG=new HashMap<CallGraphNode,CallGraphNode>();
  this.subgraphHeight=new HashMap<CallGraphNode,Integer>();
  Vector<CallGraphNode> toList=new Vector<CallGraphNode>();
  TopologicalOrderIterator<CallGraphNode,DefaultEdge> toIter=new TopologicalOrderIterator<CallGraphNode,DefaultEdge>(callGraph);
  int globalMaxDist=0;
  while (toIter.hasNext()) {
    CallGraphNode node=toIter.next();
    toList.add(node);
    int maxDist=0;
    CallGraphNode maxCallStackPred=null;
    for (    DefaultEdge e : callGraph.incomingEdgesOf(node)) {
      CallGraphNode pred=callGraph.getEdgeSource(e);
      int distViaPred=maxDistanceToRoot.get(pred) + 1;
      if (distViaPred > maxDist) {
        maxDist=distViaPred;
        maxCallStackPred=pred;
      }
    }
    this.maxDistanceToRoot.put(node,maxDist);
    if (maxCallStackPred != null)     this.maxCallstackDAG.put(node,maxCallStackPred);
    if (maxDist > globalMaxDist)     this.maxCallStackLeaf=node;
  }
  Collections.reverse(toList);
  for (  CallGraphNode n : toList) {
    int maxHeight=0;
    for (    DefaultEdge e : callGraph.outgoingEdgesOf(n)) {
      int predHeight=subgraphHeight.get(callGraph.getEdgeTarget(e));
      maxHeight=Math.max(maxHeight,predHeight);
    }
    subgraphHeight.put(n,maxHeight);
  }
}

Fixed version (ground truth):
private void calculateDepthAndHeight(){
  if (this.maxDistanceToRoot != null)   return;
  this.maxDistanceToRoot=new HashMap<CallGraphNode,Integer>();
  this.maxCallStackLeaf=this.getRootNode();
  this.maxCallstackDAG=new HashMap<CallGraphNode,CallGraphNode>();
  this.subgraphHeight=new HashMap<CallGraphNode,Integer>();
  Vector<CallGraphNode> toList=new Vector<CallGraphNode>();
  TopologicalOrderIterator<CallGraphNode,DefaultEdge> toIter=new TopologicalOrderIterator<CallGraphNode,DefaultEdge>(callGraph);
  int globalMaxDist=0;
  while (toIter.hasNext()) {
    CallGraphNode node=toIter.next();
    toList.add(node);
    int maxDist=0;
    CallGraphNode maxCallStackPred=null;
    for (    DefaultEdge e : callGraph.incomingEdgesOf(node)) {
      CallGraphNode pred=callGraph.getEdgeSource(e);
      int distViaPred=maxDistanceToRoot.get(pred) + 1;
      if (distViaPred > maxDist) {
        maxDist=distViaPred;
        maxCallStackPred=pred;
      }
    }
    this.maxDistanceToRoot.put(node,maxDist);
    if (maxCallStackPred != null)     this.maxCallstackDAG.put(node,maxCallStackPred);
    if (maxDist > globalMaxDist)     this.maxCallStackLeaf=node;
  }
  Collections.reverse(toList);
  for (  CallGraphNode n : toList) {
    int maxHeight=0;
    for (    DefaultEdge e : callGraph.outgoingEdgesOf(n)) {
      int predHeight=subgraphHeight.get(callGraph.getEdgeTarget(e));
      maxHeight=Math.max(maxHeight,predHeight + 1);
    }
    subgraphHeight.put(n,maxHeight);
  }
}
Program: 187006
Project: 187006
Buggy source:
/** 
 * Get the maximum height of the call stack. <p>A leaf method has height 1, an abstract method's height is the maximum height of its children, and the height of an implemented method is the maximum height of its children + 1. <p>
 * @return
 */
public Vector<CallGraphNode> getMaximalCallStack(){
  Map<CallGraphNode,Integer> depth=new HashMap<CallGraphNode,Integer>();
  HashMap<CallGraphNode,CallGraphNode> prev=new HashMap<CallGraphNode,CallGraphNode>();
  CallGraphNode deepestLeaf=rootNode;
  TopologicalOrderIterator<CallGraphNode,DefaultEdge> toIter=new TopologicalOrderIterator<CallGraphNode,DefaultEdge>(callGraph);
  depth.put(rootNode,0);
  int maxDepth=0;
  Set<CallGraphNode> visited=new HashSet<CallGraphNode>();
  while (toIter.hasNext()) {
    CallGraphNode n=toIter.next();
    visited.add(n);
    int thisDepth=depth.get(n);
    for (    DefaultEdge e : callGraph.outgoingEdgesOf(n)) {
      CallGraphNode target=callGraph.getEdgeTarget(e);
      if (visited.contains(target)) {
        throw new AssertionError("String_Node_Str");
      }
      int oldDepth;
{
        Integer tmp=depth.get(target);
        oldDepth=tmp == null ? 0 : tmp.intValue();
      }
      if (thisDepth + 1 > oldDepth) {
        depth.put(target,thisDepth + 1);
        prev.put(target,n);
        if (thisDepth + 1 > maxDepth) {
          maxDepth=thisDepth + 1;
          deepestLeaf=target;
        }
      }
    }
  }
  Vector<CallGraphNode> maxCallStack=new Vector<CallGraphNode>();
  CallGraphNode n=deepestLeaf;
  while (prev.containsKey(n)) {
    maxCallStack.add(n);
    n=prev.get(n);
  }
  maxCallStack.add(n);
  Collections.reverse(maxCallStack);
  return maxCallStack;
}

Fixed version (ground truth):
/** 
 * Get the maximum height of the call stack. <p>A leaf method has height 1, an abstract method's height is the maximum height of its children, and the height of an implemented method is the maximum height of its children + 1. <p>
 * @return
 */
public Vector<CallGraphNode> getMaximalCallStack(){
  if (maxCallStackLeaf == null)   calculateDepthAndHeight();
  CallGraphNode n=this.maxCallStackLeaf;
  Vector<CallGraphNode> maxCallStack=new Vector<CallGraphNode>();
  maxCallStack.add(n);
  while (maxCallstackDAG.containsKey(n)) {
    n=maxCallstackDAG.get(n);
    maxCallStack.add(n);
  }
  Collections.reverse(maxCallStack);
  return maxCallStack;
}
Program: 187007
Project: 187007
Buggy source:
/** 
 * Build a callgraph rooted at the given method
 * @param cli The class loader (with classes loaded)
 * @param className The class where the root method of the callgraph is located
 * @param methodSig The root method of the call graph. Either a plain method name(e.g. "measure"), if unique, or a method with signature (e.g. "measure()Z")
 * @throws MethodNotFoundException 
 */
public static CallGraph buildCallGraph(WcetAppInfo cli,String className,String methodSig) throws MethodNotFoundException {
  MethodInfo rootMethod=cli.searchMethod(className,methodSig);
  CallGraph cg=new CallGraph(cli,rootMethod);
  cg.build();
  return cg;
}

Fixed version (ground truth):
/** 
 * Build a callgraph rooted at the given method
 * @param appInfo   The application (with classes loaded)
 * @param className The class where the root method of the callgraph is located
 * @param methodSig The root method of the call graph. Either a plain method name(e.g. "measure"), if unique, or a method with signature (e.g. "measure()Z")
 * @throws MethodNotFoundException 
 */
public static CallGraph buildCallGraph(WcetAppInfo appInfo,String className,String methodSig) throws MethodNotFoundException {
  MethodInfo rootMethod=appInfo.searchMethod(className,methodSig);
  CallGraph cg=new CallGraph(appInfo,rootMethod);
  cg.build();
  return cg;
}
Program: 187008
Project: 187008
Buggy source:
public void exportDOT(Writer w) throws IOException {
  new AdvancedDOTExporter<CallGraphNode,DefaultEdge>().exportDOT(w,this.callGraph);
}

Fixed version (ground truth):
/** 
 * Export callgraph as .dot file
 * @param w
 * @throws IOException
 */
public void exportDOT(Writer w) throws IOException {
  new AdvancedDOTExporter<CallGraphNode,DefaultEdge>().exportDOT(w,this.callGraph);
}
Program: 187009
Project: 187009
Buggy source:
/** 
 * get non-abstract methods reachable from the given method, in DFS order
 * @return
 */
public List<MethodInfo> getReachableImplementations(MethodInfo rootMethod){
  List<MethodInfo> implemented=new Vector<MethodInfo>();
  CallGraphNode root=this.getNode(rootMethod);
  DepthFirstIterator<CallGraphNode,DefaultEdge> ti=new DepthFirstIterator<CallGraphNode,DefaultEdge>(callGraph,root);
  ti.setCrossComponentTraversal(false);
  while (ti.hasNext()) {
    MethodInfo m=ti.next().getMethodImpl();
    if (m != null)     implemented.add(m);
  }
  return implemented;
}

Fixed version (ground truth):
/** 
 * get non-abstract methods reachable from the given method, in DFS order
 * @return
 */
public List<MethodInfo> getReachableImplementations(MethodInfo rootMethod){
  List<MethodInfo> implemented=new Vector<MethodInfo>();
  CallGraphNode root=this.getNode(rootMethod);
  DepthFirstIterator<CallGraphNode,DefaultEdge> ti=new DepthFirstIterator<CallGraphNode,DefaultEdge>(callGraph,root);
  ti.setCrossComponentTraversal(false);
  while (ti.hasNext()) {
    MethodInfo m=ti.next().getMethodImpl();
    if (m == null)     throw new AssertionError("String_Node_Str");
    implemented.add(m);
  }
  return implemented;
}
Program: 187010
Project: 187010
Buggy source:
public int getMaxHeight(){
  return this.getMaximalCallStack().size();
}

Fixed version (ground truth):
public int getMaxHeight(){
  calculateDepthAndHeight();
  return this.subgraphHeight.get(this.rootNode);
}
Program: 187011
Project: 187011
Buggy source:
/** 
 * Initialize a CallGraph object.
 * @param appInfo
 * @param rootMethod The root method of the callgraph. Must not be abstract.
 */
protected CallGraph(WcetAppInfo appInfo,MethodInfo rootMethod){
  this.appInfo=appInfo;
  this.callGraph=new DefaultDirectedGraph<CallGraphNode,DefaultEdge>(DefaultEdge.class);
  this.rootNode=new CallGraphNode(rootMethod);
  this.callGraph.addVertex(rootNode);
}

Fixed version (ground truth):
/** 
 * Initialize a CallGraph object.
 * @param appInfo    Uplink to the application info.
 * @param rootMethod The root method of the callgraph (not abstract).
 */
protected CallGraph(WcetAppInfo appInfo,MethodInfo rootMethod){
  this.appInfo=appInfo;
  this.callGraph=new DefaultDirectedGraph<CallGraphNode,DefaultEdge>(DefaultEdge.class);
  this.rootNode=new CallGraphNode(rootMethod);
  this.callGraph.addVertex(rootNode);
}
Program: 187012
Project: 187012
Buggy source:
private void build() throws MethodNotFoundException {
  this.buildGraph();
  classInfos=new HashSet<ClassInfo>();
  for (  CallGraphNode cgn : callGraph.vertexSet()) {
    classInfos.add(cgn.getReferencedMethod().getReceiver());
  }
  Pair<List<CallGraphNode>,List<CallGraphNode>> cycle=DirectedCycleDetector.findCycle(callGraph,rootNode);
  if (cycle != null) {
    throw new AssertionError(cyclicCallGraphMsg(cycle));
  }
}

Fixed version (ground truth):
private void build() throws MethodNotFoundException {
  this.buildGraph();
  classInfos=new HashSet<ClassInfo>();
  for (  CallGraphNode cgn : callGraph.vertexSet()) {
    classInfos.add(cgn.getReferencedMethod().getReceiver());
  }
  Pair<List<CallGraphNode>,List<CallGraphNode>> cycle=DirectedCycleDetector.findCycle(callGraph,rootNode);
  if (cycle != null) {
    throw new AssertionError(cyclicCallGraphMsg(cycle));
  }
  invalidate();
}
Program: 187013
Project: 187013
Buggy source:
protected CallGraphNode getNode(MethodInfo m){
  return nodeMap.get(m);
}

Fixed version (ground truth):
private CallGraphNode getNode(MethodInfo m){
  return nodeMap.get(m);
}
Program: 187014
Project: 187014
Buggy source:
/** 
 * Compute the maximal total cache-miss penalty for <strong>invoking and executing</strong> m. <p> Precondition: The set of all methods reachable from <code>m</code> fit into the cache </p><p> Algorithm: If all methods reachable from <code>m</code> (including <code>m</code>) fit  into the cache, we can compute the WCET of <m> using the   {@link ALWAYS_HIT@} cacheapproximation, and then add the sum of cache miss penalties for every reachable method. </p><p> Note that when using this approximation, we attribute the total cache miss cost to the invocation of that method. </p><p> Explanation: We know that there is only one cache miss per method, but for FIFO caches we do not know when the cache miss will occur (on return or invoke), except for leaf methods. Let <code>h</code> be the number of cycles hidden by <strong>any</strong> return or  invoke instructions. Then the cache miss penalty is bounded by <code>(b-h)</code> per  method. </p>
 * @param m The method invoked
 * @return the cache miss penalty
 */
public long getMissOnceCummulativeCacheCost(MethodInfo m){
  long miss=0;
  Iterator<CallGraphNode> iter=project.getCallGraph().getReachableMethods(m);
  while (iter.hasNext()) {
    CallGraphNode n=iter.next();
    miss+=missOnceCost(n.getMethodImpl());
  }
  return miss;
}

Fixed version (ground truth):
/** 
 * Compute the maximal total cache-miss penalty for <strong>invoking and executing</strong> m. <p> Precondition: The set of all methods reachable from <code>m</code> fit into the cache </p><p> Algorithm: If all methods reachable from <code>m</code> (including <code>m</code>) fit  into the cache, we can compute the WCET of <m> using the   {@link ALWAYS_HIT@} cacheapproximation, and then add the sum of cache miss penalties for every reachable method. </p><p> Note that when using this approximation, we attribute the total cache miss cost to the invocation of that method. </p><p> Explanation: We know that there is only one cache miss per method, but for FIFO caches we do not know when the cache miss will occur (on return or invoke), except for leaf methods. Let <code>h</code> be the number of cycles hidden by <strong>any</strong> return or  invoke instructions. Then the cache miss penalty is bounded by <code>(b-h)</code> per  method. </p>
 * @param m The method invoked
 * @return the cache miss penalty
 */
public long getMissOnceCummulativeCacheCost(MethodInfo m){
  long miss=0;
  for (  MethodInfo reachable : project.getCallGraph().getReachableImplementations(m)) {
    miss+=missOnceCost(reachable);
  }
  return miss;
}
Program: 187015
Project: 187015
Buggy source:
/** 
 * Compute the number of cache blocks which might be needed when calling this method
 * @param mi
 * @return the maximum number of cache blocks needed, s.t. we won't run out of cacheblocks when invoking the given method
 * @throws TypeException 
 */
public long getAllFitCacheBlocks(MethodInfo mi){
  int size=0;
  Iterator<CallGraphNode> iter=project.getCallGraph().getReachableMethods(mi);
  while (iter.hasNext()) {
    CallGraphNode n=iter.next();
    size+=requiredNumberOfBlocks(project.getSizeInWords(n.getMethodImpl()));
  }
  return size;
}

Fixed version (ground truth):
/** 
 * Compute the number of cache blocks which might be needed when calling this method
 * @param invoked
 * @return the maximum number of cache blocks needed, s.t. we won't run out of cacheblocks when invoking the given method
 * @throws TypeException 
 */
public long getAllFitCacheBlocks(MethodInfo invoked){
  int size=0;
  for (  MethodInfo mi : project.getCallGraph().getReachableImplementations(invoked)) {
    size+=requiredNumberOfBlocks(project.getSizeInWords(mi));
  }
  return size;
}
Program: 187016
Project: 187016
Buggy source:
/** 
 * Check that cache is big enough to hold any method possibly invoked Return largest method 
 */
public MethodInfo checkCache() throws Exception {
  int maxWords=0;
  MethodInfo largestMethod=null;
  for (  MethodInfo mi : project.getCallGraph().getImplementedMethods()) {
    Code code=mi.getCode();
    if (code == null)     continue;
    int size=code.getLength();
    int words=MiscUtils.bytesToWords(size);
    if (!this.fitsInCache(words)) {
      throw new Exception("String_Node_Str" + mi.getFQMethodName() + "String_Node_Str"+ words+ "String_Node_Str");
    }
    if (words >= maxWords) {
      largestMethod=mi;
      maxWords=words;
    }
  }
  return largestMethod;
}

Fixed version (ground truth):
/** 
 * Check that cache is big enough to hold any method possibly invoked Return largest method 
 */
public MethodInfo checkCache() throws Exception {
  int maxWords=0;
  MethodInfo largestMethod=null;
  for (  MethodInfo mi : project.getCallGraph().getImplementedMethods()) {
    Code code=mi.getCode();
    if (code == null)     continue;
    int size=code.getCode().length;
    int words=MiscUtils.bytesToWords(size);
    if (!this.fitsInCache(words)) {
      throw new Exception("String_Node_Str" + mi.getFQMethodName() + "String_Node_Str"+ words+ "String_Node_Str");
    }
    if (words >= maxWords) {
      largestMethod=mi;
      maxWords=words;
    }
  }
  return largestMethod;
}
Program: 187017
Project: 187017
Buggy source:
public String getTargetName(){
  return Config.sanitizeFileName(projectConfig.getAppClassName() + "String_Node_Str" + projectConfig.getTargetMethodName());
}

Fixed version (ground truth):
public String getTargetName(){
  return MiscUtils.sanitizeFileName(projectConfig.getAppClassName() + "String_Node_Str" + projectConfig.getTargetMethodName());
}
Program: 187018
Project: 187018
Buggy source:
public String getProjectName(){
  return config.getOptionWithDefault(PROJECT_NAME,Config.sanitizeFileName(getAppClassName() + "String_Node_Str" + getTargetMethodName()));
}

Fixed version (ground truth):
public String getProjectName(){
  return config.getOptionWithDefault(PROJECT_NAME,MiscUtils.sanitizeFileName(getAppClassName() + "String_Node_Str" + getTargetMethodName()));
}
Program: 187019
Project: 187019
Buggy source:
/** 
 * If no instance of project is available, us this one to get a path for writing a file (not recommended, but sometimes useful for debugging stuff)
 * @param subdir
 * @param name 
 */
public static File getOutFile(String subdir,String name){
  return new File(getOutDir(subdir),Config.sanitizeFileName(name));
}

Fixed version (ground truth):
/** 
 * If no instance of project is available, us this one to get a path for writing a file (not recommended, but sometimes useful for debugging stuff)
 * @param subdir
 * @param name 
 */
public static File getOutFile(String subdir,String name){
  return new File(getOutDir(subdir),MiscUtils.sanitizeFileName(name));
}
Program: 187020
Project: 187020
Buggy source:
public UppaalAnalysis(Logger logger,Project project,File outDir){
  this.logger=logger;
  this.project=project;
  this.outDir=outDir;
}

Fixed version (ground truth):
public UppaalAnalysis(Logger logger,Project project,File outDir){
  this.uppaalConfig=new UppAalConfig(project.getConfig(),outDir);
  this.logger=logger;
  this.project=project;
}
Program: 187021
Project: 187021
Buggy source:
public WcetCost calculateWCET(MethodInfo m,long ub) throws IOException, DuplicateKeyException, XmlSerializationException {
  Long upperBound=null;
  if (ub > 0)   upperBound=ub;
  logger.info("String_Node_Str" + m.getFQMethodName());
  Translator translator=new Translator(project,outDir);
  translator.translateProgram(m);
  translator.writeOutput();
  logger.info("String_Node_Str" + outDir);
  logger.info("String_Node_Str" + translator.getModelFile());
  if (UppAalConfig.hasVerifier(project.getConfig())) {
    logger.info("String_Node_Str");
    WcetSearch search=new WcetSearch(project.getConfig(),translator.getModelFile());
    long start=System.nanoTime();
    long wcet=search.searchWCET(upperBound);
    long end=System.nanoTime();
    searchtime+=((double)(end - start)) / 1E9;
    solvertimemax=Math.max(solvertimemax,search.getMaxSolverTime());
    return WcetCost.totalCost(wcet);
  }
 else {
    throw new IOException("String_Node_Str");
  }
}

Fixed version (ground truth):
public WcetCost calculateWCET(MethodInfo m,long ub) throws IOException, DuplicateKeyException, XmlSerializationException {
  Long upperBound=null;
  if (ub > 0)   upperBound=ub;
  logger.info("String_Node_Str" + m.getFQMethodName());
  Translator translator=new Translator(uppaalConfig,project);
  translator.translateProgram(m);
  translator.writeOutput();
  logger.info("String_Node_Str" + uppaalConfig.outDir);
  logger.info("String_Node_Str" + translator.getModelFile());
  if (uppaalConfig.hasVerifier()) {
    logger.info("String_Node_Str");
    WcetSearch search=new WcetSearch(project.getConfig(),translator.getModelFile());
    long start=System.nanoTime();
    long wcet=search.searchWCET(upperBound);
    long end=System.nanoTime();
    searchtime+=((double)(end - start)) / 1E9;
    solvertimemax=Math.max(solvertimemax,search.getMaxSolverTime());
    return WcetCost.totalCost(wcet);
  }
 else {
    throw new IOException("String_Node_Str");
  }
}
Program: 187022
Project: 187022
Buggy source:
private static String pageOf(MethodInfo i){
  return sanitizeFileName(i.getFQMethodName()) + "String_Node_Str";
}

Fixed version (ground truth):
private static String pageOf(MethodInfo i){
  return MiscUtils.sanitizeFileName(i.getFQMethodName()) + "String_Node_Str";
}
Program: 187023
Project: 187023
Buggy source:
private void generateDetailedReport(MethodInfo method){
  String page=pageOf(method);
  Hashtable<String,Object> ctx=new Hashtable<String,Object>();
  ctx.put("String_Node_Str",method);
  ctx.put("String_Node_Str",this.detailedReports.get(method));
  for (  DetailedMethodReport m : this.detailedReports.get(method)) {
    m.getGraph();
  }
  try {
    this.generateFile("String_Node_Str",config.getOutFile(page),ctx);
  }
 catch (  Exception e) {
    logger.error(e);
  }
  this.addPage("String_Node_Str" + method.getCli().clazz.getClassName() + "String_Node_Str"+ sanitizePageKey(method.methodId),page);
}

Fixed version (ground truth):
private void generateDetailedReport(MethodInfo method){
  String page=pageOf(method);
  Hashtable<String,Object> ctx=new Hashtable<String,Object>();
  ctx.put("String_Node_Str",method);
  ctx.put("String_Node_Str",project.getFlowGraph(method).dumpDFA());
  ctx.put("String_Node_Str",this.detailedReports.get(method));
  for (  DetailedMethodReport m : this.detailedReports.get(method)) {
    m.getGraph();
  }
  try {
    this.generateFile("String_Node_Str",config.getOutFile(page),ctx);
  }
 catch (  Exception e) {
    logger.error(e);
  }
  this.addPage("String_Node_Str" + method.getCli().clazz.getClassName() + "String_Node_Str"+ sanitizePageKey(method.methodId),page);
}
Program: 187024
Project: 187024
Buggy source:
/** 
 * get the filename for output files
 * @param method the method the outputfile should be created for
 * @param extension the filename extension (e.g. .xml)
 * @return the filename
 */
public File getOutFile(MethodInfo method,String extension){
  return new File(outDir,sanitizeFileName(method.getFQMethodName() + extension));
}

Fixed version (ground truth):
/** 
 * get the filename for output files
 * @param method the method the outputfile should be created for
 * @param extension the filename extension (e.g. .xml)
 * @return the filename
 */
public File getOutFile(MethodInfo method,String extension){
  return new File(outDir,MiscUtils.sanitizeFileName(method.getFQMethodName() + extension));
}
Program: 187026
Project: 187026
Buggy source:
private void buildEdge(CFGEdge edge){
  FlowGraph<CFGNode,CFGEdge> graph=cfg.getGraph();
  Set<CFGNode> hols=cfg.getLoopColoring().getHeadOfLoops();
  Set<CFGEdge> backEdges=cfg.getLoopColoring().getBackEdges();
  Map<CFGEdge,IterationBranchLabel<CFGNode>> edgeColoring=cfg.getLoopColoring().getIterationBranchEdges();
  CFGNode src=graph.getEdgeSource(edge);
  CFGNode target=graph.getEdgeTarget(edge);
  Transition transition=tBuilder.createTransition(nodeTemplates.get(src).snd(),nodeTemplates.get(target).fst());
  TransitionAttributes attrs=transition.getAttrs();
  IterationBranchLabel<CFGNode> edgeColor=edgeColoring.get(edge);
  if (edgeColor != null) {
    for (    CFGNode loop : edgeColor.getContinues()) {
      attrs.appendGuard(tBuilder.contLoopGuard(loop));
      attrs.appendUpdate(tBuilder.incrLoopCounter(loop));
    }
    for (    CFGNode loop : edgeColor.getExits()) {
      attrs.appendGuard(tBuilder.exitLoopGuard(loop));
      attrs.appendUpdate(tBuilder.resetLoopCounter(loop));
    }
  }
  if (hols.contains(target) && !backEdges.contains(edge)) {
    attrs.appendUpdate(tBuilder.resetLoopCounter(target));
  }
}

Fixed version (ground truth):
private void buildEdge(CFGEdge edge){
  FlowGraph<CFGNode,CFGEdge> graph=cfg.getGraph();
  Set<CFGNode> hols=cfg.getLoopColoring().getHeadOfLoops();
  Set<CFGEdge> backEdges=cfg.getLoopColoring().getBackEdges();
  Map<CFGEdge,IterationBranchLabel<CFGNode>> edgeColoring=cfg.getLoopColoring().getIterationBranchEdges();
  CFGNode src=graph.getEdgeSource(edge);
  CFGNode target=graph.getEdgeTarget(edge);
  if (src == cfg.getEntry() && target == cfg.getExit())   return;
  Transition transition=tBuilder.createTransition(nodeTemplates.get(src).snd(),nodeTemplates.get(target).fst());
  TransitionAttributes attrs=transition.getAttrs();
  IterationBranchLabel<CFGNode> edgeColor=edgeColoring.get(edge);
  if (edgeColor != null) {
    for (    CFGNode loop : edgeColor.getContinues()) {
      attrs.appendGuard(tBuilder.contLoopGuard(loop));
      attrs.appendUpdate(tBuilder.incrLoopCounter(loop));
    }
    for (    CFGNode loop : edgeColor.getExits()) {
      attrs.appendGuard(tBuilder.exitLoopGuard(loop));
      attrs.appendUpdate(tBuilder.resetLoopCounter(loop));
    }
  }
  if (hols.contains(target) && !backEdges.contains(edge)) {
    attrs.appendUpdate(tBuilder.resetLoopCounter(target));
  }
}
Program: 187027
Project: 187027
Buggy source:
private StringBuilder initCache(String NUM_METHODS){
  Vector<Object> cacheElems=new Vector<Object>();
  cacheElems.add(0);
  int i;
  for (i=1; i < blocksOf(0); i++)   cacheElems.add(0);
  for (; i < cache.getNumBlocks(); i++)   cacheElems.add(NUM_METHODS);
  return CacheSimBuilder.constArray(cacheElems);
}

Fixed version (ground truth):
private StringBuilder initCache(String NUM_METHODS){
  Vector<Object> cacheElems=new Vector<Object>();
  for (int i=0; i < cache.getNumBlocks(); i++)   cacheElems.add(NUM_METHODS);
  cacheElems.set(blocksOf(0) - 1,0);
  return CacheSimBuilder.constArray(cacheElems);
}
Program: 187028
Project: 187028
Buggy source:
@Override public void appendDeclarations(NTASystem system,String NUM_METHODS){
  super.appendDeclarations(system,NUM_METHODS);
  system.appendDeclaration(String.format("String_Node_Str",NUM_METHODS,initNumBlocks()));
  system.appendDeclaration(String.format("String_Node_Str",NUM_METHODS,cache.getNumBlocks(),initCache(NUM_METHODS)));
  system.appendDeclaration(String.format("String_Node_Str"));
  system.appendDeclaration("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + cache.getNumBlocks() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ (cache.getNumBlocks() - 1)+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ NUM_METHODS+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void appendDeclarations(NTASystem system,String NUM_METHODS){
  super.appendDeclarations(system,NUM_METHODS);
  system.appendDeclaration(String.format("String_Node_Str",NUM_METHODS,initNumBlocks()));
  system.appendDeclaration(String.format("String_Node_Str",NUM_METHODS,cache.getNumBlocks(),initCache(NUM_METHODS)));
  system.appendDeclaration(String.format("String_Node_Str"));
  system.appendDeclaration("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + cache.getNumBlocks() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ (cache.getNumBlocks() - 1)+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ NUM_METHODS+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 187029
Project: 187029
Buggy source:
public void established(Packet p){
  Ip.setData(p,Tcp.DATA,"String_Node_Str");
}

Fixed version (ground truth):
public Packet established(Packet p){
  Ip.setData(p,Tcp.DATA,"String_Node_Str");
  return p;
}