1;;! target = "x86_64" 2 3(module 4 ;; Iterative factorial without locals. 5 (func $pick0 (param i64) (result i64 i64) 6 (local.get 0) (local.get 0) 7 ) 8 (func $pick1 (param i64 i64) (result i64 i64 i64) 9 (local.get 0) (local.get 1) (local.get 0) 10 ) 11 (func (export "fac-ssa") (param i64) (result i64) 12 (i64.const 1) (local.get 0) 13 (loop $l (param i64 i64) (result i64) 14 (call $pick1) (call $pick1) (i64.mul) 15 (call $pick1) (i64.const 1) (i64.sub) 16 (call $pick0) (i64.const 0) (i64.gt_u) 17 (br_if $l) 18 (drop) (return) 19 ) 20 ) 21) 22 23;; function u0:0(i64 vmctx, i64, i64) -> i64, i64 tail { 24;; gv0 = vmctx 25;; gv1 = load.i64 notrap aligned readonly gv0+8 26;; gv2 = load.i64 notrap aligned gv1+24 27;; stack_limit = gv2 28;; 29;; block0(v0: i64, v1: i64, v2: i64): 30;; @0040 jump block1 31;; 32;; block1: 33;; @0040 return v2, v2 34;; } 35;; 36;; function u0:1(i64 vmctx, i64, i64, i64) -> i64, i64, i64 tail { 37;; gv0 = vmctx 38;; gv1 = load.i64 notrap aligned readonly gv0+8 39;; gv2 = load.i64 notrap aligned gv1+24 40;; stack_limit = gv2 41;; 42;; block0(v0: i64, v1: i64, v2: i64, v3: i64): 43;; @0049 jump block1 44;; 45;; block1: 46;; @0049 return v2, v3, v2 47;; } 48;; 49;; function u0:2(i64 vmctx, i64, i64) -> i64 tail { 50;; gv0 = vmctx 51;; gv1 = load.i64 notrap aligned readonly gv0+8 52;; gv2 = load.i64 notrap aligned gv1+24 53;; sig0 = (i64 vmctx, i64, i64, i64) -> i64, i64, i64 tail 54;; sig1 = (i64 vmctx, i64, i64) -> i64, i64 tail 55;; fn0 = colocated u0:1 sig0 56;; fn1 = colocated u0:0 sig1 57;; stack_limit = gv2 58;; 59;; block0(v0: i64, v1: i64, v2: i64): 60;; @004c v4 = iconst.i64 1 61;; @0050 jump block2(v4, v2) ; v4 = 1 62;; 63;; block2(v5: i64, v6: i64): 64;; @0052 v8, v9, v10 = call fn0(v0, v0, v5, v6) 65;; @0054 v11, v12, v13 = call fn0(v0, v0, v9, v10) 66;; @0056 v14 = imul v12, v13 67;; @0057 v15, v16, v17 = call fn0(v0, v0, v11, v14) 68;; @0059 v18 = iconst.i64 1 69;; @005b v19 = isub v17, v18 ; v18 = 1 70;; @005c v20, v21 = call fn1(v0, v0, v19) 71;; @005e v22 = iconst.i64 0 72;; @0060 v23 = icmp ugt v21, v22 ; v22 = 0 73;; @0060 v24 = uextend.i32 v23 74;; @0061 brif v24, block2(v16, v20), block4 75;; 76;; block4: 77;; @0064 return v16 78;; } 79