Program: 186636
Project: 186636
Buggy source:
public void optimize(){
  List<MethodInfo> rootMethods=config.getTargetMethods();
  resetCounters();
  AnalysisManager analyses=initializeAnalyses();
  for (  CodeOptimizer opt : optimizers) {
    opt.initialize(analyses,rootMethods);
  }
  CandidateSelector selector;
  if (config.useWCA()) {
    selector=new WCETRebateSelector(analyses,config.getMaxCodesize());
  }
 else {
    selector=new ACETRebateSelector(analyses,config.getMaxCodesize());
  }
  selector.initialize();
  GreedyOrder order=config.getOrder();
  if (order == GreedyOrder.Global || (order == GreedyOrder.WCAFirst && !config.useWCA())) {
    optimizeMethods(analyses,selector,analyses.getTargetCallGraph().getMethodInfos());
  }
 else   if (order == GreedyOrder.Targets) {
    for (    MethodInfo target : config.getTargetMethods()) {
      optimizeMethods(analyses,selector,analyses.getTargetCallGraph().getReachableImplementationsSet(target));
    }
  }
 else   if (order == GreedyOrder.WCAFirst) {
    Set<MethodInfo> wcaMethods=analyses.getWCAMethods();
    optimizeMethods(analyses,selector,wcaMethods);
    Set<MethodInfo> others=new HashSet<MethodInfo>(analyses.getTargetCallGraph().getMethodInfos());
    others.removeAll(wcaMethods);
    selector.printStatistics();
    selector=new ACETRebateSelector(analyses,config.getMaxCodesize());
    selector.initialize();
    optimizeMethods(analyses,selector,others);
  }
 else {
    throw new AppInfoError("String_Node_Str" + order + "String_Node_Str");
  }
  selector.printStatistics();
  printStatistics();
}

Fixed version (ground truth):
public void optimize(){
  List<MethodInfo> rootMethods=config.getTargetMethods();
  resetCounters();
  AnalysisManager analyses=initializeAnalyses();
  for (  CodeOptimizer opt : optimizers) {
    opt.initialize(analyses,rootMethods);
  }
  CandidateSelector selector;
  if (config.useWCA()) {
    selector=new WCETRebateSelector(analyses,config.getMaxCodesize());
  }
 else {
    selector=new ACETRebateSelector(analyses,config.getMaxCodesize());
  }
  selector.initialize();
  GreedyOrder order=config.getOrder();
  if (order == GreedyOrder.Global || (order == GreedyOrder.WCAFirst && !config.useWCA())) {
    optimizeMethods(analyses,analyses.getExecCountAnalysis(),selector,analyses.getTargetCallGraph().getMethodInfos());
  }
 else   if (order == GreedyOrder.Targets) {
    for (    MethodInfo target : config.getTargetMethods()) {
      optimizeMethods(analyses,analyses.getExecCountAnalysis(),selector,analyses.getTargetCallGraph().getReachableImplementationsSet(target));
    }
  }
 else   if (order == GreedyOrder.WCAFirst) {
    Set<MethodInfo> wcaMethods=analyses.getWCAMethods();
    optimizeMethods(analyses,analyses.getWCAInvoker(),selector,wcaMethods);
    Set<MethodInfo> others=new HashSet<MethodInfo>(analyses.getTargetCallGraph().getMethodInfos());
    others.removeAll(wcaMethods);
    selector.printStatistics();
    selector=new ACETRebateSelector(analyses,config.getMaxCodesize());
    selector.initialize();
    optimizeMethods(analyses,analyses.getExecCountAnalysis(),selector,others);
  }
 else {
    throw new AppInfoError("String_Node_Str" + order + "String_Node_Str");
  }
  selector.printStatistics();
  printStatistics();
}