Program: 85265
Project: 85265
Buggy source:
private void buildCalculatingBinaryInsn(final String binaryOperation,Value firstOperand,Value secondOperand,Expr originalExpr){
  constantV.setOrigStmt(origStmt);
  Register firstOpReg=regAlloc.asImmediate(firstOperand,constantV);
  if (destinationReg.getType() instanceof IntType && secondOperand instanceof IntConstant && !binaryOperation.equals("String_Node_Str")) {
    int secondOpConstant=((IntConstant)secondOperand).value;
    if (SootToDexUtils.fitsSigned8(secondOpConstant)) {
      stmtV.addInsn(buildLit8BinaryInsn(binaryOperation,firstOpReg,(byte)secondOpConstant),origStmt);
      return;
    }
    if (SootToDexUtils.fitsSigned16(secondOpConstant)) {
      if (!binaryOperation.equals("String_Node_Str") && !binaryOperation.equals("String_Node_Str") && !binaryOperation.equals("String_Node_Str")) {
        stmtV.addInsn(buildLit16BinaryInsn(binaryOperation,firstOpReg,(short)secondOpConstant),origStmt);
        return;
      }
    }
  }
  if (!(secondOperand.getType() instanceof PrimType))   throw new RuntimeException("String_Node_Str");
  Register secondOpReg=regAlloc.asImmediate(secondOperand,constantV);
  Register orgDestReg=destinationReg;
  if (isBiggerThan(PrimitiveType.getByName(secondOpReg.getType().toString()),PrimitiveType.getByName(destinationReg.getType().toString()))) {
    destinationReg=regAlloc.asTmpReg(secondOpReg.getType());
  }
  if (destinationReg.getNumber() == firstOpReg.getNumber()) {
    stmtV.addInsn(build2AddrBinaryInsn(binaryOperation,secondOpReg),origStmt);
  }
 else {
    stmtV.addInsn(buildNormalBinaryInsn(binaryOperation,firstOpReg,secondOpReg),origStmt);
  }
  if (orgDestReg != destinationReg) {
    Register tempReg=destinationReg.clone();
    destinationReg=orgDestReg.clone();
    castPrimitive(tempReg,originalExpr,destinationReg.getType());
  }
}

Fixed version (ground truth):
private void buildCalculatingBinaryInsn(final String binaryOperation,Value firstOperand,Value secondOperand,Expr originalExpr){
  constantV.setOrigStmt(origStmt);
  Register firstOpReg=regAlloc.asImmediate(firstOperand,constantV);
  if (destinationReg.getType() instanceof IntType && secondOperand instanceof IntConstant && !binaryOperation.equals("String_Node_Str")) {
    int secondOpConstant=((IntConstant)secondOperand).value;
    if (SootToDexUtils.fitsSigned8(secondOpConstant)) {
      stmtV.addInsn(buildLit8BinaryInsn(binaryOperation,firstOpReg,(byte)secondOpConstant),origStmt);
      return;
    }
    if (SootToDexUtils.fitsSigned16(secondOpConstant)) {
      if (!binaryOperation.equals("String_Node_Str") && !binaryOperation.equals("String_Node_Str") && !binaryOperation.equals("String_Node_Str")) {
        stmtV.addInsn(buildLit16BinaryInsn(binaryOperation,firstOpReg,(short)secondOpConstant),origStmt);
        return;
      }
    }
  }
  if (!(secondOperand.getType() instanceof PrimType))   throw new RuntimeException("String_Node_Str");
  Register secondOpReg=regAlloc.asImmediate(secondOperand,constantV);
  Register orgDestReg=destinationReg;
  PrimitiveType destRegType=PrimitiveType.getByName(destinationReg.getType().toString());
  if (isBiggerThan(PrimitiveType.getByName(secondOpReg.getType().toString()),destRegType)) {
    destinationReg=regAlloc.asTmpReg(secondOpReg.getType());
  }
 else   if (isBiggerThan(PrimitiveType.getByName(firstOpReg.getType().toString()),destRegType)) {
    destinationReg=regAlloc.asTmpReg(firstOpReg.getType());
  }
  if (destinationReg.getNumber() == firstOpReg.getNumber()) {
    stmtV.addInsn(build2AddrBinaryInsn(binaryOperation,secondOpReg),origStmt);
  }
 else {
    stmtV.addInsn(buildNormalBinaryInsn(binaryOperation,firstOpReg,secondOpReg),origStmt);
  }
  if (orgDestReg != destinationReg) {
    Register tempReg=destinationReg.clone();
    destinationReg=orgDestReg.clone();
    castPrimitive(tempReg,originalExpr,destinationReg.getType());
  }
}