summaryrefslogtreecommitdiff
path: root/CryptoPkg/Library/OpensslLib/OpensslGen/X64-MSFT/crypto/aes/aesni-mb-x86_64.nasm
blob: 7908342cf4c7624ff48f5f77a758e2b2fd15e712 (plain)
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
default rel
%define XMMWORD
%define YMMWORD
%define ZMMWORD
section .text code align=64


EXTERN  OPENSSL_ia32cap_P

global  aesni_multi_cbc_encrypt

ALIGN   32
aesni_multi_cbc_encrypt:
        mov     QWORD[8+rsp],rdi        ;WIN64 prologue
        mov     QWORD[16+rsp],rsi
        mov     rax,rsp
$L$SEH_begin_aesni_multi_cbc_encrypt:
        mov     rdi,rcx
        mov     rsi,rdx
        mov     rdx,r8



        cmp     edx,2
        jb      NEAR $L$enc_non_avx
        mov     ecx,DWORD[((OPENSSL_ia32cap_P+4))]
        test    ecx,268435456
        jnz     NEAR _avx_cbc_enc_shortcut
        jmp     NEAR $L$enc_non_avx
ALIGN   16
$L$enc_non_avx:
        mov     rax,rsp

        push    rbx

        push    rbp

        push    r12

        push    r13

        push    r14

        push    r15

        lea     rsp,[((-168))+rsp]
        movaps  XMMWORD[rsp],xmm6
        movaps  XMMWORD[16+rsp],xmm7
        movaps  XMMWORD[32+rsp],xmm8
        movaps  XMMWORD[48+rsp],xmm9
        movaps  XMMWORD[64+rsp],xmm10
        movaps  XMMWORD[80+rsp],xmm11
        movaps  XMMWORD[96+rsp],xmm12
        movaps  XMMWORD[(-104)+rax],xmm13
        movaps  XMMWORD[(-88)+rax],xmm14
        movaps  XMMWORD[(-72)+rax],xmm15






        sub     rsp,48
        and     rsp,-64
        mov     QWORD[16+rsp],rax


$L$enc4x_body:
        movdqu  xmm12,XMMWORD[rsi]
        lea     rsi,[120+rsi]
        lea     rdi,[80+rdi]

$L$enc4x_loop_grande:
        mov     DWORD[24+rsp],edx
        xor     edx,edx

        mov     ecx,DWORD[((-64))+rdi]
        mov     r8,QWORD[((-80))+rdi]
        cmp     ecx,edx
        mov     r12,QWORD[((-72))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm2,XMMWORD[((-56))+rdi]
        mov     DWORD[32+rsp],ecx
        cmovle  r8,rsp

        mov     ecx,DWORD[((-24))+rdi]
        mov     r9,QWORD[((-40))+rdi]
        cmp     ecx,edx
        mov     r13,QWORD[((-32))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm3,XMMWORD[((-16))+rdi]
        mov     DWORD[36+rsp],ecx
        cmovle  r9,rsp

        mov     ecx,DWORD[16+rdi]
        mov     r10,QWORD[rdi]
        cmp     ecx,edx
        mov     r14,QWORD[8+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm4,XMMWORD[24+rdi]
        mov     DWORD[40+rsp],ecx
        cmovle  r10,rsp

        mov     ecx,DWORD[56+rdi]
        mov     r11,QWORD[40+rdi]
        cmp     ecx,edx
        mov     r15,QWORD[48+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm5,XMMWORD[64+rdi]
        mov     DWORD[44+rsp],ecx
        cmovle  r11,rsp
        test    edx,edx
        jz      NEAR $L$enc4x_done

        movups  xmm1,XMMWORD[((16-120))+rsi]
        pxor    xmm2,xmm12
        movups  xmm0,XMMWORD[((32-120))+rsi]
        pxor    xmm3,xmm12
        mov     eax,DWORD[((240-120))+rsi]
        pxor    xmm4,xmm12
        movdqu  xmm6,XMMWORD[r8]
        pxor    xmm5,xmm12
        movdqu  xmm7,XMMWORD[r9]
        pxor    xmm2,xmm6
        movdqu  xmm8,XMMWORD[r10]
        pxor    xmm3,xmm7
        movdqu  xmm9,XMMWORD[r11]
        pxor    xmm4,xmm8
        pxor    xmm5,xmm9
        movdqa  xmm10,XMMWORD[32+rsp]
        xor     rbx,rbx
        jmp     NEAR $L$oop_enc4x

ALIGN   32
$L$oop_enc4x:
        add     rbx,16
        lea     rbp,[16+rsp]
        mov     ecx,1
        sub     rbp,rbx

DB      102,15,56,220,209
        prefetcht0      [31+rbx*1+r8]
        prefetcht0      [31+rbx*1+r9]
DB      102,15,56,220,217
        prefetcht0      [31+rbx*1+r10]
        prefetcht0      [31+rbx*1+r10]
DB      102,15,56,220,225
DB      102,15,56,220,233
        movups  xmm1,XMMWORD[((48-120))+rsi]
        cmp     ecx,DWORD[32+rsp]
DB      102,15,56,220,208
DB      102,15,56,220,216
DB      102,15,56,220,224
        cmovge  r8,rbp
        cmovg   r12,rbp
DB      102,15,56,220,232
        movups  xmm0,XMMWORD[((-56))+rsi]
        cmp     ecx,DWORD[36+rsp]
DB      102,15,56,220,209
DB      102,15,56,220,217
DB      102,15,56,220,225
        cmovge  r9,rbp
        cmovg   r13,rbp
DB      102,15,56,220,233
        movups  xmm1,XMMWORD[((-40))+rsi]
        cmp     ecx,DWORD[40+rsp]
DB      102,15,56,220,208
DB      102,15,56,220,216
DB      102,15,56,220,224
        cmovge  r10,rbp
        cmovg   r14,rbp
DB      102,15,56,220,232
        movups  xmm0,XMMWORD[((-24))+rsi]
        cmp     ecx,DWORD[44+rsp]
DB      102,15,56,220,209
DB      102,15,56,220,217
DB      102,15,56,220,225
        cmovge  r11,rbp
        cmovg   r15,rbp
DB      102,15,56,220,233
        movups  xmm1,XMMWORD[((-8))+rsi]
        movdqa  xmm11,xmm10
DB      102,15,56,220,208
        prefetcht0      [15+rbx*1+r12]
        prefetcht0      [15+rbx*1+r13]
DB      102,15,56,220,216
        prefetcht0      [15+rbx*1+r14]
        prefetcht0      [15+rbx*1+r15]
DB      102,15,56,220,224
DB      102,15,56,220,232
        movups  xmm0,XMMWORD[((128-120))+rsi]
        pxor    xmm12,xmm12

DB      102,15,56,220,209
        pcmpgtd xmm11,xmm12
        movdqu  xmm12,XMMWORD[((-120))+rsi]
DB      102,15,56,220,217
        paddd   xmm10,xmm11
        movdqa  XMMWORD[32+rsp],xmm10
DB      102,15,56,220,225
DB      102,15,56,220,233
        movups  xmm1,XMMWORD[((144-120))+rsi]

        cmp     eax,11

DB      102,15,56,220,208
DB      102,15,56,220,216
DB      102,15,56,220,224
DB      102,15,56,220,232
        movups  xmm0,XMMWORD[((160-120))+rsi]

        jb      NEAR $L$enc4x_tail

DB      102,15,56,220,209
DB      102,15,56,220,217
DB      102,15,56,220,225
DB      102,15,56,220,233
        movups  xmm1,XMMWORD[((176-120))+rsi]

DB      102,15,56,220,208
DB      102,15,56,220,216
DB      102,15,56,220,224
DB      102,15,56,220,232
        movups  xmm0,XMMWORD[((192-120))+rsi]

        je      NEAR $L$enc4x_tail

DB      102,15,56,220,209
DB      102,15,56,220,217
DB      102,15,56,220,225
DB      102,15,56,220,233
        movups  xmm1,XMMWORD[((208-120))+rsi]

DB      102,15,56,220,208
DB      102,15,56,220,216
DB      102,15,56,220,224
DB      102,15,56,220,232
        movups  xmm0,XMMWORD[((224-120))+rsi]
        jmp     NEAR $L$enc4x_tail

ALIGN   32
$L$enc4x_tail:
DB      102,15,56,220,209
DB      102,15,56,220,217
DB      102,15,56,220,225
DB      102,15,56,220,233
        movdqu  xmm6,XMMWORD[rbx*1+r8]
        movdqu  xmm1,XMMWORD[((16-120))+rsi]

DB      102,15,56,221,208
        movdqu  xmm7,XMMWORD[rbx*1+r9]
        pxor    xmm6,xmm12
DB      102,15,56,221,216
        movdqu  xmm8,XMMWORD[rbx*1+r10]
        pxor    xmm7,xmm12
DB      102,15,56,221,224
        movdqu  xmm9,XMMWORD[rbx*1+r11]
        pxor    xmm8,xmm12
DB      102,15,56,221,232
        movdqu  xmm0,XMMWORD[((32-120))+rsi]
        pxor    xmm9,xmm12

        movups  XMMWORD[(-16)+rbx*1+r12],xmm2
        pxor    xmm2,xmm6
        movups  XMMWORD[(-16)+rbx*1+r13],xmm3
        pxor    xmm3,xmm7
        movups  XMMWORD[(-16)+rbx*1+r14],xmm4
        pxor    xmm4,xmm8
        movups  XMMWORD[(-16)+rbx*1+r15],xmm5
        pxor    xmm5,xmm9

        dec     edx
        jnz     NEAR $L$oop_enc4x

        mov     rax,QWORD[16+rsp]

        mov     edx,DWORD[24+rsp]











        lea     rdi,[160+rdi]
        dec     edx
        jnz     NEAR $L$enc4x_loop_grande

$L$enc4x_done:
        movaps  xmm6,XMMWORD[((-216))+rax]
        movaps  xmm7,XMMWORD[((-200))+rax]
        movaps  xmm8,XMMWORD[((-184))+rax]
        movaps  xmm9,XMMWORD[((-168))+rax]
        movaps  xmm10,XMMWORD[((-152))+rax]
        movaps  xmm11,XMMWORD[((-136))+rax]
        movaps  xmm12,XMMWORD[((-120))+rax]



        mov     r15,QWORD[((-48))+rax]

        mov     r14,QWORD[((-40))+rax]

        mov     r13,QWORD[((-32))+rax]

        mov     r12,QWORD[((-24))+rax]

        mov     rbp,QWORD[((-16))+rax]

        mov     rbx,QWORD[((-8))+rax]

        lea     rsp,[rax]

$L$enc4x_epilogue:
        mov     rdi,QWORD[8+rsp]        ;WIN64 epilogue
        mov     rsi,QWORD[16+rsp]
        DB      0F3h,0C3h               ;repret

$L$SEH_end_aesni_multi_cbc_encrypt:

global  aesni_multi_cbc_decrypt

ALIGN   32
aesni_multi_cbc_decrypt:
        mov     QWORD[8+rsp],rdi        ;WIN64 prologue
        mov     QWORD[16+rsp],rsi
        mov     rax,rsp
$L$SEH_begin_aesni_multi_cbc_decrypt:
        mov     rdi,rcx
        mov     rsi,rdx
        mov     rdx,r8



        cmp     edx,2
        jb      NEAR $L$dec_non_avx
        mov     ecx,DWORD[((OPENSSL_ia32cap_P+4))]
        test    ecx,268435456
        jnz     NEAR _avx_cbc_dec_shortcut
        jmp     NEAR $L$dec_non_avx
ALIGN   16
$L$dec_non_avx:
        mov     rax,rsp

        push    rbx

        push    rbp

        push    r12

        push    r13

        push    r14

        push    r15

        lea     rsp,[((-168))+rsp]
        movaps  XMMWORD[rsp],xmm6
        movaps  XMMWORD[16+rsp],xmm7
        movaps  XMMWORD[32+rsp],xmm8
        movaps  XMMWORD[48+rsp],xmm9
        movaps  XMMWORD[64+rsp],xmm10
        movaps  XMMWORD[80+rsp],xmm11
        movaps  XMMWORD[96+rsp],xmm12
        movaps  XMMWORD[(-104)+rax],xmm13
        movaps  XMMWORD[(-88)+rax],xmm14
        movaps  XMMWORD[(-72)+rax],xmm15






        sub     rsp,48
        and     rsp,-64
        mov     QWORD[16+rsp],rax


$L$dec4x_body:
        movdqu  xmm12,XMMWORD[rsi]
        lea     rsi,[120+rsi]
        lea     rdi,[80+rdi]

$L$dec4x_loop_grande:
        mov     DWORD[24+rsp],edx
        xor     edx,edx

        mov     ecx,DWORD[((-64))+rdi]
        mov     r8,QWORD[((-80))+rdi]
        cmp     ecx,edx
        mov     r12,QWORD[((-72))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm6,XMMWORD[((-56))+rdi]
        mov     DWORD[32+rsp],ecx
        cmovle  r8,rsp

        mov     ecx,DWORD[((-24))+rdi]
        mov     r9,QWORD[((-40))+rdi]
        cmp     ecx,edx
        mov     r13,QWORD[((-32))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm7,XMMWORD[((-16))+rdi]
        mov     DWORD[36+rsp],ecx
        cmovle  r9,rsp

        mov     ecx,DWORD[16+rdi]
        mov     r10,QWORD[rdi]
        cmp     ecx,edx
        mov     r14,QWORD[8+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm8,XMMWORD[24+rdi]
        mov     DWORD[40+rsp],ecx
        cmovle  r10,rsp

        mov     ecx,DWORD[56+rdi]
        mov     r11,QWORD[40+rdi]
        cmp     ecx,edx
        mov     r15,QWORD[48+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        movdqu  xmm9,XMMWORD[64+rdi]
        mov     DWORD[44+rsp],ecx
        cmovle  r11,rsp
        test    edx,edx
        jz      NEAR $L$dec4x_done

        movups  xmm1,XMMWORD[((16-120))+rsi]
        movups  xmm0,XMMWORD[((32-120))+rsi]
        mov     eax,DWORD[((240-120))+rsi]
        movdqu  xmm2,XMMWORD[r8]
        movdqu  xmm3,XMMWORD[r9]
        pxor    xmm2,xmm12
        movdqu  xmm4,XMMWORD[r10]
        pxor    xmm3,xmm12
        movdqu  xmm5,XMMWORD[r11]
        pxor    xmm4,xmm12
        pxor    xmm5,xmm12
        movdqa  xmm10,XMMWORD[32+rsp]
        xor     rbx,rbx
        jmp     NEAR $L$oop_dec4x

ALIGN   32
$L$oop_dec4x:
        add     rbx,16
        lea     rbp,[16+rsp]
        mov     ecx,1
        sub     rbp,rbx

DB      102,15,56,222,209
        prefetcht0      [31+rbx*1+r8]
        prefetcht0      [31+rbx*1+r9]
DB      102,15,56,222,217
        prefetcht0      [31+rbx*1+r10]
        prefetcht0      [31+rbx*1+r11]
DB      102,15,56,222,225
DB      102,15,56,222,233
        movups  xmm1,XMMWORD[((48-120))+rsi]
        cmp     ecx,DWORD[32+rsp]
DB      102,15,56,222,208
DB      102,15,56,222,216
DB      102,15,56,222,224
        cmovge  r8,rbp
        cmovg   r12,rbp
DB      102,15,56,222,232
        movups  xmm0,XMMWORD[((-56))+rsi]
        cmp     ecx,DWORD[36+rsp]
DB      102,15,56,222,209
DB      102,15,56,222,217
DB      102,15,56,222,225
        cmovge  r9,rbp
        cmovg   r13,rbp
DB      102,15,56,222,233
        movups  xmm1,XMMWORD[((-40))+rsi]
        cmp     ecx,DWORD[40+rsp]
DB      102,15,56,222,208
DB      102,15,56,222,216
DB      102,15,56,222,224
        cmovge  r10,rbp
        cmovg   r14,rbp
DB      102,15,56,222,232
        movups  xmm0,XMMWORD[((-24))+rsi]
        cmp     ecx,DWORD[44+rsp]
DB      102,15,56,222,209
DB      102,15,56,222,217
DB      102,15,56,222,225
        cmovge  r11,rbp
        cmovg   r15,rbp
DB      102,15,56,222,233
        movups  xmm1,XMMWORD[((-8))+rsi]
        movdqa  xmm11,xmm10
DB      102,15,56,222,208
        prefetcht0      [15+rbx*1+r12]
        prefetcht0      [15+rbx*1+r13]
DB      102,15,56,222,216
        prefetcht0      [15+rbx*1+r14]
        prefetcht0      [15+rbx*1+r15]
DB      102,15,56,222,224
DB      102,15,56,222,232
        movups  xmm0,XMMWORD[((128-120))+rsi]
        pxor    xmm12,xmm12

DB      102,15,56,222,209
        pcmpgtd xmm11,xmm12
        movdqu  xmm12,XMMWORD[((-120))+rsi]
DB      102,15,56,222,217
        paddd   xmm10,xmm11
        movdqa  XMMWORD[32+rsp],xmm10
DB      102,15,56,222,225
DB      102,15,56,222,233
        movups  xmm1,XMMWORD[((144-120))+rsi]

        cmp     eax,11

DB      102,15,56,222,208
DB      102,15,56,222,216
DB      102,15,56,222,224
DB      102,15,56,222,232
        movups  xmm0,XMMWORD[((160-120))+rsi]

        jb      NEAR $L$dec4x_tail

DB      102,15,56,222,209
DB      102,15,56,222,217
DB      102,15,56,222,225
DB      102,15,56,222,233
        movups  xmm1,XMMWORD[((176-120))+rsi]

DB      102,15,56,222,208
DB      102,15,56,222,216
DB      102,15,56,222,224
DB      102,15,56,222,232
        movups  xmm0,XMMWORD[((192-120))+rsi]

        je      NEAR $L$dec4x_tail

DB      102,15,56,222,209
DB      102,15,56,222,217
DB      102,15,56,222,225
DB      102,15,56,222,233
        movups  xmm1,XMMWORD[((208-120))+rsi]

DB      102,15,56,222,208
DB      102,15,56,222,216
DB      102,15,56,222,224
DB      102,15,56,222,232
        movups  xmm0,XMMWORD[((224-120))+rsi]
        jmp     NEAR $L$dec4x_tail

ALIGN   32
$L$dec4x_tail:
DB      102,15,56,222,209
DB      102,15,56,222,217
DB      102,15,56,222,225
        pxor    xmm6,xmm0
        pxor    xmm7,xmm0
DB      102,15,56,222,233
        movdqu  xmm1,XMMWORD[((16-120))+rsi]
        pxor    xmm8,xmm0
        pxor    xmm9,xmm0
        movdqu  xmm0,XMMWORD[((32-120))+rsi]

DB      102,15,56,223,214
DB      102,15,56,223,223
        movdqu  xmm6,XMMWORD[((-16))+rbx*1+r8]
        movdqu  xmm7,XMMWORD[((-16))+rbx*1+r9]
DB      102,65,15,56,223,224
DB      102,65,15,56,223,233
        movdqu  xmm8,XMMWORD[((-16))+rbx*1+r10]
        movdqu  xmm9,XMMWORD[((-16))+rbx*1+r11]

        movups  XMMWORD[(-16)+rbx*1+r12],xmm2
        movdqu  xmm2,XMMWORD[rbx*1+r8]
        movups  XMMWORD[(-16)+rbx*1+r13],xmm3
        movdqu  xmm3,XMMWORD[rbx*1+r9]
        pxor    xmm2,xmm12
        movups  XMMWORD[(-16)+rbx*1+r14],xmm4
        movdqu  xmm4,XMMWORD[rbx*1+r10]
        pxor    xmm3,xmm12
        movups  XMMWORD[(-16)+rbx*1+r15],xmm5
        movdqu  xmm5,XMMWORD[rbx*1+r11]
        pxor    xmm4,xmm12
        pxor    xmm5,xmm12

        dec     edx
        jnz     NEAR $L$oop_dec4x

        mov     rax,QWORD[16+rsp]

        mov     edx,DWORD[24+rsp]

        lea     rdi,[160+rdi]
        dec     edx
        jnz     NEAR $L$dec4x_loop_grande

$L$dec4x_done:
        movaps  xmm6,XMMWORD[((-216))+rax]
        movaps  xmm7,XMMWORD[((-200))+rax]
        movaps  xmm8,XMMWORD[((-184))+rax]
        movaps  xmm9,XMMWORD[((-168))+rax]
        movaps  xmm10,XMMWORD[((-152))+rax]
        movaps  xmm11,XMMWORD[((-136))+rax]
        movaps  xmm12,XMMWORD[((-120))+rax]



        mov     r15,QWORD[((-48))+rax]

        mov     r14,QWORD[((-40))+rax]

        mov     r13,QWORD[((-32))+rax]

        mov     r12,QWORD[((-24))+rax]

        mov     rbp,QWORD[((-16))+rax]

        mov     rbx,QWORD[((-8))+rax]

        lea     rsp,[rax]

$L$dec4x_epilogue:
        mov     rdi,QWORD[8+rsp]        ;WIN64 epilogue
        mov     rsi,QWORD[16+rsp]
        DB      0F3h,0C3h               ;repret

$L$SEH_end_aesni_multi_cbc_decrypt:

ALIGN   32
aesni_multi_cbc_encrypt_avx:
        mov     QWORD[8+rsp],rdi        ;WIN64 prologue
        mov     QWORD[16+rsp],rsi
        mov     rax,rsp
$L$SEH_begin_aesni_multi_cbc_encrypt_avx:
        mov     rdi,rcx
        mov     rsi,rdx
        mov     rdx,r8



_avx_cbc_enc_shortcut:
        mov     rax,rsp

        push    rbx

        push    rbp

        push    r12

        push    r13

        push    r14

        push    r15

        lea     rsp,[((-168))+rsp]
        movaps  XMMWORD[rsp],xmm6
        movaps  XMMWORD[16+rsp],xmm7
        movaps  XMMWORD[32+rsp],xmm8
        movaps  XMMWORD[48+rsp],xmm9
        movaps  XMMWORD[64+rsp],xmm10
        movaps  XMMWORD[80+rsp],xmm11
        movaps  XMMWORD[(-120)+rax],xmm12
        movaps  XMMWORD[(-104)+rax],xmm13
        movaps  XMMWORD[(-88)+rax],xmm14
        movaps  XMMWORD[(-72)+rax],xmm15








        sub     rsp,192
        and     rsp,-128
        mov     QWORD[16+rsp],rax


$L$enc8x_body:
        vzeroupper
        vmovdqu xmm15,XMMWORD[rsi]
        lea     rsi,[120+rsi]
        lea     rdi,[160+rdi]
        shr     edx,1

$L$enc8x_loop_grande:

        xor     edx,edx

        mov     ecx,DWORD[((-144))+rdi]

        mov     r8,QWORD[((-160))+rdi]
        cmp     ecx,edx

        mov     rbx,QWORD[((-152))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm2,XMMWORD[((-136))+rdi]
        mov     DWORD[32+rsp],ecx
        cmovle  r8,rsp
        sub     rbx,r8
        mov     QWORD[64+rsp],rbx

        mov     ecx,DWORD[((-104))+rdi]

        mov     r9,QWORD[((-120))+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[((-112))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm3,XMMWORD[((-96))+rdi]
        mov     DWORD[36+rsp],ecx
        cmovle  r9,rsp
        sub     rbp,r9
        mov     QWORD[72+rsp],rbp

        mov     ecx,DWORD[((-64))+rdi]

        mov     r10,QWORD[((-80))+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[((-72))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm4,XMMWORD[((-56))+rdi]
        mov     DWORD[40+rsp],ecx
        cmovle  r10,rsp
        sub     rbp,r10
        mov     QWORD[80+rsp],rbp

        mov     ecx,DWORD[((-24))+rdi]

        mov     r11,QWORD[((-40))+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[((-32))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm5,XMMWORD[((-16))+rdi]
        mov     DWORD[44+rsp],ecx
        cmovle  r11,rsp
        sub     rbp,r11
        mov     QWORD[88+rsp],rbp

        mov     ecx,DWORD[16+rdi]

        mov     r12,QWORD[rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[8+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm6,XMMWORD[24+rdi]
        mov     DWORD[48+rsp],ecx
        cmovle  r12,rsp
        sub     rbp,r12
        mov     QWORD[96+rsp],rbp

        mov     ecx,DWORD[56+rdi]

        mov     r13,QWORD[40+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[48+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm7,XMMWORD[64+rdi]
        mov     DWORD[52+rsp],ecx
        cmovle  r13,rsp
        sub     rbp,r13
        mov     QWORD[104+rsp],rbp

        mov     ecx,DWORD[96+rdi]

        mov     r14,QWORD[80+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[88+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm8,XMMWORD[104+rdi]
        mov     DWORD[56+rsp],ecx
        cmovle  r14,rsp
        sub     rbp,r14
        mov     QWORD[112+rsp],rbp

        mov     ecx,DWORD[136+rdi]

        mov     r15,QWORD[120+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[128+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm9,XMMWORD[144+rdi]
        mov     DWORD[60+rsp],ecx
        cmovle  r15,rsp
        sub     rbp,r15
        mov     QWORD[120+rsp],rbp
        test    edx,edx
        jz      NEAR $L$enc8x_done

        vmovups xmm1,XMMWORD[((16-120))+rsi]
        vmovups xmm0,XMMWORD[((32-120))+rsi]
        mov     eax,DWORD[((240-120))+rsi]

        vpxor   xmm10,xmm15,XMMWORD[r8]
        lea     rbp,[128+rsp]
        vpxor   xmm11,xmm15,XMMWORD[r9]
        vpxor   xmm12,xmm15,XMMWORD[r10]
        vpxor   xmm13,xmm15,XMMWORD[r11]
        vpxor   xmm2,xmm2,xmm10
        vpxor   xmm10,xmm15,XMMWORD[r12]
        vpxor   xmm3,xmm3,xmm11
        vpxor   xmm11,xmm15,XMMWORD[r13]
        vpxor   xmm4,xmm4,xmm12
        vpxor   xmm12,xmm15,XMMWORD[r14]
        vpxor   xmm5,xmm5,xmm13
        vpxor   xmm13,xmm15,XMMWORD[r15]
        vpxor   xmm6,xmm6,xmm10
        mov     ecx,1
        vpxor   xmm7,xmm7,xmm11
        vpxor   xmm8,xmm8,xmm12
        vpxor   xmm9,xmm9,xmm13
        jmp     NEAR $L$oop_enc8x

ALIGN   32
$L$oop_enc8x:
        vaesenc xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+0))+rsp]
        vaesenc xmm3,xmm3,xmm1
        prefetcht0      [31+r8]
        vaesenc xmm4,xmm4,xmm1
        vaesenc xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r8]
        cmovge  r8,rsp
        vaesenc xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm1
        sub     rbx,r8
        vaesenc xmm8,xmm8,xmm1
        vpxor   xmm10,xmm15,XMMWORD[16+r8]
        mov     QWORD[((64+0))+rsp],rbx
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((-72))+rsi]
        lea     r8,[16+rbx*1+r8]
        vmovdqu XMMWORD[rbp],xmm10
        vaesenc xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+4))+rsp]
        mov     rbx,QWORD[((64+8))+rsp]
        vaesenc xmm3,xmm3,xmm0
        prefetcht0      [31+r9]
        vaesenc xmm4,xmm4,xmm0
        vaesenc xmm5,xmm5,xmm0
        lea     rbx,[rbx*1+r9]
        cmovge  r9,rsp
        vaesenc xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm0
        sub     rbx,r9
        vaesenc xmm8,xmm8,xmm0
        vpxor   xmm11,xmm15,XMMWORD[16+r9]
        mov     QWORD[((64+8))+rsp],rbx
        vaesenc xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((-56))+rsi]
        lea     r9,[16+rbx*1+r9]
        vmovdqu XMMWORD[16+rbp],xmm11
        vaesenc xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+8))+rsp]
        mov     rbx,QWORD[((64+16))+rsp]
        vaesenc xmm3,xmm3,xmm1
        prefetcht0      [31+r10]
        vaesenc xmm4,xmm4,xmm1
        prefetcht0      [15+r8]
        vaesenc xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r10]
        cmovge  r10,rsp
        vaesenc xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm1
        sub     rbx,r10
        vaesenc xmm8,xmm8,xmm1
        vpxor   xmm12,xmm15,XMMWORD[16+r10]
        mov     QWORD[((64+16))+rsp],rbx
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((-40))+rsi]
        lea     r10,[16+rbx*1+r10]
        vmovdqu XMMWORD[32+rbp],xmm12
        vaesenc xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+12))+rsp]
        mov     rbx,QWORD[((64+24))+rsp]
        vaesenc xmm3,xmm3,xmm0
        prefetcht0      [31+r11]
        vaesenc xmm4,xmm4,xmm0
        prefetcht0      [15+r9]
        vaesenc xmm5,xmm5,xmm0
        lea     rbx,[rbx*1+r11]
        cmovge  r11,rsp
        vaesenc xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm0
        sub     rbx,r11
        vaesenc xmm8,xmm8,xmm0
        vpxor   xmm13,xmm15,XMMWORD[16+r11]
        mov     QWORD[((64+24))+rsp],rbx
        vaesenc xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((-24))+rsi]
        lea     r11,[16+rbx*1+r11]
        vmovdqu XMMWORD[48+rbp],xmm13
        vaesenc xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+16))+rsp]
        mov     rbx,QWORD[((64+32))+rsp]
        vaesenc xmm3,xmm3,xmm1
        prefetcht0      [31+r12]
        vaesenc xmm4,xmm4,xmm1
        prefetcht0      [15+r10]
        vaesenc xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r12]
        cmovge  r12,rsp
        vaesenc xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm1
        sub     rbx,r12
        vaesenc xmm8,xmm8,xmm1
        vpxor   xmm10,xmm15,XMMWORD[16+r12]
        mov     QWORD[((64+32))+rsp],rbx
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((-8))+rsi]
        lea     r12,[16+rbx*1+r12]
        vaesenc xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+20))+rsp]
        mov     rbx,QWORD[((64+40))+rsp]
        vaesenc xmm3,xmm3,xmm0
        prefetcht0      [31+r13]
        vaesenc xmm4,xmm4,xmm0
        prefetcht0      [15+r11]
        vaesenc xmm5,xmm5,xmm0
        lea     rbx,[r13*1+rbx]
        cmovge  r13,rsp
        vaesenc xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm0
        sub     rbx,r13
        vaesenc xmm8,xmm8,xmm0
        vpxor   xmm11,xmm15,XMMWORD[16+r13]
        mov     QWORD[((64+40))+rsp],rbx
        vaesenc xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[8+rsi]
        lea     r13,[16+rbx*1+r13]
        vaesenc xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+24))+rsp]
        mov     rbx,QWORD[((64+48))+rsp]
        vaesenc xmm3,xmm3,xmm1
        prefetcht0      [31+r14]
        vaesenc xmm4,xmm4,xmm1
        prefetcht0      [15+r12]
        vaesenc xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r14]
        cmovge  r14,rsp
        vaesenc xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm1
        sub     rbx,r14
        vaesenc xmm8,xmm8,xmm1
        vpxor   xmm12,xmm15,XMMWORD[16+r14]
        mov     QWORD[((64+48))+rsp],rbx
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[24+rsi]
        lea     r14,[16+rbx*1+r14]
        vaesenc xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+28))+rsp]
        mov     rbx,QWORD[((64+56))+rsp]
        vaesenc xmm3,xmm3,xmm0
        prefetcht0      [31+r15]
        vaesenc xmm4,xmm4,xmm0
        prefetcht0      [15+r13]
        vaesenc xmm5,xmm5,xmm0
        lea     rbx,[rbx*1+r15]
        cmovge  r15,rsp
        vaesenc xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesenc xmm7,xmm7,xmm0
        sub     rbx,r15
        vaesenc xmm8,xmm8,xmm0
        vpxor   xmm13,xmm15,XMMWORD[16+r15]
        mov     QWORD[((64+56))+rsp],rbx
        vaesenc xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[40+rsi]
        lea     r15,[16+rbx*1+r15]
        vmovdqu xmm14,XMMWORD[32+rsp]
        prefetcht0      [15+r14]
        prefetcht0      [15+r15]
        cmp     eax,11
        jb      NEAR $L$enc8x_tail

        vaesenc xmm2,xmm2,xmm1
        vaesenc xmm3,xmm3,xmm1
        vaesenc xmm4,xmm4,xmm1
        vaesenc xmm5,xmm5,xmm1
        vaesenc xmm6,xmm6,xmm1
        vaesenc xmm7,xmm7,xmm1
        vaesenc xmm8,xmm8,xmm1
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((176-120))+rsi]

        vaesenc xmm2,xmm2,xmm0
        vaesenc xmm3,xmm3,xmm0
        vaesenc xmm4,xmm4,xmm0
        vaesenc xmm5,xmm5,xmm0
        vaesenc xmm6,xmm6,xmm0
        vaesenc xmm7,xmm7,xmm0
        vaesenc xmm8,xmm8,xmm0
        vaesenc xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((192-120))+rsi]
        je      NEAR $L$enc8x_tail

        vaesenc xmm2,xmm2,xmm1
        vaesenc xmm3,xmm3,xmm1
        vaesenc xmm4,xmm4,xmm1
        vaesenc xmm5,xmm5,xmm1
        vaesenc xmm6,xmm6,xmm1
        vaesenc xmm7,xmm7,xmm1
        vaesenc xmm8,xmm8,xmm1
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((208-120))+rsi]

        vaesenc xmm2,xmm2,xmm0
        vaesenc xmm3,xmm3,xmm0
        vaesenc xmm4,xmm4,xmm0
        vaesenc xmm5,xmm5,xmm0
        vaesenc xmm6,xmm6,xmm0
        vaesenc xmm7,xmm7,xmm0
        vaesenc xmm8,xmm8,xmm0
        vaesenc xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((224-120))+rsi]

$L$enc8x_tail:
        vaesenc xmm2,xmm2,xmm1
        vpxor   xmm15,xmm15,xmm15
        vaesenc xmm3,xmm3,xmm1
        vaesenc xmm4,xmm4,xmm1
        vpcmpgtd        xmm15,xmm14,xmm15
        vaesenc xmm5,xmm5,xmm1
        vaesenc xmm6,xmm6,xmm1
        vpaddd  xmm15,xmm15,xmm14
        vmovdqu xmm14,XMMWORD[48+rsp]
        vaesenc xmm7,xmm7,xmm1
        mov     rbx,QWORD[64+rsp]
        vaesenc xmm8,xmm8,xmm1
        vaesenc xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((16-120))+rsi]

        vaesenclast     xmm2,xmm2,xmm0
        vmovdqa XMMWORD[32+rsp],xmm15
        vpxor   xmm15,xmm15,xmm15
        vaesenclast     xmm3,xmm3,xmm0
        vaesenclast     xmm4,xmm4,xmm0
        vpcmpgtd        xmm15,xmm14,xmm15
        vaesenclast     xmm5,xmm5,xmm0
        vaesenclast     xmm6,xmm6,xmm0
        vpaddd  xmm14,xmm14,xmm15
        vmovdqu xmm15,XMMWORD[((-120))+rsi]
        vaesenclast     xmm7,xmm7,xmm0
        vaesenclast     xmm8,xmm8,xmm0
        vmovdqa XMMWORD[48+rsp],xmm14
        vaesenclast     xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((32-120))+rsi]

        vmovups XMMWORD[(-16)+r8],xmm2
        sub     r8,rbx
        vpxor   xmm2,xmm2,XMMWORD[rbp]
        vmovups XMMWORD[(-16)+r9],xmm3
        sub     r9,QWORD[72+rsp]
        vpxor   xmm3,xmm3,XMMWORD[16+rbp]
        vmovups XMMWORD[(-16)+r10],xmm4
        sub     r10,QWORD[80+rsp]
        vpxor   xmm4,xmm4,XMMWORD[32+rbp]
        vmovups XMMWORD[(-16)+r11],xmm5
        sub     r11,QWORD[88+rsp]
        vpxor   xmm5,xmm5,XMMWORD[48+rbp]
        vmovups XMMWORD[(-16)+r12],xmm6
        sub     r12,QWORD[96+rsp]
        vpxor   xmm6,xmm6,xmm10
        vmovups XMMWORD[(-16)+r13],xmm7
        sub     r13,QWORD[104+rsp]
        vpxor   xmm7,xmm7,xmm11
        vmovups XMMWORD[(-16)+r14],xmm8
        sub     r14,QWORD[112+rsp]
        vpxor   xmm8,xmm8,xmm12
        vmovups XMMWORD[(-16)+r15],xmm9
        sub     r15,QWORD[120+rsp]
        vpxor   xmm9,xmm9,xmm13

        dec     edx
        jnz     NEAR $L$oop_enc8x

        mov     rax,QWORD[16+rsp]






$L$enc8x_done:
        vzeroupper
        movaps  xmm6,XMMWORD[((-216))+rax]
        movaps  xmm7,XMMWORD[((-200))+rax]
        movaps  xmm8,XMMWORD[((-184))+rax]
        movaps  xmm9,XMMWORD[((-168))+rax]
        movaps  xmm10,XMMWORD[((-152))+rax]
        movaps  xmm11,XMMWORD[((-136))+rax]
        movaps  xmm12,XMMWORD[((-120))+rax]
        movaps  xmm13,XMMWORD[((-104))+rax]
        movaps  xmm14,XMMWORD[((-88))+rax]
        movaps  xmm15,XMMWORD[((-72))+rax]
        mov     r15,QWORD[((-48))+rax]

        mov     r14,QWORD[((-40))+rax]

        mov     r13,QWORD[((-32))+rax]

        mov     r12,QWORD[((-24))+rax]

        mov     rbp,QWORD[((-16))+rax]

        mov     rbx,QWORD[((-8))+rax]

        lea     rsp,[rax]

$L$enc8x_epilogue:
        mov     rdi,QWORD[8+rsp]        ;WIN64 epilogue
        mov     rsi,QWORD[16+rsp]
        DB      0F3h,0C3h               ;repret

$L$SEH_end_aesni_multi_cbc_encrypt_avx:


ALIGN   32
aesni_multi_cbc_decrypt_avx:
        mov     QWORD[8+rsp],rdi        ;WIN64 prologue
        mov     QWORD[16+rsp],rsi
        mov     rax,rsp
$L$SEH_begin_aesni_multi_cbc_decrypt_avx:
        mov     rdi,rcx
        mov     rsi,rdx
        mov     rdx,r8



_avx_cbc_dec_shortcut:
        mov     rax,rsp

        push    rbx

        push    rbp

        push    r12

        push    r13

        push    r14

        push    r15

        lea     rsp,[((-168))+rsp]
        movaps  XMMWORD[rsp],xmm6
        movaps  XMMWORD[16+rsp],xmm7
        movaps  XMMWORD[32+rsp],xmm8
        movaps  XMMWORD[48+rsp],xmm9
        movaps  XMMWORD[64+rsp],xmm10
        movaps  XMMWORD[80+rsp],xmm11
        movaps  XMMWORD[(-120)+rax],xmm12
        movaps  XMMWORD[(-104)+rax],xmm13
        movaps  XMMWORD[(-88)+rax],xmm14
        movaps  XMMWORD[(-72)+rax],xmm15









        sub     rsp,256
        and     rsp,-256
        sub     rsp,192
        mov     QWORD[16+rsp],rax


$L$dec8x_body:
        vzeroupper
        vmovdqu xmm15,XMMWORD[rsi]
        lea     rsi,[120+rsi]
        lea     rdi,[160+rdi]
        shr     edx,1

$L$dec8x_loop_grande:

        xor     edx,edx

        mov     ecx,DWORD[((-144))+rdi]

        mov     r8,QWORD[((-160))+rdi]
        cmp     ecx,edx

        mov     rbx,QWORD[((-152))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm2,XMMWORD[((-136))+rdi]
        mov     DWORD[32+rsp],ecx
        cmovle  r8,rsp
        sub     rbx,r8
        mov     QWORD[64+rsp],rbx
        vmovdqu XMMWORD[192+rsp],xmm2

        mov     ecx,DWORD[((-104))+rdi]

        mov     r9,QWORD[((-120))+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[((-112))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm3,XMMWORD[((-96))+rdi]
        mov     DWORD[36+rsp],ecx
        cmovle  r9,rsp
        sub     rbp,r9
        mov     QWORD[72+rsp],rbp
        vmovdqu XMMWORD[208+rsp],xmm3

        mov     ecx,DWORD[((-64))+rdi]

        mov     r10,QWORD[((-80))+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[((-72))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm4,XMMWORD[((-56))+rdi]
        mov     DWORD[40+rsp],ecx
        cmovle  r10,rsp
        sub     rbp,r10
        mov     QWORD[80+rsp],rbp
        vmovdqu XMMWORD[224+rsp],xmm4

        mov     ecx,DWORD[((-24))+rdi]

        mov     r11,QWORD[((-40))+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[((-32))+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm5,XMMWORD[((-16))+rdi]
        mov     DWORD[44+rsp],ecx
        cmovle  r11,rsp
        sub     rbp,r11
        mov     QWORD[88+rsp],rbp
        vmovdqu XMMWORD[240+rsp],xmm5

        mov     ecx,DWORD[16+rdi]

        mov     r12,QWORD[rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[8+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm6,XMMWORD[24+rdi]
        mov     DWORD[48+rsp],ecx
        cmovle  r12,rsp
        sub     rbp,r12
        mov     QWORD[96+rsp],rbp
        vmovdqu XMMWORD[256+rsp],xmm6

        mov     ecx,DWORD[56+rdi]

        mov     r13,QWORD[40+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[48+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm7,XMMWORD[64+rdi]
        mov     DWORD[52+rsp],ecx
        cmovle  r13,rsp
        sub     rbp,r13
        mov     QWORD[104+rsp],rbp
        vmovdqu XMMWORD[272+rsp],xmm7

        mov     ecx,DWORD[96+rdi]

        mov     r14,QWORD[80+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[88+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm8,XMMWORD[104+rdi]
        mov     DWORD[56+rsp],ecx
        cmovle  r14,rsp
        sub     rbp,r14
        mov     QWORD[112+rsp],rbp
        vmovdqu XMMWORD[288+rsp],xmm8

        mov     ecx,DWORD[136+rdi]

        mov     r15,QWORD[120+rdi]
        cmp     ecx,edx

        mov     rbp,QWORD[128+rdi]
        cmovg   edx,ecx
        test    ecx,ecx

        vmovdqu xmm9,XMMWORD[144+rdi]
        mov     DWORD[60+rsp],ecx
        cmovle  r15,rsp
        sub     rbp,r15
        mov     QWORD[120+rsp],rbp
        vmovdqu XMMWORD[304+rsp],xmm9
        test    edx,edx
        jz      NEAR $L$dec8x_done

        vmovups xmm1,XMMWORD[((16-120))+rsi]
        vmovups xmm0,XMMWORD[((32-120))+rsi]
        mov     eax,DWORD[((240-120))+rsi]
        lea     rbp,[((192+128))+rsp]

        vmovdqu xmm2,XMMWORD[r8]
        vmovdqu xmm3,XMMWORD[r9]
        vmovdqu xmm4,XMMWORD[r10]
        vmovdqu xmm5,XMMWORD[r11]
        vmovdqu xmm6,XMMWORD[r12]
        vmovdqu xmm7,XMMWORD[r13]
        vmovdqu xmm8,XMMWORD[r14]
        vmovdqu xmm9,XMMWORD[r15]
        vmovdqu XMMWORD[rbp],xmm2
        vpxor   xmm2,xmm2,xmm15
        vmovdqu XMMWORD[16+rbp],xmm3
        vpxor   xmm3,xmm3,xmm15
        vmovdqu XMMWORD[32+rbp],xmm4
        vpxor   xmm4,xmm4,xmm15
        vmovdqu XMMWORD[48+rbp],xmm5
        vpxor   xmm5,xmm5,xmm15
        vmovdqu XMMWORD[64+rbp],xmm6
        vpxor   xmm6,xmm6,xmm15
        vmovdqu XMMWORD[80+rbp],xmm7
        vpxor   xmm7,xmm7,xmm15
        vmovdqu XMMWORD[96+rbp],xmm8
        vpxor   xmm8,xmm8,xmm15
        vmovdqu XMMWORD[112+rbp],xmm9
        vpxor   xmm9,xmm9,xmm15
        xor     rbp,0x80
        mov     ecx,1
        jmp     NEAR $L$oop_dec8x

ALIGN   32
$L$oop_dec8x:
        vaesdec xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+0))+rsp]
        vaesdec xmm3,xmm3,xmm1
        prefetcht0      [31+r8]
        vaesdec xmm4,xmm4,xmm1
        vaesdec xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r8]
        cmovge  r8,rsp
        vaesdec xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm1
        sub     rbx,r8
        vaesdec xmm8,xmm8,xmm1
        vmovdqu xmm10,XMMWORD[16+r8]
        mov     QWORD[((64+0))+rsp],rbx
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((-72))+rsi]
        lea     r8,[16+rbx*1+r8]
        vmovdqu XMMWORD[128+rsp],xmm10
        vaesdec xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+4))+rsp]
        mov     rbx,QWORD[((64+8))+rsp]
        vaesdec xmm3,xmm3,xmm0
        prefetcht0      [31+r9]
        vaesdec xmm4,xmm4,xmm0
        vaesdec xmm5,xmm5,xmm0
        lea     rbx,[rbx*1+r9]
        cmovge  r9,rsp
        vaesdec xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm0
        sub     rbx,r9
        vaesdec xmm8,xmm8,xmm0
        vmovdqu xmm11,XMMWORD[16+r9]
        mov     QWORD[((64+8))+rsp],rbx
        vaesdec xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((-56))+rsi]
        lea     r9,[16+rbx*1+r9]
        vmovdqu XMMWORD[144+rsp],xmm11
        vaesdec xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+8))+rsp]
        mov     rbx,QWORD[((64+16))+rsp]
        vaesdec xmm3,xmm3,xmm1
        prefetcht0      [31+r10]
        vaesdec xmm4,xmm4,xmm1
        prefetcht0      [15+r8]
        vaesdec xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r10]
        cmovge  r10,rsp
        vaesdec xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm1
        sub     rbx,r10
        vaesdec xmm8,xmm8,xmm1
        vmovdqu xmm12,XMMWORD[16+r10]
        mov     QWORD[((64+16))+rsp],rbx
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((-40))+rsi]
        lea     r10,[16+rbx*1+r10]
        vmovdqu XMMWORD[160+rsp],xmm12
        vaesdec xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+12))+rsp]
        mov     rbx,QWORD[((64+24))+rsp]
        vaesdec xmm3,xmm3,xmm0
        prefetcht0      [31+r11]
        vaesdec xmm4,xmm4,xmm0
        prefetcht0      [15+r9]
        vaesdec xmm5,xmm5,xmm0
        lea     rbx,[rbx*1+r11]
        cmovge  r11,rsp
        vaesdec xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm0
        sub     rbx,r11
        vaesdec xmm8,xmm8,xmm0
        vmovdqu xmm13,XMMWORD[16+r11]
        mov     QWORD[((64+24))+rsp],rbx
        vaesdec xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((-24))+rsi]
        lea     r11,[16+rbx*1+r11]
        vmovdqu XMMWORD[176+rsp],xmm13
        vaesdec xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+16))+rsp]
        mov     rbx,QWORD[((64+32))+rsp]
        vaesdec xmm3,xmm3,xmm1
        prefetcht0      [31+r12]
        vaesdec xmm4,xmm4,xmm1
        prefetcht0      [15+r10]
        vaesdec xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r12]
        cmovge  r12,rsp
        vaesdec xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm1
        sub     rbx,r12
        vaesdec xmm8,xmm8,xmm1
        vmovdqu xmm10,XMMWORD[16+r12]
        mov     QWORD[((64+32))+rsp],rbx
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((-8))+rsi]
        lea     r12,[16+rbx*1+r12]
        vaesdec xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+20))+rsp]
        mov     rbx,QWORD[((64+40))+rsp]
        vaesdec xmm3,xmm3,xmm0
        prefetcht0      [31+r13]
        vaesdec xmm4,xmm4,xmm0
        prefetcht0      [15+r11]
        vaesdec xmm5,xmm5,xmm0
        lea     rbx,[r13*1+rbx]
        cmovge  r13,rsp
        vaesdec xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm0
        sub     rbx,r13
        vaesdec xmm8,xmm8,xmm0
        vmovdqu xmm11,XMMWORD[16+r13]
        mov     QWORD[((64+40))+rsp],rbx
        vaesdec xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[8+rsi]
        lea     r13,[16+rbx*1+r13]
        vaesdec xmm2,xmm2,xmm1
        cmp     ecx,DWORD[((32+24))+rsp]
        mov     rbx,QWORD[((64+48))+rsp]
        vaesdec xmm3,xmm3,xmm1
        prefetcht0      [31+r14]
        vaesdec xmm4,xmm4,xmm1
        prefetcht0      [15+r12]
        vaesdec xmm5,xmm5,xmm1
        lea     rbx,[rbx*1+r14]
        cmovge  r14,rsp
        vaesdec xmm6,xmm6,xmm1
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm1
        sub     rbx,r14
        vaesdec xmm8,xmm8,xmm1
        vmovdqu xmm12,XMMWORD[16+r14]
        mov     QWORD[((64+48))+rsp],rbx
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[24+rsi]
        lea     r14,[16+rbx*1+r14]
        vaesdec xmm2,xmm2,xmm0
        cmp     ecx,DWORD[((32+28))+rsp]
        mov     rbx,QWORD[((64+56))+rsp]
        vaesdec xmm3,xmm3,xmm0
        prefetcht0      [31+r15]
        vaesdec xmm4,xmm4,xmm0
        prefetcht0      [15+r13]
        vaesdec xmm5,xmm5,xmm0
        lea     rbx,[rbx*1+r15]
        cmovge  r15,rsp
        vaesdec xmm6,xmm6,xmm0
        cmovg   rbx,rsp
        vaesdec xmm7,xmm7,xmm0
        sub     rbx,r15
        vaesdec xmm8,xmm8,xmm0
        vmovdqu xmm13,XMMWORD[16+r15]
        mov     QWORD[((64+56))+rsp],rbx
        vaesdec xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[40+rsi]
        lea     r15,[16+rbx*1+r15]
        vmovdqu xmm14,XMMWORD[32+rsp]
        prefetcht0      [15+r14]
        prefetcht0      [15+r15]
        cmp     eax,11
        jb      NEAR $L$dec8x_tail

        vaesdec xmm2,xmm2,xmm1
        vaesdec xmm3,xmm3,xmm1
        vaesdec xmm4,xmm4,xmm1
        vaesdec xmm5,xmm5,xmm1
        vaesdec xmm6,xmm6,xmm1
        vaesdec xmm7,xmm7,xmm1
        vaesdec xmm8,xmm8,xmm1
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((176-120))+rsi]

        vaesdec xmm2,xmm2,xmm0
        vaesdec xmm3,xmm3,xmm0
        vaesdec xmm4,xmm4,xmm0
        vaesdec xmm5,xmm5,xmm0
        vaesdec xmm6,xmm6,xmm0
        vaesdec xmm7,xmm7,xmm0
        vaesdec xmm8,xmm8,xmm0
        vaesdec xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((192-120))+rsi]
        je      NEAR $L$dec8x_tail

        vaesdec xmm2,xmm2,xmm1
        vaesdec xmm3,xmm3,xmm1
        vaesdec xmm4,xmm4,xmm1
        vaesdec xmm5,xmm5,xmm1
        vaesdec xmm6,xmm6,xmm1
        vaesdec xmm7,xmm7,xmm1
        vaesdec xmm8,xmm8,xmm1
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((208-120))+rsi]

        vaesdec xmm2,xmm2,xmm0
        vaesdec xmm3,xmm3,xmm0
        vaesdec xmm4,xmm4,xmm0
        vaesdec xmm5,xmm5,xmm0
        vaesdec xmm6,xmm6,xmm0
        vaesdec xmm7,xmm7,xmm0
        vaesdec xmm8,xmm8,xmm0
        vaesdec xmm9,xmm9,xmm0
        vmovups xmm0,XMMWORD[((224-120))+rsi]

$L$dec8x_tail:
        vaesdec xmm2,xmm2,xmm1
        vpxor   xmm15,xmm15,xmm15
        vaesdec xmm3,xmm3,xmm1
        vaesdec xmm4,xmm4,xmm1
        vpcmpgtd        xmm15,xmm14,xmm15
        vaesdec xmm5,xmm5,xmm1
        vaesdec xmm6,xmm6,xmm1
        vpaddd  xmm15,xmm15,xmm14
        vmovdqu xmm14,XMMWORD[48+rsp]
        vaesdec xmm7,xmm7,xmm1
        mov     rbx,QWORD[64+rsp]
        vaesdec xmm8,xmm8,xmm1
        vaesdec xmm9,xmm9,xmm1
        vmovups xmm1,XMMWORD[((16-120))+rsi]

        vaesdeclast     xmm2,xmm2,xmm0
        vmovdqa XMMWORD[32+rsp],xmm15
        vpxor   xmm15,xmm15,xmm15
        vaesdeclast     xmm3,xmm3,xmm0
        vpxor   xmm2,xmm2,XMMWORD[rbp]
        vaesdeclast     xmm4,xmm4,xmm0
        vpxor   xmm3,xmm3,XMMWORD[16+rbp]
        vpcmpgtd        xmm15,xmm14,xmm15
        vaesdeclast     xmm5,xmm5,xmm0
        vpxor   xmm4,xmm4,XMMWORD[32+rbp]
        vaesdeclast     xmm6,xmm6,xmm0
        vpxor   xmm5,xmm5,XMMWORD[48+rbp]
        vpaddd  xmm14,xmm14,xmm15
        vmovdqu xmm15,XMMWORD[((-120))+rsi]
        vaesdeclast     xmm7,xmm7,xmm0
        vpxor   xmm6,xmm6,XMMWORD[64+rbp]
        vaesdeclast     xmm8,xmm8,xmm0
        vpxor   xmm7,xmm7,XMMWORD[80+rbp]
        vmovdqa XMMWORD[48+rsp],xmm14
        vaesdeclast     xmm9,xmm9,xmm0
        vpxor   xmm8,xmm8,XMMWORD[96+rbp]
        vmovups xmm0,XMMWORD[((32-120))+rsi]

        vmovups XMMWORD[(-16)+r8],xmm2
        sub     r8,rbx
        vmovdqu xmm2,XMMWORD[((128+0))+rsp]
        vpxor   xmm9,xmm9,XMMWORD[112+rbp]
        vmovups XMMWORD[(-16)+r9],xmm3
        sub     r9,QWORD[72+rsp]
        vmovdqu XMMWORD[rbp],xmm2
        vpxor   xmm2,xmm2,xmm15
        vmovdqu xmm3,XMMWORD[((128+16))+rsp]
        vmovups XMMWORD[(-16)+r10],xmm4
        sub     r10,QWORD[80+rsp]
        vmovdqu XMMWORD[16+rbp],xmm3
        vpxor   xmm3,xmm3,xmm15
        vmovdqu xmm4,XMMWORD[((128+32))+rsp]
        vmovups XMMWORD[(-16)+r11],xmm5
        sub     r11,QWORD[88+rsp]
        vmovdqu XMMWORD[32+rbp],xmm4
        vpxor   xmm4,xmm4,xmm15
        vmovdqu xmm5,XMMWORD[((128+48))+rsp]
        vmovups XMMWORD[(-16)+r12],xmm6
        sub     r12,QWORD[96+rsp]
        vmovdqu XMMWORD[48+rbp],xmm5
        vpxor   xmm5,xmm5,xmm15
        vmovdqu XMMWORD[64+rbp],xmm10
        vpxor   xmm6,xmm15,xmm10
        vmovups XMMWORD[(-16)+r13],xmm7
        sub     r13,QWORD[104+rsp]
        vmovdqu XMMWORD[80+rbp],xmm11
        vpxor   xmm7,xmm15,xmm11
        vmovups XMMWORD[(-16)+r14],xmm8
        sub     r14,QWORD[112+rsp]
        vmovdqu XMMWORD[96+rbp],xmm12
        vpxor   xmm8,xmm15,xmm12
        vmovups XMMWORD[(-16)+r15],xmm9
        sub     r15,QWORD[120+rsp]
        vmovdqu XMMWORD[112+rbp],xmm13
        vpxor   xmm9,xmm15,xmm13

        xor     rbp,128
        dec     edx
        jnz     NEAR $L$oop_dec8x

        mov     rax,QWORD[16+rsp]






$L$dec8x_done:
        vzeroupper
        movaps  xmm6,XMMWORD[((-216))+rax]
        movaps  xmm7,XMMWORD[((-200))+rax]
        movaps  xmm8,XMMWORD[((-184))+rax]
        movaps  xmm9,XMMWORD[((-168))+rax]
        movaps  xmm10,XMMWORD[((-152))+rax]
        movaps  xmm11,XMMWORD[((-136))+rax]
        movaps  xmm12,XMMWORD[((-120))+rax]
        movaps  xmm13,XMMWORD[((-104))+rax]
        movaps  xmm14,XMMWORD[((-88))+rax]
        movaps  xmm15,XMMWORD[((-72))+rax]
        mov     r15,QWORD[((-48))+rax]

        mov     r14,QWORD[((-40))+rax]

        mov     r13,QWORD[((-32))+rax]

        mov     r12,QWORD[((-24))+rax]

        mov     rbp,QWORD[((-16))+rax]

        mov     rbx,QWORD[((-8))+rax]

        lea     rsp,[rax]

$L$dec8x_epilogue:
        mov     rdi,QWORD[8+rsp]        ;WIN64 epilogue
        mov     rsi,QWORD[16+rsp]
        DB      0F3h,0C3h               ;repret

$L$SEH_end_aesni_multi_cbc_decrypt_avx:
EXTERN  __imp_RtlVirtualUnwind

ALIGN   16
se_handler:
        push    rsi
        push    rdi
        push    rbx
        push    rbp
        push    r12
        push    r13
        push    r14
        push    r15
        pushfq
        sub     rsp,64

        mov     rax,QWORD[120+r8]
        mov     rbx,QWORD[248+r8]

        mov     rsi,QWORD[8+r9]
        mov     r11,QWORD[56+r9]

        mov     r10d,DWORD[r11]
        lea     r10,[r10*1+rsi]
        cmp     rbx,r10
        jb      NEAR $L$in_prologue

        mov     rax,QWORD[152+r8]

        mov     r10d,DWORD[4+r11]
        lea     r10,[r10*1+rsi]
        cmp     rbx,r10
        jae     NEAR $L$in_prologue

        mov     rax,QWORD[16+rax]

        mov     rbx,QWORD[((-8))+rax]
        mov     rbp,QWORD[((-16))+rax]
        mov     r12,QWORD[((-24))+rax]
        mov     r13,QWORD[((-32))+rax]
        mov     r14,QWORD[((-40))+rax]
        mov     r15,QWORD[((-48))+rax]
        mov     QWORD[144+r8],rbx
        mov     QWORD[160+r8],rbp
        mov     QWORD[216+r8],r12
        mov     QWORD[224+r8],r13
        mov     QWORD[232+r8],r14
        mov     QWORD[240+r8],r15

        lea     rsi,[((-56-160))+rax]
        lea     rdi,[512+r8]
        mov     ecx,20
        DD      0xa548f3fc

$L$in_prologue:
        mov     rdi,QWORD[8+rax]
        mov     rsi,QWORD[16+rax]
        mov     QWORD[152+r8],rax
        mov     QWORD[168+r8],rsi
        mov     QWORD[176+r8],rdi

        mov     rdi,QWORD[40+r9]
        mov     rsi,r8
        mov     ecx,154
        DD      0xa548f3fc

        mov     rsi,r9
        xor     rcx,rcx
        mov     rdx,QWORD[8+rsi]
        mov     r8,QWORD[rsi]
        mov     r9,QWORD[16+rsi]
        mov     r10,QWORD[40+rsi]
        lea     r11,[56+rsi]
        lea     r12,[24+rsi]
        mov     QWORD[32+rsp],r10
        mov     QWORD[40+rsp],r11
        mov     QWORD[48+rsp],r12
        mov     QWORD[56+rsp],rcx
        call    QWORD[__imp_RtlVirtualUnwind]

        mov     eax,1
        add     rsp,64
        popfq
        pop     r15
        pop     r14
        pop     r13
        pop     r12
        pop     rbp
        pop     rbx
        pop     rdi
        pop     rsi
        DB      0F3h,0C3h               ;repret


section .pdata rdata align=4
ALIGN   4
        DD      $L$SEH_begin_aesni_multi_cbc_encrypt wrt ..imagebase
        DD      $L$SEH_end_aesni_multi_cbc_encrypt wrt ..imagebase
        DD      $L$SEH_info_aesni_multi_cbc_encrypt wrt ..imagebase
        DD      $L$SEH_begin_aesni_multi_cbc_decrypt wrt ..imagebase
        DD      $L$SEH_end_aesni_multi_cbc_decrypt wrt ..imagebase
        DD      $L$SEH_info_aesni_multi_cbc_decrypt wrt ..imagebase
        DD      $L$SEH_begin_aesni_multi_cbc_encrypt_avx wrt ..imagebase
        DD      $L$SEH_end_aesni_multi_cbc_encrypt_avx wrt ..imagebase
        DD      $L$SEH_info_aesni_multi_cbc_encrypt_avx wrt ..imagebase
        DD      $L$SEH_begin_aesni_multi_cbc_decrypt_avx wrt ..imagebase
        DD      $L$SEH_end_aesni_multi_cbc_decrypt_avx wrt ..imagebase
        DD      $L$SEH_info_aesni_multi_cbc_decrypt_avx wrt ..imagebase
section .xdata rdata align=8
ALIGN   8
$L$SEH_info_aesni_multi_cbc_encrypt:
DB      9,0,0,0
        DD      se_handler wrt ..imagebase
        DD      $L$enc4x_body wrt ..imagebase,$L$enc4x_epilogue wrt ..imagebase
$L$SEH_info_aesni_multi_cbc_decrypt:
DB      9,0,0,0
        DD      se_handler wrt ..imagebase
        DD      $L$dec4x_body wrt ..imagebase,$L$dec4x_epilogue wrt ..imagebase
$L$SEH_info_aesni_multi_cbc_encrypt_avx:
DB      9,0,0,0
        DD      se_handler wrt ..imagebase
        DD      $L$enc8x_body wrt ..imagebase,$L$enc8x_epilogue wrt ..imagebase
$L$SEH_info_aesni_multi_cbc_decrypt_avx:
DB      9,0,0,0
        DD      se_handler wrt ..imagebase
        DD      $L$dec8x_body wrt ..imagebase,$L$dec8x_epilogue wrt ..imagebase