protoverse

A metaverse protocol
git clone git://jb55.com/protoverse
Log | Files | Refs | README | LICENSE

ifelse3.wat (847B)


      1 (module
      2 	(func $add (param $lhs i32) (param $rhs i32) (result i32)
      3 	      local.get $lhs
      4 	      local.get $rhs
      5 	      i32.add)
      6 	(func $sub (param $lhs i32) (param $rhs i32) (result i32)
      7 	      local.get $lhs
      8 	      local.get $rhs
      9 	      i32.sub
     10 	      )
     11 	(func $start (result i32)
     12 	      (local i32 i32)
     13 	      i32.const 0
     14               (if (result i32)
     15                 (then 
     16 		  i32.const 2
     17                   local.get 0
     18                   i32.sub
     19                   i32.const 0
     20                   i32.lt_s)
     21                 (else
     22                   i32.const 0))
     23 	      if
     24 	        unreachable
     25 	      end
     26 	      i32.const 0
     27 	      )
     28 
     29 	(func $enter (result i32)
     30 	      (call $start)
     31 	      drop
     32 	      (call $start)
     33 	      )
     34 
     35 	(export "start" (func $start))
     36 	(export "_start" (func $enter))
     37 
     38 	(export "add" (func $add))
     39 	(export "sub" (func $sub)))
     40