void abort() { }; 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); */;abort();} } return; } int __VERIFIER_nondet_int(); int main(int argc, char* argv[]) { int c1 = 4000; int c2 = 2000; int c3 = 10000; int n, v; int i, k, j; n = __VERIFIER_nondet_int(); if (!(0 <= n && n < 10)) return 0; k = 0; i = 0; /*@ loop invariant (((((((10000 <= c3) && (k == 0)) && (4000 <= c1)) && (i == 0)) && (2000 <= c2)) || ((((((10000 <= c3) && (2000 <= k)) && (4000 <= c1)) && (n <= 1)) && (2000 <= c2)) && (1 <= i)))); @*/ while( i < n ) { i++; v = __VERIFIER_nondet_int(); if (!(0 <= v && n < 2)) return 0; if( v == 0 ) k += c1; else if( v == 1 ) k += c2; else k += c3; } j = 0; /*@ loop invariant (((((j == 0) && (n <= 0)) || ((((((10000 <= c3) && (0 <= j)) && (2000 <= k)) && (4000 <= c1)) && (n <= 1)) && (2000 <= c2))) || ((((((10000 <= c3) && (1 <= k)) && (1 <= j)) && (4000 <= c1)) && (n <= 1)) && (2000 <= c2)))); @*/ while( j < n ) { __VERIFIER_assert(k > 0); j++; k--; } return 0; }