// Benchmark: Tail-recursive Fibonacci (measures TCO efficiency)
// Tests: Tail call optimization, accumulator pattern

fn fibTCO(n: Int, a: Int, b: Int): Int =
    if n <= 0 then a
    else fibTCO(n - 1, b, a + b)

fn fib(n: Int): Int = fibTCO(n, 0, 1)

// Calculate fib(100000) - many iterations, constant stack
let result = fib(100000)
