(module $example (type $i-func (;0;) (func (param i32))) (type $i-cont (;1;) (cont $i-func)) (type $iii-fun (;2;) (func (param i32 i32 i32))) (type $iii-cont (;3;) (cont $iii-fun)) (type (;4;) (func)) (type (;5;) (func (param i32 i32))) (type (;6;) (func (param (ref $i-cont)) (result i32))) (type (;7;) (func (param i32) (result i32))) (import "async-await" "yield" (tag $yield (;0;) (type 4))) (import "async-await" "fulfill" (tag $fulfill (;1;) (type 5) (param i32 i32))) (import "async-await" "async" (tag $async (;2;) (type 6) (param (ref $i-cont)) (result i32))) (import "async-await" "await" (tag $await (;3;) (type 7) (param i32) (result i32))) (import "spectest" "print_i32" (func $log (;0;) (type $i-func))) (export "run" (func $run)) (elem (;0;) declare func $sum) (func $sum (;1;) (type $iii-fun) (param $i i32) (param $j i32) (param $p i32) (local $a i32) loop $l local.get $i call $log local.get $a local.get $i i32.add local.set $a local.get $i i32.const 1 i32.add local.set $i local.get $i local.get $j i32.le_u if ;; label = @2 suspend $yield br $l end end local.get $p local.get $a suspend $fulfill ) (func $run (;2;) (type 4) (local $p i32) (local $q i32) (local $r i32) (local $x i32) (local $y i32) i32.const -1 call $log i32.const 1 i32.const 3 ref.func $sum cont.new $iii-cont cont.bind $iii-cont $i-cont suspend $async local.set $p i32.const -2 call $log i32.const 5 i32.const 7 ref.func $sum cont.new $iii-cont cont.bind $iii-cont $i-cont suspend $async local.set $q i32.const -3 call $log i32.const 10 i32.const 15 ref.func $sum cont.new $iii-cont cont.bind $iii-cont $i-cont suspend $async local.set $r i32.const -4 call $log local.get $p suspend $await local.get $q suspend $await i32.mul local.set $x i32.const -5 call $log local.get $r suspend $await local.get $x i32.add local.set $y i32.const -6 call $log local.get $y call $log i32.const -7 call $log ) )