// verifast_options{disable_overflow_check target:ILP32} /* shift_add algorithm for computing the product of two natural numbers */ extern void abort(void); //@ requires true; //@ ensures true; void reach_error() //@ requires false; //@ ensures true; {}extern int __VERIFIER_nondet_int(void); //@ requires true; //@ ensures true; void assume_abort_if_not(int cond) //@ requires true; //@ ensures (cond != 0); { if(!cond) {abort();} } void __VERIFIER_assert(int cond) //@ requires (1 <= cond); //@ ensures (1 <= cond); { if (!(cond)) { ERROR: {reach_error();} } return; } int main() //@ requires module(prodbin_ll_valuebound5__verifast_instrumented, true); //@ ensures junk(); { //@ open_module(); int a, b; long long x, y, z; a = __VERIFIER_nondet_int(); assume_abort_if_not(a>=0 && a<=5); b = __VERIFIER_nondet_int(); assume_abort_if_not(b>=0 && b<=5); assume_abort_if_not(b >= 1); x = a; y = b; z = 0; while (1) //@ invariant ((((((((((((z + (y * x)) == (b * a)) && (b <= 5)) && ((a * 2) == x)) && (0 <= a)) && (1 <= b)) && (a <= 5)) && ((( - 1 + b) / 2) == y)) || ((((((z == (b * a)) && (b <= 5)) && (0 <= a)) && (1 <= b)) && (y == 0)) && (a <= 5))) || (((((((z == 0) && (b == y)) && (0 <= a)) && (1 <= y)) && (a <= 5)) && (a == x)) && (y <= 5))) || ((((((y == 1) && (b <= 5)) && ((z + x) == (b * a))) && (0 <= a)) && (1 <= b)) && (a <= 5))) || ((((((((z == 0) && (y == (b / 2))) && (b <= 5)) && ((a * 2) == x)) && (0 <= a)) && ((b % 2) != 1)) && (1 <= y)) && (a <= 5))); { __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; }