aboutsummaryrefslogtreecommitdiff
path: root/prover_snapshots/hol4/RV32/riscvScript.sml
blob: a53718127a547780dd9ccdcdd59e32eb744f14b1 (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
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
25761
25762
25763
25764
25765
25766
25767
25768
25769
25770
25771
25772
25773
25774
25775
25776
25777
25778
25779
25780
25781
25782
25783
25784
25785
25786
25787
25788
25789
25790
25791
25792
25793
25794
25795
25796
25797
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810
25811
25812
25813
25814
25815
25816
25817
25818
25819
25820
25821
25822
25823
25824
25825
25826
25827
25828
25829
25830
25831
25832
25833
25834
25835
25836
25837
25838
25839
25840
25841
25842
25843
25844
25845
25846
25847
25848
25849
25850
25851
25852
25853
25854
25855
25856
25857
25858
25859
25860
25861
25862
25863
25864
25865
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883
25884
25885
25886
25887
25888
25889
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
25908
25909
25910
25911
25912
25913
25914
25915
25916
25917
25918
25919
25920
25921
25922
25923
25924
25925
25926
25927
25928
25929
25930
25931
25932
25933
25934
25935
25936
25937
25938
25939
25940
25941
25942
25943
25944
25945
25946
25947
25948
25949
25950
25951
25952
25953
25954
25955
25956
25957
25958
25959
25960
25961
25962
25963
25964
25965
25966
25967
25968
25969
25970
25971
25972
25973
25974
25975
25976
25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
26011
26012
26013
26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
26040
26041
26042
26043
26044
26045
26046
26047
26048
26049
26050
26051
26052
26053
26054
26055
26056
26057
26058
26059
26060
26061
26062
26063
26064
26065
26066
26067
26068
26069
26070
26071
26072
26073
26074
26075
26076
26077
26078
26079
26080
26081
26082
26083
26084
26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
26104
26105
26106
26107
26108
26109
26110
26111
26112
26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
26131
26132
26133
26134
26135
26136
26137
26138
26139
26140
26141
26142
26143
26144
26145
26146
26147
26148
26149
26150
26151
26152
26153
26154
26155
26156
26157
26158
26159
26160
26161
26162
26163
26164
26165
26166
26167
26168
26169
26170
26171
26172
26173
26174
26175
26176
26177
26178
26179
26180
26181
26182
26183
26184
26185
26186
26187
26188
26189
26190
26191
26192
26193
26194
26195
26196
26197
26198
26199
26200
26201
26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
26223
26224
26225
26226
26227
26228
26229
26230
26231
26232
26233
26234
26235
26236
26237
26238
26239
26240
26241
26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
26252
26253
26254
26255
26256
26257
26258
26259
26260
26261
26262
26263
26264
26265
26266
26267
26268
26269
26270
26271
26272
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284
26285
26286
26287
26288
26289
26290
26291
26292
26293
26294
26295
26296
26297
26298
26299
26300
26301
26302
26303
26304
26305
26306
26307
26308
26309
26310
26311
26312
26313
26314
26315
26316
26317
26318
26319
26320
26321
26322
26323
26324
26325
26326
26327
26328
26329
26330
26331
26332
26333
26334
26335
26336
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346
26347
26348
26349
26350
26351
26352
26353
26354
26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
26367
26368
26369
26370
26371
26372
26373
26374
26375
26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
26387
26388
26389
26390
26391
26392
26393
26394
26395
26396
26397
26398
26399
26400
26401
26402
26403
26404
26405
26406
26407
26408
26409
26410
26411
26412
26413
26414
26415
26416
26417
26418
26419
26420
26421
26422
26423
26424
26425
26426
26427
26428
26429
26430
26431
26432
26433
26434
26435
26436
26437
26438
26439
26440
26441
26442
26443
26444
26445
26446
26447
26448
26449
26450
26451
26452
26453
26454
26455
26456
26457
26458
26459
26460
26461
26462
26463
26464
26465
26466
26467
26468
26469
26470
26471
26472
26473
26474
26475
26476
26477
26478
26479
26480
26481
26482
26483
26484
26485
26486
26487
26488
26489
26490
26491
26492
26493
26494
26495
26496
26497
26498
26499
26500
26501
26502
26503
26504
26505
26506
26507
26508
26509
26510
26511
26512
26513
26514
26515
26516
26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
26528
26529
26530
26531
26532
26533
26534
26535
26536
26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
26548
26549
26550
26551
26552
26553
26554
26555
26556
26557
26558
26559
26560
26561
26562
26563
26564
26565
26566
26567
26568
26569
26570
26571
26572
26573
26574
26575
26576
26577
26578
26579
26580
26581
26582
26583
26584
26585
26586
26587
26588
26589
26590
26591
26592
26593
26594
26595
26596
26597
26598
26599
26600
26601
26602
26603
26604
26605
26606
26607
26608
26609
26610
26611
26612
26613
26614
26615
26616
26617
26618
26619
26620
26621
26622
26623
26624
26625
26626
26627
26628
26629
26630
26631
26632
26633
26634
26635
26636
26637
26638
26639
26640
26641
26642
26643
26644
26645
26646
26647
26648
26649
26650
26651
26652
26653
26654
26655
26656
26657
26658
26659
26660
26661
26662
26663
26664
26665
26666
26667
26668
26669
26670
26671
26672
26673
26674
26675
26676
26677
26678
26679
26680
26681
26682
26683
26684
26685
26686
26687
26688
26689
26690
26691
26692
26693
26694
26695
26696
26697
26698
26699
26700
26701
26702
26703
26704
26705
26706
26707
26708
26709
26710
26711
26712
26713
26714
26715
26716
26717
26718
26719
26720
26721
26722
26723
26724
26725
26726
26727
26728
26729
26730
26731
26732
26733
26734
26735
26736
26737
26738
26739
26740
26741
26742
26743
26744
26745
26746
26747
26748
26749
26750
26751
26752
26753
26754
26755
26756
26757
26758
26759
26760
26761
26762
26763
26764
26765
26766
26767
26768
26769
26770
26771
26772
26773
26774
26775
26776
26777
26778
26779
26780
26781
26782
26783
26784
26785
26786
26787
26788
26789
26790
26791
26792
26793
26794
26795
26796
26797
26798
26799
26800
26801
26802
26803
26804
26805
26806
26807
26808
26809
26810
26811
26812
26813
26814
26815
26816
26817
26818
26819
26820
26821
26822
26823
26824
26825
26826
26827
26828
26829
26830
26831
26832
26833
26834
26835
26836
26837
26838
26839
26840
26841
26842
26843
26844
26845
26846
26847
26848
26849
26850
26851
26852
26853
26854
26855
26856
26857
26858
26859
26860
26861
26862
26863
26864
26865
26866
26867
26868
26869
26870
26871
26872
26873
26874
26875
26876
26877
26878
26879
26880
26881
26882
26883
26884
26885
26886
26887
26888
26889
26890
26891
26892
26893
26894
26895
26896
26897
26898
26899
26900
26901
26902
26903
26904
26905
26906
26907
26908
26909
26910
26911
26912
26913
26914
26915
26916
26917
26918
26919
26920
26921
26922
26923
26924
26925
26926
26927
26928
26929
26930
26931
26932
26933
26934
26935
26936
26937
26938
26939
26940
26941
26942
26943
26944
26945
26946
26947
26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
26959
26960
26961
26962
26963
26964
26965
26966
26967
26968
26969
26970
26971
26972
26973
26974
26975
26976
26977
26978
26979
26980
26981
26982
26983
26984
26985
26986
26987
26988
26989
26990
26991
26992
26993
26994
26995
26996
26997
26998
26999
27000
27001
27002
27003
27004
27005
27006
27007
27008
27009
27010
27011
27012
27013
27014
27015
27016
27017
27018
27019
27020
27021
27022
27023
27024
27025
27026
27027
27028
27029
27030
27031
27032
27033
27034
27035
27036
27037
27038
27039
27040
27041
27042
27043
27044
27045
27046
27047
27048
27049
27050
27051
27052
27053
27054
27055
27056
27057
27058
27059
27060
27061
27062
27063
27064
27065
27066
27067
27068
27069
27070
27071
27072
27073
27074
27075
27076
27077
27078
27079
27080
27081
27082
27083
27084
27085
27086
27087
27088
27089
27090
27091
27092
27093
27094
27095
27096
27097
27098
27099
27100
27101
27102
27103
27104
27105
27106
27107
27108
27109
27110
27111
27112
27113
27114
27115
27116
27117
27118
27119
27120
27121
27122
27123
27124
27125
27126
27127
27128
27129
27130
27131
27132
27133
27134
27135
27136
27137
27138
27139
27140
27141
27142
27143
27144
27145
27146
27147
27148
27149
27150
27151
27152
27153
27154
27155
27156
27157
27158
27159
27160
27161
27162
27163
27164
27165
27166
27167
27168
27169
27170
27171
27172
27173
27174
27175
27176
27177
27178
27179
27180
27181
27182
27183
27184
27185
27186
27187
27188
27189
27190
27191
27192
27193
27194
27195
27196
27197
27198
27199
27200
27201
27202
27203
27204
27205
27206
27207
27208
27209
27210
27211
27212
27213
27214
27215
27216
27217
27218
27219
27220
27221
27222
27223
27224
27225
27226
27227
27228
27229
27230
27231
27232
27233
27234
27235
27236
27237
27238
27239
27240
27241
27242
27243
27244
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
27259
27260
27261
27262
27263
27264
27265
27266
27267
27268
27269
27270
27271
27272
27273
27274
27275
27276
27277
27278
27279
27280
27281
27282
27283
27284
27285
27286
27287
27288
27289
27290
27291
27292
27293
27294
27295
27296
27297
27298
27299
27300
27301
27302
27303
27304
27305
27306
27307
27308
27309
27310
27311
27312
27313
27314
27315
27316
27317
27318
27319
27320
27321
27322
27323
27324
27325
27326
27327
27328
27329
27330
27331
27332
27333
27334
27335
27336
27337
27338
27339
27340
27341
27342
27343
27344
27345
27346
27347
27348
27349
27350
27351
27352
27353
27354
27355
27356
27357
27358
27359
27360
27361
27362
27363
27364
27365
27366
27367
27368
27369
27370
27371
27372
27373
27374
27375
27376
27377
27378
27379
27380
27381
27382
27383
27384
27385
27386
27387
27388
27389
27390
27391
27392
27393
27394
27395
27396
27397
27398
27399
27400
27401
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416
27417
27418
27419
27420
27421
27422
27423
27424
27425
27426
27427
27428
27429
27430
27431
27432
27433
27434
27435
27436
27437
27438
27439
27440
27441
27442
27443
27444
27445
27446
27447
27448
27449
27450
27451
27452
27453
27454
27455
27456
27457
27458
27459
27460
27461
27462
27463
27464
27465
27466
27467
27468
27469
27470
27471
27472
27473
27474
27475
27476
27477
27478
27479
27480
27481
27482
27483
27484
27485
27486
27487
27488
27489
27490
27491
27492
27493
27494
27495
27496
27497
27498
27499
27500
27501
27502
27503
27504
27505
27506
27507
27508
27509
27510
27511
27512
27513
27514
27515
27516
27517
27518
27519
27520
27521
27522
27523
27524
27525
27526
27527
27528
27529
27530
27531
27532
27533
27534
27535
27536
27537
27538
27539
27540
27541
27542
27543
27544
27545
27546
27547
27548
27549
27550
27551
27552
27553
27554
27555
27556
27557
27558
27559
27560
27561
27562
27563
27564
27565
27566
27567
27568
27569
27570
27571
27572
27573
27574
27575
27576
27577
27578
27579
27580
27581
27582
27583
27584
27585
27586
27587
27588
27589
27590
27591
27592
27593
27594
27595
27596
27597
27598
27599
27600
27601
27602
27603
27604
27605
27606
27607
27608
27609
27610
27611
27612
27613
27614
27615
27616
27617
27618
27619
27620
27621
27622
27623
27624
27625
27626
27627
27628
27629
27630
27631
27632
27633
27634
27635
27636
27637
27638
27639
27640
27641
27642
27643
27644
27645
27646
27647
27648
27649
27650
27651
27652
27653
27654
27655
27656
27657
27658
27659
27660
27661
27662
27663
27664
27665
27666
27667
27668
27669
27670
27671
27672
27673
27674
27675
27676
27677
27678
27679
27680
27681
27682
27683
27684
27685
27686
27687
27688
27689
27690
27691
27692
27693
27694
27695
27696
27697
27698
27699
27700
27701
27702
27703
27704
27705
27706
27707
27708
27709
27710
27711
27712
27713
27714
27715
27716
27717
27718
27719
27720
27721
27722
27723
27724
27725
27726
27727
27728
27729
27730
27731
27732
27733
27734
27735
27736
27737
27738
27739
27740
27741
27742
27743
27744
27745
27746
27747
27748
27749
27750
27751
27752
27753
27754
27755
27756
27757
27758
27759
27760
27761
27762
27763
27764
27765
27766
27767
27768
27769
27770
27771
27772
27773
27774
27775
27776
27777
27778
27779
27780
27781
27782
27783
27784
27785
27786
27787
27788
27789
27790
27791
27792
27793
27794
27795
27796
27797
27798
27799
27800
27801
27802
27803
27804
27805
27806
27807
27808
27809
27810
27811
27812
27813
27814
27815
27816
27817
27818
27819
27820
27821
27822
27823
27824
27825
27826
27827
27828
27829
27830
27831
27832
27833
27834
27835
27836
27837
27838
27839
27840
27841
27842
27843
27844
27845
27846
27847
27848
27849
27850
27851
27852
27853
27854
27855
27856
27857
27858
27859
27860
27861
27862
27863
27864
27865
27866
27867
27868
27869
27870
27871
27872
27873
27874
27875
27876
27877
27878
27879
27880
27881
27882
27883
27884
27885
27886
27887
27888
27889
27890
27891
27892
27893
27894
27895
27896
27897
27898
27899
27900
27901
27902
27903
27904
27905
27906
27907
27908
27909
27910
27911
27912
27913
27914
27915
27916
27917
27918
27919
27920
27921
27922
27923
27924
27925
27926
27927
27928
27929
27930
27931
27932
27933
27934
27935
27936
27937
27938
27939
27940
27941
27942
27943
27944
27945
27946
27947
27948
27949
27950
27951
27952
27953
27954
27955
27956
27957
27958
27959
27960
27961
27962
27963
27964
27965
27966
27967
27968
27969
27970
27971
27972
27973
27974
27975
27976
27977
27978
27979
27980
27981
27982
27983
27984
27985
27986
27987
27988
27989
27990
27991
27992
27993
27994
27995
27996
27997
27998
27999
28000
28001
28002
28003
28004
28005
28006
28007
28008
28009
28010
28011
28012
28013
28014
28015
28016
28017
28018
28019
28020
28021
28022
28023
28024
28025
28026
28027
28028
28029
28030
28031
28032
28033
28034
28035
28036
28037
28038
28039
28040
28041
28042
28043
28044
28045
28046
28047
28048
28049
28050
28051
28052
28053
28054
28055
28056
28057
28058
28059
28060
28061
28062
28063
28064
28065
28066
28067
28068
28069
28070
28071
28072
28073
28074
28075
28076
28077
28078
28079
28080
28081
28082
28083
28084
28085
28086
28087
28088
28089
28090
28091
28092
28093
28094
28095
28096
28097
28098
28099
28100
28101
28102
28103
28104
28105
28106
28107
28108
28109
28110
28111
28112
28113
28114
28115
28116
28117
28118
28119
28120
28121
28122
28123
28124
28125
28126
28127
28128
28129
28130
28131
28132
28133
28134
28135
28136
28137
28138
28139
28140
28141
28142
28143
28144
28145
28146
28147
28148
28149
28150
28151
28152
28153
28154
28155
28156
28157
28158
28159
28160
28161
28162
28163
28164
28165
28166
28167
28168
28169
28170
28171
28172
28173
28174
28175
28176
28177
28178
28179
28180
28181
28182
28183
28184
28185
28186
28187
28188
28189
28190
28191
28192
28193
28194
28195
28196
28197
28198
28199
28200
28201
28202
28203
28204
28205
28206
28207
28208
28209
28210
28211
28212
28213
28214
28215
28216
28217
28218
28219
28220
28221
28222
28223
28224
28225
28226
28227
28228
28229
28230
28231
28232
28233
28234
28235
28236
28237
28238
28239
28240
28241
28242
28243
28244
28245
28246
28247
28248
28249
28250
28251
28252
28253
28254
28255
28256
28257
28258
28259
28260
28261
28262
28263
28264
28265
28266
28267
28268
28269
28270
28271
28272
28273
28274
28275
28276
28277
28278
28279
28280
28281
28282
28283
28284
28285
28286
28287
28288
28289
28290
28291
28292
28293
28294
28295
28296
28297
28298
28299
28300
28301
28302
28303
28304
28305
28306
28307
28308
28309
28310
28311
28312
28313
28314
28315
28316
28317
28318
28319
28320
28321
28322
28323
28324
28325
28326
28327
28328
28329
28330
28331
28332
28333
28334
28335
28336
28337
28338
28339
28340
28341
28342
28343
28344
28345
28346
28347
28348
28349
28350
28351
28352
28353
28354
28355
28356
28357
28358
28359
28360
28361
28362
28363
28364
28365
28366
28367
28368
28369
28370
28371
28372
28373
28374
28375
28376
28377
28378
28379
28380
28381
28382
28383
28384
28385
28386
28387
28388
28389
28390
28391
28392
28393
28394
28395
28396
28397
28398
28399
28400
28401
28402
28403
28404
28405
28406
28407
28408
28409
28410
28411
28412
28413
28414
28415
28416
28417
28418
28419
28420
28421
28422
28423
28424
28425
28426
28427
28428
28429
28430
28431
28432
28433
28434
28435
28436
28437
28438
28439
28440
28441
28442
28443
28444
28445
28446
28447
28448
28449
28450
28451
28452
28453
28454
28455
28456
28457
28458
28459
28460
28461
28462
28463
28464
28465
28466
28467
28468
28469
28470
28471
28472
28473
28474
28475
28476
28477
28478
28479
28480
28481
28482
28483
28484
28485
28486
28487
28488
28489
28490
28491
28492
28493
28494
28495
28496
28497
28498
28499
28500
28501
28502
28503
28504
28505
28506
28507
28508
28509
28510
28511
28512
28513
28514
28515
28516
28517
28518
28519
28520
28521
28522
28523
28524
28525
28526
28527
28528
28529
28530
28531
28532
28533
28534
28535
28536
28537
28538
28539
28540
28541
28542
28543
28544
28545
28546
28547
28548
28549
28550
28551
28552
28553
28554
28555
28556
28557
28558
28559
28560
28561
28562
28563
28564
28565
28566
28567
28568
28569
28570
28571
28572
28573
28574
28575
28576
28577
28578
28579
28580
28581
28582
28583
28584
28585
28586
28587
28588
28589
28590
28591
28592
28593
28594
28595
28596
28597
28598
28599
28600
28601
28602
28603
28604
28605
28606
28607
28608
28609
28610
28611
28612
28613
28614
28615
28616
28617
28618
28619
28620
28621
28622
28623
28624
28625
28626
28627
28628
28629
28630
28631
28632
28633
28634
28635
28636
28637
28638
28639
28640
28641
28642
28643
28644
28645
28646
28647
28648
28649
28650
28651
28652
28653
28654
28655
28656
28657
28658
28659
28660
28661
28662
28663
28664
28665
28666
28667
28668
28669
28670
28671
28672
28673
28674
28675
28676
28677
28678
28679
28680
28681
28682
28683
28684
28685
28686
28687
28688
28689
28690
28691
28692
28693
28694
28695
28696
28697
28698
28699
28700
28701
28702
28703
28704
28705
28706
28707
28708
28709
28710
28711
28712
28713
28714
28715
28716
28717
28718
28719
28720
28721
28722
28723
28724
28725
28726
28727
28728
28729
28730
28731
28732
28733
28734
28735
28736
28737
28738
28739
28740
28741
28742
28743
28744
28745
28746
28747
28748
28749
28750
28751
28752
28753
28754
28755
28756
28757
28758
28759
28760
28761
28762
28763
28764
28765
28766
28767
28768
28769
28770
28771
28772
28773
28774
28775
28776
28777
28778
28779
28780
28781
28782
28783
28784
28785
28786
28787
28788
28789
28790
28791
28792
28793
28794
28795
28796
28797
28798
28799
28800
28801
28802
28803
28804
28805
28806
28807
28808
28809
28810
28811
28812
28813
28814
28815
28816
28817
28818
28819
28820
28821
28822
28823
28824
28825
28826
28827
28828
28829
28830
28831
28832
28833
28834
28835
28836
28837
28838
28839
28840
28841
28842
28843
28844
28845
28846
28847
28848
28849
28850
28851
28852
28853
28854
28855
28856
28857
28858
28859
28860
28861
28862
28863
28864
28865
28866
28867
28868
28869
28870
28871
28872
28873
28874
28875
28876
28877
28878
28879
28880
28881
28882
28883
28884
28885
28886
28887
28888
28889
28890
28891
28892
28893
28894
28895
28896
28897
28898
28899
28900
28901
28902
28903
28904
28905
28906
28907
28908
28909
28910
28911
28912
28913
28914
28915
28916
28917
28918
28919
28920
28921
28922
28923
28924
28925
28926
28927
28928
28929
28930
28931
28932
28933
28934
28935
28936
28937
28938
28939
28940
28941
28942
28943
28944
28945
28946
28947
28948
28949
28950
28951
28952
28953
28954
28955
28956
28957
28958
28959
28960
28961
28962
28963
28964
28965
28966
28967
28968
28969
28970
28971
28972
28973
28974
28975
28976
28977
28978
28979
28980
28981
28982
28983
28984
28985
28986
28987
28988
28989
28990
28991
28992
28993
28994
28995
28996
28997
28998
28999
29000
29001
29002
29003
29004
29005
29006
29007
29008
29009
29010
29011
29012
29013
29014
29015
29016
29017
29018
29019
29020
29021
29022
29023
29024
29025
29026
29027
29028
29029
29030
29031
29032
29033
29034
29035
29036
29037
29038
29039
29040
29041
29042
29043
29044
29045
29046
29047
29048
29049
29050
29051
29052
29053
29054
29055
29056
29057
29058
29059
29060
29061
29062
29063
29064
29065
29066
29067
29068
29069
29070
29071
29072
29073
29074
29075
29076
29077
29078
29079
29080
29081
29082
29083
29084
29085
29086
29087
29088
29089
29090
29091
29092
29093
29094
29095
29096
29097
29098
29099
29100
29101
29102
29103
29104
29105
29106
29107
29108
29109
29110
29111
29112
29113
29114
29115
29116
29117
29118
29119
29120
29121
29122
29123
29124
29125
29126
29127
29128
29129
29130
29131
29132
29133
29134
29135
29136
29137
29138
29139
29140
29141
29142
29143
29144
29145
29146
29147
29148
29149
29150
29151
29152
29153
29154
29155
29156
29157
29158
29159
29160
29161
29162
29163
29164
29165
29166
29167
29168
29169
29170
29171
29172
29173
29174
29175
29176
29177
29178
29179
29180
29181
29182
29183
29184
29185
29186
29187
29188
29189
29190
29191
29192
29193
29194
29195
29196
29197
29198
29199
29200
29201
29202
29203
29204
29205
29206
29207
29208
29209
29210
29211
29212
29213
29214
29215
29216
29217
29218
29219
29220
29221
29222
29223
29224
29225
29226
29227
29228
29229
29230
29231
29232
29233
29234
29235
29236
29237
29238
29239
29240
29241
29242
29243
29244
29245
29246
29247
29248
29249
29250
29251
29252
29253
29254
29255
29256
29257
29258
29259
29260
29261
29262
29263
29264
29265
29266
29267
29268
29269
29270
29271
29272
29273
29274
29275
29276
29277
29278
29279
29280
29281
29282
29283
29284
29285
29286
29287
29288
29289
29290
29291
29292
29293
29294
29295
29296
29297
29298
29299
29300
29301
29302
29303
29304
29305
29306
29307
29308
29309
29310
29311
29312
29313
29314
29315
29316
29317
29318
29319
29320
29321
29322
29323
29324
29325
29326
29327
29328
29329
29330
29331
29332
29333
29334
29335
29336
29337
29338
29339
29340
29341
29342
29343
29344
29345
29346
29347
29348
29349
29350
29351
29352
29353
29354
29355
29356
29357
29358
29359
29360
29361
29362
29363
29364
29365
29366
29367
29368
29369
29370
29371
29372
29373
29374
29375
29376
29377
29378
29379
29380
29381
29382
29383
29384
29385
29386
29387
29388
29389
29390
29391
29392
29393
29394
29395
29396
29397
29398
29399
29400
29401
29402
29403
29404
29405
29406
29407
29408
29409
29410
29411
29412
29413
29414
29415
29416
29417
29418
29419
29420
29421
29422
29423
29424
29425
29426
29427
29428
29429
29430
29431
29432
29433
29434
29435
29436
29437
29438
29439
29440
29441
29442
29443
29444
29445
29446
29447
29448
29449
29450
29451
29452
29453
29454
29455
29456
29457
29458
29459
29460
29461
29462
29463
29464
29465
29466
29467
29468
29469
29470
29471
29472
29473
29474
29475
29476
29477
29478
29479
29480
29481
29482
29483
29484
29485
29486
29487
29488
29489
29490
29491
29492
29493
29494
29495
29496
29497
29498
29499
29500
29501
29502
29503
29504
29505
29506
29507
29508
29509
29510
29511
29512
29513
29514
29515
29516
29517
29518
29519
29520
29521
29522
29523
29524
29525
29526
29527
29528
29529
29530
29531
29532
29533
29534
29535
29536
29537
29538
29539
29540
29541
29542
29543
29544
29545
29546
29547
29548
29549
29550
29551
29552
29553
29554
29555
29556
29557
29558
29559
29560
29561
29562
29563
29564
29565
29566
29567
29568
29569
29570
29571
29572
29573
29574
29575
29576
29577
29578
29579
29580
29581
29582
29583
29584
29585
29586
29587
29588
29589
29590
29591
29592
29593
29594
29595
29596
29597
29598
29599
29600
29601
29602
29603
29604
29605
29606
29607
29608
29609
29610
29611
29612
29613
29614
29615
29616
29617
29618
29619
29620
29621
29622
29623
29624
29625
29626
29627
29628
29629
29630
29631
29632
29633
29634
29635
29636
29637
29638
29639
29640
29641
29642
29643
29644
29645
29646
29647
29648
29649
29650
29651
29652
29653
29654
29655
29656
29657
29658
29659
29660
29661
29662
29663
29664
29665
29666
29667
29668
29669
29670
29671
29672
29673
29674
29675
29676
29677
29678
29679
29680
29681
29682
29683
29684
29685
29686
29687
29688
29689
29690
29691
29692
29693
29694
29695
29696
29697
29698
29699
29700
29701
29702
29703
29704
29705
29706
29707
29708
29709
29710
29711
29712
29713
29714
29715
29716
29717
29718
29719
29720
29721
29722
29723
29724
29725
29726
29727
29728
29729
29730
29731
29732
29733
29734
29735
29736
29737
29738
29739
29740
29741
29742
29743
29744
29745
29746
29747
29748
29749
29750
29751
29752
29753
29754
29755
29756
29757
29758
29759
29760
29761
29762
29763
29764
29765
29766
29767
29768
29769
29770
29771
29772
29773
29774
29775
29776
29777
29778
29779
29780
29781
29782
29783
29784
29785
29786
29787
29788
29789
29790
29791
29792
29793
29794
29795
29796
29797
29798
29799
29800
29801
29802
29803
29804
29805
29806
29807
29808
29809
29810
29811
29812
29813
29814
29815
29816
29817
29818
29819
29820
29821
29822
29823
29824
29825
29826
29827
29828
29829
29830
29831
29832
29833
29834
29835
29836
29837
29838
29839
29840
29841
29842
29843
29844
29845
29846
29847
29848
29849
29850
29851
29852
29853
29854
29855
29856
29857
29858
29859
29860
29861
29862
29863
29864
29865
29866
29867
29868
29869
29870
29871
29872
29873
29874
29875
29876
29877
29878
29879
29880
29881
29882
29883
29884
29885
29886
29887
29888
29889
29890
29891
29892
29893
29894
29895
29896
29897
29898
29899
29900
29901
29902
29903
29904
29905
29906
29907
29908
29909
29910
29911
29912
29913
29914
29915
29916
29917
29918
29919
29920
29921
29922
29923
29924
29925
29926
29927
29928
29929
29930
29931
29932
29933
29934
29935
29936
29937
29938
29939
29940
29941
29942
29943
29944
29945
29946
29947
29948
29949
29950
29951
29952
29953
29954
29955
29956
29957
29958
29959
29960
29961
29962
29963
29964
29965
29966
29967
29968
29969
29970
29971
29972
29973
29974
29975
29976
29977
29978
29979
29980
29981
29982
29983
29984
29985
29986
29987
29988
29989
29990
29991
29992
29993
29994
29995
29996
29997
29998
29999
30000
30001
30002
30003
30004
30005
30006
30007
30008
30009
30010
30011
30012
30013
30014
30015
30016
30017
30018
30019
30020
30021
30022
30023
30024
30025
30026
30027
30028
30029
30030
30031
30032
30033
30034
30035
30036
30037
30038
30039
30040
30041
30042
30043
30044
30045
30046
30047
30048
30049
30050
30051
30052
30053
30054
30055
30056
30057
30058
30059
30060
30061
30062
30063
30064
30065
30066
30067
30068
30069
30070
30071
30072
30073
30074
30075
30076
30077
30078
30079
30080
30081
30082
30083
30084
30085
30086
30087
30088
30089
30090
30091
30092
30093
30094
30095
30096
30097
30098
30099
30100
30101
30102
30103
30104
30105
30106
30107
30108
30109
30110
30111
30112
30113
30114
30115
30116
30117
30118
30119
30120
30121
30122
30123
30124
30125
30126
30127
30128
30129
30130
30131
30132
30133
30134
30135
30136
30137
30138
30139
30140
30141
30142
30143
30144
30145
30146
30147
30148
30149
30150
30151
30152
30153
30154
30155
30156
30157
30158
30159
30160
30161
30162
30163
30164
30165
30166
30167
30168
30169
30170
30171
30172
30173
30174
30175
30176
30177
30178
30179
30180
30181
30182
30183
30184
30185
30186
30187
30188
30189
30190
30191
30192
30193
30194
30195
30196
30197
30198
30199
30200
30201
30202
30203
30204
30205
30206
30207
30208
30209
30210
30211
30212
30213
30214
30215
30216
30217
30218
30219
30220
30221
30222
30223
30224
30225
30226
30227
30228
30229
30230
30231
30232
30233
30234
30235
30236
30237
30238
30239
30240
30241
30242
30243
30244
30245
30246
30247
30248
30249
30250
30251
30252
30253
30254
30255
30256
30257
30258
30259
30260
30261
30262
30263
30264
30265
30266
30267
30268
30269
30270
30271
30272
30273
30274
30275
30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
30289
30290
30291
30292
30293
30294
30295
30296
30297
30298
30299
30300
30301
30302
30303
30304
30305
30306
30307
30308
30309
30310
30311
30312
30313
30314
30315
30316
30317
30318
30319
30320
30321
30322
30323
30324
30325
30326
30327
30328
30329
30330
30331
30332
30333
30334
30335
30336
30337
30338
30339
30340
30341
30342
30343
30344
30345
30346
30347
30348
30349
30350
30351
30352
30353
30354
30355
30356
30357
30358
30359
30360
30361
30362
30363
30364
30365
30366
30367
30368
30369
30370
30371
30372
30373
30374
30375
30376
30377
30378
30379
30380
30381
30382
30383
30384
30385
30386
30387
30388
30389
30390
30391
30392
30393
30394
30395
30396
30397
30398
30399
30400
30401
30402
30403
30404
30405
30406
30407
30408
30409
30410
30411
30412
30413
30414
30415
30416
30417
30418
30419
30420
30421
30422
30423
30424
30425
30426
30427
30428
30429
30430
30431
30432
30433
30434
30435
30436
30437
30438
30439
30440
30441
30442
30443
30444
30445
30446
30447
30448
30449
30450
30451
30452
30453
30454
30455
30456
30457
30458
30459
30460
30461
30462
30463
30464
30465
30466
30467
30468
30469
30470
30471
30472
30473
30474
30475
30476
30477
30478
30479
30480
30481
30482
30483
30484
30485
30486
30487
30488
30489
30490
30491
30492
30493
30494
30495
30496
30497
30498
30499
30500
30501
30502
30503
30504
30505
30506
30507
30508
30509
30510
30511
30512
30513
30514
30515
30516
30517
30518
30519
30520
30521
30522
30523
30524
30525
30526
30527
30528
30529
30530
30531
30532
30533
30534
30535
30536
30537
30538
30539
30540
30541
30542
30543
30544
30545
30546
30547
30548
30549
30550
30551
30552
30553
30554
30555
30556
30557
30558
30559
30560
30561
30562
30563
30564
30565
30566
30567
30568
30569
30570
30571
30572
30573
30574
30575
30576
30577
30578
30579
30580
30581
30582
30583
30584
30585
30586
30587
30588
30589
30590
30591
30592
30593
30594
30595
30596
30597
30598
30599
30600
30601
30602
30603
30604
30605
30606
30607
30608
30609
30610
30611
30612
30613
30614
30615
30616
30617
30618
30619
30620
30621
30622
30623
30624
30625
30626
30627
30628
30629
30630
30631
30632
30633
30634
30635
30636
30637
30638
30639
30640
30641
30642
30643
30644
30645
30646
30647
30648
30649
30650
30651
30652
30653
30654
30655
30656
30657
30658
30659
30660
30661
30662
30663
30664
30665
30666
30667
30668
30669
30670
30671
30672
30673
30674
30675
30676
30677
30678
30679
30680
30681
30682
30683
30684
30685
30686
30687
30688
30689
30690
30691
30692
30693
30694
30695
30696
30697
30698
30699
30700
30701
30702
30703
30704
30705
30706
30707
30708
30709
30710
30711
30712
30713
30714
30715
30716
30717
30718
30719
30720
30721
30722
30723
30724
30725
30726
30727
30728
30729
30730
30731
30732
30733
30734
30735
30736
30737
30738
30739
30740
30741
30742
30743
30744
30745
30746
30747
30748
30749
30750
30751
30752
30753
30754
30755
30756
30757
30758
30759
30760
30761
30762
30763
30764
30765
30766
30767
30768
30769
30770
30771
30772
30773
30774
30775
30776
30777
30778
30779
30780
30781
30782
30783
30784
30785
30786
30787
30788
30789
30790
30791
30792
30793
30794
30795
30796
30797
30798
30799
30800
30801
30802
30803
30804
30805
30806
30807
30808
30809
30810
30811
30812
30813
30814
30815
30816
30817
30818
30819
30820
30821
30822
30823
30824
30825
30826
30827
30828
30829
30830
30831
30832
30833
30834
30835
30836
30837
30838
30839
30840
30841
30842
30843
30844
30845
30846
30847
30848
30849
30850
30851
30852
30853
30854
30855
30856
30857
30858
30859
30860
30861
30862
30863
30864
30865
30866
30867
30868
30869
30870
30871
30872
30873
30874
30875
30876
30877
30878
30879
30880
30881
30882
30883
30884
30885
30886
30887
30888
30889
30890
30891
30892
30893
30894
30895
30896
30897
30898
30899
30900
30901
30902
30903
30904
30905
30906
30907
30908
30909
30910
30911
30912
30913
30914
30915
30916
30917
30918
30919
30920
30921
30922
30923
30924
30925
30926
30927
30928
30929
30930
30931
30932
30933
30934
30935
30936
30937
30938
30939
30940
30941
30942
30943
30944
30945
30946
30947
30948
30949
30950
30951
30952
30953
30954
30955
30956
30957
30958
30959
30960
30961
30962
30963
30964
30965
30966
30967
30968
30969
30970
30971
30972
30973
30974
30975
30976
30977
30978
30979
30980
30981
30982
30983
30984
30985
30986
30987
30988
30989
30990
30991
30992
30993
30994
30995
30996
30997
30998
30999
31000
31001
31002
31003
31004
31005
31006
31007
31008
31009
31010
31011
31012
31013
31014
31015
31016
31017
31018
31019
31020
31021
31022
31023
31024
31025
31026
31027
31028
31029
31030
31031
31032
31033
31034
31035
31036
31037
31038
31039
31040
31041
31042
31043
31044
31045
31046
31047
31048
31049
31050
31051
31052
31053
31054
31055
31056
31057
31058
31059
31060
31061
31062
31063
31064
31065
31066
31067
31068
31069
31070
31071
31072
31073
31074
31075
31076
31077
31078
31079
31080
31081
31082
31083
31084
31085
31086
31087
31088
31089
31090
31091
31092
31093
31094
31095
31096
31097
31098
31099
31100
31101
31102
31103
31104
31105
31106
31107
31108
31109
31110
31111
31112
31113
31114
31115
31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
31130
31131
31132
31133
31134
31135
31136
31137
31138
31139
31140
31141
31142
31143
31144
31145
31146
31147
31148
31149
31150
31151
31152
31153
31154
31155
31156
31157
31158
31159
31160
31161
31162
31163
31164
31165
31166
31167
31168
31169
31170
31171
31172
31173
31174
31175
31176
31177
31178
31179
31180
31181
31182
31183
31184
31185
31186
31187
31188
31189
31190
31191
31192
31193
31194
31195
31196
31197
31198
31199
31200
31201
31202
31203
31204
31205
31206
31207
31208
31209
31210
31211
31212
31213
31214
31215
31216
31217
31218
31219
31220
31221
31222
31223
31224
31225
31226
31227
31228
31229
31230
31231
31232
31233
31234
31235
31236
31237
31238
31239
31240
31241
31242
31243
31244
31245
31246
31247
31248
31249
31250
31251
31252
31253
31254
31255
31256
31257
31258
31259
31260
31261
31262
31263
31264
31265
31266
31267
31268
31269
31270
31271
31272
31273
31274
31275
31276
31277
31278
31279
31280
31281
31282
31283
31284
31285
31286
31287
31288
31289
31290
31291
31292
31293
31294
31295
31296
31297
31298
31299
31300
31301
31302
31303
31304
31305
31306
31307
31308
31309
31310
31311
31312
31313
31314
31315
31316
31317
31318
31319
31320
31321
31322
31323
31324
31325
31326
31327
31328
31329
31330
31331
31332
31333
31334
31335
31336
31337
31338
31339
31340
31341
31342
31343
31344
31345
31346
31347
31348
31349
31350
31351
31352
31353
31354
31355
31356
31357
31358
31359
31360
31361
31362
31363
31364
31365
31366
31367
31368
31369
31370
31371
31372
31373
31374
31375
31376
31377
31378
31379
31380
31381
31382
31383
31384
31385
31386
31387
31388
31389
31390
31391
31392
31393
31394
31395
31396
31397
31398
31399
31400
31401
31402
31403
31404
31405
31406
31407
31408
31409
31410
31411
31412
31413
31414
31415
31416
31417
31418
31419
31420
31421
31422
31423
31424
31425
31426
31427
31428
31429
31430
31431
31432
31433
31434
31435
31436
31437
31438
31439
31440
31441
31442
31443
31444
31445
31446
31447
31448
31449
31450
31451
31452
31453
31454
31455
31456
31457
31458
31459
31460
31461
31462
31463
31464
31465
31466
31467
31468
31469
31470
31471
31472
31473
31474
31475
31476
31477
31478
31479
31480
31481
31482
31483
31484
31485
31486
31487
31488
31489
31490
31491
31492
31493
31494
31495
31496
31497
31498
31499
31500
31501
31502
31503
31504
31505
31506
31507
31508
31509
31510
31511
31512
31513
31514
31515
31516
31517
31518
31519
31520
31521
31522
31523
31524
31525
31526
31527
31528
31529
31530
31531
31532
31533
31534
31535
31536
31537
31538
31539
31540
31541
31542
31543
31544
31545
31546
31547
31548
31549
31550
31551
31552
31553
31554
31555
31556
31557
31558
31559
31560
31561
31562
31563
31564
31565
31566
31567
31568
31569
31570
31571
31572
31573
31574
31575
31576
31577
31578
31579
31580
31581
31582
31583
31584
31585
31586
31587
31588
31589
31590
31591
31592
31593
31594
31595
31596
31597
31598
31599
31600
31601
31602
31603
31604
31605
31606
31607
31608
31609
31610
31611
31612
31613
31614
31615
31616
31617
31618
31619
31620
31621
31622
31623
31624
31625
31626
31627
31628
31629
31630
31631
31632
31633
31634
31635
31636
31637
31638
31639
31640
31641
31642
31643
31644
31645
31646
31647
31648
31649
31650
31651
31652
31653
31654
31655
31656
31657
31658
31659
31660
31661
31662
31663
31664
31665
31666
31667
31668
31669
31670
31671
31672
31673
31674
31675
31676
31677
31678
31679
31680
31681
31682
31683
31684
31685
31686
31687
31688
31689
31690
31691
31692
31693
31694
31695
31696
31697
31698
31699
31700
31701
31702
31703
31704
31705
31706
31707
31708
31709
31710
31711
31712
31713
31714
31715
31716
31717
31718
31719
31720
31721
31722
31723
31724
31725
31726
31727
31728
31729
31730
31731
31732
31733
31734
31735
31736
31737
31738
31739
31740
31741
31742
31743
31744
31745
31746
31747
31748
31749
31750
31751
31752
31753
31754
31755
31756
31757
31758
31759
31760
31761
31762
31763
31764
31765
31766
31767
31768
31769
31770
31771
31772
31773
31774
31775
31776
31777
31778
31779
31780
31781
31782
31783
31784
31785
31786
31787
31788
31789
31790
31791
31792
31793
31794
31795
31796
31797
31798
31799
31800
31801
31802
31803
31804
31805
31806
31807
31808
31809
31810
31811
31812
31813
31814
31815
31816
31817
31818
31819
31820
31821
31822
31823
31824
31825
31826
31827
31828
31829
31830
31831
31832
31833
31834
31835
31836
31837
31838
31839
31840
31841
31842
31843
31844
31845
31846
31847
31848
31849
31850
31851
31852
31853
31854
31855
31856
31857
31858
31859
31860
31861
31862
31863
31864
31865
31866
31867
31868
31869
31870
31871
31872
31873
31874
31875
31876
31877
31878
31879
31880
31881
31882
31883
31884
31885
31886
31887
31888
31889
31890
31891
31892
31893
31894
31895
31896
31897
31898
31899
31900
31901
31902
31903
31904
31905
31906
31907
31908
31909
31910
31911
31912
31913
31914
31915
31916
31917
31918
31919
31920
31921
31922
31923
31924
31925
31926
31927
31928
31929
31930
31931
31932
31933
31934
31935
31936
31937
31938
31939
31940
31941
31942
31943
31944
31945
31946
31947
31948
31949
31950
31951
31952
31953
31954
31955
31956
31957
31958
31959
31960
31961
31962
31963
31964
31965
31966
31967
31968
31969
31970
31971
31972
31973
31974
31975
31976
31977
31978
31979
31980
31981
31982
31983
31984
31985
31986
31987
31988
31989
31990
31991
31992
31993
31994
31995
31996
31997
31998
31999
32000
32001
32002
32003
32004
32005
32006
32007
32008
32009
32010
32011
32012
32013
32014
32015
32016
32017
32018
32019
32020
32021
32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
32035
32036
32037
32038
32039
32040
32041
32042
32043
32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064
32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
32076
32077
32078
32079
32080
32081
32082
32083
32084
32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
32096
32097
32098
32099
32100
32101
32102
32103
32104
32105
32106
32107
32108
32109
32110
32111
32112
32113
32114
32115
32116
32117
32118
32119
32120
32121
32122
32123
32124
32125
32126
32127
32128
32129
32130
32131
32132
32133
32134
32135
32136
32137
32138
32139
32140
32141
32142
32143
32144
32145
32146
32147
32148
32149
32150
32151
32152
32153
32154
32155
32156
32157
32158
32159
32160
32161
32162
32163
32164
32165
32166
32167
32168
32169
32170
32171
32172
32173
32174
32175
32176
32177
32178
32179
32180
32181
32182
32183
32184
32185
32186
32187
32188
32189
32190
32191
32192
32193
32194
32195
32196
32197
32198
32199
32200
32201
32202
32203
32204
32205
32206
32207
32208
32209
32210
32211
32212
32213
32214
32215
32216
32217
32218
32219
32220
32221
32222
32223
32224
32225
32226
32227
32228
32229
32230
32231
32232
32233
32234
32235
32236
32237
32238
32239
32240
32241
32242
32243
32244
32245
32246
32247
32248
32249
32250
32251
32252
32253
32254
32255
32256
32257
32258
32259
32260
32261
32262
32263
32264
32265
32266
32267
32268
32269
32270
32271
32272
32273
32274
32275
32276
32277
32278
32279
32280
32281
32282
32283
32284
32285
32286
32287
32288
32289
32290
32291
32292
32293
32294
32295
32296
32297
32298
32299
32300
32301
32302
32303
32304
32305
32306
32307
32308
32309
32310
32311
32312
32313
32314
32315
32316
32317
32318
32319
32320
32321
32322
32323
32324
32325
32326
32327
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338
32339
32340
32341
32342
32343
32344
32345
32346
32347
32348
32349
32350
32351
32352
32353
32354
32355
32356
32357
32358
32359
32360
32361
32362
32363
32364
32365
32366
32367
32368
32369
32370
32371
32372
32373
32374
32375
32376
32377
32378
32379
32380
32381
32382
32383
32384
32385
32386
32387
32388
32389
32390
32391
32392
32393
32394
32395
32396
32397
32398
32399
32400
32401
32402
32403
32404
32405
32406
32407
32408
32409
32410
32411
32412
32413
32414
32415
32416
32417
32418
32419
32420
32421
32422
32423
32424
32425
32426
32427
32428
32429
32430
32431
32432
32433
32434
32435
32436
32437
32438
32439
32440
32441
32442
32443
32444
32445
32446
32447
32448
32449
32450
32451
32452
32453
32454
32455
32456
32457
32458
32459
32460
32461
32462
32463
32464
32465
32466
32467
32468
32469
32470
32471
32472
32473
32474
32475
32476
32477
32478
32479
32480
32481
32482
32483
32484
32485
32486
32487
32488
32489
32490
32491
32492
32493
32494
32495
32496
32497
32498
32499
32500
32501
32502
32503
32504
32505
32506
32507
32508
32509
32510
32511
32512
32513
32514
32515
32516
32517
32518
32519
32520
32521
32522
32523
32524
32525
32526
32527
32528
32529
32530
32531
32532
32533
32534
32535
32536
32537
32538
32539
32540
32541
32542
32543
32544
32545
32546
32547
32548
32549
32550
32551
32552
32553
32554
32555
32556
32557
32558
32559
32560
32561
32562
32563
32564
32565
32566
32567
32568
32569
32570
32571
32572
32573
32574
32575
32576
32577
32578
32579
32580
32581
32582
32583
32584
32585
32586
32587
32588
32589
32590
32591
32592
32593
32594
32595
32596
32597
32598
32599
32600
32601
32602
32603
32604
32605
32606
32607
32608
32609
32610
32611
32612
32613
32614
32615
32616
32617
32618
32619
32620
32621
32622
32623
32624
32625
32626
32627
32628
32629
32630
32631
32632
32633
32634
32635
32636
32637
32638
32639
32640
32641
32642
32643
32644
32645
32646
32647
32648
32649
32650
32651
32652
32653
32654
32655
32656
32657
32658
32659
32660
32661
32662
32663
32664
32665
32666
32667
32668
32669
32670
32671
32672
32673
32674
32675
32676
32677
32678
32679
32680
32681
32682
32683
32684
32685
32686
32687
32688
32689
32690
32691
32692
32693
32694
32695
32696
32697
32698
32699
32700
32701
32702
32703
32704
32705
32706
32707
32708
32709
32710
32711
32712
32713
32714
32715
32716
32717
32718
32719
32720
32721
32722
32723
32724
32725
32726
32727
32728
32729
32730
32731
32732
32733
32734
32735
32736
32737
32738
32739
32740
32741
32742
32743
32744
32745
32746
32747
32748
32749
32750
32751
32752
32753
32754
32755
32756
32757
32758
32759
32760
32761
32762
32763
32764
32765
32766
32767
32768
32769
32770
32771
32772
32773
32774
32775
32776
32777
32778
32779
32780
32781
32782
32783
32784
32785
32786
32787
32788
32789
32790
32791
32792
32793
32794
32795
32796
32797
32798
32799
32800
32801
32802
32803
32804
32805
32806
32807
32808
32809
32810
32811
32812
32813
32814
32815
32816
32817
32818
32819
32820
32821
32822
32823
32824
32825
32826
32827
32828
32829
32830
32831
32832
32833
32834
32835
32836
32837
32838
32839
32840
32841
32842
32843
32844
32845
32846
32847
32848
32849
32850
32851
32852
32853
32854
32855
32856
32857
32858
32859
32860
32861
32862
32863
32864
32865
32866
32867
32868
32869
32870
32871
32872
32873
32874
32875
32876
32877
32878
32879
32880
32881
32882
32883
32884
32885
32886
32887
32888
32889
32890
32891
32892
32893
32894
32895
32896
32897
32898
32899
32900
32901
32902
32903
32904
32905
32906
32907
32908
32909
32910
32911
32912
32913
32914
32915
32916
32917
32918
32919
32920
32921
32922
32923
32924
32925
32926
32927
32928
32929
32930
32931
32932
32933
32934
32935
32936
32937
32938
32939
32940
32941
32942
32943
32944
32945
32946
32947
32948
32949
32950
32951
32952
32953
32954
32955
32956
32957
32958
32959
32960
32961
32962
32963
32964
32965
32966
32967
32968
32969
32970
32971
32972
32973
32974
32975
32976
32977
32978
32979
32980
32981
32982
32983
32984
32985
32986
32987
32988
32989
32990
32991
32992
32993
32994
32995
32996
32997
32998
32999
33000
33001
33002
33003
33004
33005
33006
33007
33008
33009
33010
33011
33012
33013
33014
33015
33016
33017
33018
33019
33020
33021
33022
33023
33024
33025
33026
33027
33028
33029
33030
33031
33032
33033
33034
33035
33036
33037
33038
33039
33040
33041
33042
33043
33044
33045
33046
33047
33048
33049
33050
33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
33074
33075
33076
33077
33078
33079
33080
33081
33082
33083
33084
33085
33086
33087
33088
33089
33090
33091
33092
33093
33094
33095
33096
33097
33098
33099
33100
33101
33102
33103
33104
33105
33106
33107
33108
33109
33110
33111
33112
33113
33114
33115
33116
33117
33118
33119
33120
33121
33122
33123
33124
33125
33126
33127
33128
33129
33130
33131
33132
33133
33134
33135
33136
33137
33138
33139
33140
33141
33142
33143
33144
33145
33146
33147
33148
33149
33150
33151
33152
33153
33154
33155
33156
33157
33158
33159
33160
33161
33162
33163
33164
33165
33166
33167
33168
33169
33170
33171
33172
33173
33174
33175
33176
33177
33178
33179
33180
33181
33182
33183
33184
33185
33186
33187
33188
33189
33190
33191
33192
33193
33194
33195
33196
33197
33198
33199
33200
33201
33202
33203
33204
33205
33206
33207
33208
33209
33210
33211
33212
33213
33214
33215
33216
33217
33218
33219
33220
33221
33222
33223
33224
33225
33226
33227
33228
33229
33230
33231
33232
33233
33234
33235
33236
33237
33238
33239
33240
33241
33242
33243
33244
33245
33246
33247
33248
33249
33250
33251
33252
33253
33254
33255
33256
33257
33258
33259
33260
33261
33262
33263
33264
33265
33266
33267
33268
33269
33270
33271
33272
33273
33274
33275
33276
33277
33278
33279
33280
33281
33282
33283
33284
33285
33286
33287
33288
33289
33290
33291
33292
33293
33294
33295
33296
33297
33298
33299
33300
33301
33302
33303
33304
33305
33306
33307
33308
33309
33310
33311
33312
33313
33314
33315
33316
33317
33318
33319
33320
33321
33322
33323
33324
33325
33326
33327
33328
33329
33330
33331
33332
33333
33334
33335
33336
33337
33338
33339
33340
33341
33342
33343
33344
33345
33346
33347
33348
33349
33350
33351
33352
33353
33354
33355
33356
33357
33358
33359
33360
33361
33362
33363
33364
33365
33366
33367
33368
33369
33370
33371
33372
33373
33374
33375
33376
33377
33378
33379
33380
33381
33382
33383
33384
33385
33386
33387
33388
33389
33390
33391
33392
33393
33394
33395
33396
33397
33398
33399
33400
33401
33402
33403
33404
33405
33406
33407
33408
33409
33410
33411
33412
33413
33414
33415
33416
33417
33418
33419
33420
33421
33422
33423
33424
33425
33426
33427
33428
33429
33430
33431
33432
33433
33434
33435
33436
33437
33438
33439
33440
33441
33442
33443
33444
33445
33446
33447
33448
33449
33450
33451
33452
33453
33454
33455
33456
33457
33458
33459
33460
33461
33462
33463
33464
33465
33466
33467
33468
33469
33470
33471
33472
33473
33474
33475
33476
33477
33478
33479
33480
33481
33482
33483
33484
33485
33486
33487
33488
33489
33490
33491
33492
33493
33494
33495
33496
33497
33498
33499
33500
33501
33502
33503
33504
33505
33506
33507
33508
33509
33510
33511
33512
33513
33514
33515
33516
33517
33518
33519
33520
33521
33522
33523
33524
33525
33526
33527
33528
33529
33530
33531
33532
33533
33534
33535
33536
33537
33538
33539
33540
33541
33542
33543
33544
33545
33546
33547
33548
33549
33550
33551
33552
33553
33554
33555
33556
33557
33558
33559
33560
33561
33562
33563
33564
33565
33566
33567
33568
33569
33570
33571
33572
33573
33574
33575
33576
33577
33578
33579
33580
33581
33582
33583
33584
33585
33586
33587
33588
33589
33590
33591
33592
33593
33594
33595
33596
33597
33598
33599
33600
33601
33602
33603
33604
33605
33606
33607
33608
33609
33610
33611
33612
33613
33614
33615
33616
33617
33618
33619
33620
33621
33622
33623
33624
33625
33626
33627
33628
33629
33630
33631
33632
33633
33634
33635
33636
33637
33638
33639
33640
33641
33642
33643
33644
33645
33646
33647
33648
33649
33650
33651
33652
33653
33654
33655
33656
33657
33658
33659
33660
33661
33662
33663
33664
33665
33666
33667
33668
33669
33670
33671
33672
33673
33674
33675
33676
33677
33678
33679
33680
33681
33682
33683
33684
33685
33686
33687
33688
33689
33690
33691
33692
33693
33694
33695
33696
33697
33698
33699
33700
33701
33702
33703
33704
33705
33706
33707
33708
33709
33710
33711
33712
33713
33714
33715
33716
33717
33718
33719
33720
33721
33722
33723
33724
33725
33726
33727
33728
33729
33730
33731
33732
33733
33734
33735
33736
33737
33738
33739
33740
33741
33742
33743
33744
33745
33746
33747
33748
33749
33750
33751
33752
33753
33754
33755
33756
33757
33758
33759
33760
33761
33762
33763
33764
33765
33766
33767
33768
33769
33770
33771
33772
33773
33774
33775
33776
33777
33778
33779
33780
33781
33782
33783
33784
33785
33786
33787
33788
33789
33790
33791
33792
33793
33794
33795
33796
33797
33798
33799
33800
33801
33802
33803
33804
33805
33806
33807
33808
33809
33810
33811
33812
33813
33814
33815
33816
33817
33818
33819
33820
33821
33822
33823
33824
33825
33826
33827
33828
33829
33830
33831
33832
33833
33834
33835
33836
33837
33838
33839
33840
33841
33842
33843
33844
33845
33846
33847
33848
33849
33850
33851
33852
33853
33854
33855
33856
33857
33858
33859
33860
33861
33862
33863
33864
33865
33866
33867
33868
33869
33870
33871
33872
33873
33874
33875
33876
33877
33878
33879
33880
33881
33882
33883
33884
33885
33886
33887
33888
33889
33890
33891
33892
33893
33894
33895
33896
33897
33898
33899
33900
33901
33902
33903
33904
33905
33906
33907
33908
33909
33910
33911
33912
33913
33914
33915
33916
33917
33918
33919
33920
33921
33922
33923
33924
33925
33926
33927
33928
33929
33930
33931
33932
33933
33934
33935
33936
33937
33938
33939
33940
33941
33942
33943
33944
33945
33946
33947
33948
33949
33950
33951
33952
33953
33954
33955
33956
33957
33958
33959
33960
33961
33962
33963
33964
33965
33966
33967
33968
33969
33970
33971
33972
33973
33974
33975
33976
33977
33978
33979
33980
33981
33982
33983
33984
33985
33986
33987
33988
33989
33990
33991
33992
33993
33994
33995
33996
33997
33998
33999
34000
34001
34002
34003
34004
34005
34006
34007
34008
34009
34010
34011
34012
34013
34014
34015
34016
34017
34018
34019
34020
34021
34022
34023
34024
34025
34026
34027
34028
34029
34030
34031
34032
34033
34034
34035
34036
34037
34038
34039
34040
34041
34042
34043
34044
34045
34046
34047
34048
34049
34050
34051
34052
34053
34054
34055
34056
34057
34058
34059
34060
34061
34062
34063
34064
34065
34066
34067
34068
34069
34070
34071
34072
34073
34074
34075
34076
34077
34078
34079
34080
34081
34082
34083
34084
34085
34086
34087
34088
34089
34090
34091
34092
34093
34094
34095
34096
34097
34098
34099
34100
34101
34102
34103
34104
34105
34106
34107
34108
34109
34110
34111
34112
34113
34114
34115
34116
34117
34118
34119
34120
34121
34122
34123
34124
34125
34126
34127
34128
34129
34130
34131
34132
34133
34134
34135
34136
34137
34138
34139
34140
34141
34142
34143
34144
34145
34146
34147
34148
34149
34150
34151
34152
34153
34154
34155
34156
34157
34158
34159
34160
34161
34162
34163
34164
34165
34166
34167
34168
34169
34170
34171
34172
34173
34174
34175
34176
34177
34178
34179
34180
34181
34182
34183
34184
34185
34186
34187
34188
34189
34190
34191
34192
34193
34194
34195
34196
34197
34198
34199
34200
34201
34202
34203
34204
34205
34206
34207
34208
34209
34210
34211
34212
34213
34214
34215
34216
34217
34218
34219
34220
34221
34222
34223
34224
34225
34226
34227
34228
34229
34230
34231
34232
34233
34234
34235
34236
34237
34238
34239
34240
34241
34242
34243
34244
34245
34246
34247
34248
34249
34250
34251
34252
34253
34254
34255
34256
34257
34258
34259
34260
34261
34262
34263
34264
34265
34266
34267
34268
34269
34270
34271
34272
34273
34274
34275
34276
34277
34278
34279
34280
34281
34282
34283
34284
34285
34286
34287
34288
34289
34290
34291
34292
34293
34294
34295
34296
34297
34298
34299
34300
34301
34302
34303
34304
34305
34306
34307
34308
34309
34310
34311
34312
34313
34314
34315
34316
34317
34318
34319
34320
34321
34322
34323
34324
34325
34326
34327
34328
34329
34330
34331
34332
34333
34334
34335
34336
34337
34338
34339
34340
34341
34342
34343
34344
34345
34346
34347
34348
34349
34350
34351
34352
34353
34354
34355
34356
34357
34358
34359
34360
34361
34362
34363
34364
34365
34366
34367
34368
34369
34370
34371
34372
34373
34374
34375
34376
34377
34378
34379
34380
34381
34382
34383
34384
34385
34386
34387
34388
34389
34390
34391
34392
34393
34394
34395
34396
34397
34398
34399
34400
34401
34402
34403
34404
34405
34406
34407
34408
34409
34410
34411
34412
34413
34414
34415
34416
34417
34418
34419
34420
34421
34422
34423
34424
34425
34426
34427
34428
34429
34430
34431
34432
34433
34434
34435
34436
34437
34438
34439
34440
34441
34442
34443
34444
34445
34446
34447
34448
34449
34450
34451
34452
34453
34454
34455
34456
34457
34458
34459
34460
34461
34462
34463
34464
34465
34466
34467
34468
34469
34470
34471
34472
34473
34474
34475
34476
34477
34478
34479
34480
34481
34482
34483
34484
34485
34486
34487
34488
34489
34490
34491
34492
34493
34494
34495
34496
34497
34498
34499
34500
34501
34502
34503
34504
34505
34506
34507
34508
34509
34510
34511
34512
34513
34514
34515
34516
34517
34518
34519
34520
34521
34522
34523
34524
34525
34526
34527
34528
34529
34530
34531
34532
34533
34534
34535
34536
34537
34538
34539
34540
34541
34542
34543
34544
34545
34546
34547
34548
34549
34550
34551
34552
34553
34554
34555
34556
34557
34558
34559
34560
34561
34562
34563
34564
34565
34566
34567
34568
34569
34570
34571
34572
34573
34574
34575
34576
34577
34578
34579
34580
34581
34582
34583
34584
34585
34586
34587
34588
34589
34590
34591
34592
34593
34594
34595
34596
34597
34598
34599
34600
34601
34602
34603
34604
34605
34606
34607
34608
34609
34610
34611
34612
34613
34614
34615
34616
34617
34618
34619
34620
34621
34622
34623
34624
34625
34626
34627
34628
34629
34630
34631
34632
34633
34634
34635
34636
34637
34638
34639
34640
34641
34642
34643
34644
34645
34646
34647
34648
34649
34650
34651
34652
34653
34654
34655
34656
34657
34658
34659
34660
34661
34662
34663
34664
34665
34666
34667
34668
34669
34670
34671
34672
34673
34674
34675
34676
34677
34678
34679
34680
34681
34682
34683
34684
34685
34686
34687
34688
34689
34690
34691
34692
34693
34694
34695
34696
34697
34698
34699
34700
34701
34702
34703
34704
34705
34706
34707
34708
34709
34710
34711
34712
34713
34714
34715
34716
34717
34718
34719
34720
34721
34722
34723
34724
34725
34726
34727
34728
34729
34730
34731
34732
34733
34734
34735
34736
34737
34738
34739
34740
34741
34742
34743
34744
34745
34746
34747
34748
34749
34750
34751
34752
34753
34754
34755
34756
34757
34758
34759
34760
34761
34762
34763
34764
34765
34766
34767
34768
34769
34770
34771
34772
34773
34774
34775
34776
34777
34778
34779
34780
34781
34782
34783
34784
34785
34786
34787
34788
34789
34790
34791
34792
34793
34794
34795
34796
34797
34798
34799
34800
34801
34802
34803
34804
34805
34806
34807
34808
34809
34810
34811
34812
34813
34814
34815
34816
34817
34818
34819
34820
34821
34822
34823
34824
34825
34826
34827
34828
34829
34830
34831
34832
34833
34834
34835
34836
34837
34838
34839
34840
34841
34842
34843
34844
34845
34846
34847
34848
34849
34850
34851
34852
34853
34854
34855
34856
34857
34858
34859
34860
34861
34862
34863
34864
34865
34866
34867
34868
34869
34870
34871
34872
34873
34874
34875
34876
34877
34878
34879
34880
34881
34882
34883
34884
34885
34886
34887
34888
34889
34890
34891
34892
34893
34894
34895
34896
34897
34898
34899
34900
34901
34902
34903
34904
34905
34906
34907
34908
34909
34910
34911
34912
34913
34914
34915
34916
34917
34918
34919
34920
34921
34922
34923
34924
34925
34926
34927
34928
34929
34930
34931
34932
34933
34934
34935
34936
34937
34938
34939
34940
34941
34942
34943
34944
34945
34946
34947
34948
34949
34950
34951
34952
34953
34954
34955
34956
34957
34958
34959
34960
34961
34962
34963
34964
34965
34966
34967
34968
34969
34970
34971
34972
34973
34974
34975
34976
34977
34978
34979
34980
34981
34982
34983
34984
34985
34986
34987
34988
34989
34990
34991
34992
34993
34994
34995
34996
34997
34998
34999
35000
35001
35002
35003
35004
35005
35006
35007
35008
35009
35010
35011
35012
35013
35014
35015
35016
35017
35018
35019
35020
35021
35022
35023
35024
35025
35026
35027
35028
35029
35030
35031
35032
35033
35034
35035
35036
35037
35038
35039
35040
35041
35042
35043
35044
35045
35046
35047
35048
35049
35050
35051
35052
35053
35054
35055
35056
35057
35058
35059
35060
35061
35062
35063
35064
35065
35066
35067
35068
35069
35070
35071
35072
35073
35074
35075
35076
35077
35078
35079
35080
35081
35082
35083
35084
35085
35086
35087
35088
35089
35090
35091
35092
35093
35094
35095
35096
35097
35098
35099
35100
35101
35102
35103
35104
35105
35106
35107
35108
35109
35110
35111
35112
35113
35114
35115
35116
35117
35118
35119
35120
35121
35122
35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148
35149
35150
35151
35152
35153
35154
35155
35156
35157
35158
35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
35169
35170
35171
35172
35173
35174
35175
35176
35177
35178
35179
35180
35181
35182
35183
35184
35185
35186
35187
35188
35189
35190
35191
35192
35193
35194
35195
35196
35197
35198
35199
35200
35201
35202
35203
35204
35205
35206
35207
35208
35209
35210
35211
35212
35213
35214
35215
35216
35217
35218
35219
35220
35221
35222
35223
35224
35225
35226
35227
35228
35229
35230
35231
35232
35233
35234
35235
35236
35237
35238
35239
35240
35241
35242
35243
35244
35245
35246
35247
35248
35249
35250
35251
35252
35253
35254
35255
35256
35257
35258
35259
35260
35261
35262
35263
35264
35265
35266
35267
35268
35269
35270
35271
35272
35273
35274
35275
35276
35277
35278
35279
35280
35281
35282
35283
35284
35285
35286
35287
35288
35289
35290
35291
35292
35293
35294
35295
35296
35297
35298
35299
35300
35301
35302
35303
35304
35305
35306
35307
35308
35309
35310
35311
35312
35313
35314
35315
35316
35317
35318
35319
35320
35321
35322
35323
35324
35325
35326
35327
35328
35329
35330
35331
35332
35333
35334
35335
35336
35337
35338
35339
35340
35341
35342
35343
35344
35345
35346
35347
35348
35349
35350
35351
35352
35353
35354
35355
35356
35357
35358
35359
35360
35361
35362
35363
35364
35365
35366
35367
35368
35369
35370
35371
35372
35373
35374
35375
35376
35377
35378
35379
35380
35381
35382
35383
35384
35385
35386
35387
35388
35389
35390
35391
35392
35393
35394
35395
35396
35397
35398
35399
35400
35401
35402
35403
35404
35405
35406
35407
35408
35409
35410
35411
35412
35413
35414
35415
35416
35417
35418
35419
35420
35421
35422
35423
35424
35425
35426
35427
35428
35429
35430
35431
35432
35433
35434
35435
35436
35437
35438
35439
35440
35441
35442
35443
35444
35445
35446
35447
35448
35449
35450
35451
35452
35453
35454
35455
35456
35457
35458
35459
35460
35461
35462
35463
35464
35465
35466
35467
35468
35469
35470
35471
35472
35473
35474
35475
35476
35477
35478
35479
35480
35481
35482
35483
35484
35485
35486
35487
35488
35489
35490
35491
35492
35493
35494
35495
35496
35497
35498
35499
35500
35501
35502
35503
35504
35505
35506
35507
35508
35509
35510
35511
35512
35513
35514
35515
35516
35517
35518
35519
35520
35521
35522
35523
35524
35525
35526
35527
35528
35529
35530
35531
35532
35533
35534
35535
35536
35537
35538
35539
35540
35541
35542
35543
35544
35545
35546
35547
35548
35549
35550
35551
35552
35553
35554
35555
35556
35557
35558
35559
35560
35561
35562
35563
35564
35565
35566
35567
35568
35569
35570
35571
35572
35573
35574
35575
35576
35577
35578
35579
35580
35581
35582
35583
35584
35585
35586
35587
35588
35589
35590
35591
35592
35593
35594
35595
35596
35597
35598
35599
35600
35601
35602
35603
35604
35605
35606
35607
35608
35609
35610
35611
35612
35613
35614
35615
35616
35617
35618
35619
35620
35621
35622
35623
35624
35625
35626
35627
35628
35629
35630
35631
35632
35633
35634
35635
35636
35637
35638
35639
35640
35641
35642
35643
35644
35645
35646
35647
35648
35649
35650
35651
35652
35653
35654
35655
35656
35657
35658
35659
35660
35661
35662
35663
35664
35665
35666
35667
35668
35669
35670
35671
35672
35673
35674
35675
35676
35677
35678
35679
35680
35681
35682
35683
35684
35685
35686
35687
35688
35689
35690
35691
35692
35693
35694
35695
35696
35697
35698
35699
35700
35701
35702
35703
35704
35705
35706
35707
35708
35709
35710
35711
35712
35713
35714
35715
35716
35717
35718
35719
35720
35721
35722
35723
35724
35725
35726
35727
35728
35729
35730
35731
35732
35733
35734
35735
35736
35737
35738
35739
35740
35741
35742
35743
35744
35745
35746
35747
35748
35749
35750
35751
35752
35753
35754
35755
35756
35757
35758
35759
35760
35761
35762
35763
35764
35765
35766
35767
35768
35769
35770
35771
35772
35773
35774
35775
35776
35777
35778
35779
35780
35781
35782
35783
35784
35785
35786
35787
35788
35789
35790
35791
35792
35793
35794
35795
35796
35797
35798
35799
35800
35801
35802
35803
35804
35805
35806
35807
35808
35809
35810
35811
35812
35813
35814
35815
35816
35817
35818
35819
35820
35821
35822
35823
35824
35825
35826
35827
35828
35829
35830
35831
35832
35833
35834
35835
35836
35837
35838
35839
35840
35841
35842
35843
35844
35845
35846
35847
35848
35849
35850
35851
35852
35853
35854
35855
35856
35857
35858
35859
35860
35861
35862
35863
35864
35865
35866
35867
35868
35869
35870
35871
35872
35873
35874
35875
35876
35877
35878
35879
35880
35881
35882
35883
35884
35885
35886
35887
35888
35889
35890
35891
35892
35893
35894
35895
35896
35897
35898
35899
35900
35901
35902
35903
35904
35905
35906
35907
35908
35909
35910
35911
35912
35913
35914
35915
35916
35917
35918
35919
35920
35921
35922
35923
35924
35925
35926
35927
35928
35929
35930
35931
35932
35933
35934
35935
35936
35937
35938
35939
35940
35941
35942
35943
35944
35945
35946
35947
35948
35949
35950
35951
35952
35953
35954
35955
35956
35957
35958
35959
35960
35961
35962
35963
35964
35965
35966
35967
35968
35969
35970
35971
35972
35973
35974
35975
35976
35977
35978
35979
35980
35981
35982
35983
35984
35985
35986
35987
35988
35989
35990
35991
35992
35993
35994
35995
35996
35997
35998
35999
36000
36001
36002
36003
36004
36005
36006
36007
36008
36009
36010
36011
36012
36013
36014
36015
36016
36017
36018
36019
36020
36021
36022
36023
36024
36025
36026
36027
36028
36029
36030
36031
36032
36033
36034
36035
36036
36037
36038
36039
36040
36041
36042
36043
36044
36045
36046
36047
36048
36049
36050
36051
36052
36053
36054
36055
36056
36057
36058
36059
36060
36061
36062
36063
36064
36065
36066
36067
36068
36069
36070
36071
36072
36073
36074
36075
36076
36077
36078
36079
36080
36081
36082
36083
36084
36085
36086
36087
36088
36089
36090
36091
36092
36093
36094
36095
36096
36097
36098
36099
36100
36101
36102
36103
36104
36105
36106
36107
36108
36109
36110
36111
36112
36113
36114
36115
36116
36117
36118
36119
36120
36121
36122
36123
36124
36125
36126
36127
36128
36129
36130
36131
36132
36133
36134
36135
36136
36137
36138
36139
36140
36141
36142
36143
36144
36145
36146
36147
36148
36149
36150
36151
36152
36153
36154
36155
36156
36157
36158
36159
36160
36161
36162
36163
36164
36165
36166
36167
36168
36169
36170
36171
36172
36173
36174
36175
36176
36177
36178
36179
36180
36181
36182
36183
36184
36185
36186
36187
36188
36189
36190
36191
36192
36193
36194
36195
36196
36197
36198
36199
36200
36201
36202
36203
36204
36205
36206
36207
36208
36209
36210
36211
36212
36213
36214
36215
36216
36217
36218
36219
36220
36221
36222
36223
36224
36225
36226
36227
36228
36229
36230
36231
36232
36233
36234
36235
36236
36237
36238
36239
36240
36241
36242
36243
36244
36245
36246
36247
36248
36249
36250
36251
36252
36253
36254
36255
36256
36257
36258
36259
36260
36261
36262
36263
36264
36265
36266
36267
36268
36269
36270
36271
36272
36273
36274
36275
36276
36277
36278
36279
36280
36281
36282
36283
36284
36285
36286
36287
36288
36289
36290
36291
36292
36293
36294
36295
36296
36297
36298
36299
36300
36301
36302
36303
36304
36305
36306
36307
36308
36309
36310
36311
36312
36313
36314
36315
36316
36317
36318
36319
36320
36321
36322
36323
36324
36325
36326
36327
36328
36329
36330
36331
36332
36333
36334
36335
36336
36337
36338
36339
36340
36341
36342
36343
36344
36345
36346
36347
36348
36349
36350
36351
36352
36353
36354
36355
36356
36357
36358
36359
36360
36361
36362
36363
36364
36365
36366
36367
36368
36369
36370
36371
36372
36373
36374
36375
36376
36377
36378
36379
36380
36381
36382
36383
36384
36385
36386
36387
36388
36389
36390
36391
36392
36393
36394
36395
36396
36397
36398
36399
36400
36401
36402
36403
36404
36405
36406
36407
36408
36409
36410
36411
36412
36413
36414
36415
36416
36417
36418
36419
36420
36421
36422
36423
36424
36425
36426
36427
36428
36429
36430
36431
36432
36433
36434
36435
36436
36437
36438
36439
36440
36441
36442
36443
36444
36445
36446
36447
36448
36449
36450
36451
36452
36453
36454
36455
36456
36457
36458
36459
36460
36461
36462
36463
36464
36465
36466
36467
36468
36469
36470
36471
36472
36473
36474
36475
36476
36477
36478
36479
36480
36481
36482
36483
36484
36485
36486
36487
36488
36489
36490
36491
36492
36493
36494
36495
36496
36497
36498
36499
36500
36501
36502
36503
36504
36505
36506
36507
36508
36509
36510
36511
36512
36513
36514
36515
36516
36517
36518
36519
36520
36521
36522
36523
36524
36525
36526
36527
36528
36529
36530
36531
36532
36533
36534
36535
36536
36537
36538
36539
36540
36541
36542
36543
36544
36545
36546
36547
36548
36549
36550
36551
36552
36553
36554
36555
36556
36557
36558
36559
36560
36561
36562
36563
36564
36565
36566
36567
36568
36569
36570
36571
36572
36573
36574
36575
36576
36577
36578
36579
36580
36581
36582
36583
36584
36585
36586
36587
36588
36589
36590
36591
36592
36593
36594
36595
36596
36597
36598
36599
36600
36601
36602
36603
36604
36605
36606
36607
36608
36609
36610
36611
36612
36613
36614
36615
36616
36617
36618
36619
36620
36621
36622
36623
36624
36625
36626
36627
36628
36629
36630
36631
36632
36633
36634
36635
36636
36637
36638
36639
36640
36641
36642
36643
36644
36645
36646
36647
36648
36649
36650
36651
36652
36653
36654
36655
36656
36657
36658
36659
36660
36661
36662
36663
36664
36665
36666
36667
36668
36669
36670
36671
36672
36673
36674
36675
36676
36677
36678
36679
36680
36681
36682
36683
36684
36685
36686
36687
36688
36689
36690
36691
36692
36693
36694
36695
36696
36697
36698
36699
36700
36701
36702
36703
36704
36705
36706
36707
36708
36709
36710
36711
36712
36713
36714
36715
36716
36717
36718
36719
36720
36721
36722
36723
36724
36725
36726
36727
36728
36729
36730
36731
36732
36733
36734
36735
36736
36737
36738
36739
36740
36741
36742
36743
36744
36745
36746
36747
36748
36749
36750
36751
36752
36753
36754
36755
36756
36757
36758
36759
36760
36761
36762
36763
36764
36765
36766
36767
36768
36769
36770
36771
36772
36773
36774
36775
36776
36777
36778
36779
36780
36781
36782
36783
36784
36785
36786
36787
36788
36789
36790
36791
36792
36793
36794
36795
36796
36797
36798
36799
36800
36801
36802
36803
36804
36805
36806
36807
36808
36809
36810
36811
36812
36813
36814
36815
36816
36817
36818
36819
36820
36821
36822
36823
36824
36825
36826
36827
36828
36829
36830
36831
36832
36833
36834
36835
36836
36837
36838
36839
36840
36841
36842
36843
36844
36845
36846
36847
36848
36849
36850
36851
36852
36853
36854
36855
36856
36857
36858
36859
36860
36861
36862
36863
36864
36865
36866
36867
36868
36869
36870
36871
36872
36873
36874
36875
36876
36877
36878
36879
36880
36881
36882
36883
36884
36885
36886
36887
36888
36889
36890
36891
36892
36893
36894
36895
36896
36897
36898
36899
36900
36901
36902
36903
36904
36905
36906
36907
36908
36909
36910
36911
36912
36913
36914
36915
36916
36917
36918
36919
36920
36921
36922
36923
36924
36925
36926
36927
36928
36929
36930
36931
36932
36933
36934
36935
36936
36937
36938
36939
36940
36941
36942
36943
36944
36945
36946
36947
36948
36949
36950
36951
36952
36953
36954
36955
36956
36957
36958
36959
36960
36961
36962
36963
36964
36965
36966
36967
36968
36969
36970
36971
36972
36973
36974
36975
36976
36977
36978
36979
36980
36981
36982
36983
36984
36985
36986
36987
36988
36989
36990
36991
36992
36993
36994
36995
36996
36997
36998
36999
37000
37001
37002
37003
37004
37005
37006
37007
37008
37009
37010
37011
37012
37013
37014
37015
37016
37017
37018
37019
37020
37021
37022
37023
37024
37025
37026
37027
37028
37029
37030
37031
37032
37033
37034
37035
37036
37037
37038
37039
37040
37041
37042
37043
37044
37045
37046
37047
37048
37049
37050
37051
37052
37053
37054
37055
37056
37057
37058
37059
37060
37061
37062
37063
37064
37065
37066
37067
37068
37069
37070
37071
37072
37073
37074
37075
37076
37077
37078
37079
37080
37081
37082
37083
37084
37085
37086
37087
37088
37089
37090
37091
37092
37093
37094
37095
37096
37097
37098
37099
37100
37101
37102
37103
37104
37105
37106
37107
37108
37109
37110
37111
37112
37113
37114
37115
37116
37117
37118
37119
37120
37121
37122
37123
37124
37125
37126
37127
37128
37129
37130
37131
37132
37133
37134
37135
37136
37137
37138
37139
37140
37141
37142
37143
37144
37145
37146
37147
37148
37149
37150
37151
37152
37153
37154
37155
37156
37157
37158
37159
37160
37161
37162
37163
37164
37165
37166
37167
37168
37169
37170
37171
37172
37173
37174
37175
37176
37177
37178
37179
37180
37181
37182
37183
37184
37185
37186
37187
37188
37189
37190
37191
37192
37193
37194
37195
37196
37197
37198
37199
37200
37201
37202
37203
37204
37205
37206
37207
37208
37209
37210
37211
37212
37213
37214
37215
37216
37217
37218
37219
37220
37221
37222
37223
37224
37225
37226
37227
37228
37229
37230
37231
37232
37233
37234
37235
37236
37237
37238
37239
37240
37241
37242
37243
37244
37245
37246
37247
37248
37249
37250
37251
37252
37253
37254
37255
37256
37257
37258
37259
37260
37261
37262
37263
37264
37265
37266
37267
37268
37269
37270
37271
37272
37273
37274
37275
37276
37277
37278
37279
37280
37281
37282
37283
37284
37285
37286
37287
37288
37289
37290
37291
37292
37293
37294
37295
37296
37297
37298
37299
37300
37301
37302
37303
37304
37305
37306
37307
37308
37309
37310
37311
37312
37313
37314
37315
37316
37317
37318
37319
37320
37321
37322
37323
37324
37325
37326
37327
37328
37329
37330
37331
37332
37333
37334
37335
37336
37337
37338
37339
37340
37341
37342
37343
37344
37345
37346
37347
37348
37349
37350
37351
37352
37353
37354
37355
37356
37357
37358
37359
37360
37361
37362
37363
37364
37365
37366
37367
37368
37369
37370
37371
37372
37373
37374
37375
37376
37377
37378
37379
37380
37381
37382
37383
37384
37385
37386
37387
37388
37389
37390
37391
37392
37393
37394
37395
37396
37397
37398
37399
37400
37401
37402
37403
37404
37405
37406
37407
37408
37409
37410
37411
37412
37413
37414
37415
37416
37417
37418
37419
37420
37421
37422
37423
37424
37425
37426
37427
37428
37429
37430
37431
37432
37433
37434
37435
37436
37437
37438
37439
37440
37441
37442
37443
37444
37445
37446
37447
37448
37449
37450
37451
37452
37453
37454
37455
37456
37457
37458
37459
37460
37461
37462
37463
37464
37465
37466
37467
37468
37469
37470
37471
37472
37473
37474
37475
37476
37477
37478
37479
37480
37481
37482
37483
37484
37485
37486
37487
37488
37489
37490
37491
37492
37493
37494
37495
37496
37497
37498
37499
37500
37501
37502
37503
37504
37505
37506
37507
37508
37509
37510
37511
37512
37513
37514
37515
37516
37517
37518
37519
37520
37521
37522
37523
37524
37525
37526
37527
37528
37529
37530
37531
37532
37533
37534
37535
37536
37537
37538
37539
37540
37541
37542
37543
37544
37545
37546
37547
37548
37549
37550
37551
37552
37553
37554
37555
37556
37557
37558
37559
37560
37561
37562
37563
37564
37565
37566
37567
37568
37569
37570
37571
37572
37573
37574
37575
37576
37577
37578
37579
37580
37581
37582
37583
37584
37585
37586
37587
37588
37589
37590
37591
37592
37593
37594
37595
37596
37597
37598
37599
37600
37601
37602
37603
37604
37605
37606
37607
37608
37609
37610
37611
37612
37613
37614
37615
37616
37617
37618
37619
37620
37621
37622
37623
37624
37625
37626
37627
37628
37629
37630
37631
37632
37633
37634
37635
37636
37637
37638
37639
37640
37641
37642
37643
37644
37645
37646
37647
37648
37649
37650
37651
37652
37653
37654
37655
37656
37657
37658
37659
37660
37661
37662
37663
37664
37665
37666
37667
37668
37669
37670
37671
37672
37673
37674
37675
37676
37677
37678
37679
37680
37681
37682
37683
37684
37685
37686
37687
37688
37689
37690
37691
37692
37693
37694
37695
37696
37697
37698
37699
37700
37701
37702
37703
37704
37705
37706
37707
37708
37709
37710
37711
37712
37713
37714
37715
37716
37717
37718
37719
37720
37721
37722
37723
37724
37725
37726
37727
37728
37729
37730
37731
37732
37733
37734
37735
37736
37737
37738
37739
37740
37741
37742
37743
37744
37745
37746
37747
37748
37749
37750
37751
37752
37753
37754
37755
37756
37757
37758
37759
37760
37761
37762
37763
37764
37765
37766
37767
37768
37769
37770
37771
37772
37773
37774
37775
37776
37777
37778
37779
37780
37781
37782
37783
37784
37785
37786
37787
37788
37789
37790
37791
37792
37793
37794
37795
37796
37797
37798
37799
37800
37801
37802
37803
37804
37805
37806
37807
37808
37809
37810
37811
37812
37813
37814
37815
37816
37817
37818
37819
37820
37821
37822
37823
37824
37825
37826
37827
37828
37829
37830
37831
37832
37833
37834
37835
37836
37837
37838
37839
37840
37841
37842
37843
37844
37845
37846
37847
37848
37849
37850
37851
37852
37853
37854
37855
37856
37857
37858
37859
37860
37861
37862
37863
37864
37865
37866
37867
37868
37869
37870
37871
37872
37873
37874
37875
37876
37877
37878
37879
37880
37881
37882
37883
37884
37885
37886
37887
37888
37889
37890
37891
37892
37893
37894
37895
37896
37897
37898
37899
37900
37901
37902
37903
37904
37905
37906
37907
37908
37909
37910
37911
37912
37913
37914
37915
37916
37917
37918
37919
37920
37921
37922
37923
37924
37925
37926
37927
37928
37929
37930
37931
37932
37933
37934
37935
37936
37937
37938
37939
37940
37941
37942
37943
37944
37945
37946
37947
37948
37949
37950
37951
37952
37953
37954
37955
37956
37957
37958
37959
37960
37961
37962
37963
37964
37965
37966
37967
37968
37969
37970
37971
37972
37973
37974
37975
37976
37977
37978
37979
37980
37981
37982
37983
37984
37985
37986
37987
37988
37989
37990
37991
37992
37993
37994
37995
37996
37997
37998
37999
38000
38001
38002
38003
38004
38005
38006
38007
38008
38009
38010
38011
38012
38013
38014
38015
38016
38017
38018
38019
38020
38021
38022
38023
38024
38025
38026
38027
38028
38029
38030
38031
38032
38033
38034
38035
38036
38037
38038
38039
38040
38041
38042
38043
38044
38045
38046
38047
38048
38049
38050
38051
38052
38053
38054
38055
38056
38057
38058
38059
38060
38061
38062
38063
38064
38065
38066
38067
38068
38069
38070
38071
38072
38073
38074
38075
38076
38077
38078
38079
38080
38081
38082
38083
38084
38085
38086
38087
38088
38089
38090
38091
38092
38093
38094
38095
38096
38097
38098
38099
38100
38101
38102
38103
38104
38105
38106
38107
38108
38109
38110
38111
38112
38113
38114
38115
38116
38117
38118
38119
38120
38121
38122
38123
38124
38125
38126
38127
38128
38129
38130
38131
38132
38133
38134
38135
38136
38137
38138
38139
38140
38141
38142
38143
38144
38145
38146
38147
38148
38149
38150
38151
38152
38153
38154
38155
38156
38157
38158
38159
38160
38161
38162
38163
38164
38165
38166
38167
38168
38169
38170
38171
38172
38173
38174
38175
38176
38177
38178
38179
38180
38181
38182
38183
38184
38185
38186
38187
38188
38189
38190
38191
38192
38193
38194
38195
38196
38197
38198
38199
38200
38201
38202
38203
38204
38205
38206
38207
38208
38209
38210
38211
38212
38213
38214
38215
38216
38217
38218
38219
38220
38221
38222
38223
38224
38225
38226
38227
38228
38229
38230
38231
38232
38233
38234
38235
38236
38237
38238
38239
38240
38241
38242
38243
38244
38245
38246
38247
38248
38249
38250
38251
38252
38253
38254
38255
38256
38257
38258
38259
38260
38261
38262
38263
38264
38265
38266
38267
38268
38269
38270
38271
38272
38273
38274
38275
38276
38277
38278
38279
38280
38281
38282
38283
38284
38285
38286
38287
38288
38289
38290
38291
38292
38293
38294
38295
38296
38297
38298
38299
38300
38301
38302
38303
38304
38305
38306
38307
38308
38309
38310
38311
38312
38313
38314
38315
38316
38317
38318
38319
38320
38321
38322
38323
38324
38325
38326
38327
38328
38329
38330
38331
38332
38333
38334
38335
38336
38337
38338
38339
38340
38341
38342
38343
38344
38345
38346
38347
38348
38349
38350
38351
38352
38353
38354
38355
38356
38357
38358
38359
38360
38361
38362
38363
38364
38365
38366
38367
38368
38369
38370
38371
38372
38373
38374
38375
38376
38377
38378
38379
38380
38381
38382
38383
38384
38385
38386
38387
38388
38389
38390
38391
38392
38393
38394
38395
38396
38397
38398
38399
38400
38401
38402
38403
38404
38405
38406
38407
38408
38409
38410
38411
38412
38413
38414
38415
38416
38417
38418
38419
38420
38421
38422
38423
38424
38425
38426
38427
38428
38429
38430
38431
38432
38433
38434
38435
38436
38437
38438
38439
38440
38441
38442
38443
38444
38445
38446
38447
38448
38449
38450
38451
38452
38453
38454
38455
38456
38457
38458
38459
38460
38461
38462
38463
38464
38465
38466
38467
38468
38469
38470
38471
38472
38473
38474
38475
38476
38477
38478
38479
38480
38481
38482
38483
38484
38485
38486
38487
38488
38489
38490
38491
38492
38493
38494
38495
38496
38497
38498
38499
38500
38501
38502
38503
38504
38505
38506
38507
38508
38509
38510
38511
38512
38513
38514
38515
38516
38517
38518
38519
38520
38521
38522
38523
38524
38525
38526
38527
38528
38529
38530
38531
38532
38533
38534
38535
38536
38537
38538
38539
38540
38541
38542
38543
38544
38545
38546
38547
38548
38549
38550
38551
38552
38553
38554
38555
38556
38557
38558
38559
38560
38561
38562
38563
38564
38565
38566
38567
38568
38569
38570
38571
38572
38573
38574
38575
38576
38577
38578
38579
38580
38581
38582
38583
38584
38585
38586
38587
38588
38589
38590
38591
38592
38593
38594
38595
38596
38597
38598
38599
38600
38601
38602
38603
38604
38605
38606
38607
38608
38609
38610
38611
38612
38613
38614
38615
38616
38617
38618
38619
38620
38621
38622
38623
38624
38625
38626
38627
38628
38629
38630
38631
38632
38633
38634
38635
38636
38637
38638
38639
38640
38641
38642
38643
38644
38645
38646
38647
38648
38649
38650
38651
38652
38653
38654
38655
38656
38657
38658
38659
38660
38661
38662
38663
38664
38665
38666
38667
38668
38669
38670
38671
38672
38673
38674
38675
38676
38677
38678
38679
38680
38681
38682
38683
38684
38685
38686
38687
38688
38689
38690
38691
38692
38693
38694
38695
38696
38697
38698
38699
38700
38701
38702
38703
38704
38705
38706
38707
38708
38709
38710
38711
38712
38713
38714
38715
38716
38717
38718
38719
38720
38721
38722
38723
38724
38725
38726
38727
38728
38729
38730
38731
38732
38733
38734
38735
38736
38737
38738
38739
38740
38741
38742
38743
38744
38745
38746
38747
38748
38749
38750
38751
38752
38753
38754
38755
38756
38757
38758
38759
38760
38761
38762
38763
38764
38765
38766
38767
38768
38769
38770
38771
38772
38773
38774
38775
38776
38777
38778
38779
38780
38781
38782
38783
38784
38785
38786
38787
38788
38789
38790
38791
38792
38793
38794
38795
38796
38797
38798
38799
38800
38801
38802
38803
38804
38805
38806
38807
38808
38809
38810
38811
38812
38813
38814
38815
38816
38817
38818
38819
38820
38821
38822
38823
38824
38825
38826
38827
38828
38829
38830
38831
38832
38833
38834
38835
38836
38837
38838
38839
38840
38841
38842
38843
38844
38845
38846
38847
38848
38849
38850
38851
38852
38853
38854
38855
38856
38857
38858
38859
38860
38861
38862
38863
38864
38865
38866
38867
38868
38869
38870
38871
38872
38873
38874
38875
38876
38877
38878
38879
38880
38881
38882
38883
38884
38885
38886
38887
38888
38889
38890
38891
38892
38893
38894
38895
38896
38897
38898
38899
38900
38901
38902
38903
38904
38905
38906
38907
38908
38909
38910
38911
38912
38913
38914
38915
38916
38917
38918
38919
38920
38921
38922
38923
38924
38925
38926
38927
38928
38929
38930
38931
38932
38933
38934
38935
38936
38937
38938
38939
38940
38941
38942
38943
38944
38945
38946
38947
38948
38949
38950
38951
38952
38953
38954
38955
38956
38957
38958
38959
38960
38961
38962
38963
38964
38965
38966
38967
38968
38969
38970
38971
38972
38973
38974
38975
38976
38977
38978
38979
38980
38981
38982
38983
38984
38985
38986
38987
38988
38989
38990
38991
38992
38993
38994
38995
38996
38997
38998
38999
39000
39001
39002
39003
39004
39005
39006
39007
39008
39009
39010
39011
39012
39013
39014
39015
39016
39017
39018
39019
39020
39021
39022
39023
39024
39025
39026
39027
39028
39029
39030
39031
39032
39033
39034
39035
39036
39037
39038
39039
39040
39041
39042
39043
39044
39045
39046
39047
39048
39049
39050
39051
39052
39053
39054
39055
39056
39057
39058
39059
39060
39061
39062
39063
39064
39065
39066
39067
39068
39069
39070
39071
39072
39073
39074
39075
39076
39077
39078
39079
39080
39081
39082
39083
39084
39085
39086
39087
39088
39089
39090
39091
39092
39093
39094
39095
39096
39097
39098
39099
39100
39101
39102
39103
39104
39105
39106
39107
39108
39109
39110
39111
39112
39113
39114
39115
39116
39117
39118
39119
39120
39121
39122
39123
39124
39125
39126
39127
39128
39129
39130
39131
39132
39133
39134
39135
39136
39137
39138
39139
39140
39141
39142
39143
39144
39145
39146
39147
39148
39149
39150
39151
39152
39153
39154
39155
39156
39157
39158
39159
39160
39161
39162
39163
39164
39165
39166
39167
39168
39169
39170
39171
39172
39173
39174
39175
39176
39177
39178
39179
39180
39181
39182
39183
39184
39185
39186
39187
39188
39189
39190
39191
39192
39193
39194
39195
39196
39197
39198
39199
39200
39201
39202
39203
39204
39205
39206
39207
39208
39209
39210
39211
39212
39213
39214
39215
39216
39217
39218
39219
39220
39221
39222
39223
39224
39225
39226
39227
39228
39229
39230
39231
39232
39233
39234
39235
39236
39237
39238
39239
39240
39241
39242
39243
39244
39245
39246
39247
39248
39249
39250
39251
39252
39253
39254
39255
39256
39257
39258
39259
39260
39261
39262
39263
39264
39265
39266
39267
39268
39269
39270
39271
39272
39273
39274
39275
39276
39277
39278
39279
39280
39281
39282
39283
39284
39285
39286
39287
39288
39289
39290
39291
39292
39293
39294
39295
39296
39297
39298
39299
39300
39301
39302
39303
39304
39305
39306
39307
39308
39309
39310
39311
39312
39313
39314
39315
39316
39317
39318
39319
39320
39321
39322
39323
39324
39325
39326
39327
39328
39329
39330
39331
39332
39333
39334
39335
39336
39337
39338
39339
39340
39341
39342
39343
39344
39345
39346
39347
39348
39349
39350
39351
39352
39353
39354
39355
39356
39357
39358
39359
39360
39361
39362
39363
39364
39365
39366
39367
39368
39369
39370
39371
39372
39373
39374
39375
39376
39377
39378
39379
39380
39381
39382
39383
39384
39385
39386
39387
39388
39389
39390
39391
39392
39393
39394
39395
39396
39397
39398
39399
39400
39401
39402
39403
39404
39405
39406
39407
39408
39409
39410
39411
39412
39413
39414
39415
39416
39417
39418
39419
39420
39421
39422
39423
39424
39425
39426
39427
39428
39429
39430
39431
39432
39433
39434
39435
39436
39437
39438
39439
39440
39441
39442
39443
39444
39445
39446
39447
39448
39449
39450
39451
39452
39453
39454
39455
39456
39457
39458
39459
39460
39461
39462
39463
39464
39465
39466
39467
39468
39469
39470
39471
39472
39473
39474
39475
39476
39477
39478
39479
39480
39481
39482
39483
39484
39485
39486
39487
39488
39489
39490
39491
39492
39493
39494
39495
39496
39497
39498
39499
39500
39501
39502
39503
39504
39505
39506
39507
39508
39509
39510
39511
39512
39513
39514
39515
39516
39517
39518
39519
39520
39521
39522
39523
39524
39525
39526
39527
39528
39529
39530
39531
39532
39533
39534
39535
39536
39537
39538
39539
39540
39541
39542
39543
39544
39545
39546
39547
39548
39549
39550
39551
39552
39553
39554
39555
39556
39557
39558
39559
39560
39561
39562
39563
39564
39565
39566
39567
39568
39569
39570
39571
39572
39573
39574
39575
39576
39577
39578
39579
39580
39581
39582
39583
39584
39585
39586
39587
39588
39589
39590
39591
39592
39593
39594
39595
39596
39597
39598
39599
39600
39601
39602
39603
39604
39605
39606
39607
39608
39609
39610
39611
39612
39613
39614
39615
39616
39617
39618
39619
39620
39621
39622
39623
39624
39625
39626
39627
39628
39629
39630
39631
39632
39633
39634
39635
39636
39637
39638
39639
39640
39641
39642
39643
39644
39645
39646
39647
39648
39649
39650
39651
39652
39653
39654
39655
39656
39657
39658
39659
39660
39661
39662
39663
39664
39665
39666
39667
39668
39669
39670
39671
39672
39673
39674
39675
39676
39677
39678
39679
39680
39681
39682
39683
39684
39685
39686
39687
39688
39689
39690
39691
39692
39693
39694
39695
39696
39697
39698
39699
39700
39701
39702
39703
39704
39705
39706
39707
39708
39709
39710
39711
39712
39713
39714
39715
39716
39717
39718
39719
39720
39721
39722
39723
39724
39725
39726
39727
39728
39729
39730
39731
39732
39733
39734
39735
39736
39737
39738
39739
39740
39741
39742
39743
39744
39745
39746
39747
39748
39749
39750
39751
39752
39753
39754
39755
39756
39757
39758
39759
39760
39761
39762
39763
39764
39765
39766
39767
39768
39769
39770
39771
39772
39773
39774
39775
39776
39777
39778
39779
39780
39781
39782
39783
39784
39785
39786
39787
39788
39789
39790
39791
39792
39793
39794
39795
39796
39797
39798
39799
39800
39801
39802
39803
39804
39805
39806
39807
39808
39809
39810
39811
39812
39813
39814
39815
39816
39817
39818
39819
39820
39821
39822
39823
39824
39825
39826
39827
39828
39829
39830
39831
39832
39833
39834
39835
39836
39837
39838
39839
39840
39841
39842
39843
39844
39845
39846
39847
39848
39849
39850
39851
39852
39853
39854
39855
39856
39857
39858
39859
39860
39861
39862
39863
39864
39865
39866
39867
39868
39869
39870
39871
39872
39873
39874
39875
39876
39877
39878
39879
39880
39881
39882
39883
39884
39885
39886
39887
39888
39889
39890
39891
39892
39893
39894
39895
39896
39897
39898
39899
39900
39901
39902
39903
39904
39905
39906
39907
39908
39909
39910
39911
39912
39913
39914
39915
39916
39917
39918
39919
39920
39921
39922
39923
39924
39925
39926
39927
39928
39929
39930
39931
39932
39933
39934
39935
39936
39937
39938
39939
39940
39941
39942
39943
39944
39945
39946
39947
39948
39949
39950
39951
39952
39953
39954
39955
39956
39957
39958
39959
39960
39961
39962
39963
39964
39965
39966
39967
39968
39969
39970
39971
39972
39973
39974
39975
39976
39977
39978
39979
39980
39981
39982
39983
39984
39985
39986
39987
39988
39989
39990
39991
39992
39993
39994
39995
39996
39997
39998
39999
40000
40001
40002
40003
40004
40005
40006
40007
40008
40009
40010
40011
40012
40013
40014
40015
40016
40017
40018
40019
40020
40021
40022
40023
40024
40025
40026
40027
40028
40029
40030
40031
40032
40033
40034
40035
40036
40037
40038
40039
40040
40041
40042
40043
40044
40045
40046
40047
40048
40049
40050
40051
40052
40053
40054
40055
40056
40057
40058
40059
40060
40061
40062
40063
40064
40065
40066
40067
40068
40069
40070
40071
40072
40073
40074
40075
40076
40077
40078
40079
40080
40081
40082
40083
40084
40085
40086
40087
40088
40089
40090
40091
40092
40093
40094
40095
40096
40097
40098
40099
40100
40101
40102
40103
40104
40105
40106
40107
40108
40109
40110
40111
40112
40113
40114
40115
40116
40117
40118
40119
40120
40121
40122
40123
40124
40125
40126
40127
40128
40129
40130
40131
40132
40133
40134
40135
40136
40137
40138
40139
40140
40141
40142
40143
40144
40145
40146
40147
40148
40149
40150
40151
40152
40153
40154
40155
40156
40157
40158
40159
40160
40161
40162
40163
40164
40165
40166
40167
40168
40169
40170
40171
40172
40173
40174
40175
40176
40177
40178
40179
40180
40181
40182
40183
40184
40185
40186
40187
40188
40189
40190
40191
40192
40193
40194
40195
40196
40197
40198
40199
40200
40201
40202
40203
40204
40205
40206
40207
40208
40209
40210
40211
40212
40213
40214
40215
40216
40217
40218
40219
40220
40221
40222
40223
40224
40225
40226
40227
40228
40229
40230
40231
40232
40233
40234
40235
40236
40237
40238
40239
40240
40241
40242
40243
40244
40245
40246
40247
40248
40249
40250
40251
40252
40253
40254
40255
40256
40257
40258
40259
40260
40261
40262
40263
40264
40265
40266
40267
40268
40269
40270
40271
40272
40273
40274
40275
40276
40277
40278
40279
40280
40281
40282
40283
40284
40285
40286
40287
40288
40289
40290
40291
40292
40293
40294
40295
40296
40297
40298
40299
40300
40301
40302
40303
40304
40305
40306
40307
40308
40309
40310
40311
40312
40313
40314
40315
40316
40317
40318
40319
40320
40321
40322
40323
40324
40325
40326
40327
40328
40329
40330
40331
40332
40333
40334
40335
40336
40337
40338
40339
40340
40341
40342
40343
40344
40345
40346
40347
40348
40349
40350
40351
40352
40353
40354
40355
40356
40357
40358
40359
40360
40361
40362
40363
40364
40365
40366
40367
40368
40369
40370
40371
40372
40373
40374
40375
40376
40377
40378
40379
40380
40381
40382
40383
40384
40385
40386
40387
40388
40389
40390
40391
40392
40393
40394
40395
40396
40397
40398
40399
40400
40401
40402
40403
40404
40405
40406
40407
40408
40409
40410
40411
40412
40413
40414
40415
40416
40417
40418
40419
40420
40421
40422
40423
40424
40425
40426
40427
40428
40429
40430
40431
40432
40433
40434
40435
40436
40437
40438
40439
40440
40441
40442
40443
40444
40445
40446
40447
40448
40449
40450
40451
40452
40453
40454
40455
40456
40457
40458
40459
40460
40461
40462
40463
40464
40465
40466
40467
40468
40469
40470
40471
40472
40473
40474
40475
40476
40477
40478
40479
40480
40481
40482
40483
40484
40485
40486
40487
40488
40489
40490
40491
40492
40493
40494
40495
40496
40497
40498
40499
40500
40501
40502
40503
40504
40505
40506
40507
40508
40509
40510
40511
40512
40513
40514
40515
40516
40517
40518
40519
40520
40521
40522
40523
40524
40525
40526
40527
40528
40529
40530
40531
40532
40533
40534
40535
40536
40537
40538
40539
40540
40541
40542
40543
40544
40545
40546
40547
40548
40549
40550
40551
40552
40553
40554
40555
40556
40557
40558
40559
40560
40561
40562
40563
40564
40565
40566
40567
40568
40569
40570
40571
40572
40573
40574
40575
40576
40577
40578
40579
40580
40581
40582
40583
40584
40585
40586
40587
40588
40589
40590
40591
40592
40593
40594
40595
40596
40597
40598
40599
40600
40601
40602
40603
40604
40605
40606
40607
40608
40609
40610
40611
40612
40613
40614
40615
40616
40617
40618
40619
40620
40621
40622
40623
40624
40625
40626
40627
40628
40629
40630
40631
40632
40633
40634
40635
40636
40637
40638
40639
40640
40641
40642
40643
40644
40645
40646
40647
40648
40649
40650
40651
40652
40653
40654
40655
40656
40657
40658
40659
40660
40661
40662
40663
40664
40665
40666
40667
40668
40669
40670
40671
40672
40673
40674
40675
40676
40677
40678
40679
40680
40681
40682
40683
40684
40685
40686
40687
40688
40689
40690
40691
40692
40693
40694
40695
40696
40697
40698
40699
40700
40701
40702
40703
40704
40705
40706
40707
40708
40709
40710
40711
40712
40713
40714
40715
40716
40717
40718
40719
40720
40721
40722
40723
40724
40725
40726
40727
40728
40729
40730
40731
40732
40733
40734
40735
40736
40737
40738
40739
40740
40741
40742
40743
40744
40745
40746
40747
40748
40749
40750
40751
40752
40753
40754
40755
40756
40757
40758
40759
40760
40761
40762
40763
40764
40765
40766
40767
40768
40769
40770
40771
40772
40773
40774
40775
40776
40777
40778
40779
40780
40781
40782
40783
40784
40785
40786
40787
40788
40789
40790
40791
40792
40793
40794
40795
40796
40797
40798
40799
40800
40801
40802
40803
40804
40805
40806
40807
40808
40809
40810
40811
40812
40813
40814
40815
40816
40817
40818
40819
40820
40821
40822
40823
40824
40825
40826
40827
40828
40829
40830
40831
40832
40833
40834
40835
40836
40837
40838
40839
40840
40841
40842
40843
40844
40845
40846
40847
40848
40849
40850
40851
40852
40853
40854
40855
40856
40857
40858
40859
40860
40861
40862
40863
40864
40865
40866
40867
40868
40869
40870
40871
40872
40873
40874
40875
40876
40877
40878
40879
40880
40881
40882
40883
40884
40885
40886
40887
40888
40889
40890
40891
40892
40893
40894
40895
40896
40897
40898
40899
40900
40901
40902
40903
40904
40905
40906
40907
40908
40909
40910
40911
40912
40913
40914
40915
40916
40917
40918
40919
40920
40921
40922
40923
40924
40925
40926
40927
40928
40929
40930
40931
40932
40933
40934
40935
40936
40937
40938
40939
40940
40941
40942
40943
40944
40945
40946
40947
40948
40949
40950
40951
40952
40953
40954
40955
40956
40957
40958
40959
40960
40961
40962
40963
40964
40965
40966
40967
40968
40969
40970
40971
40972
40973
40974
40975
40976
40977
40978
40979
40980
40981
40982
40983
40984
40985
40986
40987
40988
40989
40990
40991
40992
40993
40994
40995
40996
40997
40998
40999
41000
41001
41002
41003
41004
41005
41006
41007
41008
41009
41010
41011
41012
41013
41014
41015
41016
41017
41018
41019
41020
41021
41022
41023
41024
41025
41026
41027
41028
41029
41030
41031
41032
41033
41034
41035
41036
41037
41038
41039
41040
41041
41042
41043
41044
41045
41046
41047
41048
41049
41050
41051
41052
41053
41054
41055
41056
41057
41058
41059
41060
41061
41062
41063
41064
41065
41066
41067
41068
41069
41070
41071
41072
41073
41074
41075
41076
41077
41078
41079
41080
41081
41082
41083
41084
41085
41086
41087
41088
41089
41090
41091
41092
41093
41094
41095
41096
41097
41098
41099
41100
41101
41102
41103
41104
41105
41106
41107
41108
41109
41110
41111
41112
41113
41114
41115
41116
41117
41118
41119
41120
41121
41122
41123
41124
41125
41126
41127
41128
41129
41130
41131
41132
41133
41134
41135
41136
41137
41138
41139
41140
41141
41142
41143
41144
41145
41146
41147
41148
41149
41150
41151
41152
41153
41154
41155
41156
41157
41158
41159
41160
41161
41162
41163
41164
41165
41166
41167
41168
41169
41170
41171
41172
41173
41174
41175
41176
41177
41178
41179
41180
41181
41182
41183
41184
41185
41186
41187
41188
41189
41190
41191
41192
41193
41194
41195
41196
41197
41198
41199
41200
41201
41202
41203
41204
41205
41206
41207
41208
41209
41210
41211
41212
41213
41214
41215
41216
41217
41218
41219
41220
41221
41222
41223
41224
41225
41226
41227
41228
41229
41230
41231
41232
41233
41234
41235
41236
41237
41238
41239
41240
41241
41242
41243
41244
41245
41246
41247
41248
41249
41250
41251
41252
41253
41254
41255
41256
41257
41258
41259
41260
41261
41262
41263
41264
41265
41266
41267
41268
41269
41270
41271
41272
41273
41274
41275
41276
41277
41278
41279
41280
41281
41282
41283
41284
41285
41286
41287
41288
41289
41290
41291
41292
41293
41294
41295
41296
41297
41298
41299
41300
41301
41302
41303
41304
41305
41306
41307
41308
41309
41310
41311
41312
41313
41314
41315
41316
41317
41318
41319
41320
41321
41322
41323
41324
41325
41326
41327
41328
41329
41330
41331
41332
41333
41334
41335
41336
41337
41338
41339
41340
41341
41342
41343
41344
41345
41346
41347
41348
41349
41350
41351
41352
41353
41354
41355
41356
41357
41358
41359
41360
41361
41362
41363
41364
41365
41366
41367
41368
41369
41370
41371
41372
41373
41374
41375
41376
41377
41378
41379
41380
41381
41382
41383
41384
41385
41386
41387
41388
41389
41390
41391
41392
41393
41394
41395
41396
41397
41398
41399
41400
41401
41402
41403
41404
41405
41406
41407
41408
41409
41410
41411
41412
41413
41414
41415
41416
41417
41418
41419
41420
41421
41422
41423
41424
41425
41426
41427
41428
41429
41430
41431
41432
41433
41434
41435
41436
41437
41438
41439
41440
41441
41442
41443
41444
41445
41446
41447
41448
41449
41450
41451
41452
41453
41454
41455
41456
41457
41458
41459
41460
41461
41462
41463
41464
41465
41466
41467
41468
41469
41470
41471
41472
41473
41474
41475
41476
41477
41478
41479
41480
41481
41482
41483
41484
41485
41486
41487
41488
41489
41490
41491
41492
41493
41494
41495
41496
41497
41498
41499
41500
41501
41502
41503
41504
41505
41506
41507
41508
41509
41510
41511
41512
41513
41514
41515
41516
41517
41518
41519
41520
41521
41522
41523
41524
41525
41526
41527
41528
41529
41530
41531
41532
41533
41534
41535
41536
41537
41538
41539
41540
41541
41542
41543
41544
41545
41546
41547
41548
41549
41550
41551
41552
41553
41554
41555
41556
41557
41558
41559
41560
41561
41562
41563
41564
41565
41566
41567
41568
41569
41570
41571
41572
41573
41574
41575
41576
41577
41578
41579
41580
41581
41582
41583
41584
41585
41586
41587
41588
41589
41590
41591
41592
41593
41594
41595
41596
41597
41598
41599
41600
41601
41602
41603
41604
41605
41606
41607
41608
41609
41610
41611
41612
41613
41614
41615
41616
41617
41618
41619
41620
41621
41622
41623
41624
41625
41626
41627
41628
41629
41630
41631
41632
41633
41634
41635
41636
41637
41638
41639
41640
41641
41642
41643
41644
41645
41646
41647
41648
41649
41650
41651
41652
41653
41654
41655
41656
41657
41658
41659
41660
41661
41662
41663
41664
41665
41666
41667
41668
41669
41670
41671
41672
41673
41674
41675
41676
41677
41678
41679
41680
41681
41682
41683
41684
41685
41686
41687
41688
41689
41690
41691
41692
41693
41694
41695
41696
41697
41698
41699
41700
41701
41702
41703
41704
41705
41706
41707
41708
41709
41710
41711
41712
41713
41714
41715
41716
41717
41718
41719
41720
41721
41722
41723
41724
41725
41726
41727
41728
41729
41730
41731
41732
41733
41734
41735
41736
41737
41738
41739
41740
41741
41742
41743
41744
41745
41746
41747
41748
41749
41750
41751
41752
41753
41754
41755
41756
41757
41758
41759
41760
41761
41762
41763
41764
41765
41766
41767
41768
41769
41770
41771
41772
41773
41774
41775
41776
41777
41778
41779
41780
41781
41782
41783
41784
41785
41786
41787
41788
41789
41790
41791
41792
41793
41794
41795
41796
41797
41798
41799
41800
41801
41802
41803
41804
41805
41806
41807
41808
41809
41810
41811
41812
41813
41814
41815
41816
41817
41818
41819
41820
41821
41822
41823
41824
41825
41826
41827
41828
41829
41830
41831
41832
41833
41834
41835
41836
41837
41838
41839
41840
41841
41842
41843
41844
41845
41846
41847
41848
41849
41850
41851
41852
41853
41854
41855
41856
41857
41858
41859
41860
41861
41862
41863
41864
41865
41866
41867
41868
41869
41870
41871
41872
41873
41874
41875
41876
41877
41878
41879
41880
41881
41882
41883
41884
41885
41886
41887
41888
41889
41890
41891
41892
41893
41894
41895
41896
41897
41898
41899
41900
41901
41902
41903
41904
41905
41906
41907
41908
41909
41910
41911
41912
41913
41914
41915
41916
41917
41918
41919
41920
41921
41922
41923
41924
41925
41926
41927
41928
41929
41930
41931
41932
41933
41934
41935
41936
41937
41938
41939
41940
41941
41942
41943
41944
41945
41946
41947
41948
41949
41950
41951
41952
41953
41954
41955
41956
41957
41958
41959
41960
41961
41962
41963
41964
41965
41966
41967
41968
41969
41970
41971
41972
41973
41974
41975
41976
41977
41978
41979
41980
41981
41982
41983
41984
41985
41986
41987
41988
41989
41990
41991
41992
41993
41994
41995
41996
41997
41998
41999
42000
42001
42002
42003
42004
42005
42006
42007
42008
42009
42010
42011
42012
42013
42014
42015
42016
42017
42018
42019
42020
42021
42022
42023
42024
42025
42026
42027
42028
42029
42030
42031
42032
42033
42034
42035
42036
42037
42038
42039
42040
42041
42042
42043
42044
42045
42046
42047
42048
42049
42050
42051
42052
42053
42054
42055
42056
42057
42058
42059
42060
42061
42062
42063
42064
42065
42066
42067
42068
42069
42070
42071
42072
42073
42074
42075
42076
42077
42078
42079
42080
42081
42082
42083
42084
42085
42086
42087
42088
42089
42090
42091
42092
42093
42094
42095
42096
42097
42098
42099
42100
42101
42102
42103
42104
42105
42106
42107
42108
42109
42110
42111
42112
42113
42114
42115
42116
42117
42118
42119
42120
42121
42122
42123
42124
42125
42126
42127
42128
42129
42130
42131
42132
42133
42134
42135
42136
42137
42138
42139
42140
42141
42142
42143
42144
42145
42146
42147
42148
42149
42150
42151
42152
42153
42154
42155
42156
42157
42158
42159
42160
42161
42162
42163
42164
42165
42166
42167
42168
42169
42170
42171
42172
42173
42174
42175
42176
42177
42178
42179
42180
42181
42182
42183
42184
42185
42186
42187
42188
42189
42190
42191
42192
42193
42194
42195
42196
42197
42198
42199
42200
42201
42202
42203
42204
42205
42206
42207
42208
42209
42210
42211
42212
42213
42214
42215
42216
42217
42218
42219
42220
42221
42222
42223
42224
42225
42226
42227
42228
42229
42230
42231
42232
42233
42234
42235
42236
42237
42238
42239
42240
42241
42242
42243
42244
42245
42246
42247
42248
42249
42250
42251
42252
42253
42254
42255
42256
42257
42258
42259
42260
42261
42262
42263
42264
42265
42266
42267
42268
42269
42270
42271
42272
42273
42274
42275
42276
42277
42278
42279
42280
42281
42282
42283
42284
42285
42286
42287
42288
42289
42290
42291
42292
42293
42294
42295
42296
42297
42298
42299
42300
42301
42302
42303
42304
42305
42306
42307
42308
42309
42310
42311
42312
42313
42314
42315
42316
42317
42318
42319
42320
42321
42322
42323
42324
42325
42326
42327
42328
42329
42330
42331
42332
42333
42334
42335
42336
42337
42338
42339
42340
42341
42342
42343
42344
42345
42346
42347
42348
42349
42350
42351
42352
42353
42354
42355
42356
42357
42358
42359
42360
42361
42362
42363
42364
42365
42366
42367
42368
42369
42370
42371
42372
42373
42374
42375
42376
42377
42378
42379
42380
42381
42382
42383
42384
42385
42386
42387
42388
42389
42390
42391
42392
42393
42394
42395
42396
42397
42398
42399
42400
42401
42402
42403
42404
42405
42406
42407
42408
42409
42410
42411
42412
42413
42414
42415
42416
42417
42418
42419
42420
42421
42422
42423
42424
42425
42426
42427
42428
42429
42430
42431
42432
42433
42434
42435
42436
42437
42438
42439
42440
42441
42442
42443
42444
42445
42446
42447
42448
42449
42450
42451
42452
42453
42454
42455
42456
42457
42458
42459
42460
42461
42462
42463
42464
42465
42466
42467
42468
42469
42470
42471
42472
42473
42474
42475
42476
42477
42478
42479
42480
42481
42482
42483
42484
42485
42486
42487
42488
42489
42490
42491
42492
42493
42494
42495
42496
42497
42498
42499
42500
42501
42502
42503
42504
42505
42506
42507
42508
42509
42510
42511
42512
42513
42514
42515
42516
42517
42518
42519
42520
42521
42522
42523
42524
42525
42526
42527
42528
42529
42530
42531
42532
42533
42534
42535
42536
42537
42538
42539
42540
42541
42542
42543
42544
42545
42546
42547
42548
42549
42550
42551
42552
42553
42554
42555
42556
42557
42558
42559
42560
42561
42562
42563
42564
42565
42566
42567
42568
42569
42570
42571
42572
42573
42574
42575
42576
42577
42578
42579
42580
42581
42582
42583
42584
42585
42586
42587
42588
42589
42590
42591
42592
42593
42594
42595
42596
42597
42598
42599
42600
42601
42602
42603
42604
42605
42606
42607
42608
42609
42610
42611
42612
42613
42614
42615
42616
42617
42618
42619
42620
42621
42622
42623
42624
42625
42626
42627
42628
42629
42630
42631
42632
42633
42634
42635
42636
42637
42638
42639
42640
42641
42642
42643
42644
42645
42646
42647
42648
42649
42650
42651
42652
42653
42654
42655
42656
42657
42658
42659
42660
42661
42662
42663
42664
42665
42666
42667
42668
42669
42670
42671
42672
42673
42674
42675
42676
42677
42678
42679
42680
42681
42682
42683
42684
42685
42686
42687
42688
42689
42690
42691
42692
42693
42694
42695
42696
42697
42698
42699
42700
42701
42702
42703
42704
42705
42706
42707
42708
42709
42710
42711
42712
42713
42714
42715
42716
42717
42718
42719
42720
42721
42722
42723
42724
42725
42726
42727
42728
42729
42730
42731
42732
42733
42734
42735
42736
42737
42738
42739
42740
42741
42742
42743
42744
42745
42746
42747
42748
42749
42750
42751
42752
42753
42754
42755
42756
42757
42758
42759
42760
42761
42762
42763
42764
42765
42766
42767
42768
42769
42770
42771
42772
42773
42774
42775
42776
42777
42778
42779
42780
42781
42782
42783
42784
42785
42786
42787
42788
42789
42790
42791
42792
42793
42794
42795
42796
42797
42798
42799
42800
42801
42802
42803
42804
42805
42806
42807
42808
42809
42810
42811
42812
42813
42814
42815
42816
42817
42818
42819
42820
42821
42822
42823
42824
42825
42826
42827
42828
42829
42830
42831
42832
42833
42834
42835
42836
42837
42838
42839
42840
42841
42842
42843
42844
42845
42846
42847
42848
42849
42850
42851
42852
42853
42854
42855
42856
42857
42858
42859
42860
42861
42862
42863
42864
42865
42866
42867
42868
42869
42870
42871
42872
42873
42874
42875
42876
42877
42878
42879
42880
42881
42882
42883
42884
42885
42886
42887
42888
42889
42890
42891
42892
42893
42894
42895
42896
42897
42898
42899
42900
42901
42902
42903
42904
42905
42906
42907
42908
42909
42910
42911
42912
42913
42914
42915
42916
42917
42918
42919
42920
42921
42922
42923
42924
42925
42926
42927
42928
42929
42930
42931
42932
42933
42934
42935
42936
42937
42938
42939
42940
42941
42942
42943
42944
42945
42946
42947
42948
42949
42950
42951
42952
42953
42954
42955
42956
42957
42958
42959
42960
42961
42962
42963
42964
42965
42966
42967
42968
42969
42970
42971
42972
42973
42974
42975
42976
42977
42978
42979
42980
42981
42982
42983
42984
42985
42986
42987
42988
42989
42990
42991
42992
42993
42994
42995
42996
42997
42998
42999
43000
43001
43002
43003
43004
43005
43006
43007
43008
43009
43010
43011
43012
43013
43014
43015
43016
43017
43018
43019
43020
43021
43022
43023
43024
43025
43026
43027
43028
43029
43030
43031
43032
43033
43034
43035
43036
43037
43038
43039
43040
43041
43042
43043
43044
43045
43046
43047
43048
43049
43050
43051
43052
43053
43054
43055
43056
43057
43058
43059
43060
43061
43062
43063
43064
43065
43066
43067
43068
43069
43070
43071
43072
43073
43074
43075
43076
43077
43078
43079
43080
43081
43082
43083
43084
43085
43086
43087
43088
43089
43090
43091
43092
43093
43094
43095
43096
43097
43098
43099
43100
43101
43102
43103
43104
43105
43106
43107
43108
43109
43110
43111
43112
43113
43114
43115
43116
43117
43118
43119
43120
43121
43122
43123
43124
43125
43126
43127
43128
43129
43130
43131
43132
43133
43134
43135
43136
43137
43138
43139
43140
43141
43142
43143
43144
43145
43146
43147
43148
43149
43150
43151
43152
43153
43154
43155
43156
43157
43158
43159
43160
43161
43162
43163
43164
43165
43166
43167
43168
43169
43170
43171
43172
43173
43174
43175
43176
43177
43178
43179
43180
43181
43182
43183
43184
43185
43186
43187
43188
43189
43190
43191
43192
43193
43194
43195
43196
43197
43198
43199
43200
43201
43202
43203
43204
43205
43206
43207
43208
43209
43210
43211
43212
43213
43214
43215
43216
43217
43218
43219
43220
43221
43222
43223
43224
43225
43226
43227
43228
43229
43230
43231
43232
43233
43234
43235
43236
43237
43238
43239
43240
43241
43242
43243
43244
43245
43246
43247
43248
43249
43250
43251
43252
43253
43254
43255
43256
43257
43258
43259
43260
43261
43262
43263
43264
43265
43266
43267
43268
43269
43270
43271
43272
43273
43274
43275
43276
43277
43278
43279
43280
43281
43282
43283
43284
43285
43286
43287
43288
43289
43290
43291
43292
43293
43294
43295
43296
43297
43298
43299
43300
43301
43302
43303
43304
43305
43306
43307
43308
43309
43310
43311
43312
43313
43314
43315
43316
43317
43318
43319
43320
43321
43322
43323
43324
43325
43326
43327
43328
43329
43330
43331
43332
43333
43334
43335
43336
43337
43338
43339
43340
43341
43342
43343
43344
43345
43346
43347
43348
43349
43350
43351
43352
43353
43354
43355
43356
43357
43358
43359
43360
43361
43362
43363
43364
43365
43366
43367
43368
43369
43370
43371
43372
43373
43374
43375
43376
43377
43378
43379
43380
43381
43382
43383
43384
43385
43386
43387
43388
43389
43390
43391
43392
43393
43394
43395
43396
43397
43398
43399
43400
43401
43402
43403
43404
43405
43406
43407
43408
43409
43410
43411
43412
43413
43414
43415
43416
43417
43418
43419
43420
43421
43422
43423
43424
43425
43426
43427
43428
43429
43430
43431
43432
43433
43434
43435
43436
43437
43438
43439
43440
43441
43442
43443
43444
43445
43446
43447
43448
43449
43450
43451
43452
43453
43454
43455
43456
43457
43458
43459
43460
43461
43462
43463
43464
43465
43466
43467
43468
43469
43470
43471
43472
43473
43474
43475
43476
43477
43478
43479
43480
43481
43482
43483
43484
43485
43486
43487
43488
43489
43490
43491
43492
43493
43494
43495
43496
43497
43498
43499
43500
43501
43502
43503
43504
43505
43506
43507
43508
43509
43510
43511
43512
43513
43514
43515
43516
43517
43518
43519
43520
43521
43522
43523
43524
43525
43526
43527
43528
43529
43530
43531
43532
43533
43534
43535
43536
43537
43538
43539
43540
43541
43542
43543
43544
43545
43546
43547
43548
43549
43550
43551
43552
43553
43554
43555
43556
43557
43558
43559
43560
43561
43562
43563
43564
43565
43566
43567
43568
43569
43570
43571
43572
43573
43574
43575
43576
43577
43578
43579
43580
43581
43582
43583
43584
43585
43586
43587
43588
43589
43590
43591
43592
43593
43594
43595
43596
43597
43598
43599
43600
43601
43602
43603
43604
43605
43606
43607
43608
43609
43610
43611
43612
43613
43614
43615
43616
43617
43618
43619
43620
43621
43622
43623
43624
43625
43626
43627
43628
43629
43630
43631
43632
43633
43634
43635
43636
43637
43638
43639
43640
43641
43642
43643
43644
43645
43646
43647
43648
43649
43650
43651
43652
43653
43654
43655
43656
43657
43658
43659
43660
43661
43662
43663
43664
43665
43666
43667
43668
43669
43670
43671
43672
43673
43674
43675
43676
43677
43678
43679
43680
43681
43682
43683
43684
43685
43686
43687
43688
43689
43690
43691
43692
43693
43694
43695
43696
43697
43698
43699
43700
43701
43702
43703
43704
43705
43706
43707
43708
43709
43710
43711
43712
43713
43714
43715
43716
43717
43718
43719
43720
43721
43722
43723
43724
43725
43726
43727
43728
43729
43730
43731
43732
43733
43734
43735
43736
43737
43738
43739
43740
43741
43742
43743
43744
43745
43746
43747
43748
43749
43750
43751
43752
43753
43754
43755
43756
43757
43758
43759
43760
43761
43762
43763
43764
43765
43766
43767
43768
43769
43770
43771
43772
43773
43774
43775
43776
43777
43778
43779
43780
43781
43782
43783
43784
43785
43786
43787
43788
43789
43790
43791
43792
43793
43794
43795
43796
43797
43798
43799
43800
43801
43802
43803
43804
43805
43806
43807
43808
43809
43810
43811
43812
43813
43814
43815
43816
43817
43818
43819
43820
43821
43822
43823
43824
43825
43826
43827
43828
43829
43830
43831
43832
43833
43834
43835
43836
43837
43838
43839
43840
43841
43842
43843
43844
43845
43846
43847
43848
43849
43850
43851
43852
43853
43854
43855
43856
43857
43858
43859
43860
43861
43862
43863
43864
43865
43866
43867
43868
43869
43870
43871
43872
43873
43874
43875
43876
43877
43878
43879
43880
43881
43882
43883
43884
43885
43886
43887
43888
43889
43890
43891
43892
43893
43894
43895
43896
43897
43898
43899
43900
43901
43902
43903
43904
43905
43906
43907
43908
43909
43910
43911
43912
43913
43914
43915
43916
43917
43918
43919
43920
43921
43922
43923
43924
43925
43926
43927
43928
43929
43930
43931
43932
43933
43934
43935
43936
43937
43938
43939
43940
43941
43942
43943
43944
43945
43946
43947
43948
43949
43950
43951
43952
43953
43954
43955
43956
43957
43958
43959
43960
43961
43962
43963
43964
43965
43966
43967
43968
43969
43970
43971
43972
43973
43974
43975
43976
43977
43978
43979
43980
43981
43982
43983
43984
43985
43986
43987
43988
43989
43990
43991
43992
43993
43994
43995
43996
43997
43998
43999
44000
44001
44002
44003
44004
44005
44006
44007
44008
44009
44010
44011
44012
44013
44014
44015
44016
44017
44018
44019
44020
44021
44022
44023
44024
44025
44026
44027
44028
44029
44030
44031
44032
44033
44034
44035
44036
44037
44038
44039
44040
44041
44042
44043
44044
44045
44046
44047
44048
44049
44050
44051
44052
44053
44054
44055
44056
44057
44058
44059
44060
44061
44062
44063
44064
44065
44066
44067
44068
44069
44070
44071
44072
44073
44074
44075
44076
44077
44078
44079
44080
44081
44082
44083
44084
44085
44086
44087
44088
44089
44090
44091
44092
44093
44094
44095
44096
44097
44098
44099
44100
44101
44102
44103
44104
44105
44106
44107
44108
44109
44110
44111
44112
44113
44114
44115
44116
44117
44118
44119
44120
44121
44122
44123
44124
44125
44126
44127
44128
44129
44130
44131
44132
44133
44134
44135
44136
44137
44138
44139
44140
44141
44142
44143
44144
44145
44146
44147
44148
44149
44150
44151
44152
44153
44154
44155
44156
44157
44158
44159
44160
44161
44162
44163
44164
44165
44166
44167
44168
44169
44170
44171
44172
44173
44174
44175
44176
44177
44178
44179
44180
44181
44182
44183
44184
44185
44186
44187
44188
44189
44190
44191
44192
44193
44194
44195
44196
44197
44198
44199
44200
44201
44202
44203
44204
44205
44206
44207
44208
44209
44210
44211
44212
44213
44214
44215
44216
44217
44218
44219
44220
44221
44222
44223
44224
44225
44226
44227
44228
44229
44230
44231
44232
44233
44234
44235
44236
44237
44238
44239
44240
44241
44242
44243
44244
44245
44246
44247
44248
44249
44250
44251
44252
44253
44254
44255
44256
44257
44258
44259
44260
44261
44262
44263
44264
44265
44266
44267
44268
44269
44270
44271
44272
44273
44274
44275
44276
44277
44278
44279
44280
44281
44282
44283
44284
44285
44286
44287
44288
44289
44290
44291
44292
44293
44294
44295
44296
44297
44298
44299
44300
44301
44302
44303
44304
44305
44306
44307
44308
44309
44310
44311
44312
44313
44314
44315
44316
44317
44318
44319
44320
44321
44322
44323
44324
44325
44326
44327
44328
44329
44330
44331
44332
44333
44334
44335
44336
44337
44338
44339
44340
44341
44342
44343
44344
44345
44346
44347
44348
44349
44350
44351
44352
44353
44354
44355
44356
44357
44358
44359
44360
44361
44362
44363
44364
44365
44366
44367
44368
44369
44370
44371
44372
44373
44374
44375
44376
44377
44378
44379
44380
44381
44382
44383
44384
44385
44386
44387
44388
44389
44390
44391
44392
44393
44394
44395
44396
44397
44398
44399
44400
44401
44402
44403
44404
44405
44406
44407
44408
44409
44410
44411
44412
44413
44414
44415
44416
44417
44418
44419
44420
44421
44422
44423
44424
44425
44426
44427
44428
44429
44430
44431
44432
44433
44434
44435
44436
44437
44438
44439
44440
44441
44442
44443
44444
44445
44446
44447
44448
44449
44450
44451
44452
44453
44454
44455
44456
44457
44458
44459
44460
44461
44462
44463
44464
44465
44466
44467
44468
44469
44470
44471
44472
44473
44474
44475
44476
44477
44478
44479
44480
44481
44482
44483
44484
44485
44486
44487
44488
44489
44490
44491
44492
44493
44494
44495
44496
44497
44498
44499
44500
44501
44502
44503
44504
44505
44506
44507
44508
44509
44510
44511
44512
44513
44514
44515
44516
44517
44518
44519
44520
44521
44522
44523
44524
44525
44526
44527
44528
44529
44530
44531
44532
44533
44534
44535
44536
44537
44538
44539
44540
44541
44542
44543
44544
44545
44546
44547
44548
44549
44550
44551
44552
44553
44554
44555
44556
44557
44558
44559
44560
44561
44562
44563
44564
44565
44566
44567
44568
44569
44570
44571
44572
44573
44574
44575
44576
44577
44578
44579
44580
44581
44582
44583
44584
44585
44586
44587
44588
44589
44590
44591
44592
44593
44594
44595
44596
44597
44598
44599
44600
44601
44602
44603
44604
44605
44606
44607
44608
44609
44610
44611
44612
44613
44614
44615
44616
44617
44618
44619
44620
44621
44622
44623
44624
44625
44626
44627
44628
44629
44630
44631
44632
44633
44634
44635
44636
44637
44638
44639
44640
44641
44642
44643
44644
44645
44646
44647
44648
44649
44650
44651
44652
44653
44654
44655
44656
44657
44658
44659
44660
44661
44662
44663
44664
44665
44666
44667
44668
44669
44670
44671
44672
44673
44674
44675
44676
44677
44678
44679
44680
44681
44682
44683
44684
44685
44686
44687
44688
44689
44690
44691
44692
44693
44694
44695
44696
44697
44698
44699
44700
44701
44702
44703
44704
44705
44706
44707
44708
44709
44710
44711
44712
44713
44714
44715
44716
44717
44718
44719
44720
44721
44722
44723
44724
44725
44726
44727
44728
44729
44730
44731
44732
44733
44734
44735
44736
44737
44738
44739
44740
44741
44742
44743
44744
44745
44746
44747
44748
44749
44750
44751
44752
44753
44754
44755
44756
44757
44758
44759
44760
44761
44762
44763
44764
44765
44766
44767
44768
44769
44770
44771
44772
44773
44774
44775
44776
44777
44778
44779
44780
44781
44782
44783
44784
44785
44786
44787
44788
44789
44790
44791
44792
44793
44794
44795
44796
44797
44798
44799
44800
44801
44802
44803
44804
44805
44806
44807
44808
44809
44810
44811
44812
44813
44814
44815
44816
44817
44818
44819
44820
44821
44822
44823
44824
44825
44826
44827
44828
44829
44830
44831
44832
44833
44834
44835
44836
44837
44838
44839
44840
44841
44842
44843
44844
44845
44846
44847
44848
44849
44850
44851
44852
44853
44854
44855
44856
44857
44858
44859
44860
44861
44862
44863
44864
44865
44866
44867
44868
44869
44870
44871
44872
44873
44874
44875
44876
44877
44878
44879
44880
44881
44882
44883
44884
44885
44886
44887
44888
44889
44890
44891
44892
44893
44894
44895
44896
44897
44898
44899
44900
44901
44902
44903
44904
44905
44906
44907
44908
44909
44910
44911
44912
44913
44914
44915
44916
44917
44918
44919
44920
44921
44922
44923
44924
44925
44926
44927
44928
44929
44930
44931
44932
44933
44934
44935
44936
44937
44938
44939
44940
44941
44942
44943
44944
44945
44946
44947
44948
44949
44950
44951
44952
44953
44954
44955
44956
44957
44958
44959
44960
44961
44962
44963
44964
44965
44966
44967
44968
44969
44970
44971
44972
44973
44974
44975
44976
44977
44978
44979
44980
44981
44982
44983
44984
44985
44986
44987
44988
44989
44990
44991
44992
44993
44994
44995
44996
44997
44998
44999
45000
45001
45002
45003
45004
45005
45006
45007
45008
45009
45010
45011
45012
45013
45014
45015
45016
45017
45018
45019
45020
45021
45022
45023
45024
45025
45026
45027
45028
45029
45030
45031
45032
45033
45034
45035
45036
45037
45038
45039
45040
45041
45042
45043
45044
45045
45046
45047
45048
45049
45050
45051
45052
45053
45054
45055
45056
45057
45058
45059
45060
45061
45062
45063
45064
45065
45066
45067
45068
45069
45070
45071
45072
45073
45074
45075
45076
45077
45078
45079
45080
45081
45082
45083
45084
45085
45086
45087
45088
45089
45090
45091
45092
45093
45094
45095
45096
45097
45098
45099
45100
45101
45102
45103
45104
45105
45106
45107
45108
45109
45110
45111
45112
45113
45114
45115
45116
45117
45118
45119
45120
45121
45122
45123
45124
45125
45126
45127
45128
45129
45130
45131
45132
45133
45134
45135
45136
45137
45138
45139
45140
45141
45142
45143
45144
45145
45146
45147
45148
45149
45150
45151
45152
45153
45154
45155
45156
45157
45158
45159
45160
45161
45162
45163
45164
45165
45166
45167
45168
45169
45170
45171
45172
45173
45174
45175
45176
45177
45178
45179
45180
45181
45182
45183
45184
45185
45186
45187
45188
45189
45190
45191
45192
45193
45194
45195
45196
45197
45198
45199
45200
45201
45202
45203
45204
45205
45206
45207
45208
45209
45210
45211
45212
45213
45214
45215
45216
45217
45218
45219
45220
45221
45222
45223
45224
45225
45226
45227
45228
45229
45230
45231
45232
45233
45234
45235
45236
45237
45238
45239
45240
45241
45242
45243
45244
45245
45246
45247
45248
45249
45250
45251
45252
45253
45254
45255
45256
45257
45258
45259
45260
45261
45262
45263
45264
45265
45266
45267
45268
45269
45270
45271
45272
45273
45274
45275
45276
45277
45278
45279
45280
45281
45282
45283
45284
45285
45286
45287
45288
45289
45290
45291
45292
45293
45294
45295
45296
45297
45298
45299
45300
45301
45302
45303
45304
45305
45306
45307
45308
45309
45310
45311
45312
45313
45314
45315
45316
45317
45318
45319
45320
45321
45322
45323
45324
45325
45326
45327
45328
45329
45330
45331
45332
45333
45334
45335
45336
45337
45338
45339
45340
45341
45342
45343
45344
45345
45346
45347
45348
45349
45350
45351
45352
45353
45354
45355
45356
45357
45358
45359
45360
45361
45362
45363
45364
45365
45366
45367
45368
45369
45370
45371
45372
45373
45374
45375
45376
45377
45378
45379
45380
45381
45382
45383
45384
45385
45386
45387
45388
45389
45390
45391
45392
45393
45394
45395
45396
45397
45398
45399
45400
45401
45402
45403
45404
45405
45406
45407
45408
45409
45410
45411
45412
45413
45414
45415
45416
45417
45418
45419
45420
45421
45422
45423
45424
45425
45426
45427
45428
45429
45430
45431
45432
45433
45434
45435
45436
45437
45438
45439
45440
45441
45442
45443
45444
45445
45446
45447
45448
45449
45450
45451
45452
45453
45454
45455
45456
45457
45458
45459
45460
45461
45462
45463
45464
45465
45466
45467
45468
45469
45470
45471
45472
45473
45474
45475
45476
45477
45478
45479
45480
45481
45482
45483
45484
45485
45486
45487
45488
45489
45490
45491
45492
45493
45494
45495
45496
45497
45498
45499
45500
45501
45502
45503
45504
45505
45506
45507
45508
45509
45510
45511
45512
45513
45514
45515
45516
45517
45518
45519
45520
45521
45522
45523
45524
45525
45526
45527
45528
45529
45530
45531
45532
45533
45534
45535
45536
45537
45538
45539
45540
45541
45542
45543
45544
45545
45546
45547
45548
45549
45550
45551
45552
45553
45554
45555
45556
45557
45558
45559
45560
45561
45562
45563
45564
45565
45566
45567
45568
45569
45570
45571
45572
45573
45574
45575
45576
45577
45578
45579
45580
45581
45582
45583
45584
45585
45586
45587
45588
45589
45590
45591
45592
45593
45594
45595
45596
45597
45598
45599
45600
45601
45602
45603
45604
45605
45606
45607
45608
45609
45610
45611
45612
45613
45614
45615
45616
45617
45618
45619
45620
45621
45622
45623
45624
45625
45626
45627
45628
45629
45630
45631
45632
45633
45634
45635
45636
45637
45638
45639
45640
45641
45642
45643
45644
45645
45646
45647
45648
45649
45650
45651
45652
45653
45654
45655
45656
45657
45658
45659
45660
45661
45662
45663
45664
45665
45666
45667
45668
45669
45670
45671
45672
45673
45674
45675
45676
45677
45678
45679
45680
45681
45682
45683
45684
45685
45686
45687
45688
45689
45690
45691
45692
45693
45694
45695
45696
45697
45698
45699
45700
45701
45702
45703
45704
45705
45706
45707
45708
45709
45710
45711
45712
45713
45714
45715
45716
45717
45718
45719
45720
45721
45722
45723
45724
45725
45726
45727
45728
45729
45730
45731
45732
45733
45734
45735
45736
45737
45738
45739
45740
45741
45742
45743
45744
45745
45746
45747
45748
45749
45750
45751
45752
45753
45754
45755
45756
45757
45758
45759
45760
45761
45762
45763
45764
45765
45766
45767
45768
45769
45770
45771
45772
45773
45774
45775
45776
45777
45778
45779
45780
45781
45782
45783
45784
45785
45786
45787
45788
45789
45790
45791
45792
45793
45794
45795
45796
45797
45798
45799
45800
45801
45802
45803
45804
45805
45806
45807
45808
45809
45810
45811
45812
45813
45814
45815
45816
45817
45818
45819
45820
45821
45822
45823
45824
45825
45826
45827
45828
45829
45830
45831
45832
45833
45834
45835
45836
45837
45838
45839
45840
45841
45842
45843
45844
45845
45846
45847
45848
45849
45850
45851
45852
45853
45854
45855
45856
45857
45858
45859
45860
45861
45862
45863
45864
45865
45866
45867
45868
45869
45870
45871
45872
45873
45874
45875
45876
45877
45878
45879
45880
45881
45882
45883
45884
45885
45886
45887
45888
45889
45890
45891
45892
45893
45894
45895
45896
45897
45898
45899
45900
45901
45902
45903
45904
45905
45906
45907
45908
45909
45910
45911
45912
45913
45914
45915
45916
45917
45918
45919
45920
45921
45922
45923
45924
45925
45926
45927
45928
45929
45930
45931
45932
45933
45934
45935
45936
45937
45938
45939
45940
45941
45942
45943
45944
45945
45946
45947
45948
45949
45950
45951
45952
45953
45954
45955
45956
45957
45958
45959
45960
45961
45962
45963
45964
45965
45966
45967
45968
45969
45970
45971
45972
45973
45974
45975
45976
45977
45978
45979
45980
45981
45982
45983
45984
45985
45986
45987
45988
45989
45990
45991
45992
45993
45994
45995
45996
45997
45998
45999
46000
46001
46002
46003
46004
46005
46006
46007
46008
46009
46010
46011
46012
46013
46014
46015
46016
46017
46018
46019
46020
46021
46022
46023
46024
46025
46026
46027
46028
46029
46030
46031
46032
46033
46034
46035
46036
46037
46038
46039
46040
46041
46042
46043
46044
46045
46046
46047
46048
46049
46050
46051
46052
46053
46054
46055
46056
46057
46058
46059
46060
46061
46062
46063
46064
46065
46066
46067
46068
46069
46070
46071
46072
46073
46074
46075
46076
46077
46078
46079
46080
46081
46082
46083
46084
46085
46086
46087
46088
46089
46090
46091
46092
46093
46094
46095
46096
46097
46098
46099
46100
46101
46102
46103
46104
46105
46106
46107
46108
46109
46110
46111
46112
46113
46114
46115
46116
46117
46118
46119
46120
46121
46122
46123
46124
46125
46126
46127
46128
46129
46130
46131
46132
46133
46134
46135
46136
46137
46138
46139
46140
46141
46142
46143
46144
46145
46146
46147
46148
46149
46150
46151
46152
46153
46154
46155
46156
46157
46158
46159
46160
46161
46162
46163
46164
46165
46166
46167
46168
46169
46170
46171
46172
46173
46174
46175
46176
46177
46178
46179
46180
46181
46182
46183
46184
46185
46186
46187
46188
46189
46190
46191
46192
46193
46194
46195
46196
46197
46198
46199
46200
46201
46202
46203
46204
46205
46206
46207
46208
46209
46210
46211
46212
46213
46214
46215
46216
46217
46218
46219
46220
46221
46222
46223
46224
46225
46226
46227
46228
46229
46230
46231
46232
46233
46234
46235
46236
46237
46238
46239
46240
46241
46242
46243
46244
46245
46246
46247
46248
46249
46250
46251
46252
46253
46254
46255
46256
46257
46258
46259
46260
46261
46262
46263
46264
46265
46266
46267
46268
46269
46270
46271
46272
46273
46274
46275
46276
46277
46278
46279
46280
46281
46282
46283
46284
46285
46286
46287
46288
46289
46290
46291
46292
46293
46294
46295
46296
46297
46298
46299
46300
46301
46302
46303
46304
46305
46306
46307
46308
46309
46310
46311
46312
46313
46314
46315
46316
46317
46318
46319
46320
46321
46322
46323
46324
46325
46326
46327
46328
46329
46330
46331
46332
46333
46334
46335
46336
46337
46338
46339
46340
46341
46342
46343
46344
46345
46346
46347
46348
46349
46350
46351
46352
46353
46354
46355
46356
46357
46358
46359
46360
46361
46362
46363
46364
46365
46366
46367
46368
46369
46370
46371
46372
46373
46374
46375
46376
46377
46378
46379
46380
46381
46382
46383
46384
46385
46386
46387
46388
46389
46390
46391
46392
46393
46394
46395
46396
46397
46398
46399
46400
46401
46402
46403
46404
46405
46406
46407
46408
46409
46410
46411
46412
46413
46414
46415
46416
46417
46418
46419
46420
46421
46422
46423
46424
46425
46426
46427
46428
46429
46430
46431
46432
46433
46434
46435
46436
46437
46438
46439
46440
46441
46442
46443
46444
46445
46446
46447
46448
46449
46450
46451
46452
46453
46454
46455
46456
46457
46458
46459
46460
46461
46462
46463
46464
46465
46466
46467
46468
46469
46470
46471
46472
46473
46474
46475
46476
46477
46478
46479
46480
46481
46482
46483
46484
46485
46486
46487
46488
46489
46490
46491
46492
46493
46494
46495
46496
46497
46498
46499
46500
46501
46502
46503
46504
46505
46506
46507
46508
46509
46510
46511
46512
46513
46514
46515
46516
46517
46518
46519
46520
46521
46522
46523
46524
46525
46526
46527
46528
46529
46530
46531
46532
46533
46534
46535
46536
46537
46538
46539
46540
46541
46542
46543
46544
46545
46546
46547
46548
46549
46550
46551
46552
46553
46554
46555
46556
46557
46558
46559
46560
46561
46562
46563
46564
46565
46566
46567
46568
46569
46570
46571
46572
46573
46574
46575
46576
46577
46578
46579
46580
46581
46582
46583
46584
46585
46586
46587
46588
46589
46590
46591
46592
46593
46594
46595
46596
46597
46598
46599
46600
46601
46602
46603
46604
46605
46606
46607
46608
46609
46610
46611
46612
46613
46614
46615
46616
46617
46618
46619
46620
46621
46622
46623
46624
46625
46626
46627
46628
46629
46630
46631
46632
46633
46634
46635
46636
46637
46638
46639
46640
46641
46642
46643
46644
46645
46646
46647
46648
46649
46650
46651
46652
46653
46654
46655
46656
46657
46658
46659
46660
46661
46662
46663
46664
46665
46666
46667
46668
46669
46670
46671
46672
46673
46674
46675
46676
46677
46678
46679
46680
46681
46682
46683
46684
46685
46686
46687
46688
46689
46690
46691
46692
46693
46694
46695
46696
46697
46698
46699
46700
46701
46702
46703
46704
46705
46706
46707
46708
46709
46710
46711
46712
46713
46714
46715
46716
46717
46718
46719
46720
46721
46722
46723
46724
46725
46726
46727
46728
46729
46730
46731
46732
46733
46734
46735
46736
46737
46738
46739
46740
46741
46742
46743
46744
46745
46746
46747
46748
46749
46750
46751
46752
46753
46754
46755
46756
46757
46758
46759
46760
46761
46762
46763
46764
46765
46766
46767
46768
46769
46770
46771
46772
46773
46774
46775
46776
46777
46778
46779
46780
46781
46782
46783
46784
46785
46786
46787
46788
46789
46790
46791
46792
46793
46794
46795
46796
46797
46798
46799
46800
46801
46802
46803
46804
46805
46806
46807
46808
46809
46810
46811
46812
46813
46814
46815
46816
46817
46818
46819
46820
46821
46822
46823
46824
46825
46826
46827
46828
46829
46830
46831
46832
46833
46834
46835
46836
46837
46838
46839
46840
46841
46842
46843
46844
46845
46846
46847
46848
46849
46850
46851
46852
46853
46854
46855
46856
46857
46858
46859
46860
46861
46862
46863
46864
46865
46866
46867
46868
46869
46870
46871
46872
46873
46874
46875
46876
46877
46878
46879
46880
46881
46882
46883
46884
46885
46886
46887
46888
46889
46890
46891
46892
46893
46894
46895
46896
46897
46898
46899
46900
46901
46902
46903
46904
46905
46906
46907
46908
46909
46910
46911
46912
46913
46914
46915
46916
46917
46918
46919
46920
46921
46922
46923
46924
46925
46926
46927
46928
46929
46930
46931
46932
46933
46934
46935
46936
46937
46938
46939
46940
46941
46942
46943
46944
46945
46946
46947
46948
46949
46950
46951
46952
46953
46954
46955
46956
46957
46958
46959
46960
46961
46962
46963
46964
46965
46966
46967
46968
46969
46970
46971
46972
46973
46974
46975
46976
46977
46978
46979
46980
46981
46982
46983
46984
46985
46986
46987
46988
46989
46990
46991
46992
46993
46994
46995
46996
46997
46998
46999
47000
47001
47002
47003
47004
47005
47006
47007
47008
47009
47010
47011
47012
47013
47014
47015
47016
47017
47018
47019
47020
47021
47022
47023
47024
47025
47026
47027
47028
47029
47030
47031
47032
47033
47034
47035
47036
47037
47038
47039
47040
47041
47042
47043
47044
47045
47046
47047
47048
47049
47050
47051
47052
47053
47054
47055
47056
47057
47058
47059
47060
47061
47062
47063
47064
47065
47066
47067
47068
47069
47070
47071
47072
47073
47074
47075
47076
47077
47078
47079
47080
47081
47082
47083
47084
47085
47086
47087
47088
47089
47090
47091
47092
47093
47094
47095
47096
47097
47098
47099
47100
47101
47102
47103
47104
47105
47106
47107
47108
47109
47110
47111
47112
47113
47114
47115
47116
47117
47118
47119
47120
47121
47122
47123
47124
47125
47126
47127
47128
47129
47130
47131
47132
47133
47134
47135
47136
47137
47138
47139
47140
47141
47142
47143
47144
47145
47146
47147
47148
47149
47150
47151
47152
47153
47154
47155
47156
47157
47158
47159
47160
47161
47162
47163
47164
47165
47166
47167
47168
47169
47170
47171
47172
47173
47174
47175
47176
47177
47178
47179
47180
47181
47182
47183
47184
47185
47186
47187
47188
47189
47190
47191
47192
47193
47194
47195
47196
47197
47198
47199
47200
47201
47202
47203
47204
47205
47206
47207
47208
47209
47210
47211
47212
47213
47214
47215
47216
47217
47218
47219
47220
47221
47222
47223
47224
47225
47226
47227
47228
47229
47230
47231
47232
47233
47234
47235
47236
47237
47238
47239
47240
47241
47242
47243
47244
47245
47246
47247
47248
47249
47250
47251
47252
47253
47254
47255
47256
47257
47258
47259
47260
47261
47262
47263
47264
47265
47266
47267
47268
47269
47270
47271
47272
47273
47274
47275
47276
47277
47278
47279
47280
47281
47282
47283
47284
47285
47286
47287
47288
47289
47290
47291
47292
47293
47294
47295
47296
47297
47298
47299
47300
47301
47302
47303
47304
47305
47306
47307
47308
47309
47310
47311
47312
47313
47314
47315
47316
47317
47318
47319
47320
47321
47322
47323
47324
47325
47326
47327
47328
47329
47330
47331
47332
47333
47334
47335
47336
47337
47338
47339
47340
47341
47342
47343
47344
47345
47346
47347
47348
47349
47350
47351
47352
47353
47354
47355
47356
47357
47358
47359
47360
47361
47362
47363
47364
47365
47366
47367
47368
47369
47370
47371
47372
47373
47374
47375
47376
47377
47378
47379
47380
47381
47382
47383
47384
47385
47386
47387
47388
47389
47390
47391
47392
47393
47394
47395
47396
47397
47398
47399
47400
47401
47402
47403
47404
47405
47406
47407
47408
47409
47410
47411
47412
47413
47414
47415
47416
47417
47418
47419
47420
47421
47422
47423
47424
47425
47426
47427
47428
47429
47430
47431
47432
47433
47434
47435
47436
47437
47438
47439
47440
47441
47442
47443
47444
47445
47446
47447
47448
47449
47450
47451
47452
47453
47454
47455
47456
47457
47458
47459
47460
47461
47462
47463
47464
47465
47466
47467
47468
47469
47470
47471
47472
47473
47474
47475
47476
47477
47478
47479
47480
47481
47482
47483
47484
47485
47486
47487
47488
47489
47490
47491
47492
47493
47494
47495
47496
47497
47498
47499
47500
47501
47502
47503
47504
47505
47506
47507
47508
47509
47510
47511
47512
47513
47514
47515
47516
47517
47518
47519
47520
47521
47522
47523
47524
47525
47526
47527
47528
47529
47530
47531
47532
47533
47534
47535
47536
47537
47538
47539
47540
47541
47542
47543
47544
47545
47546
47547
47548
47549
47550
47551
47552
47553
47554
47555
47556
47557
47558
47559
47560
47561
47562
47563
47564
47565
47566
47567
47568
47569
47570
47571
47572
47573
47574
47575
47576
47577
47578
47579
47580
47581
47582
47583
47584
47585
47586
47587
47588
47589
47590
47591
47592
47593
47594
47595
47596
47597
47598
47599
47600
47601
47602
47603
47604
47605
47606
47607
47608
47609
47610
47611
47612
47613
47614
47615
47616
47617
47618
47619
47620
47621
47622
47623
47624
47625
47626
47627
47628
47629
47630
47631
47632
47633
47634
47635
47636
47637
47638
47639
47640
47641
47642
47643
47644
47645
47646
47647
47648
47649
47650
47651
47652
47653
47654
47655
47656
47657
47658
47659
47660
47661
47662
47663
47664
47665
47666
47667
47668
47669
47670
47671
47672
47673
47674
47675
47676
47677
47678
47679
47680
47681
47682
47683
47684
47685
47686
47687
47688
47689
47690
47691
47692
47693
47694
47695
47696
47697
47698
47699
47700
47701
47702
47703
47704
47705
47706
47707
47708
47709
47710
47711
47712
47713
47714
47715
47716
47717
47718
47719
47720
47721
47722
47723
47724
47725
47726
47727
47728
47729
47730
47731
47732
47733
47734
47735
47736
47737
47738
47739
47740
47741
47742
47743
47744
47745
47746
47747
47748
47749
47750
47751
47752
47753
47754
47755
47756
47757
47758
47759
47760
47761
47762
47763
47764
47765
47766
47767
47768
47769
47770
47771
47772
47773
47774
47775
47776
47777
47778
47779
47780
47781
47782
47783
47784
47785
47786
47787
47788
47789
47790
47791
47792
47793
47794
47795
47796
47797
47798
47799
47800
47801
47802
47803
47804
47805
47806
47807
47808
47809
47810
47811
47812
47813
47814
47815
47816
47817
47818
47819
47820
47821
47822
47823
47824
47825
47826
47827
47828
47829
47830
47831
47832
47833
47834
47835
47836
47837
47838
47839
47840
47841
47842
47843
47844
47845
47846
47847
47848
47849
47850
47851
47852
47853
47854
47855
47856
47857
47858
47859
47860
47861
47862
47863
47864
47865
47866
47867
47868
47869
47870
47871
47872
47873
47874
47875
47876
47877
47878
47879
47880
47881
47882
47883
47884
47885
47886
47887
47888
47889
47890
47891
47892
47893
47894
47895
47896
47897
47898
47899
47900
47901
47902
47903
47904
47905
47906
47907
47908
47909
47910
47911
47912
47913
47914
47915
47916
47917
47918
47919
47920
47921
47922
47923
47924
47925
47926
47927
47928
47929
47930
47931
47932
47933
47934
47935
47936
47937
47938
47939
47940
47941
47942
47943
47944
47945
47946
47947
47948
47949
47950
47951
47952
47953
47954
47955
47956
47957
47958
47959
47960
47961
47962
47963
47964
47965
47966
47967
47968
47969
47970
47971
47972
47973
47974
47975
47976
47977
47978
47979
47980
47981
47982
47983
47984
47985
47986
47987
47988
47989
47990
47991
47992
47993
47994
47995
47996
47997
47998
47999
48000
48001
48002
48003
48004
48005
48006
48007
48008
48009
48010
48011
48012
48013
48014
48015
48016
48017
48018
48019
48020
48021
48022
48023
48024
48025
48026
48027
48028
48029
48030
48031
48032
48033
48034
48035
48036
48037
48038
48039
48040
48041
48042
48043
48044
48045
48046
48047
48048
48049
48050
48051
48052
48053
48054
48055
48056
48057
48058
48059
48060
48061
48062
48063
48064
48065
48066
48067
48068
48069
48070
48071
48072
48073
48074
48075
48076
48077
48078
48079
48080
48081
48082
48083
48084
48085
48086
48087
48088
48089
48090
48091
48092
48093
48094
48095
48096
48097
48098
48099
48100
48101
48102
48103
48104
48105
48106
48107
48108
48109
48110
48111
48112
48113
48114
48115
48116
48117
48118
48119
48120
48121
48122
48123
48124
48125
48126
48127
48128
48129
48130
48131
48132
48133
48134
48135
48136
48137
48138
48139
48140
48141
48142
48143
48144
48145
48146
48147
48148
48149
48150
48151
48152
48153
48154
48155
48156
48157
48158
48159
48160
48161
48162
48163
48164
48165
48166
48167
48168
48169
48170
48171
48172
48173
48174
48175
48176
48177
48178
48179
48180
48181
48182
48183
48184
48185
48186
48187
48188
48189
48190
48191
48192
48193
48194
48195
48196
48197
48198
48199
48200
48201
48202
48203
48204
48205
48206
48207
48208
48209
48210
48211
48212
48213
48214
48215
48216
48217
48218
48219
48220
48221
48222
48223
48224
48225
48226
48227
48228
48229
48230
48231
48232
48233
48234
48235
48236
48237
48238
48239
48240
48241
48242
48243
48244
48245
48246
48247
48248
48249
48250
48251
48252
48253
48254
48255
48256
48257
48258
48259
48260
48261
48262
48263
48264
48265
48266
48267
48268
48269
48270
48271
48272
48273
48274
48275
48276
48277
48278
48279
48280
48281
48282
48283
48284
48285
48286
48287
48288
48289
48290
48291
48292
48293
48294
48295
48296
48297
48298
48299
48300
48301
48302
48303
48304
48305
48306
48307
48308
48309
48310
48311
48312
48313
48314
48315
48316
48317
48318
48319
48320
48321
48322
48323
48324
48325
48326
48327
48328
48329
48330
48331
48332
48333
48334
48335
48336
48337
48338
48339
48340
48341
48342
48343
48344
48345
48346
48347
48348
48349
48350
48351
48352
48353
48354
48355
48356
48357
48358
48359
48360
48361
48362
48363
48364
48365
48366
48367
48368
48369
48370
48371
48372
48373
48374
48375
48376
48377
48378
48379
48380
48381
48382
48383
48384
48385
48386
48387
48388
48389
48390
48391
48392
48393
48394
48395
48396
48397
48398
48399
48400
48401
48402
48403
48404
48405
48406
48407
48408
48409
48410
48411
48412
48413
48414
48415
48416
48417
48418
48419
48420
48421
48422
48423
48424
48425
48426
48427
48428
48429
48430
48431
48432
48433
48434
48435
48436
48437
48438
48439
48440
48441
48442
48443
48444
48445
48446
48447
48448
48449
48450
48451
48452
48453
48454
48455
48456
48457
48458
48459
48460
48461
48462
48463
48464
48465
48466
48467
48468
48469
48470
48471
48472
48473
48474
48475
48476
48477
48478
48479
48480
48481
48482
48483
48484
48485
48486
48487
48488
48489
48490
48491
48492
48493
48494
48495
48496
48497
48498
48499
48500
48501
48502
48503
48504
48505
48506
48507
48508
48509
48510
48511
48512
48513
48514
48515
48516
48517
48518
48519
48520
48521
48522
48523
48524
48525
48526
48527
48528
48529
48530
48531
48532
48533
48534
48535
48536
48537
48538
48539
48540
48541
48542
48543
48544
48545
48546
48547
48548
48549
48550
48551
48552
48553
48554
48555
48556
48557
48558
48559
48560
48561
48562
48563
48564
48565
48566
48567
48568
48569
48570
48571
48572
48573
48574
48575
48576
48577
48578
48579
48580
48581
48582
48583
48584
48585
48586
48587
48588
48589
48590
48591
48592
48593
48594
48595
48596
48597
48598
48599
48600
48601
48602
48603
48604
48605
48606
48607
48608
48609
48610
48611
48612
48613
48614
48615
48616
48617
48618
48619
48620
48621
48622
48623
48624
48625
48626
48627
48628
48629
48630
48631
48632
48633
48634
48635
48636
48637
48638
48639
48640
48641
48642
48643
48644
48645
48646
48647
48648
48649
48650
48651
48652
48653
48654
48655
48656
48657
48658
48659
48660
48661
48662
48663
48664
48665
48666
48667
48668
48669
48670
48671
48672
48673
48674
48675
48676
48677
48678
48679
48680
48681
48682
48683
48684
48685
48686
48687
48688
48689
48690
48691
48692
48693
48694
48695
48696
48697
48698
48699
48700
48701
48702
48703
48704
48705
48706
48707
48708
48709
48710
48711
48712
48713
48714
48715
48716
48717
48718
48719
48720
48721
48722
48723
48724
48725
48726
48727
48728
48729
48730
48731
48732
48733
48734
48735
48736
48737
48738
48739
48740
48741
48742
48743
48744
48745
48746
48747
48748
48749
48750
48751
48752
48753
48754
48755
48756
48757
48758
48759
48760
48761
48762
48763
48764
48765
48766
48767
48768
48769
48770
48771
48772
48773
48774
48775
48776
48777
48778
48779
48780
48781
48782
48783
48784
48785
48786
48787
48788
48789
48790
48791
48792
48793
48794
48795
48796
48797
48798
48799
48800
48801
48802
48803
48804
48805
48806
48807
48808
48809
48810
48811
48812
48813
48814
48815
48816
48817
48818
48819
48820
48821
48822
48823
48824
48825
48826
48827
48828
48829
48830
48831
48832
48833
48834
48835
48836
48837
48838
48839
48840
48841
48842
48843
48844
48845
48846
48847
48848
48849
48850
48851
48852
48853
48854
48855
48856
48857
48858
48859
48860
48861
48862
48863
48864
48865
48866
48867
48868
48869
48870
48871
48872
48873
48874
48875
48876
48877
48878
48879
48880
48881
48882
48883
48884
48885
48886
48887
48888
48889
48890
48891
48892
48893
48894
48895
48896
48897
48898
48899
48900
48901
48902
48903
48904
48905
48906
48907
48908
48909
48910
48911
48912
48913
48914
48915
48916
48917
48918
48919
48920
48921
48922
48923
48924
48925
48926
48927
48928
48929
48930
48931
48932
48933
48934
48935
48936
48937
48938
48939
48940
48941
48942
48943
48944
48945
48946
48947
48948
48949
48950
48951
48952
48953
48954
48955
48956
48957
48958
48959
48960
48961
48962
48963
48964
48965
48966
48967
48968
48969
48970
48971
48972
48973
48974
48975
48976
48977
48978
48979
48980
48981
48982
48983
48984
48985
48986
48987
48988
48989
48990
48991
48992
48993
48994
48995
48996
48997
48998
48999
49000
49001
49002
49003
49004
49005
49006
49007
49008
49009
49010
49011
49012
49013
49014
49015
49016
49017
49018
49019
49020
49021
49022
49023
49024
49025
49026
49027
49028
49029
49030
49031
49032
49033
49034
49035
49036
49037
49038
49039
49040
49041
49042
49043
49044
49045
49046
49047
49048
49049
49050
49051
49052
49053
49054
49055
49056
49057
49058
49059
49060
49061
49062
49063
49064
49065
49066
49067
49068
49069
49070
49071
49072
49073
49074
49075
49076
49077
49078
49079
49080
49081
49082
49083
49084
49085
49086
49087
49088
49089
49090
49091
49092
49093
49094
49095
49096
49097
49098
49099
49100
49101
49102
49103
49104
49105
49106
49107
49108
49109
49110
49111
49112
49113
49114
49115
49116
49117
49118
49119
49120
49121
49122
49123
49124
49125
49126
49127
49128
49129
49130
49131
49132
49133
49134
49135
49136
49137
49138
49139
49140
49141
49142
49143
49144
49145
49146
49147
49148
49149
49150
49151
49152
49153
49154
49155
49156
49157
49158
49159
49160
49161
49162
49163
49164
49165
49166
49167
49168
49169
49170
49171
49172
49173
49174
49175
49176
49177
49178
49179
49180
49181
49182
49183
49184
49185
49186
49187
49188
49189
49190
49191
49192
49193
49194
49195
49196
49197
49198
49199
49200
49201
49202
49203
49204
49205
49206
49207
49208
49209
49210
49211
49212
49213
49214
49215
49216
49217
49218
49219
49220
49221
49222
49223
49224
49225
49226
49227
49228
49229
49230
49231
49232
49233
49234
49235
49236
49237
49238
49239
49240
49241
49242
49243
49244
49245
49246
49247
49248
49249
49250
49251
49252
49253
49254
49255
49256
49257
49258
49259
49260
49261
49262
49263
49264
49265
49266
49267
49268
49269
49270
49271
49272
49273
49274
49275
49276
49277
49278
49279
49280
49281
49282
49283
49284
49285
49286
49287
49288
49289
49290
49291
49292
49293
49294
49295
49296
49297
49298
49299
49300
49301
49302
49303
49304
49305
49306
49307
49308
49309
49310
49311
49312
49313
49314
49315
49316
49317
49318
49319
49320
49321
49322
49323
49324
49325
49326
49327
49328
49329
49330
49331
49332
49333
(*Generated by Lem from generated_definitions/lem/RV32/riscv.lem.*)
open HolKernel Parse boolLib bossLib;
open lem_pervasives_extraTheory sail2_instr_kindsTheory sail2_valuesTheory sail2_prompt_monadTheory sail2_operators_mwordsTheory sail2_promptTheory sail2_stringTheory riscv_typesTheory mem_metadataTheory riscv_extras_fdextTheory riscv_extrasTheory;

val _ = numLib.prefer_num();



val _ = new_theory "riscv"

(*Generated by Sail from riscv.*)
(*open import Pervasives_extra*)
(*open import Sail2_instr_kinds*)
(*open import Sail2_values*)
(*open import Sail2_string*)
(*open import Sail2_operators_mwords*)
(*open import Sail2_prompt_monad*)
(*open import Sail2_prompt*)
(*open import Riscv_types*)
(*open import Mem_metadata*)
(*open import Riscv_extras_fdext*)
(*open import Riscv_extras*)

(*val is_none : forall 'a. maybe 'a -> bool*)

val _ = Define `
 ((is_none:'a option -> bool) opt=  ((case opt of   SOME (_) => F | NONE => T )))`;


(*val is_some : forall 'a. maybe 'a -> bool*)

val _ = Define `
 ((is_some:'a option -> bool) opt=  ((case opt of   SOME (_) => T | NONE => F )))`;


(*val eq_unit : unit -> unit -> bool*)

val _ = Define `
 ((eq_unit:unit -> unit -> bool) _ _=  T)`;




(*val neq_bool : bool -> bool -> bool*)

val _ = Define `
 ((neq_bool:bool -> bool -> bool) x y=  (~ (((x = y)))))`;


(*val __id : integer -> integer*)

val _ = Define `
 ((id:int -> int) x=  x)`;


(*val _shl_int_general : ii -> ii -> ii*)

val _ = Define `
 ((shl_int_general:int -> int -> int) (m : ii) (n : ii)=
    (if ((n >= (( 0 : int):ii))) then shl_int m n
   else shr_int m ((~ n))))`;


(*val _shr_int_general : ii -> ii -> ii*)

val _ = Define `
 ((shr_int_general:int -> int -> int) (m : ii) (n : ii)=
    (if ((n >= (( 0 : int):ii))) then shr_int m n
   else shl_int m ((~ n))))`;


(*val fdiv_int : ii -> ii -> ii*)

val _ = Define `
 ((fdiv_int:int -> int -> int) (n : ii) (m : ii)=
    (if (((((n < (( 0 : int):ii))) /\ ((m > (( 0 : int):ii)))))) then
     ((tdiv_int ((n + (( 1 : int):ii))) m)) - (( 1 : int):ii)
   else if (((((n > (( 0 : int):ii))) /\ ((m < (( 0 : int):ii)))))) then
     ((tdiv_int ((n - (( 1 : int):ii))) m)) - (( 1 : int):ii)
   else tdiv_int n m))`;


(*val fmod_int : ii -> ii -> ii*)

val _ = Define `
 ((fmod_int:int -> int -> int) (n : ii) (m : ii)=  (n - ((m * ((fdiv_int n m))))))`;


(*val concat_str_bits : forall 'n. Size 'n => string -> mword 'n -> string*)

val _ = Define `
 ((concat_str_bits:string -> 'n words$word -> string) str x=  (STRCAT str ((string_of_bits x))))`;


(*val concat_str_dec : string -> ii -> string*)

val _ = Define `
 ((concat_str_dec:string -> int -> string) str x=  (STRCAT str ((dec_str x))))`;




(*val sail_mask : forall 'len 'v. Size 'len, Size 'v => integer -> mword 'v -> mword 'len*)

val _ = Define `
 ((sail_mask:int -> 'v words$word -> 'len words$word) len v=
    (if ((len <= ((int_of_num (words$word_len v))))) then (vector_truncate v len  :  'len words$word)
   else (zero_extend v len  :  'len words$word)))`;


(*val sail_ones : forall 'n. Size 'n => integer -> mword 'n*)

val _ = Define `
 ((sail_ones:int -> 'n words$word) n=  ((not_vec ((zeros n  :  'n words$word))  :  'n words$word)))`;


(*val slice_mask : forall 'n. Size 'n => integer -> ii -> ii -> mword 'n*)

val _ = Define `
 ((slice_mask:int -> int -> int -> 'n words$word) n i l=
    (if ((l >= n)) then (shiftl ((sail_ones n  :  'n words$word)) i  :  'n words$word)
   else
     let (one1 :  'n words$word) = ((sail_mask n (0b1w :  1 words$word)  :  'n words$word)) in
     (shiftl ((sub_vec ((shiftl one1 l  :  'n words$word)) one1  :  'n words$word)) i  :  'n words$word)))`;


(*val read_kind_of_num : integer -> read_kind*)

val _ = Define `
 ((read_kind_of_num:int -> read_kind) arg_=
    (let l__299 = arg_ in
   if (((l__299 = (( 0 : int):ii)))) then Read_plain
   else if (((l__299 = (( 1 : int):ii)))) then Read_reserve
   else if (((l__299 = (( 2 : int):ii)))) then Read_acquire
   else if (((l__299 = (( 3 : int):ii)))) then Read_exclusive
   else if (((l__299 = (( 4 : int):ii)))) then Read_exclusive_acquire
   else if (((l__299 = (( 5 : int):ii)))) then Read_stream
   else if (((l__299 = (( 6 : int):ii)))) then Read_RISCV_acquire
   else if (((l__299 = (( 7 : int):ii)))) then Read_RISCV_strong_acquire
   else if (((l__299 = (( 8 : int):ii)))) then Read_RISCV_reserved
   else if (((l__299 = (( 9 : int):ii)))) then Read_RISCV_reserved_acquire
   else if (((l__299 = (( 10 : int):ii)))) then Read_RISCV_reserved_strong_acquire
   else Read_X86_locked))`;


(*val num_of_read_kind : read_kind -> integer*)

val _ = Define `
 ((num_of_read_kind:read_kind -> int) arg_=
    ((case arg_ of
     Read_plain => (( 0 : int):ii)
   | Read_reserve => (( 1 : int):ii)
   | Read_acquire => (( 2 : int):ii)
   | Read_exclusive => (( 3 : int):ii)
   | Read_exclusive_acquire => (( 4 : int):ii)
   | Read_stream => (( 5 : int):ii)
   | Read_RISCV_acquire => (( 6 : int):ii)
   | Read_RISCV_strong_acquire => (( 7 : int):ii)
   | Read_RISCV_reserved => (( 8 : int):ii)
   | Read_RISCV_reserved_acquire => (( 9 : int):ii)
   | Read_RISCV_reserved_strong_acquire => (( 10 : int):ii)
   | Read_X86_locked => (( 11 : int):ii)
   )))`;


(*val write_kind_of_num : integer -> write_kind*)

val _ = Define `
 ((write_kind_of_num:int -> write_kind) arg_=
    (let l__289 = arg_ in
   if (((l__289 = (( 0 : int):ii)))) then Write_plain
   else if (((l__289 = (( 1 : int):ii)))) then Write_conditional
   else if (((l__289 = (( 2 : int):ii)))) then Write_release
   else if (((l__289 = (( 3 : int):ii)))) then Write_exclusive
   else if (((l__289 = (( 4 : int):ii)))) then Write_exclusive_release
   else if (((l__289 = (( 5 : int):ii)))) then Write_RISCV_release
   else if (((l__289 = (( 6 : int):ii)))) then Write_RISCV_strong_release
   else if (((l__289 = (( 7 : int):ii)))) then Write_RISCV_conditional
   else if (((l__289 = (( 8 : int):ii)))) then Write_RISCV_conditional_release
   else if (((l__289 = (( 9 : int):ii)))) then Write_RISCV_conditional_strong_release
   else Write_X86_locked))`;


(*val num_of_write_kind : write_kind -> integer*)

val _ = Define `
 ((num_of_write_kind:write_kind -> int) arg_=
    ((case arg_ of
     Write_plain => (( 0 : int):ii)
   | Write_conditional => (( 1 : int):ii)
   | Write_release => (( 2 : int):ii)
   | Write_exclusive => (( 3 : int):ii)
   | Write_exclusive_release => (( 4 : int):ii)
   | Write_RISCV_release => (( 5 : int):ii)
   | Write_RISCV_strong_release => (( 6 : int):ii)
   | Write_RISCV_conditional => (( 7 : int):ii)
   | Write_RISCV_conditional_release => (( 8 : int):ii)
   | Write_RISCV_conditional_strong_release => (( 9 : int):ii)
   | Write_X86_locked => (( 10 : int):ii)
   )))`;


(*val a64_barrier_domain_of_num : integer -> a64_barrier_domain*)

val _ = Define `
 ((a64_barrier_domain_of_num:int -> a64_barrier_domain) arg_=
    (let l__286 = arg_ in
   if (((l__286 = (( 0 : int):ii)))) then A64_FullShare
   else if (((l__286 = (( 1 : int):ii)))) then A64_InnerShare
   else if (((l__286 = (( 2 : int):ii)))) then A64_OuterShare
   else A64_NonShare))`;


(*val num_of_a64_barrier_domain : a64_barrier_domain -> integer*)

val _ = Define `
 ((num_of_a64_barrier_domain:a64_barrier_domain -> int) arg_=
    ((case arg_ of
     A64_FullShare => (( 0 : int):ii)
   | A64_InnerShare => (( 1 : int):ii)
   | A64_OuterShare => (( 2 : int):ii)
   | A64_NonShare => (( 3 : int):ii)
   )))`;


(*val a64_barrier_type_of_num : integer -> a64_barrier_type*)

val _ = Define `
 ((a64_barrier_type_of_num:int -> a64_barrier_type) arg_=
    (let l__284 = arg_ in
   if (((l__284 = (( 0 : int):ii)))) then A64_barrier_all
   else if (((l__284 = (( 1 : int):ii)))) then A64_barrier_LD
   else A64_barrier_ST))`;


(*val num_of_a64_barrier_type : a64_barrier_type -> integer*)

val _ = Define `
 ((num_of_a64_barrier_type:a64_barrier_type -> int) arg_=
    ((case arg_ of
     A64_barrier_all => (( 0 : int):ii)
   | A64_barrier_LD => (( 1 : int):ii)
   | A64_barrier_ST => (( 2 : int):ii)
   )))`;


(*val trans_kind_of_num : integer -> trans_kind*)

val _ = Define `
 ((trans_kind_of_num:int -> trans_kind) arg_=
    (let l__282 = arg_ in
   if (((l__282 = (( 0 : int):ii)))) then Transaction_start
   else if (((l__282 = (( 1 : int):ii)))) then Transaction_commit
   else Transaction_abort))`;


(*val num_of_trans_kind : trans_kind -> integer*)

val _ = Define `
 ((num_of_trans_kind:trans_kind -> int) arg_=
    ((case arg_ of
     Transaction_start => (( 0 : int):ii)
   | Transaction_commit => (( 1 : int):ii)
   | Transaction_abort => (( 2 : int):ii)
   )))`;


(*val cache_op_kind_of_num : integer -> cache_op_kind*)

val _ = Define `
 ((cache_op_kind_of_num:int -> cache_op_kind) arg_=
    (let l__272 = arg_ in
   if (((l__272 = (( 0 : int):ii)))) then Cache_op_D_IVAC
   else if (((l__272 = (( 1 : int):ii)))) then Cache_op_D_ISW
   else if (((l__272 = (( 2 : int):ii)))) then Cache_op_D_CSW
   else if (((l__272 = (( 3 : int):ii)))) then Cache_op_D_CISW
   else if (((l__272 = (( 4 : int):ii)))) then Cache_op_D_ZVA
   else if (((l__272 = (( 5 : int):ii)))) then Cache_op_D_CVAC
   else if (((l__272 = (( 6 : int):ii)))) then Cache_op_D_CVAU
   else if (((l__272 = (( 7 : int):ii)))) then Cache_op_D_CIVAC
   else if (((l__272 = (( 8 : int):ii)))) then Cache_op_I_IALLUIS
   else if (((l__272 = (( 9 : int):ii)))) then Cache_op_I_IALLU
   else Cache_op_I_IVAU))`;


(*val num_of_cache_op_kind : cache_op_kind -> integer*)

val _ = Define `
 ((num_of_cache_op_kind:cache_op_kind -> int) arg_=
    ((case arg_ of
     Cache_op_D_IVAC => (( 0 : int):ii)
   | Cache_op_D_ISW => (( 1 : int):ii)
   | Cache_op_D_CSW => (( 2 : int):ii)
   | Cache_op_D_CISW => (( 3 : int):ii)
   | Cache_op_D_ZVA => (( 4 : int):ii)
   | Cache_op_D_CVAC => (( 5 : int):ii)
   | Cache_op_D_CVAU => (( 6 : int):ii)
   | Cache_op_D_CIVAC => (( 7 : int):ii)
   | Cache_op_I_IALLUIS => (( 8 : int):ii)
   | Cache_op_I_IALLU => (( 9 : int):ii)
   | Cache_op_I_IVAU => (( 10 : int):ii)
   )))`;


(*val not_bit : bitU -> bitU*)

val _ = Define `
 ((not_bit0:bitU -> bitU) b=  (if (((b = B1))) then B0 else B1))`;






(*val string_of_bit : bitU -> string*)

val _ = Define `
 ((string_of_bit:bitU -> string) b=  ((case b of   B0 => "0b0" | B1 => "0b1" )))`;


(*val get_config_print_instr : unit -> bool*)

(*val get_config_print_reg : unit -> bool*)

(*val get_config_print_mem : unit -> bool*)

(*val get_config_print_platform : unit -> bool*)

val _ = Define `
 ((get_config_print_instr:unit -> bool) () =  F)`;


val _ = Define `
 ((get_config_print_reg:unit -> bool) () =  F)`;


val _ = Define `
 ((get_config_print_mem:unit -> bool) () =  F)`;


val _ = Define `
 ((get_config_print_platform:unit -> bool) () =  F)`;


(*val EXTS : forall 'm 'n. Size 'm, Size 'n => integer -> mword 'n -> mword 'm*)

(*val EXTZ : forall 'm 'n. Size 'm, Size 'n => integer -> mword 'n -> mword 'm*)

val _ = Define `
 ((EXTS:int -> 'n words$word -> 'm words$word) m v=  ((sign_extend v m  :  'm words$word)))`;


val _ = Define `
 ((EXTZ:int -> 'n words$word -> 'm words$word) m v=  ((zero_extend v m  :  'm words$word)))`;


(*val zeros_implicit : forall 'n. Size 'n => integer -> mword 'n*)

val _ = Define `
 ((zeros_implicit:int -> 'n words$word) n=  ((zeros n  :  'n words$word)))`;


(*val ones : forall 'n. Size 'n => integer -> mword 'n*)

val _ = Define `
 ((ones:int -> 'n words$word) n=  ((sail_ones n  :  'n words$word)))`;


(*val bool_to_bits : bool -> mword ty1*)

val _ = Define `
 ((bool_to_bits:bool ->(1)words$word) x=  (if x then (0b1w :  1 words$word) else (0b0w :  1 words$word)))`;


(*val bit_to_bool : bitU -> bool*)

val _ = Define `
 ((bit_to_bool:bitU -> bool) b=  ((case b of   B1 => T | B0 => F )))`;


(*val to_bits : forall 'l. Size 'l => integer -> ii -> mword 'l*)

val _ = Define `
 ((to_bits:int -> int -> 'l words$word) l n=  ((get_slice_int l n (( 0 : int):ii)  :  'l words$word)))`;


(*val zopz0zI_s : forall 'n. Size 'n => mword 'n -> mword 'n -> bool*)

(*val zopz0zKzJ_s : forall 'n. Size 'n => mword 'n -> mword 'n -> bool*)

(*val zopz0zI_u : forall 'n. Size 'n => mword 'n -> mword 'n -> bool*)

(*val zopz0zKzJ_u : forall 'n. Size 'n => mword 'n -> mword 'n -> bool*)

(*val zopz0zIzJ_u : forall 'n. Size 'n => mword 'n -> mword 'n -> bool*)

val _ = Define `
 ((zopz0zI_s:'n words$word -> 'n words$word -> bool) x y=  (((integer_word$w2i x)) < ((integer_word$w2i y))))`;


val _ = Define `
 ((zopz0zKzJ_s:'n words$word -> 'n words$word -> bool) x y=  (((integer_word$w2i x)) >= ((integer_word$w2i y))))`;


val _ = Define `
 ((zopz0zI_u:'n words$word -> 'n words$word -> bool) x y=  (((lem$w2ui x)) < ((lem$w2ui y))))`;


val _ = Define `
 ((zopz0zKzJ_u:'n words$word -> 'n words$word -> bool) x y=  (((lem$w2ui x)) >= ((lem$w2ui y))))`;


val _ = Define `
 ((zopz0zIzJ_u:'n words$word -> 'n words$word -> bool) x y=  (((lem$w2ui x)) <= ((lem$w2ui y))))`;


(*val shift_right_arith64 : mword ty64 -> mword ty6 -> mword ty64*)

val _ = Define `
 ((shift_right_arith64:(64)words$word ->(6)words$word ->(64)words$word) (v : 64 bits) (shift : 6 bits)=
    (let (v128 : 128 bits) = ((EXTS (( 128 : int):ii) v  :  128 words$word)) in
   (subrange_vec_dec ((shift_bits_right v128 shift  :  128 words$word)) (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)))`;


(*val shift_right_arith32 : mword ty32 -> mword ty5 -> mword ty32*)

val _ = Define `
 ((shift_right_arith32:(32)words$word ->(5)words$word ->(32)words$word) (v : 32 bits) (shift : 5 bits)=
    (let (v64 : 64 bits) = ((EXTS (( 64 : int):ii) v  :  64 words$word)) in
   (subrange_vec_dec ((shift_bits_right v64 shift  :  64 words$word)) (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


(*val spc_forwards : unit -> string*)

(*val spc_backwards : string -> unit*)

(*val spc_forwards_matches : unit -> bool*)

(*val spc_backwards_matches : string -> bool*)

(*val spc_matches_prefix : string -> maybe ((unit * ii))*)

(*val opt_spc_forwards : unit -> string*)

(*val opt_spc_backwards : string -> unit*)

(*val opt_spc_forwards_matches : unit -> bool*)

(*val opt_spc_backwards_matches : string -> bool*)

(*val opt_spc_matches_prefix : string -> maybe ((unit * ii))*)

(*val def_spc_forwards : unit -> string*)

(*val def_spc_backwards : string -> unit*)

(*val def_spc_forwards_matches : unit -> bool*)

(*val def_spc_backwards_matches : string -> bool*)

(*val def_spc_matches_prefix : string -> maybe ((unit * ii))*)

(*val hex_bits_forwards : forall 'n. Size 'n => (integer * mword 'n) -> string*)

(*val hex_bits_backwards : forall 'n. Size 'n => string -> (integer * mword 'n)*)

(*val hex_bits_forwards_matches : forall 'n. Size 'n => (integer * mword 'n) -> bool*)

(*val hex_bits_backwards_matches : string -> bool*)

(*val hex_bits_matches_prefix : forall 'n. Size 'n => string -> maybe (((integer * mword 'n) * ii))*)

(*val n_leading_spaces : string -> ii*)

 val n_leading_spaces0_defn = Hol_defn "n_leading_spaces0" `
 ((n_leading_spaces0:string -> int) s=
    (let p0_ = s in
   if (((p0_ = ""))) then (( 0 : int):ii)
   else
     let p0_ = (string_take s (( 1 : int):ii)) in
     if (((p0_ = " "))) then (( 1 : int):ii) + ((n_leading_spaces0 ((string_drop s (( 1 : int):ii)))))
     else (( 0 : int):ii)))`;

val _ = Lib.with_flag (computeLib.auto_import_definitions, false) Defn.save_defn n_leading_spaces0_defn;

val _ = Define `
 ((spc_forwards:unit -> string) () =  " ")`;


val _ = Define `
 ((spc_backwards:string -> unit) s=  () )`;


val _ = Define `
 ((spc_matches_prefix0:string ->(unit#int)option) s=
    (let n = (n_leading_spaces0 s) in
   let l__271 = n in
   if (((l__271 = (( 0 : int):ii)))) then NONE
   else SOME (() , n)))`;


val _ = Define `
 ((opt_spc_forwards:unit -> string) () =  "")`;


val _ = Define `
 ((opt_spc_backwards:string -> unit) s=  () )`;


val _ = Define `
 ((opt_spc_matches_prefix0:string ->(unit#int)option) s=  (SOME (() , n_leading_spaces0 s)))`;


val _ = Define `
 ((def_spc_forwards:unit -> string) () =  " ")`;


val _ = Define `
 ((def_spc_backwards:string -> unit) s=  () )`;


val _ = Define `
 ((def_spc_matches_prefix:string ->(unit#ii)option) s=  (opt_spc_matches_prefix0 s))`;


(*val hex_bits_1_backwards : string -> M (mword ty1)*)

(*val hex_bits_1_forwards_matches : mword ty1 -> bool*)

(*val hex_bits_1_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_1_forwards_matches:(1)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_1_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_1_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 1 words$word # ii)) option)) of
             SOME ((g__362, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_1_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((1)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_1_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 1 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 49:2 - 51:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 49:2 - 51:3") (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_2_backwards : string -> M (mword ty2)*)

(*val hex_bits_2_forwards_matches : mword ty2 -> bool*)

(*val hex_bits_2_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_2_forwards_matches:(2)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_2_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_2_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 2 words$word # ii)) option)) of
             SOME ((g__361, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_2_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((2)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_2_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 2 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 68:2 - 70:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 68:2 - 70:3") (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_3_backwards : string -> M (mword ty3)*)

(*val hex_bits_3_forwards_matches : mword ty3 -> bool*)

(*val hex_bits_3_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_3_forwards_matches:(3)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_3_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_3_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 3 words$word # ii)) option)) of
             SOME ((g__360, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_3_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((3)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_3_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 3 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 87:2 - 89:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 87:2 - 89:3") (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_4_backwards : string -> M (mword ty4)*)

(*val hex_bits_4_forwards_matches : mword ty4 -> bool*)

(*val hex_bits_4_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_4_forwards_matches:(4)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_4_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_4_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 4 words$word # ii)) option)) of
             SOME ((g__359, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_4_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((4)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_4_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 4 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 106:2 - 108:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 106:2 - 108:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_5_backwards : string -> M (mword ty5)*)

(*val hex_bits_5_forwards_matches : mword ty5 -> bool*)

(*val hex_bits_5_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_5_forwards_matches:(5)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_5_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_5_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 5 words$word # ii)) option)) of
             SOME ((g__358, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_5_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_5_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 5 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 125:2 - 127:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 125:2 - 127:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_6_backwards : string -> M (mword ty6)*)

(*val hex_bits_6_forwards_matches : mword ty6 -> bool*)

(*val hex_bits_6_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_6_forwards_matches:(6)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_6_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_6_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 6 words$word # ii)) option)) of
             SOME ((g__357, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_6_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((6)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_6_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 6 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 144:2 - 146:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 144:2 - 146:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_7_backwards : string -> M (mword ty7)*)

(*val hex_bits_7_forwards_matches : mword ty7 -> bool*)

(*val hex_bits_7_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_7_forwards_matches:(7)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_7_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_7_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 7 words$word # ii)) option)) of
             SOME ((g__356, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_7_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((7)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_7_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 7 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 163:2 - 165:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 163:2 - 165:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_8_backwards : string -> M (mword ty8)*)

(*val hex_bits_8_forwards_matches : mword ty8 -> bool*)

(*val hex_bits_8_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_8_forwards_matches:(8)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_8_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_8_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 8 words$word # ii)) option)) of
             SOME ((g__355, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_8_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((8)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_8_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 8 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 182:2 - 184:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 182:2 - 184:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_9_backwards : string -> M (mword ty9)*)

(*val hex_bits_9_forwards_matches : mword ty9 -> bool*)

(*val hex_bits_9_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_9_forwards_matches:(9)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_9_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_9_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 9 words$word # ii)) option)) of
             SOME ((g__354, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_9_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((9)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_9_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 9 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 201:2 - 203:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 201:2 - 203:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_10_backwards : string -> M (mword ty10)*)

(*val hex_bits_10_forwards_matches : mword ty10 -> bool*)

(*val hex_bits_10_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_10_forwards_matches:(10)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_10_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_10_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 10 words$word # ii)) option)) of
             SOME ((g__353, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_10_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((10)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_10_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 10 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 220:2 - 222:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 220:2 - 222:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_11_backwards : string -> M (mword ty11)*)

(*val hex_bits_11_forwards_matches : mword ty11 -> bool*)

(*val hex_bits_11_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_11_forwards_matches:(11)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_11_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_11_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 11 words$word # ii)) option)) of
             SOME ((g__352, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_11_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((11)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_11_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 11 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 239:2 - 241:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 239:2 - 241:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_12_backwards : string -> M (mword ty12)*)

(*val hex_bits_12_forwards_matches : mword ty12 -> bool*)

(*val hex_bits_12_backwards_matches : string -> bool*)

(*val hex_bits_12_matches_prefix : string -> maybe ((mword ty12 * ii))*)

val _ = Define `
 ((hex_bits_12_forwards_matches:(12)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_12_matches_prefix0:string ->((12)words$word#ii)option) s=  NONE)`;


val _ = Define `
 ((hex_bits_12_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_12_matches_prefix0 s : (( 12 words$word # ii)) option)) of
             SOME ((g__351, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_12_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((12)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_12_matches_prefix0 s  :  (( 12 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 262:2 - 264:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 262:2 - 264:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_13_backwards : string -> M (mword ty13)*)

(*val hex_bits_13_forwards_matches : mword ty13 -> bool*)

(*val hex_bits_13_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_13_forwards_matches:(13)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_13_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_13_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 13 words$word # ii)) option)) of
             SOME ((g__350, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_13_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((13)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_13_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 13 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 281:2 - 283:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 281:2 - 283:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_14_backwards : string -> M (mword ty14)*)

(*val hex_bits_14_forwards_matches : mword ty14 -> bool*)

(*val hex_bits_14_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_14_forwards_matches:(14)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_14_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_14_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 14 words$word # ii)) option)) of
             SOME ((g__349, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_14_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((14)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_14_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 14 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 300:2 - 302:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 300:2 - 302:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_15_backwards : string -> M (mword ty15)*)

(*val hex_bits_15_forwards_matches : mword ty15 -> bool*)

(*val hex_bits_15_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_15_forwards_matches:(15)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_15_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_15_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 15 words$word # ii)) option)) of
             SOME ((g__348, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_15_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((15)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_15_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 15 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 319:2 - 321:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 319:2 - 321:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_16_backwards : string -> M (mword ty16)*)

(*val hex_bits_16_forwards_matches : mword ty16 -> bool*)

(*val hex_bits_16_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_16_forwards_matches:(16)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_16_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_16_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 16 words$word # ii)) option)) of
             SOME ((g__347, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_16_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_16_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 16 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 338:2 - 340:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 338:2 - 340:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_17_backwards : string -> M (mword ty17)*)

(*val hex_bits_17_forwards_matches : mword ty17 -> bool*)

(*val hex_bits_17_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_17_forwards_matches:(17)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_17_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_17_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 17 words$word # ii)) option)) of
             SOME ((g__346, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_17_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((17)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_17_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 17 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 357:2 - 359:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 357:2 - 359:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_18_backwards : string -> M (mword ty18)*)

(*val hex_bits_18_forwards_matches : mword ty18 -> bool*)

(*val hex_bits_18_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_18_forwards_matches:(18)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_18_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_18_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 18 words$word # ii)) option)) of
             SOME ((g__345, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_18_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((18)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_18_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 18 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 376:2 - 378:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 376:2 - 378:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_19_backwards : string -> M (mword ty19)*)

(*val hex_bits_19_forwards_matches : mword ty19 -> bool*)

(*val hex_bits_19_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_19_forwards_matches:(19)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_19_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_19_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 19 words$word # ii)) option)) of
             SOME ((g__344, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_19_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((19)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_19_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 19 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 395:2 - 397:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 395:2 - 397:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_20_backwards : string -> M (mword ty20)*)

(*val hex_bits_20_forwards_matches : mword ty20 -> bool*)

(*val hex_bits_20_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_20_forwards_matches:(20)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_20_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_20_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 20 words$word # ii)) option)) of
             SOME ((g__343, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_20_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((20)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_20_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 20 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 414:2 - 416:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 414:2 - 416:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_21_backwards : string -> M (mword ty21)*)

(*val hex_bits_21_forwards_matches : mword ty21 -> bool*)

(*val hex_bits_21_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_21_forwards_matches:(21)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_21_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_21_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 21 words$word # ii)) option)) of
             SOME ((g__342, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_21_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((21)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_21_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 21 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 433:2 - 435:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 433:2 - 435:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_22_backwards : string -> M (mword ty22)*)

(*val hex_bits_22_forwards_matches : mword ty22 -> bool*)

(*val hex_bits_22_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_22_forwards_matches:(22)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_22_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_22_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 22 words$word # ii)) option)) of
             SOME ((g__341, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_22_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((22)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_22_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 22 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 452:2 - 454:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 452:2 - 454:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_23_backwards : string -> M (mword ty23)*)

(*val hex_bits_23_forwards_matches : mword ty23 -> bool*)

(*val hex_bits_23_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_23_forwards_matches:(23)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_23_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_23_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 23 words$word # ii)) option)) of
             SOME ((g__340, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_23_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((23)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_23_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 23 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 471:2 - 473:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 471:2 - 473:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_24_backwards : string -> M (mword ty24)*)

(*val hex_bits_24_forwards_matches : mword ty24 -> bool*)

(*val hex_bits_24_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_24_forwards_matches:(24)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_24_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_24_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 24 words$word # ii)) option)) of
             SOME ((g__339, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_24_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((24)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_24_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 24 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 490:2 - 492:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 490:2 - 492:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_25_backwards : string -> M (mword ty25)*)

(*val hex_bits_25_forwards_matches : mword ty25 -> bool*)

(*val hex_bits_25_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_25_forwards_matches:(25)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_25_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_25_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 25 words$word # ii)) option)) of
             SOME ((g__338, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_25_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((25)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_25_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 25 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 509:2 - 511:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 509:2 - 511:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_26_backwards : string -> M (mword ty26)*)

(*val hex_bits_26_forwards_matches : mword ty26 -> bool*)

(*val hex_bits_26_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_26_forwards_matches:(26)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_26_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_26_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 26 words$word # ii)) option)) of
             SOME ((g__337, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_26_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((26)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_26_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 26 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 528:2 - 530:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 528:2 - 530:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_27_backwards : string -> M (mword ty27)*)

(*val hex_bits_27_forwards_matches : mword ty27 -> bool*)

(*val hex_bits_27_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_27_forwards_matches:(27)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_27_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_27_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 27 words$word # ii)) option)) of
             SOME ((g__336, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_27_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((27)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_27_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 27 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 547:2 - 549:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 547:2 - 549:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_28_backwards : string -> M (mword ty28)*)

(*val hex_bits_28_forwards_matches : mword ty28 -> bool*)

(*val hex_bits_28_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_28_forwards_matches:(28)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_28_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_28_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 28 words$word # ii)) option)) of
             SOME ((g__335, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_28_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((28)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_28_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 28 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 566:2 - 568:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 566:2 - 568:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_29_backwards : string -> M (mword ty29)*)

(*val hex_bits_29_forwards_matches : mword ty29 -> bool*)

(*val hex_bits_29_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_29_forwards_matches:(29)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_29_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_29_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 29 words$word # ii)) option)) of
             SOME ((g__334, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_29_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((29)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_29_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 29 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 585:2 - 587:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 585:2 - 587:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_30_backwards : string -> M (mword ty30)*)

(*val hex_bits_30_forwards_matches : mword ty30 -> bool*)

(*val hex_bits_30_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_30_forwards_matches:(30)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_30_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_30_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 30 words$word # ii)) option)) of
             SOME ((g__333, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_30_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((30)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_30_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 30 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 604:2 - 606:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 604:2 - 606:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_31_backwards : string -> M (mword ty31)*)

(*val hex_bits_31_forwards_matches : mword ty31 -> bool*)

(*val hex_bits_31_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_31_forwards_matches:(31)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_31_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_31_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 31 words$word # ii)) option)) of
             SOME ((g__332, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_31_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((31)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_31_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 31 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 623:2 - 625:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 623:2 - 625:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_32_backwards : string -> M (mword ty32)*)

(*val hex_bits_32_forwards_matches : mword ty32 -> bool*)

(*val hex_bits_32_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_32_forwards_matches:(32)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_32_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_32_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 32 words$word # ii)) option)) of
             SOME ((g__331, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_32_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_32_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 32 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 642:2 - 644:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 642:2 - 644:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_33_backwards : string -> M (mword ty33)*)

(*val hex_bits_33_forwards_matches : mword ty33 -> bool*)

(*val hex_bits_33_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_33_forwards_matches:(33)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_33_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_33_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 33 words$word # ii)) option)) of
             SOME ((g__330, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_33_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((33)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_33_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 33 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 661:2 - 663:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 661:2 - 663:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_48_backwards : string -> M (mword ty48)*)

(*val hex_bits_48_forwards_matches : mword ty48 -> bool*)

(*val hex_bits_48_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_48_forwards_matches:(48)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_48_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_48_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 48 words$word # ii)) option)) of
             SOME ((g__329, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_48_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((48)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_48_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 48 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 680:2 - 682:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 680:2 - 682:3")
      (sail2_state_monad$exitS () )
   )))`;


(*val hex_bits_64_backwards : string -> M (mword ty64)*)

(*val hex_bits_64_forwards_matches : mword ty64 -> bool*)

(*val hex_bits_64_backwards_matches : string -> bool*)

val _ = Define `
 ((hex_bits_64_forwards_matches:(64)words$word -> bool) bv=  T)`;


val _ = Define `
 ((hex_bits_64_backwards_matches:string -> bool) s= 
  ((case s of
         s =>
   if ((case ((hex_bits_64_matches_prefix
                 instance_Sail2_values_Bitvector_Machine_word_mword_dict 
               s : (( 64 words$word # ii)) option)) of
             SOME ((g__328, n)) =>
       if (((n = ((string_length s))))) then T else F
         | _ => F
       )) then T else F
   )))`;


val _ = Define `
 ((hex_bits_64_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=
    ((case ((hex_bits_64_matches_prefix 
  instance_Sail2_values_Bitvector_Machine_word_mword_dict s  :  (( 64 words$word # ii))option)) of
     SOME ((bv, n)) =>
      if (((n = ((string_length s))))) then sail2_state_monad$returnS bv
      else sail2_state_monad$seqS
        (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 699:2 - 701:3")
        (sail2_state_monad$exitS () )
   | _ => sail2_state_monad$seqS
      (sail2_state_monad$assert_expS F "Pattern match failure at model/prelude_mapping.sail 699:2 - 701:3")
      (sail2_state_monad$exitS () )
   )))`;


val _ = Define `
((default_meta:unit)=  () )`;


(*val __WriteRAM_Meta : mword ty32 -> integer -> unit -> M unit*)

val _ = Define `
 ((WriteRAM_Meta:(32)words$word -> int -> unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) addr width meta=  (sail2_state_monad$returnS () ))`;


(*val __ReadRAM_Meta : mword ty32 -> integer -> M unit*)

val _ = Define `
 ((ReadRAM_Meta:(32)words$word -> int ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) addr width=  (sail2_state_monad$returnS () ))`;




(*val write_ram_ea : write_kind -> mword ty32 -> integer -> M unit*)

val _ = Define `
 ((write_ram_ea:write_kind ->(32)words$word -> int ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) wk addr width=  (sail2_state_monad$returnS () ))`;




(*val __TraceMemoryWrite : forall 'm 'int8_times_n. Size 'm, Size 'int8_times_n => integer -> mword 'm -> mword 'int8_times_n -> unit*)

(*val __TraceMemoryRead : forall 'm 'int8_times_n. Size 'm, Size 'int8_times_n => integer -> mword 'm -> mword 'int8_times_n -> unit*)

val _ = Define `
((init_ext_ptw:unit)=  () )`;


(*val ext_translate_exception : unit -> unit*)

val _ = Define `
 ((ext_translate_exception:unit -> unit) e=  e)`;


(*val ext_exc_type_to_bits : unit -> mword ty8*)

val _ = Define `
 ((ext_exc_type_to_bits:unit ->(8)words$word) e=  ((0x18w :  8 words$word)))`;


(*val num_of_ext_exc_type : unit -> integer*)

val _ = Define `
 ((num_of_ext_exc_type:unit -> int) e=  ((( 24 : int):ii)))`;


(*val ext_exc_type_to_str : unit -> string*)

val _ = Define `
 ((ext_exc_type_to_str:unit -> string) e=  "extension-exception")`;


val _ = Define `
((xlen_val:int)=  ((( 32 : int):ii)))`;


val _ = Define `
((xlen_max_unsigned:int)=  ((( 4294967295 : int):ii)))`;


val _ = Define `
((xlen_max_signed:int)=  ((( 2147483647 : int):ii)))`;


val _ = Define `
((xlen_min_signed:int)=  (((( 0 : int)-( 2147483648 : int)):ii)))`;


(*val regidx_to_regno : mword ty5 -> integer*)

val _ = Define `
 ((regidx_to_regno:(5)words$word -> int) b=
    (let r = (lem$w2ui b) in
   r))`;


(*val creg2reg_idx : mword ty3 -> mword ty5*)

val _ = Define `
 ((creg2reg_idx:(3)words$word ->(5)words$word) creg=  ((concat_vec (0b01w :  2 words$word) creg  :  5 words$word)))`;


val _ = Define `
((zreg:(5)words$word)=  ((0b00000w :  5 words$word)))`;


val _ = Define `
((ra:(5)words$word)=  ((0b00001w :  5 words$word)))`;


val _ = Define `
((sp:(5)words$word)=  ((0b00010w :  5 words$word)))`;


(*val Architecture_of_num : integer -> Architecture*)

val _ = Define `
 ((Architecture_of_num:int -> Architecture) arg_=
    (let l__269 = arg_ in
   if (((l__269 = (( 0 : int):ii)))) then RV32
   else if (((l__269 = (( 1 : int):ii)))) then RV64
   else RV128))`;


(*val num_of_Architecture : Architecture -> integer*)

val _ = Define `
 ((num_of_Architecture:Architecture -> int) arg_=
    ((case arg_ of   RV32 => (( 0 : int):ii) | RV64 => (( 1 : int):ii) | RV128 => (( 2 : int):ii) )))`;


(*val architecture : mword ty2 -> maybe Architecture*)

val _ = Define `
 ((architecture:(2)words$word ->(Architecture)option) a=
    (let b__0 = a in
   if (((b__0 = (0b01w :  2 words$word)))) then SOME RV32
   else if (((b__0 = (0b10w :  2 words$word)))) then SOME RV64
   else if (((b__0 = (0b11w :  2 words$word)))) then SOME RV128
   else NONE))`;


(*val arch_to_bits : Architecture -> mword ty2*)

val _ = Define `
 ((arch_to_bits:Architecture ->(2)words$word) a=
    ((case a of
     RV32 => (0b01w :  2 words$word)
   | RV64 => (0b10w :  2 words$word)
   | RV128 => (0b11w :  2 words$word)
   )))`;


(*val Privilege_of_num : integer -> Privilege*)

val _ = Define `
 ((Privilege_of_num:int -> Privilege) arg_=
    (let l__267 = arg_ in
   if (((l__267 = (( 0 : int):ii)))) then User
   else if (((l__267 = (( 1 : int):ii)))) then Supervisor
   else Machine))`;


(*val num_of_Privilege : Privilege -> integer*)

val _ = Define `
 ((num_of_Privilege:Privilege -> int) arg_=
    ((case arg_ of   User => (( 0 : int):ii) | Supervisor => (( 1 : int):ii) | Machine => (( 2 : int):ii) )))`;


(*val privLevel_to_bits : Privilege -> mword ty2*)

val _ = Define `
 ((privLevel_to_bits:Privilege ->(2)words$word) p=
    ((case p of
     User => (0b00w :  2 words$word)
   | Supervisor => (0b01w :  2 words$word)
   | Machine => (0b11w :  2 words$word)
   )))`;


(*val privLevel_of_bits : mword ty2 -> M Privilege*)

val _ = Define `
 ((privLevel_of_bits:(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Privilege),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) p=
    (let b__0 = p in
   if (((b__0 = (0b00w :  2 words$word)))) then sail2_state_monad$returnS User
   else if (((b__0 = (0b01w :  2 words$word)))) then sail2_state_monad$returnS Supervisor
   else if (((b__0 = (0b11w :  2 words$word)))) then sail2_state_monad$returnS Machine
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_types.sail 78:2 - 82:3") (sail2_state_monad$exitS () )))`;


(*val privLevel_to_str : Privilege -> string*)

val _ = Define `
 ((privLevel_to_str:Privilege -> string) p=  ((case p of   User => "U" | Supervisor => "S" | Machine => "M" )))`;


(*val accessType_to_str : AccessType unit -> string*)

(*val csr_name : mword ty12 -> string*)

(*val exceptionType_to_str : ExceptionType -> string*)

(*val print_insn : ast -> M string*)

(*val ptw_error_to_str : PTW_Error -> string*)

(*val reg_name_abi : mword ty5 -> M string*)

(*val Retired_of_num : integer -> Retired*)

val _ = Define `
 ((Retired_of_num:int -> Retired) arg_=
    (let l__266 = arg_ in
   if (((l__266 = (( 0 : int):ii)))) then RETIRE_SUCCESS
   else RETIRE_FAIL))`;


(*val num_of_Retired : Retired -> integer*)

val _ = Define `
 ((num_of_Retired:Retired -> int) arg_=  ((case arg_ of   RETIRE_SUCCESS => (( 0 : int):ii) | RETIRE_FAIL => (( 1 : int):ii) )))`;


(*val word_width_of_num : integer -> word_width*)

val _ = Define `
 ((word_width_of_num:int -> word_width) arg_=
    (let l__263 = arg_ in
   if (((l__263 = (( 0 : int):ii)))) then BYTE
   else if (((l__263 = (( 1 : int):ii)))) then HALF
   else if (((l__263 = (( 2 : int):ii)))) then WORD
   else DOUBLE))`;


(*val num_of_word_width : word_width -> integer*)

val _ = Define `
 ((num_of_word_width:word_width -> int) arg_=
    ((case arg_ of   BYTE => (( 0 : int):ii) | HALF => (( 1 : int):ii) | WORD => (( 2 : int):ii) | DOUBLE => (( 3 : int):ii) )))`;


(*val InterruptType_of_num : integer -> InterruptType*)

val _ = Define `
 ((InterruptType_of_num:int -> InterruptType) arg_=
    (let l__255 = arg_ in
   if (((l__255 = (( 0 : int):ii)))) then I_U_Software
   else if (((l__255 = (( 1 : int):ii)))) then I_S_Software
   else if (((l__255 = (( 2 : int):ii)))) then I_M_Software
   else if (((l__255 = (( 3 : int):ii)))) then I_U_Timer
   else if (((l__255 = (( 4 : int):ii)))) then I_S_Timer
   else if (((l__255 = (( 5 : int):ii)))) then I_M_Timer
   else if (((l__255 = (( 6 : int):ii)))) then I_U_External
   else if (((l__255 = (( 7 : int):ii)))) then I_S_External
   else I_M_External))`;


(*val num_of_InterruptType : InterruptType -> integer*)

val _ = Define `
 ((num_of_InterruptType:InterruptType -> int) arg_=
    ((case arg_ of
     I_U_Software => (( 0 : int):ii)
   | I_S_Software => (( 1 : int):ii)
   | I_M_Software => (( 2 : int):ii)
   | I_U_Timer => (( 3 : int):ii)
   | I_S_Timer => (( 4 : int):ii)
   | I_M_Timer => (( 5 : int):ii)
   | I_U_External => (( 6 : int):ii)
   | I_S_External => (( 7 : int):ii)
   | I_M_External => (( 8 : int):ii)
   )))`;


(*val interruptType_to_bits : InterruptType -> mword ty8*)

val _ = Define `
 ((interruptType_to_bits:InterruptType ->(8)words$word) i=
    ((case i of
     I_U_Software => (0x00w :  8 words$word)
   | I_S_Software => (0x01w :  8 words$word)
   | I_M_Software => (0x03w :  8 words$word)
   | I_U_Timer => (0x04w :  8 words$word)
   | I_S_Timer => (0x05w :  8 words$word)
   | I_M_Timer => (0x07w :  8 words$word)
   | I_U_External => (0x08w :  8 words$word)
   | I_S_External => (0x09w :  8 words$word)
   | I_M_External => (0x0Bw :  8 words$word)
   )))`;


(*val exceptionType_to_bits : ExceptionType -> mword ty8*)

val _ = Define `
 ((exceptionType_to_bits:ExceptionType ->(8)words$word) e=
    ((case e of
     E_Fetch_Addr_Align (() ) => (0x00w :  8 words$word)
   | E_Fetch_Access_Fault (() ) => (0x01w :  8 words$word)
   | E_Illegal_Instr (() ) => (0x02w :  8 words$word)
   | E_Breakpoint (() ) => (0x03w :  8 words$word)
   | E_Load_Addr_Align (() ) => (0x04w :  8 words$word)
   | E_Load_Access_Fault (() ) => (0x05w :  8 words$word)
   | E_SAMO_Addr_Align (() ) => (0x06w :  8 words$word)
   | E_SAMO_Access_Fault (() ) => (0x07w :  8 words$word)
   | E_U_EnvCall (() ) => (0x08w :  8 words$word)
   | E_S_EnvCall (() ) => (0x09w :  8 words$word)
   | E_Reserved_10 (() ) => (0x0Aw :  8 words$word)
   | E_M_EnvCall (() ) => (0x0Bw :  8 words$word)
   | E_Fetch_Page_Fault (() ) => (0x0Cw :  8 words$word)
   | E_Load_Page_Fault (() ) => (0x0Dw :  8 words$word)
   | E_Reserved_14 (() ) => (0x0Ew :  8 words$word)
   | E_SAMO_Page_Fault (() ) => (0x0Fw :  8 words$word)
   | E_Extension (e) => (ext_exc_type_to_bits e  :  8 words$word)
   )))`;


(*val num_of_ExceptionType : ExceptionType -> integer*)

val _ = Define `
 ((num_of_ExceptionType:ExceptionType -> int) e=
    ((case e of
     E_Fetch_Addr_Align (() ) => (( 0 : int):ii)
   | E_Fetch_Access_Fault (() ) => (( 1 : int):ii)
   | E_Illegal_Instr (() ) => (( 2 : int):ii)
   | E_Breakpoint (() ) => (( 3 : int):ii)
   | E_Load_Addr_Align (() ) => (( 4 : int):ii)
   | E_Load_Access_Fault (() ) => (( 5 : int):ii)
   | E_SAMO_Addr_Align (() ) => (( 6 : int):ii)
   | E_SAMO_Access_Fault (() ) => (( 7 : int):ii)
   | E_U_EnvCall (() ) => (( 8 : int):ii)
   | E_S_EnvCall (() ) => (( 9 : int):ii)
   | E_Reserved_10 (() ) => (( 10 : int):ii)
   | E_M_EnvCall (() ) => (( 11 : int):ii)
   | E_Fetch_Page_Fault (() ) => (( 12 : int):ii)
   | E_Load_Page_Fault (() ) => (( 13 : int):ii)
   | E_Reserved_14 (() ) => (( 14 : int):ii)
   | E_SAMO_Page_Fault (() ) => (( 15 : int):ii)
   | E_Extension (e) => num_of_ext_exc_type e
   )))`;


val _ = Define `
 ((exceptionType_to_str:ExceptionType -> string) e=
    ((case e of
     E_Fetch_Addr_Align (() ) => "misaligned-fetch"
   | E_Fetch_Access_Fault (() ) => "fetch-access-fault"
   | E_Illegal_Instr (() ) => "illegal-instruction"
   | E_Breakpoint (() ) => "breakpoint"
   | E_Load_Addr_Align (() ) => "misaligned-load"
   | E_Load_Access_Fault (() ) => "load-access-fault"
   | E_SAMO_Addr_Align (() ) => "misaliged-store/amo"
   | E_SAMO_Access_Fault (() ) => "store/amo-access-fault"
   | E_U_EnvCall (() ) => "u-call"
   | E_S_EnvCall (() ) => "s-call"
   | E_Reserved_10 (() ) => "reserved-0"
   | E_M_EnvCall (() ) => "m-call"
   | E_Fetch_Page_Fault (() ) => "fetch-page-fault"
   | E_Load_Page_Fault (() ) => "load-page-fault"
   | E_Reserved_14 (() ) => "reserved-1"
   | E_SAMO_Page_Fault (() ) => "store/amo-page-fault"
   | E_Extension (e) => ext_exc_type_to_str e
   )))`;


(*val not_implemented : forall 'a. string -> M 'a*)

val _ = Define `
 ((not_implemented:string ->(regstate)sail2_state_monad$sequential_state ->(('a,(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) message=  (sail2_state_monad$throwS (Error_not_implemented message)))`;


(*val internal_error : forall 'a. string -> M 'a*)

val _ = Define `
 ((internal_error:string ->(regstate)sail2_state_monad$sequential_state ->(('a,(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=  (sail2_state_monad$seqS (sail2_state_monad$assert_expS F s) (sail2_state_monad$exitS () )))`;


(*val TrapVectorMode_of_num : integer -> TrapVectorMode*)

val _ = Define `
 ((TrapVectorMode_of_num:int -> TrapVectorMode) arg_=
    (let l__253 = arg_ in
   if (((l__253 = (( 0 : int):ii)))) then TV_Direct
   else if (((l__253 = (( 1 : int):ii)))) then TV_Vector
   else TV_Reserved))`;


(*val num_of_TrapVectorMode : TrapVectorMode -> integer*)

val _ = Define `
 ((num_of_TrapVectorMode:TrapVectorMode -> int) arg_=
    ((case arg_ of   TV_Direct => (( 0 : int):ii) | TV_Vector => (( 1 : int):ii) | TV_Reserved => (( 2 : int):ii) )))`;


(*val trapVectorMode_of_bits : mword ty2 -> TrapVectorMode*)

val _ = Define `
 ((trapVectorMode_of_bits:(2)words$word -> TrapVectorMode) m=
    (let b__0 = m in
   if (((b__0 = (0b00w :  2 words$word)))) then TV_Direct
   else if (((b__0 = (0b01w :  2 words$word)))) then TV_Vector
   else TV_Reserved))`;


(*val ExtStatus_of_num : integer -> ExtStatus*)

val _ = Define `
 ((ExtStatus_of_num:int -> ExtStatus) arg_=
    (let l__250 = arg_ in
   if (((l__250 = (( 0 : int):ii)))) then Off
   else if (((l__250 = (( 1 : int):ii)))) then Initial
   else if (((l__250 = (( 2 : int):ii)))) then Clean
   else Dirty))`;


(*val num_of_ExtStatus : ExtStatus -> integer*)

val _ = Define `
 ((num_of_ExtStatus:ExtStatus -> int) arg_=
    ((case arg_ of   Off => (( 0 : int):ii) | Initial => (( 1 : int):ii) | Clean => (( 2 : int):ii) | Dirty => (( 3 : int):ii) )))`;


(*val extStatus_to_bits : ExtStatus -> mword ty2*)

val _ = Define `
 ((extStatus_to_bits:ExtStatus ->(2)words$word) e=
    ((case e of
     Off => (0b00w :  2 words$word)
   | Initial => (0b01w :  2 words$word)
   | Clean => (0b10w :  2 words$word)
   | Dirty => (0b11w :  2 words$word)
   )))`;


(*val extStatus_of_bits : mword ty2 -> M ExtStatus*)

val _ = Define `
 ((extStatus_of_bits:(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((ExtStatus),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) e=
    (let b__0 = e in
   if (((b__0 = (0b00w :  2 words$word)))) then sail2_state_monad$returnS Off
   else if (((b__0 = (0b01w :  2 words$word)))) then sail2_state_monad$returnS Initial
   else if (((b__0 = (0b10w :  2 words$word)))) then sail2_state_monad$returnS Clean
   else if (((b__0 = (0b11w :  2 words$word)))) then sail2_state_monad$returnS Dirty
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_types.sail 281:2 - 286:3") (sail2_state_monad$exitS () )))`;


(*val SATPMode_of_num : integer -> SATPMode*)

val _ = Define `
 ((SATPMode_of_num:int -> SATPMode) arg_=
    (let l__247 = arg_ in
   if (((l__247 = (( 0 : int):ii)))) then Sbare
   else if (((l__247 = (( 1 : int):ii)))) then Sv32
   else if (((l__247 = (( 2 : int):ii)))) then Sv39
   else Sv48))`;


(*val num_of_SATPMode : SATPMode -> integer*)

val _ = Define `
 ((num_of_SATPMode:SATPMode -> int) arg_=
    ((case arg_ of   Sbare => (( 0 : int):ii) | Sv32 => (( 1 : int):ii) | Sv39 => (( 2 : int):ii) | Sv48 => (( 3 : int):ii) )))`;


(*val satp64Mode_of_bits : Architecture -> mword ty4 -> maybe SATPMode*)

val _ = Define `
 ((satp64Mode_of_bits:Architecture ->(4)words$word ->(SATPMode)option) (a : Architecture) (m : satp_mode)=
    ((case (a, m) of
     (g__327, b__0) =>
      if (((b__0 = (0x0w :  4 words$word)))) then SOME Sbare
      else
        (case (g__327, b__0) of
          (RV32, b__0) =>
           if (((b__0 = (0x1w :  4 words$word)))) then SOME Sv32
           else (case (RV32, b__0) of   (_, _) => NONE )
        | (RV64, b__0) =>
           if (((b__0 = (0x8w :  4 words$word)))) then SOME Sv39
           else if (((b__0 = (0x9w :  4 words$word)))) then SOME Sv48
           else (case (RV64, b__0) of   (_, _) => NONE )
        | (_, _) => NONE
        )
   )))`;


(*val uop_of_num : integer -> uop*)

val _ = Define `
 ((uop_of_num:int -> uop) arg_=
    (let l__246 = arg_ in
   if (((l__246 = (( 0 : int):ii)))) then RISCV_LUI
   else RISCV_AUIPC))`;


(*val num_of_uop : uop -> integer*)

val _ = Define `
 ((num_of_uop:uop -> int) arg_=  ((case arg_ of   RISCV_LUI => (( 0 : int):ii) | RISCV_AUIPC => (( 1 : int):ii) )))`;


(*val bop_of_num : integer -> bop*)

val _ = Define `
 ((bop_of_num:int -> bop) arg_=
    (let l__241 = arg_ in
   if (((l__241 = (( 0 : int):ii)))) then RISCV_BEQ
   else if (((l__241 = (( 1 : int):ii)))) then RISCV_BNE
   else if (((l__241 = (( 2 : int):ii)))) then RISCV_BLT
   else if (((l__241 = (( 3 : int):ii)))) then RISCV_BGE
   else if (((l__241 = (( 4 : int):ii)))) then RISCV_BLTU
   else RISCV_BGEU))`;


(*val num_of_bop : bop -> integer*)

val _ = Define `
 ((num_of_bop:bop -> int) arg_=
    ((case arg_ of
     RISCV_BEQ => (( 0 : int):ii)
   | RISCV_BNE => (( 1 : int):ii)
   | RISCV_BLT => (( 2 : int):ii)
   | RISCV_BGE => (( 3 : int):ii)
   | RISCV_BLTU => (( 4 : int):ii)
   | RISCV_BGEU => (( 5 : int):ii)
   )))`;


(*val iop_of_num : integer -> iop*)

val _ = Define `
 ((iop_of_num:int -> iop) arg_=
    (let l__236 = arg_ in
   if (((l__236 = (( 0 : int):ii)))) then RISCV_ADDI
   else if (((l__236 = (( 1 : int):ii)))) then RISCV_SLTI
   else if (((l__236 = (( 2 : int):ii)))) then RISCV_SLTIU
   else if (((l__236 = (( 3 : int):ii)))) then RISCV_XORI
   else if (((l__236 = (( 4 : int):ii)))) then RISCV_ORI
   else RISCV_ANDI))`;


(*val num_of_iop : iop -> integer*)

val _ = Define `
 ((num_of_iop:iop -> int) arg_=
    ((case arg_ of
     RISCV_ADDI => (( 0 : int):ii)
   | RISCV_SLTI => (( 1 : int):ii)
   | RISCV_SLTIU => (( 2 : int):ii)
   | RISCV_XORI => (( 3 : int):ii)
   | RISCV_ORI => (( 4 : int):ii)
   | RISCV_ANDI => (( 5 : int):ii)
   )))`;


(*val sop_of_num : integer -> sop*)

val _ = Define `
 ((sop_of_num:int -> sop) arg_=
    (let l__234 = arg_ in
   if (((l__234 = (( 0 : int):ii)))) then RISCV_SLLI
   else if (((l__234 = (( 1 : int):ii)))) then RISCV_SRLI
   else RISCV_SRAI))`;


(*val num_of_sop : sop -> integer*)

val _ = Define `
 ((num_of_sop:sop -> int) arg_=
    ((case arg_ of   RISCV_SLLI => (( 0 : int):ii) | RISCV_SRLI => (( 1 : int):ii) | RISCV_SRAI => (( 2 : int):ii) )))`;


(*val rop_of_num : integer -> rop*)

val _ = Define `
 ((rop_of_num:int -> rop) arg_=
    (let l__225 = arg_ in
   if (((l__225 = (( 0 : int):ii)))) then RISCV_ADD
   else if (((l__225 = (( 1 : int):ii)))) then RISCV_SUB
   else if (((l__225 = (( 2 : int):ii)))) then RISCV_SLL
   else if (((l__225 = (( 3 : int):ii)))) then RISCV_SLT
   else if (((l__225 = (( 4 : int):ii)))) then RISCV_SLTU
   else if (((l__225 = (( 5 : int):ii)))) then RISCV_XOR
   else if (((l__225 = (( 6 : int):ii)))) then RISCV_SRL
   else if (((l__225 = (( 7 : int):ii)))) then RISCV_SRA
   else if (((l__225 = (( 8 : int):ii)))) then RISCV_OR
   else RISCV_AND))`;


(*val num_of_rop : rop -> integer*)

val _ = Define `
 ((num_of_rop:rop -> int) arg_=
    ((case arg_ of
     RISCV_ADD => (( 0 : int):ii)
   | RISCV_SUB => (( 1 : int):ii)
   | RISCV_SLL => (( 2 : int):ii)
   | RISCV_SLT => (( 3 : int):ii)
   | RISCV_SLTU => (( 4 : int):ii)
   | RISCV_XOR => (( 5 : int):ii)
   | RISCV_SRL => (( 6 : int):ii)
   | RISCV_SRA => (( 7 : int):ii)
   | RISCV_OR => (( 8 : int):ii)
   | RISCV_AND => (( 9 : int):ii)
   )))`;


(*val ropw_of_num : integer -> ropw*)

val _ = Define `
 ((ropw_of_num:int -> ropw) arg_=
    (let l__221 = arg_ in
   if (((l__221 = (( 0 : int):ii)))) then RISCV_ADDW
   else if (((l__221 = (( 1 : int):ii)))) then RISCV_SUBW
   else if (((l__221 = (( 2 : int):ii)))) then RISCV_SLLW
   else if (((l__221 = (( 3 : int):ii)))) then RISCV_SRLW
   else RISCV_SRAW))`;


(*val num_of_ropw : ropw -> integer*)

val _ = Define `
 ((num_of_ropw:ropw -> int) arg_=
    ((case arg_ of
     RISCV_ADDW => (( 0 : int):ii)
   | RISCV_SUBW => (( 1 : int):ii)
   | RISCV_SLLW => (( 2 : int):ii)
   | RISCV_SRLW => (( 3 : int):ii)
   | RISCV_SRAW => (( 4 : int):ii)
   )))`;


(*val sopw_of_num : integer -> sopw*)

val _ = Define `
 ((sopw_of_num:int -> sopw) arg_=
    (let l__219 = arg_ in
   if (((l__219 = (( 0 : int):ii)))) then RISCV_SLLIW
   else if (((l__219 = (( 1 : int):ii)))) then RISCV_SRLIW
   else RISCV_SRAIW))`;


(*val num_of_sopw : sopw -> integer*)

val _ = Define `
 ((num_of_sopw:sopw -> int) arg_=
    ((case arg_ of   RISCV_SLLIW => (( 0 : int):ii) | RISCV_SRLIW => (( 1 : int):ii) | RISCV_SRAIW => (( 2 : int):ii) )))`;


(*val amoop_of_num : integer -> amoop*)

val _ = Define `
 ((amoop_of_num:int -> amoop) arg_=
    (let l__211 = arg_ in
   if (((l__211 = (( 0 : int):ii)))) then AMOSWAP
   else if (((l__211 = (( 1 : int):ii)))) then AMOADD
   else if (((l__211 = (( 2 : int):ii)))) then AMOXOR
   else if (((l__211 = (( 3 : int):ii)))) then AMOAND
   else if (((l__211 = (( 4 : int):ii)))) then AMOOR
   else if (((l__211 = (( 5 : int):ii)))) then AMOMIN
   else if (((l__211 = (( 6 : int):ii)))) then AMOMAX
   else if (((l__211 = (( 7 : int):ii)))) then AMOMINU
   else AMOMAXU))`;


(*val num_of_amoop : amoop -> integer*)

val _ = Define `
 ((num_of_amoop:amoop -> int) arg_=
    ((case arg_ of
     AMOSWAP => (( 0 : int):ii)
   | AMOADD => (( 1 : int):ii)
   | AMOXOR => (( 2 : int):ii)
   | AMOAND => (( 3 : int):ii)
   | AMOOR => (( 4 : int):ii)
   | AMOMIN => (( 5 : int):ii)
   | AMOMAX => (( 6 : int):ii)
   | AMOMINU => (( 7 : int):ii)
   | AMOMAXU => (( 8 : int):ii)
   )))`;


(*val csrop_of_num : integer -> csrop*)

val _ = Define `
 ((csrop_of_num:int -> csrop) arg_=
    (let l__209 = arg_ in
   if (((l__209 = (( 0 : int):ii)))) then CSRRW
   else if (((l__209 = (( 1 : int):ii)))) then CSRRS
   else CSRRC))`;


(*val num_of_csrop : csrop -> integer*)

val _ = Define `
 ((num_of_csrop:csrop -> int) arg_=  ((case arg_ of   CSRRW => (( 0 : int):ii) | CSRRS => (( 1 : int):ii) | CSRRC => (( 2 : int):ii) )))`;


(*val sep_forwards : unit -> string*)

(*val sep_backwards : string -> M unit*)

(*val sep_forwards_matches : unit -> bool*)

(*val sep_backwards_matches : string -> bool*)

(*val sep_matches_prefix : string -> maybe ((unit * ii))*)

val _ = Define `
 ((sep_forwards:unit -> string) arg_=
    ((case arg_ of
     ()  =>
      string_append ((opt_spc_forwards () ))
        ((string_append "," ((string_append ((def_spc_forwards () )) ""))))
   )))`;


(*val _s0_ : string -> maybe unit*)

val _ = Define `
 ((s0_:string ->(unit)option) s1_0= 
  ((case s1_0 of
         s2_0 =>
   (case ((opt_spc_matches_prefix0 s2_0)) of
         SOME ((() , s3_0)) =>
   let s4_0 = (string_drop s2_0 s3_0) in
   if ((string_startswith s4_0 ",")) then
     (case ((string_drop s4_0 ((string_length ",")))) of
           s5_0 =>
     (case ((def_spc_matches_prefix s5_0)) of
           SOME ((() , s6_0)) =>
     let p0_ = (string_drop s5_0 s6_0) in
     if (((p0_ = ""))) then SOME ()  else NONE
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((sep_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let s7_0 = arg_ in
   if ((case ((s0_ s7_0)) of   SOME (() ) => T | _ => F )) then  
  (case s0_ s7_0 of (SOME (() )) => sail2_state_monad$returnS ()  )
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((sep_forwards_matches:unit -> bool) arg_= 
  ((case arg_ of   ()  => T )))`;


(*val _s8_ : string -> maybe unit*)

val _ = Define `
 ((s8_:string ->(unit)option) s9_0= 
  ((case s9_0 of
         s10_0 =>
   (case ((opt_spc_matches_prefix0 s10_0)) of
         SOME ((() , s11_0)) =>
   let s12_0 = (string_drop s10_0 s11_0) in
   if ((string_startswith s12_0 ",")) then
     (case ((string_drop s12_0 ((string_length ",")))) of
           s13_0 =>
     (case ((def_spc_matches_prefix s13_0)) of
           SOME ((() , s14_0)) =>
     let p0_ = (string_drop s13_0 s14_0) in
     if (((p0_ = ""))) then SOME ()  else NONE
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((sep_backwards_matches:string -> bool) arg_=
    (let s15_0 = arg_ in
   if ((case ((s8_ s15_0)) of   SOME (() ) => T | _ => F )) then  
  (case s8_ s15_0 of (SOME (() )) => T )
   else F))`;


(*val _s16_ : string -> maybe string*)

val _ = Define `
 ((s16_:string ->(string)option) s17_0= 
  ((case s17_0 of
         s18_0 =>
   (case ((opt_spc_matches_prefix0 s18_0)) of
         SOME ((() , s19_0)) =>
   let s20_0 = (string_drop s18_0 s19_0) in
   if ((string_startswith s20_0 ",")) then
     (case ((string_drop s20_0 ((string_length ",")))) of
           s21_0 =>
     (case ((def_spc_matches_prefix s21_0)) of
           SOME ((() , s22_0)) =>
     (case ((string_drop s21_0 s22_0)) of   s_ => SOME s_ )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((sep_matches_prefix:string ->(unit#int)option) arg_=
    (let s23_0 = arg_ in
   if ((case ((s16_ s23_0)) of   SOME (s_) => T | _ => F )) then  
  (case s16_ s23_0 of
      (SOME (s_)) =>
  SOME (() , ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val bool_bits_forwards : bool -> mword ty1*)

(*val bool_bits_backwards : mword ty1 -> M bool*)

(*val bool_bits_forwards_matches : bool -> bool*)

(*val bool_bits_backwards_matches : mword ty1 -> bool*)

val _ = Define `
 ((bool_bits_forwards:bool ->(1)words$word) arg_=
    ((case arg_ of   T => (0b1w :  1 words$word) | F => (0b0w :  1 words$word) )))`;


val _ = Define `
 ((bool_bits_backwards:(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$returnS T
   else if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$returnS F
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bool_bits_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   T => T | F => T )))`;


val _ = Define `
 ((bool_bits_backwards_matches:(1)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then T
   else if (((b__0 = (0b0w :  1 words$word)))) then T
   else F))`;


(*val bool_not_bits_forwards : bool -> mword ty1*)

(*val bool_not_bits_backwards : mword ty1 -> M bool*)

(*val bool_not_bits_forwards_matches : bool -> bool*)

(*val bool_not_bits_backwards_matches : mword ty1 -> bool*)

val _ = Define `
 ((bool_not_bits_forwards:bool ->(1)words$word) arg_=
    ((case arg_ of   T => (0b0w :  1 words$word) | F => (0b1w :  1 words$word) )))`;


val _ = Define `
 ((bool_not_bits_backwards:(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$returnS T
   else if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$returnS F
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bool_not_bits_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   T => T | F => T )))`;


val _ = Define `
 ((bool_not_bits_backwards_matches:(1)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b0w :  1 words$word)))) then T
   else if (((b__0 = (0b1w :  1 words$word)))) then T
   else F))`;


(*val size_bits_forwards : word_width -> mword ty2*)

(*val size_bits_backwards : mword ty2 -> M word_width*)

(*val size_bits_forwards_matches : word_width -> bool*)

(*val size_bits_backwards_matches : mword ty2 -> bool*)

val _ = Define `
 ((size_bits_forwards:word_width ->(2)words$word) arg_=
    ((case arg_ of
     BYTE => (0b00w :  2 words$word)
   | HALF => (0b01w :  2 words$word)
   | WORD => (0b10w :  2 words$word)
   | DOUBLE => (0b11w :  2 words$word)
   )))`;


val _ = Define `
 ((size_bits_backwards:(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((word_width),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00w :  2 words$word)))) then sail2_state_monad$returnS BYTE
   else if (((b__0 = (0b01w :  2 words$word)))) then sail2_state_monad$returnS HALF
   else if (((b__0 = (0b10w :  2 words$word)))) then sail2_state_monad$returnS WORD
   else if (((b__0 = (0b11w :  2 words$word)))) then sail2_state_monad$returnS DOUBLE
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((size_bits_forwards_matches:word_width -> bool) arg_= 
  ((case arg_ of   BYTE => T | HALF => T | WORD => T | DOUBLE => T )))`;


val _ = Define `
 ((size_bits_backwards_matches:(2)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00w :  2 words$word)))) then T
   else if (((b__0 = (0b01w :  2 words$word)))) then T
   else if (((b__0 = (0b10w :  2 words$word)))) then T
   else if (((b__0 = (0b11w :  2 words$word)))) then T
   else F))`;


(*val size_mnemonic_forwards : word_width -> string*)

(*val size_mnemonic_backwards : string -> M word_width*)

(*val size_mnemonic_forwards_matches : word_width -> bool*)

(*val size_mnemonic_backwards_matches : string -> bool*)

(*val size_mnemonic_matches_prefix : string -> maybe ((word_width * ii))*)

val _ = Define `
 ((size_mnemonic_forwards:word_width -> string) arg_=
    ((case arg_ of   BYTE => "b" | HALF => "h" | WORD => "w" | DOUBLE => "d" )))`;


val _ = Define `
 ((size_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((word_width),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "b"))) then sail2_state_monad$returnS BYTE
   else if (((p0_ = "h"))) then sail2_state_monad$returnS HALF
   else if (((p0_ = "w"))) then sail2_state_monad$returnS WORD
   else if (((p0_ = "d"))) then sail2_state_monad$returnS DOUBLE
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((size_mnemonic_forwards_matches:word_width -> bool) arg_= 
  ((case arg_ of   BYTE => T | HALF => T | WORD => T | DOUBLE => T )))`;


val _ = Define `
 ((size_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "b"))) then T
   else if (((p0_ = "h"))) then T
   else if (((p0_ = "w"))) then T
   else if (((p0_ = "d"))) then T
   else F))`;


(*val _s36_ : string -> maybe string*)

val _ = Define `
 ((s36_:string ->(string)option) s37_0=
    (let s38_0 = s37_0 in
   if ((string_startswith s38_0 "d")) then  
  (case ((string_drop s38_0 ((string_length "d")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s32_ : string -> maybe string*)

val _ = Define `
 ((s32_:string ->(string)option) s33_0=
    (let s34_0 = s33_0 in
   if ((string_startswith s34_0 "w")) then  
  (case ((string_drop s34_0 ((string_length "w")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s28_ : string -> maybe string*)

val _ = Define `
 ((s28_:string ->(string)option) s29_0=
    (let s30_0 = s29_0 in
   if ((string_startswith s30_0 "h")) then  
  (case ((string_drop s30_0 ((string_length "h")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s24_ : string -> maybe string*)

val _ = Define `
 ((s24_:string ->(string)option) s25_0=
    (let s26_0 = s25_0 in
   if ((string_startswith s26_0 "b")) then  
  (case ((string_drop s26_0 ((string_length "b")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((size_mnemonic_matches_prefix:string ->(word_width#int)option) arg_=
    (let s27_0 = arg_ in
   if ((case ((s24_ s27_0)) of   SOME (s_) => T | _ => F )) then  
  (case s24_ s27_0 of
      (SOME (s_)) =>
  SOME (BYTE, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s28_ s27_0)) of   SOME (s_) => T | _ => F )) then  
  (case s28_ s27_0 of
      (SOME (s_)) =>
  SOME (HALF, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s32_ s27_0)) of   SOME (s_) => T | _ => F )) then  
  (case s32_ s27_0 of
      (SOME (s_)) =>
  SOME (WORD, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s36_ s27_0)) of   SOME (s_) => T | _ => F )) then  
  (case s36_ s27_0 of
      (SOME (s_)) =>
  SOME (DOUBLE, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val word_width_bytes : word_width -> integer*)

val _ = Define `
 ((word_width_bytes:word_width -> int) width=
    ((case width of   BYTE => (( 1 : int):ii) | HALF => (( 2 : int):ii) | WORD => (( 4 : int):ii) | DOUBLE => (( 8 : int):ii) )))`;


val _ = Define `
((Data:unit)=  () )`;


val _ = Define `
((default_write_acc:unit)=  () )`;


val _ = Define `
 ((accessType_to_str:(unit)AccessType -> string) a=
    ((case a of
     Read (_) => "R"
   | Write (_) => "W"
   | ReadWrite ((_, _)) => "RW"
   | Execute (() ) => "X"
   )))`;


val _ = Define `
((zero_reg:(32)words$word)=  ((0x00000000w :  32 words$word)))`;


(*val RegStr : mword ty32 -> string*)

val _ = Define `
 ((RegStr:(32)words$word -> string) r=  (string_of_bits r))`;


(*val regval_from_reg : mword ty32 -> mword ty32*)

val _ = Define `
 ((regval_from_reg:(32)words$word ->(32)words$word) r=  r)`;


(*val regval_into_reg : mword ty32 -> mword ty32*)

val _ = Define `
 ((regval_into_reg:(32)words$word ->(32)words$word) v=  v)`;


val _ = Define `
((zero_freg:(32)words$word)=  ((0x00000000w :  32 words$word)))`;


(*val FRegStr : mword ty32 -> string*)

val _ = Define `
 ((FRegStr:(32)words$word -> string) r=  (string_of_bits r))`;


(*val fregval_from_freg : mword ty32 -> mword ty32*)

val _ = Define `
 ((fregval_from_freg:(32)words$word ->(32)words$word) r=  r)`;


(*val fregval_into_freg : mword ty32 -> mword ty32*)

val _ = Define `
 ((fregval_into_freg:(32)words$word ->(32)words$word) v=  v)`;


(*val rounding_mode_of_num : integer -> rounding_mode*)

val _ = Define `
 ((rounding_mode_of_num:int -> rounding_mode) arg_=
    (let l__204 = arg_ in
   if (((l__204 = (( 0 : int):ii)))) then RM_RNE
   else if (((l__204 = (( 1 : int):ii)))) then RM_RTZ
   else if (((l__204 = (( 2 : int):ii)))) then RM_RDN
   else if (((l__204 = (( 3 : int):ii)))) then RM_RUP
   else if (((l__204 = (( 4 : int):ii)))) then RM_RMM
   else RM_DYN))`;


(*val num_of_rounding_mode : rounding_mode -> integer*)

val _ = Define `
 ((num_of_rounding_mode:rounding_mode -> int) arg_=
    ((case arg_ of
     RM_RNE => (( 0 : int):ii)
   | RM_RTZ => (( 1 : int):ii)
   | RM_RDN => (( 2 : int):ii)
   | RM_RUP => (( 3 : int):ii)
   | RM_RMM => (( 4 : int):ii)
   | RM_DYN => (( 5 : int):ii)
   )))`;


(*val f_madd_op_S_of_num : integer -> f_madd_op_S*)

val _ = Define `
 ((f_madd_op_S_of_num:int -> f_madd_op_S) arg_=
    (let l__201 = arg_ in
   if (((l__201 = (( 0 : int):ii)))) then FMADD_S
   else if (((l__201 = (( 1 : int):ii)))) then FMSUB_S
   else if (((l__201 = (( 2 : int):ii)))) then FNMSUB_S
   else FNMADD_S))`;


(*val num_of_f_madd_op_S : f_madd_op_S -> integer*)

val _ = Define `
 ((num_of_f_madd_op_S:f_madd_op_S -> int) arg_=
    ((case arg_ of
     FMADD_S => (( 0 : int):ii)
   | FMSUB_S => (( 1 : int):ii)
   | FNMSUB_S => (( 2 : int):ii)
   | FNMADD_S => (( 3 : int):ii)
   )))`;


(*val f_bin_rm_op_S_of_num : integer -> f_bin_rm_op_S*)

val _ = Define `
 ((f_bin_rm_op_S_of_num:int -> f_bin_rm_op_S) arg_=
    (let l__198 = arg_ in
   if (((l__198 = (( 0 : int):ii)))) then FADD_S
   else if (((l__198 = (( 1 : int):ii)))) then FSUB_S
   else if (((l__198 = (( 2 : int):ii)))) then FMUL_S
   else FDIV_S))`;


(*val num_of_f_bin_rm_op_S : f_bin_rm_op_S -> integer*)

val _ = Define `
 ((num_of_f_bin_rm_op_S:f_bin_rm_op_S -> int) arg_=
    ((case arg_ of   FADD_S => (( 0 : int):ii) | FSUB_S => (( 1 : int):ii) | FMUL_S => (( 2 : int):ii) | FDIV_S => (( 3 : int):ii) )))`;


(*val f_un_rm_op_S_of_num : integer -> f_un_rm_op_S*)

val _ = Define `
 ((f_un_rm_op_S_of_num:int -> f_un_rm_op_S) arg_=
    (let l__190 = arg_ in
   if (((l__190 = (( 0 : int):ii)))) then FSQRT_S
   else if (((l__190 = (( 1 : int):ii)))) then FCVT_W_S
   else if (((l__190 = (( 2 : int):ii)))) then FCVT_WU_S
   else if (((l__190 = (( 3 : int):ii)))) then FCVT_S_W
   else if (((l__190 = (( 4 : int):ii)))) then FCVT_S_WU
   else if (((l__190 = (( 5 : int):ii)))) then FCVT_L_S
   else if (((l__190 = (( 6 : int):ii)))) then FCVT_LU_S
   else if (((l__190 = (( 7 : int):ii)))) then FCVT_S_L
   else FCVT_S_LU))`;


(*val num_of_f_un_rm_op_S : f_un_rm_op_S -> integer*)

val _ = Define `
 ((num_of_f_un_rm_op_S:f_un_rm_op_S -> int) arg_=
    ((case arg_ of
     FSQRT_S => (( 0 : int):ii)
   | FCVT_W_S => (( 1 : int):ii)
   | FCVT_WU_S => (( 2 : int):ii)
   | FCVT_S_W => (( 3 : int):ii)
   | FCVT_S_WU => (( 4 : int):ii)
   | FCVT_L_S => (( 5 : int):ii)
   | FCVT_LU_S => (( 6 : int):ii)
   | FCVT_S_L => (( 7 : int):ii)
   | FCVT_S_LU => (( 8 : int):ii)
   )))`;


(*val f_un_op_S_of_num : integer -> f_un_op_S*)

val _ = Define `
 ((f_un_op_S_of_num:int -> f_un_op_S) arg_=
    (let l__188 = arg_ in
   if (((l__188 = (( 0 : int):ii)))) then FCLASS_S
   else if (((l__188 = (( 1 : int):ii)))) then FMV_X_W
   else FMV_W_X))`;


(*val num_of_f_un_op_S : f_un_op_S -> integer*)

val _ = Define `
 ((num_of_f_un_op_S:f_un_op_S -> int) arg_=
    ((case arg_ of   FCLASS_S => (( 0 : int):ii) | FMV_X_W => (( 1 : int):ii) | FMV_W_X => (( 2 : int):ii) )))`;


(*val f_bin_op_S_of_num : integer -> f_bin_op_S*)

val _ = Define `
 ((f_bin_op_S_of_num:int -> f_bin_op_S) arg_=
    (let l__181 = arg_ in
   if (((l__181 = (( 0 : int):ii)))) then FSGNJ_S
   else if (((l__181 = (( 1 : int):ii)))) then FSGNJN_S
   else if (((l__181 = (( 2 : int):ii)))) then FSGNJX_S
   else if (((l__181 = (( 3 : int):ii)))) then FMIN_S
   else if (((l__181 = (( 4 : int):ii)))) then FMAX_S
   else if (((l__181 = (( 5 : int):ii)))) then FEQ_S
   else if (((l__181 = (( 6 : int):ii)))) then FLT_S
   else FLE_S))`;


(*val num_of_f_bin_op_S : f_bin_op_S -> integer*)

val _ = Define `
 ((num_of_f_bin_op_S:f_bin_op_S -> int) arg_=
    ((case arg_ of
     FSGNJ_S => (( 0 : int):ii)
   | FSGNJN_S => (( 1 : int):ii)
   | FSGNJX_S => (( 2 : int):ii)
   | FMIN_S => (( 3 : int):ii)
   | FMAX_S => (( 4 : int):ii)
   | FEQ_S => (( 5 : int):ii)
   | FLT_S => (( 6 : int):ii)
   | FLE_S => (( 7 : int):ii)
   )))`;


(*val f_madd_op_D_of_num : integer -> f_madd_op_D*)

val _ = Define `
 ((f_madd_op_D_of_num:int -> f_madd_op_D) arg_=
    (let l__178 = arg_ in
   if (((l__178 = (( 0 : int):ii)))) then FMADD_D
   else if (((l__178 = (( 1 : int):ii)))) then FMSUB_D
   else if (((l__178 = (( 2 : int):ii)))) then FNMSUB_D
   else FNMADD_D))`;


(*val num_of_f_madd_op_D : f_madd_op_D -> integer*)

val _ = Define `
 ((num_of_f_madd_op_D:f_madd_op_D -> int) arg_=
    ((case arg_ of
     FMADD_D => (( 0 : int):ii)
   | FMSUB_D => (( 1 : int):ii)
   | FNMSUB_D => (( 2 : int):ii)
   | FNMADD_D => (( 3 : int):ii)
   )))`;


(*val f_bin_rm_op_D_of_num : integer -> f_bin_rm_op_D*)

val _ = Define `
 ((f_bin_rm_op_D_of_num:int -> f_bin_rm_op_D) arg_=
    (let l__175 = arg_ in
   if (((l__175 = (( 0 : int):ii)))) then FADD_D
   else if (((l__175 = (( 1 : int):ii)))) then FSUB_D
   else if (((l__175 = (( 2 : int):ii)))) then FMUL_D
   else FDIV_D))`;


(*val num_of_f_bin_rm_op_D : f_bin_rm_op_D -> integer*)

val _ = Define `
 ((num_of_f_bin_rm_op_D:f_bin_rm_op_D -> int) arg_=
    ((case arg_ of   FADD_D => (( 0 : int):ii) | FSUB_D => (( 1 : int):ii) | FMUL_D => (( 2 : int):ii) | FDIV_D => (( 3 : int):ii) )))`;


(*val f_un_rm_op_D_of_num : integer -> f_un_rm_op_D*)

val _ = Define `
 ((f_un_rm_op_D_of_num:int -> f_un_rm_op_D) arg_=
    (let l__165 = arg_ in
   if (((l__165 = (( 0 : int):ii)))) then FSQRT_D
   else if (((l__165 = (( 1 : int):ii)))) then FCVT_W_D
   else if (((l__165 = (( 2 : int):ii)))) then FCVT_WU_D
   else if (((l__165 = (( 3 : int):ii)))) then FCVT_D_W
   else if (((l__165 = (( 4 : int):ii)))) then FCVT_D_WU
   else if (((l__165 = (( 5 : int):ii)))) then FCVT_S_D
   else if (((l__165 = (( 6 : int):ii)))) then FCVT_D_S
   else if (((l__165 = (( 7 : int):ii)))) then FCVT_L_D
   else if (((l__165 = (( 8 : int):ii)))) then FCVT_LU_D
   else if (((l__165 = (( 9 : int):ii)))) then FCVT_D_L
   else FCVT_D_LU))`;


(*val num_of_f_un_rm_op_D : f_un_rm_op_D -> integer*)

val _ = Define `
 ((num_of_f_un_rm_op_D:f_un_rm_op_D -> int) arg_=
    ((case arg_ of
     FSQRT_D => (( 0 : int):ii)
   | FCVT_W_D => (( 1 : int):ii)
   | FCVT_WU_D => (( 2 : int):ii)
   | FCVT_D_W => (( 3 : int):ii)
   | FCVT_D_WU => (( 4 : int):ii)
   | FCVT_S_D => (( 5 : int):ii)
   | FCVT_D_S => (( 6 : int):ii)
   | FCVT_L_D => (( 7 : int):ii)
   | FCVT_LU_D => (( 8 : int):ii)
   | FCVT_D_L => (( 9 : int):ii)
   | FCVT_D_LU => (( 10 : int):ii)
   )))`;


(*val f_bin_op_D_of_num : integer -> f_bin_op_D*)

val _ = Define `
 ((f_bin_op_D_of_num:int -> f_bin_op_D) arg_=
    (let l__158 = arg_ in
   if (((l__158 = (( 0 : int):ii)))) then FSGNJ_D
   else if (((l__158 = (( 1 : int):ii)))) then FSGNJN_D
   else if (((l__158 = (( 2 : int):ii)))) then FSGNJX_D
   else if (((l__158 = (( 3 : int):ii)))) then FMIN_D
   else if (((l__158 = (( 4 : int):ii)))) then FMAX_D
   else if (((l__158 = (( 5 : int):ii)))) then FEQ_D
   else if (((l__158 = (( 6 : int):ii)))) then FLT_D
   else FLE_D))`;


(*val num_of_f_bin_op_D : f_bin_op_D -> integer*)

val _ = Define `
 ((num_of_f_bin_op_D:f_bin_op_D -> int) arg_=
    ((case arg_ of
     FSGNJ_D => (( 0 : int):ii)
   | FSGNJN_D => (( 1 : int):ii)
   | FSGNJX_D => (( 2 : int):ii)
   | FMIN_D => (( 3 : int):ii)
   | FMAX_D => (( 4 : int):ii)
   | FEQ_D => (( 5 : int):ii)
   | FLT_D => (( 6 : int):ii)
   | FLE_D => (( 7 : int):ii)
   )))`;


(*val f_un_op_D_of_num : integer -> f_un_op_D*)

val _ = Define `
 ((f_un_op_D_of_num:int -> f_un_op_D) arg_=
    (let l__156 = arg_ in
   if (((l__156 = (( 0 : int):ii)))) then FCLASS_D
   else if (((l__156 = (( 1 : int):ii)))) then FMV_X_D
   else FMV_D_X))`;


(*val num_of_f_un_op_D : f_un_op_D -> integer*)

val _ = Define `
 ((num_of_f_un_op_D:f_un_op_D -> int) arg_=
    ((case arg_ of   FCLASS_D => (( 0 : int):ii) | FMV_X_D => (( 1 : int):ii) | FMV_D_X => (( 2 : int):ii) )))`;


(*val rX : integer -> M (mword ty32)*)

val _ = Define `
 ((rX:int ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r=
    (let l__124 = r in sail2_state_monad$bindS
   (if (((l__124 = (( 0 : int):ii)))) then sail2_state_monad$returnS zero_reg
    else if (((l__124 = (( 1 : int):ii)))) then (sail2_state_monad$read_regS x1_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 2 : int):ii)))) then (sail2_state_monad$read_regS x2_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 3 : int):ii)))) then (sail2_state_monad$read_regS x3_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 4 : int):ii)))) then (sail2_state_monad$read_regS x4_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 5 : int):ii)))) then (sail2_state_monad$read_regS x5_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 6 : int):ii)))) then (sail2_state_monad$read_regS x6_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 7 : int):ii)))) then (sail2_state_monad$read_regS x7_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 8 : int):ii)))) then (sail2_state_monad$read_regS x8_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 9 : int):ii)))) then (sail2_state_monad$read_regS x9_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 10 : int):ii)))) then (sail2_state_monad$read_regS x10_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 11 : int):ii)))) then (sail2_state_monad$read_regS x11_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 12 : int):ii)))) then (sail2_state_monad$read_regS x12_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 13 : int):ii)))) then (sail2_state_monad$read_regS x13_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 14 : int):ii)))) then (sail2_state_monad$read_regS x14_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 15 : int):ii)))) then (sail2_state_monad$read_regS x15_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 16 : int):ii)))) then (sail2_state_monad$read_regS x16_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 17 : int):ii)))) then (sail2_state_monad$read_regS x17_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 18 : int):ii)))) then (sail2_state_monad$read_regS x18_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 19 : int):ii)))) then (sail2_state_monad$read_regS x19_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 20 : int):ii)))) then (sail2_state_monad$read_regS x20_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 21 : int):ii)))) then (sail2_state_monad$read_regS x21_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 22 : int):ii)))) then (sail2_state_monad$read_regS x22_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 23 : int):ii)))) then (sail2_state_monad$read_regS x23_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 24 : int):ii)))) then (sail2_state_monad$read_regS x24_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 25 : int):ii)))) then (sail2_state_monad$read_regS x25_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 26 : int):ii)))) then (sail2_state_monad$read_regS x26_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 27 : int):ii)))) then (sail2_state_monad$read_regS x27_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 28 : int):ii)))) then (sail2_state_monad$read_regS x28_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 29 : int):ii)))) then (sail2_state_monad$read_regS x29_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 30 : int):ii)))) then (sail2_state_monad$read_regS x30_ref  : ( 32 words$word) M)
    else if (((l__124 = (( 31 : int):ii)))) then (sail2_state_monad$read_regS x31_ref  : ( 32 words$word) M)
    else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "invalid register number") (sail2_state_monad$exitS () )) (\ (v : regtype) . 
   sail2_state_monad$returnS ((regval_from_reg v  :  32 words$word)))))`;


(*val rvfi_wX : integer -> mword ty32 -> unit*)

val _ = Define `
 ((rvfi_wX:int ->(32)words$word -> unit) r v=  () )`;


(*val wX : integer -> mword ty32 -> M unit*)

val _ = Define `
 ((wX:int ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r in_v=
    (let v = ((regval_into_reg in_v  :  32 words$word)) in
   let l__92 = r in sail2_state_monad$seqS
   (if (((l__92 = (( 0 : int):ii)))) then sail2_state_monad$returnS () 
    else if (((l__92 = (( 1 : int):ii)))) then sail2_state_monad$write_regS x1_ref v
    else if (((l__92 = (( 2 : int):ii)))) then sail2_state_monad$write_regS x2_ref v
    else if (((l__92 = (( 3 : int):ii)))) then sail2_state_monad$write_regS x3_ref v
    else if (((l__92 = (( 4 : int):ii)))) then sail2_state_monad$write_regS x4_ref v
    else if (((l__92 = (( 5 : int):ii)))) then sail2_state_monad$write_regS x5_ref v
    else if (((l__92 = (( 6 : int):ii)))) then sail2_state_monad$write_regS x6_ref v
    else if (((l__92 = (( 7 : int):ii)))) then sail2_state_monad$write_regS x7_ref v
    else if (((l__92 = (( 8 : int):ii)))) then sail2_state_monad$write_regS x8_ref v
    else if (((l__92 = (( 9 : int):ii)))) then sail2_state_monad$write_regS x9_ref v
    else if (((l__92 = (( 10 : int):ii)))) then sail2_state_monad$write_regS x10_ref v
    else if (((l__92 = (( 11 : int):ii)))) then sail2_state_monad$write_regS x11_ref v
    else if (((l__92 = (( 12 : int):ii)))) then sail2_state_monad$write_regS x12_ref v
    else if (((l__92 = (( 13 : int):ii)))) then sail2_state_monad$write_regS x13_ref v
    else if (((l__92 = (( 14 : int):ii)))) then sail2_state_monad$write_regS x14_ref v
    else if (((l__92 = (( 15 : int):ii)))) then sail2_state_monad$write_regS x15_ref v
    else if (((l__92 = (( 16 : int):ii)))) then sail2_state_monad$write_regS x16_ref v
    else if (((l__92 = (( 17 : int):ii)))) then sail2_state_monad$write_regS x17_ref v
    else if (((l__92 = (( 18 : int):ii)))) then sail2_state_monad$write_regS x18_ref v
    else if (((l__92 = (( 19 : int):ii)))) then sail2_state_monad$write_regS x19_ref v
    else if (((l__92 = (( 20 : int):ii)))) then sail2_state_monad$write_regS x20_ref v
    else if (((l__92 = (( 21 : int):ii)))) then sail2_state_monad$write_regS x21_ref v
    else if (((l__92 = (( 22 : int):ii)))) then sail2_state_monad$write_regS x22_ref v
    else if (((l__92 = (( 23 : int):ii)))) then sail2_state_monad$write_regS x23_ref v
    else if (((l__92 = (( 24 : int):ii)))) then sail2_state_monad$write_regS x24_ref v
    else if (((l__92 = (( 25 : int):ii)))) then sail2_state_monad$write_regS x25_ref v
    else if (((l__92 = (( 26 : int):ii)))) then sail2_state_monad$write_regS x26_ref v
    else if (((l__92 = (( 27 : int):ii)))) then sail2_state_monad$write_regS x27_ref v
    else if (((l__92 = (( 28 : int):ii)))) then sail2_state_monad$write_regS x28_ref v
    else if (((l__92 = (( 29 : int):ii)))) then sail2_state_monad$write_regS x29_ref v
    else if (((l__92 = (( 30 : int):ii)))) then sail2_state_monad$write_regS x30_ref v
    else if (((l__92 = (( 31 : int):ii)))) then sail2_state_monad$write_regS x31_ref v
    else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "invalid register number") (sail2_state_monad$exitS () ))
   (sail2_state_monad$returnS (if (((r <> (( 0 : int):ii)))) then
             let (_ : unit) = (rvfi_wX r in_v) in
             if ((get_config_print_reg () )) then
               print_dbg
                 ((STRCAT "x"
                     ((STRCAT ((stringFromInteger r)) ((STRCAT " <- " ((RegStr v))))))))
             else () 
           else () ))))`;


(*val rX_bits : mword ty5 -> M (mword ty32)*)

val _ = Define `
 ((rX_bits:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) i=  ((rX ((lem$w2ui i))  : ( 32 words$word) M)))`;


(*val wX_bits : mword ty5 -> mword ty32 -> M unit*)

val _ = Define `
 ((wX_bits:(5)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (i : 5 bits) (data : xlenbits)=  (wX ((lem$w2ui i)) data))`;


val _ = Define `
 ((reg_name_abi:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r=
    (let b__0 = r in
   if (((b__0 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS "zero"
   else if (((b__0 = (0b00001w :  5 words$word)))) then sail2_state_monad$returnS "ra"
   else if (((b__0 = (0b00010w :  5 words$word)))) then sail2_state_monad$returnS "sp"
   else if (((b__0 = (0b00011w :  5 words$word)))) then sail2_state_monad$returnS "gp"
   else if (((b__0 = (0b00100w :  5 words$word)))) then sail2_state_monad$returnS "tp"
   else if (((b__0 = (0b00101w :  5 words$word)))) then sail2_state_monad$returnS "t0"
   else if (((b__0 = (0b00110w :  5 words$word)))) then sail2_state_monad$returnS "t1"
   else if (((b__0 = (0b00111w :  5 words$word)))) then sail2_state_monad$returnS "t2"
   else if (((b__0 = (0b01000w :  5 words$word)))) then sail2_state_monad$returnS "fp"
   else if (((b__0 = (0b01001w :  5 words$word)))) then sail2_state_monad$returnS "s1"
   else if (((b__0 = (0b01010w :  5 words$word)))) then sail2_state_monad$returnS "a0"
   else if (((b__0 = (0b01011w :  5 words$word)))) then sail2_state_monad$returnS "a1"
   else if (((b__0 = (0b01100w :  5 words$word)))) then sail2_state_monad$returnS "a2"
   else if (((b__0 = (0b01101w :  5 words$word)))) then sail2_state_monad$returnS "a3"
   else if (((b__0 = (0b01110w :  5 words$word)))) then sail2_state_monad$returnS "a4"
   else if (((b__0 = (0b01111w :  5 words$word)))) then sail2_state_monad$returnS "a5"
   else if (((b__0 = (0b10000w :  5 words$word)))) then sail2_state_monad$returnS "a6"
   else if (((b__0 = (0b10001w :  5 words$word)))) then sail2_state_monad$returnS "a7"
   else if (((b__0 = (0b10010w :  5 words$word)))) then sail2_state_monad$returnS "s2"
   else if (((b__0 = (0b10011w :  5 words$word)))) then sail2_state_monad$returnS "s3"
   else if (((b__0 = (0b10100w :  5 words$word)))) then sail2_state_monad$returnS "s4"
   else if (((b__0 = (0b10101w :  5 words$word)))) then sail2_state_monad$returnS "s5"
   else if (((b__0 = (0b10110w :  5 words$word)))) then sail2_state_monad$returnS "s6"
   else if (((b__0 = (0b10111w :  5 words$word)))) then sail2_state_monad$returnS "s7"
   else if (((b__0 = (0b11000w :  5 words$word)))) then sail2_state_monad$returnS "s8"
   else if (((b__0 = (0b11001w :  5 words$word)))) then sail2_state_monad$returnS "s9"
   else if (((b__0 = (0b11010w :  5 words$word)))) then sail2_state_monad$returnS "s10"
   else if (((b__0 = (0b11011w :  5 words$word)))) then sail2_state_monad$returnS "s11"
   else if (((b__0 = (0b11100w :  5 words$word)))) then sail2_state_monad$returnS "t3"
   else if (((b__0 = (0b11101w :  5 words$word)))) then sail2_state_monad$returnS "t4"
   else if (((b__0 = (0b11110w :  5 words$word)))) then sail2_state_monad$returnS "t5"
   else if (((b__0 = (0b11111w :  5 words$word)))) then sail2_state_monad$returnS "t6"
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_regs.sail 154:2 - 187:3") (sail2_state_monad$exitS () )))`;


(*val reg_name_forwards : mword ty5 -> M string*)

(*val reg_name_backwards : string -> M (mword ty5)*)

(*val reg_name_forwards_matches : mword ty5 -> bool*)

(*val reg_name_backwards_matches : string -> bool*)

(*val reg_name_matches_prefix : string -> maybe ((mword ty5 * ii))*)

val _ = Define `
 ((reg_name_forwards:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS "zero"
   else if (((b__0 = (0b00001w :  5 words$word)))) then sail2_state_monad$returnS "ra"
   else if (((b__0 = (0b00010w :  5 words$word)))) then sail2_state_monad$returnS "sp"
   else if (((b__0 = (0b00011w :  5 words$word)))) then sail2_state_monad$returnS "gp"
   else if (((b__0 = (0b00100w :  5 words$word)))) then sail2_state_monad$returnS "tp"
   else if (((b__0 = (0b00101w :  5 words$word)))) then sail2_state_monad$returnS "t0"
   else if (((b__0 = (0b00110w :  5 words$word)))) then sail2_state_monad$returnS "t1"
   else if (((b__0 = (0b00111w :  5 words$word)))) then sail2_state_monad$returnS "t2"
   else if (((b__0 = (0b01000w :  5 words$word)))) then sail2_state_monad$returnS "fp"
   else if (((b__0 = (0b01001w :  5 words$word)))) then sail2_state_monad$returnS "s1"
   else if (((b__0 = (0b01010w :  5 words$word)))) then sail2_state_monad$returnS "a0"
   else if (((b__0 = (0b01011w :  5 words$word)))) then sail2_state_monad$returnS "a1"
   else if (((b__0 = (0b01100w :  5 words$word)))) then sail2_state_monad$returnS "a2"
   else if (((b__0 = (0b01101w :  5 words$word)))) then sail2_state_monad$returnS "a3"
   else if (((b__0 = (0b01110w :  5 words$word)))) then sail2_state_monad$returnS "a4"
   else if (((b__0 = (0b01111w :  5 words$word)))) then sail2_state_monad$returnS "a5"
   else if (((b__0 = (0b10000w :  5 words$word)))) then sail2_state_monad$returnS "a6"
   else if (((b__0 = (0b10001w :  5 words$word)))) then sail2_state_monad$returnS "a7"
   else if (((b__0 = (0b10010w :  5 words$word)))) then sail2_state_monad$returnS "s2"
   else if (((b__0 = (0b10011w :  5 words$word)))) then sail2_state_monad$returnS "s3"
   else if (((b__0 = (0b10100w :  5 words$word)))) then sail2_state_monad$returnS "s4"
   else if (((b__0 = (0b10101w :  5 words$word)))) then sail2_state_monad$returnS "s5"
   else if (((b__0 = (0b10110w :  5 words$word)))) then sail2_state_monad$returnS "s6"
   else if (((b__0 = (0b10111w :  5 words$word)))) then sail2_state_monad$returnS "s7"
   else if (((b__0 = (0b11000w :  5 words$word)))) then sail2_state_monad$returnS "s8"
   else if (((b__0 = (0b11001w :  5 words$word)))) then sail2_state_monad$returnS "s9"
   else if (((b__0 = (0b11010w :  5 words$word)))) then sail2_state_monad$returnS "s10"
   else if (((b__0 = (0b11011w :  5 words$word)))) then sail2_state_monad$returnS "s11"
   else if (((b__0 = (0b11100w :  5 words$word)))) then sail2_state_monad$returnS "t3"
   else if (((b__0 = (0b11101w :  5 words$word)))) then sail2_state_monad$returnS "t4"
   else if (((b__0 = (0b11110w :  5 words$word)))) then sail2_state_monad$returnS "t5"
   else if (((b__0 = (0b11111w :  5 words$word)))) then sail2_state_monad$returnS "t6"
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((reg_name_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "zero"))) then sail2_state_monad$returnS (0b00000w :  5 words$word)
   else if (((p0_ = "ra"))) then sail2_state_monad$returnS (0b00001w :  5 words$word)
   else if (((p0_ = "sp"))) then sail2_state_monad$returnS (0b00010w :  5 words$word)
   else if (((p0_ = "gp"))) then sail2_state_monad$returnS (0b00011w :  5 words$word)
   else if (((p0_ = "tp"))) then sail2_state_monad$returnS (0b00100w :  5 words$word)
   else if (((p0_ = "t0"))) then sail2_state_monad$returnS (0b00101w :  5 words$word)
   else if (((p0_ = "t1"))) then sail2_state_monad$returnS (0b00110w :  5 words$word)
   else if (((p0_ = "t2"))) then sail2_state_monad$returnS (0b00111w :  5 words$word)
   else if (((p0_ = "fp"))) then sail2_state_monad$returnS (0b01000w :  5 words$word)
   else if (((p0_ = "s1"))) then sail2_state_monad$returnS (0b01001w :  5 words$word)
   else if (((p0_ = "a0"))) then sail2_state_monad$returnS (0b01010w :  5 words$word)
   else if (((p0_ = "a1"))) then sail2_state_monad$returnS (0b01011w :  5 words$word)
   else if (((p0_ = "a2"))) then sail2_state_monad$returnS (0b01100w :  5 words$word)
   else if (((p0_ = "a3"))) then sail2_state_monad$returnS (0b01101w :  5 words$word)
   else if (((p0_ = "a4"))) then sail2_state_monad$returnS (0b01110w :  5 words$word)
   else if (((p0_ = "a5"))) then sail2_state_monad$returnS (0b01111w :  5 words$word)
   else if (((p0_ = "a6"))) then sail2_state_monad$returnS (0b10000w :  5 words$word)
   else if (((p0_ = "a7"))) then sail2_state_monad$returnS (0b10001w :  5 words$word)
   else if (((p0_ = "s2"))) then sail2_state_monad$returnS (0b10010w :  5 words$word)
   else if (((p0_ = "s3"))) then sail2_state_monad$returnS (0b10011w :  5 words$word)
   else if (((p0_ = "s4"))) then sail2_state_monad$returnS (0b10100w :  5 words$word)
   else if (((p0_ = "s5"))) then sail2_state_monad$returnS (0b10101w :  5 words$word)
   else if (((p0_ = "s6"))) then sail2_state_monad$returnS (0b10110w :  5 words$word)
   else if (((p0_ = "s7"))) then sail2_state_monad$returnS (0b10111w :  5 words$word)
   else if (((p0_ = "s8"))) then sail2_state_monad$returnS (0b11000w :  5 words$word)
   else if (((p0_ = "s9"))) then sail2_state_monad$returnS (0b11001w :  5 words$word)
   else if (((p0_ = "s10"))) then sail2_state_monad$returnS (0b11010w :  5 words$word)
   else if (((p0_ = "s11"))) then sail2_state_monad$returnS (0b11011w :  5 words$word)
   else if (((p0_ = "t3"))) then sail2_state_monad$returnS (0b11100w :  5 words$word)
   else if (((p0_ = "t4"))) then sail2_state_monad$returnS (0b11101w :  5 words$word)
   else if (((p0_ = "t5"))) then sail2_state_monad$returnS (0b11110w :  5 words$word)
   else if (((p0_ = "t6"))) then sail2_state_monad$returnS (0b11111w :  5 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((reg_name_forwards_matches:(5)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00000w :  5 words$word)))) then T
   else if (((b__0 = (0b00001w :  5 words$word)))) then T
   else if (((b__0 = (0b00010w :  5 words$word)))) then T
   else if (((b__0 = (0b00011w :  5 words$word)))) then T
   else if (((b__0 = (0b00100w :  5 words$word)))) then T
   else if (((b__0 = (0b00101w :  5 words$word)))) then T
   else if (((b__0 = (0b00110w :  5 words$word)))) then T
   else if (((b__0 = (0b00111w :  5 words$word)))) then T
   else if (((b__0 = (0b01000w :  5 words$word)))) then T
   else if (((b__0 = (0b01001w :  5 words$word)))) then T
   else if (((b__0 = (0b01010w :  5 words$word)))) then T
   else if (((b__0 = (0b01011w :  5 words$word)))) then T
   else if (((b__0 = (0b01100w :  5 words$word)))) then T
   else if (((b__0 = (0b01101w :  5 words$word)))) then T
   else if (((b__0 = (0b01110w :  5 words$word)))) then T
   else if (((b__0 = (0b01111w :  5 words$word)))) then T
   else if (((b__0 = (0b10000w :  5 words$word)))) then T
   else if (((b__0 = (0b10001w :  5 words$word)))) then T
   else if (((b__0 = (0b10010w :  5 words$word)))) then T
   else if (((b__0 = (0b10011w :  5 words$word)))) then T
   else if (((b__0 = (0b10100w :  5 words$word)))) then T
   else if (((b__0 = (0b10101w :  5 words$word)))) then T
   else if (((b__0 = (0b10110w :  5 words$word)))) then T
   else if (((b__0 = (0b10111w :  5 words$word)))) then T
   else if (((b__0 = (0b11000w :  5 words$word)))) then T
   else if (((b__0 = (0b11001w :  5 words$word)))) then T
   else if (((b__0 = (0b11010w :  5 words$word)))) then T
   else if (((b__0 = (0b11011w :  5 words$word)))) then T
   else if (((b__0 = (0b11100w :  5 words$word)))) then T
   else if (((b__0 = (0b11101w :  5 words$word)))) then T
   else if (((b__0 = (0b11110w :  5 words$word)))) then T
   else if (((b__0 = (0b11111w :  5 words$word)))) then T
   else F))`;


val _ = Define `
 ((reg_name_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "zero"))) then T
   else if (((p0_ = "ra"))) then T
   else if (((p0_ = "sp"))) then T
   else if (((p0_ = "gp"))) then T
   else if (((p0_ = "tp"))) then T
   else if (((p0_ = "t0"))) then T
   else if (((p0_ = "t1"))) then T
   else if (((p0_ = "t2"))) then T
   else if (((p0_ = "fp"))) then T
   else if (((p0_ = "s1"))) then T
   else if (((p0_ = "a0"))) then T
   else if (((p0_ = "a1"))) then T
   else if (((p0_ = "a2"))) then T
   else if (((p0_ = "a3"))) then T
   else if (((p0_ = "a4"))) then T
   else if (((p0_ = "a5"))) then T
   else if (((p0_ = "a6"))) then T
   else if (((p0_ = "a7"))) then T
   else if (((p0_ = "s2"))) then T
   else if (((p0_ = "s3"))) then T
   else if (((p0_ = "s4"))) then T
   else if (((p0_ = "s5"))) then T
   else if (((p0_ = "s6"))) then T
   else if (((p0_ = "s7"))) then T
   else if (((p0_ = "s8"))) then T
   else if (((p0_ = "s9"))) then T
   else if (((p0_ = "s10"))) then T
   else if (((p0_ = "s11"))) then T
   else if (((p0_ = "t3"))) then T
   else if (((p0_ = "t4"))) then T
   else if (((p0_ = "t5"))) then T
   else if (((p0_ = "t6"))) then T
   else F))`;


(*val _s164_ : string -> maybe string*)

val _ = Define `
 ((s164_:string ->(string)option) s165_0=
    (let s166_0 = s165_0 in
   if ((string_startswith s166_0 "t6")) then  
  (case ((string_drop s166_0 ((string_length "t6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s160_ : string -> maybe string*)

val _ = Define `
 ((s160_:string ->(string)option) s161_0=
    (let s162_0 = s161_0 in
   if ((string_startswith s162_0 "t5")) then  
  (case ((string_drop s162_0 ((string_length "t5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s156_ : string -> maybe string*)

val _ = Define `
 ((s156_:string ->(string)option) s157_0=
    (let s158_0 = s157_0 in
   if ((string_startswith s158_0 "t4")) then  
  (case ((string_drop s158_0 ((string_length "t4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s152_ : string -> maybe string*)

val _ = Define `
 ((s152_:string ->(string)option) s153_0=
    (let s154_0 = s153_0 in
   if ((string_startswith s154_0 "t3")) then  
  (case ((string_drop s154_0 ((string_length "t3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s148_ : string -> maybe string*)

val _ = Define `
 ((s148_:string ->(string)option) s149_0=
    (let s150_0 = s149_0 in
   if ((string_startswith s150_0 "s11")) then  
  (case ((string_drop s150_0 ((string_length "s11")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s144_ : string -> maybe string*)

val _ = Define `
 ((s144_:string ->(string)option) s145_0=
    (let s146_0 = s145_0 in
   if ((string_startswith s146_0 "s10")) then  
  (case ((string_drop s146_0 ((string_length "s10")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s140_ : string -> maybe string*)

val _ = Define `
 ((s140_:string ->(string)option) s141_0=
    (let s142_0 = s141_0 in
   if ((string_startswith s142_0 "s9")) then  
  (case ((string_drop s142_0 ((string_length "s9")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s136_ : string -> maybe string*)

val _ = Define `
 ((s136_:string ->(string)option) s137_0=
    (let s138_0 = s137_0 in
   if ((string_startswith s138_0 "s8")) then  
  (case ((string_drop s138_0 ((string_length "s8")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s132_ : string -> maybe string*)

val _ = Define `
 ((s132_:string ->(string)option) s133_0=
    (let s134_0 = s133_0 in
   if ((string_startswith s134_0 "s7")) then  
  (case ((string_drop s134_0 ((string_length "s7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s128_ : string -> maybe string*)

val _ = Define `
 ((s128_:string ->(string)option) s129_0=
    (let s130_0 = s129_0 in
   if ((string_startswith s130_0 "s6")) then  
  (case ((string_drop s130_0 ((string_length "s6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s124_ : string -> maybe string*)

val _ = Define `
 ((s124_:string ->(string)option) s125_0=
    (let s126_0 = s125_0 in
   if ((string_startswith s126_0 "s5")) then  
  (case ((string_drop s126_0 ((string_length "s5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s120_ : string -> maybe string*)

val _ = Define `
 ((s120_:string ->(string)option) s121_0=
    (let s122_0 = s121_0 in
   if ((string_startswith s122_0 "s4")) then  
  (case ((string_drop s122_0 ((string_length "s4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s116_ : string -> maybe string*)

val _ = Define `
 ((s116_:string ->(string)option) s117_0=
    (let s118_0 = s117_0 in
   if ((string_startswith s118_0 "s3")) then  
  (case ((string_drop s118_0 ((string_length "s3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s112_ : string -> maybe string*)

val _ = Define `
 ((s112_:string ->(string)option) s113_0=
    (let s114_0 = s113_0 in
   if ((string_startswith s114_0 "s2")) then  
  (case ((string_drop s114_0 ((string_length "s2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s108_ : string -> maybe string*)

val _ = Define `
 ((s108_:string ->(string)option) s109_0=
    (let s110_0 = s109_0 in
   if ((string_startswith s110_0 "a7")) then  
  (case ((string_drop s110_0 ((string_length "a7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s104_ : string -> maybe string*)

val _ = Define `
 ((s104_:string ->(string)option) s105_0=
    (let s106_0 = s105_0 in
   if ((string_startswith s106_0 "a6")) then  
  (case ((string_drop s106_0 ((string_length "a6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s100_ : string -> maybe string*)

val _ = Define `
 ((s100_:string ->(string)option) s101_0=
    (let s102_0 = s101_0 in
   if ((string_startswith s102_0 "a5")) then  
  (case ((string_drop s102_0 ((string_length "a5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s96_ : string -> maybe string*)

val _ = Define `
 ((s96_:string ->(string)option) s97_0=
    (let s98_0 = s97_0 in
   if ((string_startswith s98_0 "a4")) then  
  (case ((string_drop s98_0 ((string_length "a4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s92_ : string -> maybe string*)

val _ = Define `
 ((s92_:string ->(string)option) s93_0=
    (let s94_0 = s93_0 in
   if ((string_startswith s94_0 "a3")) then  
  (case ((string_drop s94_0 ((string_length "a3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s88_ : string -> maybe string*)

val _ = Define `
 ((s88_:string ->(string)option) s89_0=
    (let s90_0 = s89_0 in
   if ((string_startswith s90_0 "a2")) then  
  (case ((string_drop s90_0 ((string_length "a2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s84_ : string -> maybe string*)

val _ = Define `
 ((s84_:string ->(string)option) s85_0=
    (let s86_0 = s85_0 in
   if ((string_startswith s86_0 "a1")) then  
  (case ((string_drop s86_0 ((string_length "a1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s80_ : string -> maybe string*)

val _ = Define `
 ((s80_:string ->(string)option) s81_0=
    (let s82_0 = s81_0 in
   if ((string_startswith s82_0 "a0")) then  
  (case ((string_drop s82_0 ((string_length "a0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s76_ : string -> maybe string*)

val _ = Define `
 ((s76_:string ->(string)option) s77_0=
    (let s78_0 = s77_0 in
   if ((string_startswith s78_0 "s1")) then  
  (case ((string_drop s78_0 ((string_length "s1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s72_ : string -> maybe string*)

val _ = Define `
 ((s72_:string ->(string)option) s73_0=
    (let s74_0 = s73_0 in
   if ((string_startswith s74_0 "fp")) then  
  (case ((string_drop s74_0 ((string_length "fp")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s68_ : string -> maybe string*)

val _ = Define `
 ((s68_:string ->(string)option) s69_0=
    (let s70_0 = s69_0 in
   if ((string_startswith s70_0 "t2")) then  
  (case ((string_drop s70_0 ((string_length "t2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s64_ : string -> maybe string*)

val _ = Define `
 ((s64_:string ->(string)option) s65_0=
    (let s66_0 = s65_0 in
   if ((string_startswith s66_0 "t1")) then  
  (case ((string_drop s66_0 ((string_length "t1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s60_ : string -> maybe string*)

val _ = Define `
 ((s60_:string ->(string)option) s61_0=
    (let s62_0 = s61_0 in
   if ((string_startswith s62_0 "t0")) then  
  (case ((string_drop s62_0 ((string_length "t0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s56_ : string -> maybe string*)

val _ = Define `
 ((s56_:string ->(string)option) s57_0=
    (let s58_0 = s57_0 in
   if ((string_startswith s58_0 "tp")) then  
  (case ((string_drop s58_0 ((string_length "tp")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s52_ : string -> maybe string*)

val _ = Define `
 ((s52_:string ->(string)option) s53_0=
    (let s54_0 = s53_0 in
   if ((string_startswith s54_0 "gp")) then  
  (case ((string_drop s54_0 ((string_length "gp")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s48_ : string -> maybe string*)

val _ = Define `
 ((s48_:string ->(string)option) s49_0=
    (let s50_0 = s49_0 in
   if ((string_startswith s50_0 "sp")) then  
  (case ((string_drop s50_0 ((string_length "sp")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s44_ : string -> maybe string*)

val _ = Define `
 ((s44_:string ->(string)option) s45_0=
    (let s46_0 = s45_0 in
   if ((string_startswith s46_0 "ra")) then  
  (case ((string_drop s46_0 ((string_length "ra")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s40_ : string -> maybe string*)

val _ = Define `
 ((s40_:string ->(string)option) s41_0=
    (let s42_0 = s41_0 in
   if ((string_startswith s42_0 "zero")) then  
  (case ((string_drop s42_0 ((string_length "zero")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((reg_name_matches_prefix:string ->((5)words$word#int)option) arg_=
    (let s43_0 = arg_ in
   if ((case ((s40_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s40_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s44_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s44_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s48_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s48_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s52_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s52_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s56_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s56_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s60_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s60_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s64_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s64_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s68_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s68_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b00111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s72_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s72_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s76_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s76_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s80_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s80_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s84_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s84_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s88_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s88_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s92_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s92_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s96_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s96_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s100_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s100_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b01111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s104_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s104_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s108_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s108_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s112_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s112_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s116_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s116_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s120_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s120_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s124_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s124_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s128_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s128_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s132_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s132_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b10111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s136_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s136_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s140_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s140_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s144_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s144_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s148_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s148_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s152_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s152_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s156_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s156_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s160_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s160_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s164_ s43_0)) of   SOME (s_) => T | _ => F )) then  
  (case s164_ s43_0 of
      (SOME (s_)) =>
  SOME
    ((0b11111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val creg_name_forwards : mword ty3 -> M string*)

(*val creg_name_backwards : string -> M (mword ty3)*)

(*val creg_name_forwards_matches : mword ty3 -> bool*)

(*val creg_name_backwards_matches : string -> bool*)

(*val creg_name_matches_prefix : string -> maybe ((mword ty3 * ii))*)

val _ = Define `
 ((creg_name_forwards:(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then sail2_state_monad$returnS "s0"
   else if (((b__0 = (0b001w :  3 words$word)))) then sail2_state_monad$returnS "s1"
   else if (((b__0 = (0b010w :  3 words$word)))) then sail2_state_monad$returnS "a0"
   else if (((b__0 = (0b011w :  3 words$word)))) then sail2_state_monad$returnS "a1"
   else if (((b__0 = (0b100w :  3 words$word)))) then sail2_state_monad$returnS "a2"
   else if (((b__0 = (0b101w :  3 words$word)))) then sail2_state_monad$returnS "a3"
   else if (((b__0 = (0b110w :  3 words$word)))) then sail2_state_monad$returnS "a4"
   else if (((b__0 = (0b111w :  3 words$word)))) then sail2_state_monad$returnS "a5"
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((creg_name_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((3)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "s0"))) then sail2_state_monad$returnS (0b000w :  3 words$word)
   else if (((p0_ = "s1"))) then sail2_state_monad$returnS (0b001w :  3 words$word)
   else if (((p0_ = "a0"))) then sail2_state_monad$returnS (0b010w :  3 words$word)
   else if (((p0_ = "a1"))) then sail2_state_monad$returnS (0b011w :  3 words$word)
   else if (((p0_ = "a2"))) then sail2_state_monad$returnS (0b100w :  3 words$word)
   else if (((p0_ = "a3"))) then sail2_state_monad$returnS (0b101w :  3 words$word)
   else if (((p0_ = "a4"))) then sail2_state_monad$returnS (0b110w :  3 words$word)
   else if (((p0_ = "a5"))) then sail2_state_monad$returnS (0b111w :  3 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((creg_name_forwards_matches:(3)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then T
   else if (((b__0 = (0b001w :  3 words$word)))) then T
   else if (((b__0 = (0b010w :  3 words$word)))) then T
   else if (((b__0 = (0b011w :  3 words$word)))) then T
   else if (((b__0 = (0b100w :  3 words$word)))) then T
   else if (((b__0 = (0b101w :  3 words$word)))) then T
   else if (((b__0 = (0b110w :  3 words$word)))) then T
   else if (((b__0 = (0b111w :  3 words$word)))) then T
   else F))`;


val _ = Define `
 ((creg_name_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "s0"))) then T
   else if (((p0_ = "s1"))) then T
   else if (((p0_ = "a0"))) then T
   else if (((p0_ = "a1"))) then T
   else if (((p0_ = "a2"))) then T
   else if (((p0_ = "a3"))) then T
   else if (((p0_ = "a4"))) then T
   else if (((p0_ = "a5"))) then T
   else F))`;


(*val _s196_ : string -> maybe string*)

val _ = Define `
 ((s196_:string ->(string)option) s197_0=
    (let s198_0 = s197_0 in
   if ((string_startswith s198_0 "a5")) then  
  (case ((string_drop s198_0 ((string_length "a5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s192_ : string -> maybe string*)

val _ = Define `
 ((s192_:string ->(string)option) s193_0=
    (let s194_0 = s193_0 in
   if ((string_startswith s194_0 "a4")) then  
  (case ((string_drop s194_0 ((string_length "a4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s188_ : string -> maybe string*)

val _ = Define `
 ((s188_:string ->(string)option) s189_0=
    (let s190_0 = s189_0 in
   if ((string_startswith s190_0 "a3")) then  
  (case ((string_drop s190_0 ((string_length "a3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s184_ : string -> maybe string*)

val _ = Define `
 ((s184_:string ->(string)option) s185_0=
    (let s186_0 = s185_0 in
   if ((string_startswith s186_0 "a2")) then  
  (case ((string_drop s186_0 ((string_length "a2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s180_ : string -> maybe string*)

val _ = Define `
 ((s180_:string ->(string)option) s181_0=
    (let s182_0 = s181_0 in
   if ((string_startswith s182_0 "a1")) then  
  (case ((string_drop s182_0 ((string_length "a1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s176_ : string -> maybe string*)

val _ = Define `
 ((s176_:string ->(string)option) s177_0=
    (let s178_0 = s177_0 in
   if ((string_startswith s178_0 "a0")) then  
  (case ((string_drop s178_0 ((string_length "a0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s172_ : string -> maybe string*)

val _ = Define `
 ((s172_:string ->(string)option) s173_0=
    (let s174_0 = s173_0 in
   if ((string_startswith s174_0 "s1")) then  
  (case ((string_drop s174_0 ((string_length "s1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s168_ : string -> maybe string*)

val _ = Define `
 ((s168_:string ->(string)option) s169_0=
    (let s170_0 = s169_0 in
   if ((string_startswith s170_0 "s0")) then  
  (case ((string_drop s170_0 ((string_length "s0")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((creg_name_matches_prefix:string ->((3)words$word#int)option) arg_=
    (let s171_0 = arg_ in
   if ((case ((s168_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s168_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b000w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s172_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s172_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b001w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s176_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s176_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b010w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s180_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s180_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b011w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s184_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s184_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b100w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s188_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s188_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b101w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s192_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s192_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b110w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s196_ s171_0)) of   SOME (s_) => T | _ => F )) then  
  (case s196_ s171_0 of
      (SOME (s_)) =>
  SOME
    ((0b111w : 3 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val init_base_regs : unit -> M unit*)

val _ = Define `
 ((init_base_regs:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS x1_ref zero_reg)
   (sail2_state_monad$write_regS x2_ref zero_reg))
   (sail2_state_monad$write_regS x3_ref zero_reg))
   (sail2_state_monad$write_regS x4_ref zero_reg))
   (sail2_state_monad$write_regS x5_ref zero_reg))
   (sail2_state_monad$write_regS x6_ref zero_reg))
   (sail2_state_monad$write_regS x7_ref zero_reg))
   (sail2_state_monad$write_regS x8_ref zero_reg))
   (sail2_state_monad$write_regS x9_ref zero_reg))
   (sail2_state_monad$write_regS x10_ref zero_reg))
   (sail2_state_monad$write_regS x11_ref zero_reg))
   (sail2_state_monad$write_regS x12_ref zero_reg))
   (sail2_state_monad$write_regS x13_ref zero_reg))
   (sail2_state_monad$write_regS x14_ref zero_reg))
   (sail2_state_monad$write_regS x15_ref zero_reg))
   (sail2_state_monad$write_regS x16_ref zero_reg))
   (sail2_state_monad$write_regS x17_ref zero_reg))
   (sail2_state_monad$write_regS x18_ref zero_reg))
   (sail2_state_monad$write_regS x19_ref zero_reg))
   (sail2_state_monad$write_regS x20_ref zero_reg))
   (sail2_state_monad$write_regS x21_ref zero_reg))
   (sail2_state_monad$write_regS x22_ref zero_reg))
   (sail2_state_monad$write_regS x23_ref zero_reg))
   (sail2_state_monad$write_regS x24_ref zero_reg))
   (sail2_state_monad$write_regS x25_ref zero_reg))
   (sail2_state_monad$write_regS x26_ref zero_reg))
   (sail2_state_monad$write_regS x27_ref zero_reg))
   (sail2_state_monad$write_regS x28_ref zero_reg))
   (sail2_state_monad$write_regS x29_ref zero_reg)) (sail2_state_monad$write_regS x30_ref zero_reg)) (sail2_state_monad$write_regS x31_ref zero_reg)))`;


(*
  Retrieves the architectural PC value. This is not necessarily the value
  found in the PC register as extensions may choose to override this function.
  The value in the PC register is the absolute virtual address of the instruction
  to fetch.
*)
(*val get_arch_pc : unit -> M (mword ty32)*)

val _ = Define `
 ((get_arch_pc:unit ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  ((sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M)))`;


(*val get_next_pc : unit -> M (mword ty32)*)

val _ = Define `
 ((get_next_pc:unit ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  ((sail2_state_monad$read_regS nextPC_ref  : ( 32 words$word) M)))`;


(*val set_next_pc : mword ty32 -> M unit*)

val _ = Define `
 ((set_next_pc:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) pc=  (sail2_state_monad$write_regS nextPC_ref pc))`;


(*val tick_pc : unit -> M unit*)

val _ = Define `
 ((tick_pc:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS nextPC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$write_regS PC_ref w__0)))`;


(*val Mk_Misa : mword ty32 -> Misa*)

val _ = Define `
 ((Mk_Misa:(32)words$word -> Misa) v=  (<| Misa_Misa_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


(*val _get_Misa_bits : Misa -> mword ty32*)

val _ = Define `
 ((get_Misa_bits:Misa ->(32)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


(*val _set_Misa_bits : register_ref regstate register_value Misa -> mword ty32 -> M unit*)

val _ = Define `
 ((set_Misa_bits:((regstate),(register_value),(Misa))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_bits : Misa -> mword ty32 -> Misa*)

val _ = Define `
 ((update_Misa_bits:Misa ->(32)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Counteren_bits : Counteren -> mword ty32 -> Counteren*)

(*val _update_Counterin_bits : Counterin -> mword ty32 -> Counterin*)

(*val _update_Fcsr_bits : Fcsr -> mword ty32 -> Fcsr*)

(*val _update_Mcause_bits : Mcause -> mword ty32 -> Mcause*)

(*val _update_Medeleg_bits : Medeleg -> mword ty32 -> Medeleg*)

(*val _update_Minterrupts_bits : Minterrupts -> mword ty32 -> Minterrupts*)

(*val _update_Mstatus_bits : Mstatus -> mword ty32 -> Mstatus*)

(*val _update_Mstatush_bits : Mstatush -> mword ty32 -> Mstatush*)

(*val _update_Mtvec_bits : Mtvec -> mword ty32 -> Mtvec*)

(*val _update_PTE_Bits_bits : PTE_Bits -> mword ty8 -> PTE_Bits*)

(*val _update_Pmpcfg_ent_bits : Pmpcfg_ent -> mword ty8 -> Pmpcfg_ent*)

(*val _update_SV32_PTE_bits : SV32_PTE -> mword ty32 -> SV32_PTE*)

(*val _update_SV32_Paddr_bits : SV32_Paddr -> mword ty34 -> SV32_Paddr*)

(*val _update_SV32_Vaddr_bits : SV32_Vaddr -> mword ty32 -> SV32_Vaddr*)

(*val _update_SV39_PTE_bits : SV39_PTE -> mword ty64 -> SV39_PTE*)

(*val _update_SV39_Paddr_bits : SV39_Paddr -> mword ty56 -> SV39_Paddr*)

(*val _update_SV39_Vaddr_bits : SV39_Vaddr -> mword ty39 -> SV39_Vaddr*)

(*val _update_SV48_PTE_bits : SV48_PTE -> mword ty64 -> SV48_PTE*)

(*val _update_SV48_Paddr_bits : SV48_Paddr -> mword ty56 -> SV48_Paddr*)

(*val _update_SV48_Vaddr_bits : SV48_Vaddr -> mword ty48 -> SV48_Vaddr*)

(*val _update_Satp32_bits : Satp32 -> mword ty32 -> Satp32*)

(*val _update_Satp64_bits : Satp64 -> mword ty64 -> Satp64*)

(*val _update_Sedeleg_bits : Sedeleg -> mword ty32 -> Sedeleg*)

(*val _update_Sinterrupts_bits : Sinterrupts -> mword ty32 -> Sinterrupts*)

(*val _update_Sstatus_bits : Sstatus -> mword ty32 -> Sstatus*)

(*val _update_Uinterrupts_bits : Uinterrupts -> mword ty32 -> Uinterrupts*)

(*val _update_Ustatus_bits : Ustatus -> mword ty32 -> Ustatus*)

(*val _update_htif_cmd_bits : htif_cmd -> mword ty64 -> htif_cmd*)

(*val _get_Counteren_bits : Counteren -> mword ty32*)

(*val _get_Counterin_bits : Counterin -> mword ty32*)

(*val _get_Fcsr_bits : Fcsr -> mword ty32*)

(*val _get_Mcause_bits : Mcause -> mword ty32*)

(*val _get_Medeleg_bits : Medeleg -> mword ty32*)

(*val _get_Minterrupts_bits : Minterrupts -> mword ty32*)

(*val _get_Mstatus_bits : Mstatus -> mword ty32*)

(*val _get_Mstatush_bits : Mstatush -> mword ty32*)

(*val _get_Mtvec_bits : Mtvec -> mword ty32*)

(*val _get_PTE_Bits_bits : PTE_Bits -> mword ty8*)

(*val _get_Pmpcfg_ent_bits : Pmpcfg_ent -> mword ty8*)

(*val _get_SV32_PTE_bits : SV32_PTE -> mword ty32*)

(*val _get_SV32_Paddr_bits : SV32_Paddr -> mword ty34*)

(*val _get_SV32_Vaddr_bits : SV32_Vaddr -> mword ty32*)

(*val _get_SV39_PTE_bits : SV39_PTE -> mword ty64*)

(*val _get_SV39_Paddr_bits : SV39_Paddr -> mword ty56*)

(*val _get_SV39_Vaddr_bits : SV39_Vaddr -> mword ty39*)

(*val _get_SV48_PTE_bits : SV48_PTE -> mword ty64*)

(*val _get_SV48_Paddr_bits : SV48_Paddr -> mword ty56*)

(*val _get_SV48_Vaddr_bits : SV48_Vaddr -> mword ty48*)

(*val _get_Satp32_bits : Satp32 -> mword ty32*)

(*val _get_Satp64_bits : Satp64 -> mword ty64*)

(*val _get_Sedeleg_bits : Sedeleg -> mword ty32*)

(*val _get_Sinterrupts_bits : Sinterrupts -> mword ty32*)

(*val _get_Sstatus_bits : Sstatus -> mword ty32*)

(*val _get_Uinterrupts_bits : Uinterrupts -> mword ty32*)

(*val _get_Ustatus_bits : Ustatus -> mword ty32*)

(*val _get_htif_cmd_bits : htif_cmd -> mword ty64*)

(*val _set_Counteren_bits : register_ref regstate register_value Counteren -> mword ty32 -> M unit*)

(*val _set_Counterin_bits : register_ref regstate register_value Counterin -> mword ty32 -> M unit*)

(*val _set_Fcsr_bits : register_ref regstate register_value Fcsr -> mword ty32 -> M unit*)

(*val _set_Mcause_bits : register_ref regstate register_value Mcause -> mword ty32 -> M unit*)

(*val _set_Medeleg_bits : register_ref regstate register_value Medeleg -> mword ty32 -> M unit*)

(*val _set_Minterrupts_bits : register_ref regstate register_value Minterrupts -> mword ty32 -> M unit*)

(*val _set_Mstatus_bits : register_ref regstate register_value Mstatus -> mword ty32 -> M unit*)

(*val _set_Mstatush_bits : register_ref regstate register_value Mstatush -> mword ty32 -> M unit*)

(*val _set_Mtvec_bits : register_ref regstate register_value Mtvec -> mword ty32 -> M unit*)

(*val _set_PTE_Bits_bits : register_ref regstate register_value PTE_Bits -> mword ty8 -> M unit*)

(*val _set_Pmpcfg_ent_bits : register_ref regstate register_value Pmpcfg_ent -> mword ty8 -> M unit*)

(*val _set_SV32_PTE_bits : register_ref regstate register_value SV32_PTE -> mword ty32 -> M unit*)

(*val _set_SV32_Paddr_bits : register_ref regstate register_value SV32_Paddr -> mword ty34 -> M unit*)

(*val _set_SV32_Vaddr_bits : register_ref regstate register_value SV32_Vaddr -> mword ty32 -> M unit*)

(*val _set_SV39_PTE_bits : register_ref regstate register_value SV39_PTE -> mword ty64 -> M unit*)

(*val _set_SV39_Paddr_bits : register_ref regstate register_value SV39_Paddr -> mword ty56 -> M unit*)

(*val _set_SV39_Vaddr_bits : register_ref regstate register_value SV39_Vaddr -> mword ty39 -> M unit*)

(*val _set_SV48_PTE_bits : register_ref regstate register_value SV48_PTE -> mword ty64 -> M unit*)

(*val _set_SV48_Paddr_bits : register_ref regstate register_value SV48_Paddr -> mword ty56 -> M unit*)

(*val _set_SV48_Vaddr_bits : register_ref regstate register_value SV48_Vaddr -> mword ty48 -> M unit*)

(*val _set_Satp32_bits : register_ref regstate register_value Satp32 -> mword ty32 -> M unit*)

(*val _set_Satp64_bits : register_ref regstate register_value Satp64 -> mword ty64 -> M unit*)

(*val _set_Sedeleg_bits : register_ref regstate register_value Sedeleg -> mword ty32 -> M unit*)

(*val _set_Sinterrupts_bits : register_ref regstate register_value Sinterrupts -> mword ty32 -> M unit*)

(*val _set_Sstatus_bits : register_ref regstate register_value Sstatus -> mword ty32 -> M unit*)

(*val _set_Uinterrupts_bits : register_ref regstate register_value Uinterrupts -> mword ty32 -> M unit*)

(*val _set_Ustatus_bits : register_ref regstate register_value Ustatus -> mword ty32 -> M unit*)

(*val _set_htif_cmd_bits : register_ref regstate register_value htif_cmd -> mword ty64 -> M unit*)

(*val _get_Misa_MXL : Misa -> mword ty2*)

val _ = Define `
 ((get_Misa_MXL:Misa ->(2)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 31 : int):ii) (( 30 : int):ii)  :  2 words$word)))`;


(*val _set_Misa_MXL : register_ref regstate register_value Misa -> mword ty2 -> M unit*)

val _ = Define `
 ((set_Misa_MXL:((regstate),(register_value),(Misa))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 31 : int):ii) (( 30 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_MXL : Misa -> mword ty2 -> Misa*)

val _ = Define `
 ((update_Misa_MXL:Misa ->(2)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 31 : int):ii) (( 30 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_Z : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_Z:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_Z : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_Z:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 25 : int):ii) (( 25 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_Z : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_Z:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 25 : int):ii) (( 25 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_Y : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_Y:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 24 : int):ii) (( 24 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_Y : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_Y:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 24 : int):ii) (( 24 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_Y : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_Y:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 24 : int):ii) (( 24 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_X : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_X:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 23 : int):ii) (( 23 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_X : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_X:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 23 : int):ii) (( 23 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_X : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_X:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 23 : int):ii) (( 23 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_X : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _update_Pmpcfg_ent_X : Pmpcfg_ent -> mword ty1 -> Pmpcfg_ent*)

(*val _get_PTE_Bits_X : PTE_Bits -> mword ty1*)

(*val _get_Pmpcfg_ent_X : Pmpcfg_ent -> mword ty1*)

(*val _set_PTE_Bits_X : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _set_Pmpcfg_ent_X : register_ref regstate register_value Pmpcfg_ent -> mword ty1 -> M unit*)

(*val _get_Misa_W : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_W:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 22 : int):ii) (( 22 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_W : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_W:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 22 : int):ii) (( 22 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_W : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_W:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 22 : int):ii) (( 22 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_W : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _update_Pmpcfg_ent_W : Pmpcfg_ent -> mword ty1 -> Pmpcfg_ent*)

(*val _get_PTE_Bits_W : PTE_Bits -> mword ty1*)

(*val _get_Pmpcfg_ent_W : Pmpcfg_ent -> mword ty1*)

(*val _set_PTE_Bits_W : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _set_Pmpcfg_ent_W : register_ref regstate register_value Pmpcfg_ent -> mword ty1 -> M unit*)

(*val _get_Misa_V : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_V:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 21 : int):ii) (( 21 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_V : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_V:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 21 : int):ii) (( 21 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_V : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_V:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 21 : int):ii) (( 21 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_V : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _get_PTE_Bits_V : PTE_Bits -> mword ty1*)

(*val _set_PTE_Bits_V : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _get_Misa_U : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_U:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 20 : int):ii) (( 20 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_U : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_U:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 20 : int):ii) (( 20 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_U : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_U:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 20 : int):ii) (( 20 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_U : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _get_PTE_Bits_U : PTE_Bits -> mword ty1*)

(*val _set_PTE_Bits_U : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _get_Misa_T : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_T:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 19 : int):ii) (( 19 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_T : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_T:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 19 : int):ii) (( 19 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_T : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_T:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 19 : int):ii) (( 19 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_S : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_S:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 18 : int):ii) (( 18 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_S : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_S:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 18 : int):ii) (( 18 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_S : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_S:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 18 : int):ii) (( 18 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_R : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_R:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 17 : int):ii) (( 17 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_R : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_R:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 17 : int):ii) (( 17 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_R : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_R:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 17 : int):ii) (( 17 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_R : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _update_Pmpcfg_ent_R : Pmpcfg_ent -> mword ty1 -> Pmpcfg_ent*)

(*val _get_PTE_Bits_R : PTE_Bits -> mword ty1*)

(*val _get_Pmpcfg_ent_R : Pmpcfg_ent -> mword ty1*)

(*val _set_PTE_Bits_R : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _set_Pmpcfg_ent_R : register_ref regstate register_value Pmpcfg_ent -> mword ty1 -> M unit*)

(*val _get_Misa_Q : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_Q:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 16 : int):ii) (( 16 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_Q : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_Q:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 16 : int):ii) (( 16 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_Q : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_Q:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 16 : int):ii) (( 16 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_P : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_P:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 15 : int):ii) (( 15 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_P : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_P:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 15 : int):ii) (( 15 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_P : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_P:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 15 : int):ii) (( 15 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_O : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_O:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_O : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_O:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 14 : int):ii) (( 14 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_O : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_O:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 14 : int):ii) (( 14 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_N : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_N:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 13 : int):ii) (( 13 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_N : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_N:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 13 : int):ii) (( 13 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_N : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_N:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 13 : int):ii) (( 13 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_M : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_M:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_M : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_M:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 12 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_M : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_M:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 12 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_L : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_L:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 11 : int):ii) (( 11 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_L : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_L:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 11 : int):ii) (( 11 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_L : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_L:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 11 : int):ii) (( 11 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Pmpcfg_ent_L : Pmpcfg_ent -> mword ty1 -> Pmpcfg_ent*)

(*val _get_Pmpcfg_ent_L : Pmpcfg_ent -> mword ty1*)

(*val _set_Pmpcfg_ent_L : register_ref regstate register_value Pmpcfg_ent -> mword ty1 -> M unit*)

(*val _get_Misa_K : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_K:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 10 : int):ii) (( 10 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_K : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_K:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 10 : int):ii) (( 10 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_K : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_K:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 10 : int):ii) (( 10 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_J : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_J:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 9 : int):ii) (( 9 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_J : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_J:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_J : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_J:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_I : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_I:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_I : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_I:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_I : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_I:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_H : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_H:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_H : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_H:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_H : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_H:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_G : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_G:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_G : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_G:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_G : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_G:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_G : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _get_PTE_Bits_G : PTE_Bits -> mword ty1*)

(*val _set_PTE_Bits_G : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _get_Misa_F : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_F:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_F : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_F:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_F : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_F:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_E : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_E:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_E : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_E:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_E : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_E:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_D : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_D:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_D : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_D:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_D : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_D:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_D : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _get_PTE_Bits_D : PTE_Bits -> mword ty1*)

(*val _set_PTE_Bits_D : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _get_Misa_C : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_C:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_C : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_C:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_C : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_C:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_B : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_B:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_B : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_B:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_B : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_B:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Misa_A : Misa -> mword ty1*)

val _ = Define `
 ((get_Misa_A:Misa ->(1)words$word) v=  ((subrange_vec_dec v.Misa_Misa_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


(*val _set_Misa_A : register_ref regstate register_value Misa -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Misa_A:((regstate),(register_value),(Misa))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Misa_Misa_chunk_0 :=
         ((update_subrange_vec_dec r.Misa_Misa_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Misa_A : Misa -> mword ty1 -> Misa*)

val _ = Define `
 ((update_Misa_A:Misa ->(1)words$word -> Misa) v x=
    (( v with<|
     Misa_Misa_chunk_0 :=
       ((update_subrange_vec_dec v.Misa_Misa_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_PTE_Bits_A : PTE_Bits -> mword ty1 -> PTE_Bits*)

(*val _update_Pmpcfg_ent_A : Pmpcfg_ent -> mword ty2 -> Pmpcfg_ent*)

(*val _get_PTE_Bits_A : PTE_Bits -> mword ty1*)

(*val _get_Pmpcfg_ent_A : Pmpcfg_ent -> mword ty2*)

(*val _set_PTE_Bits_A : register_ref regstate register_value PTE_Bits -> mword ty1 -> M unit*)

(*val _set_Pmpcfg_ent_A : register_ref regstate register_value Pmpcfg_ent -> mword ty2 -> M unit*)

(*val ext_veto_disable_C : unit -> M bool*)

(*val legalize_misa : Misa -> mword ty32 -> M Misa*)

val _ = Define `
 ((ext_veto_disable_C:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$returnS F))`;


val _ = Define `
 ((legalize_misa:Misa ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Misa),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (m : Misa) (v : xlenbits)=
    (if ((sys_enable_writable_misa () )) then
     let v = (Mk_Misa v) in sail2_state_monad$bindS
     (sail2_state$or_boolS
       (sail2_state$and_boolS (sail2_state_monad$returnS (((((get_Misa_C v  :  1 words$word)) = (0b0w :  1 words$word)))))
          (sail2_state$or_boolS
             ( sail2_state_monad$bindS(sail2_state_monad$read_regS nextPC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
              sail2_state_monad$returnS (((((access_vec_dec w__0 (( 1 : int):ii))) = B1))))) ((ext_veto_disable_C () ))))
       (sail2_state_monad$returnS ((~ ((sys_enable_rvc () )))))) (\ (w__4 : bool) . 
     let m = (if w__4 then m else update_Misa_C m ((get_Misa_C v  :  1 words$word))) in
     sail2_state_monad$returnS (if (((((~ ((sys_enable_fdext () )))) \/ ((((((((get_Misa_D v  :  1 words$word)) = (0b1w :  1 words$word)))) /\ (((((get_Misa_F v  :  1 words$word)) = (0b0w :  1 words$word)))))))))) then
               m
             else
               update_Misa_D ((update_Misa_F m ((get_Misa_F v  :  1 words$word))))
                 ((get_Misa_D v  :  1 words$word))))
   else sail2_state_monad$returnS m))`;


(*val haveAtomics : unit -> M bool*)

val _ = Define `
 ((haveAtomics:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS (((((get_Misa_A w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))`;


(*val haveRVC : unit -> M bool*)

val _ = Define `
 ((haveRVC:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS (((((get_Misa_C w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))`;


(*val haveMulDiv : unit -> M bool*)

val _ = Define `
 ((haveMulDiv:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS (((((get_Misa_M w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))`;


(*val haveSupMode : unit -> M bool*)

val _ = Define `
 ((haveSupMode:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS (((((get_Misa_S w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))`;


(*val haveUsrMode : unit -> M bool*)

val _ = Define `
 ((haveUsrMode:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS (((((get_Misa_U w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))`;


(*val haveNExt : unit -> M bool*)

val _ = Define `
 ((haveNExt:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS (((((get_Misa_N w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))`;


(*val Mk_Mstatush : mword ty32 -> Mstatush*)

val _ = Define `
 ((Mk_Mstatush:(32)words$word -> Mstatush) v=
    (<| Mstatush_Mstatush_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Mstatush_bits:Mstatush ->(32)words$word) v=
    ((subrange_vec_dec v.Mstatush_Mstatush_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Mstatush_bits:((regstate),(register_value),(Mstatush))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatush_Mstatush_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatush_Mstatush_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Mstatush_bits:Mstatush ->(32)words$word -> Mstatush) v x=
    (( v with<|
     Mstatush_Mstatush_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatush_Mstatush_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatush_MBE : Mstatush -> mword ty1*)

val _ = Define `
 ((get_Mstatush_MBE:Mstatush ->(1)words$word) v=  ((subrange_vec_dec v.Mstatush_Mstatush_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatush_MBE : register_ref regstate register_value Mstatush -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatush_MBE:((regstate),(register_value),(Mstatush))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatush_Mstatush_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatush_Mstatush_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatush_MBE : Mstatush -> mword ty1 -> Mstatush*)

val _ = Define `
 ((update_Mstatush_MBE:Mstatush ->(1)words$word -> Mstatush) v x=
    (( v with<|
     Mstatush_Mstatush_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatush_Mstatush_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatush_SBE : Mstatush -> mword ty1*)

val _ = Define `
 ((get_Mstatush_SBE:Mstatush ->(1)words$word) v=  ((subrange_vec_dec v.Mstatush_Mstatush_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatush_SBE : register_ref regstate register_value Mstatush -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatush_SBE:((regstate),(register_value),(Mstatush))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatush_Mstatush_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatush_Mstatush_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatush_SBE : Mstatush -> mword ty1 -> Mstatush*)

val _ = Define `
 ((update_Mstatush_SBE:Mstatush ->(1)words$word -> Mstatush) v x=
    (( v with<|
     Mstatush_Mstatush_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatush_Mstatush_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val Mk_Mstatus : mword ty32 -> Mstatus*)

val _ = Define `
 ((Mk_Mstatus:(32)words$word -> Mstatus) v=
    (<| Mstatus_Mstatus_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Mstatus_bits:Mstatus ->(32)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Mstatus_bits:((regstate),(register_value),(Mstatus))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Mstatus_bits:Mstatus ->(32)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_SD : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_SD:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_SD : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_SD:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_SD : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_SD:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_SD : Sstatus -> mword ty1 -> Sstatus*)

(*val _get_Sstatus_SD : Sstatus -> mword ty1*)

(*val _set_Sstatus_SD : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_TSR : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_TSR:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 22 : int):ii) (( 22 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_TSR : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_TSR:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 22 : int):ii) (( 22 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_TSR : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_TSR:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 22 : int):ii) (( 22 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_TW : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_TW:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 21 : int):ii) (( 21 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_TW : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_TW:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 21 : int):ii) (( 21 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_TW : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_TW:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 21 : int):ii) (( 21 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_TVM : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_TVM:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 20 : int):ii) (( 20 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_TVM : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_TVM:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 20 : int):ii) (( 20 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_TVM : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_TVM:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 20 : int):ii) (( 20 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_MXR : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_MXR:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 19 : int):ii) (( 19 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_MXR : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_MXR:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 19 : int):ii) (( 19 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_MXR : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_MXR:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 19 : int):ii) (( 19 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_MXR : Sstatus -> mword ty1 -> Sstatus*)

(*val _get_Sstatus_MXR : Sstatus -> mword ty1*)

(*val _set_Sstatus_MXR : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_SUM : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_SUM:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 18 : int):ii) (( 18 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_SUM : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_SUM:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 18 : int):ii) (( 18 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_SUM : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_SUM:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 18 : int):ii) (( 18 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_SUM : Sstatus -> mword ty1 -> Sstatus*)

(*val _get_Sstatus_SUM : Sstatus -> mword ty1*)

(*val _set_Sstatus_SUM : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_MPRV : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_MPRV:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 17 : int):ii) (( 17 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_MPRV : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_MPRV:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 17 : int):ii) (( 17 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_MPRV : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_MPRV:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 17 : int):ii) (( 17 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_XS : Mstatus -> mword ty2*)

val _ = Define `
 ((get_Mstatus_XS:Mstatus ->(2)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 16 : int):ii) (( 15 : int):ii)  :  2 words$word)))`;


(*val _set_Mstatus_XS : register_ref regstate register_value Mstatus -> mword ty2 -> M unit*)

val _ = Define `
 ((set_Mstatus_XS:((regstate),(register_value),(Mstatus))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 16 : int):ii) (( 15 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_XS : Mstatus -> mword ty2 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_XS:Mstatus ->(2)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 16 : int):ii) (( 15 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_XS : Sstatus -> mword ty2 -> Sstatus*)

(*val _get_Sstatus_XS : Sstatus -> mword ty2*)

(*val _set_Sstatus_XS : register_ref regstate register_value Sstatus -> mword ty2 -> M unit*)

(*val _get_Mstatus_FS : Mstatus -> mword ty2*)

val _ = Define `
 ((get_Mstatus_FS:Mstatus ->(2)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)))`;


(*val _set_Mstatus_FS : register_ref regstate register_value Mstatus -> mword ty2 -> M unit*)

val _ = Define `
 ((set_Mstatus_FS:((regstate),(register_value),(Mstatus))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 14 : int):ii) (( 13 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_FS : Mstatus -> mword ty2 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_FS:Mstatus ->(2)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 14 : int):ii) (( 13 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_FS : Sstatus -> mword ty2 -> Sstatus*)

(*val _get_Sstatus_FS : Sstatus -> mword ty2*)

(*val _set_Sstatus_FS : register_ref regstate register_value Sstatus -> mword ty2 -> M unit*)

(*val _get_Mstatus_MPP : Mstatus -> mword ty2*)

val _ = Define `
 ((get_Mstatus_MPP:Mstatus ->(2)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 12 : int):ii) (( 11 : int):ii)  :  2 words$word)))`;


(*val _set_Mstatus_MPP : register_ref regstate register_value Mstatus -> mword ty2 -> M unit*)

val _ = Define `
 ((set_Mstatus_MPP:((regstate),(register_value),(Mstatus))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 12 : int):ii) (( 11 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_MPP : Mstatus -> mword ty2 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_MPP:Mstatus ->(2)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 12 : int):ii) (( 11 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_SPP : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_SPP:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_SPP : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_SPP:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_SPP : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_SPP:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_SPP : Sstatus -> mword ty1 -> Sstatus*)

(*val _get_Sstatus_SPP : Sstatus -> mword ty1*)

(*val _set_Sstatus_SPP : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_MPIE : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_MPIE:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_MPIE : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_MPIE:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_MPIE : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_MPIE:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_SPIE : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_SPIE:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_SPIE : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_SPIE:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_SPIE : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_SPIE:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_SPIE : Sstatus -> mword ty1 -> Sstatus*)

(*val _get_Sstatus_SPIE : Sstatus -> mword ty1*)

(*val _set_Sstatus_SPIE : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_UPIE : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_UPIE:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_UPIE : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_UPIE:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_UPIE : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_UPIE:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_UPIE : Sstatus -> mword ty1 -> Sstatus*)

(*val _update_Ustatus_UPIE : Ustatus -> mword ty1 -> Ustatus*)

(*val _get_Sstatus_UPIE : Sstatus -> mword ty1*)

(*val _get_Ustatus_UPIE : Ustatus -> mword ty1*)

(*val _set_Sstatus_UPIE : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _set_Ustatus_UPIE : register_ref regstate register_value Ustatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_MIE : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_MIE:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_MIE : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_MIE:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_MIE : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_MIE:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mstatus_SIE : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_SIE:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_SIE : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_SIE:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_SIE : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_SIE:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_SIE : Sstatus -> mword ty1 -> Sstatus*)

(*val _get_Sstatus_SIE : Sstatus -> mword ty1*)

(*val _set_Sstatus_SIE : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _get_Mstatus_UIE : Mstatus -> mword ty1*)

val _ = Define `
 ((get_Mstatus_UIE:Mstatus ->(1)words$word) v=  ((subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


(*val _set_Mstatus_UIE : register_ref regstate register_value Mstatus -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mstatus_UIE:((regstate),(register_value),(Mstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mstatus_Mstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Mstatus_Mstatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mstatus_UIE : Mstatus -> mword ty1 -> Mstatus*)

val _ = Define `
 ((update_Mstatus_UIE:Mstatus ->(1)words$word -> Mstatus) v x=
    (( v with<|
     Mstatus_Mstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Mstatus_Mstatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sstatus_UIE : Sstatus -> mword ty1 -> Sstatus*)

(*val _update_Ustatus_UIE : Ustatus -> mword ty1 -> Ustatus*)

(*val _get_Sstatus_UIE : Sstatus -> mword ty1*)

(*val _get_Ustatus_UIE : Ustatus -> mword ty1*)

(*val _set_Sstatus_UIE : register_ref regstate register_value Sstatus -> mword ty1 -> M unit*)

(*val _set_Ustatus_UIE : register_ref regstate register_value Ustatus -> mword ty1 -> M unit*)

(*val effectivePrivilege : AccessType unit -> Mstatus -> Privilege -> M Privilege*)

val _ = Define `
 ((effectivePrivilege:(ext_access_type)AccessType -> Mstatus -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((Privilege),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (t : ext_access_type AccessType) (m : Mstatus) (priv : Privilege)=
    (if ((((((t <> (Execute () )))) /\ (((((get_Mstatus_MPRV m  :  1 words$word)) = (0b1w :  1 words$word))))))) then
     privLevel_of_bits ((get_Mstatus_MPP m  :  2 words$word))
   else sail2_state_monad$returnS priv))`;


(*val get_mstatus_SXL : Mstatus -> mword ty2*)

val _ = Define `
 ((get_mstatus_SXL:Mstatus ->(2)words$word) m=  ((arch_to_bits RV32  :  2 words$word)))`;


(*val set_mstatus_SXL : Mstatus -> mword ty2 -> Mstatus*)

val _ = Define `
 ((set_mstatus_SXL:Mstatus ->(2)words$word -> Mstatus) (m : Mstatus) (a : arch_xlen)=  m)`;


(*val get_mstatus_UXL : Mstatus -> mword ty2*)

val _ = Define `
 ((get_mstatus_UXL:Mstatus ->(2)words$word) m=  ((arch_to_bits RV32  :  2 words$word)))`;


(*val set_mstatus_UXL : Mstatus -> mword ty2 -> Mstatus*)

val _ = Define `
 ((set_mstatus_UXL:Mstatus ->(2)words$word -> Mstatus) (m : Mstatus) (a : arch_xlen)=  m)`;


(*val legalize_mstatus : Mstatus -> mword ty32 -> M Mstatus*)

val _ = Define `
 ((legalize_mstatus:Mstatus ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Mstatus),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (o1 : Mstatus) (v : xlenbits)=
    (let (m : Mstatus) =
     (Mk_Mstatus
       ((EXTZ (( 32 : int):ii)
           ((concat_vec ((subrange_vec_dec v (( 22 : int):ii) (( 11 : int):ii)  :  12 words$word))
               ((concat_vec (0b00w :  2 words$word)
                   ((concat_vec ((subrange_vec_dec v (( 8 : int):ii) (( 7 : int):ii)  :  2 words$word))
                       ((concat_vec (0b0w :  1 words$word)
                           ((concat_vec ((subrange_vec_dec v (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word))
                               ((concat_vec (0b0w :  1 words$word)
                                   ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
                                  :  3 words$word))
                              :  6 words$word))
                          :  7 words$word))
                      :  9 words$word))
                  :  11 words$word))
              :  23 words$word))
          :  32 words$word))) in
   let m = (update_Mstatus_XS m ((extStatus_to_bits Off  :  2 words$word))) in sail2_state_monad$bindS
   (sail2_state$or_boolS
     ( sail2_state_monad$bindS(extStatus_of_bits ((get_Mstatus_FS m  :  2 words$word))) (\ (w__0 : ExtStatus) . 
      sail2_state_monad$returnS (((w__0 = Dirty)))))
     ( sail2_state_monad$bindS(extStatus_of_bits ((get_Mstatus_XS m  :  2 words$word))) (\ (w__1 : ExtStatus) . 
      sail2_state_monad$returnS (((w__1 = Dirty)))))) (\ dirty . 
   let m = (update_Mstatus_SD m ((bool_to_bits dirty  :  1 words$word))) in
   let m = (set_mstatus_SXL m ((get_mstatus_SXL o1  :  2 words$word))) in
   let m = (set_mstatus_UXL m ((get_mstatus_UXL o1  :  2 words$word))) in
   let m = m in sail2_state_monad$bindS
   (haveNExt () ) (\ (w__2 : bool) . 
   let m =
     (if ((~ w__2)) then
       let m = (update_Mstatus_UPIE m (0b0w :  1 words$word)) in
       update_Mstatus_UIE m (0b0w :  1 words$word)
     else m) in sail2_state_monad$bindS
   (haveUsrMode () ) (\ (w__3 : bool) . 
   sail2_state_monad$returnS (if ((~ w__3)) then update_Mstatus_MPRV m (0b0w :  1 words$word)
           else m))))))`;


(*val cur_Architecture : unit -> M Architecture*)

val _ = Define `
 ((cur_Architecture:unit ->(regstate)sail2_state_monad$sequential_state ->(((Architecture),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) .  sail2_state_monad$bindS
   (case w__0 of
     Machine => sail2_state_monad$bindS
      (sail2_state_monad$read_regS misa_ref) (\ (w__1 : Misa) .  sail2_state_monad$returnS ((get_Misa_MXL w__1  :  2 words$word)))
   | Supervisor => sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__2 : Mstatus) .  sail2_state_monad$returnS ((get_mstatus_SXL w__2  :  2 words$word)))
   | User => sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__3 : Mstatus) .  sail2_state_monad$returnS ((get_mstatus_UXL w__3  :  2 words$word)))
   ) (\ (a : arch_xlen) . 
   (case ((architecture a)) of
     SOME (a) => sail2_state_monad$returnS a
   | NONE => internal_error "Invalid current architecture"
   )))))`;


(*val in32BitMode : unit -> M bool*)

val _ = Define `
 ((in32BitMode:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS (cur_Architecture () ) (\ (w__0 : Architecture) .  sail2_state_monad$returnS (((w__0 = RV32))))))`;


(*val haveFExt : unit -> M bool*)

val _ = Define `
 ((haveFExt:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =
    (sail2_state$and_boolS
     ( sail2_state_monad$bindS(sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
      sail2_state_monad$returnS (((((get_Misa_F w__0  :  1 words$word)) = (0b1w :  1 words$word))))))
     ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__1 : Mstatus) . 
      sail2_state_monad$returnS (((((get_Mstatus_FS w__1  :  2 words$word)) <> (0b00w :  2 words$word))))))))`;


(*val haveDExt : unit -> M bool*)

val _ = Define `
 ((haveDExt:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =
    (sail2_state$and_boolS
     ( sail2_state_monad$bindS(sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
      sail2_state_monad$returnS (((((get_Misa_D w__0  :  1 words$word)) = (0b1w :  1 words$word))))))
     ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__1 : Mstatus) . 
      sail2_state_monad$returnS (((((get_Mstatus_FS w__1  :  2 words$word)) <> (0b00w :  2 words$word))))))))`;


(*val Mk_Minterrupts : mword ty32 -> Minterrupts*)

val _ = Define `
 ((Mk_Minterrupts:(32)words$word -> Minterrupts) v=
    (<| Minterrupts_Minterrupts_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Minterrupts_bits:Minterrupts ->(32)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Minterrupts_bits:((regstate),(register_value),(Minterrupts))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Minterrupts_bits:Minterrupts ->(32)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Minterrupts_MEI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_MEI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 11 : int):ii) (( 11 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_MEI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_MEI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 11 : int):ii) (( 11 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_MEI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_MEI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 11 : int):ii) (( 11 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Minterrupts_SEI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_SEI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 9 : int):ii) (( 9 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_SEI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_SEI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_SEI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_SEI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sinterrupts_SEI : Sinterrupts -> mword ty1 -> Sinterrupts*)

(*val _get_Sinterrupts_SEI : Sinterrupts -> mword ty1*)

(*val _set_Sinterrupts_SEI : register_ref regstate register_value Sinterrupts -> mword ty1 -> M unit*)

(*val _get_Minterrupts_UEI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_UEI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_UEI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_UEI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_UEI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_UEI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sinterrupts_UEI : Sinterrupts -> mword ty1 -> Sinterrupts*)

(*val _update_Uinterrupts_UEI : Uinterrupts -> mword ty1 -> Uinterrupts*)

(*val _get_Sinterrupts_UEI : Sinterrupts -> mword ty1*)

(*val _get_Uinterrupts_UEI : Uinterrupts -> mword ty1*)

(*val _set_Sinterrupts_UEI : register_ref regstate register_value Sinterrupts -> mword ty1 -> M unit*)

(*val _set_Uinterrupts_UEI : register_ref regstate register_value Uinterrupts -> mword ty1 -> M unit*)

(*val _get_Minterrupts_MTI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_MTI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_MTI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_MTI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_MTI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_MTI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Minterrupts_STI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_STI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_STI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_STI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_STI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_STI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sinterrupts_STI : Sinterrupts -> mword ty1 -> Sinterrupts*)

(*val _get_Sinterrupts_STI : Sinterrupts -> mword ty1*)

(*val _set_Sinterrupts_STI : register_ref regstate register_value Sinterrupts -> mword ty1 -> M unit*)

(*val _get_Minterrupts_UTI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_UTI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_UTI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_UTI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_UTI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_UTI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sinterrupts_UTI : Sinterrupts -> mword ty1 -> Sinterrupts*)

(*val _update_Uinterrupts_UTI : Uinterrupts -> mword ty1 -> Uinterrupts*)

(*val _get_Sinterrupts_UTI : Sinterrupts -> mword ty1*)

(*val _get_Uinterrupts_UTI : Uinterrupts -> mword ty1*)

(*val _set_Sinterrupts_UTI : register_ref regstate register_value Sinterrupts -> mword ty1 -> M unit*)

(*val _set_Uinterrupts_UTI : register_ref regstate register_value Uinterrupts -> mword ty1 -> M unit*)

(*val _get_Minterrupts_MSI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_MSI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_MSI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_MSI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_MSI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_MSI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Minterrupts_SSI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_SSI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_SSI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_SSI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_SSI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_SSI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sinterrupts_SSI : Sinterrupts -> mword ty1 -> Sinterrupts*)

(*val _get_Sinterrupts_SSI : Sinterrupts -> mword ty1*)

(*val _set_Sinterrupts_SSI : register_ref regstate register_value Sinterrupts -> mword ty1 -> M unit*)

(*val _get_Minterrupts_USI : Minterrupts -> mword ty1*)

val _ = Define `
 ((get_Minterrupts_USI:Minterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


(*val _set_Minterrupts_USI : register_ref regstate register_value Minterrupts -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Minterrupts_USI:((regstate),(register_value),(Minterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Minterrupts_Minterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Minterrupts_Minterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Minterrupts_USI : Minterrupts -> mword ty1 -> Minterrupts*)

val _ = Define `
 ((update_Minterrupts_USI:Minterrupts ->(1)words$word -> Minterrupts) v x=
    (( v with<|
     Minterrupts_Minterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Minterrupts_Minterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sinterrupts_USI : Sinterrupts -> mword ty1 -> Sinterrupts*)

(*val _update_Uinterrupts_USI : Uinterrupts -> mword ty1 -> Uinterrupts*)

(*val _get_Sinterrupts_USI : Sinterrupts -> mword ty1*)

(*val _get_Uinterrupts_USI : Uinterrupts -> mword ty1*)

(*val _set_Sinterrupts_USI : register_ref regstate register_value Sinterrupts -> mword ty1 -> M unit*)

(*val _set_Uinterrupts_USI : register_ref regstate register_value Uinterrupts -> mword ty1 -> M unit*)

(*val legalize_mip : Minterrupts -> mword ty32 -> M Minterrupts*)

val _ = Define `
 ((legalize_mip:Minterrupts ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Minterrupts),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (o1 : Minterrupts) (v : xlenbits)=
    (let v = (Mk_Minterrupts v) in
   let m = (update_Minterrupts_SEI o1 ((get_Minterrupts_SEI v  :  1 words$word))) in
   let m = (update_Minterrupts_STI m ((get_Minterrupts_STI v  :  1 words$word))) in
   let m = (update_Minterrupts_SSI m ((get_Minterrupts_SSI v  :  1 words$word))) in sail2_state_monad$bindS
   (sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))) (\ (w__2 : bool) . 
   sail2_state_monad$returnS (if w__2 then
             let m = (update_Minterrupts_UEI m ((get_Minterrupts_UEI v  :  1 words$word))) in
             let m = (update_Minterrupts_UTI m ((get_Minterrupts_UTI v  :  1 words$word))) in
             update_Minterrupts_USI m ((get_Minterrupts_USI v  :  1 words$word))
           else m))))`;


(*val legalize_mie : Minterrupts -> mword ty32 -> M Minterrupts*)

val _ = Define `
 ((legalize_mie:Minterrupts ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Minterrupts),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (o1 : Minterrupts) (v : xlenbits)=
    (let v = (Mk_Minterrupts v) in
   let m = (update_Minterrupts_MEI o1 ((get_Minterrupts_MEI v  :  1 words$word))) in
   let m = (update_Minterrupts_MTI m ((get_Minterrupts_MTI v  :  1 words$word))) in
   let m = (update_Minterrupts_MSI m ((get_Minterrupts_MSI v  :  1 words$word))) in
   let m = (update_Minterrupts_SEI m ((get_Minterrupts_SEI v  :  1 words$word))) in
   let m = (update_Minterrupts_STI m ((get_Minterrupts_STI v  :  1 words$word))) in
   let m = (update_Minterrupts_SSI m ((get_Minterrupts_SSI v  :  1 words$word))) in sail2_state_monad$bindS
   (sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))) (\ (w__2 : bool) . 
   sail2_state_monad$returnS (if w__2 then
             let m = (update_Minterrupts_UEI m ((get_Minterrupts_UEI v  :  1 words$word))) in
             let m = (update_Minterrupts_UTI m ((get_Minterrupts_UTI v  :  1 words$word))) in
             update_Minterrupts_USI m ((get_Minterrupts_USI v  :  1 words$word))
           else m))))`;


(*val legalize_mideleg : Minterrupts -> mword ty32 -> Minterrupts*)

val _ = Define `
 ((legalize_mideleg:Minterrupts ->(32)words$word -> Minterrupts) (o1 : Minterrupts) (v : xlenbits)=
    (let m = (Mk_Minterrupts v) in
   let m = (update_Minterrupts_MEI m (0b0w :  1 words$word)) in
   let m = (update_Minterrupts_MTI m (0b0w :  1 words$word)) in
   update_Minterrupts_MSI m (0b0w :  1 words$word)))`;


(*val Mk_Medeleg : mword ty32 -> Medeleg*)

val _ = Define `
 ((Mk_Medeleg:(32)words$word -> Medeleg) v=
    (<| Medeleg_Medeleg_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Medeleg_bits:Medeleg ->(32)words$word) v=  ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Medeleg_bits:((regstate),(register_value),(Medeleg))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Medeleg_bits:Medeleg ->(32)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Medeleg_SAMO_Page_Fault : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_SAMO_Page_Fault:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 15 : int):ii) (( 15 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_SAMO_Page_Fault : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_SAMO_Page_Fault:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 15 : int):ii) (( 15 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_SAMO_Page_Fault : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_SAMO_Page_Fault:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 15 : int):ii) (( 15 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Medeleg_Load_Page_Fault : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Load_Page_Fault:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 13 : int):ii) (( 13 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Load_Page_Fault : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Load_Page_Fault:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 13 : int):ii) (( 13 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Load_Page_Fault : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Load_Page_Fault:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 13 : int):ii) (( 13 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Medeleg_Fetch_Page_Fault : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Fetch_Page_Fault:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Fetch_Page_Fault : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Fetch_Page_Fault:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 12 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Fetch_Page_Fault : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Fetch_Page_Fault:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 12 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Medeleg_MEnvCall : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_MEnvCall:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 10 : int):ii) (( 10 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_MEnvCall : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_MEnvCall:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 10 : int):ii) (( 10 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_MEnvCall : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_MEnvCall:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 10 : int):ii) (( 10 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Medeleg_SEnvCall : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_SEnvCall:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 9 : int):ii) (( 9 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_SEnvCall : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_SEnvCall:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_SEnvCall : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_SEnvCall:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Medeleg_UEnvCall : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_UEnvCall:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_UEnvCall : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_UEnvCall:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_UEnvCall : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_UEnvCall:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_UEnvCall : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_UEnvCall : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_UEnvCall : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_SAMO_Access_Fault : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_SAMO_Access_Fault:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_SAMO_Access_Fault : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_SAMO_Access_Fault:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_SAMO_Access_Fault : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_SAMO_Access_Fault:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_SAMO_Access_Fault : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_SAMO_Access_Fault : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_SAMO_Access_Fault : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_SAMO_Addr_Align : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_SAMO_Addr_Align:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_SAMO_Addr_Align : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_SAMO_Addr_Align:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_SAMO_Addr_Align : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_SAMO_Addr_Align:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_SAMO_Addr_Align : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_SAMO_Addr_Align : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_SAMO_Addr_Align : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_Load_Access_Fault : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Load_Access_Fault:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Load_Access_Fault : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Load_Access_Fault:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Load_Access_Fault : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Load_Access_Fault:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_Load_Access_Fault : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_Load_Access_Fault : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_Load_Access_Fault : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_Load_Addr_Align : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Load_Addr_Align:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Load_Addr_Align : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Load_Addr_Align:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Load_Addr_Align : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Load_Addr_Align:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_Load_Addr_Align : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_Load_Addr_Align : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_Load_Addr_Align : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_Breakpoint : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Breakpoint:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Breakpoint : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Breakpoint:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Breakpoint : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Breakpoint:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_Breakpoint : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_Breakpoint : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_Breakpoint : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_Illegal_Instr : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Illegal_Instr:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Illegal_Instr : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Illegal_Instr:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Illegal_Instr : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Illegal_Instr:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_Illegal_Instr : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_Illegal_Instr : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_Illegal_Instr : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_Fetch_Access_Fault : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Fetch_Access_Fault:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Fetch_Access_Fault : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Fetch_Access_Fault:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Fetch_Access_Fault : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Fetch_Access_Fault:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_Fetch_Access_Fault : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_Fetch_Access_Fault : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_Fetch_Access_Fault : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val _get_Medeleg_Fetch_Addr_Align : Medeleg -> mword ty1*)

val _ = Define `
 ((get_Medeleg_Fetch_Addr_Align:Medeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


(*val _set_Medeleg_Fetch_Addr_Align : register_ref regstate register_value Medeleg -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Medeleg_Fetch_Addr_Align:((regstate),(register_value),(Medeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Medeleg_Medeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Medeleg_Medeleg_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Medeleg_Fetch_Addr_Align : Medeleg -> mword ty1 -> Medeleg*)

val _ = Define `
 ((update_Medeleg_Fetch_Addr_Align:Medeleg ->(1)words$word -> Medeleg) v x=
    (( v with<|
     Medeleg_Medeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Medeleg_Medeleg_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Sedeleg_Fetch_Addr_Align : Sedeleg -> mword ty1 -> Sedeleg*)

(*val _get_Sedeleg_Fetch_Addr_Align : Sedeleg -> mword ty1*)

(*val _set_Sedeleg_Fetch_Addr_Align : register_ref regstate register_value Sedeleg -> mword ty1 -> M unit*)

(*val legalize_medeleg : Medeleg -> mword ty32 -> Medeleg*)

val _ = Define `
 ((legalize_medeleg:Medeleg ->(32)words$word -> Medeleg) (o1 : Medeleg) (v : xlenbits)=
    (let m = (Mk_Medeleg v) in
   update_Medeleg_MEnvCall m (0b0w :  1 words$word)))`;


(*val Mk_Mtvec : mword ty32 -> Mtvec*)

val _ = Define `
 ((Mk_Mtvec:(32)words$word -> Mtvec) v=  (<| Mtvec_Mtvec_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Mtvec_bits:Mtvec ->(32)words$word) v=  ((subrange_vec_dec v.Mtvec_Mtvec_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Mtvec_bits:((regstate),(register_value),(Mtvec))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mtvec_Mtvec_chunk_0 :=
         ((update_subrange_vec_dec r.Mtvec_Mtvec_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Mtvec_bits:Mtvec ->(32)words$word -> Mtvec) v x=
    (( v with<|
     Mtvec_Mtvec_chunk_0 :=
       ((update_subrange_vec_dec v.Mtvec_Mtvec_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mtvec_Base : Mtvec -> mword ty30*)

val _ = Define `
 ((get_Mtvec_Base:Mtvec ->(30)words$word) v=  ((subrange_vec_dec v.Mtvec_Mtvec_chunk_0 (( 31 : int):ii) (( 2 : int):ii)  :  30 words$word)))`;


(*val _set_Mtvec_Base : register_ref regstate register_value Mtvec -> mword ty30 -> M unit*)

val _ = Define `
 ((set_Mtvec_Base:((regstate),(register_value),(Mtvec))register_ref ->(30)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mtvec_Mtvec_chunk_0 :=
         ((update_subrange_vec_dec r.Mtvec_Mtvec_chunk_0 (( 31 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 29 : int):ii) (( 0 : int):ii)  :  30 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mtvec_Base : Mtvec -> mword ty30 -> Mtvec*)

val _ = Define `
 ((update_Mtvec_Base:Mtvec ->(30)words$word -> Mtvec) v x=
    (( v with<|
     Mtvec_Mtvec_chunk_0 :=
       ((update_subrange_vec_dec v.Mtvec_Mtvec_chunk_0 (( 31 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 29 : int):ii) (( 0 : int):ii)  :  30 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mtvec_Mode : Mtvec -> mword ty2*)

val _ = Define `
 ((get_Mtvec_Mode:Mtvec ->(2)words$word) v=  ((subrange_vec_dec v.Mtvec_Mtvec_chunk_0 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)))`;


(*val _set_Mtvec_Mode : register_ref regstate register_value Mtvec -> mword ty2 -> M unit*)

val _ = Define `
 ((set_Mtvec_Mode:((regstate),(register_value),(Mtvec))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mtvec_Mtvec_chunk_0 :=
         ((update_subrange_vec_dec r.Mtvec_Mtvec_chunk_0 (( 1 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mtvec_Mode : Mtvec -> mword ty2 -> Mtvec*)

val _ = Define `
 ((update_Mtvec_Mode:Mtvec ->(2)words$word -> Mtvec) v x=
    (( v with<|
     Mtvec_Mtvec_chunk_0 :=
       ((update_subrange_vec_dec v.Mtvec_Mtvec_chunk_0 (( 1 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Satp32_Mode : Satp32 -> mword ty1 -> Satp32*)

(*val _update_Satp64_Mode : Satp64 -> mword ty4 -> Satp64*)

(*val _get_Satp32_Mode : Satp32 -> mword ty1*)

(*val _get_Satp64_Mode : Satp64 -> mword ty4*)

(*val _set_Satp32_Mode : register_ref regstate register_value Satp32 -> mword ty1 -> M unit*)

(*val _set_Satp64_Mode : register_ref regstate register_value Satp64 -> mword ty4 -> M unit*)

(*val legalize_tvec : Mtvec -> mword ty32 -> Mtvec*)

val _ = Define `
 ((legalize_tvec:Mtvec ->(32)words$word -> Mtvec) (o1 : Mtvec) (v : xlenbits)=
    (let v = (Mk_Mtvec v) in
   (case ((trapVectorMode_of_bits ((get_Mtvec_Mode v  :  2 words$word)))) of
     TV_Direct => v
   | TV_Vector => v
   | _ => update_Mtvec_Mode v ((get_Mtvec_Mode o1  :  2 words$word))
   )))`;


(*val Mk_Mcause : mword ty32 -> Mcause*)

val _ = Define `
 ((Mk_Mcause:(32)words$word -> Mcause) v=  (<| Mcause_Mcause_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Mcause_bits:Mcause ->(32)words$word) v=  ((subrange_vec_dec v.Mcause_Mcause_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Mcause_bits:((regstate),(register_value),(Mcause))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mcause_Mcause_chunk_0 :=
         ((update_subrange_vec_dec r.Mcause_Mcause_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Mcause_bits:Mcause ->(32)words$word -> Mcause) v x=
    (( v with<|
     Mcause_Mcause_chunk_0 :=
       ((update_subrange_vec_dec v.Mcause_Mcause_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mcause_IsInterrupt : Mcause -> mword ty1*)

val _ = Define `
 ((get_Mcause_IsInterrupt:Mcause ->(1)words$word) v=
    ((subrange_vec_dec v.Mcause_Mcause_chunk_0 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)))`;


(*val _set_Mcause_IsInterrupt : register_ref regstate register_value Mcause -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Mcause_IsInterrupt:((regstate),(register_value),(Mcause))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mcause_Mcause_chunk_0 :=
         ((update_subrange_vec_dec r.Mcause_Mcause_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mcause_IsInterrupt : Mcause -> mword ty1 -> Mcause*)

val _ = Define `
 ((update_Mcause_IsInterrupt:Mcause ->(1)words$word -> Mcause) v x=
    (( v with<|
     Mcause_Mcause_chunk_0 :=
       ((update_subrange_vec_dec v.Mcause_Mcause_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Mcause_Cause : Mcause -> mword ty31*)

val _ = Define `
 ((get_Mcause_Cause:Mcause ->(31)words$word) v=  ((subrange_vec_dec v.Mcause_Mcause_chunk_0 (( 30 : int):ii) (( 0 : int):ii)  :  31 words$word)))`;


(*val _set_Mcause_Cause : register_ref regstate register_value Mcause -> mword ty31 -> M unit*)

val _ = Define `
 ((set_Mcause_Cause:((regstate),(register_value),(Mcause))register_ref ->(31)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Mcause_Mcause_chunk_0 :=
         ((update_subrange_vec_dec r.Mcause_Mcause_chunk_0 (( 30 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 30 : int):ii) (( 0 : int):ii)  :  31 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Mcause_Cause : Mcause -> mword ty31 -> Mcause*)

val _ = Define `
 ((update_Mcause_Cause:Mcause ->(31)words$word -> Mcause) v x=
    (( v with<|
     Mcause_Mcause_chunk_0 :=
       ((update_subrange_vec_dec v.Mcause_Mcause_chunk_0 (( 30 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 30 : int):ii) (( 0 : int):ii)  :  31 words$word))
          :  32 words$word)) |>)))`;


(*val tvec_addr : Mtvec -> Mcause -> maybe (mword ty32)*)

val _ = Define `
 ((tvec_addr:Mtvec -> Mcause ->((32)words$word)option) (m : Mtvec) (c : Mcause)=
    (let (base : xlenbits) =
     ((concat_vec ((get_Mtvec_Base m  :  30 words$word)) (0b00w :  2 words$word)  :  32 words$word)) in
   (case ((trapVectorMode_of_bits ((get_Mtvec_Mode m  :  2 words$word)))) of
     TV_Direct => SOME base
   | TV_Vector =>
      if (((((get_Mcause_IsInterrupt c  :  1 words$word)) = (0b1w :  1 words$word)))) then
        SOME ((add_vec base
                 ((shiftl ((EXTZ (( 32 : int):ii) ((get_Mcause_Cause c  :  31 words$word))  :  32 words$word))
                     (( 2 : int):ii)
                    :  32 words$word))
                :  32 words$word))
      else SOME base
   | TV_Reserved => NONE
   )))`;


(*val legalize_xepc : mword ty32 -> M (mword ty32)*)

val _ = Define `
 ((legalize_xepc:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v=  (sail2_state_monad$bindS
   (sail2_state$or_boolS (sail2_state_monad$returnS (((((sys_enable_writable_misa () )) /\ ((sys_enable_rvc () ))))))
     ( sail2_state_monad$bindS(sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
      sail2_state_monad$returnS (((((get_Misa_C w__0  :  1 words$word)) = (0b1w :  1 words$word))))))) (\ (w__1 : bool) . 
   sail2_state_monad$returnS (if w__1 then (update_vec_dec v (( 0 : int):ii) B0  :  32 words$word)
           else (and_vec v ((EXTS (( 32 : int):ii) (0b100w :  3 words$word)  :  32 words$word))  :  32 words$word)))))`;


(*val pc_alignment_mask : unit -> M (mword ty32)*)

val _ = Define `
 ((pc_alignment_mask:unit ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__0 : Misa) . 
   sail2_state_monad$returnS ((not_vec
              ((EXTZ (( 32 : int):ii)
                  (if (((((get_Misa_C w__0  :  1 words$word)) = (0b1w :  1 words$word)))) then
                     (0b00w :  2 words$word)
                   else (0b10w :  2 words$word))
                 :  32 words$word))
             :  32 words$word)))))`;


(*val Mk_Counteren : mword ty32 -> Counteren*)

val _ = Define `
 ((Mk_Counteren:(32)words$word -> Counteren) v=
    (<| Counteren_Counteren_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Counteren_bits:Counteren ->(32)words$word) v=
    ((subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Counteren_bits:((regstate),(register_value),(Counteren))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counteren_Counteren_chunk_0 :=
         ((update_subrange_vec_dec r.Counteren_Counteren_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Counteren_bits:Counteren ->(32)words$word -> Counteren) v x=
    (( v with<|
     Counteren_Counteren_chunk_0 :=
       ((update_subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Counteren_HPM : Counteren -> mword ty29*)

val _ = Define `
 ((get_Counteren_HPM:Counteren ->(29)words$word) v=
    ((subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 31 : int):ii) (( 3 : int):ii)  :  29 words$word)))`;


(*val _set_Counteren_HPM : register_ref regstate register_value Counteren -> mword ty29 -> M unit*)

val _ = Define `
 ((set_Counteren_HPM:((regstate),(register_value),(Counteren))register_ref ->(29)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counteren_Counteren_chunk_0 :=
         ((update_subrange_vec_dec r.Counteren_Counteren_chunk_0 (( 31 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 28 : int):ii) (( 0 : int):ii)  :  29 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Counteren_HPM : Counteren -> mword ty29 -> Counteren*)

val _ = Define `
 ((update_Counteren_HPM:Counteren ->(29)words$word -> Counteren) v x=
    (( v with<|
     Counteren_Counteren_chunk_0 :=
       ((update_subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 31 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 28 : int):ii) (( 0 : int):ii)  :  29 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Counteren_IR : Counteren -> mword ty1*)

val _ = Define `
 ((get_Counteren_IR:Counteren ->(1)words$word) v=
    ((subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


(*val _set_Counteren_IR : register_ref regstate register_value Counteren -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Counteren_IR:((regstate),(register_value),(Counteren))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counteren_Counteren_chunk_0 :=
         ((update_subrange_vec_dec r.Counteren_Counteren_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Counteren_IR : Counteren -> mword ty1 -> Counteren*)

val _ = Define `
 ((update_Counteren_IR:Counteren ->(1)words$word -> Counteren) v x=
    (( v with<|
     Counteren_Counteren_chunk_0 :=
       ((update_subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Counterin_IR : Counterin -> mword ty1 -> Counterin*)

(*val _get_Counterin_IR : Counterin -> mword ty1*)

(*val _set_Counterin_IR : register_ref regstate register_value Counterin -> mword ty1 -> M unit*)

(*val _get_Counteren_TM : Counteren -> mword ty1*)

val _ = Define `
 ((get_Counteren_TM:Counteren ->(1)words$word) v=
    ((subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


(*val _set_Counteren_TM : register_ref regstate register_value Counteren -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Counteren_TM:((regstate),(register_value),(Counteren))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counteren_Counteren_chunk_0 :=
         ((update_subrange_vec_dec r.Counteren_Counteren_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Counteren_TM : Counteren -> mword ty1 -> Counteren*)

val _ = Define `
 ((update_Counteren_TM:Counteren ->(1)words$word -> Counteren) v x=
    (( v with<|
     Counteren_Counteren_chunk_0 :=
       ((update_subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Counteren_CY : Counteren -> mword ty1*)

val _ = Define `
 ((get_Counteren_CY:Counteren ->(1)words$word) v=
    ((subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


(*val _set_Counteren_CY : register_ref regstate register_value Counteren -> mword ty1 -> M unit*)

val _ = Define `
 ((set_Counteren_CY:((regstate),(register_value),(Counteren))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counteren_Counteren_chunk_0 :=
         ((update_subrange_vec_dec r.Counteren_Counteren_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Counteren_CY : Counteren -> mword ty1 -> Counteren*)

val _ = Define `
 ((update_Counteren_CY:Counteren ->(1)words$word -> Counteren) v x=
    (( v with<|
     Counteren_Counteren_chunk_0 :=
       ((update_subrange_vec_dec v.Counteren_Counteren_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val _update_Counterin_CY : Counterin -> mword ty1 -> Counterin*)

(*val _get_Counterin_CY : Counterin -> mword ty1*)

(*val _set_Counterin_CY : register_ref regstate register_value Counterin -> mword ty1 -> M unit*)

(*val legalize_mcounteren : Counteren -> mword ty32 -> Counteren*)

val _ = Define `
 ((legalize_mcounteren:Counteren ->(32)words$word -> Counteren) (c : Counteren) (v : xlenbits)=
    (let c = (update_Counteren_IR c (vec_of_bits [access_vec_dec v (( 2 : int):ii)]  :  1 words$word)) in
   let c = (update_Counteren_TM c (vec_of_bits [access_vec_dec v (( 1 : int):ii)]  :  1 words$word)) in
   update_Counteren_CY c (vec_of_bits [access_vec_dec v (( 0 : int):ii)]  :  1 words$word)))`;


(*val legalize_scounteren : Counteren -> mword ty32 -> Counteren*)

val _ = Define `
 ((legalize_scounteren:Counteren ->(32)words$word -> Counteren) (c : Counteren) (v : xlenbits)=
    (let c = (update_Counteren_IR c (vec_of_bits [access_vec_dec v (( 2 : int):ii)]  :  1 words$word)) in
   let c = (update_Counteren_TM c (vec_of_bits [access_vec_dec v (( 1 : int):ii)]  :  1 words$word)) in
   update_Counteren_CY c (vec_of_bits [access_vec_dec v (( 0 : int):ii)]  :  1 words$word)))`;


(*val Mk_Counterin : mword ty32 -> Counterin*)

val _ = Define `
 ((Mk_Counterin:(32)words$word -> Counterin) v=
    (<| Counterin_Counterin_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Counterin_bits:Counterin ->(32)words$word) v=
    ((subrange_vec_dec v.Counterin_Counterin_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Counterin_bits:((regstate),(register_value),(Counterin))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counterin_Counterin_chunk_0 :=
         ((update_subrange_vec_dec r.Counterin_Counterin_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Counterin_bits:Counterin ->(32)words$word -> Counterin) v x=
    (( v with<|
     Counterin_Counterin_chunk_0 :=
       ((update_subrange_vec_dec v.Counterin_Counterin_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Counterin_IR:Counterin ->(1)words$word) v=
    ((subrange_vec_dec v.Counterin_Counterin_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Counterin_IR:((regstate),(register_value),(Counterin))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counterin_Counterin_chunk_0 :=
         ((update_subrange_vec_dec r.Counterin_Counterin_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Counterin_IR:Counterin ->(1)words$word -> Counterin) v x=
    (( v with<|
     Counterin_Counterin_chunk_0 :=
       ((update_subrange_vec_dec v.Counterin_Counterin_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Counterin_CY:Counterin ->(1)words$word) v=
    ((subrange_vec_dec v.Counterin_Counterin_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Counterin_CY:((regstate),(register_value),(Counterin))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Counterin_Counterin_chunk_0 :=
         ((update_subrange_vec_dec r.Counterin_Counterin_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Counterin_CY:Counterin ->(1)words$word -> Counterin) v x=
    (( v with<|
     Counterin_Counterin_chunk_0 :=
       ((update_subrange_vec_dec v.Counterin_Counterin_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val legalize_mcountinhibit : Counterin -> mword ty32 -> Counterin*)

val _ = Define `
 ((legalize_mcountinhibit:Counterin ->(32)words$word -> Counterin) (c : Counterin) (v : xlenbits)=
    (let c = (update_Counterin_IR c (vec_of_bits [access_vec_dec v (( 2 : int):ii)]  :  1 words$word)) in
   update_Counterin_CY c (vec_of_bits [access_vec_dec v (( 0 : int):ii)]  :  1 words$word)))`;


(*val retire_instruction : unit -> M unit*)

val _ = Define `
 ((retire_instruction:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS minstret_written_ref) (\ (w__0 : bool) . 
   if (((w__0 = T))) then sail2_state_monad$write_regS minstret_written_ref F
   else sail2_state_monad$bindS
   (sail2_state_monad$read_regS mcountinhibit_ref) (\ (w__1 : Counterin) . 
   if (((((get_Counterin_IR w__1  :  1 words$word)) = (0b0w :  1 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__2 :  64 words$word) . 
     sail2_state_monad$write_regS minstret_ref ((add_vec_int w__2 (( 1 : int):ii)  :  64 words$word)))
   else sail2_state_monad$returnS () ))))`;


(*val Mk_Sstatus : mword ty32 -> Sstatus*)

val _ = Define `
 ((Mk_Sstatus:(32)words$word -> Sstatus) v=
    (<| Sstatus_Sstatus_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Sstatus_bits:Sstatus ->(32)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Sstatus_bits:((regstate),(register_value),(Sstatus))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_bits:Sstatus ->(32)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_SD:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_SD:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_SD:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_MXR:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 19 : int):ii) (( 19 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_MXR:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 19 : int):ii) (( 19 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_MXR:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 19 : int):ii) (( 19 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_SUM:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 18 : int):ii) (( 18 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_SUM:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 18 : int):ii) (( 18 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_SUM:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 18 : int):ii) (( 18 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_XS:Sstatus ->(2)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 16 : int):ii) (( 15 : int):ii)  :  2 words$word)))`;


val _ = Define `
 ((set_Sstatus_XS:((regstate),(register_value),(Sstatus))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 16 : int):ii) (( 15 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_XS:Sstatus ->(2)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 16 : int):ii) (( 15 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_FS:Sstatus ->(2)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)))`;


val _ = Define `
 ((set_Sstatus_FS:((regstate),(register_value),(Sstatus))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 14 : int):ii) (( 13 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_FS:Sstatus ->(2)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 14 : int):ii) (( 13 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_SPP:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_SPP:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_SPP:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_SPIE:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_SPIE:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_SPIE:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_UPIE:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_UPIE:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_UPIE:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_SIE:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_SIE:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_SIE:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sstatus_UIE:Sstatus ->(1)words$word) v=  ((subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sstatus_UIE:((regstate),(register_value),(Sstatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sstatus_Sstatus_chunk_0 :=
         ((update_subrange_vec_dec r.Sstatus_Sstatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sstatus_UIE:Sstatus ->(1)words$word -> Sstatus) v x=
    (( v with<|
     Sstatus_Sstatus_chunk_0 :=
       ((update_subrange_vec_dec v.Sstatus_Sstatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val get_sstatus_UXL : Sstatus -> mword ty2*)

val _ = Define `
 ((get_sstatus_UXL:Sstatus ->(2)words$word) s=
    (let m = (Mk_Mstatus ((get_Sstatus_bits s  :  32 words$word))) in
   (get_mstatus_UXL m  :  2 words$word)))`;


(*val set_sstatus_UXL : Sstatus -> mword ty2 -> Sstatus*)

val _ = Define `
 ((set_sstatus_UXL:Sstatus ->(2)words$word -> Sstatus) (s : Sstatus) (a : arch_xlen)=
    (let m = (Mk_Mstatus ((get_Sstatus_bits s  :  32 words$word))) in
   let m = (set_mstatus_UXL m a) in
   Mk_Sstatus ((get_Mstatus_bits m  :  32 words$word))))`;


(*val lower_mstatus : Mstatus -> Sstatus*)

val _ = Define `
 ((lower_mstatus:Mstatus -> Sstatus) m=
    (let s = (Mk_Sstatus ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))) in
   let s = (update_Sstatus_SD s ((get_Mstatus_SD m  :  1 words$word))) in
   let s = (set_sstatus_UXL s ((get_mstatus_UXL m  :  2 words$word))) in
   let s = (update_Sstatus_MXR s ((get_Mstatus_MXR m  :  1 words$word))) in
   let s = (update_Sstatus_SUM s ((get_Mstatus_SUM m  :  1 words$word))) in
   let s = (update_Sstatus_XS s ((get_Mstatus_XS m  :  2 words$word))) in
   let s = (update_Sstatus_FS s ((get_Mstatus_FS m  :  2 words$word))) in
   let s = (update_Sstatus_SPP s ((get_Mstatus_SPP m  :  1 words$word))) in
   let s = (update_Sstatus_SPIE s ((get_Mstatus_SPIE m  :  1 words$word))) in
   let s = (update_Sstatus_UPIE s ((get_Mstatus_UPIE m  :  1 words$word))) in
   let s = (update_Sstatus_SIE s ((get_Mstatus_SIE m  :  1 words$word))) in
   update_Sstatus_UIE s ((get_Mstatus_UIE m  :  1 words$word))))`;


(*val lift_sstatus : Mstatus -> Sstatus -> M Mstatus*)

val _ = Define `
 ((lift_sstatus:Mstatus -> Sstatus ->(regstate)sail2_state_monad$sequential_state ->(((Mstatus),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (m : Mstatus) (s : Sstatus)=
    (let m = (update_Mstatus_MXR m ((get_Sstatus_MXR s  :  1 words$word))) in
   let m = (update_Mstatus_SUM m ((get_Sstatus_SUM s  :  1 words$word))) in
   let m = (update_Mstatus_XS m ((get_Sstatus_XS s  :  2 words$word))) in
   let m = (update_Mstatus_FS m ((get_Sstatus_FS s  :  2 words$word))) in sail2_state_monad$bindS
   (sail2_state$or_boolS
     ( sail2_state_monad$bindS(extStatus_of_bits ((get_Mstatus_FS m  :  2 words$word))) (\ (w__0 : ExtStatus) . 
      sail2_state_monad$returnS (((w__0 = Dirty)))))
     ( sail2_state_monad$bindS(extStatus_of_bits ((get_Mstatus_XS m  :  2 words$word))) (\ (w__1 : ExtStatus) . 
      sail2_state_monad$returnS (((w__1 = Dirty)))))) (\ dirty . 
   let m = (update_Mstatus_SD m ((bool_to_bits dirty  :  1 words$word))) in
   let m = (update_Mstatus_SPP m ((get_Sstatus_SPP s  :  1 words$word))) in
   let m = (update_Mstatus_SPIE m ((get_Sstatus_SPIE s  :  1 words$word))) in
   let m = (update_Mstatus_UPIE m ((get_Sstatus_UPIE s  :  1 words$word))) in
   let m = (update_Mstatus_SIE m ((get_Sstatus_SIE s  :  1 words$word))) in
   let m = (update_Mstatus_UIE m ((get_Sstatus_UIE s  :  1 words$word))) in
   sail2_state_monad$returnS m)))`;


(*val legalize_sstatus : Mstatus -> mword ty32 -> M Mstatus*)

val _ = Define `
 ((legalize_sstatus:Mstatus ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Mstatus),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (m : Mstatus) (v : xlenbits)=  (sail2_state_monad$bindS
   (lift_sstatus m ((Mk_Sstatus v))) (\ (w__0 : Mstatus) . 
   legalize_mstatus m ((get_Mstatus_bits w__0  :  32 words$word)))))`;


(*val Mk_Sedeleg : mword ty32 -> Sedeleg*)

val _ = Define `
 ((Mk_Sedeleg:(32)words$word -> Sedeleg) v=
    (<| Sedeleg_Sedeleg_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Sedeleg_bits:Sedeleg ->(32)words$word) v=  ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Sedeleg_bits:((regstate),(register_value),(Sedeleg))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_bits:Sedeleg ->(32)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_UEnvCall:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_UEnvCall:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_UEnvCall:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_SAMO_Access_Fault:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_SAMO_Access_Fault:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_SAMO_Access_Fault:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_SAMO_Addr_Align:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_SAMO_Addr_Align:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_SAMO_Addr_Align:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_Load_Access_Fault:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_Load_Access_Fault:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_Load_Access_Fault:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_Load_Addr_Align:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_Load_Addr_Align:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_Load_Addr_Align:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_Breakpoint:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_Breakpoint:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_Breakpoint:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_Illegal_Instr:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_Illegal_Instr:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_Illegal_Instr:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_Fetch_Access_Fault:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_Fetch_Access_Fault:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_Fetch_Access_Fault:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sedeleg_Fetch_Addr_Align:Sedeleg ->(1)words$word) v=
    ((subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sedeleg_Fetch_Addr_Align:((regstate),(register_value),(Sedeleg))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sedeleg_Sedeleg_chunk_0 :=
         ((update_subrange_vec_dec r.Sedeleg_Sedeleg_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sedeleg_Fetch_Addr_Align:Sedeleg ->(1)words$word -> Sedeleg) v x=
    (( v with<|
     Sedeleg_Sedeleg_chunk_0 :=
       ((update_subrange_vec_dec v.Sedeleg_Sedeleg_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val legalize_sedeleg : Sedeleg -> mword ty32 -> Sedeleg*)

val _ = Define `
 ((legalize_sedeleg:Sedeleg ->(32)words$word -> Sedeleg) (s : Sedeleg) (v : xlenbits)=
    (Mk_Sedeleg ((EXTZ (( 32 : int):ii) ((subrange_vec_dec v (( 8 : int):ii) (( 0 : int):ii)  :  9 words$word))  :  32 words$word))))`;


(*val Mk_Sinterrupts : mword ty32 -> Sinterrupts*)

val _ = Define `
 ((Mk_Sinterrupts:(32)words$word -> Sinterrupts) v=
    (<| Sinterrupts_Sinterrupts_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Sinterrupts_bits:Sinterrupts ->(32)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_bits:((regstate),(register_value),(Sinterrupts))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_bits:Sinterrupts ->(32)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sinterrupts_SEI:Sinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 9 : int):ii) (( 9 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_SEI:((regstate),(register_value),(Sinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_SEI:Sinterrupts ->(1)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 9 : int):ii) (( 9 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sinterrupts_UEI:Sinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_UEI:((regstate),(register_value),(Sinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_UEI:Sinterrupts ->(1)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sinterrupts_STI:Sinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_STI:((regstate),(register_value),(Sinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_STI:Sinterrupts ->(1)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sinterrupts_UTI:Sinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_UTI:((regstate),(register_value),(Sinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_UTI:Sinterrupts ->(1)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sinterrupts_SSI:Sinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_SSI:((regstate),(register_value),(Sinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_SSI:Sinterrupts ->(1)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Sinterrupts_USI:Sinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Sinterrupts_USI:((regstate),(register_value),(Sinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Sinterrupts_Sinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Sinterrupts_Sinterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Sinterrupts_USI:Sinterrupts ->(1)words$word -> Sinterrupts) v x=
    (( v with<|
     Sinterrupts_Sinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Sinterrupts_Sinterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val lower_mip : Minterrupts -> Minterrupts -> Sinterrupts*)

val _ = Define `
 ((lower_mip:Minterrupts -> Minterrupts -> Sinterrupts) (m : Minterrupts) (d : Minterrupts)=
    (let (s : Sinterrupts) = (Mk_Sinterrupts ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))) in
   let s =
     (update_Sinterrupts_SEI s
       ((and_vec ((get_Minterrupts_SEI m  :  1 words$word)) ((get_Minterrupts_SEI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_STI s
       ((and_vec ((get_Minterrupts_STI m  :  1 words$word)) ((get_Minterrupts_STI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_SSI s
       ((and_vec ((get_Minterrupts_SSI m  :  1 words$word)) ((get_Minterrupts_SSI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_UEI s
       ((and_vec ((get_Minterrupts_UEI m  :  1 words$word)) ((get_Minterrupts_UEI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_UTI s
       ((and_vec ((get_Minterrupts_UTI m  :  1 words$word)) ((get_Minterrupts_UTI d  :  1 words$word))
          :  1 words$word))) in
   update_Sinterrupts_USI s
     ((and_vec ((get_Minterrupts_USI m  :  1 words$word)) ((get_Minterrupts_USI d  :  1 words$word))
        :  1 words$word))))`;


(*val lower_mie : Minterrupts -> Minterrupts -> Sinterrupts*)

val _ = Define `
 ((lower_mie:Minterrupts -> Minterrupts -> Sinterrupts) (m : Minterrupts) (d : Minterrupts)=
    (let (s : Sinterrupts) = (Mk_Sinterrupts ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))) in
   let s =
     (update_Sinterrupts_SEI s
       ((and_vec ((get_Minterrupts_SEI m  :  1 words$word)) ((get_Minterrupts_SEI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_STI s
       ((and_vec ((get_Minterrupts_STI m  :  1 words$word)) ((get_Minterrupts_STI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_SSI s
       ((and_vec ((get_Minterrupts_SSI m  :  1 words$word)) ((get_Minterrupts_SSI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_UEI s
       ((and_vec ((get_Minterrupts_UEI m  :  1 words$word)) ((get_Minterrupts_UEI d  :  1 words$word))
          :  1 words$word))) in
   let s =
     (update_Sinterrupts_UTI s
       ((and_vec ((get_Minterrupts_UTI m  :  1 words$word)) ((get_Minterrupts_UTI d  :  1 words$word))
          :  1 words$word))) in
   update_Sinterrupts_USI s
     ((and_vec ((get_Minterrupts_USI m  :  1 words$word)) ((get_Minterrupts_USI d  :  1 words$word))
        :  1 words$word))))`;


(*val lift_sip : Minterrupts -> Minterrupts -> Sinterrupts -> M Minterrupts*)

val _ = Define `
 ((lift_sip:Minterrupts -> Minterrupts -> Sinterrupts ->(regstate)sail2_state_monad$sequential_state ->(((Minterrupts),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (o1 : Minterrupts) (d : Minterrupts) (s : Sinterrupts)=
    (let (m : Minterrupts) = o1 in
   let m =
     (if (((((get_Minterrupts_SSI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
       update_Minterrupts_SSI m ((get_Sinterrupts_SSI s  :  1 words$word))
     else m) in sail2_state_monad$bindS
   (haveNExt () ) (\ (w__0 : bool) . 
   sail2_state_monad$returnS (if w__0 then
             let m =
               (if (((((get_Minterrupts_UEI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
                 update_Minterrupts_UEI m ((get_Sinterrupts_UEI s  :  1 words$word))
               else m) in
             if (((((get_Minterrupts_USI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
               update_Minterrupts_USI m ((get_Sinterrupts_USI s  :  1 words$word))
             else m
           else m))))`;


(*val legalize_sip : Minterrupts -> Minterrupts -> mword ty32 -> M Minterrupts*)

val _ = Define `
 ((legalize_sip:Minterrupts -> Minterrupts ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Minterrupts),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (m : Minterrupts) (d : Minterrupts) (v : xlenbits)=
    (lift_sip m d ((Mk_Sinterrupts v))))`;


(*val lift_sie : Minterrupts -> Minterrupts -> Sinterrupts -> M Minterrupts*)

val _ = Define `
 ((lift_sie:Minterrupts -> Minterrupts -> Sinterrupts ->(regstate)sail2_state_monad$sequential_state ->(((Minterrupts),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (o1 : Minterrupts) (d : Minterrupts) (s : Sinterrupts)=
    (let (m : Minterrupts) = o1 in
   let m =
     (if (((((get_Minterrupts_SEI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
       update_Minterrupts_SEI m ((get_Sinterrupts_SEI s  :  1 words$word))
     else m) in
   let m =
     (if (((((get_Minterrupts_STI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
       update_Minterrupts_STI m ((get_Sinterrupts_STI s  :  1 words$word))
     else m) in
   let m =
     (if (((((get_Minterrupts_SSI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
       update_Minterrupts_SSI m ((get_Sinterrupts_SSI s  :  1 words$word))
     else m) in sail2_state_monad$bindS
   (haveNExt () ) (\ (w__0 : bool) . 
   sail2_state_monad$returnS (if w__0 then
             let m =
               (if (((((get_Minterrupts_UEI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
                 update_Minterrupts_UEI m ((get_Sinterrupts_UEI s  :  1 words$word))
               else m) in
             let m =
               (if (((((get_Minterrupts_UTI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
                 update_Minterrupts_UTI m ((get_Sinterrupts_UTI s  :  1 words$word))
               else m) in
             if (((((get_Minterrupts_USI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
               update_Minterrupts_USI m ((get_Sinterrupts_USI s  :  1 words$word))
             else m
           else m))))`;


(*val legalize_sie : Minterrupts -> Minterrupts -> mword ty32 -> M Minterrupts*)

val _ = Define `
 ((legalize_sie:Minterrupts -> Minterrupts ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Minterrupts),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (m : Minterrupts) (d : Minterrupts) (v : xlenbits)=
    (lift_sie m d ((Mk_Sinterrupts v))))`;


(*val Mk_Satp64 : mword ty64 -> Satp64*)

val _ = Define `
 ((Mk_Satp64:(64)words$word -> Satp64) v=  (<| Satp64_Satp64_chunk_0 := ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)) |>))`;


val _ = Define `
 ((get_Satp64_bits:Satp64 ->(64)words$word) v=  ((subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)))`;


val _ = Define `
 ((set_Satp64_bits:((regstate),(register_value),(Satp64))register_ref ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp64_Satp64_chunk_0 :=
         ((update_subrange_vec_dec r.Satp64_Satp64_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Satp64_bits:Satp64 ->(64)words$word -> Satp64) v x=
    (( v with<|
     Satp64_Satp64_chunk_0 :=
       ((update_subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_Satp64_Mode:Satp64 ->(4)words$word) v=  ((subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 63 : int):ii) (( 60 : int):ii)  :  4 words$word)))`;


val _ = Define `
 ((set_Satp64_Mode:((regstate),(register_value),(Satp64))register_ref ->(4)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp64_Satp64_chunk_0 :=
         ((update_subrange_vec_dec r.Satp64_Satp64_chunk_0 (( 63 : int):ii) (( 60 : int):ii)
             ((subrange_vec_dec v (( 3 : int):ii) (( 0 : int):ii)  :  4 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Satp64_Mode:Satp64 ->(4)words$word -> Satp64) v x=
    (( v with<|
     Satp64_Satp64_chunk_0 :=
       ((update_subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 63 : int):ii) (( 60 : int):ii)
           ((subrange_vec_dec x (( 3 : int):ii) (( 0 : int):ii)  :  4 words$word))
          :  64 words$word)) |>)))`;


(*val _get_Satp64_Asid : Satp64 -> mword ty16*)

val _ = Define `
 ((get_Satp64_Asid:Satp64 ->(16)words$word) v=  ((subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 59 : int):ii) (( 44 : int):ii)  :  16 words$word)))`;


(*val _set_Satp64_Asid : register_ref regstate register_value Satp64 -> mword ty16 -> M unit*)

val _ = Define `
 ((set_Satp64_Asid:((regstate),(register_value),(Satp64))register_ref ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp64_Satp64_chunk_0 :=
         ((update_subrange_vec_dec r.Satp64_Satp64_chunk_0 (( 59 : int):ii) (( 44 : int):ii)
             ((subrange_vec_dec v (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Satp64_Asid : Satp64 -> mword ty16 -> Satp64*)

val _ = Define `
 ((update_Satp64_Asid:Satp64 ->(16)words$word -> Satp64) v x=
    (( v with<|
     Satp64_Satp64_chunk_0 :=
       ((update_subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 59 : int):ii) (( 44 : int):ii)
           ((subrange_vec_dec x (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))
          :  64 words$word)) |>)))`;


(*val _update_Satp32_Asid : Satp32 -> mword ty9 -> Satp32*)

(*val _get_Satp32_Asid : Satp32 -> mword ty9*)

(*val _set_Satp32_Asid : register_ref regstate register_value Satp32 -> mword ty9 -> M unit*)

(*val _get_Satp64_PPN : Satp64 -> mword ty44*)

val _ = Define `
 ((get_Satp64_PPN:Satp64 ->(44)words$word) v=  ((subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word)))`;


(*val _set_Satp64_PPN : register_ref regstate register_value Satp64 -> mword ty44 -> M unit*)

val _ = Define `
 ((set_Satp64_PPN:((regstate),(register_value),(Satp64))register_ref ->(44)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp64_Satp64_chunk_0 :=
         ((update_subrange_vec_dec r.Satp64_Satp64_chunk_0 (( 43 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Satp64_PPN : Satp64 -> mword ty44 -> Satp64*)

val _ = Define `
 ((update_Satp64_PPN:Satp64 ->(44)words$word -> Satp64) v x=
    (( v with<|
     Satp64_Satp64_chunk_0 :=
       ((update_subrange_vec_dec v.Satp64_Satp64_chunk_0 (( 43 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
          :  64 words$word)) |>)))`;


(*val _update_Satp32_PPN : Satp32 -> mword ty22 -> Satp32*)

(*val _get_Satp32_PPN : Satp32 -> mword ty22*)

(*val _set_Satp32_PPN : register_ref regstate register_value Satp32 -> mword ty22 -> M unit*)

(*val legalize_satp64 : Architecture -> mword ty64 -> mword ty64 -> mword ty64*)

val _ = Define `
 ((legalize_satp64:Architecture ->(64)words$word ->(64)words$word ->(64)words$word) (a : Architecture) (o1 : 64 bits) (v : 64 bits)=
    (let s = (Mk_Satp64 v) in
   (case ((satp64Mode_of_bits a ((get_Satp64_Mode s  :  4 words$word)))) of
     NONE => o1
   | SOME (Sv32) => o1
   | SOME (_) => (get_Satp64_bits s  :  64 words$word)
   )))`;


(*val Mk_Satp32 : mword ty32 -> Satp32*)

val _ = Define `
 ((Mk_Satp32:(32)words$word -> Satp32) v=  (<| Satp32_Satp32_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Satp32_bits:Satp32 ->(32)words$word) v=  ((subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Satp32_bits:((regstate),(register_value),(Satp32))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp32_Satp32_chunk_0 :=
         ((update_subrange_vec_dec r.Satp32_Satp32_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Satp32_bits:Satp32 ->(32)words$word -> Satp32) v x=
    (( v with<|
     Satp32_Satp32_chunk_0 :=
       ((update_subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Satp32_Mode:Satp32 ->(1)words$word) v=  ((subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Satp32_Mode:((regstate),(register_value),(Satp32))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp32_Satp32_chunk_0 :=
         ((update_subrange_vec_dec r.Satp32_Satp32_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Satp32_Mode:Satp32 ->(1)words$word -> Satp32) v x=
    (( v with<|
     Satp32_Satp32_chunk_0 :=
       ((update_subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 31 : int):ii) (( 31 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Satp32_Asid:Satp32 ->(9)words$word) v=  ((subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 30 : int):ii) (( 22 : int):ii)  :  9 words$word)))`;


val _ = Define `
 ((set_Satp32_Asid:((regstate),(register_value),(Satp32))register_ref ->(9)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp32_Satp32_chunk_0 :=
         ((update_subrange_vec_dec r.Satp32_Satp32_chunk_0 (( 30 : int):ii) (( 22 : int):ii)
             ((subrange_vec_dec v (( 8 : int):ii) (( 0 : int):ii)  :  9 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Satp32_Asid:Satp32 ->(9)words$word -> Satp32) v x=
    (( v with<|
     Satp32_Satp32_chunk_0 :=
       ((update_subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 30 : int):ii) (( 22 : int):ii)
           ((subrange_vec_dec x (( 8 : int):ii) (( 0 : int):ii)  :  9 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Satp32_PPN:Satp32 ->(22)words$word) v=  ((subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word)))`;


val _ = Define `
 ((set_Satp32_PPN:((regstate),(register_value),(Satp32))register_ref ->(22)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Satp32_Satp32_chunk_0 :=
         ((update_subrange_vec_dec r.Satp32_Satp32_chunk_0 (( 21 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Satp32_PPN:Satp32 ->(22)words$word -> Satp32) v x=
    (( v with<|
     Satp32_Satp32_chunk_0 :=
       ((update_subrange_vec_dec v.Satp32_Satp32_chunk_0 (( 21 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word))
          :  32 words$word)) |>)))`;


(*val legalize_satp32 : Architecture -> mword ty32 -> mword ty32 -> mword ty32*)

val _ = Define `
 ((legalize_satp32:Architecture ->(32)words$word ->(32)words$word ->(32)words$word) (a : Architecture) (o1 : 32 bits) (v : 32 bits)=  v)`;


(*val PmpAddrMatchType_of_num : integer -> PmpAddrMatchType*)

val _ = Define `
 ((PmpAddrMatchType_of_num:int -> PmpAddrMatchType) arg_=
    (let l__89 = arg_ in
   if (((l__89 = (( 0 : int):ii)))) then OFF
   else if (((l__89 = (( 1 : int):ii)))) then TOR
   else if (((l__89 = (( 2 : int):ii)))) then NA4
   else NAPOT))`;


(*val num_of_PmpAddrMatchType : PmpAddrMatchType -> integer*)

val _ = Define `
 ((num_of_PmpAddrMatchType:PmpAddrMatchType -> int) arg_=
    ((case arg_ of   OFF => (( 0 : int):ii) | TOR => (( 1 : int):ii) | NA4 => (( 2 : int):ii) | NAPOT => (( 3 : int):ii) )))`;


(*val pmpAddrMatchType_of_bits : mword ty2 -> M PmpAddrMatchType*)

val _ = Define `
 ((pmpAddrMatchType_of_bits:(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((PmpAddrMatchType),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) bs=
    (let b__0 = bs in
   if (((b__0 = (0b00w :  2 words$word)))) then sail2_state_monad$returnS OFF
   else if (((b__0 = (0b01w :  2 words$word)))) then sail2_state_monad$returnS TOR
   else if (((b__0 = (0b10w :  2 words$word)))) then sail2_state_monad$returnS NA4
   else if (((b__0 = (0b11w :  2 words$word)))) then sail2_state_monad$returnS NAPOT
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_pmp_regs.sail 7:2 - 12:3") (sail2_state_monad$exitS () )))`;


(*val pmpAddrMatchType_to_bits : PmpAddrMatchType -> mword ty2*)

val _ = Define `
 ((pmpAddrMatchType_to_bits:PmpAddrMatchType ->(2)words$word) bs=
    ((case bs of
     OFF => (0b00w :  2 words$word)
   | TOR => (0b01w :  2 words$word)
   | NA4 => (0b10w :  2 words$word)
   | NAPOT => (0b11w :  2 words$word)
   )))`;


(*val Mk_Pmpcfg_ent : mword ty8 -> Pmpcfg_ent*)

val _ = Define `
 ((Mk_Pmpcfg_ent:(8)words$word -> Pmpcfg_ent) v=
    (<| Pmpcfg_ent_Pmpcfg_ent_chunk_0 := ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)) |>))`;


val _ = Define `
 ((get_Pmpcfg_ent_bits:Pmpcfg_ent ->(8)words$word) v=
    ((subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))`;


val _ = Define `
 ((set_Pmpcfg_ent_bits:((regstate),(register_value),(Pmpcfg_ent))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         ((update_subrange_vec_dec r.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Pmpcfg_ent_bits:Pmpcfg_ent ->(8)words$word -> Pmpcfg_ent) v x=
    (( v with<|
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       ((update_subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_Pmpcfg_ent_L:Pmpcfg_ent ->(1)words$word) v=
    ((subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Pmpcfg_ent_L:((regstate),(register_value),(Pmpcfg_ent))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         ((update_subrange_vec_dec r.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Pmpcfg_ent_L:Pmpcfg_ent ->(1)words$word -> Pmpcfg_ent) v x=
    (( v with<|
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       ((update_subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_Pmpcfg_ent_A:Pmpcfg_ent ->(2)words$word) v=
    ((subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)))`;


val _ = Define `
 ((set_Pmpcfg_ent_A:((regstate),(register_value),(Pmpcfg_ent))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         ((update_subrange_vec_dec r.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 4 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Pmpcfg_ent_A:Pmpcfg_ent ->(2)words$word -> Pmpcfg_ent) v x=
    (( v with<|
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       ((update_subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 4 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_Pmpcfg_ent_X:Pmpcfg_ent ->(1)words$word) v=
    ((subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Pmpcfg_ent_X:((regstate),(register_value),(Pmpcfg_ent))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         ((update_subrange_vec_dec r.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Pmpcfg_ent_X:Pmpcfg_ent ->(1)words$word -> Pmpcfg_ent) v x=
    (( v with<|
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       ((update_subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_Pmpcfg_ent_W:Pmpcfg_ent ->(1)words$word) v=
    ((subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Pmpcfg_ent_W:((regstate),(register_value),(Pmpcfg_ent))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         ((update_subrange_vec_dec r.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Pmpcfg_ent_W:Pmpcfg_ent ->(1)words$word -> Pmpcfg_ent) v x=
    (( v with<|
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       ((update_subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_Pmpcfg_ent_R:Pmpcfg_ent ->(1)words$word) v=
    ((subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Pmpcfg_ent_R:((regstate),(register_value),(Pmpcfg_ent))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         ((update_subrange_vec_dec r.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Pmpcfg_ent_R:Pmpcfg_ent ->(1)words$word -> Pmpcfg_ent) v x=
    (( v with<|
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       ((update_subrange_vec_dec v.Pmpcfg_ent_Pmpcfg_ent_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


(*val pmpReadCfgReg : integer -> M (mword ty32)*)

val _ = Define `
 ((pmpReadCfgReg:int ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) n=
    (let l__85 = n in
   if (((l__85 = (( 0 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp3cfg_ref) (\ (w__0 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp2cfg_ref) (\ (w__1 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp1cfg_ref) (\ (w__2 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp0cfg_ref) (\ (w__3 : Pmpcfg_ent) . 
     sail2_state_monad$returnS ((concat_vec ((get_Pmpcfg_ent_bits w__0  :  8 words$word))
                ((concat_vec ((get_Pmpcfg_ent_bits w__1  :  8 words$word))
                    ((concat_vec ((get_Pmpcfg_ent_bits w__2  :  8 words$word))
                        ((get_Pmpcfg_ent_bits w__3  :  8 words$word))
                       :  16 words$word))
                   :  24 words$word))
               :  32 words$word))))))
   else if (((l__85 = (( 1 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp7cfg_ref) (\ (w__4 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp6cfg_ref) (\ (w__5 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp5cfg_ref) (\ (w__6 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp4cfg_ref) (\ (w__7 : Pmpcfg_ent) . 
     sail2_state_monad$returnS ((concat_vec ((get_Pmpcfg_ent_bits w__4  :  8 words$word))
                ((concat_vec ((get_Pmpcfg_ent_bits w__5  :  8 words$word))
                    ((concat_vec ((get_Pmpcfg_ent_bits w__6  :  8 words$word))
                        ((get_Pmpcfg_ent_bits w__7  :  8 words$word))
                       :  16 words$word))
                   :  24 words$word))
               :  32 words$word))))))
   else if (((l__85 = (( 2 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp11cfg_ref) (\ (w__8 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp10cfg_ref) (\ (w__9 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp9cfg_ref) (\ (w__10 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp8cfg_ref) (\ (w__11 : Pmpcfg_ent) . 
     sail2_state_monad$returnS ((concat_vec ((get_Pmpcfg_ent_bits w__8  :  8 words$word))
                ((concat_vec ((get_Pmpcfg_ent_bits w__9  :  8 words$word))
                    ((concat_vec ((get_Pmpcfg_ent_bits w__10  :  8 words$word))
                        ((get_Pmpcfg_ent_bits w__11  :  8 words$word))
                       :  16 words$word))
                   :  24 words$word))
               :  32 words$word))))))
   else if (((l__85 = (( 3 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp15cfg_ref) (\ (w__12 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp14cfg_ref) (\ (w__13 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp13cfg_ref) (\ (w__14 : Pmpcfg_ent) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp12cfg_ref) (\ (w__15 : Pmpcfg_ent) . 
     sail2_state_monad$returnS ((concat_vec ((get_Pmpcfg_ent_bits w__12  :  8 words$word))
                ((concat_vec ((get_Pmpcfg_ent_bits w__13  :  8 words$word))
                    ((concat_vec ((get_Pmpcfg_ent_bits w__14  :  8 words$word))
                        ((get_Pmpcfg_ent_bits w__15  :  8 words$word))
                       :  16 words$word))
                   :  24 words$word))
               :  32 words$word))))))
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_pmp_regs.sail 75:2 - 85:8") (sail2_state_monad$exitS () )))`;


(*val pmpLocked : Pmpcfg_ent -> bool*)

val _ = Define `
 ((pmpLocked:Pmpcfg_ent -> bool) cfg=  (((get_Pmpcfg_ent_L cfg  :  1 words$word)) = (0b1w :  1 words$word)))`;


(*val pmpTORLocked : Pmpcfg_ent -> M bool*)

val _ = Define `
 ((pmpTORLocked:Pmpcfg_ent ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) cfg=
    (sail2_state$and_boolS (sail2_state_monad$returnS (((((get_Pmpcfg_ent_L cfg  :  1 words$word)) = (0b1w :  1 words$word)))))
     ( sail2_state_monad$bindS(pmpAddrMatchType_of_bits ((get_Pmpcfg_ent_A cfg  :  2 words$word))) (\ (w__0 :
        PmpAddrMatchType) . 
      sail2_state_monad$returnS (((w__0 = TOR)))))))`;


(*val pmpWriteCfg : Pmpcfg_ent -> mword ty8 -> Pmpcfg_ent*)

val _ = Define `
 ((pmpWriteCfg:Pmpcfg_ent ->(8)words$word -> Pmpcfg_ent) (cfg : Pmpcfg_ent) (v : 8 bits)=
    (if ((pmpLocked cfg)) then cfg
   else Mk_Pmpcfg_ent ((and_vec v (0x9Fw :  8 words$word)  :  8 words$word))))`;


(*val pmpWriteCfgReg : integer -> mword ty32 -> M unit*)

val _ = Define `
 ((pmpWriteCfgReg:int ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) n v=
    (let l__81 = n in
   if (((l__81 = (( 0 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp0cfg_ref) (\ (w__0 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp0cfg_ref ((pmpWriteCfg w__0 ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp1cfg_ref)) (\ (w__1 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp1cfg_ref ((pmpWriteCfg w__1 ((subrange_vec_dec v (( 15 : int):ii) (( 8 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp2cfg_ref)) (\ (w__2 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp2cfg_ref ((pmpWriteCfg w__2 ((subrange_vec_dec v (( 23 : int):ii) (( 16 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp3cfg_ref)) (\ (w__3 : Pmpcfg_ent) . 
     sail2_state_monad$write_regS pmp3cfg_ref ((pmpWriteCfg w__3 ((subrange_vec_dec v (( 31 : int):ii) (( 24 : int):ii)  :  8 words$word))))))))
   else if (((l__81 = (( 1 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp4cfg_ref) (\ (w__4 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp4cfg_ref ((pmpWriteCfg w__4 ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp5cfg_ref)) (\ (w__5 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp5cfg_ref ((pmpWriteCfg w__5 ((subrange_vec_dec v (( 15 : int):ii) (( 8 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp6cfg_ref)) (\ (w__6 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp6cfg_ref ((pmpWriteCfg w__6 ((subrange_vec_dec v (( 23 : int):ii) (( 16 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp7cfg_ref)) (\ (w__7 : Pmpcfg_ent) . 
     sail2_state_monad$write_regS pmp7cfg_ref ((pmpWriteCfg w__7 ((subrange_vec_dec v (( 31 : int):ii) (( 24 : int):ii)  :  8 words$word))))))))
   else if (((l__81 = (( 2 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp8cfg_ref) (\ (w__8 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp8cfg_ref ((pmpWriteCfg w__8 ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp9cfg_ref)) (\ (w__9 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp9cfg_ref ((pmpWriteCfg w__9 ((subrange_vec_dec v (( 15 : int):ii) (( 8 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp10cfg_ref)) (\ (w__10 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS
       pmp10cfg_ref
       ((pmpWriteCfg w__10 ((subrange_vec_dec v (( 23 : int):ii) (( 16 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp11cfg_ref)) (\ (w__11 : Pmpcfg_ent) . 
     sail2_state_monad$write_regS
       pmp11cfg_ref
       ((pmpWriteCfg w__11 ((subrange_vec_dec v (( 31 : int):ii) (( 24 : int):ii)  :  8 words$word))))))))
   else if (((l__81 = (( 3 : int):ii)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS pmp12cfg_ref) (\ (w__12 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp12cfg_ref ((pmpWriteCfg w__12 ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp13cfg_ref)) (\ (w__13 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS pmp13cfg_ref ((pmpWriteCfg w__13 ((subrange_vec_dec v (( 15 : int):ii) (( 8 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp14cfg_ref)) (\ (w__14 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS
       pmp14cfg_ref
       ((pmpWriteCfg w__14 ((subrange_vec_dec v (( 23 : int):ii) (( 16 : int):ii)  :  8 words$word)))))
     (sail2_state_monad$read_regS pmp15cfg_ref)) (\ (w__15 : Pmpcfg_ent) . 
     sail2_state_monad$write_regS
       pmp15cfg_ref
       ((pmpWriteCfg w__15 ((subrange_vec_dec v (( 31 : int):ii) (( 24 : int):ii)  :  8 words$word))))))))
   else sail2_state_monad$seqS
     (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_pmp_regs.sail 101:2 - 144:8") (sail2_state_monad$exitS () )))`;


(*val pmpWriteAddr : bool -> bool -> mword ty32 -> mword ty32 -> mword ty32*)

val _ = Define `
 ((pmpWriteAddr:bool -> bool ->(32)words$word ->(32)words$word ->(32)words$word) (locked : bool) (tor_locked : bool) (reg : xlenbits) (v : xlenbits)=
    (if (((locked \/ tor_locked))) then reg
   else v))`;


(*val pmpAddrRange : Pmpcfg_ent -> mword ty32 -> mword ty32 -> M (maybe ((mword ty32 * mword ty32)))*)

val _ = Define `
 ((pmpAddrRange:Pmpcfg_ent ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((((32)words$word#(32)words$word)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (cfg : Pmpcfg_ent) (pmpaddr : xlenbits) (prev_pmpaddr : xlenbits)=  (sail2_state_monad$bindS
   (pmpAddrMatchType_of_bits ((get_Pmpcfg_ent_A cfg  :  2 words$word))) (\ (w__0 : PmpAddrMatchType) . 
   sail2_state_monad$returnS ((case w__0 of
     OFF => NONE
   | TOR => SOME ((shiftl prev_pmpaddr (( 2 : int):ii)  :  32 words$word), (shiftl pmpaddr (( 2 : int):ii)  :  32 words$word))
   | NA4 =>
      let lo = ((shiftl pmpaddr (( 2 : int):ii)  :  32 words$word)) in
      SOME (lo, (add_vec_int lo (( 4 : int):ii)  :  32 words$word))
   | NAPOT =>
      let mask = ((xor_vec pmpaddr ((add_vec_int pmpaddr (( 1 : int):ii)  :  32 words$word))  :  32 words$word)) in
      let lo = ((and_vec pmpaddr ((not_vec mask  :  32 words$word))  :  32 words$word)) in
      let len = ((add_vec_int mask (( 1 : int):ii)  :  32 words$word)) in
      SOME ((shiftl lo (( 2 : int):ii)  :  32 words$word),
            (shiftl ((add_vec lo len  :  32 words$word)) (( 2 : int):ii)  :  32 words$word))
   )))))`;


(*val pmpCheckRWX : Pmpcfg_ent -> AccessType unit -> bool*)

val _ = Define `
 ((pmpCheckRWX:Pmpcfg_ent ->(unit)AccessType -> bool) ent acc=
    ((case acc of
     Read (_) => (((get_Pmpcfg_ent_R ent  :  1 words$word)) = (0b1w :  1 words$word))
   | Write (_) => (((get_Pmpcfg_ent_W ent  :  1 words$word)) = (0b1w :  1 words$word))
   | ReadWrite (_) =>
      ((((((get_Pmpcfg_ent_R ent  :  1 words$word)) = (0b1w :  1 words$word)))) /\ (((((get_Pmpcfg_ent_W ent  :  1 words$word)) = (0b1w :  1 words$word)))))
   | Execute (() ) => (((get_Pmpcfg_ent_X ent  :  1 words$word)) = (0b1w :  1 words$word))
   )))`;


(*val pmpCheckPerms : Pmpcfg_ent -> AccessType unit -> Privilege -> bool*)

val _ = Define `
 ((pmpCheckPerms:Pmpcfg_ent ->(unit)AccessType -> Privilege -> bool) ent acc priv=
    ((case priv of
     Machine => if ((pmpLocked ent)) then pmpCheckRWX ent acc else T
   | _ => pmpCheckRWX ent acc
   )))`;


(*val pmpAddrMatch_of_num : integer -> pmpAddrMatch*)

val _ = Define `
 ((pmpAddrMatch_of_num:int -> pmpAddrMatch) arg_=
    (let l__79 = arg_ in
   if (((l__79 = (( 0 : int):ii)))) then PMP_NoMatch
   else if (((l__79 = (( 1 : int):ii)))) then PMP_PartialMatch
   else PMP_Match))`;


(*val num_of_pmpAddrMatch : pmpAddrMatch -> integer*)

val _ = Define `
 ((num_of_pmpAddrMatch:pmpAddrMatch -> int) arg_=
    ((case arg_ of   PMP_NoMatch => (( 0 : int):ii) | PMP_PartialMatch => (( 1 : int):ii) | PMP_Match => (( 2 : int):ii) )))`;


(*val pmpMatchAddr : mword ty32 -> mword ty32 -> maybe ((mword ty32 * mword ty32)) -> pmpAddrMatch*)

val _ = Define `
 ((pmpMatchAddr:(32)words$word ->(32)words$word ->(xlenbits#xlenbits)option -> pmpAddrMatch) (addr : xlenbits) (width : xlenbits) (rng : pmp_addr_range)=
    ((case rng of
     NONE => PMP_NoMatch
   | SOME ((lo, hi)) =>
      if ((zopz0zI_u hi lo)) then PMP_NoMatch
      else if (((((zopz0zIzJ_u ((add_vec addr width  :  32 words$word)) lo)) \/ ((zopz0zIzJ_u hi addr))))) then
        PMP_NoMatch
      else if (((((zopz0zIzJ_u lo addr)) /\ ((zopz0zIzJ_u ((add_vec addr width  :  32 words$word)) hi))))) then
        PMP_Match
      else PMP_PartialMatch
   )))`;


(*val pmpMatch_of_num : integer -> pmpMatch*)

val _ = Define `
 ((pmpMatch_of_num:int -> pmpMatch) arg_=
    (let l__77 = arg_ in
   if (((l__77 = (( 0 : int):ii)))) then PMP_Success
   else if (((l__77 = (( 1 : int):ii)))) then PMP_Continue
   else PMP_Fail))`;


(*val num_of_pmpMatch : pmpMatch -> integer*)

val _ = Define `
 ((num_of_pmpMatch:pmpMatch -> int) arg_=
    ((case arg_ of   PMP_Success => (( 0 : int):ii) | PMP_Continue => (( 1 : int):ii) | PMP_Fail => (( 2 : int):ii) )))`;


(*val pmpMatchEntry : mword ty32 -> mword ty32 -> AccessType unit -> Privilege -> Pmpcfg_ent -> mword ty32 -> mword ty32 -> M pmpMatch*)

val _ = Define `
 ((pmpMatchEntry:(32)words$word ->(32)words$word ->(ext_access_type)AccessType -> Privilege -> Pmpcfg_ent ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((pmpMatch),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (addr : xlenbits) (width : xlenbits) (acc : ext_access_type AccessType) (priv :
  Privilege) (ent : Pmpcfg_ent) (pmpaddr : xlenbits) (prev_pmpaddr : xlenbits)=  (sail2_state_monad$bindS
   (pmpAddrRange ent pmpaddr prev_pmpaddr  : ( (( 32 words$word #  32 words$word))option) M) (\ rng . 
   sail2_state_monad$returnS ((case ((pmpMatchAddr addr width rng)) of
     PMP_NoMatch => PMP_Continue
   | PMP_PartialMatch => PMP_Fail
   | PMP_Match => if ((pmpCheckPerms ent acc priv)) then PMP_Success else PMP_Fail
   )))))`;


(*val pmpCheck : mword ty32 -> integer -> AccessType unit -> Privilege -> M (maybe ExceptionType)*)

val _ = Define `
 ((pmpCheck:(32)words$word -> int ->(ext_access_type)AccessType -> Privilege ->(regstate)sail2_state_monad$sequential_state ->((((ExceptionType)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (addr : xlenbits) (width : int) (acc : ext_access_type AccessType) (priv :
  Privilege)=
    (let (width : xlenbits) = ((to_bits (( 32 : int):ii) width  :  32 words$word)) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS pmp0cfg_ref) (\ (w__0 : Pmpcfg_ent) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS pmpaddr0_ref  : ( 32 words$word) M) (\ (w__1 :  32 words$word) .  sail2_state_monad$bindS
   (pmpMatchEntry addr width acc priv w__0 w__1 ((zeros_implicit (( 32 : int):ii)  :  32 words$word))) (\ (w__2 :
     pmpMatch) .  sail2_state_monad$bindS
   (case w__2 of
     PMP_Success => sail2_state_monad$returnS T
   | PMP_Fail => sail2_state_monad$returnS F
   | PMP_Continue => sail2_state_monad$bindS
      (sail2_state_monad$read_regS pmp1cfg_ref) (\ (w__3 : Pmpcfg_ent) .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS pmpaddr1_ref  : ( 32 words$word) M) (\ (w__4 :  32 words$word) .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS pmpaddr0_ref  : ( 32 words$word) M) (\ (w__5 :  32 words$word) .  sail2_state_monad$bindS
      (pmpMatchEntry addr width acc priv w__3 w__4 w__5) (\ (w__6 : pmpMatch) . 
      (case w__6 of
        PMP_Success => sail2_state_monad$returnS T
      | PMP_Fail => sail2_state_monad$returnS F
      | PMP_Continue => sail2_state_monad$bindS
         (sail2_state_monad$read_regS pmp2cfg_ref) (\ (w__7 : Pmpcfg_ent) .  sail2_state_monad$bindS
         (sail2_state_monad$read_regS pmpaddr2_ref  : ( 32 words$word) M) (\ (w__8 :  32 words$word) .  sail2_state_monad$bindS
         (sail2_state_monad$read_regS pmpaddr1_ref  : ( 32 words$word) M) (\ (w__9 :  32 words$word) .  sail2_state_monad$bindS
         (pmpMatchEntry addr width acc priv w__7 w__8 w__9) (\ (w__10 : pmpMatch) . 
         (case w__10 of
           PMP_Success => sail2_state_monad$returnS T
         | PMP_Fail => sail2_state_monad$returnS F
         | PMP_Continue => sail2_state_monad$bindS
            (sail2_state_monad$read_regS pmp3cfg_ref) (\ (w__11 : Pmpcfg_ent) .  sail2_state_monad$bindS
            (sail2_state_monad$read_regS pmpaddr3_ref  : ( 32 words$word) M) (\ (w__12 :  32 words$word) .  sail2_state_monad$bindS
            (sail2_state_monad$read_regS pmpaddr2_ref  : ( 32 words$word) M) (\ (w__13 :  32 words$word) .  sail2_state_monad$bindS
            (pmpMatchEntry addr width acc priv w__11 w__12 w__13) (\ (w__14 : pmpMatch) . 
            (case w__14 of
              PMP_Success => sail2_state_monad$returnS T
            | PMP_Fail => sail2_state_monad$returnS F
            | PMP_Continue => sail2_state_monad$bindS
               (sail2_state_monad$read_regS pmp4cfg_ref) (\ (w__15 : Pmpcfg_ent) .  sail2_state_monad$bindS
               (sail2_state_monad$read_regS pmpaddr4_ref  : ( 32 words$word) M) (\ (w__16 :  32 words$word) .  sail2_state_monad$bindS
               (sail2_state_monad$read_regS pmpaddr3_ref  : ( 32 words$word) M) (\ (w__17 :  32 words$word) .  sail2_state_monad$bindS
               (pmpMatchEntry addr width acc priv w__15 w__16 w__17) (\ (w__18 : pmpMatch) . 
               (case w__18 of
                 PMP_Success => sail2_state_monad$returnS T
               | PMP_Fail => sail2_state_monad$returnS F
               | PMP_Continue => sail2_state_monad$bindS
                  (sail2_state_monad$read_regS pmp5cfg_ref) (\ (w__19 : Pmpcfg_ent) .  sail2_state_monad$bindS
                  (sail2_state_monad$read_regS pmpaddr5_ref  : ( 32 words$word) M) (\ (w__20 :  32 words$word) .  sail2_state_monad$bindS
                  (sail2_state_monad$read_regS pmpaddr4_ref  : ( 32 words$word) M) (\ (w__21 :  32 words$word) .  sail2_state_monad$bindS
                  (pmpMatchEntry addr width acc priv w__19 w__20 w__21) (\ (w__22 : pmpMatch) . 
                  (case w__22 of
                    PMP_Success => sail2_state_monad$returnS T
                  | PMP_Fail => sail2_state_monad$returnS F
                  | PMP_Continue => sail2_state_monad$bindS
                     (sail2_state_monad$read_regS pmp6cfg_ref) (\ (w__23 : Pmpcfg_ent) .  sail2_state_monad$bindS
                     (sail2_state_monad$read_regS pmpaddr6_ref  : ( 32 words$word) M) (\ (w__24 :  32 words$word) .  sail2_state_monad$bindS
                     (sail2_state_monad$read_regS pmpaddr5_ref  : ( 32 words$word) M) (\ (w__25 :  32 words$word) .  sail2_state_monad$bindS
                     (pmpMatchEntry addr width acc priv w__23 w__24 w__25) (\ (w__26 : pmpMatch) . 
                     (case w__26 of
                       PMP_Success => sail2_state_monad$returnS T
                     | PMP_Fail => sail2_state_monad$returnS F
                     | PMP_Continue => sail2_state_monad$bindS
                        (sail2_state_monad$read_regS pmp7cfg_ref) (\ (w__27 : Pmpcfg_ent) .  sail2_state_monad$bindS
                        (sail2_state_monad$read_regS pmpaddr7_ref  : ( 32 words$word) M) (\ (w__28 :  32 words$word) .  sail2_state_monad$bindS
                        (sail2_state_monad$read_regS pmpaddr6_ref  : ( 32 words$word) M) (\ (w__29 :  32 words$word) .  sail2_state_monad$bindS
                        (pmpMatchEntry addr width acc priv w__27 w__28 w__29) (\ (w__30 :
                          pmpMatch) . 
                        (case w__30 of
                          PMP_Success => sail2_state_monad$returnS T
                        | PMP_Fail => sail2_state_monad$returnS F
                        | PMP_Continue => sail2_state_monad$bindS
                           (sail2_state_monad$read_regS pmp8cfg_ref) (\ (w__31 : Pmpcfg_ent) .  sail2_state_monad$bindS
                           (sail2_state_monad$read_regS pmpaddr8_ref  : ( 32 words$word) M) (\ (w__32 :  32 words$word) .  sail2_state_monad$bindS
                           (sail2_state_monad$read_regS pmpaddr7_ref  : ( 32 words$word) M) (\ (w__33 :  32 words$word) .  sail2_state_monad$bindS
                           (pmpMatchEntry addr width acc priv w__31 w__32 w__33) (\ (w__34 :
                             pmpMatch) . 
                           (case w__34 of
                             PMP_Success => sail2_state_monad$returnS T
                           | PMP_Fail => sail2_state_monad$returnS F
                           | PMP_Continue => sail2_state_monad$bindS
                              (sail2_state_monad$read_regS pmp9cfg_ref) (\ (w__35 : Pmpcfg_ent) .  sail2_state_monad$bindS
                              (sail2_state_monad$read_regS pmpaddr9_ref  : ( 32 words$word) M) (\ (w__36 :  32 words$word) .  sail2_state_monad$bindS
                              (sail2_state_monad$read_regS pmpaddr8_ref  : ( 32 words$word) M) (\ (w__37 :  32 words$word) .  sail2_state_monad$bindS
                              (pmpMatchEntry addr width acc priv w__35 w__36 w__37) (\ (w__38 :
                                pmpMatch) . 
                              (case w__38 of
                                PMP_Success => sail2_state_monad$returnS T
                              | PMP_Fail => sail2_state_monad$returnS F
                              | PMP_Continue => sail2_state_monad$bindS
                                 (sail2_state_monad$read_regS pmp10cfg_ref) (\ (w__39 : Pmpcfg_ent) .  sail2_state_monad$bindS
                                 (sail2_state_monad$read_regS pmpaddr10_ref  : ( 32 words$word) M) (\ (w__40 :
                                    32 words$word) .  sail2_state_monad$bindS
                                 (sail2_state_monad$read_regS pmpaddr9_ref  : ( 32 words$word) M) (\ (w__41 :
                                    32 words$word) .  sail2_state_monad$bindS
                                 (pmpMatchEntry addr width acc priv w__39 w__40 w__41) (\ (w__42 :
                                   pmpMatch) . 
                                 (case w__42 of
                                   PMP_Success => sail2_state_monad$returnS T
                                 | PMP_Fail => sail2_state_monad$returnS F
                                 | PMP_Continue => sail2_state_monad$bindS
                                    (sail2_state_monad$read_regS pmp11cfg_ref) (\ (w__43 : Pmpcfg_ent) .  sail2_state_monad$bindS
                                    (sail2_state_monad$read_regS pmpaddr11_ref  : ( 32 words$word) M) (\ (w__44 :
                                       32 words$word) .  sail2_state_monad$bindS
                                    (sail2_state_monad$read_regS pmpaddr10_ref  : ( 32 words$word) M) (\ (w__45 :
                                       32 words$word) .  sail2_state_monad$bindS
                                    (pmpMatchEntry addr width acc priv w__43 w__44 w__45) (\ (w__46 :
                                      pmpMatch) . 
                                    (case w__46 of
                                      PMP_Success => sail2_state_monad$returnS T
                                    | PMP_Fail => sail2_state_monad$returnS F
                                    | PMP_Continue => sail2_state_monad$bindS
                                       (sail2_state_monad$read_regS pmp12cfg_ref) (\ (w__47 : Pmpcfg_ent) .  sail2_state_monad$bindS
                                       (sail2_state_monad$read_regS pmpaddr12_ref  : ( 32 words$word) M) (\ (w__48 :
                                          32 words$word) .  sail2_state_monad$bindS
                                       (sail2_state_monad$read_regS pmpaddr11_ref  : ( 32 words$word) M) (\ (w__49 :
                                          32 words$word) .  sail2_state_monad$bindS
                                       (pmpMatchEntry addr width acc priv w__47 w__48 w__49) (\ (w__50 :
                                         pmpMatch) . 
                                       (case w__50 of
                                         PMP_Success => sail2_state_monad$returnS T
                                       | PMP_Fail => sail2_state_monad$returnS F
                                       | PMP_Continue => sail2_state_monad$bindS
                                          (sail2_state_monad$read_regS pmp13cfg_ref) (\ (w__51 : Pmpcfg_ent) .  sail2_state_monad$bindS
                                          (sail2_state_monad$read_regS pmpaddr13_ref  : ( 32 words$word) M) (\ (w__52 :
                                             32 words$word) .  sail2_state_monad$bindS
                                          (sail2_state_monad$read_regS pmpaddr12_ref  : ( 32 words$word) M) (\ (w__53 :
                                             32 words$word) .  sail2_state_monad$bindS
                                          (pmpMatchEntry addr width acc priv w__51 w__52 w__53) (\ (w__54 :
                                            pmpMatch) . 
                                          (case w__54 of
                                            PMP_Success => sail2_state_monad$returnS T
                                          | PMP_Fail => sail2_state_monad$returnS F
                                          | PMP_Continue => sail2_state_monad$bindS
                                             (sail2_state_monad$read_regS pmp14cfg_ref) (\ (w__55 : Pmpcfg_ent) .  sail2_state_monad$bindS
                                             (sail2_state_monad$read_regS pmpaddr14_ref  : ( 32 words$word) M) (\ (w__56 :
                                                32 words$word) .  sail2_state_monad$bindS
                                             (sail2_state_monad$read_regS pmpaddr13_ref  : ( 32 words$word) M) (\ (w__57 :
                                                32 words$word) .  sail2_state_monad$bindS
                                             (pmpMatchEntry addr width acc priv w__55 w__56 w__57) (\ (w__58 :
                                               pmpMatch) . 
                                             (case w__58 of
                                               PMP_Success => sail2_state_monad$returnS T
                                             | PMP_Fail => sail2_state_monad$returnS F
                                             | PMP_Continue => sail2_state_monad$bindS
                                                (sail2_state_monad$read_regS pmp15cfg_ref) (\ (w__59 : Pmpcfg_ent) .  sail2_state_monad$bindS
                                                (sail2_state_monad$read_regS pmpaddr15_ref  : ( 32 words$word) M) (\ (w__60 :
                                                   32 words$word) .  sail2_state_monad$bindS
                                                (sail2_state_monad$read_regS pmpaddr14_ref  : ( 32 words$word) M) (\ (w__61 :
                                                   32 words$word) .  sail2_state_monad$bindS
                                                (pmpMatchEntry addr width acc priv w__59 w__60 w__61) (\ (w__62 :
                                                  pmpMatch) . 
                                                sail2_state_monad$returnS ((case w__62 of
                                                  PMP_Success => T
                                                | PMP_Fail => F
                                                | PMP_Continue =>
                                                   (case priv of
                                                     Machine => T
                                                   | _ => F
                                                   )
                                                ))))))
                                             )))))
                                          )))))
                                       )))))
                                    )))))
                                 )))))
                              )))))
                           )))))
                        )))))
                     )))))
                  )))))
               )))))
            )))))
         )))))
      )))))
   ) (\ (check' : bool) . 
   sail2_state_monad$returnS (if check' then NONE
           else
             (case acc of
               Read (_) => SOME (E_Load_Access_Fault () )
             | Write (_) => SOME (E_SAMO_Access_Fault () )
             | ReadWrite (_) => SOME (E_SAMO_Access_Fault () )
             | Execute (() ) => SOME (E_Fetch_Access_Fault () )
             ))))))))`;


(*val init_pmp : unit -> M unit*)

val _ = Define `
 ((init_pmp:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS pmp0cfg_ref) (\ (w__0 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp0cfg_ref ((update_Pmpcfg_ent_A w__0 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp1cfg_ref)) (\ (w__1 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp1cfg_ref ((update_Pmpcfg_ent_A w__1 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp2cfg_ref)) (\ (w__2 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp2cfg_ref ((update_Pmpcfg_ent_A w__2 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp3cfg_ref)) (\ (w__3 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp3cfg_ref ((update_Pmpcfg_ent_A w__3 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp4cfg_ref)) (\ (w__4 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp4cfg_ref ((update_Pmpcfg_ent_A w__4 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp5cfg_ref)) (\ (w__5 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp5cfg_ref ((update_Pmpcfg_ent_A w__5 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp6cfg_ref)) (\ (w__6 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp6cfg_ref ((update_Pmpcfg_ent_A w__6 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp7cfg_ref)) (\ (w__7 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp7cfg_ref ((update_Pmpcfg_ent_A w__7 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp8cfg_ref)) (\ (w__8 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp8cfg_ref ((update_Pmpcfg_ent_A w__8 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp9cfg_ref)) (\ (w__9 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS pmp9cfg_ref ((update_Pmpcfg_ent_A w__9 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp10cfg_ref)) (\ (w__10 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS
     pmp10cfg_ref
     ((update_Pmpcfg_ent_A w__10 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp11cfg_ref)) (\ (w__11 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS
     pmp11cfg_ref
     ((update_Pmpcfg_ent_A w__11 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp12cfg_ref)) (\ (w__12 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS
     pmp12cfg_ref
     ((update_Pmpcfg_ent_A w__12 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp13cfg_ref)) (\ (w__13 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS
     pmp13cfg_ref
     ((update_Pmpcfg_ent_A w__13 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp14cfg_ref)) (\ (w__14 : Pmpcfg_ent) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS
     pmp14cfg_ref
     ((update_Pmpcfg_ent_A w__14 ((pmpAddrMatchType_to_bits OFF  :  2 words$word)))))
   (sail2_state_monad$read_regS pmp15cfg_ref)) (\ (w__15 : Pmpcfg_ent) . 
   sail2_state_monad$write_regS
     pmp15cfg_ref
     ((update_Pmpcfg_ent_A w__15 ((pmpAddrMatchType_to_bits OFF  :  2 words$word))))))))))))))))))))))`;


(*val ext_init_regs : unit -> M unit*)

val _ = Define `
 ((ext_init_regs:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$returnS () ))`;


(*
This function is called after above when running rvfi and allows the model
to be initialised differently (e.g. CHERI cap regs are initialised
to omnipotent instead of null).
*)
(*val ext_rvfi_init : unit -> M unit*)

val _ = Define `
 ((ext_rvfi_init:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS x1_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$write_regS x1_ref w__0)))`;


(*
THIS(csrno, priv, isWrite) allows an extension to block access to csrno,
at Privilege level priv. It should return true if the access is allowed.
*)
(*val ext_check_CSR : mword ty12 -> Privilege -> bool -> bool*)

val _ = Define `
 ((ext_check_CSR:(12)words$word -> Privilege -> bool -> bool) csrno p isWrite=  T)`;


(*
THIS is called if ext_check_CSR returns false. It should
cause an appropriate RISCV exception.
*)
(*val ext_check_CSR_fail : unit -> unit*)

val _ = Define `
 ((ext_check_CSR_fail:unit -> unit) () =  () )`;


(*
Validate a read from physical memory.
THIS(access_type, paddr, size, aquire, release, reserved, read_meta) should
return Some(exception) to abort the read or None to allow it to proceed. The
check is performed after PMP checks and does not apply to MMIO memory.
*)
(*val ext_check_phys_mem_read : AccessType unit -> mword ty32 -> integer -> bool -> bool -> bool -> bool -> Ext_PhysAddr_Check*)

(*
Validate a write to physical memory.
THIS(write_kind, paddr, size, data, metadata) should return Some(exception)
to abort the write or None to allow it to proceed. The check is performed 
after PMP checks and does not apply to MMIO memory.
*)
(*val ext_check_phys_mem_write : forall 'int8_times_n. Size 'int8_times_n => write_kind -> mword ty32 -> integer -> mword 'int8_times_n -> unit -> Ext_PhysAddr_Check*)

(*val ext_fetch_check_pc : mword ty32 -> mword ty32 -> Ext_FetchAddr_Check unit*)

val _ = Define `
 ((ext_fetch_check_pc:(32)words$word ->(32)words$word ->(unit)Ext_FetchAddr_Check) (start_pc : xlenbits) (pc : xlenbits)=  (Ext_FetchAddr_OK pc))`;


(*val ext_handle_fetch_check_error : unit -> unit*)

val _ = Define `
 ((ext_handle_fetch_check_error:unit -> unit) err=  () )`;


(*val ext_control_check_addr : mword ty32 -> Ext_ControlAddr_Check unit*)

val _ = Define `
 ((ext_control_check_addr:(32)words$word ->(unit)Ext_ControlAddr_Check) pc=  (Ext_ControlAddr_OK pc))`;


(*val ext_control_check_pc : mword ty32 -> Ext_ControlAddr_Check unit*)

val _ = Define `
 ((ext_control_check_pc:(32)words$word ->(unit)Ext_ControlAddr_Check) pc=  (Ext_ControlAddr_OK pc))`;


(*val ext_handle_control_check_error : unit -> unit*)

val _ = Define `
 ((ext_handle_control_check_error:unit -> unit) err=  () )`;


(*val ext_data_get_addr : mword ty5 -> mword ty32 -> AccessType unit -> word_width -> M (Ext_DataAddr_Check unit)*)

val _ = Define `
 ((ext_data_get_addr:(5)words$word ->(32)words$word ->(ext_access_type)AccessType -> word_width ->(regstate)sail2_state_monad$sequential_state ->((((unit)Ext_DataAddr_Check),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (base : regidx) (offset : xlenbits) (acc : ext_access_type AccessType) (width :
  word_width)=  (sail2_state_monad$bindS
   (rX_bits base  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let addr = ((add_vec w__0 offset  :  32 words$word)) in
   sail2_state_monad$returnS (Ext_DataAddr_OK addr))))`;


(*val ext_handle_data_check_error : unit -> unit*)

val _ = Define `
 ((ext_handle_data_check_error:unit -> unit) err=  () )`;


val _ = Define `
 ((ext_check_phys_mem_read:(unit)AccessType ->(32)words$word -> int -> bool -> bool -> bool -> bool -> Ext_PhysAddr_Check) access_type paddr size1 aquire release reserved read_meta=
    (Ext_PhysAddr_OK () ))`;


val _ = Define `
 ((ext_check_phys_mem_write:write_kind ->(32)words$word -> int -> 'int8_times_n words$word -> unit -> Ext_PhysAddr_Check) write_kind paddr size1 data metadata=  (Ext_PhysAddr_OK () ))`;


(*val csr_name_map_forwards : mword ty12 -> string*)

(*val csr_name_map_backwards : string -> M (mword ty12)*)

(*val csr_name_map_forwards_matches : mword ty12 -> bool*)

(*val csr_name_map_backwards_matches : string -> M bool*)

(*val csr_name_map_matches_prefix : string -> maybe ((mword ty12 * ii))*)

(*val ext_is_CSR_defined : mword ty12 -> Privilege -> M bool*)

(*val ext_read_CSR : mword ty12 -> M (maybe (mword ty32))*)

(*val ext_write_CSR : mword ty12 -> mword ty32 -> M (maybe (mword ty32))*)

(*val Mk_Ustatus : mword ty32 -> Ustatus*)

val _ = Define `
 ((Mk_Ustatus:(32)words$word -> Ustatus) v=
    (<| Ustatus_Ustatus_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Ustatus_bits:Ustatus ->(32)words$word) v=  ((subrange_vec_dec v.Ustatus_Ustatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Ustatus_bits:((regstate),(register_value),(Ustatus))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Ustatus_Ustatus_chunk_0 :=
         ((update_subrange_vec_dec r.Ustatus_Ustatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Ustatus_bits:Ustatus ->(32)words$word -> Ustatus) v x=
    (( v with<|
     Ustatus_Ustatus_chunk_0 :=
       ((update_subrange_vec_dec v.Ustatus_Ustatus_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Ustatus_UPIE:Ustatus ->(1)words$word) v=  ((subrange_vec_dec v.Ustatus_Ustatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Ustatus_UPIE:((regstate),(register_value),(Ustatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Ustatus_Ustatus_chunk_0 :=
         ((update_subrange_vec_dec r.Ustatus_Ustatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Ustatus_UPIE:Ustatus ->(1)words$word -> Ustatus) v x=
    (( v with<|
     Ustatus_Ustatus_chunk_0 :=
       ((update_subrange_vec_dec v.Ustatus_Ustatus_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Ustatus_UIE:Ustatus ->(1)words$word) v=  ((subrange_vec_dec v.Ustatus_Ustatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Ustatus_UIE:((regstate),(register_value),(Ustatus))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Ustatus_Ustatus_chunk_0 :=
         ((update_subrange_vec_dec r.Ustatus_Ustatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Ustatus_UIE:Ustatus ->(1)words$word -> Ustatus) v x=
    (( v with<|
     Ustatus_Ustatus_chunk_0 :=
       ((update_subrange_vec_dec v.Ustatus_Ustatus_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val lower_sstatus : Sstatus -> Ustatus*)

val _ = Define `
 ((lower_sstatus:Sstatus -> Ustatus) s=
    (let u = (Mk_Ustatus ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))) in
   let u = (update_Ustatus_UPIE u ((get_Sstatus_UPIE s  :  1 words$word))) in
   update_Ustatus_UIE u ((get_Sstatus_UIE s  :  1 words$word))))`;


(*val lift_ustatus : Sstatus -> Ustatus -> Sstatus*)

val _ = Define `
 ((lift_ustatus:Sstatus -> Ustatus -> Sstatus) (s : Sstatus) (u : Ustatus)=
    (let s = (update_Sstatus_UPIE s ((get_Ustatus_UPIE u  :  1 words$word))) in
   update_Sstatus_UIE s ((get_Ustatus_UIE u  :  1 words$word))))`;


(*val legalize_ustatus : Mstatus -> mword ty32 -> M Mstatus*)

val _ = Define `
 ((legalize_ustatus:Mstatus ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Mstatus),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (m : Mstatus) (v : xlenbits)=
    (let u = (Mk_Ustatus v) in
   let s = (lower_mstatus m) in
   let s = (lift_ustatus s u) in
   lift_sstatus m s))`;


(*val Mk_Uinterrupts : mword ty32 -> Uinterrupts*)

val _ = Define `
 ((Mk_Uinterrupts:(32)words$word -> Uinterrupts) v=
    (<| Uinterrupts_Uinterrupts_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Uinterrupts_bits:Uinterrupts ->(32)words$word) v=
    ((subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Uinterrupts_bits:((regstate),(register_value),(Uinterrupts))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Uinterrupts_Uinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Uinterrupts_Uinterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Uinterrupts_bits:Uinterrupts ->(32)words$word -> Uinterrupts) v x=
    (( v with<|
     Uinterrupts_Uinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Uinterrupts_UEI:Uinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Uinterrupts_UEI:((regstate),(register_value),(Uinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Uinterrupts_Uinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Uinterrupts_Uinterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Uinterrupts_UEI:Uinterrupts ->(1)words$word -> Uinterrupts) v x=
    (( v with<|
     Uinterrupts_Uinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 8 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Uinterrupts_UTI:Uinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Uinterrupts_UTI:((regstate),(register_value),(Uinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Uinterrupts_Uinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Uinterrupts_Uinterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Uinterrupts_UTI:Uinterrupts ->(1)words$word -> Uinterrupts) v x=
    (( v with<|
     Uinterrupts_Uinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_Uinterrupts_USI:Uinterrupts ->(1)words$word) v=
    ((subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_Uinterrupts_USI:((regstate),(register_value),(Uinterrupts))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Uinterrupts_Uinterrupts_chunk_0 :=
         ((update_subrange_vec_dec r.Uinterrupts_Uinterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Uinterrupts_USI:Uinterrupts ->(1)words$word -> Uinterrupts) v x=
    (( v with<|
     Uinterrupts_Uinterrupts_chunk_0 :=
       ((update_subrange_vec_dec v.Uinterrupts_Uinterrupts_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  32 words$word)) |>)))`;


(*val lower_sip : Sinterrupts -> Sinterrupts -> Uinterrupts*)

val _ = Define `
 ((lower_sip:Sinterrupts -> Sinterrupts -> Uinterrupts) (s : Sinterrupts) (d : Sinterrupts)=
    (let (u : Uinterrupts) = (Mk_Uinterrupts ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))) in
   let u =
     (update_Uinterrupts_UEI u
       ((and_vec ((get_Sinterrupts_UEI s  :  1 words$word)) ((get_Sinterrupts_UEI d  :  1 words$word))
          :  1 words$word))) in
   let u =
     (update_Uinterrupts_UTI u
       ((and_vec ((get_Sinterrupts_UTI s  :  1 words$word)) ((get_Sinterrupts_UTI d  :  1 words$word))
          :  1 words$word))) in
   update_Uinterrupts_USI u
     ((and_vec ((get_Sinterrupts_USI s  :  1 words$word)) ((get_Sinterrupts_USI d  :  1 words$word))
        :  1 words$word))))`;


(*val lower_sie : Sinterrupts -> Sinterrupts -> Uinterrupts*)

val _ = Define `
 ((lower_sie:Sinterrupts -> Sinterrupts -> Uinterrupts) (s : Sinterrupts) (d : Sinterrupts)=
    (let (u : Uinterrupts) = (Mk_Uinterrupts ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))) in
   let u =
     (update_Uinterrupts_UEI u
       ((and_vec ((get_Sinterrupts_UEI s  :  1 words$word)) ((get_Sinterrupts_UEI d  :  1 words$word))
          :  1 words$word))) in
   let u =
     (update_Uinterrupts_UTI u
       ((and_vec ((get_Sinterrupts_UTI s  :  1 words$word)) ((get_Sinterrupts_UTI d  :  1 words$word))
          :  1 words$word))) in
   update_Uinterrupts_USI u
     ((and_vec ((get_Sinterrupts_USI s  :  1 words$word)) ((get_Sinterrupts_USI d  :  1 words$word))
        :  1 words$word))))`;


(*val lift_uip : Sinterrupts -> Sinterrupts -> Uinterrupts -> Sinterrupts*)

val _ = Define `
 ((lift_uip:Sinterrupts -> Sinterrupts -> Uinterrupts -> Sinterrupts) (o1 : Sinterrupts) (d : Sinterrupts) (u : Uinterrupts)=
    (let (s : Sinterrupts) = o1 in
   if (((((get_Sinterrupts_USI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
     update_Sinterrupts_USI s ((get_Uinterrupts_USI u  :  1 words$word))
   else s))`;


(*val legalize_uip : Sinterrupts -> Sinterrupts -> mword ty32 -> Sinterrupts*)

val _ = Define `
 ((legalize_uip:Sinterrupts -> Sinterrupts ->(32)words$word -> Sinterrupts) (s : Sinterrupts) (d : Sinterrupts) (v : xlenbits)=
    (lift_uip s d ((Mk_Uinterrupts v))))`;


(*val lift_uie : Sinterrupts -> Sinterrupts -> Uinterrupts -> Sinterrupts*)

val _ = Define `
 ((lift_uie:Sinterrupts -> Sinterrupts -> Uinterrupts -> Sinterrupts) (o1 : Sinterrupts) (d : Sinterrupts) (u : Uinterrupts)=
    (let (s : Sinterrupts) = o1 in
   let s =
     (if (((((get_Sinterrupts_UEI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
       update_Sinterrupts_UEI s ((get_Uinterrupts_UEI u  :  1 words$word))
     else s) in
   let s =
     (if (((((get_Sinterrupts_UTI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
       update_Sinterrupts_UTI s ((get_Uinterrupts_UTI u  :  1 words$word))
     else s) in
   if (((((get_Sinterrupts_USI d  :  1 words$word)) = (0b1w :  1 words$word)))) then
     update_Sinterrupts_USI s ((get_Uinterrupts_USI u  :  1 words$word))
   else s))`;


(*val legalize_uie : Sinterrupts -> Sinterrupts -> mword ty32 -> Sinterrupts*)

val _ = Define `
 ((legalize_uie:Sinterrupts -> Sinterrupts ->(32)words$word -> Sinterrupts) (s : Sinterrupts) (d : Sinterrupts) (v : xlenbits)=
    (lift_uie s d ((Mk_Uinterrupts v))))`;


(*val ext_check_xret_priv : Privilege -> bool*)

val _ = Define `
 ((ext_check_xret_priv:Privilege -> bool) p=  T)`;


(*val ext_fail_xret_priv : unit -> unit*)

val _ = Define `
 ((ext_fail_xret_priv:unit -> unit) () =  () )`;


(*val handle_trap_extension : Privilege -> mword ty32 -> maybe unit -> unit*)

val _ = Define `
 ((handle_trap_extension:Privilege ->(32)words$word ->(unit)option -> unit) (p : Privilege) (pc : xlenbits) (u :  unit option)=  () )`;


(*val prepare_trap_vector : Privilege -> Mcause -> M (mword ty32)*)

val _ = Define `
 ((prepare_trap_vector:Privilege -> Mcause ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (p : Privilege) (cause : Mcause)=  (sail2_state_monad$bindS
   (case p of
     Machine => sail2_state_monad$read_regS mtvec_ref
   | Supervisor => sail2_state_monad$read_regS stvec_ref
   | User => sail2_state_monad$read_regS utvec_ref
   ) (\ (tvec : Mtvec) . 
   (case ((tvec_addr tvec cause  :  ( 32 words$word)option)) of
     SOME (epc) => sail2_state_monad$returnS epc
   | NONE => (internal_error "Invalid tvec mode"  : ( 32 words$word) M)
   ))))`;


(*val get_xret_target : Privilege -> M (mword ty32)*)

val _ = Define `
 ((get_xret_target:Privilege ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) p=
    ((case p of
     Machine => (sail2_state_monad$read_regS mepc_ref  : ( 32 words$word) M)
   | Supervisor => (sail2_state_monad$read_regS sepc_ref  : ( 32 words$word) M)
   | User => (sail2_state_monad$read_regS uepc_ref  : ( 32 words$word) M)
   )))`;


(*val set_xret_target : Privilege -> mword ty32 -> M (mword ty32)*)

val _ = Define `
 ((set_xret_target:Privilege ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) p value=  (sail2_state_monad$bindS
   (legalize_xepc value  : ( 32 words$word) M) (\ target .  sail2_state_monad$seqS
   (case p of
     Machine => sail2_state_monad$write_regS mepc_ref target
   | Supervisor => sail2_state_monad$write_regS sepc_ref target
   | User => sail2_state_monad$write_regS uepc_ref target
   )
   (sail2_state_monad$returnS target))))`;


(*val prepare_xret_target : Privilege -> M (mword ty32)*)

val _ = Define `
 ((prepare_xret_target:Privilege ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) p=  ((get_xret_target p  : ( 32 words$word) M)))`;


(*val get_mtvec : unit -> M (mword ty32)*)

val _ = Define `
 ((get_mtvec:unit ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mtvec_ref) (\ (w__0 : Mtvec) .  sail2_state_monad$returnS ((get_Mtvec_bits w__0  :  32 words$word)))))`;


(*val get_stvec : unit -> M (mword ty32)*)

val _ = Define `
 ((get_stvec:unit ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS stvec_ref) (\ (w__0 : Mtvec) .  sail2_state_monad$returnS ((get_Mtvec_bits w__0  :  32 words$word)))))`;


(*val get_utvec : unit -> M (mword ty32)*)

val _ = Define `
 ((get_utvec:unit ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS utvec_ref) (\ (w__0 : Mtvec) .  sail2_state_monad$returnS ((get_Mtvec_bits w__0  :  32 words$word)))))`;


(*val set_mtvec : mword ty32 -> M (mword ty32)*)

val _ = Define `
 ((set_mtvec:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) value=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mtvec_ref) (\ (w__0 : Mtvec) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS mtvec_ref ((legalize_tvec w__0 value)))
   (sail2_state_monad$read_regS mtvec_ref)) (\ (w__1 : Mtvec) .  sail2_state_monad$returnS ((get_Mtvec_bits w__1  :  32 words$word))))))`;


(*val set_stvec : mword ty32 -> M (mword ty32)*)

val _ = Define `
 ((set_stvec:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) value=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS stvec_ref) (\ (w__0 : Mtvec) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS stvec_ref ((legalize_tvec w__0 value)))
   (sail2_state_monad$read_regS stvec_ref)) (\ (w__1 : Mtvec) .  sail2_state_monad$returnS ((get_Mtvec_bits w__1  :  32 words$word))))))`;


(*val set_utvec : mword ty32 -> M (mword ty32)*)

val _ = Define `
 ((set_utvec:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) value=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS utvec_ref) (\ (w__0 : Mtvec) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS utvec_ref ((legalize_tvec w__0 value)))
   (sail2_state_monad$read_regS utvec_ref)) (\ (w__1 : Mtvec) .  sail2_state_monad$returnS ((get_Mtvec_bits w__1  :  32 words$word))))))`;


(*val update_softfloat_fflags : mword ty5 -> M unit*)

val _ = Define `
 ((update_softfloat_fflags:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) flags=
    (sail2_state_monad$write_regS float_fflags_ref ((zero_extend flags (( 64 : int):ii)  :  64 words$word))))`;


(*val riscv_f16Add : mword ty3 -> mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Add:(3)words$word ->(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f16_add rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f16Sub : mword ty3 -> mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Sub:(3)words$word ->(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f16_sub rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f16Mul : mword ty3 -> mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Mul:(3)words$word ->(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f16_mul rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f16Div : mword ty3 -> mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Div:(3)words$word ->(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f16_div rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f32Add : mword ty3 -> mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Add:(3)words$word ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f32_add rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32Sub : mword ty3 -> mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Sub:(3)words$word ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f32_sub rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32Mul : mword ty3 -> mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Mul:(3)words$word ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f32_mul rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32Div : mword ty3 -> mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Div:(3)words$word ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f32_div rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f64Add : mword ty3 -> mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Add:(3)words$word ->(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f64_add rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64Sub : mword ty3 -> mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Sub:(3)words$word ->(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f64_sub rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64Mul : mword ty3 -> mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Mul:(3)words$word ->(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f64_mul rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64Div : mword ty3 -> mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Div:(3)words$word ->(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2=
    (let (_ : unit) = (softfloat_f64_div rm v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f16MulAdd : mword ty3 -> mword ty16 -> mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16MulAdd:(3)words$word ->(16)words$word ->(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2 v3=
    (let (_ : unit) = (softfloat_f16_muladd rm v1 v2 v3) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f32MulAdd : mword ty3 -> mword ty32 -> mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32MulAdd:(3)words$word ->(32)words$word ->(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2 v3=
    (let (_ : unit) = (softfloat_f32_muladd rm v1 v2 v3) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f64MulAdd : mword ty3 -> mword ty64 -> mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64MulAdd:(3)words$word ->(64)words$word ->(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v1 v2 v3=
    (let (_ : unit) = (softfloat_f64_muladd rm v1 v2 v3) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f16Sqrt : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Sqrt:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_sqrt rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f32Sqrt : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Sqrt:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_sqrt rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f64Sqrt : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Sqrt:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_sqrt rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f16ToI32 : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f16ToI32:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_to_i32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f16ToUi32 : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f16ToUi32:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_to_ui32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_i32ToF16 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_i32ToF16:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_i32_to_f16 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_ui32ToF16 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_ui32ToF16:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_ui32_to_f16 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f16ToI64 : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f16ToI64:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_to_i64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f16ToUi64 : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f16ToUi64:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_to_ui64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_i64ToF16 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_i64ToF16:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_i64_to_f16 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_ui64ToF16 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_ui64ToF16:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_ui64_to_f16 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f32ToI32 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32ToI32:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_to_i32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32ToUi32 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32ToUi32:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_to_ui32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_i32ToF32 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_i32ToF32:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_i32_to_f32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_ui32ToF32 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_ui32ToF32:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_ui32_to_f32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32ToI64 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f32ToI64:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_to_i64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f32ToUi64 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f32ToUi64:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_to_ui64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_i64ToF32 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_i64ToF32:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_i64_to_f32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_ui64ToF32 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_ui64ToF32:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_ui64_to_f32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f64ToI32 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f64ToI32:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_to_i32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f64ToUi32 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f64ToUi32:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_to_ui32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_i32ToF64 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_i32ToF64:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_i32_to_f64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_ui32ToF64 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_ui32ToF64:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_ui32_to_f64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64ToI64 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64ToI64:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_to_i64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64ToUi64 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64ToUi64:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_to_ui64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_i64ToF64 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_i64ToF64:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_i64_to_f64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_ui64ToF64 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_ui64ToF64:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_ui64_to_f64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f16ToF32 : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f16ToF32:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_to_f32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f16ToF64 : mword ty3 -> mword ty16 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f16ToF64:(3)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f16_to_f64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f32ToF64 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f32ToF64:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_to_f64 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f32ToF16 : mword ty3 -> mword ty32 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f32ToF16:(3)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f32_to_f16 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f64ToF16 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f64ToF16:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_to_f16 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f64ToF32 : mword ty3 -> mword ty64 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f64ToF32:(3)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rm v=
    (let (_ : unit) = (softfloat_f64_to_f32 rm v) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f16Lt : mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Lt:(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f16_lt v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f16Le : mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Le:(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f16_le v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f16Eq : mword ty16 -> mword ty16 -> M (mword ty5 * mword ty16)*)

val _ = Define `
 ((riscv_f16Eq:(16)words$word ->(16)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f16_eq v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))))))`;


(*val riscv_f32Lt : mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Lt:(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f32_lt v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32Le : mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Le:(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f32_le v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f32Eq : mword ty32 -> mword ty32 -> M (mword ty5 * mword ty32)*)

val _ = Define `
 ((riscv_f32Eq:(32)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f32_eq v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word),
           (subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))))`;


(*val riscv_f64Lt : mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Lt:(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f64_lt v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64Le : mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Le:(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f64_le v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val riscv_f64Eq : mword ty64 -> mword ty64 -> M (mword ty5 * mword ty64)*)

val _ = Define `
 ((riscv_f64Eq:(64)words$word ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word#(64)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) v1 v2=
    (let (_ : unit) = (softfloat_f64_eq v1 v2) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_fflags_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS float_result_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$returnS ((subrange_vec_dec w__0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word), w__1)))))`;


(*val dirty_fd_context : unit -> M unit*)

val _ = Define `
 ((dirty_fd_context:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$seqS
   (set_Mstatus_FS mstatus_ref ((extStatus_to_bits Dirty  :  2 words$word)))
   (set_Mstatus_SD mstatus_ref (0b1w :  1 words$word))))`;


(*val rF : integer -> M (mword ty32)*)

val _ = Define `
 ((rF:int ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r=
    (let l__45 = r in sail2_state_monad$bindS
   (if (((l__45 = (( 0 : int):ii)))) then (sail2_state_monad$read_regS f0_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 1 : int):ii)))) then (sail2_state_monad$read_regS f1_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 2 : int):ii)))) then (sail2_state_monad$read_regS f2_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 3 : int):ii)))) then (sail2_state_monad$read_regS f3_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 4 : int):ii)))) then (sail2_state_monad$read_regS f4_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 5 : int):ii)))) then (sail2_state_monad$read_regS f5_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 6 : int):ii)))) then (sail2_state_monad$read_regS f6_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 7 : int):ii)))) then (sail2_state_monad$read_regS f7_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 8 : int):ii)))) then (sail2_state_monad$read_regS f8_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 9 : int):ii)))) then (sail2_state_monad$read_regS f9_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 10 : int):ii)))) then (sail2_state_monad$read_regS f10_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 11 : int):ii)))) then (sail2_state_monad$read_regS f11_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 12 : int):ii)))) then (sail2_state_monad$read_regS f12_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 13 : int):ii)))) then (sail2_state_monad$read_regS f13_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 14 : int):ii)))) then (sail2_state_monad$read_regS f14_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 15 : int):ii)))) then (sail2_state_monad$read_regS f15_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 16 : int):ii)))) then (sail2_state_monad$read_regS f16_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 17 : int):ii)))) then (sail2_state_monad$read_regS f17_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 18 : int):ii)))) then (sail2_state_monad$read_regS f18_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 19 : int):ii)))) then (sail2_state_monad$read_regS f19_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 20 : int):ii)))) then (sail2_state_monad$read_regS f20_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 21 : int):ii)))) then (sail2_state_monad$read_regS f21_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 22 : int):ii)))) then (sail2_state_monad$read_regS f22_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 23 : int):ii)))) then (sail2_state_monad$read_regS f23_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 24 : int):ii)))) then (sail2_state_monad$read_regS f24_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 25 : int):ii)))) then (sail2_state_monad$read_regS f25_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 26 : int):ii)))) then (sail2_state_monad$read_regS f26_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 27 : int):ii)))) then (sail2_state_monad$read_regS f27_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 28 : int):ii)))) then (sail2_state_monad$read_regS f28_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 29 : int):ii)))) then (sail2_state_monad$read_regS f29_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 30 : int):ii)))) then (sail2_state_monad$read_regS f30_ref  : ( 32 words$word) M)
    else if (((l__45 = (( 31 : int):ii)))) then (sail2_state_monad$read_regS f31_ref  : ( 32 words$word) M)
    else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "invalid floating point register number") (sail2_state_monad$exitS () )) (\ (v : fregtype) . 
   sail2_state_monad$returnS ((fregval_from_freg v  :  32 words$word)))))`;


(*val wF : integer -> mword ty32 -> M unit*)

val _ = Define `
 ((wF:int ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r in_v=
    (let v = ((fregval_into_freg in_v  :  32 words$word)) in
   let l__13 = r in sail2_state_monad$seqS (sail2_state_monad$seqS
   (if (((l__13 = (( 0 : int):ii)))) then sail2_state_monad$write_regS f0_ref v
    else if (((l__13 = (( 1 : int):ii)))) then sail2_state_monad$write_regS f1_ref v
    else if (((l__13 = (( 2 : int):ii)))) then sail2_state_monad$write_regS f2_ref v
    else if (((l__13 = (( 3 : int):ii)))) then sail2_state_monad$write_regS f3_ref v
    else if (((l__13 = (( 4 : int):ii)))) then sail2_state_monad$write_regS f4_ref v
    else if (((l__13 = (( 5 : int):ii)))) then sail2_state_monad$write_regS f5_ref v
    else if (((l__13 = (( 6 : int):ii)))) then sail2_state_monad$write_regS f6_ref v
    else if (((l__13 = (( 7 : int):ii)))) then sail2_state_monad$write_regS f7_ref v
    else if (((l__13 = (( 8 : int):ii)))) then sail2_state_monad$write_regS f8_ref v
    else if (((l__13 = (( 9 : int):ii)))) then sail2_state_monad$write_regS f9_ref v
    else if (((l__13 = (( 10 : int):ii)))) then sail2_state_monad$write_regS f10_ref v
    else if (((l__13 = (( 11 : int):ii)))) then sail2_state_monad$write_regS f11_ref v
    else if (((l__13 = (( 12 : int):ii)))) then sail2_state_monad$write_regS f12_ref v
    else if (((l__13 = (( 13 : int):ii)))) then sail2_state_monad$write_regS f13_ref v
    else if (((l__13 = (( 14 : int):ii)))) then sail2_state_monad$write_regS f14_ref v
    else if (((l__13 = (( 15 : int):ii)))) then sail2_state_monad$write_regS f15_ref v
    else if (((l__13 = (( 16 : int):ii)))) then sail2_state_monad$write_regS f16_ref v
    else if (((l__13 = (( 17 : int):ii)))) then sail2_state_monad$write_regS f17_ref v
    else if (((l__13 = (( 18 : int):ii)))) then sail2_state_monad$write_regS f18_ref v
    else if (((l__13 = (( 19 : int):ii)))) then sail2_state_monad$write_regS f19_ref v
    else if (((l__13 = (( 20 : int):ii)))) then sail2_state_monad$write_regS f20_ref v
    else if (((l__13 = (( 21 : int):ii)))) then sail2_state_monad$write_regS f21_ref v
    else if (((l__13 = (( 22 : int):ii)))) then sail2_state_monad$write_regS f22_ref v
    else if (((l__13 = (( 23 : int):ii)))) then sail2_state_monad$write_regS f23_ref v
    else if (((l__13 = (( 24 : int):ii)))) then sail2_state_monad$write_regS f24_ref v
    else if (((l__13 = (( 25 : int):ii)))) then sail2_state_monad$write_regS f25_ref v
    else if (((l__13 = (( 26 : int):ii)))) then sail2_state_monad$write_regS f26_ref v
    else if (((l__13 = (( 27 : int):ii)))) then sail2_state_monad$write_regS f27_ref v
    else if (((l__13 = (( 28 : int):ii)))) then sail2_state_monad$write_regS f28_ref v
    else if (((l__13 = (( 29 : int):ii)))) then sail2_state_monad$write_regS f29_ref v
    else if (((l__13 = (( 30 : int):ii)))) then sail2_state_monad$write_regS f30_ref v
    else if (((l__13 = (( 31 : int):ii)))) then sail2_state_monad$write_regS f31_ref v
    else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "invalid floating point register number") (sail2_state_monad$exitS () ))
   (dirty_fd_context () ))
   (sail2_state_monad$returnS (if ((get_config_print_reg () )) then
             print_dbg
               ((STRCAT "f"
                   ((STRCAT ((stringFromInteger r)) ((STRCAT " <- " ((FRegStr v))))))))
           else () ))))`;


(*val rF_bits : mword ty5 -> M (mword ty32)*)

val _ = Define `
 ((rF_bits:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) i=  ((rF ((lem$w2ui i))  : ( 32 words$word) M)))`;


(*val wF_bits : mword ty5 -> mword ty32 -> M unit*)

val _ = Define `
 ((wF_bits:(5)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (i : 5 bits) (data : flenbits)=  (wF ((lem$w2ui i)) data))`;


(*val freg_name_abi_forwards : mword ty5 -> M string*)

(*val freg_name_abi_backwards : string -> M (mword ty5)*)

(*val freg_name_abi_forwards_matches : mword ty5 -> bool*)

(*val freg_name_abi_backwards_matches : string -> bool*)

(*val freg_name_abi_matches_prefix : string -> maybe ((mword ty5 * ii))*)

val _ = Define `
 ((freg_name_abi_forwards:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS "ft0"
   else if (((b__0 = (0b00001w :  5 words$word)))) then sail2_state_monad$returnS "ft1"
   else if (((b__0 = (0b00010w :  5 words$word)))) then sail2_state_monad$returnS "ft2"
   else if (((b__0 = (0b00011w :  5 words$word)))) then sail2_state_monad$returnS "ft3"
   else if (((b__0 = (0b00100w :  5 words$word)))) then sail2_state_monad$returnS "ft4"
   else if (((b__0 = (0b00101w :  5 words$word)))) then sail2_state_monad$returnS "ft5"
   else if (((b__0 = (0b00110w :  5 words$word)))) then sail2_state_monad$returnS "ft6"
   else if (((b__0 = (0b00111w :  5 words$word)))) then sail2_state_monad$returnS "ft7"
   else if (((b__0 = (0b01000w :  5 words$word)))) then sail2_state_monad$returnS "fs0"
   else if (((b__0 = (0b01001w :  5 words$word)))) then sail2_state_monad$returnS "fs1"
   else if (((b__0 = (0b01010w :  5 words$word)))) then sail2_state_monad$returnS "fa0"
   else if (((b__0 = (0b01011w :  5 words$word)))) then sail2_state_monad$returnS "fa1"
   else if (((b__0 = (0b01100w :  5 words$word)))) then sail2_state_monad$returnS "fa2"
   else if (((b__0 = (0b01101w :  5 words$word)))) then sail2_state_monad$returnS "fa3"
   else if (((b__0 = (0b01110w :  5 words$word)))) then sail2_state_monad$returnS "fa4"
   else if (((b__0 = (0b01111w :  5 words$word)))) then sail2_state_monad$returnS "fa5"
   else if (((b__0 = (0b10000w :  5 words$word)))) then sail2_state_monad$returnS "fa6"
   else if (((b__0 = (0b10001w :  5 words$word)))) then sail2_state_monad$returnS "fa7"
   else if (((b__0 = (0b10010w :  5 words$word)))) then sail2_state_monad$returnS "fs2"
   else if (((b__0 = (0b10011w :  5 words$word)))) then sail2_state_monad$returnS "fs3"
   else if (((b__0 = (0b10100w :  5 words$word)))) then sail2_state_monad$returnS "fs4"
   else if (((b__0 = (0b10101w :  5 words$word)))) then sail2_state_monad$returnS "fs5"
   else if (((b__0 = (0b10110w :  5 words$word)))) then sail2_state_monad$returnS "fs6"
   else if (((b__0 = (0b10111w :  5 words$word)))) then sail2_state_monad$returnS "fs7"
   else if (((b__0 = (0b11000w :  5 words$word)))) then sail2_state_monad$returnS "fs8"
   else if (((b__0 = (0b11001w :  5 words$word)))) then sail2_state_monad$returnS "fs9"
   else if (((b__0 = (0b11010w :  5 words$word)))) then sail2_state_monad$returnS "fs10"
   else if (((b__0 = (0b11011w :  5 words$word)))) then sail2_state_monad$returnS "fs11"
   else if (((b__0 = (0b11100w :  5 words$word)))) then sail2_state_monad$returnS "ft8"
   else if (((b__0 = (0b11101w :  5 words$word)))) then sail2_state_monad$returnS "ft9"
   else if (((b__0 = (0b11110w :  5 words$word)))) then sail2_state_monad$returnS "ft10"
   else if (((b__0 = (0b11111w :  5 words$word)))) then sail2_state_monad$returnS "ft11"
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((freg_name_abi_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "ft0"))) then sail2_state_monad$returnS (0b00000w :  5 words$word)
   else if (((p0_ = "ft1"))) then sail2_state_monad$returnS (0b00001w :  5 words$word)
   else if (((p0_ = "ft2"))) then sail2_state_monad$returnS (0b00010w :  5 words$word)
   else if (((p0_ = "ft3"))) then sail2_state_monad$returnS (0b00011w :  5 words$word)
   else if (((p0_ = "ft4"))) then sail2_state_monad$returnS (0b00100w :  5 words$word)
   else if (((p0_ = "ft5"))) then sail2_state_monad$returnS (0b00101w :  5 words$word)
   else if (((p0_ = "ft6"))) then sail2_state_monad$returnS (0b00110w :  5 words$word)
   else if (((p0_ = "ft7"))) then sail2_state_monad$returnS (0b00111w :  5 words$word)
   else if (((p0_ = "fs0"))) then sail2_state_monad$returnS (0b01000w :  5 words$word)
   else if (((p0_ = "fs1"))) then sail2_state_monad$returnS (0b01001w :  5 words$word)
   else if (((p0_ = "fa0"))) then sail2_state_monad$returnS (0b01010w :  5 words$word)
   else if (((p0_ = "fa1"))) then sail2_state_monad$returnS (0b01011w :  5 words$word)
   else if (((p0_ = "fa2"))) then sail2_state_monad$returnS (0b01100w :  5 words$word)
   else if (((p0_ = "fa3"))) then sail2_state_monad$returnS (0b01101w :  5 words$word)
   else if (((p0_ = "fa4"))) then sail2_state_monad$returnS (0b01110w :  5 words$word)
   else if (((p0_ = "fa5"))) then sail2_state_monad$returnS (0b01111w :  5 words$word)
   else if (((p0_ = "fa6"))) then sail2_state_monad$returnS (0b10000w :  5 words$word)
   else if (((p0_ = "fa7"))) then sail2_state_monad$returnS (0b10001w :  5 words$word)
   else if (((p0_ = "fs2"))) then sail2_state_monad$returnS (0b10010w :  5 words$word)
   else if (((p0_ = "fs3"))) then sail2_state_monad$returnS (0b10011w :  5 words$word)
   else if (((p0_ = "fs4"))) then sail2_state_monad$returnS (0b10100w :  5 words$word)
   else if (((p0_ = "fs5"))) then sail2_state_monad$returnS (0b10101w :  5 words$word)
   else if (((p0_ = "fs6"))) then sail2_state_monad$returnS (0b10110w :  5 words$word)
   else if (((p0_ = "fs7"))) then sail2_state_monad$returnS (0b10111w :  5 words$word)
   else if (((p0_ = "fs8"))) then sail2_state_monad$returnS (0b11000w :  5 words$word)
   else if (((p0_ = "fs9"))) then sail2_state_monad$returnS (0b11001w :  5 words$word)
   else if (((p0_ = "fs10"))) then sail2_state_monad$returnS (0b11010w :  5 words$word)
   else if (((p0_ = "fs11"))) then sail2_state_monad$returnS (0b11011w :  5 words$word)
   else if (((p0_ = "ft8"))) then sail2_state_monad$returnS (0b11100w :  5 words$word)
   else if (((p0_ = "ft9"))) then sail2_state_monad$returnS (0b11101w :  5 words$word)
   else if (((p0_ = "ft10"))) then sail2_state_monad$returnS (0b11110w :  5 words$word)
   else if (((p0_ = "ft11"))) then sail2_state_monad$returnS (0b11111w :  5 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((freg_name_abi_forwards_matches:(5)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00000w :  5 words$word)))) then T
   else if (((b__0 = (0b00001w :  5 words$word)))) then T
   else if (((b__0 = (0b00010w :  5 words$word)))) then T
   else if (((b__0 = (0b00011w :  5 words$word)))) then T
   else if (((b__0 = (0b00100w :  5 words$word)))) then T
   else if (((b__0 = (0b00101w :  5 words$word)))) then T
   else if (((b__0 = (0b00110w :  5 words$word)))) then T
   else if (((b__0 = (0b00111w :  5 words$word)))) then T
   else if (((b__0 = (0b01000w :  5 words$word)))) then T
   else if (((b__0 = (0b01001w :  5 words$word)))) then T
   else if (((b__0 = (0b01010w :  5 words$word)))) then T
   else if (((b__0 = (0b01011w :  5 words$word)))) then T
   else if (((b__0 = (0b01100w :  5 words$word)))) then T
   else if (((b__0 = (0b01101w :  5 words$word)))) then T
   else if (((b__0 = (0b01110w :  5 words$word)))) then T
   else if (((b__0 = (0b01111w :  5 words$word)))) then T
   else if (((b__0 = (0b10000w :  5 words$word)))) then T
   else if (((b__0 = (0b10001w :  5 words$word)))) then T
   else if (((b__0 = (0b10010w :  5 words$word)))) then T
   else if (((b__0 = (0b10011w :  5 words$word)))) then T
   else if (((b__0 = (0b10100w :  5 words$word)))) then T
   else if (((b__0 = (0b10101w :  5 words$word)))) then T
   else if (((b__0 = (0b10110w :  5 words$word)))) then T
   else if (((b__0 = (0b10111w :  5 words$word)))) then T
   else if (((b__0 = (0b11000w :  5 words$word)))) then T
   else if (((b__0 = (0b11001w :  5 words$word)))) then T
   else if (((b__0 = (0b11010w :  5 words$word)))) then T
   else if (((b__0 = (0b11011w :  5 words$word)))) then T
   else if (((b__0 = (0b11100w :  5 words$word)))) then T
   else if (((b__0 = (0b11101w :  5 words$word)))) then T
   else if (((b__0 = (0b11110w :  5 words$word)))) then T
   else if (((b__0 = (0b11111w :  5 words$word)))) then T
   else F))`;


val _ = Define `
 ((freg_name_abi_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "ft0"))) then T
   else if (((p0_ = "ft1"))) then T
   else if (((p0_ = "ft2"))) then T
   else if (((p0_ = "ft3"))) then T
   else if (((p0_ = "ft4"))) then T
   else if (((p0_ = "ft5"))) then T
   else if (((p0_ = "ft6"))) then T
   else if (((p0_ = "ft7"))) then T
   else if (((p0_ = "fs0"))) then T
   else if (((p0_ = "fs1"))) then T
   else if (((p0_ = "fa0"))) then T
   else if (((p0_ = "fa1"))) then T
   else if (((p0_ = "fa2"))) then T
   else if (((p0_ = "fa3"))) then T
   else if (((p0_ = "fa4"))) then T
   else if (((p0_ = "fa5"))) then T
   else if (((p0_ = "fa6"))) then T
   else if (((p0_ = "fa7"))) then T
   else if (((p0_ = "fs2"))) then T
   else if (((p0_ = "fs3"))) then T
   else if (((p0_ = "fs4"))) then T
   else if (((p0_ = "fs5"))) then T
   else if (((p0_ = "fs6"))) then T
   else if (((p0_ = "fs7"))) then T
   else if (((p0_ = "fs8"))) then T
   else if (((p0_ = "fs9"))) then T
   else if (((p0_ = "fs10"))) then T
   else if (((p0_ = "fs11"))) then T
   else if (((p0_ = "ft8"))) then T
   else if (((p0_ = "ft9"))) then T
   else if (((p0_ = "ft10"))) then T
   else if (((p0_ = "ft11"))) then T
   else F))`;


(*val _s324_ : string -> maybe string*)

val _ = Define `
 ((s324_:string ->(string)option) s325_0=
    (let s326_0 = s325_0 in
   if ((string_startswith s326_0 "ft11")) then  
  (case ((string_drop s326_0 ((string_length "ft11")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s320_ : string -> maybe string*)

val _ = Define `
 ((s320_:string ->(string)option) s321_0=
    (let s322_0 = s321_0 in
   if ((string_startswith s322_0 "ft10")) then  
  (case ((string_drop s322_0 ((string_length "ft10")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s316_ : string -> maybe string*)

val _ = Define `
 ((s316_:string ->(string)option) s317_0=
    (let s318_0 = s317_0 in
   if ((string_startswith s318_0 "ft9")) then  
  (case ((string_drop s318_0 ((string_length "ft9")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s312_ : string -> maybe string*)

val _ = Define `
 ((s312_:string ->(string)option) s313_0=
    (let s314_0 = s313_0 in
   if ((string_startswith s314_0 "ft8")) then  
  (case ((string_drop s314_0 ((string_length "ft8")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s308_ : string -> maybe string*)

val _ = Define `
 ((s308_:string ->(string)option) s309_0=
    (let s310_0 = s309_0 in
   if ((string_startswith s310_0 "fs11")) then  
  (case ((string_drop s310_0 ((string_length "fs11")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s304_ : string -> maybe string*)

val _ = Define `
 ((s304_:string ->(string)option) s305_0=
    (let s306_0 = s305_0 in
   if ((string_startswith s306_0 "fs10")) then  
  (case ((string_drop s306_0 ((string_length "fs10")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s300_ : string -> maybe string*)

val _ = Define `
 ((s300_:string ->(string)option) s301_0=
    (let s302_0 = s301_0 in
   if ((string_startswith s302_0 "fs9")) then  
  (case ((string_drop s302_0 ((string_length "fs9")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s296_ : string -> maybe string*)

val _ = Define `
 ((s296_:string ->(string)option) s297_0=
    (let s298_0 = s297_0 in
   if ((string_startswith s298_0 "fs8")) then  
  (case ((string_drop s298_0 ((string_length "fs8")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s292_ : string -> maybe string*)

val _ = Define `
 ((s292_:string ->(string)option) s293_0=
    (let s294_0 = s293_0 in
   if ((string_startswith s294_0 "fs7")) then  
  (case ((string_drop s294_0 ((string_length "fs7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s288_ : string -> maybe string*)

val _ = Define `
 ((s288_:string ->(string)option) s289_0=
    (let s290_0 = s289_0 in
   if ((string_startswith s290_0 "fs6")) then  
  (case ((string_drop s290_0 ((string_length "fs6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s284_ : string -> maybe string*)

val _ = Define `
 ((s284_:string ->(string)option) s285_0=
    (let s286_0 = s285_0 in
   if ((string_startswith s286_0 "fs5")) then  
  (case ((string_drop s286_0 ((string_length "fs5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s280_ : string -> maybe string*)

val _ = Define `
 ((s280_:string ->(string)option) s281_0=
    (let s282_0 = s281_0 in
   if ((string_startswith s282_0 "fs4")) then  
  (case ((string_drop s282_0 ((string_length "fs4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s276_ : string -> maybe string*)

val _ = Define `
 ((s276_:string ->(string)option) s277_0=
    (let s278_0 = s277_0 in
   if ((string_startswith s278_0 "fs3")) then  
  (case ((string_drop s278_0 ((string_length "fs3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s272_ : string -> maybe string*)

val _ = Define `
 ((s272_:string ->(string)option) s273_0=
    (let s274_0 = s273_0 in
   if ((string_startswith s274_0 "fs2")) then  
  (case ((string_drop s274_0 ((string_length "fs2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s268_ : string -> maybe string*)

val _ = Define `
 ((s268_:string ->(string)option) s269_0=
    (let s270_0 = s269_0 in
   if ((string_startswith s270_0 "fa7")) then  
  (case ((string_drop s270_0 ((string_length "fa7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s264_ : string -> maybe string*)

val _ = Define `
 ((s264_:string ->(string)option) s265_0=
    (let s266_0 = s265_0 in
   if ((string_startswith s266_0 "fa6")) then  
  (case ((string_drop s266_0 ((string_length "fa6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s260_ : string -> maybe string*)

val _ = Define `
 ((s260_:string ->(string)option) s261_0=
    (let s262_0 = s261_0 in
   if ((string_startswith s262_0 "fa5")) then  
  (case ((string_drop s262_0 ((string_length "fa5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s256_ : string -> maybe string*)

val _ = Define `
 ((s256_:string ->(string)option) s257_0=
    (let s258_0 = s257_0 in
   if ((string_startswith s258_0 "fa4")) then  
  (case ((string_drop s258_0 ((string_length "fa4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s252_ : string -> maybe string*)

val _ = Define `
 ((s252_:string ->(string)option) s253_0=
    (let s254_0 = s253_0 in
   if ((string_startswith s254_0 "fa3")) then  
  (case ((string_drop s254_0 ((string_length "fa3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s248_ : string -> maybe string*)

val _ = Define `
 ((s248_:string ->(string)option) s249_0=
    (let s250_0 = s249_0 in
   if ((string_startswith s250_0 "fa2")) then  
  (case ((string_drop s250_0 ((string_length "fa2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s244_ : string -> maybe string*)

val _ = Define `
 ((s244_:string ->(string)option) s245_0=
    (let s246_0 = s245_0 in
   if ((string_startswith s246_0 "fa1")) then  
  (case ((string_drop s246_0 ((string_length "fa1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s240_ : string -> maybe string*)

val _ = Define `
 ((s240_:string ->(string)option) s241_0=
    (let s242_0 = s241_0 in
   if ((string_startswith s242_0 "fa0")) then  
  (case ((string_drop s242_0 ((string_length "fa0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s236_ : string -> maybe string*)

val _ = Define `
 ((s236_:string ->(string)option) s237_0=
    (let s238_0 = s237_0 in
   if ((string_startswith s238_0 "fs1")) then  
  (case ((string_drop s238_0 ((string_length "fs1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s232_ : string -> maybe string*)

val _ = Define `
 ((s232_:string ->(string)option) s233_0=
    (let s234_0 = s233_0 in
   if ((string_startswith s234_0 "fs0")) then  
  (case ((string_drop s234_0 ((string_length "fs0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s228_ : string -> maybe string*)

val _ = Define `
 ((s228_:string ->(string)option) s229_0=
    (let s230_0 = s229_0 in
   if ((string_startswith s230_0 "ft7")) then  
  (case ((string_drop s230_0 ((string_length "ft7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s224_ : string -> maybe string*)

val _ = Define `
 ((s224_:string ->(string)option) s225_0=
    (let s226_0 = s225_0 in
   if ((string_startswith s226_0 "ft6")) then  
  (case ((string_drop s226_0 ((string_length "ft6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s220_ : string -> maybe string*)

val _ = Define `
 ((s220_:string ->(string)option) s221_0=
    (let s222_0 = s221_0 in
   if ((string_startswith s222_0 "ft5")) then  
  (case ((string_drop s222_0 ((string_length "ft5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s216_ : string -> maybe string*)

val _ = Define `
 ((s216_:string ->(string)option) s217_0=
    (let s218_0 = s217_0 in
   if ((string_startswith s218_0 "ft4")) then  
  (case ((string_drop s218_0 ((string_length "ft4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s212_ : string -> maybe string*)

val _ = Define `
 ((s212_:string ->(string)option) s213_0=
    (let s214_0 = s213_0 in
   if ((string_startswith s214_0 "ft3")) then  
  (case ((string_drop s214_0 ((string_length "ft3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s208_ : string -> maybe string*)

val _ = Define `
 ((s208_:string ->(string)option) s209_0=
    (let s210_0 = s209_0 in
   if ((string_startswith s210_0 "ft2")) then  
  (case ((string_drop s210_0 ((string_length "ft2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s204_ : string -> maybe string*)

val _ = Define `
 ((s204_:string ->(string)option) s205_0=
    (let s206_0 = s205_0 in
   if ((string_startswith s206_0 "ft1")) then  
  (case ((string_drop s206_0 ((string_length "ft1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s200_ : string -> maybe string*)

val _ = Define `
 ((s200_:string ->(string)option) s201_0=
    (let s202_0 = s201_0 in
   if ((string_startswith s202_0 "ft0")) then  
  (case ((string_drop s202_0 ((string_length "ft0")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((freg_name_abi_matches_prefix:string ->((5)words$word#int)option) arg_=
    (let s203_0 = arg_ in
   if ((case ((s200_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s200_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s204_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s204_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s208_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s208_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s212_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s212_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s216_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s216_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s220_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s220_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s224_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s224_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s228_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s228_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b00111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s232_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s232_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s236_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s236_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s240_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s240_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s244_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s244_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s248_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s248_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s252_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s252_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s256_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s256_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s260_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s260_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b01111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s264_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s264_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s268_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s268_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s272_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s272_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s276_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s276_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s280_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s280_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s284_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s284_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s288_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s288_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s292_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s292_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b10111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s296_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s296_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s300_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s300_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s304_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s304_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s308_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s308_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s312_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s312_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s316_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s316_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s320_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s320_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s324_ s203_0)) of   SOME (s_) => T | _ => F )) then  
  (case s324_ s203_0 of
      (SOME (s_)) =>
  SOME
    ((0b11111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val freg_name_forwards : mword ty5 -> M string*)

(*val freg_name_backwards : string -> M (mword ty5)*)

(*val freg_name_forwards_matches : mword ty5 -> bool*)

(*val freg_name_backwards_matches : string -> bool*)

(*val freg_name_matches_prefix : string -> maybe ((mword ty5 * ii))*)

val _ = Define `
 ((freg_name_forwards:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS "ft0"
   else if (((b__0 = (0b00001w :  5 words$word)))) then sail2_state_monad$returnS "ft1"
   else if (((b__0 = (0b00010w :  5 words$word)))) then sail2_state_monad$returnS "ft2"
   else if (((b__0 = (0b00011w :  5 words$word)))) then sail2_state_monad$returnS "ft3"
   else if (((b__0 = (0b00100w :  5 words$word)))) then sail2_state_monad$returnS "ft4"
   else if (((b__0 = (0b00101w :  5 words$word)))) then sail2_state_monad$returnS "ft5"
   else if (((b__0 = (0b00110w :  5 words$word)))) then sail2_state_monad$returnS "ft6"
   else if (((b__0 = (0b00111w :  5 words$word)))) then sail2_state_monad$returnS "ft7"
   else if (((b__0 = (0b01000w :  5 words$word)))) then sail2_state_monad$returnS "fs0"
   else if (((b__0 = (0b01001w :  5 words$word)))) then sail2_state_monad$returnS "fs1"
   else if (((b__0 = (0b01010w :  5 words$word)))) then sail2_state_monad$returnS "fa0"
   else if (((b__0 = (0b01011w :  5 words$word)))) then sail2_state_monad$returnS "fa1"
   else if (((b__0 = (0b01100w :  5 words$word)))) then sail2_state_monad$returnS "fa2"
   else if (((b__0 = (0b01101w :  5 words$word)))) then sail2_state_monad$returnS "fa3"
   else if (((b__0 = (0b01110w :  5 words$word)))) then sail2_state_monad$returnS "fa4"
   else if (((b__0 = (0b01111w :  5 words$word)))) then sail2_state_monad$returnS "fa5"
   else if (((b__0 = (0b10000w :  5 words$word)))) then sail2_state_monad$returnS "fa6"
   else if (((b__0 = (0b10001w :  5 words$word)))) then sail2_state_monad$returnS "fa7"
   else if (((b__0 = (0b10010w :  5 words$word)))) then sail2_state_monad$returnS "fs2"
   else if (((b__0 = (0b10011w :  5 words$word)))) then sail2_state_monad$returnS "fs3"
   else if (((b__0 = (0b10100w :  5 words$word)))) then sail2_state_monad$returnS "fs4"
   else if (((b__0 = (0b10101w :  5 words$word)))) then sail2_state_monad$returnS "fs5"
   else if (((b__0 = (0b10110w :  5 words$word)))) then sail2_state_monad$returnS "fs6"
   else if (((b__0 = (0b10111w :  5 words$word)))) then sail2_state_monad$returnS "fs7"
   else if (((b__0 = (0b11000w :  5 words$word)))) then sail2_state_monad$returnS "fs8"
   else if (((b__0 = (0b11001w :  5 words$word)))) then sail2_state_monad$returnS "fs9"
   else if (((b__0 = (0b11010w :  5 words$word)))) then sail2_state_monad$returnS "fs10"
   else if (((b__0 = (0b11011w :  5 words$word)))) then sail2_state_monad$returnS "fs11"
   else if (((b__0 = (0b11100w :  5 words$word)))) then sail2_state_monad$returnS "ft8"
   else if (((b__0 = (0b11101w :  5 words$word)))) then sail2_state_monad$returnS "ft9"
   else if (((b__0 = (0b11110w :  5 words$word)))) then sail2_state_monad$returnS "ft10"
   else if (((b__0 = (0b11111w :  5 words$word)))) then sail2_state_monad$returnS "ft11"
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((freg_name_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((5)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "ft0"))) then sail2_state_monad$returnS (0b00000w :  5 words$word)
   else if (((p0_ = "ft1"))) then sail2_state_monad$returnS (0b00001w :  5 words$word)
   else if (((p0_ = "ft2"))) then sail2_state_monad$returnS (0b00010w :  5 words$word)
   else if (((p0_ = "ft3"))) then sail2_state_monad$returnS (0b00011w :  5 words$word)
   else if (((p0_ = "ft4"))) then sail2_state_monad$returnS (0b00100w :  5 words$word)
   else if (((p0_ = "ft5"))) then sail2_state_monad$returnS (0b00101w :  5 words$word)
   else if (((p0_ = "ft6"))) then sail2_state_monad$returnS (0b00110w :  5 words$word)
   else if (((p0_ = "ft7"))) then sail2_state_monad$returnS (0b00111w :  5 words$word)
   else if (((p0_ = "fs0"))) then sail2_state_monad$returnS (0b01000w :  5 words$word)
   else if (((p0_ = "fs1"))) then sail2_state_monad$returnS (0b01001w :  5 words$word)
   else if (((p0_ = "fa0"))) then sail2_state_monad$returnS (0b01010w :  5 words$word)
   else if (((p0_ = "fa1"))) then sail2_state_monad$returnS (0b01011w :  5 words$word)
   else if (((p0_ = "fa2"))) then sail2_state_monad$returnS (0b01100w :  5 words$word)
   else if (((p0_ = "fa3"))) then sail2_state_monad$returnS (0b01101w :  5 words$word)
   else if (((p0_ = "fa4"))) then sail2_state_monad$returnS (0b01110w :  5 words$word)
   else if (((p0_ = "fa5"))) then sail2_state_monad$returnS (0b01111w :  5 words$word)
   else if (((p0_ = "fa6"))) then sail2_state_monad$returnS (0b10000w :  5 words$word)
   else if (((p0_ = "fa7"))) then sail2_state_monad$returnS (0b10001w :  5 words$word)
   else if (((p0_ = "fs2"))) then sail2_state_monad$returnS (0b10010w :  5 words$word)
   else if (((p0_ = "fs3"))) then sail2_state_monad$returnS (0b10011w :  5 words$word)
   else if (((p0_ = "fs4"))) then sail2_state_monad$returnS (0b10100w :  5 words$word)
   else if (((p0_ = "fs5"))) then sail2_state_monad$returnS (0b10101w :  5 words$word)
   else if (((p0_ = "fs6"))) then sail2_state_monad$returnS (0b10110w :  5 words$word)
   else if (((p0_ = "fs7"))) then sail2_state_monad$returnS (0b10111w :  5 words$word)
   else if (((p0_ = "fs8"))) then sail2_state_monad$returnS (0b11000w :  5 words$word)
   else if (((p0_ = "fs9"))) then sail2_state_monad$returnS (0b11001w :  5 words$word)
   else if (((p0_ = "fs10"))) then sail2_state_monad$returnS (0b11010w :  5 words$word)
   else if (((p0_ = "fs11"))) then sail2_state_monad$returnS (0b11011w :  5 words$word)
   else if (((p0_ = "ft8"))) then sail2_state_monad$returnS (0b11100w :  5 words$word)
   else if (((p0_ = "ft9"))) then sail2_state_monad$returnS (0b11101w :  5 words$word)
   else if (((p0_ = "ft10"))) then sail2_state_monad$returnS (0b11110w :  5 words$word)
   else if (((p0_ = "ft11"))) then sail2_state_monad$returnS (0b11111w :  5 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((freg_name_forwards_matches:(5)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00000w :  5 words$word)))) then T
   else if (((b__0 = (0b00001w :  5 words$word)))) then T
   else if (((b__0 = (0b00010w :  5 words$word)))) then T
   else if (((b__0 = (0b00011w :  5 words$word)))) then T
   else if (((b__0 = (0b00100w :  5 words$word)))) then T
   else if (((b__0 = (0b00101w :  5 words$word)))) then T
   else if (((b__0 = (0b00110w :  5 words$word)))) then T
   else if (((b__0 = (0b00111w :  5 words$word)))) then T
   else if (((b__0 = (0b01000w :  5 words$word)))) then T
   else if (((b__0 = (0b01001w :  5 words$word)))) then T
   else if (((b__0 = (0b01010w :  5 words$word)))) then T
   else if (((b__0 = (0b01011w :  5 words$word)))) then T
   else if (((b__0 = (0b01100w :  5 words$word)))) then T
   else if (((b__0 = (0b01101w :  5 words$word)))) then T
   else if (((b__0 = (0b01110w :  5 words$word)))) then T
   else if (((b__0 = (0b01111w :  5 words$word)))) then T
   else if (((b__0 = (0b10000w :  5 words$word)))) then T
   else if (((b__0 = (0b10001w :  5 words$word)))) then T
   else if (((b__0 = (0b10010w :  5 words$word)))) then T
   else if (((b__0 = (0b10011w :  5 words$word)))) then T
   else if (((b__0 = (0b10100w :  5 words$word)))) then T
   else if (((b__0 = (0b10101w :  5 words$word)))) then T
   else if (((b__0 = (0b10110w :  5 words$word)))) then T
   else if (((b__0 = (0b10111w :  5 words$word)))) then T
   else if (((b__0 = (0b11000w :  5 words$word)))) then T
   else if (((b__0 = (0b11001w :  5 words$word)))) then T
   else if (((b__0 = (0b11010w :  5 words$word)))) then T
   else if (((b__0 = (0b11011w :  5 words$word)))) then T
   else if (((b__0 = (0b11100w :  5 words$word)))) then T
   else if (((b__0 = (0b11101w :  5 words$word)))) then T
   else if (((b__0 = (0b11110w :  5 words$word)))) then T
   else if (((b__0 = (0b11111w :  5 words$word)))) then T
   else F))`;


val _ = Define `
 ((freg_name_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "ft0"))) then T
   else if (((p0_ = "ft1"))) then T
   else if (((p0_ = "ft2"))) then T
   else if (((p0_ = "ft3"))) then T
   else if (((p0_ = "ft4"))) then T
   else if (((p0_ = "ft5"))) then T
   else if (((p0_ = "ft6"))) then T
   else if (((p0_ = "ft7"))) then T
   else if (((p0_ = "fs0"))) then T
   else if (((p0_ = "fs1"))) then T
   else if (((p0_ = "fa0"))) then T
   else if (((p0_ = "fa1"))) then T
   else if (((p0_ = "fa2"))) then T
   else if (((p0_ = "fa3"))) then T
   else if (((p0_ = "fa4"))) then T
   else if (((p0_ = "fa5"))) then T
   else if (((p0_ = "fa6"))) then T
   else if (((p0_ = "fa7"))) then T
   else if (((p0_ = "fs2"))) then T
   else if (((p0_ = "fs3"))) then T
   else if (((p0_ = "fs4"))) then T
   else if (((p0_ = "fs5"))) then T
   else if (((p0_ = "fs6"))) then T
   else if (((p0_ = "fs7"))) then T
   else if (((p0_ = "fs8"))) then T
   else if (((p0_ = "fs9"))) then T
   else if (((p0_ = "fs10"))) then T
   else if (((p0_ = "fs11"))) then T
   else if (((p0_ = "ft8"))) then T
   else if (((p0_ = "ft9"))) then T
   else if (((p0_ = "ft10"))) then T
   else if (((p0_ = "ft11"))) then T
   else F))`;


(*val _s452_ : string -> maybe string*)

val _ = Define `
 ((s452_:string ->(string)option) s453_0=
    (let s454_0 = s453_0 in
   if ((string_startswith s454_0 "ft11")) then  
  (case ((string_drop s454_0 ((string_length "ft11")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s448_ : string -> maybe string*)

val _ = Define `
 ((s448_:string ->(string)option) s449_0=
    (let s450_0 = s449_0 in
   if ((string_startswith s450_0 "ft10")) then  
  (case ((string_drop s450_0 ((string_length "ft10")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s444_ : string -> maybe string*)

val _ = Define `
 ((s444_:string ->(string)option) s445_0=
    (let s446_0 = s445_0 in
   if ((string_startswith s446_0 "ft9")) then  
  (case ((string_drop s446_0 ((string_length "ft9")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s440_ : string -> maybe string*)

val _ = Define `
 ((s440_:string ->(string)option) s441_0=
    (let s442_0 = s441_0 in
   if ((string_startswith s442_0 "ft8")) then  
  (case ((string_drop s442_0 ((string_length "ft8")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s436_ : string -> maybe string*)

val _ = Define `
 ((s436_:string ->(string)option) s437_0=
    (let s438_0 = s437_0 in
   if ((string_startswith s438_0 "fs11")) then  
  (case ((string_drop s438_0 ((string_length "fs11")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s432_ : string -> maybe string*)

val _ = Define `
 ((s432_:string ->(string)option) s433_0=
    (let s434_0 = s433_0 in
   if ((string_startswith s434_0 "fs10")) then  
  (case ((string_drop s434_0 ((string_length "fs10")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s428_ : string -> maybe string*)

val _ = Define `
 ((s428_:string ->(string)option) s429_0=
    (let s430_0 = s429_0 in
   if ((string_startswith s430_0 "fs9")) then  
  (case ((string_drop s430_0 ((string_length "fs9")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s424_ : string -> maybe string*)

val _ = Define `
 ((s424_:string ->(string)option) s425_0=
    (let s426_0 = s425_0 in
   if ((string_startswith s426_0 "fs8")) then  
  (case ((string_drop s426_0 ((string_length "fs8")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s420_ : string -> maybe string*)

val _ = Define `
 ((s420_:string ->(string)option) s421_0=
    (let s422_0 = s421_0 in
   if ((string_startswith s422_0 "fs7")) then  
  (case ((string_drop s422_0 ((string_length "fs7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s416_ : string -> maybe string*)

val _ = Define `
 ((s416_:string ->(string)option) s417_0=
    (let s418_0 = s417_0 in
   if ((string_startswith s418_0 "fs6")) then  
  (case ((string_drop s418_0 ((string_length "fs6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s412_ : string -> maybe string*)

val _ = Define `
 ((s412_:string ->(string)option) s413_0=
    (let s414_0 = s413_0 in
   if ((string_startswith s414_0 "fs5")) then  
  (case ((string_drop s414_0 ((string_length "fs5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s408_ : string -> maybe string*)

val _ = Define `
 ((s408_:string ->(string)option) s409_0=
    (let s410_0 = s409_0 in
   if ((string_startswith s410_0 "fs4")) then  
  (case ((string_drop s410_0 ((string_length "fs4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s404_ : string -> maybe string*)

val _ = Define `
 ((s404_:string ->(string)option) s405_0=
    (let s406_0 = s405_0 in
   if ((string_startswith s406_0 "fs3")) then  
  (case ((string_drop s406_0 ((string_length "fs3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s400_ : string -> maybe string*)

val _ = Define `
 ((s400_:string ->(string)option) s401_0=
    (let s402_0 = s401_0 in
   if ((string_startswith s402_0 "fs2")) then  
  (case ((string_drop s402_0 ((string_length "fs2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s396_ : string -> maybe string*)

val _ = Define `
 ((s396_:string ->(string)option) s397_0=
    (let s398_0 = s397_0 in
   if ((string_startswith s398_0 "fa7")) then  
  (case ((string_drop s398_0 ((string_length "fa7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s392_ : string -> maybe string*)

val _ = Define `
 ((s392_:string ->(string)option) s393_0=
    (let s394_0 = s393_0 in
   if ((string_startswith s394_0 "fa6")) then  
  (case ((string_drop s394_0 ((string_length "fa6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s388_ : string -> maybe string*)

val _ = Define `
 ((s388_:string ->(string)option) s389_0=
    (let s390_0 = s389_0 in
   if ((string_startswith s390_0 "fa5")) then  
  (case ((string_drop s390_0 ((string_length "fa5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s384_ : string -> maybe string*)

val _ = Define `
 ((s384_:string ->(string)option) s385_0=
    (let s386_0 = s385_0 in
   if ((string_startswith s386_0 "fa4")) then  
  (case ((string_drop s386_0 ((string_length "fa4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s380_ : string -> maybe string*)

val _ = Define `
 ((s380_:string ->(string)option) s381_0=
    (let s382_0 = s381_0 in
   if ((string_startswith s382_0 "fa3")) then  
  (case ((string_drop s382_0 ((string_length "fa3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s376_ : string -> maybe string*)

val _ = Define `
 ((s376_:string ->(string)option) s377_0=
    (let s378_0 = s377_0 in
   if ((string_startswith s378_0 "fa2")) then  
  (case ((string_drop s378_0 ((string_length "fa2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s372_ : string -> maybe string*)

val _ = Define `
 ((s372_:string ->(string)option) s373_0=
    (let s374_0 = s373_0 in
   if ((string_startswith s374_0 "fa1")) then  
  (case ((string_drop s374_0 ((string_length "fa1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s368_ : string -> maybe string*)

val _ = Define `
 ((s368_:string ->(string)option) s369_0=
    (let s370_0 = s369_0 in
   if ((string_startswith s370_0 "fa0")) then  
  (case ((string_drop s370_0 ((string_length "fa0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s364_ : string -> maybe string*)

val _ = Define `
 ((s364_:string ->(string)option) s365_0=
    (let s366_0 = s365_0 in
   if ((string_startswith s366_0 "fs1")) then  
  (case ((string_drop s366_0 ((string_length "fs1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s360_ : string -> maybe string*)

val _ = Define `
 ((s360_:string ->(string)option) s361_0=
    (let s362_0 = s361_0 in
   if ((string_startswith s362_0 "fs0")) then  
  (case ((string_drop s362_0 ((string_length "fs0")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s356_ : string -> maybe string*)

val _ = Define `
 ((s356_:string ->(string)option) s357_0=
    (let s358_0 = s357_0 in
   if ((string_startswith s358_0 "ft7")) then  
  (case ((string_drop s358_0 ((string_length "ft7")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s352_ : string -> maybe string*)

val _ = Define `
 ((s352_:string ->(string)option) s353_0=
    (let s354_0 = s353_0 in
   if ((string_startswith s354_0 "ft6")) then  
  (case ((string_drop s354_0 ((string_length "ft6")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s348_ : string -> maybe string*)

val _ = Define `
 ((s348_:string ->(string)option) s349_0=
    (let s350_0 = s349_0 in
   if ((string_startswith s350_0 "ft5")) then  
  (case ((string_drop s350_0 ((string_length "ft5")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s344_ : string -> maybe string*)

val _ = Define `
 ((s344_:string ->(string)option) s345_0=
    (let s346_0 = s345_0 in
   if ((string_startswith s346_0 "ft4")) then  
  (case ((string_drop s346_0 ((string_length "ft4")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s340_ : string -> maybe string*)

val _ = Define `
 ((s340_:string ->(string)option) s341_0=
    (let s342_0 = s341_0 in
   if ((string_startswith s342_0 "ft3")) then  
  (case ((string_drop s342_0 ((string_length "ft3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s336_ : string -> maybe string*)

val _ = Define `
 ((s336_:string ->(string)option) s337_0=
    (let s338_0 = s337_0 in
   if ((string_startswith s338_0 "ft2")) then  
  (case ((string_drop s338_0 ((string_length "ft2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s332_ : string -> maybe string*)

val _ = Define `
 ((s332_:string ->(string)option) s333_0=
    (let s334_0 = s333_0 in
   if ((string_startswith s334_0 "ft1")) then  
  (case ((string_drop s334_0 ((string_length "ft1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s328_ : string -> maybe string*)

val _ = Define `
 ((s328_:string ->(string)option) s329_0=
    (let s330_0 = s329_0 in
   if ((string_startswith s330_0 "ft0")) then  
  (case ((string_drop s330_0 ((string_length "ft0")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((freg_name_matches_prefix:string ->((5)words$word#int)option) arg_=
    (let s331_0 = arg_ in
   if ((case ((s328_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s328_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s332_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s332_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s336_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s336_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s340_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s340_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s344_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s344_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s348_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s348_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s352_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s352_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s356_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s356_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b00111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s360_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s360_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s364_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s364_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s368_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s368_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s372_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s372_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s376_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s376_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s380_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s380_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s384_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s384_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s388_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s388_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b01111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s392_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s392_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s396_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s396_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s400_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s400_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s404_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s404_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s408_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s408_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s412_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s412_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s416_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s416_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s420_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s420_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b10111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s424_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s424_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11000w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s428_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s428_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11001w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s432_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s432_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11010w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s436_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s436_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11011w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s440_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s440_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11100w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s444_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s444_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11101w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s448_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s448_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11110w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s452_ s331_0)) of   SOME (s_) => T | _ => F )) then  
  (case s452_ s331_0 of
      (SOME (s_)) =>
  SOME
    ((0b11111w : 5 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val init_fdext_regs : unit -> M unit*)

val _ = Define `
 ((init_fdext_regs:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS f0_ref zero_freg)
   (sail2_state_monad$write_regS f1_ref zero_freg))
   (sail2_state_monad$write_regS f2_ref zero_freg))
   (sail2_state_monad$write_regS f3_ref zero_freg))
   (sail2_state_monad$write_regS f4_ref zero_freg))
   (sail2_state_monad$write_regS f5_ref zero_freg))
   (sail2_state_monad$write_regS f6_ref zero_freg))
   (sail2_state_monad$write_regS f7_ref zero_freg))
   (sail2_state_monad$write_regS f8_ref zero_freg))
   (sail2_state_monad$write_regS f9_ref zero_freg))
   (sail2_state_monad$write_regS f10_ref zero_freg))
   (sail2_state_monad$write_regS f11_ref zero_freg))
   (sail2_state_monad$write_regS f12_ref zero_freg))
   (sail2_state_monad$write_regS f13_ref zero_freg))
   (sail2_state_monad$write_regS f14_ref zero_freg))
   (sail2_state_monad$write_regS f15_ref zero_freg))
   (sail2_state_monad$write_regS f16_ref zero_freg))
   (sail2_state_monad$write_regS f17_ref zero_freg))
   (sail2_state_monad$write_regS f18_ref zero_freg))
   (sail2_state_monad$write_regS f19_ref zero_freg))
   (sail2_state_monad$write_regS f20_ref zero_freg))
   (sail2_state_monad$write_regS f21_ref zero_freg))
   (sail2_state_monad$write_regS f22_ref zero_freg))
   (sail2_state_monad$write_regS f23_ref zero_freg))
   (sail2_state_monad$write_regS f24_ref zero_freg))
   (sail2_state_monad$write_regS f25_ref zero_freg))
   (sail2_state_monad$write_regS f26_ref zero_freg))
   (sail2_state_monad$write_regS f27_ref zero_freg))
   (sail2_state_monad$write_regS f28_ref zero_freg))
   (sail2_state_monad$write_regS f29_ref zero_freg)) (sail2_state_monad$write_regS f30_ref zero_freg)) (sail2_state_monad$write_regS f31_ref zero_freg)))`;


(*val Mk_Fcsr : mword ty32 -> Fcsr*)

val _ = Define `
 ((Mk_Fcsr:(32)words$word -> Fcsr) v=  (<| Fcsr_Fcsr_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_Fcsr_bits:Fcsr ->(32)words$word) v=  ((subrange_vec_dec v.Fcsr_Fcsr_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_Fcsr_bits:((regstate),(register_value),(Fcsr))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Fcsr_Fcsr_chunk_0 :=
         ((update_subrange_vec_dec r.Fcsr_Fcsr_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_Fcsr_bits:Fcsr ->(32)words$word -> Fcsr) v x=
    (( v with<|
     Fcsr_Fcsr_chunk_0 :=
       ((update_subrange_vec_dec v.Fcsr_Fcsr_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Fcsr_FRM : Fcsr -> mword ty3*)

val _ = Define `
 ((get_Fcsr_FRM:Fcsr ->(3)words$word) v=  ((subrange_vec_dec v.Fcsr_Fcsr_chunk_0 (( 7 : int):ii) (( 5 : int):ii)  :  3 words$word)))`;


(*val _set_Fcsr_FRM : register_ref regstate register_value Fcsr -> mword ty3 -> M unit*)

val _ = Define `
 ((set_Fcsr_FRM:((regstate),(register_value),(Fcsr))register_ref ->(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Fcsr_Fcsr_chunk_0 :=
         ((update_subrange_vec_dec r.Fcsr_Fcsr_chunk_0 (( 7 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Fcsr_FRM : Fcsr -> mword ty3 -> Fcsr*)

val _ = Define `
 ((update_Fcsr_FRM:Fcsr ->(3)words$word -> Fcsr) v x=
    (( v with<|
     Fcsr_Fcsr_chunk_0 :=
       ((update_subrange_vec_dec v.Fcsr_Fcsr_chunk_0 (( 7 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word))
          :  32 words$word)) |>)))`;


(*val _get_Fcsr_FFLAGS : Fcsr -> mword ty5*)

val _ = Define `
 ((get_Fcsr_FFLAGS:Fcsr ->(5)words$word) v=  ((subrange_vec_dec v.Fcsr_Fcsr_chunk_0 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)))`;


(*val _set_Fcsr_FFLAGS : register_ref regstate register_value Fcsr -> mword ty5 -> M unit*)

val _ = Define `
 ((set_Fcsr_FFLAGS:((regstate),(register_value),(Fcsr))register_ref ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       Fcsr_Fcsr_chunk_0 :=
         ((update_subrange_vec_dec r.Fcsr_Fcsr_chunk_0 (( 4 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_Fcsr_FFLAGS : Fcsr -> mword ty5 -> Fcsr*)

val _ = Define `
 ((update_Fcsr_FFLAGS:Fcsr ->(5)words$word -> Fcsr) v x=
    (( v with<|
     Fcsr_Fcsr_chunk_0 :=
       ((update_subrange_vec_dec v.Fcsr_Fcsr_chunk_0 (( 4 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)) |>)))`;


(*val ext_write_fcsr : mword ty3 -> mword ty5 -> M unit*)

val _ = Define `
 ((ext_write_fcsr:(3)words$word ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) frm fflags=  (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (set_Fcsr_FRM fcsr_ref frm)
   (set_Fcsr_FFLAGS fcsr_ref fflags)) (update_softfloat_fflags fflags)) (dirty_fd_context () )))`;


(*val write_fflags : mword ty5 -> M unit*)

val _ = Define `
 ((write_fflags:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) fflags=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS fcsr_ref) (\ (w__0 : Fcsr) .  sail2_state_monad$seqS
   (if (((((get_Fcsr_FFLAGS w__0  :  5 words$word)) <> fflags))) then dirty_fd_context () 
    else sail2_state_monad$returnS () )
   (set_Fcsr_FFLAGS fcsr_ref fflags))))`;


(*val accrue_fflags : mword ty5 -> M unit*)

val _ = Define `
 ((accrue_fflags:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) flags=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS fcsr_ref) (\ (w__0 : Fcsr) . 
   let f = ((or_vec ((get_Fcsr_FFLAGS w__0  :  5 words$word)) flags  :  5 words$word)) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS fcsr_ref) (\ (w__1 : Fcsr) . 
   if (((((get_Fcsr_FFLAGS w__1  :  5 words$word)) <> f))) then sail2_state_monad$seqS (sail2_state_monad$seqS
     (set_Fcsr_FFLAGS fcsr_ref f) (update_softfloat_fflags f)) (dirty_fd_context () )
   else sail2_state_monad$returnS () ))))`;


val _ = Define `
 ((csr_name_map_forwards:(12)words$word -> string) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0x000w :  12 words$word)))) then "ustatus"
   else if (((b__0 = (0x004w :  12 words$word)))) then "uie"
   else if (((b__0 = (0x005w :  12 words$word)))) then "utvec"
   else if (((b__0 = (0x040w :  12 words$word)))) then "uscratch"
   else if (((b__0 = (0x041w :  12 words$word)))) then "uepc"
   else if (((b__0 = (0x042w :  12 words$word)))) then "ucause"
   else if (((b__0 = (0x043w :  12 words$word)))) then "utval"
   else if (((b__0 = (0x044w :  12 words$word)))) then "uip"
   else if (((b__0 = (0x001w :  12 words$word)))) then "fflags"
   else if (((b__0 = (0x002w :  12 words$word)))) then "frm"
   else if (((b__0 = (0x003w :  12 words$word)))) then "fcsr"
   else if (((b__0 = (0xC00w :  12 words$word)))) then "cycle"
   else if (((b__0 = (0xC01w :  12 words$word)))) then "time"
   else if (((b__0 = (0xC02w :  12 words$word)))) then "instret"
   else if (((b__0 = (0xC80w :  12 words$word)))) then "cycleh"
   else if (((b__0 = (0xC81w :  12 words$word)))) then "timeh"
   else if (((b__0 = (0xC82w :  12 words$word)))) then "instreth"
   else if (((b__0 = (0x100w :  12 words$word)))) then "sstatus"
   else if (((b__0 = (0x102w :  12 words$word)))) then "sedeleg"
   else if (((b__0 = (0x103w :  12 words$word)))) then "sideleg"
   else if (((b__0 = (0x104w :  12 words$word)))) then "sie"
   else if (((b__0 = (0x105w :  12 words$word)))) then "stvec"
   else if (((b__0 = (0x106w :  12 words$word)))) then "scounteren"
   else if (((b__0 = (0x140w :  12 words$word)))) then "sscratch"
   else if (((b__0 = (0x141w :  12 words$word)))) then "sepc"
   else if (((b__0 = (0x142w :  12 words$word)))) then "scause"
   else if (((b__0 = (0x143w :  12 words$word)))) then "stval"
   else if (((b__0 = (0x144w :  12 words$word)))) then "sip"
   else if (((b__0 = (0x180w :  12 words$word)))) then "satp"
   else if (((b__0 = (0xF11w :  12 words$word)))) then "mvendorid"
   else if (((b__0 = (0xF12w :  12 words$word)))) then "marchid"
   else if (((b__0 = (0xF13w :  12 words$word)))) then "mimpid"
   else if (((b__0 = (0xF14w :  12 words$word)))) then "mhartid"
   else if (((b__0 = (0x300w :  12 words$word)))) then "mstatus"
   else if (((b__0 = (0x301w :  12 words$word)))) then "misa"
   else if (((b__0 = (0x302w :  12 words$word)))) then "medeleg"
   else if (((b__0 = (0x303w :  12 words$word)))) then "mideleg"
   else if (((b__0 = (0x304w :  12 words$word)))) then "mie"
   else if (((b__0 = (0x305w :  12 words$word)))) then "mtvec"
   else if (((b__0 = (0x306w :  12 words$word)))) then "mcounteren"
   else if (((b__0 = (0x320w :  12 words$word)))) then "mcountinhibit"
   else if (((b__0 = (0x340w :  12 words$word)))) then "mscratch"
   else if (((b__0 = (0x341w :  12 words$word)))) then "mepc"
   else if (((b__0 = (0x342w :  12 words$word)))) then "mcause"
   else if (((b__0 = (0x343w :  12 words$word)))) then "mtval"
   else if (((b__0 = (0x344w :  12 words$word)))) then "mip"
   else if (((b__0 = (0x3A0w :  12 words$word)))) then "pmpcfg0"
   else if (((b__0 = (0x3A1w :  12 words$word)))) then "pmpcfg1"
   else if (((b__0 = (0x3A2w :  12 words$word)))) then "pmpcfg2"
   else if (((b__0 = (0x3A3w :  12 words$word)))) then "pmpcfg3"
   else if (((b__0 = (0x3B0w :  12 words$word)))) then "pmpaddr0"
   else if (((b__0 = (0x3B1w :  12 words$word)))) then "pmpaddr1"
   else if (((b__0 = (0x3B2w :  12 words$word)))) then "pmpaddr2"
   else if (((b__0 = (0x3B3w :  12 words$word)))) then "pmpaddr3"
   else if (((b__0 = (0x3B4w :  12 words$word)))) then "pmpaddr4"
   else if (((b__0 = (0x3B5w :  12 words$word)))) then "pmpaddr5"
   else if (((b__0 = (0x3B6w :  12 words$word)))) then "pmpaddr6"
   else if (((b__0 = (0x3B7w :  12 words$word)))) then "pmpaddr7"
   else if (((b__0 = (0x3B8w :  12 words$word)))) then "pmpaddr8"
   else if (((b__0 = (0x3B9w :  12 words$word)))) then "pmpaddr9"
   else if (((b__0 = (0x3BAw :  12 words$word)))) then "pmpaddr10"
   else if (((b__0 = (0x3BBw :  12 words$word)))) then "pmpaddr11"
   else if (((b__0 = (0x3BCw :  12 words$word)))) then "pmpaddr12"
   else if (((b__0 = (0x3BDw :  12 words$word)))) then "pmpaddr13"
   else if (((b__0 = (0x3BEw :  12 words$word)))) then "pmpaddr14"
   else if (((b__0 = (0x3BFw :  12 words$word)))) then "pmpaddr15"
   else if (((b__0 = (0xB00w :  12 words$word)))) then "mcycle"
   else if (((b__0 = (0xB02w :  12 words$word)))) then "minstret"
   else if (((b__0 = (0xB80w :  12 words$word)))) then "mcycleh"
   else if (((b__0 = (0xB82w :  12 words$word)))) then "minstreth"
   else if (((b__0 = (0x7A0w :  12 words$word)))) then "tselect"
   else if (((b__0 = (0x7A1w :  12 words$word)))) then "tdata1"
   else if (((b__0 = (0x7A2w :  12 words$word)))) then "tdata2"
   else if (((b__0 = (0x7A3w :  12 words$word)))) then "tdata3"
   else decimal_string_of_bits b__0))`;


val _ = Define `
 ((csr_name_map_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((12)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "ustatus"))) then sail2_state_monad$returnS (0x000w :  12 words$word)
   else if (((p0_ = "uie"))) then sail2_state_monad$returnS (0x004w :  12 words$word)
   else if (((p0_ = "utvec"))) then sail2_state_monad$returnS (0x005w :  12 words$word)
   else if (((p0_ = "uscratch"))) then sail2_state_monad$returnS (0x040w :  12 words$word)
   else if (((p0_ = "uepc"))) then sail2_state_monad$returnS (0x041w :  12 words$word)
   else if (((p0_ = "ucause"))) then sail2_state_monad$returnS (0x042w :  12 words$word)
   else if (((p0_ = "utval"))) then sail2_state_monad$returnS (0x043w :  12 words$word)
   else if (((p0_ = "uip"))) then sail2_state_monad$returnS (0x044w :  12 words$word)
   else if (((p0_ = "fflags"))) then sail2_state_monad$returnS (0x001w :  12 words$word)
   else if (((p0_ = "frm"))) then sail2_state_monad$returnS (0x002w :  12 words$word)
   else if (((p0_ = "fcsr"))) then sail2_state_monad$returnS (0x003w :  12 words$word)
   else if (((p0_ = "cycle"))) then sail2_state_monad$returnS (0xC00w :  12 words$word)
   else if (((p0_ = "time"))) then sail2_state_monad$returnS (0xC01w :  12 words$word)
   else if (((p0_ = "instret"))) then sail2_state_monad$returnS (0xC02w :  12 words$word)
   else if (((p0_ = "cycleh"))) then sail2_state_monad$returnS (0xC80w :  12 words$word)
   else if (((p0_ = "timeh"))) then sail2_state_monad$returnS (0xC81w :  12 words$word)
   else if (((p0_ = "instreth"))) then sail2_state_monad$returnS (0xC82w :  12 words$word)
   else if (((p0_ = "sstatus"))) then sail2_state_monad$returnS (0x100w :  12 words$word)
   else if (((p0_ = "sedeleg"))) then sail2_state_monad$returnS (0x102w :  12 words$word)
   else if (((p0_ = "sideleg"))) then sail2_state_monad$returnS (0x103w :  12 words$word)
   else if (((p0_ = "sie"))) then sail2_state_monad$returnS (0x104w :  12 words$word)
   else if (((p0_ = "stvec"))) then sail2_state_monad$returnS (0x105w :  12 words$word)
   else if (((p0_ = "scounteren"))) then sail2_state_monad$returnS (0x106w :  12 words$word)
   else if (((p0_ = "sscratch"))) then sail2_state_monad$returnS (0x140w :  12 words$word)
   else if (((p0_ = "sepc"))) then sail2_state_monad$returnS (0x141w :  12 words$word)
   else if (((p0_ = "scause"))) then sail2_state_monad$returnS (0x142w :  12 words$word)
   else if (((p0_ = "stval"))) then sail2_state_monad$returnS (0x143w :  12 words$word)
   else if (((p0_ = "sip"))) then sail2_state_monad$returnS (0x144w :  12 words$word)
   else if (((p0_ = "satp"))) then sail2_state_monad$returnS (0x180w :  12 words$word)
   else if (((p0_ = "mvendorid"))) then sail2_state_monad$returnS (0xF11w :  12 words$word)
   else if (((p0_ = "marchid"))) then sail2_state_monad$returnS (0xF12w :  12 words$word)
   else if (((p0_ = "mimpid"))) then sail2_state_monad$returnS (0xF13w :  12 words$word)
   else if (((p0_ = "mhartid"))) then sail2_state_monad$returnS (0xF14w :  12 words$word)
   else if (((p0_ = "mstatus"))) then sail2_state_monad$returnS (0x300w :  12 words$word)
   else if (((p0_ = "misa"))) then sail2_state_monad$returnS (0x301w :  12 words$word)
   else if (((p0_ = "medeleg"))) then sail2_state_monad$returnS (0x302w :  12 words$word)
   else if (((p0_ = "mideleg"))) then sail2_state_monad$returnS (0x303w :  12 words$word)
   else if (((p0_ = "mie"))) then sail2_state_monad$returnS (0x304w :  12 words$word)
   else if (((p0_ = "mtvec"))) then sail2_state_monad$returnS (0x305w :  12 words$word)
   else if (((p0_ = "mcounteren"))) then sail2_state_monad$returnS (0x306w :  12 words$word)
   else if (((p0_ = "mcountinhibit"))) then sail2_state_monad$returnS (0x320w :  12 words$word)
   else if (((p0_ = "mscratch"))) then sail2_state_monad$returnS (0x340w :  12 words$word)
   else if (((p0_ = "mepc"))) then sail2_state_monad$returnS (0x341w :  12 words$word)
   else if (((p0_ = "mcause"))) then sail2_state_monad$returnS (0x342w :  12 words$word)
   else if (((p0_ = "mtval"))) then sail2_state_monad$returnS (0x343w :  12 words$word)
   else if (((p0_ = "mip"))) then sail2_state_monad$returnS (0x344w :  12 words$word)
   else if (((p0_ = "pmpcfg0"))) then sail2_state_monad$returnS (0x3A0w :  12 words$word)
   else if (((p0_ = "pmpcfg1"))) then sail2_state_monad$returnS (0x3A1w :  12 words$word)
   else if (((p0_ = "pmpcfg2"))) then sail2_state_monad$returnS (0x3A2w :  12 words$word)
   else if (((p0_ = "pmpcfg3"))) then sail2_state_monad$returnS (0x3A3w :  12 words$word)
   else if (((p0_ = "pmpaddr0"))) then sail2_state_monad$returnS (0x3B0w :  12 words$word)
   else if (((p0_ = "pmpaddr1"))) then sail2_state_monad$returnS (0x3B1w :  12 words$word)
   else if (((p0_ = "pmpaddr2"))) then sail2_state_monad$returnS (0x3B2w :  12 words$word)
   else if (((p0_ = "pmpaddr3"))) then sail2_state_monad$returnS (0x3B3w :  12 words$word)
   else if (((p0_ = "pmpaddr4"))) then sail2_state_monad$returnS (0x3B4w :  12 words$word)
   else if (((p0_ = "pmpaddr5"))) then sail2_state_monad$returnS (0x3B5w :  12 words$word)
   else if (((p0_ = "pmpaddr6"))) then sail2_state_monad$returnS (0x3B6w :  12 words$word)
   else if (((p0_ = "pmpaddr7"))) then sail2_state_monad$returnS (0x3B7w :  12 words$word)
   else if (((p0_ = "pmpaddr8"))) then sail2_state_monad$returnS (0x3B8w :  12 words$word)
   else if (((p0_ = "pmpaddr9"))) then sail2_state_monad$returnS (0x3B9w :  12 words$word)
   else if (((p0_ = "pmpaddr10"))) then sail2_state_monad$returnS (0x3BAw :  12 words$word)
   else if (((p0_ = "pmpaddr11"))) then sail2_state_monad$returnS (0x3BBw :  12 words$word)
   else if (((p0_ = "pmpaddr12"))) then sail2_state_monad$returnS (0x3BCw :  12 words$word)
   else if (((p0_ = "pmpaddr13"))) then sail2_state_monad$returnS (0x3BDw :  12 words$word)
   else if (((p0_ = "pmpaddr14"))) then sail2_state_monad$returnS (0x3BEw :  12 words$word)
   else if (((p0_ = "pmpaddr15"))) then sail2_state_monad$returnS (0x3BFw :  12 words$word)
   else if (((p0_ = "mcycle"))) then sail2_state_monad$returnS (0xB00w :  12 words$word)
   else if (((p0_ = "minstret"))) then sail2_state_monad$returnS (0xB02w :  12 words$word)
   else if (((p0_ = "mcycleh"))) then sail2_state_monad$returnS (0xB80w :  12 words$word)
   else if (((p0_ = "minstreth"))) then sail2_state_monad$returnS (0xB82w :  12 words$word)
   else if (((p0_ = "tselect"))) then sail2_state_monad$returnS (0x7A0w :  12 words$word)
   else if (((p0_ = "tdata1"))) then sail2_state_monad$returnS (0x7A1w :  12 words$word)
   else if (((p0_ = "tdata2"))) then sail2_state_monad$returnS (0x7A2w :  12 words$word)
   else if (((p0_ = "tdata3"))) then sail2_state_monad$returnS (0x7A3w :  12 words$word)
   else if ((hex_bits_12_backwards_matches p0_)) then (hex_bits_12_backwards p0_  : ( 12 words$word) M)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((csr_name_map_forwards_matches:(12)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0x000w :  12 words$word)))) then T
   else if (((b__0 = (0x004w :  12 words$word)))) then T
   else if (((b__0 = (0x005w :  12 words$word)))) then T
   else if (((b__0 = (0x040w :  12 words$word)))) then T
   else if (((b__0 = (0x041w :  12 words$word)))) then T
   else if (((b__0 = (0x042w :  12 words$word)))) then T
   else if (((b__0 = (0x043w :  12 words$word)))) then T
   else if (((b__0 = (0x044w :  12 words$word)))) then T
   else if (((b__0 = (0x001w :  12 words$word)))) then T
   else if (((b__0 = (0x002w :  12 words$word)))) then T
   else if (((b__0 = (0x003w :  12 words$word)))) then T
   else if (((b__0 = (0xC00w :  12 words$word)))) then T
   else if (((b__0 = (0xC01w :  12 words$word)))) then T
   else if (((b__0 = (0xC02w :  12 words$word)))) then T
   else if (((b__0 = (0xC80w :  12 words$word)))) then T
   else if (((b__0 = (0xC81w :  12 words$word)))) then T
   else if (((b__0 = (0xC82w :  12 words$word)))) then T
   else if (((b__0 = (0x100w :  12 words$word)))) then T
   else if (((b__0 = (0x102w :  12 words$word)))) then T
   else if (((b__0 = (0x103w :  12 words$word)))) then T
   else if (((b__0 = (0x104w :  12 words$word)))) then T
   else if (((b__0 = (0x105w :  12 words$word)))) then T
   else if (((b__0 = (0x106w :  12 words$word)))) then T
   else if (((b__0 = (0x140w :  12 words$word)))) then T
   else if (((b__0 = (0x141w :  12 words$word)))) then T
   else if (((b__0 = (0x142w :  12 words$word)))) then T
   else if (((b__0 = (0x143w :  12 words$word)))) then T
   else if (((b__0 = (0x144w :  12 words$word)))) then T
   else if (((b__0 = (0x180w :  12 words$word)))) then T
   else if (((b__0 = (0xF11w :  12 words$word)))) then T
   else if (((b__0 = (0xF12w :  12 words$word)))) then T
   else if (((b__0 = (0xF13w :  12 words$word)))) then T
   else if (((b__0 = (0xF14w :  12 words$word)))) then T
   else if (((b__0 = (0x300w :  12 words$word)))) then T
   else if (((b__0 = (0x301w :  12 words$word)))) then T
   else if (((b__0 = (0x302w :  12 words$word)))) then T
   else if (((b__0 = (0x303w :  12 words$word)))) then T
   else if (((b__0 = (0x304w :  12 words$word)))) then T
   else if (((b__0 = (0x305w :  12 words$word)))) then T
   else if (((b__0 = (0x306w :  12 words$word)))) then T
   else if (((b__0 = (0x320w :  12 words$word)))) then T
   else if (((b__0 = (0x340w :  12 words$word)))) then T
   else if (((b__0 = (0x341w :  12 words$word)))) then T
   else if (((b__0 = (0x342w :  12 words$word)))) then T
   else if (((b__0 = (0x343w :  12 words$word)))) then T
   else if (((b__0 = (0x344w :  12 words$word)))) then T
   else if (((b__0 = (0x3A0w :  12 words$word)))) then T
   else if (((b__0 = (0x3A1w :  12 words$word)))) then T
   else if (((b__0 = (0x3A2w :  12 words$word)))) then T
   else if (((b__0 = (0x3A3w :  12 words$word)))) then T
   else if (((b__0 = (0x3B0w :  12 words$word)))) then T
   else if (((b__0 = (0x3B1w :  12 words$word)))) then T
   else if (((b__0 = (0x3B2w :  12 words$word)))) then T
   else if (((b__0 = (0x3B3w :  12 words$word)))) then T
   else if (((b__0 = (0x3B4w :  12 words$word)))) then T
   else if (((b__0 = (0x3B5w :  12 words$word)))) then T
   else if (((b__0 = (0x3B6w :  12 words$word)))) then T
   else if (((b__0 = (0x3B7w :  12 words$word)))) then T
   else if (((b__0 = (0x3B8w :  12 words$word)))) then T
   else if (((b__0 = (0x3B9w :  12 words$word)))) then T
   else if (((b__0 = (0x3BAw :  12 words$word)))) then T
   else if (((b__0 = (0x3BBw :  12 words$word)))) then T
   else if (((b__0 = (0x3BCw :  12 words$word)))) then T
   else if (((b__0 = (0x3BDw :  12 words$word)))) then T
   else if (((b__0 = (0x3BEw :  12 words$word)))) then T
   else if (((b__0 = (0x3BFw :  12 words$word)))) then T
   else if (((b__0 = (0xB00w :  12 words$word)))) then T
   else if (((b__0 = (0xB02w :  12 words$word)))) then T
   else if (((b__0 = (0xB80w :  12 words$word)))) then T
   else if (((b__0 = (0xB82w :  12 words$word)))) then T
   else if (((b__0 = (0x7A0w :  12 words$word)))) then T
   else if (((b__0 = (0x7A1w :  12 words$word)))) then T
   else if (((b__0 = (0x7A2w :  12 words$word)))) then T
   else if (((b__0 = (0x7A3w :  12 words$word)))) then T
   else T))`;


val _ = Define `
 ((csr_name_map_backwards_matches:string ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "ustatus"))) then sail2_state_monad$returnS T
   else if (((p0_ = "uie"))) then sail2_state_monad$returnS T
   else if (((p0_ = "utvec"))) then sail2_state_monad$returnS T
   else if (((p0_ = "uscratch"))) then sail2_state_monad$returnS T
   else if (((p0_ = "uepc"))) then sail2_state_monad$returnS T
   else if (((p0_ = "ucause"))) then sail2_state_monad$returnS T
   else if (((p0_ = "utval"))) then sail2_state_monad$returnS T
   else if (((p0_ = "uip"))) then sail2_state_monad$returnS T
   else if (((p0_ = "fflags"))) then sail2_state_monad$returnS T
   else if (((p0_ = "frm"))) then sail2_state_monad$returnS T
   else if (((p0_ = "fcsr"))) then sail2_state_monad$returnS T
   else if (((p0_ = "cycle"))) then sail2_state_monad$returnS T
   else if (((p0_ = "time"))) then sail2_state_monad$returnS T
   else if (((p0_ = "instret"))) then sail2_state_monad$returnS T
   else if (((p0_ = "cycleh"))) then sail2_state_monad$returnS T
   else if (((p0_ = "timeh"))) then sail2_state_monad$returnS T
   else if (((p0_ = "instreth"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sstatus"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sedeleg"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sideleg"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sie"))) then sail2_state_monad$returnS T
   else if (((p0_ = "stvec"))) then sail2_state_monad$returnS T
   else if (((p0_ = "scounteren"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sscratch"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sepc"))) then sail2_state_monad$returnS T
   else if (((p0_ = "scause"))) then sail2_state_monad$returnS T
   else if (((p0_ = "stval"))) then sail2_state_monad$returnS T
   else if (((p0_ = "sip"))) then sail2_state_monad$returnS T
   else if (((p0_ = "satp"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mvendorid"))) then sail2_state_monad$returnS T
   else if (((p0_ = "marchid"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mimpid"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mhartid"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mstatus"))) then sail2_state_monad$returnS T
   else if (((p0_ = "misa"))) then sail2_state_monad$returnS T
   else if (((p0_ = "medeleg"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mideleg"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mie"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mtvec"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mcounteren"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mcountinhibit"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mscratch"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mepc"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mcause"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mtval"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mip"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpcfg0"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpcfg1"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpcfg2"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpcfg3"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr0"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr1"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr2"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr3"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr4"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr5"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr6"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr7"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr8"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr9"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr10"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr11"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr12"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr13"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr14"))) then sail2_state_monad$returnS T
   else if (((p0_ = "pmpaddr15"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mcycle"))) then sail2_state_monad$returnS T
   else if (((p0_ = "minstret"))) then sail2_state_monad$returnS T
   else if (((p0_ = "mcycleh"))) then sail2_state_monad$returnS T
   else if (((p0_ = "minstreth"))) then sail2_state_monad$returnS T
   else if (((p0_ = "tselect"))) then sail2_state_monad$returnS T
   else if (((p0_ = "tdata1"))) then sail2_state_monad$returnS T
   else if (((p0_ = "tdata2"))) then sail2_state_monad$returnS T
   else if (((p0_ = "tdata3"))) then sail2_state_monad$returnS T
   else if ((hex_bits_12_backwards_matches p0_)) then sail2_state_monad$bindS
     (hex_bits_12_backwards p0_  : ( 12 words$word) M) (\ reg .  sail2_state_monad$returnS T)
   else sail2_state_monad$returnS F))`;


(*val _s752_ : string -> maybe ((mword ty12 * string))*)

val _ = Define `
 ((s752_:string ->((12)words$word#string)option) s753_0= 
  ((case s753_0 of
         s754_0 =>
   (case ((hex_bits_12_matches_prefix0 s754_0 : (( 12 words$word # ii)) option)) of
         SOME ((reg, s755_0)) =>
   (case ((string_drop s754_0 s755_0)) of   s_ => SOME (reg, s_) )
     | _ => NONE
   )
   )))`;


(*val _s748_ : string -> maybe string*)

val _ = Define `
 ((s748_:string ->(string)option) s749_0=
    (let s750_0 = s749_0 in
   if ((string_startswith s750_0 "tdata3")) then  
  (case ((string_drop s750_0 ((string_length "tdata3")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s744_ : string -> maybe string*)

val _ = Define `
 ((s744_:string ->(string)option) s745_0=
    (let s746_0 = s745_0 in
   if ((string_startswith s746_0 "tdata2")) then  
  (case ((string_drop s746_0 ((string_length "tdata2")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s740_ : string -> maybe string*)

val _ = Define `
 ((s740_:string ->(string)option) s741_0=
    (let s742_0 = s741_0 in
   if ((string_startswith s742_0 "tdata1")) then  
  (case ((string_drop s742_0 ((string_length "tdata1")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s736_ : string -> maybe string*)

val _ = Define `
 ((s736_:string ->(string)option) s737_0=
    (let s738_0 = s737_0 in
   if ((string_startswith s738_0 "tselect")) then  
  (case ((string_drop s738_0 ((string_length "tselect")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s732_ : string -> maybe string*)

val _ = Define `
 ((s732_:string ->(string)option) s733_0=
    (let s734_0 = s733_0 in
   if ((string_startswith s734_0 "minstreth")) then  
  (case ((string_drop s734_0 ((string_length "minstreth")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s728_ : string -> maybe string*)

val _ = Define `
 ((s728_:string ->(string)option) s729_0=
    (let s730_0 = s729_0 in
   if ((string_startswith s730_0 "mcycleh")) then  
  (case ((string_drop s730_0 ((string_length "mcycleh")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s724_ : string -> maybe string*)

val _ = Define `
 ((s724_:string ->(string)option) s725_0=
    (let s726_0 = s725_0 in
   if ((string_startswith s726_0 "minstret")) then  
  (case ((string_drop s726_0 ((string_length "minstret")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s720_ : string -> maybe string*)

val _ = Define `
 ((s720_:string ->(string)option) s721_0=
    (let s722_0 = s721_0 in
   if ((string_startswith s722_0 "mcycle")) then  
  (case ((string_drop s722_0 ((string_length "mcycle")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s716_ : string -> maybe string*)

val _ = Define `
 ((s716_:string ->(string)option) s717_0=
    (let s718_0 = s717_0 in
   if ((string_startswith s718_0 "pmpaddr15")) then  
  (case ((string_drop s718_0 ((string_length "pmpaddr15")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s712_ : string -> maybe string*)

val _ = Define `
 ((s712_:string ->(string)option) s713_0=
    (let s714_0 = s713_0 in
   if ((string_startswith s714_0 "pmpaddr14")) then  
  (case ((string_drop s714_0 ((string_length "pmpaddr14")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s708_ : string -> maybe string*)

val _ = Define `
 ((s708_:string ->(string)option) s709_0=
    (let s710_0 = s709_0 in
   if ((string_startswith s710_0 "pmpaddr13")) then  
  (case ((string_drop s710_0 ((string_length "pmpaddr13")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s704_ : string -> maybe string*)

val _ = Define `
 ((s704_:string ->(string)option) s705_0=
    (let s706_0 = s705_0 in
   if ((string_startswith s706_0 "pmpaddr12")) then  
  (case ((string_drop s706_0 ((string_length "pmpaddr12")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s700_ : string -> maybe string*)

val _ = Define `
 ((s700_:string ->(string)option) s701_0=
    (let s702_0 = s701_0 in
   if ((string_startswith s702_0 "pmpaddr11")) then  
  (case ((string_drop s702_0 ((string_length "pmpaddr11")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s696_ : string -> maybe string*)

val _ = Define `
 ((s696_:string ->(string)option) s697_0=
    (let s698_0 = s697_0 in
   if ((string_startswith s698_0 "pmpaddr10")) then  
  (case ((string_drop s698_0 ((string_length "pmpaddr10")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s692_ : string -> maybe string*)

val _ = Define `
 ((s692_:string ->(string)option) s693_0=
    (let s694_0 = s693_0 in
   if ((string_startswith s694_0 "pmpaddr9")) then  
  (case ((string_drop s694_0 ((string_length "pmpaddr9")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s688_ : string -> maybe string*)

val _ = Define `
 ((s688_:string ->(string)option) s689_0=
    (let s690_0 = s689_0 in
   if ((string_startswith s690_0 "pmpaddr8")) then  
  (case ((string_drop s690_0 ((string_length "pmpaddr8")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s684_ : string -> maybe string*)

val _ = Define `
 ((s684_:string ->(string)option) s685_0=
    (let s686_0 = s685_0 in
   if ((string_startswith s686_0 "pmpaddr7")) then  
  (case ((string_drop s686_0 ((string_length "pmpaddr7")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s680_ : string -> maybe string*)

val _ = Define `
 ((s680_:string ->(string)option) s681_0=
    (let s682_0 = s681_0 in
   if ((string_startswith s682_0 "pmpaddr6")) then  
  (case ((string_drop s682_0 ((string_length "pmpaddr6")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s676_ : string -> maybe string*)

val _ = Define `
 ((s676_:string ->(string)option) s677_0=
    (let s678_0 = s677_0 in
   if ((string_startswith s678_0 "pmpaddr5")) then  
  (case ((string_drop s678_0 ((string_length "pmpaddr5")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s672_ : string -> maybe string*)

val _ = Define `
 ((s672_:string ->(string)option) s673_0=
    (let s674_0 = s673_0 in
   if ((string_startswith s674_0 "pmpaddr4")) then  
  (case ((string_drop s674_0 ((string_length "pmpaddr4")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s668_ : string -> maybe string*)

val _ = Define `
 ((s668_:string ->(string)option) s669_0=
    (let s670_0 = s669_0 in
   if ((string_startswith s670_0 "pmpaddr3")) then  
  (case ((string_drop s670_0 ((string_length "pmpaddr3")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s664_ : string -> maybe string*)

val _ = Define `
 ((s664_:string ->(string)option) s665_0=
    (let s666_0 = s665_0 in
   if ((string_startswith s666_0 "pmpaddr2")) then  
  (case ((string_drop s666_0 ((string_length "pmpaddr2")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s660_ : string -> maybe string*)

val _ = Define `
 ((s660_:string ->(string)option) s661_0=
    (let s662_0 = s661_0 in
   if ((string_startswith s662_0 "pmpaddr1")) then  
  (case ((string_drop s662_0 ((string_length "pmpaddr1")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s656_ : string -> maybe string*)

val _ = Define `
 ((s656_:string ->(string)option) s657_0=
    (let s658_0 = s657_0 in
   if ((string_startswith s658_0 "pmpaddr0")) then  
  (case ((string_drop s658_0 ((string_length "pmpaddr0")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s652_ : string -> maybe string*)

val _ = Define `
 ((s652_:string ->(string)option) s653_0=
    (let s654_0 = s653_0 in
   if ((string_startswith s654_0 "pmpcfg3")) then  
  (case ((string_drop s654_0 ((string_length "pmpcfg3")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s648_ : string -> maybe string*)

val _ = Define `
 ((s648_:string ->(string)option) s649_0=
    (let s650_0 = s649_0 in
   if ((string_startswith s650_0 "pmpcfg2")) then  
  (case ((string_drop s650_0 ((string_length "pmpcfg2")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s644_ : string -> maybe string*)

val _ = Define `
 ((s644_:string ->(string)option) s645_0=
    (let s646_0 = s645_0 in
   if ((string_startswith s646_0 "pmpcfg1")) then  
  (case ((string_drop s646_0 ((string_length "pmpcfg1")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s640_ : string -> maybe string*)

val _ = Define `
 ((s640_:string ->(string)option) s641_0=
    (let s642_0 = s641_0 in
   if ((string_startswith s642_0 "pmpcfg0")) then  
  (case ((string_drop s642_0 ((string_length "pmpcfg0")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s636_ : string -> maybe string*)

val _ = Define `
 ((s636_:string ->(string)option) s637_0=
    (let s638_0 = s637_0 in
   if ((string_startswith s638_0 "mip")) then  
  (case ((string_drop s638_0 ((string_length "mip")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s632_ : string -> maybe string*)

val _ = Define `
 ((s632_:string ->(string)option) s633_0=
    (let s634_0 = s633_0 in
   if ((string_startswith s634_0 "mtval")) then  
  (case ((string_drop s634_0 ((string_length "mtval")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s628_ : string -> maybe string*)

val _ = Define `
 ((s628_:string ->(string)option) s629_0=
    (let s630_0 = s629_0 in
   if ((string_startswith s630_0 "mcause")) then  
  (case ((string_drop s630_0 ((string_length "mcause")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s624_ : string -> maybe string*)

val _ = Define `
 ((s624_:string ->(string)option) s625_0=
    (let s626_0 = s625_0 in
   if ((string_startswith s626_0 "mepc")) then  
  (case ((string_drop s626_0 ((string_length "mepc")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s620_ : string -> maybe string*)

val _ = Define `
 ((s620_:string ->(string)option) s621_0=
    (let s622_0 = s621_0 in
   if ((string_startswith s622_0 "mscratch")) then  
  (case ((string_drop s622_0 ((string_length "mscratch")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s616_ : string -> maybe string*)

val _ = Define `
 ((s616_:string ->(string)option) s617_0=
    (let s618_0 = s617_0 in
   if ((string_startswith s618_0 "mcountinhibit")) then  
  (case ((string_drop s618_0 ((string_length "mcountinhibit")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s612_ : string -> maybe string*)

val _ = Define `
 ((s612_:string ->(string)option) s613_0=
    (let s614_0 = s613_0 in
   if ((string_startswith s614_0 "mcounteren")) then  
  (case ((string_drop s614_0 ((string_length "mcounteren")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s608_ : string -> maybe string*)

val _ = Define `
 ((s608_:string ->(string)option) s609_0=
    (let s610_0 = s609_0 in
   if ((string_startswith s610_0 "mtvec")) then  
  (case ((string_drop s610_0 ((string_length "mtvec")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s604_ : string -> maybe string*)

val _ = Define `
 ((s604_:string ->(string)option) s605_0=
    (let s606_0 = s605_0 in
   if ((string_startswith s606_0 "mie")) then  
  (case ((string_drop s606_0 ((string_length "mie")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s600_ : string -> maybe string*)

val _ = Define `
 ((s600_:string ->(string)option) s601_0=
    (let s602_0 = s601_0 in
   if ((string_startswith s602_0 "mideleg")) then  
  (case ((string_drop s602_0 ((string_length "mideleg")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s596_ : string -> maybe string*)

val _ = Define `
 ((s596_:string ->(string)option) s597_0=
    (let s598_0 = s597_0 in
   if ((string_startswith s598_0 "medeleg")) then  
  (case ((string_drop s598_0 ((string_length "medeleg")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s592_ : string -> maybe string*)

val _ = Define `
 ((s592_:string ->(string)option) s593_0=
    (let s594_0 = s593_0 in
   if ((string_startswith s594_0 "misa")) then  
  (case ((string_drop s594_0 ((string_length "misa")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s588_ : string -> maybe string*)

val _ = Define `
 ((s588_:string ->(string)option) s589_0=
    (let s590_0 = s589_0 in
   if ((string_startswith s590_0 "mstatus")) then  
  (case ((string_drop s590_0 ((string_length "mstatus")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s584_ : string -> maybe string*)

val _ = Define `
 ((s584_:string ->(string)option) s585_0=
    (let s586_0 = s585_0 in
   if ((string_startswith s586_0 "mhartid")) then  
  (case ((string_drop s586_0 ((string_length "mhartid")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s580_ : string -> maybe string*)

val _ = Define `
 ((s580_:string ->(string)option) s581_0=
    (let s582_0 = s581_0 in
   if ((string_startswith s582_0 "mimpid")) then  
  (case ((string_drop s582_0 ((string_length "mimpid")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s576_ : string -> maybe string*)

val _ = Define `
 ((s576_:string ->(string)option) s577_0=
    (let s578_0 = s577_0 in
   if ((string_startswith s578_0 "marchid")) then  
  (case ((string_drop s578_0 ((string_length "marchid")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s572_ : string -> maybe string*)

val _ = Define `
 ((s572_:string ->(string)option) s573_0=
    (let s574_0 = s573_0 in
   if ((string_startswith s574_0 "mvendorid")) then  
  (case ((string_drop s574_0 ((string_length "mvendorid")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s568_ : string -> maybe string*)

val _ = Define `
 ((s568_:string ->(string)option) s569_0=
    (let s570_0 = s569_0 in
   if ((string_startswith s570_0 "satp")) then  
  (case ((string_drop s570_0 ((string_length "satp")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s564_ : string -> maybe string*)

val _ = Define `
 ((s564_:string ->(string)option) s565_0=
    (let s566_0 = s565_0 in
   if ((string_startswith s566_0 "sip")) then  
  (case ((string_drop s566_0 ((string_length "sip")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s560_ : string -> maybe string*)

val _ = Define `
 ((s560_:string ->(string)option) s561_0=
    (let s562_0 = s561_0 in
   if ((string_startswith s562_0 "stval")) then  
  (case ((string_drop s562_0 ((string_length "stval")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s556_ : string -> maybe string*)

val _ = Define `
 ((s556_:string ->(string)option) s557_0=
    (let s558_0 = s557_0 in
   if ((string_startswith s558_0 "scause")) then  
  (case ((string_drop s558_0 ((string_length "scause")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s552_ : string -> maybe string*)

val _ = Define `
 ((s552_:string ->(string)option) s553_0=
    (let s554_0 = s553_0 in
   if ((string_startswith s554_0 "sepc")) then  
  (case ((string_drop s554_0 ((string_length "sepc")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s548_ : string -> maybe string*)

val _ = Define `
 ((s548_:string ->(string)option) s549_0=
    (let s550_0 = s549_0 in
   if ((string_startswith s550_0 "sscratch")) then  
  (case ((string_drop s550_0 ((string_length "sscratch")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s544_ : string -> maybe string*)

val _ = Define `
 ((s544_:string ->(string)option) s545_0=
    (let s546_0 = s545_0 in
   if ((string_startswith s546_0 "scounteren")) then  
  (case ((string_drop s546_0 ((string_length "scounteren")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s540_ : string -> maybe string*)

val _ = Define `
 ((s540_:string ->(string)option) s541_0=
    (let s542_0 = s541_0 in
   if ((string_startswith s542_0 "stvec")) then  
  (case ((string_drop s542_0 ((string_length "stvec")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s536_ : string -> maybe string*)

val _ = Define `
 ((s536_:string ->(string)option) s537_0=
    (let s538_0 = s537_0 in
   if ((string_startswith s538_0 "sie")) then  
  (case ((string_drop s538_0 ((string_length "sie")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s532_ : string -> maybe string*)

val _ = Define `
 ((s532_:string ->(string)option) s533_0=
    (let s534_0 = s533_0 in
   if ((string_startswith s534_0 "sideleg")) then  
  (case ((string_drop s534_0 ((string_length "sideleg")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s528_ : string -> maybe string*)

val _ = Define `
 ((s528_:string ->(string)option) s529_0=
    (let s530_0 = s529_0 in
   if ((string_startswith s530_0 "sedeleg")) then  
  (case ((string_drop s530_0 ((string_length "sedeleg")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s524_ : string -> maybe string*)

val _ = Define `
 ((s524_:string ->(string)option) s525_0=
    (let s526_0 = s525_0 in
   if ((string_startswith s526_0 "sstatus")) then  
  (case ((string_drop s526_0 ((string_length "sstatus")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s520_ : string -> maybe string*)

val _ = Define `
 ((s520_:string ->(string)option) s521_0=
    (let s522_0 = s521_0 in
   if ((string_startswith s522_0 "instreth")) then  
  (case ((string_drop s522_0 ((string_length "instreth")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s516_ : string -> maybe string*)

val _ = Define `
 ((s516_:string ->(string)option) s517_0=
    (let s518_0 = s517_0 in
   if ((string_startswith s518_0 "timeh")) then  
  (case ((string_drop s518_0 ((string_length "timeh")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s512_ : string -> maybe string*)

val _ = Define `
 ((s512_:string ->(string)option) s513_0=
    (let s514_0 = s513_0 in
   if ((string_startswith s514_0 "cycleh")) then  
  (case ((string_drop s514_0 ((string_length "cycleh")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s508_ : string -> maybe string*)

val _ = Define `
 ((s508_:string ->(string)option) s509_0=
    (let s510_0 = s509_0 in
   if ((string_startswith s510_0 "instret")) then  
  (case ((string_drop s510_0 ((string_length "instret")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s504_ : string -> maybe string*)

val _ = Define `
 ((s504_:string ->(string)option) s505_0=
    (let s506_0 = s505_0 in
   if ((string_startswith s506_0 "time")) then  
  (case ((string_drop s506_0 ((string_length "time")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s500_ : string -> maybe string*)

val _ = Define `
 ((s500_:string ->(string)option) s501_0=
    (let s502_0 = s501_0 in
   if ((string_startswith s502_0 "cycle")) then  
  (case ((string_drop s502_0 ((string_length "cycle")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s496_ : string -> maybe string*)

val _ = Define `
 ((s496_:string ->(string)option) s497_0=
    (let s498_0 = s497_0 in
   if ((string_startswith s498_0 "fcsr")) then  
  (case ((string_drop s498_0 ((string_length "fcsr")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s492_ : string -> maybe string*)

val _ = Define `
 ((s492_:string ->(string)option) s493_0=
    (let s494_0 = s493_0 in
   if ((string_startswith s494_0 "frm")) then  
  (case ((string_drop s494_0 ((string_length "frm")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s488_ : string -> maybe string*)

val _ = Define `
 ((s488_:string ->(string)option) s489_0=
    (let s490_0 = s489_0 in
   if ((string_startswith s490_0 "fflags")) then  
  (case ((string_drop s490_0 ((string_length "fflags")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s484_ : string -> maybe string*)

val _ = Define `
 ((s484_:string ->(string)option) s485_0=
    (let s486_0 = s485_0 in
   if ((string_startswith s486_0 "uip")) then  
  (case ((string_drop s486_0 ((string_length "uip")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s480_ : string -> maybe string*)

val _ = Define `
 ((s480_:string ->(string)option) s481_0=
    (let s482_0 = s481_0 in
   if ((string_startswith s482_0 "utval")) then  
  (case ((string_drop s482_0 ((string_length "utval")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s476_ : string -> maybe string*)

val _ = Define `
 ((s476_:string ->(string)option) s477_0=
    (let s478_0 = s477_0 in
   if ((string_startswith s478_0 "ucause")) then  
  (case ((string_drop s478_0 ((string_length "ucause")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s472_ : string -> maybe string*)

val _ = Define `
 ((s472_:string ->(string)option) s473_0=
    (let s474_0 = s473_0 in
   if ((string_startswith s474_0 "uepc")) then  
  (case ((string_drop s474_0 ((string_length "uepc")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s468_ : string -> maybe string*)

val _ = Define `
 ((s468_:string ->(string)option) s469_0=
    (let s470_0 = s469_0 in
   if ((string_startswith s470_0 "uscratch")) then  
  (case ((string_drop s470_0 ((string_length "uscratch")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s464_ : string -> maybe string*)

val _ = Define `
 ((s464_:string ->(string)option) s465_0=
    (let s466_0 = s465_0 in
   if ((string_startswith s466_0 "utvec")) then  
  (case ((string_drop s466_0 ((string_length "utvec")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s460_ : string -> maybe string*)

val _ = Define `
 ((s460_:string ->(string)option) s461_0=
    (let s462_0 = s461_0 in
   if ((string_startswith s462_0 "uie")) then  
  (case ((string_drop s462_0 ((string_length "uie")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s456_ : string -> maybe string*)

val _ = Define `
 ((s456_:string ->(string)option) s457_0=
    (let s458_0 = s457_0 in
   if ((string_startswith s458_0 "ustatus")) then  
  (case ((string_drop s458_0 ((string_length "ustatus")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((csr_name_map_matches_prefix:string ->((12)words$word#int)option) arg_=
    (let s459_0 = arg_ in
   if ((case ((s456_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s456_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x000w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s460_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s460_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x004w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s464_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s464_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x005w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s468_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s468_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x040w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s472_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s472_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x041w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s476_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s476_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x042w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s480_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s480_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x043w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s484_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s484_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x044w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s488_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s488_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x001w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s492_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s492_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x002w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s496_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s496_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x003w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s500_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s500_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xC00w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s504_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s504_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xC01w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s508_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s508_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xC02w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s512_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s512_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xC80w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s516_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s516_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xC81w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s520_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s520_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xC82w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s524_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s524_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x100w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s528_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s528_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x102w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s532_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s532_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x103w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s536_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s536_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x104w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s540_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s540_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x105w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s544_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s544_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x106w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s548_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s548_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x140w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s552_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s552_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x141w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s556_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s556_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x142w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s560_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s560_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x143w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s564_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s564_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x144w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s568_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s568_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x180w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s572_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s572_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xF11w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s576_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s576_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xF12w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s580_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s580_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xF13w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s584_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s584_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xF14w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s588_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s588_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x300w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s592_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s592_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x301w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s596_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s596_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x302w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s600_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s600_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x303w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s604_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s604_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x304w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s608_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s608_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x305w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s612_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s612_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x306w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s616_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s616_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x320w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s620_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s620_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x340w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s624_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s624_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x341w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s628_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s628_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x342w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s632_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s632_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x343w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s636_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s636_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x344w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s640_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s640_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3A0w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s644_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s644_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3A1w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s648_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s648_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3A2w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s652_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s652_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3A3w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s656_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s656_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B0w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s660_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s660_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B1w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s664_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s664_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B2w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s668_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s668_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B3w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s672_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s672_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B4w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s676_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s676_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B5w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s680_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s680_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B6w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s684_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s684_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B7w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s688_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s688_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B8w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s692_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s692_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3B9w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s696_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s696_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3BAw : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s700_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s700_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3BBw : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s704_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s704_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3BCw : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s708_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s708_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3BDw : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s712_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s712_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3BEw : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s716_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s716_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x3BFw : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s720_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s720_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xB00w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s724_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s724_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xB02w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s728_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s728_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xB80w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s732_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s732_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0xB82w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s736_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s736_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x7A0w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s740_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s740_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x7A1w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s744_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s744_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x7A2w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s748_ s459_0)) of   SOME (s_) => T | _ => F )) then  
  (case s748_ s459_0 of
      (SOME (s_)) =>
  SOME
    ((0x7A3w : 12 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s752_ s459_0  :  (( 12 words$word # string))option)) of
       SOME ((reg, s_)) => T
     | _ => F
     )) then  (case (s752_ s459_0 : (( 12 words$word # string)) option) of
     (SOME ((reg, s_))) =>
 SOME (reg, ((string_length arg_)) - ((string_length s_)))
 )
   else NONE))`;


val _ = Define `
 ((csr_name:(12)words$word -> string) csr=  (csr_name_map_forwards csr))`;


val _ = Define `
 ((ext_is_CSR_defined:(12)words$word -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) b__0 g__326=
    (if (((b__0 = (0x000w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x004w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x005w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x040w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x041w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x042w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x043w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x044w :  12 words$word)))) then sail2_state$and_boolS ((haveUsrMode () )) ((haveNExt () ))
   else if (((b__0 = (0x001w :  12 words$word)))) then sail2_state$or_boolS ((haveFExt () )) ((haveDExt () ))
   else if (((b__0 = (0x002w :  12 words$word)))) then sail2_state$or_boolS ((haveFExt () )) ((haveDExt () ))
   else if (((b__0 = (0x003w :  12 words$word)))) then sail2_state$or_boolS ((haveFExt () )) ((haveDExt () ))
   else sail2_state_monad$returnS F))`;


val _ = Define `
 ((ext_read_CSR:(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((((32)words$word)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) b__0=
    (if (((b__0 = (0x000w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) . 
     sail2_state_monad$returnS (SOME ((get_Ustatus_bits ((lower_sstatus ((lower_mstatus w__0))))  :  32 words$word))))
   else if (((b__0 = (0x004w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mie_ref) (\ (w__1 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__2 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS sideleg_ref) (\ (w__3 : Sinterrupts) . 
     sail2_state_monad$returnS (SOME ((get_Uinterrupts_bits ((lower_sie ((lower_mie w__1 w__2)) w__3))  :  32 words$word))))))
   else if (((b__0 = (0x005w :  12 words$word)))) then sail2_state_monad$bindS
     (get_utvec ()   : ( 32 words$word) M) (\ (w__4 :  32 words$word) .  sail2_state_monad$returnS (SOME w__4))
   else if (((b__0 = (0x040w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS uscratch_ref  : ( 32 words$word) M) (\ (w__5 :  32 words$word) .  sail2_state_monad$returnS (SOME w__5))
   else if (((b__0 = (0x041w :  12 words$word)))) then sail2_state_monad$bindS
     (get_xret_target User  : ( 32 words$word) M) (\ (w__6 :  32 words$word) .  sail2_state_monad$bindS
     (pc_alignment_mask ()   : ( 32 words$word) M) (\ (w__7 :  32 words$word) . 
     sail2_state_monad$returnS (SOME ((and_vec w__6 w__7  :  32 words$word)))))
   else if (((b__0 = (0x042w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS ucause_ref) (\ (w__8 : Mcause) . 
     sail2_state_monad$returnS (SOME ((get_Mcause_bits w__8  :  32 words$word))))
   else if (((b__0 = (0x043w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS utval_ref  : ( 32 words$word) M) (\ (w__9 :  32 words$word) .  sail2_state_monad$returnS (SOME w__9))
   else if (((b__0 = (0x044w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mip_ref) (\ (w__10 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__11 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS sideleg_ref) (\ (w__12 : Sinterrupts) . 
     sail2_state_monad$returnS (SOME ((get_Uinterrupts_bits ((lower_sip ((lower_mip w__10 w__11)) w__12))
                     :  32 words$word))))))
   else if (((b__0 = (0x001w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS fcsr_ref) (\ (w__13 : Fcsr) . 
     sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Fcsr_FFLAGS w__13  :  5 words$word))  :  32 words$word))))
   else if (((b__0 = (0x002w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS fcsr_ref) (\ (w__14 : Fcsr) . 
     sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Fcsr_FRM w__14  :  3 words$word))  :  32 words$word))))
   else if (((b__0 = (0x003w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS fcsr_ref) (\ (w__15 : Fcsr) . 
     sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Fcsr_bits w__15  :  32 words$word))  :  32 words$word))))
   else sail2_state_monad$returnS NONE))`;


val _ = Define `
 ((ext_write_CSR:(12)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((((32)words$word)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) b__0 value=
    (if (((b__0 = (0x000w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
     (legalize_ustatus w__0 value) (\ (w__1 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS mstatus_ref w__1)
     (sail2_state_monad$read_regS mstatus_ref)) (\ (w__2 : Mstatus) . 
     sail2_state_monad$returnS (SOME ((get_Mstatus_bits w__2  :  32 words$word))))))
   else if (((b__0 = (0x004w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mie_ref) (\ (w__3 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__4 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS sideleg_ref) (\ (w__5 : Sinterrupts) . 
     let sie = (legalize_uie ((lower_mie w__3 w__4)) w__5 value) in sail2_state_monad$bindS
     (sail2_state_monad$read_regS mie_ref) (\ (w__6 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__7 : Minterrupts) .  sail2_state_monad$bindS
     (lift_sie w__6 w__7 sie) (\ (w__8 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS mie_ref w__8)
     (sail2_state_monad$read_regS mie_ref)) (\ (w__9 : Minterrupts) . 
     sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__9  :  32 words$word))))))))))
   else if (((b__0 = (0x005w :  12 words$word)))) then sail2_state_monad$bindS
     (set_utvec value  : ( 32 words$word) M) (\ (w__10 :  32 words$word) .  sail2_state_monad$returnS (SOME w__10))
   else if (((b__0 = (0x040w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS uscratch_ref value)
     (sail2_state_monad$read_regS uscratch_ref  : ( 32 words$word) M)) (\ (w__11 :  32 words$word) .  sail2_state_monad$returnS (SOME w__11))
   else if (((b__0 = (0x041w :  12 words$word)))) then sail2_state_monad$bindS
     (set_xret_target User value  : ( 32 words$word) M) (\ (w__12 :  32 words$word) . 
     sail2_state_monad$returnS (SOME w__12))
   else if (((b__0 = (0x042w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (set_Mcause_bits ucause_ref value)
     (sail2_state_monad$read_regS ucause_ref)) (\ (w__13 : Mcause) . 
     sail2_state_monad$returnS (SOME ((get_Mcause_bits w__13  :  32 words$word))))
   else if (((b__0 = (0x043w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS utval_ref value)
     (sail2_state_monad$read_regS utval_ref  : ( 32 words$word) M)) (\ (w__14 :  32 words$word) .  sail2_state_monad$returnS (SOME w__14))
   else if (((b__0 = (0x044w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mip_ref) (\ (w__15 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__16 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS sideleg_ref) (\ (w__17 : Sinterrupts) . 
     let sip = (legalize_uip ((lower_mip w__15 w__16)) w__17 value) in sail2_state_monad$bindS
     (sail2_state_monad$read_regS mip_ref) (\ (w__18 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__19 : Minterrupts) .  sail2_state_monad$bindS
     (lift_sip w__18 w__19 sip) (\ (w__20 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS mip_ref w__20)
     (sail2_state_monad$read_regS mip_ref)) (\ (w__21 : Minterrupts) . 
     sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__21  :  32 words$word))))))))))
   else if (((b__0 = (0x001w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS fcsr_ref) (\ (w__22 : Fcsr) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (ext_write_fcsr ((get_Fcsr_FRM w__22  :  3 words$word))
       ((subrange_vec_dec value (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)))
     (sail2_state_monad$read_regS fcsr_ref)) (\ (w__23 : Fcsr) . 
     sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Fcsr_FFLAGS w__23  :  5 words$word))  :  32 words$word)))))
   else if (((b__0 = (0x002w :  12 words$word)))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS fcsr_ref) (\ (w__24 : Fcsr) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (ext_write_fcsr ((subrange_vec_dec value (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word))
       ((get_Fcsr_FFLAGS w__24  :  5 words$word)))
     (sail2_state_monad$read_regS fcsr_ref)) (\ (w__25 : Fcsr) . 
     sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Fcsr_FRM w__25  :  3 words$word))  :  32 words$word)))))
   else if (((b__0 = (0x003w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (ext_write_fcsr ((subrange_vec_dec value (( 7 : int):ii) (( 5 : int):ii)  :  3 words$word))
       ((subrange_vec_dec value (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)))
     (sail2_state_monad$read_regS fcsr_ref)) (\ (w__26 : Fcsr) . 
     sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Fcsr_bits w__26  :  32 words$word))  :  32 words$word))))
   else sail2_state_monad$returnS NONE))`;


(*val csrAccess : mword ty12 -> mword ty2*)

val _ = Define `
 ((csrAccess:(12)words$word ->(2)words$word) csr=  ((subrange_vec_dec csr (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)))`;


(*val csrPriv : mword ty12 -> mword ty2*)

val _ = Define `
 ((csrPriv:(12)words$word ->(2)words$word) csr=  ((subrange_vec_dec csr (( 9 : int):ii) (( 8 : int):ii)  :  2 words$word)))`;


(*val is_CSR_defined : mword ty12 -> Privilege -> M bool*)

val _ = Define `
 ((is_CSR_defined:(12)words$word -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (csr : csreg) (p : Privilege)=
    (let b__0 = csr in
   if (((b__0 = (0xF11w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0xF12w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0xF13w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0xF14w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x300w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x301w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x302w :  12 words$word)))) then
     sail2_state$and_boolS (sail2_state_monad$returnS (((p = Machine)))) (sail2_state$or_boolS ((haveSupMode () )) ((haveNExt () )))
   else if (((b__0 = (0x303w :  12 words$word)))) then
     sail2_state$and_boolS (sail2_state_monad$returnS (((p = Machine)))) (sail2_state$or_boolS ((haveSupMode () )) ((haveNExt () )))
   else if (((b__0 = (0x304w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x305w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x306w :  12 words$word)))) then
     sail2_state$and_boolS (sail2_state_monad$returnS (((p = Machine)))) ((haveUsrMode () ))
   else if (((b__0 = (0x310w :  12 words$word)))) then
     sail2_state_monad$returnS ((((((p = Machine))) /\ ((((( 32 : int):ii) = (( 32 : int):ii)))))))
   else if (((b__0 = (0x320w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x340w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x341w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x342w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x343w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x344w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3A0w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3A1w :  12 words$word)))) then
     sail2_state_monad$returnS ((((((p = Machine))) /\ ((((( 32 : int):ii) = (( 32 : int):ii)))))))
   else if (((b__0 = (0x3A2w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3A3w :  12 words$word)))) then
     sail2_state_monad$returnS ((((((p = Machine))) /\ ((((( 32 : int):ii) = (( 32 : int):ii)))))))
   else if (((b__0 = (0x3B0w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B1w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B2w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B3w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B4w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B5w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B6w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B7w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B8w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3B9w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3BAw :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3BBw :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3BCw :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3BDw :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3BEw :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x3BFw :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0xB00w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0xB02w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0xB80w :  12 words$word)))) then
     sail2_state_monad$returnS ((((((p = Machine))) /\ ((((( 32 : int):ii) = (( 32 : int):ii)))))))
   else if (((b__0 = (0xB82w :  12 words$word)))) then
     sail2_state_monad$returnS ((((((p = Machine))) /\ ((((( 32 : int):ii) = (( 32 : int):ii)))))))
   else if (((b__0 = (0x7A0w :  12 words$word)))) then sail2_state_monad$returnS (((p = Machine)))
   else if (((b__0 = (0x100w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x102w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () ))
       (sail2_state$and_boolS ((haveNExt () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor))))))))
   else if (((b__0 = (0x103w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () ))
       (sail2_state$and_boolS ((haveNExt () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor))))))))
   else if (((b__0 = (0x104w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x105w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x106w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x140w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x141w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x142w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x143w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x144w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0x180w :  12 words$word)))) then
     sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS ((((((p = Machine))) \/ (((p = Supervisor)))))))
   else if (((b__0 = (0xC00w :  12 words$word)))) then haveUsrMode () 
   else if (((b__0 = (0xC01w :  12 words$word)))) then haveUsrMode () 
   else if (((b__0 = (0xC02w :  12 words$word)))) then haveUsrMode () 
   else if (((b__0 = (0xC80w :  12 words$word)))) then
     sail2_state$and_boolS ((haveUsrMode () )) (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii)))))
   else if (((b__0 = (0xC81w :  12 words$word)))) then
     sail2_state$and_boolS ((haveUsrMode () )) (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii)))))
   else if (((b__0 = (0xC82w :  12 words$word)))) then
     sail2_state$and_boolS ((haveUsrMode () )) (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii)))))
   else ext_is_CSR_defined csr p))`;


(*val check_CSR_access : mword ty2 -> mword ty2 -> Privilege -> bool -> bool*)

val _ = Define `
 ((check_CSR_access:(2)words$word ->(2)words$word -> Privilege -> bool -> bool) csrrw csrpr p isWrite=
    (((~ ((((((isWrite = T))) /\ (((csrrw = (0b11w :  2 words$word))))))))) /\ ((zopz0zKzJ_u ((privLevel_to_bits p  :  2 words$word)) csrpr))))`;


(*val check_TVM_SATP : mword ty12 -> Privilege -> M bool*)

val _ = Define `
 ((check_TVM_SATP:(12)words$word -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (csr : csreg) (p : Privilege)=  (sail2_state_monad$bindS
   (sail2_state$and_boolS (sail2_state_monad$returnS (((csr = (0x180w :  12 words$word)))))
     (sail2_state$and_boolS (sail2_state_monad$returnS (((p = Supervisor))))
        ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) . 
         sail2_state_monad$returnS (((((get_Mstatus_TVM w__0  :  1 words$word)) = (0b1w :  1 words$word)))))))) (\ (w__2 :
     bool) . 
   sail2_state_monad$returnS ((~ w__2)))))`;


(*val check_Counteren : mword ty12 -> Privilege -> M bool*)

val _ = Define `
 ((check_Counteren:(12)words$word -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (csr : csreg) (p : Privilege)=
    ((case (csr, p) of
     (b__0, Supervisor) =>
      if (((b__0 = (0xC00w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcounteren_ref) (\ (w__0 : Counteren) . 
        sail2_state_monad$returnS (((((get_Counteren_CY w__0  :  1 words$word)) = (0b1w :  1 words$word)))))
      else if (((b__0 = (0xC01w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcounteren_ref) (\ (w__1 : Counteren) . 
        sail2_state_monad$returnS (((((get_Counteren_TM w__1  :  1 words$word)) = (0b1w :  1 words$word)))))
      else if (((b__0 = (0xC02w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcounteren_ref) (\ (w__2 : Counteren) . 
        sail2_state_monad$returnS (((((get_Counteren_IR w__2  :  1 words$word)) = (0b1w :  1 words$word)))))
      else
        sail2_state_monad$returnS ((case (b__0, Supervisor) of
          (_, _) =>
           if (((((zopz0zIzJ_u (0xC03w :  12 words$word) csr)) /\ ((zopz0zIzJ_u csr (0xC1Fw :  12 words$word)))))) then
             F
           else T
        ))
   | (b__3, User) =>
      if (((b__3 = (0xC00w :  12 words$word)))) then
        sail2_state$and_boolS
          ( sail2_state_monad$bindS(sail2_state_monad$read_regS mcounteren_ref) (\ (w__6 : Counteren) . 
           sail2_state_monad$returnS (((((get_Counteren_CY w__6  :  1 words$word)) = (0b1w :  1 words$word))))))
          (sail2_state$or_boolS ( sail2_state_monad$bindS(haveSupMode () ) (\ (w__7 : bool) .  sail2_state_monad$returnS ((~ w__7))))
             ( sail2_state_monad$bindS(sail2_state_monad$read_regS scounteren_ref) (\ (w__8 : Counteren) . 
              sail2_state_monad$returnS (((((get_Counteren_CY w__8  :  1 words$word)) = (0b1w :  1 words$word)))))))
      else if (((b__3 = (0xC01w :  12 words$word)))) then
        sail2_state$and_boolS
          ( sail2_state_monad$bindS(sail2_state_monad$read_regS mcounteren_ref) (\ (w__11 : Counteren) . 
           sail2_state_monad$returnS (((((get_Counteren_TM w__11  :  1 words$word)) = (0b1w :  1 words$word))))))
          (sail2_state$or_boolS ( sail2_state_monad$bindS(haveSupMode () ) (\ (w__12 : bool) .  sail2_state_monad$returnS ((~ w__12))))
             ( sail2_state_monad$bindS(sail2_state_monad$read_regS scounteren_ref) (\ (w__13 : Counteren) . 
              sail2_state_monad$returnS (((((get_Counteren_TM w__13  :  1 words$word)) = (0b1w :  1 words$word)))))))
      else if (((b__3 = (0xC02w :  12 words$word)))) then
        sail2_state$and_boolS
          ( sail2_state_monad$bindS(sail2_state_monad$read_regS mcounteren_ref) (\ (w__16 : Counteren) . 
           sail2_state_monad$returnS (((((get_Counteren_IR w__16  :  1 words$word)) = (0b1w :  1 words$word))))))
          (sail2_state$or_boolS ( sail2_state_monad$bindS(haveSupMode () ) (\ (w__17 : bool) .  sail2_state_monad$returnS ((~ w__17))))
             ( sail2_state_monad$bindS(sail2_state_monad$read_regS scounteren_ref) (\ (w__18 : Counteren) . 
              sail2_state_monad$returnS (((((get_Counteren_IR w__18  :  1 words$word)) = (0b1w :  1 words$word)))))))
      else
        sail2_state_monad$returnS ((case (b__3, User) of
          (_, _) =>
           if (((((zopz0zIzJ_u (0xC03w :  12 words$word) csr)) /\ ((zopz0zIzJ_u csr (0xC1Fw :  12 words$word)))))) then
             F
           else T
        ))
   | (_, _) =>
      sail2_state_monad$returnS (if (((((zopz0zIzJ_u (0xC03w :  12 words$word) csr)) /\ ((zopz0zIzJ_u csr (0xC1Fw :  12 words$word)))))) then
                F
              else T)
   )))`;


(*val check_CSR : mword ty12 -> Privilege -> bool -> M bool*)

val _ = Define `
 ((check_CSR:(12)words$word -> Privilege -> bool ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (csr : csreg) (p : Privilege) (isWrite : bool)=
    (sail2_state$and_boolS ((is_CSR_defined csr p))
     (sail2_state$and_boolS
        (sail2_state_monad$returnS ((check_CSR_access ((csrAccess csr  :  2 words$word)) ((csrPriv csr  :  2 words$word)) p
                    isWrite))) (sail2_state$and_boolS ((check_TVM_SATP csr p)) ((check_Counteren csr p))))))`;


(*val exception_delegatee : ExceptionType -> Privilege -> M Privilege*)

val _ = Define `
 ((exception_delegatee:ExceptionType -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((Privilege),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (e : ExceptionType) (p : Privilege)=
    (let idx = (num_of_ExceptionType e) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS medeleg_ref) (\ (w__0 : Medeleg) . 
   let super = (bit_to_bool ((access_vec_dec ((get_Medeleg_bits w__0  :  32 words$word)) idx))) in sail2_state_monad$bindS
   (haveSupMode () ) (\ (w__1 : bool) .  sail2_state_monad$bindS
   (if w__1 then
      sail2_state$and_boolS (sail2_state_monad$returnS super)
        (sail2_state$and_boolS ((haveNExt () ))
           ( sail2_state_monad$bindS(sail2_state_monad$read_regS sedeleg_ref) (\ (w__3 : Sedeleg) . 
            sail2_state_monad$returnS ((bit_to_bool ((access_vec_dec ((get_Sedeleg_bits w__3  :  32 words$word)) idx)))))))
    else sail2_state$and_boolS (sail2_state_monad$returnS super) ((haveNExt () ))) (\ user .  sail2_state_monad$bindS
   (sail2_state$and_boolS ((haveUsrMode () )) (sail2_state_monad$returnS user)) (\ w__9 .  sail2_state_monad$bindS
   (if w__9 then sail2_state_monad$returnS User
    else sail2_state_monad$bindS
      (sail2_state$and_boolS ((haveSupMode () )) (sail2_state_monad$returnS super)) (\ w__11 . 
      sail2_state_monad$returnS (if w__11 then Supervisor
              else Machine))) (\ deleg . 
   sail2_state_monad$returnS (if ((zopz0zI_u ((privLevel_to_bits deleg  :  2 words$word))
                  ((privLevel_to_bits p  :  2 words$word)))) then
             p
           else deleg))))))))`;


(*val findPendingInterrupt : mword ty32 -> maybe InterruptType*)

val _ = Define `
 ((findPendingInterrupt:(32)words$word ->(InterruptType)option) ip=
    (let ip = (Mk_Minterrupts ip) in
   if (((((get_Minterrupts_MEI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then SOME I_M_External
   else if (((((get_Minterrupts_MSI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then
     SOME I_M_Software
   else if (((((get_Minterrupts_MTI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then SOME I_M_Timer
   else if (((((get_Minterrupts_SEI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then
     SOME I_S_External
   else if (((((get_Minterrupts_SSI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then
     SOME I_S_Software
   else if (((((get_Minterrupts_STI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then SOME I_S_Timer
   else if (((((get_Minterrupts_UEI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then
     SOME I_U_External
   else if (((((get_Minterrupts_USI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then
     SOME I_U_Software
   else if (((((get_Minterrupts_UTI ip  :  1 words$word)) = (0b1w :  1 words$word)))) then SOME I_U_Timer
   else NONE))`;


(*val processPending : Minterrupts -> Minterrupts -> mword ty32 -> bool -> interrupt_set*)

val _ = Define `
 ((processPending:Minterrupts -> Minterrupts ->(32)words$word -> bool -> interrupt_set) (xip : Minterrupts) (xie : Minterrupts) (xideleg : xlenbits) (priv_enabled : bool)=
    (let effective_pend =
     ((and_vec ((get_Minterrupts_bits xip  :  32 words$word))
        ((and_vec ((get_Minterrupts_bits xie  :  32 words$word)) ((not_vec xideleg  :  32 words$word))
           :  32 words$word))
       :  32 words$word)) in
   let effective_delg = ((and_vec ((get_Minterrupts_bits xip  :  32 words$word)) xideleg  :  32 words$word)) in
   if (((priv_enabled /\ (((effective_pend <> ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word)))))))) then
     Ints_Pending effective_pend
   else if (((effective_delg <> ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))) then
     Ints_Delegated effective_delg
   else Ints_Empty () ))`;


(*val getPendingSet : Privilege -> M (maybe ((mword ty32 * Privilege)))*)

val _ = Define `
 ((getPendingSet:Privilege ->(regstate)sail2_state_monad$sequential_state ->(((((32)words$word#Privilege)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) priv=  (sail2_state_monad$bindS
   (haveUsrMode () ) (\ (w__0 : bool) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$assert_expS w__0 "no user mode: M/U or M/S/U system required")
   (sail2_state_monad$read_regS mip_ref)) (\ (w__1 : Minterrupts) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS mie_ref) (\ (w__2 : Minterrupts) . 
   let effective_pending =
     ((and_vec ((get_Minterrupts_bits w__1  :  32 words$word))
        ((get_Minterrupts_bits w__2  :  32 words$word))
       :  32 words$word)) in
   if (((effective_pending = ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))) then
     sail2_state_monad$returnS NONE
   else sail2_state_monad$bindS
     (sail2_state$or_boolS (sail2_state_monad$returnS (((priv <> Machine))))
       (sail2_state$and_boolS (sail2_state_monad$returnS (((priv = Machine))))
          ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__3 : Mstatus) . 
           sail2_state_monad$returnS (((((get_Mstatus_MIE w__3  :  1 words$word)) = (0b1w :  1 words$word)))))))) (\ mIE .  sail2_state_monad$bindS
     (sail2_state$and_boolS ((haveSupMode () ))
       (sail2_state$or_boolS (sail2_state_monad$returnS (((priv = User))))
          (sail2_state$and_boolS (sail2_state_monad$returnS (((priv = Supervisor))))
             ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__6 : Mstatus) . 
              sail2_state_monad$returnS (((((get_Mstatus_SIE w__6  :  1 words$word)) = (0b1w :  1 words$word))))))))) (\ sIE .  sail2_state_monad$bindS
     (sail2_state$and_boolS ((haveNExt () ))
       (sail2_state$and_boolS (sail2_state_monad$returnS (((priv = User))))
          ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__10 : Mstatus) . 
           sail2_state_monad$returnS (((((get_Mstatus_UIE w__10  :  1 words$word)) = (0b1w :  1 words$word)))))))) (\ uIE .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mip_ref) (\ (w__12 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mie_ref) (\ (w__13 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mideleg_ref) (\ (w__14 : Minterrupts) . 
     (case ((processPending w__12 w__13 ((get_Minterrupts_bits w__14  :  32 words$word)) mIE)) of
       Ints_Empty (() ) => sail2_state_monad$returnS NONE
     | Ints_Pending (p) =>
        let r = (p, Machine) in
        sail2_state_monad$returnS (SOME r)
     | Ints_Delegated (d) => sail2_state_monad$bindS
        (haveSupMode () ) (\ (w__15 : bool) . 
        if ((~ w__15)) then
          sail2_state_monad$returnS (if uIE then
                    let r = (d, User) in
                    SOME r
                  else NONE)
        else sail2_state_monad$bindS
          (sail2_state_monad$read_regS mie_ref) (\ (w__16 : Minterrupts) .  sail2_state_monad$bindS
          (sail2_state_monad$read_regS sideleg_ref) (\ (w__17 : Sinterrupts) . 
          sail2_state_monad$returnS ((case ((processPending ((Mk_Minterrupts d)) w__16
                            ((get_Sinterrupts_bits w__17  :  32 words$word)) sIE)) of
            Ints_Empty (() ) => NONE
          | Ints_Pending (p) =>
             let r = (p, Supervisor) in
             SOME r
          | Ints_Delegated (d) =>
             if uIE then
               let r = (d, User) in
               SOME r
             else NONE
          )))))
     ))))))))))))`;


(*val dispatchInterrupt : Privilege -> M (maybe ((InterruptType * Privilege)))*)

val _ = Define `
 ((dispatchInterrupt:Privilege ->(regstate)sail2_state_monad$sequential_state ->((((InterruptType#Privilege)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) priv=  (sail2_state_monad$bindS
   (sail2_state$or_boolS ( sail2_state_monad$bindS(haveUsrMode () ) (\ (w__0 : bool) .  sail2_state_monad$returnS ((~ w__0))))
     (sail2_state$and_boolS ( sail2_state_monad$bindS(haveSupMode () ) (\ (w__1 : bool) .  sail2_state_monad$returnS ((~ w__1))))
        ( sail2_state_monad$bindS(haveNExt () ) (\ (w__2 : bool) .  sail2_state_monad$returnS ((~ w__2)))))) (\ (w__4 : bool) . 
   if w__4 then sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$assert_expS (((priv = Machine))) "invalid current privilege")
     (sail2_state_monad$read_regS mip_ref)) (\ (w__5 : Minterrupts) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS mie_ref) (\ (w__6 : Minterrupts) . 
     let enabled_pending =
       ((and_vec ((get_Minterrupts_bits w__5  :  32 words$word))
          ((get_Minterrupts_bits w__6  :  32 words$word))
         :  32 words$word)) in
     sail2_state_monad$returnS ((case ((findPendingInterrupt enabled_pending)) of
       SOME (i) =>
        let r = (i, Machine) in
        SOME r
     | NONE => NONE
     ))))
   else sail2_state_monad$bindS
     (getPendingSet priv  : ( (( 32 words$word # Privilege))option) M) (\ (w__7 :
        (( 32 words$word # Privilege))option) . 
     sail2_state_monad$returnS ((case w__7 of
       NONE => NONE
     | SOME ((ip, p)) =>
        (case ((findPendingInterrupt ip)) of
          NONE => NONE
        | SOME (i) =>
           let r = (i, p) in
           SOME r
        )
     ))))))`;


(*val tval : maybe (mword ty32) -> mword ty32*)

val _ = Define `
 ((tval:((32)words$word)option ->(32)words$word) excinfo=
    ((case excinfo of
     SOME (e) => e
   | NONE => (EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word)
   )))`;


(*val rvfi_trap : unit -> unit*)

val _ = Define `
 ((rvfi_trap:unit -> unit) () =  () )`;


(*val trap_handler : Privilege -> bool -> mword ty8 -> mword ty32 -> maybe (mword ty32) -> maybe unit -> M (mword ty32)*)

val _ = Define `
 ((trap_handler:Privilege -> bool ->(8)words$word ->(32)words$word ->(xlenbits)option ->(ext_exception)option ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (del_priv : Privilege) (intr : bool) (c : exc_code) (pc : xlenbits) (info :
   xlenbits option) (ext :  ext_exception option)=
    (let (_ : unit) = (rvfi_trap () ) in
   let (_ : unit) =
     (if ((get_config_print_platform () )) then
       print_dbg
         ((STRCAT "handling "
             ((STRCAT (if intr then "int#" else "exc#")
                 ((STRCAT ((string_of_bits c))
                     ((STRCAT " at priv "
                         ((STRCAT ((privLevel_to_str del_priv))
                             ((STRCAT " with tval "
                                 ((string_of_bits ((tval info  :  32 words$word))))))))))))))))
     else () ) in
   let (_ : unit) = (cancel_reservation () ) in
   (case del_priv of
     Machine => sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mcause_IsInterrupt mcause_ref ((bool_to_bits intr  :  1 words$word)))
      (set_Mcause_Cause mcause_ref ((EXTZ (( 31 : int):ii) c  :  31 words$word))))
      (sail2_state_monad$read_regS mstatus_ref)) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_MPIE mstatus_ref ((get_Mstatus_MIE w__0  :  1 words$word)))
      (set_Mstatus_MIE mstatus_ref (0b0w :  1 words$word)))
      (sail2_state_monad$read_regS cur_privilege_ref)) (\ (w__1 : Privilege) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_MPP mstatus_ref ((privLevel_to_bits w__1  :  2 words$word)))
      (sail2_state_monad$write_regS mtval_ref ((tval info  :  32 words$word))))
      (sail2_state_monad$write_regS mepc_ref pc))
      (sail2_state_monad$write_regS cur_privilege_ref del_priv))
      (let (_ : unit) = (handle_trap_extension del_priv pc ext) in sail2_state_monad$bindS (sail2_state_monad$seqS
      (if ((get_config_print_reg () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS mstatus_ref) (\ (w__2 : Mstatus) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "CSR mstatus <- "
                        ((string_of_bits ((get_Mstatus_bits w__2  :  32 words$word)))))))))
       else sail2_state_monad$returnS () )
      (sail2_state_monad$read_regS mcause_ref)) (\ (w__3 : Mcause) . 
      (prepare_trap_vector del_priv w__3  : ( 32 words$word) M)))))
   | Supervisor => sail2_state_monad$bindS
      (haveSupMode () ) (\ (w__5 : bool) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (sail2_state_monad$assert_expS w__5 "no supervisor mode present for delegation")
      (set_Mcause_IsInterrupt scause_ref ((bool_to_bits intr  :  1 words$word))))
      (set_Mcause_Cause scause_ref ((EXTZ (( 31 : int):ii) c  :  31 words$word))))
      (sail2_state_monad$read_regS mstatus_ref)) (\ (w__6 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_SPIE mstatus_ref ((get_Mstatus_SIE w__6  :  1 words$word)))
      (set_Mstatus_SIE mstatus_ref (0b0w :  1 words$word)))
      (sail2_state_monad$read_regS cur_privilege_ref)) (\ (w__7 : Privilege) .  sail2_state_monad$bindS
      (case w__7 of
        User => sail2_state_monad$returnS (0b0w :  1 words$word)
      | Supervisor => sail2_state_monad$returnS (0b1w :  1 words$word)
      | Machine => (internal_error "invalid privilege for s-mode trap"  : ( 1 words$word) M)
      ) (\ (w__9 :  1 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_SPP mstatus_ref w__9)
      (sail2_state_monad$write_regS stval_ref ((tval info  :  32 words$word))))
      (sail2_state_monad$write_regS sepc_ref pc))
      (sail2_state_monad$write_regS cur_privilege_ref del_priv))
      (let (_ : unit) = (handle_trap_extension del_priv pc ext) in sail2_state_monad$bindS (sail2_state_monad$seqS
      (if ((get_config_print_reg () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS mstatus_ref) (\ (w__10 : Mstatus) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "CSR mstatus <- "
                        ((string_of_bits ((get_Mstatus_bits w__10  :  32 words$word)))))))))
       else sail2_state_monad$returnS () )
      (sail2_state_monad$read_regS scause_ref)) (\ (w__11 : Mcause) . 
      (prepare_trap_vector del_priv w__11  : ( 32 words$word) M)))))))
   | User => sail2_state_monad$bindS
      (haveUsrMode () ) (\ (w__13 : bool) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (sail2_state_monad$assert_expS w__13 "no user mode present for delegation")
      (set_Mcause_IsInterrupt ucause_ref ((bool_to_bits intr  :  1 words$word))))
      (set_Mcause_Cause ucause_ref ((EXTZ (( 31 : int):ii) c  :  31 words$word))))
      (sail2_state_monad$read_regS mstatus_ref)) (\ (w__14 : Mstatus) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_UPIE mstatus_ref ((get_Mstatus_UIE w__14  :  1 words$word)))
      (set_Mstatus_UIE mstatus_ref (0b0w :  1 words$word)))
      (sail2_state_monad$write_regS utval_ref ((tval info  :  32 words$word))))
      (sail2_state_monad$write_regS uepc_ref pc))
      (sail2_state_monad$write_regS cur_privilege_ref del_priv))
      (let (_ : unit) = (handle_trap_extension del_priv pc ext) in sail2_state_monad$bindS (sail2_state_monad$seqS
      (if ((get_config_print_reg () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS mstatus_ref) (\ (w__15 : Mstatus) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "CSR mstatus <- "
                        ((string_of_bits ((get_Mstatus_bits w__15  :  32 words$word)))))))))
       else sail2_state_monad$returnS () )
      (sail2_state_monad$read_regS ucause_ref)) (\ (w__16 : Mcause) . 
      (prepare_trap_vector del_priv w__16  : ( 32 words$word) M)))))
   )))`;


(*val exception_handler : Privilege -> ctl_result -> mword ty32 -> M (mword ty32)*)

val _ = Define `
 ((exception_handler:Privilege -> ctl_result ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (cur_priv : Privilege) (ctl : ctl_result) (pc : xlenbits)=
    ((case (cur_priv, ctl) of
     (_, CTL_TRAP (e)) => sail2_state_monad$bindS
      (exception_delegatee e.sync_exception_trap cur_priv) (\ del_priv . 
      let (_ : unit) =
        (if ((get_config_print_platform () )) then
          print_dbg
            ((STRCAT "trapping from "
                ((STRCAT ((privLevel_to_str cur_priv))
                    ((STRCAT " to "
                        ((STRCAT ((privLevel_to_str del_priv))
                            ((STRCAT " to handle "
                                ((exceptionType_to_str e.sync_exception_trap))))))))))))
        else () ) in
      (trap_handler del_priv F ((exceptionType_to_bits e.sync_exception_trap  :  8 words$word)) pc
         e.sync_exception_excinfo e.sync_exception_ext
        : ( 32 words$word) M))
   | (_, CTL_MRET (() )) => sail2_state_monad$bindS
      (sail2_state_monad$read_regS cur_privilege_ref) (\ prev_priv .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__1 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_MIE mstatus_ref ((get_Mstatus_MPIE w__1  :  1 words$word)))
      (set_Mstatus_MPIE mstatus_ref (0b1w :  1 words$word)))
      (sail2_state_monad$read_regS mstatus_ref)) (\ (w__2 : Mstatus) .  sail2_state_monad$bindS
      (privLevel_of_bits ((get_Mstatus_MPP w__2  :  2 words$word))) (\ (w__3 : Privilege) .  sail2_state_monad$bindS (sail2_state_monad$seqS
      (sail2_state_monad$write_regS cur_privilege_ref w__3)
      (haveUsrMode () )) (\ (w__4 : bool) .  sail2_state_monad$bindS (sail2_state_monad$seqS
      (set_Mstatus_MPP mstatus_ref
        ((privLevel_to_bits (if w__4 then User else Machine)  :  2 words$word)))
      (sail2_state_monad$read_regS cur_privilege_ref)) (\ (w__5 : Privilege) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (if (((w__5 <> Machine))) then set_Mstatus_MPRV mstatus_ref (0b0w :  1 words$word)
       else sail2_state_monad$returnS () )
      (if ((get_config_print_reg () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS mstatus_ref) (\ (w__6 : Mstatus) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "CSR mstatus <- "
                        ((string_of_bits ((get_Mstatus_bits w__6  :  32 words$word)))))))))
       else sail2_state_monad$returnS () ))
      (if ((get_config_print_platform () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__7 : Privilege) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "ret-ing from "
                        ((STRCAT ((privLevel_to_str prev_priv))
                            ((STRCAT " to " ((privLevel_to_str w__7)))))))))))
       else sail2_state_monad$returnS () ))
      (let (_ : unit) = (cancel_reservation () ) in sail2_state_monad$bindS
      (prepare_xret_target Machine  : ( 32 words$word) M) (\ (w__8 :  32 words$word) .  sail2_state_monad$bindS
      (pc_alignment_mask ()   : ( 32 words$word) M) (\ (w__9 :  32 words$word) . 
      sail2_state_monad$returnS ((and_vec w__8 w__9  :  32 words$word)))))))))))
   | (_, CTL_SRET (() )) => sail2_state_monad$bindS
      (sail2_state_monad$read_regS cur_privilege_ref) (\ prev_priv .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__10 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_SIE mstatus_ref ((get_Mstatus_SPIE w__10  :  1 words$word)))
      (set_Mstatus_SPIE mstatus_ref (0b1w :  1 words$word)))
      (sail2_state_monad$read_regS mstatus_ref)) (\ (w__11 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (sail2_state_monad$write_regS
        cur_privilege_ref
        (if (((((get_Mstatus_SPP w__11  :  1 words$word)) = (0b1w :  1 words$word)))) then Supervisor
         else User))
      (set_Mstatus_SPP mstatus_ref (0b0w :  1 words$word)))
      (sail2_state_monad$read_regS cur_privilege_ref)) (\ (w__12 : Privilege) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (if (((w__12 <> Machine))) then set_Mstatus_MPRV mstatus_ref (0b0w :  1 words$word)
       else sail2_state_monad$returnS () )
      (if ((get_config_print_reg () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS mstatus_ref) (\ (w__13 : Mstatus) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "CSR mstatus <- "
                        ((string_of_bits ((get_Mstatus_bits w__13  :  32 words$word)))))))))
       else sail2_state_monad$returnS () ))
      (if ((get_config_print_platform () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__14 : Privilege) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "ret-ing from "
                        ((STRCAT ((privLevel_to_str prev_priv))
                            ((STRCAT " to " ((privLevel_to_str w__14)))))))))))
       else sail2_state_monad$returnS () ))
      (let (_ : unit) = (cancel_reservation () ) in sail2_state_monad$bindS
      (prepare_xret_target Supervisor  : ( 32 words$word) M) (\ (w__15 :  32 words$word) .  sail2_state_monad$bindS
      (pc_alignment_mask ()   : ( 32 words$word) M) (\ (w__16 :  32 words$word) . 
      sail2_state_monad$returnS ((and_vec w__15 w__16  :  32 words$word)))))))))
   | (_, CTL_URET (() )) => sail2_state_monad$bindS
      (sail2_state_monad$read_regS cur_privilege_ref) (\ prev_priv .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__17 : Mstatus) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (set_Mstatus_UIE mstatus_ref ((get_Mstatus_UPIE w__17  :  1 words$word)))
      (set_Mstatus_UPIE mstatus_ref (0b1w :  1 words$word)))
      (sail2_state_monad$write_regS cur_privilege_ref User))
      (if ((get_config_print_reg () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS mstatus_ref) (\ (w__18 : Mstatus) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "CSR mstatus <- "
                        ((string_of_bits ((get_Mstatus_bits w__18  :  32 words$word)))))))))
       else sail2_state_monad$returnS () ))
      (if ((get_config_print_platform () )) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__19 : Privilege) . 
         sail2_state_monad$returnS ((print_dbg
                    ((STRCAT "ret-ing from "
                        ((STRCAT ((privLevel_to_str prev_priv))
                            ((STRCAT " to " ((privLevel_to_str w__19)))))))))))
       else sail2_state_monad$returnS () ))
      (let (_ : unit) = (cancel_reservation () ) in sail2_state_monad$bindS
      (prepare_xret_target User  : ( 32 words$word) M) (\ (w__20 :  32 words$word) .  sail2_state_monad$bindS
      (pc_alignment_mask ()   : ( 32 words$word) M) (\ (w__21 :  32 words$word) . 
      sail2_state_monad$returnS ((and_vec w__20 w__21  :  32 words$word)))))))
   )))`;


(*val handle_mem_exception : mword ty32 -> ExceptionType -> M unit*)

val _ = Define `
 ((handle_mem_exception:(32)words$word -> ExceptionType ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (addr : xlenbits) (e : ExceptionType)=
    (let (t : sync_exception) =
     (<| sync_exception_trap := e; 
        sync_exception_excinfo := (SOME addr); 
        sync_exception_ext := NONE |>) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__1 :  32 words$word) .  sail2_state_monad$bindS
   (exception_handler w__0 (CTL_TRAP t) w__1  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
   set_next_pc w__2)))))`;


(*val handle_exception : ExceptionType -> M unit*)

val _ = Define `
 ((handle_exception:ExceptionType ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) e=
    (let (t : sync_exception) =
     (<| sync_exception_trap := e; 
        sync_exception_excinfo := NONE; 
        sync_exception_ext := NONE |>) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__1 :  32 words$word) .  sail2_state_monad$bindS
   (exception_handler w__0 (CTL_TRAP t) w__1  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
   set_next_pc w__2)))))`;


(*val handle_interrupt : InterruptType -> Privilege -> M unit*)

val _ = Define `
 ((handle_interrupt:InterruptType -> Privilege ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (i : InterruptType) (del_priv : Privilege)=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$bindS
   (trap_handler del_priv T ((interruptType_to_bits i  :  8 words$word)) w__0 NONE NONE
     : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
   set_next_pc w__1))))`;


(*val init_sys : unit -> M unit*)

val _ = Define `
 ((init_sys:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS cur_privilege_ref Machine)
   (sail2_state_monad$write_regS mhartid_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Misa_MXL misa_ref ((arch_to_bits RV32  :  2 words$word))))
   (set_Misa_A misa_ref (0b1w :  1 words$word)))
   (set_Misa_C misa_ref ((bool_to_bits ((sys_enable_rvc () ))  :  1 words$word))))
   (set_Misa_I misa_ref (0b1w :  1 words$word)))
   (set_Misa_M misa_ref (0b1w :  1 words$word)))
   (set_Misa_U misa_ref (0b1w :  1 words$word)))
   (set_Misa_S misa_ref (0b1w :  1 words$word)))
   (set_Misa_F misa_ref ((bool_to_bits ((sys_enable_fdext () ))  :  1 words$word))))
   (set_Misa_D misa_ref (0b0w :  1 words$word)))
   (sail2_state_monad$read_regS mstatus_ref)) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__1 : Misa) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS mstatus_ref ((set_mstatus_SXL w__0 ((get_Misa_MXL w__1  :  2 words$word)))))
   (sail2_state_monad$read_regS mstatus_ref)) (\ (w__2 : Mstatus) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS misa_ref) (\ (w__3 : Misa) .  sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS mstatus_ref ((set_mstatus_UXL w__2 ((get_Misa_MXL w__3  :  2 words$word)))))
   (set_Mstatus_SD mstatus_ref (0b0w :  1 words$word)))
   (set_Mstatush_bits mstatush_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Minterrupts_bits mip_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Minterrupts_bits mie_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Minterrupts_bits mideleg_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Medeleg_bits medeleg_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Mtvec_bits mtvec_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (set_Mcause_bits mcause_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (sail2_state_monad$write_regS mepc_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (sail2_state_monad$write_regS mtval_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (sail2_state_monad$write_regS mscratch_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (sail2_state_monad$write_regS mcycle_ref ((EXTZ (( 64 : int):ii) (0b0w :  1 words$word)  :  64 words$word))))
   (sail2_state_monad$write_regS mtime_ref ((EXTZ (( 64 : int):ii) (0b0w :  1 words$word)  :  64 words$word))))
   (set_Counteren_bits mcounteren_ref ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
   (sail2_state_monad$write_regS minstret_ref ((EXTZ (( 64 : int):ii) (0b0w :  1 words$word)  :  64 words$word))))
   (sail2_state_monad$write_regS minstret_written_ref F))
   (init_pmp () ))
   (if ((get_config_print_reg () )) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mstatus_ref) (\ (w__4 : Mstatus) . 
     sail2_state_monad$returnS ((print_dbg
                ((STRCAT "CSR mstatus <- "
                    ((STRCAT ((string_of_bits ((get_Mstatus_bits w__4  :  32 words$word))))
                        ((STRCAT " (input: "
                            ((STRCAT
                                ((string_of_bits ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word))))
                                ")")))))))))))
   else sail2_state_monad$returnS () )))))))`;


(*val MemoryOpResult_add_meta : forall 't. MemoryOpResult 't -> unit -> MemoryOpResult (('t * unit))*)

val _ = Define `
 ((MemoryOpResult_add_meta:'t MemoryOpResult -> unit ->('t#unit)MemoryOpResult) r m=
    ((case r of   MemValue (v) => MemValue (v, m) | MemException (e) => MemException e )))`;


(*val MemoryOpResult_drop_meta : forall 't. MemoryOpResult (('t * unit)) -> MemoryOpResult 't*)

val _ = Define `
 ((MemoryOpResult_drop_meta:('t#unit)MemoryOpResult -> 't MemoryOpResult) r=
    ((case r of   MemValue ((v, m)) => MemValue v | MemException (e) => MemException e )))`;


(*val elf_tohost : unit -> ii*)

(*val elf_entry : unit -> ii*)



(*val phys_mem_segments : unit -> list ((mword ty32 * mword ty32))*)

val _ = Define `
 ((phys_mem_segments:unit ->((32)words$word#(32)words$word)list) () =
    (((plat_rom_base ()   :  32 words$word), (plat_rom_size ()   :  32 words$word)) ::
     (((plat_ram_base ()   :  32 words$word), (plat_ram_size ()   :  32 words$word)) :: [])))`;


(*val within_phys_mem : mword ty32 -> integer -> bool*)

val _ = Define `
 ((within_phys_mem:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    (let addr_int = (lem$w2ui addr) in
   let ram_base_int = (lem$w2ui ((plat_ram_base ()   :  32 words$word))) in
   let rom_base_int = (lem$w2ui ((plat_rom_base ()   :  32 words$word))) in
   let ram_size_int = (lem$w2ui ((plat_ram_size ()   :  32 words$word))) in
   let rom_size_int = (lem$w2ui ((plat_rom_size ()   :  32 words$word))) in
   if (((((ram_base_int <= addr_int)) /\ ((((addr_int + ((id width)))) <= ((ram_base_int + ram_size_int)))))))
   then
     T
   else if (((((rom_base_int <= addr_int)) /\ ((((addr_int + ((id width)))) <=
                   ((rom_base_int + rom_size_int))))))) then
     T
   else
     let (_ : unit) =
       (print_dbg
         ((STRCAT "within_phys_mem: "
             ((STRCAT ((string_of_bits addr)) " not within phys-mem:"))))) in
     let (_ : unit) =
       (print_dbg
         ((STRCAT "  plat_rom_base: " ((string_of_bits ((plat_rom_base ()   :  32 words$word))))))) in
     let (_ : unit) =
       (print_dbg
         ((STRCAT "  plat_rom_size: " ((string_of_bits ((plat_rom_size ()   :  32 words$word))))))) in
     let (_ : unit) =
       (print_dbg
         ((STRCAT "  plat_ram_base: " ((string_of_bits ((plat_ram_base ()   :  32 words$word))))))) in
     let (_ : unit) =
       (print_dbg
         ((STRCAT "  plat_ram_size: " ((string_of_bits ((plat_ram_size ()   :  32 words$word))))))) in
     F))`;


(*val within_clint : mword ty32 -> integer -> bool*)

val _ = Define `
 ((within_clint:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    (let addr_int = (lem$w2ui addr) in
   let clint_base_int = (lem$w2ui ((plat_clint_base ()   :  32 words$word))) in
   let clint_size_int = (lem$w2ui ((plat_clint_size ()   :  32 words$word))) in
   (((clint_base_int <= addr_int)) /\ ((((addr_int + ((id width)))) <= ((clint_base_int + clint_size_int)))))))`;


(*val within_htif_writable : mword ty32 -> integer -> bool*)

val _ = Define `
 ((within_htif_writable:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    ((((((plat_htif_tohost ()   :  32 words$word)) = addr))) \/ ((((((((add_vec_int ((plat_htif_tohost ()   :  32 words$word)) (( 4 : int):ii)  :  32 words$word)) = addr))) /\ (((width = (( 4 : int):ii)))))))))`;


(*val within_htif_readable : mword ty32 -> integer -> bool*)

val _ = Define `
 ((within_htif_readable:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    ((((((plat_htif_tohost ()   :  32 words$word)) = addr))) \/ ((((((((add_vec_int ((plat_htif_tohost ()   :  32 words$word)) (( 4 : int):ii)  :  32 words$word)) = addr))) /\ (((width = (( 4 : int):ii)))))))))`;


val _ = Define `
((MSIP_BASE:(32)words$word)=  ((0x00000000w :  32 words$word)))`;


val _ = Define `
((MTIMECMP_BASE:(32)words$word)=  ((0x00004000w :  32 words$word)))`;


val _ = Define `
((MTIMECMP_BASE_HI:(32)words$word)=  ((0x00004004w :  32 words$word)))`;


val _ = Define `
((MTIME_BASE:(32)words$word)=  ((0x0000BFF8w :  32 words$word)))`;


val _ = Define `
((MTIME_BASE_HI:(32)words$word)=  ((0x0000BFFCw :  32 words$word)))`;


(*val clint_load : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> M (MemoryOpResult (mword 'int8_times_n))*)

val _ = Define `
 ((clint_load:(unit)AccessType ->(32)words$word -> int ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) t addr width=
    (let addr = ((sub_vec addr ((plat_clint_base ()   :  32 words$word))  :  32 words$word)) in
   if ((((((addr = MSIP_BASE))) /\ ((((((((id width)) = (( 8 : int):ii)))) \/ (((((id width)) = (( 4 : int):ii)))))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mip_ref) (\ (w__0 : Minterrupts) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> "
                               ((string_of_bits ((get_Minterrupts_MSI w__0  :  1 words$word)))))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mip_ref)) (\ (w__1 : Minterrupts) . 
     sail2_state_monad$returnS (MemValue ((zero_extend ((get_Minterrupts_MSI w__1  :  1 words$word))
                          (((( 8 : int):ii) * ((id width))))
                         :  'int8_times_n words$word))))
   else if ((((((addr = MTIMECMP_BASE))) /\ (((((id width)) = (( 4 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__2 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint<4>["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> "
                               ((string_of_bits
                                   ((subrange_vec_dec w__2 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M)) (\ (w__3 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w
                          ((zero_extend ((subrange_vec_dec w__3 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
                              (( 32 : int):ii)
                             :  32 words$word))
                         :  'int8_times_n words$word))))
   else if ((((((addr = MTIMECMP_BASE))) /\ (((((id width)) = (( 8 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__4 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint<8>["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> " ((string_of_bits w__4)))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M)) (\ (w__5 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w ((zero_extend w__5 (( 64 : int):ii)  :  64 words$word))  :  'int8_times_n words$word))))
   else if ((((((addr = MTIMECMP_BASE_HI))) /\ (((((id width)) = (( 4 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__6 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint-hi<4>["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> "
                               ((string_of_bits
                                   ((subrange_vec_dec w__6 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word)))))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M)) (\ (w__7 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w
                          ((zero_extend ((subrange_vec_dec w__7 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word))
                              (( 32 : int):ii)
                             :  32 words$word))
                         :  'int8_times_n words$word))))
   else if ((((((addr = MTIME_BASE))) /\ (((((id width)) = (( 4 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__8 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> " ((string_of_bits w__8)))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M)) (\ (w__9 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w
                          ((zero_extend ((subrange_vec_dec w__9 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
                              (( 32 : int):ii)
                             :  32 words$word))
                         :  'int8_times_n words$word))))
   else if ((((((addr = MTIME_BASE))) /\ (((((id width)) = (( 8 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__10 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> " ((string_of_bits w__10)))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M)) (\ (w__11 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w ((zero_extend w__11 (( 64 : int):ii)  :  64 words$word))
                         :  'int8_times_n words$word))))
   else if ((((((addr = MTIME_BASE_HI))) /\ (((((id width)) = (( 4 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__12 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg
                   ((STRCAT "clint["
                       ((STRCAT ((string_of_bits addr))
                           ((STRCAT "] -> " ((string_of_bits w__12)))))))))))
      else sail2_state_monad$returnS () )
     (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M)) (\ (w__13 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w
                          ((zero_extend ((subrange_vec_dec w__13 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word))
                              (( 32 : int):ii)
                             :  32 words$word))
                         :  'int8_times_n words$word))))
   else
     let (_ : unit) =
       (if ((get_config_print_platform () )) then
         print_dbg
           ((STRCAT "clint[" ((STRCAT ((string_of_bits addr)) "] -> <not-mapped>"))))
       else () ) in
     sail2_state_monad$returnS ((case t of
       Execute (() ) => MemException (E_Fetch_Access_Fault () )
     | Read (Data1) => MemException (E_Load_Access_Fault () )
     | _ => MemException (E_SAMO_Access_Fault () )
     ))))`;


(*val clint_dispatch : unit -> M unit*)

val _ = Define `
 ((clint_dispatch:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (if ((get_config_print_platform () )) then sail2_state_monad$bindS
      (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) . 
      sail2_state_monad$returnS ((print_dbg ((STRCAT "clint::tick mtime <- " ((string_of_bits w__0)))))))
    else sail2_state_monad$returnS () )
   (set_Minterrupts_MTI mip_ref (0b0w :  1 words$word)))
   (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M)) (\ (w__1 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__2 :  64 words$word) . 
   if ((zopz0zIzJ_u w__1 w__2)) then sail2_state_monad$seqS
     (if ((get_config_print_platform () )) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__3 :  64 words$word) . 
        sail2_state_monad$returnS ((print_dbg ((STRCAT " clint timer pending at mtime " ((string_of_bits w__3)))))))
      else sail2_state_monad$returnS () )
     (set_Minterrupts_MTI mip_ref (0b1w :  1 words$word))
   else sail2_state_monad$returnS () ))))`;


(*val clint_store : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> M (MemoryOpResult bool)*)

val _ = Define `
 ((clint_store:(32)words$word -> int -> 'int8_times_n words$word ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) addr width data=
    (let addr = ((sub_vec addr ((plat_clint_base ()   :  32 words$word))  :  32 words$word)) in
   if ((((((addr = MSIP_BASE))) /\ ((((((((id width)) = (( 8 : int):ii)))) \/ (((((id width)) = (( 4 : int):ii)))))))))) then
     let (_ : unit) =
       (if ((get_config_print_platform () )) then
         print_dbg
           ((STRCAT "clint["
               ((STRCAT ((string_of_bits addr))
                   ((STRCAT "] <- "
                       ((STRCAT ((string_of_bits data))
                           ((STRCAT " (mip.MSI <- "
                               ((STRCAT ((string_of_bit ((access_vec_dec data (( 0 : int):ii))))) ")"))))))))))))
       else () ) in sail2_state_monad$seqS (sail2_state_monad$seqS
     (set_Minterrupts_MSI mip_ref (vec_of_bits [access_vec_dec data (( 0 : int):ii)]  :  1 words$word))
     (clint_dispatch () )) (sail2_state_monad$returnS (MemValue T))
   else if ((((((addr = MTIMECMP_BASE))) /\ (((((id width)) = (( 8 : int):ii))))))) then
     let (data :  64 words$word) = ((words$w2w data  :  64 words$word)) in
     let (_ : unit) =
       (if ((get_config_print_platform () )) then
         print_dbg
           ((STRCAT "clint<8>["
               ((STRCAT ((string_of_bits addr))
                   ((STRCAT "] <- " ((STRCAT ((string_of_bits data)) " (mtimecmp)"))))))))
       else () ) in sail2_state_monad$seqS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS mtimecmp_ref ((zero_extend data (( 64 : int):ii)  :  64 words$word)))
     (clint_dispatch () )) (sail2_state_monad$returnS (MemValue T))
   else if ((((((addr = MTIMECMP_BASE))) /\ (((((id width)) = (( 4 : int):ii))))))) then
     let (data :  32 words$word) = ((words$w2w data  :  32 words$word)) in
     let (_ : unit) =
       (if ((get_config_print_platform () )) then
         print_dbg
           ((STRCAT "clint<4>["
               ((STRCAT ((string_of_bits addr))
                   ((STRCAT "] <- " ((STRCAT ((string_of_bits data)) " (mtimecmp)"))))))))
       else () ) in sail2_state_monad$bindS
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS
       mtimecmp_ref
       ((update_subrange_vec_dec w__0 (( 31 : int):ii) (( 0 : int):ii) ((zero_extend data (( 32 : int):ii)  :  32 words$word))
          :  64 words$word)))
     (clint_dispatch () )) (sail2_state_monad$returnS (MemValue T)))
   else if ((((((addr = MTIMECMP_BASE_HI))) /\ (((((id width)) = (( 4 : int):ii))))))) then
     let (data :  32 words$word) = ((words$w2w data  :  32 words$word)) in
     let (_ : unit) =
       (if ((get_config_print_platform () )) then
         print_dbg
           ((STRCAT "clint<4>["
               ((STRCAT ((string_of_bits addr))
                   ((STRCAT "] <- " ((STRCAT ((string_of_bits data)) " (mtimecmp)"))))))))
       else () ) in sail2_state_monad$bindS
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS
       mtimecmp_ref
       ((update_subrange_vec_dec w__1 (( 63 : int):ii) (( 32 : int):ii) ((zero_extend data (( 32 : int):ii)  :  32 words$word))
          :  64 words$word)))
     (clint_dispatch () )) (sail2_state_monad$returnS (MemValue T)))
   else
     let (_ : unit) =
       (if ((get_config_print_platform () )) then
         print_dbg
           ((STRCAT "clint["
               ((STRCAT ((string_of_bits addr))
                   ((STRCAT "] <- " ((STRCAT ((string_of_bits data)) " (<unmapped>)"))))))))
       else () ) in
     sail2_state_monad$returnS (MemException (E_SAMO_Access_Fault () ))))`;


(*val tick_clock : unit -> M unit*)

val _ = Define `
 ((tick_clock:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mcountinhibit_ref) (\ (w__0 : Counterin) .  sail2_state_monad$bindS (sail2_state_monad$seqS
   (if (((((get_Counterin_CY w__0  :  1 words$word)) = (0b0w :  1 words$word)))) then sail2_state_monad$bindS
      (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
      sail2_state_monad$write_regS mcycle_ref ((add_vec_int w__1 (( 1 : int):ii)  :  64 words$word)))
    else sail2_state_monad$returnS () )
   (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M)) (\ (w__2 :  64 words$word) .  sail2_state_monad$seqS
   (sail2_state_monad$write_regS mtime_ref ((add_vec_int w__2 (( 1 : int):ii)  :  64 words$word))) (clint_dispatch () )))))`;


(*val Mk_htif_cmd : mword ty64 -> htif_cmd*)

val _ = Define `
 ((Mk_htif_cmd:(64)words$word -> htif_cmd) v=
    (<| htif_cmd_htif_cmd_chunk_0 := ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)) |>))`;


val _ = Define `
 ((get_htif_cmd_bits:htif_cmd ->(64)words$word) v=
    ((subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)))`;


val _ = Define `
 ((set_htif_cmd_bits:((regstate),(register_value),(htif_cmd))register_ref ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       htif_cmd_htif_cmd_chunk_0 :=
         ((update_subrange_vec_dec r.htif_cmd_htif_cmd_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_htif_cmd_bits:htif_cmd ->(64)words$word -> htif_cmd) v x=
    (( v with<|
     htif_cmd_htif_cmd_chunk_0 :=
       ((update_subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
          :  64 words$word)) |>)))`;


(*val _get_htif_cmd_device : htif_cmd -> mword ty8*)

val _ = Define `
 ((get_htif_cmd_device:htif_cmd ->(8)words$word) v=
    ((subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 63 : int):ii) (( 56 : int):ii)  :  8 words$word)))`;


(*val _set_htif_cmd_device : register_ref regstate register_value htif_cmd -> mword ty8 -> M unit*)

val _ = Define `
 ((set_htif_cmd_device:((regstate),(register_value),(htif_cmd))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       htif_cmd_htif_cmd_chunk_0 :=
         ((update_subrange_vec_dec r.htif_cmd_htif_cmd_chunk_0 (( 63 : int):ii) (( 56 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_htif_cmd_device : htif_cmd -> mword ty8 -> htif_cmd*)

val _ = Define `
 ((update_htif_cmd_device:htif_cmd ->(8)words$word -> htif_cmd) v x=
    (( v with<|
     htif_cmd_htif_cmd_chunk_0 :=
       ((update_subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 63 : int):ii) (( 56 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  64 words$word)) |>)))`;


(*val _get_htif_cmd_cmd : htif_cmd -> mword ty8*)

val _ = Define `
 ((get_htif_cmd_cmd:htif_cmd ->(8)words$word) v=
    ((subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 55 : int):ii) (( 48 : int):ii)  :  8 words$word)))`;


(*val _set_htif_cmd_cmd : register_ref regstate register_value htif_cmd -> mword ty8 -> M unit*)

val _ = Define `
 ((set_htif_cmd_cmd:((regstate),(register_value),(htif_cmd))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       htif_cmd_htif_cmd_chunk_0 :=
         ((update_subrange_vec_dec r.htif_cmd_htif_cmd_chunk_0 (( 55 : int):ii) (( 48 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_htif_cmd_cmd : htif_cmd -> mword ty8 -> htif_cmd*)

val _ = Define `
 ((update_htif_cmd_cmd:htif_cmd ->(8)words$word -> htif_cmd) v x=
    (( v with<|
     htif_cmd_htif_cmd_chunk_0 :=
       ((update_subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 55 : int):ii) (( 48 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  64 words$word)) |>)))`;


(*val _get_htif_cmd_payload : htif_cmd -> mword ty48*)

val _ = Define `
 ((get_htif_cmd_payload:htif_cmd ->(48)words$word) v=
    ((subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word)))`;


(*val _set_htif_cmd_payload : register_ref regstate register_value htif_cmd -> mword ty48 -> M unit*)

val _ = Define `
 ((set_htif_cmd_payload:((regstate),(register_value),(htif_cmd))register_ref ->(48)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       htif_cmd_htif_cmd_chunk_0 :=
         ((update_subrange_vec_dec r.htif_cmd_htif_cmd_chunk_0 (( 47 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_htif_cmd_payload : htif_cmd -> mword ty48 -> htif_cmd*)

val _ = Define `
 ((update_htif_cmd_payload:htif_cmd ->(48)words$word -> htif_cmd) v x=
    (( v with<|
     htif_cmd_htif_cmd_chunk_0 :=
       ((update_subrange_vec_dec v.htif_cmd_htif_cmd_chunk_0 (( 47 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word))
          :  64 words$word)) |>)))`;


(*val reset_htif : unit -> M unit*)

val _ = Define `
 ((reset_htif:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$seqS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS htif_cmd_write_ref B0)
   (sail2_state_monad$write_regS htif_payload_writes_ref (0x0w :  4 words$word)))
   (sail2_state_monad$write_regS htif_tohost_ref ((EXTZ (( 64 : int):ii) (0b0w :  1 words$word)  :  64 words$word)))))`;


(*val htif_load : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> M (MemoryOpResult (mword 'int8_times_n))*)

val _ = Define `
 ((htif_load:(unit)AccessType ->(32)words$word -> int ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) t paddr width=  (sail2_state_monad$seqS
   (if ((get_config_print_platform () )) then sail2_state_monad$bindS
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) . 
      sail2_state_monad$returnS ((print_dbg
                 ((STRCAT "htif["
                     ((STRCAT ((string_of_bits paddr))
                         ((STRCAT "] -> " ((string_of_bits w__0)))))))))))
    else sail2_state_monad$returnS () )
   (if ((((((width = (( 8 : int):ii)))) /\ (((paddr = ((plat_htif_tohost ()   :  32 words$word)))))))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w ((zero_extend w__1 (( 64 : int):ii)  :  64 words$word))  :  'int8_times_n words$word))))
   else if ((((((width = (( 4 : int):ii)))) /\ (((paddr = ((plat_htif_tohost ()   :  32 words$word))))))))
   then sail2_state_monad$bindS
     (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__2 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w
                          ((zero_extend ((subrange_vec_dec w__2 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
                              (( 32 : int):ii)
                             :  32 words$word))
                         :  'int8_times_n words$word))))
   else if ((((((width = (( 4 : int):ii)))) /\ (((paddr = ((add_vec_int ((plat_htif_tohost ()   :  32 words$word)) (( 4 : int):ii)  :  32 words$word))))))))
   then sail2_state_monad$bindS
     (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__3 :  64 words$word) . 
     sail2_state_monad$returnS (MemValue ((words$w2w
                          ((zero_extend ((subrange_vec_dec w__3 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word))
                              (( 32 : int):ii)
                             :  32 words$word))
                         :  'int8_times_n words$word))))
   else
     sail2_state_monad$returnS ((case t of
       Execute (() ) => MemException (E_Fetch_Access_Fault () )
     | Read (Data1) => MemException (E_Load_Access_Fault () )
     | _ => MemException (E_SAMO_Access_Fault () )
     )))))`;


(*val htif_store : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> M (MemoryOpResult bool)*)

val _ = Define `
 ((htif_store:(32)words$word -> int -> 'int8_times_n words$word ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) paddr width data=
    (let (_ : unit) =
     (if ((get_config_print_platform () )) then
       print_dbg
         ((STRCAT "htif["
             ((STRCAT ((string_of_bits paddr))
                 ((STRCAT "] <- " ((string_of_bits data))))))))
     else () ) in sail2_state_monad$bindS (sail2_state_monad$seqS
   (if (((width = (( 8 : int):ii)))) then
      let (data :  64 words$word) = ((words$w2w data  :  64 words$word)) in sail2_state_monad$bindS (sail2_state_monad$seqS
      (sail2_state_monad$write_regS htif_cmd_write_ref B1)
      (sail2_state_monad$read_regS htif_payload_writes_ref  : ( 4 words$word) M)) (\ (w__0 :  4 words$word) .  sail2_state_monad$seqS
      (sail2_state_monad$write_regS htif_payload_writes_ref ((add_vec_int w__0 (( 1 : int):ii)  :  4 words$word)))
      (sail2_state_monad$write_regS htif_tohost_ref ((EXTZ (( 64 : int):ii) data  :  64 words$word))))
    else if ((((((width = (( 4 : int):ii)))) /\ (((paddr = ((plat_htif_tohost ()   :  32 words$word))))))))
    then
      let (data :  32 words$word) = ((words$w2w data  :  32 words$word)) in sail2_state_monad$bindS
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
      (if (((data = ((subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))))) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS htif_payload_writes_ref  : ( 4 words$word) M) (\ (w__2 :  4 words$word) . 
         sail2_state_monad$write_regS htif_payload_writes_ref ((add_vec_int w__2 (( 1 : int):ii)  :  4 words$word)))
       else sail2_state_monad$write_regS htif_payload_writes_ref (0x1w :  4 words$word))
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M)) (\ (w__3 :  64 words$word) . 
      sail2_state_monad$write_regS htif_tohost_ref ((update_subrange_vec_dec w__3 (( 31 : int):ii) (( 0 : int):ii) data  :  64 words$word))))
    else if ((((((width = (( 4 : int):ii)))) /\ (((paddr = ((add_vec_int ((plat_htif_tohost ()   :  32 words$word)) (( 4 : int):ii)  :  32 words$word))))))))
    then
      let (data :  32 words$word) = ((words$w2w data  :  32 words$word)) in sail2_state_monad$bindS
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__4 :  64 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS (sail2_state_monad$seqS
      (if (((((subrange_vec_dec data (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word)) = ((subrange_vec_dec w__4 (( 47 : int):ii) (( 32 : int):ii)  :  16 words$word))))) then sail2_state_monad$bindS
         (sail2_state_monad$read_regS htif_payload_writes_ref  : ( 4 words$word) M) (\ (w__5 :  4 words$word) . 
         sail2_state_monad$write_regS htif_payload_writes_ref ((add_vec_int w__5 (( 1 : int):ii)  :  4 words$word)))
       else sail2_state_monad$write_regS htif_payload_writes_ref (0x1w :  4 words$word))
      (sail2_state_monad$write_regS htif_cmd_write_ref B1))
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M)) (\ (w__6 :  64 words$word) . 
      sail2_state_monad$write_regS htif_tohost_ref ((update_subrange_vec_dec w__6 (( 63 : int):ii) (( 32 : int):ii) data  :  64 words$word))))
    else sail2_state_monad$write_regS htif_tohost_ref ((EXTZ (( 64 : int):ii) data  :  64 words$word)))
   (sail2_state$or_boolS
     (sail2_state$and_boolS ( sail2_state_monad$bindS(sail2_state_monad$read_regS htif_cmd_write_ref) (\ (w__7 : bitU) .  sail2_state_monad$returnS (((w__7 = B1)))))
        ( sail2_state_monad$bindS(sail2_state_monad$read_regS htif_payload_writes_ref  : ( 4 words$word) M) (\ (w__8 :  4 words$word) . 
         sail2_state_monad$returnS ((((lem$w2ui w__8)) > (( 0 : int):ii))))))
     ( sail2_state_monad$bindS(sail2_state_monad$read_regS htif_payload_writes_ref  : ( 4 words$word) M) (\ (w__10 :  4 words$word) . 
      sail2_state_monad$returnS ((((lem$w2ui w__10)) > (( 2 : int):ii))))))) (\ (w__11 : bool) .  sail2_state_monad$seqS
   (if w__11 then sail2_state_monad$bindS
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__12 :  64 words$word) . 
      let cmd = (Mk_htif_cmd w__12) in
      let b__0 = ((get_htif_cmd_device cmd  :  8 words$word)) in
      if (((b__0 = (0x00w :  8 words$word)))) then
        let (_ : unit) =
          (if ((get_config_print_platform () )) then
            print_dbg
              ((STRCAT "htif-syscall-proxy cmd: "
                  ((string_of_bits ((get_htif_cmd_payload cmd  :  48 words$word))))))
          else () ) in
        if (((((access_vec_dec ((get_htif_cmd_payload cmd  :  48 words$word)) (( 0 : int):ii))) = B1))) then sail2_state_monad$seqS
          (sail2_state_monad$write_regS htif_done_ref T)
          (sail2_state_monad$write_regS
            htif_exit_code_ref
            ((shiftr
                ((zero_extend ((get_htif_cmd_payload cmd  :  48 words$word)) (( 64 : int):ii)  :  64 words$word))
                (( 1 : int):ii)
               :  64 words$word)))
        else sail2_state_monad$returnS () 
      else if (((b__0 = (0x01w :  8 words$word)))) then
        let (_ : unit) =
          (if ((get_config_print_platform () )) then
            print_dbg
              ((STRCAT "htif-term cmd: "
                  ((string_of_bits ((get_htif_cmd_payload cmd  :  48 words$word))))))
          else () ) in
        let b__2 = ((get_htif_cmd_cmd cmd  :  8 words$word)) in
        let (_ : unit) =
          (if (((b__2 = (0x00w :  8 words$word)))) then () 
          else if (((b__2 = (0x01w :  8 words$word)))) then
            plat_term_write
              ((subrange_vec_dec ((get_htif_cmd_payload cmd  :  48 words$word)) (( 7 : int):ii) (( 0 : int):ii)
                 :  8 words$word))
          else print_endline ((STRCAT "Unknown term cmd: " ((string_of_bits b__2))))) in
        reset_htif () 
      else sail2_state_monad$returnS ((print_endline ((STRCAT "htif-???? cmd: " ((string_of_bits data)))))))
    else sail2_state_monad$returnS () )
   (sail2_state_monad$returnS (MemValue T)))))`;


(*val htif_tick : unit -> M unit*)

val _ = Define `
 ((htif_tick:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS (sail2_state_monad$seqS
   (if ((get_config_print_platform () )) then sail2_state_monad$bindS
      (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) . 
      sail2_state_monad$returnS ((print_dbg ((STRCAT "htif::tick " ((string_of_bits w__0)))))))
    else sail2_state_monad$returnS () )
   (sail2_state_monad$read_regS htif_tohost_ref  : ( 64 words$word) M)) (\ (w__1 :  64 words$word) . 
   sail2_state_monad$write_regS htif_tohost_ref w__1)))`;


(*val within_mmio_readable : mword ty32 -> integer -> bool*)

val _ = Define `
 ((within_mmio_readable:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    (((within_clint addr width)) \/ (((((within_htif_readable addr width)) /\ (((( 1 : int):ii) <= ((id width)))))))))`;


(*val within_mmio_writable : mword ty32 -> integer -> bool*)

val _ = Define `
 ((within_mmio_writable:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    (((within_clint addr width)) \/ (((((within_htif_writable addr width)) /\ ((((id width)) <= (( 8 : int):ii))))))))`;


(*val mmio_read : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> M (MemoryOpResult (mword 'int8_times_n))*)

val _ = Define `
 ((mmio_read:(ext_access_type)AccessType ->(32)words$word -> int ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (t : ext_access_type AccessType) (paddr : xlenbits) (width : int)=
    (if ((within_clint paddr width)) then
     (clint_load t paddr width  : ( ( 'int8_times_n words$word)MemoryOpResult) M)
   else if (((((within_htif_readable paddr width)) /\ (((( 1 : int):ii) <= ((id width))))))) then
     (htif_load t paddr width  : ( ( 'int8_times_n words$word)MemoryOpResult) M)
   else
     sail2_state_monad$returnS ((case t of
       Execute (() ) => MemException (E_Fetch_Access_Fault () )
     | Read (Data1) => MemException (E_Load_Access_Fault () )
     | _ => MemException (E_SAMO_Access_Fault () )
     ))))`;


(*val mmio_write : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> M (MemoryOpResult bool)*)

val _ = Define `
 ((mmio_write:(32)words$word -> int -> 'int8_times_n words$word ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (paddr : xlenbits) (width : int) (data :  'int8_times_n words$word)=
    (if ((within_clint paddr width)) then clint_store paddr width data
   else if (((((within_htif_writable paddr width)) /\ ((((id width)) <= (( 8 : int):ii)))))) then
     htif_store paddr width data
   else sail2_state_monad$returnS (MemException (E_SAMO_Access_Fault () ))))`;


(*val init_platform : unit -> M unit*)

val _ = Define `
 ((init_platform:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS htif_tohost_ref ((EXTZ (( 64 : int):ii) (0b0w :  1 words$word)  :  64 words$word)))
   (sail2_state_monad$write_regS htif_done_ref F))
   (sail2_state_monad$write_regS htif_exit_code_ref ((EXTZ (( 64 : int):ii) (0b0w :  1 words$word)  :  64 words$word))))
   (sail2_state_monad$write_regS htif_cmd_write_ref B0))
   (sail2_state_monad$write_regS htif_payload_writes_ref ((EXTZ (( 4 : int):ii) (0b0w :  1 words$word)  :  4 words$word)))))`;


(*val tick_platform : unit -> M unit*)

val _ = Define `
 ((tick_platform:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (htif_tick () ))`;


(*val handle_illegal : unit -> M unit*)

val _ = Define `
 ((handle_illegal:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (if ((plat_mtval_has_illegal_inst_bits () )) then sail2_state_monad$bindS
      (sail2_state_monad$read_regS instbits_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$returnS (SOME w__0))
    else sail2_state_monad$returnS NONE) (\ info . 
   let (t : sync_exception) =
     (<| sync_exception_trap := (E_Illegal_Instr () ); 
        sync_exception_excinfo := info; 
        sync_exception_ext := NONE |>) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__2 :  32 words$word) .  sail2_state_monad$bindS
   (exception_handler w__1 (CTL_TRAP t) w__2  : ( 32 words$word) M) (\ (w__3 :  32 words$word) . 
   set_next_pc w__3))))))`;


(*val platform_wfi : unit -> M unit*)

val _ = Define `
 ((platform_wfi:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =
    (let (_ : unit) = (cancel_reservation () ) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__1 :  64 words$word) . 
   if ((zopz0zI_u w__0 w__1)) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M) (\ (w__2 :  64 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
     (sail2_state_monad$write_regS mtime_ref w__2)
     (sail2_state_monad$read_regS mtimecmp_ref  : ( 64 words$word) M)) (\ (w__3 :  64 words$word) . 
     sail2_state_monad$write_regS mcycle_ref w__3))
   else sail2_state_monad$returnS () ))))`;


(*val is_aligned_addr : mword ty32 -> integer -> bool*)

val _ = Define `
 ((is_aligned_addr:(32)words$word -> int -> bool) (addr : xlenbits) (width : int)=
    (((((lem$w2ui addr)) % width)) = (( 0 : int):ii)))`;


(*val read_kind_of_flags : bool -> bool -> bool -> maybe read_kind*)

val _ = Define `
 ((read_kind_of_flags:bool -> bool -> bool ->(read_kind)option) (aq : bool) (rl : bool) (res : bool)=
    ((case (aq, rl, res) of
     (F, F, F) => SOME Read_plain
   | (T, F, F) => SOME Read_RISCV_acquire
   | (T, T, F) => SOME Read_RISCV_strong_acquire
   | (F, F, T) => SOME Read_RISCV_reserved
   | (T, F, T) => SOME Read_RISCV_reserved_acquire
   | (T, T, T) => SOME Read_RISCV_reserved_strong_acquire
   | (F, T, F) => NONE
   | (F, T, T) => NONE
   )))`;


(*val phys_mem_read : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> bool -> bool -> bool -> bool -> M (MemoryOpResult ((mword 'int8_times_n * unit)))*)

val _ = Define `
 ((phys_mem_read:(ext_access_type)AccessType ->(32)words$word -> int -> bool -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word#unit)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (t : ext_access_type AccessType) (paddr : xlenbits) (width : int) (aq : bool) (rl :
  bool) (res : bool) (meta : bool)=  (sail2_state_monad$bindS
   (case ((read_kind_of_flags aq rl res)) of
     SOME (rk) => sail2_state_monad$bindS
      (read_ram rk paddr width meta  : (( 'int8_times_n words$word # unit)) M) (\ (w__0 :
        ( 'int8_times_n words$word # unit)) . 
      sail2_state_monad$returnS (SOME w__0))
   | NONE => sail2_state_monad$returnS NONE
   ) (\ (w__1 :  (( 'int8_times_n words$word # unit))option) . 
   let result = w__1 in
   sail2_state_monad$returnS ((case (t, result) of
     (Execute (() ), NONE) => MemException (E_Fetch_Access_Fault () )
   | (Read (Data1), NONE) => MemException (E_Load_Access_Fault () )
   | (_, NONE) => MemException (E_SAMO_Access_Fault () )
   | (_, SOME ((v, m))) =>
      let (_ : unit) =
        (if ((get_config_print_mem () )) then
          print_dbg
            ((STRCAT "mem["
                ((STRCAT ((accessType_to_str t))
                    ((STRCAT ","
                        ((STRCAT ((string_of_bits paddr))
                            ((STRCAT "] -> " ((string_of_bits v))))))))))))
        else () ) in
      MemValue (v, m)
   )))))`;


(*val checked_mem_read : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> bool -> bool -> bool -> bool -> M (MemoryOpResult ((mword 'int8_times_n * unit)))*)

val _ = Define `
 ((checked_mem_read:(ext_access_type)AccessType ->(32)words$word -> int -> bool -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word#unit)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (t : ext_access_type AccessType) (paddr : xlenbits) (width : int) (aq :
  bool) (rl : bool) (res : bool) (meta : bool)=
    (if ((within_mmio_readable paddr width)) then sail2_state_monad$bindS
     (mmio_read t paddr width  : ( ( 'int8_times_n words$word)MemoryOpResult) M) (\ (w__0 : ( 'int8_times_n words$word)
       MemoryOpResult) . 
     sail2_state_monad$returnS ((MemoryOpResult_add_meta w__0 default_meta
               : (( 'int8_times_n words$word # unit)) MemoryOpResult)))
   else if ((within_phys_mem paddr width)) then
     (case ((ext_check_phys_mem_read t paddr width aq rl res meta)) of
       Ext_PhysAddr_OK (() ) =>
        (phys_mem_read t paddr width aq rl res meta
          : ( (( 'int8_times_n words$word # unit))MemoryOpResult) M)
     | Ext_PhysAddr_Error (e) => sail2_state_monad$returnS (MemException e)
     )
   else
     sail2_state_monad$returnS ((case t of
       Execute (() ) => MemException (E_Fetch_Access_Fault () )
     | Read (Data1) => MemException (E_Load_Access_Fault () )
     | _ => MemException (E_SAMO_Access_Fault () )
     ))))`;


(*val pmp_mem_read : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> Privilege -> mword ty32 -> integer -> bool -> bool -> bool -> bool -> M (MemoryOpResult ((mword 'int8_times_n * unit)))*)

val _ = Define `
 ((pmp_mem_read:(ext_access_type)AccessType -> Privilege ->(32)words$word -> int -> bool -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word#unit)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (t : ext_access_type AccessType) (p : Privilege) (paddr : xlenbits) (width :
  int) (aq : bool) (rl : bool) (res : bool) (meta : bool)=
    (if ((~ ((plat_enable_pmp () )))) then
     (checked_mem_read t paddr width aq rl res meta
       : ( (( 'int8_times_n words$word # unit))MemoryOpResult) M)
   else sail2_state_monad$bindS
     (pmpCheck paddr width t p) (\ (w__1 :  ExceptionType option) . 
     (case w__1 of
       NONE =>
        (checked_mem_read t paddr width aq rl res meta
          : ( (( 'int8_times_n words$word # unit))MemoryOpResult) M)
     | SOME (e) => sail2_state_monad$returnS (MemException e)
     ))))`;


(*val rvfi_read : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> MemoryOpResult ((mword 'int8_times_n * unit)) -> unit*)

val _ = Define `
 ((rvfi_read:(32)words$word -> int ->('int8_times_n words$word#unit)MemoryOpResult -> unit) addr width result=  () )`;


(*val mem_read : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> bool -> bool -> bool -> M (MemoryOpResult (mword 'int8_times_n))*)

(*val mem_read_priv : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> Privilege -> mword ty32 -> integer -> bool -> bool -> bool -> M (MemoryOpResult (mword 'int8_times_n))*)

(*val mem_read_meta : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> mword ty32 -> integer -> bool -> bool -> bool -> bool -> M (MemoryOpResult ((mword 'int8_times_n * unit)))*)

(*val mem_read_priv_meta : forall 'int8_times_n. Size 'int8_times_n => AccessType unit -> Privilege -> mword ty32 -> integer -> bool -> bool -> bool -> bool -> M (MemoryOpResult ((mword 'int8_times_n * unit)))*)

val _ = Define `
 ((mem_read_priv_meta:(unit)AccessType -> Privilege ->(32)words$word -> int -> bool -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word#unit)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) typ priv paddr width aq rl res meta=  (sail2_state_monad$bindS
   (if ((((((aq \/ res))) /\ ((~ ((is_aligned_addr paddr width))))))) then
      sail2_state_monad$returnS (MemException (E_Load_Addr_Align () ))
    else
      (case (aq, rl, res) of
        (F, T, F) => sail2_state_monad$throwS (Error_not_implemented "load.rl")
      | (F, T, T) => sail2_state_monad$throwS (Error_not_implemented "lr.rl")
      | (_, _, _) =>
         (pmp_mem_read typ priv paddr width aq rl res meta
           : ( (( 'int8_times_n words$word # unit))MemoryOpResult) M)
      )) (\ (result : (( 'int8_times_n words$word # unit)) MemoryOpResult) . 
   let (_ : unit) = (rvfi_read paddr width result) in
   sail2_state_monad$returnS result)))`;


val _ = Define `
 ((mem_read_meta:(unit)AccessType ->(32)words$word -> int -> bool -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word#unit)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) typ paddr width aq rl res meta=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (effectivePrivilege typ w__0 w__1) (\ (w__2 : Privilege) . 
   (mem_read_priv_meta typ w__2 paddr width aq rl res meta
     : ( (( 'int8_times_n words$word # unit))MemoryOpResult) M))))))`;


val _ = Define `
 ((mem_read_priv:(unit)AccessType -> Privilege ->(32)words$word -> int -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) typ priv paddr width aq rl res=  (sail2_state_monad$bindS
   (mem_read_priv_meta typ priv paddr width aq rl res F
     : ( (( 'int8_times_n words$word # unit))MemoryOpResult) M) (\ (w__0 : (( 'int8_times_n words$word # unit))
     MemoryOpResult) . 
   sail2_state_monad$returnS ((MemoryOpResult_drop_meta w__0  : ( 'int8_times_n words$word) MemoryOpResult)))))`;


val _ = Define `
 ((mem_read:(unit)AccessType ->(32)words$word -> int -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((('int8_times_n words$word)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) typ paddr width aq rel res=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (effectivePrivilege typ w__0 w__1) (\ (w__2 : Privilege) . 
   (mem_read_priv typ w__2 paddr width aq rel res  : ( ( 'int8_times_n words$word)MemoryOpResult) M))))))`;


(*val mem_write_ea : mword ty32 -> integer -> bool -> bool -> bool -> M (MemoryOpResult unit)*)

val _ = Define `
 ((mem_write_ea:(32)words$word -> int -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->((((unit)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) addr width aq rl con=
    (if ((((((rl \/ con))) /\ ((~ ((is_aligned_addr addr width))))))) then
     sail2_state_monad$returnS (MemException (E_SAMO_Addr_Align () ))
   else
     (case (aq, rl, con) of
       (F, F, F) => sail2_state_monad$seqS (write_ram_ea Write_plain addr width) (sail2_state_monad$returnS (MemValue () ))
     | (F, T, F) => sail2_state_monad$seqS (write_ram_ea Write_RISCV_release addr width) (sail2_state_monad$returnS (MemValue () ))
     | (F, F, T) => sail2_state_monad$seqS
        (write_ram_ea Write_RISCV_conditional addr width) (sail2_state_monad$returnS (MemValue () ))
     | (F, T, T) => sail2_state_monad$seqS
        (write_ram_ea Write_RISCV_conditional_release addr width) (sail2_state_monad$returnS (MemValue () ))
     | (T, F, F) => sail2_state_monad$throwS (Error_not_implemented "store.aq")
     | (T, T, F) => sail2_state_monad$seqS
        (write_ram_ea Write_RISCV_strong_release addr width) (sail2_state_monad$returnS (MemValue () ))
     | (T, F, T) => sail2_state_monad$throwS (Error_not_implemented "sc.aq")
     | (T, T, T) => sail2_state_monad$seqS
        (write_ram_ea Write_RISCV_conditional_strong_release addr width) (sail2_state_monad$returnS (MemValue () ))
     )))`;


(*val rvfi_write : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> unit -> unit*)

val _ = Define `
 ((rvfi_write:(32)words$word -> int -> 'int8_times_n words$word -> unit -> unit) addr width value meta=  () )`;


(*val phys_mem_write : forall 'int8_times_n. Size 'int8_times_n => write_kind -> mword ty32 -> integer -> mword 'int8_times_n -> unit -> M (MemoryOpResult bool)*)

val _ = Define `
 ((phys_mem_write:write_kind ->(32)words$word -> int -> 'int8_times_n words$word -> unit ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (wk : write_kind) (paddr : xlenbits) (width : int) (data :
   'int8_times_n words$word) (meta : mem_meta)=
    (let (_ : unit) = (rvfi_write paddr width data meta) in sail2_state_monad$bindS
   (write_ram wk paddr width data meta) (\ (w__0 : bool) . 
   let result = (MemValue w__0) in
   let (_ : unit) =
     (if ((get_config_print_mem () )) then
       print_dbg
         ((STRCAT "mem["
             ((STRCAT ((string_of_bits paddr))
                 ((STRCAT "] <- " ((string_of_bits data))))))))
     else () ) in
   sail2_state_monad$returnS result)))`;


(*val checked_mem_write : forall 'int8_times_n. Size 'int8_times_n => write_kind -> mword ty32 -> integer -> mword 'int8_times_n -> unit -> M (MemoryOpResult bool)*)

val _ = Define `
 ((checked_mem_write:write_kind ->(32)words$word -> int -> 'int8_times_n words$word -> unit ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (wk : write_kind) (paddr : xlenbits) (width : int) (data :
   'int8_times_n words$word) (meta : mem_meta)=
    (if ((within_mmio_writable paddr width)) then mmio_write paddr width data
   else if ((within_phys_mem paddr width)) then
     (case ((ext_check_phys_mem_write wk paddr width data meta)) of
       Ext_PhysAddr_OK (() ) => phys_mem_write wk paddr width data meta
     | Ext_PhysAddr_Error (e) => sail2_state_monad$returnS (MemException e)
     )
   else sail2_state_monad$returnS (MemException (E_SAMO_Access_Fault () ))))`;


(*val pmp_mem_write : forall 'int8_times_n. Size 'int8_times_n => write_kind -> mword ty32 -> integer -> mword 'int8_times_n -> AccessType unit -> Privilege -> unit -> M (MemoryOpResult bool)*)

val _ = Define `
 ((pmp_mem_write:write_kind ->(32)words$word -> int -> 'int8_times_n words$word ->(ext_access_type)AccessType -> Privilege -> unit ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (wk : write_kind) (paddr : xlenbits) (width : int) (data :  'int8_times_n words$word) (typ : ext_access_type
  AccessType) (priv : Privilege) (meta : mem_meta)=
    (if ((~ ((plat_enable_pmp () )))) then checked_mem_write wk paddr width data meta
   else sail2_state_monad$bindS
     (pmpCheck paddr width typ priv) (\ (w__1 :  ExceptionType option) . 
     (case w__1 of
       NONE => checked_mem_write wk paddr width data meta
     | SOME (e) => sail2_state_monad$returnS (MemException e)
     ))))`;


(*val mem_write_value_priv_meta : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> AccessType unit -> Privilege -> unit -> bool -> bool -> bool -> M (MemoryOpResult bool)*)

val _ = Define `
 ((mem_write_value_priv_meta:(32)words$word -> int -> 'int8_times_n words$word ->(unit)AccessType -> Privilege -> unit -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) paddr width value typ priv meta aq rl con=
    (let (_ : unit) = (rvfi_write paddr width value meta) in
   if ((((((rl \/ con))) /\ ((~ ((is_aligned_addr paddr width))))))) then
     sail2_state_monad$returnS (MemException (E_SAMO_Addr_Align () ))
   else sail2_state_monad$bindS
     (case (aq, rl, con) of
       (F, F, F) => sail2_state_monad$returnS Write_plain
     | (F, T, F) => sail2_state_monad$returnS Write_RISCV_release
     | (F, F, T) => sail2_state_monad$returnS Write_RISCV_conditional
     | (F, T, T) => sail2_state_monad$returnS Write_RISCV_conditional_release
     | (T, T, F) => sail2_state_monad$returnS Write_RISCV_strong_release
     | (T, T, T) => sail2_state_monad$returnS Write_RISCV_conditional_strong_release
     | (T, F, F) => sail2_state_monad$throwS (Error_not_implemented "store.aq")
     | (T, F, T) => sail2_state_monad$throwS (Error_not_implemented "sc.aq")
     ) (\ (wk : write_kind) . 
     pmp_mem_write wk paddr width value typ priv meta)))`;


(*val mem_write_value_priv : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> Privilege -> bool -> bool -> bool -> M (MemoryOpResult bool)*)

val _ = Define `
 ((mem_write_value_priv:(32)words$word -> int -> 'int8_times_n words$word -> Privilege -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) paddr width value priv aq rl con=
    (mem_write_value_priv_meta paddr width value (Write default_write_acc) priv default_meta aq rl con))`;


(*val mem_write_value_meta : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> unit -> unit -> bool -> bool -> bool -> M (MemoryOpResult bool)*)

val _ = Define `
 ((mem_write_value_meta:(32)words$word -> int -> 'int8_times_n words$word -> unit -> unit -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) paddr width value ext_acc meta aq rl con=
    (let typ = (Write ext_acc) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (effectivePrivilege typ w__0 w__1) (\ ep . 
   mem_write_value_priv_meta paddr width value typ ep meta aq rl con)))))`;


(*val mem_write_value : forall 'int8_times_n. Size 'int8_times_n => mword ty32 -> integer -> mword 'int8_times_n -> bool -> bool -> bool -> M (MemoryOpResult bool)*)

val _ = Define `
 ((mem_write_value:(32)words$word -> int -> 'int8_times_n words$word -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->((((bool)MemoryOpResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) paddr width value aq rl con=
    (mem_write_value_meta paddr width value default_write_acc default_meta aq rl con))`;


val _ = Define `
((default_sv32_ext_pte:(10)words$word)=  ((0b0000000000w :  10 words$word)))`;


(*val Mk_PTE_Bits : mword ty8 -> PTE_Bits*)

val _ = Define `
 ((Mk_PTE_Bits:(8)words$word -> PTE_Bits) v=
    (<| PTE_Bits_PTE_Bits_chunk_0 := ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)) |>))`;


val _ = Define `
 ((get_PTE_Bits_bits:PTE_Bits ->(8)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_bits:((regstate),(register_value),(PTE_Bits))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_bits:PTE_Bits ->(8)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_D:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_D:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_D:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 7 : int):ii) (( 7 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_A:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_A:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_A:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 6 : int):ii) (( 6 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_G:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_G:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_G:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 5 : int):ii) (( 5 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_U:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_U:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_U:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 4 : int):ii) (( 4 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_X:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_X:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_X:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 3 : int):ii) (( 3 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_W:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_W:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_W:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 2 : int):ii) (( 2 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_R:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_R:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_R:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 1 : int):ii) (( 1 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


val _ = Define `
 ((get_PTE_Bits_V:PTE_Bits ->(1)words$word) v=  ((subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)))`;


val _ = Define `
 ((set_PTE_Bits_V:((regstate),(register_value),(PTE_Bits))register_ref ->(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       PTE_Bits_PTE_Bits_chunk_0 :=
         ((update_subrange_vec_dec r.PTE_Bits_PTE_Bits_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
            :  8 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_PTE_Bits_V:PTE_Bits ->(1)words$word -> PTE_Bits) v x=
    (( v with<|
     PTE_Bits_PTE_Bits_chunk_0 :=
       ((update_subrange_vec_dec v.PTE_Bits_PTE_Bits_chunk_0 (( 0 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word))
          :  8 words$word)) |>)))`;


(*val isPTEPtr : mword ty8 -> mword ty10 -> bool*)

val _ = Define `
 ((isPTEPtr:(8)words$word ->(10)words$word -> bool) (p : pteAttribs) (ext : extPte)=
    (let a = (Mk_PTE_Bits p) in
   ((((((get_PTE_Bits_R a  :  1 words$word)) = (0b0w :  1 words$word)))) /\ ((((((((get_PTE_Bits_W a  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((get_PTE_Bits_X a  :  1 words$word)) = (0b0w :  1 words$word))))))))))`;


(*val isInvalidPTE : mword ty8 -> mword ty10 -> bool*)

val _ = Define `
 ((isInvalidPTE:(8)words$word ->(10)words$word -> bool) (p : pteAttribs) (ext : extPte)=
    (let a = (Mk_PTE_Bits p) in
   ((((((get_PTE_Bits_V a  :  1 words$word)) = (0b0w :  1 words$word)))) \/ ((((((((get_PTE_Bits_W a  :  1 words$word)) = (0b1w :  1 words$word)))) /\ (((((get_PTE_Bits_R a  :  1 words$word)) = (0b0w :  1 words$word))))))))))`;


(*val to_pte_check : bool -> PTE_Check*)

val _ = Define `
 ((to_pte_check:bool -> PTE_Check) b=  (if b then PTE_Check_Success ()  else PTE_Check_Failure (() , () )))`;


(*val checkPTEPermission : AccessType unit -> Privilege -> bool -> bool -> PTE_Bits -> mword ty10 -> unit -> M PTE_Check*)

val _ = Define `
 ((checkPTEPermission:(ext_access_type)AccessType -> Privilege -> bool -> bool -> PTE_Bits ->(10)words$word -> unit ->(regstate)sail2_state_monad$sequential_state ->(((PTE_Check),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (ac : ext_access_type AccessType) (priv : Privilege) (mxr : bool) (do_sum :
  bool) (p : PTE_Bits) (ext : extPte) (ext_ptw : ext_ptw)=
    ((case (ac, priv) of
     (Read (_), User) =>
      sail2_state_monad$returnS ((to_pte_check
                 ((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ ((((((((get_PTE_Bits_R p  :  1 words$word)) = (0b1w :  1 words$word)))) \/ ((((((((get_PTE_Bits_X p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ mxr)))))))))))
   | (Write (_), User) =>
      sail2_state_monad$returnS ((to_pte_check
                 ((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ (((((get_PTE_Bits_W p  :  1 words$word)) = (0b1w :  1 words$word)))))))))
   | (ReadWrite ((_, _)), User) =>
      sail2_state_monad$returnS ((to_pte_check
                 ((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ ((((((((get_PTE_Bits_W p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ ((((((((get_PTE_Bits_R p  :  1 words$word)) = (0b1w :  1 words$word)))) \/ ((((((((get_PTE_Bits_X p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ mxr))))))))))))))
   | (Execute (() ), User) =>
      sail2_state_monad$returnS ((to_pte_check
                 ((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ (((((get_PTE_Bits_X p  :  1 words$word)) = (0b1w :  1 words$word)))))))))
   | (Read (_), Supervisor) =>
      sail2_state_monad$returnS ((to_pte_check
                 (((((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b0w :  1 words$word)))) \/ do_sum))) /\ ((((((((get_PTE_Bits_R p  :  1 words$word)) = (0b1w :  1 words$word)))) \/ ((((((((get_PTE_Bits_X p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ mxr)))))))))))
   | (Write (_), Supervisor) =>
      sail2_state_monad$returnS ((to_pte_check
                 (((((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b0w :  1 words$word)))) \/ do_sum))) /\ (((((get_PTE_Bits_W p  :  1 words$word)) = (0b1w :  1 words$word)))))))))
   | (ReadWrite ((_, _)), Supervisor) =>
      sail2_state_monad$returnS ((to_pte_check
                 (((((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b0w :  1 words$word)))) \/ do_sum))) /\ ((((((((get_PTE_Bits_W p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ ((((((((get_PTE_Bits_R p  :  1 words$word)) = (0b1w :  1 words$word)))) \/ ((((((((get_PTE_Bits_X p  :  1 words$word)) = (0b1w :  1 words$word)))) /\ mxr))))))))))))))
   | (Execute (() ), Supervisor) =>
      sail2_state_monad$returnS ((to_pte_check
                 ((((((((get_PTE_Bits_U p  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((get_PTE_Bits_X p  :  1 words$word)) = (0b1w :  1 words$word)))))))))
   | (_, Machine) => internal_error "m-mode mem perm check"
   )))`;


(*val update_PTE_Bits : PTE_Bits -> AccessType unit -> mword ty10 -> maybe ((PTE_Bits * mword ty10))*)

val _ = Define `
 ((update_PTE_Bits:PTE_Bits ->(ext_access_type)AccessType ->(10)words$word ->(PTE_Bits#(10)words$word)option) (p : PTE_Bits) (a : ext_access_type AccessType) (ext : extPte)=
    (let update_d =
     ((((((get_PTE_Bits_D p  :  1 words$word)) = (0b0w :  1 words$word)))) /\ ((case a of
         Execute (() ) => F
       | Read (() ) => F
       | Write (_) => T
       | ReadWrite ((_, _)) => T
       ))) in
   let update_a = (((get_PTE_Bits_A p  :  1 words$word)) = (0b0w :  1 words$word)) in
   if (((update_d \/ update_a))) then
     let np = (update_PTE_Bits_A p (0b1w :  1 words$word)) in
     let np = (if update_d then update_PTE_Bits_D np (0b1w :  1 words$word) else np) in
     SOME (np, ext)
   else NONE))`;


val _ = Define `
 ((ptw_error_to_str:PTW_Error -> string) e=
    ((case e of
     PTW_Invalid_Addr (() ) => "invalid-source-addr"
   | PTW_Access (() ) => "mem-access-error"
   | PTW_Invalid_PTE (() ) => "invalid-pte"
   | PTW_No_Permission (() ) => "no-permission"
   | PTW_Misaligned (() ) => "misaligned-superpage"
   | PTW_PTE_Update (() ) => "pte-update-needed"
   | PTW_Ext_Error (e) => "extension-error"
   )))`;


(*val ext_get_ptw_error : unit -> PTW_Error*)

val _ = Define `
 ((ext_get_ptw_error:unit -> PTW_Error) eptwf=  (PTW_No_Permission () ))`;


(*val translationException : AccessType unit -> PTW_Error -> ExceptionType*)

val _ = Define `
 ((translationException:(ext_access_type)AccessType -> PTW_Error -> ExceptionType) (a : ext_access_type AccessType) (f : PTW_Error)=
    ((case (a, f) of
     (_, PTW_Ext_Error (e)) => E_Extension ((ext_translate_exception e))
   | (ReadWrite (_), PTW_Access (() )) => E_SAMO_Access_Fault () 
   | (ReadWrite (_), _) => E_SAMO_Page_Fault () 
   | (Read (_), PTW_Access (() )) => E_Load_Access_Fault () 
   | (Read (_), _) => E_Load_Page_Fault () 
   | (Write (_), PTW_Access (() )) => E_SAMO_Access_Fault () 
   | (Write (_), _) => E_SAMO_Page_Fault () 
   | (Execute (() ), PTW_Access (() )) => E_Fetch_Access_Fault () 
   | (Execute (() ), _) => E_Fetch_Page_Fault () 
   )))`;


val _ = Define `
((PAGESIZE_BITS:int)=  ((( 12 : int):ii)))`;


(*val curAsid32 : mword ty32 -> mword ty9*)

val _ = Define `
 ((curAsid32:(32)words$word ->(9)words$word) satp=
    (let s = (Mk_Satp32 satp) in
   (get_Satp32_Asid s  :  9 words$word)))`;


(*val curPTB32 : mword ty32 -> mword ty34*)

val _ = Define `
 ((curPTB32:(32)words$word ->(34)words$word) satp=
    (let (s : Satp32) = (Mk_Satp32 satp) in
   (shiftl ((EXTZ (( 34 : int):ii) ((get_Satp32_PPN s  :  22 words$word))  :  34 words$word)) PAGESIZE_BITS
     :  34 words$word)))`;


val _ = Define `
((SV32_LEVEL_BITS:int)=  ((( 10 : int):ii)))`;


val _ = Define `
((SV32_LEVELS:int)=  ((( 2 : int):ii)))`;


val _ = Define `
((PTE32_LOG_SIZE:int)=  ((( 2 : int):ii)))`;


val _ = Define `
((PTE32_SIZE:int)=  ((( 4 : int):ii)))`;


(*val Mk_SV32_Vaddr : mword ty32 -> SV32_Vaddr*)

val _ = Define `
 ((Mk_SV32_Vaddr:(32)words$word -> SV32_Vaddr) v=
    (<| SV32_Vaddr_SV32_Vaddr_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_SV32_Vaddr_bits:SV32_Vaddr ->(32)words$word) v=
    ((subrange_vec_dec v.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_SV32_Vaddr_bits:((regstate),(register_value),(SV32_Vaddr))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_Vaddr_SV32_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV32_Vaddr_bits:SV32_Vaddr ->(32)words$word -> SV32_Vaddr) v x=
    (( v with<|
     SV32_Vaddr_SV32_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


(*val _get_SV32_Vaddr_VPNi : SV32_Vaddr -> mword ty20*)

val _ = Define `
 ((get_SV32_Vaddr_VPNi:SV32_Vaddr ->(20)words$word) v=
    ((subrange_vec_dec v.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 31 : int):ii) (( 12 : int):ii)  :  20 words$word)))`;


(*val _set_SV32_Vaddr_VPNi : register_ref regstate register_value SV32_Vaddr -> mword ty20 -> M unit*)

val _ = Define `
 ((set_SV32_Vaddr_VPNi:((regstate),(register_value),(SV32_Vaddr))register_ref ->(20)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_Vaddr_SV32_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 31 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 19 : int):ii) (( 0 : int):ii)  :  20 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_SV32_Vaddr_VPNi : SV32_Vaddr -> mword ty20 -> SV32_Vaddr*)

val _ = Define `
 ((update_SV32_Vaddr_VPNi:SV32_Vaddr ->(20)words$word -> SV32_Vaddr) v x=
    (( v with<|
     SV32_Vaddr_SV32_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 31 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 19 : int):ii) (( 0 : int):ii)  :  20 words$word))
          :  32 words$word)) |>)))`;


(*val _update_SV39_Vaddr_VPNi : SV39_Vaddr -> mword ty27 -> SV39_Vaddr*)

(*val _update_SV48_Vaddr_VPNi : SV48_Vaddr -> mword ty27 -> SV48_Vaddr*)

(*val _get_SV39_Vaddr_VPNi : SV39_Vaddr -> mword ty27*)

(*val _get_SV48_Vaddr_VPNi : SV48_Vaddr -> mword ty27*)

(*val _set_SV39_Vaddr_VPNi : register_ref regstate register_value SV39_Vaddr -> mword ty27 -> M unit*)

(*val _set_SV48_Vaddr_VPNi : register_ref regstate register_value SV48_Vaddr -> mword ty27 -> M unit*)

(*val _get_SV32_Vaddr_PgOfs : SV32_Vaddr -> mword ty12*)

val _ = Define `
 ((get_SV32_Vaddr_PgOfs:SV32_Vaddr ->(12)words$word) v=
    ((subrange_vec_dec v.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word)))`;


(*val _set_SV32_Vaddr_PgOfs : register_ref regstate register_value SV32_Vaddr -> mword ty12 -> M unit*)

val _ = Define `
 ((set_SV32_Vaddr_PgOfs:((regstate),(register_value),(SV32_Vaddr))register_ref ->(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_Vaddr_SV32_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_SV32_Vaddr_PgOfs : SV32_Vaddr -> mword ty12 -> SV32_Vaddr*)

val _ = Define `
 ((update_SV32_Vaddr_PgOfs:SV32_Vaddr ->(12)words$word -> SV32_Vaddr) v x=
    (( v with<|
     SV32_Vaddr_SV32_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_Vaddr_SV32_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
          :  32 words$word)) |>)))`;


(*val _update_SV32_Paddr_PgOfs : SV32_Paddr -> mword ty12 -> SV32_Paddr*)

(*val _update_SV39_Paddr_PgOfs : SV39_Paddr -> mword ty12 -> SV39_Paddr*)

(*val _update_SV39_Vaddr_PgOfs : SV39_Vaddr -> mword ty12 -> SV39_Vaddr*)

(*val _update_SV48_Paddr_PgOfs : SV48_Paddr -> mword ty12 -> SV48_Paddr*)

(*val _update_SV48_Vaddr_PgOfs : SV48_Vaddr -> mword ty12 -> SV48_Vaddr*)

(*val _get_SV32_Paddr_PgOfs : SV32_Paddr -> mword ty12*)

(*val _get_SV39_Paddr_PgOfs : SV39_Paddr -> mword ty12*)

(*val _get_SV39_Vaddr_PgOfs : SV39_Vaddr -> mword ty12*)

(*val _get_SV48_Paddr_PgOfs : SV48_Paddr -> mword ty12*)

(*val _get_SV48_Vaddr_PgOfs : SV48_Vaddr -> mword ty12*)

(*val _set_SV32_Paddr_PgOfs : register_ref regstate register_value SV32_Paddr -> mword ty12 -> M unit*)

(*val _set_SV39_Paddr_PgOfs : register_ref regstate register_value SV39_Paddr -> mword ty12 -> M unit*)

(*val _set_SV39_Vaddr_PgOfs : register_ref regstate register_value SV39_Vaddr -> mword ty12 -> M unit*)

(*val _set_SV48_Paddr_PgOfs : register_ref regstate register_value SV48_Paddr -> mword ty12 -> M unit*)

(*val _set_SV48_Vaddr_PgOfs : register_ref regstate register_value SV48_Vaddr -> mword ty12 -> M unit*)

(*val Mk_SV32_Paddr : mword ty34 -> SV32_Paddr*)

val _ = Define `
 ((Mk_SV32_Paddr:(34)words$word -> SV32_Paddr) v=
    (<| SV32_Paddr_SV32_Paddr_chunk_0 := ((subrange_vec_dec v (( 33 : int):ii) (( 0 : int):ii)  :  34 words$word)) |>))`;


val _ = Define `
 ((get_SV32_Paddr_bits:SV32_Paddr ->(34)words$word) v=
    ((subrange_vec_dec v.SV32_Paddr_SV32_Paddr_chunk_0 (( 33 : int):ii) (( 0 : int):ii)  :  34 words$word)))`;


val _ = Define `
 ((set_SV32_Paddr_bits:((regstate),(register_value),(SV32_Paddr))register_ref ->(34)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_Paddr_SV32_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_Paddr_SV32_Paddr_chunk_0 (( 33 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 33 : int):ii) (( 0 : int):ii)  :  34 words$word))
            :  34 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV32_Paddr_bits:SV32_Paddr ->(34)words$word -> SV32_Paddr) v x=
    (( v with<|
     SV32_Paddr_SV32_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_Paddr_SV32_Paddr_chunk_0 (( 33 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 33 : int):ii) (( 0 : int):ii)  :  34 words$word))
          :  34 words$word)) |>)))`;


(*val _get_SV32_Paddr_PPNi : SV32_Paddr -> mword ty22*)

val _ = Define `
 ((get_SV32_Paddr_PPNi:SV32_Paddr ->(22)words$word) v=
    ((subrange_vec_dec v.SV32_Paddr_SV32_Paddr_chunk_0 (( 33 : int):ii) (( 12 : int):ii)  :  22 words$word)))`;


(*val _set_SV32_Paddr_PPNi : register_ref regstate register_value SV32_Paddr -> mword ty22 -> M unit*)

val _ = Define `
 ((set_SV32_Paddr_PPNi:((regstate),(register_value),(SV32_Paddr))register_ref ->(22)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_Paddr_SV32_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_Paddr_SV32_Paddr_chunk_0 (( 33 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word))
            :  34 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_SV32_Paddr_PPNi : SV32_Paddr -> mword ty22 -> SV32_Paddr*)

val _ = Define `
 ((update_SV32_Paddr_PPNi:SV32_Paddr ->(22)words$word -> SV32_Paddr) v x=
    (( v with<|
     SV32_Paddr_SV32_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_Paddr_SV32_Paddr_chunk_0 (( 33 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word))
          :  34 words$word)) |>)))`;


(*val _update_SV32_PTE_PPNi : SV32_PTE -> mword ty22 -> SV32_PTE*)

(*val _update_SV39_PTE_PPNi : SV39_PTE -> mword ty44 -> SV39_PTE*)

(*val _update_SV39_Paddr_PPNi : SV39_Paddr -> mword ty44 -> SV39_Paddr*)

(*val _update_SV48_PTE_PPNi : SV48_PTE -> mword ty44 -> SV48_PTE*)

(*val _update_SV48_Paddr_PPNi : SV48_Paddr -> mword ty44 -> SV48_Paddr*)

(*val _get_SV32_PTE_PPNi : SV32_PTE -> mword ty22*)

(*val _get_SV39_PTE_PPNi : SV39_PTE -> mword ty44*)

(*val _get_SV39_Paddr_PPNi : SV39_Paddr -> mword ty44*)

(*val _get_SV48_PTE_PPNi : SV48_PTE -> mword ty44*)

(*val _get_SV48_Paddr_PPNi : SV48_Paddr -> mword ty44*)

(*val _set_SV32_PTE_PPNi : register_ref regstate register_value SV32_PTE -> mword ty22 -> M unit*)

(*val _set_SV39_PTE_PPNi : register_ref regstate register_value SV39_PTE -> mword ty44 -> M unit*)

(*val _set_SV39_Paddr_PPNi : register_ref regstate register_value SV39_Paddr -> mword ty44 -> M unit*)

(*val _set_SV48_PTE_PPNi : register_ref regstate register_value SV48_PTE -> mword ty44 -> M unit*)

(*val _set_SV48_Paddr_PPNi : register_ref regstate register_value SV48_Paddr -> mword ty44 -> M unit*)

val _ = Define `
 ((get_SV32_Paddr_PgOfs:SV32_Paddr ->(12)words$word) v=
    ((subrange_vec_dec v.SV32_Paddr_SV32_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word)))`;


val _ = Define `
 ((set_SV32_Paddr_PgOfs:((regstate),(register_value),(SV32_Paddr))register_ref ->(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_Paddr_SV32_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_Paddr_SV32_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
            :  34 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV32_Paddr_PgOfs:SV32_Paddr ->(12)words$word -> SV32_Paddr) v x=
    (( v with<|
     SV32_Paddr_SV32_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_Paddr_SV32_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
          :  34 words$word)) |>)))`;


(*val Mk_SV32_PTE : mword ty32 -> SV32_PTE*)

val _ = Define `
 ((Mk_SV32_PTE:(32)words$word -> SV32_PTE) v=
    (<| SV32_PTE_SV32_PTE_chunk_0 := ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) |>))`;


val _ = Define `
 ((get_SV32_PTE_bits:SV32_PTE ->(32)words$word) v=
    ((subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


val _ = Define `
 ((set_SV32_PTE_bits:((regstate),(register_value),(SV32_PTE))register_ref ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_PTE_SV32_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_PTE_SV32_PTE_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV32_PTE_bits:SV32_PTE ->(32)words$word -> SV32_PTE) v x=
    (( v with<|
     SV32_PTE_SV32_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 31 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
          :  32 words$word)) |>)))`;


val _ = Define `
 ((get_SV32_PTE_PPNi:SV32_PTE ->(22)words$word) v=
    ((subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 31 : int):ii) (( 10 : int):ii)  :  22 words$word)))`;


val _ = Define `
 ((set_SV32_PTE_PPNi:((regstate),(register_value),(SV32_PTE))register_ref ->(22)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_PTE_SV32_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_PTE_SV32_PTE_chunk_0 (( 31 : int):ii) (( 10 : int):ii)
             ((subrange_vec_dec v (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV32_PTE_PPNi:SV32_PTE ->(22)words$word -> SV32_PTE) v x=
    (( v with<|
     SV32_PTE_SV32_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 31 : int):ii) (( 10 : int):ii)
           ((subrange_vec_dec x (( 21 : int):ii) (( 0 : int):ii)  :  22 words$word))
          :  32 words$word)) |>)))`;


(*val _get_SV32_PTE_RSW : SV32_PTE -> mword ty2*)

val _ = Define `
 ((get_SV32_PTE_RSW:SV32_PTE ->(2)words$word) v=  ((subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)  :  2 words$word)))`;


(*val _set_SV32_PTE_RSW : register_ref regstate register_value SV32_PTE -> mword ty2 -> M unit*)

val _ = Define `
 ((set_SV32_PTE_RSW:((regstate),(register_value),(SV32_PTE))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_PTE_SV32_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_PTE_SV32_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_SV32_PTE_RSW : SV32_PTE -> mword ty2 -> SV32_PTE*)

val _ = Define `
 ((update_SV32_PTE_RSW:SV32_PTE ->(2)words$word -> SV32_PTE) v x=
    (( v with<|
     SV32_PTE_SV32_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  32 words$word)) |>)))`;


(*val _update_SV39_PTE_RSW : SV39_PTE -> mword ty2 -> SV39_PTE*)

(*val _update_SV48_PTE_RSW : SV48_PTE -> mword ty2 -> SV48_PTE*)

(*val _get_SV39_PTE_RSW : SV39_PTE -> mword ty2*)

(*val _get_SV48_PTE_RSW : SV48_PTE -> mword ty2*)

(*val _set_SV39_PTE_RSW : register_ref regstate register_value SV39_PTE -> mword ty2 -> M unit*)

(*val _set_SV48_PTE_RSW : register_ref regstate register_value SV48_PTE -> mword ty2 -> M unit*)

(*val _get_SV32_PTE_BITS : SV32_PTE -> mword ty8*)

val _ = Define `
 ((get_SV32_PTE_BITS:SV32_PTE ->(8)words$word) v=  ((subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))`;


(*val _set_SV32_PTE_BITS : register_ref regstate register_value SV32_PTE -> mword ty8 -> M unit*)

val _ = Define `
 ((set_SV32_PTE_BITS:((regstate),(register_value),(SV32_PTE))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV32_PTE_SV32_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV32_PTE_SV32_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  32 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_SV32_PTE_BITS : SV32_PTE -> mword ty8 -> SV32_PTE*)

val _ = Define `
 ((update_SV32_PTE_BITS:SV32_PTE ->(8)words$word -> SV32_PTE) v x=
    (( v with<|
     SV32_PTE_SV32_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV32_PTE_SV32_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  32 words$word)) |>)))`;


(*val _update_SV39_PTE_BITS : SV39_PTE -> mword ty8 -> SV39_PTE*)

(*val _update_SV48_PTE_BITS : SV48_PTE -> mword ty8 -> SV48_PTE*)

(*val _get_SV39_PTE_BITS : SV39_PTE -> mword ty8*)

(*val _get_SV48_PTE_BITS : SV48_PTE -> mword ty8*)

(*val _set_SV39_PTE_BITS : register_ref regstate register_value SV39_PTE -> mword ty8 -> M unit*)

(*val _set_SV48_PTE_BITS : register_ref regstate register_value SV48_PTE -> mword ty8 -> M unit*)

(*val curAsid64 : mword ty64 -> mword ty16*)

val _ = Define `
 ((curAsid64:(64)words$word ->(16)words$word) satp=
    (let s = (Mk_Satp64 satp) in
   (get_Satp64_Asid s  :  16 words$word)))`;


(*val curPTB64 : mword ty64 -> mword ty56*)

val _ = Define `
 ((curPTB64:(64)words$word ->(56)words$word) satp=
    (let s = (Mk_Satp64 satp) in
   (shiftl ((EXTZ (( 56 : int):ii) ((get_Satp64_PPN s  :  44 words$word))  :  56 words$word)) PAGESIZE_BITS
     :  56 words$word)))`;


val _ = Define `
((SV39_LEVEL_BITS:int)=  ((( 9 : int):ii)))`;


val _ = Define `
((SV39_LEVELS:int)=  ((( 3 : int):ii)))`;


val _ = Define `
((PTE39_LOG_SIZE:int)=  ((( 3 : int):ii)))`;


val _ = Define `
((PTE39_SIZE:int)=  ((( 8 : int):ii)))`;


(*val Mk_SV39_Vaddr : mword ty39 -> SV39_Vaddr*)

val _ = Define `
 ((Mk_SV39_Vaddr:(39)words$word -> SV39_Vaddr) v=
    (<| SV39_Vaddr_SV39_Vaddr_chunk_0 := ((subrange_vec_dec v (( 38 : int):ii) (( 0 : int):ii)  :  39 words$word)) |>))`;


val _ = Define `
 ((get_SV39_Vaddr_bits:SV39_Vaddr ->(39)words$word) v=
    ((subrange_vec_dec v.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 38 : int):ii) (( 0 : int):ii)  :  39 words$word)))`;


val _ = Define `
 ((set_SV39_Vaddr_bits:((regstate),(register_value),(SV39_Vaddr))register_ref ->(39)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_Vaddr_SV39_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 38 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 38 : int):ii) (( 0 : int):ii)  :  39 words$word))
            :  39 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_Vaddr_bits:SV39_Vaddr ->(39)words$word -> SV39_Vaddr) v x=
    (( v with<|
     SV39_Vaddr_SV39_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 38 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 38 : int):ii) (( 0 : int):ii)  :  39 words$word))
          :  39 words$word)) |>)))`;


val _ = Define `
 ((get_SV39_Vaddr_VPNi:SV39_Vaddr ->(27)words$word) v=
    ((subrange_vec_dec v.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 38 : int):ii) (( 12 : int):ii)  :  27 words$word)))`;


val _ = Define `
 ((set_SV39_Vaddr_VPNi:((regstate),(register_value),(SV39_Vaddr))register_ref ->(27)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_Vaddr_SV39_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 38 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 26 : int):ii) (( 0 : int):ii)  :  27 words$word))
            :  39 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_Vaddr_VPNi:SV39_Vaddr ->(27)words$word -> SV39_Vaddr) v x=
    (( v with<|
     SV39_Vaddr_SV39_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 38 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 26 : int):ii) (( 0 : int):ii)  :  27 words$word))
          :  39 words$word)) |>)))`;


val _ = Define `
 ((get_SV39_Vaddr_PgOfs:SV39_Vaddr ->(12)words$word) v=
    ((subrange_vec_dec v.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word)))`;


val _ = Define `
 ((set_SV39_Vaddr_PgOfs:((regstate),(register_value),(SV39_Vaddr))register_ref ->(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_Vaddr_SV39_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
            :  39 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_Vaddr_PgOfs:SV39_Vaddr ->(12)words$word -> SV39_Vaddr) v x=
    (( v with<|
     SV39_Vaddr_SV39_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_Vaddr_SV39_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
          :  39 words$word)) |>)))`;


(*val Mk_SV39_Paddr : mword ty56 -> SV39_Paddr*)

val _ = Define `
 ((Mk_SV39_Paddr:(56)words$word -> SV39_Paddr) v=
    (<| SV39_Paddr_SV39_Paddr_chunk_0 := ((subrange_vec_dec v (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word)) |>))`;


val _ = Define `
 ((get_SV39_Paddr_bits:SV39_Paddr ->(56)words$word) v=
    ((subrange_vec_dec v.SV39_Paddr_SV39_Paddr_chunk_0 (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word)))`;


val _ = Define `
 ((set_SV39_Paddr_bits:((regstate),(register_value),(SV39_Paddr))register_ref ->(56)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_Paddr_SV39_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_Paddr_SV39_Paddr_chunk_0 (( 55 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word))
            :  56 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_Paddr_bits:SV39_Paddr ->(56)words$word -> SV39_Paddr) v x=
    (( v with<|
     SV39_Paddr_SV39_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_Paddr_SV39_Paddr_chunk_0 (( 55 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word))
          :  56 words$word)) |>)))`;


val _ = Define `
 ((get_SV39_Paddr_PPNi:SV39_Paddr ->(44)words$word) v=
    ((subrange_vec_dec v.SV39_Paddr_SV39_Paddr_chunk_0 (( 55 : int):ii) (( 12 : int):ii)  :  44 words$word)))`;


val _ = Define `
 ((set_SV39_Paddr_PPNi:((regstate),(register_value),(SV39_Paddr))register_ref ->(44)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_Paddr_SV39_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_Paddr_SV39_Paddr_chunk_0 (( 55 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
            :  56 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_Paddr_PPNi:SV39_Paddr ->(44)words$word -> SV39_Paddr) v x=
    (( v with<|
     SV39_Paddr_SV39_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_Paddr_SV39_Paddr_chunk_0 (( 55 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
          :  56 words$word)) |>)))`;


val _ = Define `
 ((get_SV39_Paddr_PgOfs:SV39_Paddr ->(12)words$word) v=
    ((subrange_vec_dec v.SV39_Paddr_SV39_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word)))`;


val _ = Define `
 ((set_SV39_Paddr_PgOfs:((regstate),(register_value),(SV39_Paddr))register_ref ->(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_Paddr_SV39_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_Paddr_SV39_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
            :  56 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_Paddr_PgOfs:SV39_Paddr ->(12)words$word -> SV39_Paddr) v x=
    (( v with<|
     SV39_Paddr_SV39_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_Paddr_SV39_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
          :  56 words$word)) |>)))`;


(*val Mk_SV39_PTE : mword ty64 -> SV39_PTE*)

val _ = Define `
 ((Mk_SV39_PTE:(64)words$word -> SV39_PTE) v=
    (<| SV39_PTE_SV39_PTE_chunk_0 := ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)) |>))`;


val _ = Define `
 ((get_SV39_PTE_bits:SV39_PTE ->(64)words$word) v=
    ((subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)))`;


val _ = Define `
 ((set_SV39_PTE_bits:((regstate),(register_value),(SV39_PTE))register_ref ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_PTE_SV39_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_PTE_SV39_PTE_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_PTE_bits:SV39_PTE ->(64)words$word -> SV39_PTE) v x=
    (( v with<|
     SV39_PTE_SV39_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
          :  64 words$word)) |>)))`;


(*val _get_SV39_PTE_Ext : SV39_PTE -> mword ty10*)

val _ = Define `
 ((get_SV39_PTE_Ext:SV39_PTE ->(10)words$word) v=
    ((subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 63 : int):ii) (( 54 : int):ii)  :  10 words$word)))`;


(*val _set_SV39_PTE_Ext : register_ref regstate register_value SV39_PTE -> mword ty10 -> M unit*)

val _ = Define `
 ((set_SV39_PTE_Ext:((regstate),(register_value),(SV39_PTE))register_ref ->(10)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_PTE_SV39_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_PTE_SV39_PTE_chunk_0 (( 63 : int):ii) (( 54 : int):ii)
             ((subrange_vec_dec v (( 9 : int):ii) (( 0 : int):ii)  :  10 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


(*val _update_SV39_PTE_Ext : SV39_PTE -> mword ty10 -> SV39_PTE*)

val _ = Define `
 ((update_SV39_PTE_Ext:SV39_PTE ->(10)words$word -> SV39_PTE) v x=
    (( v with<|
     SV39_PTE_SV39_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 63 : int):ii) (( 54 : int):ii)
           ((subrange_vec_dec x (( 9 : int):ii) (( 0 : int):ii)  :  10 words$word))
          :  64 words$word)) |>)))`;


(*val _update_SV48_PTE_Ext : SV48_PTE -> mword ty10 -> SV48_PTE*)

(*val _get_SV48_PTE_Ext : SV48_PTE -> mword ty10*)

(*val _set_SV48_PTE_Ext : register_ref regstate register_value SV48_PTE -> mword ty10 -> M unit*)

val _ = Define `
 ((get_SV39_PTE_PPNi:SV39_PTE ->(44)words$word) v=
    ((subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 53 : int):ii) (( 10 : int):ii)  :  44 words$word)))`;


val _ = Define `
 ((set_SV39_PTE_PPNi:((regstate),(register_value),(SV39_PTE))register_ref ->(44)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_PTE_SV39_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_PTE_SV39_PTE_chunk_0 (( 53 : int):ii) (( 10 : int):ii)
             ((subrange_vec_dec v (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_PTE_PPNi:SV39_PTE ->(44)words$word -> SV39_PTE) v x=
    (( v with<|
     SV39_PTE_SV39_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 53 : int):ii) (( 10 : int):ii)
           ((subrange_vec_dec x (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_SV39_PTE_RSW:SV39_PTE ->(2)words$word) v=  ((subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)  :  2 words$word)))`;


val _ = Define `
 ((set_SV39_PTE_RSW:((regstate),(register_value),(SV39_PTE))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_PTE_SV39_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_PTE_SV39_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_PTE_RSW:SV39_PTE ->(2)words$word -> SV39_PTE) v x=
    (( v with<|
     SV39_PTE_SV39_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_SV39_PTE_BITS:SV39_PTE ->(8)words$word) v=  ((subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))`;


val _ = Define `
 ((set_SV39_PTE_BITS:((regstate),(register_value),(SV39_PTE))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV39_PTE_SV39_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV39_PTE_SV39_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV39_PTE_BITS:SV39_PTE ->(8)words$word -> SV39_PTE) v x=
    (( v with<|
     SV39_PTE_SV39_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV39_PTE_SV39_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
((SV48_LEVEL_BITS:int)=  ((( 9 : int):ii)))`;


val _ = Define `
((SV48_LEVELS:int)=  ((( 4 : int):ii)))`;


val _ = Define `
((PTE48_LOG_SIZE:int)=  ((( 3 : int):ii)))`;


val _ = Define `
((PTE48_SIZE:int)=  ((( 8 : int):ii)))`;


(*val Mk_SV48_Vaddr : mword ty48 -> SV48_Vaddr*)

val _ = Define `
 ((Mk_SV48_Vaddr:(48)words$word -> SV48_Vaddr) v=
    (<| SV48_Vaddr_SV48_Vaddr_chunk_0 := ((subrange_vec_dec v (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word)) |>))`;


val _ = Define `
 ((get_SV48_Vaddr_bits:SV48_Vaddr ->(48)words$word) v=
    ((subrange_vec_dec v.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word)))`;


val _ = Define `
 ((set_SV48_Vaddr_bits:((regstate),(register_value),(SV48_Vaddr))register_ref ->(48)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_Vaddr_SV48_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 47 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word))
            :  48 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_Vaddr_bits:SV48_Vaddr ->(48)words$word -> SV48_Vaddr) v x=
    (( v with<|
     SV48_Vaddr_SV48_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 47 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 47 : int):ii) (( 0 : int):ii)  :  48 words$word))
          :  48 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_Vaddr_VPNi:SV48_Vaddr ->(27)words$word) v=
    ((subrange_vec_dec v.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 38 : int):ii) (( 12 : int):ii)  :  27 words$word)))`;


val _ = Define `
 ((set_SV48_Vaddr_VPNi:((regstate),(register_value),(SV48_Vaddr))register_ref ->(27)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_Vaddr_SV48_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 38 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 26 : int):ii) (( 0 : int):ii)  :  27 words$word))
            :  48 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_Vaddr_VPNi:SV48_Vaddr ->(27)words$word -> SV48_Vaddr) v x=
    (( v with<|
     SV48_Vaddr_SV48_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 38 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 26 : int):ii) (( 0 : int):ii)  :  27 words$word))
          :  48 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_Vaddr_PgOfs:SV48_Vaddr ->(12)words$word) v=
    ((subrange_vec_dec v.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word)))`;


val _ = Define `
 ((set_SV48_Vaddr_PgOfs:((regstate),(register_value),(SV48_Vaddr))register_ref ->(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_Vaddr_SV48_Vaddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
            :  48 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_Vaddr_PgOfs:SV48_Vaddr ->(12)words$word -> SV48_Vaddr) v x=
    (( v with<|
     SV48_Vaddr_SV48_Vaddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_Vaddr_SV48_Vaddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
          :  48 words$word)) |>)))`;


(*val Mk_SV48_Paddr : mword ty56 -> SV48_Paddr*)

val _ = Define `
 ((Mk_SV48_Paddr:(56)words$word -> SV48_Paddr) v=
    (<| SV48_Paddr_SV48_Paddr_chunk_0 := ((subrange_vec_dec v (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word)) |>))`;


val _ = Define `
 ((get_SV48_Paddr_bits:SV48_Paddr ->(56)words$word) v=
    ((subrange_vec_dec v.SV48_Paddr_SV48_Paddr_chunk_0 (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word)))`;


val _ = Define `
 ((set_SV48_Paddr_bits:((regstate),(register_value),(SV48_Paddr))register_ref ->(56)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_Paddr_SV48_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_Paddr_SV48_Paddr_chunk_0 (( 55 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word))
            :  56 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_Paddr_bits:SV48_Paddr ->(56)words$word -> SV48_Paddr) v x=
    (( v with<|
     SV48_Paddr_SV48_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_Paddr_SV48_Paddr_chunk_0 (( 55 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 55 : int):ii) (( 0 : int):ii)  :  56 words$word))
          :  56 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_Paddr_PPNi:SV48_Paddr ->(44)words$word) v=
    ((subrange_vec_dec v.SV48_Paddr_SV48_Paddr_chunk_0 (( 55 : int):ii) (( 12 : int):ii)  :  44 words$word)))`;


val _ = Define `
 ((set_SV48_Paddr_PPNi:((regstate),(register_value),(SV48_Paddr))register_ref ->(44)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_Paddr_SV48_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_Paddr_SV48_Paddr_chunk_0 (( 55 : int):ii) (( 12 : int):ii)
             ((subrange_vec_dec v (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
            :  56 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_Paddr_PPNi:SV48_Paddr ->(44)words$word -> SV48_Paddr) v x=
    (( v with<|
     SV48_Paddr_SV48_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_Paddr_SV48_Paddr_chunk_0 (( 55 : int):ii) (( 12 : int):ii)
           ((subrange_vec_dec x (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
          :  56 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_Paddr_PgOfs:SV48_Paddr ->(12)words$word) v=
    ((subrange_vec_dec v.SV48_Paddr_SV48_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word)))`;


val _ = Define `
 ((set_SV48_Paddr_PgOfs:((regstate),(register_value),(SV48_Paddr))register_ref ->(12)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_Paddr_SV48_Paddr_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_Paddr_SV48_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
            :  56 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_Paddr_PgOfs:SV48_Paddr ->(12)words$word -> SV48_Paddr) v x=
    (( v with<|
     SV48_Paddr_SV48_Paddr_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_Paddr_SV48_Paddr_chunk_0 (( 11 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 11 : int):ii) (( 0 : int):ii)  :  12 words$word))
          :  56 words$word)) |>)))`;


(*val Mk_SV48_PTE : mword ty64 -> SV48_PTE*)

val _ = Define `
 ((Mk_SV48_PTE:(64)words$word -> SV48_PTE) v=
    (<| SV48_PTE_SV48_PTE_chunk_0 := ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)) |>))`;


val _ = Define `
 ((get_SV48_PTE_bits:SV48_PTE ->(64)words$word) v=
    ((subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word)))`;


val _ = Define `
 ((set_SV48_PTE_bits:((regstate),(register_value),(SV48_PTE))register_ref ->(64)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_PTE_SV48_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_PTE_SV48_PTE_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_PTE_bits:SV48_PTE ->(64)words$word -> SV48_PTE) v x=
    (( v with<|
     SV48_PTE_SV48_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 63 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 63 : int):ii) (( 0 : int):ii)  :  64 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_PTE_Ext:SV48_PTE ->(10)words$word) v=
    ((subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 63 : int):ii) (( 54 : int):ii)  :  10 words$word)))`;


val _ = Define `
 ((set_SV48_PTE_Ext:((regstate),(register_value),(SV48_PTE))register_ref ->(10)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_PTE_SV48_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_PTE_SV48_PTE_chunk_0 (( 63 : int):ii) (( 54 : int):ii)
             ((subrange_vec_dec v (( 9 : int):ii) (( 0 : int):ii)  :  10 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_PTE_Ext:SV48_PTE ->(10)words$word -> SV48_PTE) v x=
    (( v with<|
     SV48_PTE_SV48_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 63 : int):ii) (( 54 : int):ii)
           ((subrange_vec_dec x (( 9 : int):ii) (( 0 : int):ii)  :  10 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_PTE_PPNi:SV48_PTE ->(44)words$word) v=
    ((subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 53 : int):ii) (( 10 : int):ii)  :  44 words$word)))`;


val _ = Define `
 ((set_SV48_PTE_PPNi:((regstate),(register_value),(SV48_PTE))register_ref ->(44)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_PTE_SV48_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_PTE_SV48_PTE_chunk_0 (( 53 : int):ii) (( 10 : int):ii)
             ((subrange_vec_dec v (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_PTE_PPNi:SV48_PTE ->(44)words$word -> SV48_PTE) v x=
    (( v with<|
     SV48_PTE_SV48_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 53 : int):ii) (( 10 : int):ii)
           ((subrange_vec_dec x (( 43 : int):ii) (( 0 : int):ii)  :  44 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_PTE_RSW:SV48_PTE ->(2)words$word) v=  ((subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)  :  2 words$word)))`;


val _ = Define `
 ((set_SV48_PTE_RSW:((regstate),(register_value),(SV48_PTE))register_ref ->(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_PTE_SV48_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_PTE_SV48_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)
             ((subrange_vec_dec v (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_PTE_RSW:SV48_PTE ->(2)words$word -> SV48_PTE) v x=
    (( v with<|
     SV48_PTE_SV48_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 9 : int):ii) (( 8 : int):ii)
           ((subrange_vec_dec x (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word))
          :  64 words$word)) |>)))`;


val _ = Define `
 ((get_SV48_PTE_BITS:SV48_PTE ->(8)words$word) v=  ((subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)))`;


val _ = Define `
 ((set_SV48_PTE_BITS:((regstate),(register_value),(SV48_PTE))register_ref ->(8)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) r_ref v=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS r_ref) (\ r . 
   let r =
     (( r with<|
       SV48_PTE_SV48_PTE_chunk_0 :=
         ((update_subrange_vec_dec r.SV48_PTE_SV48_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
             ((subrange_vec_dec v (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
            :  64 words$word)) |>)) in
   sail2_state_monad$write_regS r_ref r)))`;


val _ = Define `
 ((update_SV48_PTE_BITS:SV48_PTE ->(8)words$word -> SV48_PTE) v x=
    (( v with<|
     SV48_PTE_SV48_PTE_chunk_0 :=
       ((update_subrange_vec_dec v.SV48_PTE_SV48_PTE_chunk_0 (( 7 : int):ii) (( 0 : int):ii)
           ((subrange_vec_dec x (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
          :  64 words$word)) |>)))`;


(*val make_TLB_Entry : forall 'asidlen 'palen 'ptelen 'valen. Size 'asidlen, Size 'palen, Size 'ptelen, Size 'valen => mword 'asidlen -> bool -> mword 'valen -> mword 'palen -> mword 'ptelen -> ii -> mword 'palen -> ii -> M (TLB_Entry 'asidlen 'valen 'palen 'ptelen)*)

val _ = Define `
 ((make_TLB_Entry:'asidlen words$word -> bool -> 'valen words$word -> 'palen words$word -> 'ptelen words$word -> int -> 'palen words$word -> int ->(regstate)sail2_state_monad$sequential_state ->(((('asidlen,'valen,'palen,'ptelen)TLB_Entry),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) asid global vAddr pAddr pte level pteAddr levelBitSize=
    (let (shift : ii) = (PAGESIZE_BITS + ((level * levelBitSize))) in
   let (vAddrMask :  'valen words$word) =
     ((sub_vec_int
        ((shiftl
            ((xor_vec vAddr
                ((xor_vec vAddr ((EXTZ ((int_of_num (words$word_len vAddr))) (0b1w :  1 words$word)  :  'valen words$word))
                   :  'valen words$word))
               :  'valen words$word)) shift
           :  'valen words$word)) (( 1 : int):ii)
       :  'valen words$word)) in
   let (vMatchMask :  'valen words$word) = ((not_vec vAddrMask  :  'valen words$word)) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__0 :  64 words$word) . 
   sail2_state_monad$returnS (<| TLB_Entry_asid := asid; 
              TLB_Entry_global := global; 
              TLB_Entry_pte := pte; 
              TLB_Entry_pteAddr := pteAddr; 
              TLB_Entry_vAddrMask := vAddrMask; 
              TLB_Entry_vMatchMask := vMatchMask; 
              TLB_Entry_vAddr := ((and_vec vAddr vMatchMask  :  'valen words$word)); 
              TLB_Entry_pAddr :=
                ((shiftl ((shiftr pAddr shift  :  'palen words$word)) shift  :  'palen words$word)); 
              TLB_Entry_age := w__0 |>))))`;


(*val match_TLB_Entry : forall 'asidlen 'palen 'ptelen 'valen. Size 'asidlen, Size 'valen => TLB_Entry 'asidlen 'valen 'palen 'ptelen -> mword 'asidlen -> mword 'valen -> bool*)

val _ = Define `
 ((match_TLB_Entry:('asidlen,'valen,'palen,'ptelen)TLB_Entry -> 'asidlen words$word -> 'valen words$word -> bool) ent asid vaddr=
    ((((ent.TLB_Entry_global \/ (((ent.TLB_Entry_asid = asid)))))) /\ (((ent.TLB_Entry_vAddr = ((and_vec ent.TLB_Entry_vMatchMask vaddr  :  'valen words$word)))))))`;


(*val flush_TLB_Entry : forall 'asidlen 'palen 'ptelen 'valen. Size 'asidlen, Size 'valen => TLB_Entry 'asidlen 'valen 'palen 'ptelen -> maybe (mword 'asidlen) -> maybe (mword 'valen) -> bool*)

val _ = Define `
 ((flush_TLB_Entry:('asidlen,'valen,'palen,'ptelen)TLB_Entry ->('asidlen words$word)option ->('valen words$word)option -> bool) e asid addr=
    ((case (asid, addr) of
     (NONE, NONE) => T
   | (NONE, SOME (a)) =>
      (e.TLB_Entry_vAddr = ((and_vec e.TLB_Entry_vMatchMask a  :  'valen words$word)))
   | (SOME (i), NONE) => ((((e.TLB_Entry_asid = i))) /\ ((~ e.TLB_Entry_global)))
   | (SOME (i), SOME (a)) =>
      ((((e.TLB_Entry_asid = i))) /\ ((((((e.TLB_Entry_vAddr = ((and_vec a e.TLB_Entry_vMatchMask  :  'valen words$word))))) /\ ((~ e.TLB_Entry_global))))))
   )))`;


(*val to_phys_addr : mword ty34 -> mword ty32*)

val _ = Define `
 ((to_phys_addr:(34)words$word ->(32)words$word) a=  ((subrange_vec_dec a (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)))`;


(*val walk32 : mword ty32 -> AccessType unit -> Privilege -> bool -> bool -> mword ty34 -> ii -> bool -> unit -> M (PTW_Result (mword ty34) SV32_PTE)*)

 val walk32_defn = Hol_defn "walk32" `
 ((walk32:(32)words$word ->(unit)AccessType -> Privilege -> bool -> bool ->(34)words$word -> int -> bool -> unit ->(regstate)sail2_state_monad$sequential_state ->((((((34)words$word),(SV32_PTE))PTW_Result),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) vaddr ac priv mxr do_sum ptb level global ext_ptw=
    (let va = (Mk_SV32_Vaddr vaddr) in
   let (pt_ofs : paddr32) =
     ((shiftl
        ((EXTZ (( 34 : int):ii)
            ((subrange_vec_dec
                ((shiftr ((get_SV32_Vaddr_VPNi va  :  20 words$word))
                    ((level * SV32_LEVEL_BITS))
                   :  20 words$word)) ((SV32_LEVEL_BITS - (( 1 : int):ii))) (( 0 : int):ii)
               :  10 words$word))
           :  34 words$word)) PTE32_LOG_SIZE
       :  34 words$word)) in
   let pte_addr = ((add_vec ptb pt_ofs  :  34 words$word)) in sail2_state_monad$bindS
   (mem_read_priv (Read Data) Supervisor ((to_phys_addr pte_addr  :  32 words$word)) (( 4 : int):ii) F F
      F
     : ( ( 32 words$word)MemoryOpResult) M) (\ (w__0 : ( 32 words$word) MemoryOpResult) . 
   (case w__0 of
     MemException (_) => sail2_state_monad$returnS (PTW_Failure (PTW_Access () , ext_ptw))
   | MemValue (v) =>
      let pte = (Mk_SV32_PTE v) in
      let pbits = ((get_SV32_PTE_BITS pte  :  8 words$word)) in
      let (ext_pte : extPte) = default_sv32_ext_pte in
      let pattr = (Mk_PTE_Bits pbits) in
      let is_global =
        (global \/ (((((get_PTE_Bits_G pattr  :  1 words$word)) = (0b1w :  1 words$word))))) in
      if ((isInvalidPTE pbits ext_pte)) then sail2_state_monad$returnS (PTW_Failure (PTW_Invalid_PTE () , ext_ptw))
      else if ((isPTEPtr pbits ext_pte)) then
        if ((level > (( 0 : int):ii))) then
          (walk32 vaddr ac priv mxr do_sum
             ((shiftl ((EXTZ (( 34 : int):ii) ((get_SV32_PTE_PPNi pte  :  22 words$word))  :  34 words$word))
                 PAGESIZE_BITS
                :  34 words$word)) ((level - (( 1 : int):ii))) is_global ext_ptw
            : ( (( 34 words$word), SV32_PTE)PTW_Result) M)
        else sail2_state_monad$returnS (PTW_Failure (PTW_Invalid_PTE () , ext_ptw))
      else sail2_state_monad$bindS
        (checkPTEPermission ac priv mxr do_sum pattr ext_pte ext_ptw) (\ (w__3 : PTE_Check) . 
        sail2_state_monad$returnS ((case w__3 of
          PTE_Check_Failure ((ext_ptw, ext_ptw_fail)) =>
           PTW_Failure (ext_get_ptw_error ext_ptw_fail, ext_ptw)
        | PTE_Check_Success (ext_ptw) =>
           if ((level > (( 0 : int):ii))) then
             let mask =
               ((sub_vec_int
                  ((shiftl
                      ((xor_vec ((get_SV32_PTE_PPNi pte  :  22 words$word))
                          ((xor_vec ((get_SV32_PTE_PPNi pte  :  22 words$word))
                              ((EXTZ (( 22 : int):ii) (0b1w :  1 words$word)  :  22 words$word))
                             :  22 words$word))
                         :  22 words$word)) ((level * SV32_LEVEL_BITS))
                     :  22 words$word)) (( 1 : int):ii)
                 :  22 words$word)) in
             if (((((and_vec ((get_SV32_PTE_PPNi pte  :  22 words$word)) mask  :  22 words$word)) <> ((EXTZ (( 22 : int):ii) (0b0w :  1 words$word)  :  22 words$word))))) then
               PTW_Failure (PTW_Misaligned () , ext_ptw)
             else
               let ppn =
                 ((or_vec ((get_SV32_PTE_PPNi pte  :  22 words$word))
                    ((and_vec
                        ((EXTZ (( 22 : int):ii) ((get_SV32_Vaddr_VPNi va  :  20 words$word))  :  22 words$word))
                        mask
                       :  22 words$word))
                   :  22 words$word)) in
               PTW_Success ((concat_vec ppn ((get_SV32_Vaddr_PgOfs va  :  12 words$word))  :  34 words$word),
                            pte,
                            pte_addr,
                            level,
                            is_global,
                            ext_ptw)
           else
             PTW_Success ((concat_vec ((get_SV32_PTE_PPNi pte  :  22 words$word))
                             ((get_SV32_Vaddr_PgOfs va  :  12 words$word))
                            :  34 words$word),
                          pte,
                          pte_addr,
                          level,
                          is_global,
                          ext_ptw)
        )))
   ))))`;

val _ = Lib.with_flag (computeLib.auto_import_definitions, false) Defn.save_defn walk32_defn;

(*val lookup_TLB32 : mword ty9 -> mword ty32 -> M (maybe ((ii * TLB_Entry ty9 ty32 ty34 ty32)))*)

val _ = Define `
 ((lookup_TLB32:(9)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->((((int#((9),(32),(34),(32))TLB_Entry)option),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) asid vaddr=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS tlb32_ref) (\ (w__0 :  ( (9, 32, 34, 32)TLB_Entry)option) . 
   sail2_state_monad$returnS ((case w__0 of
     NONE => NONE
   | SOME (e) => if ((match_TLB_Entry e asid vaddr)) then SOME ((( 0 : int):ii), e) else NONE
   )))))`;


(*val add_to_TLB32 : mword ty9 -> mword ty32 -> mword ty34 -> SV32_PTE -> mword ty34 -> ii -> bool -> M unit*)

val _ = Define `
 ((add_to_TLB32:(9)words$word ->(32)words$word ->(34)words$word -> SV32_PTE ->(34)words$word -> int -> bool ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) asid vAddr pAddr pte pteAddr level global=  (sail2_state_monad$bindS
   (make_TLB_Entry asid global vAddr pAddr ((get_SV32_PTE_bits pte  :  32 words$word)) level pteAddr
     SV32_LEVEL_BITS) (\ (ent : TLB32_Entry) . 
   sail2_state_monad$write_regS tlb32_ref (SOME ent))))`;


(*val write_TLB32 : ii -> TLB_Entry ty9 ty32 ty34 ty32 -> M unit*)

val _ = Define `
 ((write_TLB32:int ->((9),(32),(34),(32))TLB_Entry ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (idx : ii) (ent : TLB32_Entry)=  (sail2_state_monad$write_regS tlb32_ref (SOME ent)))`;


(*val flush_TLB32 : maybe (mword ty9) -> maybe (mword ty32) -> M unit*)

val _ = Define `
 ((flush_TLB32:((9)words$word)option ->((32)words$word)option ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) asid addr=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS tlb32_ref) (\ (w__0 :  ( (9, 32, 34, 32)TLB_Entry)option) . 
   (case w__0 of
     NONE => sail2_state_monad$returnS () 
   | SOME (e) => if ((flush_TLB_Entry e asid addr)) then sail2_state_monad$write_regS tlb32_ref NONE else sail2_state_monad$returnS () 
   ))))`;


(*val translate32 : mword ty9 -> mword ty34 -> mword ty32 -> AccessType unit -> Privilege -> bool -> bool -> ii -> unit -> M (TR_Result (mword ty34) PTW_Error)*)

val _ = Define `
 ((translate32:(9)words$word ->(34)words$word ->(32)words$word ->(unit)AccessType -> Privilege -> bool -> bool -> int -> unit ->(regstate)sail2_state_monad$sequential_state ->((((((34)words$word),(PTW_Error))TR_Result),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) asid ptb vAddr ac priv mxr do_sum level ext_ptw=  (sail2_state_monad$bindS
   (lookup_TLB32 asid vAddr) (\ (w__0 :  ((ii # (9, 32, 34, 32) TLB_Entry))option) . 
   (case w__0 of
     SOME ((idx, ent)) =>
      let pte = (Mk_SV32_PTE ent.TLB_Entry_pte) in
      let (ext_pte : extPte) = ((zeros_implicit (( 10 : int):ii)  :  10 words$word)) in
      let pteBits = (Mk_PTE_Bits ((get_SV32_PTE_BITS pte  :  8 words$word))) in sail2_state_monad$bindS
      (checkPTEPermission ac priv mxr do_sum pteBits ext_pte ext_ptw) (\ (w__1 : PTE_Check) . 
      (case w__1 of
        PTE_Check_Failure ((ext_ptw, ext_ptw_fail)) =>
         sail2_state_monad$returnS (TR_Failure (ext_get_ptw_error ext_ptw_fail, ext_ptw))
      | PTE_Check_Success (ext_ptw) =>
         (case ((update_PTE_Bits pteBits ac ext_pte  :  ((PTE_Bits #  10 words$word))option)) of
           NONE =>
            sail2_state_monad$returnS (TR_Address ((or_vec ent.TLB_Entry_pAddr
                                   ((EXTZ (( 34 : int):ii)
                                       ((and_vec vAddr ent.TLB_Entry_vAddrMask  :  32 words$word))
                                      :  34 words$word))
                                  :  34 words$word),
                                ext_ptw))
         | SOME ((pbits, ext)) =>
            if ((~ ((plat_enable_dirty_update () )))) then
              sail2_state_monad$returnS (TR_Failure (PTW_PTE_Update () , ext_ptw))
            else
              let n_pte = (update_SV32_PTE_BITS pte ((get_PTE_Bits_bits pbits  :  8 words$word))) in
              let (n_ent : TLB32_Entry) = ent in
              let n_ent =
                (( n_ent with<| TLB_Entry_pte := ((get_SV32_PTE_bits n_pte  :  32 words$word)) |>)) in sail2_state_monad$bindS (sail2_state_monad$seqS
              (write_TLB32 idx n_ent)
              (mem_write_value_priv
                ((to_phys_addr ((EXTZ (( 34 : int):ii) ent.TLB_Entry_pteAddr  :  34 words$word))  :  32 words$word))
                (( 4 : int):ii) ((get_SV32_PTE_bits n_pte  :  32 words$word)) Supervisor F F F)) (\ (w__2 : bool
                MemoryOpResult) .  sail2_state_monad$seqS
              (case w__2 of
                MemValue (_) => sail2_state_monad$returnS () 
              | MemException (e) => internal_error "invalid physical address in TLB"
              )
              (sail2_state_monad$returnS (TR_Address ((or_vec ent.TLB_Entry_pAddr
                                     ((EXTZ (( 34 : int):ii)
                                         ((and_vec vAddr ent.TLB_Entry_vAddrMask  :  32 words$word))
                                        :  34 words$word))
                                    :  34 words$word),
                                  ext_ptw))))
         )
      ))
   | NONE => sail2_state_monad$bindS
      (walk32 vAddr ac priv mxr do_sum ptb level F ext_ptw
        : ( (( 34 words$word), SV32_PTE)PTW_Result) M) (\ (w__6 : (( 34 words$word), SV32_PTE) PTW_Result) . 
      (case w__6 of
        PTW_Failure ((f, ext_ptw)) => sail2_state_monad$returnS (TR_Failure (f, ext_ptw))
      | PTW_Success ((pAddr, pte, pteAddr, level, global, ext_ptw)) =>
         (case ((update_PTE_Bits ((Mk_PTE_Bits ((get_SV32_PTE_BITS pte  :  8 words$word)))) ac
                   ((zeros_implicit (( 10 : int):ii)  :  10 words$word))
                  :  ((PTE_Bits #  10 words$word))option)) of
           NONE => sail2_state_monad$seqS
            (add_to_TLB32 asid vAddr pAddr pte pteAddr level global)
            (sail2_state_monad$returnS (TR_Address (pAddr, ext_ptw)))
         | SOME ((pbits, ext)) =>
            if ((~ ((plat_enable_dirty_update () )))) then
              sail2_state_monad$returnS (TR_Failure (PTW_PTE_Update () , ext_ptw))
            else
              let (w_pte : SV32_PTE) =
                (update_SV32_PTE_BITS pte ((get_PTE_Bits_bits pbits  :  8 words$word))) in sail2_state_monad$bindS
              (mem_write_value_priv ((to_phys_addr pteAddr  :  32 words$word)) (( 4 : int):ii)
                ((get_SV32_PTE_bits w_pte  :  32 words$word)) Supervisor F F F) (\ (w__7 : bool
                MemoryOpResult) . 
              (case w__7 of
                MemValue (_) => sail2_state_monad$seqS
                 (add_to_TLB32 asid vAddr pAddr w_pte pteAddr level global)
                 (sail2_state_monad$returnS (TR_Address (pAddr, ext_ptw)))
              | MemException (e) => sail2_state_monad$returnS (TR_Failure (PTW_Access () , ext_ptw))
              ))
         )
      ))
   ))))`;


(*val init_vmem_sv32 : unit -> M unit*)

val _ = Define `
 ((init_vmem_sv32:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$write_regS tlb32_ref NONE))`;


(*val legalize_satp : Architecture -> mword ty32 -> mword ty32 -> mword ty32*)

val _ = Define `
 ((legalize_satp:Architecture ->(32)words$word ->(32)words$word ->(32)words$word) (a : Architecture) (o1 : xlenbits) (v : xlenbits)=
    ((legalize_satp32 a o1 v  :  32 words$word)))`;


(*val translationMode : Privilege -> M SATPMode*)

val _ = Define `
 ((translationMode:Privilege ->(regstate)sail2_state_monad$sequential_state ->(((SATPMode),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) priv=
    (if (((priv = Machine))) then sail2_state_monad$returnS Sbare
   else sail2_state_monad$bindS
     (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) . 
     let arch = (architecture ((get_mstatus_SXL w__0  :  2 words$word))) in
     (case arch of
       SOME (RV32) => sail2_state_monad$bindS
        (sail2_state_monad$read_regS satp_ref  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
        let s = (Mk_Satp32 ((subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))) in
        sail2_state_monad$returnS (if (((((get_Satp32_Mode s  :  1 words$word)) = (0b0w :  1 words$word)))) then Sbare
                else Sv32))
     | _ => internal_error "unsupported address translation arch"
     ))))`;


(*val translateAddr_priv : mword ty32 -> AccessType unit -> Privilege -> M (TR_Result (mword ty32) ExceptionType)*)

val _ = Define `
 ((translateAddr_priv:(32)words$word ->(unit)AccessType -> Privilege ->(regstate)sail2_state_monad$sequential_state ->((((((32)words$word),(ExceptionType))TR_Result),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) vAddr ac effPriv=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) . 
   let (mxr : bool) = (((get_Mstatus_MXR w__0  :  1 words$word)) = (0b1w :  1 words$word)) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS mstatus_ref) (\ (w__1 : Mstatus) . 
   let (do_sum : bool) = (((get_Mstatus_SUM w__1  :  1 words$word)) = (0b1w :  1 words$word)) in sail2_state_monad$bindS
   (translationMode effPriv) (\ (mode : SATPMode) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS satp_ref  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
   let asid = ((curAsid32 w__2  :  9 words$word)) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS satp_ref  : ( 32 words$word) M) (\ (w__3 :  32 words$word) . 
   let ptb = ((curPTB32 w__3  :  34 words$word)) in
   let (ext_ptw : ext_ptw) = init_ext_ptw in
   (case mode of
     Sbare => sail2_state_monad$returnS (TR_Address (vAddr, ext_ptw))
   | Sv32 => sail2_state_monad$bindS
      (translate32 asid ptb vAddr ac effPriv mxr do_sum ((SV32_LEVELS - (( 1 : int):ii))) ext_ptw
        : ( (( 34 words$word), PTW_Error)TR_Result) M) (\ (w__4 : (( 34 words$word), PTW_Error) TR_Result) . 
      sail2_state_monad$returnS ((case w__4 of
        TR_Address ((pa, ext_ptw)) => TR_Address ((to_phys_addr pa  :  32 words$word), ext_ptw)
      | TR_Failure ((f, ext_ptw)) => TR_Failure (translationException ac f, ext_ptw)
      )))
   | _ =>
      (internal_error "unsupported address translation scheme"
        : ( (( 32 words$word), ExceptionType)TR_Result) M)
   ))))))))`;


(*val translateAddr : mword ty32 -> AccessType unit -> M (TR_Result (mword ty32) ExceptionType)*)

val _ = Define `
 ((translateAddr:(32)words$word ->(unit)AccessType ->(regstate)sail2_state_monad$sequential_state ->((((((32)words$word),(ExceptionType))TR_Result),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) vAddr ac=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (effectivePrivilege ac w__0 w__1) (\ (w__2 : Privilege) . 
   (translateAddr_priv vAddr ac w__2  : ( (( 32 words$word), ExceptionType)TR_Result) M))))))`;


(*val flush_TLB : maybe (mword ty32) -> maybe (mword ty32) -> M unit*)

val _ = Define `
 ((flush_TLB:((32)words$word)option ->((32)words$word)option ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) asid_xlen addr_xlen=
    (let (asid :  asid32 option) =
     ((case asid_xlen of
       NONE => NONE
     | SOME (a) => SOME ((subrange_vec_dec a (( 8 : int):ii) (( 0 : int):ii)  :  9 words$word))
     )) in
   flush_TLB32 asid addr_xlen))`;


(*val init_vmem : unit -> M unit*)

val _ = Define `
 ((init_vmem:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (init_vmem_sv32 () ))`;


(*val execute : ast -> M Retired*)

(*val assembly_forwards : ast -> M string*)

(*val assembly_backwards : string -> M ast*)

(*val assembly_forwards_matches : ast -> bool*)

(*val assembly_backwards_matches : string -> bool*)

(*val assembly_matches_prefix : string -> maybe ((ast * ii))*)

(*val encdec_forwards : ast -> M (mword ty32)*)

(*val encdec_backwards : mword ty32 -> M ast*)

(*val encdec_forwards_matches : ast -> M bool*)

(*val encdec_backwards_matches : mword ty32 -> M bool*)

(*val encdec_compressed_forwards : ast -> M (mword ty16)*)

(*val encdec_compressed_backwards : mword ty16 -> M ast*)

(*val encdec_compressed_forwards_matches : ast -> M bool*)

(*val encdec_compressed_backwards_matches : mword ty16 -> M bool*)

(*val encdec_uop_forwards : uop -> mword ty7*)

(*val encdec_uop_backwards : mword ty7 -> M uop*)

(*val encdec_uop_forwards_matches : uop -> bool*)

(*val encdec_uop_backwards_matches : mword ty7 -> bool*)

val _ = Define `
 ((encdec_uop_forwards:uop ->(7)words$word) arg_=
    ((case arg_ of
     RISCV_LUI => (0b0110111w :  7 words$word)
   | RISCV_AUIPC => (0b0010111w :  7 words$word)
   )))`;


val _ = Define `
 ((encdec_uop_backwards:(7)words$word ->(regstate)sail2_state_monad$sequential_state ->(((uop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b0110111w :  7 words$word)))) then sail2_state_monad$returnS RISCV_LUI
   else if (((b__0 = (0b0010111w :  7 words$word)))) then sail2_state_monad$returnS RISCV_AUIPC
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_uop_forwards_matches:uop -> bool) arg_= 
  ((case arg_ of   RISCV_LUI => T | RISCV_AUIPC => T )))`;


val _ = Define `
 ((encdec_uop_backwards_matches:(7)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b0110111w :  7 words$word)))) then T
   else if (((b__0 = (0b0010111w :  7 words$word)))) then T
   else F))`;


(*val utype_mnemonic_forwards : uop -> string*)

(*val utype_mnemonic_backwards : string -> M uop*)

(*val utype_mnemonic_forwards_matches : uop -> bool*)

(*val utype_mnemonic_backwards_matches : string -> bool*)

(*val utype_mnemonic_matches_prefix : string -> maybe ((uop * ii))*)

val _ = Define `
 ((utype_mnemonic_forwards:uop -> string) arg_=  ((case arg_ of   RISCV_LUI => "lui" | RISCV_AUIPC => "auipc" )))`;


val _ = Define `
 ((utype_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((uop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "lui"))) then sail2_state_monad$returnS RISCV_LUI
   else if (((p0_ = "auipc"))) then sail2_state_monad$returnS RISCV_AUIPC
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((utype_mnemonic_forwards_matches:uop -> bool) arg_= 
  ((case arg_ of   RISCV_LUI => T | RISCV_AUIPC => T )))`;


val _ = Define `
 ((utype_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "lui"))) then T
   else if (((p0_ = "auipc"))) then T
   else F))`;


(*val _s761_ : string -> maybe string*)

val _ = Define `
 ((s761_:string ->(string)option) s762_0=
    (let s763_0 = s762_0 in
   if ((string_startswith s763_0 "auipc")) then  
  (case ((string_drop s763_0 ((string_length "auipc")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s757_ : string -> maybe string*)

val _ = Define `
 ((s757_:string ->(string)option) s758_0=
    (let s759_0 = s758_0 in
   if ((string_startswith s759_0 "lui")) then  
  (case ((string_drop s759_0 ((string_length "lui")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((utype_mnemonic_matches_prefix:string ->(uop#int)option) arg_=
    (let s760_0 = arg_ in
   if ((case ((s757_ s760_0)) of   SOME (s_) => T | _ => F )) then  
  (case s757_ s760_0 of
      (SOME (s_)) =>
  SOME (RISCV_LUI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s761_ s760_0)) of   SOME (s_) => T | _ => F )) then  
  (case s761_ s760_0 of
      (SOME (s_)) =>
  SOME (RISCV_AUIPC, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val encdec_bop_forwards : bop -> mword ty3*)

(*val encdec_bop_backwards : mword ty3 -> M bop*)

(*val encdec_bop_forwards_matches : bop -> bool*)

(*val encdec_bop_backwards_matches : mword ty3 -> bool*)

val _ = Define `
 ((encdec_bop_forwards:bop ->(3)words$word) arg_=
    ((case arg_ of
     RISCV_BEQ => (0b000w :  3 words$word)
   | RISCV_BNE => (0b001w :  3 words$word)
   | RISCV_BLT => (0b100w :  3 words$word)
   | RISCV_BGE => (0b101w :  3 words$word)
   | RISCV_BLTU => (0b110w :  3 words$word)
   | RISCV_BGEU => (0b111w :  3 words$word)
   )))`;


val _ = Define `
 ((encdec_bop_backwards:(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((bop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then sail2_state_monad$returnS RISCV_BEQ
   else if (((b__0 = (0b001w :  3 words$word)))) then sail2_state_monad$returnS RISCV_BNE
   else if (((b__0 = (0b100w :  3 words$word)))) then sail2_state_monad$returnS RISCV_BLT
   else if (((b__0 = (0b101w :  3 words$word)))) then sail2_state_monad$returnS RISCV_BGE
   else if (((b__0 = (0b110w :  3 words$word)))) then sail2_state_monad$returnS RISCV_BLTU
   else if (((b__0 = (0b111w :  3 words$word)))) then sail2_state_monad$returnS RISCV_BGEU
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_bop_forwards_matches:bop -> bool) arg_= 
  ((case arg_ of
         RISCV_BEQ => T
     | RISCV_BNE => T
     | RISCV_BLT => T
     | RISCV_BGE => T
     | RISCV_BLTU => T
     | RISCV_BGEU => T
   )))`;


val _ = Define `
 ((encdec_bop_backwards_matches:(3)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then T
   else if (((b__0 = (0b001w :  3 words$word)))) then T
   else if (((b__0 = (0b100w :  3 words$word)))) then T
   else if (((b__0 = (0b101w :  3 words$word)))) then T
   else if (((b__0 = (0b110w :  3 words$word)))) then T
   else if (((b__0 = (0b111w :  3 words$word)))) then T
   else F))`;


(*val btype_mnemonic_forwards : bop -> string*)

(*val btype_mnemonic_backwards : string -> M bop*)

(*val btype_mnemonic_forwards_matches : bop -> bool*)

(*val btype_mnemonic_backwards_matches : string -> bool*)

(*val btype_mnemonic_matches_prefix : string -> maybe ((bop * ii))*)

val _ = Define `
 ((btype_mnemonic_forwards:bop -> string) arg_=
    ((case arg_ of
     RISCV_BEQ => "beq"
   | RISCV_BNE => "bne"
   | RISCV_BLT => "blt"
   | RISCV_BGE => "bge"
   | RISCV_BLTU => "bltu"
   | RISCV_BGEU => "bgeu"
   )))`;


val _ = Define `
 ((btype_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "beq"))) then sail2_state_monad$returnS RISCV_BEQ
   else if (((p0_ = "bne"))) then sail2_state_monad$returnS RISCV_BNE
   else if (((p0_ = "blt"))) then sail2_state_monad$returnS RISCV_BLT
   else if (((p0_ = "bge"))) then sail2_state_monad$returnS RISCV_BGE
   else if (((p0_ = "bltu"))) then sail2_state_monad$returnS RISCV_BLTU
   else if (((p0_ = "bgeu"))) then sail2_state_monad$returnS RISCV_BGEU
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((btype_mnemonic_forwards_matches:bop -> bool) arg_= 
  ((case arg_ of
         RISCV_BEQ => T
     | RISCV_BNE => T
     | RISCV_BLT => T
     | RISCV_BGE => T
     | RISCV_BLTU => T
     | RISCV_BGEU => T
   )))`;


val _ = Define `
 ((btype_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "beq"))) then T
   else if (((p0_ = "bne"))) then T
   else if (((p0_ = "blt"))) then T
   else if (((p0_ = "bge"))) then T
   else if (((p0_ = "bltu"))) then T
   else if (((p0_ = "bgeu"))) then T
   else F))`;


(*val _s785_ : string -> maybe string*)

val _ = Define `
 ((s785_:string ->(string)option) s786_0=
    (let s787_0 = s786_0 in
   if ((string_startswith s787_0 "bgeu")) then  
  (case ((string_drop s787_0 ((string_length "bgeu")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s781_ : string -> maybe string*)

val _ = Define `
 ((s781_:string ->(string)option) s782_0=
    (let s783_0 = s782_0 in
   if ((string_startswith s783_0 "bltu")) then  
  (case ((string_drop s783_0 ((string_length "bltu")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s777_ : string -> maybe string*)

val _ = Define `
 ((s777_:string ->(string)option) s778_0=
    (let s779_0 = s778_0 in
   if ((string_startswith s779_0 "bge")) then  
  (case ((string_drop s779_0 ((string_length "bge")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s773_ : string -> maybe string*)

val _ = Define `
 ((s773_:string ->(string)option) s774_0=
    (let s775_0 = s774_0 in
   if ((string_startswith s775_0 "blt")) then  
  (case ((string_drop s775_0 ((string_length "blt")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s769_ : string -> maybe string*)

val _ = Define `
 ((s769_:string ->(string)option) s770_0=
    (let s771_0 = s770_0 in
   if ((string_startswith s771_0 "bne")) then  
  (case ((string_drop s771_0 ((string_length "bne")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s765_ : string -> maybe string*)

val _ = Define `
 ((s765_:string ->(string)option) s766_0=
    (let s767_0 = s766_0 in
   if ((string_startswith s767_0 "beq")) then  
  (case ((string_drop s767_0 ((string_length "beq")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((btype_mnemonic_matches_prefix:string ->(bop#int)option) arg_=
    (let s768_0 = arg_ in
   if ((case ((s765_ s768_0)) of   SOME (s_) => T | _ => F )) then  
  (case s765_ s768_0 of
      (SOME (s_)) =>
  SOME (RISCV_BEQ, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s769_ s768_0)) of   SOME (s_) => T | _ => F )) then  
  (case s769_ s768_0 of
      (SOME (s_)) =>
  SOME (RISCV_BNE, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s773_ s768_0)) of   SOME (s_) => T | _ => F )) then  
  (case s773_ s768_0 of
      (SOME (s_)) =>
  SOME (RISCV_BLT, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s777_ s768_0)) of   SOME (s_) => T | _ => F )) then  
  (case s777_ s768_0 of
      (SOME (s_)) =>
  SOME (RISCV_BGE, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s781_ s768_0)) of   SOME (s_) => T | _ => F )) then  
  (case s781_ s768_0 of
      (SOME (s_)) =>
  SOME (RISCV_BLTU, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s785_ s768_0)) of   SOME (s_) => T | _ => F )) then  
  (case s785_ s768_0 of
      (SOME (s_)) =>
  SOME (RISCV_BGEU, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val encdec_iop_forwards : iop -> mword ty3*)

(*val encdec_iop_backwards : mword ty3 -> M iop*)

(*val encdec_iop_forwards_matches : iop -> bool*)

(*val encdec_iop_backwards_matches : mword ty3 -> bool*)

val _ = Define `
 ((encdec_iop_forwards:iop ->(3)words$word) arg_=
    ((case arg_ of
     RISCV_ADDI => (0b000w :  3 words$word)
   | RISCV_SLTI => (0b010w :  3 words$word)
   | RISCV_SLTIU => (0b011w :  3 words$word)
   | RISCV_ANDI => (0b111w :  3 words$word)
   | RISCV_ORI => (0b110w :  3 words$word)
   | RISCV_XORI => (0b100w :  3 words$word)
   )))`;


val _ = Define `
 ((encdec_iop_backwards:(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((iop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then sail2_state_monad$returnS RISCV_ADDI
   else if (((b__0 = (0b010w :  3 words$word)))) then sail2_state_monad$returnS RISCV_SLTI
   else if (((b__0 = (0b011w :  3 words$word)))) then sail2_state_monad$returnS RISCV_SLTIU
   else if (((b__0 = (0b111w :  3 words$word)))) then sail2_state_monad$returnS RISCV_ANDI
   else if (((b__0 = (0b110w :  3 words$word)))) then sail2_state_monad$returnS RISCV_ORI
   else if (((b__0 = (0b100w :  3 words$word)))) then sail2_state_monad$returnS RISCV_XORI
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_iop_forwards_matches:iop -> bool) arg_= 
  ((case arg_ of
         RISCV_ADDI => T
     | RISCV_SLTI => T
     | RISCV_SLTIU => T
     | RISCV_ANDI => T
     | RISCV_ORI => T
     | RISCV_XORI => T
   )))`;


val _ = Define `
 ((encdec_iop_backwards_matches:(3)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then T
   else if (((b__0 = (0b010w :  3 words$word)))) then T
   else if (((b__0 = (0b011w :  3 words$word)))) then T
   else if (((b__0 = (0b111w :  3 words$word)))) then T
   else if (((b__0 = (0b110w :  3 words$word)))) then T
   else if (((b__0 = (0b100w :  3 words$word)))) then T
   else F))`;


(*val itype_mnemonic_forwards : iop -> string*)

(*val itype_mnemonic_backwards : string -> M iop*)

(*val itype_mnemonic_forwards_matches : iop -> bool*)

(*val itype_mnemonic_backwards_matches : string -> bool*)

(*val itype_mnemonic_matches_prefix : string -> maybe ((iop * ii))*)

val _ = Define `
 ((itype_mnemonic_forwards:iop -> string) arg_=
    ((case arg_ of
     RISCV_ADDI => "addi"
   | RISCV_SLTI => "slti"
   | RISCV_SLTIU => "sltiu"
   | RISCV_XORI => "xori"
   | RISCV_ORI => "ori"
   | RISCV_ANDI => "andi"
   )))`;


val _ = Define `
 ((itype_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((iop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "addi"))) then sail2_state_monad$returnS RISCV_ADDI
   else if (((p0_ = "slti"))) then sail2_state_monad$returnS RISCV_SLTI
   else if (((p0_ = "sltiu"))) then sail2_state_monad$returnS RISCV_SLTIU
   else if (((p0_ = "xori"))) then sail2_state_monad$returnS RISCV_XORI
   else if (((p0_ = "ori"))) then sail2_state_monad$returnS RISCV_ORI
   else if (((p0_ = "andi"))) then sail2_state_monad$returnS RISCV_ANDI
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((itype_mnemonic_forwards_matches:iop -> bool) arg_= 
  ((case arg_ of
         RISCV_ADDI => T
     | RISCV_SLTI => T
     | RISCV_SLTIU => T
     | RISCV_XORI => T
     | RISCV_ORI => T
     | RISCV_ANDI => T
   )))`;


val _ = Define `
 ((itype_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "addi"))) then T
   else if (((p0_ = "slti"))) then T
   else if (((p0_ = "sltiu"))) then T
   else if (((p0_ = "xori"))) then T
   else if (((p0_ = "ori"))) then T
   else if (((p0_ = "andi"))) then T
   else F))`;


(*val _s809_ : string -> maybe string*)

val _ = Define `
 ((s809_:string ->(string)option) s810_0=
    (let s811_0 = s810_0 in
   if ((string_startswith s811_0 "andi")) then  
  (case ((string_drop s811_0 ((string_length "andi")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s805_ : string -> maybe string*)

val _ = Define `
 ((s805_:string ->(string)option) s806_0=
    (let s807_0 = s806_0 in
   if ((string_startswith s807_0 "ori")) then  
  (case ((string_drop s807_0 ((string_length "ori")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s801_ : string -> maybe string*)

val _ = Define `
 ((s801_:string ->(string)option) s802_0=
    (let s803_0 = s802_0 in
   if ((string_startswith s803_0 "xori")) then  
  (case ((string_drop s803_0 ((string_length "xori")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s797_ : string -> maybe string*)

val _ = Define `
 ((s797_:string ->(string)option) s798_0=
    (let s799_0 = s798_0 in
   if ((string_startswith s799_0 "sltiu")) then  
  (case ((string_drop s799_0 ((string_length "sltiu")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s793_ : string -> maybe string*)

val _ = Define `
 ((s793_:string ->(string)option) s794_0=
    (let s795_0 = s794_0 in
   if ((string_startswith s795_0 "slti")) then  
  (case ((string_drop s795_0 ((string_length "slti")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s789_ : string -> maybe string*)

val _ = Define `
 ((s789_:string ->(string)option) s790_0=
    (let s791_0 = s790_0 in
   if ((string_startswith s791_0 "addi")) then  
  (case ((string_drop s791_0 ((string_length "addi")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((itype_mnemonic_matches_prefix:string ->(iop#int)option) arg_=
    (let s792_0 = arg_ in
   if ((case ((s789_ s792_0)) of   SOME (s_) => T | _ => F )) then  
  (case s789_ s792_0 of
      (SOME (s_)) =>
  SOME (RISCV_ADDI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s793_ s792_0)) of   SOME (s_) => T | _ => F )) then  
  (case s793_ s792_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLTI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s797_ s792_0)) of   SOME (s_) => T | _ => F )) then  
  (case s797_ s792_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLTIU, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s801_ s792_0)) of   SOME (s_) => T | _ => F )) then  
  (case s801_ s792_0 of
      (SOME (s_)) =>
  SOME (RISCV_XORI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s805_ s792_0)) of   SOME (s_) => T | _ => F )) then  
  (case s805_ s792_0 of
      (SOME (s_)) =>
  SOME (RISCV_ORI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s809_ s792_0)) of   SOME (s_) => T | _ => F )) then  
  (case s809_ s792_0 of
      (SOME (s_)) =>
  SOME (RISCV_ANDI, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val encdec_sop_forwards : sop -> mword ty3*)

(*val encdec_sop_backwards : mword ty3 -> M sop*)

(*val encdec_sop_forwards_matches : sop -> bool*)

(*val encdec_sop_backwards_matches : mword ty3 -> bool*)

val _ = Define `
 ((encdec_sop_forwards:sop ->(3)words$word) arg_=
    ((case arg_ of
     RISCV_SLLI => (0b001w :  3 words$word)
   | RISCV_SRLI => (0b101w :  3 words$word)
   | RISCV_SRAI => (0b101w :  3 words$word)
   )))`;


val _ = Define `
 ((encdec_sop_backwards:(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((sop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b001w :  3 words$word)))) then sail2_state_monad$returnS RISCV_SLLI
   else if (((b__0 = (0b101w :  3 words$word)))) then sail2_state_monad$returnS RISCV_SRLI
   else if (((b__0 = (0b101w :  3 words$word)))) then sail2_state_monad$returnS RISCV_SRAI
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_sop_forwards_matches:sop -> bool) arg_= 
  ((case arg_ of   RISCV_SLLI => T | RISCV_SRLI => T | RISCV_SRAI => T )))`;


val _ = Define `
 ((encdec_sop_backwards_matches:(3)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b001w :  3 words$word)))) then T
   else if (((b__0 = (0b101w :  3 words$word)))) then T
   else if (((b__0 = (0b101w :  3 words$word)))) then T
   else F))`;


(*val shiftiop_mnemonic_forwards : sop -> string*)

(*val shiftiop_mnemonic_backwards : string -> M sop*)

(*val shiftiop_mnemonic_forwards_matches : sop -> bool*)

(*val shiftiop_mnemonic_backwards_matches : string -> bool*)

(*val shiftiop_mnemonic_matches_prefix : string -> maybe ((sop * ii))*)

val _ = Define `
 ((shiftiop_mnemonic_forwards:sop -> string) arg_=
    ((case arg_ of   RISCV_SLLI => "slli" | RISCV_SRLI => "srli" | RISCV_SRAI => "srai" )))`;


val _ = Define `
 ((shiftiop_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((sop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "slli"))) then sail2_state_monad$returnS RISCV_SLLI
   else if (((p0_ = "srli"))) then sail2_state_monad$returnS RISCV_SRLI
   else if (((p0_ = "srai"))) then sail2_state_monad$returnS RISCV_SRAI
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((shiftiop_mnemonic_forwards_matches:sop -> bool) arg_= 
  ((case arg_ of   RISCV_SLLI => T | RISCV_SRLI => T | RISCV_SRAI => T )))`;


val _ = Define `
 ((shiftiop_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "slli"))) then T
   else if (((p0_ = "srli"))) then T
   else if (((p0_ = "srai"))) then T
   else F))`;


(*val _s821_ : string -> maybe string*)

val _ = Define `
 ((s821_:string ->(string)option) s822_0=
    (let s823_0 = s822_0 in
   if ((string_startswith s823_0 "srai")) then  
  (case ((string_drop s823_0 ((string_length "srai")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s817_ : string -> maybe string*)

val _ = Define `
 ((s817_:string ->(string)option) s818_0=
    (let s819_0 = s818_0 in
   if ((string_startswith s819_0 "srli")) then  
  (case ((string_drop s819_0 ((string_length "srli")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s813_ : string -> maybe string*)

val _ = Define `
 ((s813_:string ->(string)option) s814_0=
    (let s815_0 = s814_0 in
   if ((string_startswith s815_0 "slli")) then  
  (case ((string_drop s815_0 ((string_length "slli")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((shiftiop_mnemonic_matches_prefix:string ->(sop#int)option) arg_=
    (let s816_0 = arg_ in
   if ((case ((s813_ s816_0)) of   SOME (s_) => T | _ => F )) then  
  (case s813_ s816_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLLI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s817_ s816_0)) of   SOME (s_) => T | _ => F )) then  
  (case s817_ s816_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRLI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s821_ s816_0)) of   SOME (s_) => T | _ => F )) then  
  (case s821_ s816_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRAI, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val rtype_mnemonic_forwards : rop -> string*)

(*val rtype_mnemonic_backwards : string -> M rop*)

(*val rtype_mnemonic_forwards_matches : rop -> bool*)

(*val rtype_mnemonic_backwards_matches : string -> bool*)

(*val rtype_mnemonic_matches_prefix : string -> maybe ((rop * ii))*)

val _ = Define `
 ((rtype_mnemonic_forwards:rop -> string) arg_=
    ((case arg_ of
     RISCV_ADD => "add"
   | RISCV_SLT => "slt"
   | RISCV_SLTU => "sltu"
   | RISCV_AND => "and"
   | RISCV_OR => "or"
   | RISCV_XOR => "xor"
   | RISCV_SLL => "sll"
   | RISCV_SRL => "srl"
   | RISCV_SUB => "sub"
   | RISCV_SRA => "sra"
   )))`;


val _ = Define `
 ((rtype_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((rop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "add"))) then sail2_state_monad$returnS RISCV_ADD
   else if (((p0_ = "slt"))) then sail2_state_monad$returnS RISCV_SLT
   else if (((p0_ = "sltu"))) then sail2_state_monad$returnS RISCV_SLTU
   else if (((p0_ = "and"))) then sail2_state_monad$returnS RISCV_AND
   else if (((p0_ = "or"))) then sail2_state_monad$returnS RISCV_OR
   else if (((p0_ = "xor"))) then sail2_state_monad$returnS RISCV_XOR
   else if (((p0_ = "sll"))) then sail2_state_monad$returnS RISCV_SLL
   else if (((p0_ = "srl"))) then sail2_state_monad$returnS RISCV_SRL
   else if (((p0_ = "sub"))) then sail2_state_monad$returnS RISCV_SUB
   else if (((p0_ = "sra"))) then sail2_state_monad$returnS RISCV_SRA
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((rtype_mnemonic_forwards_matches:rop -> bool) arg_= 
  ((case arg_ of
         RISCV_ADD => T
     | RISCV_SLT => T
     | RISCV_SLTU => T
     | RISCV_AND => T
     | RISCV_OR => T
     | RISCV_XOR => T
     | RISCV_SLL => T
     | RISCV_SRL => T
     | RISCV_SUB => T
     | RISCV_SRA => T
   )))`;


val _ = Define `
 ((rtype_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "add"))) then T
   else if (((p0_ = "slt"))) then T
   else if (((p0_ = "sltu"))) then T
   else if (((p0_ = "and"))) then T
   else if (((p0_ = "or"))) then T
   else if (((p0_ = "xor"))) then T
   else if (((p0_ = "sll"))) then T
   else if (((p0_ = "srl"))) then T
   else if (((p0_ = "sub"))) then T
   else if (((p0_ = "sra"))) then T
   else F))`;


(*val _s861_ : string -> maybe string*)

val _ = Define `
 ((s861_:string ->(string)option) s862_0=
    (let s863_0 = s862_0 in
   if ((string_startswith s863_0 "sra")) then  
  (case ((string_drop s863_0 ((string_length "sra")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s857_ : string -> maybe string*)

val _ = Define `
 ((s857_:string ->(string)option) s858_0=
    (let s859_0 = s858_0 in
   if ((string_startswith s859_0 "sub")) then  
  (case ((string_drop s859_0 ((string_length "sub")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s853_ : string -> maybe string*)

val _ = Define `
 ((s853_:string ->(string)option) s854_0=
    (let s855_0 = s854_0 in
   if ((string_startswith s855_0 "srl")) then  
  (case ((string_drop s855_0 ((string_length "srl")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s849_ : string -> maybe string*)

val _ = Define `
 ((s849_:string ->(string)option) s850_0=
    (let s851_0 = s850_0 in
   if ((string_startswith s851_0 "sll")) then  
  (case ((string_drop s851_0 ((string_length "sll")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s845_ : string -> maybe string*)

val _ = Define `
 ((s845_:string ->(string)option) s846_0=
    (let s847_0 = s846_0 in
   if ((string_startswith s847_0 "xor")) then  
  (case ((string_drop s847_0 ((string_length "xor")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s841_ : string -> maybe string*)

val _ = Define `
 ((s841_:string ->(string)option) s842_0=
    (let s843_0 = s842_0 in
   if ((string_startswith s843_0 "or")) then  
  (case ((string_drop s843_0 ((string_length "or")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s837_ : string -> maybe string*)

val _ = Define `
 ((s837_:string ->(string)option) s838_0=
    (let s839_0 = s838_0 in
   if ((string_startswith s839_0 "and")) then  
  (case ((string_drop s839_0 ((string_length "and")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s833_ : string -> maybe string*)

val _ = Define `
 ((s833_:string ->(string)option) s834_0=
    (let s835_0 = s834_0 in
   if ((string_startswith s835_0 "sltu")) then  
  (case ((string_drop s835_0 ((string_length "sltu")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s829_ : string -> maybe string*)

val _ = Define `
 ((s829_:string ->(string)option) s830_0=
    (let s831_0 = s830_0 in
   if ((string_startswith s831_0 "slt")) then  
  (case ((string_drop s831_0 ((string_length "slt")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s825_ : string -> maybe string*)

val _ = Define `
 ((s825_:string ->(string)option) s826_0=
    (let s827_0 = s826_0 in
   if ((string_startswith s827_0 "add")) then  
  (case ((string_drop s827_0 ((string_length "add")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((rtype_mnemonic_matches_prefix:string ->(rop#int)option) arg_=
    (let s828_0 = arg_ in
   if ((case ((s825_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s825_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_ADD, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s829_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s829_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLT, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s833_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s833_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLTU, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s837_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s837_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_AND, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s841_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s841_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_OR, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s845_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s845_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_XOR, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s849_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s849_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLL, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s853_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s853_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRL, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s857_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s857_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_SUB, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s861_ s828_0)) of   SOME (s_) => T | _ => F )) then  
  (case s861_ s828_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRA, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val extend_value : forall 'int8_times_n. Size 'int8_times_n => bool -> MemoryOpResult (mword 'int8_times_n) -> MemoryOpResult (mword ty32)*)

val _ = Define `
 ((extend_value:bool ->('int8_times_n words$word)MemoryOpResult ->((32)words$word)MemoryOpResult) is_unsigned value=
    ((case value of
     MemValue (v) =>
      MemValue (if is_unsigned then (EXTZ (( 32 : int):ii) v  :  32 words$word)
                else (EXTS (( 32 : int):ii) v  :  32 words$word))
   | MemException (e) => MemException e
   )))`;


(*val process_load : forall 'int8_times_n. Size 'int8_times_n => mword ty5 -> mword ty32 -> MemoryOpResult (mword 'int8_times_n) -> bool -> M Retired*)

val _ = Define `
 ((process_load:(5)words$word ->(32)words$word ->('int8_times_n words$word)MemoryOpResult -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rd vaddr value is_unsigned=
    ((case ((extend_value is_unsigned value  : ( 32 words$word) MemoryOpResult)) of
     MemValue (result) => sail2_state_monad$seqS (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS)
   | MemException (e) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
   )))`;


(*val check_misaligned : mword ty32 -> word_width -> bool*)

val _ = Define `
 ((check_misaligned:(32)words$word -> word_width -> bool) (vaddr : xlenbits) (width : word_width)=
    (if ((plat_enable_misaligned_access () )) then F
   else
     (case width of
       BYTE => F
     | HALF => (((access_vec_dec vaddr (( 0 : int):ii))) = B1)
     | WORD =>
        ((((((access_vec_dec vaddr (( 0 : int):ii))) = B1))) \/ (((((access_vec_dec vaddr (( 1 : int):ii))) = B1))))
     | DOUBLE =>
        ((((((access_vec_dec vaddr (( 0 : int):ii))) = B1))) \/ ((((((((access_vec_dec vaddr (( 1 : int):ii))) = B1))) \/ (((((access_vec_dec vaddr (( 2 : int):ii))) = B1)))))))
     )))`;


(*val maybe_aq_forwards : bool -> string*)

(*val maybe_aq_backwards : string -> M bool*)

(*val maybe_aq_forwards_matches : bool -> bool*)

(*val maybe_aq_backwards_matches : string -> bool*)

(*val maybe_aq_matches_prefix : string -> maybe ((bool * ii))*)

val _ = Define `
 ((maybe_aq_forwards:bool -> string) arg_=  ((case arg_ of   T => ".aq" | F => "" )))`;


val _ = Define `
 ((maybe_aq_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = ".aq"))) then sail2_state_monad$returnS T
   else if (((p0_ = ""))) then sail2_state_monad$returnS F
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((maybe_aq_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   T => T | F => T )))`;


val _ = Define `
 ((maybe_aq_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = ".aq"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s869_ : string -> maybe string*)

val _ = Define `
 ((s869_:string ->(string)option) s870_0=
    (let s871_0 = s870_0 in
   if ((string_startswith s871_0 "")) then  
  (case ((string_drop s871_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s865_ : string -> maybe string*)

val _ = Define `
 ((s865_:string ->(string)option) s866_0=
    (let s867_0 = s866_0 in
   if ((string_startswith s867_0 ".aq")) then  
  (case ((string_drop s867_0 ((string_length ".aq")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((maybe_aq_matches_prefix:string ->(bool#int)option) arg_=
    (let s868_0 = arg_ in
   if ((case ((s865_ s868_0)) of   SOME (s_) => T | _ => F )) then  
  (case s865_ s868_0 of
      (SOME (s_)) =>
  SOME (T, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s869_ s868_0)) of   SOME (s_) => T | _ => F )) then  
  (case s869_ s868_0 of
      (SOME (s_)) =>
  SOME (F, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val maybe_rl_forwards : bool -> string*)

(*val maybe_rl_backwards : string -> M bool*)

(*val maybe_rl_forwards_matches : bool -> bool*)

(*val maybe_rl_backwards_matches : string -> bool*)

(*val maybe_rl_matches_prefix : string -> maybe ((bool * ii))*)

val _ = Define `
 ((maybe_rl_forwards:bool -> string) arg_=  ((case arg_ of   T => ".rl" | F => "" )))`;


val _ = Define `
 ((maybe_rl_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = ".rl"))) then sail2_state_monad$returnS T
   else if (((p0_ = ""))) then sail2_state_monad$returnS F
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((maybe_rl_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   T => T | F => T )))`;


val _ = Define `
 ((maybe_rl_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = ".rl"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s877_ : string -> maybe string*)

val _ = Define `
 ((s877_:string ->(string)option) s878_0=
    (let s879_0 = s878_0 in
   if ((string_startswith s879_0 "")) then  
  (case ((string_drop s879_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s873_ : string -> maybe string*)

val _ = Define `
 ((s873_:string ->(string)option) s874_0=
    (let s875_0 = s874_0 in
   if ((string_startswith s875_0 ".rl")) then  
  (case ((string_drop s875_0 ((string_length ".rl")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((maybe_rl_matches_prefix:string ->(bool#int)option) arg_=
    (let s876_0 = arg_ in
   if ((case ((s873_ s876_0)) of   SOME (s_) => T | _ => F )) then  
  (case s873_ s876_0 of
      (SOME (s_)) =>
  SOME (T, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s877_ s876_0)) of   SOME (s_) => T | _ => F )) then  
  (case s877_ s876_0 of
      (SOME (s_)) =>
  SOME (F, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val maybe_u_forwards : bool -> string*)

(*val maybe_u_backwards : string -> M bool*)

(*val maybe_u_forwards_matches : bool -> bool*)

(*val maybe_u_backwards_matches : string -> bool*)

(*val maybe_u_matches_prefix : string -> maybe ((bool * ii))*)

val _ = Define `
 ((maybe_u_forwards:bool -> string) arg_=  ((case arg_ of   T => "u" | F => "" )))`;


val _ = Define `
 ((maybe_u_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "u"))) then sail2_state_monad$returnS T
   else if (((p0_ = ""))) then sail2_state_monad$returnS F
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((maybe_u_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   T => T | F => T )))`;


val _ = Define `
 ((maybe_u_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "u"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s885_ : string -> maybe string*)

val _ = Define `
 ((s885_:string ->(string)option) s886_0=
    (let s887_0 = s886_0 in
   if ((string_startswith s887_0 "")) then  
  (case ((string_drop s887_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s881_ : string -> maybe string*)

val _ = Define `
 ((s881_:string ->(string)option) s882_0=
    (let s883_0 = s882_0 in
   if ((string_startswith s883_0 "u")) then  
  (case ((string_drop s883_0 ((string_length "u")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((maybe_u_matches_prefix:string ->(bool#int)option) arg_=
    (let s884_0 = arg_ in
   if ((case ((s881_ s884_0)) of   SOME (s_) => T | _ => F )) then  
  (case s881_ s884_0 of
      (SOME (s_)) =>
  SOME (T, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s885_ s884_0)) of   SOME (s_) => T | _ => F )) then  
  (case s885_ s884_0 of
      (SOME (s_)) =>
  SOME (F, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val shiftw_mnemonic_forwards : sop -> string*)

(*val shiftw_mnemonic_backwards : string -> M sop*)

(*val shiftw_mnemonic_forwards_matches : sop -> bool*)

(*val shiftw_mnemonic_backwards_matches : string -> bool*)

(*val shiftw_mnemonic_matches_prefix : string -> maybe ((sop * ii))*)

val _ = Define `
 ((shiftw_mnemonic_forwards:sop -> string) arg_=
    ((case arg_ of   RISCV_SLLI => "slli" | RISCV_SRLI => "srli" | RISCV_SRAI => "srai" )))`;


val _ = Define `
 ((shiftw_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((sop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "slli"))) then sail2_state_monad$returnS RISCV_SLLI
   else if (((p0_ = "srli"))) then sail2_state_monad$returnS RISCV_SRLI
   else if (((p0_ = "srai"))) then sail2_state_monad$returnS RISCV_SRAI
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((shiftw_mnemonic_forwards_matches:sop -> bool) arg_= 
  ((case arg_ of   RISCV_SLLI => T | RISCV_SRLI => T | RISCV_SRAI => T )))`;


val _ = Define `
 ((shiftw_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "slli"))) then T
   else if (((p0_ = "srli"))) then T
   else if (((p0_ = "srai"))) then T
   else F))`;


(*val _s897_ : string -> maybe string*)

val _ = Define `
 ((s897_:string ->(string)option) s898_0=
    (let s899_0 = s898_0 in
   if ((string_startswith s899_0 "srai")) then  
  (case ((string_drop s899_0 ((string_length "srai")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s893_ : string -> maybe string*)

val _ = Define `
 ((s893_:string ->(string)option) s894_0=
    (let s895_0 = s894_0 in
   if ((string_startswith s895_0 "srli")) then  
  (case ((string_drop s895_0 ((string_length "srli")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s889_ : string -> maybe string*)

val _ = Define `
 ((s889_:string ->(string)option) s890_0=
    (let s891_0 = s890_0 in
   if ((string_startswith s891_0 "slli")) then  
  (case ((string_drop s891_0 ((string_length "slli")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((shiftw_mnemonic_matches_prefix:string ->(sop#int)option) arg_=
    (let s892_0 = arg_ in
   if ((case ((s889_ s892_0)) of   SOME (s_) => T | _ => F )) then  
  (case s889_ s892_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLLI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s893_ s892_0)) of   SOME (s_) => T | _ => F )) then  
  (case s893_ s892_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRLI, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s897_ s892_0)) of   SOME (s_) => T | _ => F )) then  
  (case s897_ s892_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRAI, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val rtypew_mnemonic_forwards : ropw -> string*)

(*val rtypew_mnemonic_backwards : string -> M ropw*)

(*val rtypew_mnemonic_forwards_matches : ropw -> bool*)

(*val rtypew_mnemonic_backwards_matches : string -> bool*)

(*val rtypew_mnemonic_matches_prefix : string -> maybe ((ropw * ii))*)

val _ = Define `
 ((rtypew_mnemonic_forwards:ropw -> string) arg_=
    ((case arg_ of
     RISCV_ADDW => "addw"
   | RISCV_SUBW => "subw"
   | RISCV_SLLW => "sllw"
   | RISCV_SRLW => "srlw"
   | RISCV_SRAW => "sraw"
   )))`;


val _ = Define `
 ((rtypew_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((ropw),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "addw"))) then sail2_state_monad$returnS RISCV_ADDW
   else if (((p0_ = "subw"))) then sail2_state_monad$returnS RISCV_SUBW
   else if (((p0_ = "sllw"))) then sail2_state_monad$returnS RISCV_SLLW
   else if (((p0_ = "srlw"))) then sail2_state_monad$returnS RISCV_SRLW
   else if (((p0_ = "sraw"))) then sail2_state_monad$returnS RISCV_SRAW
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((rtypew_mnemonic_forwards_matches:ropw -> bool) arg_= 
  ((case arg_ of
         RISCV_ADDW => T
     | RISCV_SUBW => T
     | RISCV_SLLW => T
     | RISCV_SRLW => T
     | RISCV_SRAW => T
   )))`;


val _ = Define `
 ((rtypew_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "addw"))) then T
   else if (((p0_ = "subw"))) then T
   else if (((p0_ = "sllw"))) then T
   else if (((p0_ = "srlw"))) then T
   else if (((p0_ = "sraw"))) then T
   else F))`;


(*val _s917_ : string -> maybe string*)

val _ = Define `
 ((s917_:string ->(string)option) s918_0=
    (let s919_0 = s918_0 in
   if ((string_startswith s919_0 "sraw")) then  
  (case ((string_drop s919_0 ((string_length "sraw")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s913_ : string -> maybe string*)

val _ = Define `
 ((s913_:string ->(string)option) s914_0=
    (let s915_0 = s914_0 in
   if ((string_startswith s915_0 "srlw")) then  
  (case ((string_drop s915_0 ((string_length "srlw")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s909_ : string -> maybe string*)

val _ = Define `
 ((s909_:string ->(string)option) s910_0=
    (let s911_0 = s910_0 in
   if ((string_startswith s911_0 "sllw")) then  
  (case ((string_drop s911_0 ((string_length "sllw")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s905_ : string -> maybe string*)

val _ = Define `
 ((s905_:string ->(string)option) s906_0=
    (let s907_0 = s906_0 in
   if ((string_startswith s907_0 "subw")) then  
  (case ((string_drop s907_0 ((string_length "subw")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s901_ : string -> maybe string*)

val _ = Define `
 ((s901_:string ->(string)option) s902_0=
    (let s903_0 = s902_0 in
   if ((string_startswith s903_0 "addw")) then  
  (case ((string_drop s903_0 ((string_length "addw")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((rtypew_mnemonic_matches_prefix:string ->(ropw#int)option) arg_=
    (let s904_0 = arg_ in
   if ((case ((s901_ s904_0)) of   SOME (s_) => T | _ => F )) then  
  (case s901_ s904_0 of
      (SOME (s_)) =>
  SOME (RISCV_ADDW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s905_ s904_0)) of   SOME (s_) => T | _ => F )) then  
  (case s905_ s904_0 of
      (SOME (s_)) =>
  SOME (RISCV_SUBW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s909_ s904_0)) of   SOME (s_) => T | _ => F )) then  
  (case s909_ s904_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLLW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s913_ s904_0)) of   SOME (s_) => T | _ => F )) then  
  (case s913_ s904_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRLW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s917_ s904_0)) of   SOME (s_) => T | _ => F )) then  
  (case s917_ s904_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRAW, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val shiftiwop_mnemonic_forwards : sopw -> string*)

(*val shiftiwop_mnemonic_backwards : string -> M sopw*)

(*val shiftiwop_mnemonic_forwards_matches : sopw -> bool*)

(*val shiftiwop_mnemonic_backwards_matches : string -> bool*)

(*val shiftiwop_mnemonic_matches_prefix : string -> maybe ((sopw * ii))*)

val _ = Define `
 ((shiftiwop_mnemonic_forwards:sopw -> string) arg_=
    ((case arg_ of   RISCV_SLLIW => "slliw" | RISCV_SRLIW => "srliw" | RISCV_SRAIW => "sraiw" )))`;


val _ = Define `
 ((shiftiwop_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((sopw),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "slliw"))) then sail2_state_monad$returnS RISCV_SLLIW
   else if (((p0_ = "srliw"))) then sail2_state_monad$returnS RISCV_SRLIW
   else if (((p0_ = "sraiw"))) then sail2_state_monad$returnS RISCV_SRAIW
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((shiftiwop_mnemonic_forwards_matches:sopw -> bool) arg_= 
  ((case arg_ of   RISCV_SLLIW => T | RISCV_SRLIW => T | RISCV_SRAIW => T )))`;


val _ = Define `
 ((shiftiwop_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "slliw"))) then T
   else if (((p0_ = "srliw"))) then T
   else if (((p0_ = "sraiw"))) then T
   else F))`;


(*val _s929_ : string -> maybe string*)

val _ = Define `
 ((s929_:string ->(string)option) s930_0=
    (let s931_0 = s930_0 in
   if ((string_startswith s931_0 "sraiw")) then  
  (case ((string_drop s931_0 ((string_length "sraiw")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s925_ : string -> maybe string*)

val _ = Define `
 ((s925_:string ->(string)option) s926_0=
    (let s927_0 = s926_0 in
   if ((string_startswith s927_0 "srliw")) then  
  (case ((string_drop s927_0 ((string_length "srliw")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s921_ : string -> maybe string*)

val _ = Define `
 ((s921_:string ->(string)option) s922_0=
    (let s923_0 = s922_0 in
   if ((string_startswith s923_0 "slliw")) then  
  (case ((string_drop s923_0 ((string_length "slliw")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((shiftiwop_mnemonic_matches_prefix:string ->(sopw#int)option) arg_=
    (let s924_0 = arg_ in
   if ((case ((s921_ s924_0)) of   SOME (s_) => T | _ => F )) then  
  (case s921_ s924_0 of
      (SOME (s_)) =>
  SOME (RISCV_SLLIW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s925_ s924_0)) of   SOME (s_) => T | _ => F )) then  
  (case s925_ s924_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRLIW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s929_ s924_0)) of   SOME (s_) => T | _ => F )) then  
  (case s929_ s924_0 of
      (SOME (s_)) =>
  SOME (RISCV_SRAIW, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val bit_maybe_r_forwards : mword ty1 -> M string*)

(*val bit_maybe_r_backwards : string -> M (mword ty1)*)

(*val bit_maybe_r_forwards_matches : mword ty1 -> bool*)

(*val bit_maybe_r_backwards_matches : string -> bool*)

(*val bit_maybe_r_matches_prefix : string -> maybe ((mword ty1 * ii))*)

val _ = Define `
 ((bit_maybe_r_forwards:(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$returnS "r"
   else if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$returnS ""
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_r_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((1)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "r"))) then sail2_state_monad$returnS (0b1w :  1 words$word)
   else if (((p0_ = ""))) then sail2_state_monad$returnS (0b0w :  1 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_r_forwards_matches:(1)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then T
   else if (((b__0 = (0b0w :  1 words$word)))) then T
   else F))`;


val _ = Define `
 ((bit_maybe_r_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "r"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s937_ : string -> maybe string*)

val _ = Define `
 ((s937_:string ->(string)option) s938_0=
    (let s939_0 = s938_0 in
   if ((string_startswith s939_0 "")) then  
  (case ((string_drop s939_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s933_ : string -> maybe string*)

val _ = Define `
 ((s933_:string ->(string)option) s934_0=
    (let s935_0 = s934_0 in
   if ((string_startswith s935_0 "r")) then  
  (case ((string_drop s935_0 ((string_length "r")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((bit_maybe_r_matches_prefix:string ->((1)words$word#int)option) arg_=
    (let s936_0 = arg_ in
   if ((case ((s933_ s936_0)) of   SOME (s_) => T | _ => F )) then  
  (case s933_ s936_0 of
      (SOME (s_)) =>
  SOME ((0b1w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s937_ s936_0)) of   SOME (s_) => T | _ => F )) then  
  (case s937_ s936_0 of
      (SOME (s_)) =>
  SOME ((0b0w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val bit_maybe_w_forwards : mword ty1 -> M string*)

(*val bit_maybe_w_backwards : string -> M (mword ty1)*)

(*val bit_maybe_w_forwards_matches : mword ty1 -> bool*)

(*val bit_maybe_w_backwards_matches : string -> bool*)

(*val bit_maybe_w_matches_prefix : string -> maybe ((mword ty1 * ii))*)

val _ = Define `
 ((bit_maybe_w_forwards:(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$returnS "w"
   else if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$returnS ""
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_w_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((1)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "w"))) then sail2_state_monad$returnS (0b1w :  1 words$word)
   else if (((p0_ = ""))) then sail2_state_monad$returnS (0b0w :  1 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_w_forwards_matches:(1)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then T
   else if (((b__0 = (0b0w :  1 words$word)))) then T
   else F))`;


val _ = Define `
 ((bit_maybe_w_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "w"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s945_ : string -> maybe string*)

val _ = Define `
 ((s945_:string ->(string)option) s946_0=
    (let s947_0 = s946_0 in
   if ((string_startswith s947_0 "")) then  
  (case ((string_drop s947_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s941_ : string -> maybe string*)

val _ = Define `
 ((s941_:string ->(string)option) s942_0=
    (let s943_0 = s942_0 in
   if ((string_startswith s943_0 "w")) then  
  (case ((string_drop s943_0 ((string_length "w")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((bit_maybe_w_matches_prefix:string ->((1)words$word#int)option) arg_=
    (let s944_0 = arg_ in
   if ((case ((s941_ s944_0)) of   SOME (s_) => T | _ => F )) then  
  (case s941_ s944_0 of
      (SOME (s_)) =>
  SOME ((0b1w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s945_ s944_0)) of   SOME (s_) => T | _ => F )) then  
  (case s945_ s944_0 of
      (SOME (s_)) =>
  SOME ((0b0w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val bit_maybe_i_forwards : mword ty1 -> M string*)

(*val bit_maybe_i_backwards : string -> M (mword ty1)*)

(*val bit_maybe_i_forwards_matches : mword ty1 -> bool*)

(*val bit_maybe_i_backwards_matches : string -> bool*)

(*val bit_maybe_i_matches_prefix : string -> maybe ((mword ty1 * ii))*)

val _ = Define `
 ((bit_maybe_i_forwards:(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$returnS "i"
   else if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$returnS ""
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_i_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((1)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "i"))) then sail2_state_monad$returnS (0b1w :  1 words$word)
   else if (((p0_ = ""))) then sail2_state_monad$returnS (0b0w :  1 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_i_forwards_matches:(1)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then T
   else if (((b__0 = (0b0w :  1 words$word)))) then T
   else F))`;


val _ = Define `
 ((bit_maybe_i_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "i"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s953_ : string -> maybe string*)

val _ = Define `
 ((s953_:string ->(string)option) s954_0=
    (let s955_0 = s954_0 in
   if ((string_startswith s955_0 "")) then  
  (case ((string_drop s955_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s949_ : string -> maybe string*)

val _ = Define `
 ((s949_:string ->(string)option) s950_0=
    (let s951_0 = s950_0 in
   if ((string_startswith s951_0 "i")) then  
  (case ((string_drop s951_0 ((string_length "i")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((bit_maybe_i_matches_prefix:string ->((1)words$word#int)option) arg_=
    (let s952_0 = arg_ in
   if ((case ((s949_ s952_0)) of   SOME (s_) => T | _ => F )) then  
  (case s949_ s952_0 of
      (SOME (s_)) =>
  SOME ((0b1w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s953_ s952_0)) of   SOME (s_) => T | _ => F )) then  
  (case s953_ s952_0 of
      (SOME (s_)) =>
  SOME ((0b0w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val bit_maybe_o_forwards : mword ty1 -> M string*)

(*val bit_maybe_o_backwards : string -> M (mword ty1)*)

(*val bit_maybe_o_forwards_matches : mword ty1 -> bool*)

(*val bit_maybe_o_backwards_matches : string -> bool*)

(*val bit_maybe_o_matches_prefix : string -> maybe ((mword ty1 * ii))*)

val _ = Define `
 ((bit_maybe_o_forwards:(1)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$returnS "o"
   else if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$returnS ""
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_o_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((1)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "o"))) then sail2_state_monad$returnS (0b1w :  1 words$word)
   else if (((p0_ = ""))) then sail2_state_monad$returnS (0b0w :  1 words$word)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((bit_maybe_o_forwards_matches:(1)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b1w :  1 words$word)))) then T
   else if (((b__0 = (0b0w :  1 words$word)))) then T
   else F))`;


val _ = Define `
 ((bit_maybe_o_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "o"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s961_ : string -> maybe string*)

val _ = Define `
 ((s961_:string ->(string)option) s962_0=
    (let s963_0 = s962_0 in
   if ((string_startswith s963_0 "")) then  
  (case ((string_drop s963_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s957_ : string -> maybe string*)

val _ = Define `
 ((s957_:string ->(string)option) s958_0=
    (let s959_0 = s958_0 in
   if ((string_startswith s959_0 "o")) then  
  (case ((string_drop s959_0 ((string_length "o")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((bit_maybe_o_matches_prefix:string ->((1)words$word#int)option) arg_=
    (let s960_0 = arg_ in
   if ((case ((s957_ s960_0)) of   SOME (s_) => T | _ => F )) then  
  (case s957_ s960_0 of
      (SOME (s_)) =>
  SOME ((0b1w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s961_ s960_0)) of   SOME (s_) => T | _ => F )) then  
  (case s961_ s960_0 of
      (SOME (s_)) =>
  SOME ((0b0w : 1 words$word), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val fence_bits_forwards : mword ty4 -> M string*)

(*val fence_bits_backwards : string -> M (mword ty4)*)

(*val fence_bits_forwards_matches : mword ty4 -> bool*)

(*val fence_bits_backwards_matches : string -> bool*)

(*val fence_bits_matches_prefix : string -> maybe ((mword ty4 * ii))*)

val _ = Define `
 ((fence_bits_forwards:(4)words$word ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    ((case arg_ of
     v__0 =>
      let (i : 1 bits) = ((subrange_vec_dec v__0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)) in
      let (w : 1 bits) = ((subrange_vec_dec v__0 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
      let (r : 1 bits) = ((subrange_vec_dec v__0 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
      let (o1 : 1 bits) = ((subrange_vec_dec v__0 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
      let (i : 1 bits) = ((subrange_vec_dec v__0 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
      (bit_maybe_i_forwards i) (\ (w__0 : string) .  sail2_state_monad$bindS
      (bit_maybe_o_forwards o1) (\ (w__1 : string) .  sail2_state_monad$bindS
      (bit_maybe_r_forwards r) (\ (w__2 : string) .  sail2_state_monad$bindS
      (bit_maybe_w_forwards w) (\ (w__3 : string) . 
      sail2_state_monad$returnS ((string_append w__0
                 ((string_append w__1 ((string_append w__2 ((string_append w__3 ""))))))))))))
   )))`;


(*val _s965_ : string -> maybe ((mword ty1 * mword ty1 * mword ty1 * mword ty1))*)

val _ = Define `
 ((s965_:string ->((1)words$word#(1)words$word#(1)words$word#(1)words$word)option) s966_0= 
  ((case s966_0 of
         s967_0 =>
   (case ((bit_maybe_i_matches_prefix s967_0 : (( 1 words$word # ii)) option)) of
         SOME ((i, s968_0)) =>
   (case ((string_drop s967_0 s968_0)) of
         s969_0 =>
   (case ((bit_maybe_o_matches_prefix s969_0 : (( 1 words$word # ii)) option)) of
         SOME ((o1, s970_0)) =>
   (case ((string_drop s969_0 s970_0)) of
         s971_0 =>
   (case ((bit_maybe_r_matches_prefix s971_0 : (( 1 words$word # ii)) option)) of
         SOME ((r, s972_0)) =>
   (case ((string_drop s971_0 s972_0)) of
         s973_0 =>
   (case ((bit_maybe_w_matches_prefix s973_0 : (( 1 words$word # ii)) option)) of
         SOME ((w, s974_0)) =>
   let p0_ = (string_drop s973_0 s974_0) in
   if (((p0_ = ""))) then SOME (i, o1, r, w) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((fence_bits_backwards:string ->(regstate)sail2_state_monad$sequential_state ->((((4)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let s975_0 = arg_ in
   if ((case ((s965_ s975_0  :  (( 1 words$word #  1 words$word #  1 words$word #  1 words$word))option)) of
       SOME ((i, o1, r, w)) => T
     | _ => F
     )) then  (case
 (s965_ s975_0 : (( 1 words$word # 1 words$word # 1 words$word # 1 words$word)) option) of
     (SOME ((i, o1, r, w))) =>
 sail2_state_monad$returnS
   ((concat_vec i
       ((concat_vec o1 ((concat_vec r w : 2 words$word)) : 3 words$word))
    : 4 words$word))
 )
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((fence_bits_forwards_matches:(4)words$word -> bool) arg_= 
  ((case arg_ of   v__1 => T )))`;


(*val _s976_ : string -> maybe ((mword ty1 * mword ty1 * mword ty1 * mword ty1))*)

val _ = Define `
 ((s976_:string ->((1)words$word#(1)words$word#(1)words$word#(1)words$word)option) s977_0= 
  ((case s977_0 of
         s978_0 =>
   (case ((bit_maybe_i_matches_prefix s978_0 : (( 1 words$word # ii)) option)) of
         SOME ((i, s979_0)) =>
   (case ((string_drop s978_0 s979_0)) of
         s980_0 =>
   (case ((bit_maybe_o_matches_prefix s980_0 : (( 1 words$word # ii)) option)) of
         SOME ((o1, s981_0)) =>
   (case ((string_drop s980_0 s981_0)) of
         s982_0 =>
   (case ((bit_maybe_r_matches_prefix s982_0 : (( 1 words$word # ii)) option)) of
         SOME ((r, s983_0)) =>
   (case ((string_drop s982_0 s983_0)) of
         s984_0 =>
   (case ((bit_maybe_w_matches_prefix s984_0 : (( 1 words$word # ii)) option)) of
         SOME ((w, s985_0)) =>
   let p0_ = (string_drop s984_0 s985_0) in
   if (((p0_ = ""))) then SOME (i, o1, r, w) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((fence_bits_backwards_matches:string -> bool) arg_=
    (let s986_0 = arg_ in
   if ((case ((s976_ s986_0  :  (( 1 words$word #  1 words$word #  1 words$word #  1 words$word))option)) of
       SOME ((i, o1, r, w)) => T
     | _ => F
     )) then  (case
 (s976_ s986_0 : (( 1 words$word # 1 words$word # 1 words$word # 1 words$word)) option) of
     (SOME ((i, o1, r, w))) =>
 T
 )
   else F))`;


(*val _s987_ : string -> maybe ((mword ty1 * mword ty1 * mword ty1 * mword ty1 * string))*)

val _ = Define `
 ((s987_:string ->((1)words$word#(1)words$word#(1)words$word#(1)words$word#string)option) s988_0= 
  ((case s988_0 of
         s989_0 =>
   (case ((bit_maybe_i_matches_prefix s989_0 : (( 1 words$word # ii)) option)) of
         SOME ((i, s990_0)) =>
   (case ((string_drop s989_0 s990_0)) of
         s991_0 =>
   (case ((bit_maybe_o_matches_prefix s991_0 : (( 1 words$word # ii)) option)) of
         SOME ((o1, s992_0)) =>
   (case ((string_drop s991_0 s992_0)) of
         s993_0 =>
   (case ((bit_maybe_r_matches_prefix s993_0 : (( 1 words$word # ii)) option)) of
         SOME ((r, s994_0)) =>
   (case ((string_drop s993_0 s994_0)) of
         s995_0 =>
   (case ((bit_maybe_w_matches_prefix s995_0 : (( 1 words$word # ii)) option)) of
         SOME ((w, s996_0)) =>
   (case ((string_drop s995_0 s996_0)) of   s_ => SOME (i, o1, r, w, s_) )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((fence_bits_matches_prefix:string ->((4)words$word#int)option) arg_=
    (let s997_0 = arg_ in
   if ((case ((s987_ s997_0  :  (( 1 words$word #  1 words$word #  1 words$word #  1 words$word # string))option)) of
       SOME ((i, o1, r, w, s_)) => T
     | _ => F
     )) then  (case
 (s987_ s997_0 : (( 1 words$word # 1 words$word # 1 words$word # 1 words$word # string)) option) of
     (SOME ((i, o1, r, w, s_))) =>
 SOME
   ((concat_vec i
       ((concat_vec o1 ((concat_vec r w : 2 words$word)) : 3 words$word)) : 4 words$word),
   ((string_length arg_)) - ((string_length s_)))
 )
   else NONE))`;


(*val aqrl_str : bool -> bool -> string*)

val _ = Define `
 ((aqrl_str:bool -> bool -> string) (aq : bool) (rl : bool)=
    ((case (aq, rl) of
     (F, F) => ""
   | (F, T) => ".rl"
   | (T, F) => ".aq"
   | (T, T) => ".aqrl"
   )))`;


(*val lrsc_width_str : word_width -> string*)

val _ = Define `
 ((lrsc_width_str:word_width -> string) width=
    ((case width of   BYTE => ".b" | HALF => ".h" | WORD => ".w" | DOUBLE => ".d" )))`;


(*val amo_width_valid : word_width -> bool*)

val _ = Define `
 ((amo_width_valid:word_width -> bool) size1=
    ((case size1 of   WORD => T | DOUBLE => (( 32 : int):ii) >= (( 64 : int):ii) | _ => F )))`;


(*val process_loadres : forall 'int8_times_n. Size 'int8_times_n => mword ty5 -> mword ty32 -> MemoryOpResult (mword 'int8_times_n) -> bool -> M Retired*)

val _ = Define `
 ((process_loadres:(5)words$word ->(32)words$word ->('int8_times_n words$word)MemoryOpResult -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rd addr value is_unsigned=
    ((case ((extend_value is_unsigned value  : ( 32 words$word) MemoryOpResult)) of
     MemValue (result) =>
      let (_ : unit) = (load_reservation addr) in sail2_state_monad$seqS
      (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS)
   | MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
   )))`;


(*val encdec_amoop_forwards : amoop -> mword ty5*)

(*val encdec_amoop_backwards : mword ty5 -> M amoop*)

(*val encdec_amoop_forwards_matches : amoop -> bool*)

(*val encdec_amoop_backwards_matches : mword ty5 -> bool*)

val _ = Define `
 ((encdec_amoop_forwards:amoop ->(5)words$word) arg_=
    ((case arg_ of
     AMOSWAP => (0b00001w :  5 words$word)
   | AMOADD => (0b00000w :  5 words$word)
   | AMOXOR => (0b00100w :  5 words$word)
   | AMOAND => (0b01100w :  5 words$word)
   | AMOOR => (0b01000w :  5 words$word)
   | AMOMIN => (0b10000w :  5 words$word)
   | AMOMAX => (0b10100w :  5 words$word)
   | AMOMINU => (0b11000w :  5 words$word)
   | AMOMAXU => (0b11100w :  5 words$word)
   )))`;


val _ = Define `
 ((encdec_amoop_backwards:(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((amoop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00001w :  5 words$word)))) then sail2_state_monad$returnS AMOSWAP
   else if (((b__0 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS AMOADD
   else if (((b__0 = (0b00100w :  5 words$word)))) then sail2_state_monad$returnS AMOXOR
   else if (((b__0 = (0b01100w :  5 words$word)))) then sail2_state_monad$returnS AMOAND
   else if (((b__0 = (0b01000w :  5 words$word)))) then sail2_state_monad$returnS AMOOR
   else if (((b__0 = (0b10000w :  5 words$word)))) then sail2_state_monad$returnS AMOMIN
   else if (((b__0 = (0b10100w :  5 words$word)))) then sail2_state_monad$returnS AMOMAX
   else if (((b__0 = (0b11000w :  5 words$word)))) then sail2_state_monad$returnS AMOMINU
   else if (((b__0 = (0b11100w :  5 words$word)))) then sail2_state_monad$returnS AMOMAXU
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_amoop_forwards_matches:amoop -> bool) arg_= 
  ((case arg_ of
         AMOSWAP => T
     | AMOADD => T
     | AMOXOR => T
     | AMOAND => T
     | AMOOR => T
     | AMOMIN => T
     | AMOMAX => T
     | AMOMINU => T
     | AMOMAXU => T
   )))`;


val _ = Define `
 ((encdec_amoop_backwards_matches:(5)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b00001w :  5 words$word)))) then T
   else if (((b__0 = (0b00000w :  5 words$word)))) then T
   else if (((b__0 = (0b00100w :  5 words$word)))) then T
   else if (((b__0 = (0b01100w :  5 words$word)))) then T
   else if (((b__0 = (0b01000w :  5 words$word)))) then T
   else if (((b__0 = (0b10000w :  5 words$word)))) then T
   else if (((b__0 = (0b10100w :  5 words$word)))) then T
   else if (((b__0 = (0b11000w :  5 words$word)))) then T
   else if (((b__0 = (0b11100w :  5 words$word)))) then T
   else F))`;


(*val amo_mnemonic_forwards : amoop -> string*)

(*val amo_mnemonic_backwards : string -> M amoop*)

(*val amo_mnemonic_forwards_matches : amoop -> bool*)

(*val amo_mnemonic_backwards_matches : string -> bool*)

(*val amo_mnemonic_matches_prefix : string -> maybe ((amoop * ii))*)

val _ = Define `
 ((amo_mnemonic_forwards:amoop -> string) arg_=
    ((case arg_ of
     AMOSWAP => "amoswap"
   | AMOADD => "amoadd"
   | AMOXOR => "amoxor"
   | AMOAND => "amoand"
   | AMOOR => "amoor"
   | AMOMIN => "amomin"
   | AMOMAX => "amomax"
   | AMOMINU => "amominu"
   | AMOMAXU => "amomaxu"
   )))`;


val _ = Define `
 ((amo_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((amoop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "amoswap"))) then sail2_state_monad$returnS AMOSWAP
   else if (((p0_ = "amoadd"))) then sail2_state_monad$returnS AMOADD
   else if (((p0_ = "amoxor"))) then sail2_state_monad$returnS AMOXOR
   else if (((p0_ = "amoand"))) then sail2_state_monad$returnS AMOAND
   else if (((p0_ = "amoor"))) then sail2_state_monad$returnS AMOOR
   else if (((p0_ = "amomin"))) then sail2_state_monad$returnS AMOMIN
   else if (((p0_ = "amomax"))) then sail2_state_monad$returnS AMOMAX
   else if (((p0_ = "amominu"))) then sail2_state_monad$returnS AMOMINU
   else if (((p0_ = "amomaxu"))) then sail2_state_monad$returnS AMOMAXU
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((amo_mnemonic_forwards_matches:amoop -> bool) arg_= 
  ((case arg_ of
         AMOSWAP => T
     | AMOADD => T
     | AMOXOR => T
     | AMOAND => T
     | AMOOR => T
     | AMOMIN => T
     | AMOMAX => T
     | AMOMINU => T
     | AMOMAXU => T
   )))`;


val _ = Define `
 ((amo_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "amoswap"))) then T
   else if (((p0_ = "amoadd"))) then T
   else if (((p0_ = "amoxor"))) then T
   else if (((p0_ = "amoand"))) then T
   else if (((p0_ = "amoor"))) then T
   else if (((p0_ = "amomin"))) then T
   else if (((p0_ = "amomax"))) then T
   else if (((p0_ = "amominu"))) then T
   else if (((p0_ = "amomaxu"))) then T
   else F))`;


(*val _s1030_ : string -> maybe string*)

val _ = Define `
 ((s1030_:string ->(string)option) s1031_0=
    (let s1032_0 = s1031_0 in
   if ((string_startswith s1032_0 "amomaxu")) then  
  (case ((string_drop s1032_0 ((string_length "amomaxu")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1026_ : string -> maybe string*)

val _ = Define `
 ((s1026_:string ->(string)option) s1027_0=
    (let s1028_0 = s1027_0 in
   if ((string_startswith s1028_0 "amominu")) then  
  (case ((string_drop s1028_0 ((string_length "amominu")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1022_ : string -> maybe string*)

val _ = Define `
 ((s1022_:string ->(string)option) s1023_0=
    (let s1024_0 = s1023_0 in
   if ((string_startswith s1024_0 "amomax")) then  
  (case ((string_drop s1024_0 ((string_length "amomax")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1018_ : string -> maybe string*)

val _ = Define `
 ((s1018_:string ->(string)option) s1019_0=
    (let s1020_0 = s1019_0 in
   if ((string_startswith s1020_0 "amomin")) then  
  (case ((string_drop s1020_0 ((string_length "amomin")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1014_ : string -> maybe string*)

val _ = Define `
 ((s1014_:string ->(string)option) s1015_0=
    (let s1016_0 = s1015_0 in
   if ((string_startswith s1016_0 "amoor")) then  
  (case ((string_drop s1016_0 ((string_length "amoor")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1010_ : string -> maybe string*)

val _ = Define `
 ((s1010_:string ->(string)option) s1011_0=
    (let s1012_0 = s1011_0 in
   if ((string_startswith s1012_0 "amoand")) then  
  (case ((string_drop s1012_0 ((string_length "amoand")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1006_ : string -> maybe string*)

val _ = Define `
 ((s1006_:string ->(string)option) s1007_0=
    (let s1008_0 = s1007_0 in
   if ((string_startswith s1008_0 "amoxor")) then  
  (case ((string_drop s1008_0 ((string_length "amoxor")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1002_ : string -> maybe string*)

val _ = Define `
 ((s1002_:string ->(string)option) s1003_0=
    (let s1004_0 = s1003_0 in
   if ((string_startswith s1004_0 "amoadd")) then  
  (case ((string_drop s1004_0 ((string_length "amoadd")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s998_ : string -> maybe string*)

val _ = Define `
 ((s998_:string ->(string)option) s999_0=
    (let s1000_0 = s999_0 in
   if ((string_startswith s1000_0 "amoswap")) then  
  (case ((string_drop s1000_0 ((string_length "amoswap")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((amo_mnemonic_matches_prefix:string ->(amoop#int)option) arg_=
    (let s1001_0 = arg_ in
   if ((case ((s998_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s998_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOSWAP, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1002_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1002_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOADD, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1006_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1006_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOXOR, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1010_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1010_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOAND, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1014_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1014_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOOR, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1018_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1018_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOMIN, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1022_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1022_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOMAX, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1026_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1026_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOMINU, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1030_ s1001_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1030_ s1001_0 of
      (SOME (s_)) =>
  SOME (AMOMAXU, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val encdec_mul_op_forwards : (bool * bool * bool) -> mword ty3*)

(*val encdec_mul_op_backwards : mword ty3 -> M (bool * bool * bool)*)

(*val encdec_mul_op_forwards_matches : (bool * bool * bool) -> bool*)

(*val encdec_mul_op_backwards_matches : mword ty3 -> bool*)

val _ = Define `
 ((encdec_mul_op_forwards:bool#bool#bool ->(3)words$word) arg_=
    ((case arg_ of
     (F, T, T) => (0b000w :  3 words$word)
   | (T, T, T) => (0b001w :  3 words$word)
   | (T, T, F) => (0b010w :  3 words$word)
   | (T, F, F) => (0b011w :  3 words$word)
   )))`;


val _ = Define `
 ((encdec_mul_op_backwards:(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((bool#bool#bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then sail2_state_monad$returnS (F, T, T)
   else if (((b__0 = (0b001w :  3 words$word)))) then sail2_state_monad$returnS (T, T, T)
   else if (((b__0 = (0b010w :  3 words$word)))) then sail2_state_monad$returnS (T, T, F)
   else if (((b__0 = (0b011w :  3 words$word)))) then sail2_state_monad$returnS (T, F, F)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_mul_op_forwards_matches:bool#bool#bool -> bool) arg_=
    ((case arg_ of
     (F, T, T) => T
   | (T, T, T) => T
   | (T, T, F) => T
   | (T, F, F) => T
   | _ => F
   )))`;


val _ = Define `
 ((encdec_mul_op_backwards_matches:(3)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then T
   else if (((b__0 = (0b001w :  3 words$word)))) then T
   else if (((b__0 = (0b010w :  3 words$word)))) then T
   else if (((b__0 = (0b011w :  3 words$word)))) then T
   else F))`;


(*val mul_mnemonic_forwards : (bool * bool * bool) -> string*)

(*val mul_mnemonic_backwards : string -> M (bool * bool * bool)*)

(*val mul_mnemonic_forwards_matches : (bool * bool * bool) -> bool*)

(*val mul_mnemonic_backwards_matches : string -> bool*)

(*val mul_mnemonic_matches_prefix : string -> maybe (((bool * bool * bool) * ii))*)

val _ = Define `
 ((mul_mnemonic_forwards:bool#bool#bool -> string) arg_=
    ((case arg_ of
     (F, T, T) => "mul"
   | (T, T, T) => "mulh"
   | (T, T, F) => "mulhsu"
   | (T, F, F) => "mulhu"
   )))`;


val _ = Define `
 ((mul_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bool#bool#bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "mul"))) then sail2_state_monad$returnS (F, T, T)
   else if (((p0_ = "mulh"))) then sail2_state_monad$returnS (T, T, T)
   else if (((p0_ = "mulhsu"))) then sail2_state_monad$returnS (T, T, F)
   else if (((p0_ = "mulhu"))) then sail2_state_monad$returnS (T, F, F)
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((mul_mnemonic_forwards_matches:bool#bool#bool -> bool) arg_=
    ((case arg_ of
     (F, T, T) => T
   | (T, T, T) => T
   | (T, T, F) => T
   | (T, F, F) => T
   | _ => F
   )))`;


val _ = Define `
 ((mul_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "mul"))) then T
   else if (((p0_ = "mulh"))) then T
   else if (((p0_ = "mulhsu"))) then T
   else if (((p0_ = "mulhu"))) then T
   else F))`;


(*val _s1046_ : string -> maybe string*)

val _ = Define `
 ((s1046_:string ->(string)option) s1047_0=
    (let s1048_0 = s1047_0 in
   if ((string_startswith s1048_0 "mulhu")) then  
  (case ((string_drop s1048_0 ((string_length "mulhu")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1042_ : string -> maybe string*)

val _ = Define `
 ((s1042_:string ->(string)option) s1043_0=
    (let s1044_0 = s1043_0 in
   if ((string_startswith s1044_0 "mulhsu")) then  
  (case ((string_drop s1044_0 ((string_length "mulhsu")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1038_ : string -> maybe string*)

val _ = Define `
 ((s1038_:string ->(string)option) s1039_0=
    (let s1040_0 = s1039_0 in
   if ((string_startswith s1040_0 "mulh")) then  
  (case ((string_drop s1040_0 ((string_length "mulh")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1034_ : string -> maybe string*)

val _ = Define `
 ((s1034_:string ->(string)option) s1035_0=
    (let s1036_0 = s1035_0 in
   if ((string_startswith s1036_0 "mul")) then  
  (case ((string_drop s1036_0 ((string_length "mul")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((mul_mnemonic_matches_prefix:string ->((bool#bool#bool)#int)option) arg_=
    (let s1037_0 = arg_ in
   if ((case ((s1034_ s1037_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1034_ s1037_0 of
      (SOME (s_)) =>
  SOME ((F, T, T), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1038_ s1037_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1038_ s1037_0 of
      (SOME (s_)) =>
  SOME ((T, T, T), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1042_ s1037_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1042_ s1037_0 of
      (SOME (s_)) =>
  SOME ((T, T, F), ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1046_ s1037_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1046_ s1037_0 of
      (SOME (s_)) =>
  SOME ((T, F, F), ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val maybe_not_u_forwards : bool -> string*)

(*val maybe_not_u_backwards : string -> M bool*)

(*val maybe_not_u_forwards_matches : bool -> bool*)

(*val maybe_not_u_backwards_matches : string -> bool*)

(*val maybe_not_u_matches_prefix : string -> maybe ((bool * ii))*)

val _ = Define `
 ((maybe_not_u_forwards:bool -> string) arg_=  ((case arg_ of   F => "u" | T => "" )))`;


val _ = Define `
 ((maybe_not_u_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "u"))) then sail2_state_monad$returnS F
   else if (((p0_ = ""))) then sail2_state_monad$returnS T
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((maybe_not_u_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   F => T | T => T )))`;


val _ = Define `
 ((maybe_not_u_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "u"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s1054_ : string -> maybe string*)

val _ = Define `
 ((s1054_:string ->(string)option) s1055_0=
    (let s1056_0 = s1055_0 in
   if ((string_startswith s1056_0 "")) then  
  (case ((string_drop s1056_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1050_ : string -> maybe string*)

val _ = Define `
 ((s1050_:string ->(string)option) s1051_0=
    (let s1052_0 = s1051_0 in
   if ((string_startswith s1052_0 "u")) then  
  (case ((string_drop s1052_0 ((string_length "u")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((maybe_not_u_matches_prefix:string ->(bool#int)option) arg_=
    (let s1053_0 = arg_ in
   if ((case ((s1050_ s1053_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1050_ s1053_0 of
      (SOME (s_)) =>
  SOME (F, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1054_ s1053_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1054_ s1053_0 of
      (SOME (s_)) =>
  SOME (T, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val encdec_csrop_forwards : csrop -> mword ty2*)

(*val encdec_csrop_backwards : mword ty2 -> M csrop*)

(*val encdec_csrop_forwards_matches : csrop -> bool*)

(*val encdec_csrop_backwards_matches : mword ty2 -> bool*)

val _ = Define `
 ((encdec_csrop_forwards:csrop ->(2)words$word) arg_=
    ((case arg_ of
     CSRRW => (0b01w :  2 words$word)
   | CSRRS => (0b10w :  2 words$word)
   | CSRRC => (0b11w :  2 words$word)
   )))`;


val _ = Define `
 ((encdec_csrop_backwards:(2)words$word ->(regstate)sail2_state_monad$sequential_state ->(((csrop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b01w :  2 words$word)))) then sail2_state_monad$returnS CSRRW
   else if (((b__0 = (0b10w :  2 words$word)))) then sail2_state_monad$returnS CSRRS
   else if (((b__0 = (0b11w :  2 words$word)))) then sail2_state_monad$returnS CSRRC
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_csrop_forwards_matches:csrop -> bool) arg_= 
  ((case arg_ of   CSRRW => T | CSRRS => T | CSRRC => T )))`;


val _ = Define `
 ((encdec_csrop_backwards_matches:(2)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b01w :  2 words$word)))) then T
   else if (((b__0 = (0b10w :  2 words$word)))) then T
   else if (((b__0 = (0b11w :  2 words$word)))) then T
   else F))`;


(*val readCSR : mword ty12 -> M (mword ty32)*)

val _ = Define `
 ((readCSR:(12)words$word ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) csr=  (sail2_state_monad$bindS
   (case (csr, (( 32 : int):ii)) of
     (b__0, g__325) =>
      if (((b__0 = (0xF11w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mvendorid_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
        sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) w__0  :  32 words$word)))
      else if (((b__0 = (0xF12w :  12 words$word)))) then (sail2_state_monad$read_regS marchid_ref  : ( 32 words$word) M)
      else if (((b__0 = (0xF13w :  12 words$word)))) then (sail2_state_monad$read_regS mimpid_ref  : ( 32 words$word) M)
      else if (((b__0 = (0xF14w :  12 words$word)))) then (sail2_state_monad$read_regS mhartid_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x300w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mstatus_ref) (\ (w__4 : Mstatus) . 
        sail2_state_monad$returnS ((get_Mstatus_bits w__4  :  32 words$word)))
      else if (((b__0 = (0x301w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS misa_ref) (\ (w__5 : Misa) .  sail2_state_monad$returnS ((get_Misa_bits w__5  :  32 words$word)))
      else if (((b__0 = (0x302w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS medeleg_ref) (\ (w__6 : Medeleg) . 
        sail2_state_monad$returnS ((get_Medeleg_bits w__6  :  32 words$word)))
      else if (((b__0 = (0x303w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mideleg_ref) (\ (w__7 : Minterrupts) . 
        sail2_state_monad$returnS ((get_Minterrupts_bits w__7  :  32 words$word)))
      else if (((b__0 = (0x304w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mie_ref) (\ (w__8 : Minterrupts) . 
        sail2_state_monad$returnS ((get_Minterrupts_bits w__8  :  32 words$word)))
      else if (((b__0 = (0x305w :  12 words$word)))) then (get_mtvec ()   : ( 32 words$word) M)
      else if (((b__0 = (0x306w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcounteren_ref) (\ (w__10 : Counteren) . 
        sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) ((get_Counteren_bits w__10  :  32 words$word))  :  32 words$word)))
      else if ((((((b__0 = (0x310w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mstatush_ref) (\ (w__11 : Mstatush) . 
        sail2_state_monad$returnS ((get_Mstatush_bits w__11  :  32 words$word)))
      else if (((b__0 = (0x320w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcountinhibit_ref) (\ (w__12 : Counterin) . 
        sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) ((get_Counterin_bits w__12  :  32 words$word))  :  32 words$word)))
      else if (((b__0 = (0x340w :  12 words$word)))) then (sail2_state_monad$read_regS mscratch_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x341w :  12 words$word)))) then sail2_state_monad$bindS
        (get_xret_target Machine  : ( 32 words$word) M) (\ (w__14 :  32 words$word) .  sail2_state_monad$bindS
        (pc_alignment_mask ()   : ( 32 words$word) M) (\ (w__15 :  32 words$word) . 
        sail2_state_monad$returnS ((and_vec w__14 w__15  :  32 words$word))))
      else if (((b__0 = (0x342w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcause_ref) (\ (w__16 : Mcause) . 
        sail2_state_monad$returnS ((get_Mcause_bits w__16  :  32 words$word)))
      else if (((b__0 = (0x343w :  12 words$word)))) then (sail2_state_monad$read_regS mtval_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x344w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mip_ref) (\ (w__18 : Minterrupts) . 
        sail2_state_monad$returnS ((get_Minterrupts_bits w__18  :  32 words$word)))
      else if (((b__0 = (0x3A0w :  12 words$word)))) then (pmpReadCfgReg (( 0 : int):ii)  : ( 32 words$word) M)
      else if ((((((b__0 = (0x3A1w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then
        (pmpReadCfgReg (( 1 : int):ii)  : ( 32 words$word) M)
      else if (((b__0 = (0x3A2w :  12 words$word)))) then (pmpReadCfgReg (( 2 : int):ii)  : ( 32 words$word) M)
      else if ((((((b__0 = (0x3A3w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then
        (pmpReadCfgReg (( 3 : int):ii)  : ( 32 words$word) M)
      else if (((b__0 = (0x3B0w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr0_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B1w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr1_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B2w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr2_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B3w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr3_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B4w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr4_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B5w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr5_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B6w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr6_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B7w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr7_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B8w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr8_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3B9w :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr9_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3BAw :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr10_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3BBw :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr11_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3BCw :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr12_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3BDw :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr13_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3BEw :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr14_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x3BFw :  12 words$word)))) then (sail2_state_monad$read_regS pmpaddr15_ref  : ( 32 words$word) M)
      else if (((b__0 = (0xB00w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__39 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__39 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii)  :  32 words$word)))
      else if (((b__0 = (0xB02w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__40 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__40 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii)  :  32 words$word)))
      else if ((((((b__0 = (0xB80w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__41 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__41 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word)))
      else if ((((((b__0 = (0xB82w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__42 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__42 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word)))
      else if (((b__0 = (0x7A0w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS tselect_ref  : ( 32 words$word) M) (\ (w__43 :  32 words$word) . 
        sail2_state_monad$returnS ((not_vec w__43  :  32 words$word)))
      else if (((b__0 = (0x100w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mstatus_ref) (\ (w__44 : Mstatus) . 
        sail2_state_monad$returnS ((get_Sstatus_bits ((lower_mstatus w__44))  :  32 words$word)))
      else if (((b__0 = (0x102w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS sedeleg_ref) (\ (w__45 : Sedeleg) . 
        sail2_state_monad$returnS ((get_Sedeleg_bits w__45  :  32 words$word)))
      else if (((b__0 = (0x103w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS sideleg_ref) (\ (w__46 : Sinterrupts) . 
        sail2_state_monad$returnS ((get_Sinterrupts_bits w__46  :  32 words$word)))
      else if (((b__0 = (0x104w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mie_ref) (\ (w__47 : Minterrupts) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS mideleg_ref) (\ (w__48 : Minterrupts) . 
        sail2_state_monad$returnS ((get_Sinterrupts_bits ((lower_mie w__47 w__48))  :  32 words$word))))
      else if (((b__0 = (0x105w :  12 words$word)))) then (get_stvec ()   : ( 32 words$word) M)
      else if (((b__0 = (0x106w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS scounteren_ref) (\ (w__50 : Counteren) . 
        sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) ((get_Counteren_bits w__50  :  32 words$word))  :  32 words$word)))
      else if (((b__0 = (0x140w :  12 words$word)))) then (sail2_state_monad$read_regS sscratch_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x141w :  12 words$word)))) then sail2_state_monad$bindS
        (get_xret_target Supervisor  : ( 32 words$word) M) (\ (w__52 :  32 words$word) .  sail2_state_monad$bindS
        (pc_alignment_mask ()   : ( 32 words$word) M) (\ (w__53 :  32 words$word) . 
        sail2_state_monad$returnS ((and_vec w__52 w__53  :  32 words$word))))
      else if (((b__0 = (0x142w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS scause_ref) (\ (w__54 : Mcause) . 
        sail2_state_monad$returnS ((get_Mcause_bits w__54  :  32 words$word)))
      else if (((b__0 = (0x143w :  12 words$word)))) then (sail2_state_monad$read_regS stval_ref  : ( 32 words$word) M)
      else if (((b__0 = (0x144w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mip_ref) (\ (w__56 : Minterrupts) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS mideleg_ref) (\ (w__57 : Minterrupts) . 
        sail2_state_monad$returnS ((get_Sinterrupts_bits ((lower_mip w__56 w__57))  :  32 words$word))))
      else if (((b__0 = (0x180w :  12 words$word)))) then (sail2_state_monad$read_regS satp_ref  : ( 32 words$word) M)
      else if (((b__0 = (0xC00w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__59 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__59 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii)  :  32 words$word)))
      else if (((b__0 = (0xC01w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__60 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__60 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii)  :  32 words$word)))
      else if (((b__0 = (0xC02w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__61 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__61 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii)  :  32 words$word)))
      else if ((((((b__0 = (0xC80w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__62 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__62 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word)))
      else if ((((((b__0 = (0xC81w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mtime_ref  : ( 64 words$word) M) (\ (w__63 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__63 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word)))
      else if ((((((b__0 = (0xC82w :  12 words$word)))) /\ (((g__325 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__64 :  64 words$word) . 
        sail2_state_monad$returnS ((subrange_vec_dec w__64 (( 63 : int):ii) (( 32 : int):ii)  :  32 words$word)))
      else sail2_state_monad$bindS
        (ext_read_CSR csr  : ( ( 32 words$word)option) M) (\ (w__65 :  ( 32 words$word)option) . 
        sail2_state_monad$returnS ((case w__65 of
          SOME (res) => res
        | NONE =>
           let (_ : unit) = (print_bits0 "unhandled read to CSR " csr) in
           (EXTZ (( 32 : int):ii) (0x0w :  4 words$word)  :  32 words$word)
        )))
   ) (\ (res : xlenbits) . 
   let (_ : unit) =
     (if ((get_config_print_reg () )) then
       print_dbg
         ((STRCAT "CSR "
             ((STRCAT ((csr_name csr)) ((STRCAT " -> " ((string_of_bits res))))))))
     else () ) in
   sail2_state_monad$returnS res)))`;


(*val writeCSR : mword ty12 -> mword ty32 -> M unit*)

val _ = Define `
 ((writeCSR:(12)words$word ->(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) (csr : csreg) (value : xlenbits)=  (sail2_state_monad$bindS
   (case (csr, (( 32 : int):ii)) of
     (b__0, g__324) =>
      if (((b__0 = (0x300w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mstatus_ref) (\ (w__0 : Mstatus) .  sail2_state_monad$bindS
        (legalize_mstatus w__0 value) (\ (w__1 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mstatus_ref w__1)
        (sail2_state_monad$read_regS mstatus_ref)) (\ (w__2 : Mstatus) . 
        sail2_state_monad$returnS (SOME ((get_Mstatus_bits w__2  :  32 words$word))))))
      else if (((b__0 = (0x301w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS misa_ref) (\ (w__3 : Misa) .  sail2_state_monad$bindS
        (legalize_misa w__3 value) (\ (w__4 : Misa) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS misa_ref w__4)
        (sail2_state_monad$read_regS misa_ref)) (\ (w__5 : Misa) . 
        sail2_state_monad$returnS (SOME ((get_Misa_bits w__5  :  32 words$word))))))
      else if (((b__0 = (0x302w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS medeleg_ref) (\ (w__6 : Medeleg) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS medeleg_ref ((legalize_medeleg w__6 value)))
        (sail2_state_monad$read_regS medeleg_ref)) (\ (w__7 : Medeleg) . 
        sail2_state_monad$returnS (SOME ((get_Medeleg_bits w__7  :  32 words$word)))))
      else if (((b__0 = (0x303w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mideleg_ref) (\ (w__8 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mideleg_ref ((legalize_mideleg w__8 value)))
        (sail2_state_monad$read_regS mideleg_ref)) (\ (w__9 : Minterrupts) . 
        sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__9  :  32 words$word)))))
      else if (((b__0 = (0x304w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mie_ref) (\ (w__10 : Minterrupts) .  sail2_state_monad$bindS
        (legalize_mie w__10 value) (\ (w__11 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mie_ref w__11)
        (sail2_state_monad$read_regS mie_ref)) (\ (w__12 : Minterrupts) . 
        sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__12  :  32 words$word))))))
      else if (((b__0 = (0x305w :  12 words$word)))) then sail2_state_monad$bindS
        (set_mtvec value  : ( 32 words$word) M) (\ (w__13 :  32 words$word) .  sail2_state_monad$returnS (SOME w__13))
      else if (((b__0 = (0x306w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcounteren_ref) (\ (w__14 : Counteren) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mcounteren_ref ((legalize_mcounteren w__14 value)))
        (sail2_state_monad$read_regS mcounteren_ref)) (\ (w__15 : Counteren) . 
        sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Counteren_bits w__15  :  32 words$word))  :  32 words$word)))))
      else if ((((((b__0 = (0x310w :  12 words$word)))) /\ (((g__324 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mstatush_ref) (\ (w__16 : Mstatush) . 
        sail2_state_monad$returnS (SOME ((get_Mstatush_bits w__16  :  32 words$word))))
      else if (((b__0 = (0x320w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcountinhibit_ref) (\ (w__17 : Counterin) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mcountinhibit_ref ((legalize_mcountinhibit w__17 value)))
        (sail2_state_monad$read_regS mcountinhibit_ref)) (\ (w__18 : Counterin) . 
        sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Counterin_bits w__18  :  32 words$word))  :  32 words$word)))))
      else if (((b__0 = (0x340w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mscratch_ref value)
        (sail2_state_monad$read_regS mscratch_ref  : ( 32 words$word) M)) (\ (w__19 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__19))
      else if (((b__0 = (0x341w :  12 words$word)))) then sail2_state_monad$bindS
        (set_xret_target Machine value  : ( 32 words$word) M) (\ (w__20 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__20))
      else if (((b__0 = (0x342w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (set_Mcause_bits mcause_ref value)
        (sail2_state_monad$read_regS mcause_ref)) (\ (w__21 : Mcause) . 
        sail2_state_monad$returnS (SOME ((get_Mcause_bits w__21  :  32 words$word))))
      else if (((b__0 = (0x343w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mtval_ref value)
        (sail2_state_monad$read_regS mtval_ref  : ( 32 words$word) M)) (\ (w__22 :  32 words$word) .  sail2_state_monad$returnS (SOME w__22))
      else if (((b__0 = (0x344w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mip_ref) (\ (w__23 : Minterrupts) .  sail2_state_monad$bindS
        (legalize_mip w__23 value) (\ (w__24 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mip_ref w__24)
        (sail2_state_monad$read_regS mip_ref)) (\ (w__25 : Minterrupts) . 
        sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__25  :  32 words$word))))))
      else if (((b__0 = (0x3A0w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (pmpWriteCfgReg (( 0 : int):ii) value)
        (pmpReadCfgReg (( 0 : int):ii)  : ( 32 words$word) M)) (\ (w__26 :  32 words$word) .  sail2_state_monad$returnS (SOME w__26))
      else if ((((((b__0 = (0x3A1w :  12 words$word)))) /\ (((g__324 = (( 32 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (pmpWriteCfgReg (( 1 : int):ii) value)
        (pmpReadCfgReg (( 1 : int):ii)  : ( 32 words$word) M)) (\ (w__27 :  32 words$word) .  sail2_state_monad$returnS (SOME w__27))
      else if (((b__0 = (0x3A2w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (pmpWriteCfgReg (( 2 : int):ii) value)
        (pmpReadCfgReg (( 2 : int):ii)  : ( 32 words$word) M)) (\ (w__28 :  32 words$word) .  sail2_state_monad$returnS (SOME w__28))
      else if ((((((b__0 = (0x3A3w :  12 words$word)))) /\ (((g__324 = (( 32 : int):ii))))))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (pmpWriteCfgReg (( 3 : int):ii) value)
        (pmpReadCfgReg (( 3 : int):ii)  : ( 32 words$word) M)) (\ (w__29 :  32 words$word) .  sail2_state_monad$returnS (SOME w__29))
      else if (((b__0 = (0x3B0w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp0cfg_ref) (\ (w__30 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp1cfg_ref) (\ (w__31 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__31) (\ (w__32 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr0_ref  : ( 32 words$word) M) (\ (w__33 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr0_ref ((pmpWriteAddr ((pmpLocked w__30)) w__32 w__33 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr0_ref  : ( 32 words$word) M)) (\ (w__34 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__34))))))
      else if (((b__0 = (0x3B1w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp1cfg_ref) (\ (w__35 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp2cfg_ref) (\ (w__36 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__36) (\ (w__37 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr1_ref  : ( 32 words$word) M) (\ (w__38 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr1_ref ((pmpWriteAddr ((pmpLocked w__35)) w__37 w__38 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr1_ref  : ( 32 words$word) M)) (\ (w__39 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__39))))))
      else if (((b__0 = (0x3B2w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp2cfg_ref) (\ (w__40 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp3cfg_ref) (\ (w__41 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__41) (\ (w__42 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr2_ref  : ( 32 words$word) M) (\ (w__43 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr2_ref ((pmpWriteAddr ((pmpLocked w__40)) w__42 w__43 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr2_ref  : ( 32 words$word) M)) (\ (w__44 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__44))))))
      else if (((b__0 = (0x3B3w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp3cfg_ref) (\ (w__45 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp4cfg_ref) (\ (w__46 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__46) (\ (w__47 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr3_ref  : ( 32 words$word) M) (\ (w__48 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr3_ref ((pmpWriteAddr ((pmpLocked w__45)) w__47 w__48 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr3_ref  : ( 32 words$word) M)) (\ (w__49 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__49))))))
      else if (((b__0 = (0x3B4w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp4cfg_ref) (\ (w__50 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp5cfg_ref) (\ (w__51 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__51) (\ (w__52 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr4_ref  : ( 32 words$word) M) (\ (w__53 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr4_ref ((pmpWriteAddr ((pmpLocked w__50)) w__52 w__53 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr4_ref  : ( 32 words$word) M)) (\ (w__54 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__54))))))
      else if (((b__0 = (0x3B5w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp5cfg_ref) (\ (w__55 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp6cfg_ref) (\ (w__56 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__56) (\ (w__57 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr5_ref  : ( 32 words$word) M) (\ (w__58 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr5_ref ((pmpWriteAddr ((pmpLocked w__55)) w__57 w__58 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr5_ref  : ( 32 words$word) M)) (\ (w__59 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__59))))))
      else if (((b__0 = (0x3B6w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp6cfg_ref) (\ (w__60 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp7cfg_ref) (\ (w__61 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__61) (\ (w__62 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr6_ref  : ( 32 words$word) M) (\ (w__63 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr6_ref ((pmpWriteAddr ((pmpLocked w__60)) w__62 w__63 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr6_ref  : ( 32 words$word) M)) (\ (w__64 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__64))))))
      else if (((b__0 = (0x3B7w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp7cfg_ref) (\ (w__65 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp8cfg_ref) (\ (w__66 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__66) (\ (w__67 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr7_ref  : ( 32 words$word) M) (\ (w__68 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr7_ref ((pmpWriteAddr ((pmpLocked w__65)) w__67 w__68 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr7_ref  : ( 32 words$word) M)) (\ (w__69 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__69))))))
      else if (((b__0 = (0x3B8w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp8cfg_ref) (\ (w__70 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp9cfg_ref) (\ (w__71 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__71) (\ (w__72 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr8_ref  : ( 32 words$word) M) (\ (w__73 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr8_ref ((pmpWriteAddr ((pmpLocked w__70)) w__72 w__73 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr8_ref  : ( 32 words$word) M)) (\ (w__74 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__74))))))
      else if (((b__0 = (0x3B9w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp9cfg_ref) (\ (w__75 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp10cfg_ref) (\ (w__76 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__76) (\ (w__77 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr9_ref  : ( 32 words$word) M) (\ (w__78 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr9_ref ((pmpWriteAddr ((pmpLocked w__75)) w__77 w__78 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr9_ref  : ( 32 words$word) M)) (\ (w__79 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__79))))))
      else if (((b__0 = (0x3BAw :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp10cfg_ref) (\ (w__80 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp11cfg_ref) (\ (w__81 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__81) (\ (w__82 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr10_ref  : ( 32 words$word) M) (\ (w__83 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr10_ref ((pmpWriteAddr ((pmpLocked w__80)) w__82 w__83 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr10_ref  : ( 32 words$word) M)) (\ (w__84 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__84))))))
      else if (((b__0 = (0x3BBw :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp11cfg_ref) (\ (w__85 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp12cfg_ref) (\ (w__86 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__86) (\ (w__87 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr11_ref  : ( 32 words$word) M) (\ (w__88 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr11_ref ((pmpWriteAddr ((pmpLocked w__85)) w__87 w__88 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr11_ref  : ( 32 words$word) M)) (\ (w__89 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__89))))))
      else if (((b__0 = (0x3BCw :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp12cfg_ref) (\ (w__90 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp13cfg_ref) (\ (w__91 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__91) (\ (w__92 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr12_ref  : ( 32 words$word) M) (\ (w__93 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr12_ref ((pmpWriteAddr ((pmpLocked w__90)) w__92 w__93 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr12_ref  : ( 32 words$word) M)) (\ (w__94 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__94))))))
      else if (((b__0 = (0x3BDw :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp13cfg_ref) (\ (w__95 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp14cfg_ref) (\ (w__96 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__96) (\ (w__97 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr13_ref  : ( 32 words$word) M) (\ (w__98 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS pmpaddr13_ref ((pmpWriteAddr ((pmpLocked w__95)) w__97 w__98 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr13_ref  : ( 32 words$word) M)) (\ (w__99 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__99))))))
      else if (((b__0 = (0x3BEw :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp14cfg_ref) (\ (w__100 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp15cfg_ref) (\ (w__101 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (pmpTORLocked w__101) (\ (w__102 : bool) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr14_ref  : ( 32 words$word) M) (\ (w__103 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS
          pmpaddr14_ref
          ((pmpWriteAddr ((pmpLocked w__100)) w__102 w__103 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr14_ref  : ( 32 words$word) M)) (\ (w__104 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__104))))))
      else if (((b__0 = (0x3BFw :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmp15cfg_ref) (\ (w__105 : Pmpcfg_ent) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS pmpaddr15_ref  : ( 32 words$word) M) (\ (w__106 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS
          pmpaddr15_ref
          ((pmpWriteAddr ((pmpLocked w__105)) F w__106 value  :  32 words$word)))
        (sail2_state_monad$read_regS pmpaddr15_ref  : ( 32 words$word) M)) (\ (w__107 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__107))))
      else if (((b__0 = (0xB00w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__108 :  64 words$word) .  sail2_state_monad$seqS
        (sail2_state_monad$write_regS
          mcycle_ref
          ((update_subrange_vec_dec w__108 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii) value
             :  64 words$word)))
        (sail2_state_monad$returnS (SOME value)))
      else if (((b__0 = (0xB02w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__109 :  64 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS
          minstret_ref
          ((update_subrange_vec_dec w__109 (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii) value
             :  64 words$word)))
        (sail2_state_monad$write_regS minstret_written_ref T)) (sail2_state_monad$returnS (SOME value)))
      else if ((((((b__0 = (0xB80w :  12 words$word)))) /\ (((g__324 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mcycle_ref  : ( 64 words$word) M) (\ (w__110 :  64 words$word) .  sail2_state_monad$seqS
        (sail2_state_monad$write_regS mcycle_ref ((update_subrange_vec_dec w__110 (( 63 : int):ii) (( 32 : int):ii) value  :  64 words$word)))
        (sail2_state_monad$returnS (SOME value)))
      else if ((((((b__0 = (0xB82w :  12 words$word)))) /\ (((g__324 = (( 32 : int):ii))))))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS minstret_ref  : ( 64 words$word) M) (\ (w__111 :  64 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS
          minstret_ref
          ((update_subrange_vec_dec w__111 (( 63 : int):ii) (( 32 : int):ii) value  :  64 words$word)))
        (sail2_state_monad$write_regS minstret_written_ref T)) (sail2_state_monad$returnS (SOME value)))
      else if (((b__0 = (0x7A0w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS tselect_ref value)
        (sail2_state_monad$read_regS tselect_ref  : ( 32 words$word) M)) (\ (w__112 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__112))
      else if (((b__0 = (0x100w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mstatus_ref) (\ (w__113 : Mstatus) .  sail2_state_monad$bindS
        (legalize_sstatus w__113 value) (\ (w__114 : Mstatus) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mstatus_ref w__114)
        (sail2_state_monad$read_regS mstatus_ref)) (\ (w__115 : Mstatus) . 
        sail2_state_monad$returnS (SOME ((get_Mstatus_bits w__115  :  32 words$word))))))
      else if (((b__0 = (0x102w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS sedeleg_ref) (\ (w__116 : Sedeleg) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS sedeleg_ref ((legalize_sedeleg w__116 value)))
        (sail2_state_monad$read_regS sedeleg_ref)) (\ (w__117 : Sedeleg) . 
        sail2_state_monad$returnS (SOME ((get_Sedeleg_bits w__117  :  32 words$word)))))
      else if (((b__0 = (0x103w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (set_Sinterrupts_bits sideleg_ref value)
        (sail2_state_monad$read_regS sideleg_ref)) (\ (w__118 : Sinterrupts) . 
        sail2_state_monad$returnS (SOME ((get_Sinterrupts_bits w__118  :  32 words$word))))
      else if (((b__0 = (0x104w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mie_ref) (\ (w__119 : Minterrupts) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS mideleg_ref) (\ (w__120 : Minterrupts) .  sail2_state_monad$bindS
        (legalize_sie w__119 w__120 value) (\ (w__121 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mie_ref w__121)
        (sail2_state_monad$read_regS mie_ref)) (\ (w__122 : Minterrupts) . 
        sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__122  :  32 words$word)))))))
      else if (((b__0 = (0x105w :  12 words$word)))) then sail2_state_monad$bindS
        (set_stvec value  : ( 32 words$word) M) (\ (w__123 :  32 words$word) .  sail2_state_monad$returnS (SOME w__123))
      else if (((b__0 = (0x106w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS scounteren_ref) (\ (w__124 : Counteren) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS scounteren_ref ((legalize_scounteren w__124 value)))
        (sail2_state_monad$read_regS scounteren_ref)) (\ (w__125 : Counteren) . 
        sail2_state_monad$returnS (SOME ((EXTZ (( 32 : int):ii) ((get_Counteren_bits w__125  :  32 words$word))  :  32 words$word)))))
      else if (((b__0 = (0x140w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS sscratch_ref value)
        (sail2_state_monad$read_regS sscratch_ref  : ( 32 words$word) M)) (\ (w__126 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__126))
      else if (((b__0 = (0x141w :  12 words$word)))) then sail2_state_monad$bindS
        (set_xret_target Supervisor value  : ( 32 words$word) M) (\ (w__127 :  32 words$word) . 
        sail2_state_monad$returnS (SOME w__127))
      else if (((b__0 = (0x142w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (set_Mcause_bits scause_ref value)
        (sail2_state_monad$read_regS scause_ref)) (\ (w__128 : Mcause) . 
        sail2_state_monad$returnS (SOME ((get_Mcause_bits w__128  :  32 words$word))))
      else if (((b__0 = (0x143w :  12 words$word)))) then sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS stval_ref value)
        (sail2_state_monad$read_regS stval_ref  : ( 32 words$word) M)) (\ (w__129 :  32 words$word) .  sail2_state_monad$returnS (SOME w__129))
      else if (((b__0 = (0x144w :  12 words$word)))) then sail2_state_monad$bindS
        (sail2_state_monad$read_regS mip_ref) (\ (w__130 : Minterrupts) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS mideleg_ref) (\ (w__131 : Minterrupts) .  sail2_state_monad$bindS
        (legalize_sip w__130 w__131 value) (\ (w__132 : Minterrupts) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS mip_ref w__132)
        (sail2_state_monad$read_regS mip_ref)) (\ (w__133 : Minterrupts) . 
        sail2_state_monad$returnS (SOME ((get_Minterrupts_bits w__133  :  32 words$word)))))))
      else if (((b__0 = (0x180w :  12 words$word)))) then sail2_state_monad$bindS
        (cur_Architecture () ) (\ (w__134 : Architecture) .  sail2_state_monad$bindS
        (sail2_state_monad$read_regS satp_ref  : ( 32 words$word) M) (\ (w__135 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
        (sail2_state_monad$write_regS satp_ref ((legalize_satp w__134 w__135 value  :  32 words$word)))
        (sail2_state_monad$read_regS satp_ref  : ( 32 words$word) M)) (\ (w__136 :  32 words$word) .  sail2_state_monad$returnS (SOME w__136))))
      else (ext_write_CSR csr value  : ( ( 32 words$word)option) M)
   ) (\ (res :  xlenbits option) . 
   sail2_state_monad$returnS ((case res of
     SOME (v) =>
      if ((get_config_print_reg () )) then
        print_dbg
          ((STRCAT "CSR "
              ((STRCAT ((csr_name csr))
                  ((STRCAT " <- "
                      ((STRCAT ((string_of_bits v))
                          ((STRCAT " (input: " ((STRCAT ((string_of_bits value)) ")"))))))))))))
      else () 
   | NONE => print_bits0 "unhandled write to CSR " csr
   )))))`;


(*val maybe_i_forwards : bool -> string*)

(*val maybe_i_backwards : string -> M bool*)

(*val maybe_i_forwards_matches : bool -> bool*)

(*val maybe_i_backwards_matches : string -> bool*)

(*val maybe_i_matches_prefix : string -> maybe ((bool * ii))*)

val _ = Define `
 ((maybe_i_forwards:bool -> string) arg_=  ((case arg_ of   T => "i" | F => "" )))`;


val _ = Define `
 ((maybe_i_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "i"))) then sail2_state_monad$returnS T
   else if (((p0_ = ""))) then sail2_state_monad$returnS F
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((maybe_i_forwards_matches:bool -> bool) arg_= 
  ((case arg_ of   T => T | F => T )))`;


val _ = Define `
 ((maybe_i_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "i"))) then T
   else if (((p0_ = ""))) then T
   else F))`;


(*val _s1062_ : string -> maybe string*)

val _ = Define `
 ((s1062_:string ->(string)option) s1063_0=
    (let s1064_0 = s1063_0 in
   if ((string_startswith s1064_0 "")) then  
  (case ((string_drop s1064_0 ((string_length "")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1058_ : string -> maybe string*)

val _ = Define `
 ((s1058_:string ->(string)option) s1059_0=
    (let s1060_0 = s1059_0 in
   if ((string_startswith s1060_0 "i")) then  
  (case ((string_drop s1060_0 ((string_length "i")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((maybe_i_matches_prefix:string ->(bool#int)option) arg_=
    (let s1061_0 = arg_ in
   if ((case ((s1058_ s1061_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1058_ s1061_0 of
      (SOME (s_)) =>
  SOME (T, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1062_ s1061_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1062_ s1061_0 of
      (SOME (s_)) =>
  SOME (F, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val csr_mnemonic_forwards : csrop -> string*)

(*val csr_mnemonic_backwards : string -> M csrop*)

(*val csr_mnemonic_forwards_matches : csrop -> bool*)

(*val csr_mnemonic_backwards_matches : string -> bool*)

(*val csr_mnemonic_matches_prefix : string -> maybe ((csrop * ii))*)

val _ = Define `
 ((csr_mnemonic_forwards:csrop -> string) arg_=
    ((case arg_ of   CSRRW => "csrrw" | CSRRS => "csrrs" | CSRRC => "csrrc" )))`;


val _ = Define `
 ((csr_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((csrop),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "csrrw"))) then sail2_state_monad$returnS CSRRW
   else if (((p0_ = "csrrs"))) then sail2_state_monad$returnS CSRRS
   else if (((p0_ = "csrrc"))) then sail2_state_monad$returnS CSRRC
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((csr_mnemonic_forwards_matches:csrop -> bool) arg_= 
  ((case arg_ of   CSRRW => T | CSRRS => T | CSRRC => T )))`;


val _ = Define `
 ((csr_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "csrrw"))) then T
   else if (((p0_ = "csrrs"))) then T
   else if (((p0_ = "csrrc"))) then T
   else F))`;


(*val _s1074_ : string -> maybe string*)

val _ = Define `
 ((s1074_:string ->(string)option) s1075_0=
    (let s1076_0 = s1075_0 in
   if ((string_startswith s1076_0 "csrrc")) then  
  (case ((string_drop s1076_0 ((string_length "csrrc")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1070_ : string -> maybe string*)

val _ = Define `
 ((s1070_:string ->(string)option) s1071_0=
    (let s1072_0 = s1071_0 in
   if ((string_startswith s1072_0 "csrrs")) then  
  (case ((string_drop s1072_0 ((string_length "csrrs")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1066_ : string -> maybe string*)

val _ = Define `
 ((s1066_:string ->(string)option) s1067_0=
    (let s1068_0 = s1067_0 in
   if ((string_startswith s1068_0 "csrrw")) then  
  (case ((string_drop s1068_0 ((string_length "csrrw")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((csr_mnemonic_matches_prefix:string ->(csrop#int)option) arg_=
    (let s1069_0 = arg_ in
   if ((case ((s1066_ s1069_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1066_ s1069_0 of
      (SOME (s_)) =>
  SOME (CSRRW, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1070_ s1069_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1070_ s1069_0 of
      (SOME (s_)) =>
  SOME (CSRRS, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1074_ s1069_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1074_ s1069_0 of
      (SOME (s_)) =>
  SOME (CSRRC, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val encdec_rounding_mode_forwards : rounding_mode -> mword ty3*)

(*val encdec_rounding_mode_backwards : mword ty3 -> M rounding_mode*)

(*val encdec_rounding_mode_forwards_matches : rounding_mode -> bool*)

(*val encdec_rounding_mode_backwards_matches : mword ty3 -> bool*)

val _ = Define `
 ((encdec_rounding_mode_forwards:rounding_mode ->(3)words$word) arg_=
    ((case arg_ of
     RM_RNE => (0b000w :  3 words$word)
   | RM_RTZ => (0b001w :  3 words$word)
   | RM_RDN => (0b010w :  3 words$word)
   | RM_RUP => (0b011w :  3 words$word)
   | RM_RMM => (0b100w :  3 words$word)
   | RM_DYN => (0b111w :  3 words$word)
   )))`;


val _ = Define `
 ((encdec_rounding_mode_backwards:(3)words$word ->(regstate)sail2_state_monad$sequential_state ->(((rounding_mode),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then sail2_state_monad$returnS RM_RNE
   else if (((b__0 = (0b001w :  3 words$word)))) then sail2_state_monad$returnS RM_RTZ
   else if (((b__0 = (0b010w :  3 words$word)))) then sail2_state_monad$returnS RM_RDN
   else if (((b__0 = (0b011w :  3 words$word)))) then sail2_state_monad$returnS RM_RUP
   else if (((b__0 = (0b100w :  3 words$word)))) then sail2_state_monad$returnS RM_RMM
   else if (((b__0 = (0b111w :  3 words$word)))) then sail2_state_monad$returnS RM_DYN
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((encdec_rounding_mode_forwards_matches:rounding_mode -> bool) arg_= 
  ((case arg_ of
         RM_RNE => T
     | RM_RTZ => T
     | RM_RDN => T
     | RM_RUP => T
     | RM_RMM => T
     | RM_DYN => T
   )))`;


val _ = Define `
 ((encdec_rounding_mode_backwards_matches:(3)words$word -> bool) arg_=
    (let b__0 = arg_ in
   if (((b__0 = (0b000w :  3 words$word)))) then T
   else if (((b__0 = (0b001w :  3 words$word)))) then T
   else if (((b__0 = (0b010w :  3 words$word)))) then T
   else if (((b__0 = (0b011w :  3 words$word)))) then T
   else if (((b__0 = (0b100w :  3 words$word)))) then T
   else if (((b__0 = (0b111w :  3 words$word)))) then T
   else F))`;


(*val frm_mnemonic_forwards : rounding_mode -> string*)

(*val frm_mnemonic_backwards : string -> M rounding_mode*)

(*val frm_mnemonic_forwards_matches : rounding_mode -> bool*)

(*val frm_mnemonic_backwards_matches : string -> bool*)

(*val frm_mnemonic_matches_prefix : string -> maybe ((rounding_mode * ii))*)

val _ = Define `
 ((frm_mnemonic_forwards:rounding_mode -> string) arg_=
    ((case arg_ of
     RM_RNE => "rne"
   | RM_RTZ => "rtz"
   | RM_RDN => "rdn"
   | RM_RUP => "rup"
   | RM_RMM => "rmm"
   | RM_DYN => "dyn"
   )))`;


val _ = Define `
 ((frm_mnemonic_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((rounding_mode),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "rne"))) then sail2_state_monad$returnS RM_RNE
   else if (((p0_ = "rtz"))) then sail2_state_monad$returnS RM_RTZ
   else if (((p0_ = "rdn"))) then sail2_state_monad$returnS RM_RDN
   else if (((p0_ = "rup"))) then sail2_state_monad$returnS RM_RUP
   else if (((p0_ = "rmm"))) then sail2_state_monad$returnS RM_RMM
   else if (((p0_ = "dyn"))) then sail2_state_monad$returnS RM_DYN
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((frm_mnemonic_forwards_matches:rounding_mode -> bool) arg_= 
  ((case arg_ of
         RM_RNE => T
     | RM_RTZ => T
     | RM_RDN => T
     | RM_RUP => T
     | RM_RMM => T
     | RM_DYN => T
   )))`;


val _ = Define `
 ((frm_mnemonic_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "rne"))) then T
   else if (((p0_ = "rtz"))) then T
   else if (((p0_ = "rdn"))) then T
   else if (((p0_ = "rup"))) then T
   else if (((p0_ = "rmm"))) then T
   else if (((p0_ = "dyn"))) then T
   else F))`;


(*val _s1098_ : string -> maybe string*)

val _ = Define `
 ((s1098_:string ->(string)option) s1099_0=
    (let s1100_0 = s1099_0 in
   if ((string_startswith s1100_0 "dyn")) then  
  (case ((string_drop s1100_0 ((string_length "dyn")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1094_ : string -> maybe string*)

val _ = Define `
 ((s1094_:string ->(string)option) s1095_0=
    (let s1096_0 = s1095_0 in
   if ((string_startswith s1096_0 "rmm")) then  
  (case ((string_drop s1096_0 ((string_length "rmm")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1090_ : string -> maybe string*)

val _ = Define `
 ((s1090_:string ->(string)option) s1091_0=
    (let s1092_0 = s1091_0 in
   if ((string_startswith s1092_0 "rup")) then  
  (case ((string_drop s1092_0 ((string_length "rup")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1086_ : string -> maybe string*)

val _ = Define `
 ((s1086_:string ->(string)option) s1087_0=
    (let s1088_0 = s1087_0 in
   if ((string_startswith s1088_0 "rdn")) then  
  (case ((string_drop s1088_0 ((string_length "rdn")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1082_ : string -> maybe string*)

val _ = Define `
 ((s1082_:string ->(string)option) s1083_0=
    (let s1084_0 = s1083_0 in
   if ((string_startswith s1084_0 "rtz")) then  
  (case ((string_drop s1084_0 ((string_length "rtz")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1078_ : string -> maybe string*)

val _ = Define `
 ((s1078_:string ->(string)option) s1079_0=
    (let s1080_0 = s1079_0 in
   if ((string_startswith s1080_0 "rne")) then  
  (case ((string_drop s1080_0 ((string_length "rne")))) of   s_ => SOME s_ )
   else NONE))`;


val _ = Define `
 ((frm_mnemonic_matches_prefix:string ->(rounding_mode#int)option) arg_=
    (let s1081_0 = arg_ in
   if ((case ((s1078_ s1081_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1078_ s1081_0 of
      (SOME (s_)) =>
  SOME (RM_RNE, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1082_ s1081_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1082_ s1081_0 of
      (SOME (s_)) =>
  SOME (RM_RTZ, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1086_ s1081_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1086_ s1081_0 of
      (SOME (s_)) =>
  SOME (RM_RDN, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1090_ s1081_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1090_ s1081_0 of
      (SOME (s_)) =>
  SOME (RM_RUP, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1094_ s1081_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1094_ s1081_0 of
      (SOME (s_)) =>
  SOME (RM_RMM, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1098_ s1081_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1098_ s1081_0 of
      (SOME (s_)) =>
  SOME (RM_DYN, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val select_instr_or_fcsr_rm : rounding_mode -> M rounding_mode*)

val _ = Define `
 ((select_instr_or_fcsr_rm:rounding_mode ->(regstate)sail2_state_monad$sequential_state ->(((rounding_mode),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) instr_rm=
    (if (((instr_rm = RM_DYN))) then sail2_state_monad$bindS
     (sail2_state_monad$read_regS fcsr_ref) (\ (w__0 : Fcsr) . 
     encdec_rounding_mode_backwards ((get_Fcsr_FRM w__0  :  3 words$word)))
   else sail2_state_monad$returnS instr_rm))`;


(*val nxFlag : unit -> mword ty5*)

val _ = Define `
 ((nxFlag:unit ->(5)words$word) () =  ((0b00001w :  5 words$word)))`;


(*val ufFlag : unit -> mword ty5*)

val _ = Define `
 ((ufFlag:unit ->(5)words$word) () =  ((0b00010w :  5 words$word)))`;


(*val ofFlag : unit -> mword ty5*)

val _ = Define `
 ((ofFlag:unit ->(5)words$word) () =  ((0b00100w :  5 words$word)))`;


(*val dzFlag : unit -> mword ty5*)

val _ = Define `
 ((dzFlag:unit ->(5)words$word) () =  ((0b01000w :  5 words$word)))`;


(*val nvFlag : unit -> mword ty5*)

val _ = Define `
 ((nvFlag:unit ->(5)words$word) () =  ((0b10000w :  5 words$word)))`;


(*val fsplit_S : mword ty32 -> (mword ty1 * mword ty8 * mword ty23)*)

val _ = Define `
 ((fsplit_S:(32)words$word ->(1)words$word#(8)words$word#(23)words$word) x32=
    ((subrange_vec_dec x32 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word),
    (subrange_vec_dec x32 (( 30 : int):ii) (( 23 : int):ii)  :  8 words$word),
    (subrange_vec_dec x32 (( 22 : int):ii) (( 0 : int):ii)  :  23 words$word)))`;


(*val fmake_S : mword ty1 -> mword ty8 -> mword ty23 -> mword ty32*)

val _ = Define `
 ((fmake_S:(1)words$word ->(8)words$word ->(23)words$word ->(32)words$word) sign exp mant=  ((concat_vec sign ((concat_vec exp mant  :  31 words$word))  :  32 words$word)))`;


(*val canonical_NaN_S : unit -> mword ty32*)

val _ = Define `
 ((canonical_NaN_S:unit ->(32)words$word) () =  ((0x7FC00000w :  32 words$word)))`;


(*val f_is_neg_inf_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_neg_inf_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = (0b1w :  1 words$word)))) /\ ((((((exp = ((ones (( 8 : int):ii)  :  8 words$word))))) /\ (((mant = ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_neg_norm_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_neg_norm_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = (0b1w :  1 words$word)))) /\ ((((((exp <> ((zeros_implicit (( 8 : int):ii)  :  8 words$word))))) /\ (((exp <> ((ones (( 8 : int):ii)  :  8 words$word)))))))))))`;


(*val f_is_neg_subnorm_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_neg_subnorm_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = (0b1w :  1 words$word)))) /\ ((((((exp = ((zeros_implicit (( 8 : int):ii)  :  8 words$word))))) /\ (((mant <> ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_neg_zero_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_neg_zero_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = ((ones (( 1 : int):ii)  :  1 words$word))))) /\ ((((((exp = ((zeros_implicit (( 8 : int):ii)  :  8 words$word))))) /\ (((mant = ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_pos_zero_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_pos_zero_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = ((zeros_implicit (( 1 : int):ii)  :  1 words$word))))) /\ ((((((exp = ((zeros_implicit (( 8 : int):ii)  :  8 words$word))))) /\ (((mant = ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_pos_subnorm_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_pos_subnorm_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = ((zeros_implicit (( 1 : int):ii)  :  1 words$word))))) /\ ((((((exp = ((zeros_implicit (( 8 : int):ii)  :  8 words$word))))) /\ (((mant <> ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_pos_norm_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_pos_norm_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = ((zeros_implicit (( 1 : int):ii)  :  1 words$word))))) /\ ((((((exp <> ((zeros_implicit (( 8 : int):ii)  :  8 words$word))))) /\ (((exp <> ((ones (( 8 : int):ii)  :  8 words$word)))))))))))`;


(*val f_is_pos_inf_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_pos_inf_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((sign = ((zeros_implicit (( 1 : int):ii)  :  1 words$word))))) /\ ((((((exp = ((ones (( 8 : int):ii)  :  8 words$word))))) /\ (((mant = ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_SNaN_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_SNaN_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((exp = ((ones (( 8 : int):ii)  :  8 words$word))))) /\ ((((((((access_vec_dec mant (( 22 : int):ii))) = B0))) /\ (((mant <> ((zeros_implicit (( 23 : int):ii)  :  23 words$word)))))))))))`;


(*val f_is_QNaN_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_QNaN_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((exp = ((ones (( 8 : int):ii)  :  8 words$word))))) /\ (((((access_vec_dec mant (( 22 : int):ii))) = B1))))))`;


(*val f_is_NaN_S : mword ty32 -> bool*)

val _ = Define `
 ((f_is_NaN_S:(32)words$word -> bool) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   ((((exp = ((ones (( 8 : int):ii)  :  8 words$word))))) /\ (((mant <> ((zeros_implicit (( 23 : int):ii)  :  23 words$word))))))))`;


(*val negate_S : mword ty32 -> mword ty32*)

val _ = Define `
 ((negate_S:(32)words$word ->(32)words$word) x32=
    (let (sign, exp, mant) = ((fsplit_S x32  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let new_sign = (if (((sign = (0b0w :  1 words$word)))) then (0b1w :  1 words$word) else (0b0w :  1 words$word)) in
   (fmake_S new_sign exp mant  :  32 words$word)))`;


(*val feq_quiet_S : mword ty32 -> mword ty32 -> (bool * mword ty5)*)

val _ = Define `
 ((feq_quiet_S:(32)words$word ->(32)words$word -> bool#(5)words$word) v1 v2=
    (let (s1, e1, m1) = ((fsplit_S v1  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let (s2, e2, m2) = ((fsplit_S v2  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let v1Is0 = (((f_is_neg_zero_S v1)) \/ ((f_is_pos_zero_S v1))) in
   let v2Is0 = (((f_is_neg_zero_S v2)) \/ ((f_is_pos_zero_S v2))) in
   let result = ((((v1 = v2))) \/ (((v1Is0 /\ v2Is0)))) in
   let fflags =
     (if (((((f_is_SNaN_S v1)) \/ ((f_is_SNaN_S v2))))) then (nvFlag ()   :  5 words$word)
     else (zeros_implicit (( 5 : int):ii)  :  5 words$word)) in
   (result, fflags)))`;


(*val flt_S : mword ty32 -> mword ty32 -> bool -> (bool * mword ty5)*)

val _ = Define `
 ((flt_S:(32)words$word ->(32)words$word -> bool -> bool#(5)words$word) v1 v2 is_quiet=
    (let (s1, e1, m1) = ((fsplit_S v1  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let (s2, e2, m2) = ((fsplit_S v2  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let (result : bool) =
     (if ((((((s1 = (0b0w :  1 words$word)))) /\ (((s2 = (0b0w :  1 words$word))))))) then
       if (((e1 = e2))) then ((lem$w2ui m1)) < ((lem$w2ui m2))
       else ((lem$w2ui e1)) < ((lem$w2ui e2))
     else if ((((((s1 = (0b0w :  1 words$word)))) /\ (((s2 = (0b1w :  1 words$word))))))) then F
     else if ((((((s1 = (0b1w :  1 words$word)))) /\ (((s2 = (0b0w :  1 words$word))))))) then T
     else if (((e1 = e2))) then ((lem$w2ui m1)) > ((lem$w2ui m2))
     else ((lem$w2ui e1)) > ((lem$w2ui e2))) in
   let fflags =
     (if is_quiet then
       if (((((f_is_SNaN_S v1)) \/ ((f_is_SNaN_S v2))))) then (nvFlag ()   :  5 words$word)
       else (zeros_implicit (( 5 : int):ii)  :  5 words$word)
     else if (((((f_is_NaN_S v1)) \/ ((f_is_NaN_S v2))))) then (nvFlag ()   :  5 words$word)
     else (zeros_implicit (( 5 : int):ii)  :  5 words$word)) in
   (result, fflags)))`;


(*val fle_S : mword ty32 -> mword ty32 -> bool -> (bool * mword ty5)*)

val _ = Define `
 ((fle_S:(32)words$word ->(32)words$word -> bool -> bool#(5)words$word) v1 v2 is_quiet=
    (let (s1, e1, m1) = ((fsplit_S v1  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let (s2, e2, m2) = ((fsplit_S v2  : ( 1 words$word #  8 words$word #  23 words$word))) in
   let v1Is0 = (((f_is_neg_zero_S v1)) \/ ((f_is_pos_zero_S v1))) in
   let v2Is0 = (((f_is_neg_zero_S v2)) \/ ((f_is_pos_zero_S v2))) in
   let (result : bool) =
     (if ((((((s1 = (0b0w :  1 words$word)))) /\ (((s2 = (0b0w :  1 words$word))))))) then
       if (((e1 = e2))) then ((lem$w2ui m1)) <= ((lem$w2ui m2))
       else ((lem$w2ui e1)) < ((lem$w2ui e2))
     else if ((((((s1 = (0b0w :  1 words$word)))) /\ (((s2 = (0b1w :  1 words$word))))))) then
       (v1Is0 /\ v2Is0)
     else if ((((((s1 = (0b1w :  1 words$word)))) /\ (((s2 = (0b0w :  1 words$word))))))) then T
     else if (((e1 = e2))) then ((lem$w2ui m1)) >= ((lem$w2ui m2))
     else ((lem$w2ui e1)) > ((lem$w2ui e2))) in
   let fflags =
     (if is_quiet then
       if (((((f_is_SNaN_S v1)) \/ ((f_is_SNaN_S v2))))) then (nvFlag ()   :  5 words$word)
       else (zeros_implicit (( 5 : int):ii)  :  5 words$word)
     else if (((((f_is_NaN_S v1)) \/ ((f_is_NaN_S v2))))) then (nvFlag ()   :  5 words$word)
     else (zeros_implicit (( 5 : int):ii)  :  5 words$word)) in
   (result, fflags)))`;


(*val nan_box : mword ty32 -> mword ty32*)

val _ = Define `
 ((nan_box:(32)words$word ->(32)words$word) val_32b=  val_32b)`;


(*val nan_unbox : mword ty32 -> mword ty32*)

val _ = Define `
 ((nan_unbox:(32)words$word ->(32)words$word) regval=  regval)`;


(*val is_RV32F_or_RV64F : unit -> M bool*)

val _ = Define `
 ((is_RV32F_or_RV64F:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =
    (sail2_state$and_boolS ((haveFExt () )) (sail2_state_monad$returnS (((((((( 32 : int):ii) = (( 32 : int):ii)))) \/ ((((( 32 : int):ii) = (( 64 : int):ii))))))))))`;


(*val is_RV64F : unit -> M bool*)

val _ = Define `
 ((is_RV64F:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state$and_boolS ((haveFExt () )) (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 64 : int):ii)))))))`;


(*val is_RV32D_or_RV64D : unit -> M bool*)

val _ = Define `
 ((is_RV32D_or_RV64D:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =
    (sail2_state$and_boolS ((haveDExt () )) (sail2_state_monad$returnS (((((((( 32 : int):ii) = (( 32 : int):ii)))) \/ ((((( 32 : int):ii) = (( 64 : int):ii))))))))))`;


(*val is_RV64D : unit -> M bool*)

val _ = Define `
 ((is_RV64D:unit ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state$and_boolS ((haveDExt () )) (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 64 : int):ii)))))))`;


(*val process_fload64 : mword ty5 -> mword ty32 -> MemoryOpResult (mword ty64) -> M Retired*)

val _ = Define `
 ((process_fload64:(5)words$word ->(32)words$word ->((64)words$word)MemoryOpResult ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rd addr value=  (sail2_state_monad$returnS RETIRE_FAIL))`;


(*val process_fload32 : mword ty5 -> mword ty32 -> MemoryOpResult (mword ty32) -> M Retired*)

val _ = Define `
 ((process_fload32:(5)words$word ->(32)words$word ->((32)words$word)MemoryOpResult ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rd addr value=
    ((case value of
     MemValue (result) => sail2_state_monad$seqS (wF_bits rd ((nan_box result  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)
   | MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
   )))`;


(*val process_fstore : mword ty32 -> MemoryOpResult bool -> M Retired*)

val _ = Define `
 ((process_fstore:(32)words$word ->(bool)MemoryOpResult ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) vaddr value=
    ((case value of
     MemValue (T) => sail2_state_monad$returnS RETIRE_SUCCESS
   | MemValue (F) => internal_error "store got false from mem_write_value"
   | MemException (e) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
   )))`;


(*val f_madd_type_mnemonic_S_forwards : f_madd_op_S -> string*)

(*val f_madd_type_mnemonic_S_backwards : string -> M f_madd_op_S*)

(*val f_madd_type_mnemonic_S_forwards_matches : f_madd_op_S -> bool*)

(*val f_madd_type_mnemonic_S_backwards_matches : string -> bool*)

(*val f_madd_type_mnemonic_S_matches_prefix : string -> maybe ((f_madd_op_S * ii))*)

val _ = Define `
 ((f_madd_type_mnemonic_S_forwards:f_madd_op_S -> string) arg_=
    ((case arg_ of
     FMADD_S => "fmadd.s"
   | FMSUB_S => "fmsub.s"
   | FNMSUB_S => "fnmsub.s"
   | FNMADD_S => "fnmadd.s"
   )))`;


val _ = Define `
 ((f_madd_type_mnemonic_S_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((f_madd_op_S),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fmadd.s"))) then sail2_state_monad$returnS FMADD_S
   else if (((p0_ = "fmsub.s"))) then sail2_state_monad$returnS FMSUB_S
   else if (((p0_ = "fnmsub.s"))) then sail2_state_monad$returnS FNMSUB_S
   else if (((p0_ = "fnmadd.s"))) then sail2_state_monad$returnS FNMADD_S
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((f_madd_type_mnemonic_S_forwards_matches:f_madd_op_S -> bool) arg_= 
  ((case arg_ of
         FMADD_S => T
     | FMSUB_S => T
     | FNMSUB_S => T
     | FNMADD_S => T
   )))`;


val _ = Define `
 ((f_madd_type_mnemonic_S_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fmadd.s"))) then T
   else if (((p0_ = "fmsub.s"))) then T
   else if (((p0_ = "fnmsub.s"))) then T
   else if (((p0_ = "fnmadd.s"))) then T
   else F))`;


(*val _s1114_ : string -> maybe string*)

val _ = Define `
 ((s1114_:string ->(string)option) s1115_0=
    (let s1116_0 = s1115_0 in
   if ((string_startswith s1116_0 "fnmadd.s")) then  
  (case ((string_drop s1116_0 ((string_length "fnmadd.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1110_ : string -> maybe string*)

val _ = Define `
 ((s1110_:string ->(string)option) s1111_0=
    (let s1112_0 = s1111_0 in
   if ((string_startswith s1112_0 "fnmsub.s")) then  
  (case ((string_drop s1112_0 ((string_length "fnmsub.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1106_ : string -> maybe string*)

val _ = Define `
 ((s1106_:string ->(string)option) s1107_0=
    (let s1108_0 = s1107_0 in
   if ((string_startswith s1108_0 "fmsub.s")) then  
  (case ((string_drop s1108_0 ((string_length "fmsub.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1102_ : string -> maybe string*)

val _ = Define `
 ((s1102_:string ->(string)option) s1103_0=
    (let s1104_0 = s1103_0 in
   if ((string_startswith s1104_0 "fmadd.s")) then  
  (case ((string_drop s1104_0 ((string_length "fmadd.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((f_madd_type_mnemonic_S_matches_prefix:string ->(f_madd_op_S#int)option) arg_=
    (let s1105_0 = arg_ in
   if ((case ((s1102_ s1105_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1102_ s1105_0 of
      (SOME (s_)) =>
  SOME (FMADD_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1106_ s1105_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1106_ s1105_0 of
      (SOME (s_)) =>
  SOME (FMSUB_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1110_ s1105_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1110_ s1105_0 of
      (SOME (s_)) =>
  SOME (FNMSUB_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1114_ s1105_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1114_ s1105_0 of
      (SOME (s_)) =>
  SOME (FNMADD_S, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val f_bin_rm_type_mnemonic_S_forwards : f_bin_rm_op_S -> string*)

(*val f_bin_rm_type_mnemonic_S_backwards : string -> M f_bin_rm_op_S*)

(*val f_bin_rm_type_mnemonic_S_forwards_matches : f_bin_rm_op_S -> bool*)

(*val f_bin_rm_type_mnemonic_S_backwards_matches : string -> bool*)

(*val f_bin_rm_type_mnemonic_S_matches_prefix : string -> maybe ((f_bin_rm_op_S * ii))*)

val _ = Define `
 ((f_bin_rm_type_mnemonic_S_forwards:f_bin_rm_op_S -> string) arg_=
    ((case arg_ of
     FADD_S => "fadd.s"
   | FSUB_S => "fsub.s"
   | FMUL_S => "fmul.s"
   | FDIV_S => "fdiv.s"
   )))`;


val _ = Define `
 ((f_bin_rm_type_mnemonic_S_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((f_bin_rm_op_S),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fadd.s"))) then sail2_state_monad$returnS FADD_S
   else if (((p0_ = "fsub.s"))) then sail2_state_monad$returnS FSUB_S
   else if (((p0_ = "fmul.s"))) then sail2_state_monad$returnS FMUL_S
   else if (((p0_ = "fdiv.s"))) then sail2_state_monad$returnS FDIV_S
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((f_bin_rm_type_mnemonic_S_forwards_matches:f_bin_rm_op_S -> bool) arg_= 
  ((case arg_ of   FADD_S => T | FSUB_S => T | FMUL_S => T | FDIV_S => T )))`;


val _ = Define `
 ((f_bin_rm_type_mnemonic_S_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fadd.s"))) then T
   else if (((p0_ = "fsub.s"))) then T
   else if (((p0_ = "fmul.s"))) then T
   else if (((p0_ = "fdiv.s"))) then T
   else F))`;


(*val _s1130_ : string -> maybe string*)

val _ = Define `
 ((s1130_:string ->(string)option) s1131_0=
    (let s1132_0 = s1131_0 in
   if ((string_startswith s1132_0 "fdiv.s")) then  
  (case ((string_drop s1132_0 ((string_length "fdiv.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1126_ : string -> maybe string*)

val _ = Define `
 ((s1126_:string ->(string)option) s1127_0=
    (let s1128_0 = s1127_0 in
   if ((string_startswith s1128_0 "fmul.s")) then  
  (case ((string_drop s1128_0 ((string_length "fmul.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1122_ : string -> maybe string*)

val _ = Define `
 ((s1122_:string ->(string)option) s1123_0=
    (let s1124_0 = s1123_0 in
   if ((string_startswith s1124_0 "fsub.s")) then  
  (case ((string_drop s1124_0 ((string_length "fsub.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1118_ : string -> maybe string*)

val _ = Define `
 ((s1118_:string ->(string)option) s1119_0=
    (let s1120_0 = s1119_0 in
   if ((string_startswith s1120_0 "fadd.s")) then  
  (case ((string_drop s1120_0 ((string_length "fadd.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((f_bin_rm_type_mnemonic_S_matches_prefix:string ->(f_bin_rm_op_S#int)option) arg_=
    (let s1121_0 = arg_ in
   if ((case ((s1118_ s1121_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1118_ s1121_0 of
      (SOME (s_)) =>
  SOME (FADD_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1122_ s1121_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1122_ s1121_0 of
      (SOME (s_)) =>
  SOME (FSUB_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1126_ s1121_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1126_ s1121_0 of
      (SOME (s_)) =>
  SOME (FMUL_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1130_ s1121_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1130_ s1121_0 of
      (SOME (s_)) =>
  SOME (FDIV_S, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val f_un_rm_type_mnemonic_S_forwards : f_un_rm_op_S -> string*)

(*val f_un_rm_type_mnemonic_S_backwards : string -> M f_un_rm_op_S*)

(*val f_un_rm_type_mnemonic_S_forwards_matches : f_un_rm_op_S -> bool*)

(*val f_un_rm_type_mnemonic_S_backwards_matches : string -> bool*)

(*val f_un_rm_type_mnemonic_S_matches_prefix : string -> maybe ((f_un_rm_op_S * ii))*)

val _ = Define `
 ((f_un_rm_type_mnemonic_S_forwards:f_un_rm_op_S -> string) arg_=
    ((case arg_ of
     FSQRT_S => "fsqrt.s"
   | FCVT_W_S => "fcvt.w.s"
   | FCVT_WU_S => "fcvt.wu.s"
   | FCVT_S_W => "fcvt.s.w"
   | FCVT_S_WU => "fcvt.s.wu"
   | FCVT_L_S => "fcvt.l.s"
   | FCVT_LU_S => "fcvt.lu.s"
   | FCVT_S_L => "fcvt.s.l"
   | FCVT_S_LU => "fcvt.s.lu"
   )))`;


val _ = Define `
 ((f_un_rm_type_mnemonic_S_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((f_un_rm_op_S),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fsqrt.s"))) then sail2_state_monad$returnS FSQRT_S
   else if (((p0_ = "fcvt.w.s"))) then sail2_state_monad$returnS FCVT_W_S
   else if (((p0_ = "fcvt.wu.s"))) then sail2_state_monad$returnS FCVT_WU_S
   else if (((p0_ = "fcvt.s.w"))) then sail2_state_monad$returnS FCVT_S_W
   else if (((p0_ = "fcvt.s.wu"))) then sail2_state_monad$returnS FCVT_S_WU
   else if (((p0_ = "fcvt.l.s"))) then sail2_state_monad$returnS FCVT_L_S
   else if (((p0_ = "fcvt.lu.s"))) then sail2_state_monad$returnS FCVT_LU_S
   else if (((p0_ = "fcvt.s.l"))) then sail2_state_monad$returnS FCVT_S_L
   else if (((p0_ = "fcvt.s.lu"))) then sail2_state_monad$returnS FCVT_S_LU
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((f_un_rm_type_mnemonic_S_forwards_matches:f_un_rm_op_S -> bool) arg_= 
  ((case arg_ of
         FSQRT_S => T
     | FCVT_W_S => T
     | FCVT_WU_S => T
     | FCVT_S_W => T
     | FCVT_S_WU => T
     | FCVT_L_S => T
     | FCVT_LU_S => T
     | FCVT_S_L => T
     | FCVT_S_LU => T
   )))`;


val _ = Define `
 ((f_un_rm_type_mnemonic_S_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fsqrt.s"))) then T
   else if (((p0_ = "fcvt.w.s"))) then T
   else if (((p0_ = "fcvt.wu.s"))) then T
   else if (((p0_ = "fcvt.s.w"))) then T
   else if (((p0_ = "fcvt.s.wu"))) then T
   else if (((p0_ = "fcvt.l.s"))) then T
   else if (((p0_ = "fcvt.lu.s"))) then T
   else if (((p0_ = "fcvt.s.l"))) then T
   else if (((p0_ = "fcvt.s.lu"))) then T
   else F))`;


(*val _s1166_ : string -> maybe string*)

val _ = Define `
 ((s1166_:string ->(string)option) s1167_0=
    (let s1168_0 = s1167_0 in
   if ((string_startswith s1168_0 "fcvt.s.lu")) then  
  (case ((string_drop s1168_0 ((string_length "fcvt.s.lu")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1162_ : string -> maybe string*)

val _ = Define `
 ((s1162_:string ->(string)option) s1163_0=
    (let s1164_0 = s1163_0 in
   if ((string_startswith s1164_0 "fcvt.s.l")) then  
  (case ((string_drop s1164_0 ((string_length "fcvt.s.l")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1158_ : string -> maybe string*)

val _ = Define `
 ((s1158_:string ->(string)option) s1159_0=
    (let s1160_0 = s1159_0 in
   if ((string_startswith s1160_0 "fcvt.lu.s")) then  
  (case ((string_drop s1160_0 ((string_length "fcvt.lu.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1154_ : string -> maybe string*)

val _ = Define `
 ((s1154_:string ->(string)option) s1155_0=
    (let s1156_0 = s1155_0 in
   if ((string_startswith s1156_0 "fcvt.l.s")) then  
  (case ((string_drop s1156_0 ((string_length "fcvt.l.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1150_ : string -> maybe string*)

val _ = Define `
 ((s1150_:string ->(string)option) s1151_0=
    (let s1152_0 = s1151_0 in
   if ((string_startswith s1152_0 "fcvt.s.wu")) then  
  (case ((string_drop s1152_0 ((string_length "fcvt.s.wu")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1146_ : string -> maybe string*)

val _ = Define `
 ((s1146_:string ->(string)option) s1147_0=
    (let s1148_0 = s1147_0 in
   if ((string_startswith s1148_0 "fcvt.s.w")) then  
  (case ((string_drop s1148_0 ((string_length "fcvt.s.w")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1142_ : string -> maybe string*)

val _ = Define `
 ((s1142_:string ->(string)option) s1143_0=
    (let s1144_0 = s1143_0 in
   if ((string_startswith s1144_0 "fcvt.wu.s")) then  
  (case ((string_drop s1144_0 ((string_length "fcvt.wu.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1138_ : string -> maybe string*)

val _ = Define `
 ((s1138_:string ->(string)option) s1139_0=
    (let s1140_0 = s1139_0 in
   if ((string_startswith s1140_0 "fcvt.w.s")) then  
  (case ((string_drop s1140_0 ((string_length "fcvt.w.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1134_ : string -> maybe string*)

val _ = Define `
 ((s1134_:string ->(string)option) s1135_0=
    (let s1136_0 = s1135_0 in
   if ((string_startswith s1136_0 "fsqrt.s")) then  
  (case ((string_drop s1136_0 ((string_length "fsqrt.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((f_un_rm_type_mnemonic_S_matches_prefix:string ->(f_un_rm_op_S#int)option) arg_=
    (let s1137_0 = arg_ in
   if ((case ((s1134_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1134_ s1137_0 of
      (SOME (s_)) =>
  SOME (FSQRT_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1138_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1138_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_W_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1142_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1142_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_WU_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1146_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1146_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_S_W, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1150_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1150_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_S_WU, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1154_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1154_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_L_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1158_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1158_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_LU_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1162_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1162_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_S_L, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1166_ s1137_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1166_ s1137_0 of
      (SOME (s_)) =>
  SOME (FCVT_S_LU, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val f_bin_type_mnemonic_S_forwards : f_bin_op_S -> string*)

(*val f_bin_type_mnemonic_S_backwards : string -> M f_bin_op_S*)

(*val f_bin_type_mnemonic_S_forwards_matches : f_bin_op_S -> bool*)

(*val f_bin_type_mnemonic_S_backwards_matches : string -> bool*)

(*val f_bin_type_mnemonic_S_matches_prefix : string -> maybe ((f_bin_op_S * ii))*)

val _ = Define `
 ((f_bin_type_mnemonic_S_forwards:f_bin_op_S -> string) arg_=
    ((case arg_ of
     FSGNJ_S => "fsgnj.s"
   | FSGNJN_S => "fsgnjn.s"
   | FSGNJX_S => "fsgnjx.s"
   | FMIN_S => "fmin.s"
   | FMAX_S => "fmax.s"
   | FEQ_S => "feq.s"
   | FLT_S => "flt.s"
   | FLE_S => "fle.s"
   )))`;


val _ = Define `
 ((f_bin_type_mnemonic_S_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((f_bin_op_S),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fsgnj.s"))) then sail2_state_monad$returnS FSGNJ_S
   else if (((p0_ = "fsgnjn.s"))) then sail2_state_monad$returnS FSGNJN_S
   else if (((p0_ = "fsgnjx.s"))) then sail2_state_monad$returnS FSGNJX_S
   else if (((p0_ = "fmin.s"))) then sail2_state_monad$returnS FMIN_S
   else if (((p0_ = "fmax.s"))) then sail2_state_monad$returnS FMAX_S
   else if (((p0_ = "feq.s"))) then sail2_state_monad$returnS FEQ_S
   else if (((p0_ = "flt.s"))) then sail2_state_monad$returnS FLT_S
   else if (((p0_ = "fle.s"))) then sail2_state_monad$returnS FLE_S
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((f_bin_type_mnemonic_S_forwards_matches:f_bin_op_S -> bool) arg_= 
  ((case arg_ of
         FSGNJ_S => T
     | FSGNJN_S => T
     | FSGNJX_S => T
     | FMIN_S => T
     | FMAX_S => T
     | FEQ_S => T
     | FLT_S => T
     | FLE_S => T
   )))`;


val _ = Define `
 ((f_bin_type_mnemonic_S_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fsgnj.s"))) then T
   else if (((p0_ = "fsgnjn.s"))) then T
   else if (((p0_ = "fsgnjx.s"))) then T
   else if (((p0_ = "fmin.s"))) then T
   else if (((p0_ = "fmax.s"))) then T
   else if (((p0_ = "feq.s"))) then T
   else if (((p0_ = "flt.s"))) then T
   else if (((p0_ = "fle.s"))) then T
   else F))`;


(*val _s1198_ : string -> maybe string*)

val _ = Define `
 ((s1198_:string ->(string)option) s1199_0=
    (let s1200_0 = s1199_0 in
   if ((string_startswith s1200_0 "fle.s")) then  
  (case ((string_drop s1200_0 ((string_length "fle.s")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1194_ : string -> maybe string*)

val _ = Define `
 ((s1194_:string ->(string)option) s1195_0=
    (let s1196_0 = s1195_0 in
   if ((string_startswith s1196_0 "flt.s")) then  
  (case ((string_drop s1196_0 ((string_length "flt.s")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1190_ : string -> maybe string*)

val _ = Define `
 ((s1190_:string ->(string)option) s1191_0=
    (let s1192_0 = s1191_0 in
   if ((string_startswith s1192_0 "feq.s")) then  
  (case ((string_drop s1192_0 ((string_length "feq.s")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s1186_ : string -> maybe string*)

val _ = Define `
 ((s1186_:string ->(string)option) s1187_0=
    (let s1188_0 = s1187_0 in
   if ((string_startswith s1188_0 "fmax.s")) then  
  (case ((string_drop s1188_0 ((string_length "fmax.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1182_ : string -> maybe string*)

val _ = Define `
 ((s1182_:string ->(string)option) s1183_0=
    (let s1184_0 = s1183_0 in
   if ((string_startswith s1184_0 "fmin.s")) then  
  (case ((string_drop s1184_0 ((string_length "fmin.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1178_ : string -> maybe string*)

val _ = Define `
 ((s1178_:string ->(string)option) s1179_0=
    (let s1180_0 = s1179_0 in
   if ((string_startswith s1180_0 "fsgnjx.s")) then  
  (case ((string_drop s1180_0 ((string_length "fsgnjx.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1174_ : string -> maybe string*)

val _ = Define `
 ((s1174_:string ->(string)option) s1175_0=
    (let s1176_0 = s1175_0 in
   if ((string_startswith s1176_0 "fsgnjn.s")) then  
  (case ((string_drop s1176_0 ((string_length "fsgnjn.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1170_ : string -> maybe string*)

val _ = Define `
 ((s1170_:string ->(string)option) s1171_0=
    (let s1172_0 = s1171_0 in
   if ((string_startswith s1172_0 "fsgnj.s")) then  
  (case ((string_drop s1172_0 ((string_length "fsgnj.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((f_bin_type_mnemonic_S_matches_prefix:string ->(f_bin_op_S#int)option) arg_=
    (let s1173_0 = arg_ in
   if ((case ((s1170_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1170_ s1173_0 of
      (SOME (s_)) =>
  SOME (FSGNJ_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1174_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1174_ s1173_0 of
      (SOME (s_)) =>
  SOME (FSGNJN_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1178_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1178_ s1173_0 of
      (SOME (s_)) =>
  SOME (FSGNJX_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1182_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1182_ s1173_0 of
      (SOME (s_)) =>
  SOME (FMIN_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1186_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1186_ s1173_0 of
      (SOME (s_)) =>
  SOME (FMAX_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1190_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1190_ s1173_0 of
      (SOME (s_)) =>
  SOME (FEQ_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1194_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1194_ s1173_0 of
      (SOME (s_)) =>
  SOME (FLT_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1198_ s1173_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1198_ s1173_0 of
      (SOME (s_)) =>
  SOME (FLE_S, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


(*val f_un_type_mnemonic_S_forwards : f_un_op_S -> string*)

(*val f_un_type_mnemonic_S_backwards : string -> M f_un_op_S*)

(*val f_un_type_mnemonic_S_forwards_matches : f_un_op_S -> bool*)

(*val f_un_type_mnemonic_S_backwards_matches : string -> bool*)

(*val f_un_type_mnemonic_S_matches_prefix : string -> maybe ((f_un_op_S * ii))*)

val _ = Define `
 ((f_un_type_mnemonic_S_forwards:f_un_op_S -> string) arg_=
    ((case arg_ of   FMV_X_W => "fmv.x.w" | FCLASS_S => "fclass.s" | FMV_W_X => "fmv.w.x" )))`;


val _ = Define `
 ((f_un_type_mnemonic_S_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((f_un_op_S),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fmv.x.w"))) then sail2_state_monad$returnS FMV_X_W
   else if (((p0_ = "fclass.s"))) then sail2_state_monad$returnS FCLASS_S
   else if (((p0_ = "fmv.w.x"))) then sail2_state_monad$returnS FMV_W_X
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((f_un_type_mnemonic_S_forwards_matches:f_un_op_S -> bool) arg_= 
  ((case arg_ of   FMV_X_W => T | FCLASS_S => T | FMV_W_X => T )))`;


val _ = Define `
 ((f_un_type_mnemonic_S_backwards_matches:string -> bool) arg_=
    (let p0_ = arg_ in
   if (((p0_ = "fmv.x.w"))) then T
   else if (((p0_ = "fclass.s"))) then T
   else if (((p0_ = "fmv.w.x"))) then T
   else F))`;


(*val _s1210_ : string -> maybe string*)

val _ = Define `
 ((s1210_:string ->(string)option) s1211_0=
    (let s1212_0 = s1211_0 in
   if ((string_startswith s1212_0 "fmv.w.x")) then  
  (case ((string_drop s1212_0 ((string_length "fmv.w.x")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1206_ : string -> maybe string*)

val _ = Define `
 ((s1206_:string ->(string)option) s1207_0=
    (let s1208_0 = s1207_0 in
   if ((string_startswith s1208_0 "fclass.s")) then  
  (case ((string_drop s1208_0 ((string_length "fclass.s")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s1202_ : string -> maybe string*)

val _ = Define `
 ((s1202_:string ->(string)option) s1203_0=
    (let s1204_0 = s1203_0 in
   if ((string_startswith s1204_0 "fmv.x.w")) then  
  (case ((string_drop s1204_0 ((string_length "fmv.x.w")))) of
        s_ => SOME s_
  )
   else NONE))`;


val _ = Define `
 ((f_un_type_mnemonic_S_matches_prefix:string ->(f_un_op_S#int)option) arg_=
    (let s1205_0 = arg_ in
   if ((case ((s1202_ s1205_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1202_ s1205_0 of
      (SOME (s_)) =>
  SOME (FMV_X_W, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1206_ s1205_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1206_ s1205_0 of
      (SOME (s_)) =>
  SOME (FCLASS_S, ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s1210_ s1205_0)) of   SOME (s_) => T | _ => F )) then  
  (case s1210_ s1205_0 of
      (SOME (s_)) =>
  SOME (FMV_W_X, ((string_length arg_)) - ((string_length s_)))
  )
   else NONE))`;


val _ = Define `
 ((encdec_forwards:ast ->(regstate)sail2_state_monad$sequential_state ->((((32)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    ((case arg_ of
     UTYPE ((imm, rd, op)) =>
      sail2_state_monad$returnS ((concat_vec imm
                 ((concat_vec rd ((encdec_uop_forwards op  :  7 words$word))  :  12 words$word))
                :  32 words$word))
   | RISCV_JAL ((v__2, rd)) =>
      if (((((subrange_vec_dec v__2 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) then
        let (imm_19 : 1 bits) = ((subrange_vec_dec v__2 (( 20 : int):ii) (( 20 : int):ii)  :  1 words$word)) in
        let (imm_8 : 1 bits) = ((subrange_vec_dec v__2 (( 11 : int):ii) (( 11 : int):ii)  :  1 words$word)) in
        let (imm_7_0 : 8 bits) = ((subrange_vec_dec v__2 (( 19 : int):ii) (( 12 : int):ii)  :  8 words$word)) in
        let (imm_19 : 1 bits) = ((subrange_vec_dec v__2 (( 20 : int):ii) (( 20 : int):ii)  :  1 words$word)) in
        let (imm_18_13 : 6 bits) = ((subrange_vec_dec v__2 (( 10 : int):ii) (( 5 : int):ii)  :  6 words$word)) in
        let (imm_12_9 : 4 bits) = ((subrange_vec_dec v__2 (( 4 : int):ii) (( 1 : int):ii)  :  4 words$word)) in
        sail2_state_monad$returnS ((concat_vec imm_19
                   ((concat_vec imm_18_13
                       ((concat_vec imm_12_9
                           ((concat_vec imm_8
                               ((concat_vec imm_7_0
                                   ((concat_vec rd (0b1101111w :  7 words$word)  :  12 words$word))
                                  :  20 words$word))
                              :  21 words$word))
                          :  25 words$word))
                      :  31 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | RISCV_JALR ((imm, rs1, rd)) =>
      sail2_state_monad$returnS ((concat_vec imm
                 ((concat_vec rs1
                     ((concat_vec (0b000w :  3 words$word)
                         ((concat_vec rd (0b1100111w :  7 words$word)  :  12 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | BTYPE ((v__4, rs2, rs1, op)) =>
      if (((((subrange_vec_dec v__4 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) then
        let (imm7_6 : 1 bits) = ((subrange_vec_dec v__4 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
        let (imm7_6 : 1 bits) = ((subrange_vec_dec v__4 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
        let (imm7_5_0 : 6 bits) = ((subrange_vec_dec v__4 (( 10 : int):ii) (( 5 : int):ii)  :  6 words$word)) in
        let (imm5_4_1 : 4 bits) = ((subrange_vec_dec v__4 (( 4 : int):ii) (( 1 : int):ii)  :  4 words$word)) in
        let (imm5_0 : 1 bits) = ((subrange_vec_dec v__4 (( 11 : int):ii) (( 11 : int):ii)  :  1 words$word)) in
        sail2_state_monad$returnS ((concat_vec imm7_6
                   ((concat_vec imm7_5_0
                       ((concat_vec rs2
                           ((concat_vec rs1
                               ((concat_vec ((encdec_bop_forwards op  :  3 words$word))
                                   ((concat_vec imm5_4_1
                                       ((concat_vec imm5_0 (0b1100011w :  7 words$word)  :  8 words$word))
                                      :  12 words$word))
                                  :  15 words$word))
                              :  20 words$word))
                          :  25 words$word))
                      :  31 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | ITYPE ((imm, rs1, rd, op)) =>
      sail2_state_monad$returnS ((concat_vec imm
                 ((concat_vec rs1
                     ((concat_vec ((encdec_iop_forwards op  :  3 words$word))
                         ((concat_vec rd (0b0010011w :  7 words$word)  :  12 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | SHIFTIOP ((shamt, rs1, rd, RISCV_SLLI)) =>
      sail2_state_monad$returnS ((concat_vec (0b000000w :  6 words$word)
                 ((concat_vec shamt
                     ((concat_vec rs1
                         ((concat_vec (0b001w :  3 words$word)
                             ((concat_vec rd (0b0010011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  26 words$word))
                :  32 words$word))
   | SHIFTIOP ((shamt, rs1, rd, RISCV_SRLI)) =>
      sail2_state_monad$returnS ((concat_vec (0b000000w :  6 words$word)
                 ((concat_vec shamt
                     ((concat_vec rs1
                         ((concat_vec (0b101w :  3 words$word)
                             ((concat_vec rd (0b0010011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  26 words$word))
                :  32 words$word))
   | SHIFTIOP ((shamt, rs1, rd, RISCV_SRAI)) =>
      sail2_state_monad$returnS ((concat_vec (0b010000w :  6 words$word)
                 ((concat_vec shamt
                     ((concat_vec rs1
                         ((concat_vec (0b101w :  3 words$word)
                             ((concat_vec rd (0b0010011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  26 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_ADD)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b000w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_SLT)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b010w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_SLTU)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b011w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_AND)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b111w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_OR)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b110w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_XOR)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b100w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_SLL)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b001w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_SRL)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b101w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_SUB)) =>
      sail2_state_monad$returnS ((concat_vec (0b0100000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b000w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | RTYPE ((rs2, rs1, rd, RISCV_SRA)) =>
      sail2_state_monad$returnS ((concat_vec (0b0100000w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b101w :  3 words$word)
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | LOAD ((imm, rs1, rd, is_unsigned, size1, F, F)) =>
      if (((((((word_width_bytes size1)) < (( 4 : int):ii))) \/ (((((~ is_unsigned)) /\ ((((word_width_bytes size1)) <= (( 4 : int):ii))))))))) then
        sail2_state_monad$returnS ((concat_vec imm
                   ((concat_vec rs1
                       ((concat_vec ((bool_bits_forwards is_unsigned  :  1 words$word))
                           ((concat_vec ((size_bits_forwards size1  :  2 words$word))
                               ((concat_vec rd (0b0000011w :  7 words$word)  :  12 words$word))
                              :  14 words$word))
                          :  15 words$word))
                      :  20 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | STORE ((v__6, rs2, rs1, size1, F, F)) =>
      if ((((word_width_bytes size1)) <= (( 4 : int):ii))) then
        let (imm7 : 7 bits) = ((subrange_vec_dec v__6 (( 11 : int):ii) (( 5 : int):ii)  :  7 words$word)) in
        let (imm7 : 7 bits) = ((subrange_vec_dec v__6 (( 11 : int):ii) (( 5 : int):ii)  :  7 words$word)) in
        let (imm5 : 5 bits) = ((subrange_vec_dec v__6 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec imm7
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b0w :  1 words$word)
                               ((concat_vec ((size_bits_forwards size1  :  2 words$word))
                                   ((concat_vec imm5 (0b0100011w :  7 words$word)  :  12 words$word))
                                  :  14 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | ADDIW ((imm, rs1, rd)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec imm
                   ((concat_vec rs1
                       ((concat_vec (0b000w :  3 words$word)
                           ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                          :  15 words$word))
                      :  20 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | SHIFTW ((shamt, rs1, rd, RISCV_SLLI)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec shamt
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | SHIFTW ((shamt, rs1, rd, RISCV_SRLI)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec shamt
                       ((concat_vec rs1
                           ((concat_vec (0b101w :  3 words$word)
                               ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | SHIFTW ((shamt, rs1, rd, RISCV_SRAI)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0100000w :  7 words$word)
                   ((concat_vec shamt
                       ((concat_vec rs1
                           ((concat_vec (0b101w :  3 words$word)
                               ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | RTYPEW ((rs2, rs1, rd, RISCV_ADDW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | RTYPEW ((rs2, rs1, rd, RISCV_SUBW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0100000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | RTYPEW ((rs2, rs1, rd, RISCV_SLLW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | RTYPEW ((rs2, rs1, rd, RISCV_SRLW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b101w :  3 words$word)
                               ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | RTYPEW ((rs2, rs1, rd, RISCV_SRAW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0100000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b101w :  3 words$word)
                               ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | SHIFTIWOP ((shamt, rs1, rd, RISCV_SLLIW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec shamt
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | SHIFTIWOP ((shamt, rs1, rd, RISCV_SRLIW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec shamt
                       ((concat_vec rs1
                           ((concat_vec (0b101w :  3 words$word)
                               ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | SHIFTIWOP ((shamt, rs1, rd, RISCV_SRAIW)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0100000w :  7 words$word)
                   ((concat_vec shamt
                       ((concat_vec rs1
                           ((concat_vec (0b101w :  3 words$word)
                               ((concat_vec rd (0b0011011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | FENCE ((pred, succ)) =>
      sail2_state_monad$returnS ((concat_vec (0x0w :  4 words$word)
                 ((concat_vec pred
                     ((concat_vec succ
                         ((concat_vec (0b00000w :  5 words$word)
                             ((concat_vec (0b000w :  3 words$word)
                                 ((concat_vec (0b00000w :  5 words$word) (0b0001111w :  7 words$word)
                                    :  12 words$word))
                                :  15 words$word))
                            :  20 words$word))
                        :  24 words$word))
                    :  28 words$word))
                :  32 words$word))
   | FENCE_TSO ((pred, succ)) =>
      sail2_state_monad$returnS ((concat_vec (0x8w :  4 words$word)
                 ((concat_vec pred
                     ((concat_vec succ
                         ((concat_vec (0b00000w :  5 words$word)
                             ((concat_vec (0b000w :  3 words$word)
                                 ((concat_vec (0b00000w :  5 words$word) (0b0001111w :  7 words$word)
                                    :  12 words$word))
                                :  15 words$word))
                            :  20 words$word))
                        :  24 words$word))
                    :  28 words$word))
                :  32 words$word))
   | FENCEI (() ) =>
      sail2_state_monad$returnS ((concat_vec (0x000w :  12 words$word)
                 ((concat_vec (0b00000w :  5 words$word)
                     ((concat_vec (0b001w :  3 words$word)
                         ((concat_vec (0b00000w :  5 words$word) (0b0001111w :  7 words$word)  :  12 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | ECALL (() ) =>
      sail2_state_monad$returnS ((concat_vec (0x000w :  12 words$word)
                 ((concat_vec (0b00000w :  5 words$word)
                     ((concat_vec (0b000w :  3 words$word)
                         ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)  :  12 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | MRET (() ) =>
      sail2_state_monad$returnS ((concat_vec (0b0011000w :  7 words$word)
                 ((concat_vec (0b00010w :  5 words$word)
                     ((concat_vec (0b00000w :  5 words$word)
                         ((concat_vec (0b000w :  3 words$word)
                             ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)
                                :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | SRET (() ) =>
      sail2_state_monad$returnS ((concat_vec (0b0001000w :  7 words$word)
                 ((concat_vec (0b00010w :  5 words$word)
                     ((concat_vec (0b00000w :  5 words$word)
                         ((concat_vec (0b000w :  3 words$word)
                             ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)
                                :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | EBREAK (() ) =>
      sail2_state_monad$returnS ((concat_vec (0x001w :  12 words$word)
                 ((concat_vec (0b00000w :  5 words$word)
                     ((concat_vec (0b000w :  3 words$word)
                         ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)  :  12 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | WFI (() ) =>
      sail2_state_monad$returnS ((concat_vec (0x105w :  12 words$word)
                 ((concat_vec (0b00000w :  5 words$word)
                     ((concat_vec (0b000w :  3 words$word)
                         ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)  :  12 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | SFENCE_VMA ((rs1, rs2)) =>
      sail2_state_monad$returnS ((concat_vec (0b0001001w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b000w :  3 words$word)
                             ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)
                                :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | LOADRES ((aq, rl, rs1, size1, rd)) =>
      if ((amo_width_valid size1)) then
        sail2_state_monad$returnS ((concat_vec (0b00010w :  5 words$word)
                   ((concat_vec ((bool_bits_forwards aq  :  1 words$word))
                       ((concat_vec ((bool_bits_forwards rl  :  1 words$word))
                           ((concat_vec (0b00000w :  5 words$word)
                               ((concat_vec rs1
                                   ((concat_vec (0b0w :  1 words$word)
                                       ((concat_vec ((size_bits_forwards size1  :  2 words$word))
                                           ((concat_vec rd (0b0101111w :  7 words$word)  :  12 words$word))
                                          :  14 words$word))
                                      :  15 words$word))
                                  :  20 words$word))
                              :  25 words$word))
                          :  26 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | STORECON ((aq, rl, rs2, rs1, size1, rd)) =>
      if ((amo_width_valid size1)) then
        sail2_state_monad$returnS ((concat_vec (0b00011w :  5 words$word)
                   ((concat_vec ((bool_bits_forwards aq  :  1 words$word))
                       ((concat_vec ((bool_bits_forwards rl  :  1 words$word))
                           ((concat_vec rs2
                               ((concat_vec rs1
                                   ((concat_vec (0b0w :  1 words$word)
                                       ((concat_vec ((size_bits_forwards size1  :  2 words$word))
                                           ((concat_vec rd (0b0101111w :  7 words$word)  :  12 words$word))
                                          :  14 words$word))
                                      :  15 words$word))
                                  :  20 words$word))
                              :  25 words$word))
                          :  26 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | AMO ((op, aq, rl, rs2, rs1, size1, rd)) =>
      if ((amo_width_valid size1)) then
        sail2_state_monad$returnS ((concat_vec ((encdec_amoop_forwards op  :  5 words$word))
                   ((concat_vec ((bool_bits_forwards aq  :  1 words$word))
                       ((concat_vec ((bool_bits_forwards rl  :  1 words$word))
                           ((concat_vec rs2
                               ((concat_vec rs1
                                   ((concat_vec (0b0w :  1 words$word)
                                       ((concat_vec ((size_bits_forwards size1  :  2 words$word))
                                           ((concat_vec rd (0b0101111w :  7 words$word)  :  12 words$word))
                                          :  14 words$word))
                                      :  15 words$word))
                                  :  20 words$word))
                              :  25 words$word))
                          :  26 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | MUL ((rs2, rs1, rd, high, signed1, signed2)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000001w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec
                             ((encdec_mul_op_forwards (high, signed1, signed2)  :  3 words$word))
                             ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | DIV0 ((rs2, rs1, rd, s)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000001w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b10w :  2 words$word)
                             ((concat_vec ((bool_not_bits_forwards s  :  1 words$word))
                                 ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                                :  13 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | REM ((rs2, rs1, rd, s)) =>
      sail2_state_monad$returnS ((concat_vec (0b0000001w :  7 words$word)
                 ((concat_vec rs2
                     ((concat_vec rs1
                         ((concat_vec (0b11w :  2 words$word)
                             ((concat_vec ((bool_not_bits_forwards s  :  1 words$word))
                                 ((concat_vec rd (0b0110011w :  7 words$word)  :  12 words$word))
                                :  13 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | MULW ((rs2, rs1, rd)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000001w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | DIVW ((rs2, rs1, rd, s)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000001w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b10w :  2 words$word)
                               ((concat_vec ((bool_not_bits_forwards s  :  1 words$word))
                                   ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                                  :  13 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | REMW ((rs2, rs1, rd, s)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b0000001w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b11w :  2 words$word)
                               ((concat_vec ((bool_not_bits_forwards s  :  1 words$word))
                                   ((concat_vec rd (0b0111011w :  7 words$word)  :  12 words$word))
                                  :  13 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | CSR ((csr, rs1, rd, is_imm, op)) =>
      sail2_state_monad$returnS ((concat_vec csr
                 ((concat_vec rs1
                     ((concat_vec ((bool_bits_forwards is_imm  :  1 words$word))
                         ((concat_vec ((encdec_csrop_forwards op  :  2 words$word))
                             ((concat_vec rd (0b1110011w :  7 words$word)  :  12 words$word))
                            :  14 words$word))
                        :  15 words$word))
                    :  20 words$word))
                :  32 words$word))
   | URET (() ) =>
      sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                 ((concat_vec (0b00010w :  5 words$word)
                     ((concat_vec (0b00000w :  5 words$word)
                         ((concat_vec (0b000w :  3 words$word)
                             ((concat_vec (0b00000w :  5 words$word) (0b1110011w :  7 words$word)
                                :  12 words$word))
                            :  15 words$word))
                        :  20 words$word))
                    :  25 words$word))
                :  32 words$word))
   | FENCE_RESERVED ((fm, pred, succ, rs, rd)) =>
      if (((((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word))))))))))
      then
        sail2_state_monad$returnS ((concat_vec fm
                   ((concat_vec pred
                       ((concat_vec succ
                           ((concat_vec rs
                               ((concat_vec (0b000w :  3 words$word)
                                   ((concat_vec rd (0b0001111w :  7 words$word)  :  12 words$word))
                                  :  15 words$word))
                              :  20 words$word))
                          :  24 words$word))
                      :  28 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | FENCEI_RESERVED ((imm, rs, rd)) =>
      if ((((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg))))))))) then
        sail2_state_monad$returnS ((concat_vec imm
                   ((concat_vec rs
                       ((concat_vec (0b001w :  3 words$word)
                           ((concat_vec rd (0b0001111w :  7 words$word)  :  12 words$word))
                          :  15 words$word))
                      :  20 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | LOAD_FP ((imm, rs1, rd, WORD)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__48 : bool) . 
      if w__48 then
        sail2_state_monad$returnS ((concat_vec imm
                   ((concat_vec rs1
                       ((concat_vec (0b010w :  3 words$word)
                           ((concat_vec rd (0b0000111w :  7 words$word)  :  12 words$word))
                          :  15 words$word))
                      :  20 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | LOAD_FP ((imm, rs1, rd, DOUBLE)) => sail2_state_monad$bindS
      (is_RV32D_or_RV64D () ) (\ (w__51 : bool) . 
      if w__51 then
        sail2_state_monad$returnS ((concat_vec imm
                   ((concat_vec rs1
                       ((concat_vec (0b011w :  3 words$word)
                           ((concat_vec rd (0b0000111w :  7 words$word)  :  12 words$word))
                          :  15 words$word))
                      :  20 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | STORE_FP ((v__7, rs2, rs1, WORD)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__54 : bool) . 
      if w__54 then
        let (imm7 : 7 bits) = ((subrange_vec_dec v__7 (( 11 : int):ii) (( 5 : int):ii)  :  7 words$word)) in
        let (imm7 : 7 bits) = ((subrange_vec_dec v__7 (( 11 : int):ii) (( 5 : int):ii)  :  7 words$word)) in
        let (imm5 : 5 bits) = ((subrange_vec_dec v__7 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec imm7
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b010w :  3 words$word)
                               ((concat_vec imm5 (0b0100111w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | STORE_FP ((v__8, rs2, rs1, DOUBLE)) => sail2_state_monad$bindS
      (is_RV32D_or_RV64D () ) (\ (w__57 : bool) . 
      if w__57 then
        let (imm7 : 7 bits) = ((subrange_vec_dec v__8 (( 11 : int):ii) (( 5 : int):ii)  :  7 words$word)) in
        let (imm7 : 7 bits) = ((subrange_vec_dec v__8 (( 11 : int):ii) (( 5 : int):ii)  :  7 words$word)) in
        let (imm5 : 5 bits) = ((subrange_vec_dec v__8 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec imm7
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b011w :  3 words$word)
                               ((concat_vec imm5 (0b0100111w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FMADD_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__60 : bool) . 
      if w__60 then
        sail2_state_monad$returnS ((concat_vec rs3
                   ((concat_vec (0b00w :  2 words$word)
                       ((concat_vec rs2
                           ((concat_vec rs1
                               ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                                   ((concat_vec rd (0b1000011w :  7 words$word)  :  12 words$word))
                                  :  15 words$word))
                              :  20 words$word))
                          :  25 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FMSUB_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__63 : bool) . 
      if w__63 then
        sail2_state_monad$returnS ((concat_vec rs3
                   ((concat_vec (0b00w :  2 words$word)
                       ((concat_vec rs2
                           ((concat_vec rs1
                               ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                                   ((concat_vec rd (0b1000111w :  7 words$word)  :  12 words$word))
                                  :  15 words$word))
                              :  20 words$word))
                          :  25 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FNMSUB_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__66 : bool) . 
      if w__66 then
        sail2_state_monad$returnS ((concat_vec rs3
                   ((concat_vec (0b00w :  2 words$word)
                       ((concat_vec rs2
                           ((concat_vec rs1
                               ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                                   ((concat_vec rd (0b1001011w :  7 words$word)  :  12 words$word))
                                  :  15 words$word))
                              :  20 words$word))
                          :  25 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FNMADD_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__69 : bool) . 
      if w__69 then
        sail2_state_monad$returnS ((concat_vec rs3
                   ((concat_vec (0b00w :  2 words$word)
                       ((concat_vec rs2
                           ((concat_vec rs1
                               ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                                   ((concat_vec rd (0b1001111w :  7 words$word)  :  12 words$word))
                                  :  15 words$word))
                              :  20 words$word))
                          :  25 words$word))
                      :  27 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FADD_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__72 : bool) . 
      if w__72 then
        sail2_state_monad$returnS ((concat_vec (0b0000000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FSUB_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__75 : bool) . 
      if w__75 then
        sail2_state_monad$returnS ((concat_vec (0b0000100w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FMUL_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__78 : bool) . 
      if w__78 then
        sail2_state_monad$returnS ((concat_vec (0b0001000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FDIV_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__81 : bool) . 
      if w__81 then
        sail2_state_monad$returnS ((concat_vec (0b0001100w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FSQRT_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__84 : bool) . 
      if w__84 then
        sail2_state_monad$returnS ((concat_vec (0b0101100w :  7 words$word)
                   ((concat_vec (0b00000w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_W_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__87 : bool) . 
      if w__87 then
        sail2_state_monad$returnS ((concat_vec (0b1100000w :  7 words$word)
                   ((concat_vec (0b00000w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_WU_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__90 : bool) . 
      if w__90 then
        sail2_state_monad$returnS ((concat_vec (0b1100000w :  7 words$word)
                   ((concat_vec (0b00001w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_W)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__93 : bool) . 
      if w__93 then
        sail2_state_monad$returnS ((concat_vec (0b1101000w :  7 words$word)
                   ((concat_vec (0b00000w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_WU)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__96 : bool) . 
      if w__96 then
        sail2_state_monad$returnS ((concat_vec (0b1101000w :  7 words$word)
                   ((concat_vec (0b00001w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_L_S)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__99 : bool) . 
      if w__99 then
        sail2_state_monad$returnS ((concat_vec (0b1100000w :  7 words$word)
                   ((concat_vec (0b00010w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_LU_S)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__102 : bool) . 
      if w__102 then
        sail2_state_monad$returnS ((concat_vec (0b1100000w :  7 words$word)
                   ((concat_vec (0b00011w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_L)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__105 : bool) . 
      if w__105 then
        sail2_state_monad$returnS ((concat_vec (0b1101000w :  7 words$word)
                   ((concat_vec (0b00010w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_LU)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__108 : bool) . 
      if w__108 then
        sail2_state_monad$returnS ((concat_vec (0b1101000w :  7 words$word)
                   ((concat_vec (0b00011w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec ((encdec_rounding_mode_forwards rm  :  3 words$word))
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJ_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__111 : bool) . 
      if w__111 then
        sail2_state_monad$returnS ((concat_vec (0b0010000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJN_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__114 : bool) . 
      if w__114 then
        sail2_state_monad$returnS ((concat_vec (0b0010000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJX_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__117 : bool) . 
      if w__117 then
        sail2_state_monad$returnS ((concat_vec (0b0010000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b010w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FMIN_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__120 : bool) . 
      if w__120 then
        sail2_state_monad$returnS ((concat_vec (0b0010100w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FMAX_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__123 : bool) . 
      if w__123 then
        sail2_state_monad$returnS ((concat_vec (0b0010100w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FEQ_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__126 : bool) . 
      if w__126 then
        sail2_state_monad$returnS ((concat_vec (0b1010000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b010w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FLT_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__129 : bool) . 
      if w__129 then
        sail2_state_monad$returnS ((concat_vec (0b1010000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FLE_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__132 : bool) . 
      if w__132 then
        sail2_state_monad$returnS ((concat_vec (0b1010000w :  7 words$word)
                   ((concat_vec rs2
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_TYPE_S ((rs1, rd, FCLASS_S)) => sail2_state_monad$bindS
      (haveFExt () ) (\ (w__135 : bool) . 
      if w__135 then
        sail2_state_monad$returnS ((concat_vec (0b1110000w :  7 words$word)
                   ((concat_vec (0b00000w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec (0b001w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_TYPE_S ((rs1, rd, FMV_X_W)) => sail2_state_monad$bindS
      (haveFExt () ) (\ (w__138 : bool) . 
      if w__138 then
        sail2_state_monad$returnS ((concat_vec (0b1110000w :  7 words$word)
                   ((concat_vec (0b00000w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | F_UN_TYPE_S ((rs1, rd, FMV_W_X)) => sail2_state_monad$bindS
      (haveFExt () ) (\ (w__141 : bool) . 
      if w__141 then
        sail2_state_monad$returnS ((concat_vec (0b1111000w :  7 words$word)
                   ((concat_vec (0b00000w :  5 words$word)
                       ((concat_vec rs1
                           ((concat_vec (0b000w :  3 words$word)
                               ((concat_vec rd (0b1010011w :  7 words$word)  :  12 words$word))
                              :  15 words$word))
                          :  20 words$word))
                      :  25 words$word))
                  :  32 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | ILLEGAL (s) => sail2_state_monad$returnS s
   | _ => sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   )))`;


val _ = Define `
 ((encdec_backwards:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((ast),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let v__9 = arg_ in
   if (let (mappingpatterns_40_0 :  7 words$word) = ((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) in
     encdec_uop_backwards_matches mappingpatterns_40_0) then
     let (imm :  20 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 12 : int):ii)  :  20 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm :  20 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 12 : int):ii)  :  20 words$word)) in
     let (mappingpatterns_40_0 :  7 words$word) = ((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) in sail2_state_monad$bindS
     (encdec_uop_backwards mappingpatterns_40_0) (\ op .  sail2_state_monad$returnS (UTYPE (imm, rd, op)))
   else if (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1101111w :  7 words$word))))
   then
     let (imm_19 : 1 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm_8 : 1 bits) = ((subrange_vec_dec v__9 (( 20 : int):ii) (( 20 : int):ii)  :  1 words$word)) in
     let (imm_7_0 : 8 bits) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 12 : int):ii)  :  8 words$word)) in
     let (imm_19 : 1 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)) in
     let (imm_18_13 : 6 bits) = ((subrange_vec_dec v__9 (( 30 : int):ii) (( 25 : int):ii)  :  6 words$word)) in
     let (imm_12_9 : 4 bits) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 21 : int):ii)  :  4 words$word)) in
     sail2_state_monad$returnS (RISCV_JAL ((concat_vec imm_19
                           ((concat_vec imm_7_0
                               ((concat_vec imm_8
                                   ((concat_vec imm_18_13
                                       ((concat_vec imm_12_9 (0b0w :  1 words$word)  :  5 words$word))
                                      :  11 words$word))
                                  :  12 words$word))
                              :  20 words$word))
                          :  21 words$word),
                        rd))
   else if ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1100111w :  7 words$word)))))))
   then
     let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
     sail2_state_monad$returnS (RISCV_JALR (imm, rs1, rd))
   else if ((((let (mappingpatterns_41_0 :  3 words$word) =
                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
               encdec_bop_backwards_matches mappingpatterns_41_0) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1100011w :  7 words$word)))))))
   then
     let (imm7_6 : 1 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)) in
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (imm7_6 : 1 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 31 : int):ii)  :  1 words$word)) in
     let (imm7_5_0 : 6 bits) = ((subrange_vec_dec v__9 (( 30 : int):ii) (( 25 : int):ii)  :  6 words$word)) in
     let (imm5_4_1 : 4 bits) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 8 : int):ii)  :  4 words$word)) in
     let (imm5_0 : 1 bits) = ((subrange_vec_dec v__9 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
     let (mappingpatterns_41_0 :  3 words$word) = ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
     (encdec_bop_backwards mappingpatterns_41_0) (\ op . 
     sail2_state_monad$returnS (BTYPE ((concat_vec imm7_6
                       ((concat_vec imm5_0
                           ((concat_vec imm7_5_0
                               ((concat_vec imm5_4_1 (0b0w :  1 words$word)  :  5 words$word))
                              :  11 words$word))
                          :  12 words$word))
                      :  13 words$word),
                    rs2,
                    rs1,
                    op)))
   else if ((((let (mappingpatterns_42_0 :  3 words$word) =
                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
               encdec_iop_backwards_matches mappingpatterns_42_0) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word)))))))
   then
     let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
     let (mappingpatterns_42_0 :  3 words$word) = ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
     (encdec_iop_backwards mappingpatterns_42_0) (\ op .  sail2_state_monad$returnS (ITYPE (imm, rs1, rd, op)))
   else if ((((let (shamt :  6 words$word) = ((subrange_vec_dec v__9 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
               (((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((((access_vec_dec shamt (( 5 : int):ii))) = B0))))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 26 : int):ii)  :  6 words$word)) = (0b000000w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))))))))) then
     let (shamt :  6 words$word) = ((subrange_vec_dec v__9 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (SHIFTIOP (shamt, rs1, rd, RISCV_SLLI))
   else if ((((let (shamt :  6 words$word) = ((subrange_vec_dec v__9 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
               (((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((((access_vec_dec shamt (( 5 : int):ii))) = B0))))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 26 : int):ii)  :  6 words$word)) = (0b000000w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))))))))) then
     let (shamt :  6 words$word) = ((subrange_vec_dec v__9 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (SHIFTIOP (shamt, rs1, rd, RISCV_SRLI))
   else if ((((let (shamt :  6 words$word) = ((subrange_vec_dec v__9 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
               (((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((((access_vec_dec shamt (( 5 : int):ii))) = B0))))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 26 : int):ii)  :  6 words$word)) = (0b010000w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))))))))) then
     let (shamt :  6 words$word) = ((subrange_vec_dec v__9 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (SHIFTIOP (shamt, rs1, rd, RISCV_SRAI))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_ADD))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_SLT))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_SLTU))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_AND))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_OR))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_XOR))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_SLL))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_SRL))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_SUB))
   else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, RISCV_SRA))
   else sail2_state_monad$bindS
     (sail2_state$and_boolS
       (let (mappingpatterns_44_0 :  2 words$word) =
         ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
       let (mappingpatterns_43_0 :  1 words$word) = ((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in
       if ((size_bits_backwards_matches mappingpatterns_44_0)) then sail2_state_monad$bindS
         (size_bits_backwards mappingpatterns_44_0) (\ size1 . 
         if ((bool_bits_backwards_matches mappingpatterns_43_0)) then sail2_state_monad$bindS
           (bool_bits_backwards mappingpatterns_43_0) (\ is_unsigned . 
           sail2_state_monad$returnS (((((((word_width_bytes size1)) < (( 4 : int):ii))) \/ (((((~ is_unsigned)) /\ ((((word_width_bytes size1)) <= (( 4 : int):ii))))))))))
         else sail2_state_monad$returnS F)
       else sail2_state_monad$returnS F)
       (sail2_state_monad$returnS (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000011w :  7 words$word)))))) (\ (w__2 :
       bool) . 
     if w__2 then
       let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
       let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
       let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
       let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
       let (mappingpatterns_44_0 :  2 words$word) = ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
       let (mappingpatterns_43_0 :  1 words$word) = ((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
       (size_bits_backwards mappingpatterns_44_0) (\ size1 .  sail2_state_monad$bindS
       (bool_bits_backwards mappingpatterns_43_0) (\ is_unsigned . 
       sail2_state_monad$returnS (LOAD (imm, rs1, rd, is_unsigned, size1, F, F))))
     else sail2_state_monad$bindS
       (sail2_state$and_boolS
         (let (mappingpatterns_45_0 :  2 words$word) =
           ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
         if ((size_bits_backwards_matches mappingpatterns_45_0)) then sail2_state_monad$bindS
           (size_bits_backwards mappingpatterns_45_0) (\ size1 . 
           sail2_state_monad$returnS ((((word_width_bytes size1)) <= (( 4 : int):ii))))
         else sail2_state_monad$returnS F)
         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0100011w :  7 words$word))))))))) (\ (w__4 : bool) . 
       if w__4 then
         let (imm7 : 7 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) in
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (imm7 : 7 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) in
         let (imm5 : 5 bits) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         let (mappingpatterns_45_0 :  2 words$word) =
           ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in sail2_state_monad$bindS
         (size_bits_backwards mappingpatterns_45_0) (\ size1 . 
         sail2_state_monad$returnS (STORE ((concat_vec imm7 imm5  :  12 words$word), rs2, rs1, size1, F, F)))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word)))))))))) then
         let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         let (imm :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
         sail2_state_monad$returnS (ADDIW (imm, rs1, rd))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         let (shamt :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SHIFTW (shamt, rs1, rd, RISCV_SLLI))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         let (shamt :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SHIFTW (shamt, rs1, rd, RISCV_SRLI))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         let (shamt :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SHIFTW (shamt, rs1, rd, RISCV_SRAI))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (RTYPEW (rs2, rs1, rd, RISCV_ADDW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (RTYPEW (rs2, rs1, rd, RISCV_SUBW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (RTYPEW (rs2, rs1, rd, RISCV_SLLW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (RTYPEW (rs2, rs1, rd, RISCV_SRLW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (RTYPEW (rs2, rs1, rd, RISCV_SRAW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         let (shamt :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SHIFTIWOP (shamt, rs1, rd, RISCV_SLLIW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         let (shamt :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SHIFTIWOP (shamt, rs1, rd, RISCV_SRLIW))
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         let (shamt :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SHIFTIWOP (shamt, rs1, rd, RISCV_SRAIW))
       else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) = (0x0w :  4 words$word)))) /\ (((((subrange_vec_dec v__9 (( 19 : int):ii) (( 0 : int):ii)  :  20 words$word)) = (0x0000Fw :  20 words$word))))))) then
         let (succ :  4 words$word) = ((subrange_vec_dec v__9 (( 23 : int):ii) (( 20 : int):ii)  :  4 words$word)) in
         let (pred :  4 words$word) = ((subrange_vec_dec v__9 (( 27 : int):ii) (( 24 : int):ii)  :  4 words$word)) in
         sail2_state_monad$returnS (FENCE (pred, succ))
       else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) = (0x8w :  4 words$word)))) /\ (((((subrange_vec_dec v__9 (( 19 : int):ii) (( 0 : int):ii)  :  20 words$word)) = (0x0000Fw :  20 words$word))))))) then
         let (succ :  4 words$word) = ((subrange_vec_dec v__9 (( 23 : int):ii) (( 20 : int):ii)  :  4 words$word)) in
         let (pred :  4 words$word) = ((subrange_vec_dec v__9 (( 27 : int):ii) (( 24 : int):ii)  :  4 words$word)) in
         sail2_state_monad$returnS (FENCE_TSO (pred, succ))
       else if (((v__9 = (0x0000100Fw :  32 words$word)))) then sail2_state_monad$returnS (FENCEI () )
       else if (((v__9 = (0x00000073w :  32 words$word)))) then sail2_state_monad$returnS (ECALL () )
       else if (((v__9 = (0x30200073w :  32 words$word)))) then sail2_state_monad$returnS (MRET () )
       else if (((v__9 = (0x10200073w :  32 words$word)))) then sail2_state_monad$returnS (SRET () )
       else if (((v__9 = (0x00100073w :  32 words$word)))) then sail2_state_monad$returnS (EBREAK () )
       else if (((v__9 = (0x10500073w :  32 words$word)))) then sail2_state_monad$returnS (WFI () )
       else if ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0001001w :  7 words$word)))) /\ (((((subrange_vec_dec v__9 (( 14 : int):ii) (( 0 : int):ii)  :  15 words$word)) = (0b000000001110011w :  15 words$word))))))) then
         let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
         let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (SFENCE_VMA (rs1, rs2))
       else sail2_state_monad$bindS
         (sail2_state$and_boolS
           (let (mappingpatterns_48_0 :  2 words$word) =
             ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
           let (mappingpatterns_47_0 :  1 words$word) =
             ((subrange_vec_dec v__9 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
           let (mappingpatterns_46_0 :  1 words$word) =
             ((subrange_vec_dec v__9 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
           if ((size_bits_backwards_matches mappingpatterns_48_0)) then sail2_state_monad$bindS
             (size_bits_backwards mappingpatterns_48_0) (\ size1 . 
             if ((bool_bits_backwards_matches mappingpatterns_47_0)) then sail2_state_monad$bindS
               (bool_bits_backwards mappingpatterns_47_0) (\ rl . 
               if ((bool_bits_backwards_matches mappingpatterns_46_0)) then sail2_state_monad$bindS
                 (bool_bits_backwards mappingpatterns_46_0) (\ aq . 
                 sail2_state_monad$returnS ((amo_width_valid size1)))
               else sail2_state_monad$returnS F)
             else sail2_state_monad$returnS F)
           else sail2_state_monad$returnS F)
           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) = (0b00010w :  5 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0101111w :  7 words$word))))))))))))))) (\ (w__8 : bool) . 
         if w__8 then
           let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
           let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
           let (mappingpatterns_48_0 :  2 words$word) =
             ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
           let (mappingpatterns_47_0 :  1 words$word) =
             ((subrange_vec_dec v__9 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
           let (mappingpatterns_46_0 :  1 words$word) =
             ((subrange_vec_dec v__9 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
           (size_bits_backwards mappingpatterns_48_0) (\ size1 .  sail2_state_monad$bindS
           (bool_bits_backwards mappingpatterns_47_0) (\ rl .  sail2_state_monad$bindS
           (bool_bits_backwards mappingpatterns_46_0) (\ aq . 
           sail2_state_monad$returnS (LOADRES (aq, rl, rs1, size1, rd)))))
         else sail2_state_monad$bindS
           (sail2_state$and_boolS
             (let (mappingpatterns_51_0 :  2 words$word) =
               ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
             let (mappingpatterns_50_0 :  1 words$word) =
               ((subrange_vec_dec v__9 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
             let (mappingpatterns_49_0 :  1 words$word) =
               ((subrange_vec_dec v__9 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
             if ((size_bits_backwards_matches mappingpatterns_51_0)) then sail2_state_monad$bindS
               (size_bits_backwards mappingpatterns_51_0) (\ size1 . 
               if ((bool_bits_backwards_matches mappingpatterns_50_0)) then sail2_state_monad$bindS
                 (bool_bits_backwards mappingpatterns_50_0) (\ rl . 
                 if ((bool_bits_backwards_matches mappingpatterns_49_0)) then sail2_state_monad$bindS
                   (bool_bits_backwards mappingpatterns_49_0) (\ aq . 
                   sail2_state_monad$returnS ((amo_width_valid size1)))
                 else sail2_state_monad$returnS F)
               else sail2_state_monad$returnS F)
             else sail2_state_monad$returnS F)
             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) = (0b00011w :  5 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0101111w :  7 words$word)))))))))))) (\ (w__12 : bool) . 
           if w__12 then
             let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
             let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
             let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
             let (mappingpatterns_51_0 :  2 words$word) =
               ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
             let (mappingpatterns_50_0 :  1 words$word) =
               ((subrange_vec_dec v__9 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
             let (mappingpatterns_49_0 :  1 words$word) =
               ((subrange_vec_dec v__9 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
             (size_bits_backwards mappingpatterns_51_0) (\ size1 .  sail2_state_monad$bindS
             (bool_bits_backwards mappingpatterns_50_0) (\ rl .  sail2_state_monad$bindS
             (bool_bits_backwards mappingpatterns_49_0) (\ aq . 
             sail2_state_monad$returnS (STORECON (aq, rl, rs2, rs1, size1, rd)))))
           else sail2_state_monad$bindS
             (sail2_state$and_boolS
               (let (mappingpatterns_52_0 :  5 words$word) =
                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_55_0 :  2 words$word) =
                 ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
               let (mappingpatterns_54_0 :  1 words$word) =
                 ((subrange_vec_dec v__9 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_53_0 :  1 words$word) =
                 ((subrange_vec_dec v__9 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_52_0 :  5 words$word) =
                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
               if ((size_bits_backwards_matches mappingpatterns_55_0)) then sail2_state_monad$bindS
                 (size_bits_backwards mappingpatterns_55_0) (\ size1 . 
                 if ((bool_bits_backwards_matches mappingpatterns_54_0)) then sail2_state_monad$bindS
                   (bool_bits_backwards mappingpatterns_54_0) (\ rl . 
                   if ((bool_bits_backwards_matches mappingpatterns_53_0)) then sail2_state_monad$bindS
                     (bool_bits_backwards mappingpatterns_53_0) (\ aq . 
                     if ((encdec_amoop_backwards_matches mappingpatterns_52_0)) then sail2_state_monad$bindS
                       (encdec_amoop_backwards mappingpatterns_52_0) (\ op . 
                       sail2_state_monad$returnS ((amo_width_valid size1)))
                     else sail2_state_monad$returnS F)
                   else sail2_state_monad$returnS F)
                 else sail2_state_monad$returnS F)
               else sail2_state_monad$returnS F)
               (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0101111w :  7 words$word))))))))) (\ (w__17 : bool) . 
             if w__17 then
               let (mappingpatterns_52_0 :  5 words$word) =
                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
               let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
               let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
               let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_55_0 :  2 words$word) =
                 ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
               let (mappingpatterns_54_0 :  1 words$word) =
                 ((subrange_vec_dec v__9 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_53_0 :  1 words$word) =
                 ((subrange_vec_dec v__9 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_52_0 :  5 words$word) =
                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in sail2_state_monad$bindS
               (size_bits_backwards mappingpatterns_55_0) (\ size1 .  sail2_state_monad$bindS
               (bool_bits_backwards mappingpatterns_54_0) (\ rl .  sail2_state_monad$bindS
               (bool_bits_backwards mappingpatterns_53_0) (\ aq .  sail2_state_monad$bindS
               (encdec_amoop_backwards mappingpatterns_52_0) (\ op . 
               sail2_state_monad$returnS (AMO (op, aq, rl, rs2, rs1, size1, rd))))))
             else if ((((let (mappingpatterns_56_0 :  3 words$word) =
                           ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                         encdec_mul_op_backwards_matches mappingpatterns_56_0) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
               let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
               let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
               let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_56_0 :  3 words$word) =
                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
               (encdec_mul_op_backwards mappingpatterns_56_0) (\ varstup .  let (high, signed1, signed2) = varstup in
               sail2_state_monad$returnS (MUL (rs2, rs1, rd, high, signed1, signed2)))
             else if ((((let (mappingpatterns_57_0 :  1 words$word) =
                           ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                         bool_not_bits_backwards_matches mappingpatterns_57_0) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word))))))))))))) then
               let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
               let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
               let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_57_0 :  1 words$word) =
                 ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
               (bool_not_bits_backwards mappingpatterns_57_0) (\ s . 
               sail2_state_monad$returnS (DIV0 (rs2, rs1, rd, s)))
             else if ((((let (mappingpatterns_58_0 :  1 words$word) =
                           ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                         bool_not_bits_backwards_matches mappingpatterns_58_0) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word))))))))))))) then
               let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
               let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
               let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_58_0 :  1 words$word) =
                 ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
               (bool_not_bits_backwards mappingpatterns_58_0) (\ s . 
               sail2_state_monad$returnS (REM (rs2, rs1, rd, s)))
             else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
               let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
               let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
               let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               sail2_state_monad$returnS (MULW (rs2, rs1, rd))
             else sail2_state_monad$bindS
               (sail2_state$and_boolS
                 (let (mappingpatterns_59_0 :  1 words$word) =
                   ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                 if ((bool_not_bits_backwards_matches mappingpatterns_59_0)) then sail2_state_monad$bindS
                   (bool_not_bits_backwards mappingpatterns_59_0) (\ s . 
                   sail2_state_monad$returnS ((((( 32 : int):ii) = (( 64 : int):ii)))))
                 else sail2_state_monad$returnS F)
                 (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word)))))))))))) (\ (w__19 : bool) . 
               if w__19 then
                 let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                 let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                 let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                 let (mappingpatterns_59_0 :  1 words$word) =
                   ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
                 (bool_not_bits_backwards mappingpatterns_59_0) (\ s . 
                 sail2_state_monad$returnS (DIVW (rs2, rs1, rd, s)))
               else sail2_state_monad$bindS
                 (sail2_state$and_boolS
                   (let (mappingpatterns_60_0 :  1 words$word) =
                     ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                   if ((bool_not_bits_backwards_matches mappingpatterns_60_0)) then sail2_state_monad$bindS
                     (bool_not_bits_backwards mappingpatterns_60_0) (\ s . 
                     sail2_state_monad$returnS ((((( 32 : int):ii) = (( 64 : int):ii)))))
                   else sail2_state_monad$returnS F)
                   (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word)))))))))))) (\ (w__21 : bool) . 
                 if w__21 then
                   let (rs2 :  5 words$word) = ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                   let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                   let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                   let (mappingpatterns_60_0 :  1 words$word) =
                     ((subrange_vec_dec v__9 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
                   (bool_not_bits_backwards mappingpatterns_60_0) (\ s . 
                   sail2_state_monad$returnS (REMW (rs2, rs1, rd, s)))
                 else sail2_state_monad$bindS
                   (sail2_state$and_boolS
                     (let (mappingpatterns_62_0 :  2 words$word) =
                       ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
                     let (mappingpatterns_61_0 :  1 words$word) =
                       ((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in
                     if ((encdec_csrop_backwards_matches mappingpatterns_62_0)) then sail2_state_monad$bindS
                       (encdec_csrop_backwards mappingpatterns_62_0) (\ op . 
                       sail2_state_monad$returnS ((bool_bits_backwards_matches mappingpatterns_61_0)))
                     else sail2_state_monad$returnS F)
                     (sail2_state_monad$returnS (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1110011w :  7 words$word)))))) (\ (w__23 : bool) . 
                   if w__23 then
                     let (csr :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                     let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                     let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                     let (csr :  12 words$word) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                     let (mappingpatterns_62_0 :  2 words$word) =
                       ((subrange_vec_dec v__9 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
                     let (mappingpatterns_61_0 :  1 words$word) =
                       ((subrange_vec_dec v__9 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
                     (encdec_csrop_backwards mappingpatterns_62_0) (\ op .  sail2_state_monad$bindS
                     (bool_bits_backwards mappingpatterns_61_0) (\ is_imm . 
                     sail2_state_monad$returnS (CSR (csr, rs1, rd, is_imm, op))))
                   else if (((v__9 = (0x00200073w :  32 words$word)))) then sail2_state_monad$returnS (URET () )
                   else if ((((let (fm : 4 bits) =
                                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) in
                               let (rs : regidx) =
                                 ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                               let (rd : regidx) =
                                 ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                               let (fm : 4 bits) =
                                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) in
                               (((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word))))))))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0001111w :  7 words$word)))))))))) then
                     let (fm : 4 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) in
                     let (succ : 4 bits) = ((subrange_vec_dec v__9 (( 23 : int):ii) (( 20 : int):ii)  :  4 words$word)) in
                     let (rs : regidx) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                     let (rd : regidx) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                     let (pred : 4 bits) = ((subrange_vec_dec v__9 (( 27 : int):ii) (( 24 : int):ii)  :  4 words$word)) in
                     let (fm : 4 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) in
                     sail2_state_monad$returnS (FENCE_RESERVED (fm, pred, succ, rs, rd))
                   else if ((((let (imm : 12 bits) =
                                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                               let (rs : regidx) =
                                 ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                               let (rd : regidx) =
                                 ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                               let (imm : 12 bits) =
                                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                               ((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg)))))))) /\ ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0001111w :  7 words$word)))))))))) then
                     let (imm : 12 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                     let (rs : regidx) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                     let (rd : regidx) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                     let (imm : 12 bits) = ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                     sail2_state_monad$returnS (FENCEI_RESERVED (imm, rs, rd))
                   else sail2_state_monad$bindS
                     (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000111w :  7 words$word))))))))) (\ (w__25 : bool) . 
                     if w__25 then
                       let (imm :  12 words$word) =
                         ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                       let (rs1 :  5 words$word) = ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                       let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                       let (imm :  12 words$word) =
                         ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                       sail2_state_monad$returnS (LOAD_FP (imm, rs1, rd, WORD))
                     else sail2_state_monad$bindS
                       (sail2_state$and_boolS ((is_RV32D_or_RV64D () ))
                         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000111w :  7 words$word))))))))) (\ (w__27 : bool) . 
                       if w__27 then
                         let (imm :  12 words$word) =
                           ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                         let (rs1 :  5 words$word) =
                           ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                         let (rd :  5 words$word) = ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                         let (imm :  12 words$word) =
                           ((subrange_vec_dec v__9 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                         sail2_state_monad$returnS (LOAD_FP (imm, rs1, rd, DOUBLE))
                       else sail2_state_monad$bindS
                         (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0100111w :  7 words$word))))))))) (\ (w__29 : bool) . 
                         if w__29 then
                           let (imm7 : 7 bits) =
                             ((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) in
                           let (rs2 :  5 words$word) =
                             ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                           let (rs1 :  5 words$word) =
                             ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                           let (imm7 : 7 bits) =
                             ((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) in
                           let (imm5 : 5 bits) =
                             ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                           sail2_state_monad$returnS (STORE_FP ((concat_vec imm7 imm5  :  12 words$word), rs2, rs1, WORD))
                         else sail2_state_monad$bindS
                           (sail2_state$and_boolS ((is_RV32D_or_RV64D () ))
                             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0100111w :  7 words$word))))))))) (\ (w__31 : bool) . 
                           if w__31 then
                             let (imm7 : 7 bits) =
                               ((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) in
                             let (rs2 :  5 words$word) =
                               ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                             let (rs1 :  5 words$word) =
                               ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                             let (imm7 : 7 bits) =
                               ((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) in
                             let (imm5 : 5 bits) =
                               ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                             sail2_state_monad$returnS (STORE_FP ((concat_vec imm7 imm5  :  12 words$word),
                                               rs2,
                                               rs1,
                                               DOUBLE))
                           else sail2_state_monad$bindS
                             (sail2_state$and_boolS
                               (let (mappingpatterns_63_0 :  3 words$word) =
                                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                               if ((encdec_rounding_mode_backwards_matches mappingpatterns_63_0))
                               then sail2_state_monad$bindS
                                 (encdec_rounding_mode_backwards mappingpatterns_63_0) (\ rm . 
                                 is_RV32F_or_RV64F () )
                               else sail2_state_monad$returnS F)
                               (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 26 : int):ii) (( 25 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1000011w :  7 words$word))))))))) (\ (w__34 : bool) . 
                             if w__34 then
                               let (rs3 :  5 words$word) =
                                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                               let (rs3 :  5 words$word) =
                                 ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                               let (rs2 :  5 words$word) =
                                 ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                               let (rs1 :  5 words$word) =
                                 ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                               let (rd :  5 words$word) =
                                 ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                               let (mappingpatterns_63_0 :  3 words$word) =
                                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                               (encdec_rounding_mode_backwards mappingpatterns_63_0) (\ rm . 
                               sail2_state_monad$returnS (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMADD_S)))
                             else sail2_state_monad$bindS
                               (sail2_state$and_boolS
                                 (let (mappingpatterns_64_0 :  3 words$word) =
                                   ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                 if ((encdec_rounding_mode_backwards_matches mappingpatterns_64_0))
                                 then sail2_state_monad$bindS
                                   (encdec_rounding_mode_backwards mappingpatterns_64_0) (\ rm . 
                                   is_RV32F_or_RV64F () )
                                 else sail2_state_monad$returnS F)
                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 26 : int):ii) (( 25 : int):ii)
                                                    :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1000111w :  7 words$word))))))))) (\ (w__37 : bool) . 
                               if w__37 then
                                 let (rs3 :  5 words$word) =
                                   ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                                 let (rs3 :  5 words$word) =
                                   ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                                 let (rs2 :  5 words$word) =
                                   ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                 let (rs1 :  5 words$word) =
                                   ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                 let (rd :  5 words$word) =
                                   ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                 let (mappingpatterns_64_0 :  3 words$word) =
                                   ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                 (encdec_rounding_mode_backwards mappingpatterns_64_0) (\ rm . 
                                 sail2_state_monad$returnS (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMSUB_S)))
                               else sail2_state_monad$bindS
                                 (sail2_state$and_boolS
                                   (let (mappingpatterns_65_0 :  3 words$word) =
                                     ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                   if ((encdec_rounding_mode_backwards_matches mappingpatterns_65_0))
                                   then sail2_state_monad$bindS
                                     (encdec_rounding_mode_backwards mappingpatterns_65_0) (\ rm . 
                                     is_RV32F_or_RV64F () )
                                   else sail2_state_monad$returnS F)
                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 26 : int):ii) (( 25 : int):ii)
                                                      :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                      :  7 words$word)) = (0b1001011w :  7 words$word))))))))) (\ (w__40 :
                                   bool) . 
                                 if w__40 then
                                   let (rs3 :  5 words$word) =
                                     ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                                   let (rs3 :  5 words$word) =
                                     ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                                   let (rs2 :  5 words$word) =
                                     ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                   let (rs1 :  5 words$word) =
                                     ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                   let (rd :  5 words$word) =
                                     ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                   let (mappingpatterns_65_0 :  3 words$word) =
                                     ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                   (encdec_rounding_mode_backwards mappingpatterns_65_0) (\ rm . 
                                   sail2_state_monad$returnS (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FNMSUB_S)))
                                 else sail2_state_monad$bindS
                                   (sail2_state$and_boolS
                                     (let (mappingpatterns_66_0 :  3 words$word) =
                                       ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                     if ((encdec_rounding_mode_backwards_matches
                                            mappingpatterns_66_0)) then sail2_state_monad$bindS
                                       (encdec_rounding_mode_backwards mappingpatterns_66_0) (\ rm . 
                                       is_RV32F_or_RV64F () )
                                     else sail2_state_monad$returnS F)
                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 26 : int):ii) (( 25 : int):ii)
                                                        :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                        :  7 words$word)) = (0b1001111w :  7 words$word))))))))) (\ (w__43 :
                                     bool) . 
                                   if w__43 then
                                     let (rs3 :  5 words$word) =
                                       ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                                     let (rs3 :  5 words$word) =
                                       ((subrange_vec_dec v__9 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
                                     let (rs2 :  5 words$word) =
                                       ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                     let (rs1 :  5 words$word) =
                                       ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                     let (rd :  5 words$word) =
                                       ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                     let (mappingpatterns_66_0 :  3 words$word) =
                                       ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                     (encdec_rounding_mode_backwards mappingpatterns_66_0) (\ rm . 
                                     sail2_state_monad$returnS (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FNMADD_S)))
                                   else sail2_state_monad$bindS
                                     (sail2_state$and_boolS
                                       (let (mappingpatterns_67_0 :  3 words$word) =
                                         ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                       if ((encdec_rounding_mode_backwards_matches
                                              mappingpatterns_67_0)) then sail2_state_monad$bindS
                                         (encdec_rounding_mode_backwards mappingpatterns_67_0) (\ rm . 
                                         is_RV32F_or_RV64F () )
                                       else sail2_state_monad$returnS F)
                                       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)
                                                          :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                          :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__46 :
                                       bool) . 
                                     if w__46 then
                                       let (rs2 :  5 words$word) =
                                         ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                       let (rs1 :  5 words$word) =
                                         ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                       let (rd :  5 words$word) =
                                         ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                       let (mappingpatterns_67_0 :  3 words$word) =
                                         ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                       (encdec_rounding_mode_backwards mappingpatterns_67_0) (\ rm . 
                                       sail2_state_monad$returnS (F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FADD_S)))
                                     else sail2_state_monad$bindS
                                       (sail2_state$and_boolS
                                         (let (mappingpatterns_68_0 :  3 words$word) =
                                           ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                         if ((encdec_rounding_mode_backwards_matches
                                                mappingpatterns_68_0)) then sail2_state_monad$bindS
                                           (encdec_rounding_mode_backwards mappingpatterns_68_0) (\ rm . 
                                           is_RV32F_or_RV64F () )
                                         else sail2_state_monad$returnS F)
                                         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)
                                                            :  7 words$word)) = (0b0000100w :  7 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                            :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__49 :
                                         bool) . 
                                       if w__49 then
                                         let (rs2 :  5 words$word) =
                                           ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                         let (rs1 :  5 words$word) =
                                           ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                         let (rd :  5 words$word) =
                                           ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                         let (mappingpatterns_68_0 :  3 words$word) =
                                           ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                         (encdec_rounding_mode_backwards mappingpatterns_68_0) (\ rm . 
                                         sail2_state_monad$returnS (F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FSUB_S)))
                                       else sail2_state_monad$bindS
                                         (sail2_state$and_boolS
                                           (let (mappingpatterns_69_0 :  3 words$word) =
                                             ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                           if ((encdec_rounding_mode_backwards_matches
                                                  mappingpatterns_69_0)) then sail2_state_monad$bindS
                                             (encdec_rounding_mode_backwards mappingpatterns_69_0) (\ rm . 
                                             is_RV32F_or_RV64F () )
                                           else sail2_state_monad$returnS F)
                                           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)
                                                              :  7 words$word)) = (0b0001000w :  7 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                              :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__52 :
                                           bool) . 
                                         if w__52 then
                                           let (rs2 :  5 words$word) =
                                             ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                           let (rs1 :  5 words$word) =
                                             ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                           let (rd :  5 words$word) =
                                             ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                           let (mappingpatterns_69_0 :  3 words$word) =
                                             ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                           (encdec_rounding_mode_backwards mappingpatterns_69_0) (\ rm . 
                                           sail2_state_monad$returnS (F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FMUL_S)))
                                         else sail2_state_monad$bindS
                                           (sail2_state$and_boolS
                                             (let (mappingpatterns_70_0 :  3 words$word) =
                                               ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                             if ((encdec_rounding_mode_backwards_matches
                                                    mappingpatterns_70_0)) then sail2_state_monad$bindS
                                               (encdec_rounding_mode_backwards mappingpatterns_70_0) (\ rm . 
                                               is_RV32F_or_RV64F () )
                                             else sail2_state_monad$returnS F)
                                             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii) (( 25 : int):ii)
                                                                :  7 words$word)) = (0b0001100w :  7 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                                :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__55 :
                                             bool) . 
                                           if w__55 then
                                             let (rs2 :  5 words$word) =
                                               ((subrange_vec_dec v__9 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) in
                                             let (rs1 :  5 words$word) =
                                               ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                             let (rd :  5 words$word) =
                                               ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                             let (mappingpatterns_70_0 :  3 words$word) =
                                               ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                             (encdec_rounding_mode_backwards mappingpatterns_70_0) (\ rm . 
                                             sail2_state_monad$returnS (F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FDIV_S)))
                                           else sail2_state_monad$bindS
                                             (sail2_state$and_boolS
                                               (let (mappingpatterns_71_0 :  3 words$word) =
                                                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                               if ((encdec_rounding_mode_backwards_matches
                                                      mappingpatterns_71_0)) then sail2_state_monad$bindS
                                                 (encdec_rounding_mode_backwards mappingpatterns_71_0) (\ rm . 
                                                 is_RV32F_or_RV64F () )
                                               else sail2_state_monad$returnS F)
                                               (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii)
                                                                   (( 20 : int):ii)
                                                                  :  12 words$word)) = (0x580w :  12 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii) (( 0 : int):ii)
                                                                  :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__58 :
                                               bool) . 
                                             if w__58 then
                                               let (rs1 :  5 words$word) =
                                                 ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                                               let (rd :  5 words$word) =
                                                 ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                                               let (mappingpatterns_71_0 :  3 words$word) =
                                                 ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                               (encdec_rounding_mode_backwards mappingpatterns_71_0) (\ rm . 
                                               sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S)))
                                             else sail2_state_monad$bindS
                                               (sail2_state$and_boolS
                                                 (let (mappingpatterns_72_0 :  3 words$word) =
                                                   ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                     :  3 words$word)) in
                                                 if ((encdec_rounding_mode_backwards_matches
                                                        mappingpatterns_72_0)) then sail2_state_monad$bindS
                                                   (encdec_rounding_mode_backwards
                                                     mappingpatterns_72_0) (\ rm . 
                                                   is_RV32F_or_RV64F () )
                                                 else sail2_state_monad$returnS F)
                                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii)
                                                                     (( 20 : int):ii)
                                                                    :  12 words$word)) = (0xC00w :  12 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii)
                                                                     (( 0 : int):ii)
                                                                    :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__61 :
                                                 bool) . 
                                               if w__61 then
                                                 let (rs1 :  5 words$word) =
                                                   ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)
                                                     :  5 words$word)) in
                                                 let (rd :  5 words$word) =
                                                   ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                     :  5 words$word)) in
                                                 let (mappingpatterns_72_0 :  3 words$word) =
                                                   ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                     :  3 words$word)) in sail2_state_monad$bindS
                                                 (encdec_rounding_mode_backwards mappingpatterns_72_0) (\ rm . 
                                                 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S)))
                                               else sail2_state_monad$bindS
                                                 (sail2_state$and_boolS
                                                   (let (mappingpatterns_73_0 :  3 words$word) =
                                                     ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                       :  3 words$word)) in
                                                   if ((encdec_rounding_mode_backwards_matches
                                                          mappingpatterns_73_0)) then sail2_state_monad$bindS
                                                     (encdec_rounding_mode_backwards
                                                       mappingpatterns_73_0) (\ rm . 
                                                     is_RV32F_or_RV64F () )
                                                   else sail2_state_monad$returnS F)
                                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii)
                                                                       (( 20 : int):ii)
                                                                      :  12 words$word)) = (0xC01w :  12 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii)
                                                                       (( 0 : int):ii)
                                                                      :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__64 :
                                                   bool) . 
                                                 if w__64 then
                                                   let (rs1 :  5 words$word) =
                                                     ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)
                                                       :  5 words$word)) in
                                                   let (rd :  5 words$word) =
                                                     ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                       :  5 words$word)) in
                                                   let (mappingpatterns_73_0 :  3 words$word) =
                                                     ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                       :  3 words$word)) in sail2_state_monad$bindS
                                                   (encdec_rounding_mode_backwards
                                                     mappingpatterns_73_0) (\ rm . 
                                                   sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S)))
                                                 else sail2_state_monad$bindS
                                                   (sail2_state$and_boolS
                                                     (let (mappingpatterns_74_0 :  3 words$word) =
                                                       ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                         :  3 words$word)) in
                                                     if ((encdec_rounding_mode_backwards_matches
                                                            mappingpatterns_74_0)) then sail2_state_monad$bindS
                                                       (encdec_rounding_mode_backwards
                                                         mappingpatterns_74_0) (\ rm . 
                                                       is_RV32F_or_RV64F () )
                                                     else sail2_state_monad$returnS F)
                                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9 (( 31 : int):ii)
                                                                         (( 20 : int):ii)
                                                                        :  12 words$word)) = (0xD00w :  12 words$word)))) /\ (((((subrange_vec_dec v__9 (( 6 : int):ii)
                                                                         (( 0 : int):ii)
                                                                        :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__67 :
                                                     bool) . 
                                                   if w__67 then
                                                     let (rs1 :  5 words$word) =
                                                       ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)
                                                         :  5 words$word)) in
                                                     let (rd :  5 words$word) =
                                                       ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                         :  5 words$word)) in
                                                     let (mappingpatterns_74_0 :  3 words$word) =
                                                       ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                         :  3 words$word)) in sail2_state_monad$bindS
                                                     (encdec_rounding_mode_backwards
                                                       mappingpatterns_74_0) (\ rm . 
                                                     sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W)))
                                                   else sail2_state_monad$bindS
                                                     (sail2_state$and_boolS
                                                       (let (mappingpatterns_75_0 :  3 words$word) =
                                                         ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                           :  3 words$word)) in
                                                       if ((encdec_rounding_mode_backwards_matches
                                                              mappingpatterns_75_0)) then sail2_state_monad$bindS
                                                         (encdec_rounding_mode_backwards
                                                           mappingpatterns_75_0) (\ rm . 
                                                         is_RV32F_or_RV64F () )
                                                       else sail2_state_monad$returnS F)
                                                       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9
                                                                           (( 31 : int):ii) (( 20 : int):ii)
                                                                          :  12 words$word)) = (0xD01w :  12 words$word)))) /\ (((((subrange_vec_dec v__9
                                                                           (( 6 : int):ii) (( 0 : int):ii)
                                                                          :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__70 :
                                                       bool) . 
                                                     if w__70 then
                                                       let (rs1 :  5 words$word) =
                                                         ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)
                                                           :  5 words$word)) in
                                                       let (rd :  5 words$word) =
                                                         ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                           :  5 words$word)) in
                                                       let (mappingpatterns_75_0 :  3 words$word) =
                                                         ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                           :  3 words$word)) in sail2_state_monad$bindS
                                                       (encdec_rounding_mode_backwards
                                                         mappingpatterns_75_0) (\ rm . 
                                                       sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1,
                                                                               rm,
                                                                               rd,
                                                                               FCVT_S_WU)))
                                                     else sail2_state_monad$bindS
                                                       (sail2_state$and_boolS
                                                         (let (mappingpatterns_76_0 :  3 words$word) =
                                                           ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                             :  3 words$word)) in
                                                         if ((encdec_rounding_mode_backwards_matches
                                                                mappingpatterns_76_0)) then sail2_state_monad$bindS
                                                           (encdec_rounding_mode_backwards
                                                             mappingpatterns_76_0) (\ rm . 
                                                           is_RV64F () )
                                                         else sail2_state_monad$returnS F)
                                                         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9
                                                                             (( 31 : int):ii) (( 20 : int):ii)
                                                                            :  12 words$word)) = (0xC02w :  12 words$word)))) /\ (((((subrange_vec_dec v__9
                                                                             (( 6 : int):ii) (( 0 : int):ii)
                                                                            :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__73 :
                                                         bool) . 
                                                       if w__73 then
                                                         let (rs1 :  5 words$word) =
                                                           ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)
                                                             :  5 words$word)) in
                                                         let (rd :  5 words$word) =
                                                           ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                             :  5 words$word)) in
                                                         let (mappingpatterns_76_0 :  3 words$word) =
                                                           ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                             :  3 words$word)) in sail2_state_monad$bindS
                                                         (encdec_rounding_mode_backwards
                                                           mappingpatterns_76_0) (\ rm . 
                                                         sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1,
                                                                                 rm,
                                                                                 rd,
                                                                                 FCVT_L_S)))
                                                       else sail2_state_monad$bindS
                                                         (sail2_state$and_boolS
                                                           (let (mappingpatterns_77_0 :  3 words$word) =
                                                             ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                               :  3 words$word)) in
                                                           if ((encdec_rounding_mode_backwards_matches
                                                                  mappingpatterns_77_0)) then sail2_state_monad$bindS
                                                             (encdec_rounding_mode_backwards
                                                               mappingpatterns_77_0) (\ rm . 
                                                             is_RV64F () )
                                                           else sail2_state_monad$returnS F)
                                                           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9
                                                                               (( 31 : int):ii) (( 20 : int):ii)
                                                                              :  12 words$word)) = (0xC03w :  12 words$word)))) /\ (((((subrange_vec_dec v__9
                                                                               (( 6 : int):ii) (( 0 : int):ii)
                                                                              :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__76 :
                                                           bool) . 
                                                         if w__76 then
                                                           let (rs1 :  5 words$word) =
                                                             ((subrange_vec_dec v__9 (( 19 : int):ii) (( 15 : int):ii)
                                                               :  5 words$word)) in
                                                           let (rd :  5 words$word) =
                                                             ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                               :  5 words$word)) in
                                                           let (mappingpatterns_77_0 :  3 words$word) =
                                                             ((subrange_vec_dec v__9 (( 14 : int):ii) (( 12 : int):ii)
                                                               :  3 words$word)) in sail2_state_monad$bindS
                                                           (encdec_rounding_mode_backwards
                                                             mappingpatterns_77_0) (\ rm . 
                                                           sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1,
                                                                                   rm,
                                                                                   rd,
                                                                                   FCVT_LU_S)))
                                                         else sail2_state_monad$bindS
                                                           (sail2_state$and_boolS
                                                             (let (mappingpatterns_78_0 :  3 words$word) =
                                                               ((subrange_vec_dec v__9 (( 14 : int):ii)
                                                                  (( 12 : int):ii)
                                                                 :  3 words$word)) in
                                                             if ((encdec_rounding_mode_backwards_matches
                                                                    mappingpatterns_78_0)) then sail2_state_monad$bindS
                                                               (encdec_rounding_mode_backwards
                                                                 mappingpatterns_78_0) (\ rm . 
                                                               is_RV64F () )
                                                             else sail2_state_monad$returnS F)
                                                             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__9
                                                                                 (( 31 : int):ii) (( 20 : int):ii)
                                                                                :  12 words$word)) = (0xD02w :  12 words$word)))) /\ (((((subrange_vec_dec v__9
                                                                                 (( 6 : int):ii) (( 0 : int):ii)
                                                                                :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__79 :
                                                             bool) . 
                                                           if w__79 then
                                                             let (rs1 :  5 words$word) =
                                                               ((subrange_vec_dec v__9 (( 19 : int):ii)
                                                                  (( 15 : int):ii)
                                                                 :  5 words$word)) in
                                                             let (rd :  5 words$word) =
                                                               ((subrange_vec_dec v__9 (( 11 : int):ii) (( 7 : int):ii)
                                                                 :  5 words$word)) in
                                                             let (mappingpatterns_78_0 :  3 words$word) =
                                                               ((subrange_vec_dec v__9 (( 14 : int):ii)
                                                                  (( 12 : int):ii)
                                                                 :  3 words$word)) in sail2_state_monad$bindS
                                                             (encdec_rounding_mode_backwards
                                                               mappingpatterns_78_0) (\ rm . 
                                                             sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1,
                                                                                     rm,
                                                                                     rd,
                                                                                     FCVT_S_L)))
                                                           else sail2_state_monad$bindS
                                                             (sail2_state$and_boolS
                                                               (let (mappingpatterns_79_0 :
                                                                  3 words$word) =
                                                                 ((subrange_vec_dec v__9 (( 14 : int):ii)
                                                                    (( 12 : int):ii)
                                                                   :  3 words$word)) in
                                                               if ((encdec_rounding_mode_backwards_matches
                                                                      mappingpatterns_79_0)) then sail2_state_monad$bindS
                                                                 (encdec_rounding_mode_backwards
                                                                   mappingpatterns_79_0) (\ rm . 
                                                                 is_RV64F () )
                                                               else sail2_state_monad$returnS F)
                                                               (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                   v__9 (( 31 : int):ii)
                                                                                   (( 20 : int):ii)
                                                                                  :  12 words$word)) = (0xD03w :  12 words$word)))) /\ (((((subrange_vec_dec
                                                                                   v__9 (( 6 : int):ii)
                                                                                   (( 0 : int):ii)
                                                                                  :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__82 :
                                                               bool) . 
                                                             if w__82 then
                                                               let (rs1 :  5 words$word) =
                                                                 ((subrange_vec_dec v__9 (( 19 : int):ii)
                                                                    (( 15 : int):ii)
                                                                   :  5 words$word)) in
                                                               let (rd :  5 words$word) =
                                                                 ((subrange_vec_dec v__9 (( 11 : int):ii)
                                                                    (( 7 : int):ii)
                                                                   :  5 words$word)) in
                                                               let (mappingpatterns_79_0 :  3 words$word) =
                                                                 ((subrange_vec_dec v__9 (( 14 : int):ii)
                                                                    (( 12 : int):ii)
                                                                   :  3 words$word)) in sail2_state_monad$bindS
                                                               (encdec_rounding_mode_backwards
                                                                 mappingpatterns_79_0) (\ rm . 
                                                               sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1,
                                                                                       rm,
                                                                                       rd,
                                                                                       FCVT_S_LU)))
                                                             else sail2_state_monad$bindS
                                                               (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                                                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                     v__9 (( 31 : int):ii)
                                                                                     (( 25 : int):ii)
                                                                                    :  7 words$word)) = (0b0010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                         v__9
                                                                                         (( 14 : int):ii)
                                                                                         (( 12 : int):ii)
                                                                                        :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                         v__9 (( 6 : int):ii)
                                                                                         (( 0 : int):ii)
                                                                                        :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__84 :
                                                                 bool) . 
                                                               if w__84 then
                                                                 let (rs2 :  5 words$word) =
                                                                   ((subrange_vec_dec v__9 (( 24 : int):ii)
                                                                      (( 20 : int):ii)
                                                                     :  5 words$word)) in
                                                                 let (rs1 :  5 words$word) =
                                                                   ((subrange_vec_dec v__9 (( 19 : int):ii)
                                                                      (( 15 : int):ii)
                                                                     :  5 words$word)) in
                                                                 let (rd :  5 words$word) =
                                                                   ((subrange_vec_dec v__9 (( 11 : int):ii)
                                                                      (( 7 : int):ii)
                                                                     :  5 words$word)) in
                                                                 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                       rs1,
                                                                                       rd,
                                                                                       FSGNJ_S))
                                                               else sail2_state_monad$bindS
                                                                 (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                                                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                       v__9 (( 31 : int):ii)
                                                                                       (( 25 : int):ii)
                                                                                      :  7 words$word)) = (0b0010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                           v__9
                                                                                           (( 14 : int):ii)
                                                                                           (( 12 : int):ii)
                                                                                          :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                           v__9
                                                                                           (( 6 : int):ii)
                                                                                           (( 0 : int):ii)
                                                                                          :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__86 :
                                                                   bool) . 
                                                                 if w__86 then
                                                                   let (rs2 :  5 words$word) =
                                                                     ((subrange_vec_dec v__9 (( 24 : int):ii)
                                                                        (( 20 : int):ii)
                                                                       :  5 words$word)) in
                                                                   let (rs1 :  5 words$word) =
                                                                     ((subrange_vec_dec v__9 (( 19 : int):ii)
                                                                        (( 15 : int):ii)
                                                                       :  5 words$word)) in
                                                                   let (rd :  5 words$word) =
                                                                     ((subrange_vec_dec v__9 (( 11 : int):ii)
                                                                        (( 7 : int):ii)
                                                                       :  5 words$word)) in
                                                                   sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                         rs1,
                                                                                         rd,
                                                                                         FSGNJN_S))
                                                                 else sail2_state_monad$bindS
                                                                   (sail2_state$and_boolS
                                                                     ((is_RV32F_or_RV64F () ))
                                                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                         v__9
                                                                                         (( 31 : int):ii)
                                                                                         (( 25 : int):ii)
                                                                                        :  7 words$word)) = (0b0010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                             v__9
                                                                                             (( 14 : int):ii)
                                                                                             (( 12 : int):ii)
                                                                                            :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                             v__9
                                                                                             (( 6 : int):ii)
                                                                                             (( 0 : int):ii)
                                                                                            :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__88 :
                                                                     bool) . 
                                                                   if w__88 then
                                                                     let (rs2 :  5 words$word) =
                                                                       ((subrange_vec_dec v__9
                                                                          (( 24 : int):ii) (( 20 : int):ii)
                                                                         :  5 words$word)) in
                                                                     let (rs1 :  5 words$word) =
                                                                       ((subrange_vec_dec v__9
                                                                          (( 19 : int):ii) (( 15 : int):ii)
                                                                         :  5 words$word)) in
                                                                     let (rd :  5 words$word) =
                                                                       ((subrange_vec_dec v__9
                                                                          (( 11 : int):ii) (( 7 : int):ii)
                                                                         :  5 words$word)) in
                                                                     sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                           rs1,
                                                                                           rd,
                                                                                           FSGNJX_S))
                                                                   else sail2_state_monad$bindS
                                                                     (sail2_state$and_boolS
                                                                       ((is_RV32F_or_RV64F () ))
                                                                       (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                           v__9
                                                                                           (( 31 : int):ii)
                                                                                           (( 25 : int):ii)
                                                                                          :  7 words$word)) = (0b0010100w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                               v__9
                                                                                               (( 14 : int):ii)
                                                                                               (( 12 : int):ii)
                                                                                              :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                               v__9
                                                                                               (( 6 : int):ii)
                                                                                               (( 0 : int):ii)
                                                                                              :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__90 :
                                                                       bool) . 
                                                                     if w__90 then
                                                                       let (rs2 :  5 words$word) =
                                                                         ((subrange_vec_dec v__9
                                                                            (( 24 : int):ii) (( 20 : int):ii)
                                                                           :  5 words$word)) in
                                                                       let (rs1 :  5 words$word) =
                                                                         ((subrange_vec_dec v__9
                                                                            (( 19 : int):ii) (( 15 : int):ii)
                                                                           :  5 words$word)) in
                                                                       let (rd :  5 words$word) =
                                                                         ((subrange_vec_dec v__9
                                                                            (( 11 : int):ii) (( 7 : int):ii)
                                                                           :  5 words$word)) in
                                                                       sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                             rs1,
                                                                                             rd,
                                                                                             FMIN_S))
                                                                     else sail2_state_monad$bindS
                                                                       (sail2_state$and_boolS
                                                                         ((is_RV32F_or_RV64F () ))
                                                                         (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                             v__9
                                                                                             (( 31 : int):ii)
                                                                                             (( 25 : int):ii)
                                                                                            :  7 words$word)) = (0b0010100w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                 v__9
                                                                                                 (( 14 : int):ii)
                                                                                                 (( 12 : int):ii)
                                                                                                :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                 v__9
                                                                                                 (( 6 : int):ii)
                                                                                                 (( 0 : int):ii)
                                                                                                :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__92 :
                                                                         bool) . 
                                                                       if w__92 then
                                                                         let (rs2 :  5 words$word) =
                                                                           ((subrange_vec_dec v__9
                                                                              (( 24 : int):ii) (( 20 : int):ii)
                                                                             :  5 words$word)) in
                                                                         let (rs1 :  5 words$word) =
                                                                           ((subrange_vec_dec v__9
                                                                              (( 19 : int):ii) (( 15 : int):ii)
                                                                             :  5 words$word)) in
                                                                         let (rd :  5 words$word) =
                                                                           ((subrange_vec_dec v__9
                                                                              (( 11 : int):ii) (( 7 : int):ii)
                                                                             :  5 words$word)) in
                                                                         sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                               rs1,
                                                                                               rd,
                                                                                               FMAX_S))
                                                                       else sail2_state_monad$bindS
                                                                         (sail2_state$and_boolS
                                                                           ((is_RV32F_or_RV64F () ))
                                                                           (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                               v__9
                                                                                               (( 31 : int):ii)
                                                                                               (( 25 : int):ii)
                                                                                              :  7 words$word)) = (0b1010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                   v__9
                                                                                                   (( 14 : int):ii)
                                                                                                   (( 12 : int):ii)
                                                                                                  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                   v__9
                                                                                                   (( 6 : int):ii)
                                                                                                   (( 0 : int):ii)
                                                                                                  :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__94 :
                                                                           bool) . 
                                                                         if w__94 then
                                                                           let (rs2 :  5 words$word) =
                                                                             ((subrange_vec_dec v__9
                                                                                (( 24 : int):ii) (( 20 : int):ii)
                                                                               :  5 words$word)) in
                                                                           let (rs1 :  5 words$word) =
                                                                             ((subrange_vec_dec v__9
                                                                                (( 19 : int):ii) (( 15 : int):ii)
                                                                               :  5 words$word)) in
                                                                           let (rd :  5 words$word) =
                                                                             ((subrange_vec_dec v__9
                                                                                (( 11 : int):ii) (( 7 : int):ii)
                                                                               :  5 words$word)) in
                                                                           sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                                 rs1,
                                                                                                 rd,
                                                                                                 FEQ_S))
                                                                         else sail2_state_monad$bindS
                                                                           (sail2_state$and_boolS
                                                                             ((is_RV32F_or_RV64F () ))
                                                                             (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                 v__9
                                                                                                 (( 31 : int):ii)
                                                                                                 (( 25 : int):ii)
                                                                                                :  7 words$word)) = (0b1010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                     v__9
                                                                                                     (( 14 : int):ii)
                                                                                                     (( 12 : int):ii)
                                                                                                    :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                     v__9
                                                                                                     (( 6 : int):ii)
                                                                                                     (( 0 : int):ii)
                                                                                                    :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__96 :
                                                                             bool) . 
                                                                           if w__96 then
                                                                             let (rs2 :  5 words$word) =
                                                                               ((subrange_vec_dec
                                                                                  v__9 (( 24 : int):ii)
                                                                                  (( 20 : int):ii)
                                                                                 :  5 words$word)) in
                                                                             let (rs1 :  5 words$word) =
                                                                               ((subrange_vec_dec
                                                                                  v__9 (( 19 : int):ii)
                                                                                  (( 15 : int):ii)
                                                                                 :  5 words$word)) in
                                                                             let (rd :  5 words$word) =
                                                                               ((subrange_vec_dec
                                                                                  v__9 (( 11 : int):ii)
                                                                                  (( 7 : int):ii)
                                                                                 :  5 words$word)) in
                                                                             sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                                   rs1,
                                                                                                   rd,
                                                                                                   FLT_S))
                                                                           else sail2_state_monad$bindS
                                                                             (sail2_state$and_boolS
                                                                               ((is_RV32F_or_RV64F
                                                                                   () ))
                                                                               (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                   v__9
                                                                                                   (( 31 : int):ii)
                                                                                                   (( 25 : int):ii)
                                                                                                  :  7 words$word)) = (0b1010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                       v__9
                                                                                                       (( 14 : int):ii)
                                                                                                       (( 12 : int):ii)
                                                                                                      :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                       v__9
                                                                                                       (( 6 : int):ii)
                                                                                                       (( 0 : int):ii)
                                                                                                      :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__98 :
                                                                               bool) . 
                                                                             if w__98 then
                                                                               let (rs2 :  5 words$word) =
                                                                                 ((subrange_vec_dec
                                                                                    v__9 (( 24 : int):ii)
                                                                                    (( 20 : int):ii)
                                                                                   :  5 words$word)) in
                                                                               let (rs1 :  5 words$word) =
                                                                                 ((subrange_vec_dec
                                                                                    v__9 (( 19 : int):ii)
                                                                                    (( 15 : int):ii)
                                                                                   :  5 words$word)) in
                                                                               let (rd :  5 words$word) =
                                                                                 ((subrange_vec_dec
                                                                                    v__9 (( 11 : int):ii)
                                                                                    (( 7 : int):ii)
                                                                                   :  5 words$word)) in
                                                                               sail2_state_monad$returnS (F_BIN_TYPE_S (rs2,
                                                                                                     rs1,
                                                                                                     rd,
                                                                                                     FLE_S))
                                                                             else sail2_state_monad$bindS
                                                                               (sail2_state$and_boolS
                                                                                 ((haveFExt () ))
                                                                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                     v__9
                                                                                                     (( 31 : int):ii)
                                                                                                     (( 20 : int):ii)
                                                                                                    :  12 words$word)) = (0xE00w :  12 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                         v__9
                                                                                                         (( 14 : int):ii)
                                                                                                         (( 12 : int):ii)
                                                                                                        :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                         v__9
                                                                                                         (( 6 : int):ii)
                                                                                                         (( 0 : int):ii)
                                                                                                        :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__100 :
                                                                                 bool) . 
                                                                               if w__100 then
                                                                                 let (rs1 :
                                                                                    5 words$word) =
                                                                                   ((subrange_vec_dec
                                                                                      v__9 (( 19 : int):ii)
                                                                                      (( 15 : int):ii)
                                                                                     :  5 words$word)) in
                                                                                 let (rd :  5 words$word) =
                                                                                   ((subrange_vec_dec
                                                                                      v__9 (( 11 : int):ii)
                                                                                      (( 7 : int):ii)
                                                                                     :  5 words$word)) in
                                                                                 sail2_state_monad$returnS (F_UN_TYPE_S (rs1,
                                                                                                      rd,
                                                                                                      FCLASS_S))
                                                                               else sail2_state_monad$bindS
                                                                                 (sail2_state$and_boolS
                                                                                   ((haveFExt () ))
                                                                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                       v__9
                                                                                                       (( 31 : int):ii)
                                                                                                       (( 20 : int):ii)
                                                                                                      :  12 words$word)) = (0xE00w :  12 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                           v__9
                                                                                                           (( 14 : int):ii)
                                                                                                           (( 12 : int):ii)
                                                                                                          :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                           v__9
                                                                                                           (( 6 : int):ii)
                                                                                                           (( 0 : int):ii)
                                                                                                          :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__102 :
                                                                                   bool) . 
                                                                                 if w__102 then
                                                                                   let (rs1 :
                                                                                      5 words$word) =
                                                                                     ((subrange_vec_dec
                                                                                        v__9 (( 19 : int):ii)
                                                                                        (( 15 : int):ii)
                                                                                       :  5 words$word)) in
                                                                                   let (rd :
                                                                                      5 words$word) =
                                                                                     ((subrange_vec_dec
                                                                                        v__9 (( 11 : int):ii)
                                                                                        (( 7 : int):ii)
                                                                                       :  5 words$word)) in
                                                                                   sail2_state_monad$returnS (F_UN_TYPE_S (rs1,
                                                                                                        rd,
                                                                                                        FMV_X_W))
                                                                                 else sail2_state_monad$bindS
                                                                                   (sail2_state$and_boolS
                                                                                     ((haveFExt () ))
                                                                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                         v__9
                                                                                                         (( 31 : int):ii)
                                                                                                         (( 20 : int):ii)
                                                                                                        :  12 words$word)) = (0xF00w :  12 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                             v__9
                                                                                                             (( 14 : int):ii)
                                                                                                             (( 12 : int):ii)
                                                                                                            :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                             v__9
                                                                                                             (( 6 : int):ii)
                                                                                                             (( 0 : int):ii)
                                                                                                            :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__104 :
                                                                                     bool) . 
                                                                                   sail2_state_monad$returnS (if w__104
                                                                                           then
                                                                                             let (rs1 :
                                                                                                5 words$word) =
                                                                                               ((subrange_vec_dec
                                                                                                  v__9
                                                                                                  (( 19 : int):ii)
                                                                                                  (( 15 : int):ii)
                                                                                                 :  5 words$word)) in
                                                                                             let (rd :
                                                                                                5 words$word) =
                                                                                               ((subrange_vec_dec
                                                                                                  v__9
                                                                                                  (( 11 : int):ii)
                                                                                                  (( 7 : int):ii)
                                                                                                 :  5 words$word)) in
                                                                                             F_UN_TYPE_S (rs1,
                                                                                                          rd,
                                                                                                          FMV_W_X)
                                                                                           else
                                                                                             ILLEGAL v__9)))))))))))))))))))))))))))))))))))))))))))`;


val _ = Define `
 ((encdec_forwards_matches:ast ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    ((case arg_ of
     UTYPE ((imm, rd, op)) => sail2_state_monad$returnS T
   | RISCV_JAL ((v__347, rd)) =>
      sail2_state_monad$returnS (if (((((subrange_vec_dec v__347 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word))))
              then
                T
              else F)
   | RISCV_JALR ((imm, rs1, rd)) => sail2_state_monad$returnS T
   | BTYPE ((v__349, rs2, rs1, op)) =>
      sail2_state_monad$returnS (if (((((subrange_vec_dec v__349 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word))))
              then
                T
              else F)
   | ITYPE ((imm, rs1, rd, op)) => sail2_state_monad$returnS T
   | SHIFTIOP ((shamt, rs1, rd, RISCV_SLLI)) => sail2_state_monad$returnS T
   | SHIFTIOP ((shamt, rs1, rd, RISCV_SRLI)) => sail2_state_monad$returnS T
   | SHIFTIOP ((shamt, rs1, rd, RISCV_SRAI)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_ADD)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_SLT)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_SLTU)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_AND)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_OR)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_XOR)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_SLL)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_SRL)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_SUB)) => sail2_state_monad$returnS T
   | RTYPE ((rs2, rs1, rd, RISCV_SRA)) => sail2_state_monad$returnS T
   | LOAD ((imm, rs1, rd, is_unsigned, size1, F, F)) =>
      sail2_state_monad$returnS (if (((((((word_width_bytes size1)) < (( 4 : int):ii))) \/ (((((~ is_unsigned)) /\ ((((word_width_bytes size1)) <= (( 4 : int):ii)))))))))
              then
                T
              else F)
   | STORE ((v__351, rs2, rs1, size1, F, F)) =>
      sail2_state_monad$returnS (if ((((word_width_bytes size1)) <= (( 4 : int):ii))) then T else F)
   | ADDIW ((imm, rs1, rd)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | SHIFTW ((shamt, rs1, rd, RISCV_SLLI)) =>
      sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | SHIFTW ((shamt, rs1, rd, RISCV_SRLI)) =>
      sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | SHIFTW ((shamt, rs1, rd, RISCV_SRAI)) =>
      sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | RTYPEW ((rs2, rs1, rd, RISCV_ADDW)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | RTYPEW ((rs2, rs1, rd, RISCV_SUBW)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | RTYPEW ((rs2, rs1, rd, RISCV_SLLW)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | RTYPEW ((rs2, rs1, rd, RISCV_SRLW)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | RTYPEW ((rs2, rs1, rd, RISCV_SRAW)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | SHIFTIWOP ((shamt, rs1, rd, RISCV_SLLIW)) =>
      sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | SHIFTIWOP ((shamt, rs1, rd, RISCV_SRLIW)) =>
      sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | SHIFTIWOP ((shamt, rs1, rd, RISCV_SRAIW)) =>
      sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | FENCE ((pred, succ)) => sail2_state_monad$returnS T
   | FENCE_TSO ((pred, succ)) => sail2_state_monad$returnS T
   | FENCEI (() ) => sail2_state_monad$returnS T
   | ECALL (() ) => sail2_state_monad$returnS T
   | MRET (() ) => sail2_state_monad$returnS T
   | SRET (() ) => sail2_state_monad$returnS T
   | EBREAK (() ) => sail2_state_monad$returnS T
   | WFI (() ) => sail2_state_monad$returnS T
   | SFENCE_VMA ((rs1, rs2)) => sail2_state_monad$returnS T
   | LOADRES ((aq, rl, rs1, size1, rd)) => sail2_state_monad$returnS (if ((amo_width_valid size1)) then T else F)
   | STORECON ((aq, rl, rs2, rs1, size1, rd)) =>
      sail2_state_monad$returnS (if ((amo_width_valid size1)) then T else F)
   | AMO ((op, aq, rl, rs2, rs1, size1, rd)) =>
      sail2_state_monad$returnS (if ((amo_width_valid size1)) then T else F)
   | MUL ((rs2, rs1, rd, high, signed1, signed2)) => sail2_state_monad$returnS T
   | DIV0 ((rs2, rs1, rd, s)) => sail2_state_monad$returnS T
   | REM ((rs2, rs1, rd, s)) => sail2_state_monad$returnS T
   | MULW ((rs2, rs1, rd)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | DIVW ((rs2, rs1, rd, s)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | REMW ((rs2, rs1, rd, s)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | CSR ((csr, rs1, rd, is_imm, op)) => sail2_state_monad$returnS T
   | URET (() ) => sail2_state_monad$returnS T
   | FENCE_RESERVED ((fm, pred, succ, rs, rd)) =>
      sail2_state_monad$returnS (if (((((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word)))))))))) then
                T
              else F)
   | FENCEI_RESERVED ((imm, rs, rd)) =>
      sail2_state_monad$returnS (if ((((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg))))))))) then
                T
              else F)
   | LOAD_FP ((imm, rs1, rd, WORD)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__0 : bool) .  sail2_state_monad$returnS (if w__0 then T else F))
   | LOAD_FP ((imm, rs1, rd, DOUBLE)) => sail2_state_monad$bindS
      (is_RV32D_or_RV64D () ) (\ (w__1 : bool) .  sail2_state_monad$returnS (if w__1 then T else F))
   | STORE_FP ((v__352, rs2, rs1, WORD)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__2 : bool) .  sail2_state_monad$returnS (if w__2 then T else F))
   | STORE_FP ((v__353, rs2, rs1, DOUBLE)) => sail2_state_monad$bindS
      (is_RV32D_or_RV64D () ) (\ (w__3 : bool) .  sail2_state_monad$returnS (if w__3 then T else F))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FMADD_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__4 : bool) .  sail2_state_monad$returnS (if w__4 then T else F))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FMSUB_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__5 : bool) .  sail2_state_monad$returnS (if w__5 then T else F))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FNMSUB_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__6 : bool) .  sail2_state_monad$returnS (if w__6 then T else F))
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, FNMADD_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__7 : bool) .  sail2_state_monad$returnS (if w__7 then T else F))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FADD_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__8 : bool) .  sail2_state_monad$returnS (if w__8 then T else F))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FSUB_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__9 : bool) .  sail2_state_monad$returnS (if w__9 then T else F))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FMUL_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__10 : bool) .  sail2_state_monad$returnS (if w__10 then T else F))
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, FDIV_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__11 : bool) .  sail2_state_monad$returnS (if w__11 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FSQRT_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__12 : bool) .  sail2_state_monad$returnS (if w__12 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_W_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__13 : bool) .  sail2_state_monad$returnS (if w__13 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_WU_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__14 : bool) .  sail2_state_monad$returnS (if w__14 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_W)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__15 : bool) .  sail2_state_monad$returnS (if w__15 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_WU)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__16 : bool) .  sail2_state_monad$returnS (if w__16 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_L_S)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__17 : bool) .  sail2_state_monad$returnS (if w__17 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_LU_S)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__18 : bool) .  sail2_state_monad$returnS (if w__18 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_L)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__19 : bool) .  sail2_state_monad$returnS (if w__19 then T else F))
   | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_LU)) => sail2_state_monad$bindS
      (is_RV64F () ) (\ (w__20 : bool) .  sail2_state_monad$returnS (if w__20 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJ_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__21 : bool) .  sail2_state_monad$returnS (if w__21 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJN_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__22 : bool) .  sail2_state_monad$returnS (if w__22 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJX_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__23 : bool) .  sail2_state_monad$returnS (if w__23 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FMIN_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__24 : bool) .  sail2_state_monad$returnS (if w__24 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FMAX_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__25 : bool) .  sail2_state_monad$returnS (if w__25 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FEQ_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__26 : bool) .  sail2_state_monad$returnS (if w__26 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FLT_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__27 : bool) .  sail2_state_monad$returnS (if w__27 then T else F))
   | F_BIN_TYPE_S ((rs2, rs1, rd, FLE_S)) => sail2_state_monad$bindS
      (is_RV32F_or_RV64F () ) (\ (w__28 : bool) .  sail2_state_monad$returnS (if w__28 then T else F))
   | F_UN_TYPE_S ((rs1, rd, FCLASS_S)) => sail2_state_monad$bindS
      (haveFExt () ) (\ (w__29 : bool) .  sail2_state_monad$returnS (if w__29 then T else F))
   | F_UN_TYPE_S ((rs1, rd, FMV_X_W)) => sail2_state_monad$bindS
      (haveFExt () ) (\ (w__30 : bool) .  sail2_state_monad$returnS (if w__30 then T else F))
   | F_UN_TYPE_S ((rs1, rd, FMV_W_X)) => sail2_state_monad$bindS
      (haveFExt () ) (\ (w__31 : bool) .  sail2_state_monad$returnS (if w__31 then T else F))
   | ILLEGAL (s) => sail2_state_monad$returnS T
   | _ => sail2_state_monad$returnS F
   )))`;


val _ = Define `
 ((encdec_backwards_matches:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let v__354 = arg_ in
   if (let (mappingpatterns_0_0 :  7 words$word) = ((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) in
     encdec_uop_backwards_matches mappingpatterns_0_0) then
     let (mappingpatterns_0_0 :  7 words$word) = ((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) in sail2_state_monad$bindS
     (encdec_uop_backwards mappingpatterns_0_0) (\ op .  sail2_state_monad$returnS T)
   else if (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1101111w :  7 words$word))))
   then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1100111w :  7 words$word))))))) then
     sail2_state_monad$returnS T
   else if ((((let (mappingpatterns_1_0 :  3 words$word) =
                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
               encdec_bop_backwards_matches mappingpatterns_1_0) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1100011w :  7 words$word))))))) then
     let (mappingpatterns_1_0 :  3 words$word) = ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
     (encdec_bop_backwards mappingpatterns_1_0) (\ op .  sail2_state_monad$returnS T)
   else if ((((let (mappingpatterns_2_0 :  3 words$word) =
                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
               encdec_iop_backwards_matches mappingpatterns_2_0) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))) then
     let (mappingpatterns_2_0 :  3 words$word) = ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
     (encdec_iop_backwards mappingpatterns_2_0) (\ op .  sail2_state_monad$returnS T)
   else if ((((let (shamt :  6 words$word) = ((subrange_vec_dec v__354 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
               (((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((((access_vec_dec shamt (( 5 : int):ii))) = B0))))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 26 : int):ii)  :  6 words$word)) = (0b000000w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (shamt :  6 words$word) = ((subrange_vec_dec v__354 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
               (((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((((access_vec_dec shamt (( 5 : int):ii))) = B0))))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 26 : int):ii)  :  6 words$word)) = (0b000000w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (shamt :  6 words$word) = ((subrange_vec_dec v__354 (( 25 : int):ii) (( 20 : int):ii)  :  6 words$word)) in
               (((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((((access_vec_dec shamt (( 5 : int):ii))) = B0))))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 26 : int):ii)  :  6 words$word)) = (0b010000w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0010011w :  7 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else sail2_state_monad$bindS
     (sail2_state$and_boolS
       (let (mappingpatterns_4_0 :  2 words$word) =
         ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
       let (mappingpatterns_3_0 :  1 words$word) =
         ((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in
       if ((size_bits_backwards_matches mappingpatterns_4_0)) then sail2_state_monad$bindS
         (size_bits_backwards mappingpatterns_4_0) (\ size1 . 
         if ((bool_bits_backwards_matches mappingpatterns_3_0)) then sail2_state_monad$bindS
           (bool_bits_backwards mappingpatterns_3_0) (\ is_unsigned . 
           sail2_state_monad$returnS (((((((word_width_bytes size1)) < (( 4 : int):ii))) \/ (((((~ is_unsigned)) /\ ((((word_width_bytes size1)) <= (( 4 : int):ii))))))))))
         else sail2_state_monad$returnS F)
       else sail2_state_monad$returnS F)
       (sail2_state_monad$returnS (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000011w :  7 words$word)))))) (\ (w__2 : bool) . 
     if w__2 then
       let (mappingpatterns_4_0 :  2 words$word) =
         ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
       let (mappingpatterns_3_0 :  1 words$word) =
         ((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
       (size_bits_backwards mappingpatterns_4_0) (\ size1 .  sail2_state_monad$bindS
       (bool_bits_backwards mappingpatterns_3_0) (\ is_unsigned .  sail2_state_monad$returnS T))
     else sail2_state_monad$bindS
       (sail2_state$and_boolS
         (let (mappingpatterns_5_0 :  2 words$word) =
           ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
         if ((size_bits_backwards_matches mappingpatterns_5_0)) then sail2_state_monad$bindS
           (size_bits_backwards mappingpatterns_5_0) (\ size1 . 
           sail2_state_monad$returnS ((((word_width_bytes size1)) <= (( 4 : int):ii))))
         else sail2_state_monad$returnS F)
         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0100011w :  7 words$word))))))))) (\ (w__4 : bool) . 
       if w__4 then
         let (mappingpatterns_5_0 :  2 words$word) =
           ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in sail2_state_monad$bindS
         (size_bits_backwards mappingpatterns_5_0) (\ size1 .  sail2_state_monad$returnS T)
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word)))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0100000w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0011011w :  7 words$word))))))))))))) then
         sail2_state_monad$returnS T
       else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) = (0x0w :  4 words$word)))) /\ (((((subrange_vec_dec v__354 (( 19 : int):ii) (( 0 : int):ii)  :  20 words$word)) = (0x0000Fw :  20 words$word))))))) then
         sail2_state_monad$returnS T
       else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) = (0x8w :  4 words$word)))) /\ (((((subrange_vec_dec v__354 (( 19 : int):ii) (( 0 : int):ii)  :  20 words$word)) = (0x0000Fw :  20 words$word))))))) then
         sail2_state_monad$returnS T
       else if (((v__354 = (0x0000100Fw :  32 words$word)))) then sail2_state_monad$returnS T
       else if (((v__354 = (0x00000073w :  32 words$word)))) then sail2_state_monad$returnS T
       else if (((v__354 = (0x30200073w :  32 words$word)))) then sail2_state_monad$returnS T
       else if (((v__354 = (0x10200073w :  32 words$word)))) then sail2_state_monad$returnS T
       else if (((v__354 = (0x00100073w :  32 words$word)))) then sail2_state_monad$returnS T
       else if (((v__354 = (0x10500073w :  32 words$word)))) then sail2_state_monad$returnS T
       else if ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0001001w :  7 words$word)))) /\ (((((subrange_vec_dec v__354 (( 14 : int):ii) (( 0 : int):ii)  :  15 words$word)) = (0b000000001110011w :  15 words$word))))))) then
         sail2_state_monad$returnS T
       else sail2_state_monad$bindS
         (sail2_state$and_boolS
           (let (mappingpatterns_8_0 :  2 words$word) =
             ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
           let (mappingpatterns_7_0 :  1 words$word) =
             ((subrange_vec_dec v__354 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
           let (mappingpatterns_6_0 :  1 words$word) =
             ((subrange_vec_dec v__354 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
           if ((size_bits_backwards_matches mappingpatterns_8_0)) then sail2_state_monad$bindS
             (size_bits_backwards mappingpatterns_8_0) (\ size1 . 
             if ((bool_bits_backwards_matches mappingpatterns_7_0)) then sail2_state_monad$bindS
               (bool_bits_backwards mappingpatterns_7_0) (\ rl . 
               if ((bool_bits_backwards_matches mappingpatterns_6_0)) then sail2_state_monad$bindS
                 (bool_bits_backwards mappingpatterns_6_0) (\ aq . 
                 sail2_state_monad$returnS ((amo_width_valid size1)))
               else sail2_state_monad$returnS F)
             else sail2_state_monad$returnS F)
           else sail2_state_monad$returnS F)
           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) = (0b00010w :  5 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 24 : int):ii) (( 20 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0101111w :  7 words$word))))))))))))))) (\ (w__8 : bool) . 
         if w__8 then
           let (mappingpatterns_8_0 :  2 words$word) =
             ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
           let (mappingpatterns_7_0 :  1 words$word) =
             ((subrange_vec_dec v__354 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
           let (mappingpatterns_6_0 :  1 words$word) =
             ((subrange_vec_dec v__354 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
           (size_bits_backwards mappingpatterns_8_0) (\ size1 .  sail2_state_monad$bindS
           (bool_bits_backwards mappingpatterns_7_0) (\ rl .  sail2_state_monad$bindS
           (bool_bits_backwards mappingpatterns_6_0) (\ aq .  sail2_state_monad$returnS T)))
         else sail2_state_monad$bindS
           (sail2_state$and_boolS
             (let (mappingpatterns_9_0 :  1 words$word) =
               ((subrange_vec_dec v__354 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
             let (mappingpatterns_11_0 :  2 words$word) =
               ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
             let (mappingpatterns_10_0 :  1 words$word) =
               ((subrange_vec_dec v__354 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
             if ((size_bits_backwards_matches mappingpatterns_11_0)) then sail2_state_monad$bindS
               (size_bits_backwards mappingpatterns_11_0) (\ size1 . 
               if ((bool_bits_backwards_matches mappingpatterns_10_0)) then sail2_state_monad$bindS
                 (bool_bits_backwards mappingpatterns_10_0) (\ rl . 
                 if ((bool_bits_backwards_matches mappingpatterns_9_0)) then sail2_state_monad$bindS
                   (bool_bits_backwards mappingpatterns_9_0) (\ aq . 
                   sail2_state_monad$returnS ((amo_width_valid size1)))
                 else sail2_state_monad$returnS F)
               else sail2_state_monad$returnS F)
             else sail2_state_monad$returnS F)
             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) = (0b00011w :  5 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0101111w :  7 words$word)))))))))))) (\ (w__12 : bool) . 
           if w__12 then
             let (mappingpatterns_9_0 :  1 words$word) =
               ((subrange_vec_dec v__354 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
             let (mappingpatterns_11_0 :  2 words$word) =
               ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
             let (mappingpatterns_10_0 :  1 words$word) =
               ((subrange_vec_dec v__354 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
             (size_bits_backwards mappingpatterns_11_0) (\ size1 .  sail2_state_monad$bindS
             (bool_bits_backwards mappingpatterns_10_0) (\ rl .  sail2_state_monad$bindS
             (bool_bits_backwards mappingpatterns_9_0) (\ aq .  sail2_state_monad$returnS T)))
           else sail2_state_monad$bindS
             (sail2_state$and_boolS
               (let (mappingpatterns_12_0 :  5 words$word) =
                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_15_0 :  2 words$word) =
                 ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
               let (mappingpatterns_14_0 :  1 words$word) =
                 ((subrange_vec_dec v__354 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_13_0 :  1 words$word) =
                 ((subrange_vec_dec v__354 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_12_0 :  5 words$word) =
                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
               if ((size_bits_backwards_matches mappingpatterns_15_0)) then sail2_state_monad$bindS
                 (size_bits_backwards mappingpatterns_15_0) (\ size1 . 
                 if ((bool_bits_backwards_matches mappingpatterns_14_0)) then sail2_state_monad$bindS
                   (bool_bits_backwards mappingpatterns_14_0) (\ rl . 
                   if ((bool_bits_backwards_matches mappingpatterns_13_0)) then sail2_state_monad$bindS
                     (bool_bits_backwards mappingpatterns_13_0) (\ aq . 
                     if ((encdec_amoop_backwards_matches mappingpatterns_12_0)) then sail2_state_monad$bindS
                       (encdec_amoop_backwards mappingpatterns_12_0) (\ op . 
                       sail2_state_monad$returnS ((amo_width_valid size1)))
                     else sail2_state_monad$returnS F)
                   else sail2_state_monad$returnS F)
                 else sail2_state_monad$returnS F)
               else sail2_state_monad$returnS F)
               (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0101111w :  7 words$word))))))))) (\ (w__17 : bool) . 
             if w__17 then
               let (mappingpatterns_12_0 :  5 words$word) =
                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in
               let (mappingpatterns_15_0 :  2 words$word) =
                 ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
               let (mappingpatterns_14_0 :  1 words$word) =
                 ((subrange_vec_dec v__354 (( 25 : int):ii) (( 25 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_13_0 :  1 words$word) =
                 ((subrange_vec_dec v__354 (( 26 : int):ii) (( 26 : int):ii)  :  1 words$word)) in
               let (mappingpatterns_12_0 :  5 words$word) =
                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 27 : int):ii)  :  5 words$word)) in sail2_state_monad$bindS
               (size_bits_backwards mappingpatterns_15_0) (\ size1 .  sail2_state_monad$bindS
               (bool_bits_backwards mappingpatterns_14_0) (\ rl .  sail2_state_monad$bindS
               (bool_bits_backwards mappingpatterns_13_0) (\ aq .  sail2_state_monad$bindS
               (encdec_amoop_backwards mappingpatterns_12_0) (\ op .  sail2_state_monad$returnS T))))
             else if ((((let (mappingpatterns_16_0 :  3 words$word) =
                           ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                         encdec_mul_op_backwards_matches mappingpatterns_16_0) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word)))))))))) then
               let (mappingpatterns_16_0 :  3 words$word) =
                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
               (encdec_mul_op_backwards mappingpatterns_16_0) (\ varstup .  let (high, signed1, signed2) = varstup in
               sail2_state_monad$returnS T)
             else if ((((let (mappingpatterns_17_0 :  1 words$word) =
                           ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                         bool_not_bits_backwards_matches mappingpatterns_17_0) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word))))))))))))) then
               let (mappingpatterns_17_0 :  1 words$word) =
                 ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
               (bool_not_bits_backwards mappingpatterns_17_0) (\ s .  sail2_state_monad$returnS T)
             else if ((((let (mappingpatterns_18_0 :  1 words$word) =
                           ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                         bool_not_bits_backwards_matches mappingpatterns_18_0) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0110011w :  7 words$word))))))))))))) then
               let (mappingpatterns_18_0 :  1 words$word) =
                 ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
               (bool_not_bits_backwards mappingpatterns_18_0) (\ s .  sail2_state_monad$returnS T)
             else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word))))))))))))) then
               sail2_state_monad$returnS T
             else sail2_state_monad$bindS
               (sail2_state$and_boolS
                 (let (mappingpatterns_19_0 :  1 words$word) =
                   ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                 if ((bool_not_bits_backwards_matches mappingpatterns_19_0)) then sail2_state_monad$bindS
                   (bool_not_bits_backwards mappingpatterns_19_0) (\ s . 
                   sail2_state_monad$returnS ((((( 32 : int):ii) = (( 64 : int):ii)))))
                 else sail2_state_monad$returnS F)
                 (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word)))))))))))) (\ (w__19 : bool) . 
               if w__19 then
                 let (mappingpatterns_19_0 :  1 words$word) =
                   ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
                 (bool_not_bits_backwards mappingpatterns_19_0) (\ s .  sail2_state_monad$returnS T)
               else sail2_state_monad$bindS
                 (sail2_state$and_boolS
                   (let (mappingpatterns_20_0 :  1 words$word) =
                     ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
                   if ((bool_not_bits_backwards_matches mappingpatterns_20_0)) then sail2_state_monad$bindS
                     (bool_not_bits_backwards mappingpatterns_20_0) (\ s . 
                     sail2_state_monad$returnS ((((( 32 : int):ii) = (( 64 : int):ii)))))
                   else sail2_state_monad$returnS F)
                   (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 13 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0111011w :  7 words$word)))))))))))) (\ (w__21 : bool) . 
                 if w__21 then
                   let (mappingpatterns_20_0 :  1 words$word) =
                     ((subrange_vec_dec v__354 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
                   (bool_not_bits_backwards mappingpatterns_20_0) (\ s .  sail2_state_monad$returnS T)
                 else sail2_state_monad$bindS
                   (sail2_state$and_boolS
                     (let (mappingpatterns_22_0 :  2 words$word) =
                       ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
                     let (mappingpatterns_21_0 :  1 words$word) =
                       ((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in
                     if ((encdec_csrop_backwards_matches mappingpatterns_22_0)) then sail2_state_monad$bindS
                       (encdec_csrop_backwards mappingpatterns_22_0) (\ op . 
                       sail2_state_monad$returnS ((bool_bits_backwards_matches mappingpatterns_21_0)))
                     else sail2_state_monad$returnS F)
                     (sail2_state_monad$returnS (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1110011w :  7 words$word)))))) (\ (w__23 : bool) . 
                   if w__23 then
                     let (mappingpatterns_22_0 :  2 words$word) =
                       ((subrange_vec_dec v__354 (( 13 : int):ii) (( 12 : int):ii)  :  2 words$word)) in
                     let (mappingpatterns_21_0 :  1 words$word) =
                       ((subrange_vec_dec v__354 (( 14 : int):ii) (( 14 : int):ii)  :  1 words$word)) in sail2_state_monad$bindS
                     (encdec_csrop_backwards mappingpatterns_22_0) (\ op .  sail2_state_monad$bindS
                     (bool_bits_backwards mappingpatterns_21_0) (\ is_imm .  sail2_state_monad$returnS T))
                   else if (((v__354 = (0x00200073w :  32 words$word)))) then sail2_state_monad$returnS T
                   else if ((((let (fm : 4 bits) =
                                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) in
                               let (rs : regidx) =
                                 ((subrange_vec_dec v__354 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                               let (rd : regidx) =
                                 ((subrange_vec_dec v__354 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                               let (fm : 4 bits) =
                                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 28 : int):ii)  :  4 words$word)) in
                               (((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word))))))))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0001111w :  7 words$word)))))))))) then
                     sail2_state_monad$returnS T
                   else if ((((let (imm : 12 bits) =
                                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                               let (rs : regidx) =
                                 ((subrange_vec_dec v__354 (( 19 : int):ii) (( 15 : int):ii)  :  5 words$word)) in
                               let (rd : regidx) =
                                 ((subrange_vec_dec v__354 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
                               let (imm : 12 bits) =
                                 ((subrange_vec_dec v__354 (( 31 : int):ii) (( 20 : int):ii)  :  12 words$word)) in
                               ((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg)))))))) /\ ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0001111w :  7 words$word)))))))))) then
                     sail2_state_monad$returnS T
                   else sail2_state_monad$bindS
                     (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000111w :  7 words$word))))))))) (\ (w__25 : bool) . 
                     if w__25 then sail2_state_monad$returnS T
                     else sail2_state_monad$bindS
                       (sail2_state$and_boolS ((is_RV32D_or_RV64D () ))
                         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000111w :  7 words$word))))))))) (\ (w__27 : bool) . 
                       if w__27 then sail2_state_monad$returnS T
                       else sail2_state_monad$bindS
                         (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0100111w :  7 words$word))))))))) (\ (w__29 : bool) . 
                         if w__29 then sail2_state_monad$returnS T
                         else sail2_state_monad$bindS
                           (sail2_state$and_boolS ((is_RV32D_or_RV64D () ))
                             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0100111w :  7 words$word))))))))) (\ (w__31 : bool) . 
                           if w__31 then sail2_state_monad$returnS T
                           else sail2_state_monad$bindS
                             (sail2_state$and_boolS
                               (let (mappingpatterns_23_0 :  3 words$word) =
                                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                               if ((encdec_rounding_mode_backwards_matches mappingpatterns_23_0))
                               then sail2_state_monad$bindS
                                 (encdec_rounding_mode_backwards mappingpatterns_23_0) (\ rm . 
                                 is_RV32F_or_RV64F () )
                               else sail2_state_monad$returnS F)
                               (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 26 : int):ii) (( 25 : int):ii)
                                                  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b1000011w :  7 words$word))))))))) (\ (w__34 : bool) . 
                             if w__34 then
                               let (mappingpatterns_23_0 :  3 words$word) =
                                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                               (encdec_rounding_mode_backwards mappingpatterns_23_0) (\ rm . 
                               sail2_state_monad$returnS T)
                             else sail2_state_monad$bindS
                               (sail2_state$and_boolS
                                 (let (mappingpatterns_24_0 :  3 words$word) =
                                   ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                 if ((encdec_rounding_mode_backwards_matches mappingpatterns_24_0))
                                 then sail2_state_monad$bindS
                                   (encdec_rounding_mode_backwards mappingpatterns_24_0) (\ rm . 
                                   is_RV32F_or_RV64F () )
                                 else sail2_state_monad$returnS F)
                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 26 : int):ii) (( 25 : int):ii)
                                                    :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                    :  7 words$word)) = (0b1000111w :  7 words$word))))))))) (\ (w__37 :
                                 bool) . 
                               if w__37 then
                                 let (mappingpatterns_24_0 :  3 words$word) =
                                   ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                 (encdec_rounding_mode_backwards mappingpatterns_24_0) (\ rm . 
                                 sail2_state_monad$returnS T)
                               else sail2_state_monad$bindS
                                 (sail2_state$and_boolS
                                   (let (mappingpatterns_25_0 :  3 words$word) =
                                     ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                   if ((encdec_rounding_mode_backwards_matches mappingpatterns_25_0))
                                   then sail2_state_monad$bindS
                                     (encdec_rounding_mode_backwards mappingpatterns_25_0) (\ rm . 
                                     is_RV32F_or_RV64F () )
                                   else sail2_state_monad$returnS F)
                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 26 : int):ii) (( 25 : int):ii)
                                                      :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                      :  7 words$word)) = (0b1001011w :  7 words$word))))))))) (\ (w__40 :
                                   bool) . 
                                 if w__40 then
                                   let (mappingpatterns_25_0 :  3 words$word) =
                                     ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                   (encdec_rounding_mode_backwards mappingpatterns_25_0) (\ rm . 
                                   sail2_state_monad$returnS T)
                                 else sail2_state_monad$bindS
                                   (sail2_state$and_boolS
                                     (let (mappingpatterns_26_0 :  3 words$word) =
                                       ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                     if ((encdec_rounding_mode_backwards_matches
                                            mappingpatterns_26_0)) then sail2_state_monad$bindS
                                       (encdec_rounding_mode_backwards mappingpatterns_26_0) (\ rm . 
                                       is_RV32F_or_RV64F () )
                                     else sail2_state_monad$returnS F)
                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 26 : int):ii) (( 25 : int):ii)
                                                        :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                        :  7 words$word)) = (0b1001111w :  7 words$word))))))))) (\ (w__43 :
                                     bool) . 
                                   if w__43 then
                                     let (mappingpatterns_26_0 :  3 words$word) =
                                       ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                     (encdec_rounding_mode_backwards mappingpatterns_26_0) (\ rm . 
                                     sail2_state_monad$returnS T)
                                   else sail2_state_monad$bindS
                                     (sail2_state$and_boolS
                                       (let (mappingpatterns_27_0 :  3 words$word) =
                                         ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                       if ((encdec_rounding_mode_backwards_matches
                                              mappingpatterns_27_0)) then sail2_state_monad$bindS
                                         (encdec_rounding_mode_backwards mappingpatterns_27_0) (\ rm . 
                                         is_RV32F_or_RV64F () )
                                       else sail2_state_monad$returnS F)
                                       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)
                                                          :  7 words$word)) = (0b0000000w :  7 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                          :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__46 :
                                       bool) . 
                                     if w__46 then
                                       let (mappingpatterns_27_0 :  3 words$word) =
                                         ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                       (encdec_rounding_mode_backwards mappingpatterns_27_0) (\ rm . 
                                       sail2_state_monad$returnS T)
                                     else sail2_state_monad$bindS
                                       (sail2_state$and_boolS
                                         (let (mappingpatterns_28_0 :  3 words$word) =
                                           ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                         if ((encdec_rounding_mode_backwards_matches
                                                mappingpatterns_28_0)) then sail2_state_monad$bindS
                                           (encdec_rounding_mode_backwards mappingpatterns_28_0) (\ rm . 
                                           is_RV32F_or_RV64F () )
                                         else sail2_state_monad$returnS F)
                                         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)
                                                            :  7 words$word)) = (0b0000100w :  7 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                            :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__49 :
                                         bool) . 
                                       if w__49 then
                                         let (mappingpatterns_28_0 :  3 words$word) =
                                           ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                         (encdec_rounding_mode_backwards mappingpatterns_28_0) (\ rm . 
                                         sail2_state_monad$returnS T)
                                       else sail2_state_monad$bindS
                                         (sail2_state$and_boolS
                                           (let (mappingpatterns_29_0 :  3 words$word) =
                                             ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                           if ((encdec_rounding_mode_backwards_matches
                                                  mappingpatterns_29_0)) then sail2_state_monad$bindS
                                             (encdec_rounding_mode_backwards mappingpatterns_29_0) (\ rm . 
                                             is_RV32F_or_RV64F () )
                                           else sail2_state_monad$returnS F)
                                           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii) (( 25 : int):ii)
                                                              :  7 words$word)) = (0b0001000w :  7 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                              :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__52 :
                                           bool) . 
                                         if w__52 then
                                           let (mappingpatterns_29_0 :  3 words$word) =
                                             ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                           (encdec_rounding_mode_backwards mappingpatterns_29_0) (\ rm . 
                                           sail2_state_monad$returnS T)
                                         else sail2_state_monad$bindS
                                           (sail2_state$and_boolS
                                             (let (mappingpatterns_30_0 :  3 words$word) =
                                               ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in
                                             if ((encdec_rounding_mode_backwards_matches
                                                    mappingpatterns_30_0)) then sail2_state_monad$bindS
                                               (encdec_rounding_mode_backwards mappingpatterns_30_0) (\ rm . 
                                               is_RV32F_or_RV64F () )
                                             else sail2_state_monad$returnS F)
                                             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii)
                                                                 (( 25 : int):ii)
                                                                :  7 words$word)) = (0b0001100w :  7 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii) (( 0 : int):ii)
                                                                :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__55 :
                                             bool) . 
                                           if w__55 then
                                             let (mappingpatterns_30_0 :  3 words$word) =
                                               ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)  :  3 words$word)) in sail2_state_monad$bindS
                                             (encdec_rounding_mode_backwards mappingpatterns_30_0) (\ rm . 
                                             sail2_state_monad$returnS T)
                                           else sail2_state_monad$bindS
                                             (sail2_state$and_boolS
                                               (let (mappingpatterns_31_0 :  3 words$word) =
                                                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                   :  3 words$word)) in
                                               if ((encdec_rounding_mode_backwards_matches
                                                      mappingpatterns_31_0)) then sail2_state_monad$bindS
                                                 (encdec_rounding_mode_backwards mappingpatterns_31_0) (\ rm . 
                                                 is_RV32F_or_RV64F () )
                                               else sail2_state_monad$returnS F)
                                               (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii)
                                                                   (( 20 : int):ii)
                                                                  :  12 words$word)) = (0x580w :  12 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii)
                                                                   (( 0 : int):ii)
                                                                  :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__58 :
                                               bool) . 
                                             if w__58 then
                                               let (mappingpatterns_31_0 :  3 words$word) =
                                                 ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                   :  3 words$word)) in sail2_state_monad$bindS
                                               (encdec_rounding_mode_backwards mappingpatterns_31_0) (\ rm . 
                                               sail2_state_monad$returnS T)
                                             else sail2_state_monad$bindS
                                               (sail2_state$and_boolS
                                                 (let (mappingpatterns_32_0 :  3 words$word) =
                                                   ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                     :  3 words$word)) in
                                                 if ((encdec_rounding_mode_backwards_matches
                                                        mappingpatterns_32_0)) then sail2_state_monad$bindS
                                                   (encdec_rounding_mode_backwards
                                                     mappingpatterns_32_0) (\ rm . 
                                                   is_RV32F_or_RV64F () )
                                                 else sail2_state_monad$returnS F)
                                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii)
                                                                     (( 20 : int):ii)
                                                                    :  12 words$word)) = (0xC00w :  12 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii)
                                                                     (( 0 : int):ii)
                                                                    :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__61 :
                                                 bool) . 
                                               if w__61 then
                                                 let (mappingpatterns_32_0 :  3 words$word) =
                                                   ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                     :  3 words$word)) in sail2_state_monad$bindS
                                                 (encdec_rounding_mode_backwards mappingpatterns_32_0) (\ rm . 
                                                 sail2_state_monad$returnS T)
                                               else sail2_state_monad$bindS
                                                 (sail2_state$and_boolS
                                                   (let (mappingpatterns_33_0 :  3 words$word) =
                                                     ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                       :  3 words$word)) in
                                                   if ((encdec_rounding_mode_backwards_matches
                                                          mappingpatterns_33_0)) then sail2_state_monad$bindS
                                                     (encdec_rounding_mode_backwards
                                                       mappingpatterns_33_0) (\ rm . 
                                                     is_RV32F_or_RV64F () )
                                                   else sail2_state_monad$returnS F)
                                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354 (( 31 : int):ii)
                                                                       (( 20 : int):ii)
                                                                      :  12 words$word)) = (0xC01w :  12 words$word)))) /\ (((((subrange_vec_dec v__354 (( 6 : int):ii)
                                                                       (( 0 : int):ii)
                                                                      :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__64 :
                                                   bool) . 
                                                 if w__64 then
                                                   let (mappingpatterns_33_0 :  3 words$word) =
                                                     ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                       :  3 words$word)) in sail2_state_monad$bindS
                                                   (encdec_rounding_mode_backwards
                                                     mappingpatterns_33_0) (\ rm . 
                                                   sail2_state_monad$returnS T)
                                                 else sail2_state_monad$bindS
                                                   (sail2_state$and_boolS
                                                     (let (mappingpatterns_34_0 :  3 words$word) =
                                                       ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                         :  3 words$word)) in
                                                     if ((encdec_rounding_mode_backwards_matches
                                                            mappingpatterns_34_0)) then sail2_state_monad$bindS
                                                       (encdec_rounding_mode_backwards
                                                         mappingpatterns_34_0) (\ rm . 
                                                       is_RV32F_or_RV64F () )
                                                     else sail2_state_monad$returnS F)
                                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354
                                                                         (( 31 : int):ii) (( 20 : int):ii)
                                                                        :  12 words$word)) = (0xD00w :  12 words$word)))) /\ (((((subrange_vec_dec v__354
                                                                         (( 6 : int):ii) (( 0 : int):ii)
                                                                        :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__67 :
                                                     bool) . 
                                                   if w__67 then
                                                     let (mappingpatterns_34_0 :  3 words$word) =
                                                       ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                         :  3 words$word)) in sail2_state_monad$bindS
                                                     (encdec_rounding_mode_backwards
                                                       mappingpatterns_34_0) (\ rm . 
                                                     sail2_state_monad$returnS T)
                                                   else sail2_state_monad$bindS
                                                     (sail2_state$and_boolS
                                                       (let (mappingpatterns_35_0 :  3 words$word) =
                                                         ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                           :  3 words$word)) in
                                                       if ((encdec_rounding_mode_backwards_matches
                                                              mappingpatterns_35_0)) then sail2_state_monad$bindS
                                                         (encdec_rounding_mode_backwards
                                                           mappingpatterns_35_0) (\ rm . 
                                                         is_RV32F_or_RV64F () )
                                                       else sail2_state_monad$returnS F)
                                                       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354
                                                                           (( 31 : int):ii) (( 20 : int):ii)
                                                                          :  12 words$word)) = (0xD01w :  12 words$word)))) /\ (((((subrange_vec_dec v__354
                                                                           (( 6 : int):ii) (( 0 : int):ii)
                                                                          :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__70 :
                                                       bool) . 
                                                     if w__70 then
                                                       let (mappingpatterns_35_0 :  3 words$word) =
                                                         ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                           :  3 words$word)) in sail2_state_monad$bindS
                                                       (encdec_rounding_mode_backwards
                                                         mappingpatterns_35_0) (\ rm . 
                                                       sail2_state_monad$returnS T)
                                                     else sail2_state_monad$bindS
                                                       (sail2_state$and_boolS
                                                         (let (mappingpatterns_36_0 :  3 words$word) =
                                                           ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                             :  3 words$word)) in
                                                         if ((encdec_rounding_mode_backwards_matches
                                                                mappingpatterns_36_0)) then sail2_state_monad$bindS
                                                           (encdec_rounding_mode_backwards
                                                             mappingpatterns_36_0) (\ rm . 
                                                           is_RV64F () )
                                                         else sail2_state_monad$returnS F)
                                                         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354
                                                                             (( 31 : int):ii) (( 20 : int):ii)
                                                                            :  12 words$word)) = (0xC02w :  12 words$word)))) /\ (((((subrange_vec_dec v__354
                                                                             (( 6 : int):ii) (( 0 : int):ii)
                                                                            :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__73 :
                                                         bool) . 
                                                       if w__73 then
                                                         let (mappingpatterns_36_0 :  3 words$word) =
                                                           ((subrange_vec_dec v__354 (( 14 : int):ii) (( 12 : int):ii)
                                                             :  3 words$word)) in sail2_state_monad$bindS
                                                         (encdec_rounding_mode_backwards
                                                           mappingpatterns_36_0) (\ rm . 
                                                         sail2_state_monad$returnS T)
                                                       else sail2_state_monad$bindS
                                                         (sail2_state$and_boolS
                                                           (let (mappingpatterns_37_0 :  3 words$word) =
                                                             ((subrange_vec_dec v__354 (( 14 : int):ii)
                                                                (( 12 : int):ii)
                                                               :  3 words$word)) in
                                                           if ((encdec_rounding_mode_backwards_matches
                                                                  mappingpatterns_37_0)) then sail2_state_monad$bindS
                                                             (encdec_rounding_mode_backwards
                                                               mappingpatterns_37_0) (\ rm . 
                                                             is_RV64F () )
                                                           else sail2_state_monad$returnS F)
                                                           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__354
                                                                               (( 31 : int):ii) (( 20 : int):ii)
                                                                              :  12 words$word)) = (0xC03w :  12 words$word)))) /\ (((((subrange_vec_dec v__354
                                                                               (( 6 : int):ii) (( 0 : int):ii)
                                                                              :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__76 :
                                                           bool) . 
                                                         if w__76 then
                                                           let (mappingpatterns_37_0 :  3 words$word) =
                                                             ((subrange_vec_dec v__354 (( 14 : int):ii)
                                                                (( 12 : int):ii)
                                                               :  3 words$word)) in sail2_state_monad$bindS
                                                           (encdec_rounding_mode_backwards
                                                             mappingpatterns_37_0) (\ rm . 
                                                           sail2_state_monad$returnS T)
                                                         else sail2_state_monad$bindS
                                                           (sail2_state$and_boolS
                                                             (let (mappingpatterns_38_0 :  3 words$word) =
                                                               ((subrange_vec_dec v__354 (( 14 : int):ii)
                                                                  (( 12 : int):ii)
                                                                 :  3 words$word)) in
                                                             if ((encdec_rounding_mode_backwards_matches
                                                                    mappingpatterns_38_0)) then sail2_state_monad$bindS
                                                               (encdec_rounding_mode_backwards
                                                                 mappingpatterns_38_0) (\ rm . 
                                                               is_RV64F () )
                                                             else sail2_state_monad$returnS F)
                                                             (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                 v__354 (( 31 : int):ii)
                                                                                 (( 20 : int):ii)
                                                                                :  12 words$word)) = (0xD02w :  12 words$word)))) /\ (((((subrange_vec_dec
                                                                                 v__354 (( 6 : int):ii)
                                                                                 (( 0 : int):ii)
                                                                                :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__79 :
                                                             bool) . 
                                                           if w__79 then
                                                             let (mappingpatterns_38_0 :  3 words$word) =
                                                               ((subrange_vec_dec v__354 (( 14 : int):ii)
                                                                  (( 12 : int):ii)
                                                                 :  3 words$word)) in sail2_state_monad$bindS
                                                             (encdec_rounding_mode_backwards
                                                               mappingpatterns_38_0) (\ rm . 
                                                             sail2_state_monad$returnS T)
                                                           else sail2_state_monad$bindS
                                                             (sail2_state$and_boolS
                                                               (let (mappingpatterns_39_0 :
                                                                  3 words$word) =
                                                                 ((subrange_vec_dec v__354 (( 14 : int):ii)
                                                                    (( 12 : int):ii)
                                                                   :  3 words$word)) in
                                                               if ((encdec_rounding_mode_backwards_matches
                                                                      mappingpatterns_39_0)) then sail2_state_monad$bindS
                                                                 (encdec_rounding_mode_backwards
                                                                   mappingpatterns_39_0) (\ rm . 
                                                                 is_RV64F () )
                                                               else sail2_state_monad$returnS F)
                                                               (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                   v__354 (( 31 : int):ii)
                                                                                   (( 20 : int):ii)
                                                                                  :  12 words$word)) = (0xD03w :  12 words$word)))) /\ (((((subrange_vec_dec
                                                                                   v__354 (( 6 : int):ii)
                                                                                   (( 0 : int):ii)
                                                                                  :  7 words$word)) = (0b1010011w :  7 words$word))))))))) (\ (w__82 :
                                                               bool) . 
                                                             if w__82 then
                                                               let (mappingpatterns_39_0 :  3 words$word) =
                                                                 ((subrange_vec_dec v__354 (( 14 : int):ii)
                                                                    (( 12 : int):ii)
                                                                   :  3 words$word)) in sail2_state_monad$bindS
                                                               (encdec_rounding_mode_backwards
                                                                 mappingpatterns_39_0) (\ rm . 
                                                               sail2_state_monad$returnS T)
                                                             else sail2_state_monad$bindS
                                                               (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                                                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                     v__354 (( 31 : int):ii)
                                                                                     (( 25 : int):ii)
                                                                                    :  7 words$word)) = (0b0010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                         v__354
                                                                                         (( 14 : int):ii)
                                                                                         (( 12 : int):ii)
                                                                                        :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                         v__354
                                                                                         (( 6 : int):ii)
                                                                                         (( 0 : int):ii)
                                                                                        :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__84 :
                                                                 bool) . 
                                                               if w__84 then sail2_state_monad$returnS T
                                                               else sail2_state_monad$bindS
                                                                 (sail2_state$and_boolS ((is_RV32F_or_RV64F () ))
                                                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                       v__354
                                                                                       (( 31 : int):ii)
                                                                                       (( 25 : int):ii)
                                                                                      :  7 words$word)) = (0b0010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                           v__354
                                                                                           (( 14 : int):ii)
                                                                                           (( 12 : int):ii)
                                                                                          :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                           v__354
                                                                                           (( 6 : int):ii)
                                                                                           (( 0 : int):ii)
                                                                                          :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__86 :
                                                                   bool) . 
                                                                 if w__86 then sail2_state_monad$returnS T
                                                                 else sail2_state_monad$bindS
                                                                   (sail2_state$and_boolS
                                                                     ((is_RV32F_or_RV64F () ))
                                                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                         v__354
                                                                                         (( 31 : int):ii)
                                                                                         (( 25 : int):ii)
                                                                                        :  7 words$word)) = (0b0010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                             v__354
                                                                                             (( 14 : int):ii)
                                                                                             (( 12 : int):ii)
                                                                                            :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                             v__354
                                                                                             (( 6 : int):ii)
                                                                                             (( 0 : int):ii)
                                                                                            :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__88 :
                                                                     bool) . 
                                                                   if w__88 then sail2_state_monad$returnS T
                                                                   else sail2_state_monad$bindS
                                                                     (sail2_state$and_boolS
                                                                       ((is_RV32F_or_RV64F () ))
                                                                       (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                           v__354
                                                                                           (( 31 : int):ii)
                                                                                           (( 25 : int):ii)
                                                                                          :  7 words$word)) = (0b0010100w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                               v__354
                                                                                               (( 14 : int):ii)
                                                                                               (( 12 : int):ii)
                                                                                              :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                               v__354
                                                                                               (( 6 : int):ii)
                                                                                               (( 0 : int):ii)
                                                                                              :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__90 :
                                                                       bool) . 
                                                                     if w__90 then sail2_state_monad$returnS T
                                                                     else sail2_state_monad$bindS
                                                                       (sail2_state$and_boolS
                                                                         ((is_RV32F_or_RV64F () ))
                                                                         (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                             v__354
                                                                                             (( 31 : int):ii)
                                                                                             (( 25 : int):ii)
                                                                                            :  7 words$word)) = (0b0010100w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                 v__354
                                                                                                 (( 14 : int):ii)
                                                                                                 (( 12 : int):ii)
                                                                                                :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                 v__354
                                                                                                 (( 6 : int):ii)
                                                                                                 (( 0 : int):ii)
                                                                                                :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__92 :
                                                                         bool) . 
                                                                       if w__92 then sail2_state_monad$returnS T
                                                                       else sail2_state_monad$bindS
                                                                         (sail2_state$and_boolS
                                                                           ((is_RV32F_or_RV64F () ))
                                                                           (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                               v__354
                                                                                               (( 31 : int):ii)
                                                                                               (( 25 : int):ii)
                                                                                              :  7 words$word)) = (0b1010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                   v__354
                                                                                                   (( 14 : int):ii)
                                                                                                   (( 12 : int):ii)
                                                                                                  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                   v__354
                                                                                                   (( 6 : int):ii)
                                                                                                   (( 0 : int):ii)
                                                                                                  :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__94 :
                                                                           bool) . 
                                                                         if w__94 then sail2_state_monad$returnS T
                                                                         else sail2_state_monad$bindS
                                                                           (sail2_state$and_boolS
                                                                             ((is_RV32F_or_RV64F () ))
                                                                             (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                 v__354
                                                                                                 (( 31 : int):ii)
                                                                                                 (( 25 : int):ii)
                                                                                                :  7 words$word)) = (0b1010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                     v__354
                                                                                                     (( 14 : int):ii)
                                                                                                     (( 12 : int):ii)
                                                                                                    :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                     v__354
                                                                                                     (( 6 : int):ii)
                                                                                                     (( 0 : int):ii)
                                                                                                    :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__96 :
                                                                             bool) . 
                                                                           if w__96 then sail2_state_monad$returnS T
                                                                           else sail2_state_monad$bindS
                                                                             (sail2_state$and_boolS
                                                                               ((is_RV32F_or_RV64F
                                                                                   () ))
                                                                               (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                   v__354
                                                                                                   (( 31 : int):ii)
                                                                                                   (( 25 : int):ii)
                                                                                                  :  7 words$word)) = (0b1010000w :  7 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                       v__354
                                                                                                       (( 14 : int):ii)
                                                                                                       (( 12 : int):ii)
                                                                                                      :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                       v__354
                                                                                                       (( 6 : int):ii)
                                                                                                       (( 0 : int):ii)
                                                                                                      :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__98 :
                                                                               bool) . 
                                                                             if w__98 then
                                                                               sail2_state_monad$returnS T
                                                                             else sail2_state_monad$bindS
                                                                               (sail2_state$and_boolS
                                                                                 ((haveFExt () ))
                                                                                 (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                     v__354
                                                                                                     (( 31 : int):ii)
                                                                                                     (( 20 : int):ii)
                                                                                                    :  12 words$word)) = (0xE00w :  12 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                         v__354
                                                                                                         (( 14 : int):ii)
                                                                                                         (( 12 : int):ii)
                                                                                                        :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                         v__354
                                                                                                         (( 6 : int):ii)
                                                                                                         (( 0 : int):ii)
                                                                                                        :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__100 :
                                                                                 bool) . 
                                                                               if w__100 then
                                                                                 sail2_state_monad$returnS T
                                                                               else sail2_state_monad$bindS
                                                                                 (sail2_state$and_boolS
                                                                                   ((haveFExt () ))
                                                                                   (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                       v__354
                                                                                                       (( 31 : int):ii)
                                                                                                       (( 20 : int):ii)
                                                                                                      :  12 words$word)) = (0xE00w :  12 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                           v__354
                                                                                                           (( 14 : int):ii)
                                                                                                           (( 12 : int):ii)
                                                                                                          :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                           v__354
                                                                                                           (( 6 : int):ii)
                                                                                                           (( 0 : int):ii)
                                                                                                          :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__102 :
                                                                                   bool) . 
                                                                                 if w__102 then
                                                                                   sail2_state_monad$returnS T
                                                                                 else sail2_state_monad$bindS
                                                                                   (sail2_state$and_boolS
                                                                                     ((haveFExt () ))
                                                                                     (sail2_state_monad$returnS ((((((((subrange_vec_dec
                                                                                                         v__354
                                                                                                         (( 31 : int):ii)
                                                                                                         (( 20 : int):ii)
                                                                                                        :  12 words$word)) = (0xF00w :  12 words$word)))) /\ ((((((((subrange_vec_dec
                                                                                                             v__354
                                                                                                             (( 14 : int):ii)
                                                                                                             (( 12 : int):ii)
                                                                                                            :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec
                                                                                                             v__354
                                                                                                             (( 6 : int):ii)
                                                                                                             (( 0 : int):ii)
                                                                                                            :  7 words$word)) = (0b1010011w :  7 words$word)))))))))))) (\ (w__104 :
                                                                                     bool) . 
                                                                                   sail2_state_monad$returnS (if w__104
                                                                                           then
                                                                                             T
                                                                                           else T)))))))))))))))))))))))))))))))))))))))))))`;


val _ = Define `
 ((encdec_compressed_forwards:ast ->(regstate)sail2_state_monad$sequential_state ->((((16)words$word),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    ((case arg_ of
     C_NOP (() ) =>
      sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b00000w :  5 words$word)
                         ((concat_vec (0b00000w :  5 words$word) (0b01w :  2 words$word)  :  7 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_ADDI4SPN ((rd, v__692)) =>
      if (let (nz96 : 4 bits) = ((subrange_vec_dec v__692 (( 7 : int):ii) (( 4 : int):ii)  :  4 words$word)) in
        let (nz96 : 4 bits) = ((subrange_vec_dec v__692 (( 7 : int):ii) (( 4 : int):ii)  :  4 words$word)) in
        let (nz54 : 2 bits) = ((subrange_vec_dec v__692 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
        let (nz3 : 1 bits) = ((subrange_vec_dec v__692 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
        let (nz2 : 1 bits) = ((subrange_vec_dec v__692 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
        (((concat_vec nz96 ((concat_vec nz54 ((concat_vec nz3 nz2  :  2 words$word))  :  4 words$word))
             :  8 words$word)) <> (0x00w :  8 words$word))) then
        let (nz96 : 4 bits) = ((subrange_vec_dec v__692 (( 7 : int):ii) (( 4 : int):ii)  :  4 words$word)) in
        let (nz96 : 4 bits) = ((subrange_vec_dec v__692 (( 7 : int):ii) (( 4 : int):ii)  :  4 words$word)) in
        let (nz54 : 2 bits) = ((subrange_vec_dec v__692 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
        let (nz3 : 1 bits) = ((subrange_vec_dec v__692 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
        let (nz2 : 1 bits) = ((subrange_vec_dec v__692 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                   ((concat_vec nz54
                       ((concat_vec nz96
                           ((concat_vec nz2
                               ((concat_vec nz3 ((concat_vec rd (0b00w :  2 words$word)  :  5 words$word))
                                  :  6 words$word))
                              :  7 words$word))
                          :  11 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_LW ((v__693, rs1, rd)) =>
      let (ui6 : 1 bits) = ((subrange_vec_dec v__693 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (ui6 : 1 bits) = ((subrange_vec_dec v__693 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (ui53 : 3 bits) = ((subrange_vec_dec v__693 (( 3 : int):ii) (( 1 : int):ii)  :  3 words$word)) in
      let (ui2 : 1 bits) = ((subrange_vec_dec v__693 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b010w :  3 words$word)
                 ((concat_vec ui53
                     ((concat_vec rs1
                         ((concat_vec ui2
                             ((concat_vec ui6 ((concat_vec rd (0b00w :  2 words$word)  :  5 words$word))
                                :  6 words$word))
                            :  7 words$word))
                        :  10 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_LD ((v__694, rs1, rd)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        let (ui76 : 2 bits) = ((subrange_vec_dec v__694 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
        let (ui76 : 2 bits) = ((subrange_vec_dec v__694 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
        let (ui53 : 3 bits) = ((subrange_vec_dec v__694 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec ui53
                       ((concat_vec rs1
                           ((concat_vec ui76 ((concat_vec rd (0b00w :  2 words$word)  :  5 words$word))
                              :  7 words$word))
                          :  10 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_SW ((v__695, rs1, rs2)) =>
      let (ui6 : 1 bits) = ((subrange_vec_dec v__695 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (ui6 : 1 bits) = ((subrange_vec_dec v__695 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (ui53 : 3 bits) = ((subrange_vec_dec v__695 (( 3 : int):ii) (( 1 : int):ii)  :  3 words$word)) in
      let (ui2 : 1 bits) = ((subrange_vec_dec v__695 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b110w :  3 words$word)
                 ((concat_vec ui53
                     ((concat_vec rs1
                         ((concat_vec ui2
                             ((concat_vec ui6 ((concat_vec rs2 (0b00w :  2 words$word)  :  5 words$word))
                                :  6 words$word))
                            :  7 words$word))
                        :  10 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_SD ((v__696, rs1, rs2)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        let (ui76 : 2 bits) = ((subrange_vec_dec v__696 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
        let (ui76 : 2 bits) = ((subrange_vec_dec v__696 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
        let (ui53 : 3 bits) = ((subrange_vec_dec v__696 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b111w :  3 words$word)
                   ((concat_vec ui53
                       ((concat_vec rs1
                           ((concat_vec ui76 ((concat_vec rs2 (0b00w :  2 words$word)  :  5 words$word))
                              :  7 words$word))
                          :  10 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ADDI ((v__697, rsd)) =>
      if (let (nzi5 : 1 bits) = ((subrange_vec_dec v__697 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi5 : 1 bits) = ((subrange_vec_dec v__697 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi40 : 5 bits) = ((subrange_vec_dec v__697 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        ((((((concat_vec nzi5 nzi40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))) then
        let (nzi5 : 1 bits) = ((subrange_vec_dec v__697 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi5 : 1 bits) = ((subrange_vec_dec v__697 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi40 : 5 bits) = ((subrange_vec_dec v__697 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                   ((concat_vec nzi5
                       ((concat_vec rsd ((concat_vec nzi40 (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_JAL (v__698) =>
      if ((((( 32 : int):ii) = (( 32 : int):ii)))) then
        let (i11 : 1 bits) = ((subrange_vec_dec v__698 (( 10 : int):ii) (( 10 : int):ii)  :  1 words$word)) in
        let (i98 : 2 bits) = ((subrange_vec_dec v__698 (( 8 : int):ii) (( 7 : int):ii)  :  2 words$word)) in
        let (i7 : 1 bits) = ((subrange_vec_dec v__698 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
        let (i6 : 1 bits) = ((subrange_vec_dec v__698 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (i5 : 1 bits) = ((subrange_vec_dec v__698 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
        let (i4 : 1 bits) = ((subrange_vec_dec v__698 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)) in
        let (i31 : 3 bits) = ((subrange_vec_dec v__698 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
        let (i11 : 1 bits) = ((subrange_vec_dec v__698 (( 10 : int):ii) (( 10 : int):ii)  :  1 words$word)) in
        let (i10 : 1 bits) = ((subrange_vec_dec v__698 (( 9 : int):ii) (( 9 : int):ii)  :  1 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b001w :  3 words$word)
                   ((concat_vec i11
                       ((concat_vec i4
                           ((concat_vec i98
                               ((concat_vec i10
                                   ((concat_vec i6
                                       ((concat_vec i7
                                           ((concat_vec i31
                                               ((concat_vec i5 (0b01w :  2 words$word)  :  3 words$word))
                                              :  6 words$word))
                                          :  7 words$word))
                                      :  8 words$word))
                                  :  9 words$word))
                              :  11 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ADDIW ((v__699, rsd)) =>
      if ((((((rsd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii))))))) then
        let (imm5 : 1 bits) = ((subrange_vec_dec v__699 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm5 : 1 bits) = ((subrange_vec_dec v__699 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm40 : 5 bits) = ((subrange_vec_dec v__699 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b001w :  3 words$word)
                   ((concat_vec imm5
                       ((concat_vec rsd ((concat_vec imm40 (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_LI ((v__700, rd)) =>
      if (((rd <> zreg))) then
        let (imm5 : 1 bits) = ((subrange_vec_dec v__700 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm5 : 1 bits) = ((subrange_vec_dec v__700 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm40 : 5 bits) = ((subrange_vec_dec v__700 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b010w :  3 words$word)
                   ((concat_vec imm5
                       ((concat_vec rd ((concat_vec imm40 (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ADDI16SP (v__701) =>
      if (let (nzi9 : 1 bits) = ((subrange_vec_dec v__701 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi9 : 1 bits) = ((subrange_vec_dec v__701 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi87 : 2 bits) = ((subrange_vec_dec v__701 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
        let (nzi6 : 1 bits) = ((subrange_vec_dec v__701 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
        let (nzi5 : 1 bits) = ((subrange_vec_dec v__701 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
        let (nzi4 : 1 bits) = ((subrange_vec_dec v__701 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
        (((concat_vec nzi9
              ((concat_vec nzi87
                  ((concat_vec nzi6 ((concat_vec nzi5 nzi4  :  2 words$word))  :  3 words$word))
                 :  5 words$word))
             :  6 words$word)) <> (0b000000w :  6 words$word))) then
        let (nzi9 : 1 bits) = ((subrange_vec_dec v__701 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi9 : 1 bits) = ((subrange_vec_dec v__701 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzi87 : 2 bits) = ((subrange_vec_dec v__701 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
        let (nzi6 : 1 bits) = ((subrange_vec_dec v__701 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
        let (nzi5 : 1 bits) = ((subrange_vec_dec v__701 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
        let (nzi4 : 1 bits) = ((subrange_vec_dec v__701 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec nzi9
                       ((concat_vec (0b00010w :  5 words$word)
                           ((concat_vec nzi4
                               ((concat_vec nzi6
                                   ((concat_vec nzi87
                                       ((concat_vec nzi5 (0b01w :  2 words$word)  :  3 words$word))
                                      :  5 words$word))
                                  :  6 words$word))
                              :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_LUI ((v__702, rd)) =>
      if (let (imm17 : 1 bits) = ((subrange_vec_dec v__702 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm17 : 1 bits) = ((subrange_vec_dec v__702 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm1612 : 5 bits) = ((subrange_vec_dec v__702 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))))))))) then
        let (imm17 : 1 bits) = ((subrange_vec_dec v__702 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm17 : 1 bits) = ((subrange_vec_dec v__702 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm1612 : 5 bits) = ((subrange_vec_dec v__702 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec imm17
                       ((concat_vec rd ((concat_vec imm1612 (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_SRLI ((v__703, rsd)) =>
      if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__703 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__703 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__703 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) then
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__703 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__703 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__703 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec nzui5
                       ((concat_vec (0b00w :  2 words$word)
                           ((concat_vec rsd ((concat_vec nzui40 (0b01w :  2 words$word)  :  7 words$word))
                              :  10 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_SRAI ((v__704, rsd)) =>
      if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__704 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__704 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__704 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) then
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__704 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__704 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__704 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec nzui5
                       ((concat_vec (0b01w :  2 words$word)
                           ((concat_vec rsd ((concat_vec nzui40 (0b01w :  2 words$word)  :  7 words$word))
                              :  10 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ANDI ((v__705, rsd)) =>
      let (i5 : 1 bits) = ((subrange_vec_dec v__705 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
      let (i5 : 1 bits) = ((subrange_vec_dec v__705 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
      let (i40 : 5 bits) = ((subrange_vec_dec v__705 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec i5
                     ((concat_vec (0b10w :  2 words$word)
                         ((concat_vec rsd ((concat_vec i40 (0b01w :  2 words$word)  :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_SUB ((rsd, rs2)) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b11w :  2 words$word)
                         ((concat_vec rsd
                             ((concat_vec (0b00w :  2 words$word)
                                 ((concat_vec rs2 (0b01w :  2 words$word)  :  5 words$word))
                                :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_XOR ((rsd, rs2)) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b11w :  2 words$word)
                         ((concat_vec rsd
                             ((concat_vec (0b01w :  2 words$word)
                                 ((concat_vec rs2 (0b01w :  2 words$word)  :  5 words$word))
                                :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_OR ((rsd, rs2)) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b11w :  2 words$word)
                         ((concat_vec rsd
                             ((concat_vec (0b10w :  2 words$word)
                                 ((concat_vec rs2 (0b01w :  2 words$word)  :  5 words$word))
                                :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_AND ((rsd, rs2)) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b11w :  2 words$word)
                         ((concat_vec rsd
                             ((concat_vec (0b11w :  2 words$word)
                                 ((concat_vec rs2 (0b01w :  2 words$word)  :  5 words$word))
                                :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_SUBW ((rsd, rs2)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b1w :  1 words$word)
                       ((concat_vec (0b11w :  2 words$word)
                           ((concat_vec rsd
                               ((concat_vec (0b00w :  2 words$word)
                                   ((concat_vec rs2 (0b01w :  2 words$word)  :  5 words$word))
                                  :  7 words$word))
                              :  10 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ADDW ((rsd, rs2)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b1w :  1 words$word)
                       ((concat_vec (0b11w :  2 words$word)
                           ((concat_vec rsd
                               ((concat_vec (0b01w :  2 words$word)
                                   ((concat_vec rs2 (0b01w :  2 words$word)  :  5 words$word))
                                  :  7 words$word))
                              :  10 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_J (v__706) =>
      let (i11 : 1 bits) = ((subrange_vec_dec v__706 (( 10 : int):ii) (( 10 : int):ii)  :  1 words$word)) in
      let (i98 : 2 bits) = ((subrange_vec_dec v__706 (( 8 : int):ii) (( 7 : int):ii)  :  2 words$word)) in
      let (i7 : 1 bits) = ((subrange_vec_dec v__706 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
      let (i6 : 1 bits) = ((subrange_vec_dec v__706 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
      let (i5 : 1 bits) = ((subrange_vec_dec v__706 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (i4 : 1 bits) = ((subrange_vec_dec v__706 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)) in
      let (i31 : 3 bits) = ((subrange_vec_dec v__706 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
      let (i11 : 1 bits) = ((subrange_vec_dec v__706 (( 10 : int):ii) (( 10 : int):ii)  :  1 words$word)) in
      let (i10 : 1 bits) = ((subrange_vec_dec v__706 (( 9 : int):ii) (( 9 : int):ii)  :  1 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b101w :  3 words$word)
                 ((concat_vec i11
                     ((concat_vec i4
                         ((concat_vec i98
                             ((concat_vec i10
                                 ((concat_vec i6
                                     ((concat_vec i7
                                         ((concat_vec i31
                                             ((concat_vec i5 (0b01w :  2 words$word)  :  3 words$word))
                                            :  6 words$word))
                                        :  7 words$word))
                                    :  8 words$word))
                                :  9 words$word))
                            :  11 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_BEQZ ((v__707, rs)) =>
      let (i8 : 1 bits) = ((subrange_vec_dec v__707 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
      let (i8 : 1 bits) = ((subrange_vec_dec v__707 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
      let (i76 : 2 bits) = ((subrange_vec_dec v__707 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
      let (i5 : 1 bits) = ((subrange_vec_dec v__707 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (i43 : 2 bits) = ((subrange_vec_dec v__707 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
      let (i21 : 2 bits) = ((subrange_vec_dec v__707 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b110w :  3 words$word)
                 ((concat_vec i8
                     ((concat_vec i43
                         ((concat_vec rs
                             ((concat_vec i76
                                 ((concat_vec i21 ((concat_vec i5 (0b01w :  2 words$word)  :  3 words$word))
                                    :  5 words$word))
                                :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_BNEZ ((v__708, rs)) =>
      let (i8 : 1 bits) = ((subrange_vec_dec v__708 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
      let (i8 : 1 bits) = ((subrange_vec_dec v__708 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
      let (i76 : 2 bits) = ((subrange_vec_dec v__708 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
      let (i5 : 1 bits) = ((subrange_vec_dec v__708 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
      let (i43 : 2 bits) = ((subrange_vec_dec v__708 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
      let (i21 : 2 bits) = ((subrange_vec_dec v__708 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b111w :  3 words$word)
                 ((concat_vec i8
                     ((concat_vec i43
                         ((concat_vec rs
                             ((concat_vec i76
                                 ((concat_vec i21 ((concat_vec i5 (0b01w :  2 words$word)  :  3 words$word))
                                    :  5 words$word))
                                :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_SLLI ((v__709, rsd)) =>
      if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__709 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__709 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__709 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        ((((((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ ((((((rsd <> zreg))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word)))))))))))) then
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__709 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__709 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__709 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                   ((concat_vec nzui5
                       ((concat_vec rsd ((concat_vec nzui40 (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_LWSP ((v__710, rd)) =>
      if (((rd <> zreg))) then
        let (ui76 : 2 bits) = ((subrange_vec_dec v__710 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
        let (ui76 : 2 bits) = ((subrange_vec_dec v__710 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
        let (ui5 : 1 bits) = ((subrange_vec_dec v__710 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)) in
        let (ui42 : 3 bits) = ((subrange_vec_dec v__710 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b010w :  3 words$word)
                   ((concat_vec ui5
                       ((concat_vec rd
                           ((concat_vec ui42 ((concat_vec ui76 (0b10w :  2 words$word)  :  4 words$word))
                              :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_LDSP ((v__711, rd)) =>
      if ((((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii))))))) then
        let (ui86 : 3 bits) = ((subrange_vec_dec v__711 (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word)) in
        let (ui86 : 3 bits) = ((subrange_vec_dec v__711 (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word)) in
        let (ui5 : 1 bits) = ((subrange_vec_dec v__711 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
        let (ui43 : 2 bits) = ((subrange_vec_dec v__711 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec ui5
                       ((concat_vec rd
                           ((concat_vec ui43 ((concat_vec ui86 (0b10w :  2 words$word)  :  5 words$word))
                              :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_SWSP ((v__712, rs2)) =>
      let (ui76 : 2 bits) = ((subrange_vec_dec v__712 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
      let (ui76 : 2 bits) = ((subrange_vec_dec v__712 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
      let (ui52 : 4 bits) = ((subrange_vec_dec v__712 (( 3 : int):ii) (( 0 : int):ii)  :  4 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b110w :  3 words$word)
                 ((concat_vec ui52
                     ((concat_vec ui76 ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                        :  9 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_SDSP ((v__713, rs2)) =>
      if ((((( 32 : int):ii) = (( 64 : int):ii)))) then
        let (ui86 : 3 bits) = ((subrange_vec_dec v__713 (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word)) in
        let (ui86 : 3 bits) = ((subrange_vec_dec v__713 (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word)) in
        let (ui53 : 3 bits) = ((subrange_vec_dec v__713 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b111w :  3 words$word)
                   ((concat_vec ui53
                       ((concat_vec ui86 ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                          :  10 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_JR (rs1) =>
      if (((rs1 <> zreg))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b0w :  1 words$word)
                       ((concat_vec rs1
                           ((concat_vec (0b00000w :  5 words$word) (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_JALR (rs1) =>
      if (((rs1 <> zreg))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b1w :  1 words$word)
                       ((concat_vec rs1
                           ((concat_vec (0b00000w :  5 words$word) (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_MV ((rd, rs2)) =>
      if ((((((rd <> zreg))) /\ (((rs2 <> zreg)))))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b0w :  1 words$word)
                       ((concat_vec rd ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_EBREAK (() ) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b1w :  1 words$word)
                     ((concat_vec (0b00000w :  5 words$word)
                         ((concat_vec (0b00000w :  5 words$word) (0b10w :  2 words$word)  :  7 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_ADD ((rsd, rs2)) =>
      if ((((((rsd <> zreg))) /\ (((rs2 <> zreg)))))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b1w :  1 words$word)
                       ((concat_vec rsd ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_NOP_HINT (v__714) =>
      if (let (im5 : 1 bits) = ((subrange_vec_dec v__714 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (im5 : 1 bits) = ((subrange_vec_dec v__714 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (im40 : 5 bits) = ((subrange_vec_dec v__714 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        (((concat_vec im5 im40  :  6 words$word)) <> (0b000000w :  6 words$word))) then
        let (im5 : 1 bits) = ((subrange_vec_dec v__714 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (im5 : 1 bits) = ((subrange_vec_dec v__714 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (im40 : 5 bits) = ((subrange_vec_dec v__714 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                   ((concat_vec im5
                       ((concat_vec (0b00000w :  5 words$word)
                           ((concat_vec im40 (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ADDI_HINT (rsd) =>
      if (((rsd <> zreg))) then
        sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                   ((concat_vec (0b0w :  1 words$word)
                       ((concat_vec rsd
                           ((concat_vec (0b00000w :  5 words$word) (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_LI_HINT (v__715) =>
      let (imm5 : 1 bits) = ((subrange_vec_dec v__715 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
      let (imm5 : 1 bits) = ((subrange_vec_dec v__715 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
      let (imm40 : 5 bits) = ((subrange_vec_dec v__715 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
      sail2_state_monad$returnS ((concat_vec (0b010w :  3 words$word)
                 ((concat_vec imm5
                     ((concat_vec (0b00000w :  5 words$word)
                         ((concat_vec imm40 (0b01w :  2 words$word)  :  7 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_LUI_HINT (v__716) =>
      if (let (imm17 : 1 bits) = ((subrange_vec_dec v__716 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm17 : 1 bits) = ((subrange_vec_dec v__716 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm1612 : 5 bits) = ((subrange_vec_dec v__716 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        (((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))) then
        let (imm17 : 1 bits) = ((subrange_vec_dec v__716 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm17 : 1 bits) = ((subrange_vec_dec v__716 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (imm1612 : 5 bits) = ((subrange_vec_dec v__716 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec imm17
                       ((concat_vec (0b00000w :  5 words$word)
                           ((concat_vec imm1612 (0b01w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_MV_HINT (rs2) =>
      if (((rs2 <> zreg))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b0w :  1 words$word)
                       ((concat_vec (0b00000w :  5 words$word)
                           ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_ADD_HINT (rs2) =>
      if (((rs2 <> zreg))) then
        sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                   ((concat_vec (0b1w :  1 words$word)
                       ((concat_vec (0b00000w :  5 words$word)
                           ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_SLLI_HINT ((v__717, rsd)) =>
      if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__717 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__717 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__717 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        (((((((((concat_vec nzui5 nzui40  :  6 words$word)) = (0b000000w :  6 words$word)))) \/ (((rsd = zreg)))))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word))))))))) then
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__717 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui5 : 1 bits) = ((subrange_vec_dec v__717 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
        let (nzui40 : 5 bits) = ((subrange_vec_dec v__717 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b000w :  3 words$word)
                   ((concat_vec nzui5
                       ((concat_vec rsd ((concat_vec nzui40 (0b10w :  2 words$word)  :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   | C_SRLI_HINT (rsd) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b00w :  2 words$word)
                         ((concat_vec rsd
                             ((concat_vec (0b00000w :  5 words$word) (0b01w :  2 words$word)  :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_SRAI_HINT (rsd) =>
      sail2_state_monad$returnS ((concat_vec (0b100w :  3 words$word)
                 ((concat_vec (0b0w :  1 words$word)
                     ((concat_vec (0b01w :  2 words$word)
                         ((concat_vec rsd
                             ((concat_vec (0b00000w :  5 words$word) (0b01w :  2 words$word)  :  7 words$word))
                            :  10 words$word))
                        :  12 words$word))
                    :  13 words$word))
                :  16 words$word))
   | C_FLWSP ((v__718, rd)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__57 :
        bool) . 
      if w__57 then
        let (ui76 : 2 bits) = ((subrange_vec_dec v__718 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
        let (ui76 : 2 bits) = ((subrange_vec_dec v__718 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
        let (ui5 : 1 bits) = ((subrange_vec_dec v__718 (( 3 : int):ii) (( 3 : int):ii)  :  1 words$word)) in
        let (ui42 : 3 bits) = ((subrange_vec_dec v__718 (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec ui5
                       ((concat_vec rd
                           ((concat_vec ui42 ((concat_vec ui76 (0b10w :  2 words$word)  :  4 words$word))
                              :  7 words$word))
                          :  12 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | C_FSWSP ((v__719, rs2)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__63 :
        bool) . 
      if w__63 then
        let (ui76 : 2 bits) = ((subrange_vec_dec v__719 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
        let (ui76 : 2 bits) = ((subrange_vec_dec v__719 (( 5 : int):ii) (( 4 : int):ii)  :  2 words$word)) in
        let (ui52 : 4 bits) = ((subrange_vec_dec v__719 (( 3 : int):ii) (( 0 : int):ii)  :  4 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b111w :  3 words$word)
                   ((concat_vec ui52
                       ((concat_vec ui76 ((concat_vec rs2 (0b10w :  2 words$word)  :  7 words$word))
                          :  9 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | C_FLW ((v__720, rs1, rd)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__69 :
        bool) . 
      if w__69 then
        let (ui6 : 1 bits) = ((subrange_vec_dec v__720 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
        let (ui6 : 1 bits) = ((subrange_vec_dec v__720 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
        let (ui53 : 3 bits) = ((subrange_vec_dec v__720 (( 3 : int):ii) (( 1 : int):ii)  :  3 words$word)) in
        let (ui2 : 1 bits) = ((subrange_vec_dec v__720 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b011w :  3 words$word)
                   ((concat_vec ui53
                       ((concat_vec rs1
                           ((concat_vec ui2
                               ((concat_vec ui6 ((concat_vec rd (0b00w :  2 words$word)  :  5 words$word))
                                  :  6 words$word))
                              :  7 words$word))
                          :  10 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | C_FSW ((v__721, rs1, rs2)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__75 :
        bool) . 
      if w__75 then
        let (ui6 : 1 bits) = ((subrange_vec_dec v__721 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
        let (ui6 : 1 bits) = ((subrange_vec_dec v__721 (( 4 : int):ii) (( 4 : int):ii)  :  1 words$word)) in
        let (ui53 : 3 bits) = ((subrange_vec_dec v__721 (( 3 : int):ii) (( 1 : int):ii)  :  3 words$word)) in
        let (ui2 : 1 bits) = ((subrange_vec_dec v__721 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
        sail2_state_monad$returnS ((concat_vec (0b111w :  3 words$word)
                   ((concat_vec ui53
                       ((concat_vec rs1
                           ((concat_vec ui2
                               ((concat_vec ui6 ((concat_vec rs2 (0b00w :  2 words$word)  :  5 words$word))
                                  :  6 words$word))
                              :  7 words$word))
                          :  10 words$word))
                      :  13 words$word))
                  :  16 words$word))
      else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () ))
   | C_ILLEGAL (s) => sail2_state_monad$returnS s
   | _ => sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )
   )))`;


val _ = Define `
 ((encdec_compressed_backwards:(16)words$word ->(regstate)sail2_state_monad$sequential_state ->(((ast),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let v__722 = arg_ in
   if (((v__722 = (0x0001w :  16 words$word)))) then sail2_state_monad$returnS (C_NOP () )
   else if ((((let (nz96 : 4 bits) = ((subrange_vec_dec v__722 (( 10 : int):ii) (( 7 : int):ii)  :  4 words$word)) in
               let (nz54 : 2 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 11 : int):ii)  :  2 words$word)) in
               let (nz3 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
               let (nz2 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
               (((concat_vec nz96
                     ((concat_vec nz54 ((concat_vec nz3 nz2  :  2 words$word))  :  4 words$word))
                    :  8 words$word)) <> (0x00w :  8 words$word))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))))) then
     let (rd : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     let (nz96 : 4 bits) = ((subrange_vec_dec v__722 (( 10 : int):ii) (( 7 : int):ii)  :  4 words$word)) in
     let (nz54 : 2 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 11 : int):ii)  :  2 words$word)) in
     let (nz3 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
     let (nz2 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
     sail2_state_monad$returnS (C_ADDI4SPN (rd,
                         (concat_vec nz96
                            ((concat_vec nz54 ((concat_vec nz3 nz2  :  2 words$word))  :  4 words$word))
                           :  8 words$word)))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))
   then
     let (ui6 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
     let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
     let (ui2 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
     let (rs1 : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rd : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_LW ((concat_vec ui6 ((concat_vec ui53 ui2  :  4 words$word))  :  5 words$word), rs1, rd))
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))))) then
     let (ui76 : 2 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
     let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
     let (rs1 : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rd : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_LD ((concat_vec ui76 ui53  :  5 words$word), rs1, rd))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))
   then
     let (ui6 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
     let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
     let (ui2 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     let (rs1 : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_SW ((concat_vec ui6 ((concat_vec ui53 ui2  :  4 words$word))  :  5 words$word), rs1, rs2))
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))))) then
     let (ui76 : 2 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
     let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
     let (rs2 : 3 bits) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     let (rs1 : 3 bits) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_SD ((concat_vec ui76 ui53  :  5 words$word), rs1, rs2))
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (nzi5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzi40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((((concat_vec nzi5 nzi40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (nzi5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (nzi40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_ADDI ((concat_vec nzi5 nzi40  :  6 words$word), rsd))
   else if (((((((( 32 : int):ii) = (( 32 : int):ii)))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (i98 : 2 bits) = ((subrange_vec_dec v__722 (( 10 : int):ii) (( 9 : int):ii)  :  2 words$word)) in
     let (i7 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
     let (i6 : 1 bits) = ((subrange_vec_dec v__722 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
     let (i5 : 1 bits) = ((subrange_vec_dec v__722 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
     let (i4 : 1 bits) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 11 : int):ii)  :  1 words$word)) in
     let (i31 : 3 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word)) in
     let (i11 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (i10 : 1 bits) = ((subrange_vec_dec v__722 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)) in
     sail2_state_monad$returnS (C_JAL ((concat_vec i11
                       ((concat_vec i10
                           ((concat_vec i98
                               ((concat_vec i7
                                   ((concat_vec i6
                                       ((concat_vec i5 ((concat_vec i4 i31  :  4 words$word))
                                          :  5 words$word))
                                      :  6 words$word))
                                  :  7 words$word))
                              :  9 words$word))
                          :  10 words$word))
                      :  11 words$word)))
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               ((((rsd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (imm40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_ADDIW ((concat_vec imm5 imm40  :  6 words$word), rsd))
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rd <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (imm40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_LI ((concat_vec imm5 imm40  :  6 words$word), rd))
   else if ((((let (nzi9 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzi87 : 2 bits) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
               let (nzi6 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
               let (nzi5 : 1 bits) = ((subrange_vec_dec v__722 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
               let (nzi4 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
               (((concat_vec nzi9
                     ((concat_vec nzi87
                         ((concat_vec nzi6 ((concat_vec nzi5 nzi4  :  2 words$word))  :  3 words$word))
                        :  5 words$word))
                    :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00010w :  5 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (nzi9 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (nzi87 : 2 bits) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
     let (nzi6 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
     let (nzi5 : 1 bits) = ((subrange_vec_dec v__722 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
     let (nzi4 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
     sail2_state_monad$returnS (C_ADDI16SP ((concat_vec nzi9
                            ((concat_vec nzi87
                                ((concat_vec nzi6 ((concat_vec nzi5 nzi4  :  2 words$word))  :  3 words$word))
                               :  5 words$word))
                           :  6 words$word)))
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (imm17 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (imm1612 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))))))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (imm17 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (imm1612 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_LUI ((concat_vec imm17 imm1612  :  6 words$word), rd))
   else if ((((let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_SRLI ((concat_vec nzui5 nzui40  :  6 words$word), rsd))
   else if ((((let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_SRAI ((concat_vec nzui5 nzui40  :  6 words$word), rsd))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (i5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (i40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_ANDI ((concat_vec i5 i40  :  6 words$word), rsd))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_SUB (rsd, rs2))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_XOR (rsd, rs2))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_OR (rsd, rs2))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_AND (rsd, rs2))
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100111w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_SUBW (rsd, rs2))
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100111w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_ADDW (rsd, rs2))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))
   then
     let (i98 : 2 bits) = ((subrange_vec_dec v__722 (( 10 : int):ii) (( 9 : int):ii)  :  2 words$word)) in
     let (i7 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
     let (i6 : 1 bits) = ((subrange_vec_dec v__722 (( 7 : int):ii) (( 7 : int):ii)  :  1 words$word)) in
     let (i5 : 1 bits) = ((subrange_vec_dec v__722 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
     let (i4 : 1 bits) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 11 : int):ii)  :  1 words$word)) in
     let (i31 : 3 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 3 : int):ii)  :  3 words$word)) in
     let (i11 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (i10 : 1 bits) = ((subrange_vec_dec v__722 (( 8 : int):ii) (( 8 : int):ii)  :  1 words$word)) in
     sail2_state_monad$returnS (C_J ((concat_vec i11
                     ((concat_vec i10
                         ((concat_vec i98
                             ((concat_vec i7
                                 ((concat_vec i6
                                     ((concat_vec i5 ((concat_vec i4 i31  :  4 words$word))  :  5 words$word))
                                    :  6 words$word))
                                :  7 words$word))
                            :  9 words$word))
                        :  10 words$word))
                    :  11 words$word)))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))
   then
     let (rs : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (i8 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (i76 : 2 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
     let (i5 : 1 bits) = ((subrange_vec_dec v__722 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
     let (i43 : 2 bits) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) in
     let (i21 : 2 bits) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
     sail2_state_monad$returnS (C_BEQZ ((concat_vec i8
                        ((concat_vec i76
                            ((concat_vec i5 ((concat_vec i43 i21  :  4 words$word))  :  5 words$word))
                           :  7 words$word))
                       :  8 words$word),
                     rs))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))
   then
     let (rs : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (i8 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (i76 : 2 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
     let (i5 : 1 bits) = ((subrange_vec_dec v__722 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
     let (i43 : 2 bits) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) in
     let (i21 : 2 bits) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
     sail2_state_monad$returnS (C_BNEZ ((concat_vec i8
                        ((concat_vec i76
                            ((concat_vec i5 ((concat_vec i43 i21  :  4 words$word))  :  5 words$word))
                           :  7 words$word))
                       :  8 words$word),
                     rs))
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ ((((((rsd <> zreg))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word)))))))))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_SLLI ((concat_vec nzui5 nzui40  :  6 words$word), rsd))
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rd <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (ui76 : 2 bits) = ((subrange_vec_dec v__722 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
     let (ui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (ui42 : 3 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 4 : int):ii)  :  3 words$word)) in
     let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_LWSP ((concat_vec ui76 ((concat_vec ui5 ui42  :  4 words$word))  :  6 words$word), rd))
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               ((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (ui86 : 3 bits) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
     let (ui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (ui43 : 2 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) in
     let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_LDSP ((concat_vec ui86 ((concat_vec ui5 ui43  :  3 words$word))  :  6 words$word), rd))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))
   then
     let (ui76 : 2 bits) = ((subrange_vec_dec v__722 (( 8 : int):ii) (( 7 : int):ii)  :  2 words$word)) in
     let (ui52 : 4 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 9 : int):ii)  :  4 words$word)) in
     let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_SWSP ((concat_vec ui76 ui52  :  6 words$word), rs2))
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (ui86 : 3 bits) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
     let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_SDSP ((concat_vec ui86 ui53  :  6 words$word), rs2))
   else if ((((let (rs1 : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rs1 <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x8w :  4 words$word)))) /\ (((((subrange_vec_dec v__722 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000010w :  7 words$word)))))))))) then
     let (rs1 : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_JR rs1)
   else if ((((let (rs1 : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rs1 <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x9w :  4 words$word)))) /\ (((((subrange_vec_dec v__722 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000010w :  7 words$word)))))))))) then
     let (rs1 : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_JALR rs1)
   else if ((((let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               ((((rd <> zreg))) /\ (((rs2 <> zreg))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x8w :  4 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_MV (rd, rs2))
   else if (((v__722 = (0x9002w :  16 words$word)))) then sail2_state_monad$returnS (C_EBREAK () )
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((rsd <> zreg))) /\ (((rs2 <> zreg))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x9w :  4 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_ADD (rsd, rs2))
   else if ((((let (im5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (im40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec im5 im40  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (im5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (im40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_NOP_HINT ((concat_vec im5 im40  :  6 words$word)))
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rsd <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x0w :  4 words$word)))) /\ (((((subrange_vec_dec v__722 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))))))))) then
     let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_ADDI_HINT rsd)
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     let (imm5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (imm40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_LI_HINT ((concat_vec imm5 imm40  :  6 words$word)))
   else if ((((let (imm17 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (imm1612 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     let (imm17 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (imm1612 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_LUI_HINT ((concat_vec imm17 imm1612  :  6 words$word)))
   else if ((((let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (rs2 <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 7 : int):ii)  :  9 words$word)) = (0b100000000w :  9 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_MV_HINT rs2)
   else if ((((let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (rs2 <> zreg)) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 7 : int):ii)  :  9 words$word)) = (0b100100000w :  9 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_ADD_HINT rs2)
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((((((((concat_vec nzui5 nzui40  :  6 words$word)) = (0b000000w :  6 words$word)))) \/ (((rsd = zreg)))))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word))))))))) /\ ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     let (rsd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
     let (nzui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
     let (nzui40 : 5 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
     sail2_state_monad$returnS (C_SLLI_HINT ((concat_vec nzui5 nzui40  :  6 words$word), rsd))
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100000w :  6 words$word)))) /\ (((((subrange_vec_dec v__722 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_SRLI_HINT rsd)
   else if ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100001w :  6 words$word)))) /\ (((((subrange_vec_dec v__722 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word))))))) then
     let (rsd : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
     sail2_state_monad$returnS (C_SRAI_HINT rsd)
   else sail2_state_monad$bindS
     (sail2_state$and_boolS
       (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))))) (\ (w__4 : bool) . 
     if w__4 then
       let (ui76 : 2 bits) = ((subrange_vec_dec v__722 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
       let (ui5 : 1 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
       let (ui42 : 3 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 4 : int):ii)  :  3 words$word)) in
       let (rd : regidx) = ((subrange_vec_dec v__722 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
       sail2_state_monad$returnS (C_FLWSP ((concat_vec ui76 ((concat_vec ui5 ui42  :  4 words$word))  :  6 words$word), rd))
     else sail2_state_monad$bindS
       (sail2_state$and_boolS
         (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))))) (\ (w__9 : bool) . 
       if w__9 then
         let (ui76 : 2 bits) = ((subrange_vec_dec v__722 (( 8 : int):ii) (( 7 : int):ii)  :  2 words$word)) in
         let (ui52 : 4 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 9 : int):ii)  :  4 words$word)) in
         let (rs2 : regidx) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
         sail2_state_monad$returnS (C_FSWSP ((concat_vec ui76 ui52  :  6 words$word), rs2))
       else sail2_state_monad$bindS
         (sail2_state$and_boolS
           (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))))))))) (\ (w__14 : bool) . 
         if w__14 then
           let (ui6 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
           let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
           let (ui2 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
           let (rs1 : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
           let (rd : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
           sail2_state_monad$returnS (C_FLW ((concat_vec ui6 ((concat_vec ui53 ui2  :  4 words$word))  :  5 words$word),
                          rs1,
                          rd))
         else sail2_state_monad$bindS
           (sail2_state$and_boolS
             (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__722 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__722 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))))))))) (\ (w__19 : bool) . 
           sail2_state_monad$returnS (if w__19 then
                     let (ui6 : 1 bits) = ((subrange_vec_dec v__722 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                     let (ui53 : 3 bits) = ((subrange_vec_dec v__722 (( 12 : int):ii) (( 10 : int):ii)  :  3 words$word)) in
                     let (ui2 : 1 bits) = ((subrange_vec_dec v__722 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
                     let (rs2 : cregidx) = ((subrange_vec_dec v__722 (( 4 : int):ii) (( 2 : int):ii)  :  3 words$word)) in
                     let (rs1 : cregidx) = ((subrange_vec_dec v__722 (( 9 : int):ii) (( 7 : int):ii)  :  3 words$word)) in
                     C_FSW ((concat_vec ui6 ((concat_vec ui53 ui2  :  4 words$word))  :  5 words$word),
                            rs1,
                            rs2)
                   else C_ILLEGAL v__722)))))))`;


val _ = Define `
 ((encdec_compressed_forwards_matches:ast ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    ((case arg_ of
     C_NOP (() ) => sail2_state_monad$returnS T
   | C_ADDI4SPN ((rd, v__912)) =>
      sail2_state_monad$returnS (if (let (nz96 : 4 bits) = ((subrange_vec_dec v__912 (( 7 : int):ii) (( 4 : int):ii)  :  4 words$word)) in
                let (nz96 : 4 bits) = ((subrange_vec_dec v__912 (( 7 : int):ii) (( 4 : int):ii)  :  4 words$word)) in
                let (nz54 : 2 bits) = ((subrange_vec_dec v__912 (( 3 : int):ii) (( 2 : int):ii)  :  2 words$word)) in
                let (nz3 : 1 bits) = ((subrange_vec_dec v__912 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
                let (nz2 : 1 bits) = ((subrange_vec_dec v__912 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
                (((concat_vec nz96
                      ((concat_vec nz54 ((concat_vec nz3 nz2  :  2 words$word))  :  4 words$word))
                     :  8 words$word)) <> (0x00w :  8 words$word))) then
                T
              else F)
   | C_LW ((v__913, rs1, rd)) => sail2_state_monad$returnS T
   | C_LD ((v__914, rs1, rd)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | C_SW ((v__915, rs1, rs2)) => sail2_state_monad$returnS T
   | C_SD ((v__916, rs1, rs2)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | C_ADDI ((v__917, rsd)) =>
      sail2_state_monad$returnS (if (let (nzi5 : 1 bits) = ((subrange_vec_dec v__917 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzi5 : 1 bits) = ((subrange_vec_dec v__917 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzi40 : 5 bits) = ((subrange_vec_dec v__917 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                ((((((concat_vec nzi5 nzi40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))) then
                T
              else F)
   | C_JAL (v__918) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 32 : int):ii)))) then T else F)
   | C_ADDIW ((v__919, rsd)) =>
      sail2_state_monad$returnS (if ((((((rsd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii))))))) then T else F)
   | C_LI ((v__920, rd)) => sail2_state_monad$returnS (if (((rd <> zreg))) then T else F)
   | C_ADDI16SP (v__921) =>
      sail2_state_monad$returnS (if (let (nzi9 : 1 bits) = ((subrange_vec_dec v__921 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzi9 : 1 bits) = ((subrange_vec_dec v__921 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzi87 : 2 bits) = ((subrange_vec_dec v__921 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
                let (nzi6 : 1 bits) = ((subrange_vec_dec v__921 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
                let (nzi5 : 1 bits) = ((subrange_vec_dec v__921 (( 1 : int):ii) (( 1 : int):ii)  :  1 words$word)) in
                let (nzi4 : 1 bits) = ((subrange_vec_dec v__921 (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) in
                (((concat_vec nzi9
                      ((concat_vec nzi87
                          ((concat_vec nzi6 ((concat_vec nzi5 nzi4  :  2 words$word))  :  3 words$word))
                         :  5 words$word))
                     :  6 words$word)) <> (0b000000w :  6 words$word))) then
                T
              else F)
   | C_LUI ((v__922, rd)) =>
      sail2_state_monad$returnS (if (let (imm17 : 1 bits) = ((subrange_vec_dec v__922 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (imm17 : 1 bits) = ((subrange_vec_dec v__922 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (imm1612 : 5 bits) = ((subrange_vec_dec v__922 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word)))))))))
              then
                T
              else F)
   | C_SRLI ((v__923, rsd)) =>
      sail2_state_monad$returnS (if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__923 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui5 : 1 bits) = ((subrange_vec_dec v__923 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui40 : 5 bits) = ((subrange_vec_dec v__923 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) then
                T
              else F)
   | C_SRAI ((v__924, rsd)) =>
      sail2_state_monad$returnS (if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__924 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui5 : 1 bits) = ((subrange_vec_dec v__924 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui40 : 5 bits) = ((subrange_vec_dec v__924 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) then
                T
              else F)
   | C_ANDI ((v__925, rsd)) => sail2_state_monad$returnS T
   | C_SUB ((rsd, rs2)) => sail2_state_monad$returnS T
   | C_XOR ((rsd, rs2)) => sail2_state_monad$returnS T
   | C_OR ((rsd, rs2)) => sail2_state_monad$returnS T
   | C_AND ((rsd, rs2)) => sail2_state_monad$returnS T
   | C_SUBW ((rsd, rs2)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | C_ADDW ((rsd, rs2)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | C_J (v__926) => sail2_state_monad$returnS T
   | C_BEQZ ((v__927, rs)) => sail2_state_monad$returnS T
   | C_BNEZ ((v__928, rs)) => sail2_state_monad$returnS T
   | C_SLLI ((v__929, rsd)) =>
      sail2_state_monad$returnS (if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__929 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui5 : 1 bits) = ((subrange_vec_dec v__929 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui40 : 5 bits) = ((subrange_vec_dec v__929 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                ((((((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ ((((((rsd <> zreg))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word)))))))))))) then
                T
              else F)
   | C_LWSP ((v__930, rd)) => sail2_state_monad$returnS (if (((rd <> zreg))) then T else F)
   | C_LDSP ((v__931, rd)) =>
      sail2_state_monad$returnS (if ((((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii))))))) then T else F)
   | C_SWSP ((v__932, rs2)) => sail2_state_monad$returnS T
   | C_SDSP ((v__933, rs2)) => sail2_state_monad$returnS (if ((((( 32 : int):ii) = (( 64 : int):ii)))) then T else F)
   | C_JR (rs1) => sail2_state_monad$returnS (if (((rs1 <> zreg))) then T else F)
   | C_JALR (rs1) => sail2_state_monad$returnS (if (((rs1 <> zreg))) then T else F)
   | C_MV ((rd, rs2)) =>
      sail2_state_monad$returnS (if ((((((rd <> zreg))) /\ (((rs2 <> zreg)))))) then T else F)
   | C_EBREAK (() ) => sail2_state_monad$returnS T
   | C_ADD ((rsd, rs2)) =>
      sail2_state_monad$returnS (if ((((((rsd <> zreg))) /\ (((rs2 <> zreg)))))) then T else F)
   | C_NOP_HINT (v__934) =>
      sail2_state_monad$returnS (if (let (im5 : 1 bits) = ((subrange_vec_dec v__934 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (im5 : 1 bits) = ((subrange_vec_dec v__934 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (im40 : 5 bits) = ((subrange_vec_dec v__934 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                (((concat_vec im5 im40  :  6 words$word)) <> (0b000000w :  6 words$word))) then
                T
              else F)
   | C_ADDI_HINT (rsd) => sail2_state_monad$returnS (if (((rsd <> zreg))) then T else F)
   | C_LI_HINT (v__935) => sail2_state_monad$returnS T
   | C_LUI_HINT (v__936) =>
      sail2_state_monad$returnS (if (let (imm17 : 1 bits) = ((subrange_vec_dec v__936 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (imm17 : 1 bits) = ((subrange_vec_dec v__936 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (imm1612 : 5 bits) = ((subrange_vec_dec v__936 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                (((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))) then
                T
              else F)
   | C_MV_HINT (rs2) => sail2_state_monad$returnS (if (((rs2 <> zreg))) then T else F)
   | C_ADD_HINT (rs2) => sail2_state_monad$returnS (if (((rs2 <> zreg))) then T else F)
   | C_SLLI_HINT ((v__937, rsd)) =>
      sail2_state_monad$returnS (if (let (nzui5 : 1 bits) = ((subrange_vec_dec v__937 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui5 : 1 bits) = ((subrange_vec_dec v__937 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
                let (nzui40 : 5 bits) = ((subrange_vec_dec v__937 (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word)) in
                (((((((((concat_vec nzui5 nzui40  :  6 words$word)) = (0b000000w :  6 words$word)))) \/ (((rsd = zreg)))))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word))))))))) then
                T
              else F)
   | C_SRLI_HINT (rsd) => sail2_state_monad$returnS T
   | C_SRAI_HINT (rsd) => sail2_state_monad$returnS T
   | C_FLWSP ((v__938, rd)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__3 :
        bool) . 
      sail2_state_monad$returnS (if w__3 then T
              else F))
   | C_FSWSP ((v__939, rs2)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__7 :
        bool) . 
      sail2_state_monad$returnS (if w__7 then T
              else F))
   | C_FLW ((v__940, rs1, rd)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__11 :
        bool) . 
      sail2_state_monad$returnS (if w__11 then T
              else F))
   | C_FSW ((v__941, rs1, rs2)) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () )))) (\ (w__15 :
        bool) . 
      sail2_state_monad$returnS (if w__15 then T
              else F))
   | C_ILLEGAL (s) => sail2_state_monad$returnS T
   | _ => sail2_state_monad$returnS F
   )))`;


val _ = Define `
 ((encdec_compressed_backwards_matches:(16)words$word ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let v__942 = arg_ in
   if (((v__942 = (0x0001w :  16 words$word)))) then sail2_state_monad$returnS T
   else if ((((let (nz96 : 4 bits) = ((subrange_vec_dec v__942 (( 10 : int):ii) (( 7 : int):ii)  :  4 words$word)) in
               let (nz54 : 2 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 11 : int):ii)  :  2 words$word)) in
               let (nz3 : 1 bits) = ((subrange_vec_dec v__942 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
               let (nz2 : 1 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
               (((concat_vec nz96
                     ((concat_vec nz54 ((concat_vec nz3 nz2  :  2 words$word))  :  4 words$word))
                    :  8 words$word)) <> (0x00w :  8 words$word))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))
   then
     sail2_state_monad$returnS T
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))
   then
     sail2_state_monad$returnS T
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (nzi5 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzi40 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((((concat_vec nzi5 nzi40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if (((((((( 32 : int):ii) = (( 32 : int):ii)))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               ((((rsd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b001w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rd <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (nzi9 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzi87 : 2 bits) = ((subrange_vec_dec v__942 (( 4 : int):ii) (( 3 : int):ii)  :  2 words$word)) in
               let (nzi6 : 1 bits) = ((subrange_vec_dec v__942 (( 5 : int):ii) (( 5 : int):ii)  :  1 words$word)) in
               let (nzi5 : 1 bits) = ((subrange_vec_dec v__942 (( 2 : int):ii) (( 2 : int):ii)  :  1 words$word)) in
               let (nzi4 : 1 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 6 : int):ii)  :  1 words$word)) in
               (((concat_vec nzi9
                     ((concat_vec nzi87
                         ((concat_vec nzi6 ((concat_vec nzi5 nzi4  :  2 words$word))  :  3 words$word))
                        :  5 words$word))
                    :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00010w :  5 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (imm17 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (imm1612 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))))))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (nzui5 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (nzui5 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b100w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 10 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100011w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100111w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100111w :  6 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 6 : int):ii) (( 5 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b101w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))
   then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))
   then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))
   then
     sail2_state_monad$returnS T
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (nzui5 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((((concat_vec nzui5 nzui40  :  6 words$word)) <> (0b000000w :  6 words$word)))) /\ ((((((rsd <> zreg))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word)))))))))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rd <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               ((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b110w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))
   then
     sail2_state_monad$returnS T
   else if (((((((( 32 : int):ii) = (( 64 : int):ii)))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rs1 : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rs1 <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x8w :  4 words$word)))) /\ (((((subrange_vec_dec v__942 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000010w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rs1 : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rs1 <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x9w :  4 words$word)))) /\ (((((subrange_vec_dec v__942 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000010w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rs2 : regidx) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               let (rd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               ((((rd <> zreg))) /\ (((rs2 <> zreg))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x8w :  4 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if (((v__942 = (0x9002w :  16 words$word)))) then sail2_state_monad$returnS T
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (rs2 : regidx) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               ((((rsd <> zreg))) /\ (((rs2 <> zreg))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x9w :  4 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (im5 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (im40 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec im5 im40  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               (rsd <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 12 : int):ii)  :  4 words$word)) = (0x0w :  4 words$word)))) /\ (((((subrange_vec_dec v__942 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b010w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (imm17 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (imm1612 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((concat_vec imm17 imm1612  :  6 words$word)) <> (0b000000w :  6 words$word))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ ((((((((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) = (0b00000w :  5 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rs2 : regidx) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (rs2 <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 7 : int):ii)  :  9 words$word)) = (0b100000000w :  9 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rs2 : regidx) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (rs2 <> zreg)) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 7 : int):ii)  :  9 words$word)) = (0b100100000w :  9 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((let (rsd : regidx) = ((subrange_vec_dec v__942 (( 11 : int):ii) (( 7 : int):ii)  :  5 words$word)) in
               let (nzui5 : 1 bits) = ((subrange_vec_dec v__942 (( 12 : int):ii) (( 12 : int):ii)  :  1 words$word)) in
               let (nzui40 : 5 bits) = ((subrange_vec_dec v__942 (( 6 : int):ii) (( 2 : int):ii)  :  5 words$word)) in
               (((((((((concat_vec nzui5 nzui40  :  6 words$word)) = (0b000000w :  6 words$word)))) \/ (((rsd = zreg)))))) /\ (((((((( 32 : int):ii) = (( 64 : int):ii)))) \/ (((nzui5 = (0b0w :  1 words$word))))))))) /\ ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100000w :  6 words$word)))) /\ (((((subrange_vec_dec v__942 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word))))))) then
     sail2_state_monad$returnS T
   else if ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 10 : int):ii)  :  6 words$word)) = (0b100001w :  6 words$word)))) /\ (((((subrange_vec_dec v__942 (( 6 : int):ii) (( 0 : int):ii)  :  7 words$word)) = (0b0000001w :  7 words$word))))))) then
     sail2_state_monad$returnS T
   else sail2_state_monad$bindS
     (sail2_state$and_boolS
       (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
       (sail2_state_monad$returnS ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))))) (\ (w__4 : bool) . 
     if w__4 then sail2_state_monad$returnS T
     else sail2_state_monad$bindS
       (sail2_state$and_boolS
         (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
         (sail2_state_monad$returnS ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))))) (\ (w__9 : bool) . 
       if w__9 then sail2_state_monad$returnS T
       else sail2_state_monad$bindS
         (sail2_state$and_boolS
           (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
           (sail2_state_monad$returnS ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b011w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))))))))) (\ (w__14 : bool) . 
         if w__14 then sail2_state_monad$returnS T
         else sail2_state_monad$bindS
           (sail2_state$and_boolS
             (sail2_state$and_boolS (sail2_state_monad$returnS ((((( 32 : int):ii) = (( 32 : int):ii))))) (sail2_state$and_boolS ((haveRVC () )) ((haveFExt () ))))
             (sail2_state_monad$returnS ((((((((subrange_vec_dec v__942 (( 15 : int):ii) (( 13 : int):ii)  :  3 words$word)) = (0b111w :  3 words$word)))) /\ (((((subrange_vec_dec v__942 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))))))))) (\ (w__19 : bool) . 
           sail2_state_monad$returnS (if w__19 then T
                   else T)))))))`;


(*val execute_WFI : unit -> M Retired*)

val _ = Define `
 ((execute_WFI:unit ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) . 
   (case w__0 of
     Machine => sail2_state_monad$seqS (platform_wfi () ) (sail2_state_monad$returnS RETIRE_SUCCESS)
   | Supervisor => sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__1 : Mstatus) . 
      if (((((get_Mstatus_TW w__1  :  1 words$word)) = (0b1w :  1 words$word)))) then sail2_state_monad$seqS
        (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$seqS (platform_wfi () ) (sail2_state_monad$returnS RETIRE_SUCCESS))
   | User => sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
   ))))`;


(*val execute_UTYPE : mword ty20 -> mword ty5 -> uop -> M Retired*)

val _ = Define `
 ((execute_UTYPE:(20)words$word ->(5)words$word -> uop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rd op=
    (let (off : xlenbits) =
     ((EXTS (( 32 : int):ii) ((concat_vec imm (0x000w :  12 words$word)  :  32 words$word))  :  32 words$word)) in sail2_state_monad$bindS
   (case op of
     RISCV_LUI => sail2_state_monad$returnS off
   | RISCV_AUIPC => sail2_state_monad$bindS
      (get_arch_pc ()   : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      sail2_state_monad$returnS ((add_vec w__0 off  :  32 words$word)))
   ) (\ (ret : xlenbits) .  sail2_state_monad$seqS
   (wX_bits rd ret) (sail2_state_monad$returnS RETIRE_SUCCESS))))`;


(*val execute_URET : unit -> M Retired*)

val _ = Define `
 ((execute_URET:unit ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state$or_boolS ( sail2_state_monad$bindS(haveUsrMode () ) (\ (w__0 : bool) .  sail2_state_monad$returnS ((~ w__0))))
     (sail2_state_monad$returnS ((~ ((sys_enable_next () )))))) (\ (w__1 : bool) .  sail2_state_monad$seqS
   (if w__1 then handle_illegal () 
    else if ((~ ((ext_check_xret_priv User)))) then sail2_state_monad$returnS ((ext_fail_xret_priv () ))
    else sail2_state_monad$bindS
      (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__2 : Privilege) .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__3 :  32 words$word) .  sail2_state_monad$bindS
      (exception_handler w__2 (CTL_URET () ) w__3  : ( 32 words$word) M) (\ (w__4 :  32 words$word) . 
      set_next_pc w__4))))
   (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_STORE_FP : mword ty12 -> mword ty5 -> mword ty5 -> word_width -> M Retired*)

val _ = Define `
 ((execute_STORE_FP:(12)words$word ->(5)words$word ->(5)words$word -> word_width ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs2 rs1 width=
    (let (offset : xlenbits) = ((EXTS (( 32 : int):ii) imm  :  32 words$word)) in
   let (aq, rl, con) = (F, F, F) in sail2_state_monad$bindS
   (ext_data_get_addr rs1 offset (Write Data) width) (\ (w__0 : unit Ext_DataAddr_Check) . 
   (case w__0 of
     Ext_DataAddr_Error (e) =>
      let (_ : unit) = (ext_handle_data_check_error e) in
      sail2_state_monad$returnS RETIRE_FAIL
   | Ext_DataAddr_OK (vaddr) =>
      if ((check_misaligned vaddr width)) then sail2_state_monad$seqS
        (handle_mem_exception vaddr (E_SAMO_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$bindS
        (translateAddr vaddr (Write Data)  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__1 : (( 32 words$word), ExceptionType)
          TR_Result) . 
        (case w__1 of
          TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
        | TR_Address ((addr, _)) => sail2_state_monad$bindS
           (case width of
             BYTE => sail2_state_monad$returnS (MemValue () )
           | HALF => sail2_state_monad$returnS (MemValue () )
           | WORD => mem_write_ea addr (( 4 : int):ii) aq rl F
           | DOUBLE => mem_write_ea addr (( 8 : int):ii) aq rl F
           ) (\ (eares : unit MemoryOpResult) . 
           (case eares of
             MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
           | MemValue (_) => sail2_state_monad$bindS
              (rF_bits rs2  : ( 32 words$word) M) (\ rs2_val . 
              (case (width, (( 32 : int):ii)) of
                (BYTE, g__321) => sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
              | (HALF, g__322) => sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
              | (WORD, g__323) => sail2_state_monad$bindS
                 (mem_write_value addr (( 4 : int):ii)
                   ((subrange_vec_dec rs2_val (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) aq rl con) (\ (w__4 : bool
                   MemoryOpResult) . 
                 process_fstore vaddr w__4)
              | _ => sail2_state_monad$seqS
                 (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_insts_fext.sail 401:14 - 406:15")
                 (sail2_state_monad$exitS () )
              ))
           ))
        ))
   ))))`;


(*val execute_STORECON : bool -> bool -> mword ty5 -> mword ty5 -> word_width -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_STORECON:bool -> bool ->(5)words$word ->(5)words$word -> word_width ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) aq rl rs2 rs1 width rd=  (sail2_state_monad$bindS
   (speculate_conditional_success () ) (\ (w__0 : bool) . 
   if (((w__0 = F))) then sail2_state_monad$seqS
     (wX_bits rd ((EXTZ (( 32 : int):ii) (0b1w :  1 words$word)  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)
   else sail2_state_monad$bindS
     (haveAtomics () ) (\ (w__1 : bool) . 
     if w__1 then sail2_state_monad$bindS
       (ext_data_get_addr rs1 ((zeros_implicit (( 32 : int):ii)  :  32 words$word)) (Write Data) width) (\ (w__2 : unit
         Ext_DataAddr_Check) . 
       (case w__2 of
         Ext_DataAddr_Error (e) =>
          let (_ : unit) = (ext_handle_data_check_error e) in
          sail2_state_monad$returnS RETIRE_FAIL
       | Ext_DataAddr_OK (vaddr) =>
          let (aligned : bool) =
            ((case width of
              BYTE => T
            | HALF => (((subrange_vec_dec vaddr (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word))
            | WORD =>
               (((subrange_vec_dec vaddr (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))
            | DOUBLE =>
               (((subrange_vec_dec vaddr (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word))
            )) in
          if ((~ aligned)) then sail2_state_monad$seqS
            (handle_mem_exception vaddr (E_SAMO_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
          else if (((((match_reservation vaddr)) = F))) then sail2_state_monad$seqS
            (wX_bits rd ((EXTZ (( 32 : int):ii) (0b1w :  1 words$word)  :  32 words$word)))
            (let (_ : unit) = (cancel_reservation () ) in
            sail2_state_monad$returnS RETIRE_SUCCESS)
          else sail2_state_monad$bindS
            (translateAddr vaddr (Write Data)  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__3 : (( 32 words$word), ExceptionType)
              TR_Result) . 
            (case w__3 of
              TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
            | TR_Address ((addr, _)) => sail2_state_monad$bindS
               (case (width, (( 32 : int):ii)) of
                 (BYTE, _) => mem_write_ea addr (( 1 : int):ii) (((aq /\ rl))) rl T
               | (HALF, _) => mem_write_ea addr (( 2 : int):ii) (((aq /\ rl))) rl T
               | (WORD, _) => mem_write_ea addr (( 4 : int):ii) (((aq /\ rl))) rl T
               | _ => internal_error "STORECON expected word or double"
               ) (\ (eares : unit MemoryOpResult) . 
               (case eares of
                 MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
               | MemValue (_) => sail2_state_monad$bindS
                  (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val .  sail2_state_monad$bindS
                  (case (width, (( 32 : int):ii)) of
                    (BYTE, _) =>
                     mem_write_value addr (( 1 : int):ii)
                       ((subrange_vec_dec rs2_val (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)) (((aq /\ rl))) rl
                       T
                  | (HALF, _) =>
                     mem_write_value addr (( 2 : int):ii)
                       ((subrange_vec_dec rs2_val (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word)) (((aq /\ rl)))
                       rl T
                  | (WORD, _) =>
                     mem_write_value addr (( 4 : int):ii)
                       ((subrange_vec_dec rs2_val (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) (((aq /\ rl)))
                       rl T
                  | _ => internal_error "STORECON expected word or double"
                  ) (\ (res : bool MemoryOpResult) . 
                  (case res of
                    MemValue (T) => sail2_state_monad$seqS
                     (wX_bits rd ((EXTZ (( 32 : int):ii) (0b0w :  1 words$word)  :  32 words$word)))
                     (let (_ : unit) = (cancel_reservation () ) in
                     sail2_state_monad$returnS RETIRE_SUCCESS)
                  | MemValue (F) => sail2_state_monad$seqS
                     (wX_bits rd ((EXTZ (( 32 : int):ii) (0b1w :  1 words$word)  :  32 words$word)))
                     (let (_ : unit) = (cancel_reservation () ) in
                     sail2_state_monad$returnS RETIRE_SUCCESS)
                  | MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
                  )))
               ))
            ))
       ))
     else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)))))`;


(*val execute_STORE : mword ty12 -> mword ty5 -> mword ty5 -> word_width -> bool -> bool -> M Retired*)

val _ = Define `
 ((execute_STORE:(12)words$word ->(5)words$word ->(5)words$word -> word_width -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs2 rs1 width aq rl=
    (let (offset : xlenbits) = ((EXTS (( 32 : int):ii) imm  :  32 words$word)) in sail2_state_monad$bindS
   (ext_data_get_addr rs1 offset (Write Data) width) (\ (w__0 : unit Ext_DataAddr_Check) . 
   (case w__0 of
     Ext_DataAddr_Error (e) =>
      let (_ : unit) = (ext_handle_data_check_error e) in
      sail2_state_monad$returnS RETIRE_FAIL
   | Ext_DataAddr_OK (vaddr) =>
      if ((check_misaligned vaddr width)) then sail2_state_monad$seqS
        (handle_mem_exception vaddr (E_SAMO_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$bindS
        (translateAddr vaddr (Write Data)  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__1 : (( 32 words$word), ExceptionType)
          TR_Result) . 
        (case w__1 of
          TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
        | TR_Address ((paddr, _)) => sail2_state_monad$bindS
           (case width of
             BYTE => mem_write_ea paddr (( 1 : int):ii) aq rl F
           | HALF => mem_write_ea paddr (( 2 : int):ii) aq rl F
           | WORD => mem_write_ea paddr (( 4 : int):ii) aq rl F
           | DOUBLE => mem_write_ea paddr (( 8 : int):ii) aq rl F
           ) (\ (eares : unit MemoryOpResult) . 
           (case eares of
             MemException (e) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
           | MemValue (_) => sail2_state_monad$bindS
              (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val .  sail2_state_monad$bindS
              (case (width, (( 32 : int):ii)) of
                (BYTE, g__313) =>
                 mem_write_value paddr (( 1 : int):ii)
                   ((subrange_vec_dec rs2_val (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)) aq rl F
              | (HALF, g__314) =>
                 mem_write_value paddr (( 2 : int):ii)
                   ((subrange_vec_dec rs2_val (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word)) aq rl F
              | (WORD, g__315) =>
                 mem_write_value paddr (( 4 : int):ii)
                   ((subrange_vec_dec rs2_val (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) aq rl F
              | _ => sail2_state_monad$seqS
                 (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_insts_base.sail 394:47 - 399:15")
                 (sail2_state_monad$exitS () )
              ) (\ (res : bool MemoryOpResult) . 
              (case res of
                MemValue (T) => sail2_state_monad$returnS RETIRE_SUCCESS
              | MemValue (F) => internal_error "store got false from mem_write_value"
              | MemException (e) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
              )))
           ))
        ))
   ))))`;


(*val execute_SRET : unit -> M Retired*)

val _ = Define `
 ((execute_SRET:unit ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) .  sail2_state_monad$bindS
   (case w__0 of
     User => sail2_state_monad$returnS T
   | Supervisor =>
      sail2_state$or_boolS ( sail2_state_monad$bindS(haveSupMode () ) (\ (w__1 : bool) .  sail2_state_monad$returnS ((~ w__1))))
        ( sail2_state_monad$bindS(sail2_state_monad$read_regS mstatus_ref) (\ (w__2 : Mstatus) . 
         sail2_state_monad$returnS (((((get_Mstatus_TSR w__2  :  1 words$word)) = (0b1w :  1 words$word))))))
   | Machine => sail2_state_monad$bindS (haveSupMode () ) (\ (w__4 : bool) .  sail2_state_monad$returnS ((~ w__4)))
   ) (\ (sret_illegal : bool) . 
   if sret_illegal then sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
   else if ((~ ((ext_check_xret_priv Supervisor)))) then
     let (_ : unit) = (ext_fail_xret_priv () ) in
     sail2_state_monad$returnS RETIRE_FAIL
   else sail2_state_monad$bindS
     (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__5 : Privilege) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__6 :  32 words$word) .  sail2_state_monad$bindS
     (exception_handler w__5 (CTL_SRET () ) w__6  : ( 32 words$word) M) (\ (w__7 :  32 words$word) .  sail2_state_monad$seqS
     (set_next_pc w__7) (sail2_state_monad$returnS RETIRE_SUCCESS))))))))`;


(*val execute_SHIFTW : mword ty5 -> mword ty5 -> mword ty5 -> sop -> M Retired*)

val _ = Define `
 ((execute_SHIFTW:(5)words$word ->(5)words$word ->(5)words$word -> sop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) shamt rs1 rd op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let rs1_val = ((subrange_vec_dec w__0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in
   let (result : 32 bits) =
     ((case op of
       RISCV_SLLI => (shift_bits_left rs1_val shamt  :  32 words$word)
     | RISCV_SRLI => (shift_bits_right rs1_val shamt  :  32 words$word)
     | RISCV_SRAI => (shift_right_arith32 rs1_val shamt  :  32 words$word)
     )) in sail2_state_monad$seqS
   (wX_bits rd ((EXTS (( 32 : int):ii) result  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS))))`;


(*val execute_SHIFTIWOP : mword ty5 -> mword ty5 -> mword ty5 -> sopw -> M Retired*)

val _ = Define `
 ((execute_SHIFTIWOP:(5)words$word ->(5)words$word ->(5)words$word -> sopw ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) shamt rs1 rd op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val . 
   let (result : 32 bits) =
     ((case op of
       RISCV_SLLIW =>
        (shift_bits_left ((subrange_vec_dec rs1_val (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) shamt
          :  32 words$word)
     | RISCV_SRLIW =>
        (shift_bits_right ((subrange_vec_dec rs1_val (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) shamt
          :  32 words$word)
     | RISCV_SRAIW =>
        (shift_right_arith32 ((subrange_vec_dec rs1_val (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) shamt
          :  32 words$word)
     )) in sail2_state_monad$seqS
   (wX_bits rd ((EXTS (( 32 : int):ii) result  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS))))`;


(*val execute_SHIFTIOP : mword ty6 -> mword ty5 -> mword ty5 -> sop -> M Retired*)

val _ = Define `
 ((execute_SHIFTIOP:(6)words$word ->(5)words$word ->(5)words$word -> sop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) shamt rs1 rd op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val . 
   let (result : xlenbits) =
     ((case op of
       RISCV_SLLI =>
        (shift_bits_left rs1_val ((subrange_vec_dec shamt (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))  :  32 words$word)
     | RISCV_SRLI =>
        (shift_bits_right rs1_val ((subrange_vec_dec shamt (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     | RISCV_SRAI =>
        (shift_right_arith32 rs1_val ((subrange_vec_dec shamt (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     )) in sail2_state_monad$seqS
   (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS))))`;


(*val execute_SFENCE_VMA : mword ty5 -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_SFENCE_VMA:(5)words$word ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs1 rs2=  (sail2_state_monad$bindS
   (if (((rs1 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS NONE
    else sail2_state_monad$bindS (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$returnS (SOME w__0))) (\ (addr :
      xlenbits option) .  sail2_state_monad$bindS
   (if (((rs2 = (0b00000w :  5 words$word)))) then sail2_state_monad$returnS NONE
    else sail2_state_monad$bindS (rX_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) .  sail2_state_monad$returnS (SOME w__1))) (\ (asid :
      xlenbits option) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__2 : Privilege) . 
   (case w__2 of
     User => sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
   | Supervisor => sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__3 : Mstatus) .  sail2_state_monad$bindS
      (sail2_state_monad$read_regS mstatus_ref) (\ (w__4 : Mstatus) . 
      let p__317 =
        (architecture ((get_mstatus_SXL w__3  :  2 words$word)), (get_Mstatus_TVM w__4  :  1 words$word)) in
      (case p__317 of
        (SOME (g__316), b__0) =>
         if (((b__0 = (0b1w :  1 words$word)))) then sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
         else if (((b__0 = (0b0w :  1 words$word)))) then sail2_state_monad$seqS (flush_TLB asid addr) (sail2_state_monad$returnS RETIRE_SUCCESS)
         else
           (case (SOME g__316, b__0) of
             (_, _) => internal_error "unimplemented sfence architecture"
           )
      | (_, _) => internal_error "unimplemented sfence architecture"
      )))
   | Machine => sail2_state_monad$seqS (flush_TLB asid addr) (sail2_state_monad$returnS RETIRE_SUCCESS)
   ))))))`;


(*val execute_RTYPEW : mword ty5 -> mword ty5 -> mword ty5 -> ropw -> M Retired*)

val _ = Define `
 ((execute_RTYPEW:(5)words$word ->(5)words$word ->(5)words$word -> ropw ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let rs1_val = ((subrange_vec_dec w__0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
   (rX_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
   let rs2_val = ((subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in
   let (result : 32 bits) =
     ((case op of
       RISCV_ADDW => (add_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_SUBW => (sub_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_SLLW =>
        (shift_bits_left rs1_val ((subrange_vec_dec rs2_val (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     | RISCV_SRLW =>
        (shift_bits_right rs1_val ((subrange_vec_dec rs2_val (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     | RISCV_SRAW =>
        (shift_right_arith32 rs1_val ((subrange_vec_dec rs2_val (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     )) in sail2_state_monad$seqS
   (wX_bits rd ((EXTS (( 32 : int):ii) result  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)))))`;


(*val execute_RTYPE : mword ty5 -> mword ty5 -> mword ty5 -> rop -> M Retired*)

val _ = Define `
 ((execute_RTYPE:(5)words$word ->(5)words$word ->(5)words$word -> rop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val .  sail2_state_monad$bindS
   (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val . 
   let (result : xlenbits) =
     ((case op of
       RISCV_ADD => (add_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_SLT =>
        (EXTZ (( 32 : int):ii) ((bool_to_bits ((zopz0zI_s rs1_val rs2_val))  :  1 words$word))  :  32 words$word)
     | RISCV_SLTU =>
        (EXTZ (( 32 : int):ii) ((bool_to_bits ((zopz0zI_u rs1_val rs2_val))  :  1 words$word))  :  32 words$word)
     | RISCV_AND => (and_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_OR => (or_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_XOR => (xor_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_SLL =>
        (shift_bits_left rs1_val ((subrange_vec_dec rs2_val (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     | RISCV_SRL =>
        (shift_bits_right rs1_val ((subrange_vec_dec rs2_val (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     | RISCV_SUB => (sub_vec rs1_val rs2_val  :  32 words$word)
     | RISCV_SRA =>
        (shift_right_arith32 rs1_val ((subrange_vec_dec rs2_val (( 4 : int):ii) (( 0 : int):ii)  :  5 words$word))
          :  32 words$word)
     )) in sail2_state_monad$seqS
   (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS)))))`;


(*val execute_RISCV_JALR : mword ty12 -> mword ty5 -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_RISCV_JALR:(12)words$word ->(5)words$word ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs1 rd=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let (t : xlenbits) = ((add_vec w__0 ((EXTS (( 32 : int):ii) imm  :  32 words$word))  :  32 words$word)) in
   (case ((ext_control_check_addr t)) of
     Ext_ControlAddr_Error (e) =>
      let (_ : unit) = (ext_handle_control_check_error e) in
      sail2_state_monad$returnS RETIRE_FAIL
   | Ext_ControlAddr_OK (addr) =>
      let target = ((update_vec_dec addr (( 0 : int):ii) B0  :  32 words$word)) in sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((bit_to_bool ((access_vec_dec target (( 1 : int):ii))))))
        ( sail2_state_monad$bindS(haveRVC () ) (\ (w__1 : bool) .  sail2_state_monad$returnS ((~ w__1))))) (\ (w__2 : bool) . 
      if w__2 then sail2_state_monad$seqS (handle_mem_exception target (E_Fetch_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$bindS
        (get_next_pc ()   : ( 32 words$word) M) (\ (w__3 :  32 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS
        (wX_bits rd w__3) (set_next_pc target)) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   ))))`;


(*val execute_RISCV_JAL : mword ty21 -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_RISCV_JAL:(21)words$word ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rd=  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let (t : xlenbits) = ((add_vec w__0 ((EXTS (( 32 : int):ii) imm  :  32 words$word))  :  32 words$word)) in
   (case ((ext_control_check_pc t)) of
     Ext_ControlAddr_Error (e) =>
      let (_ : unit) = (ext_handle_control_check_error e) in
      sail2_state_monad$returnS RETIRE_FAIL
   | Ext_ControlAddr_OK (target) => sail2_state_monad$bindS
      (sail2_state$and_boolS (sail2_state_monad$returnS ((bit_to_bool ((access_vec_dec target (( 1 : int):ii))))))
        ( sail2_state_monad$bindS(haveRVC () ) (\ (w__1 : bool) .  sail2_state_monad$returnS ((~ w__1))))) (\ (w__2 : bool) . 
      if w__2 then sail2_state_monad$seqS (handle_mem_exception target (E_Fetch_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$bindS
        (get_next_pc ()   : ( 32 words$word) M) (\ (w__3 :  32 words$word) .  sail2_state_monad$seqS (sail2_state_monad$seqS
        (wX_bits rd w__3) (set_next_pc target)) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   ))))`;


(*val execute_REMW : mword ty5 -> mword ty5 -> mword ty5 -> bool -> M Retired*)

val _ = Define `
 ((execute_REMW:(5)words$word ->(5)words$word ->(5)words$word -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd s=  (sail2_state_monad$bindS
   (haveMulDiv () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (rX_bits rs1  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
     let rs1_val = ((subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
     (rX_bits rs2  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
     let rs2_val = ((subrange_vec_dec w__2 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in
     let (rs1_int : ii) = (if s then integer_word$w2i rs1_val else lem$w2ui rs1_val) in
     let (rs2_int : ii) = (if s then integer_word$w2i rs2_val else lem$w2ui rs2_val) in
     let (r : ii) = (if (((rs2_int = (( 0 : int):ii)))) then rs1_int else hardware_mod rs1_int rs2_int) in sail2_state_monad$seqS
     (wX_bits rd ((EXTS (( 32 : int):ii) ((to_bits (( 32 : int):ii) r  :  32 words$word))  :  32 words$word)))
     (sail2_state_monad$returnS RETIRE_SUCCESS)))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_REM : mword ty5 -> mword ty5 -> mword ty5 -> bool -> M Retired*)

val _ = Define `
 ((execute_REM:(5)words$word ->(5)words$word ->(5)words$word -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd s=  (sail2_state_monad$bindS
   (haveMulDiv () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val .  sail2_state_monad$bindS
     (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val . 
     let (rs1_int : ii) = (if s then integer_word$w2i rs1_val else lem$w2ui rs1_val) in
     let (rs2_int : ii) = (if s then integer_word$w2i rs2_val else lem$w2ui rs2_val) in
     let (r : ii) = (if (((rs2_int = (( 0 : int):ii)))) then rs1_int else hardware_mod rs1_int rs2_int) in sail2_state_monad$seqS
     (wX_bits rd ((to_bits (( 32 : int):ii) r  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_MULW : mword ty5 -> mword ty5 -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_MULW:(5)words$word ->(5)words$word ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd=  (sail2_state_monad$bindS
   (haveMulDiv () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (rX_bits rs1  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
     let rs1_val = ((subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
     (rX_bits rs2  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
     let rs2_val = ((subrange_vec_dec w__2 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in
     let (rs1_int : ii) = (integer_word$w2i rs1_val) in
     let (rs2_int : ii) = (integer_word$w2i rs2_val) in
     let result32 =
       ((subrange_vec_dec ((to_bits (( 64 : int):ii) ((rs1_int * rs2_int))  :  64 words$word)) (( 31 : int):ii)
          (( 0 : int):ii)
         :  32 words$word)) in
     let (result : xlenbits) = ((EXTS (( 32 : int):ii) result32  :  32 words$word)) in sail2_state_monad$seqS
     (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_MUL : mword ty5 -> mword ty5 -> mword ty5 -> bool -> bool -> bool -> M Retired*)

val _ = Define `
 ((execute_MUL:(5)words$word ->(5)words$word ->(5)words$word -> bool -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd high signed1 signed2=  (sail2_state_monad$bindS
   (haveMulDiv () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val .  sail2_state_monad$bindS
     (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val . 
     let (rs1_int : ii) = (if signed1 then integer_word$w2i rs1_val else lem$w2ui rs1_val) in
     let (rs2_int : ii) = (if signed2 then integer_word$w2i rs2_val else lem$w2ui rs2_val) in
     let result_wide =
       ((to_bits (((( 2 : int):ii) * (( 32 : int):ii))) ((rs1_int * rs2_int))  :  64 words$word)) in
     let result =
       (if high then
         (subrange_vec_dec result_wide (((((( 2 : int):ii) * (( 32 : int):ii))) - (( 1 : int):ii)))
            (( 32 : int):ii)
           :  32 words$word)
       else (subrange_vec_dec result_wide (((( 32 : int):ii) - (( 1 : int):ii))) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$seqS
     (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_MRET : unit -> M Retired*)

val _ = Define `
 ((execute_MRET:unit ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) . 
   if (((w__0 <> Machine))) then sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
   else if ((~ ((ext_check_xret_priv Machine)))) then
     let (_ : unit) = (ext_fail_xret_priv () ) in
     sail2_state_monad$returnS RETIRE_FAIL
   else sail2_state_monad$bindS
     (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
     (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__2 :  32 words$word) .  sail2_state_monad$bindS
     (exception_handler w__1 (CTL_MRET () ) w__2  : ( 32 words$word) M) (\ (w__3 :  32 words$word) .  sail2_state_monad$seqS
     (set_next_pc w__3) (sail2_state_monad$returnS RETIRE_SUCCESS)))))))`;


(*val execute_LOAD_FP : mword ty12 -> mword ty5 -> mword ty5 -> word_width -> M Retired*)

val _ = Define `
 ((execute_LOAD_FP:(12)words$word ->(5)words$word ->(5)words$word -> word_width ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs1 rd width=
    (let (offset : xlenbits) = ((EXTS (( 32 : int):ii) imm  :  32 words$word)) in sail2_state_monad$bindS
   (ext_data_get_addr rs1 offset (Read Data) width) (\ (w__0 : unit Ext_DataAddr_Check) . 
   (case w__0 of
     Ext_DataAddr_Error (e) =>
      let (_ : unit) = (ext_handle_data_check_error e) in
      sail2_state_monad$returnS RETIRE_FAIL
   | Ext_DataAddr_OK (vaddr) =>
      if ((check_misaligned vaddr width)) then sail2_state_monad$seqS
        (handle_mem_exception vaddr (E_Load_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$bindS
        (translateAddr vaddr (Read Data)  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__1 : (( 32 words$word), ExceptionType)
          TR_Result) . 
        (case w__1 of
          TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
        | TR_Address ((addr, _)) =>
           let (aq, rl, res) = (F, F, F) in
           (case (width, (( 32 : int):ii)) of
             (BYTE, g__318) => sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
           | (HALF, g__319) => sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
           | (WORD, g__320) => sail2_state_monad$bindS
              (mem_read (Read Data) addr (( 4 : int):ii) aq rl res  : ( ( 32 words$word)MemoryOpResult) M) (\ (w__2 : ( 32 words$word)
                MemoryOpResult) . 
              process_fload32 rd vaddr w__2)
           | _ => sail2_state_monad$seqS
              (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_insts_fext.sail 331:10 - 338:11")
              (sail2_state_monad$exitS () )
           )
        ))
   ))))`;


(*val execute_LOADRES : bool -> bool -> mword ty5 -> word_width -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_LOADRES:bool -> bool ->(5)words$word -> word_width ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) aq rl rs1 width rd=  (sail2_state_monad$bindS
   (haveAtomics () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (ext_data_get_addr rs1 ((zeros_implicit (( 32 : int):ii)  :  32 words$word)) (Read Data) width) (\ (w__1 : unit
       Ext_DataAddr_Check) . 
     (case w__1 of
       Ext_DataAddr_Error (e) =>
        let (_ : unit) = (ext_handle_data_check_error e) in
        sail2_state_monad$returnS RETIRE_FAIL
     | Ext_DataAddr_OK (vaddr) =>
        let (aligned : bool) =
          ((case width of
            BYTE => T
          | HALF => (((subrange_vec_dec vaddr (( 0 : int):ii) (( 0 : int):ii)  :  1 words$word)) = (0b0w :  1 words$word))
          | WORD => (((subrange_vec_dec vaddr (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))
          | DOUBLE =>
             (((subrange_vec_dec vaddr (( 2 : int):ii) (( 0 : int):ii)  :  3 words$word)) = (0b000w :  3 words$word))
          )) in
        if ((~ aligned)) then sail2_state_monad$seqS
          (handle_mem_exception vaddr (E_Load_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
        else sail2_state_monad$bindS
          (translateAddr vaddr (Read Data)  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__2 : (( 32 words$word), ExceptionType)
            TR_Result) . 
          (case w__2 of
            TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
          | TR_Address ((addr, _)) =>
             (case (width, (( 32 : int):ii)) of
               (BYTE, _) => sail2_state_monad$bindS
                (mem_read (Read Data) addr (( 1 : int):ii) aq (((aq /\ rl))) T
                  : ( ( 8 words$word)MemoryOpResult) M) (\ (w__3 : ( 8 words$word) MemoryOpResult) . 
                process_loadres rd vaddr w__3 F)
             | (HALF, _) => sail2_state_monad$bindS
                (mem_read (Read Data) addr (( 2 : int):ii) aq (((aq /\ rl))) T
                  : ( ( 16 words$word)MemoryOpResult) M) (\ (w__5 : ( 16 words$word) MemoryOpResult) . 
                process_loadres rd vaddr w__5 F)
             | (WORD, _) => sail2_state_monad$bindS
                (mem_read (Read Data) addr (( 4 : int):ii) aq (((aq /\ rl))) T
                  : ( ( 32 words$word)MemoryOpResult) M) (\ (w__7 : ( 32 words$word) MemoryOpResult) . 
                process_loadres rd vaddr w__7 F)
             | _ => internal_error "Unexpected AMO width"
             )
          ))
     ))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_LOAD : mword ty12 -> mword ty5 -> mword ty5 -> bool -> word_width -> bool -> bool -> M Retired*)

val _ = Define `
 ((execute_LOAD:(12)words$word ->(5)words$word ->(5)words$word -> bool -> word_width -> bool -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs1 rd is_unsigned width aq rl=
    (let (offset : xlenbits) = ((EXTS (( 32 : int):ii) imm  :  32 words$word)) in sail2_state_monad$bindS
   (ext_data_get_addr rs1 offset (Read Data) width) (\ (w__0 : unit Ext_DataAddr_Check) . 
   (case w__0 of
     Ext_DataAddr_Error (e) =>
      let (_ : unit) = (ext_handle_data_check_error e) in
      sail2_state_monad$returnS RETIRE_FAIL
   | Ext_DataAddr_OK (vaddr) =>
      if ((check_misaligned vaddr width)) then sail2_state_monad$seqS
        (handle_mem_exception vaddr (E_Load_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
      else sail2_state_monad$bindS
        (translateAddr vaddr (Read Data)  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__1 : (( 32 words$word), ExceptionType)
          TR_Result) . 
        (case w__1 of
          TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
        | TR_Address ((paddr, _)) =>
           (case (width, (( 32 : int):ii)) of
             (BYTE, g__310) => sail2_state_monad$bindS
              (mem_read (Read Data) paddr (( 1 : int):ii) aq rl F  : ( ( 8 words$word)MemoryOpResult) M) (\ (w__2 : ( 8 words$word)
                MemoryOpResult) . 
              process_load rd vaddr w__2 is_unsigned)
           | (HALF, g__311) => sail2_state_monad$bindS
              (mem_read (Read Data) paddr (( 2 : int):ii) aq rl F  : ( ( 16 words$word)MemoryOpResult) M) (\ (w__4 : ( 16 words$word)
                MemoryOpResult) . 
              process_load rd vaddr w__4 is_unsigned)
           | (WORD, g__312) => sail2_state_monad$bindS
              (mem_read (Read Data) paddr (( 4 : int):ii) aq rl F  : ( ( 32 words$word)MemoryOpResult) M) (\ (w__6 : ( 32 words$word)
                MemoryOpResult) . 
              process_load rd vaddr w__6 is_unsigned)
           | _ => sail2_state_monad$seqS
              (sail2_state_monad$assert_expS F "Pattern match failure at model/riscv_insts_base.sail 329:10 - 338:11")
              (sail2_state_monad$exitS () )
           )
        ))
   ))))`;


(*val execute_ITYPE : mword ty12 -> mword ty5 -> mword ty5 -> iop -> M Retired*)

val _ = Define `
 ((execute_ITYPE:(12)words$word ->(5)words$word ->(5)words$word -> iop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs1 rd op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val . 
   let (immext : xlenbits) = ((EXTS (( 32 : int):ii) imm  :  32 words$word)) in
   let (result : xlenbits) =
     ((case op of
       RISCV_ADDI => (add_vec rs1_val immext  :  32 words$word)
     | RISCV_SLTI =>
        (EXTZ (( 32 : int):ii) ((bool_to_bits ((zopz0zI_s rs1_val immext))  :  1 words$word))  :  32 words$word)
     | RISCV_SLTIU =>
        (EXTZ (( 32 : int):ii) ((bool_to_bits ((zopz0zI_u rs1_val immext))  :  1 words$word))  :  32 words$word)
     | RISCV_ANDI => (and_vec rs1_val immext  :  32 words$word)
     | RISCV_ORI => (or_vec rs1_val immext  :  32 words$word)
     | RISCV_XORI => (xor_vec rs1_val immext  :  32 words$word)
     )) in sail2_state_monad$seqS
   (wX_bits rd result) (sail2_state_monad$returnS RETIRE_SUCCESS))))`;


(*val execute_ILLEGAL : mword ty32 -> M Retired*)

val _ = Define `
 ((execute_ILLEGAL:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=  (sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)))`;


(*val execute_F_UN_TYPE_S : mword ty5 -> mword ty5 -> f_un_op_S -> M Retired*)

val _ = Define `
 ((execute_F_UN_TYPE_S:(5)words$word ->(5)words$word -> f_un_op_S ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg0 arg1 arg2=
    (let merge_var = (arg0, arg1, arg2) in
   (case merge_var of
     (rs1, rd, FCLASS_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in
      let (rd_val_10b : 10 bits) =
        (if ((f_is_neg_inf_S rs1_val_S)) then (0b0000000001w :  10 words$word)
        else if ((f_is_neg_norm_S rs1_val_S)) then (0b0000000010w :  10 words$word)
        else if ((f_is_neg_subnorm_S rs1_val_S)) then (0b0000000100w :  10 words$word)
        else if ((f_is_neg_zero_S rs1_val_S)) then (0b0000001000w :  10 words$word)
        else if ((f_is_pos_zero_S rs1_val_S)) then (0b0000010000w :  10 words$word)
        else if ((f_is_pos_subnorm_S rs1_val_S)) then (0b0000100000w :  10 words$word)
        else if ((f_is_pos_norm_S rs1_val_S)) then (0b0001000000w :  10 words$word)
        else if ((f_is_pos_inf_S rs1_val_S)) then (0b0010000000w :  10 words$word)
        else if ((f_is_SNaN_S rs1_val_S)) then (0b0100000000w :  10 words$word)
        else if ((f_is_QNaN_S rs1_val_S)) then (0b1000000000w :  10 words$word)
        else (zeros_implicit (( 10 : int):ii)  :  10 words$word)) in sail2_state_monad$seqS
      (wX_bits rd ((EXTZ (( 32 : int):ii) rd_val_10b  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS))
   | (rs1, rd, FMV_X_W) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((subrange_vec_dec w__0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in
      let (rd_val_X : xlenbits) = ((EXTS (( 32 : int):ii) rs1_val_S  :  32 words$word)) in sail2_state_monad$seqS
      (wX_bits rd rd_val_X) (sail2_state_monad$returnS RETIRE_SUCCESS))
   | (rs1, rd, FMV_W_X) => sail2_state_monad$bindS
      (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val_X . 
      let rd_val_S = ((subrange_vec_dec rs1_val_X (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$seqS
      (wF_bits rd ((nan_box rd_val_S  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS))
   )))`;


(*val execute_F_UN_RM_TYPE_S : mword ty5 -> rounding_mode -> mword ty5 -> f_un_rm_op_S -> M Retired*)

val _ = Define `
 ((execute_F_UN_RM_TYPE_S:(5)words$word -> rounding_mode ->(5)words$word -> f_un_rm_op_S ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg0 arg1 arg2 arg3=
    (let merge_var = (arg0, arg1, arg2, arg3) in
   (case merge_var of
     (rs1, rm, rd, FSQRT_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (select_instr_or_fcsr_rm rm) (\ (w__1 : rounding_mode) . 
      let rm_3b = ((encdec_rounding_mode_forwards w__1  :  3 words$word)) in sail2_state_monad$bindS
      (riscv_f32Sqrt rm_3b rs1_val_S  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let (fflags, rd_val_S) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags) (wF_bits rd ((nan_box rd_val_S  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs1, rm, rd, FCVT_W_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (select_instr_or_fcsr_rm rm) (\ (w__1 : rounding_mode) . 
      let rm_3b = ((encdec_rounding_mode_forwards w__1  :  3 words$word)) in sail2_state_monad$bindS
      (riscv_f32ToI32 rm_3b rs1_val_S  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let (fflags, rd_val_W) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags)
      (wX_bits rd ((EXTS (( 32 : int):ii) rd_val_W  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs1, rm, rd, FCVT_WU_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (select_instr_or_fcsr_rm rm) (\ (w__1 : rounding_mode) . 
      let rm_3b = ((encdec_rounding_mode_forwards w__1  :  3 words$word)) in sail2_state_monad$bindS
      (riscv_f32ToUi32 rm_3b rs1_val_S  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let (fflags, rd_val_WU) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags)
      (wX_bits rd ((EXTS (( 32 : int):ii) rd_val_WU  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs1, rm, rd, FCVT_S_W) => sail2_state_monad$bindS
      (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_W = ((subrange_vec_dec w__0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
      (select_instr_or_fcsr_rm rm) (\ (w__1 : rounding_mode) . 
      let rm_3b = ((encdec_rounding_mode_forwards w__1  :  3 words$word)) in sail2_state_monad$bindS
      (riscv_i32ToF32 rm_3b rs1_val_W  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let (fflags, rd_val_S) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags) (wF_bits rd ((nan_box rd_val_S  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs1, rm, rd, FCVT_S_WU) => sail2_state_monad$bindS
      (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_WU = ((subrange_vec_dec w__0 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
      (select_instr_or_fcsr_rm rm) (\ (w__1 : rounding_mode) . 
      let rm_3b = ((encdec_rounding_mode_forwards w__1  :  3 words$word)) in sail2_state_monad$bindS
      (riscv_ui32ToF32 rm_3b rs1_val_WU  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let (fflags, rd_val_S) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags) (wF_bits rd ((nan_box rd_val_S  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs1, rm, rd, FCVT_L_S) => sail2_state_monad$returnS RETIRE_FAIL
   | (rs1, rm, rd, FCVT_LU_S) => sail2_state_monad$returnS RETIRE_FAIL
   | (rs1, rm, rd, FCVT_S_L) => sail2_state_monad$returnS RETIRE_FAIL
   | (rs1, rm, rd, FCVT_S_LU) => sail2_state_monad$returnS RETIRE_FAIL
   )))`;


(*val execute_F_MADD_TYPE_S : mword ty5 -> mword ty5 -> mword ty5 -> rounding_mode -> mword ty5 -> f_madd_op_S -> M Retired*)

val _ = Define `
 ((execute_F_MADD_TYPE_S:(5)words$word ->(5)words$word ->(5)words$word -> rounding_mode ->(5)words$word -> f_madd_op_S ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs3 rs2 rs1 rm rd op=  (sail2_state_monad$bindS
   (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let rs1_val_32b = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
   (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
   let rs2_val_32b = ((nan_unbox w__1  :  32 words$word)) in sail2_state_monad$bindS
   (rF_bits rs3  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
   let rs3_val_32b = ((nan_unbox w__2  :  32 words$word)) in sail2_state_monad$bindS
   (select_instr_or_fcsr_rm rm) (\ (w__3 : rounding_mode) . 
   let rm_3b = ((encdec_rounding_mode_forwards w__3  :  3 words$word)) in sail2_state_monad$bindS
   (case op of
     FMADD_S =>
      (riscv_f32MulAdd rm_3b rs1_val_32b rs2_val_32b rs3_val_32b  : (( 5 words$word #  32 words$word)) M)
   | FMSUB_S =>
      (riscv_f32MulAdd rm_3b rs1_val_32b rs2_val_32b ((negate_S rs3_val_32b  :  32 words$word))
        : (( 5 words$word #  32 words$word)) M)
   | FNMSUB_S =>
      (riscv_f32MulAdd rm_3b ((negate_S rs1_val_32b  :  32 words$word)) rs2_val_32b rs3_val_32b
        : (( 5 words$word #  32 words$word)) M)
   | FNMADD_S =>
      (riscv_f32MulAdd rm_3b ((negate_S rs1_val_32b  :  32 words$word)) rs2_val_32b
         ((negate_S rs3_val_32b  :  32 words$word))
        : (( 5 words$word #  32 words$word)) M)
   ) (\ varstup .  let ((fflags : 5 bits), (rd_val_32b : 32 bits)) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
   (write_fflags fflags) (wF_bits rd ((nan_box rd_val_32b  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))))))`;


(*val execute_F_BIN_TYPE_S : mword ty5 -> mword ty5 -> mword ty5 -> f_bin_op_S -> M Retired*)

val _ = Define `
 ((execute_F_BIN_TYPE_S:(5)words$word ->(5)words$word ->(5)words$word -> f_bin_op_S ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg0 arg1 arg2 arg3=
    (let merge_var = (arg0, arg1, arg2, arg3) in
   (case merge_var of
     (rs2, rs1, rd, FSGNJ_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in
      let (s1, e1, m1) = ((fsplit_S rs1_val_S  : ( 1 words$word #  8 words$word #  23 words$word))) in
      let (s2, e2, m2) = ((fsplit_S rs2_val_S  : ( 1 words$word #  8 words$word #  23 words$word))) in
      let rd_val_S = ((fmake_S s2 e1 m1  :  32 words$word)) in sail2_state_monad$seqS
      (wF_bits rd ((nan_box rd_val_S  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   | (rs2, rs1, rd, FSGNJN_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in
      let (s1, e1, m1) = ((fsplit_S rs1_val_S  : ( 1 words$word #  8 words$word #  23 words$word))) in
      let (s2, e2, m2) = ((fsplit_S rs2_val_S  : ( 1 words$word #  8 words$word #  23 words$word))) in
      let rd_val_S = ((fmake_S ((xor_vec (0b1w :  1 words$word) s2  :  1 words$word)) e1 m1  :  32 words$word)) in sail2_state_monad$seqS
      (wF_bits rd ((nan_box rd_val_S  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   | (rs2, rs1, rd, FSGNJX_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in
      let (s1, e1, m1) = ((fsplit_S rs1_val_S  : ( 1 words$word #  8 words$word #  23 words$word))) in
      let (s2, e2, m2) = ((fsplit_S rs2_val_S  : ( 1 words$word #  8 words$word #  23 words$word))) in
      let rd_val_S = ((fmake_S ((xor_vec s1 s2  :  1 words$word)) e1 m1  :  32 words$word)) in sail2_state_monad$seqS
      (wF_bits rd ((nan_box rd_val_S  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   | (rs2, rs1, rd, FMIN_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in
      let is_quiet = T in
      let (rs1_lt_rs2, fflags) = ((fle_S rs1_val_S rs2_val_S is_quiet  : (bool #  5 words$word))) in
      let rd_val_S =
        (if (((((f_is_NaN_S rs1_val_S)) /\ ((f_is_NaN_S rs2_val_S))))) then
          (canonical_NaN_S ()   :  32 words$word)
        else if ((f_is_NaN_S rs1_val_S)) then rs2_val_S
        else if ((f_is_NaN_S rs2_val_S)) then rs1_val_S
        else if (((((f_is_neg_zero_S rs1_val_S)) /\ ((f_is_pos_zero_S rs2_val_S))))) then
          rs1_val_S
        else if (((((f_is_neg_zero_S rs2_val_S)) /\ ((f_is_pos_zero_S rs1_val_S))))) then
          rs2_val_S
        else if rs1_lt_rs2 then rs1_val_S
        else rs2_val_S) in sail2_state_monad$seqS (sail2_state_monad$seqS
      (accrue_fflags fflags) (wF_bits rd ((nan_box rd_val_S  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   | (rs2, rs1, rd, FMAX_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in
      let is_quiet = T in
      let (rs2_lt_rs1, fflags) = ((fle_S rs2_val_S rs1_val_S is_quiet  : (bool #  5 words$word))) in
      let rd_val_S =
        (if (((((f_is_NaN_S rs1_val_S)) /\ ((f_is_NaN_S rs2_val_S))))) then
          (canonical_NaN_S ()   :  32 words$word)
        else if ((f_is_NaN_S rs1_val_S)) then rs2_val_S
        else if ((f_is_NaN_S rs2_val_S)) then rs1_val_S
        else if (((((f_is_neg_zero_S rs1_val_S)) /\ ((f_is_pos_zero_S rs2_val_S))))) then
          rs2_val_S
        else if (((((f_is_neg_zero_S rs2_val_S)) /\ ((f_is_pos_zero_S rs1_val_S))))) then
          rs1_val_S
        else if rs2_lt_rs1 then rs1_val_S
        else rs2_val_S) in sail2_state_monad$seqS (sail2_state_monad$seqS
      (accrue_fflags fflags) (wF_bits rd ((nan_box rd_val_S  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   | (rs2, rs1, rd, FEQ_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in sail2_state_monad$bindS
      (riscv_f32Eq rs1_val_S rs2_val_S  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let ((fflags :
        bits_fflags), (rd_val : bits_WU)) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags)
      (wX_bits rd ((EXTZ (( 32 : int):ii) rd_val  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs2, rs1, rd, FLT_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in sail2_state_monad$bindS
      (riscv_f32Lt rs1_val_S rs2_val_S  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let ((fflags :
        bits_fflags), (rd_val : bits_WU)) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags)
      (wX_bits rd ((EXTZ (( 32 : int):ii) rd_val  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   | (rs2, rs1, rd, FLE_S) => sail2_state_monad$bindS
      (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
      let rs1_val_S = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
      (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
      let rs2_val_S = ((nan_unbox w__1  :  32 words$word)) in sail2_state_monad$bindS
      (riscv_f32Le rs1_val_S rs2_val_S  : (( 5 words$word #  32 words$word)) M) (\ varstup .  let ((fflags :
        bits_fflags), (rd_val : bits_WU)) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
      (write_fflags fflags)
      (wX_bits rd ((EXTZ (( 32 : int):ii) rd_val  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS))))
   )))`;


(*val execute_F_BIN_RM_TYPE_S : mword ty5 -> mword ty5 -> rounding_mode -> mword ty5 -> f_bin_rm_op_S -> M Retired*)

val _ = Define `
 ((execute_F_BIN_RM_TYPE_S:(5)words$word ->(5)words$word -> rounding_mode ->(5)words$word -> f_bin_rm_op_S ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rm rd op=  (sail2_state_monad$bindS
   (rF_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let rs1_val_32b = ((nan_unbox w__0  :  32 words$word)) in sail2_state_monad$bindS
   (rF_bits rs2  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
   let rs2_val_32b = ((nan_unbox w__1  :  32 words$word)) in sail2_state_monad$bindS
   (select_instr_or_fcsr_rm rm) (\ (w__2 : rounding_mode) . 
   let rm_3b = ((encdec_rounding_mode_forwards w__2  :  3 words$word)) in sail2_state_monad$bindS
   (case op of
     FADD_S => (riscv_f32Add rm_3b rs1_val_32b rs2_val_32b  : (( 5 words$word #  32 words$word)) M)
   | FSUB_S => (riscv_f32Sub rm_3b rs1_val_32b rs2_val_32b  : (( 5 words$word #  32 words$word)) M)
   | FMUL_S => (riscv_f32Mul rm_3b rs1_val_32b rs2_val_32b  : (( 5 words$word #  32 words$word)) M)
   | FDIV_S => (riscv_f32Div rm_3b rs1_val_32b rs2_val_32b  : (( 5 words$word #  32 words$word)) M)
   ) (\ varstup .  let ((fflags : 5 bits), (rd_val_32b : 32 bits)) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
   (write_fflags fflags) (wF_bits rd ((nan_box rd_val_32b  :  32 words$word)))) (sail2_state_monad$returnS RETIRE_SUCCESS)))))))`;


(*val execute_FENCE_TSO : mword ty4 -> mword ty4 -> M Retired*)

val _ = Define `
 ((execute_FENCE_TSO:(4)words$word ->(4)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) pred succ=  (sail2_state_monad$seqS
   (case (pred, succ) of
     (v__1172, v__1173) =>
      if ((((((((subrange_vec_dec v__1172 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__1173 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))))))
      then
        barrier (Barrier_RISCV_tso () )
      else
        sail2_state_monad$returnS (if ((((((((subrange_vec_dec v__1172 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) /\ (((((subrange_vec_dec v__1173 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word))))))) then
                  () 
                else
                  let (_ : unit) = (print_endline "FIXME: unsupported fence") in
                  () )
   )
   (sail2_state_monad$returnS RETIRE_SUCCESS)))`;


(*val execute_FENCE_RESERVED : mword ty4 -> mword ty4 -> mword ty4 -> mword ty5 -> mword ty5 -> Retired*)

val _ = Define `
 ((execute_FENCE_RESERVED:(4)words$word ->(4)words$word ->(4)words$word ->(5)words$word ->(5)words$word -> Retired) fm pred succ rs rd=  RETIRE_SUCCESS)`;


(*val execute_FENCEI_RESERVED : mword ty12 -> mword ty5 -> mword ty5 -> Retired*)

val _ = Define `
 ((execute_FENCEI_RESERVED:(12)words$word ->(5)words$word ->(5)words$word -> Retired) imm rs rd=  RETIRE_SUCCESS)`;


(*val execute_FENCEI : unit -> Retired*)

val _ = Define `
 ((execute_FENCEI:unit -> Retired) () =  RETIRE_SUCCESS)`;


(*val execute_FENCE : mword ty4 -> mword ty4 -> M Retired*)

val _ = Define `
 ((execute_FENCE:(4)words$word ->(4)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) pred succ=  (sail2_state_monad$seqS
   (case (pred, succ) of
     (v__1132, v__1133) =>
      if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))))))
      then
        barrier (Barrier_RISCV_rw_rw () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word))))))) then
        barrier (Barrier_RISCV_r_rw () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))) then
        barrier (Barrier_RISCV_r_r () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))) then
        barrier (Barrier_RISCV_rw_w () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))) then
        barrier (Barrier_RISCV_w_w () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word))))))) then
        barrier (Barrier_RISCV_w_rw () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))) then
        barrier (Barrier_RISCV_rw_r () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word))))))) then
        barrier (Barrier_RISCV_r_w () )
      else if ((((((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b01w :  2 words$word)))) /\ (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b10w :  2 words$word))))))) then
        barrier (Barrier_RISCV_w_r () )
      else
        sail2_state_monad$returnS (if (((((subrange_vec_dec v__1133 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) then
                  () 
                else if (((((subrange_vec_dec v__1132 (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b00w :  2 words$word)))) then
                  () 
                else
                  let (_ : unit) = (print_endline "FIXME: unsupported fence") in
                  () )
   )
   (sail2_state_monad$returnS RETIRE_SUCCESS)))`;


(*val execute_ECALL : unit -> M Retired*)

val _ = Define `
 ((execute_ECALL:unit ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__0 : Privilege) . 
   let (t : sync_exception) =
     (<| sync_exception_trap :=
          ((case w__0 of
            User => E_U_EnvCall () 
          | Supervisor => E_S_EnvCall () 
          | Machine => E_M_EnvCall () 
          )); 
        sync_exception_excinfo := NONE; 
        sync_exception_ext := NONE |>) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__2 :  32 words$word) .  sail2_state_monad$bindS
   (exception_handler w__1 (CTL_TRAP t) w__2  : ( 32 words$word) M) (\ (w__3 :  32 words$word) .  sail2_state_monad$seqS
   (set_next_pc w__3) (sail2_state_monad$returnS RETIRE_FAIL)))))))`;


(*val execute_EBREAK : unit -> M Retired*)

val _ = Define `
 ((execute_EBREAK:unit ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$seqS
   (handle_mem_exception w__0 (E_Breakpoint () )) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_DIVW : mword ty5 -> mword ty5 -> mword ty5 -> bool -> M Retired*)

val _ = Define `
 ((execute_DIVW:(5)words$word ->(5)words$word ->(5)words$word -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd s=  (sail2_state_monad$bindS
   (haveMulDiv () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (rX_bits rs1  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
     let rs1_val = ((subrange_vec_dec w__1 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
     (rX_bits rs2  : ( 32 words$word) M) (\ (w__2 :  32 words$word) . 
     let rs2_val = ((subrange_vec_dec w__2 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) in
     let (rs1_int : ii) = (if s then integer_word$w2i rs1_val else lem$w2ui rs1_val) in
     let (rs2_int : ii) = (if s then integer_word$w2i rs2_val else lem$w2ui rs2_val) in
     let (q : ii) = (if (((rs2_int = (( 0 : int):ii)))) then ((( 0 : int)-( 1 : int)):ii) else hardware_quot rs1_int rs2_int) in
     let (q' : ii) =
       (if (((s /\ ((q > ((((pow2 (( 31 : int):ii))) - (( 1 : int):ii)))))))) then
         (( 0 : int):ii) - ((pow0 (( 2 : int):ii) (( 31 : int):ii)))
       else q) in sail2_state_monad$seqS
     (wX_bits rd ((EXTS (( 32 : int):ii) ((to_bits (( 32 : int):ii) q'  :  32 words$word))  :  32 words$word)))
     (sail2_state_monad$returnS RETIRE_SUCCESS)))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_DIV : mword ty5 -> mword ty5 -> mword ty5 -> bool -> M Retired*)

val _ = Define `
 ((execute_DIV:(5)words$word ->(5)words$word ->(5)words$word -> bool ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) rs2 rs1 rd s=  (sail2_state_monad$bindS
   (haveMulDiv () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val .  sail2_state_monad$bindS
     (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val . 
     let (rs1_int : ii) = (if s then integer_word$w2i rs1_val else lem$w2ui rs1_val) in
     let (rs2_int : ii) = (if s then integer_word$w2i rs2_val else lem$w2ui rs2_val) in
     let (q : ii) = (if (((rs2_int = (( 0 : int):ii)))) then ((( 0 : int)-( 1 : int)):ii) else hardware_quot rs1_int rs2_int) in
     let (q' : ii) = (if (((s /\ ((q > xlen_max_signed))))) then xlen_min_signed else q) in sail2_state_monad$seqS
     (wX_bits rd ((to_bits (( 32 : int):ii) q'  :  32 words$word))) (sail2_state_monad$returnS RETIRE_SUCCESS)))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_C_SRLI_HINT : mword ty3 -> Retired*)

val _ = Define `
 ((execute_C_SRLI_HINT:(3)words$word -> Retired) rsd=  RETIRE_SUCCESS)`;


(*val execute_C_SRAI_HINT : mword ty3 -> Retired*)

val _ = Define `
 ((execute_C_SRAI_HINT:(3)words$word -> Retired) rsd=  RETIRE_SUCCESS)`;


(*val execute_C_SLLI_HINT : mword ty6 -> mword ty5 -> Retired*)

val _ = Define `
 ((execute_C_SLLI_HINT:(6)words$word ->(5)words$word -> Retired) shamt rsd=  RETIRE_SUCCESS)`;


(*val execute_C_NOP_HINT : mword ty6 -> Retired*)

val _ = Define `
 ((execute_C_NOP_HINT:(6)words$word -> Retired) imm=  RETIRE_SUCCESS)`;


(*val execute_C_NOP : unit -> Retired*)

val _ = Define `
 ((execute_C_NOP:unit -> Retired) () =  RETIRE_SUCCESS)`;


(*val execute_C_MV_HINT : mword ty5 -> Retired*)

val _ = Define `
 ((execute_C_MV_HINT:(5)words$word -> Retired) rs2=  RETIRE_SUCCESS)`;


(*val execute_C_LUI_HINT : mword ty6 -> Retired*)

val _ = Define `
 ((execute_C_LUI_HINT:(6)words$word -> Retired) imm=  RETIRE_SUCCESS)`;


(*val execute_C_LI_HINT : mword ty6 -> Retired*)

val _ = Define `
 ((execute_C_LI_HINT:(6)words$word -> Retired) imm=  RETIRE_SUCCESS)`;


(*val execute_C_ILLEGAL : mword ty16 -> M Retired*)

val _ = Define `
 ((execute_C_ILLEGAL:(16)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) s=  (sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)))`;


(*val execute_C_ADD_HINT : mword ty5 -> Retired*)

val _ = Define `
 ((execute_C_ADD_HINT:(5)words$word -> Retired) rs2=  RETIRE_SUCCESS)`;


(*val execute_C_ADDI_HINT : mword ty5 -> Retired*)

val _ = Define `
 ((execute_C_ADDI_HINT:(5)words$word -> Retired) rsd=  RETIRE_SUCCESS)`;


(*val execute_CSR : mword ty12 -> mword ty5 -> mword ty5 -> bool -> csrop -> M Retired*)

val _ = Define `
 ((execute_CSR:(12)words$word ->(5)words$word ->(5)words$word -> bool -> csrop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) csr rs1 rd is_imm op=  (sail2_state_monad$bindS
   (if is_imm then sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) rs1  :  32 words$word))
    else (rX_bits rs1  : ( 32 words$word) M)) (\ (rs1_val : xlenbits) . 
   let (isWrite : bool) =
     ((case op of
       CSRRW => T
     | _ => if is_imm then (((lem$w2ui rs1_val)) <> (( 0 : int):ii)) else (((lem$w2ui rs1)) <> (( 0 : int):ii))
     )) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__1 : Privilege) .  sail2_state_monad$bindS
   (check_CSR csr w__1 isWrite) (\ (w__2 : bool) . 
   if ((~ w__2)) then sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL)
   else sail2_state_monad$bindS
     (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__3 : Privilege) . 
     if ((~ ((ext_check_CSR csr w__3 isWrite)))) then
       let (_ : unit) = (ext_check_CSR_fail () ) in
       sail2_state_monad$returnS RETIRE_FAIL
     else sail2_state_monad$bindS
       (readCSR csr  : ( 32 words$word) M) (\ csr_val .  sail2_state_monad$seqS (sail2_state_monad$seqS
       (if isWrite then
          let (new_val : xlenbits) =
            ((case op of
              CSRRW => rs1_val
            | CSRRS => (or_vec csr_val rs1_val  :  32 words$word)
            | CSRRC => (and_vec csr_val ((not_vec rs1_val  :  32 words$word))  :  32 words$word)
            )) in
          writeCSR csr new_val
        else sail2_state_monad$returnS () )
       (wX_bits rd csr_val)) (sail2_state_monad$returnS RETIRE_SUCCESS))))))))`;


(*val execute_BTYPE : mword ty13 -> mword ty5 -> mword ty5 -> bop -> M Retired*)

val _ = Define `
 ((execute_BTYPE:(13)words$word ->(5)words$word ->(5)words$word -> bop ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs2 rs1 op=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ rs1_val .  sail2_state_monad$bindS
   (rX_bits rs2  : ( 32 words$word) M) (\ rs2_val . 
   let (taken : bool) =
     ((case op of
       RISCV_BEQ => (rs1_val = rs2_val)
     | RISCV_BNE => (rs1_val <> rs2_val)
     | RISCV_BLT => zopz0zI_s rs1_val rs2_val
     | RISCV_BGE => zopz0zKzJ_s rs1_val rs2_val
     | RISCV_BLTU => zopz0zI_u rs1_val rs2_val
     | RISCV_BGEU => zopz0zKzJ_u rs1_val rs2_val
     )) in sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let (t : xlenbits) = ((add_vec w__0 ((EXTS (( 32 : int):ii) imm  :  32 words$word))  :  32 words$word)) in
   if taken then
     (case ((ext_control_check_pc t)) of
       Ext_ControlAddr_Error (e) =>
        let (_ : unit) = (ext_handle_control_check_error e) in
        sail2_state_monad$returnS RETIRE_FAIL
     | Ext_ControlAddr_OK (target) => sail2_state_monad$bindS
        (sail2_state$and_boolS (sail2_state_monad$returnS ((bit_to_bool ((access_vec_dec target (( 1 : int):ii))))))
          ( sail2_state_monad$bindS(haveRVC () ) (\ (w__1 : bool) .  sail2_state_monad$returnS ((~ w__1))))) (\ (w__2 : bool) . 
        if w__2 then sail2_state_monad$seqS (handle_mem_exception target (E_Fetch_Addr_Align () )) (sail2_state_monad$returnS RETIRE_FAIL)
        else sail2_state_monad$seqS (set_next_pc target) (sail2_state_monad$returnS RETIRE_SUCCESS))
     )
   else sail2_state_monad$returnS RETIRE_SUCCESS)))))`;


(*val execute_AMO : amoop -> bool -> bool -> mword ty5 -> mword ty5 -> word_width -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_AMO:amoop -> bool -> bool ->(5)words$word ->(5)words$word -> word_width ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) op aq rl rs2 rs1 width rd=  (sail2_state_monad$bindS
   (haveAtomics () ) (\ (w__0 : bool) . 
   if w__0 then sail2_state_monad$bindS
     (ext_data_get_addr rs1 ((zeros_implicit (( 32 : int):ii)  :  32 words$word)) (ReadWrite (Data, Data)) width) (\ (w__1 : unit
       Ext_DataAddr_Check) . 
     (case w__1 of
       Ext_DataAddr_Error (e) =>
        let (_ : unit) = (ext_handle_data_check_error e) in
        sail2_state_monad$returnS RETIRE_FAIL
     | Ext_DataAddr_OK (vaddr) => sail2_state_monad$bindS
        (translateAddr vaddr (ReadWrite (Data, Data))  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__2 : (( 32 words$word), ExceptionType)
          TR_Result) . 
        (case w__2 of
          TR_Failure ((e, _)) => sail2_state_monad$seqS (handle_mem_exception vaddr e) (sail2_state_monad$returnS RETIRE_FAIL)
        | TR_Address ((addr, _)) => sail2_state_monad$bindS
           (case (width, (( 32 : int):ii)) of
             (BYTE, _) => mem_write_ea addr (( 1 : int):ii) (((aq /\ rl))) rl T
           | (HALF, _) => mem_write_ea addr (( 2 : int):ii) (((aq /\ rl))) rl T
           | (WORD, _) => mem_write_ea addr (( 4 : int):ii) (((aq /\ rl))) rl T
           | _ => internal_error "Unexpected AMO width"
           ) (\ (eares : unit MemoryOpResult) . 
           let (is_unsigned : bool) =
             ((case op of   AMOMINU => T | AMOMAXU => T | _ => F )) in sail2_state_monad$bindS
           (case width of
             BYTE =>
              if is_unsigned then sail2_state_monad$bindS
                (rX_bits rs2  : ( 32 words$word) M) (\ (w__7 :  32 words$word) . 
                sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) ((subrange_vec_dec w__7 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
                          :  32 words$word)))
              else sail2_state_monad$bindS
                (rX_bits rs2  : ( 32 words$word) M) (\ (w__8 :  32 words$word) . 
                sail2_state_monad$returnS ((EXTS (( 32 : int):ii) ((subrange_vec_dec w__8 (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
                          :  32 words$word)))
           | HALF =>
              if is_unsigned then sail2_state_monad$bindS
                (rX_bits rs2  : ( 32 words$word) M) (\ (w__10 :  32 words$word) . 
                sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) ((subrange_vec_dec w__10 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))
                          :  32 words$word)))
              else sail2_state_monad$bindS
                (rX_bits rs2  : ( 32 words$word) M) (\ (w__11 :  32 words$word) . 
                sail2_state_monad$returnS ((EXTS (( 32 : int):ii) ((subrange_vec_dec w__11 (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))
                          :  32 words$word)))
           | WORD =>
              if is_unsigned then sail2_state_monad$bindS
                (rX_bits rs2  : ( 32 words$word) M) (\ (w__13 :  32 words$word) . 
                sail2_state_monad$returnS ((EXTZ (( 32 : int):ii) ((subrange_vec_dec w__13 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
                          :  32 words$word)))
              else sail2_state_monad$bindS
                (rX_bits rs2  : ( 32 words$word) M) (\ (w__14 :  32 words$word) . 
                sail2_state_monad$returnS ((EXTS (( 32 : int):ii) ((subrange_vec_dec w__14 (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
                          :  32 words$word)))
           | DOUBLE => (rX_bits rs2  : ( 32 words$word) M)
           ) (\ (rs2_val : xlenbits) . 
           (case eares of
             MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
           | MemValue (_) => sail2_state_monad$bindS
              (case (width, (( 32 : int):ii)) of
                (BYTE, _) => sail2_state_monad$bindS
                 (mem_read (ReadWrite (Data, Data)) addr (( 1 : int):ii) aq (((aq /\ rl))) T
                   : ( ( 8 words$word)MemoryOpResult) M) (\ (w__17 : ( 8 words$word) MemoryOpResult) . 
                 sail2_state_monad$returnS ((extend_value is_unsigned w__17  : ( 32 words$word) MemoryOpResult)))
              | (HALF, _) => sail2_state_monad$bindS
                 (mem_read (ReadWrite (Data, Data)) addr (( 2 : int):ii) aq (((aq /\ rl))) T
                   : ( ( 16 words$word)MemoryOpResult) M) (\ (w__18 : ( 16 words$word) MemoryOpResult) . 
                 sail2_state_monad$returnS ((extend_value is_unsigned w__18  : ( 32 words$word) MemoryOpResult)))
              | (WORD, _) => sail2_state_monad$bindS
                 (mem_read (ReadWrite (Data, Data)) addr (( 4 : int):ii) aq (((aq /\ rl))) T
                   : ( ( 32 words$word)MemoryOpResult) M) (\ (w__19 : ( 32 words$word) MemoryOpResult) . 
                 sail2_state_monad$returnS ((extend_value is_unsigned w__19  : ( 32 words$word) MemoryOpResult)))
              | _ => (internal_error "Unexpected AMO width"  : ( ( 32 words$word)MemoryOpResult) M)
              ) (\ (mval : xlenbits MemoryOpResult) . 
              (case mval of
                MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
              | MemValue (loaded) =>
                 let (result : xlenbits) =
                   ((case op of
                     AMOSWAP => rs2_val
                   | AMOADD => (add_vec rs2_val loaded  :  32 words$word)
                   | AMOXOR => (xor_vec rs2_val loaded  :  32 words$word)
                   | AMOAND => (and_vec rs2_val loaded  :  32 words$word)
                   | AMOOR => (or_vec rs2_val loaded  :  32 words$word)
                   | AMOMIN =>
                      (to_bits (( 32 : int):ii) ((int_min ((integer_word$w2i rs2_val)) ((integer_word$w2i loaded))))  :  32 words$word)
                   | AMOMAX =>
                      (to_bits (( 32 : int):ii) ((int_max ((integer_word$w2i rs2_val)) ((integer_word$w2i loaded))))  :  32 words$word)
                   | AMOMINU =>
                      (to_bits (( 32 : int):ii) ((int_min ((lem$w2ui rs2_val)) ((lem$w2ui loaded))))  :  32 words$word)
                   | AMOMAXU =>
                      (to_bits (( 32 : int):ii) ((int_max ((lem$w2ui rs2_val)) ((lem$w2ui loaded))))  :  32 words$word)
                   )) in
                 let (rval : xlenbits) =
                   ((case width of
                     BYTE =>
                      (EXTS (( 32 : int):ii) ((subrange_vec_dec loaded (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word))
                        :  32 words$word)
                   | HALF =>
                      (EXTS (( 32 : int):ii) ((subrange_vec_dec loaded (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word))
                        :  32 words$word)
                   | WORD =>
                      (EXTS (( 32 : int):ii) ((subrange_vec_dec loaded (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))
                        :  32 words$word)
                   | DOUBLE => loaded
                   )) in sail2_state_monad$bindS
                 (case (width, (( 32 : int):ii)) of
                   (BYTE, _) =>
                    mem_write_value addr (( 1 : int):ii)
                      ((subrange_vec_dec result (( 7 : int):ii) (( 0 : int):ii)  :  8 words$word)) (((aq /\ rl))) rl
                      T
                 | (HALF, _) =>
                    mem_write_value addr (( 2 : int):ii)
                      ((subrange_vec_dec result (( 15 : int):ii) (( 0 : int):ii)  :  16 words$word)) (((aq /\ rl))) rl
                      T
                 | (WORD, _) =>
                    mem_write_value addr (( 4 : int):ii)
                      ((subrange_vec_dec result (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word)) (((aq /\ rl))) rl
                      T
                 | _ => internal_error "Unexpected AMO width"
                 ) (\ (wval : bool MemoryOpResult) . 
                 (case wval of
                   MemValue (T) => sail2_state_monad$seqS (wX_bits rd rval) (sail2_state_monad$returnS RETIRE_SUCCESS)
                 | MemValue (F) => internal_error "AMO got false from mem_write_value"
                 | MemException (e) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS RETIRE_FAIL)
                 ))
              ))
           )))
        ))
     ))
   else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS RETIRE_FAIL))))`;


(*val execute_ADDIW : mword ty12 -> mword ty5 -> mword ty5 -> M Retired*)

val _ = Define `
 ((execute_ADDIW:(12)words$word ->(5)words$word ->(5)words$word ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) imm rs1 rd=  (sail2_state_monad$bindS
   (rX_bits rs1  : ( 32 words$word) M) (\ (w__0 :  32 words$word) . 
   let (result : xlenbits) = ((add_vec ((EXTS (( 32 : int):ii) imm  :  32 words$word)) w__0  :  32 words$word)) in sail2_state_monad$seqS
   (wX_bits rd
     ((EXTS (( 32 : int):ii) ((subrange_vec_dec result (( 31 : int):ii) (( 0 : int):ii)  :  32 words$word))  :  32 words$word)))
   (sail2_state_monad$returnS RETIRE_SUCCESS))))`;


 val execute_defn = Hol_defn "execute" `
 ((execute:ast ->(regstate)sail2_state_monad$sequential_state ->(((Retired),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) merge_var=
    ((case merge_var of
     C_ADDI4SPN ((rdc, nzimm)) =>
      let (imm : 12 bits) =
        ((concat_vec (0b00w :  2 words$word) ((concat_vec nzimm (0b00w :  2 words$word)  :  10 words$word))
          :  12 words$word)) in
      let rd = ((creg2reg_idx rdc  :  5 words$word)) in
      execute (ITYPE (imm, sp, rd, RISCV_ADDI))
   | C_LW ((uimm, rsc, rdc)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  7 words$word))  :  12 words$word)) in
      let rd = ((creg2reg_idx rdc  :  5 words$word)) in
      let rs = ((creg2reg_idx rsc  :  5 words$word)) in
      execute (LOAD (imm, rs, rd, F, WORD, F, F))
   | C_LD ((uimm, rsc, rdc)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b000w :  3 words$word)  :  8 words$word))  :  12 words$word)) in
      let rd = ((creg2reg_idx rdc  :  5 words$word)) in
      let rs = ((creg2reg_idx rsc  :  5 words$word)) in
      execute (LOAD (imm, rs, rd, F, DOUBLE, F, F))
   | C_SW ((uimm, rsc1, rsc2)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  7 words$word))  :  12 words$word)) in
      let rs1 = ((creg2reg_idx rsc1  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rsc2  :  5 words$word)) in
      execute (STORE (imm, rs2, rs1, WORD, F, F))
   | C_SD ((uimm, rsc1, rsc2)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b000w :  3 words$word)  :  8 words$word))  :  12 words$word)) in
      let rs1 = ((creg2reg_idx rsc1  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rsc2  :  5 words$word)) in
      execute (STORE (imm, rs2, rs1, DOUBLE, F, F))
   | C_ADDI ((nzi, rsd)) =>
      let (imm : 12 bits) = ((EXTS (( 12 : int):ii) nzi  :  12 words$word)) in
      execute (ITYPE (imm, rsd, rsd, RISCV_ADDI))
   | C_JAL (imm) =>
      execute
        (RISCV_JAL ((EXTS (( 21 : int):ii) ((concat_vec imm (0b0w :  1 words$word)  :  12 words$word))  :  21 words$word),
                    ra))
   | C_ADDIW ((imm, rsd)) => execute (ADDIW ((EXTS (( 12 : int):ii) imm  :  12 words$word), rsd, rsd))
   | C_LI ((imm, rd)) =>
      let (imm : 12 bits) = ((EXTS (( 12 : int):ii) imm  :  12 words$word)) in
      execute (ITYPE (imm, zreg, rd, RISCV_ADDI))
   | C_ADDI16SP (imm) =>
      let (imm : 12 bits) =
        ((EXTS (( 12 : int):ii) ((concat_vec imm (0x0w :  4 words$word)  :  10 words$word))  :  12 words$word)) in
      execute (ITYPE (imm, sp, sp, RISCV_ADDI))
   | C_LUI ((imm, rd)) =>
      let (res : 20 bits) = ((EXTS (( 20 : int):ii) imm  :  20 words$word)) in
      execute (UTYPE (res, rd, RISCV_LUI))
   | C_SRLI ((shamt, rsd)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      execute (SHIFTIOP (shamt, rsd, rsd, RISCV_SRLI))
   | C_SRAI ((shamt, rsd)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      execute (SHIFTIOP (shamt, rsd, rsd, RISCV_SRAI))
   | C_ANDI ((imm, rsd)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      execute (ITYPE ((EXTS (( 12 : int):ii) imm  :  12 words$word), rsd, rsd, RISCV_ANDI))
   | C_SUB ((rsd, rs2)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rs2  :  5 words$word)) in
      execute (RTYPE (rs2, rsd, rsd, RISCV_SUB))
   | C_XOR ((rsd, rs2)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rs2  :  5 words$word)) in
      execute (RTYPE (rs2, rsd, rsd, RISCV_XOR))
   | C_OR ((rsd, rs2)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rs2  :  5 words$word)) in
      execute (RTYPE (rs2, rsd, rsd, RISCV_OR))
   | C_AND ((rsd, rs2)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rs2  :  5 words$word)) in
      execute (RTYPE (rs2, rsd, rsd, RISCV_AND))
   | C_SUBW ((rsd, rs2)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rs2  :  5 words$word)) in
      execute (RTYPEW (rs2, rsd, rsd, RISCV_SUBW))
   | C_ADDW ((rsd, rs2)) =>
      let rsd = ((creg2reg_idx rsd  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rs2  :  5 words$word)) in
      execute (RTYPEW (rs2, rsd, rsd, RISCV_ADDW))
   | C_J (imm) =>
      execute
        (RISCV_JAL ((EXTS (( 21 : int):ii) ((concat_vec imm (0b0w :  1 words$word)  :  12 words$word))  :  21 words$word),
                    zreg))
   | C_BEQZ ((imm, rs)) =>
      execute
        (BTYPE ((EXTS (( 13 : int):ii) ((concat_vec imm (0b0w :  1 words$word)  :  9 words$word))  :  13 words$word),
                zreg,
                (creg2reg_idx rs  :  5 words$word),
                RISCV_BEQ))
   | C_BNEZ ((imm, rs)) =>
      execute
        (BTYPE ((EXTS (( 13 : int):ii) ((concat_vec imm (0b0w :  1 words$word)  :  9 words$word))  :  13 words$word),
                zreg,
                (creg2reg_idx rs  :  5 words$word),
                RISCV_BNE))
   | C_SLLI ((shamt, rsd)) => execute (SHIFTIOP (shamt, rsd, rsd, RISCV_SLLI))
   | C_LWSP ((uimm, rd)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  8 words$word))  :  12 words$word)) in
      execute (LOAD (imm, sp, rd, F, WORD, F, F))
   | C_LDSP ((uimm, rd)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b000w :  3 words$word)  :  9 words$word))  :  12 words$word)) in
      execute (LOAD (imm, sp, rd, F, DOUBLE, F, F))
   | C_SWSP ((uimm, rs2)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  8 words$word))  :  12 words$word)) in
      execute (STORE (imm, rs2, sp, WORD, F, F))
   | C_SDSP ((uimm, rs2)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b000w :  3 words$word)  :  9 words$word))  :  12 words$word)) in
      execute (STORE (imm, rs2, sp, DOUBLE, F, F))
   | C_JR (rs1) => execute (RISCV_JALR ((EXTZ (( 12 : int):ii) (0b0w :  1 words$word)  :  12 words$word), rs1, zreg))
   | C_JALR (rs1) => execute (RISCV_JALR ((EXTZ (( 12 : int):ii) (0b0w :  1 words$word)  :  12 words$word), rs1, ra))
   | C_MV ((rd, rs2)) => execute (RTYPE (rs2, zreg, rd, RISCV_ADD))
   | C_EBREAK (() ) => execute (EBREAK () )
   | C_ADD ((rsd, rs2)) => execute (RTYPE (rs2, rsd, rsd, RISCV_ADD))
   | C_FLWSP ((imm, rd)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec imm (0b00w :  2 words$word)  :  8 words$word))  :  12 words$word)) in
      execute (LOAD_FP (imm, sp, rd, WORD))
   | C_FSWSP ((uimm, rs2)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  8 words$word))  :  12 words$word)) in
      execute (STORE_FP (imm, rs2, sp, WORD))
   | C_FLW ((uimm, rsc, rdc)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  7 words$word))  :  12 words$word)) in
      let rd = ((creg2reg_idx rdc  :  5 words$word)) in
      let rs = ((creg2reg_idx rsc  :  5 words$word)) in
      execute (LOAD_FP (imm, rs, rd, WORD))
   | C_FSW ((uimm, rsc1, rsc2)) =>
      let (imm : 12 bits) =
        ((EXTZ (( 12 : int):ii) ((concat_vec uimm (0b00w :  2 words$word)  :  7 words$word))  :  12 words$word)) in
      let rs1 = ((creg2reg_idx rsc1  :  5 words$word)) in
      let rs2 = ((creg2reg_idx rsc2  :  5 words$word)) in
      execute (STORE_FP (imm, rs2, rs1, WORD))
   | UTYPE ((imm, rd, op)) => execute_UTYPE imm rd op
   | RISCV_JAL ((imm, rd)) => execute_RISCV_JAL imm rd
   | BTYPE ((imm, rs2, rs1, op)) => execute_BTYPE imm rs2 rs1 op
   | ITYPE ((imm, rs1, rd, op)) => execute_ITYPE imm rs1 rd op
   | SHIFTIOP ((shamt, rs1, rd, op)) => execute_SHIFTIOP shamt rs1 rd op
   | RTYPE ((rs2, rs1, rd, op)) => execute_RTYPE rs2 rs1 rd op
   | LOAD ((imm, rs1, rd, is_unsigned, width, aq, rl)) =>
      execute_LOAD imm rs1 rd is_unsigned width aq rl
   | STORE ((imm, rs2, rs1, width, aq, rl)) => execute_STORE imm rs2 rs1 width aq rl
   | ADDIW ((imm, rs1, rd)) => execute_ADDIW imm rs1 rd
   | SHIFTW ((shamt, rs1, rd, op)) => execute_SHIFTW shamt rs1 rd op
   | RTYPEW ((rs2, rs1, rd, op)) => execute_RTYPEW rs2 rs1 rd op
   | SHIFTIWOP ((shamt, rs1, rd, op)) => execute_SHIFTIWOP shamt rs1 rd op
   | FENCE ((pred, succ)) => execute_FENCE pred succ
   | FENCE_TSO ((pred, succ)) => execute_FENCE_TSO pred succ
   | FENCEI (arg0) => sail2_state_monad$returnS ((execute_FENCEI arg0))
   | ECALL (arg0) => execute_ECALL arg0
   | MRET (arg0) => execute_MRET arg0
   | SRET (arg0) => execute_SRET arg0
   | EBREAK (arg0) => execute_EBREAK arg0
   | WFI (arg0) => execute_WFI arg0
   | SFENCE_VMA ((rs1, rs2)) => execute_SFENCE_VMA rs1 rs2
   | LOADRES ((aq, rl, rs1, width, rd)) => execute_LOADRES aq rl rs1 width rd
   | STORECON ((aq, rl, rs2, rs1, width, rd)) => execute_STORECON aq rl rs2 rs1 width rd
   | AMO ((op, aq, rl, rs2, rs1, width, rd)) => execute_AMO op aq rl rs2 rs1 width rd
   | C_NOP (arg0) => sail2_state_monad$returnS ((execute_C_NOP arg0))
   | MUL ((rs2, rs1, rd, high, signed1, signed2)) => execute_MUL rs2 rs1 rd high signed1 signed2
   | DIV0 ((rs2, rs1, rd, s)) => execute_DIV rs2 rs1 rd s
   | REM ((rs2, rs1, rd, s)) => execute_REM rs2 rs1 rd s
   | MULW ((rs2, rs1, rd)) => execute_MULW rs2 rs1 rd
   | DIVW ((rs2, rs1, rd, s)) => execute_DIVW rs2 rs1 rd s
   | REMW ((rs2, rs1, rd, s)) => execute_REMW rs2 rs1 rd s
   | CSR ((csr, rs1, rd, is_imm, op)) => execute_CSR csr rs1 rd is_imm op
   | URET (arg0) => execute_URET arg0
   | C_NOP_HINT (imm) => sail2_state_monad$returnS ((execute_C_NOP_HINT imm))
   | C_ADDI_HINT (rsd) => sail2_state_monad$returnS ((execute_C_ADDI_HINT rsd))
   | C_LI_HINT (imm) => sail2_state_monad$returnS ((execute_C_LI_HINT imm))
   | C_LUI_HINT (imm) => sail2_state_monad$returnS ((execute_C_LUI_HINT imm))
   | C_MV_HINT (rs2) => sail2_state_monad$returnS ((execute_C_MV_HINT rs2))
   | C_ADD_HINT (rs2) => sail2_state_monad$returnS ((execute_C_ADD_HINT rs2))
   | C_SLLI_HINT ((shamt, rsd)) => sail2_state_monad$returnS ((execute_C_SLLI_HINT shamt rsd))
   | C_SRLI_HINT (rsd) => sail2_state_monad$returnS ((execute_C_SRLI_HINT rsd))
   | C_SRAI_HINT (rsd) => sail2_state_monad$returnS ((execute_C_SRAI_HINT rsd))
   | FENCE_RESERVED ((fm, pred, succ, rs, rd)) =>
      sail2_state_monad$returnS ((execute_FENCE_RESERVED fm pred succ rs rd))
   | FENCEI_RESERVED ((imm, rs, rd)) => sail2_state_monad$returnS ((execute_FENCEI_RESERVED imm rs rd))
   | LOAD_FP ((imm, rs1, rd, width)) => execute_LOAD_FP imm rs1 rd width
   | STORE_FP ((imm, rs2, rs1, width)) => execute_STORE_FP imm rs2 rs1 width
   | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, op)) => execute_F_MADD_TYPE_S rs3 rs2 rs1 rm rd op
   | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, op)) => execute_F_BIN_RM_TYPE_S rs2 rs1 rm rd op
   | F_UN_RM_TYPE_S ((rs1, rm, rd, arg3)) => execute_F_UN_RM_TYPE_S rs1 rm rd arg3
   | F_BIN_TYPE_S ((rs2, rs1, rd, arg3)) => execute_F_BIN_TYPE_S rs2 rs1 rd arg3
   | F_UN_TYPE_S ((rs1, rd, arg2)) => execute_F_UN_TYPE_S rs1 rd arg2
   | RISCV_JALR ((imm, rs1, rd)) => execute_RISCV_JALR imm rs1 rd
   | ILLEGAL (s) => execute_ILLEGAL s
   | C_ILLEGAL (s) => execute_C_ILLEGAL s
   )))`;

val _ = Lib.with_flag (computeLib.auto_import_definitions, false) Defn.save_defn execute_defn;

val _ = Define `
 ((assembly_forwards:ast ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_= 
  ((case arg_ of
         UTYPE ((imm, rd, op)) => sail2_state_monad$bindS
                                    (reg_name_forwards rd)
                                    (\ (w__0 : string) . 
                                     sail2_state_monad$returnS
                                       ((string_append
                                           ((utype_mnemonic_forwards op))
                                           ((string_append
                                               ((spc_forwards () ))
                                               ((string_append w__0
                                                   ((string_append
                                                       ((sep_forwards () ))
                                                       ((string_append
                                                           ((decimal_string_of_bits
                                                               imm)) 
                                                         "")))))))))))
     | RISCV_JAL ((imm, rd)) => sail2_state_monad$bindS
                                  (reg_name_forwards rd)
                                  (\ (w__1 : string) . 
                                   sail2_state_monad$returnS
                                     ((string_append "jal"
                                         ((string_append ((spc_forwards () ))
                                             ((string_append w__1
                                                 ((string_append
                                                     ((sep_forwards () ))
                                                     ((string_append
                                                         ((decimal_string_of_bits
                                                             imm)) "")))))))))))
     | RISCV_JALR ((imm, rs1, rd)) => sail2_state_monad$bindS
                                        (reg_name_forwards rd)
                                        (\ (w__2 : string) .  sail2_state_monad$bindS
                                                                (reg_name_forwards
                                                                   rs1)
                                                                (\ (w__3 : string) . 
                                                                 sail2_state_monad$returnS
                                                                   ((
                                                                    string_append
                                                                    "jalr"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__2
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__3
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm)) 
                                                                    ""))))))))))))))))
     | BTYPE ((imm, rs2, rs1, op)) => sail2_state_monad$bindS
                                        (reg_name_forwards rs1)
                                        (\ (w__4 : string) .  sail2_state_monad$bindS
                                                                (reg_name_forwards
                                                                   rs2)
                                                                (\ (w__5 : string) . 
                                                                 sail2_state_monad$returnS
                                                                   ((
                                                                    string_append
                                                                    (
                                                                    (
                                                                    btype_mnemonic_forwards
                                                                    op))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__4
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__5
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm)) 
                                                                    ""))))))))))))))))
     | ITYPE ((imm, rs1, rd, op)) => sail2_state_monad$bindS
                                       (reg_name_forwards rd)
                                       (\ (w__6 : string) .  sail2_state_monad$bindS
                                                               (reg_name_forwards
                                                                  rs1)
                                                               (\ (w__7 : string) . 
                                                                sail2_state_monad$returnS
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    itype_mnemonic_forwards
                                                                    op))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__6
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__7
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm)) 
                                                                    ""))))))))))))))))
     | SHIFTIOP ((shamt, rs1, rd, op)) => sail2_state_monad$bindS
                                            (reg_name_forwards rd)
                                            (\ (w__8 : string) .  sail2_state_monad$bindS
                                                                    (
                                                                    reg_name_forwards
                                                                    rs1)
                                                                    (
                                                                    \ (w__9 : string) . 
                                                                    sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    shiftiop_mnemonic_forwards
                                                                    op))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__8
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__9
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    shamt))
                                                                    ""))))))))))))))))
     | RTYPE ((rs2, rs1, rd, op)) => sail2_state_monad$bindS
                                       (reg_name_forwards rd)
                                       (\ (w__10 : string) .  sail2_state_monad$bindS
                                                                (reg_name_forwards
                                                                   rs1)
                                                                (\ (w__11 : string) .  
                                                                 sail2_state_monad$bindS
                                                                   (reg_name_forwards
                                                                    rs2)
                                                                   (\ (w__12 : string) . 
                                                                    sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    rtype_mnemonic_forwards
                                                                    op))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__10
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__11
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__12 
                                                                    "")))))))))))))))))
     | LOAD ((imm, rs1, rd, is_unsigned, size1, aq, rl)) => sail2_state_monad$bindS
                                                              (reg_name_forwards
                                                                 rd)
                                                              (\ (w__13 : string) .  
                                                               sail2_state_monad$bindS
                                                                 (reg_name_forwards
                                                                    rs1)
                                                                 (\ (w__14 : string) . 
                                                                  sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "l"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    size_mnemonic_forwards
                                                                    size1))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_u_forwards
                                                                    is_unsigned))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_aq_forwards
                                                                    aq))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_rl_forwards
                                                                    rl))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__13
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "("
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__14
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    ")" 
                                                                    ""))))))))))))))))))))))))))))))))
     | STORE ((imm, rs2, rs1, size1, aq, rl)) => sail2_state_monad$bindS
                                                   (reg_name_forwards rs2)
                                                   (\ (w__15 : string) .  
                                                    sail2_state_monad$bindS
                                                      (reg_name_forwards rs1)
                                                      (\ (w__16 : string) . 
                                                       sail2_state_monad$returnS
                                                         ((string_append 
                                                           "s"
                                                             ((string_append
                                                                 ((size_mnemonic_forwards
                                                                    size1))
                                                                 ((string_append
                                                                    (
                                                                    (
                                                                    maybe_aq_forwards
                                                                    aq))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_rl_forwards
                                                                    rl))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__15
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "("
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__16
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    ")" 
                                                                    ""))))))))))))))))))))))))))))))
     | ADDIW ((imm, rs1, rd)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__17 : string) .  sail2_state_monad$bindS (reg_name_forwards rs1)
                                (\ (w__18 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "addiw"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__17
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__18
                                                       ((string_append
                                                           ((sep_forwards () ))
                                                           ((string_append
                                                               ((decimal_string_of_bits
                                                                   imm)) 
                                                             ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | SHIFTW ((shamt, rs1, rd, op)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__21 : string) .  sail2_state_monad$bindS (reg_name_forwards rs1)
                                (\ (w__22 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append
                                       ((shiftw_mnemonic_forwards op))
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__21
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__22
                                                       ((string_append
                                                           ((sep_forwards () ))
                                                           ((string_append
                                                               ((decimal_string_of_bits
                                                                   shamt)) 
                                                             ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | RTYPEW ((rs2, rs1, rd, op)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__25 : string) .  sail2_state_monad$bindS (reg_name_forwards rs1)
                                (\ (w__26 : string) .  sail2_state_monad$bindS
                                                         (reg_name_forwards
                                                            rs2)
                                                         (\ (w__27 : string) . 
                                                          sail2_state_monad$returnS
                                                            ((string_append
                                                                ((rtypew_mnemonic_forwards
                                                                    op))
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__25
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__26
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__27 
                                                                    "")))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | SHIFTIWOP ((shamt, rs1, rd, op)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__30 : string) .  sail2_state_monad$bindS (reg_name_forwards rs1)
                                (\ (w__31 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append
                                       ((shiftiwop_mnemonic_forwards op))
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__30
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__31
                                                       ((string_append
                                                           ((sep_forwards () ))
                                                           ((string_append
                                                               ((decimal_string_of_bits
                                                                   shamt)) 
                                                             ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | FENCE ((pred, succ)) => sail2_state_monad$bindS
                                 (fence_bits_forwards pred)
                                 (\ (w__34 : string) .  sail2_state_monad$bindS
                                                          (fence_bits_forwards
                                                             succ)
                                                          (\ (w__35 : string) . 
                                                           sail2_state_monad$returnS
                                                             ((string_append
                                                                 "fence"
                                                                 ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__34
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__35 
                                                                    ""))))))))))))
     | FENCE_TSO ((pred, succ)) => sail2_state_monad$bindS
                                     (fence_bits_forwards pred)
                                     (\ (w__36 : string) .  sail2_state_monad$bindS
                                                              (fence_bits_forwards
                                                                 succ)
                                                              (\ (w__37 : string) . 
                                                               sail2_state_monad$returnS
                                                                 ((string_append
                                                                    "fence.tso"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__36
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__37 
                                                                    ""))))))))))))
     | FENCEI (() ) => sail2_state_monad$returnS "fence.i"
     | ECALL (() ) => sail2_state_monad$returnS "ecall"
     | MRET (() ) => sail2_state_monad$returnS "mret"
     | SRET (() ) => sail2_state_monad$returnS "sret"
     | EBREAK (() ) => sail2_state_monad$returnS "ebreak"
     | WFI (() ) => sail2_state_monad$returnS "wfi"
     | SFENCE_VMA ((rs1, rs2)) => sail2_state_monad$bindS
                                    (reg_name_forwards rs1)
                                    (\ (w__38 : string) .  sail2_state_monad$bindS
                                                             (reg_name_forwards
                                                                rs2)
                                                             (\ (w__39 : string) . 
                                                              sail2_state_monad$returnS
                                                                ((string_append
                                                                    "sfence.vma"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__38
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__39 
                                                                    ""))))))))))))
     | LOADRES ((aq, rl, rs1, size1, rd)) => sail2_state_monad$bindS
                                               (reg_name_forwards rd)
                                               (\ (w__40 : string) .  
                                                sail2_state_monad$bindS
                                                  (reg_name_forwards rs1)
                                                  (\ (w__41 : string) . 
                                                   sail2_state_monad$returnS
                                                     ((string_append 
                                                       "lr."
                                                         ((string_append
                                                             ((size_mnemonic_forwards
                                                                 size1))
                                                             ((string_append
                                                                 ((maybe_aq_forwards
                                                                    aq))
                                                                 ((string_append
                                                                    (
                                                                    (
                                                                    maybe_rl_forwards
                                                                    rl))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__40
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__41 
                                                                    ""))))))))))))))))))
     | STORECON ((aq, rl, rs2, rs1, size1, rd)) => sail2_state_monad$bindS
                                                     (reg_name_forwards rd)
                                                     (\ (w__42 : string) .  
                                                      sail2_state_monad$bindS
                                                        (reg_name_forwards
                                                           rs1)
                                                        (\ (w__43 : string) .  
                                                         sail2_state_monad$bindS
                                                           (reg_name_forwards
                                                              rs2)
                                                           (\ (w__44 : string) . 
                                                            sail2_state_monad$returnS
                                                              ((string_append
                                                                  "sc."
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    size_mnemonic_forwards
                                                                    size1))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_aq_forwards
                                                                    aq))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_rl_forwards
                                                                    rl))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__42
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__43
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__44 
                                                                    "")))))))))))))))))))))))
     | AMO ((op, aq, rl, rs2, rs1, width, rd)) => sail2_state_monad$bindS
                                                    (reg_name_forwards rd)
                                                    (\ (w__45 : string) .  
                                                     sail2_state_monad$bindS
                                                       (reg_name_forwards rs2)
                                                       (\ (w__46 : string) .  
                                                        sail2_state_monad$bindS
                                                          (reg_name_forwards
                                                             rs1)
                                                          (\ (w__47 : string) . 
                                                           sail2_state_monad$returnS
                                                             ((string_append
                                                                 ((amo_mnemonic_forwards
                                                                    op))
                                                                 ((string_append
                                                                    "."
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    size_mnemonic_forwards
                                                                    width))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_aq_forwards
                                                                    aq))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_rl_forwards
                                                                    rl))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__45
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__46
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "("
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__47
                                                                    (
                                                                    (
                                                                    string_append
                                                                    ")" 
                                                                    "")))))))))))))))))))))))))))))
     | C_NOP (() ) => sail2_state_monad$returnS "c.nop"
     | C_ADDI4SPN ((rdc, nzimm)) =>
   if (((nzimm <> (0x00w : 8 words$word)))) then
     sail2_state_monad$bindS (creg_name_forwards rdc)
       (\ (w__48 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.addi4spn"
              ((string_append ((spc_forwards () ))
                  ((string_append w__48
                      ((string_append ((sep_forwards () ))
                          ((string_append
                              ((decimal_string_of_bits
                                  ((concat_vec nzimm (0b00w : 2 words$word) : 10 words$word))))
                              ""))))))))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_LW ((uimm, rsc, rdc)) => sail2_state_monad$bindS
                                    (creg_name_forwards rdc)
                                    (\ (w__51 : string) .  sail2_state_monad$bindS
                                                             (creg_name_forwards
                                                                rsc)
                                                             (\ (w__52 : string) . 
                                                              sail2_state_monad$returnS
                                                                ((string_append
                                                                    "c.lw"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__51
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__52
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    (
                                                                    (
                                                                    concat_vec
                                                                    uimm
                                                                    (
                                                                    0b00w : 2 words$word) : 7 words$word))))
                                                                    ""))))))))))))))))
     | C_LD ((uimm, rsc, rdc)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (creg_name_forwards rdc)
       (\ (w__53 : string) .  sail2_state_monad$bindS
                                (creg_name_forwards rsc)
                                (\ (w__54 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "c.ld"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__53
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__54
                                                       ((string_append
                                                           ((sep_forwards () ))
                                                           ((string_append
                                                               ((decimal_string_of_bits
                                                                   ((
                                                                    concat_vec
                                                                    uimm
                                                                    (
                                                                    0b000w : 3 words$word) : 8 words$word))))
                                                               ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_SW ((uimm, rsc1, rsc2)) => sail2_state_monad$bindS
                                      (creg_name_forwards rsc1)
                                      (\ (w__57 : string) .  sail2_state_monad$bindS
                                                               (creg_name_forwards
                                                                  rsc2)
                                                               (\ (w__58 : string) . 
                                                                sail2_state_monad$returnS
                                                                  ((string_append
                                                                    "c.sw"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__57
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__58
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    (
                                                                    (
                                                                    concat_vec
                                                                    uimm
                                                                    (
                                                                    0b00w : 2 words$word) : 7 words$word))))
                                                                    ""))))))))))))))))
     | C_SD ((uimm, rsc1, rsc2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (creg_name_forwards rsc1)
       (\ (w__59 : string) .  sail2_state_monad$bindS
                                (creg_name_forwards rsc2)
                                (\ (w__60 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "c.sd"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__59
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__60
                                                       ((string_append
                                                           ((sep_forwards () ))
                                                           ((string_append
                                                               ((decimal_string_of_bits
                                                                   ((
                                                                    concat_vec
                                                                    uimm
                                                                    (
                                                                    0b000w : 3 words$word) : 8 words$word))))
                                                               ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_ADDI ((nzi, rsd)) =>
   if ((((((nzi <> (0b000000w : 6 words$word)))) /\ (((rsd <> zreg)))))) then
     sail2_state_monad$bindS (reg_name_forwards rsd)
       (\ (w__63 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.addi"
              ((string_append ((spc_forwards () ))
                  ((string_append w__63
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits nzi)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_JAL (imm) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then
     sail2_state_monad$returnS
       ((string_append "c.jal"
           ((string_append ((spc_forwards () ))
               ((string_append
                   ((decimal_string_of_bits
                       ((concat_vec imm (0b0w : 1 words$word) : 12 words$word))))
                   "")))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_ADDIW ((imm, rsd)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rsd)
       (\ (w__68 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.addiw"
              ((string_append ((spc_forwards () ))
                  ((string_append w__68
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits imm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_LI ((imm, rd)) =>
   if (((rd <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__71 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.li"
              ((string_append ((spc_forwards () ))
                  ((string_append w__71
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits imm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_ADDI16SP (imm) =>
   if (((imm <> (0b000000w : 6 words$word)))) then
     sail2_state_monad$returnS
       ((string_append "c.addi16sp"
           ((string_append ((spc_forwards () ))
               ((string_append ((decimal_string_of_bits imm)) "")))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_LUI ((imm, rd)) =>
   if ((((((rd <> zreg))) /\
           ((((((rd <> sp))) /\ (((imm <> (0b000000w : 6 words$word)))))))))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__76 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.lui"
              ((string_append ((spc_forwards () ))
                  ((string_append w__76
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits imm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_SRLI ((shamt, rsd)) =>
   if (((shamt <> (0b000000w : 6 words$word)))) then
     sail2_state_monad$bindS (creg_name_forwards rsd)
       (\ (w__79 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.srli"
              ((string_append ((spc_forwards () ))
                  ((string_append w__79
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits shamt)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_SRAI ((shamt, rsd)) =>
   if (((shamt <> (0b000000w : 6 words$word)))) then
     sail2_state_monad$bindS (creg_name_forwards rsd)
       (\ (w__82 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.srai"
              ((string_append ((spc_forwards () ))
                  ((string_append w__82
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits shamt)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_ANDI ((imm, rsd)) => sail2_state_monad$bindS
                                (creg_name_forwards rsd)
                                (\ (w__85 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "c.andi"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__85
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append
                                                       ((decimal_string_of_bits
                                                           imm)) "")))))))))))
     | C_SUB ((rsd, rs2)) => sail2_state_monad$bindS (creg_name_forwards rsd)
                               (\ (w__86 : string) .  sail2_state_monad$bindS
                                                        (creg_name_forwards
                                                           rs2)
                                                        (\ (w__87 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               "c.sub"
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__86
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__87 
                                                                    ""))))))))))))
     | C_XOR ((rsd, rs2)) => sail2_state_monad$bindS (creg_name_forwards rsd)
                               (\ (w__88 : string) .  sail2_state_monad$bindS
                                                        (creg_name_forwards
                                                           rs2)
                                                        (\ (w__89 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               "c.xor"
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__88
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__89 
                                                                    ""))))))))))))
     | C_OR ((rsd, rs2)) => sail2_state_monad$bindS (creg_name_forwards rsd)
                              (\ (w__90 : string) .  sail2_state_monad$bindS
                                                       (creg_name_forwards
                                                          rs2)
                                                       (\ (w__91 : string) . 
                                                        sail2_state_monad$returnS
                                                          ((string_append
                                                              "c.or"
                                                              ((string_append
                                                                  ((spc_forwards
                                                                    () ))
                                                                  ((string_append
                                                                    w__90
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__91 
                                                                    ""))))))))))))
     | C_AND ((rsd, rs2)) => sail2_state_monad$bindS (creg_name_forwards rsd)
                               (\ (w__92 : string) .  sail2_state_monad$bindS
                                                        (creg_name_forwards
                                                           rs2)
                                                        (\ (w__93 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               "c.and"
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__92
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__93 
                                                                    ""))))))))))))
     | C_SUBW ((rsd, rs2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (creg_name_forwards rsd)
       (\ (w__94 : string) .  sail2_state_monad$bindS
                                (creg_name_forwards rs2)
                                (\ (w__95 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "c.subw"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__94
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__95 ""))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_ADDW ((rsd, rs2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (creg_name_forwards rsd)
       (\ (w__98 : string) .  sail2_state_monad$bindS
                                (creg_name_forwards rs2)
                                (\ (w__99 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "c.addw"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__98
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append w__99 ""))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_J (imm) =>
   sail2_state_monad$returnS
     ((string_append "c.j"
         ((string_append ((spc_forwards () ))
             ((string_append ((decimal_string_of_bits imm)) ""))))))
     | C_BEQZ ((imm, rs)) => sail2_state_monad$bindS (creg_name_forwards rs)
                               (\ (w__102 : string) . 
                                sail2_state_monad$returnS
                                  ((string_append "c.beqz"
                                      ((string_append ((spc_forwards () ))
                                          ((string_append w__102
                                              ((string_append
                                                  ((sep_forwards () ))
                                                  ((string_append
                                                      ((decimal_string_of_bits
                                                          imm)) "")))))))))))
     | C_BNEZ ((imm, rs)) => sail2_state_monad$bindS (creg_name_forwards rs)
                               (\ (w__103 : string) . 
                                sail2_state_monad$returnS
                                  ((string_append "c.bnez"
                                      ((string_append ((spc_forwards () ))
                                          ((string_append w__103
                                              ((string_append
                                                  ((sep_forwards () ))
                                                  ((string_append
                                                      ((decimal_string_of_bits
                                                          imm)) "")))))))))))
     | C_SLLI ((shamt, rsd)) =>
   if ((((((shamt <> (0b000000w : 6 words$word)))) /\ (((rsd <> zreg)))))) then
     sail2_state_monad$bindS (reg_name_forwards rsd)
       (\ (w__104 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.slli"
              ((string_append ((spc_forwards () ))
                  ((string_append w__104
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits shamt)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_LWSP ((uimm, rd)) =>
   if (((rd <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__107 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.lwsp"
              ((string_append ((spc_forwards () ))
                  ((string_append w__107
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits uimm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_LDSP ((uimm, rd)) =>
   if ((((((rd <> zreg))) /\ ((((( 32 : int): ii) = (( 64 : int): ii))))))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__110 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.ldsp"
              ((string_append ((spc_forwards () ))
                  ((string_append w__110
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits uimm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_SWSP ((uimm, rd)) => sail2_state_monad$bindS (reg_name_forwards rd)
                                (\ (w__113 : string) . 
                                 sail2_state_monad$returnS
                                   ((string_append "c.swsp"
                                       ((string_append ((spc_forwards () ))
                                           ((string_append w__113
                                               ((string_append
                                                   ((sep_forwards () ))
                                                   ((string_append
                                                       ((decimal_string_of_bits
                                                           uimm)) "")))))))))))
     | C_SDSP ((uimm, rs2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rs2)
       (\ (w__114 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.sdsp"
              ((string_append ((spc_forwards () ))
                  ((string_append w__114
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits uimm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_JR (rs1) =>
   if (((rs1 <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rs1)
       (\ (w__117 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.jr"
              ((string_append ((spc_forwards () ))
                  ((string_append w__117 ""))))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_JALR (rs1) =>
   if (((rs1 <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rs1)
       (\ (w__120 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.jalr"
              ((string_append ((spc_forwards () ))
                  ((string_append w__120 ""))))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_MV ((rd, rs2)) =>
   if ((((((rd <> zreg))) /\ (((rs2 <> zreg)))))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__123 : string) .  sail2_state_monad$bindS
                                 (reg_name_forwards rs2)
                                 (\ (w__124 : string) . 
                                  sail2_state_monad$returnS
                                    ((string_append "c.mv"
                                        ((string_append ((spc_forwards () ))
                                            ((string_append w__123
                                                ((string_append
                                                    ((sep_forwards () ))
                                                    ((string_append w__124 ""))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_EBREAK (() ) => sail2_state_monad$returnS "c.ebreak"
     | C_ADD ((rsd, rs2)) =>
   if ((((((rsd <> zreg))) /\ (((rs2 <> zreg)))))) then
     sail2_state_monad$bindS (reg_name_forwards rsd)
       (\ (w__127 : string) .  sail2_state_monad$bindS
                                 (reg_name_forwards rs2)
                                 (\ (w__128 : string) . 
                                  sail2_state_monad$returnS
                                    ((string_append "c.add"
                                        ((string_append ((spc_forwards () ))
                                            ((string_append w__127
                                                ((string_append
                                                    ((sep_forwards () ))
                                                    ((string_append w__128 ""))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | MUL ((rs2, rs1, rd, high, signed1, signed2)) => sail2_state_monad$bindS
                                                         (reg_name_forwards
                                                            rd)
                                                         (\ (w__131 : string) .  
                                                          sail2_state_monad$bindS
                                                            (reg_name_forwards
                                                               rs1)
                                                            (\ (w__132 : string) .  
                                                             sail2_state_monad$bindS
                                                               (reg_name_forwards
                                                                  rs2)
                                                               (\ (w__133 : string) . 
                                                                sail2_state_monad$returnS
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    mul_mnemonic_forwards
                                                                    (high, signed1, signed2)))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__131
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__132
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__133 
                                                                    "")))))))))))))))))
     | DIV0 ((rs2, rs1, rd, s)) => sail2_state_monad$bindS
                                     (reg_name_forwards rd)
                                     (\ (w__134 : string) .  sail2_state_monad$bindS
                                                               (reg_name_forwards
                                                                  rs1)
                                                               (\ (w__135 : string) .  
                                                                sail2_state_monad$bindS
                                                                  (reg_name_forwards
                                                                    rs2)
                                                                  (\ (w__136 : string) . 
                                                                   sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "div"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_not_u_forwards
                                                                    s))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__134
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__135
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__136 
                                                                    "")))))))))))))))))))
     | REM ((rs2, rs1, rd, s)) => sail2_state_monad$bindS
                                    (reg_name_forwards rd)
                                    (\ (w__137 : string) .  sail2_state_monad$bindS
                                                              (reg_name_forwards
                                                                 rs1)
                                                              (\ (w__138 : string) .  
                                                               sail2_state_monad$bindS
                                                                 (reg_name_forwards
                                                                    rs2)
                                                                 (\ (w__139 : string) . 
                                                                  sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "rem"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    maybe_not_u_forwards
                                                                    s))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__137
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__138
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__139 
                                                                    "")))))))))))))))))))
     | MULW ((rs2, rs1, rd)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__140 : string) .  sail2_state_monad$bindS
                                 (reg_name_forwards rs1)
                                 (\ (w__141 : string) .  sail2_state_monad$bindS
                                                           (reg_name_forwards
                                                              rs2)
                                                           (\ (w__142 : string) . 
                                                            sail2_state_monad$returnS
                                                              ((string_append
                                                                  "mulw"
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__140
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__141
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__142 
                                                                    "")))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | DIVW ((rs2, rs1, rd, s)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__145 : string) .  sail2_state_monad$bindS
                                 (reg_name_forwards rs1)
                                 (\ (w__146 : string) .  sail2_state_monad$bindS
                                                           (reg_name_forwards
                                                              rs2)
                                                           (\ (w__147 : string) . 
                                                            sail2_state_monad$returnS
                                                              ((string_append
                                                                  "div"
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    maybe_not_u_forwards
                                                                    s))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "w"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__145
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__146
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__147 
                                                                    "")))))))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | REMW ((rs2, rs1, rd, s)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__150 : string) .  sail2_state_monad$bindS
                                 (reg_name_forwards rs1)
                                 (\ (w__151 : string) .  sail2_state_monad$bindS
                                                           (reg_name_forwards
                                                              rs2)
                                                           (\ (w__152 : string) . 
                                                            sail2_state_monad$returnS
                                                              ((string_append
                                                                  "rem"
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    maybe_not_u_forwards
                                                                    s))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "w"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__150
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__151
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__152 
                                                                    "")))))))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | CSR ((csr, rs1, rd, T, op)) => sail2_state_monad$bindS
                                        (reg_name_forwards rd)
                                        (\ (w__155 : string) . 
                                         sail2_state_monad$returnS
                                           ((string_append
                                               ((csr_mnemonic_forwards op))
                                               ((string_append "i"
                                                   ((string_append
                                                       ((spc_forwards () ))
                                                       ((string_append 
                                                         w__155
                                                           ((string_append
                                                               ((sep_forwards
                                                                   () ))
                                                               ((string_append
                                                                   ((
                                                                    csr_name_map_forwards
                                                                    csr))
                                                                   ((
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    rs1)) 
                                                                    "")))))))))))))))))
     | CSR ((csr, rs1, rd, F, op)) => sail2_state_monad$bindS
                                        (reg_name_forwards rd)
                                        (\ (w__156 : string) .  sail2_state_monad$bindS
                                                                  (reg_name_forwards
                                                                    rs1)
                                                                  (\ (w__157 : string) . 
                                                                   sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    csr_mnemonic_forwards
                                                                    op))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__156
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    csr_name_map_forwards
                                                                    csr))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__157 
                                                                    ""))))))))))))))))
     | URET (() ) => sail2_state_monad$returnS "uret"
     | C_NOP_HINT (imm) =>
   sail2_state_monad$returnS
     ((string_append "c.nop.hint."
         ((string_append ((decimal_string_of_bits imm)) ""))))
     | C_ADDI_HINT (rsd) =>
   if (((rsd <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rsd)
       (\ (w__158 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.addi.hint." ((string_append w__158 ""))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_LI_HINT (imm) =>
   sail2_state_monad$returnS
     ((string_append "c.li.hint."
         ((string_append ((decimal_string_of_bits imm)) ""))))
     | C_LUI_HINT (imm) =>
   if (((imm <> (0b000000w : 6 words$word)))) then
     sail2_state_monad$returnS
       ((string_append "c.lui.hint."
           ((string_append ((decimal_string_of_bits imm)) "")))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_MV_HINT (rs2) =>
   if (((rs2 <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rs2)
       (\ (w__163 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.mv.hint." ((string_append w__163 ""))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_ADD_HINT (rs2) =>
   if (((rs2 <> zreg))) then
     sail2_state_monad$bindS (reg_name_forwards rs2)
       (\ (w__166 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.add.hint." ((string_append w__166 ""))))) else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_SLLI_HINT ((shamt, rsd)) =>
   if ((((((shamt = (0b000000w : 6 words$word)))) \/ (((rsd = zreg)))))) then
     sail2_state_monad$bindS (reg_name_forwards rsd)
       (\ (w__169 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.slli.hint."
              ((string_append w__169
                  ((string_append "."
                      ((string_append ((decimal_string_of_bits shamt)) "")))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_SRLI_HINT (rsd) => sail2_state_monad$bindS (creg_name_forwards rsd)
                              (\ (w__172 : string) . 
                               sail2_state_monad$returnS
                                 ((string_append "c.srli.hint."
                                     ((string_append w__172 "")))))
     | C_SRAI_HINT (rsd) => sail2_state_monad$bindS (creg_name_forwards rsd)
                              (\ (w__173 : string) . 
                               sail2_state_monad$returnS
                                 ((string_append "c.srai.hint."
                                     ((string_append w__173 "")))))
     | FENCE_RESERVED ((fm, pred, succ, rs, rd)) =>
   if (((((((((fm <> (0x0w : 4 words$word)))) /\
              (((fm <> (0x8w : 4 words$word))))))) \/
           ((((((rs <> (0b00000w : 5 words$word)))) \/
                (((rd <> (0b00000w : 5 words$word)))))))))) then
     sail2_state_monad$bindS (fence_bits_forwards pred)
       (\ (w__174 : string) .  sail2_state_monad$bindS
                                 (fence_bits_forwards succ)
                                 (\ (w__175 : string) .  sail2_state_monad$bindS
                                                           (reg_name_forwards
                                                              rs)
                                                           (\ (w__176 : string) .  
                                                            sail2_state_monad$bindS
                                                              (reg_name_forwards
                                                                 rd)
                                                              (\ (w__177 : string) . 
                                                               sail2_state_monad$returnS
                                                                 ((string_append
                                                                    "fence.reserved."
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__174
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "."
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__175
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "."
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__176
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "."
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__177
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "."
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    fm)) 
                                                                    ""))))))))))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | FENCEI_RESERVED ((imm, rs, rd)) =>
   if ((((((imm <> (0x000w : 12 words$word)))) \/
           ((((((rs <> zreg))) \/ (((rd <> zreg))))))))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__180 : string) .  sail2_state_monad$bindS (reg_name_forwards rs)
                                 (\ (w__181 : string) . 
                                  sail2_state_monad$returnS
                                    ((string_append "fence.i.reserved."
                                        ((string_append w__180
                                            ((string_append "."
                                                ((string_append w__181
                                                    ((string_append "."
                                                        ((string_append
                                                            ((decimal_string_of_bits
                                                                imm)) 
                                                          ""))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | LOAD_FP ((imm, rs1, rd, width)) => sail2_state_monad$bindS
                                            (freg_name_forwards rd)
                                            (\ (w__184 : string) .  sail2_state_monad$bindS
                                                                    (
                                                                    reg_name_forwards
                                                                    rs1)
                                                                    (
                                                                    \ (w__185 : string) . 
                                                                    sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "fl"
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    size_mnemonic_forwards
                                                                    width))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__184
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "("
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__185
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    ")" 
                                                                    ""))))))))))))))))))))))))))
     | STORE_FP ((imm, rs2, rs1, width)) => sail2_state_monad$bindS
                                              (freg_name_forwards rs2)
                                              (\ (w__186 : string) .  
                                               sail2_state_monad$bindS
                                                 (reg_name_forwards rs1)
                                                 (\ (w__187 : string) . 
                                                  sail2_state_monad$returnS
                                                    ((string_append "fs"
                                                        ((string_append
                                                            ((size_mnemonic_forwards
                                                                width))
                                                            ((string_append
                                                                ((spc_forwards
                                                                    () ))
                                                                ((string_append
                                                                    w__186
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    decimal_string_of_bits
                                                                    imm))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    "("
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__187
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    opt_spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    ")" 
                                                                    ""))))))))))))))))))))))))))
     | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, op)) => sail2_state_monad$bindS
                                                        (freg_name_forwards
                                                           rd)
                                                        (\ (w__188 : string) .  
                                                         sail2_state_monad$bindS
                                                           (freg_name_forwards
                                                              rs1)
                                                           (\ (w__189 : string) .  
                                                            sail2_state_monad$bindS
                                                              (freg_name_forwards
                                                                 rs2)
                                                              (\ (w__190 : string) .  
                                                               sail2_state_monad$bindS
                                                                 (freg_name_forwards
                                                                    rs3)
                                                                 (\ (w__191 : string) . 
                                                                  sail2_state_monad$returnS
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    f_madd_type_mnemonic_S_forwards
                                                                    op))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__188
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__189
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__190
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__191
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))))))))))))
     | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, op)) => sail2_state_monad$bindS
                                                     (freg_name_forwards rd)
                                                     (\ (w__192 : string) .  
                                                      sail2_state_monad$bindS
                                                        (freg_name_forwards
                                                           rs1)
                                                        (\ (w__193 : string) .  
                                                         sail2_state_monad$bindS
                                                           (freg_name_forwards
                                                              rs2)
                                                           (\ (w__194 : string) . 
                                                            sail2_state_monad$returnS
                                                              ((string_append
                                                                  ((f_bin_rm_type_mnemonic_S_forwards
                                                                    op))
                                                                  ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__192
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__193
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__194
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    "")))))))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FSQRT_S)) => sail2_state_monad$bindS
                                                    (freg_name_forwards rd)
                                                    (\ (w__195 : string) .  
                                                     sail2_state_monad$bindS
                                                       (freg_name_forwards
                                                          rs1)
                                                       (\ (w__196 : string) . 
                                                        sail2_state_monad$returnS
                                                          ((string_append
                                                              ((f_un_rm_type_mnemonic_S_forwards
                                                                  FSQRT_S))
                                                              ((string_append
                                                                  ((spc_forwards
                                                                    () ))
                                                                  ((string_append
                                                                    w__195
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__196
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_W_S)) => sail2_state_monad$bindS
                                                     (reg_name_forwards rd)
                                                     (\ (w__197 : string) .  
                                                      sail2_state_monad$bindS
                                                        (freg_name_forwards
                                                           rs1)
                                                        (\ (w__198 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               ((f_un_rm_type_mnemonic_S_forwards
                                                                   FCVT_W_S))
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__197
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__198
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_WU_S)) => sail2_state_monad$bindS
                                                      (reg_name_forwards rd)
                                                      (\ (w__199 : string) .  
                                                       sail2_state_monad$bindS
                                                         (freg_name_forwards
                                                            rs1)
                                                         (\ (w__200 : string) . 
                                                          sail2_state_monad$returnS
                                                            ((string_append
                                                                ((f_un_rm_type_mnemonic_S_forwards
                                                                    FCVT_WU_S))
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__199
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__200
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_W)) => sail2_state_monad$bindS
                                                     (freg_name_forwards rd)
                                                     (\ (w__201 : string) .  
                                                      sail2_state_monad$bindS
                                                        (reg_name_forwards
                                                           rs1)
                                                        (\ (w__202 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               ((f_un_rm_type_mnemonic_S_forwards
                                                                   FCVT_S_W))
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__201
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__202
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_WU)) => sail2_state_monad$bindS
                                                      (freg_name_forwards rd)
                                                      (\ (w__203 : string) .  
                                                       sail2_state_monad$bindS
                                                         (reg_name_forwards
                                                            rs1)
                                                         (\ (w__204 : string) . 
                                                          sail2_state_monad$returnS
                                                            ((string_append
                                                                ((f_un_rm_type_mnemonic_S_forwards
                                                                    FCVT_S_WU))
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__203
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__204
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_L_S)) => sail2_state_monad$bindS
                                                     (reg_name_forwards rd)
                                                     (\ (w__205 : string) .  
                                                      sail2_state_monad$bindS
                                                        (freg_name_forwards
                                                           rs1)
                                                        (\ (w__206 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               ((f_un_rm_type_mnemonic_S_forwards
                                                                   FCVT_L_S))
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__205
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__206
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_LU_S)) => sail2_state_monad$bindS
                                                      (reg_name_forwards rd)
                                                      (\ (w__207 : string) .  
                                                       sail2_state_monad$bindS
                                                         (freg_name_forwards
                                                            rs1)
                                                         (\ (w__208 : string) . 
                                                          sail2_state_monad$returnS
                                                            ((string_append
                                                                ((f_un_rm_type_mnemonic_S_forwards
                                                                    FCVT_LU_S))
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__207
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__208
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_L)) => sail2_state_monad$bindS
                                                     (freg_name_forwards rd)
                                                     (\ (w__209 : string) .  
                                                      sail2_state_monad$bindS
                                                        (reg_name_forwards
                                                           rs1)
                                                        (\ (w__210 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               ((f_un_rm_type_mnemonic_S_forwards
                                                                   FCVT_S_L))
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__209
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__210
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_LU)) => sail2_state_monad$bindS
                                                      (freg_name_forwards rd)
                                                      (\ (w__211 : string) .  
                                                       sail2_state_monad$bindS
                                                         (reg_name_forwards
                                                            rs1)
                                                         (\ (w__212 : string) . 
                                                          sail2_state_monad$returnS
                                                            ((string_append
                                                                ((f_un_rm_type_mnemonic_S_forwards
                                                                    FCVT_S_LU))
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__211
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__212
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    frm_mnemonic_forwards
                                                                    rm)) 
                                                                    ""))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJ_S)) => sail2_state_monad$bindS
                                                   (freg_name_forwards rd)
                                                   (\ (w__213 : string) .  
                                                    sail2_state_monad$bindS
                                                      (freg_name_forwards rs1)
                                                      (\ (w__214 : string) .  
                                                       sail2_state_monad$bindS
                                                         (freg_name_forwards
                                                            rs2)
                                                         (\ (w__215 : string) . 
                                                          sail2_state_monad$returnS
                                                            ((string_append
                                                                ((f_bin_type_mnemonic_S_forwards
                                                                    FSGNJ_S))
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__213
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__214
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__215 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJN_S)) => sail2_state_monad$bindS
                                                    (freg_name_forwards rd)
                                                    (\ (w__216 : string) .  
                                                     sail2_state_monad$bindS
                                                       (freg_name_forwards
                                                          rs1)
                                                       (\ (w__217 : string) .  
                                                        sail2_state_monad$bindS
                                                          (freg_name_forwards
                                                             rs2)
                                                          (\ (w__218 : string) . 
                                                           sail2_state_monad$returnS
                                                             ((string_append
                                                                 ((f_bin_type_mnemonic_S_forwards
                                                                    FSGNJN_S))
                                                                 ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__216
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__217
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__218 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJX_S)) => sail2_state_monad$bindS
                                                    (freg_name_forwards rd)
                                                    (\ (w__219 : string) .  
                                                     sail2_state_monad$bindS
                                                       (freg_name_forwards
                                                          rs1)
                                                       (\ (w__220 : string) .  
                                                        sail2_state_monad$bindS
                                                          (freg_name_forwards
                                                             rs2)
                                                          (\ (w__221 : string) . 
                                                           sail2_state_monad$returnS
                                                             ((string_append
                                                                 ((f_bin_type_mnemonic_S_forwards
                                                                    FSGNJX_S))
                                                                 ((string_append
                                                                    (
                                                                    (
                                                                    spc_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__219
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__220
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__221 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FMIN_S)) => sail2_state_monad$bindS
                                                  (freg_name_forwards rd)
                                                  (\ (w__222 : string) .  
                                                   sail2_state_monad$bindS
                                                     (freg_name_forwards rs1)
                                                     (\ (w__223 : string) .  
                                                      sail2_state_monad$bindS
                                                        (freg_name_forwards
                                                           rs2)
                                                        (\ (w__224 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               ((f_bin_type_mnemonic_S_forwards
                                                                   FMIN_S))
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__222
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__223
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__224 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FMAX_S)) => sail2_state_monad$bindS
                                                  (freg_name_forwards rd)
                                                  (\ (w__225 : string) .  
                                                   sail2_state_monad$bindS
                                                     (freg_name_forwards rs1)
                                                     (\ (w__226 : string) .  
                                                      sail2_state_monad$bindS
                                                        (freg_name_forwards
                                                           rs2)
                                                        (\ (w__227 : string) . 
                                                         sail2_state_monad$returnS
                                                           ((string_append
                                                               ((f_bin_type_mnemonic_S_forwards
                                                                   FMAX_S))
                                                               ((string_append
                                                                   ((
                                                                    spc_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__225
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__226
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__227 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FEQ_S)) => sail2_state_monad$bindS
                                                 (reg_name_forwards rd)
                                                 (\ (w__228 : string) .  
                                                  sail2_state_monad$bindS
                                                    (freg_name_forwards rs1)
                                                    (\ (w__229 : string) .  
                                                     sail2_state_monad$bindS
                                                       (freg_name_forwards
                                                          rs2)
                                                       (\ (w__230 : string) . 
                                                        sail2_state_monad$returnS
                                                          ((string_append
                                                              ((f_bin_type_mnemonic_S_forwards
                                                                  FEQ_S))
                                                              ((string_append
                                                                  ((spc_forwards
                                                                    () ))
                                                                  ((string_append
                                                                    w__228
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__229
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__230 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FLT_S)) => sail2_state_monad$bindS
                                                 (reg_name_forwards rd)
                                                 (\ (w__231 : string) .  
                                                  sail2_state_monad$bindS
                                                    (freg_name_forwards rs1)
                                                    (\ (w__232 : string) .  
                                                     sail2_state_monad$bindS
                                                       (freg_name_forwards
                                                          rs2)
                                                       (\ (w__233 : string) . 
                                                        sail2_state_monad$returnS
                                                          ((string_append
                                                              ((f_bin_type_mnemonic_S_forwards
                                                                  FLT_S))
                                                              ((string_append
                                                                  ((spc_forwards
                                                                    () ))
                                                                  ((string_append
                                                                    w__231
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__232
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__233 
                                                                    "")))))))))))))))))
     | F_BIN_TYPE_S ((rs2, rs1, rd, FLE_S)) => sail2_state_monad$bindS
                                                 (reg_name_forwards rd)
                                                 (\ (w__234 : string) .  
                                                  sail2_state_monad$bindS
                                                    (freg_name_forwards rs1)
                                                    (\ (w__235 : string) .  
                                                     sail2_state_monad$bindS
                                                       (freg_name_forwards
                                                          rs2)
                                                       (\ (w__236 : string) . 
                                                        sail2_state_monad$returnS
                                                          ((string_append
                                                              ((f_bin_type_mnemonic_S_forwards
                                                                  FLE_S))
                                                              ((string_append
                                                                  ((spc_forwards
                                                                    () ))
                                                                  ((string_append
                                                                    w__234
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__235
                                                                    (
                                                                    (
                                                                    string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__236 
                                                                    "")))))))))))))))))
     | F_UN_TYPE_S ((rs1, rd, FMV_X_W)) => sail2_state_monad$bindS
                                             (reg_name_forwards rd)
                                             (\ (w__237 : string) .  
                                              sail2_state_monad$bindS
                                                (freg_name_forwards rs1)
                                                (\ (w__238 : string) . 
                                                 sail2_state_monad$returnS
                                                   ((string_append
                                                       ((f_un_type_mnemonic_S_forwards
                                                           FMV_X_W))
                                                       ((string_append
                                                           ((spc_forwards () ))
                                                           ((string_append
                                                               w__237
                                                               ((string_append
                                                                   ((
                                                                    sep_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__238 
                                                                    ""))))))))))))
     | F_UN_TYPE_S ((rs1, rd, FMV_W_X)) => sail2_state_monad$bindS
                                             (freg_name_forwards rd)
                                             (\ (w__239 : string) .  
                                              sail2_state_monad$bindS
                                                (reg_name_forwards rs1)
                                                (\ (w__240 : string) . 
                                                 sail2_state_monad$returnS
                                                   ((string_append
                                                       ((f_un_type_mnemonic_S_forwards
                                                           FMV_W_X))
                                                       ((string_append
                                                           ((spc_forwards () ))
                                                           ((string_append
                                                               w__239
                                                               ((string_append
                                                                   ((
                                                                    sep_forwards
                                                                    () ))
                                                                   ((
                                                                    string_append
                                                                    w__240 
                                                                    ""))))))))))))
     | F_UN_TYPE_S ((rs1, rd, FCLASS_S)) => sail2_state_monad$bindS
                                              (reg_name_forwards rd)
                                              (\ (w__241 : string) .  
                                               sail2_state_monad$bindS
                                                 (freg_name_forwards rs1)
                                                 (\ (w__242 : string) . 
                                                  sail2_state_monad$returnS
                                                    ((string_append
                                                        ((f_un_type_mnemonic_S_forwards
                                                            FCLASS_S))
                                                        ((string_append
                                                            ((spc_forwards
                                                                () ))
                                                            ((string_append
                                                                w__241
                                                                ((string_append
                                                                    (
                                                                    (
                                                                    sep_forwards
                                                                    () ))
                                                                    (
                                                                    (
                                                                    string_append
                                                                    w__242 
                                                                    ""))))))))))))
     | C_FLWSP ((imm, rd)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__243 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.flwsp"
              ((string_append ((spc_forwards () ))
                  ((string_append w__243
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits imm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_FSWSP ((uimm, rd)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then
     sail2_state_monad$bindS (reg_name_forwards rd)
       (\ (w__246 : string) . 
        sail2_state_monad$returnS
          ((string_append "c.fswsp"
              ((string_append ((spc_forwards () ))
                  ((string_append w__246
                      ((string_append ((sep_forwards () ))
                          ((string_append ((decimal_string_of_bits uimm)) "")))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_FLW ((uimm, rsc, rdc)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then
     sail2_state_monad$bindS (creg_name_forwards rdc)
       (\ (w__249 : string) .  sail2_state_monad$bindS
                                 (creg_name_forwards rsc)
                                 (\ (w__250 : string) . 
                                  sail2_state_monad$returnS
                                    ((string_append "c.flw"
                                        ((string_append ((spc_forwards () ))
                                            ((string_append w__249
                                                ((string_append
                                                    ((sep_forwards () ))
                                                    ((string_append w__250
                                                        ((string_append
                                                            ((sep_forwards
                                                                () ))
                                                            ((string_append
                                                                ((decimal_string_of_bits
                                                                    (
                                                                    (
                                                                    concat_vec
                                                                    uimm
                                                                    (
                                                                    0b00w : 2 words$word) : 7 words$word))))
                                                                ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | C_FSW ((uimm, rsc1, rsc2)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then
     sail2_state_monad$bindS (creg_name_forwards rsc1)
       (\ (w__253 : string) .  sail2_state_monad$bindS
                                 (creg_name_forwards rsc2)
                                 (\ (w__254 : string) . 
                                  sail2_state_monad$returnS
                                    ((string_append "c.fsw"
                                        ((string_append ((spc_forwards () ))
                                            ((string_append w__253
                                                ((string_append
                                                    ((sep_forwards () ))
                                                    ((string_append w__254
                                                        ((string_append
                                                            ((sep_forwards
                                                                () ))
                                                            ((string_append
                                                                ((decimal_string_of_bits
                                                                    (
                                                                    (
                                                                    concat_vec
                                                                    uimm
                                                                    (
                                                                    0b00w : 2 words$word) : 7 words$word))))
                                                                ""))))))))))))))))
   else
     sail2_state_monad$seqS
       (sail2_state_monad$assert_expS F
          "Pattern match failure at unknown location")
       (sail2_state_monad$exitS () )
     | ILLEGAL (s) =>
   sail2_state_monad$returnS
     ((string_append "illegal"
         ((string_append ((spc_forwards () ))
             ((string_append ((decimal_string_of_bits s)) ""))))))
     | C_ILLEGAL (s) =>
   sail2_state_monad$returnS
     ((string_append "c.illegal"
         ((string_append ((spc_forwards () ))
             ((string_append ((decimal_string_of_bits s)) ""))))))
   )))`;


(*val _s2645_ : string -> maybe (mword ty16)*)

val _ = Define `
 ((s2645_:string ->((16)words$word)option) s2646_0=
    (let s2647_0 = s2646_0 in
   if ((string_startswith s2647_0 "c.illegal")) then  
  (case ((string_drop s2647_0 ((string_length "c.illegal")))) of
        s2648_0 =>
  (case ((spc_matches_prefix0 s2648_0)) of
        SOME ((() , s2649_0)) =>
  (case ((string_drop s2648_0 s2649_0)) of
        s2650_0 =>
  (case ((hex_bits_16_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2650_0 : (( 16 words$word # ii)) option)) of
        SOME ((s, s2651_0)) =>
  let p0_ = (string_drop s2650_0 s2651_0) in
  if (((p0_ = ""))) then SOME s else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2637_ : string -> maybe (mword ty32)*)

val _ = Define `
 ((s2637_:string ->((32)words$word)option) s2638_0=
    (let s2639_0 = s2638_0 in
   if ((string_startswith s2639_0 "illegal")) then  
  (case ((string_drop s2639_0 ((string_length "illegal")))) of
        s2640_0 =>
  (case ((spc_matches_prefix0 s2640_0)) of
        SOME ((() , s2641_0)) =>
  (case ((string_drop s2640_0 s2641_0)) of
        s2642_0 =>
  (case ((hex_bits_32_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2642_0 : (( 32 words$word # ii)) option)) of
        SOME ((s, s2643_0)) =>
  let p0_ = (string_drop s2642_0 s2643_0) in
  if (((p0_ = ""))) then SOME s else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2621_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s2621_:string ->((3)words$word#(3)words$word#(5)words$word)option) s2622_0=
    (let s2623_0 = s2622_0 in
   if ((string_startswith s2623_0 "c.fsw")) then  
  (case ((string_drop s2623_0 ((string_length "c.fsw")))) of
        s2624_0 =>
  (case ((spc_matches_prefix0 s2624_0)) of
        SOME ((() , s2625_0)) =>
  (case ((string_drop s2624_0 s2625_0)) of
        s2626_0 =>
  (case ((creg_name_matches_prefix s2626_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s2627_0)) =>
  (case ((string_drop s2626_0 s2627_0)) of
        s2628_0 =>
  (case ((sep_matches_prefix s2628_0)) of
        SOME ((() , s2629_0)) =>
  (case ((string_drop s2628_0 s2629_0)) of
        s2630_0 =>
  (case ((creg_name_matches_prefix s2630_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s2631_0)) =>
  (case ((string_drop s2630_0 s2631_0)) of
        s2632_0 =>
  (case ((sep_matches_prefix s2632_0)) of
        SOME ((() , s2633_0)) =>
  (case ((string_drop s2632_0 s2633_0)) of
        s2634_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2634_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1180, s2635_0)) =>
  if (((((subrange_vec_dec v__1180 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1180 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1180 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s2634_0 s2635_0) in
    if (((p0_ = ""))) then SOME (rsc1, rsc2, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2605_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s2605_:string ->((3)words$word#(3)words$word#(5)words$word)option) s2606_0=
    (let s2607_0 = s2606_0 in
   if ((string_startswith s2607_0 "c.flw")) then  
  (case ((string_drop s2607_0 ((string_length "c.flw")))) of
        s2608_0 =>
  (case ((spc_matches_prefix0 s2608_0)) of
        SOME ((() , s2609_0)) =>
  (case ((string_drop s2608_0 s2609_0)) of
        s2610_0 =>
  (case ((creg_name_matches_prefix s2610_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s2611_0)) =>
  (case ((string_drop s2610_0 s2611_0)) of
        s2612_0 =>
  (case ((sep_matches_prefix s2612_0)) of
        SOME ((() , s2613_0)) =>
  (case ((string_drop s2612_0 s2613_0)) of
        s2614_0 =>
  (case ((creg_name_matches_prefix s2614_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s2615_0)) =>
  (case ((string_drop s2614_0 s2615_0)) of
        s2616_0 =>
  (case ((sep_matches_prefix s2616_0)) of
        SOME ((() , s2617_0)) =>
  (case ((string_drop s2616_0 s2617_0)) of
        s2618_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2618_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1182, s2619_0)) =>
  if (((((subrange_vec_dec v__1182 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1182 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1182 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s2618_0 s2619_0) in
    if (((p0_ = ""))) then SOME (rdc, rsc, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2593_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s2593_:string ->((5)words$word#(6)words$word)option) s2594_0=
    (let s2595_0 = s2594_0 in
   if ((string_startswith s2595_0 "c.fswsp")) then  
  (case ((string_drop s2595_0 ((string_length "c.fswsp")))) of
        s2596_0 =>
  (case ((spc_matches_prefix0 s2596_0)) of
        SOME ((() , s2597_0)) =>
  (case ((string_drop s2596_0 s2597_0)) of
        s2598_0 =>
  (case ((reg_name_matches_prefix s2598_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2599_0)) =>
  (case ((string_drop s2598_0 s2599_0)) of
        s2600_0 =>
  (case ((sep_matches_prefix s2600_0)) of
        SOME ((() , s2601_0)) =>
  (case ((string_drop s2600_0 s2601_0)) of
        s2602_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2602_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s2603_0)) =>
  let p0_ = (string_drop s2602_0 s2603_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2581_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s2581_:string ->((5)words$word#(6)words$word)option) s2582_0=
    (let s2583_0 = s2582_0 in
   if ((string_startswith s2583_0 "c.flwsp")) then  
  (case ((string_drop s2583_0 ((string_length "c.flwsp")))) of
        s2584_0 =>
  (case ((spc_matches_prefix0 s2584_0)) of
        SOME ((() , s2585_0)) =>
  (case ((string_drop s2584_0 s2585_0)) of
        s2586_0 =>
  (case ((reg_name_matches_prefix s2586_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2587_0)) =>
  (case ((string_drop s2586_0 s2587_0)) of
        s2588_0 =>
  (case ((sep_matches_prefix s2588_0)) of
        SOME ((() , s2589_0)) =>
  (case ((string_drop s2588_0 s2589_0)) of
        s2590_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2590_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s2591_0)) =>
  let p0_ = (string_drop s2590_0 s2591_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2568_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2568_:string ->(f_un_op_S#(5)words$word#(5)words$word)option) s2569_0= 
  ((case s2569_0 of
         s2570_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s2570_0)) of
         SOME ((FCLASS_S, s2571_0)) =>
   (case ((string_drop s2570_0 s2571_0)) of
         s2572_0 =>
   (case ((spc_matches_prefix0 s2572_0)) of
         SOME ((() , s2573_0)) =>
   (case ((string_drop s2572_0 s2573_0)) of
         s2574_0 =>
   (case ((reg_name_matches_prefix s2574_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2575_0)) =>
   (case ((string_drop s2574_0 s2575_0)) of
         s2576_0 =>
   (case ((sep_matches_prefix s2576_0)) of
         SOME ((() , s2577_0)) =>
   (case ((string_drop s2576_0 s2577_0)) of
         s2578_0 =>
   (case ((freg_name_matches_prefix s2578_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2579_0)) =>
   let p0_ = (string_drop s2578_0 s2579_0) in
   if (((p0_ = ""))) then SOME (FCLASS_S, rd, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2555_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2555_:string ->(f_un_op_S#(5)words$word#(5)words$word)option) s2556_0= 
  ((case s2556_0 of
         s2557_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s2557_0)) of
         SOME ((FMV_W_X, s2558_0)) =>
   (case ((string_drop s2557_0 s2558_0)) of
         s2559_0 =>
   (case ((spc_matches_prefix0 s2559_0)) of
         SOME ((() , s2560_0)) =>
   (case ((string_drop s2559_0 s2560_0)) of
         s2561_0 =>
   (case ((freg_name_matches_prefix s2561_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2562_0)) =>
   (case ((string_drop s2561_0 s2562_0)) of
         s2563_0 =>
   (case ((sep_matches_prefix s2563_0)) of
         SOME ((() , s2564_0)) =>
   (case ((string_drop s2563_0 s2564_0)) of
         s2565_0 =>
   (case ((reg_name_matches_prefix s2565_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2566_0)) =>
   let p0_ = (string_drop s2565_0 s2566_0) in
   if (((p0_ = ""))) then SOME (FMV_W_X, rd, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2542_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2542_:string ->(f_un_op_S#(5)words$word#(5)words$word)option) s2543_0= 
  ((case s2543_0 of
         s2544_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s2544_0)) of
         SOME ((FMV_X_W, s2545_0)) =>
   (case ((string_drop s2544_0 s2545_0)) of
         s2546_0 =>
   (case ((spc_matches_prefix0 s2546_0)) of
         SOME ((() , s2547_0)) =>
   (case ((string_drop s2546_0 s2547_0)) of
         s2548_0 =>
   (case ((reg_name_matches_prefix s2548_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2549_0)) =>
   (case ((string_drop s2548_0 s2549_0)) of
         s2550_0 =>
   (case ((sep_matches_prefix s2550_0)) of
         SOME ((() , s2551_0)) =>
   (case ((string_drop s2550_0 s2551_0)) of
         s2552_0 =>
   (case ((freg_name_matches_prefix s2552_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2553_0)) =>
   let p0_ = (string_drop s2552_0 s2553_0) in
   if (((p0_ = ""))) then SOME (FMV_X_W, rd, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2525_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2525_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2526_0= 
  ((case s2526_0 of
         s2527_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2527_0)) of
         SOME ((FLE_S, s2528_0)) =>
   (case ((string_drop s2527_0 s2528_0)) of
         s2529_0 =>
   (case ((spc_matches_prefix0 s2529_0)) of
         SOME ((() , s2530_0)) =>
   (case ((string_drop s2529_0 s2530_0)) of
         s2531_0 =>
   (case ((reg_name_matches_prefix s2531_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2532_0)) =>
   (case ((string_drop s2531_0 s2532_0)) of
         s2533_0 =>
   (case ((sep_matches_prefix s2533_0)) of
         SOME ((() , s2534_0)) =>
   (case ((string_drop s2533_0 s2534_0)) of
         s2535_0 =>
   (case ((freg_name_matches_prefix s2535_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2536_0)) =>
   (case ((string_drop s2535_0 s2536_0)) of
         s2537_0 =>
   (case ((sep_matches_prefix s2537_0)) of
         SOME ((() , s2538_0)) =>
   (case ((string_drop s2537_0 s2538_0)) of
         s2539_0 =>
   (case ((freg_name_matches_prefix s2539_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2540_0)) =>
   let p0_ = (string_drop s2539_0 s2540_0) in
   if (((p0_ = ""))) then SOME (FLE_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2508_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2508_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2509_0= 
  ((case s2509_0 of
         s2510_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2510_0)) of
         SOME ((FLT_S, s2511_0)) =>
   (case ((string_drop s2510_0 s2511_0)) of
         s2512_0 =>
   (case ((spc_matches_prefix0 s2512_0)) of
         SOME ((() , s2513_0)) =>
   (case ((string_drop s2512_0 s2513_0)) of
         s2514_0 =>
   (case ((reg_name_matches_prefix s2514_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2515_0)) =>
   (case ((string_drop s2514_0 s2515_0)) of
         s2516_0 =>
   (case ((sep_matches_prefix s2516_0)) of
         SOME ((() , s2517_0)) =>
   (case ((string_drop s2516_0 s2517_0)) of
         s2518_0 =>
   (case ((freg_name_matches_prefix s2518_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2519_0)) =>
   (case ((string_drop s2518_0 s2519_0)) of
         s2520_0 =>
   (case ((sep_matches_prefix s2520_0)) of
         SOME ((() , s2521_0)) =>
   (case ((string_drop s2520_0 s2521_0)) of
         s2522_0 =>
   (case ((freg_name_matches_prefix s2522_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2523_0)) =>
   let p0_ = (string_drop s2522_0 s2523_0) in
   if (((p0_ = ""))) then SOME (FLT_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2491_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2491_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2492_0= 
  ((case s2492_0 of
         s2493_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2493_0)) of
         SOME ((FEQ_S, s2494_0)) =>
   (case ((string_drop s2493_0 s2494_0)) of
         s2495_0 =>
   (case ((spc_matches_prefix0 s2495_0)) of
         SOME ((() , s2496_0)) =>
   (case ((string_drop s2495_0 s2496_0)) of
         s2497_0 =>
   (case ((reg_name_matches_prefix s2497_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2498_0)) =>
   (case ((string_drop s2497_0 s2498_0)) of
         s2499_0 =>
   (case ((sep_matches_prefix s2499_0)) of
         SOME ((() , s2500_0)) =>
   (case ((string_drop s2499_0 s2500_0)) of
         s2501_0 =>
   (case ((freg_name_matches_prefix s2501_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2502_0)) =>
   (case ((string_drop s2501_0 s2502_0)) of
         s2503_0 =>
   (case ((sep_matches_prefix s2503_0)) of
         SOME ((() , s2504_0)) =>
   (case ((string_drop s2503_0 s2504_0)) of
         s2505_0 =>
   (case ((freg_name_matches_prefix s2505_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2506_0)) =>
   let p0_ = (string_drop s2505_0 s2506_0) in
   if (((p0_ = ""))) then SOME (FEQ_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2474_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2474_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2475_0= 
  ((case s2475_0 of
         s2476_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2476_0)) of
         SOME ((FMAX_S, s2477_0)) =>
   (case ((string_drop s2476_0 s2477_0)) of
         s2478_0 =>
   (case ((spc_matches_prefix0 s2478_0)) of
         SOME ((() , s2479_0)) =>
   (case ((string_drop s2478_0 s2479_0)) of
         s2480_0 =>
   (case ((freg_name_matches_prefix s2480_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2481_0)) =>
   (case ((string_drop s2480_0 s2481_0)) of
         s2482_0 =>
   (case ((sep_matches_prefix s2482_0)) of
         SOME ((() , s2483_0)) =>
   (case ((string_drop s2482_0 s2483_0)) of
         s2484_0 =>
   (case ((freg_name_matches_prefix s2484_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2485_0)) =>
   (case ((string_drop s2484_0 s2485_0)) of
         s2486_0 =>
   (case ((sep_matches_prefix s2486_0)) of
         SOME ((() , s2487_0)) =>
   (case ((string_drop s2486_0 s2487_0)) of
         s2488_0 =>
   (case ((freg_name_matches_prefix s2488_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2489_0)) =>
   let p0_ = (string_drop s2488_0 s2489_0) in
   if (((p0_ = ""))) then SOME (FMAX_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2457_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2457_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2458_0= 
  ((case s2458_0 of
         s2459_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2459_0)) of
         SOME ((FMIN_S, s2460_0)) =>
   (case ((string_drop s2459_0 s2460_0)) of
         s2461_0 =>
   (case ((spc_matches_prefix0 s2461_0)) of
         SOME ((() , s2462_0)) =>
   (case ((string_drop s2461_0 s2462_0)) of
         s2463_0 =>
   (case ((freg_name_matches_prefix s2463_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2464_0)) =>
   (case ((string_drop s2463_0 s2464_0)) of
         s2465_0 =>
   (case ((sep_matches_prefix s2465_0)) of
         SOME ((() , s2466_0)) =>
   (case ((string_drop s2465_0 s2466_0)) of
         s2467_0 =>
   (case ((freg_name_matches_prefix s2467_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2468_0)) =>
   (case ((string_drop s2467_0 s2468_0)) of
         s2469_0 =>
   (case ((sep_matches_prefix s2469_0)) of
         SOME ((() , s2470_0)) =>
   (case ((string_drop s2469_0 s2470_0)) of
         s2471_0 =>
   (case ((freg_name_matches_prefix s2471_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2472_0)) =>
   let p0_ = (string_drop s2471_0 s2472_0) in
   if (((p0_ = ""))) then SOME (FMIN_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2440_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2440_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2441_0= 
  ((case s2441_0 of
         s2442_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2442_0)) of
         SOME ((FSGNJX_S, s2443_0)) =>
   (case ((string_drop s2442_0 s2443_0)) of
         s2444_0 =>
   (case ((spc_matches_prefix0 s2444_0)) of
         SOME ((() , s2445_0)) =>
   (case ((string_drop s2444_0 s2445_0)) of
         s2446_0 =>
   (case ((freg_name_matches_prefix s2446_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2447_0)) =>
   (case ((string_drop s2446_0 s2447_0)) of
         s2448_0 =>
   (case ((sep_matches_prefix s2448_0)) of
         SOME ((() , s2449_0)) =>
   (case ((string_drop s2448_0 s2449_0)) of
         s2450_0 =>
   (case ((freg_name_matches_prefix s2450_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2451_0)) =>
   (case ((string_drop s2450_0 s2451_0)) of
         s2452_0 =>
   (case ((sep_matches_prefix s2452_0)) of
         SOME ((() , s2453_0)) =>
   (case ((string_drop s2452_0 s2453_0)) of
         s2454_0 =>
   (case ((freg_name_matches_prefix s2454_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2455_0)) =>
   let p0_ = (string_drop s2454_0 s2455_0) in
   if (((p0_ = ""))) then SOME (FSGNJX_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2423_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2423_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2424_0= 
  ((case s2424_0 of
         s2425_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2425_0)) of
         SOME ((FSGNJN_S, s2426_0)) =>
   (case ((string_drop s2425_0 s2426_0)) of
         s2427_0 =>
   (case ((spc_matches_prefix0 s2427_0)) of
         SOME ((() , s2428_0)) =>
   (case ((string_drop s2427_0 s2428_0)) of
         s2429_0 =>
   (case ((freg_name_matches_prefix s2429_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2430_0)) =>
   (case ((string_drop s2429_0 s2430_0)) of
         s2431_0 =>
   (case ((sep_matches_prefix s2431_0)) of
         SOME ((() , s2432_0)) =>
   (case ((string_drop s2431_0 s2432_0)) of
         s2433_0 =>
   (case ((freg_name_matches_prefix s2433_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2434_0)) =>
   (case ((string_drop s2433_0 s2434_0)) of
         s2435_0 =>
   (case ((sep_matches_prefix s2435_0)) of
         SOME ((() , s2436_0)) =>
   (case ((string_drop s2435_0 s2436_0)) of
         s2437_0 =>
   (case ((freg_name_matches_prefix s2437_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2438_0)) =>
   let p0_ = (string_drop s2437_0 s2438_0) in
   if (((p0_ = ""))) then SOME (FSGNJN_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2406_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2406_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s2407_0= 
  ((case s2407_0 of
         s2408_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s2408_0)) of
         SOME ((FSGNJ_S, s2409_0)) =>
   (case ((string_drop s2408_0 s2409_0)) of
         s2410_0 =>
   (case ((spc_matches_prefix0 s2410_0)) of
         SOME ((() , s2411_0)) =>
   (case ((string_drop s2410_0 s2411_0)) of
         s2412_0 =>
   (case ((freg_name_matches_prefix s2412_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2413_0)) =>
   (case ((string_drop s2412_0 s2413_0)) of
         s2414_0 =>
   (case ((sep_matches_prefix s2414_0)) of
         SOME ((() , s2415_0)) =>
   (case ((string_drop s2414_0 s2415_0)) of
         s2416_0 =>
   (case ((freg_name_matches_prefix s2416_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2417_0)) =>
   (case ((string_drop s2416_0 s2417_0)) of
         s2418_0 =>
   (case ((sep_matches_prefix s2418_0)) of
         SOME ((() , s2419_0)) =>
   (case ((string_drop s2418_0 s2419_0)) of
         s2420_0 =>
   (case ((freg_name_matches_prefix s2420_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2421_0)) =>
   let p0_ = (string_drop s2420_0 s2421_0) in
   if (((p0_ = ""))) then SOME (FSGNJ_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2389_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2389_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2390_0= 
  ((case s2390_0 of
         s2391_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2391_0)) of
         SOME ((FCVT_S_LU, s2392_0)) =>
   (case ((string_drop s2391_0 s2392_0)) of
         s2393_0 =>
   (case ((spc_matches_prefix0 s2393_0)) of
         SOME ((() , s2394_0)) =>
   (case ((string_drop s2393_0 s2394_0)) of
         s2395_0 =>
   (case ((freg_name_matches_prefix s2395_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2396_0)) =>
   (case ((string_drop s2395_0 s2396_0)) of
         s2397_0 =>
   (case ((sep_matches_prefix s2397_0)) of
         SOME ((() , s2398_0)) =>
   (case ((string_drop s2397_0 s2398_0)) of
         s2399_0 =>
   (case ((reg_name_matches_prefix s2399_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2400_0)) =>
   (case ((string_drop s2399_0 s2400_0)) of
         s2401_0 =>
   (case ((sep_matches_prefix s2401_0)) of
         SOME ((() , s2402_0)) =>
   (case ((string_drop s2401_0 s2402_0)) of
         s2403_0 =>
   (case ((frm_mnemonic_matches_prefix s2403_0)) of
         SOME ((rm, s2404_0)) =>
   let p0_ = (string_drop s2403_0 s2404_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_LU, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2372_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2372_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2373_0= 
  ((case s2373_0 of
         s2374_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2374_0)) of
         SOME ((FCVT_S_L, s2375_0)) =>
   (case ((string_drop s2374_0 s2375_0)) of
         s2376_0 =>
   (case ((spc_matches_prefix0 s2376_0)) of
         SOME ((() , s2377_0)) =>
   (case ((string_drop s2376_0 s2377_0)) of
         s2378_0 =>
   (case ((freg_name_matches_prefix s2378_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2379_0)) =>
   (case ((string_drop s2378_0 s2379_0)) of
         s2380_0 =>
   (case ((sep_matches_prefix s2380_0)) of
         SOME ((() , s2381_0)) =>
   (case ((string_drop s2380_0 s2381_0)) of
         s2382_0 =>
   (case ((reg_name_matches_prefix s2382_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2383_0)) =>
   (case ((string_drop s2382_0 s2383_0)) of
         s2384_0 =>
   (case ((sep_matches_prefix s2384_0)) of
         SOME ((() , s2385_0)) =>
   (case ((string_drop s2384_0 s2385_0)) of
         s2386_0 =>
   (case ((frm_mnemonic_matches_prefix s2386_0)) of
         SOME ((rm, s2387_0)) =>
   let p0_ = (string_drop s2386_0 s2387_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_L, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2355_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2355_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2356_0= 
  ((case s2356_0 of
         s2357_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2357_0)) of
         SOME ((FCVT_LU_S, s2358_0)) =>
   (case ((string_drop s2357_0 s2358_0)) of
         s2359_0 =>
   (case ((spc_matches_prefix0 s2359_0)) of
         SOME ((() , s2360_0)) =>
   (case ((string_drop s2359_0 s2360_0)) of
         s2361_0 =>
   (case ((reg_name_matches_prefix s2361_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2362_0)) =>
   (case ((string_drop s2361_0 s2362_0)) of
         s2363_0 =>
   (case ((sep_matches_prefix s2363_0)) of
         SOME ((() , s2364_0)) =>
   (case ((string_drop s2363_0 s2364_0)) of
         s2365_0 =>
   (case ((freg_name_matches_prefix s2365_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2366_0)) =>
   (case ((string_drop s2365_0 s2366_0)) of
         s2367_0 =>
   (case ((sep_matches_prefix s2367_0)) of
         SOME ((() , s2368_0)) =>
   (case ((string_drop s2367_0 s2368_0)) of
         s2369_0 =>
   (case ((frm_mnemonic_matches_prefix s2369_0)) of
         SOME ((rm, s2370_0)) =>
   let p0_ = (string_drop s2369_0 s2370_0) in
   if (((p0_ = ""))) then SOME (FCVT_LU_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2338_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2338_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2339_0= 
  ((case s2339_0 of
         s2340_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2340_0)) of
         SOME ((FCVT_L_S, s2341_0)) =>
   (case ((string_drop s2340_0 s2341_0)) of
         s2342_0 =>
   (case ((spc_matches_prefix0 s2342_0)) of
         SOME ((() , s2343_0)) =>
   (case ((string_drop s2342_0 s2343_0)) of
         s2344_0 =>
   (case ((reg_name_matches_prefix s2344_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2345_0)) =>
   (case ((string_drop s2344_0 s2345_0)) of
         s2346_0 =>
   (case ((sep_matches_prefix s2346_0)) of
         SOME ((() , s2347_0)) =>
   (case ((string_drop s2346_0 s2347_0)) of
         s2348_0 =>
   (case ((freg_name_matches_prefix s2348_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2349_0)) =>
   (case ((string_drop s2348_0 s2349_0)) of
         s2350_0 =>
   (case ((sep_matches_prefix s2350_0)) of
         SOME ((() , s2351_0)) =>
   (case ((string_drop s2350_0 s2351_0)) of
         s2352_0 =>
   (case ((frm_mnemonic_matches_prefix s2352_0)) of
         SOME ((rm, s2353_0)) =>
   let p0_ = (string_drop s2352_0 s2353_0) in
   if (((p0_ = ""))) then SOME (FCVT_L_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2321_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2321_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2322_0= 
  ((case s2322_0 of
         s2323_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2323_0)) of
         SOME ((FCVT_S_WU, s2324_0)) =>
   (case ((string_drop s2323_0 s2324_0)) of
         s2325_0 =>
   (case ((spc_matches_prefix0 s2325_0)) of
         SOME ((() , s2326_0)) =>
   (case ((string_drop s2325_0 s2326_0)) of
         s2327_0 =>
   (case ((freg_name_matches_prefix s2327_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2328_0)) =>
   (case ((string_drop s2327_0 s2328_0)) of
         s2329_0 =>
   (case ((sep_matches_prefix s2329_0)) of
         SOME ((() , s2330_0)) =>
   (case ((string_drop s2329_0 s2330_0)) of
         s2331_0 =>
   (case ((reg_name_matches_prefix s2331_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2332_0)) =>
   (case ((string_drop s2331_0 s2332_0)) of
         s2333_0 =>
   (case ((sep_matches_prefix s2333_0)) of
         SOME ((() , s2334_0)) =>
   (case ((string_drop s2333_0 s2334_0)) of
         s2335_0 =>
   (case ((frm_mnemonic_matches_prefix s2335_0)) of
         SOME ((rm, s2336_0)) =>
   let p0_ = (string_drop s2335_0 s2336_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_WU, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2304_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2304_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2305_0= 
  ((case s2305_0 of
         s2306_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2306_0)) of
         SOME ((FCVT_S_W, s2307_0)) =>
   (case ((string_drop s2306_0 s2307_0)) of
         s2308_0 =>
   (case ((spc_matches_prefix0 s2308_0)) of
         SOME ((() , s2309_0)) =>
   (case ((string_drop s2308_0 s2309_0)) of
         s2310_0 =>
   (case ((freg_name_matches_prefix s2310_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2311_0)) =>
   (case ((string_drop s2310_0 s2311_0)) of
         s2312_0 =>
   (case ((sep_matches_prefix s2312_0)) of
         SOME ((() , s2313_0)) =>
   (case ((string_drop s2312_0 s2313_0)) of
         s2314_0 =>
   (case ((reg_name_matches_prefix s2314_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2315_0)) =>
   (case ((string_drop s2314_0 s2315_0)) of
         s2316_0 =>
   (case ((sep_matches_prefix s2316_0)) of
         SOME ((() , s2317_0)) =>
   (case ((string_drop s2316_0 s2317_0)) of
         s2318_0 =>
   (case ((frm_mnemonic_matches_prefix s2318_0)) of
         SOME ((rm, s2319_0)) =>
   let p0_ = (string_drop s2318_0 s2319_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_W, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2287_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2287_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2288_0= 
  ((case s2288_0 of
         s2289_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2289_0)) of
         SOME ((FCVT_WU_S, s2290_0)) =>
   (case ((string_drop s2289_0 s2290_0)) of
         s2291_0 =>
   (case ((spc_matches_prefix0 s2291_0)) of
         SOME ((() , s2292_0)) =>
   (case ((string_drop s2291_0 s2292_0)) of
         s2293_0 =>
   (case ((reg_name_matches_prefix s2293_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2294_0)) =>
   (case ((string_drop s2293_0 s2294_0)) of
         s2295_0 =>
   (case ((sep_matches_prefix s2295_0)) of
         SOME ((() , s2296_0)) =>
   (case ((string_drop s2295_0 s2296_0)) of
         s2297_0 =>
   (case ((freg_name_matches_prefix s2297_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2298_0)) =>
   (case ((string_drop s2297_0 s2298_0)) of
         s2299_0 =>
   (case ((sep_matches_prefix s2299_0)) of
         SOME ((() , s2300_0)) =>
   (case ((string_drop s2299_0 s2300_0)) of
         s2301_0 =>
   (case ((frm_mnemonic_matches_prefix s2301_0)) of
         SOME ((rm, s2302_0)) =>
   let p0_ = (string_drop s2301_0 s2302_0) in
   if (((p0_ = ""))) then SOME (FCVT_WU_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2270_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2270_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2271_0= 
  ((case s2271_0 of
         s2272_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2272_0)) of
         SOME ((FCVT_W_S, s2273_0)) =>
   (case ((string_drop s2272_0 s2273_0)) of
         s2274_0 =>
   (case ((spc_matches_prefix0 s2274_0)) of
         SOME ((() , s2275_0)) =>
   (case ((string_drop s2274_0 s2275_0)) of
         s2276_0 =>
   (case ((reg_name_matches_prefix s2276_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2277_0)) =>
   (case ((string_drop s2276_0 s2277_0)) of
         s2278_0 =>
   (case ((sep_matches_prefix s2278_0)) of
         SOME ((() , s2279_0)) =>
   (case ((string_drop s2278_0 s2279_0)) of
         s2280_0 =>
   (case ((freg_name_matches_prefix s2280_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2281_0)) =>
   (case ((string_drop s2280_0 s2281_0)) of
         s2282_0 =>
   (case ((sep_matches_prefix s2282_0)) of
         SOME ((() , s2283_0)) =>
   (case ((string_drop s2282_0 s2283_0)) of
         s2284_0 =>
   (case ((frm_mnemonic_matches_prefix s2284_0)) of
         SOME ((rm, s2285_0)) =>
   let p0_ = (string_drop s2284_0 s2285_0) in
   if (((p0_ = ""))) then SOME (FCVT_W_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2253_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2253_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s2254_0= 
  ((case s2254_0 of
         s2255_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s2255_0)) of
         SOME ((FSQRT_S, s2256_0)) =>
   (case ((string_drop s2255_0 s2256_0)) of
         s2257_0 =>
   (case ((spc_matches_prefix0 s2257_0)) of
         SOME ((() , s2258_0)) =>
   (case ((string_drop s2257_0 s2258_0)) of
         s2259_0 =>
   (case ((freg_name_matches_prefix s2259_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2260_0)) =>
   (case ((string_drop s2259_0 s2260_0)) of
         s2261_0 =>
   (case ((sep_matches_prefix s2261_0)) of
         SOME ((() , s2262_0)) =>
   (case ((string_drop s2261_0 s2262_0)) of
         s2263_0 =>
   (case ((freg_name_matches_prefix s2263_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2264_0)) =>
   (case ((string_drop s2263_0 s2264_0)) of
         s2265_0 =>
   (case ((sep_matches_prefix s2265_0)) of
         SOME ((() , s2266_0)) =>
   (case ((string_drop s2265_0 s2266_0)) of
         s2267_0 =>
   (case ((frm_mnemonic_matches_prefix s2267_0)) of
         SOME ((rm, s2268_0)) =>
   let p0_ = (string_drop s2267_0 s2268_0) in
   if (((p0_ = ""))) then SOME (FSQRT_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2232_ : string -> maybe ((f_bin_rm_op_S * mword ty5 * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2232_:string ->(f_bin_rm_op_S#(5)words$word#(5)words$word#(5)words$word#rounding_mode)option) s2233_0= 
  ((case s2233_0 of
         s2234_0 =>
   (case ((f_bin_rm_type_mnemonic_S_matches_prefix s2234_0)) of
         SOME ((op, s2235_0)) =>
   (case ((string_drop s2234_0 s2235_0)) of
         s2236_0 =>
   (case ((spc_matches_prefix0 s2236_0)) of
         SOME ((() , s2237_0)) =>
   (case ((string_drop s2236_0 s2237_0)) of
         s2238_0 =>
   (case ((freg_name_matches_prefix s2238_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2239_0)) =>
   (case ((string_drop s2238_0 s2239_0)) of
         s2240_0 =>
   (case ((sep_matches_prefix s2240_0)) of
         SOME ((() , s2241_0)) =>
   (case ((string_drop s2240_0 s2241_0)) of
         s2242_0 =>
   (case ((freg_name_matches_prefix s2242_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2243_0)) =>
   (case ((string_drop s2242_0 s2243_0)) of
         s2244_0 =>
   (case ((sep_matches_prefix s2244_0)) of
         SOME ((() , s2245_0)) =>
   (case ((string_drop s2244_0 s2245_0)) of
         s2246_0 =>
   (case ((freg_name_matches_prefix s2246_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2247_0)) =>
   (case ((string_drop s2246_0 s2247_0)) of
         s2248_0 =>
   (case ((sep_matches_prefix s2248_0)) of
         SOME ((() , s2249_0)) =>
   (case ((string_drop s2248_0 s2249_0)) of
         s2250_0 =>
   (case ((frm_mnemonic_matches_prefix s2250_0)) of
         SOME ((rm, s2251_0)) =>
   let p0_ = (string_drop s2250_0 s2251_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2207_ : string -> maybe ((f_madd_op_S * mword ty5 * mword ty5 * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s2207_:string ->(f_madd_op_S#(5)words$word#(5)words$word#(5)words$word#(5)words$word#rounding_mode)option) s2208_0= 
  ((case s2208_0 of
         s2209_0 =>
   (case ((f_madd_type_mnemonic_S_matches_prefix s2209_0)) of
         SOME ((op, s2210_0)) =>
   (case ((string_drop s2209_0 s2210_0)) of
         s2211_0 =>
   (case ((spc_matches_prefix0 s2211_0)) of
         SOME ((() , s2212_0)) =>
   (case ((string_drop s2211_0 s2212_0)) of
         s2213_0 =>
   (case ((freg_name_matches_prefix s2213_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2214_0)) =>
   (case ((string_drop s2213_0 s2214_0)) of
         s2215_0 =>
   (case ((sep_matches_prefix s2215_0)) of
         SOME ((() , s2216_0)) =>
   (case ((string_drop s2215_0 s2216_0)) of
         s2217_0 =>
   (case ((freg_name_matches_prefix s2217_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2218_0)) =>
   (case ((string_drop s2217_0 s2218_0)) of
         s2219_0 =>
   (case ((sep_matches_prefix s2219_0)) of
         SOME ((() , s2220_0)) =>
   (case ((string_drop s2219_0 s2220_0)) of
         s2221_0 =>
   (case ((freg_name_matches_prefix s2221_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2222_0)) =>
   (case ((string_drop s2221_0 s2222_0)) of
         s2223_0 =>
   (case ((sep_matches_prefix s2223_0)) of
         SOME ((() , s2224_0)) =>
   (case ((string_drop s2223_0 s2224_0)) of
         s2225_0 =>
   (case ((freg_name_matches_prefix s2225_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs3, s2226_0)) =>
   (case ((string_drop s2225_0 s2226_0)) of
         s2227_0 =>
   (case ((sep_matches_prefix s2227_0)) of
         SOME ((() , s2228_0)) =>
   (case ((string_drop s2227_0 s2228_0)) of
         s2229_0 =>
   (case ((frm_mnemonic_matches_prefix s2229_0)) of
         SOME ((rm, s2230_0)) =>
   let p0_ = (string_drop s2229_0 s2230_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2, rs3, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2183_ : string -> maybe ((word_width * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s2183_:string ->(word_width#(5)words$word#(12)words$word#(5)words$word)option) s2184_0=
    (let s2185_0 = s2184_0 in
   if ((string_startswith s2185_0 "fs")) then  
  (case ((string_drop s2185_0 ((string_length "fs")))) of
        s2186_0 =>
  (case ((size_mnemonic_matches_prefix s2186_0)) of
        SOME ((width, s2187_0)) =>
  (case ((string_drop s2186_0 s2187_0)) of
        s2188_0 =>
  (case ((spc_matches_prefix0 s2188_0)) of
        SOME ((() , s2189_0)) =>
  (case ((string_drop s2188_0 s2189_0)) of
        s2190_0 =>
  (case ((freg_name_matches_prefix s2190_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s2191_0)) =>
  (case ((string_drop s2190_0 s2191_0)) of
        s2192_0 =>
  (case ((sep_matches_prefix s2192_0)) of
        SOME ((() , s2193_0)) =>
  (case ((string_drop s2192_0 s2193_0)) of
        s2194_0 =>
  (case ((hex_bits_12_matches_prefix0 s2194_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s2195_0)) =>
  (case ((string_drop s2194_0 s2195_0)) of
        s2196_0 =>
  (case ((opt_spc_matches_prefix0 s2196_0)) of
        SOME ((() , s2197_0)) =>
  let s2198_0 = (string_drop s2196_0 s2197_0) in
  if ((string_startswith s2198_0 "(")) then
    (case ((string_drop s2198_0 ((string_length "(")))) of
          s2199_0 =>
    (case ((opt_spc_matches_prefix0 s2199_0)) of
          SOME ((() , s2200_0)) =>
    (case ((string_drop s2199_0 s2200_0)) of
          s2201_0 =>
    (case ((reg_name_matches_prefix s2201_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s2202_0)) =>
    (case ((string_drop s2201_0 s2202_0)) of
          s2203_0 =>
    (case ((opt_spc_matches_prefix0 s2203_0)) of
          SOME ((() , s2204_0)) =>
    let s2205_0 = (string_drop s2203_0 s2204_0) in
    if ((string_startswith s2205_0 ")")) then
      let p0_ = (string_drop s2205_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (width, rs2, imm, rs1) else NONE else 
    NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2159_ : string -> maybe ((word_width * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s2159_:string ->(word_width#(5)words$word#(12)words$word#(5)words$word)option) s2160_0=
    (let s2161_0 = s2160_0 in
   if ((string_startswith s2161_0 "fl")) then  
  (case ((string_drop s2161_0 ((string_length "fl")))) of
        s2162_0 =>
  (case ((size_mnemonic_matches_prefix s2162_0)) of
        SOME ((width, s2163_0)) =>
  (case ((string_drop s2162_0 s2163_0)) of
        s2164_0 =>
  (case ((spc_matches_prefix0 s2164_0)) of
        SOME ((() , s2165_0)) =>
  (case ((string_drop s2164_0 s2165_0)) of
        s2166_0 =>
  (case ((freg_name_matches_prefix s2166_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2167_0)) =>
  (case ((string_drop s2166_0 s2167_0)) of
        s2168_0 =>
  (case ((sep_matches_prefix s2168_0)) of
        SOME ((() , s2169_0)) =>
  (case ((string_drop s2168_0 s2169_0)) of
        s2170_0 =>
  (case ((hex_bits_12_matches_prefix0 s2170_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s2171_0)) =>
  (case ((string_drop s2170_0 s2171_0)) of
        s2172_0 =>
  (case ((opt_spc_matches_prefix0 s2172_0)) of
        SOME ((() , s2173_0)) =>
  let s2174_0 = (string_drop s2172_0 s2173_0) in
  if ((string_startswith s2174_0 "(")) then
    (case ((string_drop s2174_0 ((string_length "(")))) of
          s2175_0 =>
    (case ((opt_spc_matches_prefix0 s2175_0)) of
          SOME ((() , s2176_0)) =>
    (case ((string_drop s2175_0 s2176_0)) of
          s2177_0 =>
    (case ((reg_name_matches_prefix s2177_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s2178_0)) =>
    (case ((string_drop s2177_0 s2178_0)) of
          s2179_0 =>
    (case ((opt_spc_matches_prefix0 s2179_0)) of
          SOME ((() , s2180_0)) =>
    let s2181_0 = (string_drop s2179_0 s2180_0) in
    if ((string_startswith s2181_0 ")")) then
      let p0_ = (string_drop s2181_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (width, rd, imm, rs1) else NONE else 
    NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2147_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s2147_:string ->((5)words$word#(5)words$word#(12)words$word)option) s2148_0=
    (let s2149_0 = s2148_0 in
   if ((string_startswith s2149_0 "fence.i.reserved.")) then  
  (case ((string_drop s2149_0 ((string_length "fence.i.reserved.")))) of
        s2150_0 =>
  (case ((reg_name_matches_prefix s2150_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2151_0)) =>
  let s2152_0 = (string_drop s2150_0 s2151_0) in
  if ((string_startswith s2152_0 ".")) then
    (case ((string_drop s2152_0 ((string_length ".")))) of
          s2153_0 =>
    (case ((reg_name_matches_prefix s2153_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs, s2154_0)) =>
    let s2155_0 = (string_drop s2153_0 s2154_0) in
    if ((string_startswith s2155_0 ".")) then
      (case ((string_drop s2155_0 ((string_length ".")))) of
            s2156_0 =>
      (case ((hex_bits_12_matches_prefix0 s2156_0 : (( 12 words$word # ii)) option)) of
            SOME ((imm, s2157_0)) =>
      let p0_ = (string_drop s2156_0 s2157_0) in
      if (((p0_ = ""))) then SOME (rd, rs, imm) else NONE
        | _ => NONE
      )
      ) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2129_ : string -> maybe ((mword ty4 * mword ty4 * mword ty5 * mword ty5 * mword ty4))*)

val _ = Define `
 ((s2129_:string ->((4)words$word#(4)words$word#(5)words$word#(5)words$word#(4)words$word)option) s2130_0=
    (let s2131_0 = s2130_0 in
   if ((string_startswith s2131_0 "fence.reserved.")) then  
  (case ((string_drop s2131_0 ((string_length "fence.reserved.")))) of
        s2132_0 =>
  (case ((fence_bits_matches_prefix s2132_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s2133_0)) =>
  let s2134_0 = (string_drop s2132_0 s2133_0) in
  if ((string_startswith s2134_0 ".")) then
    (case ((string_drop s2134_0 ((string_length ".")))) of
          s2135_0 =>
    (case ((fence_bits_matches_prefix s2135_0 : (( 4 words$word # ii)) option)) of
          SOME ((succ, s2136_0)) =>
    let s2137_0 = (string_drop s2135_0 s2136_0) in
    if ((string_startswith s2137_0 ".")) then
      (case ((string_drop s2137_0 ((string_length ".")))) of
            s2138_0 =>
      (case ((reg_name_matches_prefix s2138_0 : (( 5 words$word # ii)) option)) of
            SOME ((rs, s2139_0)) =>
      let s2140_0 = (string_drop s2138_0 s2139_0) in
      if ((string_startswith s2140_0 ".")) then
        (case ((string_drop s2140_0 ((string_length ".")))) of
              s2141_0 =>
        (case ((reg_name_matches_prefix s2141_0 : (( 5 words$word # ii)) option)) of
              SOME ((rd, s2142_0)) =>
        let s2143_0 = (string_drop s2141_0 s2142_0) in
        if ((string_startswith s2143_0 ".")) then
          (case ((string_drop s2143_0 ((string_length ".")))) of
                s2144_0 =>
          (case ((hex_bits_4_matches_prefix
                    instance_Sail2_values_Bitvector_Machine_word_mword_dict
                    s2144_0 : (( 4 words$word # ii)) option)) of
                SOME ((fm, s2145_0)) =>
          let p0_ = (string_drop s2144_0 s2145_0) in
          if (((p0_ = ""))) then SOME (pred, succ, rs, rd, fm) else NONE
            | _ => NONE
          )
          ) else NONE
          | _ => NONE
        )
        ) else NONE
        | _ => NONE
      )
      ) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2123_ : string -> maybe (mword ty3)*)

val _ = Define `
 ((s2123_:string ->((3)words$word)option) s2124_0=
    (let s2125_0 = s2124_0 in
   if ((string_startswith s2125_0 "c.srai.hint.")) then  
  (case ((string_drop s2125_0 ((string_length "c.srai.hint.")))) of
        s2126_0 =>
  (case ((creg_name_matches_prefix s2126_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s2127_0)) =>
  let p0_ = (string_drop s2126_0 s2127_0) in
  if (((p0_ = ""))) then SOME rsd else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2117_ : string -> maybe (mword ty3)*)

val _ = Define `
 ((s2117_:string ->((3)words$word)option) s2118_0=
    (let s2119_0 = s2118_0 in
   if ((string_startswith s2119_0 "c.srli.hint.")) then  
  (case ((string_drop s2119_0 ((string_length "c.srli.hint.")))) of
        s2120_0 =>
  (case ((creg_name_matches_prefix s2120_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s2121_0)) =>
  let p0_ = (string_drop s2120_0 s2121_0) in
  if (((p0_ = ""))) then SOME rsd else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2108_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s2108_:string ->((5)words$word#(6)words$word)option) s2109_0=
    (let s2110_0 = s2109_0 in
   if ((string_startswith s2110_0 "c.slli.hint.")) then  
  (case ((string_drop s2110_0 ((string_length "c.slli.hint.")))) of
        s2111_0 =>
  (case ((reg_name_matches_prefix s2111_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s2112_0)) =>
  let s2113_0 = (string_drop s2111_0 s2112_0) in
  if ((string_startswith s2113_0 ".")) then
    (case ((string_drop s2113_0 ((string_length ".")))) of
          s2114_0 =>
    (case ((hex_bits_6_matches_prefix
              instance_Sail2_values_Bitvector_Machine_word_mword_dict 
            s2114_0 : (( 6 words$word # ii)) option)) of
          SOME ((shamt, s2115_0)) =>
    let p0_ = (string_drop s2114_0 s2115_0) in
    if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2102_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s2102_:string ->((5)words$word)option) s2103_0=
    (let s2104_0 = s2103_0 in
   if ((string_startswith s2104_0 "c.add.hint.")) then  
  (case ((string_drop s2104_0 ((string_length "c.add.hint.")))) of
        s2105_0 =>
  (case ((reg_name_matches_prefix s2105_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s2106_0)) =>
  let p0_ = (string_drop s2105_0 s2106_0) in
  if (((p0_ = ""))) then SOME rs2 else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2096_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s2096_:string ->((5)words$word)option) s2097_0=
    (let s2098_0 = s2097_0 in
   if ((string_startswith s2098_0 "c.mv.hint.")) then  
  (case ((string_drop s2098_0 ((string_length "c.mv.hint.")))) of
        s2099_0 =>
  (case ((reg_name_matches_prefix s2099_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s2100_0)) =>
  let p0_ = (string_drop s2099_0 s2100_0) in
  if (((p0_ = ""))) then SOME rs2 else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2090_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s2090_:string ->((6)words$word)option) s2091_0=
    (let s2092_0 = s2091_0 in
   if ((string_startswith s2092_0 "c.lui.hint.")) then  
  (case ((string_drop s2092_0 ((string_length "c.lui.hint.")))) of
        s2093_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2093_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s2094_0)) =>
  let p0_ = (string_drop s2093_0 s2094_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2084_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s2084_:string ->((6)words$word)option) s2085_0=
    (let s2086_0 = s2085_0 in
   if ((string_startswith s2086_0 "c.li.hint.")) then  
  (case ((string_drop s2086_0 ((string_length "c.li.hint.")))) of
        s2087_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2087_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s2088_0)) =>
  let p0_ = (string_drop s2087_0 s2088_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2078_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s2078_:string ->((5)words$word)option) s2079_0=
    (let s2080_0 = s2079_0 in
   if ((string_startswith s2080_0 "c.addi.hint.")) then  
  (case ((string_drop s2080_0 ((string_length "c.addi.hint.")))) of
        s2081_0 =>
  (case ((reg_name_matches_prefix s2081_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s2082_0)) =>
  let p0_ = (string_drop s2081_0 s2082_0) in
  if (((p0_ = ""))) then SOME rsd else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2072_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s2072_:string ->((6)words$word)option) s2073_0=
    (let s2074_0 = s2073_0 in
   if ((string_startswith s2074_0 "c.nop.hint.")) then  
  (case ((string_drop s2074_0 ((string_length "c.nop.hint.")))) of
        s2075_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2075_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s2076_0)) =>
  let p0_ = (string_drop s2075_0 s2076_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2055_ : string -> maybe ((csrop * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s2055_:string ->(csrop#(5)words$word#(12)words$word#(5)words$word)option) s2056_0= 
  ((case s2056_0 of
         s2057_0 =>
   (case ((csr_mnemonic_matches_prefix s2057_0)) of
         SOME ((op, s2058_0)) =>
   (case ((string_drop s2057_0 s2058_0)) of
         s2059_0 =>
   (case ((spc_matches_prefix0 s2059_0)) of
         SOME ((() , s2060_0)) =>
   (case ((string_drop s2059_0 s2060_0)) of
         s2061_0 =>
   (case ((reg_name_matches_prefix s2061_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2062_0)) =>
   (case ((string_drop s2061_0 s2062_0)) of
         s2063_0 =>
   (case ((sep_matches_prefix s2063_0)) of
         SOME ((() , s2064_0)) =>
   (case ((string_drop s2063_0 s2064_0)) of
         s2065_0 =>
   (case ((csr_name_map_matches_prefix s2065_0
          : (( 12 words$word # ii)) option)) of
         SOME ((csr, s2066_0)) =>
   (case ((string_drop s2065_0 s2066_0)) of
         s2067_0 =>
   (case ((sep_matches_prefix s2067_0)) of
         SOME ((() , s2068_0)) =>
   (case ((string_drop s2067_0 s2068_0)) of
         s2069_0 =>
   (case ((reg_name_matches_prefix s2069_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2070_0)) =>
   let p0_ = (string_drop s2069_0 s2070_0) in
   if (((p0_ = ""))) then SOME (op, rd, csr, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2037_ : string -> maybe ((csrop * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s2037_:string ->(csrop#(5)words$word#(12)words$word#(5)words$word)option) s2038_0= 
  ((case s2038_0 of
         s2039_0 =>
   (case ((csr_mnemonic_matches_prefix s2039_0)) of
         SOME ((op, s2040_0)) =>
   let s2041_0 = (string_drop s2039_0 s2040_0) in
   if ((string_startswith s2041_0 "i")) then
     (case ((string_drop s2041_0 ((string_length "i")))) of
           s2042_0 =>
     (case ((spc_matches_prefix0 s2042_0)) of
           SOME ((() , s2043_0)) =>
     (case ((string_drop s2042_0 s2043_0)) of
           s2044_0 =>
     (case ((reg_name_matches_prefix s2044_0 : (( 5 words$word # ii)) option)) of
           SOME ((rd, s2045_0)) =>
     (case ((string_drop s2044_0 s2045_0)) of
           s2046_0 =>
     (case ((sep_matches_prefix s2046_0)) of
           SOME ((() , s2047_0)) =>
     (case ((string_drop s2046_0 s2047_0)) of
           s2048_0 =>
     (case ((csr_name_map_matches_prefix s2048_0
            : (( 12 words$word # ii)) option)) of
           SOME ((csr, s2049_0)) =>
     (case ((string_drop s2048_0 s2049_0)) of
           s2050_0 =>
     (case ((sep_matches_prefix s2050_0)) of
           SOME ((() , s2051_0)) =>
     (case ((string_drop s2050_0 s2051_0)) of
           s2052_0 =>
     (case ((hex_bits_5_matches_prefix
               instance_Sail2_values_Bitvector_Machine_word_mword_dict
               s2052_0 : (( 5 words$word # ii)) option)) of
           SOME ((rs1, s2053_0)) =>
     let p0_ = (string_drop s2052_0 s2053_0) in
     if (((p0_ = ""))) then SOME (op, rd, csr, rs1) else NONE
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


(*val _s2018_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2018_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s2019_0=
    (let s2020_0 = s2019_0 in
   if ((string_startswith s2020_0 "rem")) then  
  (case ((string_drop s2020_0 ((string_length "rem")))) of
        s2021_0 =>
  (case ((maybe_not_u_matches_prefix s2021_0)) of
        SOME ((s, s2022_0)) =>
  let s2023_0 = (string_drop s2021_0 s2022_0) in
  if ((string_startswith s2023_0 "w")) then
    (case ((string_drop s2023_0 ((string_length "w")))) of
          s2024_0 =>
    (case ((spc_matches_prefix0 s2024_0)) of
          SOME ((() , s2025_0)) =>
    (case ((string_drop s2024_0 s2025_0)) of
          s2026_0 =>
    (case ((reg_name_matches_prefix s2026_0 : (( 5 words$word # ii)) option)) of
          SOME ((rd, s2027_0)) =>
    (case ((string_drop s2026_0 s2027_0)) of
          s2028_0 =>
    (case ((sep_matches_prefix s2028_0)) of
          SOME ((() , s2029_0)) =>
    (case ((string_drop s2028_0 s2029_0)) of
          s2030_0 =>
    (case ((reg_name_matches_prefix s2030_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s2031_0)) =>
    (case ((string_drop s2030_0 s2031_0)) of
          s2032_0 =>
    (case ((sep_matches_prefix s2032_0)) of
          SOME ((() , s2033_0)) =>
    (case ((string_drop s2032_0 s2033_0)) of
          s2034_0 =>
    (case ((reg_name_matches_prefix s2034_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs2, s2035_0)) =>
    let p0_ = (string_drop s2034_0 s2035_0) in
    if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1999_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1999_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s2000_0=
    (let s2001_0 = s2000_0 in
   if ((string_startswith s2001_0 "div")) then  
  (case ((string_drop s2001_0 ((string_length "div")))) of
        s2002_0 =>
  (case ((maybe_not_u_matches_prefix s2002_0)) of
        SOME ((s, s2003_0)) =>
  let s2004_0 = (string_drop s2002_0 s2003_0) in
  if ((string_startswith s2004_0 "w")) then
    (case ((string_drop s2004_0 ((string_length "w")))) of
          s2005_0 =>
    (case ((spc_matches_prefix0 s2005_0)) of
          SOME ((() , s2006_0)) =>
    (case ((string_drop s2005_0 s2006_0)) of
          s2007_0 =>
    (case ((reg_name_matches_prefix s2007_0 : (( 5 words$word # ii)) option)) of
          SOME ((rd, s2008_0)) =>
    (case ((string_drop s2007_0 s2008_0)) of
          s2009_0 =>
    (case ((sep_matches_prefix s2009_0)) of
          SOME ((() , s2010_0)) =>
    (case ((string_drop s2009_0 s2010_0)) of
          s2011_0 =>
    (case ((reg_name_matches_prefix s2011_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s2012_0)) =>
    (case ((string_drop s2011_0 s2012_0)) of
          s2013_0 =>
    (case ((sep_matches_prefix s2013_0)) of
          SOME ((() , s2014_0)) =>
    (case ((string_drop s2013_0 s2014_0)) of
          s2015_0 =>
    (case ((reg_name_matches_prefix s2015_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs2, s2016_0)) =>
    let p0_ = (string_drop s2015_0 s2016_0) in
    if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1983_ : string -> maybe ((mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1983_:string ->((5)words$word#(5)words$word#(5)words$word)option) s1984_0=
    (let s1985_0 = s1984_0 in
   if ((string_startswith s1985_0 "mulw")) then  
  (case ((string_drop s1985_0 ((string_length "mulw")))) of
        s1986_0 =>
  (case ((spc_matches_prefix0 s1986_0)) of
        SOME ((() , s1987_0)) =>
  (case ((string_drop s1986_0 s1987_0)) of
        s1988_0 =>
  (case ((reg_name_matches_prefix s1988_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1989_0)) =>
  (case ((string_drop s1988_0 s1989_0)) of
        s1990_0 =>
  (case ((sep_matches_prefix s1990_0)) of
        SOME ((() , s1991_0)) =>
  (case ((string_drop s1990_0 s1991_0)) of
        s1992_0 =>
  (case ((reg_name_matches_prefix s1992_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1993_0)) =>
  (case ((string_drop s1992_0 s1993_0)) of
        s1994_0 =>
  (case ((sep_matches_prefix s1994_0)) of
        SOME ((() , s1995_0)) =>
  (case ((string_drop s1994_0 s1995_0)) of
        s1996_0 =>
  (case ((reg_name_matches_prefix s1996_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1997_0)) =>
  let p0_ = (string_drop s1996_0 s1997_0) in
  if (((p0_ = ""))) then SOME (rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1965_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1965_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s1966_0=
    (let s1967_0 = s1966_0 in
   if ((string_startswith s1967_0 "rem")) then  
  (case ((string_drop s1967_0 ((string_length "rem")))) of
        s1968_0 =>
  (case ((maybe_not_u_matches_prefix s1968_0)) of
        SOME ((s, s1969_0)) =>
  (case ((string_drop s1968_0 s1969_0)) of
        s1970_0 =>
  (case ((spc_matches_prefix0 s1970_0)) of
        SOME ((() , s1971_0)) =>
  (case ((string_drop s1970_0 s1971_0)) of
        s1972_0 =>
  (case ((reg_name_matches_prefix s1972_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1973_0)) =>
  (case ((string_drop s1972_0 s1973_0)) of
        s1974_0 =>
  (case ((sep_matches_prefix s1974_0)) of
        SOME ((() , s1975_0)) =>
  (case ((string_drop s1974_0 s1975_0)) of
        s1976_0 =>
  (case ((reg_name_matches_prefix s1976_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1977_0)) =>
  (case ((string_drop s1976_0 s1977_0)) of
        s1978_0 =>
  (case ((sep_matches_prefix s1978_0)) of
        SOME ((() , s1979_0)) =>
  (case ((string_drop s1978_0 s1979_0)) of
        s1980_0 =>
  (case ((reg_name_matches_prefix s1980_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1981_0)) =>
  let p0_ = (string_drop s1980_0 s1981_0) in
  if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1947_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1947_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s1948_0=
    (let s1949_0 = s1948_0 in
   if ((string_startswith s1949_0 "div")) then  
  (case ((string_drop s1949_0 ((string_length "div")))) of
        s1950_0 =>
  (case ((maybe_not_u_matches_prefix s1950_0)) of
        SOME ((s, s1951_0)) =>
  (case ((string_drop s1950_0 s1951_0)) of
        s1952_0 =>
  (case ((spc_matches_prefix0 s1952_0)) of
        SOME ((() , s1953_0)) =>
  (case ((string_drop s1952_0 s1953_0)) of
        s1954_0 =>
  (case ((reg_name_matches_prefix s1954_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1955_0)) =>
  (case ((string_drop s1954_0 s1955_0)) of
        s1956_0 =>
  (case ((sep_matches_prefix s1956_0)) of
        SOME ((() , s1957_0)) =>
  (case ((string_drop s1956_0 s1957_0)) of
        s1958_0 =>
  (case ((reg_name_matches_prefix s1958_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1959_0)) =>
  (case ((string_drop s1958_0 s1959_0)) of
        s1960_0 =>
  (case ((sep_matches_prefix s1960_0)) of
        SOME ((() , s1961_0)) =>
  (case ((string_drop s1960_0 s1961_0)) of
        s1962_0 =>
  (case ((reg_name_matches_prefix s1962_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1963_0)) =>
  let p0_ = (string_drop s1962_0 s1963_0) in
  if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1930_ : string -> maybe ((bool * bool * bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1930_:string ->(bool#bool#bool#(5)words$word#(5)words$word#(5)words$word)option) s1931_0= 
  ((case s1931_0 of
         s1932_0 =>
   (case ((mul_mnemonic_matches_prefix s1932_0)) of
         SOME (((high, signed1, signed2), s1933_0)) =>
   (case ((string_drop s1932_0 s1933_0)) of
         s1934_0 =>
   (case ((spc_matches_prefix0 s1934_0)) of
         SOME ((() , s1935_0)) =>
   (case ((string_drop s1934_0 s1935_0)) of
         s1936_0 =>
   (case ((reg_name_matches_prefix s1936_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1937_0)) =>
   (case ((string_drop s1936_0 s1937_0)) of
         s1938_0 =>
   (case ((sep_matches_prefix s1938_0)) of
         SOME ((() , s1939_0)) =>
   (case ((string_drop s1938_0 s1939_0)) of
         s1940_0 =>
   (case ((reg_name_matches_prefix s1940_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1941_0)) =>
   (case ((string_drop s1940_0 s1941_0)) of
         s1942_0 =>
   (case ((sep_matches_prefix s1942_0)) of
         SOME ((() , s1943_0)) =>
   (case ((string_drop s1942_0 s1943_0)) of
         s1944_0 =>
   (case ((reg_name_matches_prefix s1944_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s1945_0)) =>
   let p0_ = (string_drop s1944_0 s1945_0) in
   if (((p0_ = ""))) then SOME (high, signed1, signed2, rd, rs1, rs2) else
     NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1918_ : string -> maybe ((mword ty5 * mword ty5))*)

val _ = Define `
 ((s1918_:string ->((5)words$word#(5)words$word)option) s1919_0=
    (let s1920_0 = s1919_0 in
   if ((string_startswith s1920_0 "c.add")) then  
  (case ((string_drop s1920_0 ((string_length "c.add")))) of
        s1921_0 =>
  (case ((spc_matches_prefix0 s1921_0)) of
        SOME ((() , s1922_0)) =>
  (case ((string_drop s1921_0 s1922_0)) of
        s1923_0 =>
  (case ((reg_name_matches_prefix s1923_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s1924_0)) =>
  (case ((string_drop s1923_0 s1924_0)) of
        s1925_0 =>
  (case ((sep_matches_prefix s1925_0)) of
        SOME ((() , s1926_0)) =>
  (case ((string_drop s1925_0 s1926_0)) of
        s1927_0 =>
  (case ((reg_name_matches_prefix s1927_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1928_0)) =>
  let p0_ = (string_drop s1927_0 s1928_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1906_ : string -> maybe ((mword ty5 * mword ty5))*)

val _ = Define `
 ((s1906_:string ->((5)words$word#(5)words$word)option) s1907_0=
    (let s1908_0 = s1907_0 in
   if ((string_startswith s1908_0 "c.mv")) then  
  (case ((string_drop s1908_0 ((string_length "c.mv")))) of
        s1909_0 =>
  (case ((spc_matches_prefix0 s1909_0)) of
        SOME ((() , s1910_0)) =>
  (case ((string_drop s1909_0 s1910_0)) of
        s1911_0 =>
  (case ((reg_name_matches_prefix s1911_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1912_0)) =>
  (case ((string_drop s1911_0 s1912_0)) of
        s1913_0 =>
  (case ((sep_matches_prefix s1913_0)) of
        SOME ((() , s1914_0)) =>
  (case ((string_drop s1913_0 s1914_0)) of
        s1915_0 =>
  (case ((reg_name_matches_prefix s1915_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1916_0)) =>
  let p0_ = (string_drop s1915_0 s1916_0) in
  if (((p0_ = ""))) then SOME (rd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1898_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s1898_:string ->((5)words$word)option) s1899_0=
    (let s1900_0 = s1899_0 in
   if ((string_startswith s1900_0 "c.jalr")) then  
  (case ((string_drop s1900_0 ((string_length "c.jalr")))) of
        s1901_0 =>
  (case ((spc_matches_prefix0 s1901_0)) of
        SOME ((() , s1902_0)) =>
  (case ((string_drop s1901_0 s1902_0)) of
        s1903_0 =>
  (case ((reg_name_matches_prefix s1903_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1904_0)) =>
  let p0_ = (string_drop s1903_0 s1904_0) in
  if (((p0_ = ""))) then SOME rs1 else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1890_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s1890_:string ->((5)words$word)option) s1891_0=
    (let s1892_0 = s1891_0 in
   if ((string_startswith s1892_0 "c.jr")) then  
  (case ((string_drop s1892_0 ((string_length "c.jr")))) of
        s1893_0 =>
  (case ((spc_matches_prefix0 s1893_0)) of
        SOME ((() , s1894_0)) =>
  (case ((string_drop s1893_0 s1894_0)) of
        s1895_0 =>
  (case ((reg_name_matches_prefix s1895_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1896_0)) =>
  let p0_ = (string_drop s1895_0 s1896_0) in
  if (((p0_ = ""))) then SOME rs1 else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1878_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1878_:string ->((5)words$word#(6)words$word)option) s1879_0=
    (let s1880_0 = s1879_0 in
   if ((string_startswith s1880_0 "c.sdsp")) then  
  (case ((string_drop s1880_0 ((string_length "c.sdsp")))) of
        s1881_0 =>
  (case ((spc_matches_prefix0 s1881_0)) of
        SOME ((() , s1882_0)) =>
  (case ((string_drop s1881_0 s1882_0)) of
        s1883_0 =>
  (case ((reg_name_matches_prefix s1883_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1884_0)) =>
  (case ((string_drop s1883_0 s1884_0)) of
        s1885_0 =>
  (case ((sep_matches_prefix s1885_0)) of
        SOME ((() , s1886_0)) =>
  (case ((string_drop s1885_0 s1886_0)) of
        s1887_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1887_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s1888_0)) =>
  let p0_ = (string_drop s1887_0 s1888_0) in
  if (((p0_ = ""))) then SOME (rs2, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1866_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1866_:string ->((5)words$word#(6)words$word)option) s1867_0=
    (let s1868_0 = s1867_0 in
   if ((string_startswith s1868_0 "c.swsp")) then  
  (case ((string_drop s1868_0 ((string_length "c.swsp")))) of
        s1869_0 =>
  (case ((spc_matches_prefix0 s1869_0)) of
        SOME ((() , s1870_0)) =>
  (case ((string_drop s1869_0 s1870_0)) of
        s1871_0 =>
  (case ((reg_name_matches_prefix s1871_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1872_0)) =>
  (case ((string_drop s1871_0 s1872_0)) of
        s1873_0 =>
  (case ((sep_matches_prefix s1873_0)) of
        SOME ((() , s1874_0)) =>
  (case ((string_drop s1873_0 s1874_0)) of
        s1875_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1875_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s1876_0)) =>
  let p0_ = (string_drop s1875_0 s1876_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1854_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1854_:string ->((5)words$word#(6)words$word)option) s1855_0=
    (let s1856_0 = s1855_0 in
   if ((string_startswith s1856_0 "c.ldsp")) then  
  (case ((string_drop s1856_0 ((string_length "c.ldsp")))) of
        s1857_0 =>
  (case ((spc_matches_prefix0 s1857_0)) of
        SOME ((() , s1858_0)) =>
  (case ((string_drop s1857_0 s1858_0)) of
        s1859_0 =>
  (case ((reg_name_matches_prefix s1859_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1860_0)) =>
  (case ((string_drop s1859_0 s1860_0)) of
        s1861_0 =>
  (case ((sep_matches_prefix s1861_0)) of
        SOME ((() , s1862_0)) =>
  (case ((string_drop s1861_0 s1862_0)) of
        s1863_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1863_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s1864_0)) =>
  let p0_ = (string_drop s1863_0 s1864_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1842_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1842_:string ->((5)words$word#(6)words$word)option) s1843_0=
    (let s1844_0 = s1843_0 in
   if ((string_startswith s1844_0 "c.lwsp")) then  
  (case ((string_drop s1844_0 ((string_length "c.lwsp")))) of
        s1845_0 =>
  (case ((spc_matches_prefix0 s1845_0)) of
        SOME ((() , s1846_0)) =>
  (case ((string_drop s1845_0 s1846_0)) of
        s1847_0 =>
  (case ((reg_name_matches_prefix s1847_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1848_0)) =>
  (case ((string_drop s1847_0 s1848_0)) of
        s1849_0 =>
  (case ((sep_matches_prefix s1849_0)) of
        SOME ((() , s1850_0)) =>
  (case ((string_drop s1849_0 s1850_0)) of
        s1851_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1851_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s1852_0)) =>
  let p0_ = (string_drop s1851_0 s1852_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1830_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1830_:string ->((5)words$word#(6)words$word)option) s1831_0=
    (let s1832_0 = s1831_0 in
   if ((string_startswith s1832_0 "c.slli")) then  
  (case ((string_drop s1832_0 ((string_length "c.slli")))) of
        s1833_0 =>
  (case ((spc_matches_prefix0 s1833_0)) of
        SOME ((() , s1834_0)) =>
  (case ((string_drop s1833_0 s1834_0)) of
        s1835_0 =>
  (case ((reg_name_matches_prefix s1835_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s1836_0)) =>
  (case ((string_drop s1835_0 s1836_0)) of
        s1837_0 =>
  (case ((sep_matches_prefix s1837_0)) of
        SOME ((() , s1838_0)) =>
  (case ((string_drop s1837_0 s1838_0)) of
        s1839_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1839_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s1840_0)) =>
  let p0_ = (string_drop s1839_0 s1840_0) in
  if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1818_ : string -> maybe ((mword ty3 * mword ty8))*)

val _ = Define `
 ((s1818_:string ->((3)words$word#(8)words$word)option) s1819_0=
    (let s1820_0 = s1819_0 in
   if ((string_startswith s1820_0 "c.bnez")) then  
  (case ((string_drop s1820_0 ((string_length "c.bnez")))) of
        s1821_0 =>
  (case ((spc_matches_prefix0 s1821_0)) of
        SOME ((() , s1822_0)) =>
  (case ((string_drop s1821_0 s1822_0)) of
        s1823_0 =>
  (case ((creg_name_matches_prefix s1823_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs, s1824_0)) =>
  (case ((string_drop s1823_0 s1824_0)) of
        s1825_0 =>
  (case ((sep_matches_prefix s1825_0)) of
        SOME ((() , s1826_0)) =>
  (case ((string_drop s1825_0 s1826_0)) of
        s1827_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1827_0 : (( 8 words$word # ii)) option)) of
        SOME ((imm, s1828_0)) =>
  let p0_ = (string_drop s1827_0 s1828_0) in
  if (((p0_ = ""))) then SOME (rs, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1806_ : string -> maybe ((mword ty3 * mword ty8))*)

val _ = Define `
 ((s1806_:string ->((3)words$word#(8)words$word)option) s1807_0=
    (let s1808_0 = s1807_0 in
   if ((string_startswith s1808_0 "c.beqz")) then  
  (case ((string_drop s1808_0 ((string_length "c.beqz")))) of
        s1809_0 =>
  (case ((spc_matches_prefix0 s1809_0)) of
        SOME ((() , s1810_0)) =>
  (case ((string_drop s1809_0 s1810_0)) of
        s1811_0 =>
  (case ((creg_name_matches_prefix s1811_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs, s1812_0)) =>
  (case ((string_drop s1811_0 s1812_0)) of
        s1813_0 =>
  (case ((sep_matches_prefix s1813_0)) of
        SOME ((() , s1814_0)) =>
  (case ((string_drop s1813_0 s1814_0)) of
        s1815_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1815_0 : (( 8 words$word # ii)) option)) of
        SOME ((imm, s1816_0)) =>
  let p0_ = (string_drop s1815_0 s1816_0) in
  if (((p0_ = ""))) then SOME (rs, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1798_ : string -> maybe (mword ty11)*)

val _ = Define `
 ((s1798_:string ->((11)words$word)option) s1799_0=
    (let s1800_0 = s1799_0 in
   if ((string_startswith s1800_0 "c.j")) then  
  (case ((string_drop s1800_0 ((string_length "c.j")))) of
        s1801_0 =>
  (case ((spc_matches_prefix0 s1801_0)) of
        SOME ((() , s1802_0)) =>
  (case ((string_drop s1801_0 s1802_0)) of
        s1803_0 =>
  (case ((hex_bits_11_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1803_0 : (( 11 words$word # ii)) option)) of
        SOME ((imm, s1804_0)) =>
  let p0_ = (string_drop s1803_0 s1804_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1786_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s1786_:string ->((3)words$word#(3)words$word)option) s1787_0=
    (let s1788_0 = s1787_0 in
   if ((string_startswith s1788_0 "c.addw")) then  
  (case ((string_drop s1788_0 ((string_length "c.addw")))) of
        s1789_0 =>
  (case ((spc_matches_prefix0 s1789_0)) of
        SOME ((() , s1790_0)) =>
  (case ((string_drop s1789_0 s1790_0)) of
        s1791_0 =>
  (case ((creg_name_matches_prefix s1791_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1792_0)) =>
  (case ((string_drop s1791_0 s1792_0)) of
        s1793_0 =>
  (case ((sep_matches_prefix s1793_0)) of
        SOME ((() , s1794_0)) =>
  (case ((string_drop s1793_0 s1794_0)) of
        s1795_0 =>
  (case ((creg_name_matches_prefix s1795_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s1796_0)) =>
  let p0_ = (string_drop s1795_0 s1796_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1774_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s1774_:string ->((3)words$word#(3)words$word)option) s1775_0=
    (let s1776_0 = s1775_0 in
   if ((string_startswith s1776_0 "c.subw")) then  
  (case ((string_drop s1776_0 ((string_length "c.subw")))) of
        s1777_0 =>
  (case ((spc_matches_prefix0 s1777_0)) of
        SOME ((() , s1778_0)) =>
  (case ((string_drop s1777_0 s1778_0)) of
        s1779_0 =>
  (case ((creg_name_matches_prefix s1779_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1780_0)) =>
  (case ((string_drop s1779_0 s1780_0)) of
        s1781_0 =>
  (case ((sep_matches_prefix s1781_0)) of
        SOME ((() , s1782_0)) =>
  (case ((string_drop s1781_0 s1782_0)) of
        s1783_0 =>
  (case ((creg_name_matches_prefix s1783_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s1784_0)) =>
  let p0_ = (string_drop s1783_0 s1784_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1762_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s1762_:string ->((3)words$word#(3)words$word)option) s1763_0=
    (let s1764_0 = s1763_0 in
   if ((string_startswith s1764_0 "c.and")) then  
  (case ((string_drop s1764_0 ((string_length "c.and")))) of
        s1765_0 =>
  (case ((spc_matches_prefix0 s1765_0)) of
        SOME ((() , s1766_0)) =>
  (case ((string_drop s1765_0 s1766_0)) of
        s1767_0 =>
  (case ((creg_name_matches_prefix s1767_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1768_0)) =>
  (case ((string_drop s1767_0 s1768_0)) of
        s1769_0 =>
  (case ((sep_matches_prefix s1769_0)) of
        SOME ((() , s1770_0)) =>
  (case ((string_drop s1769_0 s1770_0)) of
        s1771_0 =>
  (case ((creg_name_matches_prefix s1771_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s1772_0)) =>
  let p0_ = (string_drop s1771_0 s1772_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1750_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s1750_:string ->((3)words$word#(3)words$word)option) s1751_0=
    (let s1752_0 = s1751_0 in
   if ((string_startswith s1752_0 "c.or")) then  
  (case ((string_drop s1752_0 ((string_length "c.or")))) of
        s1753_0 =>
  (case ((spc_matches_prefix0 s1753_0)) of
        SOME ((() , s1754_0)) =>
  (case ((string_drop s1753_0 s1754_0)) of
        s1755_0 =>
  (case ((creg_name_matches_prefix s1755_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1756_0)) =>
  (case ((string_drop s1755_0 s1756_0)) of
        s1757_0 =>
  (case ((sep_matches_prefix s1757_0)) of
        SOME ((() , s1758_0)) =>
  (case ((string_drop s1757_0 s1758_0)) of
        s1759_0 =>
  (case ((creg_name_matches_prefix s1759_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s1760_0)) =>
  let p0_ = (string_drop s1759_0 s1760_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1738_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s1738_:string ->((3)words$word#(3)words$word)option) s1739_0=
    (let s1740_0 = s1739_0 in
   if ((string_startswith s1740_0 "c.xor")) then  
  (case ((string_drop s1740_0 ((string_length "c.xor")))) of
        s1741_0 =>
  (case ((spc_matches_prefix0 s1741_0)) of
        SOME ((() , s1742_0)) =>
  (case ((string_drop s1741_0 s1742_0)) of
        s1743_0 =>
  (case ((creg_name_matches_prefix s1743_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1744_0)) =>
  (case ((string_drop s1743_0 s1744_0)) of
        s1745_0 =>
  (case ((sep_matches_prefix s1745_0)) of
        SOME ((() , s1746_0)) =>
  (case ((string_drop s1745_0 s1746_0)) of
        s1747_0 =>
  (case ((creg_name_matches_prefix s1747_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s1748_0)) =>
  let p0_ = (string_drop s1747_0 s1748_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1726_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s1726_:string ->((3)words$word#(3)words$word)option) s1727_0=
    (let s1728_0 = s1727_0 in
   if ((string_startswith s1728_0 "c.sub")) then  
  (case ((string_drop s1728_0 ((string_length "c.sub")))) of
        s1729_0 =>
  (case ((spc_matches_prefix0 s1729_0)) of
        SOME ((() , s1730_0)) =>
  (case ((string_drop s1729_0 s1730_0)) of
        s1731_0 =>
  (case ((creg_name_matches_prefix s1731_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1732_0)) =>
  (case ((string_drop s1731_0 s1732_0)) of
        s1733_0 =>
  (case ((sep_matches_prefix s1733_0)) of
        SOME ((() , s1734_0)) =>
  (case ((string_drop s1733_0 s1734_0)) of
        s1735_0 =>
  (case ((creg_name_matches_prefix s1735_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s1736_0)) =>
  let p0_ = (string_drop s1735_0 s1736_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1714_ : string -> maybe ((mword ty3 * mword ty6))*)

val _ = Define `
 ((s1714_:string ->((3)words$word#(6)words$word)option) s1715_0=
    (let s1716_0 = s1715_0 in
   if ((string_startswith s1716_0 "c.andi")) then  
  (case ((string_drop s1716_0 ((string_length "c.andi")))) of
        s1717_0 =>
  (case ((spc_matches_prefix0 s1717_0)) of
        SOME ((() , s1718_0)) =>
  (case ((string_drop s1717_0 s1718_0)) of
        s1719_0 =>
  (case ((creg_name_matches_prefix s1719_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1720_0)) =>
  (case ((string_drop s1719_0 s1720_0)) of
        s1721_0 =>
  (case ((sep_matches_prefix s1721_0)) of
        SOME ((() , s1722_0)) =>
  (case ((string_drop s1721_0 s1722_0)) of
        s1723_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1723_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s1724_0)) =>
  let p0_ = (string_drop s1723_0 s1724_0) in
  if (((p0_ = ""))) then SOME (rsd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1702_ : string -> maybe ((mword ty3 * mword ty6))*)

val _ = Define `
 ((s1702_:string ->((3)words$word#(6)words$word)option) s1703_0=
    (let s1704_0 = s1703_0 in
   if ((string_startswith s1704_0 "c.srai")) then  
  (case ((string_drop s1704_0 ((string_length "c.srai")))) of
        s1705_0 =>
  (case ((spc_matches_prefix0 s1705_0)) of
        SOME ((() , s1706_0)) =>
  (case ((string_drop s1705_0 s1706_0)) of
        s1707_0 =>
  (case ((creg_name_matches_prefix s1707_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1708_0)) =>
  (case ((string_drop s1707_0 s1708_0)) of
        s1709_0 =>
  (case ((sep_matches_prefix s1709_0)) of
        SOME ((() , s1710_0)) =>
  (case ((string_drop s1709_0 s1710_0)) of
        s1711_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1711_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s1712_0)) =>
  let p0_ = (string_drop s1711_0 s1712_0) in
  if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1690_ : string -> maybe ((mword ty3 * mword ty6))*)

val _ = Define `
 ((s1690_:string ->((3)words$word#(6)words$word)option) s1691_0=
    (let s1692_0 = s1691_0 in
   if ((string_startswith s1692_0 "c.srli")) then  
  (case ((string_drop s1692_0 ((string_length "c.srli")))) of
        s1693_0 =>
  (case ((spc_matches_prefix0 s1693_0)) of
        SOME ((() , s1694_0)) =>
  (case ((string_drop s1693_0 s1694_0)) of
        s1695_0 =>
  (case ((creg_name_matches_prefix s1695_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s1696_0)) =>
  (case ((string_drop s1695_0 s1696_0)) of
        s1697_0 =>
  (case ((sep_matches_prefix s1697_0)) of
        SOME ((() , s1698_0)) =>
  (case ((string_drop s1697_0 s1698_0)) of
        s1699_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1699_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s1700_0)) =>
  let p0_ = (string_drop s1699_0 s1700_0) in
  if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1678_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1678_:string ->((5)words$word#(6)words$word)option) s1679_0=
    (let s1680_0 = s1679_0 in
   if ((string_startswith s1680_0 "c.lui")) then  
  (case ((string_drop s1680_0 ((string_length "c.lui")))) of
        s1681_0 =>
  (case ((spc_matches_prefix0 s1681_0)) of
        SOME ((() , s1682_0)) =>
  (case ((string_drop s1681_0 s1682_0)) of
        s1683_0 =>
  (case ((reg_name_matches_prefix s1683_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1684_0)) =>
  (case ((string_drop s1683_0 s1684_0)) of
        s1685_0 =>
  (case ((sep_matches_prefix s1685_0)) of
        SOME ((() , s1686_0)) =>
  (case ((string_drop s1685_0 s1686_0)) of
        s1687_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1687_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s1688_0)) =>
  let p0_ = (string_drop s1687_0 s1688_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1670_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s1670_:string ->((6)words$word)option) s1671_0=
    (let s1672_0 = s1671_0 in
   if ((string_startswith s1672_0 "c.addi16sp")) then  
  (case ((string_drop s1672_0 ((string_length "c.addi16sp")))) of
        s1673_0 =>
  (case ((spc_matches_prefix0 s1673_0)) of
        SOME ((() , s1674_0)) =>
  (case ((string_drop s1673_0 s1674_0)) of
        s1675_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1675_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s1676_0)) =>
  let p0_ = (string_drop s1675_0 s1676_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1658_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1658_:string ->((5)words$word#(6)words$word)option) s1659_0=
    (let s1660_0 = s1659_0 in
   if ((string_startswith s1660_0 "c.li")) then  
  (case ((string_drop s1660_0 ((string_length "c.li")))) of
        s1661_0 =>
  (case ((spc_matches_prefix0 s1661_0)) of
        SOME ((() , s1662_0)) =>
  (case ((string_drop s1661_0 s1662_0)) of
        s1663_0 =>
  (case ((reg_name_matches_prefix s1663_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1664_0)) =>
  (case ((string_drop s1663_0 s1664_0)) of
        s1665_0 =>
  (case ((sep_matches_prefix s1665_0)) of
        SOME ((() , s1666_0)) =>
  (case ((string_drop s1665_0 s1666_0)) of
        s1667_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1667_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s1668_0)) =>
  let p0_ = (string_drop s1667_0 s1668_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1646_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1646_:string ->((5)words$word#(6)words$word)option) s1647_0=
    (let s1648_0 = s1647_0 in
   if ((string_startswith s1648_0 "c.addiw")) then  
  (case ((string_drop s1648_0 ((string_length "c.addiw")))) of
        s1649_0 =>
  (case ((spc_matches_prefix0 s1649_0)) of
        SOME ((() , s1650_0)) =>
  (case ((string_drop s1649_0 s1650_0)) of
        s1651_0 =>
  (case ((reg_name_matches_prefix s1651_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s1652_0)) =>
  (case ((string_drop s1651_0 s1652_0)) of
        s1653_0 =>
  (case ((sep_matches_prefix s1653_0)) of
        SOME ((() , s1654_0)) =>
  (case ((string_drop s1653_0 s1654_0)) of
        s1655_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1655_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s1656_0)) =>
  let p0_ = (string_drop s1655_0 s1656_0) in
  if (((p0_ = ""))) then SOME (rsd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1638_ : string -> maybe (mword ty11)*)

val _ = Define `
 ((s1638_:string ->((11)words$word)option) s1639_0=
    (let s1640_0 = s1639_0 in
   if ((string_startswith s1640_0 "c.jal")) then  
  (case ((string_drop s1640_0 ((string_length "c.jal")))) of
        s1641_0 =>
  (case ((spc_matches_prefix0 s1641_0)) of
        SOME ((() , s1642_0)) =>
  (case ((string_drop s1641_0 s1642_0)) of
        s1643_0 =>
  (case ((hex_bits_12_matches_prefix0 s1643_0 : (( 12 words$word # ii)) option)) of
        SOME ((v__1184, s1644_0)) =>
  if (((((subrange_vec_dec v__1184 (( 0 : int): ii) (( 0 : int): ii) : 1 words$word))
          = (0b0w : 1 words$word)))) then
    let (imm : 11 words$word) = ((subrange_vec_dec v__1184 (( 11 : int): ii)
                                    (( 1 : int): ii) : 11 words$word)) in
    let (imm : 11 words$word) = ((subrange_vec_dec v__1184 (( 11 : int): ii)
                                    (( 1 : int): ii) : 11 words$word)) in
    let p0_ = (string_drop s1643_0 s1644_0) in
    if (((p0_ = ""))) then SOME imm else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1626_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s1626_:string ->((5)words$word#(6)words$word)option) s1627_0=
    (let s1628_0 = s1627_0 in
   if ((string_startswith s1628_0 "c.addi")) then  
  (case ((string_drop s1628_0 ((string_length "c.addi")))) of
        s1629_0 =>
  (case ((spc_matches_prefix0 s1629_0)) of
        SOME ((() , s1630_0)) =>
  (case ((string_drop s1629_0 s1630_0)) of
        s1631_0 =>
  (case ((reg_name_matches_prefix s1631_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s1632_0)) =>
  (case ((string_drop s1631_0 s1632_0)) of
        s1633_0 =>
  (case ((sep_matches_prefix s1633_0)) of
        SOME ((() , s1634_0)) =>
  (case ((string_drop s1633_0 s1634_0)) of
        s1635_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1635_0 : (( 6 words$word # ii)) option)) of
        SOME ((nzi, s1636_0)) =>
  let p0_ = (string_drop s1635_0 s1636_0) in
  if (((p0_ = ""))) then SOME (rsd, nzi) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1610_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s1610_:string ->((3)words$word#(3)words$word#(5)words$word)option) s1611_0=
    (let s1612_0 = s1611_0 in
   if ((string_startswith s1612_0 "c.sd")) then  
  (case ((string_drop s1612_0 ((string_length "c.sd")))) of
        s1613_0 =>
  (case ((spc_matches_prefix0 s1613_0)) of
        SOME ((() , s1614_0)) =>
  (case ((string_drop s1613_0 s1614_0)) of
        s1615_0 =>
  (case ((creg_name_matches_prefix s1615_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s1616_0)) =>
  (case ((string_drop s1615_0 s1616_0)) of
        s1617_0 =>
  (case ((sep_matches_prefix s1617_0)) of
        SOME ((() , s1618_0)) =>
  (case ((string_drop s1617_0 s1618_0)) of
        s1619_0 =>
  (case ((creg_name_matches_prefix s1619_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s1620_0)) =>
  (case ((string_drop s1619_0 s1620_0)) of
        s1621_0 =>
  (case ((sep_matches_prefix s1621_0)) of
        SOME ((() , s1622_0)) =>
  (case ((string_drop s1621_0 s1622_0)) of
        s1623_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1623_0
         : (( 8 words$word # ii)) option)) of
        SOME ((v__1186, s1624_0)) =>
  if (((((subrange_vec_dec v__1186 (( 2 : int): ii) (( 0 : int): ii)
         : 3 words$word)) = (0b000w : 3 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1186 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1186 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s1623_0 s1624_0) in
    if (((p0_ = ""))) then SOME (rsc1, rsc2, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1594_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s1594_:string ->((3)words$word#(3)words$word#(5)words$word)option) s1595_0=
    (let s1596_0 = s1595_0 in
   if ((string_startswith s1596_0 "c.sw")) then  
  (case ((string_drop s1596_0 ((string_length "c.sw")))) of
        s1597_0 =>
  (case ((spc_matches_prefix0 s1597_0)) of
        SOME ((() , s1598_0)) =>
  (case ((string_drop s1597_0 s1598_0)) of
        s1599_0 =>
  (case ((creg_name_matches_prefix s1599_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s1600_0)) =>
  (case ((string_drop s1599_0 s1600_0)) of
        s1601_0 =>
  (case ((sep_matches_prefix s1601_0)) of
        SOME ((() , s1602_0)) =>
  (case ((string_drop s1601_0 s1602_0)) of
        s1603_0 =>
  (case ((creg_name_matches_prefix s1603_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s1604_0)) =>
  (case ((string_drop s1603_0 s1604_0)) of
        s1605_0 =>
  (case ((sep_matches_prefix s1605_0)) of
        SOME ((() , s1606_0)) =>
  (case ((string_drop s1605_0 s1606_0)) of
        s1607_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1607_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1188, s1608_0)) =>
  if (((((subrange_vec_dec v__1188 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1188 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1188 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s1607_0 s1608_0) in
    if (((p0_ = ""))) then SOME (rsc1, rsc2, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1578_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s1578_:string ->((3)words$word#(3)words$word#(5)words$word)option) s1579_0=
    (let s1580_0 = s1579_0 in
   if ((string_startswith s1580_0 "c.ld")) then  
  (case ((string_drop s1580_0 ((string_length "c.ld")))) of
        s1581_0 =>
  (case ((spc_matches_prefix0 s1581_0)) of
        SOME ((() , s1582_0)) =>
  (case ((string_drop s1581_0 s1582_0)) of
        s1583_0 =>
  (case ((creg_name_matches_prefix s1583_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s1584_0)) =>
  (case ((string_drop s1583_0 s1584_0)) of
        s1585_0 =>
  (case ((sep_matches_prefix s1585_0)) of
        SOME ((() , s1586_0)) =>
  (case ((string_drop s1585_0 s1586_0)) of
        s1587_0 =>
  (case ((creg_name_matches_prefix s1587_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s1588_0)) =>
  (case ((string_drop s1587_0 s1588_0)) of
        s1589_0 =>
  (case ((sep_matches_prefix s1589_0)) of
        SOME ((() , s1590_0)) =>
  (case ((string_drop s1589_0 s1590_0)) of
        s1591_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1591_0
         : (( 8 words$word # ii)) option)) of
        SOME ((v__1190, s1592_0)) =>
  if (((((subrange_vec_dec v__1190 (( 2 : int): ii) (( 0 : int): ii)
         : 3 words$word)) = (0b000w : 3 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1190 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1190 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s1591_0 s1592_0) in
    if (((p0_ = ""))) then SOME (rdc, rsc, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1562_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s1562_:string ->((3)words$word#(3)words$word#(5)words$word)option) s1563_0=
    (let s1564_0 = s1563_0 in
   if ((string_startswith s1564_0 "c.lw")) then  
  (case ((string_drop s1564_0 ((string_length "c.lw")))) of
        s1565_0 =>
  (case ((spc_matches_prefix0 s1565_0)) of
        SOME ((() , s1566_0)) =>
  (case ((string_drop s1565_0 s1566_0)) of
        s1567_0 =>
  (case ((creg_name_matches_prefix s1567_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s1568_0)) =>
  (case ((string_drop s1567_0 s1568_0)) of
        s1569_0 =>
  (case ((sep_matches_prefix s1569_0)) of
        SOME ((() , s1570_0)) =>
  (case ((string_drop s1569_0 s1570_0)) of
        s1571_0 =>
  (case ((creg_name_matches_prefix s1571_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s1572_0)) =>
  (case ((string_drop s1571_0 s1572_0)) of
        s1573_0 =>
  (case ((sep_matches_prefix s1573_0)) of
        SOME ((() , s1574_0)) =>
  (case ((string_drop s1573_0 s1574_0)) of
        s1575_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1575_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1192, s1576_0)) =>
  if (((((subrange_vec_dec v__1192 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1192 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1192 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s1575_0 s1576_0) in
    if (((p0_ = ""))) then SOME (rdc, rsc, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1550_ : string -> maybe ((mword ty3 * mword ty8))*)

val _ = Define `
 ((s1550_:string ->((3)words$word#(8)words$word)option) s1551_0=
    (let s1552_0 = s1551_0 in
   if ((string_startswith s1552_0 "c.addi4spn")) then  
  (case ((string_drop s1552_0 ((string_length "c.addi4spn")))) of
        s1553_0 =>
  (case ((spc_matches_prefix0 s1553_0)) of
        SOME ((() , s1554_0)) =>
  (case ((string_drop s1553_0 s1554_0)) of
        s1555_0 =>
  (case ((creg_name_matches_prefix s1555_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s1556_0)) =>
  (case ((string_drop s1555_0 s1556_0)) of
        s1557_0 =>
  (case ((sep_matches_prefix s1557_0)) of
        SOME ((() , s1558_0)) =>
  (case ((string_drop s1557_0 s1558_0)) of
        s1559_0 =>
  (case ((hex_bits_10_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1559_0 : (( 10 words$word # ii)) option)) of
        SOME ((v__1194, s1560_0)) =>
  if (((((subrange_vec_dec v__1194 (( 1 : int): ii) (( 0 : int): ii) : 2 words$word))
          = (0b00w : 2 words$word)))) then
    let (nzimm : 8 words$word) =
        ((subrange_vec_dec v__1194 (( 9 : int): ii) (( 2 : int): ii) : 8 words$word)) in
    let (nzimm : 8 words$word) =
        ((subrange_vec_dec v__1194 (( 9 : int): ii) (( 2 : int): ii) : 8 words$word)) in
    let p0_ = (string_drop s1559_0 s1560_0) in
    if (((p0_ = ""))) then SOME (rdc, nzimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1524_ : string -> maybe ((amoop * word_width * bool * bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1524_:string ->(amoop#word_width#bool#bool#(5)words$word#(5)words$word#(5)words$word)option) s1525_0= 
  ((case s1525_0 of
         s1526_0 =>
   (case ((amo_mnemonic_matches_prefix s1526_0)) of
         SOME ((op, s1527_0)) =>
   let s1528_0 = (string_drop s1526_0 s1527_0) in
   if ((string_startswith s1528_0 ".")) then
     (case ((string_drop s1528_0 ((string_length ".")))) of
           s1529_0 =>
     (case ((size_mnemonic_matches_prefix s1529_0)) of
           SOME ((width, s1530_0)) =>
     (case ((string_drop s1529_0 s1530_0)) of
           s1531_0 =>
     (case ((maybe_aq_matches_prefix s1531_0)) of
           SOME ((aq, s1532_0)) =>
     (case ((string_drop s1531_0 s1532_0)) of
           s1533_0 =>
     (case ((maybe_rl_matches_prefix s1533_0)) of
           SOME ((rl, s1534_0)) =>
     (case ((string_drop s1533_0 s1534_0)) of
           s1535_0 =>
     (case ((spc_matches_prefix0 s1535_0)) of
           SOME ((() , s1536_0)) =>
     (case ((string_drop s1535_0 s1536_0)) of
           s1537_0 =>
     (case ((reg_name_matches_prefix s1537_0 : (( 5 words$word # ii)) option)) of
           SOME ((rd, s1538_0)) =>
     (case ((string_drop s1537_0 s1538_0)) of
           s1539_0 =>
     (case ((sep_matches_prefix s1539_0)) of
           SOME ((() , s1540_0)) =>
     (case ((string_drop s1539_0 s1540_0)) of
           s1541_0 =>
     (case ((reg_name_matches_prefix s1541_0 : (( 5 words$word # ii)) option)) of
           SOME ((rs2, s1542_0)) =>
     (case ((string_drop s1541_0 s1542_0)) of
           s1543_0 =>
     (case ((sep_matches_prefix s1543_0)) of
           SOME ((() , s1544_0)) =>
     let s1545_0 = (string_drop s1543_0 s1544_0) in
     if ((string_startswith s1545_0 "(")) then
       (case ((string_drop s1545_0 ((string_length "(")))) of
             s1546_0 =>
       (case ((reg_name_matches_prefix s1546_0
              : (( 5 words$word # ii)) option)) of
             SOME ((rs1, s1547_0)) =>
       let s1548_0 = (string_drop s1546_0 s1547_0) in
       if ((string_startswith s1548_0 ")")) then
         let p0_ = (string_drop s1548_0 ((string_length ")"))) in
         if (((p0_ = ""))) then SOME (op, width, aq, rl, rd, rs2, rs1) else
           NONE else NONE
         | _ => NONE
       )
       ) else NONE
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


(*val _s1502_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1502_:string ->(word_width#bool#bool#(5)words$word#(5)words$word#(5)words$word)option) s1503_0=
    (let s1504_0 = s1503_0 in
   if ((string_startswith s1504_0 "sc.")) then  
  (case ((string_drop s1504_0 ((string_length "sc.")))) of
        s1505_0 =>
  (case ((size_mnemonic_matches_prefix s1505_0)) of
        SOME ((size1, s1506_0)) =>
  (case ((string_drop s1505_0 s1506_0)) of
        s1507_0 =>
  (case ((maybe_aq_matches_prefix s1507_0)) of
        SOME ((aq, s1508_0)) =>
  (case ((string_drop s1507_0 s1508_0)) of
        s1509_0 =>
  (case ((maybe_rl_matches_prefix s1509_0)) of
        SOME ((rl, s1510_0)) =>
  (case ((string_drop s1509_0 s1510_0)) of
        s1511_0 =>
  (case ((spc_matches_prefix0 s1511_0)) of
        SOME ((() , s1512_0)) =>
  (case ((string_drop s1511_0 s1512_0)) of
        s1513_0 =>
  (case ((reg_name_matches_prefix s1513_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1514_0)) =>
  (case ((string_drop s1513_0 s1514_0)) of
        s1515_0 =>
  (case ((sep_matches_prefix s1515_0)) of
        SOME ((() , s1516_0)) =>
  (case ((string_drop s1515_0 s1516_0)) of
        s1517_0 =>
  (case ((reg_name_matches_prefix s1517_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1518_0)) =>
  (case ((string_drop s1517_0 s1518_0)) of
        s1519_0 =>
  (case ((sep_matches_prefix s1519_0)) of
        SOME ((() , s1520_0)) =>
  (case ((string_drop s1519_0 s1520_0)) of
        s1521_0 =>
  (case ((reg_name_matches_prefix s1521_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1522_0)) =>
  let p0_ = (string_drop s1521_0 s1522_0) in
  if (((p0_ = ""))) then SOME (size1, aq, rl, rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1484_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1484_:string ->(word_width#bool#bool#(5)words$word#(5)words$word)option) s1485_0=
    (let s1486_0 = s1485_0 in
   if ((string_startswith s1486_0 "lr.")) then  
  (case ((string_drop s1486_0 ((string_length "lr.")))) of
        s1487_0 =>
  (case ((size_mnemonic_matches_prefix s1487_0)) of
        SOME ((size1, s1488_0)) =>
  (case ((string_drop s1487_0 s1488_0)) of
        s1489_0 =>
  (case ((maybe_aq_matches_prefix s1489_0)) of
        SOME ((aq, s1490_0)) =>
  (case ((string_drop s1489_0 s1490_0)) of
        s1491_0 =>
  (case ((maybe_rl_matches_prefix s1491_0)) of
        SOME ((rl, s1492_0)) =>
  (case ((string_drop s1491_0 s1492_0)) of
        s1493_0 =>
  (case ((spc_matches_prefix0 s1493_0)) of
        SOME ((() , s1494_0)) =>
  (case ((string_drop s1493_0 s1494_0)) of
        s1495_0 =>
  (case ((reg_name_matches_prefix s1495_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1496_0)) =>
  (case ((string_drop s1495_0 s1496_0)) of
        s1497_0 =>
  (case ((sep_matches_prefix s1497_0)) of
        SOME ((() , s1498_0)) =>
  (case ((string_drop s1497_0 s1498_0)) of
        s1499_0 =>
  (case ((reg_name_matches_prefix s1499_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1500_0)) =>
  let p0_ = (string_drop s1499_0 s1500_0) in
  if (((p0_ = ""))) then SOME (size1, aq, rl, rd, rs1) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1472_ : string -> maybe ((mword ty5 * mword ty5))*)

val _ = Define `
 ((s1472_:string ->((5)words$word#(5)words$word)option) s1473_0=
    (let s1474_0 = s1473_0 in
   if ((string_startswith s1474_0 "sfence.vma")) then  
  (case ((string_drop s1474_0 ((string_length "sfence.vma")))) of
        s1475_0 =>
  (case ((spc_matches_prefix0 s1475_0)) of
        SOME ((() , s1476_0)) =>
  (case ((string_drop s1475_0 s1476_0)) of
        s1477_0 =>
  (case ((reg_name_matches_prefix s1477_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1478_0)) =>
  (case ((string_drop s1477_0 s1478_0)) of
        s1479_0 =>
  (case ((sep_matches_prefix s1479_0)) of
        SOME ((() , s1480_0)) =>
  (case ((string_drop s1479_0 s1480_0)) of
        s1481_0 =>
  (case ((reg_name_matches_prefix s1481_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1482_0)) =>
  let p0_ = (string_drop s1481_0 s1482_0) in
  if (((p0_ = ""))) then SOME (rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1460_ : string -> maybe ((mword ty4 * mword ty4))*)

val _ = Define `
 ((s1460_:string ->((4)words$word#(4)words$word)option) s1461_0=
    (let s1462_0 = s1461_0 in
   if ((string_startswith s1462_0 "fence.tso")) then  
  (case ((string_drop s1462_0 ((string_length "fence.tso")))) of
        s1463_0 =>
  (case ((spc_matches_prefix0 s1463_0)) of
        SOME ((() , s1464_0)) =>
  (case ((string_drop s1463_0 s1464_0)) of
        s1465_0 =>
  (case ((fence_bits_matches_prefix s1465_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s1466_0)) =>
  (case ((string_drop s1465_0 s1466_0)) of
        s1467_0 =>
  (case ((sep_matches_prefix s1467_0)) of
        SOME ((() , s1468_0)) =>
  (case ((string_drop s1467_0 s1468_0)) of
        s1469_0 =>
  (case ((fence_bits_matches_prefix s1469_0 : (( 4 words$word # ii)) option)) of
        SOME ((succ, s1470_0)) =>
  let p0_ = (string_drop s1469_0 s1470_0) in
  if (((p0_ = ""))) then SOME (pred, succ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1448_ : string -> maybe ((mword ty4 * mword ty4))*)

val _ = Define `
 ((s1448_:string ->((4)words$word#(4)words$word)option) s1449_0=
    (let s1450_0 = s1449_0 in
   if ((string_startswith s1450_0 "fence")) then  
  (case ((string_drop s1450_0 ((string_length "fence")))) of
        s1451_0 =>
  (case ((spc_matches_prefix0 s1451_0)) of
        SOME ((() , s1452_0)) =>
  (case ((string_drop s1451_0 s1452_0)) of
        s1453_0 =>
  (case ((fence_bits_matches_prefix s1453_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s1454_0)) =>
  (case ((string_drop s1453_0 s1454_0)) of
        s1455_0 =>
  (case ((sep_matches_prefix s1455_0)) of
        SOME ((() , s1456_0)) =>
  (case ((string_drop s1455_0 s1456_0)) of
        s1457_0 =>
  (case ((fence_bits_matches_prefix s1457_0 : (( 4 words$word # ii)) option)) of
        SOME ((succ, s1458_0)) =>
  let p0_ = (string_drop s1457_0 s1458_0) in
  if (((p0_ = ""))) then SOME (pred, succ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1431_ : string -> maybe ((sopw * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1431_:string ->(sopw#(5)words$word#(5)words$word#(5)words$word)option) s1432_0= 
  ((case s1432_0 of
         s1433_0 =>
   (case ((shiftiwop_mnemonic_matches_prefix s1433_0)) of
         SOME ((op, s1434_0)) =>
   (case ((string_drop s1433_0 s1434_0)) of
         s1435_0 =>
   (case ((spc_matches_prefix0 s1435_0)) of
         SOME ((() , s1436_0)) =>
   (case ((string_drop s1435_0 s1436_0)) of
         s1437_0 =>
   (case ((reg_name_matches_prefix s1437_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1438_0)) =>
   (case ((string_drop s1437_0 s1438_0)) of
         s1439_0 =>
   (case ((sep_matches_prefix s1439_0)) of
         SOME ((() , s1440_0)) =>
   (case ((string_drop s1439_0 s1440_0)) of
         s1441_0 =>
   (case ((reg_name_matches_prefix s1441_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1442_0)) =>
   (case ((string_drop s1441_0 s1442_0)) of
         s1443_0 =>
   (case ((sep_matches_prefix s1443_0)) of
         SOME ((() , s1444_0)) =>
   (case ((string_drop s1443_0 s1444_0)) of
         s1445_0 =>
   (case ((hex_bits_5_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s1445_0 : (( 5 words$word # ii)) option)) of
         SOME ((shamt, s1446_0)) =>
   let p0_ = (string_drop s1445_0 s1446_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, shamt) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1414_ : string -> maybe ((ropw * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1414_:string ->(ropw#(5)words$word#(5)words$word#(5)words$word)option) s1415_0= 
  ((case s1415_0 of
         s1416_0 =>
   (case ((rtypew_mnemonic_matches_prefix s1416_0)) of
         SOME ((op, s1417_0)) =>
   (case ((string_drop s1416_0 s1417_0)) of
         s1418_0 =>
   (case ((spc_matches_prefix0 s1418_0)) of
         SOME ((() , s1419_0)) =>
   (case ((string_drop s1418_0 s1419_0)) of
         s1420_0 =>
   (case ((reg_name_matches_prefix s1420_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1421_0)) =>
   (case ((string_drop s1420_0 s1421_0)) of
         s1422_0 =>
   (case ((sep_matches_prefix s1422_0)) of
         SOME ((() , s1423_0)) =>
   (case ((string_drop s1422_0 s1423_0)) of
         s1424_0 =>
   (case ((reg_name_matches_prefix s1424_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1425_0)) =>
   (case ((string_drop s1424_0 s1425_0)) of
         s1426_0 =>
   (case ((sep_matches_prefix s1426_0)) of
         SOME ((() , s1427_0)) =>
   (case ((string_drop s1426_0 s1427_0)) of
         s1428_0 =>
   (case ((reg_name_matches_prefix s1428_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s1429_0)) =>
   let p0_ = (string_drop s1428_0 s1429_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1397_ : string -> maybe ((sop * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1397_:string ->(sop#(5)words$word#(5)words$word#(5)words$word)option) s1398_0= 
  ((case s1398_0 of
         s1399_0 =>
   (case ((shiftw_mnemonic_matches_prefix s1399_0)) of
         SOME ((op, s1400_0)) =>
   (case ((string_drop s1399_0 s1400_0)) of
         s1401_0 =>
   (case ((spc_matches_prefix0 s1401_0)) of
         SOME ((() , s1402_0)) =>
   (case ((string_drop s1401_0 s1402_0)) of
         s1403_0 =>
   (case ((reg_name_matches_prefix s1403_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1404_0)) =>
   (case ((string_drop s1403_0 s1404_0)) of
         s1405_0 =>
   (case ((sep_matches_prefix s1405_0)) of
         SOME ((() , s1406_0)) =>
   (case ((string_drop s1405_0 s1406_0)) of
         s1407_0 =>
   (case ((reg_name_matches_prefix s1407_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1408_0)) =>
   (case ((string_drop s1407_0 s1408_0)) of
         s1409_0 =>
   (case ((sep_matches_prefix s1409_0)) of
         SOME ((() , s1410_0)) =>
   (case ((string_drop s1409_0 s1410_0)) of
         s1411_0 =>
   (case ((hex_bits_5_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s1411_0 : (( 5 words$word # ii)) option)) of
         SOME ((shamt, s1412_0)) =>
   let p0_ = (string_drop s1411_0 s1412_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, shamt) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1381_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s1381_:string ->((5)words$word#(5)words$word#(12)words$word)option) s1382_0=
    (let s1383_0 = s1382_0 in
   if ((string_startswith s1383_0 "addiw")) then  
  (case ((string_drop s1383_0 ((string_length "addiw")))) of
        s1384_0 =>
  (case ((spc_matches_prefix0 s1384_0)) of
        SOME ((() , s1385_0)) =>
  (case ((string_drop s1384_0 s1385_0)) of
        s1386_0 =>
  (case ((reg_name_matches_prefix s1386_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1387_0)) =>
  (case ((string_drop s1386_0 s1387_0)) of
        s1388_0 =>
  (case ((sep_matches_prefix s1388_0)) of
        SOME ((() , s1389_0)) =>
  (case ((string_drop s1388_0 s1389_0)) of
        s1390_0 =>
  (case ((reg_name_matches_prefix s1390_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1391_0)) =>
  (case ((string_drop s1390_0 s1391_0)) of
        s1392_0 =>
  (case ((sep_matches_prefix s1392_0)) of
        SOME ((() , s1393_0)) =>
  (case ((string_drop s1392_0 s1393_0)) of
        s1394_0 =>
  (case ((hex_bits_12_matches_prefix0 s1394_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s1395_0)) =>
  let p0_ = (string_drop s1394_0 s1395_0) in
  if (((p0_ = ""))) then SOME (rd, rs1, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1353_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s1353_:string ->(word_width#bool#bool#(5)words$word#(12)words$word#(5)words$word)option) s1354_0=
    (let s1355_0 = s1354_0 in
   if ((string_startswith s1355_0 "s")) then  
  (case ((string_drop s1355_0 ((string_length "s")))) of
        s1356_0 =>
  (case ((size_mnemonic_matches_prefix s1356_0)) of
        SOME ((size1, s1357_0)) =>
  (case ((string_drop s1356_0 s1357_0)) of
        s1358_0 =>
  (case ((maybe_aq_matches_prefix s1358_0)) of
        SOME ((aq, s1359_0)) =>
  (case ((string_drop s1358_0 s1359_0)) of
        s1360_0 =>
  (case ((maybe_rl_matches_prefix s1360_0)) of
        SOME ((rl, s1361_0)) =>
  (case ((string_drop s1360_0 s1361_0)) of
        s1362_0 =>
  (case ((spc_matches_prefix0 s1362_0)) of
        SOME ((() , s1363_0)) =>
  (case ((string_drop s1362_0 s1363_0)) of
        s1364_0 =>
  (case ((reg_name_matches_prefix s1364_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s1365_0)) =>
  (case ((string_drop s1364_0 s1365_0)) of
        s1366_0 =>
  (case ((sep_matches_prefix s1366_0)) of
        SOME ((() , s1367_0)) =>
  (case ((string_drop s1366_0 s1367_0)) of
        s1368_0 =>
  (case ((hex_bits_12_matches_prefix0 s1368_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s1369_0)) =>
  (case ((string_drop s1368_0 s1369_0)) of
        s1370_0 =>
  (case ((opt_spc_matches_prefix0 s1370_0)) of
        SOME ((() , s1371_0)) =>
  let s1372_0 = (string_drop s1370_0 s1371_0) in
  if ((string_startswith s1372_0 "(")) then
    (case ((string_drop s1372_0 ((string_length "(")))) of
          s1373_0 =>
    (case ((opt_spc_matches_prefix0 s1373_0)) of
          SOME ((() , s1374_0)) =>
    (case ((string_drop s1373_0 s1374_0)) of
          s1375_0 =>
    (case ((reg_name_matches_prefix s1375_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s1376_0)) =>
    (case ((string_drop s1375_0 s1376_0)) of
          s1377_0 =>
    (case ((opt_spc_matches_prefix0 s1377_0)) of
          SOME ((() , s1378_0)) =>
    let s1379_0 = (string_drop s1377_0 s1378_0) in
    if ((string_startswith s1379_0 ")")) then
      let p0_ = (string_drop s1379_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (size1, aq, rl, rs2, imm, rs1) else NONE
    else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1323_ : string -> maybe ((word_width * bool * bool * bool * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s1323_:string ->(word_width#bool#bool#bool#(5)words$word#(12)words$word#(5)words$word)option) s1324_0=
    (let s1325_0 = s1324_0 in
   if ((string_startswith s1325_0 "l")) then  
  (case ((string_drop s1325_0 ((string_length "l")))) of
        s1326_0 =>
  (case ((size_mnemonic_matches_prefix s1326_0)) of
        SOME ((size1, s1327_0)) =>
  (case ((string_drop s1326_0 s1327_0)) of
        s1328_0 =>
  (case ((maybe_u_matches_prefix s1328_0)) of
        SOME ((is_unsigned, s1329_0)) =>
  (case ((string_drop s1328_0 s1329_0)) of
        s1330_0 =>
  (case ((maybe_aq_matches_prefix s1330_0)) of
        SOME ((aq, s1331_0)) =>
  (case ((string_drop s1330_0 s1331_0)) of
        s1332_0 =>
  (case ((maybe_rl_matches_prefix s1332_0)) of
        SOME ((rl, s1333_0)) =>
  (case ((string_drop s1332_0 s1333_0)) of
        s1334_0 =>
  (case ((spc_matches_prefix0 s1334_0)) of
        SOME ((() , s1335_0)) =>
  (case ((string_drop s1334_0 s1335_0)) of
        s1336_0 =>
  (case ((reg_name_matches_prefix s1336_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1337_0)) =>
  (case ((string_drop s1336_0 s1337_0)) of
        s1338_0 =>
  (case ((sep_matches_prefix s1338_0)) of
        SOME ((() , s1339_0)) =>
  (case ((string_drop s1338_0 s1339_0)) of
        s1340_0 =>
  (case ((hex_bits_12_matches_prefix0 s1340_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s1341_0)) =>
  (case ((string_drop s1340_0 s1341_0)) of
        s1342_0 =>
  (case ((opt_spc_matches_prefix0 s1342_0)) of
        SOME ((() , s1343_0)) =>
  let s1344_0 = (string_drop s1342_0 s1343_0) in
  if ((string_startswith s1344_0 "(")) then
    (case ((string_drop s1344_0 ((string_length "(")))) of
          s1345_0 =>
    (case ((opt_spc_matches_prefix0 s1345_0)) of
          SOME ((() , s1346_0)) =>
    (case ((string_drop s1345_0 s1346_0)) of
          s1347_0 =>
    (case ((reg_name_matches_prefix s1347_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s1348_0)) =>
    (case ((string_drop s1347_0 s1348_0)) of
          s1349_0 =>
    (case ((opt_spc_matches_prefix0 s1349_0)) of
          SOME ((() , s1350_0)) =>
    let s1351_0 = (string_drop s1349_0 s1350_0) in
    if ((string_startswith s1351_0 ")")) then
      let p0_ = (string_drop s1351_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (size1, is_unsigned, aq, rl, rd, imm, rs1)
      else NONE else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1306_ : string -> maybe ((rop * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s1306_:string ->(rop#(5)words$word#(5)words$word#(5)words$word)option) s1307_0= 
  ((case s1307_0 of
         s1308_0 =>
   (case ((rtype_mnemonic_matches_prefix s1308_0)) of
         SOME ((op, s1309_0)) =>
   (case ((string_drop s1308_0 s1309_0)) of
         s1310_0 =>
   (case ((spc_matches_prefix0 s1310_0)) of
         SOME ((() , s1311_0)) =>
   (case ((string_drop s1310_0 s1311_0)) of
         s1312_0 =>
   (case ((reg_name_matches_prefix s1312_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1313_0)) =>
   (case ((string_drop s1312_0 s1313_0)) of
         s1314_0 =>
   (case ((sep_matches_prefix s1314_0)) of
         SOME ((() , s1315_0)) =>
   (case ((string_drop s1314_0 s1315_0)) of
         s1316_0 =>
   (case ((reg_name_matches_prefix s1316_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1317_0)) =>
   (case ((string_drop s1316_0 s1317_0)) of
         s1318_0 =>
   (case ((sep_matches_prefix s1318_0)) of
         SOME ((() , s1319_0)) =>
   (case ((string_drop s1318_0 s1319_0)) of
         s1320_0 =>
   (case ((reg_name_matches_prefix s1320_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s1321_0)) =>
   let p0_ = (string_drop s1320_0 s1321_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1289_ : string -> maybe ((sop * mword ty5 * mword ty5 * mword ty6))*)

val _ = Define `
 ((s1289_:string ->(sop#(5)words$word#(5)words$word#(6)words$word)option) s1290_0= 
  ((case s1290_0 of
         s1291_0 =>
   (case ((shiftiop_mnemonic_matches_prefix s1291_0)) of
         SOME ((op, s1292_0)) =>
   (case ((string_drop s1291_0 s1292_0)) of
         s1293_0 =>
   (case ((spc_matches_prefix0 s1293_0)) of
         SOME ((() , s1294_0)) =>
   (case ((string_drop s1293_0 s1294_0)) of
         s1295_0 =>
   (case ((reg_name_matches_prefix s1295_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1296_0)) =>
   (case ((string_drop s1295_0 s1296_0)) of
         s1297_0 =>
   (case ((sep_matches_prefix s1297_0)) of
         SOME ((() , s1298_0)) =>
   (case ((string_drop s1297_0 s1298_0)) of
         s1299_0 =>
   (case ((reg_name_matches_prefix s1299_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1300_0)) =>
   (case ((string_drop s1299_0 s1300_0)) of
         s1301_0 =>
   (case ((sep_matches_prefix s1301_0)) of
         SOME ((() , s1302_0)) =>
   (case ((string_drop s1301_0 s1302_0)) of
         s1303_0 =>
   (case ((hex_bits_6_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s1303_0 : (( 6 words$word # ii)) option)) of
         SOME ((shamt, s1304_0)) =>
   let p0_ = (string_drop s1303_0 s1304_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, shamt) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1272_ : string -> maybe ((iop * mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s1272_:string ->(iop#(5)words$word#(5)words$word#(12)words$word)option) s1273_0= 
  ((case s1273_0 of
         s1274_0 =>
   (case ((itype_mnemonic_matches_prefix s1274_0)) of
         SOME ((op, s1275_0)) =>
   (case ((string_drop s1274_0 s1275_0)) of
         s1276_0 =>
   (case ((spc_matches_prefix0 s1276_0)) of
         SOME ((() , s1277_0)) =>
   (case ((string_drop s1276_0 s1277_0)) of
         s1278_0 =>
   (case ((reg_name_matches_prefix s1278_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1279_0)) =>
   (case ((string_drop s1278_0 s1279_0)) of
         s1280_0 =>
   (case ((sep_matches_prefix s1280_0)) of
         SOME ((() , s1281_0)) =>
   (case ((string_drop s1280_0 s1281_0)) of
         s1282_0 =>
   (case ((reg_name_matches_prefix s1282_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1283_0)) =>
   (case ((string_drop s1282_0 s1283_0)) of
         s1284_0 =>
   (case ((sep_matches_prefix s1284_0)) of
         SOME ((() , s1285_0)) =>
   (case ((string_drop s1284_0 s1285_0)) of
         s1286_0 =>
   (case ((hex_bits_12_matches_prefix0 s1286_0
          : (( 12 words$word # ii)) option)) of
         SOME ((imm, s1287_0)) =>
   let p0_ = (string_drop s1286_0 s1287_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, imm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1255_ : string -> maybe ((bop * mword ty5 * mword ty5 * mword ty13))*)

val _ = Define `
 ((s1255_:string ->(bop#(5)words$word#(5)words$word#(13)words$word)option) s1256_0= 
  ((case s1256_0 of
         s1257_0 =>
   (case ((btype_mnemonic_matches_prefix s1257_0)) of
         SOME ((op, s1258_0)) =>
   (case ((string_drop s1257_0 s1258_0)) of
         s1259_0 =>
   (case ((spc_matches_prefix0 s1259_0)) of
         SOME ((() , s1260_0)) =>
   (case ((string_drop s1259_0 s1260_0)) of
         s1261_0 =>
   (case ((reg_name_matches_prefix s1261_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s1262_0)) =>
   (case ((string_drop s1261_0 s1262_0)) of
         s1263_0 =>
   (case ((sep_matches_prefix s1263_0)) of
         SOME ((() , s1264_0)) =>
   (case ((string_drop s1263_0 s1264_0)) of
         s1265_0 =>
   (case ((reg_name_matches_prefix s1265_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s1266_0)) =>
   (case ((string_drop s1265_0 s1266_0)) of
         s1267_0 =>
   (case ((sep_matches_prefix s1267_0)) of
         SOME ((() , s1268_0)) =>
   (case ((string_drop s1267_0 s1268_0)) of
         s1269_0 =>
   (case ((hex_bits_13_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s1269_0 : (( 13 words$word # ii)) option)) of
         SOME ((imm, s1270_0)) =>
   let p0_ = (string_drop s1269_0 s1270_0) in
   if (((p0_ = ""))) then SOME (op, rs1, rs2, imm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s1239_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s1239_:string ->((5)words$word#(5)words$word#(12)words$word)option) s1240_0=
    (let s1241_0 = s1240_0 in
   if ((string_startswith s1241_0 "jalr")) then  
  (case ((string_drop s1241_0 ((string_length "jalr")))) of
        s1242_0 =>
  (case ((spc_matches_prefix0 s1242_0)) of
        SOME ((() , s1243_0)) =>
  (case ((string_drop s1242_0 s1243_0)) of
        s1244_0 =>
  (case ((reg_name_matches_prefix s1244_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1245_0)) =>
  (case ((string_drop s1244_0 s1245_0)) of
        s1246_0 =>
  (case ((sep_matches_prefix s1246_0)) of
        SOME ((() , s1247_0)) =>
  (case ((string_drop s1246_0 s1247_0)) of
        s1248_0 =>
  (case ((reg_name_matches_prefix s1248_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s1249_0)) =>
  (case ((string_drop s1248_0 s1249_0)) of
        s1250_0 =>
  (case ((sep_matches_prefix s1250_0)) of
        SOME ((() , s1251_0)) =>
  (case ((string_drop s1250_0 s1251_0)) of
        s1252_0 =>
  (case ((hex_bits_12_matches_prefix0 s1252_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s1253_0)) =>
  let p0_ = (string_drop s1252_0 s1253_0) in
  if (((p0_ = ""))) then SOME (rd, rs1, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1227_ : string -> maybe ((mword ty5 * mword ty21))*)

val _ = Define `
 ((s1227_:string ->((5)words$word#(21)words$word)option) s1228_0=
    (let s1229_0 = s1228_0 in
   if ((string_startswith s1229_0 "jal")) then  
  (case ((string_drop s1229_0 ((string_length "jal")))) of
        s1230_0 =>
  (case ((spc_matches_prefix0 s1230_0)) of
        SOME ((() , s1231_0)) =>
  (case ((string_drop s1230_0 s1231_0)) of
        s1232_0 =>
  (case ((reg_name_matches_prefix s1232_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s1233_0)) =>
  (case ((string_drop s1232_0 s1233_0)) of
        s1234_0 =>
  (case ((sep_matches_prefix s1234_0)) of
        SOME ((() , s1235_0)) =>
  (case ((string_drop s1234_0 s1235_0)) of
        s1236_0 =>
  (case ((hex_bits_21_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s1236_0 : (( 21 words$word # ii)) option)) of
        SOME ((imm, s1237_0)) =>
  let p0_ = (string_drop s1236_0 s1237_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s1214_ : string -> maybe ((uop * mword ty5 * mword ty20))*)

val _ = Define `
 ((s1214_:string ->(uop#(5)words$word#(20)words$word)option) s1215_0= 
  ((case s1215_0 of
         s1216_0 =>
   (case ((utype_mnemonic_matches_prefix s1216_0)) of
         SOME ((op, s1217_0)) =>
   (case ((string_drop s1216_0 s1217_0)) of
         s1218_0 =>
   (case ((spc_matches_prefix0 s1218_0)) of
         SOME ((() , s1219_0)) =>
   (case ((string_drop s1218_0 s1219_0)) of
         s1220_0 =>
   (case ((reg_name_matches_prefix s1220_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s1221_0)) =>
   (case ((string_drop s1220_0 s1221_0)) of
         s1222_0 =>
   (case ((sep_matches_prefix s1222_0)) of
         SOME ((() , s1223_0)) =>
   (case ((string_drop s1222_0 s1223_0)) of
         s1224_0 =>
   (case ((hex_bits_20_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s1224_0 : (( 20 words$word # ii)) option)) of
         SOME ((imm, s1225_0)) =>
   let p0_ = (string_drop s1224_0 s1225_0) in
   if (((p0_ = ""))) then SOME (op, rd, imm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((assembly_backwards:string ->(regstate)sail2_state_monad$sequential_state ->(((ast),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) arg_=
    (let s1226_0 = arg_ in
   if ((case ((s1214_ s1226_0  :  ((uop #  5 words$word #  20 words$word))option)) of
       SOME ((op, rd, imm)) => T
     | _ => F
     )) then  (case (s1214_ s1226_0 : (( uop # 5 words$word # 20 words$word)) option) of
     (SOME ((op, rd, imm))) =>
 sail2_state_monad$returnS (UTYPE (imm, rd, op))
 )
   else if ((case ((s1227_ s1226_0  :  (( 5 words$word #  21 words$word))option)) of
       SOME ((rd, imm)) => T
     | _ => F
     )) then  (case (s1227_ s1226_0 : (( 5 words$word # 21 words$word)) option) of
     (SOME ((rd, imm))) =>
 sail2_state_monad$returnS (RISCV_JAL (imm, rd))
 )
   else if ((case ((s1239_ s1226_0  :  (( 5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((rd, rs1, imm)) => T
     | _ => F
     )) then  (case (s1239_ s1226_0 : (( 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((rd, rs1, imm))) =>
 sail2_state_monad$returnS (RISCV_JALR (imm, rs1, rd))
 )
   else if ((case ((s1255_ s1226_0  :  ((bop #  5 words$word #  5 words$word #  13 words$word))option)) of
       SOME ((op, rs1, rs2, imm)) => T
     | _ => F
     )) then  (case
 (s1255_ s1226_0 : (( bop # 5 words$word # 5 words$word # 13 words$word)) option) of
     (SOME ((op, rs1, rs2, imm))) =>
 sail2_state_monad$returnS (BTYPE (imm, rs2, rs1, op))
 )
   else if ((case ((s1272_ s1226_0  :  ((iop #  5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((op, rd, rs1, imm)) => T
     | _ => F
     )) then  (case
 (s1272_ s1226_0 : (( iop # 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((op, rd, rs1, imm))) =>
 sail2_state_monad$returnS (ITYPE (imm, rs1, rd, op))
 )
   else if ((case ((s1289_ s1226_0  :  ((sop #  5 words$word #  5 words$word #  6 words$word))option)) of
       SOME ((op, rd, rs1, shamt)) => T
     | _ => F
     )) then  (case
 (s1289_ s1226_0 : (( sop # 5 words$word # 5 words$word # 6 words$word)) option) of
     (SOME ((op, rd, rs1, shamt))) =>
 sail2_state_monad$returnS (SHIFTIOP (shamt, rs1, rd, op))
 )
   else if ((case ((s1306_ s1226_0  :  ((rop #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s1306_ s1226_0 : (( rop # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (RTYPE (rs2, rs1, rd, op))
 )
   else if ((case ((s1323_ s1226_0
                     :  ((word_width # bool # bool # bool #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((size1, is_unsigned, aq, rl, rd, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s1323_ s1226_0
 : (( word_width # bool # bool # bool # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((size1, is_unsigned, aq, rl, rd, imm, rs1))) =>
 sail2_state_monad$returnS (LOAD (imm, rs1, rd, is_unsigned, size1, aq, rl))
 )
   else if ((case ((s1353_ s1226_0
                     :  ((word_width # bool # bool #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((size1, aq, rl, rs2, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s1353_ s1226_0 : (( word_width # bool # bool # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((size1, aq, rl, rs2, imm, rs1))) =>
 sail2_state_monad$returnS (STORE (imm, rs2, rs1, size1, aq, rl))
 )
   else if ((case ((s1381_ s1226_0  :  (( 5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((rd, rs1, imm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s1381_ s1226_0 : (( 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((rd, rs1, imm))) =>
 sail2_state_monad$returnS (ADDIW (imm, rs1, rd))
 )
   else if ((case ((s1397_ s1226_0  :  ((sop #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, shamt)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s1397_ s1226_0 : (( sop # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, shamt))) =>
 sail2_state_monad$returnS (SHIFTW (shamt, rs1, rd, op))
 )
   else if ((case ((s1414_ s1226_0  :  ((ropw #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s1414_ s1226_0 : (( ropw # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (RTYPEW (rs2, rs1, rd, op))
 )
   else if ((case ((s1431_ s1226_0  :  ((sopw #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, shamt)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s1431_ s1226_0 : (( sopw # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, shamt))) =>
 sail2_state_monad$returnS (SHIFTIWOP (shamt, rs1, rd, op))
 )
   else if ((case ((s1448_ s1226_0  :  (( 4 words$word #  4 words$word))option)) of
       SOME ((pred, succ)) => T
     | _ => F
     )) then  (case (s1448_ s1226_0 : (( 4 words$word # 4 words$word)) option) of
     (SOME ((pred, succ))) =>
 sail2_state_monad$returnS (FENCE (pred, succ))
 )
   else if ((case ((s1460_ s1226_0  :  (( 4 words$word #  4 words$word))option)) of
       SOME ((pred, succ)) => T
     | _ => F
     )) then  (case (s1460_ s1226_0 : (( 4 words$word # 4 words$word)) option) of
     (SOME ((pred, succ))) =>
 sail2_state_monad$returnS (FENCE_TSO (pred, succ))
 )
   else if (((s1226_0 = "fence.i"))) then sail2_state_monad$returnS (FENCEI () )
   else if (((s1226_0 = "ecall"))) then sail2_state_monad$returnS (ECALL () )
   else if (((s1226_0 = "mret"))) then sail2_state_monad$returnS (MRET () )
   else if (((s1226_0 = "sret"))) then sail2_state_monad$returnS (SRET () )
   else if (((s1226_0 = "ebreak"))) then sail2_state_monad$returnS (EBREAK () )
   else if (((s1226_0 = "wfi"))) then sail2_state_monad$returnS (WFI () )
   else if ((case ((s1472_ s1226_0  :  (( 5 words$word #  5 words$word))option)) of
       SOME ((rs1, rs2)) => T
     | _ => F
     )) then  (case (s1472_ s1226_0 : (( 5 words$word # 5 words$word)) option) of
     (SOME ((rs1, rs2))) =>
 sail2_state_monad$returnS (SFENCE_VMA (rs1, rs2))
 )
   else if ((case ((s1484_ s1226_0  :  ((word_width # bool # bool #  5 words$word #  5 words$word))option)) of
       SOME ((size1, aq, rl, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s1484_ s1226_0 : (( word_width # bool # bool # 5 words$word # 5 words$word)) option) of
     (SOME ((size1, aq, rl, rd, rs1))) =>
 sail2_state_monad$returnS (LOADRES (aq, rl, rs1, size1, rd))
 )
   else if ((case ((s1502_ s1226_0
                     :  ((word_width # bool # bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((size1, aq, rl, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s1502_ s1226_0 : (( word_width # bool # bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((size1, aq, rl, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (STORECON (aq, rl, rs2, rs1, size1, rd))
 )
   else if ((case ((s1524_ s1226_0
                     :  ((amoop # word_width # bool # bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, width, aq, rl, rd, rs2, rs1)) => T
     | _ => F
     )) then  (case
 (s1524_ s1226_0
 : (( amoop # word_width # bool # bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, width, aq, rl, rd, rs2, rs1))) =>
 sail2_state_monad$returnS (AMO (op, aq, rl, rs2, rs1, width, rd))
 )
   else if (((s1226_0 = "c.nop"))) then sail2_state_monad$returnS (C_NOP () )
   else if ((case ((s1550_ s1226_0  :  (( 3 words$word #  8 words$word))option)) of
       SOME ((rdc, nzimm)) => (nzimm <> (0x00w :  8 words$word))
     | _ => F
     )) then  (case (s1550_ s1226_0 : (( 3 words$word # 8 words$word)) option) of
     (SOME ((rdc, nzimm))) =>
 sail2_state_monad$returnS (C_ADDI4SPN (rdc, nzimm))
 )
   else if ((case ((s1562_ s1226_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rdc, rsc, uimm)) => T
     | _ => F
     )) then  (case
 (s1562_ s1226_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rdc, rsc, uimm))) =>
 sail2_state_monad$returnS (C_LW (uimm, rsc, rdc))
 )
   else if ((case ((s1578_ s1226_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rdc, rsc, uimm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s1578_ s1226_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rdc, rsc, uimm))) =>
 sail2_state_monad$returnS (C_LD (uimm, rsc, rdc))
 )
   else if ((case ((s1594_ s1226_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rsc1, rsc2, uimm)) => T
     | _ => F
     )) then  (case
 (s1594_ s1226_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rsc1, rsc2, uimm))) =>
 sail2_state_monad$returnS (C_SW (uimm, rsc1, rsc2))
 )
   else if ((case ((s1610_ s1226_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rsc1, rsc2, uimm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s1610_ s1226_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rsc1, rsc2, uimm))) =>
 sail2_state_monad$returnS (C_SD (uimm, rsc1, rsc2))
 )
   else if ((case ((s1626_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, nzi)) => ((((nzi <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))
     | _ => F
     )) then  (case (s1626_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, nzi))) =>
 sail2_state_monad$returnS (C_ADDI (nzi, rsd))
 )
   else if ((case ((s1638_ s1226_0  :  ( 11 words$word)option)) of
       SOME (imm) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s1638_ s1226_0 : ( 11 words$word) option) of
     (SOME (imm)) =>
 sail2_state_monad$returnS (C_JAL imm)
 )
   else if ((case ((s1646_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, imm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s1646_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, imm))) =>
 sail2_state_monad$returnS (C_ADDIW (imm, rsd))
 )
   else if ((case ((s1658_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, imm)) => (rd <> zreg)
     | _ => F
     )) then  (case (s1658_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, imm))) =>
 sail2_state_monad$returnS (C_LI (imm, rd))
 )
   else if ((case ((s1670_ s1226_0  :  ( 6 words$word)option)) of
       SOME (imm) => (imm <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s1670_ s1226_0 : ( 6 words$word) option) of
     (SOME (imm)) =>
 sail2_state_monad$returnS (C_ADDI16SP imm)
 )
   else if ((case ((s1678_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, imm)) =>
        ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((imm <> (0b000000w :  6 words$word))))))))
     | _ => F
     )) then  (case (s1678_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, imm))) =>
 sail2_state_monad$returnS (C_LUI (imm, rd))
 )
   else if ((case ((s1690_ s1226_0  :  (( 3 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => (shamt <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s1690_ s1226_0 : (( 3 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 sail2_state_monad$returnS (C_SRLI (shamt, rsd))
 )
   else if ((case ((s1702_ s1226_0  :  (( 3 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => (shamt <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s1702_ s1226_0 : (( 3 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 sail2_state_monad$returnS (C_SRAI (shamt, rsd))
 )
   else if ((case ((s1714_ s1226_0  :  (( 3 words$word #  6 words$word))option)) of
       SOME ((rsd, imm)) => T
     | _ => F
     )) then  (case (s1714_ s1226_0 : (( 3 words$word # 6 words$word)) option) of
     (SOME ((rsd, imm))) =>
 sail2_state_monad$returnS (C_ANDI (imm, rsd))
 )
   else if ((case ((s1726_ s1226_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s1726_ s1226_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_SUB (rsd, rs2))
 )
   else if ((case ((s1738_ s1226_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s1738_ s1226_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_XOR (rsd, rs2))
 )
   else if ((case ((s1750_ s1226_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s1750_ s1226_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_OR (rsd, rs2))
 )
   else if ((case ((s1762_ s1226_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s1762_ s1226_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_AND (rsd, rs2))
 )
   else if ((case ((s1774_ s1226_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s1774_ s1226_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_SUBW (rsd, rs2))
 )
   else if ((case ((s1786_ s1226_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s1786_ s1226_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_ADDW (rsd, rs2))
 )
   else if ((case ((s1798_ s1226_0  :  ( 11 words$word)option)) of
       SOME (imm) => T
     | _ => F
     )) then  (case (s1798_ s1226_0 : ( 11 words$word) option) of
     (SOME (imm)) =>
 sail2_state_monad$returnS (C_J imm)
 )
   else if ((case ((s1806_ s1226_0  :  (( 3 words$word #  8 words$word))option)) of
       SOME ((rs, imm)) => T
     | _ => F
     )) then  (case (s1806_ s1226_0 : (( 3 words$word # 8 words$word)) option) of
     (SOME ((rs, imm))) =>
 sail2_state_monad$returnS (C_BEQZ (imm, rs))
 )
   else if ((case ((s1818_ s1226_0  :  (( 3 words$word #  8 words$word))option)) of
       SOME ((rs, imm)) => T
     | _ => F
     )) then  (case (s1818_ s1226_0 : (( 3 words$word # 8 words$word)) option) of
     (SOME ((rs, imm))) =>
 sail2_state_monad$returnS (C_BNEZ (imm, rs))
 )
   else if ((case ((s1830_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => ((((shamt <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))
     | _ => F
     )) then  (case (s1830_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 sail2_state_monad$returnS (C_SLLI (shamt, rsd))
 )
   else if ((case ((s1842_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => (rd <> zreg)
     | _ => F
     )) then  (case (s1842_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 sail2_state_monad$returnS (C_LWSP (uimm, rd))
 )
   else if ((case ((s1854_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => ((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))
     | _ => F
     )) then  (case (s1854_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 sail2_state_monad$returnS (C_LDSP (uimm, rd))
 )
   else if ((case ((s1866_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => T
     | _ => F
     )) then  (case (s1866_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 sail2_state_monad$returnS (C_SWSP (uimm, rd))
 )
   else if ((case ((s1878_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rs2, uimm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s1878_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rs2, uimm))) =>
 sail2_state_monad$returnS (C_SDSP (uimm, rs2))
 )
   else if ((case ((s1890_ s1226_0  :  ( 5 words$word)option)) of
       SOME (rs1) => (rs1 <> zreg)
     | _ => F
     )) then  (case (s1890_ s1226_0 : ( 5 words$word) option) of
     (SOME (rs1)) =>
 sail2_state_monad$returnS (C_JR rs1)
 )
   else if ((case ((s1898_ s1226_0  :  ( 5 words$word)option)) of
       SOME (rs1) => (rs1 <> zreg)
     | _ => F
     )) then  (case (s1898_ s1226_0 : ( 5 words$word) option) of
     (SOME (rs1)) =>
 sail2_state_monad$returnS (C_JALR rs1)
 )
   else if ((case ((s1906_ s1226_0  :  (( 5 words$word #  5 words$word))option)) of
       SOME ((rd, rs2)) => ((((rd <> zreg))) /\ (((rs2 <> zreg))))
     | _ => F
     )) then  (case (s1906_ s1226_0 : (( 5 words$word # 5 words$word)) option) of
     (SOME ((rd, rs2))) =>
 sail2_state_monad$returnS (C_MV (rd, rs2))
 )
   else if (((s1226_0 = "c.ebreak"))) then sail2_state_monad$returnS (C_EBREAK () )
   else if ((case ((s1918_ s1226_0  :  (( 5 words$word #  5 words$word))option)) of
       SOME ((rsd, rs2)) => ((((rsd <> zreg))) /\ (((rs2 <> zreg))))
     | _ => F
     )) then  (case (s1918_ s1226_0 : (( 5 words$word # 5 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 sail2_state_monad$returnS (C_ADD (rsd, rs2))
 )
   else if ((case ((s1930_ s1226_0
                     :  ((bool # bool # bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((high, signed1, signed2, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s1930_ s1226_0 : (( bool # bool # bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((high, signed1, signed2, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (MUL (rs2, rs1, rd, high, signed1, signed2))
 )
   else if ((case ((s1947_ s1226_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s1947_ s1226_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (DIV0 (rs2, rs1, rd, s))
 )
   else if ((case ((s1965_ s1226_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s1965_ s1226_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (REM (rs2, rs1, rd, s))
 )
   else if ((case ((s1983_ s1226_0  :  (( 5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s1983_ s1226_0 : (( 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((rd, rs1, rs2))) =>
 sail2_state_monad$returnS (MULW (rs2, rs1, rd))
 )
   else if ((case ((s1999_ s1226_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s1999_ s1226_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (DIVW (rs2, rs1, rd, s))
 )
   else if ((case ((s2018_ s1226_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s2018_ s1226_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (REMW (rs2, rs1, rd, s))
 )
   else if ((case ((s2037_ s1226_0  :  ((csrop #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((op, rd, csr, rs1)) => T
     | _ => F
     )) then  (case
 (s2037_ s1226_0 : (( csrop # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((op, rd, csr, rs1))) =>
 sail2_state_monad$returnS (CSR (csr, rs1, rd, T, op))
 )
   else if ((case ((s2055_ s1226_0  :  ((csrop #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((op, rd, csr, rs1)) => T
     | _ => F
     )) then  (case
 (s2055_ s1226_0 : (( csrop # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((op, rd, csr, rs1))) =>
 sail2_state_monad$returnS (CSR (csr, rs1, rd, F, op))
 )
   else if (((s1226_0 = "uret"))) then sail2_state_monad$returnS (URET () )
   else if ((case ((s2072_ s1226_0  :  ( 6 words$word)option)) of
       SOME (imm) => T
     | _ => F
     )) then  (case (s2072_ s1226_0 : ( 6 words$word) option) of
     (SOME (imm)) =>
 sail2_state_monad$returnS (C_NOP_HINT imm)
 )
   else if ((case ((s2078_ s1226_0  :  ( 5 words$word)option)) of
       SOME (rsd) => (rsd <> zreg)
     | _ => F
     )) then  (case (s2078_ s1226_0 : ( 5 words$word) option) of
     (SOME (rsd)) =>
 sail2_state_monad$returnS (C_ADDI_HINT rsd)
 )
   else if ((case ((s2084_ s1226_0  :  ( 6 words$word)option)) of
       SOME (imm) => T
     | _ => F
     )) then  (case (s2084_ s1226_0 : ( 6 words$word) option) of
     (SOME (imm)) =>
 sail2_state_monad$returnS (C_LI_HINT imm)
 )
   else if ((case ((s2090_ s1226_0  :  ( 6 words$word)option)) of
       SOME (imm) => (imm <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s2090_ s1226_0 : ( 6 words$word) option) of
     (SOME (imm)) =>
 sail2_state_monad$returnS (C_LUI_HINT imm)
 )
   else if ((case ((s2096_ s1226_0  :  ( 5 words$word)option)) of
       SOME (rs2) => (rs2 <> zreg)
     | _ => F
     )) then  (case (s2096_ s1226_0 : ( 5 words$word) option) of
     (SOME (rs2)) =>
 sail2_state_monad$returnS (C_MV_HINT rs2)
 )
   else if ((case ((s2102_ s1226_0  :  ( 5 words$word)option)) of
       SOME (rs2) => (rs2 <> zreg)
     | _ => F
     )) then  (case (s2102_ s1226_0 : ( 5 words$word) option) of
     (SOME (rs2)) =>
 sail2_state_monad$returnS (C_ADD_HINT rs2)
 )
   else if ((case ((s2108_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => ((((shamt = (0b000000w :  6 words$word)))) \/ (((rsd = zreg))))
     | _ => F
     )) then  (case (s2108_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 sail2_state_monad$returnS (C_SLLI_HINT (shamt, rsd))
 )
   else if ((case ((s2117_ s1226_0  :  ( 3 words$word)option)) of
       SOME (rsd) => T
     | _ => F
     )) then  (case (s2117_ s1226_0 : ( 3 words$word) option) of
     (SOME (rsd)) =>
 sail2_state_monad$returnS (C_SRLI_HINT rsd)
 )
   else if ((case ((s2123_ s1226_0  :  ( 3 words$word)option)) of
       SOME (rsd) => T
     | _ => F
     )) then  (case (s2123_ s1226_0 : ( 3 words$word) option) of
     (SOME (rsd)) =>
 sail2_state_monad$returnS (C_SRAI_HINT rsd)
 )
   else if ((case ((s2129_ s1226_0
                     :  (( 4 words$word #  4 words$word #  5 words$word #  5 words$word #  4 words$word))option)) of
       SOME ((pred, succ, rs, rd, fm)) =>
        (((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word))))))))
     | _ => F
     )) then  (case
 (s2129_ s1226_0 : (( 4 words$word # 4 words$word # 5 words$word # 5 words$word # 4 words$word)) option) of
     (SOME ((pred, succ, rs, rd, fm))) =>
 sail2_state_monad$returnS (FENCE_RESERVED (fm, pred, succ, rs, rd))
 )
   else if ((case ((s2147_ s1226_0  :  (( 5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((rd, rs, imm)) =>
        ((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg)))))))
     | _ => F
     )) then  (case (s2147_ s1226_0 : (( 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((rd, rs, imm))) =>
 sail2_state_monad$returnS (FENCEI_RESERVED (imm, rs, rd))
 )
   else if ((case ((s2159_ s1226_0  :  ((word_width #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((width, rd, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s2159_ s1226_0 : (( word_width # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((width, rd, imm, rs1))) =>
 sail2_state_monad$returnS (LOAD_FP (imm, rs1, rd, width))
 )
   else if ((case ((s2183_ s1226_0  :  ((word_width #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((width, rs2, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s2183_ s1226_0 : (( word_width # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((width, rs2, imm, rs1))) =>
 sail2_state_monad$returnS (STORE_FP (imm, rs2, rs1, width))
 )
   else if ((case ((s2207_ s1226_0
                     :  ((f_madd_op_S #  5 words$word #  5 words$word #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((op, rd, rs1, rs2, rs3, rm)) => T
     | _ => F
     )) then  (case
 (s2207_ s1226_0
 : (( f_madd_op_S # 5 words$word # 5 words$word # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((op, rd, rs1, rs2, rs3, rm))) =>
 sail2_state_monad$returnS (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, op))
 )
   else if ((case ((s2232_ s1226_0
                     :  ((f_bin_rm_op_S #  5 words$word #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((op, rd, rs1, rs2, rm)) => T
     | _ => F
     )) then  (case
 (s2232_ s1226_0
 : (( f_bin_rm_op_S # 5 words$word # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((op, rd, rs1, rs2, rm))) =>
 sail2_state_monad$returnS (F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, op))
 )
   else if ((case ((s2253_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FSQRT_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2253_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FSQRT_S, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S))
 )
   else if ((case ((s2270_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_W_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2270_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_W_S, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S))
 )
   else if ((case ((s2287_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_WU_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2287_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_WU_S, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S))
 )
   else if ((case ((s2304_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_W, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2304_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_W, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W))
 )
   else if ((case ((s2321_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_WU, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2321_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_WU, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_WU))
 )
   else if ((case ((s2338_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_L_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2338_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_L_S, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_L_S))
 )
   else if ((case ((s2355_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_LU_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2355_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_LU_S, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_LU_S))
 )
   else if ((case ((s2372_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_L, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2372_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_L, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_L))
 )
   else if ((case ((s2389_ s1226_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_LU, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s2389_ s1226_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_LU, rd, rs1, rm))) =>
 sail2_state_monad$returnS (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_LU))
 )
   else if ((case ((s2406_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FSGNJ_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2406_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FSGNJ_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FSGNJ_S))
 )
   else if ((case ((s2423_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FSGNJN_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2423_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FSGNJN_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FSGNJN_S))
 )
   else if ((case ((s2440_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FSGNJX_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2440_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FSGNJX_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FSGNJX_S))
 )
   else if ((case ((s2457_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FMIN_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2457_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FMIN_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FMIN_S))
 )
   else if ((case ((s2474_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FMAX_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2474_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FMAX_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FMAX_S))
 )
   else if ((case ((s2491_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FEQ_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2491_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FEQ_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FEQ_S))
 )
   else if ((case ((s2508_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FLT_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2508_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FLT_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FLT_S))
 )
   else if ((case ((s2525_ s1226_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FLE_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2525_ s1226_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FLE_S, rd, rs1, rs2))) =>
 sail2_state_monad$returnS (F_BIN_TYPE_S (rs2, rs1, rd, FLE_S))
 )
   else if ((case ((s2542_ s1226_0  :  ((f_un_op_S #  5 words$word #  5 words$word))option)) of
       SOME ((FMV_X_W, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s2542_ s1226_0 : (( f_un_op_S # 5 words$word # 5 words$word)) option) of
     (SOME ((FMV_X_W, rd, rs1))) =>
 sail2_state_monad$returnS (F_UN_TYPE_S (rs1, rd, FMV_X_W))
 )
   else if ((case ((s2555_ s1226_0  :  ((f_un_op_S #  5 words$word #  5 words$word))option)) of
       SOME ((FMV_W_X, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s2555_ s1226_0 : (( f_un_op_S # 5 words$word # 5 words$word)) option) of
     (SOME ((FMV_W_X, rd, rs1))) =>
 sail2_state_monad$returnS (F_UN_TYPE_S (rs1, rd, FMV_W_X))
 )
   else if ((case ((s2568_ s1226_0  :  ((f_un_op_S #  5 words$word #  5 words$word))option)) of
       SOME ((FCLASS_S, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s2568_ s1226_0 : (( f_un_op_S # 5 words$word # 5 words$word)) option) of
     (SOME ((FCLASS_S, rd, rs1))) =>
 sail2_state_monad$returnS (F_UN_TYPE_S (rs1, rd, FCLASS_S))
 )
   else if ((case ((s2581_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, imm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s2581_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, imm))) =>
 sail2_state_monad$returnS (C_FLWSP (imm, rd))
 )
   else if ((case ((s2593_ s1226_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s2593_ s1226_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 sail2_state_monad$returnS (C_FSWSP (uimm, rd))
 )
   else if ((case ((s2605_ s1226_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rdc, rsc, uimm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case
 (s2605_ s1226_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rdc, rsc, uimm))) =>
 sail2_state_monad$returnS (C_FLW (uimm, rsc, rdc))
 )
   else if ((case ((s2621_ s1226_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rsc1, rsc2, uimm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case
 (s2621_ s1226_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rsc1, rsc2, uimm))) =>
 sail2_state_monad$returnS (C_FSW (uimm, rsc1, rsc2))
 )
   else if ((case ((s2637_ s1226_0  :  ( 32 words$word)option)) of   SOME (s) => T | _ => F ))
   then  (case (s2637_ s1226_0 : ( 32 words$word) option) of
     (SOME (s)) =>
 sail2_state_monad$returnS (ILLEGAL s)
 )
   else if ((case ((s2645_ s1226_0  :  ( 16 words$word)option)) of   SOME (s) => T | _ => F ))
   then  (case (s2645_ s1226_0 : ( 16 words$word) option) of
     (SOME (s)) =>
 sail2_state_monad$returnS (C_ILLEGAL s)
 )
   else sail2_state_monad$seqS (sail2_state_monad$assert_expS F "Pattern match failure at unknown location") (sail2_state_monad$exitS () )))`;


val _ = Define `
 ((assembly_forwards_matches:ast -> bool) arg_= 
  ((case arg_ of
         UTYPE ((imm, rd, op)) => T
     | RISCV_JAL ((imm, rd)) => T
     | RISCV_JALR ((imm, rs1, rd)) => T
     | BTYPE ((imm, rs2, rs1, op)) => T
     | ITYPE ((imm, rs1, rd, op)) => T
     | SHIFTIOP ((shamt, rs1, rd, op)) => T
     | RTYPE ((rs2, rs1, rd, op)) => T
     | LOAD ((imm, rs1, rd, is_unsigned, size1, aq, rl)) => T
     | STORE ((imm, rs2, rs1, size1, aq, rl)) => T
     | ADDIW ((imm, rs1, rd)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | SHIFTW ((shamt, rs1, rd, op)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | RTYPEW ((rs2, rs1, rd, op)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | SHIFTIWOP ((shamt, rs1, rd, op)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | FENCE ((pred, succ)) => T
     | FENCE_TSO ((pred, succ)) => T
     | FENCEI (() ) => T
     | ECALL (() ) => T
     | MRET (() ) => T
     | SRET (() ) => T
     | EBREAK (() ) => T
     | WFI (() ) => T
     | SFENCE_VMA ((rs1, rs2)) => T
     | LOADRES ((aq, rl, rs1, size1, rd)) => T
     | STORECON ((aq, rl, rs2, rs1, size1, rd)) => T
     | AMO ((op, aq, rl, rs2, rs1, width, rd)) => T
     | C_NOP (() ) => T
     | C_ADDI4SPN ((rdc, nzimm)) =>
   if (((nzimm <> (0x00w : 8 words$word)))) then T else F
     | C_LW ((uimm, rsc, rdc)) => T
     | C_LD ((uimm, rsc, rdc)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | C_SW ((uimm, rsc1, rsc2)) => T
     | C_SD ((uimm, rsc1, rsc2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | C_ADDI ((nzi, rsd)) =>
   if ((((((nzi <> (0b000000w : 6 words$word)))) /\ (((rsd <> zreg)))))) then
     T else F
     | C_JAL (imm) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then T else F
     | C_ADDIW ((imm, rsd)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | C_LI ((imm, rd)) =>
   if (((rd <> zreg))) then T else F
     | C_ADDI16SP (imm) =>
   if (((imm <> (0b000000w : 6 words$word)))) then T else F
     | C_LUI ((imm, rd)) =>
   if ((((((rd <> zreg))) /\
           ((((((rd <> sp))) /\ (((imm <> (0b000000w : 6 words$word)))))))))) then
     T else F
     | C_SRLI ((shamt, rsd)) =>
   if (((shamt <> (0b000000w : 6 words$word)))) then T else F
     | C_SRAI ((shamt, rsd)) =>
   if (((shamt <> (0b000000w : 6 words$word)))) then T else F
     | C_ANDI ((imm, rsd)) => T
     | C_SUB ((rsd, rs2)) => T
     | C_XOR ((rsd, rs2)) => T
     | C_OR ((rsd, rs2)) => T
     | C_AND ((rsd, rs2)) => T
     | C_SUBW ((rsd, rs2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | C_ADDW ((rsd, rs2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | C_J (imm) => T
     | C_BEQZ ((imm, rs)) => T
     | C_BNEZ ((imm, rs)) => T
     | C_SLLI ((shamt, rsd)) =>
   if ((((((shamt <> (0b000000w : 6 words$word)))) /\ (((rsd <> zreg)))))) then
     T else F
     | C_LWSP ((uimm, rd)) =>
   if (((rd <> zreg))) then T else F
     | C_LDSP ((uimm, rd)) =>
   if ((((((rd <> zreg))) /\ ((((( 32 : int): ii) = (( 64 : int): ii))))))) then
     T else F
     | C_SWSP ((uimm, rd)) => T
     | C_SDSP ((uimm, rs2)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | C_JR (rs1) =>
   if (((rs1 <> zreg))) then T else F
     | C_JALR (rs1) =>
   if (((rs1 <> zreg))) then T else F
     | C_MV ((rd, rs2)) =>
   if ((((((rd <> zreg))) /\ (((rs2 <> zreg)))))) then T else F
     | C_EBREAK (() ) => T
     | C_ADD ((rsd, rs2)) =>
   if ((((((rsd <> zreg))) /\ (((rs2 <> zreg)))))) then T else F
     | MUL ((rs2, rs1, rd, high, signed1, signed2)) => T
     | DIV0 ((rs2, rs1, rd, s)) => T
     | REM ((rs2, rs1, rd, s)) => T
     | MULW ((rs2, rs1, rd)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | DIVW ((rs2, rs1, rd, s)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | REMW ((rs2, rs1, rd, s)) =>
   if ((((( 32 : int): ii) = (( 64 : int): ii)))) then T else F
     | CSR ((csr, rs1, rd, T, op)) => T
     | CSR ((csr, rs1, rd, F, op)) => T
     | URET (() ) => T
     | C_NOP_HINT (imm) => T
     | C_ADDI_HINT (rsd) =>
   if (((rsd <> zreg))) then T else F
     | C_LI_HINT (imm) => T
     | C_LUI_HINT (imm) =>
   if (((imm <> (0b000000w : 6 words$word)))) then T else F
     | C_MV_HINT (rs2) =>
   if (((rs2 <> zreg))) then T else F
     | C_ADD_HINT (rs2) =>
   if (((rs2 <> zreg))) then T else F
     | C_SLLI_HINT ((shamt, rsd)) =>
   if ((((((shamt = (0b000000w : 6 words$word)))) \/ (((rsd = zreg)))))) then
     T else F
     | C_SRLI_HINT (rsd) => T
     | C_SRAI_HINT (rsd) => T
     | FENCE_RESERVED ((fm, pred, succ, rs, rd)) =>
   if (((((((((fm <> (0x0w : 4 words$word)))) /\
              (((fm <> (0x8w : 4 words$word))))))) \/
           ((((((rs <> (0b00000w : 5 words$word)))) \/
                (((rd <> (0b00000w : 5 words$word)))))))))) then T else 
   F
     | FENCEI_RESERVED ((imm, rs, rd)) =>
   if ((((((imm <> (0x000w : 12 words$word)))) \/
           ((((((rs <> zreg))) \/ (((rd <> zreg))))))))) then T else 
   F
     | LOAD_FP ((imm, rs1, rd, width)) => T
     | STORE_FP ((imm, rs2, rs1, width)) => T
     | F_MADD_TYPE_S ((rs3, rs2, rs1, rm, rd, op)) => T
     | F_BIN_RM_TYPE_S ((rs2, rs1, rm, rd, op)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FSQRT_S)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_W_S)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_WU_S)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_W)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_WU)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_L_S)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_LU_S)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_L)) => T
     | F_UN_RM_TYPE_S ((rs1, rm, rd, FCVT_S_LU)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJ_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJN_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FSGNJX_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FMIN_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FMAX_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FEQ_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FLT_S)) => T
     | F_BIN_TYPE_S ((rs2, rs1, rd, FLE_S)) => T
     | F_UN_TYPE_S ((rs1, rd, FMV_X_W)) => T
     | F_UN_TYPE_S ((rs1, rd, FMV_W_X)) => T
     | F_UN_TYPE_S ((rs1, rd, FCLASS_S)) => T
     | C_FLWSP ((imm, rd)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then T else F
     | C_FSWSP ((uimm, rd)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then T else F
     | C_FLW ((uimm, rsc, rdc)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then T else F
     | C_FSW ((uimm, rsc1, rsc2)) =>
   if ((((( 32 : int): ii) = (( 32 : int): ii)))) then T else F
     | ILLEGAL (s) => T
     | C_ILLEGAL (s) => T
   )))`;


(*val _s4084_ : string -> maybe (mword ty16)*)

val _ = Define `
 ((s4084_:string ->((16)words$word)option) s4085_0=
    (let s4086_0 = s4085_0 in
   if ((string_startswith s4086_0 "c.illegal")) then  
  (case ((string_drop s4086_0 ((string_length "c.illegal")))) of
        s4087_0 =>
  (case ((spc_matches_prefix0 s4087_0)) of
        SOME ((() , s4088_0)) =>
  (case ((string_drop s4087_0 s4088_0)) of
        s4089_0 =>
  (case ((hex_bits_16_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4089_0 : (( 16 words$word # ii)) option)) of
        SOME ((s, s4090_0)) =>
  let p0_ = (string_drop s4089_0 s4090_0) in
  if (((p0_ = ""))) then SOME s else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4076_ : string -> maybe (mword ty32)*)

val _ = Define `
 ((s4076_:string ->((32)words$word)option) s4077_0=
    (let s4078_0 = s4077_0 in
   if ((string_startswith s4078_0 "illegal")) then  
  (case ((string_drop s4078_0 ((string_length "illegal")))) of
        s4079_0 =>
  (case ((spc_matches_prefix0 s4079_0)) of
        SOME ((() , s4080_0)) =>
  (case ((string_drop s4079_0 s4080_0)) of
        s4081_0 =>
  (case ((hex_bits_32_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4081_0 : (( 32 words$word # ii)) option)) of
        SOME ((s, s4082_0)) =>
  let p0_ = (string_drop s4081_0 s4082_0) in
  if (((p0_ = ""))) then SOME s else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4060_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s4060_:string ->((3)words$word#(3)words$word#(5)words$word)option) s4061_0=
    (let s4062_0 = s4061_0 in
   if ((string_startswith s4062_0 "c.fsw")) then  
  (case ((string_drop s4062_0 ((string_length "c.fsw")))) of
        s4063_0 =>
  (case ((spc_matches_prefix0 s4063_0)) of
        SOME ((() , s4064_0)) =>
  (case ((string_drop s4063_0 s4064_0)) of
        s4065_0 =>
  (case ((creg_name_matches_prefix s4065_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s4066_0)) =>
  (case ((string_drop s4065_0 s4066_0)) of
        s4067_0 =>
  (case ((sep_matches_prefix s4067_0)) of
        SOME ((() , s4068_0)) =>
  (case ((string_drop s4067_0 s4068_0)) of
        s4069_0 =>
  (case ((creg_name_matches_prefix s4069_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s4070_0)) =>
  (case ((string_drop s4069_0 s4070_0)) of
        s4071_0 =>
  (case ((sep_matches_prefix s4071_0)) of
        SOME ((() , s4072_0)) =>
  (case ((string_drop s4071_0 s4072_0)) of
        s4073_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4073_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1196, s4074_0)) =>
  if (((((subrange_vec_dec v__1196 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1196 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1196 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s4073_0 s4074_0) in
    if (((p0_ = ""))) then SOME (rsc1, rsc2, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4044_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s4044_:string ->((3)words$word#(3)words$word#(5)words$word)option) s4045_0=
    (let s4046_0 = s4045_0 in
   if ((string_startswith s4046_0 "c.flw")) then  
  (case ((string_drop s4046_0 ((string_length "c.flw")))) of
        s4047_0 =>
  (case ((spc_matches_prefix0 s4047_0)) of
        SOME ((() , s4048_0)) =>
  (case ((string_drop s4047_0 s4048_0)) of
        s4049_0 =>
  (case ((creg_name_matches_prefix s4049_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s4050_0)) =>
  (case ((string_drop s4049_0 s4050_0)) of
        s4051_0 =>
  (case ((sep_matches_prefix s4051_0)) of
        SOME ((() , s4052_0)) =>
  (case ((string_drop s4051_0 s4052_0)) of
        s4053_0 =>
  (case ((creg_name_matches_prefix s4053_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s4054_0)) =>
  (case ((string_drop s4053_0 s4054_0)) of
        s4055_0 =>
  (case ((sep_matches_prefix s4055_0)) of
        SOME ((() , s4056_0)) =>
  (case ((string_drop s4055_0 s4056_0)) of
        s4057_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4057_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1198, s4058_0)) =>
  if (((((subrange_vec_dec v__1198 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1198 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1198 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s4057_0 s4058_0) in
    if (((p0_ = ""))) then SOME (rdc, rsc, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4032_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s4032_:string ->((5)words$word#(6)words$word)option) s4033_0=
    (let s4034_0 = s4033_0 in
   if ((string_startswith s4034_0 "c.fswsp")) then  
  (case ((string_drop s4034_0 ((string_length "c.fswsp")))) of
        s4035_0 =>
  (case ((spc_matches_prefix0 s4035_0)) of
        SOME ((() , s4036_0)) =>
  (case ((string_drop s4035_0 s4036_0)) of
        s4037_0 =>
  (case ((reg_name_matches_prefix s4037_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4038_0)) =>
  (case ((string_drop s4037_0 s4038_0)) of
        s4039_0 =>
  (case ((sep_matches_prefix s4039_0)) of
        SOME ((() , s4040_0)) =>
  (case ((string_drop s4039_0 s4040_0)) of
        s4041_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4041_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s4042_0)) =>
  let p0_ = (string_drop s4041_0 s4042_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4020_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s4020_:string ->((5)words$word#(6)words$word)option) s4021_0=
    (let s4022_0 = s4021_0 in
   if ((string_startswith s4022_0 "c.flwsp")) then  
  (case ((string_drop s4022_0 ((string_length "c.flwsp")))) of
        s4023_0 =>
  (case ((spc_matches_prefix0 s4023_0)) of
        SOME ((() , s4024_0)) =>
  (case ((string_drop s4023_0 s4024_0)) of
        s4025_0 =>
  (case ((reg_name_matches_prefix s4025_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4026_0)) =>
  (case ((string_drop s4025_0 s4026_0)) of
        s4027_0 =>
  (case ((sep_matches_prefix s4027_0)) of
        SOME ((() , s4028_0)) =>
  (case ((string_drop s4027_0 s4028_0)) of
        s4029_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4029_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4030_0)) =>
  let p0_ = (string_drop s4029_0 s4030_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4007_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5))*)

val _ = Define `
 ((s4007_:string ->(f_un_op_S#(5)words$word#(5)words$word)option) s4008_0= 
  ((case s4008_0 of
         s4009_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s4009_0)) of
         SOME ((FCLASS_S, s4010_0)) =>
   (case ((string_drop s4009_0 s4010_0)) of
         s4011_0 =>
   (case ((spc_matches_prefix0 s4011_0)) of
         SOME ((() , s4012_0)) =>
   (case ((string_drop s4011_0 s4012_0)) of
         s4013_0 =>
   (case ((reg_name_matches_prefix s4013_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4014_0)) =>
   (case ((string_drop s4013_0 s4014_0)) of
         s4015_0 =>
   (case ((sep_matches_prefix s4015_0)) of
         SOME ((() , s4016_0)) =>
   (case ((string_drop s4015_0 s4016_0)) of
         s4017_0 =>
   (case ((freg_name_matches_prefix s4017_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4018_0)) =>
   let p0_ = (string_drop s4017_0 s4018_0) in
   if (((p0_ = ""))) then SOME (FCLASS_S, rd, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3994_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3994_:string ->(f_un_op_S#(5)words$word#(5)words$word)option) s3995_0= 
  ((case s3995_0 of
         s3996_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s3996_0)) of
         SOME ((FMV_W_X, s3997_0)) =>
   (case ((string_drop s3996_0 s3997_0)) of
         s3998_0 =>
   (case ((spc_matches_prefix0 s3998_0)) of
         SOME ((() , s3999_0)) =>
   (case ((string_drop s3998_0 s3999_0)) of
         s4000_0 =>
   (case ((freg_name_matches_prefix s4000_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4001_0)) =>
   (case ((string_drop s4000_0 s4001_0)) of
         s4002_0 =>
   (case ((sep_matches_prefix s4002_0)) of
         SOME ((() , s4003_0)) =>
   (case ((string_drop s4002_0 s4003_0)) of
         s4004_0 =>
   (case ((reg_name_matches_prefix s4004_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4005_0)) =>
   let p0_ = (string_drop s4004_0 s4005_0) in
   if (((p0_ = ""))) then SOME (FMV_W_X, rd, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3981_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3981_:string ->(f_un_op_S#(5)words$word#(5)words$word)option) s3982_0= 
  ((case s3982_0 of
         s3983_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s3983_0)) of
         SOME ((FMV_X_W, s3984_0)) =>
   (case ((string_drop s3983_0 s3984_0)) of
         s3985_0 =>
   (case ((spc_matches_prefix0 s3985_0)) of
         SOME ((() , s3986_0)) =>
   (case ((string_drop s3985_0 s3986_0)) of
         s3987_0 =>
   (case ((reg_name_matches_prefix s3987_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3988_0)) =>
   (case ((string_drop s3987_0 s3988_0)) of
         s3989_0 =>
   (case ((sep_matches_prefix s3989_0)) of
         SOME ((() , s3990_0)) =>
   (case ((string_drop s3989_0 s3990_0)) of
         s3991_0 =>
   (case ((freg_name_matches_prefix s3991_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3992_0)) =>
   let p0_ = (string_drop s3991_0 s3992_0) in
   if (((p0_ = ""))) then SOME (FMV_X_W, rd, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3964_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3964_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3965_0= 
  ((case s3965_0 of
         s3966_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3966_0)) of
         SOME ((FLE_S, s3967_0)) =>
   (case ((string_drop s3966_0 s3967_0)) of
         s3968_0 =>
   (case ((spc_matches_prefix0 s3968_0)) of
         SOME ((() , s3969_0)) =>
   (case ((string_drop s3968_0 s3969_0)) of
         s3970_0 =>
   (case ((reg_name_matches_prefix s3970_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3971_0)) =>
   (case ((string_drop s3970_0 s3971_0)) of
         s3972_0 =>
   (case ((sep_matches_prefix s3972_0)) of
         SOME ((() , s3973_0)) =>
   (case ((string_drop s3972_0 s3973_0)) of
         s3974_0 =>
   (case ((freg_name_matches_prefix s3974_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3975_0)) =>
   (case ((string_drop s3974_0 s3975_0)) of
         s3976_0 =>
   (case ((sep_matches_prefix s3976_0)) of
         SOME ((() , s3977_0)) =>
   (case ((string_drop s3976_0 s3977_0)) of
         s3978_0 =>
   (case ((freg_name_matches_prefix s3978_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3979_0)) =>
   let p0_ = (string_drop s3978_0 s3979_0) in
   if (((p0_ = ""))) then SOME (FLE_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3947_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3947_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3948_0= 
  ((case s3948_0 of
         s3949_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3949_0)) of
         SOME ((FLT_S, s3950_0)) =>
   (case ((string_drop s3949_0 s3950_0)) of
         s3951_0 =>
   (case ((spc_matches_prefix0 s3951_0)) of
         SOME ((() , s3952_0)) =>
   (case ((string_drop s3951_0 s3952_0)) of
         s3953_0 =>
   (case ((reg_name_matches_prefix s3953_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3954_0)) =>
   (case ((string_drop s3953_0 s3954_0)) of
         s3955_0 =>
   (case ((sep_matches_prefix s3955_0)) of
         SOME ((() , s3956_0)) =>
   (case ((string_drop s3955_0 s3956_0)) of
         s3957_0 =>
   (case ((freg_name_matches_prefix s3957_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3958_0)) =>
   (case ((string_drop s3957_0 s3958_0)) of
         s3959_0 =>
   (case ((sep_matches_prefix s3959_0)) of
         SOME ((() , s3960_0)) =>
   (case ((string_drop s3959_0 s3960_0)) of
         s3961_0 =>
   (case ((freg_name_matches_prefix s3961_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3962_0)) =>
   let p0_ = (string_drop s3961_0 s3962_0) in
   if (((p0_ = ""))) then SOME (FLT_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3930_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3930_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3931_0= 
  ((case s3931_0 of
         s3932_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3932_0)) of
         SOME ((FEQ_S, s3933_0)) =>
   (case ((string_drop s3932_0 s3933_0)) of
         s3934_0 =>
   (case ((spc_matches_prefix0 s3934_0)) of
         SOME ((() , s3935_0)) =>
   (case ((string_drop s3934_0 s3935_0)) of
         s3936_0 =>
   (case ((reg_name_matches_prefix s3936_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3937_0)) =>
   (case ((string_drop s3936_0 s3937_0)) of
         s3938_0 =>
   (case ((sep_matches_prefix s3938_0)) of
         SOME ((() , s3939_0)) =>
   (case ((string_drop s3938_0 s3939_0)) of
         s3940_0 =>
   (case ((freg_name_matches_prefix s3940_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3941_0)) =>
   (case ((string_drop s3940_0 s3941_0)) of
         s3942_0 =>
   (case ((sep_matches_prefix s3942_0)) of
         SOME ((() , s3943_0)) =>
   (case ((string_drop s3942_0 s3943_0)) of
         s3944_0 =>
   (case ((freg_name_matches_prefix s3944_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3945_0)) =>
   let p0_ = (string_drop s3944_0 s3945_0) in
   if (((p0_ = ""))) then SOME (FEQ_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3913_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3913_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3914_0= 
  ((case s3914_0 of
         s3915_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3915_0)) of
         SOME ((FMAX_S, s3916_0)) =>
   (case ((string_drop s3915_0 s3916_0)) of
         s3917_0 =>
   (case ((spc_matches_prefix0 s3917_0)) of
         SOME ((() , s3918_0)) =>
   (case ((string_drop s3917_0 s3918_0)) of
         s3919_0 =>
   (case ((freg_name_matches_prefix s3919_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3920_0)) =>
   (case ((string_drop s3919_0 s3920_0)) of
         s3921_0 =>
   (case ((sep_matches_prefix s3921_0)) of
         SOME ((() , s3922_0)) =>
   (case ((string_drop s3921_0 s3922_0)) of
         s3923_0 =>
   (case ((freg_name_matches_prefix s3923_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3924_0)) =>
   (case ((string_drop s3923_0 s3924_0)) of
         s3925_0 =>
   (case ((sep_matches_prefix s3925_0)) of
         SOME ((() , s3926_0)) =>
   (case ((string_drop s3925_0 s3926_0)) of
         s3927_0 =>
   (case ((freg_name_matches_prefix s3927_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3928_0)) =>
   let p0_ = (string_drop s3927_0 s3928_0) in
   if (((p0_ = ""))) then SOME (FMAX_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3896_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3896_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3897_0= 
  ((case s3897_0 of
         s3898_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3898_0)) of
         SOME ((FMIN_S, s3899_0)) =>
   (case ((string_drop s3898_0 s3899_0)) of
         s3900_0 =>
   (case ((spc_matches_prefix0 s3900_0)) of
         SOME ((() , s3901_0)) =>
   (case ((string_drop s3900_0 s3901_0)) of
         s3902_0 =>
   (case ((freg_name_matches_prefix s3902_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3903_0)) =>
   (case ((string_drop s3902_0 s3903_0)) of
         s3904_0 =>
   (case ((sep_matches_prefix s3904_0)) of
         SOME ((() , s3905_0)) =>
   (case ((string_drop s3904_0 s3905_0)) of
         s3906_0 =>
   (case ((freg_name_matches_prefix s3906_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3907_0)) =>
   (case ((string_drop s3906_0 s3907_0)) of
         s3908_0 =>
   (case ((sep_matches_prefix s3908_0)) of
         SOME ((() , s3909_0)) =>
   (case ((string_drop s3908_0 s3909_0)) of
         s3910_0 =>
   (case ((freg_name_matches_prefix s3910_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3911_0)) =>
   let p0_ = (string_drop s3910_0 s3911_0) in
   if (((p0_ = ""))) then SOME (FMIN_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3879_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3879_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3880_0= 
  ((case s3880_0 of
         s3881_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3881_0)) of
         SOME ((FSGNJX_S, s3882_0)) =>
   (case ((string_drop s3881_0 s3882_0)) of
         s3883_0 =>
   (case ((spc_matches_prefix0 s3883_0)) of
         SOME ((() , s3884_0)) =>
   (case ((string_drop s3883_0 s3884_0)) of
         s3885_0 =>
   (case ((freg_name_matches_prefix s3885_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3886_0)) =>
   (case ((string_drop s3885_0 s3886_0)) of
         s3887_0 =>
   (case ((sep_matches_prefix s3887_0)) of
         SOME ((() , s3888_0)) =>
   (case ((string_drop s3887_0 s3888_0)) of
         s3889_0 =>
   (case ((freg_name_matches_prefix s3889_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3890_0)) =>
   (case ((string_drop s3889_0 s3890_0)) of
         s3891_0 =>
   (case ((sep_matches_prefix s3891_0)) of
         SOME ((() , s3892_0)) =>
   (case ((string_drop s3891_0 s3892_0)) of
         s3893_0 =>
   (case ((freg_name_matches_prefix s3893_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3894_0)) =>
   let p0_ = (string_drop s3893_0 s3894_0) in
   if (((p0_ = ""))) then SOME (FSGNJX_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3862_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3862_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3863_0= 
  ((case s3863_0 of
         s3864_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3864_0)) of
         SOME ((FSGNJN_S, s3865_0)) =>
   (case ((string_drop s3864_0 s3865_0)) of
         s3866_0 =>
   (case ((spc_matches_prefix0 s3866_0)) of
         SOME ((() , s3867_0)) =>
   (case ((string_drop s3866_0 s3867_0)) of
         s3868_0 =>
   (case ((freg_name_matches_prefix s3868_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3869_0)) =>
   (case ((string_drop s3868_0 s3869_0)) of
         s3870_0 =>
   (case ((sep_matches_prefix s3870_0)) of
         SOME ((() , s3871_0)) =>
   (case ((string_drop s3870_0 s3871_0)) of
         s3872_0 =>
   (case ((freg_name_matches_prefix s3872_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3873_0)) =>
   (case ((string_drop s3872_0 s3873_0)) of
         s3874_0 =>
   (case ((sep_matches_prefix s3874_0)) of
         SOME ((() , s3875_0)) =>
   (case ((string_drop s3874_0 s3875_0)) of
         s3876_0 =>
   (case ((freg_name_matches_prefix s3876_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3877_0)) =>
   let p0_ = (string_drop s3876_0 s3877_0) in
   if (((p0_ = ""))) then SOME (FSGNJN_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3845_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3845_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word)option) s3846_0= 
  ((case s3846_0 of
         s3847_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s3847_0)) of
         SOME ((FSGNJ_S, s3848_0)) =>
   (case ((string_drop s3847_0 s3848_0)) of
         s3849_0 =>
   (case ((spc_matches_prefix0 s3849_0)) of
         SOME ((() , s3850_0)) =>
   (case ((string_drop s3849_0 s3850_0)) of
         s3851_0 =>
   (case ((freg_name_matches_prefix s3851_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3852_0)) =>
   (case ((string_drop s3851_0 s3852_0)) of
         s3853_0 =>
   (case ((sep_matches_prefix s3853_0)) of
         SOME ((() , s3854_0)) =>
   (case ((string_drop s3853_0 s3854_0)) of
         s3855_0 =>
   (case ((freg_name_matches_prefix s3855_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3856_0)) =>
   (case ((string_drop s3855_0 s3856_0)) of
         s3857_0 =>
   (case ((sep_matches_prefix s3857_0)) of
         SOME ((() , s3858_0)) =>
   (case ((string_drop s3857_0 s3858_0)) of
         s3859_0 =>
   (case ((freg_name_matches_prefix s3859_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3860_0)) =>
   let p0_ = (string_drop s3859_0 s3860_0) in
   if (((p0_ = ""))) then SOME (FSGNJ_S, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3828_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3828_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3829_0= 
  ((case s3829_0 of
         s3830_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3830_0)) of
         SOME ((FCVT_S_LU, s3831_0)) =>
   (case ((string_drop s3830_0 s3831_0)) of
         s3832_0 =>
   (case ((spc_matches_prefix0 s3832_0)) of
         SOME ((() , s3833_0)) =>
   (case ((string_drop s3832_0 s3833_0)) of
         s3834_0 =>
   (case ((freg_name_matches_prefix s3834_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3835_0)) =>
   (case ((string_drop s3834_0 s3835_0)) of
         s3836_0 =>
   (case ((sep_matches_prefix s3836_0)) of
         SOME ((() , s3837_0)) =>
   (case ((string_drop s3836_0 s3837_0)) of
         s3838_0 =>
   (case ((reg_name_matches_prefix s3838_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3839_0)) =>
   (case ((string_drop s3838_0 s3839_0)) of
         s3840_0 =>
   (case ((sep_matches_prefix s3840_0)) of
         SOME ((() , s3841_0)) =>
   (case ((string_drop s3840_0 s3841_0)) of
         s3842_0 =>
   (case ((frm_mnemonic_matches_prefix s3842_0)) of
         SOME ((rm, s3843_0)) =>
   let p0_ = (string_drop s3842_0 s3843_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_LU, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3811_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3811_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3812_0= 
  ((case s3812_0 of
         s3813_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3813_0)) of
         SOME ((FCVT_S_L, s3814_0)) =>
   (case ((string_drop s3813_0 s3814_0)) of
         s3815_0 =>
   (case ((spc_matches_prefix0 s3815_0)) of
         SOME ((() , s3816_0)) =>
   (case ((string_drop s3815_0 s3816_0)) of
         s3817_0 =>
   (case ((freg_name_matches_prefix s3817_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3818_0)) =>
   (case ((string_drop s3817_0 s3818_0)) of
         s3819_0 =>
   (case ((sep_matches_prefix s3819_0)) of
         SOME ((() , s3820_0)) =>
   (case ((string_drop s3819_0 s3820_0)) of
         s3821_0 =>
   (case ((reg_name_matches_prefix s3821_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3822_0)) =>
   (case ((string_drop s3821_0 s3822_0)) of
         s3823_0 =>
   (case ((sep_matches_prefix s3823_0)) of
         SOME ((() , s3824_0)) =>
   (case ((string_drop s3823_0 s3824_0)) of
         s3825_0 =>
   (case ((frm_mnemonic_matches_prefix s3825_0)) of
         SOME ((rm, s3826_0)) =>
   let p0_ = (string_drop s3825_0 s3826_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_L, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3794_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3794_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3795_0= 
  ((case s3795_0 of
         s3796_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3796_0)) of
         SOME ((FCVT_LU_S, s3797_0)) =>
   (case ((string_drop s3796_0 s3797_0)) of
         s3798_0 =>
   (case ((spc_matches_prefix0 s3798_0)) of
         SOME ((() , s3799_0)) =>
   (case ((string_drop s3798_0 s3799_0)) of
         s3800_0 =>
   (case ((reg_name_matches_prefix s3800_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3801_0)) =>
   (case ((string_drop s3800_0 s3801_0)) of
         s3802_0 =>
   (case ((sep_matches_prefix s3802_0)) of
         SOME ((() , s3803_0)) =>
   (case ((string_drop s3802_0 s3803_0)) of
         s3804_0 =>
   (case ((freg_name_matches_prefix s3804_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3805_0)) =>
   (case ((string_drop s3804_0 s3805_0)) of
         s3806_0 =>
   (case ((sep_matches_prefix s3806_0)) of
         SOME ((() , s3807_0)) =>
   (case ((string_drop s3806_0 s3807_0)) of
         s3808_0 =>
   (case ((frm_mnemonic_matches_prefix s3808_0)) of
         SOME ((rm, s3809_0)) =>
   let p0_ = (string_drop s3808_0 s3809_0) in
   if (((p0_ = ""))) then SOME (FCVT_LU_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3777_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3777_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3778_0= 
  ((case s3778_0 of
         s3779_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3779_0)) of
         SOME ((FCVT_L_S, s3780_0)) =>
   (case ((string_drop s3779_0 s3780_0)) of
         s3781_0 =>
   (case ((spc_matches_prefix0 s3781_0)) of
         SOME ((() , s3782_0)) =>
   (case ((string_drop s3781_0 s3782_0)) of
         s3783_0 =>
   (case ((reg_name_matches_prefix s3783_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3784_0)) =>
   (case ((string_drop s3783_0 s3784_0)) of
         s3785_0 =>
   (case ((sep_matches_prefix s3785_0)) of
         SOME ((() , s3786_0)) =>
   (case ((string_drop s3785_0 s3786_0)) of
         s3787_0 =>
   (case ((freg_name_matches_prefix s3787_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3788_0)) =>
   (case ((string_drop s3787_0 s3788_0)) of
         s3789_0 =>
   (case ((sep_matches_prefix s3789_0)) of
         SOME ((() , s3790_0)) =>
   (case ((string_drop s3789_0 s3790_0)) of
         s3791_0 =>
   (case ((frm_mnemonic_matches_prefix s3791_0)) of
         SOME ((rm, s3792_0)) =>
   let p0_ = (string_drop s3791_0 s3792_0) in
   if (((p0_ = ""))) then SOME (FCVT_L_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3760_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3760_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3761_0= 
  ((case s3761_0 of
         s3762_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3762_0)) of
         SOME ((FCVT_S_WU, s3763_0)) =>
   (case ((string_drop s3762_0 s3763_0)) of
         s3764_0 =>
   (case ((spc_matches_prefix0 s3764_0)) of
         SOME ((() , s3765_0)) =>
   (case ((string_drop s3764_0 s3765_0)) of
         s3766_0 =>
   (case ((freg_name_matches_prefix s3766_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3767_0)) =>
   (case ((string_drop s3766_0 s3767_0)) of
         s3768_0 =>
   (case ((sep_matches_prefix s3768_0)) of
         SOME ((() , s3769_0)) =>
   (case ((string_drop s3768_0 s3769_0)) of
         s3770_0 =>
   (case ((reg_name_matches_prefix s3770_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3771_0)) =>
   (case ((string_drop s3770_0 s3771_0)) of
         s3772_0 =>
   (case ((sep_matches_prefix s3772_0)) of
         SOME ((() , s3773_0)) =>
   (case ((string_drop s3772_0 s3773_0)) of
         s3774_0 =>
   (case ((frm_mnemonic_matches_prefix s3774_0)) of
         SOME ((rm, s3775_0)) =>
   let p0_ = (string_drop s3774_0 s3775_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_WU, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3743_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3743_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3744_0= 
  ((case s3744_0 of
         s3745_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3745_0)) of
         SOME ((FCVT_S_W, s3746_0)) =>
   (case ((string_drop s3745_0 s3746_0)) of
         s3747_0 =>
   (case ((spc_matches_prefix0 s3747_0)) of
         SOME ((() , s3748_0)) =>
   (case ((string_drop s3747_0 s3748_0)) of
         s3749_0 =>
   (case ((freg_name_matches_prefix s3749_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3750_0)) =>
   (case ((string_drop s3749_0 s3750_0)) of
         s3751_0 =>
   (case ((sep_matches_prefix s3751_0)) of
         SOME ((() , s3752_0)) =>
   (case ((string_drop s3751_0 s3752_0)) of
         s3753_0 =>
   (case ((reg_name_matches_prefix s3753_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3754_0)) =>
   (case ((string_drop s3753_0 s3754_0)) of
         s3755_0 =>
   (case ((sep_matches_prefix s3755_0)) of
         SOME ((() , s3756_0)) =>
   (case ((string_drop s3755_0 s3756_0)) of
         s3757_0 =>
   (case ((frm_mnemonic_matches_prefix s3757_0)) of
         SOME ((rm, s3758_0)) =>
   let p0_ = (string_drop s3757_0 s3758_0) in
   if (((p0_ = ""))) then SOME (FCVT_S_W, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3726_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3726_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3727_0= 
  ((case s3727_0 of
         s3728_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3728_0)) of
         SOME ((FCVT_WU_S, s3729_0)) =>
   (case ((string_drop s3728_0 s3729_0)) of
         s3730_0 =>
   (case ((spc_matches_prefix0 s3730_0)) of
         SOME ((() , s3731_0)) =>
   (case ((string_drop s3730_0 s3731_0)) of
         s3732_0 =>
   (case ((reg_name_matches_prefix s3732_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3733_0)) =>
   (case ((string_drop s3732_0 s3733_0)) of
         s3734_0 =>
   (case ((sep_matches_prefix s3734_0)) of
         SOME ((() , s3735_0)) =>
   (case ((string_drop s3734_0 s3735_0)) of
         s3736_0 =>
   (case ((freg_name_matches_prefix s3736_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3737_0)) =>
   (case ((string_drop s3736_0 s3737_0)) of
         s3738_0 =>
   (case ((sep_matches_prefix s3738_0)) of
         SOME ((() , s3739_0)) =>
   (case ((string_drop s3738_0 s3739_0)) of
         s3740_0 =>
   (case ((frm_mnemonic_matches_prefix s3740_0)) of
         SOME ((rm, s3741_0)) =>
   let p0_ = (string_drop s3740_0 s3741_0) in
   if (((p0_ = ""))) then SOME (FCVT_WU_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3709_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3709_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3710_0= 
  ((case s3710_0 of
         s3711_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3711_0)) of
         SOME ((FCVT_W_S, s3712_0)) =>
   (case ((string_drop s3711_0 s3712_0)) of
         s3713_0 =>
   (case ((spc_matches_prefix0 s3713_0)) of
         SOME ((() , s3714_0)) =>
   (case ((string_drop s3713_0 s3714_0)) of
         s3715_0 =>
   (case ((reg_name_matches_prefix s3715_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3716_0)) =>
   (case ((string_drop s3715_0 s3716_0)) of
         s3717_0 =>
   (case ((sep_matches_prefix s3717_0)) of
         SOME ((() , s3718_0)) =>
   (case ((string_drop s3717_0 s3718_0)) of
         s3719_0 =>
   (case ((freg_name_matches_prefix s3719_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3720_0)) =>
   (case ((string_drop s3719_0 s3720_0)) of
         s3721_0 =>
   (case ((sep_matches_prefix s3721_0)) of
         SOME ((() , s3722_0)) =>
   (case ((string_drop s3721_0 s3722_0)) of
         s3723_0 =>
   (case ((frm_mnemonic_matches_prefix s3723_0)) of
         SOME ((rm, s3724_0)) =>
   let p0_ = (string_drop s3723_0 s3724_0) in
   if (((p0_ = ""))) then SOME (FCVT_W_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3692_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3692_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode)option) s3693_0= 
  ((case s3693_0 of
         s3694_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s3694_0)) of
         SOME ((FSQRT_S, s3695_0)) =>
   (case ((string_drop s3694_0 s3695_0)) of
         s3696_0 =>
   (case ((spc_matches_prefix0 s3696_0)) of
         SOME ((() , s3697_0)) =>
   (case ((string_drop s3696_0 s3697_0)) of
         s3698_0 =>
   (case ((freg_name_matches_prefix s3698_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3699_0)) =>
   (case ((string_drop s3698_0 s3699_0)) of
         s3700_0 =>
   (case ((sep_matches_prefix s3700_0)) of
         SOME ((() , s3701_0)) =>
   (case ((string_drop s3700_0 s3701_0)) of
         s3702_0 =>
   (case ((freg_name_matches_prefix s3702_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3703_0)) =>
   (case ((string_drop s3702_0 s3703_0)) of
         s3704_0 =>
   (case ((sep_matches_prefix s3704_0)) of
         SOME ((() , s3705_0)) =>
   (case ((string_drop s3704_0 s3705_0)) of
         s3706_0 =>
   (case ((frm_mnemonic_matches_prefix s3706_0)) of
         SOME ((rm, s3707_0)) =>
   let p0_ = (string_drop s3706_0 s3707_0) in
   if (((p0_ = ""))) then SOME (FSQRT_S, rd, rs1, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3671_ : string -> maybe ((f_bin_rm_op_S * mword ty5 * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3671_:string ->(f_bin_rm_op_S#(5)words$word#(5)words$word#(5)words$word#rounding_mode)option) s3672_0= 
  ((case s3672_0 of
         s3673_0 =>
   (case ((f_bin_rm_type_mnemonic_S_matches_prefix s3673_0)) of
         SOME ((op, s3674_0)) =>
   (case ((string_drop s3673_0 s3674_0)) of
         s3675_0 =>
   (case ((spc_matches_prefix0 s3675_0)) of
         SOME ((() , s3676_0)) =>
   (case ((string_drop s3675_0 s3676_0)) of
         s3677_0 =>
   (case ((freg_name_matches_prefix s3677_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3678_0)) =>
   (case ((string_drop s3677_0 s3678_0)) of
         s3679_0 =>
   (case ((sep_matches_prefix s3679_0)) of
         SOME ((() , s3680_0)) =>
   (case ((string_drop s3679_0 s3680_0)) of
         s3681_0 =>
   (case ((freg_name_matches_prefix s3681_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3682_0)) =>
   (case ((string_drop s3681_0 s3682_0)) of
         s3683_0 =>
   (case ((sep_matches_prefix s3683_0)) of
         SOME ((() , s3684_0)) =>
   (case ((string_drop s3683_0 s3684_0)) of
         s3685_0 =>
   (case ((freg_name_matches_prefix s3685_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3686_0)) =>
   (case ((string_drop s3685_0 s3686_0)) of
         s3687_0 =>
   (case ((sep_matches_prefix s3687_0)) of
         SOME ((() , s3688_0)) =>
   (case ((string_drop s3687_0 s3688_0)) of
         s3689_0 =>
   (case ((frm_mnemonic_matches_prefix s3689_0)) of
         SOME ((rm, s3690_0)) =>
   let p0_ = (string_drop s3689_0 s3690_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3646_ : string -> maybe ((f_madd_op_S * mword ty5 * mword ty5 * mword ty5 * mword ty5 * rounding_mode))*)

val _ = Define `
 ((s3646_:string ->(f_madd_op_S#(5)words$word#(5)words$word#(5)words$word#(5)words$word#rounding_mode)option) s3647_0= 
  ((case s3647_0 of
         s3648_0 =>
   (case ((f_madd_type_mnemonic_S_matches_prefix s3648_0)) of
         SOME ((op, s3649_0)) =>
   (case ((string_drop s3648_0 s3649_0)) of
         s3650_0 =>
   (case ((spc_matches_prefix0 s3650_0)) of
         SOME ((() , s3651_0)) =>
   (case ((string_drop s3650_0 s3651_0)) of
         s3652_0 =>
   (case ((freg_name_matches_prefix s3652_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3653_0)) =>
   (case ((string_drop s3652_0 s3653_0)) of
         s3654_0 =>
   (case ((sep_matches_prefix s3654_0)) of
         SOME ((() , s3655_0)) =>
   (case ((string_drop s3654_0 s3655_0)) of
         s3656_0 =>
   (case ((freg_name_matches_prefix s3656_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3657_0)) =>
   (case ((string_drop s3656_0 s3657_0)) of
         s3658_0 =>
   (case ((sep_matches_prefix s3658_0)) of
         SOME ((() , s3659_0)) =>
   (case ((string_drop s3658_0 s3659_0)) of
         s3660_0 =>
   (case ((freg_name_matches_prefix s3660_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3661_0)) =>
   (case ((string_drop s3660_0 s3661_0)) of
         s3662_0 =>
   (case ((sep_matches_prefix s3662_0)) of
         SOME ((() , s3663_0)) =>
   (case ((string_drop s3662_0 s3663_0)) of
         s3664_0 =>
   (case ((freg_name_matches_prefix s3664_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs3, s3665_0)) =>
   (case ((string_drop s3664_0 s3665_0)) of
         s3666_0 =>
   (case ((sep_matches_prefix s3666_0)) of
         SOME ((() , s3667_0)) =>
   (case ((string_drop s3666_0 s3667_0)) of
         s3668_0 =>
   (case ((frm_mnemonic_matches_prefix s3668_0)) of
         SOME ((rm, s3669_0)) =>
   let p0_ = (string_drop s3668_0 s3669_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2, rs3, rm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3622_ : string -> maybe ((word_width * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s3622_:string ->(word_width#(5)words$word#(12)words$word#(5)words$word)option) s3623_0=
    (let s3624_0 = s3623_0 in
   if ((string_startswith s3624_0 "fs")) then  
  (case ((string_drop s3624_0 ((string_length "fs")))) of
        s3625_0 =>
  (case ((size_mnemonic_matches_prefix s3625_0)) of
        SOME ((width, s3626_0)) =>
  (case ((string_drop s3625_0 s3626_0)) of
        s3627_0 =>
  (case ((spc_matches_prefix0 s3627_0)) of
        SOME ((() , s3628_0)) =>
  (case ((string_drop s3627_0 s3628_0)) of
        s3629_0 =>
  (case ((freg_name_matches_prefix s3629_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3630_0)) =>
  (case ((string_drop s3629_0 s3630_0)) of
        s3631_0 =>
  (case ((sep_matches_prefix s3631_0)) of
        SOME ((() , s3632_0)) =>
  (case ((string_drop s3631_0 s3632_0)) of
        s3633_0 =>
  (case ((hex_bits_12_matches_prefix0 s3633_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s3634_0)) =>
  (case ((string_drop s3633_0 s3634_0)) of
        s3635_0 =>
  (case ((opt_spc_matches_prefix0 s3635_0)) of
        SOME ((() , s3636_0)) =>
  let s3637_0 = (string_drop s3635_0 s3636_0) in
  if ((string_startswith s3637_0 "(")) then
    (case ((string_drop s3637_0 ((string_length "(")))) of
          s3638_0 =>
    (case ((opt_spc_matches_prefix0 s3638_0)) of
          SOME ((() , s3639_0)) =>
    (case ((string_drop s3638_0 s3639_0)) of
          s3640_0 =>
    (case ((reg_name_matches_prefix s3640_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s3641_0)) =>
    (case ((string_drop s3640_0 s3641_0)) of
          s3642_0 =>
    (case ((opt_spc_matches_prefix0 s3642_0)) of
          SOME ((() , s3643_0)) =>
    let s3644_0 = (string_drop s3642_0 s3643_0) in
    if ((string_startswith s3644_0 ")")) then
      let p0_ = (string_drop s3644_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (width, rs2, imm, rs1) else NONE else 
    NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3598_ : string -> maybe ((word_width * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s3598_:string ->(word_width#(5)words$word#(12)words$word#(5)words$word)option) s3599_0=
    (let s3600_0 = s3599_0 in
   if ((string_startswith s3600_0 "fl")) then  
  (case ((string_drop s3600_0 ((string_length "fl")))) of
        s3601_0 =>
  (case ((size_mnemonic_matches_prefix s3601_0)) of
        SOME ((width, s3602_0)) =>
  (case ((string_drop s3601_0 s3602_0)) of
        s3603_0 =>
  (case ((spc_matches_prefix0 s3603_0)) of
        SOME ((() , s3604_0)) =>
  (case ((string_drop s3603_0 s3604_0)) of
        s3605_0 =>
  (case ((freg_name_matches_prefix s3605_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3606_0)) =>
  (case ((string_drop s3605_0 s3606_0)) of
        s3607_0 =>
  (case ((sep_matches_prefix s3607_0)) of
        SOME ((() , s3608_0)) =>
  (case ((string_drop s3607_0 s3608_0)) of
        s3609_0 =>
  (case ((hex_bits_12_matches_prefix0 s3609_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s3610_0)) =>
  (case ((string_drop s3609_0 s3610_0)) of
        s3611_0 =>
  (case ((opt_spc_matches_prefix0 s3611_0)) of
        SOME ((() , s3612_0)) =>
  let s3613_0 = (string_drop s3611_0 s3612_0) in
  if ((string_startswith s3613_0 "(")) then
    (case ((string_drop s3613_0 ((string_length "(")))) of
          s3614_0 =>
    (case ((opt_spc_matches_prefix0 s3614_0)) of
          SOME ((() , s3615_0)) =>
    (case ((string_drop s3614_0 s3615_0)) of
          s3616_0 =>
    (case ((reg_name_matches_prefix s3616_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s3617_0)) =>
    (case ((string_drop s3616_0 s3617_0)) of
          s3618_0 =>
    (case ((opt_spc_matches_prefix0 s3618_0)) of
          SOME ((() , s3619_0)) =>
    let s3620_0 = (string_drop s3618_0 s3619_0) in
    if ((string_startswith s3620_0 ")")) then
      let p0_ = (string_drop s3620_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (width, rd, imm, rs1) else NONE else 
    NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3586_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s3586_:string ->((5)words$word#(5)words$word#(12)words$word)option) s3587_0=
    (let s3588_0 = s3587_0 in
   if ((string_startswith s3588_0 "fence.i.reserved.")) then  
  (case ((string_drop s3588_0 ((string_length "fence.i.reserved.")))) of
        s3589_0 =>
  (case ((reg_name_matches_prefix s3589_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3590_0)) =>
  let s3591_0 = (string_drop s3589_0 s3590_0) in
  if ((string_startswith s3591_0 ".")) then
    (case ((string_drop s3591_0 ((string_length ".")))) of
          s3592_0 =>
    (case ((reg_name_matches_prefix s3592_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs, s3593_0)) =>
    let s3594_0 = (string_drop s3592_0 s3593_0) in
    if ((string_startswith s3594_0 ".")) then
      (case ((string_drop s3594_0 ((string_length ".")))) of
            s3595_0 =>
      (case ((hex_bits_12_matches_prefix0 s3595_0 : (( 12 words$word # ii)) option)) of
            SOME ((imm, s3596_0)) =>
      let p0_ = (string_drop s3595_0 s3596_0) in
      if (((p0_ = ""))) then SOME (rd, rs, imm) else NONE
        | _ => NONE
      )
      ) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3568_ : string -> maybe ((mword ty4 * mword ty4 * mword ty5 * mword ty5 * mword ty4))*)

val _ = Define `
 ((s3568_:string ->((4)words$word#(4)words$word#(5)words$word#(5)words$word#(4)words$word)option) s3569_0=
    (let s3570_0 = s3569_0 in
   if ((string_startswith s3570_0 "fence.reserved.")) then  
  (case ((string_drop s3570_0 ((string_length "fence.reserved.")))) of
        s3571_0 =>
  (case ((fence_bits_matches_prefix s3571_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s3572_0)) =>
  let s3573_0 = (string_drop s3571_0 s3572_0) in
  if ((string_startswith s3573_0 ".")) then
    (case ((string_drop s3573_0 ((string_length ".")))) of
          s3574_0 =>
    (case ((fence_bits_matches_prefix s3574_0 : (( 4 words$word # ii)) option)) of
          SOME ((succ, s3575_0)) =>
    let s3576_0 = (string_drop s3574_0 s3575_0) in
    if ((string_startswith s3576_0 ".")) then
      (case ((string_drop s3576_0 ((string_length ".")))) of
            s3577_0 =>
      (case ((reg_name_matches_prefix s3577_0 : (( 5 words$word # ii)) option)) of
            SOME ((rs, s3578_0)) =>
      let s3579_0 = (string_drop s3577_0 s3578_0) in
      if ((string_startswith s3579_0 ".")) then
        (case ((string_drop s3579_0 ((string_length ".")))) of
              s3580_0 =>
        (case ((reg_name_matches_prefix s3580_0 : (( 5 words$word # ii)) option)) of
              SOME ((rd, s3581_0)) =>
        let s3582_0 = (string_drop s3580_0 s3581_0) in
        if ((string_startswith s3582_0 ".")) then
          (case ((string_drop s3582_0 ((string_length ".")))) of
                s3583_0 =>
          (case ((hex_bits_4_matches_prefix
                    instance_Sail2_values_Bitvector_Machine_word_mword_dict
                    s3583_0 : (( 4 words$word # ii)) option)) of
                SOME ((fm, s3584_0)) =>
          let p0_ = (string_drop s3583_0 s3584_0) in
          if (((p0_ = ""))) then SOME (pred, succ, rs, rd, fm) else NONE
            | _ => NONE
          )
          ) else NONE
          | _ => NONE
        )
        ) else NONE
        | _ => NONE
      )
      ) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3562_ : string -> maybe (mword ty3)*)

val _ = Define `
 ((s3562_:string ->((3)words$word)option) s3563_0=
    (let s3564_0 = s3563_0 in
   if ((string_startswith s3564_0 "c.srai.hint.")) then  
  (case ((string_drop s3564_0 ((string_length "c.srai.hint.")))) of
        s3565_0 =>
  (case ((creg_name_matches_prefix s3565_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3566_0)) =>
  let p0_ = (string_drop s3565_0 s3566_0) in
  if (((p0_ = ""))) then SOME rsd else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3556_ : string -> maybe (mword ty3)*)

val _ = Define `
 ((s3556_:string ->((3)words$word)option) s3557_0=
    (let s3558_0 = s3557_0 in
   if ((string_startswith s3558_0 "c.srli.hint.")) then  
  (case ((string_drop s3558_0 ((string_length "c.srli.hint.")))) of
        s3559_0 =>
  (case ((creg_name_matches_prefix s3559_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3560_0)) =>
  let p0_ = (string_drop s3559_0 s3560_0) in
  if (((p0_ = ""))) then SOME rsd else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3547_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3547_:string ->((5)words$word#(6)words$word)option) s3548_0=
    (let s3549_0 = s3548_0 in
   if ((string_startswith s3549_0 "c.slli.hint.")) then  
  (case ((string_drop s3549_0 ((string_length "c.slli.hint.")))) of
        s3550_0 =>
  (case ((reg_name_matches_prefix s3550_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s3551_0)) =>
  let s3552_0 = (string_drop s3550_0 s3551_0) in
  if ((string_startswith s3552_0 ".")) then
    (case ((string_drop s3552_0 ((string_length ".")))) of
          s3553_0 =>
    (case ((hex_bits_6_matches_prefix
              instance_Sail2_values_Bitvector_Machine_word_mword_dict 
            s3553_0 : (( 6 words$word # ii)) option)) of
          SOME ((shamt, s3554_0)) =>
    let p0_ = (string_drop s3553_0 s3554_0) in
    if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3541_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s3541_:string ->((5)words$word)option) s3542_0=
    (let s3543_0 = s3542_0 in
   if ((string_startswith s3543_0 "c.add.hint.")) then  
  (case ((string_drop s3543_0 ((string_length "c.add.hint.")))) of
        s3544_0 =>
  (case ((reg_name_matches_prefix s3544_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3545_0)) =>
  let p0_ = (string_drop s3544_0 s3545_0) in
  if (((p0_ = ""))) then SOME rs2 else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3535_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s3535_:string ->((5)words$word)option) s3536_0=
    (let s3537_0 = s3536_0 in
   if ((string_startswith s3537_0 "c.mv.hint.")) then  
  (case ((string_drop s3537_0 ((string_length "c.mv.hint.")))) of
        s3538_0 =>
  (case ((reg_name_matches_prefix s3538_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3539_0)) =>
  let p0_ = (string_drop s3538_0 s3539_0) in
  if (((p0_ = ""))) then SOME rs2 else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3529_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s3529_:string ->((6)words$word)option) s3530_0=
    (let s3531_0 = s3530_0 in
   if ((string_startswith s3531_0 "c.lui.hint.")) then  
  (case ((string_drop s3531_0 ((string_length "c.lui.hint.")))) of
        s3532_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3532_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3533_0)) =>
  let p0_ = (string_drop s3532_0 s3533_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3523_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s3523_:string ->((6)words$word)option) s3524_0=
    (let s3525_0 = s3524_0 in
   if ((string_startswith s3525_0 "c.li.hint.")) then  
  (case ((string_drop s3525_0 ((string_length "c.li.hint.")))) of
        s3526_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3526_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3527_0)) =>
  let p0_ = (string_drop s3526_0 s3527_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3517_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s3517_:string ->((5)words$word)option) s3518_0=
    (let s3519_0 = s3518_0 in
   if ((string_startswith s3519_0 "c.addi.hint.")) then  
  (case ((string_drop s3519_0 ((string_length "c.addi.hint.")))) of
        s3520_0 =>
  (case ((reg_name_matches_prefix s3520_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s3521_0)) =>
  let p0_ = (string_drop s3520_0 s3521_0) in
  if (((p0_ = ""))) then SOME rsd else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3511_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s3511_:string ->((6)words$word)option) s3512_0=
    (let s3513_0 = s3512_0 in
   if ((string_startswith s3513_0 "c.nop.hint.")) then  
  (case ((string_drop s3513_0 ((string_length "c.nop.hint.")))) of
        s3514_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3514_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3515_0)) =>
  let p0_ = (string_drop s3514_0 s3515_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3494_ : string -> maybe ((csrop * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s3494_:string ->(csrop#(5)words$word#(12)words$word#(5)words$word)option) s3495_0= 
  ((case s3495_0 of
         s3496_0 =>
   (case ((csr_mnemonic_matches_prefix s3496_0)) of
         SOME ((op, s3497_0)) =>
   (case ((string_drop s3496_0 s3497_0)) of
         s3498_0 =>
   (case ((spc_matches_prefix0 s3498_0)) of
         SOME ((() , s3499_0)) =>
   (case ((string_drop s3498_0 s3499_0)) of
         s3500_0 =>
   (case ((reg_name_matches_prefix s3500_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3501_0)) =>
   (case ((string_drop s3500_0 s3501_0)) of
         s3502_0 =>
   (case ((sep_matches_prefix s3502_0)) of
         SOME ((() , s3503_0)) =>
   (case ((string_drop s3502_0 s3503_0)) of
         s3504_0 =>
   (case ((csr_name_map_matches_prefix s3504_0
          : (( 12 words$word # ii)) option)) of
         SOME ((csr, s3505_0)) =>
   (case ((string_drop s3504_0 s3505_0)) of
         s3506_0 =>
   (case ((sep_matches_prefix s3506_0)) of
         SOME ((() , s3507_0)) =>
   (case ((string_drop s3506_0 s3507_0)) of
         s3508_0 =>
   (case ((reg_name_matches_prefix s3508_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3509_0)) =>
   let p0_ = (string_drop s3508_0 s3509_0) in
   if (((p0_ = ""))) then SOME (op, rd, csr, rs1) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3476_ : string -> maybe ((csrop * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s3476_:string ->(csrop#(5)words$word#(12)words$word#(5)words$word)option) s3477_0= 
  ((case s3477_0 of
         s3478_0 =>
   (case ((csr_mnemonic_matches_prefix s3478_0)) of
         SOME ((op, s3479_0)) =>
   let s3480_0 = (string_drop s3478_0 s3479_0) in
   if ((string_startswith s3480_0 "i")) then
     (case ((string_drop s3480_0 ((string_length "i")))) of
           s3481_0 =>
     (case ((spc_matches_prefix0 s3481_0)) of
           SOME ((() , s3482_0)) =>
     (case ((string_drop s3481_0 s3482_0)) of
           s3483_0 =>
     (case ((reg_name_matches_prefix s3483_0 : (( 5 words$word # ii)) option)) of
           SOME ((rd, s3484_0)) =>
     (case ((string_drop s3483_0 s3484_0)) of
           s3485_0 =>
     (case ((sep_matches_prefix s3485_0)) of
           SOME ((() , s3486_0)) =>
     (case ((string_drop s3485_0 s3486_0)) of
           s3487_0 =>
     (case ((csr_name_map_matches_prefix s3487_0
            : (( 12 words$word # ii)) option)) of
           SOME ((csr, s3488_0)) =>
     (case ((string_drop s3487_0 s3488_0)) of
           s3489_0 =>
     (case ((sep_matches_prefix s3489_0)) of
           SOME ((() , s3490_0)) =>
     (case ((string_drop s3489_0 s3490_0)) of
           s3491_0 =>
     (case ((hex_bits_5_matches_prefix
               instance_Sail2_values_Bitvector_Machine_word_mword_dict
               s3491_0 : (( 5 words$word # ii)) option)) of
           SOME ((rs1, s3492_0)) =>
     let p0_ = (string_drop s3491_0 s3492_0) in
     if (((p0_ = ""))) then SOME (op, rd, csr, rs1) else NONE
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


(*val _s3457_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3457_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s3458_0=
    (let s3459_0 = s3458_0 in
   if ((string_startswith s3459_0 "rem")) then  
  (case ((string_drop s3459_0 ((string_length "rem")))) of
        s3460_0 =>
  (case ((maybe_not_u_matches_prefix s3460_0)) of
        SOME ((s, s3461_0)) =>
  let s3462_0 = (string_drop s3460_0 s3461_0) in
  if ((string_startswith s3462_0 "w")) then
    (case ((string_drop s3462_0 ((string_length "w")))) of
          s3463_0 =>
    (case ((spc_matches_prefix0 s3463_0)) of
          SOME ((() , s3464_0)) =>
    (case ((string_drop s3463_0 s3464_0)) of
          s3465_0 =>
    (case ((reg_name_matches_prefix s3465_0 : (( 5 words$word # ii)) option)) of
          SOME ((rd, s3466_0)) =>
    (case ((string_drop s3465_0 s3466_0)) of
          s3467_0 =>
    (case ((sep_matches_prefix s3467_0)) of
          SOME ((() , s3468_0)) =>
    (case ((string_drop s3467_0 s3468_0)) of
          s3469_0 =>
    (case ((reg_name_matches_prefix s3469_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s3470_0)) =>
    (case ((string_drop s3469_0 s3470_0)) of
          s3471_0 =>
    (case ((sep_matches_prefix s3471_0)) of
          SOME ((() , s3472_0)) =>
    (case ((string_drop s3471_0 s3472_0)) of
          s3473_0 =>
    (case ((reg_name_matches_prefix s3473_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs2, s3474_0)) =>
    let p0_ = (string_drop s3473_0 s3474_0) in
    if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3438_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3438_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s3439_0=
    (let s3440_0 = s3439_0 in
   if ((string_startswith s3440_0 "div")) then  
  (case ((string_drop s3440_0 ((string_length "div")))) of
        s3441_0 =>
  (case ((maybe_not_u_matches_prefix s3441_0)) of
        SOME ((s, s3442_0)) =>
  let s3443_0 = (string_drop s3441_0 s3442_0) in
  if ((string_startswith s3443_0 "w")) then
    (case ((string_drop s3443_0 ((string_length "w")))) of
          s3444_0 =>
    (case ((spc_matches_prefix0 s3444_0)) of
          SOME ((() , s3445_0)) =>
    (case ((string_drop s3444_0 s3445_0)) of
          s3446_0 =>
    (case ((reg_name_matches_prefix s3446_0 : (( 5 words$word # ii)) option)) of
          SOME ((rd, s3447_0)) =>
    (case ((string_drop s3446_0 s3447_0)) of
          s3448_0 =>
    (case ((sep_matches_prefix s3448_0)) of
          SOME ((() , s3449_0)) =>
    (case ((string_drop s3448_0 s3449_0)) of
          s3450_0 =>
    (case ((reg_name_matches_prefix s3450_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s3451_0)) =>
    (case ((string_drop s3450_0 s3451_0)) of
          s3452_0 =>
    (case ((sep_matches_prefix s3452_0)) of
          SOME ((() , s3453_0)) =>
    (case ((string_drop s3452_0 s3453_0)) of
          s3454_0 =>
    (case ((reg_name_matches_prefix s3454_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs2, s3455_0)) =>
    let p0_ = (string_drop s3454_0 s3455_0) in
    if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3422_ : string -> maybe ((mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3422_:string ->((5)words$word#(5)words$word#(5)words$word)option) s3423_0=
    (let s3424_0 = s3423_0 in
   if ((string_startswith s3424_0 "mulw")) then  
  (case ((string_drop s3424_0 ((string_length "mulw")))) of
        s3425_0 =>
  (case ((spc_matches_prefix0 s3425_0)) of
        SOME ((() , s3426_0)) =>
  (case ((string_drop s3425_0 s3426_0)) of
        s3427_0 =>
  (case ((reg_name_matches_prefix s3427_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3428_0)) =>
  (case ((string_drop s3427_0 s3428_0)) of
        s3429_0 =>
  (case ((sep_matches_prefix s3429_0)) of
        SOME ((() , s3430_0)) =>
  (case ((string_drop s3429_0 s3430_0)) of
        s3431_0 =>
  (case ((reg_name_matches_prefix s3431_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s3432_0)) =>
  (case ((string_drop s3431_0 s3432_0)) of
        s3433_0 =>
  (case ((sep_matches_prefix s3433_0)) of
        SOME ((() , s3434_0)) =>
  (case ((string_drop s3433_0 s3434_0)) of
        s3435_0 =>
  (case ((reg_name_matches_prefix s3435_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3436_0)) =>
  let p0_ = (string_drop s3435_0 s3436_0) in
  if (((p0_ = ""))) then SOME (rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3404_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3404_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s3405_0=
    (let s3406_0 = s3405_0 in
   if ((string_startswith s3406_0 "rem")) then  
  (case ((string_drop s3406_0 ((string_length "rem")))) of
        s3407_0 =>
  (case ((maybe_not_u_matches_prefix s3407_0)) of
        SOME ((s, s3408_0)) =>
  (case ((string_drop s3407_0 s3408_0)) of
        s3409_0 =>
  (case ((spc_matches_prefix0 s3409_0)) of
        SOME ((() , s3410_0)) =>
  (case ((string_drop s3409_0 s3410_0)) of
        s3411_0 =>
  (case ((reg_name_matches_prefix s3411_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3412_0)) =>
  (case ((string_drop s3411_0 s3412_0)) of
        s3413_0 =>
  (case ((sep_matches_prefix s3413_0)) of
        SOME ((() , s3414_0)) =>
  (case ((string_drop s3413_0 s3414_0)) of
        s3415_0 =>
  (case ((reg_name_matches_prefix s3415_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s3416_0)) =>
  (case ((string_drop s3415_0 s3416_0)) of
        s3417_0 =>
  (case ((sep_matches_prefix s3417_0)) of
        SOME ((() , s3418_0)) =>
  (case ((string_drop s3417_0 s3418_0)) of
        s3419_0 =>
  (case ((reg_name_matches_prefix s3419_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3420_0)) =>
  let p0_ = (string_drop s3419_0 s3420_0) in
  if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3386_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3386_:string ->(bool#(5)words$word#(5)words$word#(5)words$word)option) s3387_0=
    (let s3388_0 = s3387_0 in
   if ((string_startswith s3388_0 "div")) then  
  (case ((string_drop s3388_0 ((string_length "div")))) of
        s3389_0 =>
  (case ((maybe_not_u_matches_prefix s3389_0)) of
        SOME ((s, s3390_0)) =>
  (case ((string_drop s3389_0 s3390_0)) of
        s3391_0 =>
  (case ((spc_matches_prefix0 s3391_0)) of
        SOME ((() , s3392_0)) =>
  (case ((string_drop s3391_0 s3392_0)) of
        s3393_0 =>
  (case ((reg_name_matches_prefix s3393_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3394_0)) =>
  (case ((string_drop s3393_0 s3394_0)) of
        s3395_0 =>
  (case ((sep_matches_prefix s3395_0)) of
        SOME ((() , s3396_0)) =>
  (case ((string_drop s3395_0 s3396_0)) of
        s3397_0 =>
  (case ((reg_name_matches_prefix s3397_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s3398_0)) =>
  (case ((string_drop s3397_0 s3398_0)) of
        s3399_0 =>
  (case ((sep_matches_prefix s3399_0)) of
        SOME ((() , s3400_0)) =>
  (case ((string_drop s3399_0 s3400_0)) of
        s3401_0 =>
  (case ((reg_name_matches_prefix s3401_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3402_0)) =>
  let p0_ = (string_drop s3401_0 s3402_0) in
  if (((p0_ = ""))) then SOME (s, rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3369_ : string -> maybe ((bool * bool * bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s3369_:string ->(bool#bool#bool#(5)words$word#(5)words$word#(5)words$word)option) s3370_0= 
  ((case s3370_0 of
         s3371_0 =>
   (case ((mul_mnemonic_matches_prefix s3371_0)) of
         SOME (((high, signed1, signed2), s3372_0)) =>
   (case ((string_drop s3371_0 s3372_0)) of
         s3373_0 =>
   (case ((spc_matches_prefix0 s3373_0)) of
         SOME ((() , s3374_0)) =>
   (case ((string_drop s3373_0 s3374_0)) of
         s3375_0 =>
   (case ((reg_name_matches_prefix s3375_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s3376_0)) =>
   (case ((string_drop s3375_0 s3376_0)) of
         s3377_0 =>
   (case ((sep_matches_prefix s3377_0)) of
         SOME ((() , s3378_0)) =>
   (case ((string_drop s3377_0 s3378_0)) of
         s3379_0 =>
   (case ((reg_name_matches_prefix s3379_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s3380_0)) =>
   (case ((string_drop s3379_0 s3380_0)) of
         s3381_0 =>
   (case ((sep_matches_prefix s3381_0)) of
         SOME ((() , s3382_0)) =>
   (case ((string_drop s3381_0 s3382_0)) of
         s3383_0 =>
   (case ((reg_name_matches_prefix s3383_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s3384_0)) =>
   let p0_ = (string_drop s3383_0 s3384_0) in
   if (((p0_ = ""))) then SOME (high, signed1, signed2, rd, rs1, rs2) else
     NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s3357_ : string -> maybe ((mword ty5 * mword ty5))*)

val _ = Define `
 ((s3357_:string ->((5)words$word#(5)words$word)option) s3358_0=
    (let s3359_0 = s3358_0 in
   if ((string_startswith s3359_0 "c.add")) then  
  (case ((string_drop s3359_0 ((string_length "c.add")))) of
        s3360_0 =>
  (case ((spc_matches_prefix0 s3360_0)) of
        SOME ((() , s3361_0)) =>
  (case ((string_drop s3360_0 s3361_0)) of
        s3362_0 =>
  (case ((reg_name_matches_prefix s3362_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s3363_0)) =>
  (case ((string_drop s3362_0 s3363_0)) of
        s3364_0 =>
  (case ((sep_matches_prefix s3364_0)) of
        SOME ((() , s3365_0)) =>
  (case ((string_drop s3364_0 s3365_0)) of
        s3366_0 =>
  (case ((reg_name_matches_prefix s3366_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3367_0)) =>
  let p0_ = (string_drop s3366_0 s3367_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3345_ : string -> maybe ((mword ty5 * mword ty5))*)

val _ = Define `
 ((s3345_:string ->((5)words$word#(5)words$word)option) s3346_0=
    (let s3347_0 = s3346_0 in
   if ((string_startswith s3347_0 "c.mv")) then  
  (case ((string_drop s3347_0 ((string_length "c.mv")))) of
        s3348_0 =>
  (case ((spc_matches_prefix0 s3348_0)) of
        SOME ((() , s3349_0)) =>
  (case ((string_drop s3348_0 s3349_0)) of
        s3350_0 =>
  (case ((reg_name_matches_prefix s3350_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3351_0)) =>
  (case ((string_drop s3350_0 s3351_0)) of
        s3352_0 =>
  (case ((sep_matches_prefix s3352_0)) of
        SOME ((() , s3353_0)) =>
  (case ((string_drop s3352_0 s3353_0)) of
        s3354_0 =>
  (case ((reg_name_matches_prefix s3354_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3355_0)) =>
  let p0_ = (string_drop s3354_0 s3355_0) in
  if (((p0_ = ""))) then SOME (rd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3337_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s3337_:string ->((5)words$word)option) s3338_0=
    (let s3339_0 = s3338_0 in
   if ((string_startswith s3339_0 "c.jalr")) then  
  (case ((string_drop s3339_0 ((string_length "c.jalr")))) of
        s3340_0 =>
  (case ((spc_matches_prefix0 s3340_0)) of
        SOME ((() , s3341_0)) =>
  (case ((string_drop s3340_0 s3341_0)) of
        s3342_0 =>
  (case ((reg_name_matches_prefix s3342_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s3343_0)) =>
  let p0_ = (string_drop s3342_0 s3343_0) in
  if (((p0_ = ""))) then SOME rs1 else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3329_ : string -> maybe (mword ty5)*)

val _ = Define `
 ((s3329_:string ->((5)words$word)option) s3330_0=
    (let s3331_0 = s3330_0 in
   if ((string_startswith s3331_0 "c.jr")) then  
  (case ((string_drop s3331_0 ((string_length "c.jr")))) of
        s3332_0 =>
  (case ((spc_matches_prefix0 s3332_0)) of
        SOME ((() , s3333_0)) =>
  (case ((string_drop s3332_0 s3333_0)) of
        s3334_0 =>
  (case ((reg_name_matches_prefix s3334_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s3335_0)) =>
  let p0_ = (string_drop s3334_0 s3335_0) in
  if (((p0_ = ""))) then SOME rs1 else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3317_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3317_:string ->((5)words$word#(6)words$word)option) s3318_0=
    (let s3319_0 = s3318_0 in
   if ((string_startswith s3319_0 "c.sdsp")) then  
  (case ((string_drop s3319_0 ((string_length "c.sdsp")))) of
        s3320_0 =>
  (case ((spc_matches_prefix0 s3320_0)) of
        SOME ((() , s3321_0)) =>
  (case ((string_drop s3320_0 s3321_0)) of
        s3322_0 =>
  (case ((reg_name_matches_prefix s3322_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s3323_0)) =>
  (case ((string_drop s3322_0 s3323_0)) of
        s3324_0 =>
  (case ((sep_matches_prefix s3324_0)) of
        SOME ((() , s3325_0)) =>
  (case ((string_drop s3324_0 s3325_0)) of
        s3326_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3326_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s3327_0)) =>
  let p0_ = (string_drop s3326_0 s3327_0) in
  if (((p0_ = ""))) then SOME (rs2, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3305_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3305_:string ->((5)words$word#(6)words$word)option) s3306_0=
    (let s3307_0 = s3306_0 in
   if ((string_startswith s3307_0 "c.swsp")) then  
  (case ((string_drop s3307_0 ((string_length "c.swsp")))) of
        s3308_0 =>
  (case ((spc_matches_prefix0 s3308_0)) of
        SOME ((() , s3309_0)) =>
  (case ((string_drop s3308_0 s3309_0)) of
        s3310_0 =>
  (case ((reg_name_matches_prefix s3310_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3311_0)) =>
  (case ((string_drop s3310_0 s3311_0)) of
        s3312_0 =>
  (case ((sep_matches_prefix s3312_0)) of
        SOME ((() , s3313_0)) =>
  (case ((string_drop s3312_0 s3313_0)) of
        s3314_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3314_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s3315_0)) =>
  let p0_ = (string_drop s3314_0 s3315_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3293_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3293_:string ->((5)words$word#(6)words$word)option) s3294_0=
    (let s3295_0 = s3294_0 in
   if ((string_startswith s3295_0 "c.ldsp")) then  
  (case ((string_drop s3295_0 ((string_length "c.ldsp")))) of
        s3296_0 =>
  (case ((spc_matches_prefix0 s3296_0)) of
        SOME ((() , s3297_0)) =>
  (case ((string_drop s3296_0 s3297_0)) of
        s3298_0 =>
  (case ((reg_name_matches_prefix s3298_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3299_0)) =>
  (case ((string_drop s3298_0 s3299_0)) of
        s3300_0 =>
  (case ((sep_matches_prefix s3300_0)) of
        SOME ((() , s3301_0)) =>
  (case ((string_drop s3300_0 s3301_0)) of
        s3302_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3302_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s3303_0)) =>
  let p0_ = (string_drop s3302_0 s3303_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3281_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3281_:string ->((5)words$word#(6)words$word)option) s3282_0=
    (let s3283_0 = s3282_0 in
   if ((string_startswith s3283_0 "c.lwsp")) then  
  (case ((string_drop s3283_0 ((string_length "c.lwsp")))) of
        s3284_0 =>
  (case ((spc_matches_prefix0 s3284_0)) of
        SOME ((() , s3285_0)) =>
  (case ((string_drop s3284_0 s3285_0)) of
        s3286_0 =>
  (case ((reg_name_matches_prefix s3286_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3287_0)) =>
  (case ((string_drop s3286_0 s3287_0)) of
        s3288_0 =>
  (case ((sep_matches_prefix s3288_0)) of
        SOME ((() , s3289_0)) =>
  (case ((string_drop s3288_0 s3289_0)) of
        s3290_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3290_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s3291_0)) =>
  let p0_ = (string_drop s3290_0 s3291_0) in
  if (((p0_ = ""))) then SOME (rd, uimm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3269_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3269_:string ->((5)words$word#(6)words$word)option) s3270_0=
    (let s3271_0 = s3270_0 in
   if ((string_startswith s3271_0 "c.slli")) then  
  (case ((string_drop s3271_0 ((string_length "c.slli")))) of
        s3272_0 =>
  (case ((spc_matches_prefix0 s3272_0)) of
        SOME ((() , s3273_0)) =>
  (case ((string_drop s3272_0 s3273_0)) of
        s3274_0 =>
  (case ((reg_name_matches_prefix s3274_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s3275_0)) =>
  (case ((string_drop s3274_0 s3275_0)) of
        s3276_0 =>
  (case ((sep_matches_prefix s3276_0)) of
        SOME ((() , s3277_0)) =>
  (case ((string_drop s3276_0 s3277_0)) of
        s3278_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3278_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s3279_0)) =>
  let p0_ = (string_drop s3278_0 s3279_0) in
  if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3257_ : string -> maybe ((mword ty3 * mword ty8))*)

val _ = Define `
 ((s3257_:string ->((3)words$word#(8)words$word)option) s3258_0=
    (let s3259_0 = s3258_0 in
   if ((string_startswith s3259_0 "c.bnez")) then  
  (case ((string_drop s3259_0 ((string_length "c.bnez")))) of
        s3260_0 =>
  (case ((spc_matches_prefix0 s3260_0)) of
        SOME ((() , s3261_0)) =>
  (case ((string_drop s3260_0 s3261_0)) of
        s3262_0 =>
  (case ((creg_name_matches_prefix s3262_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs, s3263_0)) =>
  (case ((string_drop s3262_0 s3263_0)) of
        s3264_0 =>
  (case ((sep_matches_prefix s3264_0)) of
        SOME ((() , s3265_0)) =>
  (case ((string_drop s3264_0 s3265_0)) of
        s3266_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3266_0 : (( 8 words$word # ii)) option)) of
        SOME ((imm, s3267_0)) =>
  let p0_ = (string_drop s3266_0 s3267_0) in
  if (((p0_ = ""))) then SOME (rs, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3245_ : string -> maybe ((mword ty3 * mword ty8))*)

val _ = Define `
 ((s3245_:string ->((3)words$word#(8)words$word)option) s3246_0=
    (let s3247_0 = s3246_0 in
   if ((string_startswith s3247_0 "c.beqz")) then  
  (case ((string_drop s3247_0 ((string_length "c.beqz")))) of
        s3248_0 =>
  (case ((spc_matches_prefix0 s3248_0)) of
        SOME ((() , s3249_0)) =>
  (case ((string_drop s3248_0 s3249_0)) of
        s3250_0 =>
  (case ((creg_name_matches_prefix s3250_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs, s3251_0)) =>
  (case ((string_drop s3250_0 s3251_0)) of
        s3252_0 =>
  (case ((sep_matches_prefix s3252_0)) of
        SOME ((() , s3253_0)) =>
  (case ((string_drop s3252_0 s3253_0)) of
        s3254_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3254_0 : (( 8 words$word # ii)) option)) of
        SOME ((imm, s3255_0)) =>
  let p0_ = (string_drop s3254_0 s3255_0) in
  if (((p0_ = ""))) then SOME (rs, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3237_ : string -> maybe (mword ty11)*)

val _ = Define `
 ((s3237_:string ->((11)words$word)option) s3238_0=
    (let s3239_0 = s3238_0 in
   if ((string_startswith s3239_0 "c.j")) then  
  (case ((string_drop s3239_0 ((string_length "c.j")))) of
        s3240_0 =>
  (case ((spc_matches_prefix0 s3240_0)) of
        SOME ((() , s3241_0)) =>
  (case ((string_drop s3240_0 s3241_0)) of
        s3242_0 =>
  (case ((hex_bits_11_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3242_0 : (( 11 words$word # ii)) option)) of
        SOME ((imm, s3243_0)) =>
  let p0_ = (string_drop s3242_0 s3243_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3225_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s3225_:string ->((3)words$word#(3)words$word)option) s3226_0=
    (let s3227_0 = s3226_0 in
   if ((string_startswith s3227_0 "c.addw")) then  
  (case ((string_drop s3227_0 ((string_length "c.addw")))) of
        s3228_0 =>
  (case ((spc_matches_prefix0 s3228_0)) of
        SOME ((() , s3229_0)) =>
  (case ((string_drop s3228_0 s3229_0)) of
        s3230_0 =>
  (case ((creg_name_matches_prefix s3230_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3231_0)) =>
  (case ((string_drop s3230_0 s3231_0)) of
        s3232_0 =>
  (case ((sep_matches_prefix s3232_0)) of
        SOME ((() , s3233_0)) =>
  (case ((string_drop s3232_0 s3233_0)) of
        s3234_0 =>
  (case ((creg_name_matches_prefix s3234_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s3235_0)) =>
  let p0_ = (string_drop s3234_0 s3235_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3213_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s3213_:string ->((3)words$word#(3)words$word)option) s3214_0=
    (let s3215_0 = s3214_0 in
   if ((string_startswith s3215_0 "c.subw")) then  
  (case ((string_drop s3215_0 ((string_length "c.subw")))) of
        s3216_0 =>
  (case ((spc_matches_prefix0 s3216_0)) of
        SOME ((() , s3217_0)) =>
  (case ((string_drop s3216_0 s3217_0)) of
        s3218_0 =>
  (case ((creg_name_matches_prefix s3218_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3219_0)) =>
  (case ((string_drop s3218_0 s3219_0)) of
        s3220_0 =>
  (case ((sep_matches_prefix s3220_0)) of
        SOME ((() , s3221_0)) =>
  (case ((string_drop s3220_0 s3221_0)) of
        s3222_0 =>
  (case ((creg_name_matches_prefix s3222_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s3223_0)) =>
  let p0_ = (string_drop s3222_0 s3223_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3201_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s3201_:string ->((3)words$word#(3)words$word)option) s3202_0=
    (let s3203_0 = s3202_0 in
   if ((string_startswith s3203_0 "c.and")) then  
  (case ((string_drop s3203_0 ((string_length "c.and")))) of
        s3204_0 =>
  (case ((spc_matches_prefix0 s3204_0)) of
        SOME ((() , s3205_0)) =>
  (case ((string_drop s3204_0 s3205_0)) of
        s3206_0 =>
  (case ((creg_name_matches_prefix s3206_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3207_0)) =>
  (case ((string_drop s3206_0 s3207_0)) of
        s3208_0 =>
  (case ((sep_matches_prefix s3208_0)) of
        SOME ((() , s3209_0)) =>
  (case ((string_drop s3208_0 s3209_0)) of
        s3210_0 =>
  (case ((creg_name_matches_prefix s3210_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s3211_0)) =>
  let p0_ = (string_drop s3210_0 s3211_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3189_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s3189_:string ->((3)words$word#(3)words$word)option) s3190_0=
    (let s3191_0 = s3190_0 in
   if ((string_startswith s3191_0 "c.or")) then  
  (case ((string_drop s3191_0 ((string_length "c.or")))) of
        s3192_0 =>
  (case ((spc_matches_prefix0 s3192_0)) of
        SOME ((() , s3193_0)) =>
  (case ((string_drop s3192_0 s3193_0)) of
        s3194_0 =>
  (case ((creg_name_matches_prefix s3194_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3195_0)) =>
  (case ((string_drop s3194_0 s3195_0)) of
        s3196_0 =>
  (case ((sep_matches_prefix s3196_0)) of
        SOME ((() , s3197_0)) =>
  (case ((string_drop s3196_0 s3197_0)) of
        s3198_0 =>
  (case ((creg_name_matches_prefix s3198_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s3199_0)) =>
  let p0_ = (string_drop s3198_0 s3199_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3177_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s3177_:string ->((3)words$word#(3)words$word)option) s3178_0=
    (let s3179_0 = s3178_0 in
   if ((string_startswith s3179_0 "c.xor")) then  
  (case ((string_drop s3179_0 ((string_length "c.xor")))) of
        s3180_0 =>
  (case ((spc_matches_prefix0 s3180_0)) of
        SOME ((() , s3181_0)) =>
  (case ((string_drop s3180_0 s3181_0)) of
        s3182_0 =>
  (case ((creg_name_matches_prefix s3182_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3183_0)) =>
  (case ((string_drop s3182_0 s3183_0)) of
        s3184_0 =>
  (case ((sep_matches_prefix s3184_0)) of
        SOME ((() , s3185_0)) =>
  (case ((string_drop s3184_0 s3185_0)) of
        s3186_0 =>
  (case ((creg_name_matches_prefix s3186_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s3187_0)) =>
  let p0_ = (string_drop s3186_0 s3187_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3165_ : string -> maybe ((mword ty3 * mword ty3))*)

val _ = Define `
 ((s3165_:string ->((3)words$word#(3)words$word)option) s3166_0=
    (let s3167_0 = s3166_0 in
   if ((string_startswith s3167_0 "c.sub")) then  
  (case ((string_drop s3167_0 ((string_length "c.sub")))) of
        s3168_0 =>
  (case ((spc_matches_prefix0 s3168_0)) of
        SOME ((() , s3169_0)) =>
  (case ((string_drop s3168_0 s3169_0)) of
        s3170_0 =>
  (case ((creg_name_matches_prefix s3170_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3171_0)) =>
  (case ((string_drop s3170_0 s3171_0)) of
        s3172_0 =>
  (case ((sep_matches_prefix s3172_0)) of
        SOME ((() , s3173_0)) =>
  (case ((string_drop s3172_0 s3173_0)) of
        s3174_0 =>
  (case ((creg_name_matches_prefix s3174_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s3175_0)) =>
  let p0_ = (string_drop s3174_0 s3175_0) in
  if (((p0_ = ""))) then SOME (rsd, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3153_ : string -> maybe ((mword ty3 * mword ty6))*)

val _ = Define `
 ((s3153_:string ->((3)words$word#(6)words$word)option) s3154_0=
    (let s3155_0 = s3154_0 in
   if ((string_startswith s3155_0 "c.andi")) then  
  (case ((string_drop s3155_0 ((string_length "c.andi")))) of
        s3156_0 =>
  (case ((spc_matches_prefix0 s3156_0)) of
        SOME ((() , s3157_0)) =>
  (case ((string_drop s3156_0 s3157_0)) of
        s3158_0 =>
  (case ((creg_name_matches_prefix s3158_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3159_0)) =>
  (case ((string_drop s3158_0 s3159_0)) of
        s3160_0 =>
  (case ((sep_matches_prefix s3160_0)) of
        SOME ((() , s3161_0)) =>
  (case ((string_drop s3160_0 s3161_0)) of
        s3162_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3162_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3163_0)) =>
  let p0_ = (string_drop s3162_0 s3163_0) in
  if (((p0_ = ""))) then SOME (rsd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3141_ : string -> maybe ((mword ty3 * mword ty6))*)

val _ = Define `
 ((s3141_:string ->((3)words$word#(6)words$word)option) s3142_0=
    (let s3143_0 = s3142_0 in
   if ((string_startswith s3143_0 "c.srai")) then  
  (case ((string_drop s3143_0 ((string_length "c.srai")))) of
        s3144_0 =>
  (case ((spc_matches_prefix0 s3144_0)) of
        SOME ((() , s3145_0)) =>
  (case ((string_drop s3144_0 s3145_0)) of
        s3146_0 =>
  (case ((creg_name_matches_prefix s3146_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3147_0)) =>
  (case ((string_drop s3146_0 s3147_0)) of
        s3148_0 =>
  (case ((sep_matches_prefix s3148_0)) of
        SOME ((() , s3149_0)) =>
  (case ((string_drop s3148_0 s3149_0)) of
        s3150_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3150_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s3151_0)) =>
  let p0_ = (string_drop s3150_0 s3151_0) in
  if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3129_ : string -> maybe ((mword ty3 * mword ty6))*)

val _ = Define `
 ((s3129_:string ->((3)words$word#(6)words$word)option) s3130_0=
    (let s3131_0 = s3130_0 in
   if ((string_startswith s3131_0 "c.srli")) then  
  (case ((string_drop s3131_0 ((string_length "c.srli")))) of
        s3132_0 =>
  (case ((spc_matches_prefix0 s3132_0)) of
        SOME ((() , s3133_0)) =>
  (case ((string_drop s3132_0 s3133_0)) of
        s3134_0 =>
  (case ((creg_name_matches_prefix s3134_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s3135_0)) =>
  (case ((string_drop s3134_0 s3135_0)) of
        s3136_0 =>
  (case ((sep_matches_prefix s3136_0)) of
        SOME ((() , s3137_0)) =>
  (case ((string_drop s3136_0 s3137_0)) of
        s3138_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3138_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s3139_0)) =>
  let p0_ = (string_drop s3138_0 s3139_0) in
  if (((p0_ = ""))) then SOME (rsd, shamt) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3117_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3117_:string ->((5)words$word#(6)words$word)option) s3118_0=
    (let s3119_0 = s3118_0 in
   if ((string_startswith s3119_0 "c.lui")) then  
  (case ((string_drop s3119_0 ((string_length "c.lui")))) of
        s3120_0 =>
  (case ((spc_matches_prefix0 s3120_0)) of
        SOME ((() , s3121_0)) =>
  (case ((string_drop s3120_0 s3121_0)) of
        s3122_0 =>
  (case ((reg_name_matches_prefix s3122_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3123_0)) =>
  (case ((string_drop s3122_0 s3123_0)) of
        s3124_0 =>
  (case ((sep_matches_prefix s3124_0)) of
        SOME ((() , s3125_0)) =>
  (case ((string_drop s3124_0 s3125_0)) of
        s3126_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3126_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3127_0)) =>
  let p0_ = (string_drop s3126_0 s3127_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3109_ : string -> maybe (mword ty6)*)

val _ = Define `
 ((s3109_:string ->((6)words$word)option) s3110_0=
    (let s3111_0 = s3110_0 in
   if ((string_startswith s3111_0 "c.addi16sp")) then  
  (case ((string_drop s3111_0 ((string_length "c.addi16sp")))) of
        s3112_0 =>
  (case ((spc_matches_prefix0 s3112_0)) of
        SOME ((() , s3113_0)) =>
  (case ((string_drop s3112_0 s3113_0)) of
        s3114_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3114_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3115_0)) =>
  let p0_ = (string_drop s3114_0 s3115_0) in
  if (((p0_ = ""))) then SOME imm else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3097_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3097_:string ->((5)words$word#(6)words$word)option) s3098_0=
    (let s3099_0 = s3098_0 in
   if ((string_startswith s3099_0 "c.li")) then  
  (case ((string_drop s3099_0 ((string_length "c.li")))) of
        s3100_0 =>
  (case ((spc_matches_prefix0 s3100_0)) of
        SOME ((() , s3101_0)) =>
  (case ((string_drop s3100_0 s3101_0)) of
        s3102_0 =>
  (case ((reg_name_matches_prefix s3102_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s3103_0)) =>
  (case ((string_drop s3102_0 s3103_0)) of
        s3104_0 =>
  (case ((sep_matches_prefix s3104_0)) of
        SOME ((() , s3105_0)) =>
  (case ((string_drop s3104_0 s3105_0)) of
        s3106_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3106_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3107_0)) =>
  let p0_ = (string_drop s3106_0 s3107_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3085_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3085_:string ->((5)words$word#(6)words$word)option) s3086_0=
    (let s3087_0 = s3086_0 in
   if ((string_startswith s3087_0 "c.addiw")) then  
  (case ((string_drop s3087_0 ((string_length "c.addiw")))) of
        s3088_0 =>
  (case ((spc_matches_prefix0 s3088_0)) of
        SOME ((() , s3089_0)) =>
  (case ((string_drop s3088_0 s3089_0)) of
        s3090_0 =>
  (case ((reg_name_matches_prefix s3090_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s3091_0)) =>
  (case ((string_drop s3090_0 s3091_0)) of
        s3092_0 =>
  (case ((sep_matches_prefix s3092_0)) of
        SOME ((() , s3093_0)) =>
  (case ((string_drop s3092_0 s3093_0)) of
        s3094_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3094_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s3095_0)) =>
  let p0_ = (string_drop s3094_0 s3095_0) in
  if (((p0_ = ""))) then SOME (rsd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3077_ : string -> maybe (mword ty11)*)

val _ = Define `
 ((s3077_:string ->((11)words$word)option) s3078_0=
    (let s3079_0 = s3078_0 in
   if ((string_startswith s3079_0 "c.jal")) then  
  (case ((string_drop s3079_0 ((string_length "c.jal")))) of
        s3080_0 =>
  (case ((spc_matches_prefix0 s3080_0)) of
        SOME ((() , s3081_0)) =>
  (case ((string_drop s3080_0 s3081_0)) of
        s3082_0 =>
  (case ((hex_bits_12_matches_prefix0 s3082_0 : (( 12 words$word # ii)) option)) of
        SOME ((v__1200, s3083_0)) =>
  if (((((subrange_vec_dec v__1200 (( 0 : int): ii) (( 0 : int): ii) : 1 words$word))
          = (0b0w : 1 words$word)))) then
    let (imm : 11 words$word) = ((subrange_vec_dec v__1200 (( 11 : int): ii)
                                    (( 1 : int): ii) : 11 words$word)) in
    let (imm : 11 words$word) = ((subrange_vec_dec v__1200 (( 11 : int): ii)
                                    (( 1 : int): ii) : 11 words$word)) in
    let p0_ = (string_drop s3082_0 s3083_0) in
    if (((p0_ = ""))) then SOME imm else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3065_ : string -> maybe ((mword ty5 * mword ty6))*)

val _ = Define `
 ((s3065_:string ->((5)words$word#(6)words$word)option) s3066_0=
    (let s3067_0 = s3066_0 in
   if ((string_startswith s3067_0 "c.addi")) then  
  (case ((string_drop s3067_0 ((string_length "c.addi")))) of
        s3068_0 =>
  (case ((spc_matches_prefix0 s3068_0)) of
        SOME ((() , s3069_0)) =>
  (case ((string_drop s3068_0 s3069_0)) of
        s3070_0 =>
  (case ((reg_name_matches_prefix s3070_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s3071_0)) =>
  (case ((string_drop s3070_0 s3071_0)) of
        s3072_0 =>
  (case ((sep_matches_prefix s3072_0)) of
        SOME ((() , s3073_0)) =>
  (case ((string_drop s3072_0 s3073_0)) of
        s3074_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3074_0 : (( 6 words$word # ii)) option)) of
        SOME ((nzi, s3075_0)) =>
  let p0_ = (string_drop s3074_0 s3075_0) in
  if (((p0_ = ""))) then SOME (rsd, nzi) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3049_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s3049_:string ->((3)words$word#(3)words$word#(5)words$word)option) s3050_0=
    (let s3051_0 = s3050_0 in
   if ((string_startswith s3051_0 "c.sd")) then  
  (case ((string_drop s3051_0 ((string_length "c.sd")))) of
        s3052_0 =>
  (case ((spc_matches_prefix0 s3052_0)) of
        SOME ((() , s3053_0)) =>
  (case ((string_drop s3052_0 s3053_0)) of
        s3054_0 =>
  (case ((creg_name_matches_prefix s3054_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s3055_0)) =>
  (case ((string_drop s3054_0 s3055_0)) of
        s3056_0 =>
  (case ((sep_matches_prefix s3056_0)) of
        SOME ((() , s3057_0)) =>
  (case ((string_drop s3056_0 s3057_0)) of
        s3058_0 =>
  (case ((creg_name_matches_prefix s3058_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s3059_0)) =>
  (case ((string_drop s3058_0 s3059_0)) of
        s3060_0 =>
  (case ((sep_matches_prefix s3060_0)) of
        SOME ((() , s3061_0)) =>
  (case ((string_drop s3060_0 s3061_0)) of
        s3062_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3062_0
         : (( 8 words$word # ii)) option)) of
        SOME ((v__1202, s3063_0)) =>
  if (((((subrange_vec_dec v__1202 (( 2 : int): ii) (( 0 : int): ii)
         : 3 words$word)) = (0b000w : 3 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1202 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1202 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s3062_0 s3063_0) in
    if (((p0_ = ""))) then SOME (rsc1, rsc2, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3033_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s3033_:string ->((3)words$word#(3)words$word#(5)words$word)option) s3034_0=
    (let s3035_0 = s3034_0 in
   if ((string_startswith s3035_0 "c.sw")) then  
  (case ((string_drop s3035_0 ((string_length "c.sw")))) of
        s3036_0 =>
  (case ((spc_matches_prefix0 s3036_0)) of
        SOME ((() , s3037_0)) =>
  (case ((string_drop s3036_0 s3037_0)) of
        s3038_0 =>
  (case ((creg_name_matches_prefix s3038_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s3039_0)) =>
  (case ((string_drop s3038_0 s3039_0)) of
        s3040_0 =>
  (case ((sep_matches_prefix s3040_0)) of
        SOME ((() , s3041_0)) =>
  (case ((string_drop s3040_0 s3041_0)) of
        s3042_0 =>
  (case ((creg_name_matches_prefix s3042_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s3043_0)) =>
  (case ((string_drop s3042_0 s3043_0)) of
        s3044_0 =>
  (case ((sep_matches_prefix s3044_0)) of
        SOME ((() , s3045_0)) =>
  (case ((string_drop s3044_0 s3045_0)) of
        s3046_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3046_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1204, s3047_0)) =>
  if (((((subrange_vec_dec v__1204 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1204 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1204 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s3046_0 s3047_0) in
    if (((p0_ = ""))) then SOME (rsc1, rsc2, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3017_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s3017_:string ->((3)words$word#(3)words$word#(5)words$word)option) s3018_0=
    (let s3019_0 = s3018_0 in
   if ((string_startswith s3019_0 "c.ld")) then  
  (case ((string_drop s3019_0 ((string_length "c.ld")))) of
        s3020_0 =>
  (case ((spc_matches_prefix0 s3020_0)) of
        SOME ((() , s3021_0)) =>
  (case ((string_drop s3020_0 s3021_0)) of
        s3022_0 =>
  (case ((creg_name_matches_prefix s3022_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s3023_0)) =>
  (case ((string_drop s3022_0 s3023_0)) of
        s3024_0 =>
  (case ((sep_matches_prefix s3024_0)) of
        SOME ((() , s3025_0)) =>
  (case ((string_drop s3024_0 s3025_0)) of
        s3026_0 =>
  (case ((creg_name_matches_prefix s3026_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s3027_0)) =>
  (case ((string_drop s3026_0 s3027_0)) of
        s3028_0 =>
  (case ((sep_matches_prefix s3028_0)) of
        SOME ((() , s3029_0)) =>
  (case ((string_drop s3028_0 s3029_0)) of
        s3030_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3030_0
         : (( 8 words$word # ii)) option)) of
        SOME ((v__1206, s3031_0)) =>
  if (((((subrange_vec_dec v__1206 (( 2 : int): ii) (( 0 : int): ii)
         : 3 words$word)) = (0b000w : 3 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1206 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1206 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s3030_0 s3031_0) in
    if (((p0_ = ""))) then SOME (rdc, rsc, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s3001_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5))*)

val _ = Define `
 ((s3001_:string ->((3)words$word#(3)words$word#(5)words$word)option) s3002_0=
    (let s3003_0 = s3002_0 in
   if ((string_startswith s3003_0 "c.lw")) then  
  (case ((string_drop s3003_0 ((string_length "c.lw")))) of
        s3004_0 =>
  (case ((spc_matches_prefix0 s3004_0)) of
        SOME ((() , s3005_0)) =>
  (case ((string_drop s3004_0 s3005_0)) of
        s3006_0 =>
  (case ((creg_name_matches_prefix s3006_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s3007_0)) =>
  (case ((string_drop s3006_0 s3007_0)) of
        s3008_0 =>
  (case ((sep_matches_prefix s3008_0)) of
        SOME ((() , s3009_0)) =>
  (case ((string_drop s3008_0 s3009_0)) of
        s3010_0 =>
  (case ((creg_name_matches_prefix s3010_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s3011_0)) =>
  (case ((string_drop s3010_0 s3011_0)) of
        s3012_0 =>
  (case ((sep_matches_prefix s3012_0)) of
        SOME ((() , s3013_0)) =>
  (case ((string_drop s3012_0 s3013_0)) of
        s3014_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s3014_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1208, s3015_0)) =>
  if (((((subrange_vec_dec v__1208 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1208 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1208 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let p0_ = (string_drop s3014_0 s3015_0) in
    if (((p0_ = ""))) then SOME (rdc, rsc, uimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2989_ : string -> maybe ((mword ty3 * mword ty8))*)

val _ = Define `
 ((s2989_:string ->((3)words$word#(8)words$word)option) s2990_0=
    (let s2991_0 = s2990_0 in
   if ((string_startswith s2991_0 "c.addi4spn")) then  
  (case ((string_drop s2991_0 ((string_length "c.addi4spn")))) of
        s2992_0 =>
  (case ((spc_matches_prefix0 s2992_0)) of
        SOME ((() , s2993_0)) =>
  (case ((string_drop s2992_0 s2993_0)) of
        s2994_0 =>
  (case ((creg_name_matches_prefix s2994_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s2995_0)) =>
  (case ((string_drop s2994_0 s2995_0)) of
        s2996_0 =>
  (case ((sep_matches_prefix s2996_0)) of
        SOME ((() , s2997_0)) =>
  (case ((string_drop s2996_0 s2997_0)) of
        s2998_0 =>
  (case ((hex_bits_10_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2998_0 : (( 10 words$word # ii)) option)) of
        SOME ((v__1210, s2999_0)) =>
  if (((((subrange_vec_dec v__1210 (( 1 : int): ii) (( 0 : int): ii) : 2 words$word))
          = (0b00w : 2 words$word)))) then
    let (nzimm : 8 words$word) =
        ((subrange_vec_dec v__1210 (( 9 : int): ii) (( 2 : int): ii) : 8 words$word)) in
    let (nzimm : 8 words$word) =
        ((subrange_vec_dec v__1210 (( 9 : int): ii) (( 2 : int): ii) : 8 words$word)) in
    let p0_ = (string_drop s2998_0 s2999_0) in
    if (((p0_ = ""))) then SOME (rdc, nzimm) else NONE else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2963_ : string -> maybe ((amoop * word_width * bool * bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2963_:string ->(amoop#word_width#bool#bool#(5)words$word#(5)words$word#(5)words$word)option) s2964_0= 
  ((case s2964_0 of
         s2965_0 =>
   (case ((amo_mnemonic_matches_prefix s2965_0)) of
         SOME ((op, s2966_0)) =>
   let s2967_0 = (string_drop s2965_0 s2966_0) in
   if ((string_startswith s2967_0 ".")) then
     (case ((string_drop s2967_0 ((string_length ".")))) of
           s2968_0 =>
     (case ((size_mnemonic_matches_prefix s2968_0)) of
           SOME ((width, s2969_0)) =>
     (case ((string_drop s2968_0 s2969_0)) of
           s2970_0 =>
     (case ((maybe_aq_matches_prefix s2970_0)) of
           SOME ((aq, s2971_0)) =>
     (case ((string_drop s2970_0 s2971_0)) of
           s2972_0 =>
     (case ((maybe_rl_matches_prefix s2972_0)) of
           SOME ((rl, s2973_0)) =>
     (case ((string_drop s2972_0 s2973_0)) of
           s2974_0 =>
     (case ((spc_matches_prefix0 s2974_0)) of
           SOME ((() , s2975_0)) =>
     (case ((string_drop s2974_0 s2975_0)) of
           s2976_0 =>
     (case ((reg_name_matches_prefix s2976_0 : (( 5 words$word # ii)) option)) of
           SOME ((rd, s2977_0)) =>
     (case ((string_drop s2976_0 s2977_0)) of
           s2978_0 =>
     (case ((sep_matches_prefix s2978_0)) of
           SOME ((() , s2979_0)) =>
     (case ((string_drop s2978_0 s2979_0)) of
           s2980_0 =>
     (case ((reg_name_matches_prefix s2980_0 : (( 5 words$word # ii)) option)) of
           SOME ((rs2, s2981_0)) =>
     (case ((string_drop s2980_0 s2981_0)) of
           s2982_0 =>
     (case ((sep_matches_prefix s2982_0)) of
           SOME ((() , s2983_0)) =>
     let s2984_0 = (string_drop s2982_0 s2983_0) in
     if ((string_startswith s2984_0 "(")) then
       (case ((string_drop s2984_0 ((string_length "(")))) of
             s2985_0 =>
       (case ((reg_name_matches_prefix s2985_0
              : (( 5 words$word # ii)) option)) of
             SOME ((rs1, s2986_0)) =>
       let s2987_0 = (string_drop s2985_0 s2986_0) in
       if ((string_startswith s2987_0 ")")) then
         let p0_ = (string_drop s2987_0 ((string_length ")"))) in
         if (((p0_ = ""))) then SOME (op, width, aq, rl, rd, rs2, rs1) else
           NONE else NONE
         | _ => NONE
       )
       ) else NONE
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


(*val _s2941_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2941_:string ->(word_width#bool#bool#(5)words$word#(5)words$word#(5)words$word)option) s2942_0=
    (let s2943_0 = s2942_0 in
   if ((string_startswith s2943_0 "sc.")) then  
  (case ((string_drop s2943_0 ((string_length "sc.")))) of
        s2944_0 =>
  (case ((size_mnemonic_matches_prefix s2944_0)) of
        SOME ((size1, s2945_0)) =>
  (case ((string_drop s2944_0 s2945_0)) of
        s2946_0 =>
  (case ((maybe_aq_matches_prefix s2946_0)) of
        SOME ((aq, s2947_0)) =>
  (case ((string_drop s2946_0 s2947_0)) of
        s2948_0 =>
  (case ((maybe_rl_matches_prefix s2948_0)) of
        SOME ((rl, s2949_0)) =>
  (case ((string_drop s2948_0 s2949_0)) of
        s2950_0 =>
  (case ((spc_matches_prefix0 s2950_0)) of
        SOME ((() , s2951_0)) =>
  (case ((string_drop s2950_0 s2951_0)) of
        s2952_0 =>
  (case ((reg_name_matches_prefix s2952_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2953_0)) =>
  (case ((string_drop s2952_0 s2953_0)) of
        s2954_0 =>
  (case ((sep_matches_prefix s2954_0)) of
        SOME ((() , s2955_0)) =>
  (case ((string_drop s2954_0 s2955_0)) of
        s2956_0 =>
  (case ((reg_name_matches_prefix s2956_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s2957_0)) =>
  (case ((string_drop s2956_0 s2957_0)) of
        s2958_0 =>
  (case ((sep_matches_prefix s2958_0)) of
        SOME ((() , s2959_0)) =>
  (case ((string_drop s2958_0 s2959_0)) of
        s2960_0 =>
  (case ((reg_name_matches_prefix s2960_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s2961_0)) =>
  let p0_ = (string_drop s2960_0 s2961_0) in
  if (((p0_ = ""))) then SOME (size1, aq, rl, rd, rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2923_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2923_:string ->(word_width#bool#bool#(5)words$word#(5)words$word)option) s2924_0=
    (let s2925_0 = s2924_0 in
   if ((string_startswith s2925_0 "lr.")) then  
  (case ((string_drop s2925_0 ((string_length "lr.")))) of
        s2926_0 =>
  (case ((size_mnemonic_matches_prefix s2926_0)) of
        SOME ((size1, s2927_0)) =>
  (case ((string_drop s2926_0 s2927_0)) of
        s2928_0 =>
  (case ((maybe_aq_matches_prefix s2928_0)) of
        SOME ((aq, s2929_0)) =>
  (case ((string_drop s2928_0 s2929_0)) of
        s2930_0 =>
  (case ((maybe_rl_matches_prefix s2930_0)) of
        SOME ((rl, s2931_0)) =>
  (case ((string_drop s2930_0 s2931_0)) of
        s2932_0 =>
  (case ((spc_matches_prefix0 s2932_0)) of
        SOME ((() , s2933_0)) =>
  (case ((string_drop s2932_0 s2933_0)) of
        s2934_0 =>
  (case ((reg_name_matches_prefix s2934_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2935_0)) =>
  (case ((string_drop s2934_0 s2935_0)) of
        s2936_0 =>
  (case ((sep_matches_prefix s2936_0)) of
        SOME ((() , s2937_0)) =>
  (case ((string_drop s2936_0 s2937_0)) of
        s2938_0 =>
  (case ((reg_name_matches_prefix s2938_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s2939_0)) =>
  let p0_ = (string_drop s2938_0 s2939_0) in
  if (((p0_ = ""))) then SOME (size1, aq, rl, rd, rs1) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2911_ : string -> maybe ((mword ty5 * mword ty5))*)

val _ = Define `
 ((s2911_:string ->((5)words$word#(5)words$word)option) s2912_0=
    (let s2913_0 = s2912_0 in
   if ((string_startswith s2913_0 "sfence.vma")) then  
  (case ((string_drop s2913_0 ((string_length "sfence.vma")))) of
        s2914_0 =>
  (case ((spc_matches_prefix0 s2914_0)) of
        SOME ((() , s2915_0)) =>
  (case ((string_drop s2914_0 s2915_0)) of
        s2916_0 =>
  (case ((reg_name_matches_prefix s2916_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s2917_0)) =>
  (case ((string_drop s2916_0 s2917_0)) of
        s2918_0 =>
  (case ((sep_matches_prefix s2918_0)) of
        SOME ((() , s2919_0)) =>
  (case ((string_drop s2918_0 s2919_0)) of
        s2920_0 =>
  (case ((reg_name_matches_prefix s2920_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s2921_0)) =>
  let p0_ = (string_drop s2920_0 s2921_0) in
  if (((p0_ = ""))) then SOME (rs1, rs2) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2899_ : string -> maybe ((mword ty4 * mword ty4))*)

val _ = Define `
 ((s2899_:string ->((4)words$word#(4)words$word)option) s2900_0=
    (let s2901_0 = s2900_0 in
   if ((string_startswith s2901_0 "fence.tso")) then  
  (case ((string_drop s2901_0 ((string_length "fence.tso")))) of
        s2902_0 =>
  (case ((spc_matches_prefix0 s2902_0)) of
        SOME ((() , s2903_0)) =>
  (case ((string_drop s2902_0 s2903_0)) of
        s2904_0 =>
  (case ((fence_bits_matches_prefix s2904_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s2905_0)) =>
  (case ((string_drop s2904_0 s2905_0)) of
        s2906_0 =>
  (case ((sep_matches_prefix s2906_0)) of
        SOME ((() , s2907_0)) =>
  (case ((string_drop s2906_0 s2907_0)) of
        s2908_0 =>
  (case ((fence_bits_matches_prefix s2908_0 : (( 4 words$word # ii)) option)) of
        SOME ((succ, s2909_0)) =>
  let p0_ = (string_drop s2908_0 s2909_0) in
  if (((p0_ = ""))) then SOME (pred, succ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2887_ : string -> maybe ((mword ty4 * mword ty4))*)

val _ = Define `
 ((s2887_:string ->((4)words$word#(4)words$word)option) s2888_0=
    (let s2889_0 = s2888_0 in
   if ((string_startswith s2889_0 "fence")) then  
  (case ((string_drop s2889_0 ((string_length "fence")))) of
        s2890_0 =>
  (case ((spc_matches_prefix0 s2890_0)) of
        SOME ((() , s2891_0)) =>
  (case ((string_drop s2890_0 s2891_0)) of
        s2892_0 =>
  (case ((fence_bits_matches_prefix s2892_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s2893_0)) =>
  (case ((string_drop s2892_0 s2893_0)) of
        s2894_0 =>
  (case ((sep_matches_prefix s2894_0)) of
        SOME ((() , s2895_0)) =>
  (case ((string_drop s2894_0 s2895_0)) of
        s2896_0 =>
  (case ((fence_bits_matches_prefix s2896_0 : (( 4 words$word # ii)) option)) of
        SOME ((succ, s2897_0)) =>
  let p0_ = (string_drop s2896_0 s2897_0) in
  if (((p0_ = ""))) then SOME (pred, succ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2870_ : string -> maybe ((sopw * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2870_:string ->(sopw#(5)words$word#(5)words$word#(5)words$word)option) s2871_0= 
  ((case s2871_0 of
         s2872_0 =>
   (case ((shiftiwop_mnemonic_matches_prefix s2872_0)) of
         SOME ((op, s2873_0)) =>
   (case ((string_drop s2872_0 s2873_0)) of
         s2874_0 =>
   (case ((spc_matches_prefix0 s2874_0)) of
         SOME ((() , s2875_0)) =>
   (case ((string_drop s2874_0 s2875_0)) of
         s2876_0 =>
   (case ((reg_name_matches_prefix s2876_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2877_0)) =>
   (case ((string_drop s2876_0 s2877_0)) of
         s2878_0 =>
   (case ((sep_matches_prefix s2878_0)) of
         SOME ((() , s2879_0)) =>
   (case ((string_drop s2878_0 s2879_0)) of
         s2880_0 =>
   (case ((reg_name_matches_prefix s2880_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2881_0)) =>
   (case ((string_drop s2880_0 s2881_0)) of
         s2882_0 =>
   (case ((sep_matches_prefix s2882_0)) of
         SOME ((() , s2883_0)) =>
   (case ((string_drop s2882_0 s2883_0)) of
         s2884_0 =>
   (case ((hex_bits_5_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s2884_0 : (( 5 words$word # ii)) option)) of
         SOME ((shamt, s2885_0)) =>
   let p0_ = (string_drop s2884_0 s2885_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, shamt) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2853_ : string -> maybe ((ropw * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2853_:string ->(ropw#(5)words$word#(5)words$word#(5)words$word)option) s2854_0= 
  ((case s2854_0 of
         s2855_0 =>
   (case ((rtypew_mnemonic_matches_prefix s2855_0)) of
         SOME ((op, s2856_0)) =>
   (case ((string_drop s2855_0 s2856_0)) of
         s2857_0 =>
   (case ((spc_matches_prefix0 s2857_0)) of
         SOME ((() , s2858_0)) =>
   (case ((string_drop s2857_0 s2858_0)) of
         s2859_0 =>
   (case ((reg_name_matches_prefix s2859_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2860_0)) =>
   (case ((string_drop s2859_0 s2860_0)) of
         s2861_0 =>
   (case ((sep_matches_prefix s2861_0)) of
         SOME ((() , s2862_0)) =>
   (case ((string_drop s2861_0 s2862_0)) of
         s2863_0 =>
   (case ((reg_name_matches_prefix s2863_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2864_0)) =>
   (case ((string_drop s2863_0 s2864_0)) of
         s2865_0 =>
   (case ((sep_matches_prefix s2865_0)) of
         SOME ((() , s2866_0)) =>
   (case ((string_drop s2865_0 s2866_0)) of
         s2867_0 =>
   (case ((reg_name_matches_prefix s2867_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2868_0)) =>
   let p0_ = (string_drop s2867_0 s2868_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2836_ : string -> maybe ((sop * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2836_:string ->(sop#(5)words$word#(5)words$word#(5)words$word)option) s2837_0= 
  ((case s2837_0 of
         s2838_0 =>
   (case ((shiftw_mnemonic_matches_prefix s2838_0)) of
         SOME ((op, s2839_0)) =>
   (case ((string_drop s2838_0 s2839_0)) of
         s2840_0 =>
   (case ((spc_matches_prefix0 s2840_0)) of
         SOME ((() , s2841_0)) =>
   (case ((string_drop s2840_0 s2841_0)) of
         s2842_0 =>
   (case ((reg_name_matches_prefix s2842_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2843_0)) =>
   (case ((string_drop s2842_0 s2843_0)) of
         s2844_0 =>
   (case ((sep_matches_prefix s2844_0)) of
         SOME ((() , s2845_0)) =>
   (case ((string_drop s2844_0 s2845_0)) of
         s2846_0 =>
   (case ((reg_name_matches_prefix s2846_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2847_0)) =>
   (case ((string_drop s2846_0 s2847_0)) of
         s2848_0 =>
   (case ((sep_matches_prefix s2848_0)) of
         SOME ((() , s2849_0)) =>
   (case ((string_drop s2848_0 s2849_0)) of
         s2850_0 =>
   (case ((hex_bits_5_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s2850_0 : (( 5 words$word # ii)) option)) of
         SOME ((shamt, s2851_0)) =>
   let p0_ = (string_drop s2850_0 s2851_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, shamt) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2820_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s2820_:string ->((5)words$word#(5)words$word#(12)words$word)option) s2821_0=
    (let s2822_0 = s2821_0 in
   if ((string_startswith s2822_0 "addiw")) then  
  (case ((string_drop s2822_0 ((string_length "addiw")))) of
        s2823_0 =>
  (case ((spc_matches_prefix0 s2823_0)) of
        SOME ((() , s2824_0)) =>
  (case ((string_drop s2823_0 s2824_0)) of
        s2825_0 =>
  (case ((reg_name_matches_prefix s2825_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2826_0)) =>
  (case ((string_drop s2825_0 s2826_0)) of
        s2827_0 =>
  (case ((sep_matches_prefix s2827_0)) of
        SOME ((() , s2828_0)) =>
  (case ((string_drop s2827_0 s2828_0)) of
        s2829_0 =>
  (case ((reg_name_matches_prefix s2829_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s2830_0)) =>
  (case ((string_drop s2829_0 s2830_0)) of
        s2831_0 =>
  (case ((sep_matches_prefix s2831_0)) of
        SOME ((() , s2832_0)) =>
  (case ((string_drop s2831_0 s2832_0)) of
        s2833_0 =>
  (case ((hex_bits_12_matches_prefix0 s2833_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s2834_0)) =>
  let p0_ = (string_drop s2833_0 s2834_0) in
  if (((p0_ = ""))) then SOME (rd, rs1, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2792_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s2792_:string ->(word_width#bool#bool#(5)words$word#(12)words$word#(5)words$word)option) s2793_0=
    (let s2794_0 = s2793_0 in
   if ((string_startswith s2794_0 "s")) then  
  (case ((string_drop s2794_0 ((string_length "s")))) of
        s2795_0 =>
  (case ((size_mnemonic_matches_prefix s2795_0)) of
        SOME ((size1, s2796_0)) =>
  (case ((string_drop s2795_0 s2796_0)) of
        s2797_0 =>
  (case ((maybe_aq_matches_prefix s2797_0)) of
        SOME ((aq, s2798_0)) =>
  (case ((string_drop s2797_0 s2798_0)) of
        s2799_0 =>
  (case ((maybe_rl_matches_prefix s2799_0)) of
        SOME ((rl, s2800_0)) =>
  (case ((string_drop s2799_0 s2800_0)) of
        s2801_0 =>
  (case ((spc_matches_prefix0 s2801_0)) of
        SOME ((() , s2802_0)) =>
  (case ((string_drop s2801_0 s2802_0)) of
        s2803_0 =>
  (case ((reg_name_matches_prefix s2803_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s2804_0)) =>
  (case ((string_drop s2803_0 s2804_0)) of
        s2805_0 =>
  (case ((sep_matches_prefix s2805_0)) of
        SOME ((() , s2806_0)) =>
  (case ((string_drop s2805_0 s2806_0)) of
        s2807_0 =>
  (case ((hex_bits_12_matches_prefix0 s2807_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s2808_0)) =>
  (case ((string_drop s2807_0 s2808_0)) of
        s2809_0 =>
  (case ((opt_spc_matches_prefix0 s2809_0)) of
        SOME ((() , s2810_0)) =>
  let s2811_0 = (string_drop s2809_0 s2810_0) in
  if ((string_startswith s2811_0 "(")) then
    (case ((string_drop s2811_0 ((string_length "(")))) of
          s2812_0 =>
    (case ((opt_spc_matches_prefix0 s2812_0)) of
          SOME ((() , s2813_0)) =>
    (case ((string_drop s2812_0 s2813_0)) of
          s2814_0 =>
    (case ((reg_name_matches_prefix s2814_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s2815_0)) =>
    (case ((string_drop s2814_0 s2815_0)) of
          s2816_0 =>
    (case ((opt_spc_matches_prefix0 s2816_0)) of
          SOME ((() , s2817_0)) =>
    let s2818_0 = (string_drop s2816_0 s2817_0) in
    if ((string_startswith s2818_0 ")")) then
      let p0_ = (string_drop s2818_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (size1, aq, rl, rs2, imm, rs1) else NONE
    else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2762_ : string -> maybe ((word_width * bool * bool * bool * mword ty5 * mword ty12 * mword ty5))*)

val _ = Define `
 ((s2762_:string ->(word_width#bool#bool#bool#(5)words$word#(12)words$word#(5)words$word)option) s2763_0=
    (let s2764_0 = s2763_0 in
   if ((string_startswith s2764_0 "l")) then  
  (case ((string_drop s2764_0 ((string_length "l")))) of
        s2765_0 =>
  (case ((size_mnemonic_matches_prefix s2765_0)) of
        SOME ((size1, s2766_0)) =>
  (case ((string_drop s2765_0 s2766_0)) of
        s2767_0 =>
  (case ((maybe_u_matches_prefix s2767_0)) of
        SOME ((is_unsigned, s2768_0)) =>
  (case ((string_drop s2767_0 s2768_0)) of
        s2769_0 =>
  (case ((maybe_aq_matches_prefix s2769_0)) of
        SOME ((aq, s2770_0)) =>
  (case ((string_drop s2769_0 s2770_0)) of
        s2771_0 =>
  (case ((maybe_rl_matches_prefix s2771_0)) of
        SOME ((rl, s2772_0)) =>
  (case ((string_drop s2771_0 s2772_0)) of
        s2773_0 =>
  (case ((spc_matches_prefix0 s2773_0)) of
        SOME ((() , s2774_0)) =>
  (case ((string_drop s2773_0 s2774_0)) of
        s2775_0 =>
  (case ((reg_name_matches_prefix s2775_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2776_0)) =>
  (case ((string_drop s2775_0 s2776_0)) of
        s2777_0 =>
  (case ((sep_matches_prefix s2777_0)) of
        SOME ((() , s2778_0)) =>
  (case ((string_drop s2777_0 s2778_0)) of
        s2779_0 =>
  (case ((hex_bits_12_matches_prefix0 s2779_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s2780_0)) =>
  (case ((string_drop s2779_0 s2780_0)) of
        s2781_0 =>
  (case ((opt_spc_matches_prefix0 s2781_0)) of
        SOME ((() , s2782_0)) =>
  let s2783_0 = (string_drop s2781_0 s2782_0) in
  if ((string_startswith s2783_0 "(")) then
    (case ((string_drop s2783_0 ((string_length "(")))) of
          s2784_0 =>
    (case ((opt_spc_matches_prefix0 s2784_0)) of
          SOME ((() , s2785_0)) =>
    (case ((string_drop s2784_0 s2785_0)) of
          s2786_0 =>
    (case ((reg_name_matches_prefix s2786_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s2787_0)) =>
    (case ((string_drop s2786_0 s2787_0)) of
          s2788_0 =>
    (case ((opt_spc_matches_prefix0 s2788_0)) of
          SOME ((() , s2789_0)) =>
    let s2790_0 = (string_drop s2788_0 s2789_0) in
    if ((string_startswith s2790_0 ")")) then
      let p0_ = (string_drop s2790_0 ((string_length ")"))) in
      if (((p0_ = ""))) then SOME (size1, is_unsigned, aq, rl, rd, imm, rs1)
      else NONE else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2745_ : string -> maybe ((rop * mword ty5 * mword ty5 * mword ty5))*)

val _ = Define `
 ((s2745_:string ->(rop#(5)words$word#(5)words$word#(5)words$word)option) s2746_0= 
  ((case s2746_0 of
         s2747_0 =>
   (case ((rtype_mnemonic_matches_prefix s2747_0)) of
         SOME ((op, s2748_0)) =>
   (case ((string_drop s2747_0 s2748_0)) of
         s2749_0 =>
   (case ((spc_matches_prefix0 s2749_0)) of
         SOME ((() , s2750_0)) =>
   (case ((string_drop s2749_0 s2750_0)) of
         s2751_0 =>
   (case ((reg_name_matches_prefix s2751_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2752_0)) =>
   (case ((string_drop s2751_0 s2752_0)) of
         s2753_0 =>
   (case ((sep_matches_prefix s2753_0)) of
         SOME ((() , s2754_0)) =>
   (case ((string_drop s2753_0 s2754_0)) of
         s2755_0 =>
   (case ((reg_name_matches_prefix s2755_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2756_0)) =>
   (case ((string_drop s2755_0 s2756_0)) of
         s2757_0 =>
   (case ((sep_matches_prefix s2757_0)) of
         SOME ((() , s2758_0)) =>
   (case ((string_drop s2757_0 s2758_0)) of
         s2759_0 =>
   (case ((reg_name_matches_prefix s2759_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2760_0)) =>
   let p0_ = (string_drop s2759_0 s2760_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, rs2) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2728_ : string -> maybe ((sop * mword ty5 * mword ty5 * mword ty6))*)

val _ = Define `
 ((s2728_:string ->(sop#(5)words$word#(5)words$word#(6)words$word)option) s2729_0= 
  ((case s2729_0 of
         s2730_0 =>
   (case ((shiftiop_mnemonic_matches_prefix s2730_0)) of
         SOME ((op, s2731_0)) =>
   (case ((string_drop s2730_0 s2731_0)) of
         s2732_0 =>
   (case ((spc_matches_prefix0 s2732_0)) of
         SOME ((() , s2733_0)) =>
   (case ((string_drop s2732_0 s2733_0)) of
         s2734_0 =>
   (case ((reg_name_matches_prefix s2734_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2735_0)) =>
   (case ((string_drop s2734_0 s2735_0)) of
         s2736_0 =>
   (case ((sep_matches_prefix s2736_0)) of
         SOME ((() , s2737_0)) =>
   (case ((string_drop s2736_0 s2737_0)) of
         s2738_0 =>
   (case ((reg_name_matches_prefix s2738_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2739_0)) =>
   (case ((string_drop s2738_0 s2739_0)) of
         s2740_0 =>
   (case ((sep_matches_prefix s2740_0)) of
         SOME ((() , s2741_0)) =>
   (case ((string_drop s2740_0 s2741_0)) of
         s2742_0 =>
   (case ((hex_bits_6_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s2742_0 : (( 6 words$word # ii)) option)) of
         SOME ((shamt, s2743_0)) =>
   let p0_ = (string_drop s2742_0 s2743_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, shamt) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2711_ : string -> maybe ((iop * mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s2711_:string ->(iop#(5)words$word#(5)words$word#(12)words$word)option) s2712_0= 
  ((case s2712_0 of
         s2713_0 =>
   (case ((itype_mnemonic_matches_prefix s2713_0)) of
         SOME ((op, s2714_0)) =>
   (case ((string_drop s2713_0 s2714_0)) of
         s2715_0 =>
   (case ((spc_matches_prefix0 s2715_0)) of
         SOME ((() , s2716_0)) =>
   (case ((string_drop s2715_0 s2716_0)) of
         s2717_0 =>
   (case ((reg_name_matches_prefix s2717_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2718_0)) =>
   (case ((string_drop s2717_0 s2718_0)) of
         s2719_0 =>
   (case ((sep_matches_prefix s2719_0)) of
         SOME ((() , s2720_0)) =>
   (case ((string_drop s2719_0 s2720_0)) of
         s2721_0 =>
   (case ((reg_name_matches_prefix s2721_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2722_0)) =>
   (case ((string_drop s2721_0 s2722_0)) of
         s2723_0 =>
   (case ((sep_matches_prefix s2723_0)) of
         SOME ((() , s2724_0)) =>
   (case ((string_drop s2723_0 s2724_0)) of
         s2725_0 =>
   (case ((hex_bits_12_matches_prefix0 s2725_0
          : (( 12 words$word # ii)) option)) of
         SOME ((imm, s2726_0)) =>
   let p0_ = (string_drop s2725_0 s2726_0) in
   if (((p0_ = ""))) then SOME (op, rd, rs1, imm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2694_ : string -> maybe ((bop * mword ty5 * mword ty5 * mword ty13))*)

val _ = Define `
 ((s2694_:string ->(bop#(5)words$word#(5)words$word#(13)words$word)option) s2695_0= 
  ((case s2695_0 of
         s2696_0 =>
   (case ((btype_mnemonic_matches_prefix s2696_0)) of
         SOME ((op, s2697_0)) =>
   (case ((string_drop s2696_0 s2697_0)) of
         s2698_0 =>
   (case ((spc_matches_prefix0 s2698_0)) of
         SOME ((() , s2699_0)) =>
   (case ((string_drop s2698_0 s2699_0)) of
         s2700_0 =>
   (case ((reg_name_matches_prefix s2700_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s2701_0)) =>
   (case ((string_drop s2700_0 s2701_0)) of
         s2702_0 =>
   (case ((sep_matches_prefix s2702_0)) of
         SOME ((() , s2703_0)) =>
   (case ((string_drop s2702_0 s2703_0)) of
         s2704_0 =>
   (case ((reg_name_matches_prefix s2704_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s2705_0)) =>
   (case ((string_drop s2704_0 s2705_0)) of
         s2706_0 =>
   (case ((sep_matches_prefix s2706_0)) of
         SOME ((() , s2707_0)) =>
   (case ((string_drop s2706_0 s2707_0)) of
         s2708_0 =>
   (case ((hex_bits_13_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s2708_0 : (( 13 words$word # ii)) option)) of
         SOME ((imm, s2709_0)) =>
   let p0_ = (string_drop s2708_0 s2709_0) in
   if (((p0_ = ""))) then SOME (op, rs1, rs2, imm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s2678_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12))*)

val _ = Define `
 ((s2678_:string ->((5)words$word#(5)words$word#(12)words$word)option) s2679_0=
    (let s2680_0 = s2679_0 in
   if ((string_startswith s2680_0 "jalr")) then  
  (case ((string_drop s2680_0 ((string_length "jalr")))) of
        s2681_0 =>
  (case ((spc_matches_prefix0 s2681_0)) of
        SOME ((() , s2682_0)) =>
  (case ((string_drop s2681_0 s2682_0)) of
        s2683_0 =>
  (case ((reg_name_matches_prefix s2683_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2684_0)) =>
  (case ((string_drop s2683_0 s2684_0)) of
        s2685_0 =>
  (case ((sep_matches_prefix s2685_0)) of
        SOME ((() , s2686_0)) =>
  (case ((string_drop s2685_0 s2686_0)) of
        s2687_0 =>
  (case ((reg_name_matches_prefix s2687_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s2688_0)) =>
  (case ((string_drop s2687_0 s2688_0)) of
        s2689_0 =>
  (case ((sep_matches_prefix s2689_0)) of
        SOME ((() , s2690_0)) =>
  (case ((string_drop s2689_0 s2690_0)) of
        s2691_0 =>
  (case ((hex_bits_12_matches_prefix0 s2691_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s2692_0)) =>
  let p0_ = (string_drop s2691_0 s2692_0) in
  if (((p0_ = ""))) then SOME (rd, rs1, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2666_ : string -> maybe ((mword ty5 * mword ty21))*)

val _ = Define `
 ((s2666_:string ->((5)words$word#(21)words$word)option) s2667_0=
    (let s2668_0 = s2667_0 in
   if ((string_startswith s2668_0 "jal")) then  
  (case ((string_drop s2668_0 ((string_length "jal")))) of
        s2669_0 =>
  (case ((spc_matches_prefix0 s2669_0)) of
        SOME ((() , s2670_0)) =>
  (case ((string_drop s2669_0 s2670_0)) of
        s2671_0 =>
  (case ((reg_name_matches_prefix s2671_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s2672_0)) =>
  (case ((string_drop s2671_0 s2672_0)) of
        s2673_0 =>
  (case ((sep_matches_prefix s2673_0)) of
        SOME ((() , s2674_0)) =>
  (case ((string_drop s2673_0 s2674_0)) of
        s2675_0 =>
  (case ((hex_bits_21_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s2675_0 : (( 21 words$word # ii)) option)) of
        SOME ((imm, s2676_0)) =>
  let p0_ = (string_drop s2675_0 s2676_0) in
  if (((p0_ = ""))) then SOME (rd, imm) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s2653_ : string -> maybe ((uop * mword ty5 * mword ty20))*)

val _ = Define `
 ((s2653_:string ->(uop#(5)words$word#(20)words$word)option) s2654_0= 
  ((case s2654_0 of
         s2655_0 =>
   (case ((utype_mnemonic_matches_prefix s2655_0)) of
         SOME ((op, s2656_0)) =>
   (case ((string_drop s2655_0 s2656_0)) of
         s2657_0 =>
   (case ((spc_matches_prefix0 s2657_0)) of
         SOME ((() , s2658_0)) =>
   (case ((string_drop s2657_0 s2658_0)) of
         s2659_0 =>
   (case ((reg_name_matches_prefix s2659_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s2660_0)) =>
   (case ((string_drop s2659_0 s2660_0)) of
         s2661_0 =>
   (case ((sep_matches_prefix s2661_0)) of
         SOME ((() , s2662_0)) =>
   (case ((string_drop s2661_0 s2662_0)) of
         s2663_0 =>
   (case ((hex_bits_20_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s2663_0 : (( 20 words$word # ii)) option)) of
         SOME ((imm, s2664_0)) =>
   let p0_ = (string_drop s2663_0 s2664_0) in
   if (((p0_ = ""))) then SOME (op, rd, imm) else NONE
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((assembly_backwards_matches:string -> bool) arg_=
    (let s2665_0 = arg_ in
   if ((case ((s2653_ s2665_0  :  ((uop #  5 words$word #  20 words$word))option)) of
       SOME ((op, rd, imm)) => T
     | _ => F
     )) then  (case (s2653_ s2665_0 : (( uop # 5 words$word # 20 words$word)) option) of
     (SOME ((op, rd, imm))) =>
 T
 )
   else if ((case ((s2666_ s2665_0  :  (( 5 words$word #  21 words$word))option)) of
       SOME ((rd, imm)) => T
     | _ => F
     )) then  (case (s2666_ s2665_0 : (( 5 words$word # 21 words$word)) option) of
     (SOME ((rd, imm))) =>
 T
 )
   else if ((case ((s2678_ s2665_0  :  (( 5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((rd, rs1, imm)) => T
     | _ => F
     )) then  (case (s2678_ s2665_0 : (( 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((rd, rs1, imm))) =>
 T
 )
   else if ((case ((s2694_ s2665_0  :  ((bop #  5 words$word #  5 words$word #  13 words$word))option)) of
       SOME ((op, rs1, rs2, imm)) => T
     | _ => F
     )) then  (case
 (s2694_ s2665_0 : (( bop # 5 words$word # 5 words$word # 13 words$word)) option) of
     (SOME ((op, rs1, rs2, imm))) =>
 T
 )
   else if ((case ((s2711_ s2665_0  :  ((iop #  5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((op, rd, rs1, imm)) => T
     | _ => F
     )) then  (case
 (s2711_ s2665_0 : (( iop # 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((op, rd, rs1, imm))) =>
 T
 )
   else if ((case ((s2728_ s2665_0  :  ((sop #  5 words$word #  5 words$word #  6 words$word))option)) of
       SOME ((op, rd, rs1, shamt)) => T
     | _ => F
     )) then  (case
 (s2728_ s2665_0 : (( sop # 5 words$word # 5 words$word # 6 words$word)) option) of
     (SOME ((op, rd, rs1, shamt))) =>
 T
 )
   else if ((case ((s2745_ s2665_0  :  ((rop #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2745_ s2665_0 : (( rop # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s2762_ s2665_0
                     :  ((word_width # bool # bool # bool #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((size1, is_unsigned, aq, rl, rd, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s2762_ s2665_0
 : (( word_width # bool # bool # bool # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((size1, is_unsigned, aq, rl, rd, imm, rs1))) =>
 T
 )
   else if ((case ((s2792_ s2665_0
                     :  ((word_width # bool # bool #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((size1, aq, rl, rs2, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s2792_ s2665_0 : (( word_width # bool # bool # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((size1, aq, rl, rs2, imm, rs1))) =>
 T
 )
   else if ((case ((s2820_ s2665_0  :  (( 5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((rd, rs1, imm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s2820_ s2665_0 : (( 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((rd, rs1, imm))) =>
 T
 )
   else if ((case ((s2836_ s2665_0  :  ((sop #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, shamt)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s2836_ s2665_0 : (( sop # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, shamt))) =>
 T
 )
   else if ((case ((s2853_ s2665_0  :  ((ropw #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s2853_ s2665_0 : (( ropw # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s2870_ s2665_0  :  ((sopw #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, rd, rs1, shamt)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s2870_ s2665_0 : (( sopw # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, rd, rs1, shamt))) =>
 T
 )
   else if ((case ((s2887_ s2665_0  :  (( 4 words$word #  4 words$word))option)) of
       SOME ((pred, succ)) => T
     | _ => F
     )) then  (case (s2887_ s2665_0 : (( 4 words$word # 4 words$word)) option) of
     (SOME ((pred, succ))) =>
 T
 )
   else if ((case ((s2899_ s2665_0  :  (( 4 words$word #  4 words$word))option)) of
       SOME ((pred, succ)) => T
     | _ => F
     )) then  (case (s2899_ s2665_0 : (( 4 words$word # 4 words$word)) option) of
     (SOME ((pred, succ))) =>
 T
 )
   else if (((s2665_0 = "fence.i"))) then T
   else if (((s2665_0 = "ecall"))) then T
   else if (((s2665_0 = "mret"))) then T
   else if (((s2665_0 = "sret"))) then T
   else if (((s2665_0 = "ebreak"))) then T
   else if (((s2665_0 = "wfi"))) then T
   else if ((case ((s2911_ s2665_0  :  (( 5 words$word #  5 words$word))option)) of
       SOME ((rs1, rs2)) => T
     | _ => F
     )) then  (case (s2911_ s2665_0 : (( 5 words$word # 5 words$word)) option) of
     (SOME ((rs1, rs2))) =>
 T
 )
   else if ((case ((s2923_ s2665_0  :  ((word_width # bool # bool #  5 words$word #  5 words$word))option)) of
       SOME ((size1, aq, rl, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s2923_ s2665_0 : (( word_width # bool # bool # 5 words$word # 5 words$word)) option) of
     (SOME ((size1, aq, rl, rd, rs1))) =>
 T
 )
   else if ((case ((s2941_ s2665_0
                     :  ((word_width # bool # bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((size1, aq, rl, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s2941_ s2665_0 : (( word_width # bool # bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((size1, aq, rl, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s2963_ s2665_0
                     :  ((amoop # word_width # bool # bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((op, width, aq, rl, rd, rs2, rs1)) => T
     | _ => F
     )) then  (case
 (s2963_ s2665_0
 : (( amoop # word_width # bool # bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((op, width, aq, rl, rd, rs2, rs1))) =>
 T
 )
   else if (((s2665_0 = "c.nop"))) then T
   else if ((case ((s2989_ s2665_0  :  (( 3 words$word #  8 words$word))option)) of
       SOME ((rdc, nzimm)) => (nzimm <> (0x00w :  8 words$word))
     | _ => F
     )) then  (case (s2989_ s2665_0 : (( 3 words$word # 8 words$word)) option) of
     (SOME ((rdc, nzimm))) =>
 T
 )
   else if ((case ((s3001_ s2665_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rdc, rsc, uimm)) => T
     | _ => F
     )) then  (case
 (s3001_ s2665_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rdc, rsc, uimm))) =>
 T
 )
   else if ((case ((s3017_ s2665_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rdc, rsc, uimm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s3017_ s2665_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rdc, rsc, uimm))) =>
 T
 )
   else if ((case ((s3033_ s2665_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rsc1, rsc2, uimm)) => T
     | _ => F
     )) then  (case
 (s3033_ s2665_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rsc1, rsc2, uimm))) =>
 T
 )
   else if ((case ((s3049_ s2665_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rsc1, rsc2, uimm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s3049_ s2665_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rsc1, rsc2, uimm))) =>
 T
 )
   else if ((case ((s3065_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, nzi)) => ((((nzi <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))
     | _ => F
     )) then  (case (s3065_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, nzi))) =>
 T
 )
   else if ((case ((s3077_ s2665_0  :  ( 11 words$word)option)) of
       SOME (imm) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s3077_ s2665_0 : ( 11 words$word) option) of (SOME (imm)) => T )
   else if ((case ((s3085_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, imm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s3085_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, imm))) =>
 T
 )
   else if ((case ((s3097_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, imm)) => (rd <> zreg)
     | _ => F
     )) then  (case (s3097_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, imm))) =>
 T
 )
   else if ((case ((s3109_ s2665_0  :  ( 6 words$word)option)) of
       SOME (imm) => (imm <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s3109_ s2665_0 : ( 6 words$word) option) of (SOME (imm)) => T )
   else if ((case ((s3117_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, imm)) =>
        ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((imm <> (0b000000w :  6 words$word))))))))
     | _ => F
     )) then  (case (s3117_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, imm))) =>
 T
 )
   else if ((case ((s3129_ s2665_0  :  (( 3 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => (shamt <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s3129_ s2665_0 : (( 3 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 T
 )
   else if ((case ((s3141_ s2665_0  :  (( 3 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => (shamt <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s3141_ s2665_0 : (( 3 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 T
 )
   else if ((case ((s3153_ s2665_0  :  (( 3 words$word #  6 words$word))option)) of
       SOME ((rsd, imm)) => T
     | _ => F
     )) then  (case (s3153_ s2665_0 : (( 3 words$word # 6 words$word)) option) of
     (SOME ((rsd, imm))) =>
 T
 )
   else if ((case ((s3165_ s2665_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s3165_ s2665_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3177_ s2665_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s3177_ s2665_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3189_ s2665_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s3189_ s2665_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3201_ s2665_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => T
     | _ => F
     )) then  (case (s3201_ s2665_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3213_ s2665_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s3213_ s2665_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3225_ s2665_0  :  (( 3 words$word #  3 words$word))option)) of
       SOME ((rsd, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s3225_ s2665_0 : (( 3 words$word # 3 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3237_ s2665_0  :  ( 11 words$word)option)) of
       SOME (imm) => T
     | _ => F
     )) then  (case (s3237_ s2665_0 : ( 11 words$word) option) of (SOME (imm)) => T )
   else if ((case ((s3245_ s2665_0  :  (( 3 words$word #  8 words$word))option)) of
       SOME ((rs, imm)) => T
     | _ => F
     )) then  (case (s3245_ s2665_0 : (( 3 words$word # 8 words$word)) option) of
     (SOME ((rs, imm))) =>
 T
 )
   else if ((case ((s3257_ s2665_0  :  (( 3 words$word #  8 words$word))option)) of
       SOME ((rs, imm)) => T
     | _ => F
     )) then  (case (s3257_ s2665_0 : (( 3 words$word # 8 words$word)) option) of
     (SOME ((rs, imm))) =>
 T
 )
   else if ((case ((s3269_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => ((((shamt <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))
     | _ => F
     )) then  (case (s3269_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 T
 )
   else if ((case ((s3281_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => (rd <> zreg)
     | _ => F
     )) then  (case (s3281_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 T
 )
   else if ((case ((s3293_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => ((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))
     | _ => F
     )) then  (case (s3293_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 T
 )
   else if ((case ((s3305_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => T
     | _ => F
     )) then  (case (s3305_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 T
 )
   else if ((case ((s3317_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rs2, uimm)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s3317_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rs2, uimm))) =>
 T
 )
   else if ((case ((s3329_ s2665_0  :  ( 5 words$word)option)) of
       SOME (rs1) => (rs1 <> zreg)
     | _ => F
     )) then  (case (s3329_ s2665_0 : ( 5 words$word) option) of (SOME (rs1)) => T )
   else if ((case ((s3337_ s2665_0  :  ( 5 words$word)option)) of
       SOME (rs1) => (rs1 <> zreg)
     | _ => F
     )) then  (case (s3337_ s2665_0 : ( 5 words$word) option) of (SOME (rs1)) => T )
   else if ((case ((s3345_ s2665_0  :  (( 5 words$word #  5 words$word))option)) of
       SOME ((rd, rs2)) => ((((rd <> zreg))) /\ (((rs2 <> zreg))))
     | _ => F
     )) then  (case (s3345_ s2665_0 : (( 5 words$word # 5 words$word)) option) of
     (SOME ((rd, rs2))) =>
 T
 )
   else if (((s2665_0 = "c.ebreak"))) then T
   else if ((case ((s3357_ s2665_0  :  (( 5 words$word #  5 words$word))option)) of
       SOME ((rsd, rs2)) => ((((rsd <> zreg))) /\ (((rs2 <> zreg))))
     | _ => F
     )) then  (case (s3357_ s2665_0 : (( 5 words$word # 5 words$word)) option) of
     (SOME ((rsd, rs2))) =>
 T
 )
   else if ((case ((s3369_ s2665_0
                     :  ((bool # bool # bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((high, signed1, signed2, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3369_ s2665_0 : (( bool # bool # bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((high, signed1, signed2, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3386_ s2665_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3386_ s2665_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3404_ s2665_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3404_ s2665_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3422_ s2665_0  :  (( 5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s3422_ s2665_0 : (( 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3438_ s2665_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s3438_ s2665_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3457_ s2665_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((s, rd, rs1, rs2)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s3457_ s2665_0 : (( bool # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((s, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3476_ s2665_0  :  ((csrop #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((op, rd, csr, rs1)) => T
     | _ => F
     )) then  (case
 (s3476_ s2665_0 : (( csrop # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((op, rd, csr, rs1))) =>
 T
 )
   else if ((case ((s3494_ s2665_0  :  ((csrop #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((op, rd, csr, rs1)) => T
     | _ => F
     )) then  (case
 (s3494_ s2665_0 : (( csrop # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((op, rd, csr, rs1))) =>
 T
 )
   else if (((s2665_0 = "uret"))) then T
   else if ((case ((s3511_ s2665_0  :  ( 6 words$word)option)) of
       SOME (imm) => T
     | _ => F
     )) then  (case (s3511_ s2665_0 : ( 6 words$word) option) of (SOME (imm)) => T )
   else if ((case ((s3517_ s2665_0  :  ( 5 words$word)option)) of
       SOME (rsd) => (rsd <> zreg)
     | _ => F
     )) then  (case (s3517_ s2665_0 : ( 5 words$word) option) of (SOME (rsd)) => T )
   else if ((case ((s3523_ s2665_0  :  ( 6 words$word)option)) of
       SOME (imm) => T
     | _ => F
     )) then  (case (s3523_ s2665_0 : ( 6 words$word) option) of (SOME (imm)) => T )
   else if ((case ((s3529_ s2665_0  :  ( 6 words$word)option)) of
       SOME (imm) => (imm <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s3529_ s2665_0 : ( 6 words$word) option) of (SOME (imm)) => T )
   else if ((case ((s3535_ s2665_0  :  ( 5 words$word)option)) of
       SOME (rs2) => (rs2 <> zreg)
     | _ => F
     )) then  (case (s3535_ s2665_0 : ( 5 words$word) option) of (SOME (rs2)) => T )
   else if ((case ((s3541_ s2665_0  :  ( 5 words$word)option)) of
       SOME (rs2) => (rs2 <> zreg)
     | _ => F
     )) then  (case (s3541_ s2665_0 : ( 5 words$word) option) of (SOME (rs2)) => T )
   else if ((case ((s3547_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rsd, shamt)) => ((((shamt = (0b000000w :  6 words$word)))) \/ (((rsd = zreg))))
     | _ => F
     )) then  (case (s3547_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rsd, shamt))) =>
 T
 )
   else if ((case ((s3556_ s2665_0  :  ( 3 words$word)option)) of
       SOME (rsd) => T
     | _ => F
     )) then  (case (s3556_ s2665_0 : ( 3 words$word) option) of (SOME (rsd)) => T )
   else if ((case ((s3562_ s2665_0  :  ( 3 words$word)option)) of
       SOME (rsd) => T
     | _ => F
     )) then  (case (s3562_ s2665_0 : ( 3 words$word) option) of (SOME (rsd)) => T )
   else if ((case ((s3568_ s2665_0
                     :  (( 4 words$word #  4 words$word #  5 words$word #  5 words$word #  4 words$word))option)) of
       SOME ((pred, succ, rs, rd, fm)) =>
        (((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word))))))))
     | _ => F
     )) then  (case
 (s3568_ s2665_0 : (( 4 words$word # 4 words$word # 5 words$word # 5 words$word # 4 words$word)) option) of
     (SOME ((pred, succ, rs, rd, fm))) =>
 T
 )
   else if ((case ((s3586_ s2665_0  :  (( 5 words$word #  5 words$word #  12 words$word))option)) of
       SOME ((rd, rs, imm)) =>
        ((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg)))))))
     | _ => F
     )) then  (case (s3586_ s2665_0 : (( 5 words$word # 5 words$word # 12 words$word)) option) of
     (SOME ((rd, rs, imm))) =>
 T
 )
   else if ((case ((s3598_ s2665_0  :  ((word_width #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((width, rd, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s3598_ s2665_0 : (( word_width # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((width, rd, imm, rs1))) =>
 T
 )
   else if ((case ((s3622_ s2665_0  :  ((word_width #  5 words$word #  12 words$word #  5 words$word))option)) of
       SOME ((width, rs2, imm, rs1)) => T
     | _ => F
     )) then  (case
 (s3622_ s2665_0 : (( word_width # 5 words$word # 12 words$word # 5 words$word)) option) of
     (SOME ((width, rs2, imm, rs1))) =>
 T
 )
   else if ((case ((s3646_ s2665_0
                     :  ((f_madd_op_S #  5 words$word #  5 words$word #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((op, rd, rs1, rs2, rs3, rm)) => T
     | _ => F
     )) then  (case
 (s3646_ s2665_0
 : (( f_madd_op_S # 5 words$word # 5 words$word # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((op, rd, rs1, rs2, rs3, rm))) =>
 T
 )
   else if ((case ((s3671_ s2665_0
                     :  ((f_bin_rm_op_S #  5 words$word #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((op, rd, rs1, rs2, rm)) => T
     | _ => F
     )) then  (case
 (s3671_ s2665_0
 : (( f_bin_rm_op_S # 5 words$word # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((op, rd, rs1, rs2, rm))) =>
 T
 )
   else if ((case ((s3692_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FSQRT_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3692_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FSQRT_S, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3709_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_W_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3709_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_W_S, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3726_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_WU_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3726_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_WU_S, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3743_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_W, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3743_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_W, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3760_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_WU, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3760_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_WU, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3777_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_L_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3777_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_L_S, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3794_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_LU_S, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3794_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_LU_S, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3811_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_L, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3811_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_L, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3828_ s2665_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode))option)) of
       SOME ((FCVT_S_LU, rd, rs1, rm)) => T
     | _ => F
     )) then  (case
 (s3828_ s2665_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode)) option) of
     (SOME ((FCVT_S_LU, rd, rs1, rm))) =>
 T
 )
   else if ((case ((s3845_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FSGNJ_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3845_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FSGNJ_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3862_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FSGNJN_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3862_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FSGNJN_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3879_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FSGNJX_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3879_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FSGNJX_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3896_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FMIN_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3896_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FMIN_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3913_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FMAX_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3913_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FMAX_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3930_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FEQ_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3930_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FEQ_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3947_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FLT_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3947_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FLT_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3964_ s2665_0  :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word))option)) of
       SOME ((FLE_S, rd, rs1, rs2)) => T
     | _ => F
     )) then  (case
 (s3964_ s2665_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word)) option) of
     (SOME ((FLE_S, rd, rs1, rs2))) =>
 T
 )
   else if ((case ((s3981_ s2665_0  :  ((f_un_op_S #  5 words$word #  5 words$word))option)) of
       SOME ((FMV_X_W, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s3981_ s2665_0 : (( f_un_op_S # 5 words$word # 5 words$word)) option) of
     (SOME ((FMV_X_W, rd, rs1))) =>
 T
 )
   else if ((case ((s3994_ s2665_0  :  ((f_un_op_S #  5 words$word #  5 words$word))option)) of
       SOME ((FMV_W_X, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s3994_ s2665_0 : (( f_un_op_S # 5 words$word # 5 words$word)) option) of
     (SOME ((FMV_W_X, rd, rs1))) =>
 T
 )
   else if ((case ((s4007_ s2665_0  :  ((f_un_op_S #  5 words$word #  5 words$word))option)) of
       SOME ((FCLASS_S, rd, rs1)) => T
     | _ => F
     )) then  (case
 (s4007_ s2665_0 : (( f_un_op_S # 5 words$word # 5 words$word)) option) of
     (SOME ((FCLASS_S, rd, rs1))) =>
 T
 )
   else if ((case ((s4020_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, imm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s4020_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, imm))) =>
 T
 )
   else if ((case ((s4032_ s2665_0  :  (( 5 words$word #  6 words$word))option)) of
       SOME ((rd, uimm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s4032_ s2665_0 : (( 5 words$word # 6 words$word)) option) of
     (SOME ((rd, uimm))) =>
 T
 )
   else if ((case ((s4044_ s2665_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rdc, rsc, uimm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case
 (s4044_ s2665_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rdc, rsc, uimm))) =>
 T
 )
   else if ((case ((s4060_ s2665_0  :  (( 3 words$word #  3 words$word #  5 words$word))option)) of
       SOME ((rsc1, rsc2, uimm)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case
 (s4060_ s2665_0 : (( 3 words$word # 3 words$word # 5 words$word)) option) of
     (SOME ((rsc1, rsc2, uimm))) =>
 T
 )
   else if ((case ((s4076_ s2665_0  :  ( 32 words$word)option)) of   SOME (s) => T | _ => F ))
   then  (case (s4076_ s2665_0 : ( 32 words$word) option) of (SOME (s)) => T )
   else if ((case ((s4084_ s2665_0  :  ( 16 words$word)option)) of   SOME (s) => T | _ => F ))
   then  (case (s4084_ s2665_0 : ( 16 words$word) option) of (SOME (s)) => T )
   else F))`;


(*val _s5559_ : string -> maybe ((mword ty16 * string))*)

val _ = Define `
 ((s5559_:string ->((16)words$word#string)option) s5560_0=
    (let s5561_0 = s5560_0 in
   if ((string_startswith s5561_0 "c.illegal")) then  
  (case ((string_drop s5561_0 ((string_length "c.illegal")))) of
        s5562_0 =>
  (case ((spc_matches_prefix0 s5562_0)) of
        SOME ((() , s5563_0)) =>
  (case ((string_drop s5562_0 s5563_0)) of
        s5564_0 =>
  (case ((hex_bits_16_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5564_0 : (( 16 words$word # ii)) option)) of
        SOME ((s, s5565_0)) =>
  (case ((string_drop s5564_0 s5565_0)) of   s_ => SOME (s, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5551_ : string -> maybe ((mword ty32 * string))*)

val _ = Define `
 ((s5551_:string ->((32)words$word#string)option) s5552_0=
    (let s5553_0 = s5552_0 in
   if ((string_startswith s5553_0 "illegal")) then  
  (case ((string_drop s5553_0 ((string_length "illegal")))) of
        s5554_0 =>
  (case ((spc_matches_prefix0 s5554_0)) of
        SOME ((() , s5555_0)) =>
  (case ((string_drop s5554_0 s5555_0)) of
        s5556_0 =>
  (case ((hex_bits_32_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5556_0 : (( 32 words$word # ii)) option)) of
        SOME ((s, s5557_0)) =>
  (case ((string_drop s5556_0 s5557_0)) of   s_ => SOME (s, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5535_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5 * string))*)

val _ = Define `
 ((s5535_:string ->((3)words$word#(3)words$word#(5)words$word#string)option) s5536_0=
    (let s5537_0 = s5536_0 in
   if ((string_startswith s5537_0 "c.fsw")) then  
  (case ((string_drop s5537_0 ((string_length "c.fsw")))) of
        s5538_0 =>
  (case ((spc_matches_prefix0 s5538_0)) of
        SOME ((() , s5539_0)) =>
  (case ((string_drop s5538_0 s5539_0)) of
        s5540_0 =>
  (case ((creg_name_matches_prefix s5540_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s5541_0)) =>
  (case ((string_drop s5540_0 s5541_0)) of
        s5542_0 =>
  (case ((sep_matches_prefix s5542_0)) of
        SOME ((() , s5543_0)) =>
  (case ((string_drop s5542_0 s5543_0)) of
        s5544_0 =>
  (case ((creg_name_matches_prefix s5544_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s5545_0)) =>
  (case ((string_drop s5544_0 s5545_0)) of
        s5546_0 =>
  (case ((sep_matches_prefix s5546_0)) of
        SOME ((() , s5547_0)) =>
  (case ((string_drop s5546_0 s5547_0)) of
        s5548_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5548_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1212, s5549_0)) =>
  if (((((subrange_vec_dec v__1212 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1212 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1212 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    (case ((string_drop s5548_0 s5549_0)) of
          s_ => SOME (rsc1, rsc2, uimm, s_)
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5519_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5 * string))*)

val _ = Define `
 ((s5519_:string ->((3)words$word#(3)words$word#(5)words$word#string)option) s5520_0=
    (let s5521_0 = s5520_0 in
   if ((string_startswith s5521_0 "c.flw")) then  
  (case ((string_drop s5521_0 ((string_length "c.flw")))) of
        s5522_0 =>
  (case ((spc_matches_prefix0 s5522_0)) of
        SOME ((() , s5523_0)) =>
  (case ((string_drop s5522_0 s5523_0)) of
        s5524_0 =>
  (case ((creg_name_matches_prefix s5524_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s5525_0)) =>
  (case ((string_drop s5524_0 s5525_0)) of
        s5526_0 =>
  (case ((sep_matches_prefix s5526_0)) of
        SOME ((() , s5527_0)) =>
  (case ((string_drop s5526_0 s5527_0)) of
        s5528_0 =>
  (case ((creg_name_matches_prefix s5528_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s5529_0)) =>
  (case ((string_drop s5528_0 s5529_0)) of
        s5530_0 =>
  (case ((sep_matches_prefix s5530_0)) of
        SOME ((() , s5531_0)) =>
  (case ((string_drop s5530_0 s5531_0)) of
        s5532_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5532_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1214, s5533_0)) =>
  if (((((subrange_vec_dec v__1214 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1214 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1214 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    (case ((string_drop s5532_0 s5533_0)) of
          s_ => SOME (rdc, rsc, uimm, s_)
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5507_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s5507_:string ->((5)words$word#(6)words$word#string)option) s5508_0=
    (let s5509_0 = s5508_0 in
   if ((string_startswith s5509_0 "c.fswsp")) then  
  (case ((string_drop s5509_0 ((string_length "c.fswsp")))) of
        s5510_0 =>
  (case ((spc_matches_prefix0 s5510_0)) of
        SOME ((() , s5511_0)) =>
  (case ((string_drop s5510_0 s5511_0)) of
        s5512_0 =>
  (case ((reg_name_matches_prefix s5512_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s5513_0)) =>
  (case ((string_drop s5512_0 s5513_0)) of
        s5514_0 =>
  (case ((sep_matches_prefix s5514_0)) of
        SOME ((() , s5515_0)) =>
  (case ((string_drop s5514_0 s5515_0)) of
        s5516_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5516_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s5517_0)) =>
  (case ((string_drop s5516_0 s5517_0)) of   s_ => SOME (rd, uimm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5495_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s5495_:string ->((5)words$word#(6)words$word#string)option) s5496_0=
    (let s5497_0 = s5496_0 in
   if ((string_startswith s5497_0 "c.flwsp")) then  
  (case ((string_drop s5497_0 ((string_length "c.flwsp")))) of
        s5498_0 =>
  (case ((spc_matches_prefix0 s5498_0)) of
        SOME ((() , s5499_0)) =>
  (case ((string_drop s5498_0 s5499_0)) of
        s5500_0 =>
  (case ((reg_name_matches_prefix s5500_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s5501_0)) =>
  (case ((string_drop s5500_0 s5501_0)) of
        s5502_0 =>
  (case ((sep_matches_prefix s5502_0)) of
        SOME ((() , s5503_0)) =>
  (case ((string_drop s5502_0 s5503_0)) of
        s5504_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5504_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s5505_0)) =>
  (case ((string_drop s5504_0 s5505_0)) of   s_ => SOME (rd, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5482_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5482_:string ->(f_un_op_S#(5)words$word#(5)words$word#string)option) s5483_0= 
  ((case s5483_0 of
         s5484_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s5484_0)) of
         SOME ((FCLASS_S, s5485_0)) =>
   (case ((string_drop s5484_0 s5485_0)) of
         s5486_0 =>
   (case ((spc_matches_prefix0 s5486_0)) of
         SOME ((() , s5487_0)) =>
   (case ((string_drop s5486_0 s5487_0)) of
         s5488_0 =>
   (case ((reg_name_matches_prefix s5488_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5489_0)) =>
   (case ((string_drop s5488_0 s5489_0)) of
         s5490_0 =>
   (case ((sep_matches_prefix s5490_0)) of
         SOME ((() , s5491_0)) =>
   (case ((string_drop s5490_0 s5491_0)) of
         s5492_0 =>
   (case ((freg_name_matches_prefix s5492_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5493_0)) =>
   (case ((string_drop s5492_0 s5493_0)) of
         s_ => SOME (FCLASS_S, rd, rs1, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5469_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5469_:string ->(f_un_op_S#(5)words$word#(5)words$word#string)option) s5470_0= 
  ((case s5470_0 of
         s5471_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s5471_0)) of
         SOME ((FMV_W_X, s5472_0)) =>
   (case ((string_drop s5471_0 s5472_0)) of
         s5473_0 =>
   (case ((spc_matches_prefix0 s5473_0)) of
         SOME ((() , s5474_0)) =>
   (case ((string_drop s5473_0 s5474_0)) of
         s5475_0 =>
   (case ((freg_name_matches_prefix s5475_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5476_0)) =>
   (case ((string_drop s5475_0 s5476_0)) of
         s5477_0 =>
   (case ((sep_matches_prefix s5477_0)) of
         SOME ((() , s5478_0)) =>
   (case ((string_drop s5477_0 s5478_0)) of
         s5479_0 =>
   (case ((reg_name_matches_prefix s5479_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5480_0)) =>
   (case ((string_drop s5479_0 s5480_0)) of
         s_ => SOME (FMV_W_X, rd, rs1, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5456_ : string -> maybe ((f_un_op_S * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5456_:string ->(f_un_op_S#(5)words$word#(5)words$word#string)option) s5457_0= 
  ((case s5457_0 of
         s5458_0 =>
   (case ((f_un_type_mnemonic_S_matches_prefix s5458_0)) of
         SOME ((FMV_X_W, s5459_0)) =>
   (case ((string_drop s5458_0 s5459_0)) of
         s5460_0 =>
   (case ((spc_matches_prefix0 s5460_0)) of
         SOME ((() , s5461_0)) =>
   (case ((string_drop s5460_0 s5461_0)) of
         s5462_0 =>
   (case ((reg_name_matches_prefix s5462_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5463_0)) =>
   (case ((string_drop s5462_0 s5463_0)) of
         s5464_0 =>
   (case ((sep_matches_prefix s5464_0)) of
         SOME ((() , s5465_0)) =>
   (case ((string_drop s5464_0 s5465_0)) of
         s5466_0 =>
   (case ((freg_name_matches_prefix s5466_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5467_0)) =>
   (case ((string_drop s5466_0 s5467_0)) of
         s_ => SOME (FMV_X_W, rd, rs1, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5439_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5439_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5440_0= 
  ((case s5440_0 of
         s5441_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5441_0)) of
         SOME ((FLE_S, s5442_0)) =>
   (case ((string_drop s5441_0 s5442_0)) of
         s5443_0 =>
   (case ((spc_matches_prefix0 s5443_0)) of
         SOME ((() , s5444_0)) =>
   (case ((string_drop s5443_0 s5444_0)) of
         s5445_0 =>
   (case ((reg_name_matches_prefix s5445_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5446_0)) =>
   (case ((string_drop s5445_0 s5446_0)) of
         s5447_0 =>
   (case ((sep_matches_prefix s5447_0)) of
         SOME ((() , s5448_0)) =>
   (case ((string_drop s5447_0 s5448_0)) of
         s5449_0 =>
   (case ((freg_name_matches_prefix s5449_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5450_0)) =>
   (case ((string_drop s5449_0 s5450_0)) of
         s5451_0 =>
   (case ((sep_matches_prefix s5451_0)) of
         SOME ((() , s5452_0)) =>
   (case ((string_drop s5451_0 s5452_0)) of
         s5453_0 =>
   (case ((freg_name_matches_prefix s5453_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5454_0)) =>
   (case ((string_drop s5453_0 s5454_0)) of
         s_ => SOME (FLE_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5422_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5422_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5423_0= 
  ((case s5423_0 of
         s5424_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5424_0)) of
         SOME ((FLT_S, s5425_0)) =>
   (case ((string_drop s5424_0 s5425_0)) of
         s5426_0 =>
   (case ((spc_matches_prefix0 s5426_0)) of
         SOME ((() , s5427_0)) =>
   (case ((string_drop s5426_0 s5427_0)) of
         s5428_0 =>
   (case ((reg_name_matches_prefix s5428_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5429_0)) =>
   (case ((string_drop s5428_0 s5429_0)) of
         s5430_0 =>
   (case ((sep_matches_prefix s5430_0)) of
         SOME ((() , s5431_0)) =>
   (case ((string_drop s5430_0 s5431_0)) of
         s5432_0 =>
   (case ((freg_name_matches_prefix s5432_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5433_0)) =>
   (case ((string_drop s5432_0 s5433_0)) of
         s5434_0 =>
   (case ((sep_matches_prefix s5434_0)) of
         SOME ((() , s5435_0)) =>
   (case ((string_drop s5434_0 s5435_0)) of
         s5436_0 =>
   (case ((freg_name_matches_prefix s5436_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5437_0)) =>
   (case ((string_drop s5436_0 s5437_0)) of
         s_ => SOME (FLT_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5405_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5405_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5406_0= 
  ((case s5406_0 of
         s5407_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5407_0)) of
         SOME ((FEQ_S, s5408_0)) =>
   (case ((string_drop s5407_0 s5408_0)) of
         s5409_0 =>
   (case ((spc_matches_prefix0 s5409_0)) of
         SOME ((() , s5410_0)) =>
   (case ((string_drop s5409_0 s5410_0)) of
         s5411_0 =>
   (case ((reg_name_matches_prefix s5411_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5412_0)) =>
   (case ((string_drop s5411_0 s5412_0)) of
         s5413_0 =>
   (case ((sep_matches_prefix s5413_0)) of
         SOME ((() , s5414_0)) =>
   (case ((string_drop s5413_0 s5414_0)) of
         s5415_0 =>
   (case ((freg_name_matches_prefix s5415_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5416_0)) =>
   (case ((string_drop s5415_0 s5416_0)) of
         s5417_0 =>
   (case ((sep_matches_prefix s5417_0)) of
         SOME ((() , s5418_0)) =>
   (case ((string_drop s5417_0 s5418_0)) of
         s5419_0 =>
   (case ((freg_name_matches_prefix s5419_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5420_0)) =>
   (case ((string_drop s5419_0 s5420_0)) of
         s_ => SOME (FEQ_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5388_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5388_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5389_0= 
  ((case s5389_0 of
         s5390_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5390_0)) of
         SOME ((FMAX_S, s5391_0)) =>
   (case ((string_drop s5390_0 s5391_0)) of
         s5392_0 =>
   (case ((spc_matches_prefix0 s5392_0)) of
         SOME ((() , s5393_0)) =>
   (case ((string_drop s5392_0 s5393_0)) of
         s5394_0 =>
   (case ((freg_name_matches_prefix s5394_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5395_0)) =>
   (case ((string_drop s5394_0 s5395_0)) of
         s5396_0 =>
   (case ((sep_matches_prefix s5396_0)) of
         SOME ((() , s5397_0)) =>
   (case ((string_drop s5396_0 s5397_0)) of
         s5398_0 =>
   (case ((freg_name_matches_prefix s5398_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5399_0)) =>
   (case ((string_drop s5398_0 s5399_0)) of
         s5400_0 =>
   (case ((sep_matches_prefix s5400_0)) of
         SOME ((() , s5401_0)) =>
   (case ((string_drop s5400_0 s5401_0)) of
         s5402_0 =>
   (case ((freg_name_matches_prefix s5402_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5403_0)) =>
   (case ((string_drop s5402_0 s5403_0)) of
         s_ => SOME (FMAX_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5371_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5371_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5372_0= 
  ((case s5372_0 of
         s5373_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5373_0)) of
         SOME ((FMIN_S, s5374_0)) =>
   (case ((string_drop s5373_0 s5374_0)) of
         s5375_0 =>
   (case ((spc_matches_prefix0 s5375_0)) of
         SOME ((() , s5376_0)) =>
   (case ((string_drop s5375_0 s5376_0)) of
         s5377_0 =>
   (case ((freg_name_matches_prefix s5377_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5378_0)) =>
   (case ((string_drop s5377_0 s5378_0)) of
         s5379_0 =>
   (case ((sep_matches_prefix s5379_0)) of
         SOME ((() , s5380_0)) =>
   (case ((string_drop s5379_0 s5380_0)) of
         s5381_0 =>
   (case ((freg_name_matches_prefix s5381_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5382_0)) =>
   (case ((string_drop s5381_0 s5382_0)) of
         s5383_0 =>
   (case ((sep_matches_prefix s5383_0)) of
         SOME ((() , s5384_0)) =>
   (case ((string_drop s5383_0 s5384_0)) of
         s5385_0 =>
   (case ((freg_name_matches_prefix s5385_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5386_0)) =>
   (case ((string_drop s5385_0 s5386_0)) of
         s_ => SOME (FMIN_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5354_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5354_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5355_0= 
  ((case s5355_0 of
         s5356_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5356_0)) of
         SOME ((FSGNJX_S, s5357_0)) =>
   (case ((string_drop s5356_0 s5357_0)) of
         s5358_0 =>
   (case ((spc_matches_prefix0 s5358_0)) of
         SOME ((() , s5359_0)) =>
   (case ((string_drop s5358_0 s5359_0)) of
         s5360_0 =>
   (case ((freg_name_matches_prefix s5360_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5361_0)) =>
   (case ((string_drop s5360_0 s5361_0)) of
         s5362_0 =>
   (case ((sep_matches_prefix s5362_0)) of
         SOME ((() , s5363_0)) =>
   (case ((string_drop s5362_0 s5363_0)) of
         s5364_0 =>
   (case ((freg_name_matches_prefix s5364_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5365_0)) =>
   (case ((string_drop s5364_0 s5365_0)) of
         s5366_0 =>
   (case ((sep_matches_prefix s5366_0)) of
         SOME ((() , s5367_0)) =>
   (case ((string_drop s5366_0 s5367_0)) of
         s5368_0 =>
   (case ((freg_name_matches_prefix s5368_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5369_0)) =>
   (case ((string_drop s5368_0 s5369_0)) of
         s_ => SOME (FSGNJX_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5337_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5337_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5338_0= 
  ((case s5338_0 of
         s5339_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5339_0)) of
         SOME ((FSGNJN_S, s5340_0)) =>
   (case ((string_drop s5339_0 s5340_0)) of
         s5341_0 =>
   (case ((spc_matches_prefix0 s5341_0)) of
         SOME ((() , s5342_0)) =>
   (case ((string_drop s5341_0 s5342_0)) of
         s5343_0 =>
   (case ((freg_name_matches_prefix s5343_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5344_0)) =>
   (case ((string_drop s5343_0 s5344_0)) of
         s5345_0 =>
   (case ((sep_matches_prefix s5345_0)) of
         SOME ((() , s5346_0)) =>
   (case ((string_drop s5345_0 s5346_0)) of
         s5347_0 =>
   (case ((freg_name_matches_prefix s5347_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5348_0)) =>
   (case ((string_drop s5347_0 s5348_0)) of
         s5349_0 =>
   (case ((sep_matches_prefix s5349_0)) of
         SOME ((() , s5350_0)) =>
   (case ((string_drop s5349_0 s5350_0)) of
         s5351_0 =>
   (case ((freg_name_matches_prefix s5351_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5352_0)) =>
   (case ((string_drop s5351_0 s5352_0)) of
         s_ => SOME (FSGNJN_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5320_ : string -> maybe ((f_bin_op_S * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s5320_:string ->(f_bin_op_S#(5)words$word#(5)words$word#(5)words$word#string)option) s5321_0= 
  ((case s5321_0 of
         s5322_0 =>
   (case ((f_bin_type_mnemonic_S_matches_prefix s5322_0)) of
         SOME ((FSGNJ_S, s5323_0)) =>
   (case ((string_drop s5322_0 s5323_0)) of
         s5324_0 =>
   (case ((spc_matches_prefix0 s5324_0)) of
         SOME ((() , s5325_0)) =>
   (case ((string_drop s5324_0 s5325_0)) of
         s5326_0 =>
   (case ((freg_name_matches_prefix s5326_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5327_0)) =>
   (case ((string_drop s5326_0 s5327_0)) of
         s5328_0 =>
   (case ((sep_matches_prefix s5328_0)) of
         SOME ((() , s5329_0)) =>
   (case ((string_drop s5328_0 s5329_0)) of
         s5330_0 =>
   (case ((freg_name_matches_prefix s5330_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5331_0)) =>
   (case ((string_drop s5330_0 s5331_0)) of
         s5332_0 =>
   (case ((sep_matches_prefix s5332_0)) of
         SOME ((() , s5333_0)) =>
   (case ((string_drop s5332_0 s5333_0)) of
         s5334_0 =>
   (case ((freg_name_matches_prefix s5334_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5335_0)) =>
   (case ((string_drop s5334_0 s5335_0)) of
         s_ => SOME (FSGNJ_S, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5303_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5303_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5304_0= 
  ((case s5304_0 of
         s5305_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5305_0)) of
         SOME ((FCVT_S_LU, s5306_0)) =>
   (case ((string_drop s5305_0 s5306_0)) of
         s5307_0 =>
   (case ((spc_matches_prefix0 s5307_0)) of
         SOME ((() , s5308_0)) =>
   (case ((string_drop s5307_0 s5308_0)) of
         s5309_0 =>
   (case ((freg_name_matches_prefix s5309_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5310_0)) =>
   (case ((string_drop s5309_0 s5310_0)) of
         s5311_0 =>
   (case ((sep_matches_prefix s5311_0)) of
         SOME ((() , s5312_0)) =>
   (case ((string_drop s5311_0 s5312_0)) of
         s5313_0 =>
   (case ((reg_name_matches_prefix s5313_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5314_0)) =>
   (case ((string_drop s5313_0 s5314_0)) of
         s5315_0 =>
   (case ((sep_matches_prefix s5315_0)) of
         SOME ((() , s5316_0)) =>
   (case ((string_drop s5315_0 s5316_0)) of
         s5317_0 =>
   (case ((frm_mnemonic_matches_prefix s5317_0)) of
         SOME ((rm, s5318_0)) =>
   (case ((string_drop s5317_0 s5318_0)) of
         s_ => SOME (FCVT_S_LU, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5286_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5286_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5287_0= 
  ((case s5287_0 of
         s5288_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5288_0)) of
         SOME ((FCVT_S_L, s5289_0)) =>
   (case ((string_drop s5288_0 s5289_0)) of
         s5290_0 =>
   (case ((spc_matches_prefix0 s5290_0)) of
         SOME ((() , s5291_0)) =>
   (case ((string_drop s5290_0 s5291_0)) of
         s5292_0 =>
   (case ((freg_name_matches_prefix s5292_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5293_0)) =>
   (case ((string_drop s5292_0 s5293_0)) of
         s5294_0 =>
   (case ((sep_matches_prefix s5294_0)) of
         SOME ((() , s5295_0)) =>
   (case ((string_drop s5294_0 s5295_0)) of
         s5296_0 =>
   (case ((reg_name_matches_prefix s5296_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5297_0)) =>
   (case ((string_drop s5296_0 s5297_0)) of
         s5298_0 =>
   (case ((sep_matches_prefix s5298_0)) of
         SOME ((() , s5299_0)) =>
   (case ((string_drop s5298_0 s5299_0)) of
         s5300_0 =>
   (case ((frm_mnemonic_matches_prefix s5300_0)) of
         SOME ((rm, s5301_0)) =>
   (case ((string_drop s5300_0 s5301_0)) of
         s_ => SOME (FCVT_S_L, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5269_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5269_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5270_0= 
  ((case s5270_0 of
         s5271_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5271_0)) of
         SOME ((FCVT_LU_S, s5272_0)) =>
   (case ((string_drop s5271_0 s5272_0)) of
         s5273_0 =>
   (case ((spc_matches_prefix0 s5273_0)) of
         SOME ((() , s5274_0)) =>
   (case ((string_drop s5273_0 s5274_0)) of
         s5275_0 =>
   (case ((reg_name_matches_prefix s5275_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5276_0)) =>
   (case ((string_drop s5275_0 s5276_0)) of
         s5277_0 =>
   (case ((sep_matches_prefix s5277_0)) of
         SOME ((() , s5278_0)) =>
   (case ((string_drop s5277_0 s5278_0)) of
         s5279_0 =>
   (case ((freg_name_matches_prefix s5279_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5280_0)) =>
   (case ((string_drop s5279_0 s5280_0)) of
         s5281_0 =>
   (case ((sep_matches_prefix s5281_0)) of
         SOME ((() , s5282_0)) =>
   (case ((string_drop s5281_0 s5282_0)) of
         s5283_0 =>
   (case ((frm_mnemonic_matches_prefix s5283_0)) of
         SOME ((rm, s5284_0)) =>
   (case ((string_drop s5283_0 s5284_0)) of
         s_ => SOME (FCVT_LU_S, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5252_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5252_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5253_0= 
  ((case s5253_0 of
         s5254_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5254_0)) of
         SOME ((FCVT_L_S, s5255_0)) =>
   (case ((string_drop s5254_0 s5255_0)) of
         s5256_0 =>
   (case ((spc_matches_prefix0 s5256_0)) of
         SOME ((() , s5257_0)) =>
   (case ((string_drop s5256_0 s5257_0)) of
         s5258_0 =>
   (case ((reg_name_matches_prefix s5258_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5259_0)) =>
   (case ((string_drop s5258_0 s5259_0)) of
         s5260_0 =>
   (case ((sep_matches_prefix s5260_0)) of
         SOME ((() , s5261_0)) =>
   (case ((string_drop s5260_0 s5261_0)) of
         s5262_0 =>
   (case ((freg_name_matches_prefix s5262_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5263_0)) =>
   (case ((string_drop s5262_0 s5263_0)) of
         s5264_0 =>
   (case ((sep_matches_prefix s5264_0)) of
         SOME ((() , s5265_0)) =>
   (case ((string_drop s5264_0 s5265_0)) of
         s5266_0 =>
   (case ((frm_mnemonic_matches_prefix s5266_0)) of
         SOME ((rm, s5267_0)) =>
   (case ((string_drop s5266_0 s5267_0)) of
         s_ => SOME (FCVT_L_S, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5235_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5235_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5236_0= 
  ((case s5236_0 of
         s5237_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5237_0)) of
         SOME ((FCVT_S_WU, s5238_0)) =>
   (case ((string_drop s5237_0 s5238_0)) of
         s5239_0 =>
   (case ((spc_matches_prefix0 s5239_0)) of
         SOME ((() , s5240_0)) =>
   (case ((string_drop s5239_0 s5240_0)) of
         s5241_0 =>
   (case ((freg_name_matches_prefix s5241_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5242_0)) =>
   (case ((string_drop s5241_0 s5242_0)) of
         s5243_0 =>
   (case ((sep_matches_prefix s5243_0)) of
         SOME ((() , s5244_0)) =>
   (case ((string_drop s5243_0 s5244_0)) of
         s5245_0 =>
   (case ((reg_name_matches_prefix s5245_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5246_0)) =>
   (case ((string_drop s5245_0 s5246_0)) of
         s5247_0 =>
   (case ((sep_matches_prefix s5247_0)) of
         SOME ((() , s5248_0)) =>
   (case ((string_drop s5247_0 s5248_0)) of
         s5249_0 =>
   (case ((frm_mnemonic_matches_prefix s5249_0)) of
         SOME ((rm, s5250_0)) =>
   (case ((string_drop s5249_0 s5250_0)) of
         s_ => SOME (FCVT_S_WU, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5218_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5218_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5219_0= 
  ((case s5219_0 of
         s5220_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5220_0)) of
         SOME ((FCVT_S_W, s5221_0)) =>
   (case ((string_drop s5220_0 s5221_0)) of
         s5222_0 =>
   (case ((spc_matches_prefix0 s5222_0)) of
         SOME ((() , s5223_0)) =>
   (case ((string_drop s5222_0 s5223_0)) of
         s5224_0 =>
   (case ((freg_name_matches_prefix s5224_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5225_0)) =>
   (case ((string_drop s5224_0 s5225_0)) of
         s5226_0 =>
   (case ((sep_matches_prefix s5226_0)) of
         SOME ((() , s5227_0)) =>
   (case ((string_drop s5226_0 s5227_0)) of
         s5228_0 =>
   (case ((reg_name_matches_prefix s5228_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5229_0)) =>
   (case ((string_drop s5228_0 s5229_0)) of
         s5230_0 =>
   (case ((sep_matches_prefix s5230_0)) of
         SOME ((() , s5231_0)) =>
   (case ((string_drop s5230_0 s5231_0)) of
         s5232_0 =>
   (case ((frm_mnemonic_matches_prefix s5232_0)) of
         SOME ((rm, s5233_0)) =>
   (case ((string_drop s5232_0 s5233_0)) of
         s_ => SOME (FCVT_S_W, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5201_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5201_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5202_0= 
  ((case s5202_0 of
         s5203_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5203_0)) of
         SOME ((FCVT_WU_S, s5204_0)) =>
   (case ((string_drop s5203_0 s5204_0)) of
         s5205_0 =>
   (case ((spc_matches_prefix0 s5205_0)) of
         SOME ((() , s5206_0)) =>
   (case ((string_drop s5205_0 s5206_0)) of
         s5207_0 =>
   (case ((reg_name_matches_prefix s5207_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5208_0)) =>
   (case ((string_drop s5207_0 s5208_0)) of
         s5209_0 =>
   (case ((sep_matches_prefix s5209_0)) of
         SOME ((() , s5210_0)) =>
   (case ((string_drop s5209_0 s5210_0)) of
         s5211_0 =>
   (case ((freg_name_matches_prefix s5211_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5212_0)) =>
   (case ((string_drop s5211_0 s5212_0)) of
         s5213_0 =>
   (case ((sep_matches_prefix s5213_0)) of
         SOME ((() , s5214_0)) =>
   (case ((string_drop s5213_0 s5214_0)) of
         s5215_0 =>
   (case ((frm_mnemonic_matches_prefix s5215_0)) of
         SOME ((rm, s5216_0)) =>
   (case ((string_drop s5215_0 s5216_0)) of
         s_ => SOME (FCVT_WU_S, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5184_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5184_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5185_0= 
  ((case s5185_0 of
         s5186_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5186_0)) of
         SOME ((FCVT_W_S, s5187_0)) =>
   (case ((string_drop s5186_0 s5187_0)) of
         s5188_0 =>
   (case ((spc_matches_prefix0 s5188_0)) of
         SOME ((() , s5189_0)) =>
   (case ((string_drop s5188_0 s5189_0)) of
         s5190_0 =>
   (case ((reg_name_matches_prefix s5190_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5191_0)) =>
   (case ((string_drop s5190_0 s5191_0)) of
         s5192_0 =>
   (case ((sep_matches_prefix s5192_0)) of
         SOME ((() , s5193_0)) =>
   (case ((string_drop s5192_0 s5193_0)) of
         s5194_0 =>
   (case ((freg_name_matches_prefix s5194_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5195_0)) =>
   (case ((string_drop s5194_0 s5195_0)) of
         s5196_0 =>
   (case ((sep_matches_prefix s5196_0)) of
         SOME ((() , s5197_0)) =>
   (case ((string_drop s5196_0 s5197_0)) of
         s5198_0 =>
   (case ((frm_mnemonic_matches_prefix s5198_0)) of
         SOME ((rm, s5199_0)) =>
   (case ((string_drop s5198_0 s5199_0)) of
         s_ => SOME (FCVT_W_S, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5167_ : string -> maybe ((f_un_rm_op_S * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5167_:string ->(f_un_rm_op_S#(5)words$word#(5)words$word#rounding_mode#string)option) s5168_0= 
  ((case s5168_0 of
         s5169_0 =>
   (case ((f_un_rm_type_mnemonic_S_matches_prefix s5169_0)) of
         SOME ((FSQRT_S, s5170_0)) =>
   (case ((string_drop s5169_0 s5170_0)) of
         s5171_0 =>
   (case ((spc_matches_prefix0 s5171_0)) of
         SOME ((() , s5172_0)) =>
   (case ((string_drop s5171_0 s5172_0)) of
         s5173_0 =>
   (case ((freg_name_matches_prefix s5173_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5174_0)) =>
   (case ((string_drop s5173_0 s5174_0)) of
         s5175_0 =>
   (case ((sep_matches_prefix s5175_0)) of
         SOME ((() , s5176_0)) =>
   (case ((string_drop s5175_0 s5176_0)) of
         s5177_0 =>
   (case ((freg_name_matches_prefix s5177_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5178_0)) =>
   (case ((string_drop s5177_0 s5178_0)) of
         s5179_0 =>
   (case ((sep_matches_prefix s5179_0)) of
         SOME ((() , s5180_0)) =>
   (case ((string_drop s5179_0 s5180_0)) of
         s5181_0 =>
   (case ((frm_mnemonic_matches_prefix s5181_0)) of
         SOME ((rm, s5182_0)) =>
   (case ((string_drop s5181_0 s5182_0)) of
         s_ => SOME (FSQRT_S, rd, rs1, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5146_ : string -> maybe ((f_bin_rm_op_S * mword ty5 * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5146_:string ->(f_bin_rm_op_S#(5)words$word#(5)words$word#(5)words$word#rounding_mode#string)option) s5147_0= 
  ((case s5147_0 of
         s5148_0 =>
   (case ((f_bin_rm_type_mnemonic_S_matches_prefix s5148_0)) of
         SOME ((op, s5149_0)) =>
   (case ((string_drop s5148_0 s5149_0)) of
         s5150_0 =>
   (case ((spc_matches_prefix0 s5150_0)) of
         SOME ((() , s5151_0)) =>
   (case ((string_drop s5150_0 s5151_0)) of
         s5152_0 =>
   (case ((freg_name_matches_prefix s5152_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5153_0)) =>
   (case ((string_drop s5152_0 s5153_0)) of
         s5154_0 =>
   (case ((sep_matches_prefix s5154_0)) of
         SOME ((() , s5155_0)) =>
   (case ((string_drop s5154_0 s5155_0)) of
         s5156_0 =>
   (case ((freg_name_matches_prefix s5156_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5157_0)) =>
   (case ((string_drop s5156_0 s5157_0)) of
         s5158_0 =>
   (case ((sep_matches_prefix s5158_0)) of
         SOME ((() , s5159_0)) =>
   (case ((string_drop s5158_0 s5159_0)) of
         s5160_0 =>
   (case ((freg_name_matches_prefix s5160_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5161_0)) =>
   (case ((string_drop s5160_0 s5161_0)) of
         s5162_0 =>
   (case ((sep_matches_prefix s5162_0)) of
         SOME ((() , s5163_0)) =>
   (case ((string_drop s5162_0 s5163_0)) of
         s5164_0 =>
   (case ((frm_mnemonic_matches_prefix s5164_0)) of
         SOME ((rm, s5165_0)) =>
   (case ((string_drop s5164_0 s5165_0)) of
         s_ => SOME (op, rd, rs1, rs2, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5121_ : string -> maybe ((f_madd_op_S * mword ty5 * mword ty5 * mword ty5 * mword ty5 * rounding_mode * string))*)

val _ = Define `
 ((s5121_:string ->(f_madd_op_S#(5)words$word#(5)words$word#(5)words$word#(5)words$word#rounding_mode#string)option) s5122_0= 
  ((case s5122_0 of
         s5123_0 =>
   (case ((f_madd_type_mnemonic_S_matches_prefix s5123_0)) of
         SOME ((op, s5124_0)) =>
   (case ((string_drop s5123_0 s5124_0)) of
         s5125_0 =>
   (case ((spc_matches_prefix0 s5125_0)) of
         SOME ((() , s5126_0)) =>
   (case ((string_drop s5125_0 s5126_0)) of
         s5127_0 =>
   (case ((freg_name_matches_prefix s5127_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s5128_0)) =>
   (case ((string_drop s5127_0 s5128_0)) of
         s5129_0 =>
   (case ((sep_matches_prefix s5129_0)) of
         SOME ((() , s5130_0)) =>
   (case ((string_drop s5129_0 s5130_0)) of
         s5131_0 =>
   (case ((freg_name_matches_prefix s5131_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s5132_0)) =>
   (case ((string_drop s5131_0 s5132_0)) of
         s5133_0 =>
   (case ((sep_matches_prefix s5133_0)) of
         SOME ((() , s5134_0)) =>
   (case ((string_drop s5133_0 s5134_0)) of
         s5135_0 =>
   (case ((freg_name_matches_prefix s5135_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s5136_0)) =>
   (case ((string_drop s5135_0 s5136_0)) of
         s5137_0 =>
   (case ((sep_matches_prefix s5137_0)) of
         SOME ((() , s5138_0)) =>
   (case ((string_drop s5137_0 s5138_0)) of
         s5139_0 =>
   (case ((freg_name_matches_prefix s5139_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs3, s5140_0)) =>
   (case ((string_drop s5139_0 s5140_0)) of
         s5141_0 =>
   (case ((sep_matches_prefix s5141_0)) of
         SOME ((() , s5142_0)) =>
   (case ((string_drop s5141_0 s5142_0)) of
         s5143_0 =>
   (case ((frm_mnemonic_matches_prefix s5143_0)) of
         SOME ((rm, s5144_0)) =>
   (case ((string_drop s5143_0 s5144_0)) of
         s_ =>
   SOME (op, rd, rs1, rs2, rs3, rm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s5097_ : string -> maybe ((word_width * mword ty5 * mword ty12 * mword ty5 * string))*)

val _ = Define `
 ((s5097_:string ->(word_width#(5)words$word#(12)words$word#(5)words$word#string)option) s5098_0=
    (let s5099_0 = s5098_0 in
   if ((string_startswith s5099_0 "fs")) then  
  (case ((string_drop s5099_0 ((string_length "fs")))) of
        s5100_0 =>
  (case ((size_mnemonic_matches_prefix s5100_0)) of
        SOME ((width, s5101_0)) =>
  (case ((string_drop s5100_0 s5101_0)) of
        s5102_0 =>
  (case ((spc_matches_prefix0 s5102_0)) of
        SOME ((() , s5103_0)) =>
  (case ((string_drop s5102_0 s5103_0)) of
        s5104_0 =>
  (case ((freg_name_matches_prefix s5104_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s5105_0)) =>
  (case ((string_drop s5104_0 s5105_0)) of
        s5106_0 =>
  (case ((sep_matches_prefix s5106_0)) of
        SOME ((() , s5107_0)) =>
  (case ((string_drop s5106_0 s5107_0)) of
        s5108_0 =>
  (case ((hex_bits_12_matches_prefix0 s5108_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s5109_0)) =>
  (case ((string_drop s5108_0 s5109_0)) of
        s5110_0 =>
  (case ((opt_spc_matches_prefix0 s5110_0)) of
        SOME ((() , s5111_0)) =>
  let s5112_0 = (string_drop s5110_0 s5111_0) in
  if ((string_startswith s5112_0 "(")) then
    (case ((string_drop s5112_0 ((string_length "(")))) of
          s5113_0 =>
    (case ((opt_spc_matches_prefix0 s5113_0)) of
          SOME ((() , s5114_0)) =>
    (case ((string_drop s5113_0 s5114_0)) of
          s5115_0 =>
    (case ((reg_name_matches_prefix s5115_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s5116_0)) =>
    (case ((string_drop s5115_0 s5116_0)) of
          s5117_0 =>
    (case ((opt_spc_matches_prefix0 s5117_0)) of
          SOME ((() , s5118_0)) =>
    let s5119_0 = (string_drop s5117_0 s5118_0) in
    if ((string_startswith s5119_0 ")")) then
      (case ((string_drop s5119_0 ((string_length ")")))) of
            s_ =>
      SOME (width, rs2, imm, rs1, s_)
      ) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5073_ : string -> maybe ((word_width * mword ty5 * mword ty12 * mword ty5 * string))*)

val _ = Define `
 ((s5073_:string ->(word_width#(5)words$word#(12)words$word#(5)words$word#string)option) s5074_0=
    (let s5075_0 = s5074_0 in
   if ((string_startswith s5075_0 "fl")) then  
  (case ((string_drop s5075_0 ((string_length "fl")))) of
        s5076_0 =>
  (case ((size_mnemonic_matches_prefix s5076_0)) of
        SOME ((width, s5077_0)) =>
  (case ((string_drop s5076_0 s5077_0)) of
        s5078_0 =>
  (case ((spc_matches_prefix0 s5078_0)) of
        SOME ((() , s5079_0)) =>
  (case ((string_drop s5078_0 s5079_0)) of
        s5080_0 =>
  (case ((freg_name_matches_prefix s5080_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s5081_0)) =>
  (case ((string_drop s5080_0 s5081_0)) of
        s5082_0 =>
  (case ((sep_matches_prefix s5082_0)) of
        SOME ((() , s5083_0)) =>
  (case ((string_drop s5082_0 s5083_0)) of
        s5084_0 =>
  (case ((hex_bits_12_matches_prefix0 s5084_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s5085_0)) =>
  (case ((string_drop s5084_0 s5085_0)) of
        s5086_0 =>
  (case ((opt_spc_matches_prefix0 s5086_0)) of
        SOME ((() , s5087_0)) =>
  let s5088_0 = (string_drop s5086_0 s5087_0) in
  if ((string_startswith s5088_0 "(")) then
    (case ((string_drop s5088_0 ((string_length "(")))) of
          s5089_0 =>
    (case ((opt_spc_matches_prefix0 s5089_0)) of
          SOME ((() , s5090_0)) =>
    (case ((string_drop s5089_0 s5090_0)) of
          s5091_0 =>
    (case ((reg_name_matches_prefix s5091_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s5092_0)) =>
    (case ((string_drop s5091_0 s5092_0)) of
          s5093_0 =>
    (case ((opt_spc_matches_prefix0 s5093_0)) of
          SOME ((() , s5094_0)) =>
    let s5095_0 = (string_drop s5093_0 s5094_0) in
    if ((string_startswith s5095_0 ")")) then
      (case ((string_drop s5095_0 ((string_length ")")))) of
            s_ =>
      SOME (width, rd, imm, rs1, s_)
      ) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5061_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12 * string))*)

val _ = Define `
 ((s5061_:string ->((5)words$word#(5)words$word#(12)words$word#string)option) s5062_0=
    (let s5063_0 = s5062_0 in
   if ((string_startswith s5063_0 "fence.i.reserved.")) then  
  (case ((string_drop s5063_0 ((string_length "fence.i.reserved.")))) of
        s5064_0 =>
  (case ((reg_name_matches_prefix s5064_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s5065_0)) =>
  let s5066_0 = (string_drop s5064_0 s5065_0) in
  if ((string_startswith s5066_0 ".")) then
    (case ((string_drop s5066_0 ((string_length ".")))) of
          s5067_0 =>
    (case ((reg_name_matches_prefix s5067_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs, s5068_0)) =>
    let s5069_0 = (string_drop s5067_0 s5068_0) in
    if ((string_startswith s5069_0 ".")) then
      (case ((string_drop s5069_0 ((string_length ".")))) of
            s5070_0 =>
      (case ((hex_bits_12_matches_prefix0 s5070_0 : (( 12 words$word # ii)) option)) of
            SOME ((imm, s5071_0)) =>
      (case ((string_drop s5070_0 s5071_0)) of
            s_ => SOME (rd, rs, imm, s_)
      )
        | _ => NONE
      )
      ) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5043_ : string -> maybe ((mword ty4 * mword ty4 * mword ty5 * mword ty5 * mword ty4 * string))*)

val _ = Define `
 ((s5043_:string ->((4)words$word#(4)words$word#(5)words$word#(5)words$word#(4)words$word#string)option) s5044_0=
    (let s5045_0 = s5044_0 in
   if ((string_startswith s5045_0 "fence.reserved.")) then  
  (case ((string_drop s5045_0 ((string_length "fence.reserved.")))) of
        s5046_0 =>
  (case ((fence_bits_matches_prefix s5046_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s5047_0)) =>
  let s5048_0 = (string_drop s5046_0 s5047_0) in
  if ((string_startswith s5048_0 ".")) then
    (case ((string_drop s5048_0 ((string_length ".")))) of
          s5049_0 =>
    (case ((fence_bits_matches_prefix s5049_0 : (( 4 words$word # ii)) option)) of
          SOME ((succ, s5050_0)) =>
    let s5051_0 = (string_drop s5049_0 s5050_0) in
    if ((string_startswith s5051_0 ".")) then
      (case ((string_drop s5051_0 ((string_length ".")))) of
            s5052_0 =>
      (case ((reg_name_matches_prefix s5052_0 : (( 5 words$word # ii)) option)) of
            SOME ((rs, s5053_0)) =>
      let s5054_0 = (string_drop s5052_0 s5053_0) in
      if ((string_startswith s5054_0 ".")) then
        (case ((string_drop s5054_0 ((string_length ".")))) of
              s5055_0 =>
        (case ((reg_name_matches_prefix s5055_0 : (( 5 words$word # ii)) option)) of
              SOME ((rd, s5056_0)) =>
        let s5057_0 = (string_drop s5055_0 s5056_0) in
        if ((string_startswith s5057_0 ".")) then
          (case ((string_drop s5057_0 ((string_length ".")))) of
                s5058_0 =>
          (case ((hex_bits_4_matches_prefix
                    instance_Sail2_values_Bitvector_Machine_word_mword_dict
                    s5058_0 : (( 4 words$word # ii)) option)) of
                SOME ((fm, s5059_0)) =>
          (case ((string_drop s5058_0 s5059_0)) of
                s_ => SOME (pred, succ, rs, rd, fm, s_)
          )
            | _ => NONE
          )
          ) else NONE
          | _ => NONE
        )
        ) else NONE
        | _ => NONE
      )
      ) else NONE
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5037_ : string -> maybe ((mword ty3 * string))*)

val _ = Define `
 ((s5037_:string ->((3)words$word#string)option) s5038_0=
    (let s5039_0 = s5038_0 in
   if ((string_startswith s5039_0 "c.srai.hint.")) then  
  (case ((string_drop s5039_0 ((string_length "c.srai.hint.")))) of
        s5040_0 =>
  (case ((creg_name_matches_prefix s5040_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s5041_0)) =>
  (case ((string_drop s5040_0 s5041_0)) of   s_ => SOME (rsd, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5031_ : string -> maybe ((mword ty3 * string))*)

val _ = Define `
 ((s5031_:string ->((3)words$word#string)option) s5032_0=
    (let s5033_0 = s5032_0 in
   if ((string_startswith s5033_0 "c.srli.hint.")) then  
  (case ((string_drop s5033_0 ((string_length "c.srli.hint.")))) of
        s5034_0 =>
  (case ((creg_name_matches_prefix s5034_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s5035_0)) =>
  (case ((string_drop s5034_0 s5035_0)) of   s_ => SOME (rsd, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5022_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s5022_:string ->((5)words$word#(6)words$word#string)option) s5023_0=
    (let s5024_0 = s5023_0 in
   if ((string_startswith s5024_0 "c.slli.hint.")) then  
  (case ((string_drop s5024_0 ((string_length "c.slli.hint.")))) of
        s5025_0 =>
  (case ((reg_name_matches_prefix s5025_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s5026_0)) =>
  let s5027_0 = (string_drop s5025_0 s5026_0) in
  if ((string_startswith s5027_0 ".")) then
    (case ((string_drop s5027_0 ((string_length ".")))) of
          s5028_0 =>
    (case ((hex_bits_6_matches_prefix
              instance_Sail2_values_Bitvector_Machine_word_mword_dict 
            s5028_0 : (( 6 words$word # ii)) option)) of
          SOME ((shamt, s5029_0)) =>
    (case ((string_drop s5028_0 s5029_0)) of   s_ => SOME (rsd, shamt, s_) )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5016_ : string -> maybe ((mword ty5 * string))*)

val _ = Define `
 ((s5016_:string ->((5)words$word#string)option) s5017_0=
    (let s5018_0 = s5017_0 in
   if ((string_startswith s5018_0 "c.add.hint.")) then  
  (case ((string_drop s5018_0 ((string_length "c.add.hint.")))) of
        s5019_0 =>
  (case ((reg_name_matches_prefix s5019_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s5020_0)) =>
  (case ((string_drop s5019_0 s5020_0)) of   s_ => SOME (rs2, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5010_ : string -> maybe ((mword ty5 * string))*)

val _ = Define `
 ((s5010_:string ->((5)words$word#string)option) s5011_0=
    (let s5012_0 = s5011_0 in
   if ((string_startswith s5012_0 "c.mv.hint.")) then  
  (case ((string_drop s5012_0 ((string_length "c.mv.hint.")))) of
        s5013_0 =>
  (case ((reg_name_matches_prefix s5013_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s5014_0)) =>
  (case ((string_drop s5013_0 s5014_0)) of   s_ => SOME (rs2, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s5004_ : string -> maybe ((mword ty6 * string))*)

val _ = Define `
 ((s5004_:string ->((6)words$word#string)option) s5005_0=
    (let s5006_0 = s5005_0 in
   if ((string_startswith s5006_0 "c.lui.hint.")) then  
  (case ((string_drop s5006_0 ((string_length "c.lui.hint.")))) of
        s5007_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5007_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s5008_0)) =>
  (case ((string_drop s5007_0 s5008_0)) of   s_ => SOME (imm, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4998_ : string -> maybe ((mword ty6 * string))*)

val _ = Define `
 ((s4998_:string ->((6)words$word#string)option) s4999_0=
    (let s5000_0 = s4999_0 in
   if ((string_startswith s5000_0 "c.li.hint.")) then  
  (case ((string_drop s5000_0 ((string_length "c.li.hint.")))) of
        s5001_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s5001_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s5002_0)) =>
  (case ((string_drop s5001_0 s5002_0)) of   s_ => SOME (imm, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4992_ : string -> maybe ((mword ty5 * string))*)

val _ = Define `
 ((s4992_:string ->((5)words$word#string)option) s4993_0=
    (let s4994_0 = s4993_0 in
   if ((string_startswith s4994_0 "c.addi.hint.")) then  
  (case ((string_drop s4994_0 ((string_length "c.addi.hint.")))) of
        s4995_0 =>
  (case ((reg_name_matches_prefix s4995_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s4996_0)) =>
  (case ((string_drop s4995_0 s4996_0)) of   s_ => SOME (rsd, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4986_ : string -> maybe ((mword ty6 * string))*)

val _ = Define `
 ((s4986_:string ->((6)words$word#string)option) s4987_0=
    (let s4988_0 = s4987_0 in
   if ((string_startswith s4988_0 "c.nop.hint.")) then  
  (case ((string_drop s4988_0 ((string_length "c.nop.hint.")))) of
        s4989_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4989_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4990_0)) =>
  (case ((string_drop s4989_0 s4990_0)) of   s_ => SOME (imm, s_) )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4982_ : string -> maybe string*)

val _ = Define `
 ((s4982_:string ->(string)option) s4983_0=
    (let s4984_0 = s4983_0 in
   if ((string_startswith s4984_0 "uret")) then  
  (case ((string_drop s4984_0 ((string_length "uret")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s4965_ : string -> maybe ((csrop * mword ty5 * mword ty12 * mword ty5 * string))*)

val _ = Define `
 ((s4965_:string ->(csrop#(5)words$word#(12)words$word#(5)words$word#string)option) s4966_0= 
  ((case s4966_0 of
         s4967_0 =>
   (case ((csr_mnemonic_matches_prefix s4967_0)) of
         SOME ((op, s4968_0)) =>
   (case ((string_drop s4967_0 s4968_0)) of
         s4969_0 =>
   (case ((spc_matches_prefix0 s4969_0)) of
         SOME ((() , s4970_0)) =>
   (case ((string_drop s4969_0 s4970_0)) of
         s4971_0 =>
   (case ((reg_name_matches_prefix s4971_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4972_0)) =>
   (case ((string_drop s4971_0 s4972_0)) of
         s4973_0 =>
   (case ((sep_matches_prefix s4973_0)) of
         SOME ((() , s4974_0)) =>
   (case ((string_drop s4973_0 s4974_0)) of
         s4975_0 =>
   (case ((csr_name_map_matches_prefix s4975_0
          : (( 12 words$word # ii)) option)) of
         SOME ((csr, s4976_0)) =>
   (case ((string_drop s4975_0 s4976_0)) of
         s4977_0 =>
   (case ((sep_matches_prefix s4977_0)) of
         SOME ((() , s4978_0)) =>
   (case ((string_drop s4977_0 s4978_0)) of
         s4979_0 =>
   (case ((reg_name_matches_prefix s4979_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4980_0)) =>
   (case ((string_drop s4979_0 s4980_0)) of
         s_ => SOME (op, rd, csr, rs1, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4947_ : string -> maybe ((csrop * mword ty5 * mword ty12 * mword ty5 * string))*)

val _ = Define `
 ((s4947_:string ->(csrop#(5)words$word#(12)words$word#(5)words$word#string)option) s4948_0= 
  ((case s4948_0 of
         s4949_0 =>
   (case ((csr_mnemonic_matches_prefix s4949_0)) of
         SOME ((op, s4950_0)) =>
   let s4951_0 = (string_drop s4949_0 s4950_0) in
   if ((string_startswith s4951_0 "i")) then
     (case ((string_drop s4951_0 ((string_length "i")))) of
           s4952_0 =>
     (case ((spc_matches_prefix0 s4952_0)) of
           SOME ((() , s4953_0)) =>
     (case ((string_drop s4952_0 s4953_0)) of
           s4954_0 =>
     (case ((reg_name_matches_prefix s4954_0 : (( 5 words$word # ii)) option)) of
           SOME ((rd, s4955_0)) =>
     (case ((string_drop s4954_0 s4955_0)) of
           s4956_0 =>
     (case ((sep_matches_prefix s4956_0)) of
           SOME ((() , s4957_0)) =>
     (case ((string_drop s4956_0 s4957_0)) of
           s4958_0 =>
     (case ((csr_name_map_matches_prefix s4958_0
            : (( 12 words$word # ii)) option)) of
           SOME ((csr, s4959_0)) =>
     (case ((string_drop s4958_0 s4959_0)) of
           s4960_0 =>
     (case ((sep_matches_prefix s4960_0)) of
           SOME ((() , s4961_0)) =>
     (case ((string_drop s4960_0 s4961_0)) of
           s4962_0 =>
     (case ((hex_bits_5_matches_prefix
               instance_Sail2_values_Bitvector_Machine_word_mword_dict
               s4962_0 : (( 5 words$word # ii)) option)) of
           SOME ((rs1, s4963_0)) =>
     (case ((string_drop s4962_0 s4963_0)) of
           s_ => SOME (op, rd, csr, rs1, s_)
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


(*val _s4928_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4928_:string ->(bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4929_0=
    (let s4930_0 = s4929_0 in
   if ((string_startswith s4930_0 "rem")) then  
  (case ((string_drop s4930_0 ((string_length "rem")))) of
        s4931_0 =>
  (case ((maybe_not_u_matches_prefix s4931_0)) of
        SOME ((s, s4932_0)) =>
  let s4933_0 = (string_drop s4931_0 s4932_0) in
  if ((string_startswith s4933_0 "w")) then
    (case ((string_drop s4933_0 ((string_length "w")))) of
          s4934_0 =>
    (case ((spc_matches_prefix0 s4934_0)) of
          SOME ((() , s4935_0)) =>
    (case ((string_drop s4934_0 s4935_0)) of
          s4936_0 =>
    (case ((reg_name_matches_prefix s4936_0 : (( 5 words$word # ii)) option)) of
          SOME ((rd, s4937_0)) =>
    (case ((string_drop s4936_0 s4937_0)) of
          s4938_0 =>
    (case ((sep_matches_prefix s4938_0)) of
          SOME ((() , s4939_0)) =>
    (case ((string_drop s4938_0 s4939_0)) of
          s4940_0 =>
    (case ((reg_name_matches_prefix s4940_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s4941_0)) =>
    (case ((string_drop s4940_0 s4941_0)) of
          s4942_0 =>
    (case ((sep_matches_prefix s4942_0)) of
          SOME ((() , s4943_0)) =>
    (case ((string_drop s4942_0 s4943_0)) of
          s4944_0 =>
    (case ((reg_name_matches_prefix s4944_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs2, s4945_0)) =>
    (case ((string_drop s4944_0 s4945_0)) of
          s_ => SOME (s, rd, rs1, rs2, s_)
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4909_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4909_:string ->(bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4910_0=
    (let s4911_0 = s4910_0 in
   if ((string_startswith s4911_0 "div")) then  
  (case ((string_drop s4911_0 ((string_length "div")))) of
        s4912_0 =>
  (case ((maybe_not_u_matches_prefix s4912_0)) of
        SOME ((s, s4913_0)) =>
  let s4914_0 = (string_drop s4912_0 s4913_0) in
  if ((string_startswith s4914_0 "w")) then
    (case ((string_drop s4914_0 ((string_length "w")))) of
          s4915_0 =>
    (case ((spc_matches_prefix0 s4915_0)) of
          SOME ((() , s4916_0)) =>
    (case ((string_drop s4915_0 s4916_0)) of
          s4917_0 =>
    (case ((reg_name_matches_prefix s4917_0 : (( 5 words$word # ii)) option)) of
          SOME ((rd, s4918_0)) =>
    (case ((string_drop s4917_0 s4918_0)) of
          s4919_0 =>
    (case ((sep_matches_prefix s4919_0)) of
          SOME ((() , s4920_0)) =>
    (case ((string_drop s4919_0 s4920_0)) of
          s4921_0 =>
    (case ((reg_name_matches_prefix s4921_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s4922_0)) =>
    (case ((string_drop s4921_0 s4922_0)) of
          s4923_0 =>
    (case ((sep_matches_prefix s4923_0)) of
          SOME ((() , s4924_0)) =>
    (case ((string_drop s4923_0 s4924_0)) of
          s4925_0 =>
    (case ((reg_name_matches_prefix s4925_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs2, s4926_0)) =>
    (case ((string_drop s4925_0 s4926_0)) of
          s_ => SOME (s, rd, rs1, rs2, s_)
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4893_ : string -> maybe ((mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4893_:string ->((5)words$word#(5)words$word#(5)words$word#string)option) s4894_0=
    (let s4895_0 = s4894_0 in
   if ((string_startswith s4895_0 "mulw")) then  
  (case ((string_drop s4895_0 ((string_length "mulw")))) of
        s4896_0 =>
  (case ((spc_matches_prefix0 s4896_0)) of
        SOME ((() , s4897_0)) =>
  (case ((string_drop s4896_0 s4897_0)) of
        s4898_0 =>
  (case ((reg_name_matches_prefix s4898_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4899_0)) =>
  (case ((string_drop s4898_0 s4899_0)) of
        s4900_0 =>
  (case ((sep_matches_prefix s4900_0)) of
        SOME ((() , s4901_0)) =>
  (case ((string_drop s4900_0 s4901_0)) of
        s4902_0 =>
  (case ((reg_name_matches_prefix s4902_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4903_0)) =>
  (case ((string_drop s4902_0 s4903_0)) of
        s4904_0 =>
  (case ((sep_matches_prefix s4904_0)) of
        SOME ((() , s4905_0)) =>
  (case ((string_drop s4904_0 s4905_0)) of
        s4906_0 =>
  (case ((reg_name_matches_prefix s4906_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4907_0)) =>
  (case ((string_drop s4906_0 s4907_0)) of   s_ => SOME (rd, rs1, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4875_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4875_:string ->(bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4876_0=
    (let s4877_0 = s4876_0 in
   if ((string_startswith s4877_0 "rem")) then  
  (case ((string_drop s4877_0 ((string_length "rem")))) of
        s4878_0 =>
  (case ((maybe_not_u_matches_prefix s4878_0)) of
        SOME ((s, s4879_0)) =>
  (case ((string_drop s4878_0 s4879_0)) of
        s4880_0 =>
  (case ((spc_matches_prefix0 s4880_0)) of
        SOME ((() , s4881_0)) =>
  (case ((string_drop s4880_0 s4881_0)) of
        s4882_0 =>
  (case ((reg_name_matches_prefix s4882_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4883_0)) =>
  (case ((string_drop s4882_0 s4883_0)) of
        s4884_0 =>
  (case ((sep_matches_prefix s4884_0)) of
        SOME ((() , s4885_0)) =>
  (case ((string_drop s4884_0 s4885_0)) of
        s4886_0 =>
  (case ((reg_name_matches_prefix s4886_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4887_0)) =>
  (case ((string_drop s4886_0 s4887_0)) of
        s4888_0 =>
  (case ((sep_matches_prefix s4888_0)) of
        SOME ((() , s4889_0)) =>
  (case ((string_drop s4888_0 s4889_0)) of
        s4890_0 =>
  (case ((reg_name_matches_prefix s4890_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4891_0)) =>
  (case ((string_drop s4890_0 s4891_0)) of
        s_ => SOME (s, rd, rs1, rs2, s_)
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4857_ : string -> maybe ((bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4857_:string ->(bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4858_0=
    (let s4859_0 = s4858_0 in
   if ((string_startswith s4859_0 "div")) then  
  (case ((string_drop s4859_0 ((string_length "div")))) of
        s4860_0 =>
  (case ((maybe_not_u_matches_prefix s4860_0)) of
        SOME ((s, s4861_0)) =>
  (case ((string_drop s4860_0 s4861_0)) of
        s4862_0 =>
  (case ((spc_matches_prefix0 s4862_0)) of
        SOME ((() , s4863_0)) =>
  (case ((string_drop s4862_0 s4863_0)) of
        s4864_0 =>
  (case ((reg_name_matches_prefix s4864_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4865_0)) =>
  (case ((string_drop s4864_0 s4865_0)) of
        s4866_0 =>
  (case ((sep_matches_prefix s4866_0)) of
        SOME ((() , s4867_0)) =>
  (case ((string_drop s4866_0 s4867_0)) of
        s4868_0 =>
  (case ((reg_name_matches_prefix s4868_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4869_0)) =>
  (case ((string_drop s4868_0 s4869_0)) of
        s4870_0 =>
  (case ((sep_matches_prefix s4870_0)) of
        SOME ((() , s4871_0)) =>
  (case ((string_drop s4870_0 s4871_0)) of
        s4872_0 =>
  (case ((reg_name_matches_prefix s4872_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4873_0)) =>
  (case ((string_drop s4872_0 s4873_0)) of
        s_ => SOME (s, rd, rs1, rs2, s_)
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4840_ : string -> maybe ((bool * bool * bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4840_:string ->(bool#bool#bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4841_0= 
  ((case s4841_0 of
         s4842_0 =>
   (case ((mul_mnemonic_matches_prefix s4842_0)) of
         SOME (((high, signed1, signed2), s4843_0)) =>
   (case ((string_drop s4842_0 s4843_0)) of
         s4844_0 =>
   (case ((spc_matches_prefix0 s4844_0)) of
         SOME ((() , s4845_0)) =>
   (case ((string_drop s4844_0 s4845_0)) of
         s4846_0 =>
   (case ((reg_name_matches_prefix s4846_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4847_0)) =>
   (case ((string_drop s4846_0 s4847_0)) of
         s4848_0 =>
   (case ((sep_matches_prefix s4848_0)) of
         SOME ((() , s4849_0)) =>
   (case ((string_drop s4848_0 s4849_0)) of
         s4850_0 =>
   (case ((reg_name_matches_prefix s4850_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4851_0)) =>
   (case ((string_drop s4850_0 s4851_0)) of
         s4852_0 =>
   (case ((sep_matches_prefix s4852_0)) of
         SOME ((() , s4853_0)) =>
   (case ((string_drop s4852_0 s4853_0)) of
         s4854_0 =>
   (case ((reg_name_matches_prefix s4854_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s4855_0)) =>
   (case ((string_drop s4854_0 s4855_0)) of
         s_ => SOME (high, signed1, signed2, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4828_ : string -> maybe ((mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4828_:string ->((5)words$word#(5)words$word#string)option) s4829_0=
    (let s4830_0 = s4829_0 in
   if ((string_startswith s4830_0 "c.add")) then  
  (case ((string_drop s4830_0 ((string_length "c.add")))) of
        s4831_0 =>
  (case ((spc_matches_prefix0 s4831_0)) of
        SOME ((() , s4832_0)) =>
  (case ((string_drop s4831_0 s4832_0)) of
        s4833_0 =>
  (case ((reg_name_matches_prefix s4833_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s4834_0)) =>
  (case ((string_drop s4833_0 s4834_0)) of
        s4835_0 =>
  (case ((sep_matches_prefix s4835_0)) of
        SOME ((() , s4836_0)) =>
  (case ((string_drop s4835_0 s4836_0)) of
        s4837_0 =>
  (case ((reg_name_matches_prefix s4837_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4838_0)) =>
  (case ((string_drop s4837_0 s4838_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4824_ : string -> maybe string*)

val _ = Define `
 ((s4824_:string ->(string)option) s4825_0=
    (let s4826_0 = s4825_0 in
   if ((string_startswith s4826_0 "c.ebreak")) then  
  (case ((string_drop s4826_0 ((string_length "c.ebreak")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s4812_ : string -> maybe ((mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4812_:string ->((5)words$word#(5)words$word#string)option) s4813_0=
    (let s4814_0 = s4813_0 in
   if ((string_startswith s4814_0 "c.mv")) then  
  (case ((string_drop s4814_0 ((string_length "c.mv")))) of
        s4815_0 =>
  (case ((spc_matches_prefix0 s4815_0)) of
        SOME ((() , s4816_0)) =>
  (case ((string_drop s4815_0 s4816_0)) of
        s4817_0 =>
  (case ((reg_name_matches_prefix s4817_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4818_0)) =>
  (case ((string_drop s4817_0 s4818_0)) of
        s4819_0 =>
  (case ((sep_matches_prefix s4819_0)) of
        SOME ((() , s4820_0)) =>
  (case ((string_drop s4819_0 s4820_0)) of
        s4821_0 =>
  (case ((reg_name_matches_prefix s4821_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4822_0)) =>
  (case ((string_drop s4821_0 s4822_0)) of   s_ => SOME (rd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4804_ : string -> maybe ((mword ty5 * string))*)

val _ = Define `
 ((s4804_:string ->((5)words$word#string)option) s4805_0=
    (let s4806_0 = s4805_0 in
   if ((string_startswith s4806_0 "c.jalr")) then  
  (case ((string_drop s4806_0 ((string_length "c.jalr")))) of
        s4807_0 =>
  (case ((spc_matches_prefix0 s4807_0)) of
        SOME ((() , s4808_0)) =>
  (case ((string_drop s4807_0 s4808_0)) of
        s4809_0 =>
  (case ((reg_name_matches_prefix s4809_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4810_0)) =>
  (case ((string_drop s4809_0 s4810_0)) of   s_ => SOME (rs1, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4796_ : string -> maybe ((mword ty5 * string))*)

val _ = Define `
 ((s4796_:string ->((5)words$word#string)option) s4797_0=
    (let s4798_0 = s4797_0 in
   if ((string_startswith s4798_0 "c.jr")) then  
  (case ((string_drop s4798_0 ((string_length "c.jr")))) of
        s4799_0 =>
  (case ((spc_matches_prefix0 s4799_0)) of
        SOME ((() , s4800_0)) =>
  (case ((string_drop s4799_0 s4800_0)) of
        s4801_0 =>
  (case ((reg_name_matches_prefix s4801_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4802_0)) =>
  (case ((string_drop s4801_0 s4802_0)) of   s_ => SOME (rs1, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4784_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4784_:string ->((5)words$word#(6)words$word#string)option) s4785_0=
    (let s4786_0 = s4785_0 in
   if ((string_startswith s4786_0 "c.sdsp")) then  
  (case ((string_drop s4786_0 ((string_length "c.sdsp")))) of
        s4787_0 =>
  (case ((spc_matches_prefix0 s4787_0)) of
        SOME ((() , s4788_0)) =>
  (case ((string_drop s4787_0 s4788_0)) of
        s4789_0 =>
  (case ((reg_name_matches_prefix s4789_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4790_0)) =>
  (case ((string_drop s4789_0 s4790_0)) of
        s4791_0 =>
  (case ((sep_matches_prefix s4791_0)) of
        SOME ((() , s4792_0)) =>
  (case ((string_drop s4791_0 s4792_0)) of
        s4793_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4793_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s4794_0)) =>
  (case ((string_drop s4793_0 s4794_0)) of   s_ => SOME (rs2, uimm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4772_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4772_:string ->((5)words$word#(6)words$word#string)option) s4773_0=
    (let s4774_0 = s4773_0 in
   if ((string_startswith s4774_0 "c.swsp")) then  
  (case ((string_drop s4774_0 ((string_length "c.swsp")))) of
        s4775_0 =>
  (case ((spc_matches_prefix0 s4775_0)) of
        SOME ((() , s4776_0)) =>
  (case ((string_drop s4775_0 s4776_0)) of
        s4777_0 =>
  (case ((reg_name_matches_prefix s4777_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4778_0)) =>
  (case ((string_drop s4777_0 s4778_0)) of
        s4779_0 =>
  (case ((sep_matches_prefix s4779_0)) of
        SOME ((() , s4780_0)) =>
  (case ((string_drop s4779_0 s4780_0)) of
        s4781_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4781_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s4782_0)) =>
  (case ((string_drop s4781_0 s4782_0)) of   s_ => SOME (rd, uimm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4760_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4760_:string ->((5)words$word#(6)words$word#string)option) s4761_0=
    (let s4762_0 = s4761_0 in
   if ((string_startswith s4762_0 "c.ldsp")) then  
  (case ((string_drop s4762_0 ((string_length "c.ldsp")))) of
        s4763_0 =>
  (case ((spc_matches_prefix0 s4763_0)) of
        SOME ((() , s4764_0)) =>
  (case ((string_drop s4763_0 s4764_0)) of
        s4765_0 =>
  (case ((reg_name_matches_prefix s4765_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4766_0)) =>
  (case ((string_drop s4765_0 s4766_0)) of
        s4767_0 =>
  (case ((sep_matches_prefix s4767_0)) of
        SOME ((() , s4768_0)) =>
  (case ((string_drop s4767_0 s4768_0)) of
        s4769_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4769_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s4770_0)) =>
  (case ((string_drop s4769_0 s4770_0)) of   s_ => SOME (rd, uimm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4748_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4748_:string ->((5)words$word#(6)words$word#string)option) s4749_0=
    (let s4750_0 = s4749_0 in
   if ((string_startswith s4750_0 "c.lwsp")) then  
  (case ((string_drop s4750_0 ((string_length "c.lwsp")))) of
        s4751_0 =>
  (case ((spc_matches_prefix0 s4751_0)) of
        SOME ((() , s4752_0)) =>
  (case ((string_drop s4751_0 s4752_0)) of
        s4753_0 =>
  (case ((reg_name_matches_prefix s4753_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4754_0)) =>
  (case ((string_drop s4753_0 s4754_0)) of
        s4755_0 =>
  (case ((sep_matches_prefix s4755_0)) of
        SOME ((() , s4756_0)) =>
  (case ((string_drop s4755_0 s4756_0)) of
        s4757_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4757_0 : (( 6 words$word # ii)) option)) of
        SOME ((uimm, s4758_0)) =>
  (case ((string_drop s4757_0 s4758_0)) of   s_ => SOME (rd, uimm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4736_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4736_:string ->((5)words$word#(6)words$word#string)option) s4737_0=
    (let s4738_0 = s4737_0 in
   if ((string_startswith s4738_0 "c.slli")) then  
  (case ((string_drop s4738_0 ((string_length "c.slli")))) of
        s4739_0 =>
  (case ((spc_matches_prefix0 s4739_0)) of
        SOME ((() , s4740_0)) =>
  (case ((string_drop s4739_0 s4740_0)) of
        s4741_0 =>
  (case ((reg_name_matches_prefix s4741_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s4742_0)) =>
  (case ((string_drop s4741_0 s4742_0)) of
        s4743_0 =>
  (case ((sep_matches_prefix s4743_0)) of
        SOME ((() , s4744_0)) =>
  (case ((string_drop s4743_0 s4744_0)) of
        s4745_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4745_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s4746_0)) =>
  (case ((string_drop s4745_0 s4746_0)) of   s_ => SOME (rsd, shamt, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4724_ : string -> maybe ((mword ty3 * mword ty8 * string))*)

val _ = Define `
 ((s4724_:string ->((3)words$word#(8)words$word#string)option) s4725_0=
    (let s4726_0 = s4725_0 in
   if ((string_startswith s4726_0 "c.bnez")) then  
  (case ((string_drop s4726_0 ((string_length "c.bnez")))) of
        s4727_0 =>
  (case ((spc_matches_prefix0 s4727_0)) of
        SOME ((() , s4728_0)) =>
  (case ((string_drop s4727_0 s4728_0)) of
        s4729_0 =>
  (case ((creg_name_matches_prefix s4729_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs, s4730_0)) =>
  (case ((string_drop s4729_0 s4730_0)) of
        s4731_0 =>
  (case ((sep_matches_prefix s4731_0)) of
        SOME ((() , s4732_0)) =>
  (case ((string_drop s4731_0 s4732_0)) of
        s4733_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4733_0 : (( 8 words$word # ii)) option)) of
        SOME ((imm, s4734_0)) =>
  (case ((string_drop s4733_0 s4734_0)) of   s_ => SOME (rs, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4712_ : string -> maybe ((mword ty3 * mword ty8 * string))*)

val _ = Define `
 ((s4712_:string ->((3)words$word#(8)words$word#string)option) s4713_0=
    (let s4714_0 = s4713_0 in
   if ((string_startswith s4714_0 "c.beqz")) then  
  (case ((string_drop s4714_0 ((string_length "c.beqz")))) of
        s4715_0 =>
  (case ((spc_matches_prefix0 s4715_0)) of
        SOME ((() , s4716_0)) =>
  (case ((string_drop s4715_0 s4716_0)) of
        s4717_0 =>
  (case ((creg_name_matches_prefix s4717_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs, s4718_0)) =>
  (case ((string_drop s4717_0 s4718_0)) of
        s4719_0 =>
  (case ((sep_matches_prefix s4719_0)) of
        SOME ((() , s4720_0)) =>
  (case ((string_drop s4719_0 s4720_0)) of
        s4721_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4721_0 : (( 8 words$word # ii)) option)) of
        SOME ((imm, s4722_0)) =>
  (case ((string_drop s4721_0 s4722_0)) of   s_ => SOME (rs, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4704_ : string -> maybe ((mword ty11 * string))*)

val _ = Define `
 ((s4704_:string ->((11)words$word#string)option) s4705_0=
    (let s4706_0 = s4705_0 in
   if ((string_startswith s4706_0 "c.j")) then  
  (case ((string_drop s4706_0 ((string_length "c.j")))) of
        s4707_0 =>
  (case ((spc_matches_prefix0 s4707_0)) of
        SOME ((() , s4708_0)) =>
  (case ((string_drop s4707_0 s4708_0)) of
        s4709_0 =>
  (case ((hex_bits_11_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4709_0 : (( 11 words$word # ii)) option)) of
        SOME ((imm, s4710_0)) =>
  (case ((string_drop s4709_0 s4710_0)) of   s_ => SOME (imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4692_ : string -> maybe ((mword ty3 * mword ty3 * string))*)

val _ = Define `
 ((s4692_:string ->((3)words$word#(3)words$word#string)option) s4693_0=
    (let s4694_0 = s4693_0 in
   if ((string_startswith s4694_0 "c.addw")) then  
  (case ((string_drop s4694_0 ((string_length "c.addw")))) of
        s4695_0 =>
  (case ((spc_matches_prefix0 s4695_0)) of
        SOME ((() , s4696_0)) =>
  (case ((string_drop s4695_0 s4696_0)) of
        s4697_0 =>
  (case ((creg_name_matches_prefix s4697_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4698_0)) =>
  (case ((string_drop s4697_0 s4698_0)) of
        s4699_0 =>
  (case ((sep_matches_prefix s4699_0)) of
        SOME ((() , s4700_0)) =>
  (case ((string_drop s4699_0 s4700_0)) of
        s4701_0 =>
  (case ((creg_name_matches_prefix s4701_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s4702_0)) =>
  (case ((string_drop s4701_0 s4702_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4680_ : string -> maybe ((mword ty3 * mword ty3 * string))*)

val _ = Define `
 ((s4680_:string ->((3)words$word#(3)words$word#string)option) s4681_0=
    (let s4682_0 = s4681_0 in
   if ((string_startswith s4682_0 "c.subw")) then  
  (case ((string_drop s4682_0 ((string_length "c.subw")))) of
        s4683_0 =>
  (case ((spc_matches_prefix0 s4683_0)) of
        SOME ((() , s4684_0)) =>
  (case ((string_drop s4683_0 s4684_0)) of
        s4685_0 =>
  (case ((creg_name_matches_prefix s4685_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4686_0)) =>
  (case ((string_drop s4685_0 s4686_0)) of
        s4687_0 =>
  (case ((sep_matches_prefix s4687_0)) of
        SOME ((() , s4688_0)) =>
  (case ((string_drop s4687_0 s4688_0)) of
        s4689_0 =>
  (case ((creg_name_matches_prefix s4689_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s4690_0)) =>
  (case ((string_drop s4689_0 s4690_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4668_ : string -> maybe ((mword ty3 * mword ty3 * string))*)

val _ = Define `
 ((s4668_:string ->((3)words$word#(3)words$word#string)option) s4669_0=
    (let s4670_0 = s4669_0 in
   if ((string_startswith s4670_0 "c.and")) then  
  (case ((string_drop s4670_0 ((string_length "c.and")))) of
        s4671_0 =>
  (case ((spc_matches_prefix0 s4671_0)) of
        SOME ((() , s4672_0)) =>
  (case ((string_drop s4671_0 s4672_0)) of
        s4673_0 =>
  (case ((creg_name_matches_prefix s4673_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4674_0)) =>
  (case ((string_drop s4673_0 s4674_0)) of
        s4675_0 =>
  (case ((sep_matches_prefix s4675_0)) of
        SOME ((() , s4676_0)) =>
  (case ((string_drop s4675_0 s4676_0)) of
        s4677_0 =>
  (case ((creg_name_matches_prefix s4677_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s4678_0)) =>
  (case ((string_drop s4677_0 s4678_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4656_ : string -> maybe ((mword ty3 * mword ty3 * string))*)

val _ = Define `
 ((s4656_:string ->((3)words$word#(3)words$word#string)option) s4657_0=
    (let s4658_0 = s4657_0 in
   if ((string_startswith s4658_0 "c.or")) then  
  (case ((string_drop s4658_0 ((string_length "c.or")))) of
        s4659_0 =>
  (case ((spc_matches_prefix0 s4659_0)) of
        SOME ((() , s4660_0)) =>
  (case ((string_drop s4659_0 s4660_0)) of
        s4661_0 =>
  (case ((creg_name_matches_prefix s4661_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4662_0)) =>
  (case ((string_drop s4661_0 s4662_0)) of
        s4663_0 =>
  (case ((sep_matches_prefix s4663_0)) of
        SOME ((() , s4664_0)) =>
  (case ((string_drop s4663_0 s4664_0)) of
        s4665_0 =>
  (case ((creg_name_matches_prefix s4665_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s4666_0)) =>
  (case ((string_drop s4665_0 s4666_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4644_ : string -> maybe ((mword ty3 * mword ty3 * string))*)

val _ = Define `
 ((s4644_:string ->((3)words$word#(3)words$word#string)option) s4645_0=
    (let s4646_0 = s4645_0 in
   if ((string_startswith s4646_0 "c.xor")) then  
  (case ((string_drop s4646_0 ((string_length "c.xor")))) of
        s4647_0 =>
  (case ((spc_matches_prefix0 s4647_0)) of
        SOME ((() , s4648_0)) =>
  (case ((string_drop s4647_0 s4648_0)) of
        s4649_0 =>
  (case ((creg_name_matches_prefix s4649_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4650_0)) =>
  (case ((string_drop s4649_0 s4650_0)) of
        s4651_0 =>
  (case ((sep_matches_prefix s4651_0)) of
        SOME ((() , s4652_0)) =>
  (case ((string_drop s4651_0 s4652_0)) of
        s4653_0 =>
  (case ((creg_name_matches_prefix s4653_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s4654_0)) =>
  (case ((string_drop s4653_0 s4654_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4632_ : string -> maybe ((mword ty3 * mword ty3 * string))*)

val _ = Define `
 ((s4632_:string ->((3)words$word#(3)words$word#string)option) s4633_0=
    (let s4634_0 = s4633_0 in
   if ((string_startswith s4634_0 "c.sub")) then  
  (case ((string_drop s4634_0 ((string_length "c.sub")))) of
        s4635_0 =>
  (case ((spc_matches_prefix0 s4635_0)) of
        SOME ((() , s4636_0)) =>
  (case ((string_drop s4635_0 s4636_0)) of
        s4637_0 =>
  (case ((creg_name_matches_prefix s4637_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4638_0)) =>
  (case ((string_drop s4637_0 s4638_0)) of
        s4639_0 =>
  (case ((sep_matches_prefix s4639_0)) of
        SOME ((() , s4640_0)) =>
  (case ((string_drop s4639_0 s4640_0)) of
        s4641_0 =>
  (case ((creg_name_matches_prefix s4641_0 : (( 3 words$word # ii)) option)) of
        SOME ((rs2, s4642_0)) =>
  (case ((string_drop s4641_0 s4642_0)) of   s_ => SOME (rsd, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4620_ : string -> maybe ((mword ty3 * mword ty6 * string))*)

val _ = Define `
 ((s4620_:string ->((3)words$word#(6)words$word#string)option) s4621_0=
    (let s4622_0 = s4621_0 in
   if ((string_startswith s4622_0 "c.andi")) then  
  (case ((string_drop s4622_0 ((string_length "c.andi")))) of
        s4623_0 =>
  (case ((spc_matches_prefix0 s4623_0)) of
        SOME ((() , s4624_0)) =>
  (case ((string_drop s4623_0 s4624_0)) of
        s4625_0 =>
  (case ((creg_name_matches_prefix s4625_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4626_0)) =>
  (case ((string_drop s4625_0 s4626_0)) of
        s4627_0 =>
  (case ((sep_matches_prefix s4627_0)) of
        SOME ((() , s4628_0)) =>
  (case ((string_drop s4627_0 s4628_0)) of
        s4629_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4629_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4630_0)) =>
  (case ((string_drop s4629_0 s4630_0)) of   s_ => SOME (rsd, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4608_ : string -> maybe ((mword ty3 * mword ty6 * string))*)

val _ = Define `
 ((s4608_:string ->((3)words$word#(6)words$word#string)option) s4609_0=
    (let s4610_0 = s4609_0 in
   if ((string_startswith s4610_0 "c.srai")) then  
  (case ((string_drop s4610_0 ((string_length "c.srai")))) of
        s4611_0 =>
  (case ((spc_matches_prefix0 s4611_0)) of
        SOME ((() , s4612_0)) =>
  (case ((string_drop s4611_0 s4612_0)) of
        s4613_0 =>
  (case ((creg_name_matches_prefix s4613_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4614_0)) =>
  (case ((string_drop s4613_0 s4614_0)) of
        s4615_0 =>
  (case ((sep_matches_prefix s4615_0)) of
        SOME ((() , s4616_0)) =>
  (case ((string_drop s4615_0 s4616_0)) of
        s4617_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4617_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s4618_0)) =>
  (case ((string_drop s4617_0 s4618_0)) of   s_ => SOME (rsd, shamt, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4596_ : string -> maybe ((mword ty3 * mword ty6 * string))*)

val _ = Define `
 ((s4596_:string ->((3)words$word#(6)words$word#string)option) s4597_0=
    (let s4598_0 = s4597_0 in
   if ((string_startswith s4598_0 "c.srli")) then  
  (case ((string_drop s4598_0 ((string_length "c.srli")))) of
        s4599_0 =>
  (case ((spc_matches_prefix0 s4599_0)) of
        SOME ((() , s4600_0)) =>
  (case ((string_drop s4599_0 s4600_0)) of
        s4601_0 =>
  (case ((creg_name_matches_prefix s4601_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsd, s4602_0)) =>
  (case ((string_drop s4601_0 s4602_0)) of
        s4603_0 =>
  (case ((sep_matches_prefix s4603_0)) of
        SOME ((() , s4604_0)) =>
  (case ((string_drop s4603_0 s4604_0)) of
        s4605_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4605_0 : (( 6 words$word # ii)) option)) of
        SOME ((shamt, s4606_0)) =>
  (case ((string_drop s4605_0 s4606_0)) of   s_ => SOME (rsd, shamt, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4584_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4584_:string ->((5)words$word#(6)words$word#string)option) s4585_0=
    (let s4586_0 = s4585_0 in
   if ((string_startswith s4586_0 "c.lui")) then  
  (case ((string_drop s4586_0 ((string_length "c.lui")))) of
        s4587_0 =>
  (case ((spc_matches_prefix0 s4587_0)) of
        SOME ((() , s4588_0)) =>
  (case ((string_drop s4587_0 s4588_0)) of
        s4589_0 =>
  (case ((reg_name_matches_prefix s4589_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4590_0)) =>
  (case ((string_drop s4589_0 s4590_0)) of
        s4591_0 =>
  (case ((sep_matches_prefix s4591_0)) of
        SOME ((() , s4592_0)) =>
  (case ((string_drop s4591_0 s4592_0)) of
        s4593_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4593_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4594_0)) =>
  (case ((string_drop s4593_0 s4594_0)) of   s_ => SOME (rd, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4576_ : string -> maybe ((mword ty6 * string))*)

val _ = Define `
 ((s4576_:string ->((6)words$word#string)option) s4577_0=
    (let s4578_0 = s4577_0 in
   if ((string_startswith s4578_0 "c.addi16sp")) then  
  (case ((string_drop s4578_0 ((string_length "c.addi16sp")))) of
        s4579_0 =>
  (case ((spc_matches_prefix0 s4579_0)) of
        SOME ((() , s4580_0)) =>
  (case ((string_drop s4579_0 s4580_0)) of
        s4581_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4581_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4582_0)) =>
  (case ((string_drop s4581_0 s4582_0)) of   s_ => SOME (imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4564_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4564_:string ->((5)words$word#(6)words$word#string)option) s4565_0=
    (let s4566_0 = s4565_0 in
   if ((string_startswith s4566_0 "c.li")) then  
  (case ((string_drop s4566_0 ((string_length "c.li")))) of
        s4567_0 =>
  (case ((spc_matches_prefix0 s4567_0)) of
        SOME ((() , s4568_0)) =>
  (case ((string_drop s4567_0 s4568_0)) of
        s4569_0 =>
  (case ((reg_name_matches_prefix s4569_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4570_0)) =>
  (case ((string_drop s4569_0 s4570_0)) of
        s4571_0 =>
  (case ((sep_matches_prefix s4571_0)) of
        SOME ((() , s4572_0)) =>
  (case ((string_drop s4571_0 s4572_0)) of
        s4573_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4573_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4574_0)) =>
  (case ((string_drop s4573_0 s4574_0)) of   s_ => SOME (rd, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4552_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4552_:string ->((5)words$word#(6)words$word#string)option) s4553_0=
    (let s4554_0 = s4553_0 in
   if ((string_startswith s4554_0 "c.addiw")) then  
  (case ((string_drop s4554_0 ((string_length "c.addiw")))) of
        s4555_0 =>
  (case ((spc_matches_prefix0 s4555_0)) of
        SOME ((() , s4556_0)) =>
  (case ((string_drop s4555_0 s4556_0)) of
        s4557_0 =>
  (case ((reg_name_matches_prefix s4557_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s4558_0)) =>
  (case ((string_drop s4557_0 s4558_0)) of
        s4559_0 =>
  (case ((sep_matches_prefix s4559_0)) of
        SOME ((() , s4560_0)) =>
  (case ((string_drop s4559_0 s4560_0)) of
        s4561_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4561_0 : (( 6 words$word # ii)) option)) of
        SOME ((imm, s4562_0)) =>
  (case ((string_drop s4561_0 s4562_0)) of   s_ => SOME (rsd, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4544_ : string -> maybe ((mword ty11 * string))*)

val _ = Define `
 ((s4544_:string ->((11)words$word#string)option) s4545_0=
    (let s4546_0 = s4545_0 in
   if ((string_startswith s4546_0 "c.jal")) then  
  (case ((string_drop s4546_0 ((string_length "c.jal")))) of
        s4547_0 =>
  (case ((spc_matches_prefix0 s4547_0)) of
        SOME ((() , s4548_0)) =>
  (case ((string_drop s4547_0 s4548_0)) of
        s4549_0 =>
  (case ((hex_bits_12_matches_prefix0 s4549_0 : (( 12 words$word # ii)) option)) of
        SOME ((v__1216, s4550_0)) =>
  if (((((subrange_vec_dec v__1216 (( 0 : int): ii) (( 0 : int): ii) : 1 words$word))
          = (0b0w : 1 words$word)))) then
    let (imm : 11 words$word) = ((subrange_vec_dec v__1216 (( 11 : int): ii)
                                    (( 1 : int): ii) : 11 words$word)) in
    let (imm : 11 words$word) = ((subrange_vec_dec v__1216 (( 11 : int): ii)
                                    (( 1 : int): ii) : 11 words$word)) in
    (case ((string_drop s4549_0 s4550_0)) of   s_ => SOME (imm, s_) ) else
    NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4532_ : string -> maybe ((mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4532_:string ->((5)words$word#(6)words$word#string)option) s4533_0=
    (let s4534_0 = s4533_0 in
   if ((string_startswith s4534_0 "c.addi")) then  
  (case ((string_drop s4534_0 ((string_length "c.addi")))) of
        s4535_0 =>
  (case ((spc_matches_prefix0 s4535_0)) of
        SOME ((() , s4536_0)) =>
  (case ((string_drop s4535_0 s4536_0)) of
        s4537_0 =>
  (case ((reg_name_matches_prefix s4537_0 : (( 5 words$word # ii)) option)) of
        SOME ((rsd, s4538_0)) =>
  (case ((string_drop s4537_0 s4538_0)) of
        s4539_0 =>
  (case ((sep_matches_prefix s4539_0)) of
        SOME ((() , s4540_0)) =>
  (case ((string_drop s4539_0 s4540_0)) of
        s4541_0 =>
  (case ((hex_bits_6_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4541_0 : (( 6 words$word # ii)) option)) of
        SOME ((nzi, s4542_0)) =>
  (case ((string_drop s4541_0 s4542_0)) of   s_ => SOME (rsd, nzi, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4516_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5 * string))*)

val _ = Define `
 ((s4516_:string ->((3)words$word#(3)words$word#(5)words$word#string)option) s4517_0=
    (let s4518_0 = s4517_0 in
   if ((string_startswith s4518_0 "c.sd")) then  
  (case ((string_drop s4518_0 ((string_length "c.sd")))) of
        s4519_0 =>
  (case ((spc_matches_prefix0 s4519_0)) of
        SOME ((() , s4520_0)) =>
  (case ((string_drop s4519_0 s4520_0)) of
        s4521_0 =>
  (case ((creg_name_matches_prefix s4521_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s4522_0)) =>
  (case ((string_drop s4521_0 s4522_0)) of
        s4523_0 =>
  (case ((sep_matches_prefix s4523_0)) of
        SOME ((() , s4524_0)) =>
  (case ((string_drop s4523_0 s4524_0)) of
        s4525_0 =>
  (case ((creg_name_matches_prefix s4525_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s4526_0)) =>
  (case ((string_drop s4525_0 s4526_0)) of
        s4527_0 =>
  (case ((sep_matches_prefix s4527_0)) of
        SOME ((() , s4528_0)) =>
  (case ((string_drop s4527_0 s4528_0)) of
        s4529_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4529_0
         : (( 8 words$word # ii)) option)) of
        SOME ((v__1218, s4530_0)) =>
  if (((((subrange_vec_dec v__1218 (( 2 : int): ii) (( 0 : int): ii)
         : 3 words$word)) = (0b000w : 3 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1218 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1218 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    (case ((string_drop s4529_0 s4530_0)) of
          s_ => SOME (rsc1, rsc2, uimm, s_)
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4500_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5 * string))*)

val _ = Define `
 ((s4500_:string ->((3)words$word#(3)words$word#(5)words$word#string)option) s4501_0=
    (let s4502_0 = s4501_0 in
   if ((string_startswith s4502_0 "c.sw")) then  
  (case ((string_drop s4502_0 ((string_length "c.sw")))) of
        s4503_0 =>
  (case ((spc_matches_prefix0 s4503_0)) of
        SOME ((() , s4504_0)) =>
  (case ((string_drop s4503_0 s4504_0)) of
        s4505_0 =>
  (case ((creg_name_matches_prefix s4505_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc1, s4506_0)) =>
  (case ((string_drop s4505_0 s4506_0)) of
        s4507_0 =>
  (case ((sep_matches_prefix s4507_0)) of
        SOME ((() , s4508_0)) =>
  (case ((string_drop s4507_0 s4508_0)) of
        s4509_0 =>
  (case ((creg_name_matches_prefix s4509_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc2, s4510_0)) =>
  (case ((string_drop s4509_0 s4510_0)) of
        s4511_0 =>
  (case ((sep_matches_prefix s4511_0)) of
        SOME ((() , s4512_0)) =>
  (case ((string_drop s4511_0 s4512_0)) of
        s4513_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4513_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1220, s4514_0)) =>
  if (((((subrange_vec_dec v__1220 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1220 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1220 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    (case ((string_drop s4513_0 s4514_0)) of
          s_ => SOME (rsc1, rsc2, uimm, s_)
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4484_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5 * string))*)

val _ = Define `
 ((s4484_:string ->((3)words$word#(3)words$word#(5)words$word#string)option) s4485_0=
    (let s4486_0 = s4485_0 in
   if ((string_startswith s4486_0 "c.ld")) then  
  (case ((string_drop s4486_0 ((string_length "c.ld")))) of
        s4487_0 =>
  (case ((spc_matches_prefix0 s4487_0)) of
        SOME ((() , s4488_0)) =>
  (case ((string_drop s4487_0 s4488_0)) of
        s4489_0 =>
  (case ((creg_name_matches_prefix s4489_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s4490_0)) =>
  (case ((string_drop s4489_0 s4490_0)) of
        s4491_0 =>
  (case ((sep_matches_prefix s4491_0)) of
        SOME ((() , s4492_0)) =>
  (case ((string_drop s4491_0 s4492_0)) of
        s4493_0 =>
  (case ((creg_name_matches_prefix s4493_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s4494_0)) =>
  (case ((string_drop s4493_0 s4494_0)) of
        s4495_0 =>
  (case ((sep_matches_prefix s4495_0)) of
        SOME ((() , s4496_0)) =>
  (case ((string_drop s4495_0 s4496_0)) of
        s4497_0 =>
  (case ((hex_bits_8_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4497_0
         : (( 8 words$word # ii)) option)) of
        SOME ((v__1222, s4498_0)) =>
  if (((((subrange_vec_dec v__1222 (( 2 : int): ii) (( 0 : int): ii)
         : 3 words$word)) = (0b000w : 3 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1222 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1222 (( 7 : int): ii) (( 3 : int): ii) : 5 words$word)) in
    (case ((string_drop s4497_0 s4498_0)) of
          s_ => SOME (rdc, rsc, uimm, s_)
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4468_ : string -> maybe ((mword ty3 * mword ty3 * mword ty5 * string))*)

val _ = Define `
 ((s4468_:string ->((3)words$word#(3)words$word#(5)words$word#string)option) s4469_0=
    (let s4470_0 = s4469_0 in
   if ((string_startswith s4470_0 "c.lw")) then  
  (case ((string_drop s4470_0 ((string_length "c.lw")))) of
        s4471_0 =>
  (case ((spc_matches_prefix0 s4471_0)) of
        SOME ((() , s4472_0)) =>
  (case ((string_drop s4471_0 s4472_0)) of
        s4473_0 =>
  (case ((creg_name_matches_prefix s4473_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s4474_0)) =>
  (case ((string_drop s4473_0 s4474_0)) of
        s4475_0 =>
  (case ((sep_matches_prefix s4475_0)) of
        SOME ((() , s4476_0)) =>
  (case ((string_drop s4475_0 s4476_0)) of
        s4477_0 =>
  (case ((creg_name_matches_prefix s4477_0 : (( 3 words$word # ii)) option)) of
        SOME ((rsc, s4478_0)) =>
  (case ((string_drop s4477_0 s4478_0)) of
        s4479_0 =>
  (case ((sep_matches_prefix s4479_0)) of
        SOME ((() , s4480_0)) =>
  (case ((string_drop s4479_0 s4480_0)) of
        s4481_0 =>
  (case ((hex_bits_7_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4481_0
         : (( 7 words$word # ii)) option)) of
        SOME ((v__1224, s4482_0)) =>
  if (((((subrange_vec_dec v__1224 (( 1 : int): ii) (( 0 : int): ii)
         : 2 words$word)) = (0b00w : 2 words$word)))) then
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1224 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    let (uimm : 5 words$word) =
        ((subrange_vec_dec v__1224 (( 6 : int): ii) (( 2 : int): ii) : 5 words$word)) in
    (case ((string_drop s4481_0 s4482_0)) of
          s_ => SOME (rdc, rsc, uimm, s_)
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4456_ : string -> maybe ((mword ty3 * mword ty8 * string))*)

val _ = Define `
 ((s4456_:string ->((3)words$word#(8)words$word#string)option) s4457_0=
    (let s4458_0 = s4457_0 in
   if ((string_startswith s4458_0 "c.addi4spn")) then  
  (case ((string_drop s4458_0 ((string_length "c.addi4spn")))) of
        s4459_0 =>
  (case ((spc_matches_prefix0 s4459_0)) of
        SOME ((() , s4460_0)) =>
  (case ((string_drop s4459_0 s4460_0)) of
        s4461_0 =>
  (case ((creg_name_matches_prefix s4461_0 : (( 3 words$word # ii)) option)) of
        SOME ((rdc, s4462_0)) =>
  (case ((string_drop s4461_0 s4462_0)) of
        s4463_0 =>
  (case ((sep_matches_prefix s4463_0)) of
        SOME ((() , s4464_0)) =>
  (case ((string_drop s4463_0 s4464_0)) of
        s4465_0 =>
  (case ((hex_bits_10_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4465_0 : (( 10 words$word # ii)) option)) of
        SOME ((v__1226, s4466_0)) =>
  if (((((subrange_vec_dec v__1226 (( 1 : int): ii) (( 0 : int): ii) : 2 words$word))
          = (0b00w : 2 words$word)))) then
    let (nzimm : 8 words$word) =
        ((subrange_vec_dec v__1226 (( 9 : int): ii) (( 2 : int): ii) : 8 words$word)) in
    let (nzimm : 8 words$word) =
        ((subrange_vec_dec v__1226 (( 9 : int): ii) (( 2 : int): ii) : 8 words$word)) in
    (case ((string_drop s4465_0 s4466_0)) of   s_ => SOME (rdc, nzimm, s_) )
  else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4452_ : string -> maybe string*)

val _ = Define `
 ((s4452_:string ->(string)option) s4453_0=
    (let s4454_0 = s4453_0 in
   if ((string_startswith s4454_0 "c.nop")) then  
  (case ((string_drop s4454_0 ((string_length "c.nop")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s4426_ : string -> maybe ((amoop * word_width * bool * bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4426_:string ->(amoop#word_width#bool#bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4427_0= 
  ((case s4427_0 of
         s4428_0 =>
   (case ((amo_mnemonic_matches_prefix s4428_0)) of
         SOME ((op, s4429_0)) =>
   let s4430_0 = (string_drop s4428_0 s4429_0) in
   if ((string_startswith s4430_0 ".")) then
     (case ((string_drop s4430_0 ((string_length ".")))) of
           s4431_0 =>
     (case ((size_mnemonic_matches_prefix s4431_0)) of
           SOME ((width, s4432_0)) =>
     (case ((string_drop s4431_0 s4432_0)) of
           s4433_0 =>
     (case ((maybe_aq_matches_prefix s4433_0)) of
           SOME ((aq, s4434_0)) =>
     (case ((string_drop s4433_0 s4434_0)) of
           s4435_0 =>
     (case ((maybe_rl_matches_prefix s4435_0)) of
           SOME ((rl, s4436_0)) =>
     (case ((string_drop s4435_0 s4436_0)) of
           s4437_0 =>
     (case ((spc_matches_prefix0 s4437_0)) of
           SOME ((() , s4438_0)) =>
     (case ((string_drop s4437_0 s4438_0)) of
           s4439_0 =>
     (case ((reg_name_matches_prefix s4439_0 : (( 5 words$word # ii)) option)) of
           SOME ((rd, s4440_0)) =>
     (case ((string_drop s4439_0 s4440_0)) of
           s4441_0 =>
     (case ((sep_matches_prefix s4441_0)) of
           SOME ((() , s4442_0)) =>
     (case ((string_drop s4441_0 s4442_0)) of
           s4443_0 =>
     (case ((reg_name_matches_prefix s4443_0 : (( 5 words$word # ii)) option)) of
           SOME ((rs2, s4444_0)) =>
     (case ((string_drop s4443_0 s4444_0)) of
           s4445_0 =>
     (case ((sep_matches_prefix s4445_0)) of
           SOME ((() , s4446_0)) =>
     let s4447_0 = (string_drop s4445_0 s4446_0) in
     if ((string_startswith s4447_0 "(")) then
       (case ((string_drop s4447_0 ((string_length "(")))) of
             s4448_0 =>
       (case ((reg_name_matches_prefix s4448_0
              : (( 5 words$word # ii)) option)) of
             SOME ((rs1, s4449_0)) =>
       let s4450_0 = (string_drop s4448_0 s4449_0) in
       if ((string_startswith s4450_0 ")")) then
         (case ((string_drop s4450_0 ((string_length ")")))) of
               s_ =>
         SOME (op, width, aq, rl, rd, rs2, rs1, s_)
         ) else NONE
         | _ => NONE
       )
       ) else NONE
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     )
       | _ => NONE
     )
     ) else NONE
     | _ => NONE
   )
   )))`;


(*val _s4404_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4404_:string ->(word_width#bool#bool#(5)words$word#(5)words$word#(5)words$word#string)option) s4405_0=
    (let s4406_0 = s4405_0 in
   if ((string_startswith s4406_0 "sc.")) then  
  (case ((string_drop s4406_0 ((string_length "sc.")))) of
        s4407_0 =>
  (case ((size_mnemonic_matches_prefix s4407_0)) of
        SOME ((size1, s4408_0)) =>
  (case ((string_drop s4407_0 s4408_0)) of
        s4409_0 =>
  (case ((maybe_aq_matches_prefix s4409_0)) of
        SOME ((aq, s4410_0)) =>
  (case ((string_drop s4409_0 s4410_0)) of
        s4411_0 =>
  (case ((maybe_rl_matches_prefix s4411_0)) of
        SOME ((rl, s4412_0)) =>
  (case ((string_drop s4411_0 s4412_0)) of
        s4413_0 =>
  (case ((spc_matches_prefix0 s4413_0)) of
        SOME ((() , s4414_0)) =>
  (case ((string_drop s4413_0 s4414_0)) of
        s4415_0 =>
  (case ((reg_name_matches_prefix s4415_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4416_0)) =>
  (case ((string_drop s4415_0 s4416_0)) of
        s4417_0 =>
  (case ((sep_matches_prefix s4417_0)) of
        SOME ((() , s4418_0)) =>
  (case ((string_drop s4417_0 s4418_0)) of
        s4419_0 =>
  (case ((reg_name_matches_prefix s4419_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4420_0)) =>
  (case ((string_drop s4419_0 s4420_0)) of
        s4421_0 =>
  (case ((sep_matches_prefix s4421_0)) of
        SOME ((() , s4422_0)) =>
  (case ((string_drop s4421_0 s4422_0)) of
        s4423_0 =>
  (case ((reg_name_matches_prefix s4423_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4424_0)) =>
  (case ((string_drop s4423_0 s4424_0)) of
        s_ =>
  SOME (size1, aq, rl, rd, rs1, rs2, s_)
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4386_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4386_:string ->(word_width#bool#bool#(5)words$word#(5)words$word#string)option) s4387_0=
    (let s4388_0 = s4387_0 in
   if ((string_startswith s4388_0 "lr.")) then  
  (case ((string_drop s4388_0 ((string_length "lr.")))) of
        s4389_0 =>
  (case ((size_mnemonic_matches_prefix s4389_0)) of
        SOME ((size1, s4390_0)) =>
  (case ((string_drop s4389_0 s4390_0)) of
        s4391_0 =>
  (case ((maybe_aq_matches_prefix s4391_0)) of
        SOME ((aq, s4392_0)) =>
  (case ((string_drop s4391_0 s4392_0)) of
        s4393_0 =>
  (case ((maybe_rl_matches_prefix s4393_0)) of
        SOME ((rl, s4394_0)) =>
  (case ((string_drop s4393_0 s4394_0)) of
        s4395_0 =>
  (case ((spc_matches_prefix0 s4395_0)) of
        SOME ((() , s4396_0)) =>
  (case ((string_drop s4395_0 s4396_0)) of
        s4397_0 =>
  (case ((reg_name_matches_prefix s4397_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4398_0)) =>
  (case ((string_drop s4397_0 s4398_0)) of
        s4399_0 =>
  (case ((sep_matches_prefix s4399_0)) of
        SOME ((() , s4400_0)) =>
  (case ((string_drop s4399_0 s4400_0)) of
        s4401_0 =>
  (case ((reg_name_matches_prefix s4401_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4402_0)) =>
  (case ((string_drop s4401_0 s4402_0)) of
        s_ => SOME (size1, aq, rl, rd, rs1, s_)
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4374_ : string -> maybe ((mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4374_:string ->((5)words$word#(5)words$word#string)option) s4375_0=
    (let s4376_0 = s4375_0 in
   if ((string_startswith s4376_0 "sfence.vma")) then  
  (case ((string_drop s4376_0 ((string_length "sfence.vma")))) of
        s4377_0 =>
  (case ((spc_matches_prefix0 s4377_0)) of
        SOME ((() , s4378_0)) =>
  (case ((string_drop s4377_0 s4378_0)) of
        s4379_0 =>
  (case ((reg_name_matches_prefix s4379_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4380_0)) =>
  (case ((string_drop s4379_0 s4380_0)) of
        s4381_0 =>
  (case ((sep_matches_prefix s4381_0)) of
        SOME ((() , s4382_0)) =>
  (case ((string_drop s4381_0 s4382_0)) of
        s4383_0 =>
  (case ((reg_name_matches_prefix s4383_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4384_0)) =>
  (case ((string_drop s4383_0 s4384_0)) of   s_ => SOME (rs1, rs2, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4370_ : string -> maybe string*)

val _ = Define `
 ((s4370_:string ->(string)option) s4371_0=
    (let s4372_0 = s4371_0 in
   if ((string_startswith s4372_0 "wfi")) then  
  (case ((string_drop s4372_0 ((string_length "wfi")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s4366_ : string -> maybe string*)

val _ = Define `
 ((s4366_:string ->(string)option) s4367_0=
    (let s4368_0 = s4367_0 in
   if ((string_startswith s4368_0 "ebreak")) then  
  (case ((string_drop s4368_0 ((string_length "ebreak")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s4362_ : string -> maybe string*)

val _ = Define `
 ((s4362_:string ->(string)option) s4363_0=
    (let s4364_0 = s4363_0 in
   if ((string_startswith s4364_0 "sret")) then  
  (case ((string_drop s4364_0 ((string_length "sret")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s4358_ : string -> maybe string*)

val _ = Define `
 ((s4358_:string ->(string)option) s4359_0=
    (let s4360_0 = s4359_0 in
   if ((string_startswith s4360_0 "mret")) then  
  (case ((string_drop s4360_0 ((string_length "mret")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s4354_ : string -> maybe string*)

val _ = Define `
 ((s4354_:string ->(string)option) s4355_0=
    (let s4356_0 = s4355_0 in
   if ((string_startswith s4356_0 "ecall")) then  
  (case ((string_drop s4356_0 ((string_length "ecall")))) of   s_ => SOME s_ )
   else NONE))`;


(*val _s4350_ : string -> maybe string*)

val _ = Define `
 ((s4350_:string ->(string)option) s4351_0=
    (let s4352_0 = s4351_0 in
   if ((string_startswith s4352_0 "fence.i")) then  
  (case ((string_drop s4352_0 ((string_length "fence.i")))) of
        s_ => SOME s_
  )
   else NONE))`;


(*val _s4338_ : string -> maybe ((mword ty4 * mword ty4 * string))*)

val _ = Define `
 ((s4338_:string ->((4)words$word#(4)words$word#string)option) s4339_0=
    (let s4340_0 = s4339_0 in
   if ((string_startswith s4340_0 "fence.tso")) then  
  (case ((string_drop s4340_0 ((string_length "fence.tso")))) of
        s4341_0 =>
  (case ((spc_matches_prefix0 s4341_0)) of
        SOME ((() , s4342_0)) =>
  (case ((string_drop s4341_0 s4342_0)) of
        s4343_0 =>
  (case ((fence_bits_matches_prefix s4343_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s4344_0)) =>
  (case ((string_drop s4343_0 s4344_0)) of
        s4345_0 =>
  (case ((sep_matches_prefix s4345_0)) of
        SOME ((() , s4346_0)) =>
  (case ((string_drop s4345_0 s4346_0)) of
        s4347_0 =>
  (case ((fence_bits_matches_prefix s4347_0 : (( 4 words$word # ii)) option)) of
        SOME ((succ, s4348_0)) =>
  (case ((string_drop s4347_0 s4348_0)) of   s_ => SOME (pred, succ, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4326_ : string -> maybe ((mword ty4 * mword ty4 * string))*)

val _ = Define `
 ((s4326_:string ->((4)words$word#(4)words$word#string)option) s4327_0=
    (let s4328_0 = s4327_0 in
   if ((string_startswith s4328_0 "fence")) then  
  (case ((string_drop s4328_0 ((string_length "fence")))) of
        s4329_0 =>
  (case ((spc_matches_prefix0 s4329_0)) of
        SOME ((() , s4330_0)) =>
  (case ((string_drop s4329_0 s4330_0)) of
        s4331_0 =>
  (case ((fence_bits_matches_prefix s4331_0 : (( 4 words$word # ii)) option)) of
        SOME ((pred, s4332_0)) =>
  (case ((string_drop s4331_0 s4332_0)) of
        s4333_0 =>
  (case ((sep_matches_prefix s4333_0)) of
        SOME ((() , s4334_0)) =>
  (case ((string_drop s4333_0 s4334_0)) of
        s4335_0 =>
  (case ((fence_bits_matches_prefix s4335_0 : (( 4 words$word # ii)) option)) of
        SOME ((succ, s4336_0)) =>
  (case ((string_drop s4335_0 s4336_0)) of   s_ => SOME (pred, succ, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4309_ : string -> maybe ((sopw * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4309_:string ->(sopw#(5)words$word#(5)words$word#(5)words$word#string)option) s4310_0= 
  ((case s4310_0 of
         s4311_0 =>
   (case ((shiftiwop_mnemonic_matches_prefix s4311_0)) of
         SOME ((op, s4312_0)) =>
   (case ((string_drop s4311_0 s4312_0)) of
         s4313_0 =>
   (case ((spc_matches_prefix0 s4313_0)) of
         SOME ((() , s4314_0)) =>
   (case ((string_drop s4313_0 s4314_0)) of
         s4315_0 =>
   (case ((reg_name_matches_prefix s4315_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4316_0)) =>
   (case ((string_drop s4315_0 s4316_0)) of
         s4317_0 =>
   (case ((sep_matches_prefix s4317_0)) of
         SOME ((() , s4318_0)) =>
   (case ((string_drop s4317_0 s4318_0)) of
         s4319_0 =>
   (case ((reg_name_matches_prefix s4319_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4320_0)) =>
   (case ((string_drop s4319_0 s4320_0)) of
         s4321_0 =>
   (case ((sep_matches_prefix s4321_0)) of
         SOME ((() , s4322_0)) =>
   (case ((string_drop s4321_0 s4322_0)) of
         s4323_0 =>
   (case ((hex_bits_5_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s4323_0 : (( 5 words$word # ii)) option)) of
         SOME ((shamt, s4324_0)) =>
   (case ((string_drop s4323_0 s4324_0)) of
         s_ => SOME (op, rd, rs1, shamt, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4292_ : string -> maybe ((ropw * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4292_:string ->(ropw#(5)words$word#(5)words$word#(5)words$word#string)option) s4293_0= 
  ((case s4293_0 of
         s4294_0 =>
   (case ((rtypew_mnemonic_matches_prefix s4294_0)) of
         SOME ((op, s4295_0)) =>
   (case ((string_drop s4294_0 s4295_0)) of
         s4296_0 =>
   (case ((spc_matches_prefix0 s4296_0)) of
         SOME ((() , s4297_0)) =>
   (case ((string_drop s4296_0 s4297_0)) of
         s4298_0 =>
   (case ((reg_name_matches_prefix s4298_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4299_0)) =>
   (case ((string_drop s4298_0 s4299_0)) of
         s4300_0 =>
   (case ((sep_matches_prefix s4300_0)) of
         SOME ((() , s4301_0)) =>
   (case ((string_drop s4300_0 s4301_0)) of
         s4302_0 =>
   (case ((reg_name_matches_prefix s4302_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4303_0)) =>
   (case ((string_drop s4302_0 s4303_0)) of
         s4304_0 =>
   (case ((sep_matches_prefix s4304_0)) of
         SOME ((() , s4305_0)) =>
   (case ((string_drop s4304_0 s4305_0)) of
         s4306_0 =>
   (case ((reg_name_matches_prefix s4306_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s4307_0)) =>
   (case ((string_drop s4306_0 s4307_0)) of
         s_ => SOME (op, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4275_ : string -> maybe ((sop * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4275_:string ->(sop#(5)words$word#(5)words$word#(5)words$word#string)option) s4276_0= 
  ((case s4276_0 of
         s4277_0 =>
   (case ((shiftw_mnemonic_matches_prefix s4277_0)) of
         SOME ((op, s4278_0)) =>
   (case ((string_drop s4277_0 s4278_0)) of
         s4279_0 =>
   (case ((spc_matches_prefix0 s4279_0)) of
         SOME ((() , s4280_0)) =>
   (case ((string_drop s4279_0 s4280_0)) of
         s4281_0 =>
   (case ((reg_name_matches_prefix s4281_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4282_0)) =>
   (case ((string_drop s4281_0 s4282_0)) of
         s4283_0 =>
   (case ((sep_matches_prefix s4283_0)) of
         SOME ((() , s4284_0)) =>
   (case ((string_drop s4283_0 s4284_0)) of
         s4285_0 =>
   (case ((reg_name_matches_prefix s4285_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4286_0)) =>
   (case ((string_drop s4285_0 s4286_0)) of
         s4287_0 =>
   (case ((sep_matches_prefix s4287_0)) of
         SOME ((() , s4288_0)) =>
   (case ((string_drop s4287_0 s4288_0)) of
         s4289_0 =>
   (case ((hex_bits_5_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s4289_0 : (( 5 words$word # ii)) option)) of
         SOME ((shamt, s4290_0)) =>
   (case ((string_drop s4289_0 s4290_0)) of
         s_ => SOME (op, rd, rs1, shamt, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4259_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12 * string))*)

val _ = Define `
 ((s4259_:string ->((5)words$word#(5)words$word#(12)words$word#string)option) s4260_0=
    (let s4261_0 = s4260_0 in
   if ((string_startswith s4261_0 "addiw")) then  
  (case ((string_drop s4261_0 ((string_length "addiw")))) of
        s4262_0 =>
  (case ((spc_matches_prefix0 s4262_0)) of
        SOME ((() , s4263_0)) =>
  (case ((string_drop s4262_0 s4263_0)) of
        s4264_0 =>
  (case ((reg_name_matches_prefix s4264_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4265_0)) =>
  (case ((string_drop s4264_0 s4265_0)) of
        s4266_0 =>
  (case ((sep_matches_prefix s4266_0)) of
        SOME ((() , s4267_0)) =>
  (case ((string_drop s4266_0 s4267_0)) of
        s4268_0 =>
  (case ((reg_name_matches_prefix s4268_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4269_0)) =>
  (case ((string_drop s4268_0 s4269_0)) of
        s4270_0 =>
  (case ((sep_matches_prefix s4270_0)) of
        SOME ((() , s4271_0)) =>
  (case ((string_drop s4270_0 s4271_0)) of
        s4272_0 =>
  (case ((hex_bits_12_matches_prefix0 s4272_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s4273_0)) =>
  (case ((string_drop s4272_0 s4273_0)) of   s_ => SOME (rd, rs1, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4231_ : string -> maybe ((word_width * bool * bool * mword ty5 * mword ty12 * mword ty5 * string))*)

val _ = Define `
 ((s4231_:string ->(word_width#bool#bool#(5)words$word#(12)words$word#(5)words$word#string)option) s4232_0=
    (let s4233_0 = s4232_0 in
   if ((string_startswith s4233_0 "s")) then  
  (case ((string_drop s4233_0 ((string_length "s")))) of
        s4234_0 =>
  (case ((size_mnemonic_matches_prefix s4234_0)) of
        SOME ((size1, s4235_0)) =>
  (case ((string_drop s4234_0 s4235_0)) of
        s4236_0 =>
  (case ((maybe_aq_matches_prefix s4236_0)) of
        SOME ((aq, s4237_0)) =>
  (case ((string_drop s4236_0 s4237_0)) of
        s4238_0 =>
  (case ((maybe_rl_matches_prefix s4238_0)) of
        SOME ((rl, s4239_0)) =>
  (case ((string_drop s4238_0 s4239_0)) of
        s4240_0 =>
  (case ((spc_matches_prefix0 s4240_0)) of
        SOME ((() , s4241_0)) =>
  (case ((string_drop s4240_0 s4241_0)) of
        s4242_0 =>
  (case ((reg_name_matches_prefix s4242_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs2, s4243_0)) =>
  (case ((string_drop s4242_0 s4243_0)) of
        s4244_0 =>
  (case ((sep_matches_prefix s4244_0)) of
        SOME ((() , s4245_0)) =>
  (case ((string_drop s4244_0 s4245_0)) of
        s4246_0 =>
  (case ((hex_bits_12_matches_prefix0 s4246_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s4247_0)) =>
  (case ((string_drop s4246_0 s4247_0)) of
        s4248_0 =>
  (case ((opt_spc_matches_prefix0 s4248_0)) of
        SOME ((() , s4249_0)) =>
  let s4250_0 = (string_drop s4248_0 s4249_0) in
  if ((string_startswith s4250_0 "(")) then
    (case ((string_drop s4250_0 ((string_length "(")))) of
          s4251_0 =>
    (case ((opt_spc_matches_prefix0 s4251_0)) of
          SOME ((() , s4252_0)) =>
    (case ((string_drop s4251_0 s4252_0)) of
          s4253_0 =>
    (case ((reg_name_matches_prefix s4253_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s4254_0)) =>
    (case ((string_drop s4253_0 s4254_0)) of
          s4255_0 =>
    (case ((opt_spc_matches_prefix0 s4255_0)) of
          SOME ((() , s4256_0)) =>
    let s4257_0 = (string_drop s4255_0 s4256_0) in
    if ((string_startswith s4257_0 ")")) then
      (case ((string_drop s4257_0 ((string_length ")")))) of
            s_ =>
      SOME (size1, aq, rl, rs2, imm, rs1, s_)
      ) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4201_ : string -> maybe ((word_width * bool * bool * bool * mword ty5 * mword ty12 * mword ty5 * string))*)

val _ = Define `
 ((s4201_:string ->(word_width#bool#bool#bool#(5)words$word#(12)words$word#(5)words$word#string)option) s4202_0=
    (let s4203_0 = s4202_0 in
   if ((string_startswith s4203_0 "l")) then  
  (case ((string_drop s4203_0 ((string_length "l")))) of
        s4204_0 =>
  (case ((size_mnemonic_matches_prefix s4204_0)) of
        SOME ((size1, s4205_0)) =>
  (case ((string_drop s4204_0 s4205_0)) of
        s4206_0 =>
  (case ((maybe_u_matches_prefix s4206_0)) of
        SOME ((is_unsigned, s4207_0)) =>
  (case ((string_drop s4206_0 s4207_0)) of
        s4208_0 =>
  (case ((maybe_aq_matches_prefix s4208_0)) of
        SOME ((aq, s4209_0)) =>
  (case ((string_drop s4208_0 s4209_0)) of
        s4210_0 =>
  (case ((maybe_rl_matches_prefix s4210_0)) of
        SOME ((rl, s4211_0)) =>
  (case ((string_drop s4210_0 s4211_0)) of
        s4212_0 =>
  (case ((spc_matches_prefix0 s4212_0)) of
        SOME ((() , s4213_0)) =>
  (case ((string_drop s4212_0 s4213_0)) of
        s4214_0 =>
  (case ((reg_name_matches_prefix s4214_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4215_0)) =>
  (case ((string_drop s4214_0 s4215_0)) of
        s4216_0 =>
  (case ((sep_matches_prefix s4216_0)) of
        SOME ((() , s4217_0)) =>
  (case ((string_drop s4216_0 s4217_0)) of
        s4218_0 =>
  (case ((hex_bits_12_matches_prefix0 s4218_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s4219_0)) =>
  (case ((string_drop s4218_0 s4219_0)) of
        s4220_0 =>
  (case ((opt_spc_matches_prefix0 s4220_0)) of
        SOME ((() , s4221_0)) =>
  let s4222_0 = (string_drop s4220_0 s4221_0) in
  if ((string_startswith s4222_0 "(")) then
    (case ((string_drop s4222_0 ((string_length "(")))) of
          s4223_0 =>
    (case ((opt_spc_matches_prefix0 s4223_0)) of
          SOME ((() , s4224_0)) =>
    (case ((string_drop s4223_0 s4224_0)) of
          s4225_0 =>
    (case ((reg_name_matches_prefix s4225_0 : (( 5 words$word # ii)) option)) of
          SOME ((rs1, s4226_0)) =>
    (case ((string_drop s4225_0 s4226_0)) of
          s4227_0 =>
    (case ((opt_spc_matches_prefix0 s4227_0)) of
          SOME ((() , s4228_0)) =>
    let s4229_0 = (string_drop s4227_0 s4228_0) in
    if ((string_startswith s4229_0 ")")) then
      (case ((string_drop s4229_0 ((string_length ")")))) of
            s_ =>
      SOME (size1, is_unsigned, aq, rl, rd, imm, rs1, s_)
      ) else NONE
      | _ => NONE
    )
    )
      | _ => NONE
    )
    )
      | _ => NONE
    )
    ) else NONE
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4184_ : string -> maybe ((rop * mword ty5 * mword ty5 * mword ty5 * string))*)

val _ = Define `
 ((s4184_:string ->(rop#(5)words$word#(5)words$word#(5)words$word#string)option) s4185_0= 
  ((case s4185_0 of
         s4186_0 =>
   (case ((rtype_mnemonic_matches_prefix s4186_0)) of
         SOME ((op, s4187_0)) =>
   (case ((string_drop s4186_0 s4187_0)) of
         s4188_0 =>
   (case ((spc_matches_prefix0 s4188_0)) of
         SOME ((() , s4189_0)) =>
   (case ((string_drop s4188_0 s4189_0)) of
         s4190_0 =>
   (case ((reg_name_matches_prefix s4190_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4191_0)) =>
   (case ((string_drop s4190_0 s4191_0)) of
         s4192_0 =>
   (case ((sep_matches_prefix s4192_0)) of
         SOME ((() , s4193_0)) =>
   (case ((string_drop s4192_0 s4193_0)) of
         s4194_0 =>
   (case ((reg_name_matches_prefix s4194_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4195_0)) =>
   (case ((string_drop s4194_0 s4195_0)) of
         s4196_0 =>
   (case ((sep_matches_prefix s4196_0)) of
         SOME ((() , s4197_0)) =>
   (case ((string_drop s4196_0 s4197_0)) of
         s4198_0 =>
   (case ((reg_name_matches_prefix s4198_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s4199_0)) =>
   (case ((string_drop s4198_0 s4199_0)) of
         s_ => SOME (op, rd, rs1, rs2, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4167_ : string -> maybe ((sop * mword ty5 * mword ty5 * mword ty6 * string))*)

val _ = Define `
 ((s4167_:string ->(sop#(5)words$word#(5)words$word#(6)words$word#string)option) s4168_0= 
  ((case s4168_0 of
         s4169_0 =>
   (case ((shiftiop_mnemonic_matches_prefix s4169_0)) of
         SOME ((op, s4170_0)) =>
   (case ((string_drop s4169_0 s4170_0)) of
         s4171_0 =>
   (case ((spc_matches_prefix0 s4171_0)) of
         SOME ((() , s4172_0)) =>
   (case ((string_drop s4171_0 s4172_0)) of
         s4173_0 =>
   (case ((reg_name_matches_prefix s4173_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4174_0)) =>
   (case ((string_drop s4173_0 s4174_0)) of
         s4175_0 =>
   (case ((sep_matches_prefix s4175_0)) of
         SOME ((() , s4176_0)) =>
   (case ((string_drop s4175_0 s4176_0)) of
         s4177_0 =>
   (case ((reg_name_matches_prefix s4177_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4178_0)) =>
   (case ((string_drop s4177_0 s4178_0)) of
         s4179_0 =>
   (case ((sep_matches_prefix s4179_0)) of
         SOME ((() , s4180_0)) =>
   (case ((string_drop s4179_0 s4180_0)) of
         s4181_0 =>
   (case ((hex_bits_6_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s4181_0 : (( 6 words$word # ii)) option)) of
         SOME ((shamt, s4182_0)) =>
   (case ((string_drop s4181_0 s4182_0)) of
         s_ => SOME (op, rd, rs1, shamt, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4150_ : string -> maybe ((iop * mword ty5 * mword ty5 * mword ty12 * string))*)

val _ = Define `
 ((s4150_:string ->(iop#(5)words$word#(5)words$word#(12)words$word#string)option) s4151_0= 
  ((case s4151_0 of
         s4152_0 =>
   (case ((itype_mnemonic_matches_prefix s4152_0)) of
         SOME ((op, s4153_0)) =>
   (case ((string_drop s4152_0 s4153_0)) of
         s4154_0 =>
   (case ((spc_matches_prefix0 s4154_0)) of
         SOME ((() , s4155_0)) =>
   (case ((string_drop s4154_0 s4155_0)) of
         s4156_0 =>
   (case ((reg_name_matches_prefix s4156_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4157_0)) =>
   (case ((string_drop s4156_0 s4157_0)) of
         s4158_0 =>
   (case ((sep_matches_prefix s4158_0)) of
         SOME ((() , s4159_0)) =>
   (case ((string_drop s4158_0 s4159_0)) of
         s4160_0 =>
   (case ((reg_name_matches_prefix s4160_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4161_0)) =>
   (case ((string_drop s4160_0 s4161_0)) of
         s4162_0 =>
   (case ((sep_matches_prefix s4162_0)) of
         SOME ((() , s4163_0)) =>
   (case ((string_drop s4162_0 s4163_0)) of
         s4164_0 =>
   (case ((hex_bits_12_matches_prefix0 s4164_0
          : (( 12 words$word # ii)) option)) of
         SOME ((imm, s4165_0)) =>
   (case ((string_drop s4164_0 s4165_0)) of
         s_ => SOME (op, rd, rs1, imm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4133_ : string -> maybe ((bop * mword ty5 * mword ty5 * mword ty13 * string))*)

val _ = Define `
 ((s4133_:string ->(bop#(5)words$word#(5)words$word#(13)words$word#string)option) s4134_0= 
  ((case s4134_0 of
         s4135_0 =>
   (case ((btype_mnemonic_matches_prefix s4135_0)) of
         SOME ((op, s4136_0)) =>
   (case ((string_drop s4135_0 s4136_0)) of
         s4137_0 =>
   (case ((spc_matches_prefix0 s4137_0)) of
         SOME ((() , s4138_0)) =>
   (case ((string_drop s4137_0 s4138_0)) of
         s4139_0 =>
   (case ((reg_name_matches_prefix s4139_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs1, s4140_0)) =>
   (case ((string_drop s4139_0 s4140_0)) of
         s4141_0 =>
   (case ((sep_matches_prefix s4141_0)) of
         SOME ((() , s4142_0)) =>
   (case ((string_drop s4141_0 s4142_0)) of
         s4143_0 =>
   (case ((reg_name_matches_prefix s4143_0 : (( 5 words$word # ii)) option)) of
         SOME ((rs2, s4144_0)) =>
   (case ((string_drop s4143_0 s4144_0)) of
         s4145_0 =>
   (case ((sep_matches_prefix s4145_0)) of
         SOME ((() , s4146_0)) =>
   (case ((string_drop s4145_0 s4146_0)) of
         s4147_0 =>
   (case ((hex_bits_13_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s4147_0 : (( 13 words$word # ii)) option)) of
         SOME ((imm, s4148_0)) =>
   (case ((string_drop s4147_0 s4148_0)) of
         s_ => SOME (op, rs1, rs2, imm, s_)
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


(*val _s4117_ : string -> maybe ((mword ty5 * mword ty5 * mword ty12 * string))*)

val _ = Define `
 ((s4117_:string ->((5)words$word#(5)words$word#(12)words$word#string)option) s4118_0=
    (let s4119_0 = s4118_0 in
   if ((string_startswith s4119_0 "jalr")) then  
  (case ((string_drop s4119_0 ((string_length "jalr")))) of
        s4120_0 =>
  (case ((spc_matches_prefix0 s4120_0)) of
        SOME ((() , s4121_0)) =>
  (case ((string_drop s4120_0 s4121_0)) of
        s4122_0 =>
  (case ((reg_name_matches_prefix s4122_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4123_0)) =>
  (case ((string_drop s4122_0 s4123_0)) of
        s4124_0 =>
  (case ((sep_matches_prefix s4124_0)) of
        SOME ((() , s4125_0)) =>
  (case ((string_drop s4124_0 s4125_0)) of
        s4126_0 =>
  (case ((reg_name_matches_prefix s4126_0 : (( 5 words$word # ii)) option)) of
        SOME ((rs1, s4127_0)) =>
  (case ((string_drop s4126_0 s4127_0)) of
        s4128_0 =>
  (case ((sep_matches_prefix s4128_0)) of
        SOME ((() , s4129_0)) =>
  (case ((string_drop s4128_0 s4129_0)) of
        s4130_0 =>
  (case ((hex_bits_12_matches_prefix0 s4130_0
         : (( 12 words$word # ii)) option)) of
        SOME ((imm, s4131_0)) =>
  (case ((string_drop s4130_0 s4131_0)) of   s_ => SOME (rd, rs1, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4105_ : string -> maybe ((mword ty5 * mword ty21 * string))*)

val _ = Define `
 ((s4105_:string ->((5)words$word#(21)words$word#string)option) s4106_0=
    (let s4107_0 = s4106_0 in
   if ((string_startswith s4107_0 "jal")) then  
  (case ((string_drop s4107_0 ((string_length "jal")))) of
        s4108_0 =>
  (case ((spc_matches_prefix0 s4108_0)) of
        SOME ((() , s4109_0)) =>
  (case ((string_drop s4108_0 s4109_0)) of
        s4110_0 =>
  (case ((reg_name_matches_prefix s4110_0 : (( 5 words$word # ii)) option)) of
        SOME ((rd, s4111_0)) =>
  (case ((string_drop s4110_0 s4111_0)) of
        s4112_0 =>
  (case ((sep_matches_prefix s4112_0)) of
        SOME ((() , s4113_0)) =>
  (case ((string_drop s4112_0 s4113_0)) of
        s4114_0 =>
  (case ((hex_bits_21_matches_prefix
            instance_Sail2_values_Bitvector_Machine_word_mword_dict s4114_0 : (( 21 words$word # ii)) option)) of
        SOME ((imm, s4115_0)) =>
  (case ((string_drop s4114_0 s4115_0)) of   s_ => SOME (rd, imm, s_) )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
    | _ => NONE
  )
  )
   else NONE))`;


(*val _s4092_ : string -> maybe ((uop * mword ty5 * mword ty20 * string))*)

val _ = Define `
 ((s4092_:string ->(uop#(5)words$word#(20)words$word#string)option) s4093_0= 
  ((case s4093_0 of
         s4094_0 =>
   (case ((utype_mnemonic_matches_prefix s4094_0)) of
         SOME ((op, s4095_0)) =>
   (case ((string_drop s4094_0 s4095_0)) of
         s4096_0 =>
   (case ((spc_matches_prefix0 s4096_0)) of
         SOME ((() , s4097_0)) =>
   (case ((string_drop s4096_0 s4097_0)) of
         s4098_0 =>
   (case ((reg_name_matches_prefix s4098_0 : (( 5 words$word # ii)) option)) of
         SOME ((rd, s4099_0)) =>
   (case ((string_drop s4098_0 s4099_0)) of
         s4100_0 =>
   (case ((sep_matches_prefix s4100_0)) of
         SOME ((() , s4101_0)) =>
   (case ((string_drop s4100_0 s4101_0)) of
         s4102_0 =>
   (case ((hex_bits_20_matches_prefix
             instance_Sail2_values_Bitvector_Machine_word_mword_dict 
           s4102_0 : (( 20 words$word # ii)) option)) of
         SOME ((imm, s4103_0)) =>
   (case ((string_drop s4102_0 s4103_0)) of   s_ => SOME (op, rd, imm, s_) )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )
     | _ => NONE
   )
   )))`;


val _ = Define `
 ((assembly_matches_prefix:string ->(ast#int)option) arg_=
    (let s4104_0 = arg_ in
   if ((case ((s4092_ s4104_0  :  ((uop #  5 words$word #  20 words$word # string))option)) of
       SOME ((op, rd, imm, s_)) => T
     | _ => F
     )) then  (case
 (s4092_ s4104_0 : (( uop # 5 words$word # 20 words$word # string)) option) of
     (SOME ((op, rd, imm, s_))) =>
 SOME (UTYPE (imm, rd, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4105_ s4104_0  :  (( 5 words$word #  21 words$word # string))option)) of
       SOME ((rd, imm, s_)) => T
     | _ => F
     )) then  (case (s4105_ s4104_0 : (( 5 words$word # 21 words$word # string)) option) of
     (SOME ((rd, imm, s_))) =>
 SOME (RISCV_JAL (imm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4117_ s4104_0  :  (( 5 words$word #  5 words$word #  12 words$word # string))option)) of
       SOME ((rd, rs1, imm, s_)) => T
     | _ => F
     )) then  (case
 (s4117_ s4104_0 : (( 5 words$word # 5 words$word # 12 words$word # string)) option) of
     (SOME ((rd, rs1, imm, s_))) =>
 SOME
   (RISCV_JALR (imm, rs1, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4133_ s4104_0  :  ((bop #  5 words$word #  5 words$word #  13 words$word # string))option)) of
       SOME ((op, rs1, rs2, imm, s_)) => T
     | _ => F
     )) then  (case
 (s4133_ s4104_0 : (( bop # 5 words$word # 5 words$word # 13 words$word # string)) option) of
     (SOME ((op, rs1, rs2, imm, s_))) =>
 SOME
   (BTYPE (imm, rs2, rs1, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4150_ s4104_0  :  ((iop #  5 words$word #  5 words$word #  12 words$word # string))option)) of
       SOME ((op, rd, rs1, imm, s_)) => T
     | _ => F
     )) then  (case
 (s4150_ s4104_0 : (( iop # 5 words$word # 5 words$word # 12 words$word # string)) option) of
     (SOME ((op, rd, rs1, imm, s_))) =>
 SOME
   (ITYPE (imm, rs1, rd, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4167_ s4104_0  :  ((sop #  5 words$word #  5 words$word #  6 words$word # string))option)) of
       SOME ((op, rd, rs1, shamt, s_)) => T
     | _ => F
     )) then  (case
 (s4167_ s4104_0 : (( sop # 5 words$word # 5 words$word # 6 words$word # string)) option) of
     (SOME ((op, rd, rs1, shamt, s_))) =>
 SOME
   (SHIFTIOP (shamt, rs1, rd, op), ((string_length arg_)) -
                                     ((string_length s_)))
 )
   else if ((case ((s4184_ s4104_0  :  ((rop #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((op, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s4184_ s4104_0 : (( rop # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((op, rd, rs1, rs2, s_))) =>
 SOME
   (RTYPE (rs2, rs1, rd, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4201_ s4104_0
                     :  ((word_width # bool # bool # bool #  5 words$word #  12 words$word #  5 words$word # string))option)) of
       SOME ((size1, is_unsigned, aq, rl, rd, imm, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s4201_ s4104_0
 : (( word_width # bool # bool # bool # 5 words$word # 12 words$word # 5 words$word # string)) option) of
     (SOME ((size1, is_unsigned, aq, rl, rd, imm, rs1, s_))) =>
 SOME
   (LOAD (imm, rs1, rd, is_unsigned, size1, aq, rl),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4231_ s4104_0
                     :  ((word_width # bool # bool #  5 words$word #  12 words$word #  5 words$word # string))option)) of
       SOME ((size1, aq, rl, rs2, imm, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s4231_ s4104_0
 : (( word_width # bool # bool # 5 words$word # 12 words$word # 5 words$word # string)) option) of
     (SOME ((size1, aq, rl, rs2, imm, rs1, s_))) =>
 SOME
   (STORE (imm, rs2, rs1, size1, aq, rl),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4259_ s4104_0  :  (( 5 words$word #  5 words$word #  12 words$word # string))option)) of
       SOME ((rd, rs1, imm, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4259_ s4104_0 : (( 5 words$word # 5 words$word # 12 words$word # string)) option) of
     (SOME ((rd, rs1, imm, s_))) =>
 SOME (ADDIW (imm, rs1, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4275_ s4104_0  :  ((sop #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((op, rd, rs1, shamt, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4275_ s4104_0 : (( sop # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((op, rd, rs1, shamt, s_))) =>
 SOME
   (SHIFTW (shamt, rs1, rd, op), ((string_length arg_)) -
                                   ((string_length s_)))
 )
   else if ((case ((s4292_ s4104_0  :  ((ropw #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((op, rd, rs1, rs2, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4292_ s4104_0 : (( ropw # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((op, rd, rs1, rs2, s_))) =>
 SOME
   (RTYPEW (rs2, rs1, rd, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4309_ s4104_0  :  ((sopw #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((op, rd, rs1, shamt, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4309_ s4104_0 : (( sopw # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((op, rd, rs1, shamt, s_))) =>
 SOME
   (SHIFTIWOP (shamt, rs1, rd, op), ((string_length arg_)) -
                                      ((string_length s_)))
 )
   else if ((case ((s4326_ s4104_0  :  (( 4 words$word #  4 words$word # string))option)) of
       SOME ((pred, succ, s_)) => T
     | _ => F
     )) then  (case (s4326_ s4104_0 : (( 4 words$word # 4 words$word # string)) option) of
     (SOME ((pred, succ, s_))) =>
 SOME (FENCE (pred, succ), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4338_ s4104_0  :  (( 4 words$word #  4 words$word # string))option)) of
       SOME ((pred, succ, s_)) => T
     | _ => F
     )) then  (case (s4338_ s4104_0 : (( 4 words$word # 4 words$word # string)) option) of
     (SOME ((pred, succ, s_))) =>
 SOME (FENCE_TSO (pred, succ), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4350_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4350_ s4104_0 of
      (SOME (s_)) =>
  SOME (FENCEI () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4354_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4354_ s4104_0 of
      (SOME (s_)) =>
  SOME (ECALL () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4358_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4358_ s4104_0 of
      (SOME (s_)) =>
  SOME (MRET () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4362_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4362_ s4104_0 of
      (SOME (s_)) =>
  SOME (SRET () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4366_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4366_ s4104_0 of
      (SOME (s_)) =>
  SOME (EBREAK () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4370_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4370_ s4104_0 of
      (SOME (s_)) =>
  SOME (WFI () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4374_ s4104_0  :  (( 5 words$word #  5 words$word # string))option)) of
       SOME ((rs1, rs2, s_)) => T
     | _ => F
     )) then  (case (s4374_ s4104_0 : (( 5 words$word # 5 words$word # string)) option) of
     (SOME ((rs1, rs2, s_))) =>
 SOME (SFENCE_VMA (rs1, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4386_ s4104_0
                     :  ((word_width # bool # bool #  5 words$word #  5 words$word # string))option)) of
       SOME ((size1, aq, rl, rd, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s4386_ s4104_0 : (( word_width # bool # bool # 5 words$word # 5 words$word # string)) option) of
     (SOME ((size1, aq, rl, rd, rs1, s_))) =>
 SOME
   (LOADRES (aq, rl, rs1, size1, rd), ((string_length arg_)) -
                                        ((string_length s_)))
 )
   else if ((case ((s4404_ s4104_0
                     :  ((word_width # bool # bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((size1, aq, rl, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s4404_ s4104_0
 : (( word_width # bool # bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((size1, aq, rl, rd, rs1, rs2, s_))) =>
 SOME
   (STORECON (aq, rl, rs2, rs1, size1, rd),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4426_ s4104_0
                     :  ((amoop # word_width # bool # bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((op, width, aq, rl, rd, rs2, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s4426_ s4104_0
 : (( amoop # word_width # bool # bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((op, width, aq, rl, rd, rs2, rs1, s_))) =>
 SOME
   (AMO (op, aq, rl, rs2, rs1, width, rd),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4452_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4452_ s4104_0 of
      (SOME (s_)) =>
  SOME (C_NOP () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4456_ s4104_0  :  (( 3 words$word #  8 words$word # string))option)) of
       SOME ((rdc, nzimm, s_)) => (nzimm <> (0x00w :  8 words$word))
     | _ => F
     )) then  (case (s4456_ s4104_0 : (( 3 words$word # 8 words$word # string)) option) of
     (SOME ((rdc, nzimm, s_))) =>
 SOME
   (C_ADDI4SPN (rdc, nzimm), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4468_ s4104_0  :  (( 3 words$word #  3 words$word #  5 words$word # string))option)) of
       SOME ((rdc, rsc, uimm, s_)) => T
     | _ => F
     )) then  (case
 (s4468_ s4104_0 : (( 3 words$word # 3 words$word # 5 words$word # string)) option) of
     (SOME ((rdc, rsc, uimm, s_))) =>
 SOME (C_LW (uimm, rsc, rdc), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4484_ s4104_0  :  (( 3 words$word #  3 words$word #  5 words$word # string))option)) of
       SOME ((rdc, rsc, uimm, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4484_ s4104_0 : (( 3 words$word # 3 words$word # 5 words$word # string)) option) of
     (SOME ((rdc, rsc, uimm, s_))) =>
 SOME (C_LD (uimm, rsc, rdc), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4500_ s4104_0  :  (( 3 words$word #  3 words$word #  5 words$word # string))option)) of
       SOME ((rsc1, rsc2, uimm, s_)) => T
     | _ => F
     )) then  (case
 (s4500_ s4104_0 : (( 3 words$word # 3 words$word # 5 words$word # string)) option) of
     (SOME ((rsc1, rsc2, uimm, s_))) =>
 SOME
   (C_SW (uimm, rsc1, rsc2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4516_ s4104_0  :  (( 3 words$word #  3 words$word #  5 words$word # string))option)) of
       SOME ((rsc1, rsc2, uimm, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4516_ s4104_0 : (( 3 words$word # 3 words$word # 5 words$word # string)) option) of
     (SOME ((rsc1, rsc2, uimm, s_))) =>
 SOME
   (C_SD (uimm, rsc1, rsc2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4532_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rsd, nzi, s_)) => ((((nzi <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))
     | _ => F
     )) then  (case (s4532_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, nzi, s_))) =>
 SOME (C_ADDI (nzi, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4544_ s4104_0  :  (( 11 words$word # string))option)) of
       SOME ((imm, s_)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s4544_ s4104_0 : (( 11 words$word # string)) option) of
     (SOME ((imm, s_))) =>
 SOME (C_JAL imm, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4552_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rsd, imm, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s4552_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, imm, s_))) =>
 SOME (C_ADDIW (imm, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4564_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, imm, s_)) => (rd <> zreg)
     | _ => F
     )) then  (case (s4564_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, imm, s_))) =>
 SOME (C_LI (imm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4576_ s4104_0  :  (( 6 words$word # string))option)) of
       SOME ((imm, s_)) => (imm <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s4576_ s4104_0 : (( 6 words$word # string)) option) of
     (SOME ((imm, s_))) =>
 SOME (C_ADDI16SP imm, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4584_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, imm, s_)) =>
        ((((rd <> zreg))) /\ ((((((rd <> sp))) /\ (((imm <> (0b000000w :  6 words$word))))))))
     | _ => F
     )) then  (case (s4584_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, imm, s_))) =>
 SOME (C_LUI (imm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4596_ s4104_0  :  (( 3 words$word #  6 words$word # string))option)) of
       SOME ((rsd, shamt, s_)) => (shamt <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s4596_ s4104_0 : (( 3 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, shamt, s_))) =>
 SOME (C_SRLI (shamt, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4608_ s4104_0  :  (( 3 words$word #  6 words$word # string))option)) of
       SOME ((rsd, shamt, s_)) => (shamt <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s4608_ s4104_0 : (( 3 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, shamt, s_))) =>
 SOME (C_SRAI (shamt, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4620_ s4104_0  :  (( 3 words$word #  6 words$word # string))option)) of
       SOME ((rsd, imm, s_)) => T
     | _ => F
     )) then  (case (s4620_ s4104_0 : (( 3 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, imm, s_))) =>
 SOME (C_ANDI (imm, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4632_ s4104_0  :  (( 3 words$word #  3 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => T
     | _ => F
     )) then  (case (s4632_ s4104_0 : (( 3 words$word # 3 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_SUB (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4644_ s4104_0  :  (( 3 words$word #  3 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => T
     | _ => F
     )) then  (case (s4644_ s4104_0 : (( 3 words$word # 3 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_XOR (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4656_ s4104_0  :  (( 3 words$word #  3 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => T
     | _ => F
     )) then  (case (s4656_ s4104_0 : (( 3 words$word # 3 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_OR (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4668_ s4104_0  :  (( 3 words$word #  3 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => T
     | _ => F
     )) then  (case (s4668_ s4104_0 : (( 3 words$word # 3 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_AND (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4680_ s4104_0  :  (( 3 words$word #  3 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s4680_ s4104_0 : (( 3 words$word # 3 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_SUBW (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4692_ s4104_0  :  (( 3 words$word #  3 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s4692_ s4104_0 : (( 3 words$word # 3 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_ADDW (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4704_ s4104_0  :  (( 11 words$word # string))option)) of
       SOME ((imm, s_)) => T
     | _ => F
     )) then  (case (s4704_ s4104_0 : (( 11 words$word # string)) option) of
     (SOME ((imm, s_))) =>
 SOME (C_J imm, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4712_ s4104_0  :  (( 3 words$word #  8 words$word # string))option)) of
       SOME ((rs, imm, s_)) => T
     | _ => F
     )) then  (case (s4712_ s4104_0 : (( 3 words$word # 8 words$word # string)) option) of
     (SOME ((rs, imm, s_))) =>
 SOME (C_BEQZ (imm, rs), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4724_ s4104_0  :  (( 3 words$word #  8 words$word # string))option)) of
       SOME ((rs, imm, s_)) => T
     | _ => F
     )) then  (case (s4724_ s4104_0 : (( 3 words$word # 8 words$word # string)) option) of
     (SOME ((rs, imm, s_))) =>
 SOME (C_BNEZ (imm, rs), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4736_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rsd, shamt, s_)) =>
        ((((shamt <> (0b000000w :  6 words$word)))) /\ (((rsd <> zreg))))
     | _ => F
     )) then  (case (s4736_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, shamt, s_))) =>
 SOME (C_SLLI (shamt, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4748_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, uimm, s_)) => (rd <> zreg)
     | _ => F
     )) then  (case (s4748_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, uimm, s_))) =>
 SOME (C_LWSP (uimm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4760_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, uimm, s_)) => ((((rd <> zreg))) /\ ((((( 32 : int):ii) = (( 64 : int):ii)))))
     | _ => F
     )) then  (case (s4760_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, uimm, s_))) =>
 SOME (C_LDSP (uimm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4772_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, uimm, s_)) => T
     | _ => F
     )) then  (case (s4772_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, uimm, s_))) =>
 SOME (C_SWSP (uimm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4784_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rs2, uimm, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case (s4784_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rs2, uimm, s_))) =>
 SOME (C_SDSP (uimm, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4796_ s4104_0  :  (( 5 words$word # string))option)) of
       SOME ((rs1, s_)) => (rs1 <> zreg)
     | _ => F
     )) then  (case (s4796_ s4104_0 : (( 5 words$word # string)) option) of
     (SOME ((rs1, s_))) =>
 SOME (C_JR rs1, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4804_ s4104_0  :  (( 5 words$word # string))option)) of
       SOME ((rs1, s_)) => (rs1 <> zreg)
     | _ => F
     )) then  (case (s4804_ s4104_0 : (( 5 words$word # string)) option) of
     (SOME ((rs1, s_))) =>
 SOME (C_JALR rs1, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4812_ s4104_0  :  (( 5 words$word #  5 words$word # string))option)) of
       SOME ((rd, rs2, s_)) => ((((rd <> zreg))) /\ (((rs2 <> zreg))))
     | _ => F
     )) then  (case (s4812_ s4104_0 : (( 5 words$word # 5 words$word # string)) option) of
     (SOME ((rd, rs2, s_))) =>
 SOME (C_MV (rd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4824_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4824_ s4104_0 of
      (SOME (s_)) =>
  SOME (C_EBREAK () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4828_ s4104_0  :  (( 5 words$word #  5 words$word # string))option)) of
       SOME ((rsd, rs2, s_)) => ((((rsd <> zreg))) /\ (((rs2 <> zreg))))
     | _ => F
     )) then  (case (s4828_ s4104_0 : (( 5 words$word # 5 words$word # string)) option) of
     (SOME ((rsd, rs2, s_))) =>
 SOME (C_ADD (rsd, rs2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4840_ s4104_0
                     :  ((bool # bool # bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((high, signed1, signed2, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s4840_ s4104_0 : (( bool # bool # bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((high, signed1, signed2, rd, rs1, rs2, s_))) =>
 SOME
   (MUL (rs2, rs1, rd, high, signed1, signed2),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4857_ s4104_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((s, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s4857_ s4104_0 : (( bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((s, rd, rs1, rs2, s_))) =>
 SOME (DIV0 (rs2, rs1, rd, s), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4875_ s4104_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((s, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s4875_ s4104_0 : (( bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((s, rd, rs1, rs2, s_))) =>
 SOME (REM (rs2, rs1, rd, s), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4893_ s4104_0  :  (( 5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((rd, rs1, rs2, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4893_ s4104_0 : (( 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((rd, rs1, rs2, s_))) =>
 SOME (MULW (rs2, rs1, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4909_ s4104_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((s, rd, rs1, rs2, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4909_ s4104_0 : (( bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((s, rd, rs1, rs2, s_))) =>
 SOME (DIVW (rs2, rs1, rd, s), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4928_ s4104_0  :  ((bool #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((s, rd, rs1, rs2, s_)) => ((( 32 : int):ii) = (( 64 : int):ii))
     | _ => F
     )) then  (case
 (s4928_ s4104_0 : (( bool # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((s, rd, rs1, rs2, s_))) =>
 SOME (REMW (rs2, rs1, rd, s), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4947_ s4104_0  :  ((csrop #  5 words$word #  12 words$word #  5 words$word # string))option)) of
       SOME ((op, rd, csr, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s4947_ s4104_0 : (( csrop # 5 words$word # 12 words$word # 5 words$word # string)) option) of
     (SOME ((op, rd, csr, rs1, s_))) =>
 SOME
   (CSR (csr, rs1, rd, T, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4965_ s4104_0  :  ((csrop #  5 words$word #  12 words$word #  5 words$word # string))option)) of
       SOME ((op, rd, csr, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s4965_ s4104_0 : (( csrop # 5 words$word # 12 words$word # 5 words$word # string)) option) of
     (SOME ((op, rd, csr, rs1, s_))) =>
 SOME
   (CSR (csr, rs1, rd, F, op), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4982_ s4104_0)) of   SOME (s_) => T | _ => F )) then  
  (case s4982_ s4104_0 of
      (SOME (s_)) =>
  SOME (URET () , ((string_length arg_)) - ((string_length s_)))
  )
   else if ((case ((s4986_ s4104_0  :  (( 6 words$word # string))option)) of
       SOME ((imm, s_)) => T
     | _ => F
     )) then  (case (s4986_ s4104_0 : (( 6 words$word # string)) option) of
     (SOME ((imm, s_))) =>
 SOME (C_NOP_HINT imm, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4992_ s4104_0  :  (( 5 words$word # string))option)) of
       SOME ((rsd, s_)) => (rsd <> zreg)
     | _ => F
     )) then  (case (s4992_ s4104_0 : (( 5 words$word # string)) option) of
     (SOME ((rsd, s_))) =>
 SOME (C_ADDI_HINT rsd, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s4998_ s4104_0  :  (( 6 words$word # string))option)) of
       SOME ((imm, s_)) => T
     | _ => F
     )) then  (case (s4998_ s4104_0 : (( 6 words$word # string)) option) of
     (SOME ((imm, s_))) =>
 SOME (C_LI_HINT imm, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5004_ s4104_0  :  (( 6 words$word # string))option)) of
       SOME ((imm, s_)) => (imm <> (0b000000w :  6 words$word))
     | _ => F
     )) then  (case (s5004_ s4104_0 : (( 6 words$word # string)) option) of
     (SOME ((imm, s_))) =>
 SOME (C_LUI_HINT imm, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5010_ s4104_0  :  (( 5 words$word # string))option)) of
       SOME ((rs2, s_)) => (rs2 <> zreg)
     | _ => F
     )) then  (case (s5010_ s4104_0 : (( 5 words$word # string)) option) of
     (SOME ((rs2, s_))) =>
 SOME (C_MV_HINT rs2, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5016_ s4104_0  :  (( 5 words$word # string))option)) of
       SOME ((rs2, s_)) => (rs2 <> zreg)
     | _ => F
     )) then  (case (s5016_ s4104_0 : (( 5 words$word # string)) option) of
     (SOME ((rs2, s_))) =>
 SOME (C_ADD_HINT rs2, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5022_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rsd, shamt, s_)) =>
        ((((shamt = (0b000000w :  6 words$word)))) \/ (((rsd = zreg))))
     | _ => F
     )) then  (case (s5022_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rsd, shamt, s_))) =>
 SOME
   (C_SLLI_HINT (shamt, rsd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5031_ s4104_0  :  (( 3 words$word # string))option)) of
       SOME ((rsd, s_)) => T
     | _ => F
     )) then  (case (s5031_ s4104_0 : (( 3 words$word # string)) option) of
     (SOME ((rsd, s_))) =>
 SOME (C_SRLI_HINT rsd, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5037_ s4104_0  :  (( 3 words$word # string))option)) of
       SOME ((rsd, s_)) => T
     | _ => F
     )) then  (case (s5037_ s4104_0 : (( 3 words$word # string)) option) of
     (SOME ((rsd, s_))) =>
 SOME (C_SRAI_HINT rsd, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5043_ s4104_0
                     :  (( 4 words$word #  4 words$word #  5 words$word #  5 words$word #  4 words$word # string))option)) of
       SOME ((pred, succ, rs, rd, fm, s_)) =>
        (((((((fm <> (0x0w :  4 words$word)))) /\ (((fm <> (0x8w :  4 words$word))))))) \/ ((((((rs <> (0b00000w :  5 words$word)))) \/ (((rd <> (0b00000w :  5 words$word))))))))
     | _ => F
     )) then  (case
 (s5043_ s4104_0
 : (( 4 words$word # 4 words$word # 5 words$word # 5 words$word # 4 words$word # string)) option) of
     (SOME ((pred, succ, rs, rd, fm, s_))) =>
 SOME
   (FENCE_RESERVED (fm, pred, succ, rs, rd),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5061_ s4104_0  :  (( 5 words$word #  5 words$word #  12 words$word # string))option)) of
       SOME ((rd, rs, imm, s_)) =>
        ((((imm <> (0x000w :  12 words$word)))) \/ ((((((rs <> zreg))) \/ (((rd <> zreg)))))))
     | _ => F
     )) then  (case
 (s5061_ s4104_0 : (( 5 words$word # 5 words$word # 12 words$word # string)) option) of
     (SOME ((rd, rs, imm, s_))) =>
 SOME
   (FENCEI_RESERVED (imm, rs, rd), ((string_length arg_)) -
                                     ((string_length s_)))
 )
   else if ((case ((s5073_ s4104_0
                     :  ((word_width #  5 words$word #  12 words$word #  5 words$word # string))option)) of
       SOME ((width, rd, imm, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s5073_ s4104_0 : (( word_width # 5 words$word # 12 words$word # 5 words$word # string)) option) of
     (SOME ((width, rd, imm, rs1, s_))) =>
 SOME
   (LOAD_FP (imm, rs1, rd, width), ((string_length arg_)) -
                                     ((string_length s_)))
 )
   else if ((case ((s5097_ s4104_0
                     :  ((word_width #  5 words$word #  12 words$word #  5 words$word # string))option)) of
       SOME ((width, rs2, imm, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s5097_ s4104_0 : (( word_width # 5 words$word # 12 words$word # 5 words$word # string)) option) of
     (SOME ((width, rs2, imm, rs1, s_))) =>
 SOME
   (STORE_FP (imm, rs2, rs1, width), ((string_length arg_)) -
                                       ((string_length s_)))
 )
   else if ((case ((s5121_ s4104_0
                     :  ((f_madd_op_S #  5 words$word #  5 words$word #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((op, rd, rs1, rs2, rs3, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5121_ s4104_0
 : (( f_madd_op_S # 5 words$word # 5 words$word # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((op, rd, rs1, rs2, rs3, rm, s_))) =>
 SOME
   (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, op),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5146_ s4104_0
                     :  ((f_bin_rm_op_S #  5 words$word #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((op, rd, rs1, rs2, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5146_ s4104_0
 : (( f_bin_rm_op_S # 5 words$word # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((op, rd, rs1, rs2, rm, s_))) =>
 SOME
   (F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, op),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5167_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FSQRT_S, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5167_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FSQRT_S, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5184_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_W_S, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5184_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_W_S, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5201_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_WU_S, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5201_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_WU_S, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5218_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_S_W, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5218_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_S_W, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5235_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_S_WU, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5235_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_S_WU, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_WU),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5252_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_L_S, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5252_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_L_S, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_L_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5269_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_LU_S, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5269_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_LU_S, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_LU_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5286_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_S_L, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5286_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_S_L, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_L),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5303_ s4104_0
                     :  ((f_un_rm_op_S #  5 words$word #  5 words$word # rounding_mode # string))option)) of
       SOME ((FCVT_S_LU, rd, rs1, rm, s_)) => T
     | _ => F
     )) then  (case
 (s5303_ s4104_0 : (( f_un_rm_op_S # 5 words$word # 5 words$word # rounding_mode # string)) option) of
     (SOME ((FCVT_S_LU, rd, rs1, rm, s_))) =>
 SOME
   (F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_LU),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5320_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FSGNJ_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5320_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FSGNJ_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FSGNJ_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5337_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FSGNJN_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5337_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FSGNJN_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FSGNJN_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5354_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FSGNJX_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5354_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FSGNJX_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FSGNJX_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5371_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FMIN_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5371_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FMIN_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FMIN_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5388_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FMAX_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5388_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FMAX_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FMAX_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5405_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FEQ_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5405_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FEQ_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FEQ_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5422_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FLT_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5422_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FLT_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FLT_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5439_ s4104_0
                     :  ((f_bin_op_S #  5 words$word #  5 words$word #  5 words$word # string))option)) of
       SOME ((FLE_S, rd, rs1, rs2, s_)) => T
     | _ => F
     )) then  (case
 (s5439_ s4104_0 : (( f_bin_op_S # 5 words$word # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FLE_S, rd, rs1, rs2, s_))) =>
 SOME
   (F_BIN_TYPE_S (rs2, rs1, rd, FLE_S),
   ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5456_ s4104_0  :  ((f_un_op_S #  5 words$word #  5 words$word # string))option)) of
       SOME ((FMV_X_W, rd, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s5456_ s4104_0 : (( f_un_op_S # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FMV_X_W, rd, rs1, s_))) =>
 SOME
   (F_UN_TYPE_S (rs1, rd, FMV_X_W), ((string_length arg_)) -
                                      ((string_length s_)))
 )
   else if ((case ((s5469_ s4104_0  :  ((f_un_op_S #  5 words$word #  5 words$word # string))option)) of
       SOME ((FMV_W_X, rd, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s5469_ s4104_0 : (( f_un_op_S # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FMV_W_X, rd, rs1, s_))) =>
 SOME
   (F_UN_TYPE_S (rs1, rd, FMV_W_X), ((string_length arg_)) -
                                      ((string_length s_)))
 )
   else if ((case ((s5482_ s4104_0  :  ((f_un_op_S #  5 words$word #  5 words$word # string))option)) of
       SOME ((FCLASS_S, rd, rs1, s_)) => T
     | _ => F
     )) then  (case
 (s5482_ s4104_0 : (( f_un_op_S # 5 words$word # 5 words$word # string)) option) of
     (SOME ((FCLASS_S, rd, rs1, s_))) =>
 SOME
   (F_UN_TYPE_S (rs1, rd, FCLASS_S), ((string_length arg_)) -
                                       ((string_length s_)))
 )
   else if ((case ((s5495_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, imm, s_)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s5495_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, imm, s_))) =>
 SOME (C_FLWSP (imm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5507_ s4104_0  :  (( 5 words$word #  6 words$word # string))option)) of
       SOME ((rd, uimm, s_)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case (s5507_ s4104_0 : (( 5 words$word # 6 words$word # string)) option) of
     (SOME ((rd, uimm, s_))) =>
 SOME (C_FSWSP (uimm, rd), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5519_ s4104_0  :  (( 3 words$word #  3 words$word #  5 words$word # string))option)) of
       SOME ((rdc, rsc, uimm, s_)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case
 (s5519_ s4104_0 : (( 3 words$word # 3 words$word # 5 words$word # string)) option) of
     (SOME ((rdc, rsc, uimm, s_))) =>
 SOME (C_FLW (uimm, rsc, rdc), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5535_ s4104_0  :  (( 3 words$word #  3 words$word #  5 words$word # string))option)) of
       SOME ((rsc1, rsc2, uimm, s_)) => ((( 32 : int):ii) = (( 32 : int):ii))
     | _ => F
     )) then  (case
 (s5535_ s4104_0 : (( 3 words$word # 3 words$word # 5 words$word # string)) option) of
     (SOME ((rsc1, rsc2, uimm, s_))) =>
 SOME
   (C_FSW (uimm, rsc1, rsc2), ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5551_ s4104_0  :  (( 32 words$word # string))option)) of
       SOME ((s, s_)) => T
     | _ => F
     )) then  (case (s5551_ s4104_0 : (( 32 words$word # string)) option) of
     (SOME ((s, s_))) =>
 SOME (ILLEGAL s, ((string_length arg_)) - ((string_length s_)))
 )
   else if ((case ((s5559_ s4104_0  :  (( 16 words$word # string))option)) of
       SOME ((s, s_)) => T
     | _ => F
     )) then  (case (s5559_ s4104_0 : (( 16 words$word # string)) option) of
     (SOME ((s, s_))) =>
 SOME (C_ILLEGAL s, ((string_length arg_)) - ((string_length s_)))
 )
   else NONE))`;


val _ = Define `
 ((print_insn:ast ->(regstate)sail2_state_monad$sequential_state ->(((string),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) insn=  (assembly_forwards insn))`;


(*val decode : mword ty32 -> M ast*)

val _ = Define `
 ((decode:(32)words$word ->(regstate)sail2_state_monad$sequential_state ->(((ast),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) bv=  (encdec_backwards bv))`;


(*val decodeCompressed : mword ty16 -> M ast*)

val _ = Define `
 ((decodeCompressed:(16)words$word ->(regstate)sail2_state_monad$sequential_state ->(((ast),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) bv=  (encdec_compressed_backwards bv))`;


(*val ext_init : unit -> unit*)

val _ = Define `
 ((ext_init:unit -> unit) () =  () )`;


(*val ext_fetch_hook : FetchResult -> FetchResult*)

val _ = Define `
 ((ext_fetch_hook:FetchResult -> FetchResult) f=  f)`;


(*val ext_pre_step_hook : unit -> unit*)

val _ = Define `
 ((ext_pre_step_hook:unit -> unit) () =  () )`;


(*val ext_post_step_hook : unit -> unit*)

val _ = Define `
 ((ext_post_step_hook:unit -> unit) () =  () )`;


(*val ext_post_decode_hook : ast -> M ast*)

val _ = Define `
 ((ext_post_decode_hook:ast ->(regstate)sail2_state_monad$sequential_state ->(((ast),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) x=  (sail2_state_monad$returnS x))`;


(*val isRVC : mword ty16 -> bool*)

val _ = Define `
 ((isRVC:(16)words$word -> bool) h=  (~ (((((subrange_vec_dec h (( 1 : int):ii) (( 0 : int):ii)  :  2 words$word)) = (0b11w :  2 words$word))))))`;


(*val fetch : unit -> M FetchResult*)

val _ = Define `
 ((fetch:unit ->(regstate)sail2_state_monad$sequential_state ->(((FetchResult),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__0 :  32 words$word) .  sail2_state_monad$bindS
   (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__1 :  32 words$word) . 
   (case ((ext_fetch_check_pc w__0 w__1)) of
     Ext_FetchAddr_Error (e) => sail2_state_monad$returnS (F_Ext_Error e)
   | Ext_FetchAddr_OK (use_pc) => sail2_state_monad$bindS
      (sail2_state$or_boolS (sail2_state_monad$returnS (((((access_vec_dec use_pc (( 0 : int):ii))) <> B0))))
        (sail2_state$and_boolS (sail2_state_monad$returnS (((((access_vec_dec use_pc (( 1 : int):ii))) <> B0))))
           ( sail2_state_monad$bindS(haveRVC () ) (\ (w__2 : bool) .  sail2_state_monad$returnS ((~ w__2)))))) (\ (w__4 : bool) . 
      if w__4 then sail2_state_monad$bindS
        (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__5 :  32 words$word) . 
        sail2_state_monad$returnS (F_Error (E_Fetch_Addr_Align () , w__5)))
      else sail2_state_monad$bindS
        (translateAddr use_pc (Execute () )  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__6 : (( 32 words$word), ExceptionType)
          TR_Result) . 
        (case w__6 of
          TR_Failure ((e, _)) => sail2_state_monad$bindS
           (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__7 :  32 words$word) . 
           sail2_state_monad$returnS (F_Error (e, w__7)))
        | TR_Address ((ppclo, _)) => sail2_state_monad$bindS
           (mem_read (Execute () ) ppclo (( 2 : int):ii) F F F  : ( ( 16 words$word)MemoryOpResult) M) (\ (w__8 : ( 16 words$word)
             MemoryOpResult) . 
           (case w__8 of
             MemException (e) => sail2_state_monad$bindS
              (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__9 :  32 words$word) . 
              sail2_state_monad$returnS (F_Error (e, w__9)))
           | MemValue (ilo) =>
              if ((isRVC ilo)) then sail2_state_monad$returnS (F_RVC ilo)
              else sail2_state_monad$bindS
                (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__10 :  32 words$word) . 
                let (PC_hi : xlenbits) = ((add_vec_int w__10 (( 2 : int):ii)  :  32 words$word)) in sail2_state_monad$bindS
                (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__11 :  32 words$word) . 
                (case ((ext_fetch_check_pc w__11 PC_hi)) of
                  Ext_FetchAddr_Error (e) => sail2_state_monad$returnS (F_Ext_Error e)
                | Ext_FetchAddr_OK (use_pc_hi) => sail2_state_monad$bindS
                   (translateAddr use_pc_hi (Execute () )  : ( (( 32 words$word), ExceptionType)TR_Result) M) (\ (w__12 : (( 32 words$word), ExceptionType)
                     TR_Result) . 
                   (case w__12 of
                     TR_Failure ((e, _)) => sail2_state_monad$returnS (F_Error (e, PC_hi))
                   | TR_Address ((ppchi, _)) => sail2_state_monad$bindS
                      (mem_read (Execute () ) ppchi (( 2 : int):ii) F F F
                        : ( ( 16 words$word)MemoryOpResult) M) (\ (w__13 : ( 16 words$word)
                        MemoryOpResult) . 
                      sail2_state_monad$returnS ((case w__13 of
                        MemException (e) => F_Error (e, PC_hi)
                      | MemValue (ihi) => F_Base ((concat_vec ihi ilo  :  32 words$word))
                      )))
                   ))
                )))
           ))
        )))
   )))))`;


(*val step : ii -> M bool*)

val _ = Define `
 ((step:int ->(regstate)sail2_state_monad$sequential_state ->(((bool),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) step_no=
    (let (_ : unit) = (ext_pre_step_hook () ) in sail2_state_monad$bindS (sail2_state_monad$seqS
   (sail2_state_monad$write_regS minstret_written_ref F)
   (sail2_state_monad$read_regS cur_privilege_ref)) (\ (w__0 : Privilege) .  sail2_state_monad$bindS
   (dispatchInterrupt w__0) (\ (w__1 :  ((InterruptType # Privilege))option) .  sail2_state_monad$bindS
   (case w__1 of
     SOME ((intr, priv)) =>
      let (_ : unit) =
        (if ((get_config_print_instr () )) then
          print_bits0 "Handling interrupt: " ((interruptType_to_bits intr  :  8 words$word))
        else () ) in sail2_state_monad$seqS
      (handle_interrupt intr priv) (sail2_state_monad$returnS (RETIRE_FAIL, F))
   | NONE => sail2_state_monad$bindS
      (fetch () ) (\ (w__2 : FetchResult) . 
      let (f : FetchResult) = (ext_fetch_hook w__2) in
      (case f of
        F_Ext_Error (e) =>
         let (_ : unit) = (ext_handle_fetch_check_error e) in
         sail2_state_monad$returnS (RETIRE_FAIL, F)
      | F_Error ((e, addr)) => sail2_state_monad$seqS (handle_mem_exception addr e) (sail2_state_monad$returnS (RETIRE_FAIL, F))
      | F_RVC (h) => sail2_state_monad$bindS
         (decodeCompressed h) (\ ast .  sail2_state_monad$bindS (sail2_state_monad$seqS
         (if ((get_config_print_instr () )) then sail2_state_monad$bindS
            (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__3 : Privilege) .  sail2_state_monad$bindS
            (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__4 :  32 words$word) .  sail2_state_monad$bindS
            (print_insn ast) (\ (w__5 : string) . 
            sail2_state_monad$returnS ((print_dbg
                       ((STRCAT "["
                           ((STRCAT ((stringFromInteger step_no))
                               ((STRCAT "] ["
                                   ((STRCAT ((privLevel_to_str w__3))
                                       ((STRCAT "]: "
                                           ((STRCAT ((string_of_bits w__4))
                                               ((STRCAT " ("
                                                   ((STRCAT ((string_of_bits h))
                                                       ((STRCAT ") " w__5)))))))))))))))))))))))
          else sail2_state_monad$returnS () )
         (haveRVC () )) (\ (w__6 : bool) . 
         if w__6 then sail2_state_monad$bindS
           (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__7 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
           (sail2_state_monad$write_regS nextPC_ref ((add_vec_int w__7 (( 2 : int):ii)  :  32 words$word)))
           (ext_post_decode_hook ast)) (\ (w__8 : ast) .  sail2_state_monad$bindS
           (execute w__8) (\ (w__9 : Retired) .  sail2_state_monad$returnS (w__9, T))))
         else sail2_state_monad$seqS (handle_illegal () ) (sail2_state_monad$returnS (RETIRE_FAIL, T))))
      | F_Base (w) => sail2_state_monad$bindS
         (decode w) (\ ast .  sail2_state_monad$bindS (sail2_state_monad$seqS
         (if ((get_config_print_instr () )) then sail2_state_monad$bindS
            (sail2_state_monad$read_regS cur_privilege_ref) (\ (w__11 : Privilege) .  sail2_state_monad$bindS
            (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M) (\ (w__12 :  32 words$word) .  sail2_state_monad$bindS
            (print_insn ast) (\ (w__13 : string) . 
            sail2_state_monad$returnS ((print_dbg
                       ((STRCAT "["
                           ((STRCAT ((stringFromInteger step_no))
                               ((STRCAT "] ["
                                   ((STRCAT ((privLevel_to_str w__11))
                                       ((STRCAT "]: "
                                           ((STRCAT ((string_of_bits w__12))
                                               ((STRCAT " ("
                                                   ((STRCAT ((string_of_bits w))
                                                       ((STRCAT ") " w__13)))))))))))))))))))))))
          else sail2_state_monad$returnS () )
         (sail2_state_monad$read_regS PC_ref  : ( 32 words$word) M)) (\ (w__14 :  32 words$word) .  sail2_state_monad$bindS (sail2_state_monad$seqS
         (sail2_state_monad$write_regS nextPC_ref ((add_vec_int w__14 (( 4 : int):ii)  :  32 words$word)))
         (ext_post_decode_hook ast)) (\ (w__15 : ast) .  sail2_state_monad$bindS
         (execute w__15) (\ (w__16 : Retired) .  sail2_state_monad$returnS (w__16, T)))))
      ))
   ) (\ varstup .  let ((retired : Retired), (stepped : bool)) = varstup in sail2_state_monad$seqS (sail2_state_monad$seqS
   (tick_pc () )
   (case retired of   RETIRE_SUCCESS => retire_instruction ()  | RETIRE_FAIL => sail2_state_monad$returnS ()  ))
   (let (_ : unit) = (ext_post_step_hook () ) in
   sail2_state_monad$returnS stepped))))))`;


(*val loop : unit -> M unit*)

val _ = Define `
 ((loop:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =
    (let insns_per_tick = (plat_insns_per_tick () ) in
   let (i : ii) = ((( 0 : int):ii)) in
   let (step_no : ii) = ((( 0 : int):ii)) in sail2_state_monad$bindS
   (sail2_state$whileS (i, step_no)
     (\ varstup .  let (i, step_no) = varstup in sail2_state_monad$bindS
       (sail2_state_monad$read_regS htif_done_ref) (\ (w__0 : bool) .  sail2_state_monad$returnS ((~ w__0))))
     (\ varstup .  let (i, step_no) = varstup in sail2_state_monad$bindS
       (step step_no) (\ stepped . 
       let (step_no : ii) = (if stepped then step_no + (( 1 : int):ii) else step_no) in sail2_state_monad$bindS
       (sail2_state_monad$read_regS htif_done_ref) (\ (w__1 : bool) .  sail2_state_monad$bindS
       (if w__1 then sail2_state_monad$bindS
          (sail2_state_monad$read_regS htif_exit_code_ref  : ( 64 words$word) M) (\ (w__2 :  64 words$word) . 
          let exit_val = (lem$w2ui w__2) in
          sail2_state_monad$returnS (let (_ : unit) =
            (if (((exit_val = (( 0 : int):ii)))) then print_endline "SUCCESS"
            else print_int "FAILURE: " exit_val) in
          i))
        else
          let i = (i + (( 1 : int):ii)) in
          if (((i = insns_per_tick))) then sail2_state_monad$seqS (sail2_state_monad$seqS (tick_clock () ) (tick_platform () )) (sail2_state_monad$returnS (( 0 : int):ii))
          else sail2_state_monad$returnS i) (\ (i : ii) . 
       sail2_state_monad$returnS (i, step_no)))))) (\ varstup .  let ((i : ii), (step_no : ii)) = varstup in
   sail2_state_monad$returnS () )))`;


(*val init_model : unit -> M unit*)

val _ = Define `
 ((init_model:unit ->(regstate)sail2_state_monad$sequential_state ->(((unit),(exception))sail2_state_monad$result#(regstate)sail2_state_monad$sequential_state)set) () =  (sail2_state_monad$seqS (sail2_state_monad$seqS (sail2_state_monad$seqS
   (init_platform () )
   (init_sys () ))
   (init_vmem () ))
   (let (_ : unit) = (ext_init () ) in
   ext_init_regs () )))`;



val _ = export_theory()