Skip to content

Instantly share code, notes, and snippets.

@ashirleyshe
Created September 18, 2023 14:52
Show Gist options
  • Save ashirleyshe/04a5ed08727a5b06fcda2fc545ed56b8 to your computer and use it in GitHub Desktop.
Save ashirleyshe/04a5ed08727a5b06fcda2fc545ed56b8 to your computer and use it in GitHub Desktop.
BytesMove
// Move bytecode v6
module 0.solve {
compute(Arg0: u64, Arg1: u64): u64 * u64 {
L0: loc2: u64
B0:
0: CopyLoc[0](Arg0: u64)
1: LdU8(1)
2: Shl
3: LdU64(4294967295)
4: BitAnd
5: StLoc[2](loc0: u64)
6: MoveLoc[0](Arg0: u64)
7: MoveLoc[1](Arg1: u64)
8: BitAnd
9: LdU64(4294967295)
10: BitAnd
11: StLoc[3](loc1: u64)
12: LdU64(0)
13: StLoc[4](loc2: u64)
B1:
14: CopyLoc[3](loc1: u64)
15: LdU64(0)
16: Neq
17: BrFalse(30)
B2:
18: Branch(19)
B3:
19: MoveLoc[4](loc2: u64)
20: CopyLoc[3](loc1: u64)
21: LdU64(1)
22: BitAnd
23: Xor
24: StLoc[4](loc2: u64)
25: MoveLoc[3](loc1: u64)
26: LdU8(1)
27: Shr
28: StLoc[3](loc1: u64)
29: Branch(14)
B4:
30: MoveLoc[2](loc0: u64)
31: CopyLoc[4](loc2: u64)
32: Xor
33: MoveLoc[4](loc2: u64)
34: Ret
}
byte_to_u64(Arg0: vector<u64>): u64 {
L0: loc1: u64
L1: loc2: u64
L2: loc3: u8
B0:
0: LdU64(0)
1: StLoc[3](loc2: u64)
2: LdU64(0)
3: StLoc[2](loc1: u64)
B1:
4: CopyLoc[2](loc1: u64)
5: ImmBorrowLoc[0](Arg0: vector<u64>)
6: VecLen(2)
7: Lt
8: BrFalse(36)
B2:
9: Branch(10)
B3:
10: ImmBorrowLoc[0](Arg0: vector<u64>)
11: CopyLoc[2](loc1: u64)
12: VecImmBorrow(2)
13: ReadRef
14: StLoc[1](loc0: u64)
15: ImmBorrowLoc[0](Arg0: vector<u64>)
16: VecLen(2)
17: LdU64(1)
18: Sub
19: CopyLoc[2](loc1: u64)
20: Sub
21: CastU8
22: LdU8(8)
23: Mul
24: StLoc[4](loc3: u8)
25: MoveLoc[3](loc2: u64)
26: MoveLoc[1](loc0: u64)
27: MoveLoc[4](loc3: u8)
28: Shl
29: BitOr
30: StLoc[3](loc2: u64)
31: MoveLoc[2](loc1: u64)
32: LdU64(1)
33: Add
34: StLoc[2](loc1: u64)
35: Branch(4)
B4:
36: MoveLoc[3](loc2: u64)
37: CastU64
38: Ret
}
slice(Arg0: vector<u8>, Arg1: u64, Arg2: u64): vector<u64> {
B0:
0: LdConst[2](Vector(U64): 00)
1: StLoc[4](loc1: vector<u64>)
2: MoveLoc[1](Arg1: u64)
3: StLoc[3](loc0: u64)
B1:
4: CopyLoc[3](loc0: u64)
5: CopyLoc[2](Arg2: u64)
6: Lt
7: BrFalse(21)
B2:
8: Branch(9)
B3:
9: MutBorrowLoc[4](loc1: vector<u64>)
10: ImmBorrowLoc[0](Arg0: vector<u8>)
11: CopyLoc[3](loc0: u64)
12: VecImmBorrow(9)
13: ReadRef
14: CastU64
15: VecPushBack(2)
16: MoveLoc[3](loc0: u64)
17: LdU64(1)
18: Add
19: StLoc[3](loc0: u64)
20: Branch(4)
B4:
21: MoveLoc[4](loc1: vector<u64>)
22: Ret
}
entry public solve(Arg0: vector<u8>) {
L0: loc1: vector<u8>
L1: loc2: u64
L2: loc3: u64
L3: loc4: u64
L4: loc5: u64
L5: loc6: u64
L6: loc7: u64
L7: loc8: vector<u64>
L8: loc9: &mut u64
L9: loc10: vector<u64>
L10: loc11: vector<u64>
L11: loc12: vector<u64>
L12: loc13: vector<u64>
L13: loc14: vector<u64>
L14: loc15: vector<u64>
L15: loc16: vector<u64>
L16: loc17: vector<u8>
L17: loc18: vector<u64>
L18: loc19: u64
B0:
0: LdConst[3](Vector(U8): 04637466..)
1: StLoc[18](loc17: vector<u8>)
2: LdConst[4](Vector(U8): 017d)
3: StLoc[2](loc1: vector<u8>)
4: ImmBorrowLoc[0](Arg0: vector<u8>)
5: VecLen(9)
6: StLoc[7](loc6: u64)
7: LdU64(0)
8: StLoc[3](loc2: u64)
B1:
9: CopyLoc[3](loc2: u64)
10: ImmBorrowLoc[18](loc17: vector<u8>)
11: VecLen(9)
12: Lt
13: BrFalse(33)
B2:
14: Branch(15)
B3:
15: ImmBorrowLoc[0](Arg0: vector<u8>)
16: CopyLoc[3](loc2: u64)
17: VecImmBorrow(9)
18: ReadRef
19: ImmBorrowLoc[18](loc17: vector<u8>)
20: CopyLoc[3](loc2: u64)
21: VecImmBorrow(9)
22: ReadRef
23: Eq
24: BrFalse(26)
B4:
25: Branch(28)
B5:
26: LdConst[1](U64: 01000000..)
27: Abort
B6:
28: MoveLoc[3](loc2: u64)
29: LdU64(1)
30: Add
31: StLoc[3](loc2: u64)
32: Branch(9)
B7:
33: ImmBorrowLoc[0](Arg0: vector<u8>)
34: CopyLoc[7](loc6: u64)
35: LdU64(1)
36: Sub
37: VecImmBorrow(9)
38: ReadRef
39: ImmBorrowLoc[2](loc1: vector<u8>)
40: LdU64(0)
41: VecImmBorrow(9)
42: ReadRef
43: Eq
44: BrFalse(46)
B8:
45: Branch(48)
B9:
46: LdConst[1](U64: 01000000..)
47: Abort
B10:
48: MoveLoc[7](loc6: u64)
49: LdU64(37)
50: Eq
51: BrFalse(53)
B11:
52: Branch(55)
B12:
53: LdConst[0](U64: 00000000..)
54: Abort
B13:
55: LdConst[5](Vector(U64): 20c00000..)
56: StLoc[1](loc0: vector<u64>)
57: LdConst[2](Vector(U64): 00)
58: StLoc[9](loc8: vector<u64>)
59: CopyLoc[0](Arg0: vector<u8>)
60: LdU64(4)
61: LdU64(8)
62: Call slice(vector<u8>, u64, u64): vector<u64>
63: StLoc[11](loc10: vector<u64>)
64: CopyLoc[0](Arg0: vector<u8>)
65: LdU64(8)
66: LdU64(12)
67: Call slice(vector<u8>, u64, u64): vector<u64>
68: StLoc[12](loc11: vector<u64>)
69: CopyLoc[0](Arg0: vector<u8>)
70: LdU64(12)
71: LdU64(16)
72: Call slice(vector<u8>, u64, u64): vector<u64>
73: StLoc[13](loc12: vector<u64>)
74: CopyLoc[0](Arg0: vector<u8>)
75: LdU64(16)
76: LdU64(20)
77: Call slice(vector<u8>, u64, u64): vector<u64>
78: StLoc[14](loc13: vector<u64>)
79: CopyLoc[0](Arg0: vector<u8>)
80: LdU64(20)
81: LdU64(24)
82: Call slice(vector<u8>, u64, u64): vector<u64>
83: StLoc[15](loc14: vector<u64>)
84: CopyLoc[0](Arg0: vector<u8>)
85: LdU64(24)
86: LdU64(28)
87: Call slice(vector<u8>, u64, u64): vector<u64>
88: StLoc[16](loc15: vector<u64>)
89: CopyLoc[0](Arg0: vector<u8>)
90: LdU64(28)
91: LdU64(32)
92: Call slice(vector<u8>, u64, u64): vector<u64>
93: StLoc[17](loc16: vector<u64>)
94: MoveLoc[0](Arg0: vector<u8>)
95: LdU64(32)
96: LdU64(36)
97: Call slice(vector<u8>, u64, u64): vector<u64>
98: Call byte_to_u64(vector<u64>): u64
99: MoveLoc[17](loc16: vector<u64>)
100: Call byte_to_u64(vector<u64>): u64
101: MoveLoc[13](loc12: vector<u64>)
102: Call byte_to_u64(vector<u64>): u64
103: MoveLoc[16](loc15: vector<u64>)
104: Call byte_to_u64(vector<u64>): u64
105: MoveLoc[15](loc14: vector<u64>)
106: Call byte_to_u64(vector<u64>): u64
107: MoveLoc[14](loc13: vector<u64>)
108: Call byte_to_u64(vector<u64>): u64
109: MoveLoc[12](loc11: vector<u64>)
110: Call byte_to_u64(vector<u64>): u64
111: MoveLoc[11](loc10: vector<u64>)
112: Call byte_to_u64(vector<u64>): u64
113: VecPack(2, 8)
114: StLoc[19](loc18: vector<u64>)
115: LdU64(0)
116: StLoc[4](loc3: u64)
B14:
117: CopyLoc[4](loc3: u64)
118: LdU64(32)
119: Lt
120: BrFalse(163)
B15:
121: Branch(122)
B16:
122: LdU64(0)
123: StLoc[20](loc19: u64)
124: LdU64(0)
125: StLoc[5](loc4: u64)
B17:
126: CopyLoc[5](loc4: u64)
127: LdU64(8)
128: Lt
129: BrFalse(155)
B18:
130: Branch(131)
B19:
131: MutBorrowLoc[19](loc18: vector<u64>)
132: CopyLoc[4](loc3: u64)
133: LdU64(4)
134: Div
135: VecMutBorrow(2)
136: StLoc[10](loc9: &mut u64)
137: CopyLoc[10](loc9: &mut u64)
138: ReadRef
139: LdU64(2290631716)
140: Call compute(u64, u64): u64 * u64
141: StLoc[8](loc7: u64)
142: MoveLoc[10](loc9: &mut u64)
143: WriteRef
144: MoveLoc[20](loc19: u64)
145: LdU8(1)
146: Shl
147: MoveLoc[8](loc7: u64)
148: Xor
149: StLoc[20](loc19: u64)
150: MoveLoc[5](loc4: u64)
151: LdU64(1)
152: Add
153: StLoc[5](loc4: u64)
154: Branch(126)
B20:
155: MutBorrowLoc[9](loc8: vector<u64>)
156: MoveLoc[20](loc19: u64)
157: VecPushBack(2)
158: MoveLoc[4](loc3: u64)
159: LdU64(1)
160: Add
161: StLoc[4](loc3: u64)
162: Branch(117)
B21:
163: LdU64(0)
164: StLoc[6](loc5: u64)
B22:
165: CopyLoc[6](loc5: u64)
166: LdU64(32)
167: Lt
168: BrFalse(188)
B23:
169: Branch(170)
B24:
170: ImmBorrowLoc[9](loc8: vector<u64>)
171: CopyLoc[6](loc5: u64)
172: VecImmBorrow(2)
173: ReadRef
174: ImmBorrowLoc[1](loc0: vector<u64>)
175: CopyLoc[6](loc5: u64)
176: VecImmBorrow(2)
177: ReadRef
178: Eq
179: BrFalse(181)
B25:
180: Branch(183)
B26:
181: LdConst[1](U64: 01000000..)
182: Abort
B27:
183: MoveLoc[6](loc5: u64)
184: LdU64(1)
185: Add
186: StLoc[6](loc5: u64)
187: Branch(165)
B28:
188: Ret
}
Constants [
0 => u64: 0000000000000000
1 => u64: 0100000000000000
2 => vector<u64>: 00
3 => vector<u8>: 046374667b
4 => vector<u8>: 017d
5 => vector<u64>: 20c0000000000000000c000000000000004500000000000000c200000000000000b800000000000000d600000000000000780000000000000010000000000000003a000000000000000b00000000000000f9000000000000004c00000000000000ae00000000000000ba00000000000000a20000000000000083000000000000004d00000000000000d100000000000000f200000000000000a7000000000000000e00000000000000df000000000000002e0000000000000047000000000000000100000000000000a00000000000000080000000000000001900000000000000f500000000000000260000000000000086000000000000004a00000000000000
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment