// A function to hook: fib(n) the slow way, kept from being turned into a // loop so that it makes the 2 fib(n+1) - 1 calls the definition says. #include #include __attribute__((noinline, optnone)) static unsigned long fib(unsigned long n) { if (n < 2) return n; return fib(n - 1) + fib(n - 2); } int main(int argc, char **argv) { unsigned long n = argc > 1 ? strtoul(argv[1], NULL, 10) : 10; printf("fib(%lu) = %lu\n", n, fib(n)); return 0; }