projects
/
libfirm
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
- Normalized some testprograms so that they have a main function and main
[libfirm]
/
ir
/
be
/
test
/
fib.c
1
#include <stdio.h>
2
3
int b1, b2, b3;
4
5
unsigned fib(unsigned n)
6
{
7
if(n == 0) {
8
b1++;
9
return 0;
10
}
11
if(n == 1) {
12
b2++;
13
return 1;
14
}
15
16
b3++;
17
return fib(n-1) + fib(n-2);
18
}
19
20
int main(int argc, char** argv) {
21
unsigned n = 8;
22
if(argc > 1)
23
n = (unsigned) atoi(argv[1]);
24
25
b1 = b2 = b3 = 0;
26
printf("Fib %u: %u\n", n, fib(n));
27
printf("Branches: 1:%d 2:%d 3:%d\n", b1, b2, b3);
28
29
return 0;
30
}