(module (type $0 (func (param i64) (result i64))) (export "fac-rec" (func $0)) (export "fac-rec-named" (func $1)) (export "fac-iter" (func $2)) (export "fac-iter-named" (func $3)) (export "fac-opt" (func $4)) (func $0 (param $0 i64) (result i64) (if (result i64) (i64.eqz (local.get $0) ) (then (i64.const 1) ) (else (i64.mul (call $0 (i64.sub (local.get $0) (i64.const 1) ) ) (local.get $0) ) ) ) ) (func $1 (param $0 i64) (result i64) (if (result i64) (i64.eqz (local.get $0) ) (then (i64.const 1) ) (else (i64.mul (call $1 (i64.sub (local.get $0) (i64.const 1) ) ) (local.get $0) ) ) ) ) (func $2 (param $0 i64) (result i64) (unreachable) ) (func $3 (param $0 i64) (result i64) (local $1 i64) (local.set $1 (i64.const 1) ) (loop $label (if (i32.eqz (i64.eqz (local.get $0) ) ) (then (local.set $1 (i64.mul (local.get $0) (local.get $1) ) ) (local.set $0 (i64.sub (local.get $0) (i64.const 1) ) ) (br $label) ) ) ) (local.get $1) ) (func $4 (param $0 i64) (result i64) (local $1 i64) (local.set $1 (i64.const 1) ) (if (i64.ge_s (local.get $0) (i64.const 2) ) (then (loop $label (local.set $1 (i64.mul (local.get $0) (local.get $1) ) ) (br_if $label (i64.gt_s (local.tee $0 (i64.sub (local.get $0) (i64.const 1) ) ) (i64.const 1) ) ) ) ) ) (local.get $1) ) )