1;;! target = "riscv64"
2;;! test = 'optimize'
3;;! filter = 'wasm[2]--function[1]'
4
5(component
6  (type $a (enum "a" "b" "c"))
7  (type $func_ty (func (param "x" $a)))
8
9  (component $c1
10    (import "a" (type $a' (eq $a)))
11    (core module $m1
12      (func (export "f") (result i32)
13        (i32.const 0)))
14    (core instance $ci1 (instantiate $m1))
15    (func (export "f") (result $a') (canon lift (core func $ci1 "f"))))
16
17  (component $c2
18    (import "a" (type $a' (eq $a)))
19    (import "f" (func $f (result $a')))
20    (core func $g (canon lower (func $f)))
21    (core module $m2
22      (import "" "f" (func (result i32)))
23      (func (export "f") (result i32) (call 0)))
24    (core instance $ci2
25      (instantiate $m2 (with "" (instance (export "f" (func $g))))))
26    (func (export "f") (result $a') (canon lift (core func $ci2 "f"))))
27
28  (instance $i1 (instantiate $c1 (with "a" (type $a))))
29  (instance $i2 (instantiate $c2
30                  (with "a" (type $a))
31                  (with "f" (func $i1 "f"))))
32)
33
34;; function u2:0(i64 vmctx, i64) -> i32 tail {
35;;     gv0 = vmctx
36;;     gv1 = load.i64 notrap aligned readonly gv0+8
37;;     gv2 = load.i64 notrap aligned gv1+16
38;;     gv3 = vmctx
39;;     gv4 = load.i64 notrap aligned readonly can_move gv3+96
40;;     gv5 = load.i64 notrap aligned readonly can_move gv3+72
41;;     sig0 = (i64 vmctx, i64) -> i32 tail
42;;     fn0 = colocated u0:0 sig0
43;;     stack_limit = gv2
44;;
45;;                                 block0(v0: i64, v1: i64):
46;; @0063                               v4 = load.i64 notrap aligned readonly can_move v0+96
47;; @0063                               v5 = load.i32 notrap aligned table v4
48;; @0065                               v6 = iconst.i32 1
49;; @0067                               v7 = band v5, v6  ; v6 = 1
50;; @0061                               v3 = iconst.i32 0
51;; @0068                               v8 = icmp eq v7, v3  ; v3 = 0
52;; @0068                               v9 = uextend.i32 v8
53;; @006b                               trapnz v9, user11
54;; @0069                               jump block3
55;;
56;;                                 block3:
57;; @006d                               v10 = load.i64 notrap aligned readonly can_move v0+72
58;; @006d                               v11 = load.i32 notrap aligned table v10
59;; @006f                               v12 = iconst.i32 2
60;; @0071                               v13 = band v11, v12  ; v12 = 2
61;;                                     v79 = iconst.i32 0
62;;                                     v80 = icmp eq v13, v79  ; v79 = 0
63;; @0072                               v15 = uextend.i32 v80
64;; @0075                               trapnz v15, user11
65;; @0073                               jump block5
66;;
67;;                                 block5:
68;; @0077                               v17 = load.i32 notrap aligned table v10
69;; @0079                               v18 = iconst.i32 -3
70;; @007b                               v19 = band v17, v18  ; v18 = -3
71;; @007c                               store notrap aligned table v19, v10
72;;                                     v69 = iconst.i32 -4
73;;                                     v75 = band v17, v69  ; v69 = -4
74;; @0083                               store notrap aligned table v75, v10
75;;                                     v81 = iconst.i32 1
76;;                                     v82 = bor v19, v81  ; v81 = 1
77;; @008a                               store notrap aligned table v82, v10
78;; @008c                               v32 = load.i64 notrap aligned readonly can_move v0+64
79;; @008c                               v33 = call fn0(v32, v0)
80;; @0090                               v35 = load.i32 notrap aligned table v4
81;; @0080                               v23 = iconst.i32 -2
82;; @0094                               v37 = band v35, v23  ; v23 = -2
83;; @0095                               store notrap aligned table v37, v4
84;; @009b                               v39 = iconst.i32 3
85;; @009d                               v40 = icmp ugt v33, v39  ; v39 = 3
86;; @009d                               v41 = uextend.i32 v40
87;; @00a0                               trapnz v41, user11
88;; @009e                               jump block7
89;;
90;;                                 block7:
91;; @00a4                               v43 = load.i32 notrap aligned table v4
92;;                                     v83 = iconst.i32 1
93;;                                     v84 = bor v43, v83  ; v83 = 1
94;; @00a9                               store notrap aligned table v84, v4
95;; @00ab                               v48 = load.i32 notrap aligned table v10
96;;                                     v85 = iconst.i32 2
97;;                                     v86 = bor v48, v85  ; v85 = 2
98;; @00b0                               store notrap aligned table v86, v10
99;; @00b2                               jump block1
100;;
101;;                                 block1:
102;; @00b2                               return v33
103;; }
104