2018-01-13 23:38:07 +01:00
|
|
|
(module
|
2018-02-02 03:07:54 +01:00
|
|
|
(type $iiiiv (func (param i32 i32 i32 i32)))
|
2018-01-13 23:38:07 +01:00
|
|
|
(type $iii (func (param i32 i32) (result i32)))
|
|
|
|
(type $iiiv (func (param i32 i32 i32)))
|
|
|
|
(type $v (func))
|
2018-02-02 03:07:54 +01:00
|
|
|
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
|
2018-01-13 23:38:07 +01:00
|
|
|
(global $std/carray/arr (mut i32) (i32.const 0))
|
2018-02-14 09:18:43 +01:00
|
|
|
(global $HEAP_BASE i32 (i32.const 36))
|
2018-01-13 23:38:07 +01:00
|
|
|
(memory $0 1)
|
2018-02-14 09:18:43 +01:00
|
|
|
(data (i32.const 4) "\0d\00\00\00s\00t\00d\00/\00c\00a\00r\00r\00a\00y\00.\00t\00s")
|
2018-01-13 23:38:07 +01:00
|
|
|
(export "memory" (memory $0))
|
|
|
|
(start $start)
|
2018-02-02 03:07:54 +01:00
|
|
|
(func "$(lib)/array/CArray#__get" (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
2018-01-14 02:30:20 +01:00
|
|
|
(if
|
|
|
|
(i32.lt_s
|
|
|
|
(get_local $1)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
(i32.load
|
|
|
|
(i32.add
|
|
|
|
(get_local $0)
|
|
|
|
(i32.mul
|
|
|
|
(get_local $1)
|
|
|
|
(i32.const 4)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(func "$(lib)/array/CArray#__set" (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
2018-01-14 02:30:20 +01:00
|
|
|
(if
|
|
|
|
(i32.lt_s
|
|
|
|
(get_local $1)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
(i32.store
|
|
|
|
(i32.add
|
|
|
|
(get_local $0)
|
|
|
|
(i32.mul
|
|
|
|
(get_local $1)
|
|
|
|
(i32.const 4)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(get_local $2)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(func $start (; 3 ;) (type $v)
|
2018-01-13 23:38:07 +01:00
|
|
|
(local $0 i32)
|
|
|
|
(set_global $std/carray/arr
|
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.load
|
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 8)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.load
|
|
|
|
(i32.add
|
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
(i32.const 4)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 9)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__get"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 11)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__get"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 1)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 12)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__set"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 0)
|
|
|
|
(i32.const 42)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__set"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 1)
|
|
|
|
(i32.const 24)
|
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.ne
|
|
|
|
(i32.load
|
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
)
|
|
|
|
(i32.const 42)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 17)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.ne
|
|
|
|
(i32.load
|
|
|
|
(i32.add
|
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
(i32.const 4)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(i32.const 24)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 18)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.ne
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__get"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(i32.const 42)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 20)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.ne
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__get"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 1)
|
|
|
|
)
|
|
|
|
(i32.const 24)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 21)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(block (result i32)
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__set"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 3)
|
|
|
|
(tee_local $0
|
|
|
|
(i32.const 9000)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(i32.ne
|
|
|
|
(get_local $0)
|
|
|
|
(i32.const 9000)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 23)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.ne
|
|
|
|
(i32.load
|
|
|
|
(i32.add
|
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
(i32.const 12)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(i32.const 9000)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 25)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
(if
|
|
|
|
(i32.ne
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/array/CArray#__get"
|
2018-01-13 23:38:07 +01:00
|
|
|
(get_global $std/carray/arr)
|
|
|
|
(i32.const 3)
|
|
|
|
)
|
|
|
|
(i32.const 9000)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(block
|
|
|
|
(call $abort
|
|
|
|
(i32.const 0)
|
2018-02-14 09:18:43 +01:00
|
|
|
(i32.const 4)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const 26)
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-01-13 23:38:07 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|