void abort() { }; extern int __VERIFIER_nondet_int(); /*@ requires (1); ensures ((cond != 0)); @*/ void assume_abort_if_not(int cond) { if(!cond) {abort();} } /*@ requires ((1 <= cond)) && (cond != 0); ensures ((1 <= cond)) && (1); @*/ void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: {/*@ assert(0); */;} } return; } int main() { int a, b; long long x, y, z; a = __VERIFIER_nondet_int(); assume_abort_if_not(a>=0 && a<=1); b = __VERIFIER_nondet_int(); assume_abort_if_not(b>=0 && b<=1); assume_abort_if_not(b >= 1); x = a; y = b; z = 0; /*@ loop invariant ((((((z == 0) && (b == 1)) && (y == 1)) && (a == x)) || (((b == 1) && (a == z)) && (y == 0)))); @*/ while (1) { __VERIFIER_assert(z + x * y == (long long) a * b); if (!(y != 0)) break; if (y % 2 == 1) { z = z + x; y = y - 1; } x = 2 * x; y = y / 2; } __VERIFIER_assert(z == (long long) a * b); return 0; }