Program: 13711
Project: 13711
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 (opt.overrideMem > 0 && type != COMBINE) {
    if (!BAMinput)     mmem=opt.overrideMem;
    rmem=opt.overrideMem;
  }
  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));
  opt.maps=Math.max(1,opt.nodes * opt.mapContainersPerNode);
  Logger.DEBUG("String_Node_Str" + opt.maps);
  HalvadeConf.setMapContainerCount(conf,opt.maps);
  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;
  }
  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);
  if (subtractAM)   conf.set("String_Node_Str","String_Node_Str" + (opt.rthreads - VCORES_AM));
 else   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.8 * rmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.8 * mmem) + "String_Node_Str");
  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;
  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 (opt.overrideMem > 0 && type != COMBINE) {
    if (!BAMinput)     mmem=opt.overrideMem;
    rmem=opt.overrideMem;
  }
  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));
  opt.maps=Math.max(1,opt.nodes * opt.mapContainersPerNode);
  Logger.DEBUG("String_Node_Str" + opt.maps);
  HalvadeConf.setMapContainerCount(conf,opt.maps);
  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;
  }
  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);
  if (subtractAM)   conf.set("String_Node_Str","String_Node_Str" + (opt.rthreads - VCORES_AM));
 else   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.7 * rmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.8 * mmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str");
  HalvadeConf.setMapThreads(conf,opt.mthreads);
  HalvadeConf.setReducerThreads(conf,opt.rthreads);
}