const n:int = 100

fun f(a:int^n at r) returns (o:int^n at r)
let
  o = [a with [0] = 0]
tel

fun g () returns (o:int^n)
var x:int^n at r;
let
  init<<r>> x = 1^n;
  o = f(f(x))
tel

fun f2(u:int; a:int^n at r) returns (o:int^n at r)
let
  o = [a with [0] = u]
tel

fun lin_fold(a : int^3) returns (o:int^n)
var x:int^n at r;
let
  init<<r>> x = 1^n;
  o = fold<<3>> f2(a, f(f(x)));
tel

fun plus(a,b:int) returns (c:int)
let c = a + b tel

node main() returns (o:int^n)
var o1,o2:int^n;
let
  o1 = g();
  o2 = lin_fold([13,17,23]);
  o = map<<n>> plus(o1,o2);
tel
