class RemoveRedundantPushStores extends BodyTransformer implements IJbcoTransform {

  public static String dependancies[] = new String[] { "bb.jbco_rrps" };

  public String[] getDependencies() {
    return dependancies;
  }

  public static String name = "bb.jbco_rrps";

  public String getName() {
    return name;
  }

  public void outputSummary() {
  }

  protected void internalTransform(Body b, String phaseName, Map<String, String> options) {<FILL_FUNCTION_BODY>}

  private void fixJumps(Unit from, Unit to, Chain<Trap> t) {
    from.redirectJumpsToThisTo(to);
    for (Trap trap : t) {
      if (trap.getBeginUnit() == from) {
        trap.setBeginUnit(to);
      }
      if (trap.getEndUnit() == from) {
        trap.setEndUnit(to);
      }
      if (trap.getHandlerUnit() == from) {
        trap.setHandlerUnit(to);
      }
    }
  }
}

    // removes all redundant load-stores
    boolean changed = true;
    PatchingChain<Unit> units = b.getUnits();
    while (changed) {
      changed = false;
      Unit prevprevprev = null, prevprev = null, prev = null;
      ExceptionalUnitGraph eug = ExceptionalUnitGraphFactory.createExceptionalUnitGraph(b);
      Iterator<Unit> it = units.snapshotIterator();
      while (it.hasNext()) {
        Unit u = it.next();
        if (prev != null && prev instanceof PushInst && u instanceof StoreInst) {
          if (prevprev != null && prevprev instanceof StoreInst && prevprevprev != null
              && prevprevprev instanceof PushInst) {
            Local lprev = ((StoreInst) prevprev).getLocal();
            Local l = ((StoreInst) u).getLocal();
            if (l == lprev && eug.getSuccsOf(prevprevprev).size() == 1 && eug.getSuccsOf(prevprev).size() == 1) {
              fixJumps(prevprevprev, prev, b.getTraps());
              fixJumps(prevprev, u, b.getTraps());
              units.remove(prevprevprev);
              units.remove(prevprev);
              changed = true;
              break;
            }
          }
        }
        prevprevprev = prevprev;
        prevprev = prev;
        prev = u;
      }
    } // end while changes have been made
  
<methods>public non-sealed void <init>() ,public final void transform(soot.Body, java.lang.String, Map<java.lang.String,java.lang.String>) ,public final void transform(soot.Body, java.lang.String) ,public final void transform(soot.Body) <variables>private static final Map<java.lang.String,java.lang.String> enabledOnlyMap