use std::thread;

#[no_mangle]
pub extern fn process(){
    let handles: Vec<_> = (0..10).map(|_| {
        thread::spawn(|| {
            let mut _x = 0;
            for _ in (0..10_000_001) {
                _x += 1
            }
        })
    }).collect();

    for h in handles {
        h.join()
            .ok()
            .expect("could not join a thread.");

    }
}


#[no_mangle]
pub extern fn fibonacci(x: i64) -> i64{
    if x <= 2 {
        return 1;
    } else {
        return fibonacci(x - 1) + fibonacci(x - 2);
    }
}

#[no_mangle]
pub extern fn iterative_fibonacci(x: i64) -> i64{
    if x <= 2 {
        return x
    }
    let mut fib_prev: i64 = 1;
        fib = fib + fib_prev;
        fib_prev = i;
    }
    return fib;

}
#[test]
fn process() {

}

#[test]
fn fibonacci() {

}

#[test]
fn iterative_fibonacci() {

}


// cargo build --release which builds with optimizations on.
// We want this to be as fast as possible!
// You can find the output of the library in target/release:
    let mut fib: i64 = 1;
    for _num in (0..x) {
        let i: i64 = fib;