//# publish module 0x42.Math { public sum_(n: u64, acc: u64): u64 { let new_n: u64; let new_acc: u64; let new_sum: u64; label b0: jump_if_false (copy(n) == 0) b2; label b1: return move(acc); label b2: new_n = copy(n) - 1; new_acc = move(acc) + move(n); new_sum = Self.sum_(move(new_n), move(new_acc)); return move(new_sum); } public sum(n: u64): u64 { let result: u64; label b0: result = Self.sum_(move(n), 0); return move(result); } } //# run import 0x42.Math; main() { let sum1: u64; let sum2: u64; label b0: sum1 = Math.sum(5); assert(move(sum1) == 15, 66); sum2 = Math.sum(7); assert(move(sum2) == 28, 67); return; }