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