1(module 2 (type $fd_write_ty (func (param i32 i32 i32 i32) (result i32))) 3 (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (type $fd_write_ty))) 4 5 (func (export "double") (param i32) (result i32) 6 local.get 0 7 i32.const 2 8 i32.mul 9 ) 10 11 (func (export "log") (param i32 i32) 12 ;; store the pointer in the first iovec field 13 i32.const 4 14 local.get 0 15 i32.store 16 17 ;; store the length in the first iovec field 18 i32.const 4 19 local.get 1 20 i32.store offset=4 21 22 ;; call the `fd_write` import 23 i32.const 1 ;; stdout fd 24 i32.const 4 ;; iovs start 25 i32.const 1 ;; number of iovs 26 i32.const 0 ;; where to write nwritten bytes 27 call $fd_write 28 drop 29 ) 30 31 (memory (export "memory") 2) 32 (global (export "memory_offset") i32 (i32.const 65536)) 33) 34