public static Expression applyWraparound(
     final ILocation loc,
     final TypeSizes typeSizes,
     final CPrimitive cPrimitive,
     final Expression operand) {
   if (cPrimitive.getGeneralType() == CPrimitiveCategory.INTTYPE) {
     if (typeSizes.isUnsigned(cPrimitive)) {
       final BigInteger maxValuePlusOne =
           typeSizes.getMaxValueOfPrimitiveType(cPrimitive).add(BigInteger.ONE);
       return ExpressionFactory.newBinaryExpression(
           loc,
           BinaryExpression.Operator.ARITHMOD,
           operand,
           new IntegerLiteral(loc, maxValuePlusOne.toString()));
     } else {
       throw new AssertionError("wraparound only for unsigned types");
     }
   } else {
     throw new AssertionError("wraparound only for integer types");
   }
 }
  /** Returns "assume (minValue <= lrValue && lrValue <= maxValue)" */
  private AssumeStatement constructAssumeInRangeStatement(
      final TypeSizes typeSizes,
      final ILocation loc,
      final Expression expr,
      final CPrimitive type) {
    final Expression minValue =
        constructLiteralForIntegerType(loc, type, typeSizes.getMinValueOfPrimitiveType(type));
    final Expression maxValue =
        constructLiteralForIntegerType(loc, type, typeSizes.getMaxValueOfPrimitiveType(type));

    final Expression biggerMinInt =
        constructBinaryComparisonExpression(
            loc, IASTBinaryExpression.op_lessEqual, minValue, type, expr, type);
    final Expression smallerMaxValue =
        constructBinaryComparisonExpression(
            loc, IASTBinaryExpression.op_lessEqual, expr, type, maxValue, type);
    final AssumeStatement inRange =
        new AssumeStatement(
            loc,
            ExpressionFactory.newBinaryExpression(
                loc, BinaryExpression.Operator.LOGICAND, biggerMinInt, smallerMaxValue));
    return inRange;
  }