Skip to content

Instantly share code, notes, and snippets.

@sourabhniyogi
Created September 24, 2024 14:14
Show Gist options
  • Save sourabhniyogi/5e44600216af117169384a51ab389c8d to your computer and use it in GitHub Desktop.
Save sourabhniyogi/5e44600216af117169384a51ab389c8d to your computer and use it in GitHub Desktop.
pub @main:
jump @is_authorized
fallthrough
fallthrough
fallthrough
jump @refine
fallthrough
fallthrough
fallthrough
jump @accumulate
fallthrough
fallthrough
fallthrough
jump @on_transfer
pub @is_authorized:
fallthrough
pub @refine:
@import_12_byte_record:
ra = 1
sp = 0xFEFE0000
t0 = 12
ecalli 16
sp = 0
jump @init if ra != sp
@fibsum:
sp = u32[0xFEFE0004]
t0 = u32[0xFEFE0008]
u32[0xFEFE0008] = sp
sp = sp + t0
u32[0xFEFE0004] = sp
t1 = 1
ra = u32[0xFEFE0000]
ra = ra + t1
u32[0xFEFE0000] = ra
jump @export_12_byte_record
@export_12_byte_record:
ra = 0xFEFE0000
sp = 12
ecalli 17
trap
@init:
u32 [0xFEFE0000] = 0x00000001
u32 [0xFEFE0004] = 0x00000001
u32 [0xFEFE0008] = 0x00000000
jump @fibsum
pub @accumulate:
@write:
u32 [0x4000] = 0x00001234
ra = 0x4000
sp = 4
t0 = 0xFEFF0000
t1 = 12
u32 [0x4000] = 0x00000000
ecalli 3
fallthrough
pub @on_transfer:
fallthrough
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment