github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/vs/testdata/memory.wat (about)

     1  (module
     2    (memory (export "memory") 1)
     3  
     4    ;; Load the i32 value at the offset 32, decrement it, and store it back at the same position
     5    ;; until the value becomes zero.
     6    (func (export "i32")
     7      (loop
     8        i32.const 32
     9        (i32.load align=1 (i32.const 32))
    10        i32.const 1
    11        i32.sub
    12        i32.store
    13        (br_if 1 (i32.eqz (i32.load align=1 (i32.const 32)))) ;; exit.
    14        (br 0) ;; continue loop.
    15      )
    16    )
    17  
    18    ;; Load the i64 value at the offset 64, decrement it, and store it back at the same position
    19    ;; until the value becomes zero.
    20    (func (export "i64")
    21      (loop
    22        i32.const 64
    23        (i64.load align=1 (i32.const 64))
    24        i64.const 1
    25        i64.sub
    26        i64.store
    27        (br_if 1 (i64.eqz (i64.load align=1 (i32.const 64)))) ;; exit.
    28        (br 0) ;; continue loop.
    29      )
    30    )
    31  )