Skip to content

Instantly share code, notes, and snippets.

@DenialAdams
Created July 16, 2020 00:12
Show Gist options
  • Select an option

  • Save DenialAdams/fee140b01a8a9831838fbb92ce4b7834 to your computer and use it in GitHub Desktop.

Select an option

Save DenialAdams/fee140b01a8a9831838fbb92ce4b7834 to your computer and use it in GitHub Desktop.
Generated by rolandc
(module
(import "wasi_unstable" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
(memory 1)
(export "memory" (memory 0))
(data 0 (i32.const 16) "\n")
(data 0 (i32.const 18) "true")
(data 0 (i32.const 22) "false")
(func $print (param $str_offset i32) (param $str_len i32)
(i32.store (i32.const 0) (local.get $str_offset))
(i32.store (i32.const 4) (local.get $str_len))
(i32.store (i32.const 8) (i32.const 16))
(i32.store (i32.const 12) (i32.const 1))
(call $fd_write (i32.const 1) (i32.const 0) (i32.const 2) (i32.const 0))
drop
)
(func $print_int (param $int i64)
(i32.store (i32.const 8) (i32.const 16))
(i32.store (i32.const 12) (i32.const 1))
(call $fd_write (i32.const 1) (i32.const 0) (i32.const 2) (i32.const 0))
drop
)
(func $main
(export "_start")
(local $x i64)
(local $y i64)
(local $z i64)
i64.const 10
i64.const -1
i64.xor
i64.const 1
i64.add
local.set $x
i64.const 10
local.set $y
local.get $x
local.get $y
i64.gt_s
call $print_bool
local.get $x
local.get $y
i64.ge_s
call $print_bool
local.get $x
local.get $y
i64.lt_s
call $print_bool
local.get $x
local.get $y
i64.le_s
call $print_bool
local.get $x
local.get $y
i64.eq
call $print_bool
local.get $x
local.get $y
i64.ne
call $print_bool
i64.const 10
local.set $z
local.get $y
local.get $z
i64.gt_s
call $print_bool
local.get $y
local.get $z
i64.ge_s
call $print_bool
local.get $y
local.get $z
i64.lt_s
call $print_bool
local.get $y
local.get $z
i64.le_s
call $print_bool
local.get $y
local.get $z
i64.eq
call $print_bool
local.get $y
local.get $z
i64.ne
call $print_bool
)
(func $print_bool (param $value i32)
(if
(
local.get $value
)
(then
i32.const 18
i32.const 4
call $print
)
(else
i32.const 22
i32.const 5
call $print
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment