• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1default	rel
2%define XMMWORD
3%define YMMWORD
4%define ZMMWORD
5section	.text code align=64
6
7EXTERN	OPENSSL_ia32cap_P
8
9global	asm_RC4
10
11ALIGN	16
12asm_RC4:
13	mov	QWORD[8+rsp],rdi	;WIN64 prologue
14	mov	QWORD[16+rsp],rsi
15	mov	rax,rsp
16$L$SEH_begin_asm_RC4:
17	mov	rdi,rcx
18	mov	rsi,rdx
19	mov	rdx,r8
20	mov	rcx,r9
21
22
23	or	rsi,rsi
24	jne	NEAR $L$entry
25	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
26	mov	rsi,QWORD[16+rsp]
27	DB	0F3h,0C3h		;repret
28$L$entry:
29	push	rbx
30	push	r12
31	push	r13
32$L$prologue:
33	mov	r11,rsi
34	mov	r12,rdx
35	mov	r13,rcx
36	xor	r10,r10
37	xor	rcx,rcx
38
39	lea	rdi,[8+rdi]
40	mov	r10b,BYTE[((-8))+rdi]
41	mov	cl,BYTE[((-4))+rdi]
42	cmp	DWORD[256+rdi],-1
43	je	NEAR $L$RC4_CHAR
44	mov	r8d,DWORD[OPENSSL_ia32cap_P]
45	xor	rbx,rbx
46	inc	r10b
47	sub	rbx,r10
48	sub	r13,r12
49	mov	eax,DWORD[r10*4+rdi]
50	test	r11,-16
51	jz	NEAR $L$loop1
52	bt	r8d,30
53	jc	NEAR $L$intel
54	and	rbx,7
55	lea	rsi,[1+r10]
56	jz	NEAR $L$oop8
57	sub	r11,rbx
58$L$oop8_warmup:
59	add	cl,al
60	mov	edx,DWORD[rcx*4+rdi]
61	mov	DWORD[rcx*4+rdi],eax
62	mov	DWORD[r10*4+rdi],edx
63	add	al,dl
64	inc	r10b
65	mov	edx,DWORD[rax*4+rdi]
66	mov	eax,DWORD[r10*4+rdi]
67	xor	dl,BYTE[r12]
68	mov	BYTE[r13*1+r12],dl
69	lea	r12,[1+r12]
70	dec	rbx
71	jnz	NEAR $L$oop8_warmup
72
73	lea	rsi,[1+r10]
74	jmp	NEAR $L$oop8
75ALIGN	16
76$L$oop8:
77	add	cl,al
78	mov	edx,DWORD[rcx*4+rdi]
79	mov	DWORD[rcx*4+rdi],eax
80	mov	ebx,DWORD[rsi*4+rdi]
81	ror	r8,8
82	mov	DWORD[r10*4+rdi],edx
83	add	dl,al
84	mov	r8b,BYTE[rdx*4+rdi]
85	add	cl,bl
86	mov	edx,DWORD[rcx*4+rdi]
87	mov	DWORD[rcx*4+rdi],ebx
88	mov	eax,DWORD[4+rsi*4+rdi]
89	ror	r8,8
90	mov	DWORD[4+r10*4+rdi],edx
91	add	dl,bl
92	mov	r8b,BYTE[rdx*4+rdi]
93	add	cl,al
94	mov	edx,DWORD[rcx*4+rdi]
95	mov	DWORD[rcx*4+rdi],eax
96	mov	ebx,DWORD[8+rsi*4+rdi]
97	ror	r8,8
98	mov	DWORD[8+r10*4+rdi],edx
99	add	dl,al
100	mov	r8b,BYTE[rdx*4+rdi]
101	add	cl,bl
102	mov	edx,DWORD[rcx*4+rdi]
103	mov	DWORD[rcx*4+rdi],ebx
104	mov	eax,DWORD[12+rsi*4+rdi]
105	ror	r8,8
106	mov	DWORD[12+r10*4+rdi],edx
107	add	dl,bl
108	mov	r8b,BYTE[rdx*4+rdi]
109	add	cl,al
110	mov	edx,DWORD[rcx*4+rdi]
111	mov	DWORD[rcx*4+rdi],eax
112	mov	ebx,DWORD[16+rsi*4+rdi]
113	ror	r8,8
114	mov	DWORD[16+r10*4+rdi],edx
115	add	dl,al
116	mov	r8b,BYTE[rdx*4+rdi]
117	add	cl,bl
118	mov	edx,DWORD[rcx*4+rdi]
119	mov	DWORD[rcx*4+rdi],ebx
120	mov	eax,DWORD[20+rsi*4+rdi]
121	ror	r8,8
122	mov	DWORD[20+r10*4+rdi],edx
123	add	dl,bl
124	mov	r8b,BYTE[rdx*4+rdi]
125	add	cl,al
126	mov	edx,DWORD[rcx*4+rdi]
127	mov	DWORD[rcx*4+rdi],eax
128	mov	ebx,DWORD[24+rsi*4+rdi]
129	ror	r8,8
130	mov	DWORD[24+r10*4+rdi],edx
131	add	dl,al
132	mov	r8b,BYTE[rdx*4+rdi]
133	add	sil,8
134	add	cl,bl
135	mov	edx,DWORD[rcx*4+rdi]
136	mov	DWORD[rcx*4+rdi],ebx
137	mov	eax,DWORD[((-4))+rsi*4+rdi]
138	ror	r8,8
139	mov	DWORD[28+r10*4+rdi],edx
140	add	dl,bl
141	mov	r8b,BYTE[rdx*4+rdi]
142	add	r10b,8
143	ror	r8,8
144	sub	r11,8
145
146	xor	r8,QWORD[r12]
147	mov	QWORD[r13*1+r12],r8
148	lea	r12,[8+r12]
149
150	test	r11,-8
151	jnz	NEAR $L$oop8
152	cmp	r11,0
153	jne	NEAR $L$loop1
154	jmp	NEAR $L$exit
155
156ALIGN	16
157$L$intel:
158	test	r11,-32
159	jz	NEAR $L$loop1
160	and	rbx,15
161	jz	NEAR $L$oop16_is_hot
162	sub	r11,rbx
163$L$oop16_warmup:
164	add	cl,al
165	mov	edx,DWORD[rcx*4+rdi]
166	mov	DWORD[rcx*4+rdi],eax
167	mov	DWORD[r10*4+rdi],edx
168	add	al,dl
169	inc	r10b
170	mov	edx,DWORD[rax*4+rdi]
171	mov	eax,DWORD[r10*4+rdi]
172	xor	dl,BYTE[r12]
173	mov	BYTE[r13*1+r12],dl
174	lea	r12,[1+r12]
175	dec	rbx
176	jnz	NEAR $L$oop16_warmup
177
178	mov	rbx,rcx
179	xor	rcx,rcx
180	mov	cl,bl
181
182$L$oop16_is_hot:
183	lea	rsi,[r10*4+rdi]
184	add	cl,al
185	mov	edx,DWORD[rcx*4+rdi]
186	pxor	xmm0,xmm0
187	mov	DWORD[rcx*4+rdi],eax
188	add	al,dl
189	mov	ebx,DWORD[4+rsi]
190	movzx	eax,al
191	mov	DWORD[rsi],edx
192	add	cl,bl
193	pinsrw	xmm0,WORD[rax*4+rdi],0
194	jmp	NEAR $L$oop16_enter
195ALIGN	16
196$L$oop16:
197	add	cl,al
198	mov	edx,DWORD[rcx*4+rdi]
199	pxor	xmm2,xmm0
200	psllq	xmm1,8
201	pxor	xmm0,xmm0
202	mov	DWORD[rcx*4+rdi],eax
203	add	al,dl
204	mov	ebx,DWORD[4+rsi]
205	movzx	eax,al
206	mov	DWORD[rsi],edx
207	pxor	xmm2,xmm1
208	add	cl,bl
209	pinsrw	xmm0,WORD[rax*4+rdi],0
210	movdqu	XMMWORD[r13*1+r12],xmm2
211	lea	r12,[16+r12]
212$L$oop16_enter:
213	mov	edx,DWORD[rcx*4+rdi]
214	pxor	xmm1,xmm1
215	mov	DWORD[rcx*4+rdi],ebx
216	add	bl,dl
217	mov	eax,DWORD[8+rsi]
218	movzx	ebx,bl
219	mov	DWORD[4+rsi],edx
220	add	cl,al
221	pinsrw	xmm1,WORD[rbx*4+rdi],0
222	mov	edx,DWORD[rcx*4+rdi]
223	mov	DWORD[rcx*4+rdi],eax
224	add	al,dl
225	mov	ebx,DWORD[12+rsi]
226	movzx	eax,al
227	mov	DWORD[8+rsi],edx
228	add	cl,bl
229	pinsrw	xmm0,WORD[rax*4+rdi],1
230	mov	edx,DWORD[rcx*4+rdi]
231	mov	DWORD[rcx*4+rdi],ebx
232	add	bl,dl
233	mov	eax,DWORD[16+rsi]
234	movzx	ebx,bl
235	mov	DWORD[12+rsi],edx
236	add	cl,al
237	pinsrw	xmm1,WORD[rbx*4+rdi],1
238	mov	edx,DWORD[rcx*4+rdi]
239	mov	DWORD[rcx*4+rdi],eax
240	add	al,dl
241	mov	ebx,DWORD[20+rsi]
242	movzx	eax,al
243	mov	DWORD[16+rsi],edx
244	add	cl,bl
245	pinsrw	xmm0,WORD[rax*4+rdi],2
246	mov	edx,DWORD[rcx*4+rdi]
247	mov	DWORD[rcx*4+rdi],ebx
248	add	bl,dl
249	mov	eax,DWORD[24+rsi]
250	movzx	ebx,bl
251	mov	DWORD[20+rsi],edx
252	add	cl,al
253	pinsrw	xmm1,WORD[rbx*4+rdi],2
254	mov	edx,DWORD[rcx*4+rdi]
255	mov	DWORD[rcx*4+rdi],eax
256	add	al,dl
257	mov	ebx,DWORD[28+rsi]
258	movzx	eax,al
259	mov	DWORD[24+rsi],edx
260	add	cl,bl
261	pinsrw	xmm0,WORD[rax*4+rdi],3
262	mov	edx,DWORD[rcx*4+rdi]
263	mov	DWORD[rcx*4+rdi],ebx
264	add	bl,dl
265	mov	eax,DWORD[32+rsi]
266	movzx	ebx,bl
267	mov	DWORD[28+rsi],edx
268	add	cl,al
269	pinsrw	xmm1,WORD[rbx*4+rdi],3
270	mov	edx,DWORD[rcx*4+rdi]
271	mov	DWORD[rcx*4+rdi],eax
272	add	al,dl
273	mov	ebx,DWORD[36+rsi]
274	movzx	eax,al
275	mov	DWORD[32+rsi],edx
276	add	cl,bl
277	pinsrw	xmm0,WORD[rax*4+rdi],4
278	mov	edx,DWORD[rcx*4+rdi]
279	mov	DWORD[rcx*4+rdi],ebx
280	add	bl,dl
281	mov	eax,DWORD[40+rsi]
282	movzx	ebx,bl
283	mov	DWORD[36+rsi],edx
284	add	cl,al
285	pinsrw	xmm1,WORD[rbx*4+rdi],4
286	mov	edx,DWORD[rcx*4+rdi]
287	mov	DWORD[rcx*4+rdi],eax
288	add	al,dl
289	mov	ebx,DWORD[44+rsi]
290	movzx	eax,al
291	mov	DWORD[40+rsi],edx
292	add	cl,bl
293	pinsrw	xmm0,WORD[rax*4+rdi],5
294	mov	edx,DWORD[rcx*4+rdi]
295	mov	DWORD[rcx*4+rdi],ebx
296	add	bl,dl
297	mov	eax,DWORD[48+rsi]
298	movzx	ebx,bl
299	mov	DWORD[44+rsi],edx
300	add	cl,al
301	pinsrw	xmm1,WORD[rbx*4+rdi],5
302	mov	edx,DWORD[rcx*4+rdi]
303	mov	DWORD[rcx*4+rdi],eax
304	add	al,dl
305	mov	ebx,DWORD[52+rsi]
306	movzx	eax,al
307	mov	DWORD[48+rsi],edx
308	add	cl,bl
309	pinsrw	xmm0,WORD[rax*4+rdi],6
310	mov	edx,DWORD[rcx*4+rdi]
311	mov	DWORD[rcx*4+rdi],ebx
312	add	bl,dl
313	mov	eax,DWORD[56+rsi]
314	movzx	ebx,bl
315	mov	DWORD[52+rsi],edx
316	add	cl,al
317	pinsrw	xmm1,WORD[rbx*4+rdi],6
318	mov	edx,DWORD[rcx*4+rdi]
319	mov	DWORD[rcx*4+rdi],eax
320	add	al,dl
321	mov	ebx,DWORD[60+rsi]
322	movzx	eax,al
323	mov	DWORD[56+rsi],edx
324	add	cl,bl
325	pinsrw	xmm0,WORD[rax*4+rdi],7
326	add	r10b,16
327	movdqu	xmm2,XMMWORD[r12]
328	mov	edx,DWORD[rcx*4+rdi]
329	mov	DWORD[rcx*4+rdi],ebx
330	add	bl,dl
331	movzx	ebx,bl
332	mov	DWORD[60+rsi],edx
333	lea	rsi,[r10*4+rdi]
334	pinsrw	xmm1,WORD[rbx*4+rdi],7
335	mov	eax,DWORD[rsi]
336	mov	rbx,rcx
337	xor	rcx,rcx
338	sub	r11,16
339	mov	cl,bl
340	test	r11,-16
341	jnz	NEAR $L$oop16
342
343	psllq	xmm1,8
344	pxor	xmm2,xmm0
345	pxor	xmm2,xmm1
346	movdqu	XMMWORD[r13*1+r12],xmm2
347	lea	r12,[16+r12]
348
349	cmp	r11,0
350	jne	NEAR $L$loop1
351	jmp	NEAR $L$exit
352
353ALIGN	16
354$L$loop1:
355	add	cl,al
356	mov	edx,DWORD[rcx*4+rdi]
357	mov	DWORD[rcx*4+rdi],eax
358	mov	DWORD[r10*4+rdi],edx
359	add	al,dl
360	inc	r10b
361	mov	edx,DWORD[rax*4+rdi]
362	mov	eax,DWORD[r10*4+rdi]
363	xor	dl,BYTE[r12]
364	mov	BYTE[r13*1+r12],dl
365	lea	r12,[1+r12]
366	dec	r11
367	jnz	NEAR $L$loop1
368	jmp	NEAR $L$exit
369
370ALIGN	16
371$L$RC4_CHAR:
372	add	r10b,1
373	movzx	eax,BYTE[r10*1+rdi]
374	test	r11,-8
375	jz	NEAR $L$cloop1
376	jmp	NEAR $L$cloop8
377ALIGN	16
378$L$cloop8:
379	mov	r8d,DWORD[r12]
380	mov	r9d,DWORD[4+r12]
381	add	cl,al
382	lea	rsi,[1+r10]
383	movzx	edx,BYTE[rcx*1+rdi]
384	movzx	esi,sil
385	movzx	ebx,BYTE[rsi*1+rdi]
386	mov	BYTE[rcx*1+rdi],al
387	cmp	rcx,rsi
388	mov	BYTE[r10*1+rdi],dl
389	jne	NEAR $L$cmov0
390	mov	rbx,rax
391$L$cmov0:
392	add	dl,al
393	xor	r8b,BYTE[rdx*1+rdi]
394	ror	r8d,8
395	add	cl,bl
396	lea	r10,[1+rsi]
397	movzx	edx,BYTE[rcx*1+rdi]
398	movzx	r10d,r10b
399	movzx	eax,BYTE[r10*1+rdi]
400	mov	BYTE[rcx*1+rdi],bl
401	cmp	rcx,r10
402	mov	BYTE[rsi*1+rdi],dl
403	jne	NEAR $L$cmov1
404	mov	rax,rbx
405$L$cmov1:
406	add	dl,bl
407	xor	r8b,BYTE[rdx*1+rdi]
408	ror	r8d,8
409	add	cl,al
410	lea	rsi,[1+r10]
411	movzx	edx,BYTE[rcx*1+rdi]
412	movzx	esi,sil
413	movzx	ebx,BYTE[rsi*1+rdi]
414	mov	BYTE[rcx*1+rdi],al
415	cmp	rcx,rsi
416	mov	BYTE[r10*1+rdi],dl
417	jne	NEAR $L$cmov2
418	mov	rbx,rax
419$L$cmov2:
420	add	dl,al
421	xor	r8b,BYTE[rdx*1+rdi]
422	ror	r8d,8
423	add	cl,bl
424	lea	r10,[1+rsi]
425	movzx	edx,BYTE[rcx*1+rdi]
426	movzx	r10d,r10b
427	movzx	eax,BYTE[r10*1+rdi]
428	mov	BYTE[rcx*1+rdi],bl
429	cmp	rcx,r10
430	mov	BYTE[rsi*1+rdi],dl
431	jne	NEAR $L$cmov3
432	mov	rax,rbx
433$L$cmov3:
434	add	dl,bl
435	xor	r8b,BYTE[rdx*1+rdi]
436	ror	r8d,8
437	add	cl,al
438	lea	rsi,[1+r10]
439	movzx	edx,BYTE[rcx*1+rdi]
440	movzx	esi,sil
441	movzx	ebx,BYTE[rsi*1+rdi]
442	mov	BYTE[rcx*1+rdi],al
443	cmp	rcx,rsi
444	mov	BYTE[r10*1+rdi],dl
445	jne	NEAR $L$cmov4
446	mov	rbx,rax
447$L$cmov4:
448	add	dl,al
449	xor	r9b,BYTE[rdx*1+rdi]
450	ror	r9d,8
451	add	cl,bl
452	lea	r10,[1+rsi]
453	movzx	edx,BYTE[rcx*1+rdi]
454	movzx	r10d,r10b
455	movzx	eax,BYTE[r10*1+rdi]
456	mov	BYTE[rcx*1+rdi],bl
457	cmp	rcx,r10
458	mov	BYTE[rsi*1+rdi],dl
459	jne	NEAR $L$cmov5
460	mov	rax,rbx
461$L$cmov5:
462	add	dl,bl
463	xor	r9b,BYTE[rdx*1+rdi]
464	ror	r9d,8
465	add	cl,al
466	lea	rsi,[1+r10]
467	movzx	edx,BYTE[rcx*1+rdi]
468	movzx	esi,sil
469	movzx	ebx,BYTE[rsi*1+rdi]
470	mov	BYTE[rcx*1+rdi],al
471	cmp	rcx,rsi
472	mov	BYTE[r10*1+rdi],dl
473	jne	NEAR $L$cmov6
474	mov	rbx,rax
475$L$cmov6:
476	add	dl,al
477	xor	r9b,BYTE[rdx*1+rdi]
478	ror	r9d,8
479	add	cl,bl
480	lea	r10,[1+rsi]
481	movzx	edx,BYTE[rcx*1+rdi]
482	movzx	r10d,r10b
483	movzx	eax,BYTE[r10*1+rdi]
484	mov	BYTE[rcx*1+rdi],bl
485	cmp	rcx,r10
486	mov	BYTE[rsi*1+rdi],dl
487	jne	NEAR $L$cmov7
488	mov	rax,rbx
489$L$cmov7:
490	add	dl,bl
491	xor	r9b,BYTE[rdx*1+rdi]
492	ror	r9d,8
493	lea	r11,[((-8))+r11]
494	mov	DWORD[r13],r8d
495	lea	r12,[8+r12]
496	mov	DWORD[4+r13],r9d
497	lea	r13,[8+r13]
498
499	test	r11,-8
500	jnz	NEAR $L$cloop8
501	cmp	r11,0
502	jne	NEAR $L$cloop1
503	jmp	NEAR $L$exit
504ALIGN	16
505$L$cloop1:
506	add	cl,al
507	movzx	ecx,cl
508	movzx	edx,BYTE[rcx*1+rdi]
509	mov	BYTE[rcx*1+rdi],al
510	mov	BYTE[r10*1+rdi],dl
511	add	dl,al
512	add	r10b,1
513	movzx	edx,dl
514	movzx	r10d,r10b
515	movzx	edx,BYTE[rdx*1+rdi]
516	movzx	eax,BYTE[r10*1+rdi]
517	xor	dl,BYTE[r12]
518	lea	r12,[1+r12]
519	mov	BYTE[r13],dl
520	lea	r13,[1+r13]
521	sub	r11,1
522	jnz	NEAR $L$cloop1
523	jmp	NEAR $L$exit
524
525ALIGN	16
526$L$exit:
527	sub	r10b,1
528	mov	DWORD[((-8))+rdi],r10d
529	mov	DWORD[((-4))+rdi],ecx
530
531	mov	r13,QWORD[rsp]
532	mov	r12,QWORD[8+rsp]
533	mov	rbx,QWORD[16+rsp]
534	add	rsp,24
535$L$epilogue:
536	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
537	mov	rsi,QWORD[16+rsp]
538	DB	0F3h,0C3h		;repret
539$L$SEH_end_asm_RC4:
540global	asm_RC4_set_key
541
542ALIGN	16
543asm_RC4_set_key:
544	mov	QWORD[8+rsp],rdi	;WIN64 prologue
545	mov	QWORD[16+rsp],rsi
546	mov	rax,rsp
547$L$SEH_begin_asm_RC4_set_key:
548	mov	rdi,rcx
549	mov	rsi,rdx
550	mov	rdx,r8
551
552
553	lea	rdi,[8+rdi]
554	lea	rdx,[rsi*1+rdx]
555	neg	rsi
556	mov	rcx,rsi
557	xor	eax,eax
558	xor	r9,r9
559	xor	r10,r10
560	xor	r11,r11
561
562	mov	r8d,DWORD[OPENSSL_ia32cap_P]
563	bt	r8d,20
564	jc	NEAR $L$c1stloop
565	jmp	NEAR $L$w1stloop
566
567ALIGN	16
568$L$w1stloop:
569	mov	DWORD[rax*4+rdi],eax
570	add	al,1
571	jnc	NEAR $L$w1stloop
572
573	xor	r9,r9
574	xor	r8,r8
575ALIGN	16
576$L$w2ndloop:
577	mov	r10d,DWORD[r9*4+rdi]
578	add	r8b,BYTE[rsi*1+rdx]
579	add	r8b,r10b
580	add	rsi,1
581	mov	r11d,DWORD[r8*4+rdi]
582	cmovz	rsi,rcx
583	mov	DWORD[r8*4+rdi],r10d
584	mov	DWORD[r9*4+rdi],r11d
585	add	r9b,1
586	jnc	NEAR $L$w2ndloop
587	jmp	NEAR $L$exit_key
588
589ALIGN	16
590$L$c1stloop:
591	mov	BYTE[rax*1+rdi],al
592	add	al,1
593	jnc	NEAR $L$c1stloop
594
595	xor	r9,r9
596	xor	r8,r8
597ALIGN	16
598$L$c2ndloop:
599	mov	r10b,BYTE[r9*1+rdi]
600	add	r8b,BYTE[rsi*1+rdx]
601	add	r8b,r10b
602	add	rsi,1
603	mov	r11b,BYTE[r8*1+rdi]
604	jnz	NEAR $L$cnowrap
605	mov	rsi,rcx
606$L$cnowrap:
607	mov	BYTE[r8*1+rdi],r10b
608	mov	BYTE[r9*1+rdi],r11b
609	add	r9b,1
610	jnc	NEAR $L$c2ndloop
611	mov	DWORD[256+rdi],-1
612
613ALIGN	16
614$L$exit_key:
615	xor	eax,eax
616	mov	DWORD[((-8))+rdi],eax
617	mov	DWORD[((-4))+rdi],eax
618	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
619	mov	rsi,QWORD[16+rsp]
620	DB	0F3h,0C3h		;repret
621$L$SEH_end_asm_RC4_set_key:
622EXTERN	__imp_RtlVirtualUnwind
623
624ALIGN	16
625stream_se_handler:
626	push	rsi
627	push	rdi
628	push	rbx
629	push	rbp
630	push	r12
631	push	r13
632	push	r14
633	push	r15
634	pushfq
635	sub	rsp,64
636
637	mov	rax,QWORD[120+r8]
638	mov	rbx,QWORD[248+r8]
639
640	lea	r10,[$L$prologue]
641	cmp	rbx,r10
642	jb	NEAR $L$in_prologue
643
644	mov	rax,QWORD[152+r8]
645
646	lea	r10,[$L$epilogue]
647	cmp	rbx,r10
648	jae	NEAR $L$in_prologue
649
650	lea	rax,[24+rax]
651
652	mov	rbx,QWORD[((-8))+rax]
653	mov	r12,QWORD[((-16))+rax]
654	mov	r13,QWORD[((-24))+rax]
655	mov	QWORD[144+r8],rbx
656	mov	QWORD[216+r8],r12
657	mov	QWORD[224+r8],r13
658
659$L$in_prologue:
660	mov	rdi,QWORD[8+rax]
661	mov	rsi,QWORD[16+rax]
662	mov	QWORD[152+r8],rax
663	mov	QWORD[168+r8],rsi
664	mov	QWORD[176+r8],rdi
665
666	jmp	NEAR $L$common_seh_exit
667
668
669
670ALIGN	16
671key_se_handler:
672	push	rsi
673	push	rdi
674	push	rbx
675	push	rbp
676	push	r12
677	push	r13
678	push	r14
679	push	r15
680	pushfq
681	sub	rsp,64
682
683	mov	rax,QWORD[152+r8]
684	mov	rdi,QWORD[8+rax]
685	mov	rsi,QWORD[16+rax]
686	mov	QWORD[168+r8],rsi
687	mov	QWORD[176+r8],rdi
688
689$L$common_seh_exit:
690
691	mov	rdi,QWORD[40+r9]
692	mov	rsi,r8
693	mov	ecx,154
694	DD	0xa548f3fc
695
696	mov	rsi,r9
697	xor	rcx,rcx
698	mov	rdx,QWORD[8+rsi]
699	mov	r8,QWORD[rsi]
700	mov	r9,QWORD[16+rsi]
701	mov	r10,QWORD[40+rsi]
702	lea	r11,[56+rsi]
703	lea	r12,[24+rsi]
704	mov	QWORD[32+rsp],r10
705	mov	QWORD[40+rsp],r11
706	mov	QWORD[48+rsp],r12
707	mov	QWORD[56+rsp],rcx
708	call	QWORD[__imp_RtlVirtualUnwind]
709
710	mov	eax,1
711	add	rsp,64
712	popfq
713	pop	r15
714	pop	r14
715	pop	r13
716	pop	r12
717	pop	rbp
718	pop	rbx
719	pop	rdi
720	pop	rsi
721	DB	0F3h,0C3h		;repret
722
723
724section	.pdata rdata align=4
725ALIGN	4
726	DD	$L$SEH_begin_asm_RC4 wrt ..imagebase
727	DD	$L$SEH_end_asm_RC4 wrt ..imagebase
728	DD	$L$SEH_info_asm_RC4 wrt ..imagebase
729
730	DD	$L$SEH_begin_asm_RC4_set_key wrt ..imagebase
731	DD	$L$SEH_end_asm_RC4_set_key wrt ..imagebase
732	DD	$L$SEH_info_asm_RC4_set_key wrt ..imagebase
733
734section	.xdata rdata align=8
735ALIGN	8
736$L$SEH_info_asm_RC4:
737DB	9,0,0,0
738	DD	stream_se_handler wrt ..imagebase
739$L$SEH_info_asm_RC4_set_key:
740DB	9,0,0,0
741	DD	key_se_handler wrt ..imagebase
742