def down64
import bend-collections-laws-crypto@1.0.0.0/src/math/w64.bend as W64import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend as W
468def down64(fuel: Nat, +n: W.U64, +r: U32, over: Bool) -> U32:
469 match fuel over:
470 case 0n _:
471 r
472 case 1n+f False{}:
473 r
474 case 1n+f True{}:
475 down64(f, n, U32.sub(r, 1), sq_over(n, U32.sub(r, 1)))