class CastInstruction extends TaggedInstruction {

  public CastInstruction(Instruction instruction, int codeAddress) {
    super(instruction, codeAddress);
  }

  @Override
  public void jimplify(DexBody body) {<FILL_FUNCTION_BODY>}

  /**
   * Return the appropriate target type for the covered opcodes.
   *
   * Note: the tag represents the original type before the cast. The cast type is not lost in Jimple and can be retrieved by
   * calling the getCastType() method.
   */
  private Type getTargetType() {
    Opcode opcode = instruction.getOpcode();
    switch (opcode) {
      case INT_TO_BYTE:
        setTag(new IntOpTag());
        return ByteType.v();
      case INT_TO_CHAR:
        setTag(new IntOpTag());
        return CharType.v();
      case INT_TO_SHORT:
        setTag(new IntOpTag());
        return ShortType.v();

      case LONG_TO_INT:
        setTag(new LongOpTag());
        return IntType.v();
      case DOUBLE_TO_INT:
        setTag(new DoubleOpTag());
        return IntType.v();
      case FLOAT_TO_INT:
        setTag(new FloatOpTag());
        return IntType.v();

      case INT_TO_LONG:
        setTag(new IntOpTag());
        return LongType.v();
      case DOUBLE_TO_LONG:
        setTag(new DoubleOpTag());
        return LongType.v();
      case FLOAT_TO_LONG:
        setTag(new FloatOpTag());
        return LongType.v();

      case LONG_TO_FLOAT:
        setTag(new LongOpTag());
        return FloatType.v();
      case DOUBLE_TO_FLOAT:
        setTag(new DoubleOpTag());
        return FloatType.v();
      case INT_TO_FLOAT:
        setTag(new IntOpTag());
        return FloatType.v();

      case INT_TO_DOUBLE:
        setTag(new IntOpTag());
        return DoubleType.v();
      case FLOAT_TO_DOUBLE:
        setTag(new FloatOpTag());
        return DoubleType.v();
      case LONG_TO_DOUBLE:
        setTag(new LongOpTag());
        return DoubleType.v();

      default:
        throw new RuntimeException("Invalid Opcode: " + opcode);
    }
  }

  @Override
  boolean overridesRegister(int register) {
    TwoRegisterInstruction i = (TwoRegisterInstruction) instruction;
    int dest = i.getRegisterA();
    return register == dest;
  }

}

    TwoRegisterInstruction i = (TwoRegisterInstruction) instruction;
    int dest = i.getRegisterA();
    int source = i.getRegisterB();
    Type targetType = getTargetType();
    CastExpr cast = Jimple.v().newCastExpr(body.getRegisterLocal(source), targetType);
    AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cast);
    assign.addTag(getTag());
    setUnit(assign);
    addTags(assign);
    body.add(assign);

    if (IDalvikTyper.ENABLE_DVKTYPER) {
      DalvikTyper.v().setType(assign.getLeftOpBox(), cast.getType(), false);
      // DalvikTyper.v().captureAssign((JAssignStmt)assign, op);
    }
  
<methods>public void <init>(org.jf.dexlib2.iface.instruction.Instruction, int) ,public soot.tagkit.Tag getTag() ,public void setTag(soot.tagkit.Tag) <variables>private soot.tagkit.Tag instructionTag