forked from mmcloughlin/avo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stadtx.s
338 lines (308 loc) · 5.29 KB
/
stadtx.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
// Code generated by command: go run asm.go -out stadtx.s -stubs stub.go. DO NOT EDIT.
#include "textflag.h"
// func Hash(state *State, key []byte) uint64
TEXT ·Hash(SB), NOSPLIT, $0-40
MOVQ state+0(FP), AX
MOVQ key_base+8(FP), CX
MOVQ key_len+16(FP), DX
MOVQ (AX), BX
MOVQ 8(AX), BP
MOVQ DX, SI
ADDQ $0x00000001, SI
MOVQ $0xb89b0f8e1655514f, DI
IMULQ DI, SI
XORQ SI, BX
MOVQ DX, SI
ADDQ $0x00000002, SI
MOVQ $0x8c6f736011bd5127, DI
IMULQ DI, SI
XORQ SI, BP
CMPQ DX, $0x00000020
JGE coreLong
MOVQ DX, SI
SHRQ $0x03, SI
CMPQ SI, $0x00000000
JE shortCore0
CMPQ SI, $0x00000001
JE shortCore1
CMPQ SI, $0x00000002
JE shortCore2
CMPQ SI, $0x00000003
JE shortCore3
shortCore3:
MOVQ (CX), SI
MOVQ $0x9c1b8e1e9628323f, DI
IMULQ DI, SI
ADDQ SI, BX
RORQ $0x11, BX
XORQ BP, BX
RORQ $0x35, BP
ADDQ BX, BP
ADDQ $0x00000008, CX
SUBQ $0x00000008, DX
shortCore2:
MOVQ (CX), SI
MOVQ $0x9c1b8e1e9628323f, DI
IMULQ DI, SI
ADDQ SI, BX
RORQ $0x11, BX
XORQ BP, BX
RORQ $0x35, BP
ADDQ BX, BP
ADDQ $0x00000008, CX
SUBQ $0x00000008, DX
shortCore1:
MOVQ (CX), SI
MOVQ $0x9c1b8e1e9628323f, DI
IMULQ DI, SI
ADDQ SI, BX
RORQ $0x11, BX
XORQ BP, BX
RORQ $0x35, BP
ADDQ BX, BP
ADDQ $0x00000008, CX
SUBQ $0x00000008, DX
shortCore0:
CMPQ DX, $0x00000000
JE shortTail0
CMPQ DX, $0x00000001
JE shortTail1
CMPQ DX, $0x00000002
JE shortTail2
CMPQ DX, $0x00000003
JE shortTail3
CMPQ DX, $0x00000004
JE shortTail4
CMPQ DX, $0x00000005
JE shortTail5
CMPQ DX, $0x00000006
JE shortTail6
CMPQ DX, $0x00000007
JE shortTail7
shortTail7:
MOVBQZX 6(CX), SI
SHLQ $0x20, SI
ADDQ SI, BX
shortTail6:
MOVBQZX 5(CX), SI
SHLQ $0x30, SI
ADDQ SI, BP
shortTail5:
MOVBQZX 4(CX), SI
SHLQ $0x10, SI
ADDQ SI, BX
shortTail4:
MOVLQZX (CX), SI
ADDQ SI, BP
JMP shortAfter
shortTail3:
MOVBQZX 2(CX), SI
SHLQ $0x30, SI
ADDQ SI, BX
shortTail2:
MOVWQZX (CX), SI
ADDQ SI, BP
JMP shortAfter
shortTail1:
MOVBQZX (CX), SI
ADDQ SI, BX
shortTail0:
RORQ $0x20, BP
XORQ $0x000000ff, BP
shortAfter:
XORQ BX, BP
RORQ $0x21, BX
ADDQ BP, BX
ROLQ $0x11, BP
XORQ BX, BP
ROLQ $0x2b, BX
ADDQ BP, BX
ROLQ $0x1f, BP
SUBQ BX, BP
ROLQ $0x0d, BX
XORQ BP, BX
SUBQ BX, BP
ROLQ $0x29, BX
ADDQ BP, BX
ROLQ $0x25, BP
XORQ BX, BP
RORQ $0x27, BX
ADDQ BP, BX
RORQ $0x0f, BP
ADDQ BX, BP
ROLQ $0x0f, BX
XORQ BP, BX
RORQ $0x05, BP
XORQ BP, BX
MOVQ BX, ret+32(FP)
RET
coreLong:
MOVQ 16(AX), DI
MOVQ 24(AX), AX
MOVQ DX, SI
ADDQ $0x00000003, SI
MOVQ $0x8f29bd94edce7b39, R8
IMULQ R8, SI
XORQ SI, DI
MOVQ DX, SI
ADDQ $0x00000004, SI
MOVQ $0x9c1b8e1e9628323f, R8
IMULQ R8, SI
XORQ SI, AX
block:
MOVQ (CX), SI
MOVQ $0x00000000802910e3, R8
IMULQ R8, SI
ADDQ SI, BX
ROLQ $0x39, BX
XORQ AX, BX
MOVQ 8(CX), SI
MOVQ $0x00000000819b13af, R8
IMULQ R8, SI
ADDQ SI, BP
ROLQ $0x3f, BP
XORQ DI, BP
MOVQ 16(CX), SI
MOVQ $0x0000000091cb27e5, R8
IMULQ R8, SI
ADDQ SI, DI
RORQ $0x2f, DI
ADDQ BX, DI
MOVQ 24(CX), SI
MOVQ $0x00000000c1a269c1, R8
IMULQ R8, SI
ADDQ SI, AX
RORQ $0x0b, AX
SUBQ BP, AX
ADDQ $0x00000020, CX
SUBQ $0x00000020, DX
CMPQ DX, $0x00000020
JGE block
MOVQ DX, R8
MOVQ DX, SI
SHRQ $0x03, SI
CMPQ SI, $0x00000000
JE longCore0
CMPQ SI, $0x00000001
JE longCore1
CMPQ SI, $0x00000002
JE longCore2
CMPQ SI, $0x00000003
JE longCore3
longCore3:
MOVQ (CX), SI
MOVQ $0x00000000802910e3, R9
IMULQ R9, SI
ADDQ SI, BX
ROLQ $0x39, BX
XORQ AX, BX
ADDQ $0x00000008, CX
SUBQ $0x00000008, DX
longCore2:
MOVQ (CX), SI
MOVQ $0x00000000819b13af, R9
IMULQ R9, SI
ADDQ SI, BP
ROLQ $0x3f, BP
XORQ DI, BP
ADDQ $0x00000008, CX
SUBQ $0x00000008, DX
longCore1:
MOVQ (CX), SI
MOVQ $0x0000000091cb27e5, R9
IMULQ R9, SI
ADDQ SI, DI
RORQ $0x2f, DI
ADDQ BX, DI
ADDQ $0x00000008, CX
SUBQ $0x00000008, DX
longCore0:
RORQ $0x0b, AX
SUBQ BP, AX
ADDQ $0x00000001, R8
MOVQ $0x9c1b8e1e9628323f, SI
IMULQ SI, R8
XORQ R8, BX
CMPQ DX, $0x00000000
JE longTail0
CMPQ DX, $0x00000001
JE longTail1
CMPQ DX, $0x00000002
JE longTail2
CMPQ DX, $0x00000003
JE longTail3
CMPQ DX, $0x00000004
JE longTail4
CMPQ DX, $0x00000005
JE longTail5
CMPQ DX, $0x00000006
JE longTail6
CMPQ DX, $0x00000007
JE longTail7
longTail7:
MOVBQZX 6(CX), SI
ADDQ SI, BP
longTail6:
MOVWQZX 4(CX), SI
ADDQ SI, DI
MOVLQZX (CX), SI
ADDQ SI, AX
JMP longAfter
longTail5:
MOVBQZX 4(CX), SI
ADDQ SI, BP
longTail4:
MOVLQZX (CX), SI
ADDQ SI, DI
JMP longAfter
longTail3:
MOVBQZX 2(CX), SI
ADDQ SI, AX
longTail2:
MOVWQZX (CX), SI
ADDQ SI, BP
JMP longAfter
longTail1:
MOVBQZX (CX), SI
ADDQ SI, DI
longTail0:
ROLQ $0x20, AX
XORQ $0x000000ff, AX
longAfter:
SUBQ DI, BP
RORQ $0x13, BX
SUBQ BX, BP
RORQ $0x35, BP
XORQ BP, AX
SUBQ AX, BX
ROLQ $0x2b, AX
ADDQ AX, BX
RORQ $0x03, BX
SUBQ BX, AX
RORQ $0x2b, DI
SUBQ AX, DI
ROLQ $0x37, DI
XORQ BX, DI
SUBQ DI, BP
RORQ $0x07, AX
SUBQ DI, AX
RORQ $0x1f, DI
ADDQ DI, AX
SUBQ BP, DI
RORQ $0x27, AX
XORQ AX, DI
RORQ $0x11, AX
XORQ DI, AX
ADDQ AX, BP
RORQ $0x09, BP
XORQ BP, DI
ROLQ $0x18, DI
XORQ DI, AX
RORQ $0x3b, AX
RORQ $0x01, BX
SUBQ BP, BX
XORQ BP, BX
XORQ AX, DI
XORQ DI, BX
MOVQ BX, ret+32(FP)
RET