(module $state (type $f (;0;) (func (param i32) (result i32))) (type $k (;1;) (cont $f)) (type (;2;) (func (result i32))) (type (;3;) (func (param i32 (ref $k)) (result i32))) (type (;4;) (func (result i32 (ref $k)))) (tag $get (;0;) (type 2) (result i32)) (tag $set (;1;) (type $f) (param i32) (result i32)) (export "run" (func 2)) (elem (;0;) declare func $f) (func $runner (;0;) (type 3) (param $s i32) (param $k (ref $k)) (result i32) loop $loop block $on_get (result (ref $k)) block $on_set (type 4) (result i32 (ref $k)) local.get $s local.get $k resume $k (on $get $on_get) (on $set $on_set) return end local.set $k local.set $s br $loop end local.set $k br $loop end unreachable ) (func $f (;1;) (type $f) (param i32) (result i32) i32.const 7 suspend $set drop suspend $get i32.const 2 i32.const 3 suspend $set suspend $get i32.add i32.mul i32.add ) (func (;2;) (type 2) (result i32) i32.const 0 ref.func $f cont.new $k call $runner ) )