Program: 132849
Project: 132849
Buggy source:
/** 
 * Work out how much each variable needs to be decrementent. In some cases this will place the decrement instructions right away
 * @param block
 * @param increments
 */
private void countBlockDecrements(Function fn,Block block,RCTracker increments){
  if (block.getType() == BlockType.MAIN_BLOCK) {
    assert(block == fn.mainBlock());
    if (fn.isAsync()) {
      for (      Var i : fn.getInputList()) {
        increments.readDecr(i);
        if (Types.isScalarUpdateable(i) && RefCounting.WRITABLE_UPDATEABLE_INARGS) {
          increments.writeDecr(i);
        }
      }
      for (      PassedVar o : fn.getPassedOutputList()) {
        increments.writeDecr(o.var);
        if (!o.writeOnly) {
          increments.readDecr(o.var);
        }
      }
    }
  }
  for (  Var var : block.getVariables()) {
    if (var.storage() != Alloc.ALIAS && !Types.isStruct(var)) {
      increments.readDecr(var);
      increments.writeDecr(var);
    }
  }
  if (RCUtil.cancelEnabled()) {
    ListIterator<CleanupAction> caIt=block.cleanupIterator();
    while (caIt.hasNext()) {
      CleanupAction ca=caIt.next();
      Instruction action=ca.action();
      if (RefCountOp.isRefcountOp(action.op) && RefCountOp.isDecrement(action.op)) {
        Var decrVar=RefCountOp.getRCTarget(action);
        Arg amount=RefCountOp.getRCAmount(action);
        if (amount.isIntVal()) {
          RefCountType rcType=RefCountOp.getRCType(action.op);
          increments.decr(decrVar,rcType,amount.getIntLit());
          caIt.remove();
        }
      }
    }
  }
  if (!RCUtil.cancelEnabled()) {
    placer.dumpDecrements(block,increments);
  }
}

Fixed version (ground truth):
/** 
 * Work out how much each variable needs to be decrementent. In some cases this will place the decrement instructions right away
 * @param block
 * @param increments
 */
private void countBlockDecrements(Function fn,Block block,RCTracker increments){
  if (block.getType() == BlockType.MAIN_BLOCK) {
    assert(block == fn.mainBlock());
    if (fn.isAsync()) {
      for (      Var i : fn.getInputList()) {
        increments.readDecr(i);
        if (Types.isScalarUpdateable(i) && RefCounting.WRITABLE_UPDATEABLE_INARGS) {
          increments.writeDecr(i);
        }
      }
      for (      PassedVar o : fn.getPassedOutputList()) {
        increments.writeDecr(o.var);
        if (!o.writeOnly) {
          increments.readDecr(o.var);
        }
      }
    }
  }
  for (  Var var : block.getVariables()) {
    if (var.storage() != Alloc.ALIAS && !Types.isStruct(var)) {
      increments.readDecr(var);
      increments.writeDecr(var);
    }
  }
  ListIterator<CleanupAction> caIt=block.cleanupIterator();
  while (caIt.hasNext()) {
    CleanupAction ca=caIt.next();
    Instruction action=ca.action();
    if (RefCountOp.isRefcountOp(action.op) && RefCountOp.isDecrement(action.op)) {
      Var decrVar=RefCountOp.getRCTarget(action);
      Arg amount=RefCountOp.getRCAmount(action);
      if (amount.isIntVal()) {
        RefCountType rcType=RefCountOp.getRCType(action.op);
        increments.decr(decrVar,rcType,amount.getIntLit());
        caIt.remove();
      }
    }
  }
  if (!RCUtil.cancelEnabled()) {
    placer.dumpDecrements(block,increments);
  }
}