Skip to content

Commit

Permalink
Task 1: store stack on the stack fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
akifoq committed Aug 11, 2023
1 parent fd6a1cb commit 39c481f
Showing 1 changed file with 17 additions and 32 deletions.
49 changes: 17 additions & 32 deletions contracts/1.fc
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,23 @@
}

cell solution(int hash, cell cur) asm """
DEPTH 2 PUSHINT EQUAL NOT
IFJMP:<{ 42 PUSHINT RETALT }>
// hash cur
DUP HASHCU
s2 PUSH EQUAL
IFJMP:<{
NIP
}> // hash cur

PUSHNULL CONS // hash t
<{
AGAINBRK:
UNCONS // hash c t
SWAP CTOS // hash t cs
DUP SREFS // hash t cs srefs
REPEAT:<{ // hash t cs
LDREF // hash t ref cs
OVER // hash t ref cs ref
HASHCU // hash t ref cs _16
s4 PUSH // hash t ref cs _16 hash
EQUAL // hash t ref cs _17
IFJMP:<{ // hash t ref cs
s1 s3 XCHG
3 BLKDROP // ref
RETALT
}> // hash t ref cs
s0 s2 XCHG // hash cs ref t
CONS // hash cs t
SWAP // hash t cs
}>
DROP // hash t
}>CONT // hash t
SWAP // cur hash
<{ AGAINBRK:
// ... cur hash
OVER HASHCU OVER EQUAL
IFJMP:<{
DROP
1 PUSHINT ONLYTOPX
RETALT
}>
SWAP CTOS // ... hash cs
DUP SREFS
REPEAT:<{
LDREF // ... hash ref cs
ROT SWAP
}>
DROP // ... hash
}>CONT
<{ 2DROP
<b b> PUSHREF
}>CONT
Expand Down

0 comments on commit 39c481f

Please sign in to comment.