Program: 186625
Project: 186625
Buggy source:
public void optimize(){
  List<MethodInfo> rootMethods=config.getTargetMethods();
  resetCounters();
  boolean useWCAProvider=config.useWCA() && config.useWCAExecCount();
  GreedyOrder order=config.getOrder();
  if (order != GreedyOrder.WCAFirst) {
    if (!config.getTargetMethodSet().equals(config.getWCATargetSet())) {
      logger.warn("String_Node_Str" + "String_Node_Str");
      useWCAProvider=false;
    }
  }
  AnalysisManager analyses=initializeAnalyses(config.useWCEP() || useWCAProvider);
  for (  CodeOptimizer opt : optimizers) {
    opt.initialize(analyses,rootMethods);
  }
  CandidateSelector selector;
  if (config.useWCA()) {
    GainCalculator gc=new GainCalculator(analyses);
    if (config.useWCEP()) {
      selector=new WCEPRebateSelector(analyses,gc,config.getMaxCodesize());
    }
 else {
      selector=new WCETRebateSelector(analyses,gc,config.getMaxCodesize());
    }
  }
 else {
    selector=new ACETRebateSelector(analyses,new GainCalculator(analyses),config.getMaxCodesize());
  }
  selector.initialize();
  ExecFrequencyProvider ecp=useWCAProvider ? analyses.getWCAInvoker() : analyses.getExecFrequencyAnalysis();
  if (config.useLocalExecCount()) {
    ecp=new LocalExecFrequencyProvider(ecp);
  }
  analyses.getTargetCallGraph().dumpCallgraph(jcopter.getJConfig().getConfig(),"String_Node_Str",config.getTargetCallgraphDumpType(),true);
  if (order == GreedyOrder.Global || (order == GreedyOrder.WCAFirst && !config.useWCA())) {
    optimizeMethods(analyses,ecp,selector,analyses.getTargetCallGraph().getMethodInfos());
  }
 else   if (order == GreedyOrder.Targets) {
    for (    MethodInfo target : config.getTargetMethods()) {
      optimizeMethods(analyses,ecp,selector,analyses.getTargetCallGraph().getReachableImplementationsSet(target));
    }
  }
 else   if (order == GreedyOrder.WCAFirst) {
    Set<MethodInfo> wcaMethods=analyses.getWCAMethods();
    optimizeMethods(analyses,ecp,selector,wcaMethods);
    Set<MethodInfo> others=new HashSet<MethodInfo>(analyses.getTargetCallGraph().getMethodInfos());
    others.removeAll(wcaMethods);
    selector.printStatistics();
    selector=new ACETRebateSelector(analyses,new GainCalculator(analyses),config.getMaxCodesize());
    selector.initialize();
    ecp=analyses.getExecFrequencyAnalysis();
    if (config.useLocalExecCount()) {
      ecp=new LocalExecFrequencyProvider(ecp);
    }
    optimizeMethods(analyses,ecp,selector,others);
  }
 else   if (order == GreedyOrder.TopDown || order == GreedyOrder.BottomUp) {
    if (config.useWCA() && !analyses.hasWCATargetsOnly()) {
      throw new AppInfoError("String_Node_Str" + order + "String_Node_Str");
    }
    TopologicalOrderIterator<MethodNode,InvokeEdge> topOrder=new TopologicalOrderIterator<MethodNode,InvokeEdge>(analyses.getTargetCallGraph().getAcyclicMergedGraph(order == GreedyOrder.BottomUp));
    while (topOrder.hasNext()) {
      MethodNode node=topOrder.next();
      optimizeMethods(analyses,ecp,selector,Collections.singleton(node.getMethodInfo()));
    }
  }
 else {
    throw new AppInfoError("String_Node_Str" + order + "String_Node_Str");
  }
  analyses.getTargetCallGraph().dumpCallgraph(jcopter.getJConfig().getConfig(),"String_Node_Str",config.getTargetCallgraphDumpType(),true);
  selector.printStatistics();
  printStatistics();
}

Fixed version (ground truth):
public void optimize(){
  List<MethodInfo> rootMethods=config.getTargetMethods();
  resetCounters();
  boolean useWCAProvider=config.useWCA() && config.useWCAExecCount();
  GreedyOrder order=config.getOrder();
  if (order != GreedyOrder.WCAFirst) {
    if (!config.getTargetMethodSet().equals(config.getWCATargetSet())) {
      logger.warn("String_Node_Str" + "String_Node_Str");
      useWCAProvider=false;
    }
  }
  AnalysisManager analyses=initializeAnalyses(config.useWCEP() || useWCAProvider);
  for (  CodeOptimizer opt : optimizers) {
    opt.initialize(analyses,rootMethods);
  }
  CandidateSelector selector;
  if (config.useWCA()) {
    GainCalculator gc=new GainCalculator(analyses);
    if (config.useWCEP()) {
      logger.info("String_Node_Str");
      selector=new WCEPRebateSelector(analyses,gc,config.getMaxCodesize());
    }
 else {
      logger.info("String_Node_Str");
      selector=new WCETRebateSelector(analyses,gc,config.getMaxCodesize());
    }
  }
 else {
    logger.info("String_Node_Str");
    selector=new ACETRebateSelector(analyses,new GainCalculator(analyses),config.getMaxCodesize());
  }
  selector.initialize();
  ExecFrequencyProvider ecp=useWCAProvider ? analyses.getWCAInvoker() : analyses.getExecFrequencyAnalysis();
  if (config.useLocalExecCount()) {
    ecp=new LocalExecFrequencyProvider(ecp);
  }
  analyses.getTargetCallGraph().dumpCallgraph(jcopter.getJConfig().getConfig(),"String_Node_Str",config.getTargetCallgraphDumpType(),true);
  if (order == GreedyOrder.Global || (order == GreedyOrder.WCAFirst && !config.useWCA())) {
    optimizeMethods(analyses,ecp,selector,analyses.getTargetCallGraph().getMethodInfos());
  }
 else   if (order == GreedyOrder.Targets) {
    for (    MethodInfo target : config.getTargetMethods()) {
      optimizeMethods(analyses,ecp,selector,analyses.getTargetCallGraph().getReachableImplementationsSet(target));
    }
  }
 else   if (order == GreedyOrder.WCAFirst) {
    logger.info("String_Node_Str");
    Set<MethodInfo> wcaMethods=analyses.getWCAMethods();
    optimizeMethods(analyses,ecp,selector,wcaMethods);
    selector.printStatistics();
    Set<MethodInfo> others=new HashSet<MethodInfo>(analyses.getTargetCallGraph().getMethodInfos());
    others.removeAll(wcaMethods);
    logger.info("String_Node_Str");
    selector=new ACETRebateSelector(analyses,new GainCalculator(analyses),config.getMaxCodesize());
    selector.initialize();
    ecp=analyses.getExecFrequencyAnalysis();
    if (config.useLocalExecCount()) {
      ecp=new LocalExecFrequencyProvider(ecp);
    }
    optimizeMethods(analyses,ecp,selector,others);
  }
 else   if (order == GreedyOrder.TopDown || order == GreedyOrder.BottomUp) {
    if (config.useWCA() && !analyses.hasWCATargetsOnly()) {
      throw new AppInfoError("String_Node_Str" + order + "String_Node_Str");
    }
    TopologicalOrderIterator<MethodNode,InvokeEdge> topOrder=new TopologicalOrderIterator<MethodNode,InvokeEdge>(analyses.getTargetCallGraph().getAcyclicMergedGraph(order == GreedyOrder.BottomUp));
    while (topOrder.hasNext()) {
      MethodNode node=topOrder.next();
      optimizeMethods(analyses,ecp,selector,Collections.singleton(node.getMethodInfo()));
    }
  }
 else {
    throw new AppInfoError("String_Node_Str" + order + "String_Node_Str");
  }
  analyses.getTargetCallGraph().dumpCallgraph(jcopter.getJConfig().getConfig(),"String_Node_Str",config.getTargetCallgraphDumpType(),true);
  selector.printStatistics();
  printStatistics();
}