class CastAndReturnInliner extends BodyTransformer {

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


    final UnitPatchingChain units = body.getUnits();
    for (Iterator<Unit> it = units.snapshotIterator(); it.hasNext();) {
      Unit u = it.next();
      if (u instanceof GotoStmt) {
        GotoStmt gtStmt = (GotoStmt) u;
        if (gtStmt.getTarget() instanceof AssignStmt) {
          AssignStmt assign = (AssignStmt) gtStmt.getTarget();
          if (assign.getRightOp() instanceof CastExpr) {
            CastExpr ce = (CastExpr) assign.getRightOp();

            // We have goto that ends up at a cast statement
            Unit nextStmt = units.getSuccOf(assign);
            if (nextStmt instanceof ReturnStmt) {
              ReturnStmt retStmt = (ReturnStmt) nextStmt;
              if (retStmt.getOp() == assign.getLeftOp()) {
                // We need to replace the GOTO with the return
                ReturnStmt newStmt = (ReturnStmt) retStmt.clone();
                Local a = (Local) ce.getOp();

                for (Trap t : body.getTraps()) {
                  for (UnitBox ubox : t.getUnitBoxes()) {
                    if (ubox.getUnit() == gtStmt) {
                      ubox.setUnit(newStmt);
                    }
                  }
                }
                Jimple j = Jimple.v();
                Local n = j.newLocal(a.getName() + "_ret", ce.getCastType());
                body.getLocals().add(n);
                newStmt.setOp(n);

                final List<UnitBox> boxesRefGtStmt = gtStmt.getBoxesPointingToThis();
                while (!boxesRefGtStmt.isEmpty()) {
                  boxesRefGtStmt.get(0).setUnit(newStmt);
                }
                units.swapWith(gtStmt, newStmt);
                ce = (CastExpr) ce.clone();
                units.insertBefore(j.newAssignStmt(n, ce), newStmt);
              }
            }
          }
        }
      }
    }
  
<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