Program: 81840
Project: 81840
Buggy source:
public static void profileForFoliageShader(){
  World world=Minecraft.getMinecraft().world;
  Entity entityIn=Minecraft.getMinecraft().player;
  BlockPos pos=entityIn.getPosition();
  boolean add=true;
  boolean trim=true;
  int radialRange=40;
  int xzRange=radialRange;
  int yRange=15;
  boolean dirtyVBO2=false;
  if (add) {
    for (int x=-xzRange; x <= xzRange; x++) {
      for (int z=-xzRange; z <= xzRange; z++) {
        for (int y=-yRange; y <= yRange; y++) {
          BlockPos posScan=pos.add(x,y,z);
          if (!ExtendedRenderer.foliageRenderer.lookupPosToFoliage.containsKey(posScan) && !FoliageRenderer.foliageQueueAdd.contains(posScan)) {
            if (validFoliageSpot(entityIn.world,posScan.down())) {
              if (entityIn.getDistanceSq(posScan) <= radialRange * radialRange) {
                FoliageRenderer.foliageQueueAdd.add(posScan);
                dirtyVBO2=true;
              }
            }
          }
 else {
          }
        }
      }
    }
  }
  if (trim) {
    Iterator<Map.Entry<BlockPos,List<Foliage>>> it=ExtendedRenderer.foliageRenderer.lookupPosToFoliage.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<BlockPos,List<Foliage>> entry=it.next();
      if (!validFoliageSpot(world,entry.getKey().down())) {
        FoliageRenderer.foliageQueueRemove.add(entry.getKey());
        dirtyVBO2=true;
      }
 else       if (entityIn.getDistanceSq(entry.getKey()) > radialRange * radialRange) {
        FoliageRenderer.foliageQueueRemove.add(entry.getKey());
        dirtyVBO2=true;
      }
    }
  }
  if (dirtyVBO2) {
    updateVBO2Threaded();
  }
  FoliageRenderer.dirtyVBO2Flag=dirtyVBO2;
}

Fixed version (ground truth):
public static void profileForFoliageShader(){
  World world=Minecraft.getMinecraft().world;
  Entity entityIn=Minecraft.getMinecraft().player;
  BlockPos pos=entityIn.getPosition();
  boolean add=true;
  boolean trim=true;
  int radialRange=40;
  int xzRange=radialRange;
  int yRange=15;
  boolean dirtyVBO2=false;
  FoliageClutter.clutterSize=6;
  if (add) {
    for (int x=-xzRange; x <= xzRange; x++) {
      for (int z=-xzRange; z <= xzRange; z++) {
        for (int y=-yRange; y <= yRange; y++) {
          BlockPos posScan=pos.add(x,y,z);
          if (!ExtendedRenderer.foliageRenderer.lookupPosToFoliage.containsKey(posScan) && !FoliageRenderer.foliageQueueAdd.contains(posScan)) {
            if (validFoliageSpot(entityIn.world,posScan.down())) {
              if (entityIn.getDistanceSq(posScan) <= radialRange * radialRange) {
                FoliageRenderer.foliageQueueAdd.add(posScan);
                dirtyVBO2=true;
              }
            }
          }
 else {
          }
        }
      }
    }
  }
  if (trim) {
    Iterator<Map.Entry<BlockPos,List<Foliage>>> it=ExtendedRenderer.foliageRenderer.lookupPosToFoliage.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<BlockPos,List<Foliage>> entry=it.next();
      if (!validFoliageSpot(world,entry.getKey().down())) {
        FoliageRenderer.foliageQueueRemove.add(entry.getKey());
        dirtyVBO2=true;
      }
 else       if (entityIn.getDistanceSq(entry.getKey()) > radialRange * radialRange) {
        FoliageRenderer.foliageQueueRemove.add(entry.getKey());
        dirtyVBO2=true;
      }
    }
  }
  if (dirtyVBO2) {
    updateVBO2Threaded();
  }
  FoliageRenderer.dirtyVBO2Flag=dirtyVBO2;
}