1
0
mirror of https://github.com/danog/toncontest.git synced 2024-12-02 09:27:47 +01:00
toncontest/lightning/wallet-code.fif
2019-10-17 15:41:43 +02:00

497 lines
6.7 KiB
Plaintext

"Asm.fif" include
// automatically generated from `/home/daniil/repos/contest/lib/crypto/smartcont/stdlib.fc` `wallet-code.fc`
PROGRAM{
DECLPROC store_sgrams
DECLPROC ~load_sgrams
DECLPROC preload_sgrams
DECLPROC ~load_simple_addr_pair
DECLPROC preload_simple_addr_pair
DECLPROC skip_sigs
DECLPROC ~load_sigs
DECLPROC preload_sigs
DECLPROC store_sigs
DECLPROC load_storage
DECLPROC store_storage
DECLPROC recv_internal
DECLPROC recv_external
84593 DECLMETHOD seqNo
125129 DECLMETHOD getDelta
112390 DECLMETHOD isTurnA
100197 DECLMETHOD isTurnB
101812 DECLMETHOD getAmountA
114135 DECLMETHOD getAmountB
105039 DECLMETHOD getAddrA
109100 DECLMETHOD getAddrB
78055 DECLMETHOD getSignatures
115661 DECLMETHOD hasSignatureA
127918 DECLMETHOD hasSignatureB
120167 DECLMETHOD getHash
store_sgrams PROC:<{
DUP
0 LESSINT
IFJMP:<{
1 PUSHINT
ROT
1 STU
SWAP
NEGATE
STGRAMS
}>
0 PUSHINT
ROT
1 STU
SWAP
STGRAMS
}>
~load_sgrams PROC:<{
1 LDU
SWAP
IFJMP:<{
LDGRAMS
SWAP
NEGATE
}>
LDGRAMS
SWAP
}>
preload_sgrams PROC:<{
1 LDU
SWAP
IFJMP:<{
LDGRAMS
DROP
NEGATE
}>
LDGRAMS
DROP
}>
~load_simple_addr_pair PROC:<{
8 LDI
256 LDU
8 LDI
256 LDU
4 -ROLL
}>
preload_simple_addr_pair PROC:<{
8 LDI
DUP
256 PLDU
SWAP
8 LDI
256 PLDU
}>
skip_sigs PROC:<{
DUP
SREFS
2 EQINT
IFJMP:<{
LDREF
NIP
LDREF
NIP
}>
1 PUSHINT
SDSKIPFIRST
LDREF
NIP
}>
~load_sigs PROC:<{
DUP
SREFS
2 EQINT
IFJMP:<{
3 PUSHINT
SWAP
LDREF
LDREF
3 -ROLL
}>
1 LDU
SWAP
IFJMP:<{
2 PUSHINT
NEWDICT
s0 s2 XCHG
LDREF
s3 s3 XCHG2
}>
1 PUSHINT
SWAP
LDREF
NEWDICT
s3 s3 s0 XCHG3
}>
preload_sigs PROC:<{
~load_sigs CALLDICT
s3 POP
ROT
}>
store_sigs PROC:<{
s2 PUSH
3 EQINT
IFJMP:<{
s2 POP
ROT
STREF
STREF
}>
s0 s2 XCHG
2 EQINT
IFJMP:<{
DROP
1 PUSHINT
ROT
1 STU
STREF
}>
NIP
0 PUSHINT
ROT
1 STU
STREF
}>
load_storage PROC:<{
c4 PUSH
CTOS
256 LDU
256 LDU
LDGRAMS
LDGRAMS
LDREF
~load_sigs CALLDICT
s0 s3 XCHG
32 LDU
~load_sgrams CALLDICT
SWAP
1 LDU
ENDS
s4 s5 XCHG
s3 s4 XCHG
}>
store_storage PROC:<{
NEWC
s1 s11 XCHG
256 STU
s1 s9 XCHG
256 STU
s0 s7 XCHG2
STGRAMS
s0 s5 XCHG2
STGRAMS
s1 s3 XCHG
STREF
s2 s3 XCHG2
store_sigs CALLDICT
32 STU
SWAP
store_sgrams CALLDICT
1 STU
ENDC
c4 POP
}>
recv_internal PROC:<{
NIP
CTOS
4 LDU
LDMSGADDR
DROP
REWRITESTDADDR
s0 s2 XCHG
1 PUSHINT
AND
IFJMP:<{
2DROP
}>
load_storage CALLDICT
s6 s10 XCHG
10 BLKDROP
DUP
CTOS
NIP
preload_simple_addr_pair CALLDICT
s3 s4 XCPU
EQUAL
s2 s5 XCPU
EQUAL
s1 s2 XCHG
AND
IF:<{
4 BLKDROP
}>ELSE<{
ROT
EQUAL
s0 s2 XCHG
EQUAL
AND
IF:<{
}>ELSE<{
33 THROW
}>
}>
}>
recv_external PROC:<{
~load_sigs CALLDICT
s3 PUSH
32 LDU
~load_sgrams CALLDICT
SWAP
1 LDU
DROP
load_storage CALLDICT
DUMPSTK
s3 POP
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LDICT
32 PLDU
}>
getDelta PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
NIP
LDGRAMS
NIP
LDREF
NIP
skip_sigs CALLDICT
32 PUSHINT
SDSKIPFIRST
LDGRAMS
DROP
}>
isTurnA PROC:<{
seqNo CALLDICT
1 MODPOW2#
NOT
}>
isTurnB PROC:<{
seqNo CALLDICT
1 MODPOW2#
}>
getAmountA PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
DROP
}>
getAmountB PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
NIP
LDGRAMS
DROP
}>
getAddrA PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
NIP
LDGRAMS
NIP
PLDREF
CTOS
8 LDI
256 PLDU
}>
getAddrB PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
NIP
LDGRAMS
NIP
PLDREF
CTOS
264 PUSHINT
SDSKIPFIRST
8 LDI
256 PLDU
}>
getSignatures PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
NIP
LDGRAMS
NIP
LDREF
NIP
preload_sigs CALLDICT
}>
hasSignatureA PROC:<{
getSignatures CALLDICT
2DROP
1 PUSHINT
AND
}>
hasSignatureB PROC:<{
getSignatures CALLDICT
2DROP
2 PUSHINT
AND
}>
getHash PROC:<{
c4 PUSH
CTOS
9 PUSHPOW2
SDSKIPFIRST
LDGRAMS
NIP
LDGRAMS
NIP
LDREF
NIP
skip_sigs CALLDICT
HASHSU
}>
}END>c