Wonda
Collection
Models and datasets for loop invariant generation task • 23 items • Updated
id int64 1 219 | file stringlengths 8 30 | original_program stringlengths 387 8.63k | program_for_baseline stringlengths 260 6.89k | baseline_decision stringclasses 3 values | timings listlengths 3 3 | median_timing float64 3.77 601 | program_for_llm stringlengths 151 6.79k | split stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
1 | geo1-ll_unwindbound1_2.c | /*
Geometric Series
computes x=(z-1)* sum(z^k)[k=0..k-1] , y = z^k
returns 1+x-y == 0
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "geo1-ll.c", 9, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int z, k;
unsigned long long x, y, c;
z = __VERIFIER_nondet_int();
k = __VERIFIER_nondet_int();
assume_abort_if_not(z >= 1);
assume_abort_if_not(k >= 1);
x = 1;
y = z;
c = 1;
while (counter++ < 1) {
if (!(c < k)) {
break;
}
c = c + 1;
x = x * z + 1;
y = y * z;
} // geo1
x = x * (z - 1);
__VERIFIER_assert(1 + x - y == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int z;
int k;
unsigned long long x;
unsigned long long y;
unsigned long long c;
z = __VERIFIER_nondet_int();
k = __VERIFIER_nondet_int();
assume(z >= 1);
assume(k >= 1);
x = 1;
y = z;
c = 1;
while ((counter++) < 1)
{
;
if (!(c < k))
{
break;
}
c = c + 1;
x = (x * z) + 1;
y = y * z;
}
x = x * (z - 1);
assert(((1 + x) - y) == 0);
return 0;
} | TRUE | [
86.4,
49.95,
50.86
] | 50.86 | int counter = 0;
int main()
{
int z;
int k;
unsigned long long x;
unsigned long long y;
unsigned long long c;
z = (int) rand();
k = (int) rand();
assume(z >= 1);
assume(k >= 1);
x = 1;
y = z;
c = 1;
while ((counter++) < 1)
{
INVARIANT_MARKER_1();
if (!(c < k))
{
break;
}
c = c + 1;
x = (x * z) + 1;
y = y * z;
}
x = x * (z - 1);
assert(((1 + x) - y) == 0);
return 0;
} | hard |
2 | prodbin-ll_unwindbound1_2.c | /* shift_add algorithm for computing the
product of two natural numbers
This task is incorrect, here is an explanation why:
- The first assertion z + x * y == (long long) a * b is a loop invariant, so it can never be violated.
*/
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "prodbin-ll.c", 14, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int a, b;
long long x, y, z;
a = __VERIFIER_nondet_int();
b = __VERIFIER_nondet_int();
assume_abort_if_not(b >= 1);
x = a;
y = b;
z = 0;
while (counter++ < 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;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int a;
int b;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_int();
b = __VERIFIER_nondet_int();
assume(b >= 1);
x = a;
y = b;
z = 0;
while ((counter++) < 1)
{
;
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;
}
return 0;
} | TRUE | [
4.48,
4.38,
4.5
] | 4.48 | int counter = 0;
int main()
{
int a;
int b;
long long x;
long long y;
long long z;
a = (int) rand();
b = (int) rand();
assume(b >= 1);
x = a;
y = b;
z = 0;
while ((counter++) < 1)
{
INVARIANT_MARKER_1();
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;
}
return 0;
} | easy |
3 | egcd2-ll_valuebound50_2.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd2-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int x, y;
long long a, b, p, q, r, s, c, k, xy, yy;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 50);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 50);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
c = 0;
k = 0;
xy = (long long)x * y;
yy = (long long)y * y;
assume_abort_if_not(xy < 2147483647);
assume_abort_if_not(yy < 2147483647);
while (1) {
if (!(b != 0)) {
break;
}
c = a;
k = 0;
while (1) {
__VERIFIER_assert(a == y * r + x * p);
if (!(c >= b)) {
break;
}
c = c - b;
k = k + 1;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
return a;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
long long c;
long long k;
long long xy;
long long yy;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 50));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 50));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
c = 0;
k = 0;
xy = ((long long) x) * y;
yy = ((long long) y) * y;
assume(xy < 2147483647);
assume(yy < 2147483647);
while (1)
{
;
if (!(b != 0))
{
break;
}
c = a;
k = 0;
while (1)
{
;
assert(a == ((y * r) + (x * p)));
if (!(c >= b))
{
break;
}
c = c - b;
k = k + 1;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return a;
} | TRUE | [
297.3,
294.78,
297.85
] | 297.3 | int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
long long c;
long long k;
long long xy;
long long yy;
x = (int) rand();
assume((x >= 0) && (x <= 50));
y = (int) rand();
assume((y >= 0) && (y <= 50));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
c = 0;
k = 0;
xy = ((long long) x) * y;
yy = ((long long) y) * y;
assume(xy < 2147483647);
assume(yy < 2147483647);
while (1)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
c = a;
k = 0;
while (1)
{
INVARIANT_MARKER_2();
assert(a == ((y * r) + (x * p)));
if (!(c >= b))
{
break;
}
c = c - b;
k = k + 1;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return a;
} | hard |
4 | condmf_1.c | /*
* Benchmarks contributed by Divyesh Unadkat[1,2], Supratik Chakraborty[1], Ashutosh Gupta[1]
* [1] Indian Institute of Technology Bombay, Mumbai
* [2] TCS Innovation labs, Pune
*
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "condmf.c", 10, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
}
extern int __VERIFIER_nondet_int(void);
void *malloc(unsigned int size);
int N;
int main() {
N = __VERIFIER_nondet_int();
if (N <= 0) {
return 1;
}
assume_abort_if_not(N <= 2147483647 / sizeof(int));
int i;
int *a = malloc(sizeof(int) * N);
for (i = 0; i < N; i++) {
a[i] = 0;
}
for (i = 0; i < N; i++) {
if (N % 2 == 1) {
a[i] = a[i] + 2;
} else {
a[i] = a[i] + 1;
}
}
for (i = 0; i < N; i++) {
__VERIFIER_assert(a[i] % 2 == N % 2);
}
return 1;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
void *malloc(unsigned int size);
int N;
int main()
{
N = __VERIFIER_nondet_int();
if (N <= 0)
{
return 1;
}
assume(N <= (2147483647 / (sizeof(int))));
int i;
int *a = malloc((sizeof(int)) * N);
for (i = 0; i < N; i++)
{
;
a[i] = 0;
}
for (i = 0; i < N; i++)
{
;
if ((N % 2) == 1)
{
a[i] = a[i] + 2;
}
else
{
a[i] = a[i] + 1;
}
}
for (i = 0; i < N; i++)
{
;
assert((a[i] % 2) == (N % 2));
}
return 1;
} | FALSE | [
4.1,
4.02,
4.28
] | 4.1 | void *malloc(unsigned int size);
int N;
int main()
{
N = (int) rand();
if (N <= 0)
{
return 1;
}
assume(N <= (2147483647 / (sizeof(int))));
int i;
int *a = malloc((sizeof(int)) * N);
for (i = 0; i < N; i++)
{
INVARIANT_MARKER_1();
a[i] = 0;
}
for (i = 0; i < N; i++)
{
INVARIANT_MARKER_2();
if ((N % 2) == 1)
{
a[i] = a[i] + 2;
}
else
{
a[i] = a[i] + 1;
}
}
for (i = 0; i < N; i++)
{
INVARIANT_MARKER_3();
assert((a[i] % 2) == (N % 2));
}
return 1;
} | easy |
5 | cohencu-ll_valuebound100_9.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 100);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(2 * y * y - 3 * x * z - 18 * x - 10 * y + 3 * z - 10 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 100));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((((2 * y) * y) - ((3 * x) * z)) - (18 * x)) - (10 * y)) + (3 * z)) - 10) == 0);
return 0;
} | TRUE | [
31.02,
31.1,
31.48
] | 31.1 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 100));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((((2 * y) * y) - ((3 * x) * z)) - (18 * x)) - (10 * y)) + (3 * z)) - 10) == 0);
return 0;
} | hard |
6 | cohencu-ll_valuebound1_2.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 1);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
__VERIFIER_assert(y == 3 * n * n + 3 * n + 1);
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 1));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
assert(y == ((((3 * n) * n) + (3 * n)) + 1));
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | TRUE | [
4.62,
4.9,
4.44
] | 4.62 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 1));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
assert(y == ((((3 * n) * n) + (3 * n)) + 1));
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | easy |
7 | hard2_4.c | /*
hardware integer division program, by Manna
returns q==A//B
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "hard2.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int A, B;
int r, d, p, q;
A = __VERIFIER_nondet_int();
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1) {
if (!(r >= d)) {
break;
}
d = 2 * d;
p = 2 * p;
}
while (1) {
__VERIFIER_assert(A == q * B + r);
if (!(p != 1)) {
break;
}
d = d / 2;
p = p / 2;
if (r >= d) {
r = r - d;
q = q + p;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int A;
int B;
int r;
int d;
int p;
int q;
A = __VERIFIER_nondet_int();
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
;
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
;
assert(A == ((q * B) + r));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | TIMEOUT | [
601.11,
601.11,
601.11
] | 601.11 | int main()
{
int A;
int B;
int r;
int d;
int p;
int q;
A = (int) rand();
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
INVARIANT_MARKER_2();
assert(A == ((q * B) + r));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | hard |
8 | freire2_unwindbound10_3.c | /* Algorithm for finding the closet integer to cubic root
* more details, see : http://www.pedrofreire.com/sqrt/sqrt1.en.html
Note: for some reason using cpa was able to disprove these
cpa.sh -kInduction -setprop solver.solver=z3 freire2.c
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "freire2.c", 10, "reach_error"); }
extern double __VERIFIER_nondet_double(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int r;
double a, x, s;
a = __VERIFIER_nondet_double();
x = a;
s = 3.25;
r = 1;
while (counter++ < 10) {
__VERIFIER_assert((int)(8 * r * s - 24 * a + 16 * r - 12 * s + 24 * x - 3 == 0));
if (!(x - s > 0.0)) {
break;
}
x = x - s;
s = s + 6 * r + 3;
r = r + 1;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int r;
double a;
double x;
double s;
a = __VERIFIER_nondet_double();
x = a;
s = 3.25;
r = 1;
while ((counter++) < 10)
{
;
assert((int) ((((((((8 * r) * s) - (24 * a)) + (16 * r)) - (12 * s)) + (24 * x)) - 3) == 0));
if (!((x - s) > 0.0))
{
break;
}
x = x - s;
s = (s + (6 * r)) + 3;
r = r + 1;
}
return 0;
} | FALSE | [
32.66,
29.93,
30.73
] | 30.73 | int counter = 0;
int main()
{
int r;
double a;
double x;
double s;
a = (double) rand();
x = a;
s = 3.25;
r = 1;
while ((counter++) < 10)
{
INVARIANT_MARKER_1();
assert((int) ((((((((8 * r) * s) - (24 * a)) + (16 * r)) - (12 * s)) + (24 * x)) - 3) == 0));
if (!((x - s) > 0.0))
{
break;
}
x = x - s;
s = (s + (6 * r)) + 3;
r = r + 1;
}
return 0;
} | hard |
9 | fermat2-ll_unwindbound20_1.c | /* program computing a divisor for factorisation, by Bressoud */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "fermat2-ll.c", 5, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int A, R;
long long u, v, r;
A = __VERIFIER_nondet_int();
R = __VERIFIER_nondet_int();
// assume_abort_if_not(A >= 1);
assume_abort_if_not(((long long)R - 1) * ((long long)R - 1) < A);
// assume_abort_if_not(A <= R * R);
assume_abort_if_not(A % 2 == 1);
u = ((long long)2 * R) + 1;
v = 1;
r = ((long long)R * R) - A;
while (counter++ < 20) {
__VERIFIER_assert(4 * (A + r) == u * u - v * v - 2 * u + 2 * v);
if (!(r != 0)) {
break;
}
if (r > 0) {
r = r - v;
v = v + 2;
} else {
r = r + u;
u = u + 2;
}
}
// return (u - v) / 2;
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int A;
int R;
long long u;
long long v;
long long r;
A = __VERIFIER_nondet_int();
R = __VERIFIER_nondet_int();
assume(((((long long) R) - 1) * (((long long) R) - 1)) < A);
assume((A % 2) == 1);
u = (((long long) 2) * R) + 1;
v = 1;
r = (((long long) R) * R) - A;
while ((counter++) < 20)
{
;
assert((4 * (A + r)) == ((((u * u) - (v * v)) - (2 * u)) + (2 * v)));
if (!(r != 0))
{
break;
}
if (r > 0)
{
r = r - v;
v = v + 2;
}
else
{
r = r + u;
u = u + 2;
}
}
return 0;
} | TRUE | [
7.23,
7.15,
7.03
] | 7.15 | int counter = 0;
int main()
{
int A;
int R;
long long u;
long long v;
long long r;
A = (int) rand();
R = (int) rand();
assume(((((long long) R) - 1) * (((long long) R) - 1)) < A);
assume((A % 2) == 1);
u = (((long long) 2) * R) + 1;
v = 1;
r = (((long long) R) * R) - A;
while ((counter++) < 20)
{
INVARIANT_MARKER_1();
assert((4 * (A + r)) == ((((u * u) - (v * v)) - (2 * u)) + (2 * v)));
if (!(r != 0))
{
break;
}
if (r > 0)
{
r = r - v;
v = v + 2;
}
else
{
r = r + u;
u = u + 2;
}
}
return 0;
} | easy |
10 | egcd-ll_valuebound20_6.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 20);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 20);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1) {
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
__VERIFIER_assert(q * r - p * s + 1 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 20));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 20));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
;
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((q * r) - (p * s)) + 1) == 0);
return 0;
} | TRUE | [
5.54,
5.28,
5.63
] | 5.54 | int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
assume((x >= 0) && (x <= 20));
y = (int) rand();
assume((y >= 0) && (y <= 20));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((q * r) - (p * s)) + 1) == 0);
return 0;
} | easy |
11 | cohencu-ll_valuebound20_11.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 20);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(y * z - 18 * x - 12 * y + 2 * z - 6 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 20));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((y * z) - (18 * x)) - (12 * y)) + (2 * z)) - 6) == 0);
return 0;
} | TRUE | [
4.62,
4.2,
4.45
] | 4.45 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 20));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((y * z) - (18 * x)) - (12 * y)) + (2 * z)) - 6) == 0);
return 0;
} | easy |
12 | ps5-ll_3.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps5-ll.c", 3, "reach_error"); }
extern short __VERIFIER_nondet_short(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short k;
long long y, x, c;
k = __VERIFIER_nondet_short();
assume_abort_if_not(k <= 256);
y = 0;
x = 0;
c = 0;
while (1) {
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y * y * y * y + x;
}
__VERIFIER_assert(k * y == y * y);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_short();
assume(k <= 256);
y = 0;
x = 0;
c = 0;
while (1)
{
;
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = (((y * y) * y) * y) + x;
}
assert((k * y) == (y * y));
return 0;
} | TRUE | [
4.79,
5.23,
4.89
] | 4.89 | int main()
{
short k;
long long y;
long long x;
long long c;
k = (short) rand();
assume(k <= 256);
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = (((y * y) * y) * y) + x;
}
assert((k * y) == (y * y));
return 0;
} | easy |
13 | egcd3-ll_unwindbound50_4.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd3-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long a, b, p, q, r, s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 50) {
if (!(b != 0)) {
break;
}
long long c, k;
c = a;
k = 0;
while (counter++ < 50) {
if (!(c >= b)) {
break;
}
long long d, v;
d = 1;
v = b;
while (counter++ < 50) {
__VERIFIER_assert(v == b * d);
if (!(c >= 2 * v)) {
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 50)
{
;
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 50)
{
;
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 50)
{
;
assert(v == (b * d));
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return 0;
} | TRUE | [
4.62,
5.12,
5.13
] | 5.12 | int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 50)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 50)
{
INVARIANT_MARKER_2();
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 50)
{
INVARIANT_MARKER_3();
assert(v == (b * d));
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return 0;
} | easy |
14 | hard2_valuebound1_4.c | /*
hardware integer division program, by Manna
returns q==A//B
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "hard2.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int A, B;
int r, d, p, q;
A = __VERIFIER_nondet_int();
assume_abort_if_not(A >= 0 && A <= 1);
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1) {
if (!(r >= d)) {
break;
}
d = 2 * d;
p = 2 * p;
}
while (1) {
__VERIFIER_assert(A == q * B + r);
if (!(p != 1)) {
break;
}
d = d / 2;
p = p / 2;
if (r >= d) {
r = r - d;
q = q + p;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int A;
int B;
int r;
int d;
int p;
int q;
A = __VERIFIER_nondet_int();
assume((A >= 0) && (A <= 1));
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
;
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
;
assert(A == ((q * B) + r));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | TRUE | [
25.7,
30.75,
25.96
] | 25.96 | int main()
{
int A;
int B;
int r;
int d;
int p;
int q;
A = (int) rand();
assume((A >= 0) && (A <= 1));
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
INVARIANT_MARKER_2();
assert(A == ((q * B) + r));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | easy |
15 | mono-crafted_11_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() {
__assert_fail("0", "mono-crafted_11.c", 3, "reach_error");
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
}
int main() {
unsigned int x = 0;
while (x < 100000000) {
if (x < 10000000) {
x++;
} else {
x += 2;
}
}
__VERIFIER_assert((x % 2) == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
unsigned int x = 0;
while (x < 100000000)
{
;
if (x < 10000000)
{
x++;
}
else
{
x += 2;
}
}
assert((x % 2) == 0);
return 0;
} | TRUE | [
5.8,
5.43,
5.44
] | 5.44 | int main()
{
unsigned int x = 0;
while (x < 100000000)
{
INVARIANT_MARKER_1();
if (x < 10000000)
{
x++;
}
else
{
x += 2;
}
}
assert((x % 2) == 0);
return 0;
} | easy |
16 | ps4-ll_valuebound5_3.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps4-ll.c", 3, "reach_error"); }
extern short __VERIFIER_nondet_short(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short k;
long long y, x, c;
k = __VERIFIER_nondet_short();
assume_abort_if_not(k >= 0 && k <= 5);
y = 0;
x = 0;
c = 0;
while (1) {
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y * y * y + x;
}
__VERIFIER_assert(4 * x - y * y * y * y - 2 * y * y * y - y * y == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_short();
assume((k >= 0) && (k <= 5));
y = 0;
x = 0;
c = 0;
while (1)
{
;
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
assert(((((4 * x) - (((y * y) * y) * y)) - (((2 * y) * y) * y)) - (y * y)) == 0);
return 0;
} | TRUE | [
4.71,
4.64,
4.73
] | 4.71 | int main()
{
short k;
long long y;
long long x;
long long c;
k = (short) rand();
assume((k >= 0) && (k <= 5));
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
assert(((((4 * x) - (((y * y) * y) * y)) - (((2 * y) * y) * y)) - (y * y)) == 0);
return 0;
} | easy |
17 | cohencu-ll_valuebound20_7.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 20);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(6 * a * x - x * z + 12 * x == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 20));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((6 * a) * x) - (x * z)) + (12 * x)) == 0);
return 0;
} | TRUE | [
4.2,
4.8,
4.3
] | 4.3 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 20));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((6 * a) * x) - (x * z)) + (12 * x)) == 0);
return 0;
} | easy |
18 | cohencu-ll_valuebound50_8.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 50);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(a * z - 6 * a - 2 * y + 2 * z - 10 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 50));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((a * z) - (6 * a)) - (2 * y)) + (2 * z)) - 10) == 0);
return 0;
} | TRUE | [
7.19,
7.7,
7.24
] | 7.24 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 50));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((a * z) - (6 * a)) - (2 * y)) + (2 * z)) - 10) == 0);
return 0;
} | easy |
19 | egcd-ll_valuebound5_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 5);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 5);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1) {
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
__VERIFIER_assert(p * x + r * y - b == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 5));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 5));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
;
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | TRUE | [
16.86,
16.89,
17.11
] | 16.89 | int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
assume((x >= 0) && (x <= 5));
y = (int) rand();
assume((y >= 0) && (y <= 5));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | easy |
20 | egcd-ll_valuebound100_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 100);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 100);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1) {
__VERIFIER_assert(((((1 <= y && x <= 100) && 1 <= x) && s * y + q * x + 2 * a == b + 2 * (p * x) + r * y * 2)&& r * y + p * x == a) && y <= 100);
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
__VERIFIER_assert(p * x + r * y - b == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 100));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 100));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
;
assert((((((1 <= y) && (x <= 100)) && (1 <= x)) && ((((s * y) + (q * x)) + (2 * a)) == ((b + (2 * (p * x))) + ((r * y) * 2)))) && (((r * y) + (p * x)) == a)) && (y <= 100));
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | TRUE | [
9.88,
9.94,
10.14
] | 9.94 | int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
assume((x >= 0) && (x <= 100));
y = (int) rand();
assume((y >= 0) && (y <= 100));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
INVARIANT_MARKER_1();
assert((((((1 <= y) && (x <= 100)) && (1 <= x)) && ((((s * y) + (q * x)) + (2 * a)) == ((b + (2 * (p * x))) + ((r * y) * 2)))) && (((r * y) + (p * x)) == a)) && (y <= 100));
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | easy |
21 | prod4br-ll_valuebound10_1.c | /* algorithm for computing the product of two natural numbers */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "prod4br-ll.c", 5, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int x, y;
long long a, b, p, q;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 10);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 10);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
while (1) {
__VERIFIER_assert(q + a * b * p == (long long)x * y);
if (!(a != 0 && b != 0)) {
break;
}
if (a % 2 == 0 && b % 2 == 0) {
a = a / 2;
b = b / 2;
p = 4 * p;
} else if (a % 2 == 1 && b % 2 == 0) {
a = a - 1;
q = q + b * p;
} else if (a % 2 == 0 && b % 2 == 1) {
b = b - 1;
q = q + a * p;
} else {
a = a - 1;
b = b - 1;
q = q + (a + b + 1) * p; /*fix a bug here--- was (a+b-1)*/
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 10));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 10));
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
while (1)
{
;
assert((q + ((a * b) * p)) == (((long long) x) * y));
if (!((a != 0) && (b != 0)))
{
break;
}
if (((a % 2) == 0) && ((b % 2) == 0))
{
a = a / 2;
b = b / 2;
p = 4 * p;
}
else
if (((a % 2) == 1) && ((b % 2) == 0))
{
a = a - 1;
q = q + (b * p);
}
else
if (((a % 2) == 0) && ((b % 2) == 1))
{
b = b - 1;
q = q + (a * p);
}
else
{
a = a - 1;
b = b - 1;
q = q + (((a + b) + 1) * p);
}
}
return 0;
} | TRUE | [
4.85,
4.46,
4.33
] | 4.46 | int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
x = (int) rand();
assume((x >= 0) && (x <= 10));
y = (int) rand();
assume((y >= 0) && (y <= 10));
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
while (1)
{
INVARIANT_MARKER_1();
assert((q + ((a * b) * p)) == (((long long) x) * y));
if (!((a != 0) && (b != 0)))
{
break;
}
if (((a % 2) == 0) && ((b % 2) == 0))
{
a = a / 2;
b = b / 2;
p = 4 * p;
}
else
if (((a % 2) == 1) && ((b % 2) == 0))
{
a = a - 1;
q = q + (b * p);
}
else
if (((a % 2) == 0) && ((b % 2) == 1))
{
b = b - 1;
q = q + (a * p);
}
else
{
a = a - 1;
b = b - 1;
q = q + (((a + b) + 1) * p);
}
}
return 0;
} | easy |
22 | hard-ll_valuebound1_6.c | /*
hardware integer division program, by Manna
returns q==A//B
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "hard-ll.c", 8, "reach_error"); }
extern unsigned int __VERIFIER_nondet_uint(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
unsigned int A, B;
long long r, d, p, q;
A = __VERIFIER_nondet_uint();
assume_abort_if_not(A >= 0 && A <= 1);
B = __VERIFIER_nondet_uint();
assume_abort_if_not(B >= 0 && B <= 1);
assume_abort_if_not(B >= 1);
r = A;
d = B;
p = 1;
q = 0;
while (1) {
if (!(r >= d)) {
break;
}
d = 2 * d;
p = 2 * p;
}
while (1) {
if (!(p != 1)) {
break;
}
d = d / 2;
p = p / 2;
if (r >= d) {
r = r - d;
q = q + p;
}
}
__VERIFIER_assert(A == d * q + r);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
unsigned int A;
unsigned int B;
long long r;
long long d;
long long p;
long long q;
A = __VERIFIER_nondet_uint();
assume((A >= 0) && (A <= 1));
B = __VERIFIER_nondet_uint();
assume((B >= 0) && (B <= 1));
assume(B >= 1);
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
;
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
;
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
assert(A == ((d * q) + r));
return 0;
} | TRUE | [
6.09,
5.98,
6.06
] | 6.06 | int main()
{
unsigned int A;
unsigned int B;
long long r;
long long d;
long long p;
long long q;
A = (unsigned int) rand();
assume((A >= 0) && (A <= 1));
B = (unsigned int) rand();
assume((B >= 0) && (B <= 1));
assume(B >= 1);
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
INVARIANT_MARKER_2();
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
assert(A == ((d * q) + r));
return 0;
} | easy |
23 | benchmark24_conjunctive_1.c | #include <assert.h>
void reach_error(void) { assert(0); }
extern int __VERIFIER_nondet_int(void);
extern _Bool __VERIFIER_nondet_bool(void);
void __VERIFIER_assert(int cond) {
if (!cond) {
reach_error();
}
}
/* 24.cfg:
names=i k n
beforeloop=
beforeloopinit=
precondition=i==0 && k==n && n>=0
loopcondition=i<n
loop=k--; i+=2;
postcondition=2*k>=n-1
afterloop=
learners= conj
*/
int main() {
int i = __VERIFIER_nondet_int();
int k = __VERIFIER_nondet_int();
int n = __VERIFIER_nondet_int();
if (!(i == 0 && k == n && n >= 0)) {
return 0;
}
while (i < n) {
k--;
i += 2;
}
__VERIFIER_assert(2 * k >= n - 1);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int i = __VERIFIER_nondet_int();
int k = __VERIFIER_nondet_int();
int n = __VERIFIER_nondet_int();
if (!(((i == 0) && (k == n)) && (n >= 0)))
{
return 0;
}
while (i < n)
{
;
k--;
i += 2;
}
assert((2 * k) >= (n - 1));
return 0;
} | TRUE | [
4.22,
4.42,
4.95
] | 4.42 | int main()
{
int i = (int) rand();
int k = (int) rand();
int n = (int) rand();
if (!(((i == 0) && (k == n)) && (n >= 0)))
{
return 0;
}
while (i < n)
{
INVARIANT_MARKER_1();
k--;
i += 2;
}
assert((2 * k) >= (n - 1));
return 0;
} | easy |
24 | rewnifrev2_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "rewnifrev2.c", 3, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
}
extern int __VERIFIER_nondet_int(void);
void *malloc(unsigned int size);
int SIZE;
const int MAX = 100000;
int main() {
SIZE = __VERIFIER_nondet_int();
int i;
if (SIZE > 1 && SIZE < MAX) {
int *a = malloc(sizeof(int) * SIZE);
for (i = SIZE - 2; i >= 0; i--) {
a[i] = i;
a[i + 1] = i + 1;
}
for (i = 0; i < SIZE; i++) {
__VERIFIER_assert(a[i] >= i);
}
}
return 1;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
void *malloc(unsigned int size);
int SIZE;
const int MAX = 100000;
int main()
{
SIZE = __VERIFIER_nondet_int();
int i;
if ((SIZE > 1) && (SIZE < MAX))
{
int *a = malloc((sizeof(int)) * SIZE);
for (i = SIZE - 2; i >= 0; i--)
{
;
a[i] = i;
a[i + 1] = i + 1;
}
for (i = 0; i < SIZE; i++)
{
;
assert(a[i] >= i);
}
}
return 1;
} | TIMEOUT | [
601.11,
601.11,
601.11
] | 601.11 | void *malloc(unsigned int size);
int SIZE;
const int MAX = 100000;
int main()
{
SIZE = (int) rand();
int i;
if ((SIZE > 1) && (SIZE < MAX))
{
int *a = malloc((sizeof(int)) * SIZE);
for (i = SIZE - 2; i >= 0; i--)
{
INVARIANT_MARKER_1();
a[i] = i;
a[i + 1] = i + 1;
}
for (i = 0; i < SIZE; i++)
{
INVARIANT_MARKER_2();
assert(a[i] >= i);
}
}
return 1;
} | hard |
25 | cohencu-ll_valuebound2_5.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 2);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
__VERIFIER_assert((z * z) - 12 * y - 6 * z + 12 == 0);
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 2));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
assert(((((z * z) - (12 * y)) - (6 * z)) + 12) == 0);
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | TRUE | [
4.52,
4.72,
4.67
] | 4.67 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 2));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
assert(((((z * z) - (12 * y)) - (6 * z)) + 12) == 0);
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | easy |
26 | cohencu-ll_unwindbound20_7.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while (counter++ < 20) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(6 * a * x - x * z + 12 * x == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 20)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((6 * a) * x) - (x * z)) + (12 * x)) == 0);
return 0;
} | FALSE | [
6.02,
6.36,
6.38
] | 6.36 | int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 20)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((6 * a) * x) - (x * z)) + (12 * x)) == 0);
return 0;
} | easy |
27 | lcm1_unwindbound2_5.c | /*
* algorithm for computing simultaneously the GCD and the LCM,
* by Sankaranarayanan
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "lcm1.c", 8, "reach_error"); }
extern unsigned __VERIFIER_nondet_uint(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
unsigned a, b;
unsigned x, y, u, v;
a = __VERIFIER_nondet_uint();
b = __VERIFIER_nondet_uint();
assume_abort_if_not(a >= 1); // infinite loop if remove
assume_abort_if_not(b >= 1);
assume_abort_if_not(a <= 65535);
assume_abort_if_not(b <= 65535);
x = a;
y = b;
u = b;
v = 0;
while (counter++ < 2) {
if (!(x != y)) {
break;
}
while (counter++ < 2) {
if (!(x > y)) {
break;
}
x = x - y;
v = v + u;
}
while (counter++ < 2) {
if (!(x < y)) {
break;
}
y = y - x;
u = u + v;
}
}
__VERIFIER_assert(x == y);
// x == gcd(a,b)
// u + v == lcm(a,b)
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
unsigned a;
unsigned b;
unsigned x;
unsigned y;
unsigned u;
unsigned v;
a = __VERIFIER_nondet_uint();
b = __VERIFIER_nondet_uint();
assume(a >= 1);
assume(b >= 1);
assume(a <= 65535);
assume(b <= 65535);
x = a;
y = b;
u = b;
v = 0;
while ((counter++) < 2)
{
;
if (!(x != y))
{
break;
}
while ((counter++) < 2)
{
;
if (!(x > y))
{
break;
}
x = x - y;
v = v + u;
}
while ((counter++) < 2)
{
;
if (!(x < y))
{
break;
}
y = y - x;
u = u + v;
}
}
assert(x == y);
return 0;
} | FALSE | [
4,
3.98,
4.52
] | 4 | int counter = 0;
int main()
{
unsigned a;
unsigned b;
unsigned x;
unsigned y;
unsigned u;
unsigned v;
a = (unsigned int) rand();
b = (unsigned int) rand();
assume(a >= 1);
assume(b >= 1);
assume(a <= 65535);
assume(b <= 65535);
x = a;
y = b;
u = b;
v = 0;
while ((counter++) < 2)
{
INVARIANT_MARKER_1();
if (!(x != y))
{
break;
}
while ((counter++) < 2)
{
INVARIANT_MARKER_2();
if (!(x > y))
{
break;
}
x = x - y;
v = v + u;
}
while ((counter++) < 2)
{
INVARIANT_MARKER_3();
if (!(x < y))
{
break;
}
y = y - x;
u = u + v;
}
}
assert(x == y);
return 0;
} | easy |
28 | ps4-ll_2.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps4-ll.c", 3, "reach_error"); }
extern short __VERIFIER_nondet_short(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short k;
long long y, x, c;
k = __VERIFIER_nondet_short();
y = 0;
x = 0;
c = 0;
while (1) {
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y * y * y + x;
}
__VERIFIER_assert(k * y - (y * y) == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_short();
y = 0;
x = 0;
c = 0;
while (1)
{
;
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
assert(((k * y) - (y * y)) == 0);
return 0;
} | TRUE | [
4.83,
4.68,
4.63
] | 4.68 | int main()
{
short k;
long long y;
long long x;
long long c;
k = (short) rand();
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
assert(((k * y) - (y * y)) == 0);
return 0;
} | easy |
29 | num_conversion_1_1.c | // This file is part of the SV-Benchmarks collection of verification tasks:
// https://gitlab.com/sosy-lab/benchmarking/sv-benchmarks
//
// SPDX-FileCopyrightText: 2012-2021 The SV-Benchmarks Community
// SPDX-FileCopyrightText: 2012 FBK-ES <https://es.fbk.eu/>
//
// SPDX-License-Identifier: Apache-2.0
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() {
__assert_fail("0", "num_conversion_1.c", 3, "reach_error");
}
extern int __VERIFIER_nondet_int(void);
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
return;
}
// #include <assert.h>
int main() {
unsigned char x;
unsigned char y;
unsigned char c;
x = 37;
y = 0;
c = 0;
while (c < (unsigned char)8) {
unsigned char i = ((unsigned char)1) << c;
unsigned char bit = x & i;
if (bit != (unsigned char)0) {
y = y + i;
}
c = c + ((unsigned char)1);
}
__VERIFIER_assert(x == y);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
unsigned char x;
unsigned char y;
unsigned char c;
x = 37;
y = 0;
c = 0;
while (c < ((unsigned char) 8))
{
;
unsigned char i = ((unsigned char) 1) << c;
unsigned char bit = x & i;
if (bit != ((unsigned char) 0))
{
y = y + i;
}
c = c + ((unsigned char) 1);
}
assert(x == y);
return 0;
} | TRUE | [
18.98,
18.69,
18.55
] | 18.69 | int main()
{
unsigned char x;
unsigned char y;
unsigned char c;
x = 37;
y = 0;
c = 0;
while (c < ((unsigned char) 8))
{
INVARIANT_MARKER_1();
unsigned char i = ((unsigned char) 1) << c;
unsigned char bit = x & i;
if (bit != ((unsigned char) 0))
{
y = y + i;
}
c = c + ((unsigned char) 1);
}
assert(x == y);
return 0;
} | easy |
30 | sum_by_3_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "sum_by_3.c", 3, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
return;
}
int SIZE = 20000001;
unsigned int __VERIFIER_nondet_uint();
int main() {
unsigned int n, i, k;
n = __VERIFIER_nondet_uint();
if (!(n <= SIZE)) {
return 0;
}
i = 0;
while (i < n) {
i = i + 1;
}
int j = i;
while (j < n) {
j = j + 1;
}
k = j;
while (k < n) {
k = k + 1;
}
__VERIFIER_assert((i + j + k) / 3 <= SIZE);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int SIZE = 20000001;
unsigned int __VERIFIER_nondet_uint();
int main()
{
unsigned int n;
unsigned int i;
unsigned int k;
n = __VERIFIER_nondet_uint();
if (!(n <= SIZE))
{
return 0;
}
i = 0;
while (i < n)
{
;
i = i + 1;
}
int j = i;
while (j < n)
{
;
j = j + 1;
}
k = j;
while (k < n)
{
;
k = k + 1;
}
assert((((i + j) + k) / 3) <= SIZE);
return 0;
} | TRUE | [
119.31,
112.03,
147.67
] | 119.31 | int SIZE = 20000001;
unsigned int (unsigned int) rand();
int main()
{
unsigned int n;
unsigned int i;
unsigned int k;
n = (unsigned int) rand();
if (!(n <= SIZE))
{
return 0;
}
i = 0;
while (i < n)
{
INVARIANT_MARKER_1();
i = i + 1;
}
int j = i;
while (j < n)
{
INVARIANT_MARKER_2();
j = j + 1;
}
k = j;
while (k < n)
{
INVARIANT_MARKER_3();
k = k + 1;
}
assert((((i + j) + k) / 3) <= SIZE);
return 0;
} | hard |
31 | cohencu-ll_unwindbound5_2.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while (counter++ < 5) {
__VERIFIER_assert(y == 3 * n * n + 3 * n + 1);
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 5)
{
;
assert(y == ((((3 * n) * n) + (3 * n)) + 1));
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | TRUE | [
4.52,
4.39,
4.71
] | 4.52 | int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
assert(y == ((((3 * n) * n) + (3 * n)) + 1));
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | easy |
32 | bh2017-ex-add_2.c | // Source: Rémy Boutonnet, Nicolas Halbwachs: "Improving the results of program analysis by abstract interpretation beyond the decreasing sequence", FMSD 2017.
// Example "additional".
#include <assert.h>
extern void abort(void);
void reach_error() { assert(0); }
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
}
extern _Bool __VERIFIER_nondet_bool();
int main() {
int m = 0;
int n = 0;
while (1) {
__VERIFIER_assert(n <= 60);
if (__VERIFIER_nondet_bool()) {
if (__VERIFIER_nondet_bool()) {
if (m < 60) {
m++;
} else {
m = 0;
}
}
}
if (__VERIFIER_nondet_bool()) {
if (__VERIFIER_nondet_bool()) {
if (n < 60) {
n++;
} else {
n = 0;
}
}
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int m = 0;
int n = 0;
while (1)
{
;
assert(n <= 60);
if (__VERIFIER_nondet_bool())
{
if (__VERIFIER_nondet_bool())
{
if (m < 60)
{
m++;
}
else
{
m = 0;
}
}
}
if (__VERIFIER_nondet_bool())
{
if (__VERIFIER_nondet_bool())
{
if (n < 60)
{
n++;
}
else
{
n = 0;
}
}
}
}
return 0;
} | TRUE | [
4.32,
4.44,
3.72
] | 4.32 | int main()
{
int m = 0;
int n = 0;
while (1)
{
INVARIANT_MARKER_1();
assert(n <= 60);
if ((bool) rand())
{
if ((bool) rand())
{
if (m < 60)
{
m++;
}
else
{
m = 0;
}
}
}
if ((bool) rand())
{
if ((bool) rand())
{
if (n < 60)
{
n++;
}
else
{
n = 0;
}
}
}
}
return 0;
} | easy |
33 | egcd-ll_unwindbound10_3.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 10) {
__VERIFIER_assert(b == x * q + y * s);
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
;
assert(b == ((x * q) + (y * s)));
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
return 0;
} | TRUE | [
5.23,
4.78,
5.35
] | 5.23 | int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
INVARIANT_MARKER_1();
assert(b == ((x * q) + (y * s)));
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
return 0;
} | easy |
34 | geo1-ll_valuebound2_1.c | /*
Geometric Series
computes x=(z-1)* sum(z^k)[k=0..k-1] , y = z^k
returns 1+x-y == 0
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "geo1-ll.c", 9, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int z, k;
long long x, y, c;
z = __VERIFIER_nondet_int();
assume_abort_if_not(z >= 0 && z <= 2);
k = __VERIFIER_nondet_int();
assume_abort_if_not(k >= 0 && k <= 2);
assume_abort_if_not(z >= 1);
assume_abort_if_not(k >= 1);
x = 1;
y = z;
c = 1;
while (1) {
__VERIFIER_assert(x * z - x - y + 1 == 0);
if (!(c < k)) {
break;
}
c = c + 1;
x = x * z + 1;
y = y * z;
} // geo1
x = x * (z - 1);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int z;
int k;
long long x;
long long y;
long long c;
z = __VERIFIER_nondet_int();
assume((z >= 0) && (z <= 2));
k = __VERIFIER_nondet_int();
assume((k >= 0) && (k <= 2));
assume(z >= 1);
assume(k >= 1);
x = 1;
y = z;
c = 1;
while (1)
{
;
assert(((((x * z) - x) - y) + 1) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
x = (x * z) + 1;
y = y * z;
}
x = x * (z - 1);
return 0;
} | TRUE | [
4.64,
5.08,
4.62
] | 4.64 | int main()
{
int z;
int k;
long long x;
long long y;
long long c;
z = (int) rand();
assume((z >= 0) && (z <= 2));
k = (int) rand();
assume((k >= 0) && (k <= 2));
assume(z >= 1);
assume(k >= 1);
x = 1;
y = z;
c = 1;
while (1)
{
INVARIANT_MARKER_1();
assert(((((x * z) - x) - y) + 1) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
x = (x * z) + 1;
y = y * z;
}
x = x * (z - 1);
return 0;
} | easy |
35 | cohencu_1.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int a, n, x, y, z;
a = __VERIFIER_nondet_int();
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
__VERIFIER_assert(z == 6 * n + 6);
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int a;
int n;
int x;
int y;
int z;
a = __VERIFIER_nondet_int();
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
assert(z == ((6 * n) + 6));
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | TRUE | [
4.19,
3.87,
4.18
] | 4.18 | int main()
{
int a;
int n;
int x;
int y;
int z;
a = (int) rand();
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
assert(z == ((6 * n) + 6));
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
return 0;
} | easy |
36 | egcd-ll_unwindbound50_3.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 50) {
__VERIFIER_assert(b == x * q + y * s);
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 50)
{
;
assert(b == ((x * q) + (y * s)));
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
return 0;
} | TRUE | [
5.14,
5.24,
4.88
] | 5.14 | int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 50)
{
INVARIANT_MARKER_1();
assert(b == ((x * q) + (y * s)));
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
return 0;
} | easy |
37 | rewnifrev_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "rewnifrev.c", 3, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
}
extern int __VERIFIER_nondet_int(void);
void *malloc(unsigned int size);
int SIZE;
const int MAX = 100000;
int main() {
SIZE = __VERIFIER_nondet_int();
if (SIZE > 1 && SIZE < MAX) {
int i;
int *a = malloc(sizeof(int) * SIZE);
for (i = SIZE - 1; i >= 0; i--) {
if ((i - 1) >= 0) {
a[i - 1] = i - 2;
}
a[i] = i;
}
for (i = 0; i < SIZE; i++) {
__VERIFIER_assert(a[i] >= i);
}
}
return 1;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
void *malloc(unsigned int size);
int SIZE;
const int MAX = 100000;
int main()
{
SIZE = __VERIFIER_nondet_int();
if ((SIZE > 1) && (SIZE < MAX))
{
int i;
int *a = malloc((sizeof(int)) * SIZE);
for (i = SIZE - 1; i >= 0; i--)
{
;
if ((i - 1) >= 0)
{
a[i - 1] = i - 2;
}
a[i] = i;
}
for (i = 0; i < SIZE; i++)
{
;
assert(a[i] >= i);
}
}
return 1;
} | TIMEOUT | [
601.11,
601.11,
601.11
] | 601.11 | void *malloc(unsigned int size);
int SIZE;
const int MAX = 100000;
int main()
{
SIZE = (int) rand();
if ((SIZE > 1) && (SIZE < MAX))
{
int i;
int *a = malloc((sizeof(int)) * SIZE);
for (i = SIZE - 1; i >= 0; i--)
{
INVARIANT_MARKER_1();
if ((i - 1) >= 0)
{
a[i - 1] = i - 2;
}
a[i] = i;
}
for (i = 0; i < SIZE; i++)
{
INVARIANT_MARKER_2();
assert(a[i] >= i);
}
}
return 1;
} | hard |
38 | hard2_valuebound10_5.c | /*
hardware integer division program, by Manna
returns q==A//B
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "hard2.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int A, B;
int r, d, p, q;
A = __VERIFIER_nondet_int();
assume_abort_if_not(A >= 0 && A <= 10);
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1) {
if (!(r >= d)) {
break;
}
d = 2 * d;
p = 2 * p;
}
while (1) {
__VERIFIER_assert(d == B * p);
if (!(p != 1)) {
break;
}
d = d / 2;
p = p / 2;
if (r >= d) {
r = r - d;
q = q + p;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int A;
int B;
int r;
int d;
int p;
int q;
A = __VERIFIER_nondet_int();
assume((A >= 0) && (A <= 10));
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
;
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
;
assert(d == (B * p));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | TRUE | [
40.91,
40.22,
41.06
] | 40.91 | int main()
{
int A;
int B;
int r;
int d;
int p;
int q;
A = (int) rand();
assume((A >= 0) && (A <= 10));
B = 1;
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
INVARIANT_MARKER_2();
assert(d == (B * p));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | hard |
39 | egcd-ll_unwindbound10_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 10) {
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
__VERIFIER_assert(p * x + r * y - b == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
;
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | FALSE | [
12.75,
12.92,
13.14
] | 12.92 | int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
INVARIANT_MARKER_1();
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | easy |
40 | divbin2_valuebound1_2.c | /*
A division algorithm, by Kaldewaij
returns A//B
*/
#include <limits.h>
extern void abort(void);
#include <assert.h>
void reach_error() { assert(0); }
extern unsigned __VERIFIER_nondet_uint(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
unsigned A, B;
unsigned q, r, b;
A = __VERIFIER_nondet_uint();
assume_abort_if_not(A >= 0 && A <= 1);
B = 1;
q = 0;
r = A;
b = B;
while (1) {
if (!(r >= b)) {
break;
}
b = 2 * b;
}
while (1) {
if (!(b != B)) {
break;
}
q = 2 * q;
b = b / 2;
if (r >= b) {
q = q + 1;
r = r - b;
}
}
__VERIFIER_assert(A == q * b + r);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
unsigned A;
unsigned B;
unsigned q;
unsigned r;
unsigned b;
A = __VERIFIER_nondet_uint();
assume((A >= 0) && (A <= 1));
B = 1;
q = 0;
r = A;
b = B;
while (1)
{
;
if (!(r >= b))
{
break;
}
b = 2 * b;
}
while (1)
{
;
if (!(b != B))
{
break;
}
q = 2 * q;
b = b / 2;
if (r >= b)
{
q = q + 1;
r = r - b;
}
}
assert(A == ((q * b) + r));
return 0;
} | TRUE | [
5.13,
5.4,
5.22
] | 5.22 | int main()
{
unsigned A;
unsigned B;
unsigned q;
unsigned r;
unsigned b;
A = (unsigned int) rand();
assume((A >= 0) && (A <= 1));
B = 1;
q = 0;
r = A;
b = B;
while (1)
{
INVARIANT_MARKER_1();
if (!(r >= b))
{
break;
}
b = 2 * b;
}
while (1)
{
INVARIANT_MARKER_2();
if (!(b != B))
{
break;
}
q = 2 * q;
b = b / 2;
if (r >= b)
{
q = q + 1;
r = r - b;
}
}
assert(A == ((q * b) + r));
return 0;
} | easy |
41 | egcd3-ll_valuebound2_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd3-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int x, y;
long long a, b, p, q, r, s;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 2);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 2);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1) {
if (!(b != 0)) {
break;
}
long long c, k;
c = a;
k = 0;
while (1) {
if (!(c >= b)) {
break;
}
long long d, v;
d = 1;
v = b;
while (1) {
if (!(c >= 2 * v)) {
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
__VERIFIER_assert(p * x - q * x + r * y - s * y == a);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 2));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 2));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
;
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while (1)
{
;
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while (1)
{
;
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
assert(((((p * x) - (q * x)) + (r * y)) - (s * y)) == a);
return 0;
} | TRUE | [
29.03,
28.38,
28.81
] | 28.81 | int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = (int) rand();
assume((x >= 0) && (x <= 2));
y = (int) rand();
assume((y >= 0) && (y <= 2));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while (1)
{
INVARIANT_MARKER_2();
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while (1)
{
INVARIANT_MARKER_3();
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
assert(((((p * x) - (q * x)) + (r * y)) - (s * y)) == a);
return 0;
} | easy |
42 | cohencu-ll_valuebound10_10.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 10);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(z * z - 12 * y - 6 * z + 12 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 10));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((z * z) - (12 * y)) - (6 * z)) + 12) == 0);
return 0;
} | TRUE | [
4.55,
4.2,
4.09
] | 4.2 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 10));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((z * z) - (12 * y)) - (6 * z)) + 12) == 0);
return 0;
} | easy |
43 | egcd-ll_unwindbound5_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 5) {
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
__VERIFIER_assert(p * x + r * y - b == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 5)
{
;
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | FALSE | [
8.75,
8.67,
8.88
] | 8.75 | int counter = 0;
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((p * x) + (r * y)) - b) == 0);
return 0;
} | easy |
44 | cohencu-ll_valuebound100_8.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 100);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(a * z - 6 * a - 2 * y + 2 * z - 10 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 100));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((a * z) - (6 * a)) - (2 * y)) + (2 * z)) - 10) == 0);
return 0;
} | TRUE | [
7.44,
7.58,
7.6
] | 7.58 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 100));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((a * z) - (6 * a)) - (2 * y)) + (2 * z)) - 10) == 0);
return 0;
} | easy |
45 | dll-rb-cnstr_1-2_4.c | extern void abort(void);
#include <assert.h>
void reach_error() { assert(0); }
typedef enum { RED,
BLACK } Colour;
typedef struct TSLL {
struct TSLL *next;
struct TSLL *prev;
Colour colour;
} SLL;
int main() {
// create the head
SLL *list = malloc(sizeof(SLL));
list->next = NULL;
list->prev = NULL;
list->colour = BLACK;
SLL *end = list;
// create an arbitrarily long tail
while (__VERIFIER_nondet_int()) {
// create a node
end->next = malloc(sizeof(SLL));
end->next->prev = end;
end = end->next;
end->next = NULL;
if (__VERIFIER_nondet_int()) { // mark the node as black
end->colour = BLACK;
} else { // mark the node as red and follow it by a black node
end->colour = RED;
end->next = malloc(sizeof(SLL));
end->next->prev = end;
end = end->next;
end->next = NULL;
end->colour = BLACK;
}
}
end = NULL;
end = list;
// check the invariant
while (NULL != end) {
if (RED == end->colour) {
end = end->next;
end = end->next;
}
__VERIFIER_assert(end->next);
end = end->next;
}
// destroy the list
while (NULL != list) {
if (RED == list->colour) { // we can remove two nodes at once
end = list->next;
free(list);
list = end->next;
free(end);
} else { // we can remove only one node
end = list->next;
free(list);
list = end;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
typedef enum
{
RED,
BLACK
} Colour;
typedef struct TSLL
{
struct TSLL *next;
struct TSLL *prev;
Colour colour;
} SLL;
int main()
{
SLL *list = malloc(sizeof(SLL));
list->next = NULL;
list->prev = NULL;
list->colour = BLACK;
SLL *end = list;
while (__VERIFIER_nondet_int())
{
;
end->next = malloc(sizeof(SLL));
end->next->prev = end;
end = end->next;
end->next = NULL;
if (__VERIFIER_nondet_int())
{
end->colour = BLACK;
}
else
{
end->colour = RED;
end->next = malloc(sizeof(SLL));
end->next->prev = end;
end = end->next;
end->next = NULL;
end->colour = BLACK;
}
}
end = NULL;
end = list;
while (NULL != end)
{
;
if (RED == end->colour)
{
end = end->next;
end = end->next;
}
assert(end->next);
end = end->next;
}
while (NULL != list)
{
;
if (RED == list->colour)
{
end = list->next;
free(list);
list = end->next;
free(end);
}
else
{
end = list->next;
free(list);
list = end;
}
}
return 0;
} | FALSE | [
3.99,
4.34,
4.34
] | 4.34 | typedef enum
{
RED,
BLACK
} Colour;
typedef struct TSLL
{
struct TSLL *next;
struct TSLL *prev;
Colour colour;
} SLL;
int main()
{
SLL *list = malloc(sizeof(SLL));
list->next = NULL;
list->prev = NULL;
list->colour = BLACK;
SLL *end = list;
while ((int) rand())
{
INVARIANT_MARKER_1();
end->next = malloc(sizeof(SLL));
end->next->prev = end;
end = end->next;
end->next = NULL;
if ((int) rand())
{
end->colour = BLACK;
}
else
{
end->colour = RED;
end->next = malloc(sizeof(SLL));
end->next->prev = end;
end = end->next;
end->next = NULL;
end->colour = BLACK;
}
}
end = NULL;
end = list;
while (NULL != end)
{
INVARIANT_MARKER_2();
if (RED == end->colour)
{
end = end->next;
end = end->next;
}
assert(end->next);
end = end->next;
}
while (NULL != list)
{
INVARIANT_MARKER_3();
if (RED == list->colour)
{
end = list->next;
free(list);
list = end->next;
free(end);
}
else
{
end = list->next;
free(list);
list = end;
}
}
return 0;
} | easy |
46 | ps4-ll_valuebound5_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps4-ll.c", 3, "reach_error"); }
extern short __VERIFIER_nondet_short(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short k;
long long y, x, c;
k = __VERIFIER_nondet_short();
assume_abort_if_not(k >= 0 && k <= 5);
y = 0;
x = 0;
c = 0;
while (1) {
__VERIFIER_assert(4 * x - y * y * y * y - 2 * y * y * y - y * y == 0);
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y * y * y + x;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_short();
assume((k >= 0) && (k <= 5));
y = 0;
x = 0;
c = 0;
while (1)
{
;
assert(((((4 * x) - (((y * y) * y) * y)) - (((2 * y) * y) * y)) - (y * y)) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
return 0;
} | TRUE | [
4.65,
4.63,
4.76
] | 4.65 | int main()
{
short k;
long long y;
long long x;
long long c;
k = (short) rand();
assume((k >= 0) && (k <= 5));
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
assert(((((4 * x) - (((y * y) * y) * y)) - (((2 * y) * y) * y)) - (y * y)) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
return 0;
} | easy |
47 | sqrt1_2.c | /* Compute the floor of the square root of a natural number */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "sqrt1.c", 5, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int n, a, s, t;
n = __VERIFIER_nondet_int();
a = 0;
s = 1;
t = 1;
while (1) {
__VERIFIER_assert(s == (a + 1) * (a + 1));
// the above 2 should be equiv to
if (!(s <= n)) {
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int n;
int a;
int s;
int t;
n = __VERIFIER_nondet_int();
a = 0;
s = 1;
t = 1;
while (1)
{
;
assert(s == ((a + 1) * (a + 1)));
if (!(s <= n))
{
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
return 0;
} | TRUE | [
4.63,
4.71,
4.23
] | 4.63 | int main()
{
int n;
int a;
int s;
int t;
n = (int) rand();
a = 0;
s = 1;
t = 1;
while (1)
{
INVARIANT_MARKER_1();
assert(s == ((a + 1) * (a + 1)));
if (!(s <= n))
{
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
return 0;
} | easy |
48 | egcd3-ll_unwindbound10_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd3-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long a, b, p, q, r, s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 10) {
if (!(b != 0)) {
break;
}
long long c, k;
c = a;
k = 0;
while (counter++ < 10) {
if (!(c >= b)) {
break;
}
long long d, v;
d = 1;
v = b;
while (counter++ < 10) {
if (!(c >= 2 * v)) {
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
__VERIFIER_assert(p * x - q * x + r * y - s * y == a);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
;
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 10)
{
;
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 10)
{
;
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
assert(((((p * x) - (q * x)) + (r * y)) - (s * y)) == a);
return 0;
} | FALSE | [
38.08,
38.7,
37.88
] | 38.08 | int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 10)
{
INVARIANT_MARKER_2();
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 10)
{
INVARIANT_MARKER_3();
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
assert(((((p * x) - (q * x)) + (r * y)) - (s * y)) == a);
return 0;
} | hard |
49 | modnf_1.c | /*
* Benchmarks contributed by Divyesh Unadkat[1,2], Supratik Chakraborty[1], Ashutosh Gupta[1]
* [1] Indian Institute of Technology Bombay, Mumbai
* [2] TCS Innovation labs, Pune
*
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "modnf.c", 10, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
}
extern int __VERIFIER_nondet_int(void);
void *malloc(unsigned int size);
int N;
int main() {
N = __VERIFIER_nondet_int();
if (N <= 0) {
return 1;
}
assume_abort_if_not(N <= 2147483647 / sizeof(int));
int i;
int sum[1];
int *a = malloc(sizeof(int) * N);
sum[0] = 0;
for (i = 0; i < N; i++) {
sum[0] = sum[0] + 1;
}
for (i = 0; i < N; i++) {
a[i] = sum[0] % N;
}
for (i = 0; i < N; i++) {
__VERIFIER_assert(a[i] == 1);
}
return 1;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
void *malloc(unsigned int size);
int N;
int main()
{
N = __VERIFIER_nondet_int();
if (N <= 0)
{
return 1;
}
assume(N <= (2147483647 / (sizeof(int))));
int i;
int sum[1];
int *a = malloc((sizeof(int)) * N);
sum[0] = 0;
for (i = 0; i < N; i++)
{
;
sum[0] = sum[0] + 1;
}
for (i = 0; i < N; i++)
{
;
a[i] = sum[0] % N;
}
for (i = 0; i < N; i++)
{
;
assert(a[i] == 1);
}
return 1;
} | FALSE | [
4.51,
4.46,
4.12
] | 4.46 | void *malloc(unsigned int size);
int N;
int main()
{
N = (int) rand();
if (N <= 0)
{
return 1;
}
assume(N <= (2147483647 / (sizeof(int))));
int i;
int sum[1];
int *a = malloc((sizeof(int)) * N);
sum[0] = 0;
for (i = 0; i < N; i++)
{
INVARIANT_MARKER_1();
sum[0] = sum[0] + 1;
}
for (i = 0; i < N; i++)
{
INVARIANT_MARKER_2();
a[i] = sum[0] % N;
}
for (i = 0; i < N; i++)
{
INVARIANT_MARKER_3();
assert(a[i] == 1);
}
return 1;
} | easy |
50 | cohencu-ll_unwindbound2_8.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while (counter++ < 2) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(a * z - 6 * a - 2 * y + 2 * z - 10 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 2)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((a * z) - (6 * a)) - (2 * y)) + (2 * z)) - 10) == 0);
return 0;
} | FALSE | [
4.83,
5.49,
5.39
] | 5.39 | int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 2)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((a * z) - (6 * a)) - (2 * y)) + (2 * z)) - 10) == 0);
return 0;
} | easy |
51 | hard-u_valuebound1_4.c | /*
hardware integer division program, by Manna
returns q==A//B
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "hard-u.c", 8, "reach_error"); }
extern unsigned int __VERIFIER_nondet_uint(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
unsigned int A, B;
unsigned int r, d, p, q;
A = __VERIFIER_nondet_uint();
assume_abort_if_not(A >= 0 && A <= 1);
B = __VERIFIER_nondet_uint();
assume_abort_if_not(B >= 0 && B <= 1);
assume_abort_if_not(B >= 1);
r = A;
d = B;
p = 1;
q = 0;
while (1) {
if (!(r >= d)) {
break;
}
d = 2 * d;
p = 2 * p;
}
while (1) {
__VERIFIER_assert(A == q * B + r);
if (!(p != 1)) {
break;
}
d = d / 2;
p = p / 2;
if (r >= d) {
r = r - d;
q = q + p;
}
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
unsigned int A;
unsigned int B;
unsigned int r;
unsigned int d;
unsigned int p;
unsigned int q;
A = __VERIFIER_nondet_uint();
assume((A >= 0) && (A <= 1));
B = __VERIFIER_nondet_uint();
assume((B >= 0) && (B <= 1));
assume(B >= 1);
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
;
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
;
assert(A == ((q * B) + r));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | TRUE | [
137.52,
84.43,
112.25
] | 112.25 | int main()
{
unsigned int A;
unsigned int B;
unsigned int r;
unsigned int d;
unsigned int p;
unsigned int q;
A = (unsigned int) rand();
assume((A >= 0) && (A <= 1));
B = (unsigned int) rand();
assume((B >= 0) && (B <= 1));
assume(B >= 1);
r = A;
d = B;
p = 1;
q = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(r >= d))
{
break;
}
d = 2 * d;
p = 2 * p;
}
while (1)
{
INVARIANT_MARKER_2();
assert(A == ((q * B) + r));
if (!(p != 1))
{
break;
}
d = d / 2;
p = p / 2;
if (r >= d)
{
r = r - d;
q = q + p;
}
}
return 0;
} | hard |
52 | sll-buckets-2_3.c | extern void abort(void);
#include <assert.h>
void reach_error() { assert(0); }
typedef struct TSLL {
struct TSLL *next;
int data;
} SLL;
typedef struct TBCK {
struct TBCK *next;
SLL *list;
int data;
} BCK;
int main() {
// create the head
BCK *bucket = malloc(sizeof(BCK));
bucket->data = 0;
bucket->list = NULL;
bucket->next = malloc(sizeof(BCK));
BCK *bcki = bucket->next;
bcki->data = 1;
bcki->list = NULL;
bcki->next = malloc(sizeof(BCK));
bcki = bcki->next;
bcki->data = 2;
bcki->list = NULL;
bcki->next = NULL;
struct TSLL *item = NULL;
struct TSLL *itr = NULL;
while (__VERIFIER_nondet_int()) {
item = malloc(sizeof(SLL));
item->next = NULL;
if (__VERIFIER_nondet_int()) {
item->data = 0;
} else if (__VERIFIER_nondet_int()) {
item->data = 1;
} else {
item->data = 2;
}
bcki = bucket;
__VERIFIER_assert(item != NULL);
while (bcki->data != item->data) {
bcki = bcki->next;
}
if (bcki->list == NULL) {
bcki->list = item;
} else {
itr = bcki->list;
while (itr->next != NULL) {
itr = itr->next;
}
itr->next = item;
}
}
bcki = bucket;
while (bcki != NULL) {
item = bcki->list;
bcki->list = NULL;
while (item != NULL) {
itr = item;
item = item->next;
free(itr);
}
bucket = bcki;
bcki = bcki->next;
free(bucket);
bucket = NULL;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
typedef struct TSLL
{
struct TSLL *next;
int data;
} SLL;
typedef struct TBCK
{
struct TBCK *next;
SLL *list;
int data;
} BCK;
int main()
{
BCK *bucket = malloc(sizeof(BCK));
bucket->data = 0;
bucket->list = NULL;
bucket->next = malloc(sizeof(BCK));
BCK *bcki = bucket->next;
bcki->data = 1;
bcki->list = NULL;
bcki->next = malloc(sizeof(BCK));
bcki = bcki->next;
bcki->data = 2;
bcki->list = NULL;
bcki->next = NULL;
struct TSLL *item = NULL;
struct TSLL *itr = NULL;
while (__VERIFIER_nondet_int())
{
;
item = malloc(sizeof(SLL));
item->next = NULL;
if (__VERIFIER_nondet_int())
{
item->data = 0;
}
else
if (__VERIFIER_nondet_int())
{
item->data = 1;
}
else
{
item->data = 2;
}
bcki = bucket;
assert(item != NULL);
while (bcki->data != item->data)
{
;
bcki = bcki->next;
}
if (bcki->list == NULL)
{
bcki->list = item;
}
else
{
itr = bcki->list;
while (itr->next != NULL)
{
;
itr = itr->next;
}
itr->next = item;
}
}
bcki = bucket;
while (bcki != NULL)
{
;
item = bcki->list;
bcki->list = NULL;
while (item != NULL)
{
;
itr = item;
item = item->next;
free(itr);
}
bucket = bcki;
bcki = bcki->next;
free(bucket);
bucket = NULL;
}
return 0;
} | TRUE | [
4.2,
4.6,
4.38
] | 4.38 | typedef struct TSLL
{
struct TSLL *next;
int data;
} SLL;
typedef struct TBCK
{
struct TBCK *next;
SLL *list;
int data;
} BCK;
int main()
{
BCK *bucket = malloc(sizeof(BCK));
bucket->data = 0;
bucket->list = NULL;
bucket->next = malloc(sizeof(BCK));
BCK *bcki = bucket->next;
bcki->data = 1;
bcki->list = NULL;
bcki->next = malloc(sizeof(BCK));
bcki = bcki->next;
bcki->data = 2;
bcki->list = NULL;
bcki->next = NULL;
struct TSLL *item = NULL;
struct TSLL *itr = NULL;
while ((int) rand())
{
INVARIANT_MARKER_1();
item = malloc(sizeof(SLL));
item->next = NULL;
if ((int) rand())
{
item->data = 0;
}
else
if ((int) rand())
{
item->data = 1;
}
else
{
item->data = 2;
}
bcki = bucket;
assert(item != NULL);
while (bcki->data != item->data)
{
INVARIANT_MARKER_2();
bcki = bcki->next;
}
if (bcki->list == NULL)
{
bcki->list = item;
}
else
{
itr = bcki->list;
while (itr->next != NULL)
{
INVARIANT_MARKER_3();
itr = itr->next;
}
itr->next = item;
}
}
bcki = bucket;
while (bcki != NULL)
{
INVARIANT_MARKER_4();
item = bcki->list;
bcki->list = NULL;
while (item != NULL)
{
INVARIANT_MARKER_5();
itr = item;
item = item->next;
free(itr);
}
bucket = bcki;
bcki = bcki->next;
free(bucket);
bucket = NULL;
}
return 0;
} | easy |
53 | diamond_1-1_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "diamond_1-1.c", 3, "reach_error"); }
extern unsigned int __VERIFIER_nondet_uint(void);
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
return;
}
int main(void) {
unsigned int x = 0;
unsigned int y = __VERIFIER_nondet_uint();
while (x < 99) {
if (y % 2 == 0) {
x += 2;
} else {
x++;
}
}
__VERIFIER_assert((x % 2) == (y % 2));
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main(void)
{
unsigned int x = 0;
unsigned int y = __VERIFIER_nondet_uint();
while (x < 99)
{
;
if ((y % 2) == 0)
{
x += 2;
}
else
{
x++;
}
}
assert((x % 2) == (y % 2));
} | TRUE | [
15.1,
15.48,
15.54
] | 15.48 | int main(void)
{
unsigned int x = 0;
unsigned int y = (unsigned int) rand();
while (x < 99)
{
INVARIANT_MARKER_1();
if ((y % 2) == 0)
{
x += 2;
}
else
{
x++;
}
}
assert((x % 2) == (y % 2));
} | easy |
54 | sqrt1-ll_valuebound50_5.c | /* Compute the floor of the square root of a natural number */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "sqrt1-ll.c", 5, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int n;
long long a, s, t;
n = __VERIFIER_nondet_int();
assume_abort_if_not(n >= 0 && n <= 50);
a = 0;
s = 1;
t = 1;
while (1) {
// the above 2 should be equiv to
if (!(s <= n)) {
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
__VERIFIER_assert(s == (a + 1) * (a + 1));
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int n;
long long a;
long long s;
long long t;
n = __VERIFIER_nondet_int();
assume((n >= 0) && (n <= 50));
a = 0;
s = 1;
t = 1;
while (1)
{
;
if (!(s <= n))
{
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
assert(s == ((a + 1) * (a + 1)));
return 0;
} | TRUE | [
4.35,
4.42,
4.65
] | 4.42 | int main()
{
int n;
long long a;
long long s;
long long t;
n = (int) rand();
assume((n >= 0) && (n <= 50));
a = 0;
s = 1;
t = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(s <= n))
{
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
assert(s == ((a + 1) * (a + 1)));
return 0;
} | easy |
55 | freire2_valuebound10_6.c | /* Algorithm for finding the closet integer to cubic root
* more details, see : http://www.pedrofreire.com/sqrt/sqrt1.en.html
Note: for some reason using cpa was able to disprove these
cpa.sh -kInduction -setprop solver.solver=z3 freire2.c
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "freire2.c", 10, "reach_error"); }
extern double __VERIFIER_nondet_double(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int r;
double a, x, s;
a = __VERIFIER_nondet_double();
assume_abort_if_not(a >= 0 && a <= 10);
x = a;
s = 3.25;
r = 1;
while (1) {
if (!(x - s > 0.0)) {
break;
}
x = x - s;
s = s + 6 * r + 3;
r = r + 1;
}
__VERIFIER_assert((int)(8 * r * s - 24 * a + 16 * r - 12 * s + 24 * x - 3 == 0));
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int r;
double a;
double x;
double s;
a = __VERIFIER_nondet_double();
assume((a >= 0) && (a <= 10));
x = a;
s = 3.25;
r = 1;
while (1)
{
;
if (!((x - s) > 0.0))
{
break;
}
x = x - s;
s = (s + (6 * r)) + 3;
r = r + 1;
}
assert((int) ((((((((8 * r) * s) - (24 * a)) + (16 * r)) - (12 * s)) + (24 * x)) - 3) == 0));
return 0;
} | FALSE | [
21.57,
22.43,
22.06
] | 22.06 | int main()
{
int r;
double a;
double x;
double s;
a = (double) rand();
assume((a >= 0) && (a <= 10));
x = a;
s = 3.25;
r = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!((x - s) > 0.0))
{
break;
}
x = x - s;
s = (s + (6 * r)) + 3;
r = r + 1;
}
assert((int) ((((((((8 * r) * s) - (24 * a)) + (16 * r)) - (12 * s)) + (24 * x)) - 3) == 0));
return 0;
} | easy |
56 | cohendiv-ll_unwindbound10_5.c | /*
Cohen's integer division
returns x % y
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohendiv.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohendiv-ll.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long q, r, a, b;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 1);
q = 0;
r = x;
a = 0;
b = 0;
while (counter++ < 10) {
if (!(r >= y)) {
break;
}
a = 1;
b = y;
while (counter++ < 10) {
__VERIFIER_assert(r >= 0);
if (!(r >= 2 * b)) {
break;
}
a = 2 * a;
b = 2 * b;
}
r = r - b;
q = q + a;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long q;
long long r;
long long a;
long long b;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(y >= 1);
q = 0;
r = x;
a = 0;
b = 0;
while ((counter++) < 10)
{
;
if (!(r >= y))
{
break;
}
a = 1;
b = y;
while ((counter++) < 10)
{
;
assert(r >= 0);
if (!(r >= (2 * b)))
{
break;
}
a = 2 * a;
b = 2 * b;
}
r = r - b;
q = q + a;
}
return 0;
} | TRUE | [
4.36,
4.29,
3.95
] | 4.29 | int counter = 0;
int main()
{
int x;
int y;
long long q;
long long r;
long long a;
long long b;
x = (int) rand();
y = (int) rand();
assume(y >= 1);
q = 0;
r = x;
a = 0;
b = 0;
while ((counter++) < 10)
{
INVARIANT_MARKER_1();
if (!(r >= y))
{
break;
}
a = 1;
b = y;
while ((counter++) < 10)
{
INVARIANT_MARKER_2();
assert(r >= 0);
if (!(r >= (2 * b)))
{
break;
}
a = 2 * a;
b = 2 * b;
}
r = r - b;
q = q + a;
}
return 0;
} | easy |
57 | ps4-ll_valuebound20_2.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps4-ll.c", 3, "reach_error"); }
extern short __VERIFIER_nondet_short(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short k;
long long y, x, c;
k = __VERIFIER_nondet_short();
assume_abort_if_not(k >= 0 && k <= 20);
y = 0;
x = 0;
c = 0;
while (1) {
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y * y * y + x;
}
__VERIFIER_assert(k * y - (y * y) == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_short();
assume((k >= 0) && (k <= 20));
y = 0;
x = 0;
c = 0;
while (1)
{
;
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
assert(((k * y) - (y * y)) == 0);
return 0;
} | TRUE | [
5.17,
4.74,
4.88
] | 4.88 | int main()
{
short k;
long long y;
long long x;
long long c;
k = (short) rand();
assume((k >= 0) && (k <= 20));
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
assert(((k * y) - (y * y)) == 0);
return 0;
} | easy |
58 | egcd3-ll_valuebound1_5.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd3-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int x, y;
long long a, b, p, q, r, s;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 1);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 1);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1) {
if (!(b != 0)) {
break;
}
long long c, k;
c = a;
k = 0;
while (1) {
if (!(c >= b)) {
break;
}
long long d, v;
d = 1;
v = b;
while (1) {
if (!(c >= 2 * v)) {
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
__VERIFIER_assert(p * x - q * x + r * y - s * y == a);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 1));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 1));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
;
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while (1)
{
;
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while (1)
{
;
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
assert(((((p * x) - (q * x)) + (r * y)) - (s * y)) == a);
return 0;
} | TRUE | [
7.95,
7.89,
7.88
] | 7.89 | int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = (int) rand();
assume((x >= 0) && (x <= 1));
y = (int) rand();
assume((y >= 0) && (y <= 1));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while (1)
{
INVARIANT_MARKER_2();
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while (1)
{
INVARIANT_MARKER_3();
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
assert(((((p * x) - (q * x)) + (r * y)) - (s * y)) == a);
return 0;
} | easy |
59 | egcd3-ll_unwindbound10_1.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd3-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long a, b, p, q, r, s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 10) {
if (!(b != 0)) {
break;
}
long long c, k;
c = a;
k = 0;
while (counter++ < 10) {
if (!(c >= b)) {
break;
}
long long d, v;
d = 1;
v = b;
while (counter++ < 10) {
__VERIFIER_assert(a == y * r + x * p);
if (!(c >= 2 * v)) {
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
;
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 10)
{
;
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 10)
{
;
assert(a == ((y * r) + (x * p)));
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return 0;
} | TRUE | [
12.05,
12.58,
12.97
] | 12.58 | int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 10)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 10)
{
INVARIANT_MARKER_2();
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 10)
{
INVARIANT_MARKER_3();
assert(a == ((y * r) + (x * p)));
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return 0;
} | easy |
60 | ps2-ll_valuebound10_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps2-ll.c", 3, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int k;
long long y, x, c;
k = __VERIFIER_nondet_int();
assume_abort_if_not(k >= 0 && k <= 10);
y = 0;
x = 0;
c = 0;
while (1) {
__VERIFIER_assert((y * y) - 2 * x + y == 0);
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y + x;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_int();
assume((k >= 0) && (k <= 10));
y = 0;
x = 0;
c = 0;
while (1)
{
;
assert((((y * y) - (2 * x)) + y) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = y + x;
}
return 0;
} | TRUE | [
4.33,
4.31,
4.37
] | 4.33 | int main()
{
int k;
long long y;
long long x;
long long c;
k = (int) rand();
assume((k >= 0) && (k <= 10));
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
assert((((y * y) - (2 * x)) + y) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = y + x;
}
return 0;
} | easy |
61 | prod4br-ll_unwindbound5_2.c | /* algorithm for computing the product of two natural numbers */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "prod4br-ll.c", 5, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long a, b, p, q;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
while (counter++ < 5) {
if (!(a != 0 && b != 0)) {
break;
}
if (a % 2 == 0 && b % 2 == 0) {
a = a / 2;
b = b / 2;
p = 4 * p;
} else if (a % 2 == 1 && b % 2 == 0) {
a = a - 1;
q = q + b * p;
} else if (a % 2 == 0 && b % 2 == 1) {
b = b - 1;
q = q + a * p;
} else {
a = a - 1;
b = b - 1;
q = q + (a + b + 1) * p; /*fix a bug here--- was (a+b-1)*/
}
}
__VERIFIER_assert(q == (long long)x * y);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
while ((counter++) < 5)
{
;
if (!((a != 0) && (b != 0)))
{
break;
}
if (((a % 2) == 0) && ((b % 2) == 0))
{
a = a / 2;
b = b / 2;
p = 4 * p;
}
else
if (((a % 2) == 1) && ((b % 2) == 0))
{
a = a - 1;
q = q + (b * p);
}
else
if (((a % 2) == 0) && ((b % 2) == 1))
{
b = b - 1;
q = q + (a * p);
}
else
{
a = a - 1;
b = b - 1;
q = q + (((a + b) + 1) * p);
}
}
assert(q == (((long long) x) * y));
return 0;
} | FALSE | [
32.13,
31.93,
31.95
] | 31.95 | int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
x = (int) rand();
y = (int) rand();
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
if (!((a != 0) && (b != 0)))
{
break;
}
if (((a % 2) == 0) && ((b % 2) == 0))
{
a = a / 2;
b = b / 2;
p = 4 * p;
}
else
if (((a % 2) == 1) && ((b % 2) == 0))
{
a = a - 1;
q = q + (b * p);
}
else
if (((a % 2) == 0) && ((b % 2) == 1))
{
b = b - 1;
q = q + (a * p);
}
else
{
a = a - 1;
b = b - 1;
q = q + (((a + b) + 1) * p);
}
}
assert(q == (((long long) x) * y));
return 0;
} | hard |
62 | functions_1-1_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "functions_1-1.c", 3, "reach_error"); }
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : {
reach_error();
abort();
}
}
return;
}
unsigned int f(unsigned int z) { return z + 2; }
int main(void) {
unsigned int x = 0;
while (x < 0x0fffffff) {
x = f(x);
}
__VERIFIER_assert(!(x % 2));
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
unsigned int f(unsigned int z)
{
return z + 2;
}
int main(void)
{
unsigned int x = 0;
while (x < 0x0fffffff)
{
;
x = f(x);
}
assert(!(x % 2));
} | TRUE | [
4.66,
4.46,
4.47
] | 4.47 | unsigned int f(unsigned int z)
{
return z + 2;
}
int main(void)
{
unsigned int x = 0;
while (x < 0x0fffffff)
{
INVARIANT_MARKER_1();
x = f(x);
}
assert(!(x % 2));
} | easy |
63 | cohencu-ll_valuebound10_9.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
assume_abort_if_not(a >= 0 && a <= 10);
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(2 * y * y - 3 * x * z - 18 * x - 10 * y + 3 * z - 10 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
assume((a >= 0) && (a <= 10));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((((2 * y) * y) - ((3 * x) * z)) - (18 * x)) - (10 * y)) + (3 * z)) - 10) == 0);
return 0;
} | TRUE | [
39.57,
39.49,
40.06
] | 39.57 | int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
assume((a >= 0) && (a <= 10));
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((((2 * y) * y) - ((3 * x) * z)) - (18 * x)) - (10 * y)) + (3 * z)) - 10) == 0);
return 0;
} | hard |
64 | cohencu_10.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int a, n, x, y, z;
a = __VERIFIER_nondet_int();
n = 0;
x = 0;
y = 1;
z = 6;
while (1) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(z * z - 12 * y - 6 * z + 12 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int a;
int n;
int x;
int y;
int z;
a = __VERIFIER_nondet_int();
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((z * z) - (12 * y)) - (6 * z)) + 12) == 0);
return 0;
} | TRUE | [
4.73,
4.24,
4.25
] | 4.25 | int main()
{
int a;
int n;
int x;
int y;
int z;
a = (int) rand();
n = 0;
x = 0;
y = 1;
z = 6;
while (1)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert(((((z * z) - (12 * y)) - (6 * z)) + 12) == 0);
return 0;
} | easy |
65 | cohencu-ll_unwindbound5_9.c | /*
Printing consecutive cubes, by Cohen
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohencu.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohencu-ll.c", 8, "reach_error"); }
extern unsigned short __VERIFIER_nondet_ushort(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
short a;
long long n, x, y, z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while (counter++ < 5) {
if (!(n <= a)) {
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
__VERIFIER_assert(2 * y * y - 3 * x * z - 18 * x - 10 * y + 3 * z - 10 == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = __VERIFIER_nondet_ushort();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 5)
{
;
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((((2 * y) * y) - ((3 * x) * z)) - (18 * x)) - (10 * y)) + (3 * z)) - 10) == 0);
return 0;
} | TRUE | [
18.65,
18.76,
18.66
] | 18.66 | int counter = 0;
int main()
{
short a;
long long n;
long long x;
long long y;
long long z;
a = (ushort) rand();
n = 0;
x = 0;
y = 1;
z = 6;
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
if (!(n <= a))
{
break;
}
n = n + 1;
x = x + y;
y = y + z;
z = z + 6;
}
assert((((((((2 * y) * y) - ((3 * x) * z)) - (18 * x)) - (10 * y)) + (3 * z)) - 10) == 0);
return 0;
} | easy |
66 | egcd3-ll_unwindbound5_4.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd3-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long a, b, p, q, r, s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (counter++ < 5) {
if (!(b != 0)) {
break;
}
long long c, k;
c = a;
k = 0;
while (counter++ < 5) {
if (!(c >= b)) {
break;
}
long long d, v;
d = 1;
v = b;
while (counter++ < 5) {
__VERIFIER_assert(v == b * d);
if (!(c >= 2 * v)) {
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 5)
{
;
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 5)
{
;
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 5)
{
;
assert(v == (b * d));
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return 0;
} | TRUE | [
4.6,
4.78,
4.59
] | 4.6 | int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
long long c;
long long k;
c = a;
k = 0;
while ((counter++) < 5)
{
INVARIANT_MARKER_2();
if (!(c >= b))
{
break;
}
long long d;
long long v;
d = 1;
v = b;
while ((counter++) < 5)
{
INVARIANT_MARKER_3();
assert(v == (b * d));
if (!(c >= (2 * v)))
{
break;
}
d = 2 * d;
v = 2 * v;
}
c = c - v;
k = k + d;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return 0;
} | easy |
67 | ps4-ll_valuebound1_1.c | extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "ps4-ll.c", 3, "reach_error"); }
extern short __VERIFIER_nondet_short(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
short k;
long long y, x, c;
k = __VERIFIER_nondet_short();
assume_abort_if_not(k >= 0 && k <= 1);
y = 0;
x = 0;
c = 0;
while (1) {
__VERIFIER_assert(4 * x - y * y * y * y - 2 * y * y * y - y * y == 0);
if (!(c < k)) {
break;
}
c = c + 1;
y = y + 1;
x = y * y * y + x;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
short k;
long long y;
long long x;
long long c;
k = __VERIFIER_nondet_short();
assume((k >= 0) && (k <= 1));
y = 0;
x = 0;
c = 0;
while (1)
{
;
assert(((((4 * x) - (((y * y) * y) * y)) - (((2 * y) * y) * y)) - (y * y)) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
return 0;
} | TRUE | [
4.8,
4.86,
5.14
] | 4.86 | int main()
{
short k;
long long y;
long long x;
long long c;
k = (short) rand();
assume((k >= 0) && (k <= 1));
y = 0;
x = 0;
c = 0;
while (1)
{
INVARIANT_MARKER_1();
assert(((((4 * x) - (((y * y) * y) * y)) - (((2 * y) * y) * y)) - (y * y)) == 0);
if (!(c < k))
{
break;
}
c = c + 1;
y = y + 1;
x = ((y * y) * y) + x;
}
return 0;
} | easy |
68 | benchmark46_disjunctive_1.c | #include <assert.h>
void reach_error(void) { assert(0); }
extern int __VERIFIER_nondet_int(void);
extern _Bool __VERIFIER_nondet_bool(void);
void __VERIFIER_assert(int cond) {
if (!cond) {
reach_error();
}
}
/* 46.cfg:
names= x y z
precondition= y>0 || x>0 || z>0
loopcondition=
#loop=if (x>0) x++; else x--; x=-1 * x;
branchcondition=x>0
branch=x++;
branchcondition=y>0
branch=y++;
branchcondition=
branch=z++;
postcondition=x>0 || y>0 || z>0
learners=linear disjunctive
*/
int main() {
int x = __VERIFIER_nondet_int();
int y = __VERIFIER_nondet_int();
int z = __VERIFIER_nondet_int();
if (!(y > 0 || x > 0 || z > 0)) {
return 0;
}
while (__VERIFIER_nondet_bool()) {
if (x > 0) {
x++;
}
if (y > 0) {
y++;
} else {
z++;
}
}
__VERIFIER_assert(x > 0 || y > 0 || z > 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int x = __VERIFIER_nondet_int();
int y = __VERIFIER_nondet_int();
int z = __VERIFIER_nondet_int();
if (!(((y > 0) || (x > 0)) || (z > 0)))
{
return 0;
}
while (__VERIFIER_nondet_bool())
{
;
if (x > 0)
{
x++;
}
if (y > 0)
{
y++;
}
else
{
z++;
}
}
assert(((x > 0) || (y > 0)) || (z > 0));
return 0;
} | TRUE | [
3.77,
3.75,
4.18
] | 3.77 | int main()
{
int x = (int) rand();
int y = (int) rand();
int z = (int) rand();
if (!(((y > 0) || (x > 0)) || (z > 0)))
{
return 0;
}
while ((bool) rand())
{
INVARIANT_MARKER_1();
if (x > 0)
{
x++;
}
if (y > 0)
{
y++;
}
else
{
z++;
}
}
assert(((x > 0) || (y > 0)) || (z > 0));
return 0;
} | easy |
69 | egcd2-ll_unwindbound5_2.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd2-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long a, b, p, q, r, s, c, k, xy, yy;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
c = 0;
k = 0;
xy = (long long)x * y;
yy = (long long)y * y;
assume_abort_if_not(xy < 2147483647);
assume_abort_if_not(yy < 2147483647);
while (counter++ < 5) {
if (!(b != 0)) {
break;
}
c = a;
k = 0;
while (counter++ < 5) {
__VERIFIER_assert(a == y * r + x * p);
if (!(c >= b)) {
break;
}
c = c - b;
k = k + 1;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - q * k;
temp = r;
r = s;
s = temp - s * k;
}
return a;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
long long c;
long long k;
long long xy;
long long yy;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
c = 0;
k = 0;
xy = ((long long) x) * y;
yy = ((long long) y) * y;
assume(xy < 2147483647);
assume(yy < 2147483647);
while ((counter++) < 5)
{
;
if (!(b != 0))
{
break;
}
c = a;
k = 0;
while ((counter++) < 5)
{
;
assert(a == ((y * r) + (x * p)));
if (!(c >= b))
{
break;
}
c = c - b;
k = k + 1;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return a;
} | TRUE | [
6.75,
6.83,
6.51
] | 6.75 | int counter = 0;
int main()
{
int x;
int y;
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
long long c;
long long k;
long long xy;
long long yy;
x = (int) rand();
y = (int) rand();
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
c = 0;
k = 0;
xy = ((long long) x) * y;
yy = ((long long) y) * y;
assume(xy < 2147483647);
assume(yy < 2147483647);
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
if (!(b != 0))
{
break;
}
c = a;
k = 0;
while ((counter++) < 5)
{
INVARIANT_MARKER_2();
assert(a == ((y * r) + (x * p)));
if (!(c >= b))
{
break;
}
c = c - b;
k = k + 1;
}
a = b;
b = c;
long long temp;
temp = p;
p = q;
q = temp - (q * k);
temp = r;
r = s;
s = temp - (s * k);
}
return a;
} | easy |
70 | egcd-ll_valuebound5_7.c | /* extended Euclid's algorithm */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "egcd-ll.c", 4, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
long long a, b, p, q, r, s;
int x, y;
x = __VERIFIER_nondet_int();
assume_abort_if_not(x >= 0 && x <= 5);
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 0 && y <= 5);
assume_abort_if_not(x >= 1);
assume_abort_if_not(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1) {
if (!(a != b)) {
break;
}
if (a > b) {
a = a - b;
p = p - q;
r = r - s;
} else {
b = b - a;
q = q - p;
s = s - r;
}
}
__VERIFIER_assert(q * x + s * y - b == 0);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = __VERIFIER_nondet_int();
assume((x >= 0) && (x <= 5));
y = __VERIFIER_nondet_int();
assume((y >= 0) && (y <= 5));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
;
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((q * x) + (s * y)) - b) == 0);
return 0;
} | TRUE | [
16.14,
15.53,
16.17
] | 16.14 | int main()
{
long long a;
long long b;
long long p;
long long q;
long long r;
long long s;
int x;
int y;
x = (int) rand();
assume((x >= 0) && (x <= 5));
y = (int) rand();
assume((y >= 0) && (y <= 5));
assume(x >= 1);
assume(y >= 1);
a = x;
b = y;
p = 1;
q = 0;
r = 0;
s = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(a != b))
{
break;
}
if (a > b)
{
a = a - b;
p = p - q;
r = r - s;
}
else
{
b = b - a;
q = q - p;
s = s - r;
}
}
assert((((q * x) + (s * y)) - b) == 0);
return 0;
} | easy |
71 | cohendiv-ll_unwindbound5_4.c | /*
Cohen's integer division
returns x % y
http://www.cs.upc.edu/~erodri/webpage/polynomial_invariants/cohendiv.htm
*/
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int,
const char *) __attribute__((__nothrow__, __leaf__))
__attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "cohendiv-ll.c", 8, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int counter = 0;
int main() {
int x, y;
long long q, r, a, b;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume_abort_if_not(y >= 1);
q = 0;
r = x;
a = 0;
b = 0;
while (counter++ < 5) {
if (!(r >= y)) {
break;
}
a = 1;
b = y;
while (counter++ < 5) {
__VERIFIER_assert(x == q * y + r);
if (!(r >= 2 * b)) {
break;
}
a = 2 * a;
b = 2 * b;
}
r = r - b;
q = q + a;
}
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int counter = 0;
int main()
{
int x;
int y;
long long q;
long long r;
long long a;
long long b;
x = __VERIFIER_nondet_int();
y = __VERIFIER_nondet_int();
assume(y >= 1);
q = 0;
r = x;
a = 0;
b = 0;
while ((counter++) < 5)
{
;
if (!(r >= y))
{
break;
}
a = 1;
b = y;
while ((counter++) < 5)
{
;
assert(x == ((q * y) + r));
if (!(r >= (2 * b)))
{
break;
}
a = 2 * a;
b = 2 * b;
}
r = r - b;
q = q + a;
}
return 0;
} | TRUE | [
8.62,
6.96,
6.95
] | 6.96 | int counter = 0;
int main()
{
int x;
int y;
long long q;
long long r;
long long a;
long long b;
x = (int) rand();
y = (int) rand();
assume(y >= 1);
q = 0;
r = x;
a = 0;
b = 0;
while ((counter++) < 5)
{
INVARIANT_MARKER_1();
if (!(r >= y))
{
break;
}
a = 1;
b = y;
while ((counter++) < 5)
{
INVARIANT_MARKER_2();
assert(x == ((q * y) + r));
if (!(r >= (2 * b)))
{
break;
}
a = 2 * a;
b = 2 * b;
}
r = r - b;
q = q + a;
}
return 0;
} | easy |
72 | sqrt1-ll_valuebound50_4.c | /* Compute the floor of the square root of a natural number */
extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__((__nothrow__, __leaf__)) __attribute__((__noreturn__));
void reach_error() { __assert_fail("0", "sqrt1-ll.c", 5, "reach_error"); }
extern int __VERIFIER_nondet_int(void);
extern void abort(void);
void assume_abort_if_not(int cond) {
if (!cond) {
abort();
}
}
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR : { reach_error(); }
}
return;
}
int main() {
int n;
long long a, s, t;
n = __VERIFIER_nondet_int();
assume_abort_if_not(n >= 0 && n <= 50);
a = 0;
s = 1;
t = 1;
while (1) {
// the above 2 should be equiv to
if (!(s <= n)) {
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
__VERIFIER_assert(t == 2 * a + 1);
return 0;
} | void assert(int cond) { if (!(cond)) { ERROR : { reach_error(); abort(); } } }
void assume(int cond) { if (!cond) { abort(); } }
int main()
{
int n;
long long a;
long long s;
long long t;
n = __VERIFIER_nondet_int();
assume((n >= 0) && (n <= 50));
a = 0;
s = 1;
t = 1;
while (1)
{
;
if (!(s <= n))
{
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
assert(t == ((2 * a) + 1));
return 0;
} | TRUE | [
4.7,
4.53,
3.79
] | 4.53 | int main()
{
int n;
long long a;
long long s;
long long t;
n = (int) rand();
assume((n >= 0) && (n <= 50));
a = 0;
s = 1;
t = 1;
while (1)
{
INVARIANT_MARKER_1();
if (!(s <= n))
{
break;
}
a = a + 1;
t = t + 2;
s = s + t;
}
assert(t == ((2 * a) + 1));
return 0;
} | easy |