(module
  (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
  (import "wasi_snapshot_preview1" "proc_exit" (func $proc_exit (param i32)))
  (data (i32.const 48) "\04\00\00\00true")
  (data (i32.const 56) "\05\00\00\00false")
  (data (i32.const 64) "\01\00\00\00-")
  (func $alloc (param $n i32) (result i32) (local $p i32) (local $limit i32)
    (local.set $p (global.get $hp))
    (global.set $hp (i32.and (i32.add (i32.add (local.get $p) (local.get $n)) (i32.const 7)) (i32.const -8)))
    (local.set $limit (i32.mul (memory.size) (i32.const 65536)))
    (if (i32.gt_u (global.get $hp) (local.get $limit))
      (then
        (if (i32.eq (memory.grow (i32.add (i32.shr_u (i32.sub (global.get $hp) (local.get $limit)) (i32.const 16)) (i32.const 1))) (i32.const -1))
          (then (unreachable)))))
    (local.get $p))
  (func $str_eq (param $a i32) (param $b i32) (result i32) (local $n i32) (local $i i32)
    (local.set $n (i32.load (local.get $a)))
    (if (i32.ne (local.get $n) (i32.load (local.get $b))) (then (return (i32.const 0))))
    (block $done
      (loop $next
        (br_if $done (i32.ge_u (local.get $i) (local.get $n)))
        (if (i32.ne (i32.load8_u (i32.add (i32.add (local.get $a) (i32.const 4)) (local.get $i)))
                    (i32.load8_u (i32.add (i32.add (local.get $b) (i32.const 4)) (local.get $i))))
          (then (return (i32.const 0))))
        (local.set $i (i32.add (local.get $i) (i32.const 1)))
        (br $next)))
    (i32.const 1))
  (memory (export "memory") 2)
  (global $hp (mut i32) (i32.const 88))
  (func $spiralMain (result i32)
    (local $v0 i32)
    (local $v1 i32)
    (local $v2 i32)
    (local $t3 i32)
    (local $v3 i32)
    (local $v4 i32)
    (local $t6 i32)
    (local $v5 i32)
    (local $t8 i32)
    (local $v6 i32)
    (local $t10 i32)
    (local $t11 i32)
    (local $v7 i32)
    (local $v8 i32)
    (local $v9 i32)
    (local $t15 i32)
    (local $v10 i32)
    (local $v11 i32)
    (local $t18 i32)
    (local $v12 i32)
    (local $v13 i32)
    (local $v14 i32)
    (local $v15 i32)
    (local $v16 i32)
    (local $v17 i32)
    (local $v18 i32)
    (local $v20 i32)
    (local $v19 i32)
    (local $v22 i32)
    (local $v21 i32)
    (local.set $v0 (i32.const 3))
    (local.set $v1 (i32.const 72))
    (local.set $t3 (call $alloc (i32.const 24)))
    (i32.store offset=8 (local.get $t3) (local.get $v0))
    (i32.store offset=16 (local.get $t3) (local.get $v1))
    (local.set $v2 (local.get $t3))
    (local.set $v3 (i32.const 1))
    (local.set $t6 (call $alloc (i32.const 24)))
    (i32.store offset=8 (local.get $t6) (local.get $v2))
    (i32.store offset=16 (local.get $t6) (local.get $v3))
    (local.set $v4 (local.get $t6))
    (local.set $t8 (call $alloc (i32.const 16)))
    (i32.store offset=8 (local.get $t8) (local.get $v4))
    (local.set $v5 (local.get $t8))
    (local.set $t10 (i32.const 1))
    (local.set $t11 (call $alloc (i32.add (i32.const 8) (i32.mul (local.get $t10) (i32.const 8)))))
    (i32.store (local.get $t11) (local.get $t10))
    (local.set $v6 (local.get $t11))
    (i32.store offset=8 (i32.add (local.get $v6) (i32.mul (i32.const 0) (i32.const 8))) (local.get $v5))
    (local.set $v7 (i32.const 7))
    (local.set $v8 (i32.const 80))
    (local.set $t15 (call $alloc (i32.const 24)))
    (i32.store offset=8 (local.get $t15) (local.get $v7))
    (i32.store offset=16 (local.get $t15) (local.get $v8))
    (local.set $v9 (local.get $t15))
    (local.set $v10 (i32.const 4))
    (local.set $t18 (call $alloc (i32.const 24)))
    (i32.store offset=8 (local.get $t18) (local.get $v9))
    (i32.store offset=16 (local.get $t18) (local.get $v10))
    (local.set $v11 (local.get $t18))
    (local.set $v12 (i32.load offset=8 (i32.add (local.get $v6) (i32.mul (i32.const 0) (i32.const 8)))))
    (i32.store offset=8 (local.get $v12) (local.get $v11))
    (local.set $v13 (i32.load offset=8 (local.get $v12)))
    (local.set $v14 (i32.load offset=8 (local.get $v13)))
    (local.set $v15 (i32.load offset=16 (local.get $v13)))
    (local.set $v16 (i32.load offset=8 (local.get $v14)))
    (local.set $v17 (i32.load offset=16 (local.get $v14)))
    (local.set $v18 (i32.eq (local.get $v16) (i32.const 7)))
    (if (local.get $v18)
        (then
            (local.set $v19 (call $str_eq (local.get $v17) (i32.const 80)))
            (local.set $v20 (local.get $v19))
        )
        (else
            (local.set $v20 (i32.const 0))
        ))
    (if (local.get $v20)
        (then
            (local.set $v21 (i32.eq (local.get $v15) (i32.const 4)))
            (local.set $v22 (local.get $v21))
        )
        (else
            (local.set $v22 (i32.const 0))
        ))
    (if (local.get $v22)
        (then
            (return (i32.const 0))
        )
        (else
            (return (i32.const 1))
        ))
    (unreachable)
  )
  (data (i32.const 72) "\02\00\00\00no")
  (data (i32.const 80) "\02\00\00\00hi")
  (func $_start (export "_start")
    (call $proc_exit (call $spiralMain)))
)
