-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFibonacci05.c
51 lines (42 loc) · 867 Bytes
/
Fibonacci05.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
The C* port of Fibonacci05.c from github.com/sosy-lab/sv-benchmarks
for any information about the LICENCE see github.com/sosy-lab/sv-benchmarks
termination : true
unreach-call: false
*/
void VERIFIER_error() {
uint64_t x;
x = 10 / 0;
}
uint64_t fibonacci(uint64_t n) {
if (n < 1) {
return 0;
} else if (n == 1) {
return 1;
} else {
return fibonacci(n-1) + fibonacci(n-2);
}
}
// fibo 1-30
// 1, 1, 2, 3, 5,
// 8, 13, 21, 34, 55,
// 89, 144, 233, 377, 610,
// 987, 1597, 2584, 4181, 6765,
// 10946, 17711, 28657, 46368, 75025,
// 121393, 196418, 317811, 514229, 832040
uint64_t main() {
uint64_t x;
uint64_t result;
interval(&x, 0, -1, 1);
if (x > 25)
return 0;
result = fibonacci(x);
if (x < 19) {
return 0;
} else if (result >= 6765) {
return 0;
} else {
VERIFIER_error();
}
return 0;
}