/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>

#include "high_res_timer.h"

int fib(int n) {
    return n < 2 ? n : fib(n - 1) + fib(n - 2);
}

static const int REP = 5;

int main()
{
    printf("C:\n");
    for(int i = 0; i < REP; i++)
    {
        TIMECOUNT_T t0 = GET_TIMECOUNT;
        int ans = fib(45);
        TIMECOUNT_T t1 = GET_TIMECOUNT;
        printf("fib(45) = %d took %f seconds.\n", ans, (t1 - t0) * 1.0 / UNITS_PER_SECOND);
    }
    return 0;
}
