from "./dep.zok" import dep as dep;

def local(field a) -> field { // this costs 3 constraints per call
    field res = a ** 8;
    return res; // currently expressions in the return statement don't get memoized
}

def main(field a) {
    // calling a local function many times with the same arg should cost only once
    assert(local(a) + local(a) + local(a) + local(a) + local(a) == 5 * (a ** 8));

    // calling an imported function many times with the same arg should cost only once
    assert(dep(a) + dep(a) + dep(a) + dep(a) + dep(a) == 5 * (a ** 4));

    return;
}