Program: 85212
Project: 85212
Buggy source:
protected void internalTransform(Body b,String phaseName,Map<String,String> options){
  int weight=soot.jbco.Main.getWeight(phaseName,b.getMethod().getSignature());
  if (weight == 0)   return;
  PatchingChain<Unit> units=b.getUnits();
  int localCount=0;
  Collection<Local> locals=b.getLocals();
  if (output)   out.println("String_Node_Str" + b.getMethod().getSignature());
  Iterator<Unit> it=units.snapshotIterator();
  while (it.hasNext()) {
    Unit u=(Unit)it.next();
    if (u instanceof AssignStmt) {
      AssignStmt as=(AssignStmt)u;
      Value v=as.getRightOp();
      if (v instanceof MulExpr) {
        total++;
        MulExpr me=(MulExpr)v;
        Value op1=me.getOp1();
        Value op=null, op2=me.getOp2();
        NumericConstant nc=null;
        if (op1 instanceof NumericConstant) {
          nc=(NumericConstant)op1;
          op=op2;
        }
 else         if (op2 instanceof NumericConstant) {
          nc=(NumericConstant)op2;
          op=op1;
        }
        if (nc != null) {
          if (output)           out.println("String_Node_Str" + as + "String_Node_Str");
          Type opType=op.getType();
          int max=opType instanceof IntType ? 32 : opType instanceof LongType ? 64 : 0;
          if (max != 0) {
            Object shft_rem[]=checkNumericValue(nc);
            if (shft_rem[0] != null && ((Integer)shft_rem[0]).intValue() < max && Rand.getInt(10) <= weight) {
              List<Unit> unitsBuilt=new ArrayList<Unit>();
              int rand=Rand.getInt(16);
              int shift=((Integer)shft_rem[0]).intValue();
              boolean neg=((Boolean)shft_rem[2]).booleanValue();
              if (rand % 2 == 0) {
                shift+=rand * max;
              }
 else {
                shift-=rand * max;
              }
              Expr e=null;
              if (shft_rem[1] != null) {
                Local tmp2=null, tmp1=Jimple.v().newLocal("String_Node_Str" + localCount++,opType);
                locals.add(tmp1);
                Unit newU=Jimple.v().newAssignStmt(tmp1,Jimple.v().newShlExpr(op,IntConstant.v(shift)));
                unitsBuilt.add(newU);
                units.insertBefore(newU,u);
                double rem=((Double)shft_rem[1]).doubleValue();
                if (rem != 1) {
                  if (rem == ((int)rem) && opType instanceof IntType)                   nc=IntConstant.v((int)rem);
 else                   if (rem == ((long)rem) && opType instanceof LongType)                   nc=LongConstant.v((long)rem);
 else                   nc=DoubleConstant.v(rem);
                  if (nc instanceof DoubleConstant && !(opType instanceof DoubleType)) {
                    tmp2=Jimple.v().newLocal("String_Node_Str" + localCount++,DoubleType.v());
                    locals.add(tmp2);
                    newU=Jimple.v().newAssignStmt(tmp2,Jimple.v().newCastExpr(op,DoubleType.v()));
                    unitsBuilt.add(newU);
                    units.insertBefore(newU,u);
                    newU=Jimple.v().newAssignStmt(tmp2,Jimple.v().newMulExpr(tmp2,nc));
                  }
 else {
                    tmp2=Jimple.v().newLocal("String_Node_Str" + localCount++,nc.getType());
                    locals.add(tmp2);
                    newU=Jimple.v().newAssignStmt(tmp2,Jimple.v().newMulExpr(op,nc));
                  }
                  unitsBuilt.add(newU);
                  units.insertBefore(newU,u);
                }
                if (tmp2 == null) {
                  e=Jimple.v().newAddExpr(tmp1,op);
                }
 else                 if (tmp2.getType().getClass() != tmp1.getType().getClass()) {
                  Local tmp3=Jimple.v().newLocal("String_Node_Str" + localCount++,tmp2.getType());
                  locals.add(tmp3);
                  newU=Jimple.v().newAssignStmt(tmp3,Jimple.v().newCastExpr(tmp1,tmp2.getType()));
                  unitsBuilt.add(newU);
                  units.insertBefore(newU,u);
                  e=Jimple.v().newAddExpr(tmp3,tmp2);
                }
 else {
                  e=Jimple.v().newAddExpr(tmp1,tmp2);
                }
              }
 else {
                e=Jimple.v().newShlExpr(op,IntConstant.v(shift));
              }
              if (e.getType().getClass() != as.getLeftOp().getType().getClass()) {
                Local tmp=Jimple.v().newLocal("String_Node_Str" + localCount++,e.getType());
                locals.add(tmp);
                Unit newU=Jimple.v().newAssignStmt(tmp,e);
                unitsBuilt.add(newU);
                units.insertAfter(newU,u);
                e=Jimple.v().newCastExpr(tmp,as.getLeftOp().getType());
              }
              as.setRightOp(e);
              unitsBuilt.add(as);
              if (neg) {
                Unit newU=Jimple.v().newAssignStmt(as.getLeftOp(),Jimple.v().newNegExpr(as.getLeftOp()));
                unitsBuilt.add(newU);
                units.insertAfter(newU,u);
              }
              mulPerformed++;
              if (output) {
                System.out.println("String_Node_Str");
                Iterator<Unit> ait=unitsBuilt.iterator();
                while (ait.hasNext()) {
                  Unit uu=ait.next();
                  System.out.println("String_Node_Str" + uu + "String_Node_Str"+ (uu instanceof AssignStmt ? ((AssignStmt)uu).getLeftOp().getType().toString() : "String_Node_Str"));
                }
              }
            }
          }
        }
      }
 else       if (v instanceof DivExpr) {
        total++;
        DivExpr de=(DivExpr)v;
        Value op2=de.getOp2();
        NumericConstant nc=null;
        if (op2 instanceof NumericConstant) {
          nc=(NumericConstant)op2;
          if (nc != null) {
            Type opType=de.getOp1().getType();
            int max=opType instanceof IntType ? 32 : opType instanceof LongType ? 64 : 0;
            if (max != 0) {
              Object shft_rem[]=checkNumericValue(nc);
              if (shft_rem[0] != null && ((Integer)shft_rem[0]).intValue() < max && Rand.getInt(10) <= weight) {
                List<Unit> unitsBuilt=new ArrayList<Unit>();
                int rand=Rand.getInt(16);
                int shift=((Integer)shft_rem[0]).intValue();
                boolean neg=((Boolean)shft_rem[2]).booleanValue();
                if (Rand.getInt() % 2 == 0) {
                  shift+=rand * max;
                }
 else {
                  shift-=rand * max;
                }
                Expr e=Jimple.v().newShrExpr(de.getOp1(),IntConstant.v(shift));
                if (e.getType().getClass() != as.getLeftOp().getType().getClass()) {
                  Local tmp=Jimple.v().newLocal("String_Node_Str" + localCount++,e.getType());
                  locals.add(tmp);
                  Unit newU=Jimple.v().newAssignStmt(tmp,e);
                  unitsBuilt.add(newU);
                  units.insertAfter(newU,u);
                  e=Jimple.v().newCastExpr(tmp,as.getLeftOp().getType());
                }
                as.setRightOp(e);
                unitsBuilt.add(as);
                if (neg) {
                  Unit newU=Jimple.v().newAssignStmt(as.getLeftOp(),Jimple.v().newNegExpr(as.getLeftOp()));
                  unitsBuilt.add(newU);
                  units.insertAfter(newU,u);
                }
                divPerformed++;
                if (output) {
                  System.out.println("String_Node_Str");
                  Iterator<Unit> ait=unitsBuilt.iterator();
                  while (ait.hasNext()) {
                    Unit uu=ait.next();
                    System.out.println("String_Node_Str" + uu + "String_Node_Str"+ (uu instanceof AssignStmt ? ((AssignStmt)uu).getLeftOp().getType().toString() : "String_Node_Str"));
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void internalTransform(Body b,String phaseName,Map<String,String> options){
  int weight=soot.jbco.Main.getWeight(phaseName,b.getMethod().getSignature());
  if (weight == 0) {
    return;
  }
  PatchingChain<Unit> units=b.getUnits();
  int localCount=0;
  Chain<Local> locals=b.getLocals();
  if (output) {
    out.println("String_Node_Str" + b.getMethod().getSignature());
  }
  Iterator<Unit> it=units.snapshotIterator();
  while (it.hasNext()) {
    Unit u=it.next();
    if (u instanceof AssignStmt) {
      AssignStmt as=(AssignStmt)u;
      Value v=as.getRightOp();
      if (v instanceof MulExpr) {
        total++;
        MulExpr me=(MulExpr)v;
        Value op1=me.getOp1();
        Value op=null, op2=me.getOp2();
        NumericConstant nc=null;
        if (op1 instanceof NumericConstant) {
          nc=(NumericConstant)op1;
          op=op2;
        }
 else         if (op2 instanceof NumericConstant) {
          nc=(NumericConstant)op2;
          op=op1;
        }
        if (nc != null) {
          if (output) {
            out.println("String_Node_Str" + as + "String_Node_Str");
          }
          Type opType=op.getType();
          int max=opType instanceof IntType ? 32 : opType instanceof LongType ? 64 : 0;
          if (max != 0) {
            Object shft_rem[]=checkNumericValue(nc);
            if (shft_rem[0] != null && (Integer)shft_rem[0] < max && Rand.getInt(10) <= weight) {
              List<Unit> unitsBuilt=new ArrayList<>();
              int rand=Rand.getInt(16);
              int shift=(Integer)shft_rem[0];
              boolean neg=(Boolean)shft_rem[2];
              if (rand % 2 == 0) {
                shift+=rand * max;
              }
 else {
                shift-=rand * max;
              }
              Expr e;
              if (shft_rem[1] != null) {
                Local tmp2=null, tmp1=Jimple.v().newLocal("String_Node_Str" + localCount++,opType);
                locals.add(tmp1);
                Unit newU=Jimple.v().newAssignStmt(tmp1,Jimple.v().newShlExpr(op,IntConstant.v(shift)));
                unitsBuilt.add(newU);
                units.insertBefore(newU,u);
                double rem=(Double)shft_rem[1];
                if (rem != 1) {
                  if (rem == ((int)rem) && opType instanceof IntType) {
                    nc=IntConstant.v((int)rem);
                  }
 else                   if (rem == ((long)rem) && opType instanceof LongType) {
                    nc=LongConstant.v((long)rem);
                  }
 else {
                    nc=DoubleConstant.v(rem);
                  }
                  if (nc instanceof DoubleConstant) {
                    tmp2=Jimple.v().newLocal("String_Node_Str" + localCount++,DoubleType.v());
                    locals.add(tmp2);
                    newU=Jimple.v().newAssignStmt(tmp2,Jimple.v().newCastExpr(op,DoubleType.v()));
                    unitsBuilt.add(newU);
                    units.insertBefore(newU,u);
                    newU=Jimple.v().newAssignStmt(tmp2,Jimple.v().newMulExpr(tmp2,nc));
                  }
 else {
                    tmp2=Jimple.v().newLocal("String_Node_Str" + localCount++,nc.getType());
                    locals.add(tmp2);
                    newU=Jimple.v().newAssignStmt(tmp2,Jimple.v().newMulExpr(op,nc));
                  }
                  unitsBuilt.add(newU);
                  units.insertBefore(newU,u);
                }
                if (tmp2 == null) {
                  e=Jimple.v().newAddExpr(tmp1,op);
                }
 else                 if (tmp2.getType().getClass() != tmp1.getType().getClass()) {
                  Local tmp3=Jimple.v().newLocal("String_Node_Str" + localCount++,tmp2.getType());
                  locals.add(tmp3);
                  newU=Jimple.v().newAssignStmt(tmp3,Jimple.v().newCastExpr(tmp1,tmp2.getType()));
                  unitsBuilt.add(newU);
                  units.insertBefore(newU,u);
                  e=Jimple.v().newAddExpr(tmp3,tmp2);
                }
 else {
                  e=Jimple.v().newAddExpr(tmp1,tmp2);
                }
              }
 else {
                e=Jimple.v().newShlExpr(op,IntConstant.v(shift));
              }
              if (e.getType().getClass() != as.getLeftOp().getType().getClass()) {
                Local tmp=Jimple.v().newLocal("String_Node_Str" + localCount++,e.getType());
                locals.add(tmp);
                Unit newU=Jimple.v().newAssignStmt(tmp,e);
                unitsBuilt.add(newU);
                units.insertAfter(newU,u);
                e=Jimple.v().newCastExpr(tmp,as.getLeftOp().getType());
              }
              as.setRightOp(e);
              unitsBuilt.add(as);
              if (neg) {
                Unit newU=Jimple.v().newAssignStmt(as.getLeftOp(),Jimple.v().newNegExpr(as.getLeftOp()));
                unitsBuilt.add(newU);
                units.insertAfter(newU,u);
              }
              mulPerformed++;
              printOutput(unitsBuilt);
            }
          }
        }
      }
 else       if (v instanceof DivExpr) {
        total++;
        DivExpr de=(DivExpr)v;
        Value op2=de.getOp2();
        NumericConstant nc;
        if (op2 instanceof NumericConstant) {
          nc=(NumericConstant)op2;
          Type opType=de.getOp1().getType();
          int max=opType instanceof IntType ? 32 : opType instanceof LongType ? 64 : 0;
          if (max != 0) {
            Object shft_rem[]=checkNumericValue(nc);
            if (shft_rem[0] != null && (shft_rem[1] == null || (Double)shft_rem[1] == 0) && (Integer)shft_rem[0] < max && Rand.getInt(10) <= weight) {
              List<Unit> unitsBuilt=new ArrayList<>();
              int rand=Rand.getInt(16);
              int shift=(Integer)shft_rem[0];
              boolean neg=(Boolean)shft_rem[2];
              if (Rand.getInt() % 2 == 0) {
                shift+=rand * max;
              }
 else {
                shift-=rand * max;
              }
              Expr e=Jimple.v().newShrExpr(de.getOp1(),IntConstant.v(shift));
              if (e.getType().getClass() != as.getLeftOp().getType().getClass()) {
                Local tmp=Jimple.v().newLocal("String_Node_Str" + localCount++,e.getType());
                locals.add(tmp);
                Unit newU=Jimple.v().newAssignStmt(tmp,e);
                unitsBuilt.add(newU);
                units.insertAfter(newU,u);
                e=Jimple.v().newCastExpr(tmp,as.getLeftOp().getType());
              }
              as.setRightOp(e);
              unitsBuilt.add(as);
              if (neg) {
                Unit newU=Jimple.v().newAssignStmt(as.getLeftOp(),Jimple.v().newNegExpr(as.getLeftOp()));
                unitsBuilt.add(newU);
                units.insertAfter(newU,u);
              }
              divPerformed++;
              printOutput(unitsBuilt);
            }
          }
        }
      }
    }
  }
}