mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
21 lines
521 B
Plaintext
21 lines
521 B
Plaintext
(module
|
|
(func $main (result i32)
|
|
(call $fib (i32.const 40))
|
|
)
|
|
|
|
(func $fib (param $n i32) (result i32)
|
|
(if (i32.eq (get_local $n) (i32.const 0))
|
|
(then (return (i32.const 1)))
|
|
)
|
|
(if (i32.eq (get_local $n) (i32.const 1))
|
|
(then (return (i32.const 1)))
|
|
)
|
|
(i32.add
|
|
(call $fib (i32.sub (get_local $n) (i32.const 1)))
|
|
(call $fib (i32.sub (get_local $n) (i32.const 2)))
|
|
)
|
|
)
|
|
|
|
(export "main" (func $main))
|
|
)
|