Program: 13697
Project: 13697
Buggy source:
public static void setJobResources(HalvadeOptions opt,Configuration conf,int type,boolean subtractAM,boolean BAMinput) throws InterruptedException {
  int tmpmem=(int)(opt.mem * 1024);
  int tmpvcores=opt.vcores;
  BAMinput=BAMinput && type < 3;
  int mmem=RESOURCE_REQ[BAMinput ? 3 : type][0];
  int rmem=RESOURCE_REQ[type][1] == ALL ? tmpmem - MEM_AM : RESOURCE_REQ[type][1];
  if (rmem == MEM_ELPREP && !opt.useElPrep)   rmem=MEM_REF;
  if ((opt.overrideMapMem > 0 || opt.overrideRedMem > 0) && type != COMBINE) {
    if (!BAMinput && opt.overrideMapMem > 0)     mmem=opt.overrideMapMem;
    if (type != RNA_SHMEM_PASS1 && opt.overrideRedMem > 0)     rmem=opt.overrideRedMem;
  }
  if (mmem > opt.mem * 1024 || rmem > opt.mem * 1024)   throw new InterruptedException("String_Node_Str" + opt.mem * 1024 + "String_Node_Str" + Math.max(rmem,mmem));
  if (opt.setMapContainers)   opt.mapContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / mmem,1));
  if (opt.setReduceContainers)   opt.reducerContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / rmem,1));
  HalvadeConf.setVcores(conf,opt.vcores);
  opt.mthreads=Math.max(1,tmpvcores / opt.mapContainersPerNode);
  opt.rthreads=Math.max(1,tmpvcores / opt.reducerContainersPerNode);
  if (opt.smtEnabled) {
    opt.mthreads*=2;
    opt.rthreads*=2;
  }
  if (opt.mthreads > 1 && opt.mthreads % 2 == 1) {
    opt.mthreads++;
    opt.mapContainersPerNode=Math.min(Math.max(tmpvcores / opt.mthreads,1),Math.max(tmpmem / mmem,1));
  }
  opt.maps=Math.max(1,opt.nodes * opt.mapContainersPerNode);
  opt.parallel_reducers=Math.max(1,opt.nodes * opt.reducerContainersPerNode);
  Logger.DEBUG("String_Node_Str" + opt.maps);
  HalvadeConf.setMapContainerCount(conf,opt.maps);
  if (subtractAM)   opt.rthreads-=VCORES_AM;
  Logger.DEBUG("String_Node_Str" + opt.mapContainersPerNode + "String_Node_Str"+ opt.mthreads+ "String_Node_Str"+ mmem+ "String_Node_Str"+ opt.reducerContainersPerNode+ "String_Node_Str"+ opt.rthreads+ "String_Node_Str"+ rmem+ "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + opt.mthreads);
  conf.set("String_Node_Str","String_Node_Str" + mmem);
  conf.set("String_Node_Str","String_Node_Str" + opt.rthreads);
  conf.set("String_Node_Str","String_Node_Str" + rmem);
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.30 * rmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.30 * mmem) + "String_Node_Str");
  if (type == COMBINE) {
    conf.set("String_Node_Str","String_Node_Str" + (int)(0.80 * rmem) + "String_Node_Str");
    conf.set("String_Node_Str","String_Node_Str" + (int)(0.80 * mmem) + "String_Node_Str");
  }
  if (type != COMBINE)   conf.set("String_Node_Str","String_Node_Str");
  HalvadeConf.setMapThreads(conf,opt.mthreads);
  HalvadeConf.setReducerThreads(conf,opt.rthreads);
}

Fixed version (ground truth):
public static void setJobResources(HalvadeOptions opt,Configuration conf,int type,boolean subtractAM,boolean BAMinput) throws InterruptedException {
  int tmpmem=(int)(opt.mem * 1024);
  int tmpvcores=opt.vcores;
  if (subtractAM)   tmpvcores-=VCORES_AM;
  BAMinput=BAMinput && type < 3;
  int mmem=RESOURCE_REQ[BAMinput ? 3 : type][0];
  int rmem=RESOURCE_REQ[type][1] == ALL ? tmpmem - MEM_AM : RESOURCE_REQ[type][1];
  if (rmem == MEM_ELPREP && !opt.useElPrep)   rmem=MEM_REF;
  if ((opt.overrideMapMem > 0 || opt.overrideRedMem > 0) && type != COMBINE) {
    if (!BAMinput && opt.overrideMapMem > 0)     mmem=opt.overrideMapMem;
    if (type != RNA_SHMEM_PASS1 && opt.overrideRedMem > 0)     rmem=opt.overrideRedMem;
  }
  if (mmem > opt.mem * 1024 || rmem > opt.mem * 1024)   throw new InterruptedException("String_Node_Str" + opt.mem * 1024 + "String_Node_Str" + Math.max(rmem,mmem));
  if (opt.setMapContainers)   opt.mapContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / mmem,1));
  if (opt.setReduceContainers && (type != RNA_SHMEM_PASS2 || type != COMBINE))   opt.reducerContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / rmem,1));
  HalvadeConf.setVcores(conf,opt.vcores);
  opt.mthreads=Math.max(1,tmpvcores / opt.mapContainersPerNode);
  opt.rthreads=Math.max(1,tmpvcores / opt.reducerContainersPerNode);
  if (opt.smtEnabled) {
    opt.mthreads*=2;
    opt.rthreads*=2;
  }
  if (opt.mthreads > 1 && opt.mthreads % 2 == 1) {
    opt.mthreads++;
    opt.mapContainersPerNode=Math.min(Math.max(tmpvcores / opt.mthreads,1),Math.max(tmpmem / mmem,1));
  }
  opt.maps=Math.max(1,opt.nodes * opt.mapContainersPerNode);
  opt.parallel_reducers=Math.max(1,opt.nodes * opt.reducerContainersPerNode);
  Logger.DEBUG("String_Node_Str" + opt.maps);
  HalvadeConf.setMapContainerCount(conf,opt.maps);
  Logger.DEBUG("String_Node_Str" + opt.mapContainersPerNode + "String_Node_Str"+ opt.mthreads+ "String_Node_Str"+ mmem+ "String_Node_Str"+ opt.reducerContainersPerNode+ "String_Node_Str"+ opt.rthreads+ "String_Node_Str"+ rmem+ "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + opt.mthreads);
  conf.set("String_Node_Str","String_Node_Str" + mmem);
  conf.set("String_Node_Str","String_Node_Str" + opt.rthreads);
  conf.set("String_Node_Str","String_Node_Str" + rmem);
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.30 * rmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.30 * mmem) + "String_Node_Str");
  if (type == COMBINE) {
    conf.set("String_Node_Str","String_Node_Str" + (int)(0.80 * rmem) + "String_Node_Str");
    conf.set("String_Node_Str","String_Node_Str" + (int)(0.80 * mmem) + "String_Node_Str");
  }
  if (type != COMBINE)   conf.set("String_Node_Str","String_Node_Str");
  HalvadeConf.setMapThreads(conf,opt.mthreads);
  HalvadeConf.setReducerThreads(conf,opt.rthreads);
}