File: fastrecordparser.d

package info (click to toggle)
sambamba 1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,528 kB
  • sloc: sh: 220; python: 166; ruby: 147; makefile: 103
file content (4712 lines) | stat: -rw-r--r-- 105,361 bytes parent folder | download | duplicates (2)
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
module bio.std.hts.sam.utils.fastrecordparser;

#line 1 "sam_alignment.rl"
/*
    This file is part of BioD.
    Copyright (C) 2012    Artem Tarasov <lomereiter@gmail.com>

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.

*/

#line 28 "sam_alignment.d"
static const int sam_alignment_start = 1;
static const int sam_alignment_first_final = 191;
static const int sam_alignment_error = 0;

static const int sam_alignment_en_recover_from_invalid_qname = 169;
static const int sam_alignment_en_recover_from_invalid_flag = 170;
static const int sam_alignment_en_recover_from_invalid_rname = 171;
static const int sam_alignment_en_recover_from_invalid_pos = 172;
static const int sam_alignment_en_recover_from_invalid_mapq = 173;
static const int sam_alignment_en_recover_from_invalid_cigar = 174;
static const int sam_alignment_en_recover_from_invalid_rnext = 175;
static const int sam_alignment_en_recover_from_invalid_pnext = 176;
static const int sam_alignment_en_recover_from_invalid_tlen = 177;
static const int sam_alignment_en_recover_from_invalid_seq = 178;
static const int sam_alignment_en_recover_from_invalid_qual = 179;
static const int sam_alignment_en_recover_from_invalid_tag = 180;
static const int sam_alignment_en_alignment = 1;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_flag_parsing = 181;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_rname_parsing = 182;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_pos_parsing = 183;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_mapq_parsing = 184;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_cigar_parsing = 185;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_rnext_parsing = 186;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_pnext_parsing = 187;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_tlen_parsing = 188;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_seq_parsing = 189;
static const int sam_alignment_en_alignment_field_parsing_mandatoryfields_qual_parsing = 190;
static const int sam_alignment_en_alignment_tag_parsing = 251;


#line 419 "sam_alignment.rl"


import bio.std.hts.sam.header;
import bio.std.hts.bam.cigar;
import bio.std.hts.bam.read;
import bio.std.hts.bam.bai.bin;
import bio.core.utils.outbuffer;
import bio.core.base;
import std.conv;
import std.array;
import std.exception;

BamRead parseAlignmentLine(string line, SamHeader header, OutBuffer buffer=null) {
    char* p = cast(char*)line.ptr;
    char* pe = p + line.length;
    char* eof = pe;
    int cs;

    if (buffer is null)
        buffer = new OutBuffer(8192);
    else
        buffer.clear();

    size_t rollback_size; // needed in case of invalid data

    byte current_sign = 1;

    size_t read_name_beg; // position of beginning of QNAME

    size_t sequence_beg; // position of SEQ start
    int l_seq;           // sequence length

    uint cigar_op_len;   // length of CIGAR operation
    char cigar_op_chr;   // CIGAR operation

    size_t quals_length;  // number of QUAL characters
    char quals_last_char; // needed in order to handle '*' correctly

    size_t cigar_op_len_start; // position of start of CIGAR operation

    long int_value;                      // for storing temporary integers
    float float_value;                   // for storing temporary floats
    size_t float_beg;                    // position of start of current float
    char arraytype;                      // type of last array tag value
    size_t tag_array_length_offset;      // where the length is stored in the buffer

    string read_name;
    ushort flag;
    int pos = -1;
    int end_pos; // for bin calculation
    int mate_pos = -1;
    ubyte mapping_quality = 255;
    int template_length = 0;

    size_t tag_key_beg, tagvalue_beg;
    ubyte[] tag_key;
    size_t rname_beg, rnext_beg;

    int ref_id = -1;

    
#line 121 "sam_alignment.d"
	{
	cs = sam_alignment_start;
	}

#line 480 "sam_alignment.rl"
    
#line 128 "sam_alignment.d"
	{
	if ( p == pe )
		goto _test_eof;
	switch ( cs )
	{
goto case; case 1:
	if ( (*p) == 9u )
		goto tr1;
	if ( (*p) > 63u ) {
		if ( 65u <= (*p) && (*p) <= 126u )
			goto tr2;
	} else if ( (*p) >= 33u )
		goto tr2;
	goto tr0;
tr0:
#line 50 "sam_alignment.rl"
	{ p--; {if (true) goto st169;} }
	goto st0;
tr3:
#line 58 "sam_alignment.rl"
	{ p--; {if (true) goto st170;} }
	goto st0;
tr7:
#line 67 "sam_alignment.rl"
	{ p--; {if (true) goto st171;} }
	goto st0;
tr12:
#line 75 "sam_alignment.rl"
	{ p--; {if (true) goto st172;} }
	goto st0;
tr16:
#line 81 "sam_alignment.rl"
	{ p--; {if (true) goto st173;} }
	goto st0;
tr20:
#line 124 "sam_alignment.rl"
	{
        auto ptr = cast(uint*)(buffer.data.ptr + 3 * uint.sizeof);
        *ptr = (*ptr) & 0xFFFF0000;
        buffer.shrink(rollback_size);
        end_pos = pos + 1;
        p--; {if (true) goto st174;}
    }
	goto st0;
tr24:
#line 162 "sam_alignment.rl"
	{ p--; {if (true) goto st175;} }
	goto st0;
tr30:
#line 175 "sam_alignment.rl"
	{ p--; {if (true) goto st176;} }
	goto st0;
tr34:
#line 187 "sam_alignment.rl"
	{ p--; {if (true) goto st177;} }
	goto st0;
tr39:
#line 217 "sam_alignment.rl"
	{
        rollback_size = buffer.length;
        p--; {if (true) goto st178;}
    }
	goto st0;
tr43:
#line 243 "sam_alignment.rl"
	{
        buffer.shrink(rollback_size);
        for (size_t i = 0; i < l_seq; ++i)
            buffer.putUnsafe!ubyte(0xFF);
        rollback_size = buffer.length;
        p--; {if (true) goto st179;}
    }
	goto st0;
tr49:
#line 403 "sam_alignment.rl"
	{
        buffer.shrink(rollback_size);
        p--; {if (true) goto st180;}
    }
	goto st0;
#line 209 "sam_alignment.d"
st0:
cs = 0;
	goto _out;
tr1:
#line 48 "sam_alignment.rl"
	{ read_name_beg = p - line.ptr; }
#line 49 "sam_alignment.rl"
	{ read_name = line[read_name_beg .. p - line.ptr]; }
	goto st2;
tr206:
#line 49 "sam_alignment.rl"
	{ read_name = line[read_name_beg .. p - line.ptr]; }
	goto st2;
st2:
	if ( ++p == pe )
		goto _test_eof2;
goto case; case 2:
#line 227 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr4;
	goto tr3;
tr4:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st3;
st3:
	if ( ++p == pe )
		goto _test_eof3;
goto case; case 3:
#line 241 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr6;
	goto tr3;
tr5:
#line 56 "sam_alignment.rl"
	{ flag = to!ushort(int_value); }
	goto st4;
st4:
	if ( ++p == pe )
		goto _test_eof4;
goto case; case 4:
#line 255 "sam_alignment.d"
	if ( (*p) == 42u )
		goto st150;
	if ( (*p) > 60u ) {
		if ( 62u <= (*p) && (*p) <= 126u )
			goto tr8;
	} else if ( (*p) >= 33u )
		goto tr8;
	goto tr7;
tr8:
#line 62 "sam_alignment.rl"
	{ rname_beg = p - line.ptr; }
	goto st5;
st5:
	if ( ++p == pe )
		goto _test_eof5;
goto case; case 5:
#line 272 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr10;
	if ( 33u <= (*p) && (*p) <= 126u )
		goto st5;
	goto tr7;
tr10:
#line 63 "sam_alignment.rl"
	{
        ref_id = header.getSequenceIndex(line[rname_beg .. p - line.ptr]);
    }
	goto st6;
st6:
	if ( ++p == pe )
		goto _test_eof6;
goto case; case 6:
#line 288 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr13;
	goto tr12;
tr13:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st7;
st7:
	if ( ++p == pe )
		goto _test_eof7;
goto case; case 7:
#line 302 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr15;
	goto tr12;
tr14:
#line 73 "sam_alignment.rl"
	{ end_pos = pos = to!uint(int_value); }
	goto st8;
st8:
	if ( ++p == pe )
		goto _test_eof8;
goto case; case 8:
#line 316 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr17;
	goto tr16;
tr17:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st9;
st9:
	if ( ++p == pe )
		goto _test_eof9;
goto case; case 9:
#line 330 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr19;
	goto tr16;
tr18:
#line 79 "sam_alignment.rl"
	{ mapping_quality = to!ubyte(int_value); }
#line 85 "sam_alignment.rl"
	{
        buffer.capacity = 32 + read_name.length + 1;
        buffer.putUnsafe!int(ref_id);
        buffer.putUnsafe!int(pos - 1);

        enforce(read_name.length + 1 <= 255, "Read name " ~ read_name ~ " is too long!");

        // bin will be set later
        auto bin_mq_nl = ((cast(uint)mapping_quality) << 8) | (read_name.length + 1);
        buffer.putUnsafe(cast(uint)bin_mq_nl);

        // number of CIGAR operations will be set later
        buffer.putUnsafe!uint(flag << 16);

        buffer.putUnsafe!int(0);
        buffer.putUnsafe!int(-1); // mate ref. id
        buffer.putUnsafe!int(-1); // mate pos
        buffer.putUnsafe!int(0);  // tlen

        buffer.putUnsafe(cast(ubyte[])read_name);
        buffer.putUnsafe!ubyte(0);

        rollback_size = buffer.length;
    }
	goto st10;
tr235:
#line 85 "sam_alignment.rl"
	{
        buffer.capacity = 32 + read_name.length + 1;
        buffer.putUnsafe!int(ref_id);
        buffer.putUnsafe!int(pos - 1);

        enforce(read_name.length + 1 <= 255, "Read name " ~ read_name ~ " is too long!");

        // bin will be set later
        auto bin_mq_nl = ((cast(uint)mapping_quality) << 8) | (read_name.length + 1);
        buffer.putUnsafe(cast(uint)bin_mq_nl);

        // number of CIGAR operations will be set later
        buffer.putUnsafe!uint(flag << 16);

        buffer.putUnsafe!int(0);
        buffer.putUnsafe!int(-1); // mate ref. id
        buffer.putUnsafe!int(-1); // mate pos
        buffer.putUnsafe!int(0);  // tlen

        buffer.putUnsafe(cast(ubyte[])read_name);
        buffer.putUnsafe!ubyte(0);

        rollback_size = buffer.length;
    }
	goto st10;
st10:
	if ( ++p == pe )
		goto _test_eof10;
goto case; case 10:
#line 396 "sam_alignment.d"
	if ( (*p) == 42u )
		goto st11;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr22;
	goto tr20;
st11:
	if ( ++p == pe )
		goto _test_eof11;
goto case; case 11:
	if ( (*p) == 9u )
		goto tr23;
	goto tr20;
tr23:
#line 137 "sam_alignment.rl"
	{
        if (end_pos == pos)
            ++end_pos;
        {
        auto bin = reg2bin(pos - 1, end_pos - 1); // 0-based [) interval
        auto ptr = cast(uint*)(buffer.data.ptr + 2 * uint.sizeof);
        *ptr = (*ptr) | ((cast(uint)bin) << 16);
        }
    }
	goto st12;
tr155:
#line 113 "sam_alignment.rl"
	{
        auto op = CigarOperation(cigar_op_len, cigar_op_chr);
        if (op.is_reference_consuming)
            end_pos += op.length;
        buffer.put!CigarOperation(op);
        {
        auto ptr = cast(uint*)(buffer.data.ptr + 3 * uint.sizeof);
        *ptr = (*ptr) + 1;
        }
    }
#line 137 "sam_alignment.rl"
	{
        if (end_pos == pos)
            ++end_pos;
        {
        auto bin = reg2bin(pos - 1, end_pos - 1); // 0-based [) interval
        auto ptr = cast(uint*)(buffer.data.ptr + 2 * uint.sizeof);
        *ptr = (*ptr) | ((cast(uint)bin) << 16);
        }
    }
	goto st12;
st12:
	if ( ++p == pe )
		goto _test_eof12;
goto case; case 12:
#line 448 "sam_alignment.d"
	switch( (*p) ) {
		case 42u: goto st95;
		case 61u: goto st96;
		default: break;
	}
	if ( 33u <= (*p) && (*p) <= 126u )
		goto tr25;
	goto tr24;
tr25:
#line 155 "sam_alignment.rl"
	{ rnext_beg = p - line.ptr; }
	goto st13;
st13:
	if ( ++p == pe )
		goto _test_eof13;
goto case; case 13:
#line 465 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr28;
	if ( 33u <= (*p) && (*p) <= 126u )
		goto st13;
	goto tr24;
tr28:
#line 156 "sam_alignment.rl"
	{
        {
        auto ptr = cast(int*)(buffer.data.ptr + 5 * int.sizeof);
        *ptr = header.getSequenceIndex(line[rnext_beg .. p - line.ptr]);
        }
    }
	goto st14;
tr136:
#line 148 "sam_alignment.rl"
	{
        {
        auto ptr = cast(int*)(buffer.data.ptr + 5 * int.sizeof);
        *ptr = ref_id;
        }
    }
	goto st14;
st14:
	if ( ++p == pe )
		goto _test_eof14;
goto case; case 14:
#line 493 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr31;
	goto tr30;
tr31:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st15;
st15:
	if ( ++p == pe )
		goto _test_eof15;
goto case; case 15:
#line 507 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr33;
	goto tr30;
tr32:
#line 169 "sam_alignment.rl"
	{
        {
        auto ptr = cast(int*)(buffer.data.ptr + 6 * int.sizeof);
        *ptr = to!int(int_value) - 1;
        }
    }
	goto st16;
st16:
	if ( ++p == pe )
		goto _test_eof16;
goto case; case 16:
#line 526 "sam_alignment.d"
	switch( (*p) ) {
		case 43u: goto tr35;
		case 45u: goto tr35;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr36;
	goto tr34;
tr35:
#line 27 "sam_alignment.rl"
	{ current_sign = (*p) == '-' ? -1 : 1; }
	goto st17;
st17:
	if ( ++p == pe )
		goto _test_eof17;
goto case; case 17:
#line 543 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr36;
	goto tr34;
tr36:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st18;
st18:
	if ( ++p == pe )
		goto _test_eof18;
goto case; case 18:
#line 557 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr38;
	goto tr34;
tr37:
#line 30 "sam_alignment.rl"
	{ int_value *= current_sign; current_sign = 1; }
#line 181 "sam_alignment.rl"
	{
        {
        auto ptr = cast(int*)(buffer.data.ptr + 7 * int.sizeof);
        *ptr = to!int(int_value);
        }
    }
	goto st19;
st19:
	if ( ++p == pe )
		goto _test_eof19;
goto case; case 19:
#line 578 "sam_alignment.d"
	switch( (*p) ) {
		case 42u: goto st20;
		case 46u: goto tr41;
		case 61u: goto tr41;
		default: break;
	}
	if ( (*p) > 90u ) {
		if ( 97u <= (*p) && (*p) <= 122u )
			goto tr41;
	} else if ( (*p) >= 65u )
		goto tr41;
	goto tr39;
st20:
	if ( ++p == pe )
		goto _test_eof20;
goto case; case 20:
	if ( (*p) == 9u )
		goto tr42;
	goto tr39;
tr42:
#line 223 "sam_alignment.rl"
	{
        rollback_size = buffer.length;
    }
	goto st21;
tr101:
#line 194 "sam_alignment.rl"
	{
        auto data = cast(ubyte[])line[sequence_beg .. p - line.ptr];
        l_seq = cast(int)data.length;
        auto raw_len = (l_seq + 1) / 2;

        // reserve space for base qualities, too
        buffer.capacity = buffer.length + raw_len + l_seq;

        for (size_t i = 0; i < raw_len; ++i) {
            auto b = cast(ubyte)(Base(data[2 * i]).internal_code << 4);
            if (2 * i + 1 < l_seq)
                b |= cast(ubyte)(Base(data[2 * i + 1]).internal_code);
            buffer.putUnsafe!ubyte(b);
        }

        // set l_seq
        {
        auto ptr = cast(int*)(buffer.data.ptr + 4 * int.sizeof);
        *ptr = l_seq;
        }

        rollback_size = buffer.length;
    }
	goto st21;
st21:
	if ( ++p == pe )
		goto _test_eof21;
goto case; case 21:
#line 634 "sam_alignment.d"
	if ( 33u <= (*p) && (*p) <= 126u )
		goto tr44;
	goto tr43;
tr44:
#line 230 "sam_alignment.rl"
	{
        ++quals_length;
        quals_last_char = (*p);
        buffer.putUnsafe!ubyte(cast(ubyte)((*p) - 33));
    }
	goto st191;
st191:
	if ( ++p == pe )
		goto _test_eof191;
goto case; case 191:
#line 650 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr239;
	if ( 33u <= (*p) && (*p) <= 126u )
		goto tr44;
	goto tr43;
tr239:
#line 236 "sam_alignment.rl"
	{
        // '*' may correspond either to a one-base long sequence
        // or to absence of information
        if (quals_length == 1 && quals_last_char == '*' && l_seq == 0)
            buffer.shrink(rollback_size);
    }
#line 253 "sam_alignment.rl"
	{
        if (buffer.length - rollback_size != l_seq) {
            buffer.shrink(rollback_size);
            for (size_t i = 0; i < l_seq; ++i)
                buffer.putUnsafe!ubyte(0xFF);
        }
        rollback_size = buffer.length;
    }
	goto st22;
tr240:
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
tr241:
#line 30 "sam_alignment.rl"
	{ int_value *= current_sign; current_sign = 1; }
#line 362 "sam_alignment.rl"
	{
        // here, we assume that compiler is smart enough to move switch out of loop.
        switch (arraytype) {
            case 'c': buffer.put(to!byte(int_value)); break;
            case 'C': buffer.put(to!ubyte(int_value)); break;
            case 's': buffer.put(to!short(int_value)); break;
            case 'S': buffer.put(to!ushort(int_value)); break;
            case 'i': buffer.put(to!int(int_value)); break;
            case 'I': buffer.put(to!uint(int_value)); break;
            default: assert(0);
        }
        {
            auto ptr = cast(uint*)(buffer.data.ptr + tag_array_length_offset);
            ++*ptr;
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
tr260:
#line 38 "sam_alignment.rl"
	{
        float_value = to!float(line[float_beg .. p - line.ptr]);
    }
#line 379 "sam_alignment.rl"
	{
        buffer.put!float(float_value);
        {
            auto ptr = cast(uint*)(buffer.data.ptr + tag_array_length_offset);
            ++*ptr;
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
tr263:
#line 337 "sam_alignment.rl"
	{
        {
        auto data = cast(ubyte[])(line[tagvalue_beg .. p - line.ptr]);
        buffer.capacity = buffer.length + 4 + data.length;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('H');
        buffer.putUnsafe(data);
        buffer.putUnsafe!ubyte(0);
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
tr265:
#line 326 "sam_alignment.rl"
	{
        {
        auto data = cast(ubyte[])(line[tagvalue_beg .. p - line.ptr]);
        buffer.capacity = buffer.length + 4 + data.length;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('Z');
        buffer.putUnsafe(data);
        buffer.putUnsafe!ubyte(0);
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
tr267:
#line 38 "sam_alignment.rl"
	{
        float_value = to!float(line[float_beg .. p - line.ptr]);
    }
#line 319 "sam_alignment.rl"
	{
        buffer.capacity = buffer.length + 7;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('f');
        buffer.putUnsafe!float(float_value);
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
tr269:
#line 30 "sam_alignment.rl"
	{ int_value *= current_sign; current_sign = 1; }
#line 285 "sam_alignment.rl"
	{
        buffer.capacity = buffer.length + 7;
        buffer.putUnsafe(tag_key);
        if (int_value < 0) {
            if (int_value >= byte.min) {
                buffer.putUnsafe!char('c');
                buffer.putUnsafe(cast(byte)int_value);
            } else if (int_value >= short.min) {
                buffer.putUnsafe!char('s');
                buffer.putUnsafe(cast(short)int_value);
            } else if (int_value >= int.min) {
                buffer.putUnsafe!char('i');
                buffer.putUnsafe(cast(int)int_value);
            } else {
                throw new Exception("integer out of range");
            }
        } else {
            if (int_value <= ubyte.max) {
                buffer.putUnsafe!char('C');
                buffer.putUnsafe(cast(ubyte)int_value);
            } else if (int_value <= ushort.max) {
                buffer.putUnsafe!char('S');
                buffer.putUnsafe(cast(ushort)int_value);
            } else if (int_value <= uint.max) {
                buffer.putUnsafe!char('I');
                buffer.putUnsafe(cast(uint)int_value);
            } else {
                throw new Exception("integer out of range");
            }
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	goto st22;
st22:
	if ( ++p == pe )
		goto _test_eof22;
goto case; case 22:
#line 804 "sam_alignment.d"
	if ( (*p) > 90u ) {
		if ( 97u <= (*p) && (*p) <= 122u )
			goto tr45;
	} else if ( (*p) >= 65u )
		goto tr45;
	goto st0;
tr45:
#line 400 "sam_alignment.rl"
	{ tag_key_beg = p - line.ptr; }
	goto st23;
st23:
	if ( ++p == pe )
		goto _test_eof23;
goto case; case 23:
#line 819 "sam_alignment.d"
	if ( (*p) < 65u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto st24;
	} else if ( (*p) > 90u ) {
		if ( 97u <= (*p) && (*p) <= 122u )
			goto st24;
	} else
		goto st24;
	goto st0;
st24:
	if ( ++p == pe )
		goto _test_eof24;
goto case; case 24:
	if ( (*p) == 58u )
		goto tr48;
	goto st0;
tr48:
#line 401 "sam_alignment.rl"
	{ tag_key = cast(ubyte[])(line[tag_key_beg .. p - line.ptr]); }
	goto st25;
st25:
	if ( ++p == pe )
		goto _test_eof25;
goto case; case 25:
#line 844 "sam_alignment.d"
	switch( (*p) ) {
		case 65u: goto st26;
		case 66u: goto st28;
		case 72u: goto st43;
		case 90u: goto st45;
		case 102u: goto st47;
		case 105u: goto st57;
		default: break;
	}
	goto tr49;
st26:
	if ( ++p == pe )
		goto _test_eof26;
goto case; case 26:
	if ( (*p) == 58u )
		goto st27;
	goto tr49;
st27:
	if ( ++p == pe )
		goto _test_eof27;
goto case; case 27:
	if ( 33u <= (*p) && (*p) <= 126u )
		goto tr57;
	goto tr49;
tr57:
#line 278 "sam_alignment.rl"
	{
        buffer.capacity = buffer.length + 4;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('A');
        buffer.putUnsafe!char((*p));
    }
	goto st192;
st192:
	if ( ++p == pe )
		goto _test_eof192;
goto case; case 192:
#line 882 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr240;
	goto tr49;
st28:
	if ( ++p == pe )
		goto _test_eof28;
goto case; case 28:
	if ( (*p) == 58u )
		goto st29;
	goto tr49;
st29:
	if ( ++p == pe )
		goto _test_eof29;
goto case; case 29:
	switch( (*p) ) {
		case 67u: goto tr59;
		case 73u: goto tr59;
		case 83u: goto tr59;
		case 99u: goto tr59;
		case 102u: goto tr60;
		case 105u: goto tr59;
		case 115u: goto tr59;
		default: break;
	}
	goto tr49;
tr59:
#line 352 "sam_alignment.rl"
	{
        arraytype = (*p);
        buffer.capacity = buffer.length + 8;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('B');
        buffer.putUnsafe!char(arraytype);
        buffer.putUnsafe!uint(0);
        tag_array_length_offset = buffer.length - uint.sizeof;
    }
	goto st30;
st30:
	if ( ++p == pe )
		goto _test_eof30;
goto case; case 30:
#line 924 "sam_alignment.d"
	if ( (*p) == 44u )
		goto st31;
	goto tr49;
tr242:
#line 30 "sam_alignment.rl"
	{ int_value *= current_sign; current_sign = 1; }
#line 362 "sam_alignment.rl"
	{
        // here, we assume that compiler is smart enough to move switch out of loop.
        switch (arraytype) {
            case 'c': buffer.put(to!byte(int_value)); break;
            case 'C': buffer.put(to!ubyte(int_value)); break;
            case 's': buffer.put(to!short(int_value)); break;
            case 'S': buffer.put(to!ushort(int_value)); break;
            case 'i': buffer.put(to!int(int_value)); break;
            case 'I': buffer.put(to!uint(int_value)); break;
            default: assert(0);
        }
        {
            auto ptr = cast(uint*)(buffer.data.ptr + tag_array_length_offset);
            ++*ptr;
        }
    }
	goto st31;
st31:
	if ( ++p == pe )
		goto _test_eof31;
goto case; case 31:
#line 953 "sam_alignment.d"
	switch( (*p) ) {
		case 43u: goto tr62;
		case 45u: goto tr62;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr63;
	goto tr49;
tr62:
#line 27 "sam_alignment.rl"
	{ current_sign = (*p) == '-' ? -1 : 1; }
	goto st32;
st32:
	if ( ++p == pe )
		goto _test_eof32;
goto case; case 32:
#line 970 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr63;
	goto tr49;
tr63:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st193;
st193:
	if ( ++p == pe )
		goto _test_eof193;
goto case; case 193:
#line 984 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr243;
	goto tr49;
tr243:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st194;
st194:
	if ( ++p == pe )
		goto _test_eof194;
goto case; case 194:
#line 1001 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr244;
	goto tr49;
tr244:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st195;
st195:
	if ( ++p == pe )
		goto _test_eof195;
goto case; case 195:
#line 1018 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr245;
	goto tr49;
tr245:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st196;
st196:
	if ( ++p == pe )
		goto _test_eof196;
goto case; case 196:
#line 1035 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr246;
	goto tr49;
tr246:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st197;
st197:
	if ( ++p == pe )
		goto _test_eof197;
goto case; case 197:
#line 1052 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr247;
	goto tr49;
tr247:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st198;
st198:
	if ( ++p == pe )
		goto _test_eof198;
goto case; case 198:
#line 1069 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr248;
	goto tr49;
tr248:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st199;
st199:
	if ( ++p == pe )
		goto _test_eof199;
goto case; case 199:
#line 1086 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr249;
	goto tr49;
tr249:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st200;
st200:
	if ( ++p == pe )
		goto _test_eof200;
goto case; case 200:
#line 1103 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr250;
	goto tr49;
tr250:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st201;
st201:
	if ( ++p == pe )
		goto _test_eof201;
goto case; case 201:
#line 1120 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr251;
	goto tr49;
tr251:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st202;
st202:
	if ( ++p == pe )
		goto _test_eof202;
goto case; case 202:
#line 1137 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr252;
	goto tr49;
tr252:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st203;
st203:
	if ( ++p == pe )
		goto _test_eof203;
goto case; case 203:
#line 1154 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr253;
	goto tr49;
tr253:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st204;
st204:
	if ( ++p == pe )
		goto _test_eof204;
goto case; case 204:
#line 1171 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr254;
	goto tr49;
tr254:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st205;
st205:
	if ( ++p == pe )
		goto _test_eof205;
goto case; case 205:
#line 1188 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr255;
	goto tr49;
tr255:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st206;
st206:
	if ( ++p == pe )
		goto _test_eof206;
goto case; case 206:
#line 1205 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr256;
	goto tr49;
tr256:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st207;
st207:
	if ( ++p == pe )
		goto _test_eof207;
goto case; case 207:
#line 1222 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr257;
	goto tr49;
tr257:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st208;
st208:
	if ( ++p == pe )
		goto _test_eof208;
goto case; case 208:
#line 1239 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr258;
	goto tr49;
tr258:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st209;
st209:
	if ( ++p == pe )
		goto _test_eof209;
goto case; case 209:
#line 1256 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr259;
	goto tr49;
tr259:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st210;
st210:
	if ( ++p == pe )
		goto _test_eof210;
goto case; case 210:
#line 1273 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr241;
		case 44u: goto tr242;
		default: break;
	}
	goto tr49;
tr60:
#line 352 "sam_alignment.rl"
	{
        arraytype = (*p);
        buffer.capacity = buffer.length + 8;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('B');
        buffer.putUnsafe!char(arraytype);
        buffer.putUnsafe!uint(0);
        tag_array_length_offset = buffer.length - uint.sizeof;
    }
	goto st33;
st33:
	if ( ++p == pe )
		goto _test_eof33;
goto case; case 33:
#line 1296 "sam_alignment.d"
	if ( (*p) == 44u )
		goto st34;
	goto tr49;
tr261:
#line 38 "sam_alignment.rl"
	{
        float_value = to!float(line[float_beg .. p - line.ptr]);
    }
#line 379 "sam_alignment.rl"
	{
        buffer.put!float(float_value);
        {
            auto ptr = cast(uint*)(buffer.data.ptr + tag_array_length_offset);
            ++*ptr;
        }
    }
	goto st34;
st34:
	if ( ++p == pe )
		goto _test_eof34;
goto case; case 34:
#line 1318 "sam_alignment.d"
	switch( (*p) ) {
		case 43u: goto tr65;
		case 45u: goto tr65;
		case 46u: goto tr66;
		case 105u: goto tr68;
		case 110u: goto tr69;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr67;
	goto tr49;
tr65:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st35;
st35:
	if ( ++p == pe )
		goto _test_eof35;
goto case; case 35:
#line 1338 "sam_alignment.d"
	switch( (*p) ) {
		case 46u: goto st36;
		case 105u: goto st39;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st213;
	goto tr49;
tr66:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st36;
st36:
	if ( ++p == pe )
		goto _test_eof36;
goto case; case 36:
#line 1355 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st211;
	goto tr49;
st211:
	if ( ++p == pe )
		goto _test_eof211;
goto case; case 211:
	switch( (*p) ) {
		case 9u: goto tr260;
		case 44u: goto tr261;
		case 69u: goto st37;
		case 101u: goto st37;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st211;
	goto tr49;
st37:
	if ( ++p == pe )
		goto _test_eof37;
goto case; case 37:
	switch( (*p) ) {
		case 43u: goto st38;
		case 45u: goto st38;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st212;
	goto tr49;
st38:
	if ( ++p == pe )
		goto _test_eof38;
goto case; case 38:
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st212;
	goto tr49;
st212:
	if ( ++p == pe )
		goto _test_eof212;
goto case; case 212:
	switch( (*p) ) {
		case 9u: goto tr260;
		case 44u: goto tr261;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st212;
	goto tr49;
tr67:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st213;
st213:
	if ( ++p == pe )
		goto _test_eof213;
goto case; case 213:
#line 1412 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr260;
		case 44u: goto tr261;
		case 46u: goto st36;
		case 69u: goto st37;
		case 101u: goto st37;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st213;
	goto tr49;
tr68:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st39;
st39:
	if ( ++p == pe )
		goto _test_eof39;
goto case; case 39:
#line 1432 "sam_alignment.d"
	if ( (*p) == 110u )
		goto st40;
	goto tr49;
st40:
	if ( ++p == pe )
		goto _test_eof40;
goto case; case 40:
	if ( (*p) == 102u )
		goto st214;
	goto tr49;
st214:
	if ( ++p == pe )
		goto _test_eof214;
goto case; case 214:
	switch( (*p) ) {
		case 9u: goto tr260;
		case 44u: goto tr261;
		default: break;
	}
	goto tr49;
tr69:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st41;
st41:
	if ( ++p == pe )
		goto _test_eof41;
goto case; case 41:
#line 1461 "sam_alignment.d"
	if ( (*p) == 97u )
		goto st42;
	goto tr49;
st42:
	if ( ++p == pe )
		goto _test_eof42;
goto case; case 42:
	if ( (*p) == 110u )
		goto st214;
	goto tr49;
st43:
	if ( ++p == pe )
		goto _test_eof43;
goto case; case 43:
	if ( (*p) == 58u )
		goto st44;
	goto tr49;
st44:
	if ( ++p == pe )
		goto _test_eof44;
goto case; case 44:
	if ( (*p) < 65u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr80;
	} else if ( (*p) > 70u ) {
		if ( 97u <= (*p) && (*p) <= 102u )
			goto tr80;
	} else
		goto tr80;
	goto tr49;
tr80:
#line 317 "sam_alignment.rl"
	{ tagvalue_beg = p - line.ptr; }
	goto st215;
st215:
	if ( ++p == pe )
		goto _test_eof215;
goto case; case 215:
#line 1500 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr263;
	if ( (*p) < 65u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto st215;
	} else if ( (*p) > 70u ) {
		if ( 97u <= (*p) && (*p) <= 102u )
			goto st215;
	} else
		goto st215;
	goto tr49;
st45:
	if ( ++p == pe )
		goto _test_eof45;
goto case; case 45:
	if ( (*p) == 58u )
		goto st46;
	goto tr49;
st46:
	if ( ++p == pe )
		goto _test_eof46;
goto case; case 46:
	if ( 32u <= (*p) && (*p) <= 126u )
		goto tr82;
	goto tr49;
tr82:
#line 317 "sam_alignment.rl"
	{ tagvalue_beg = p - line.ptr; }
	goto st216;
st216:
	if ( ++p == pe )
		goto _test_eof216;
goto case; case 216:
#line 1534 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr265;
	if ( 32u <= (*p) && (*p) <= 126u )
		goto st216;
	goto tr49;
st47:
	if ( ++p == pe )
		goto _test_eof47;
goto case; case 47:
	if ( (*p) == 58u )
		goto st48;
	goto tr49;
st48:
	if ( ++p == pe )
		goto _test_eof48;
goto case; case 48:
	switch( (*p) ) {
		case 43u: goto tr84;
		case 45u: goto tr84;
		case 46u: goto tr85;
		case 105u: goto tr87;
		case 110u: goto tr88;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr86;
	goto tr49;
tr84:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st49;
st49:
	if ( ++p == pe )
		goto _test_eof49;
goto case; case 49:
#line 1570 "sam_alignment.d"
	switch( (*p) ) {
		case 46u: goto st50;
		case 105u: goto st53;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st219;
	goto tr49;
tr85:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st50;
st50:
	if ( ++p == pe )
		goto _test_eof50;
goto case; case 50:
#line 1587 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st217;
	goto tr49;
st217:
	if ( ++p == pe )
		goto _test_eof217;
goto case; case 217:
	switch( (*p) ) {
		case 9u: goto tr267;
		case 69u: goto st51;
		case 101u: goto st51;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st217;
	goto tr49;
st51:
	if ( ++p == pe )
		goto _test_eof51;
goto case; case 51:
	switch( (*p) ) {
		case 43u: goto st52;
		case 45u: goto st52;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st218;
	goto tr49;
st52:
	if ( ++p == pe )
		goto _test_eof52;
goto case; case 52:
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st218;
	goto tr49;
st218:
	if ( ++p == pe )
		goto _test_eof218;
goto case; case 218:
	if ( (*p) == 9u )
		goto tr267;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st218;
	goto tr49;
tr86:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st219;
st219:
	if ( ++p == pe )
		goto _test_eof219;
goto case; case 219:
#line 1640 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr267;
		case 46u: goto st50;
		case 69u: goto st51;
		case 101u: goto st51;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto st219;
	goto tr49;
tr87:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st53;
st53:
	if ( ++p == pe )
		goto _test_eof53;
goto case; case 53:
#line 1659 "sam_alignment.d"
	if ( (*p) == 110u )
		goto st54;
	goto tr49;
st54:
	if ( ++p == pe )
		goto _test_eof54;
goto case; case 54:
	if ( (*p) == 102u )
		goto st220;
	goto tr49;
st220:
	if ( ++p == pe )
		goto _test_eof220;
goto case; case 220:
	if ( (*p) == 9u )
		goto tr267;
	goto tr49;
tr88:
#line 37 "sam_alignment.rl"
	{ float_beg = p - line.ptr; }
	goto st55;
st55:
	if ( ++p == pe )
		goto _test_eof55;
goto case; case 55:
#line 1685 "sam_alignment.d"
	if ( (*p) == 97u )
		goto st56;
	goto tr49;
st56:
	if ( ++p == pe )
		goto _test_eof56;
goto case; case 56:
	if ( (*p) == 110u )
		goto st220;
	goto tr49;
st57:
	if ( ++p == pe )
		goto _test_eof57;
goto case; case 57:
	if ( (*p) == 58u )
		goto st58;
	goto tr49;
st58:
	if ( ++p == pe )
		goto _test_eof58;
goto case; case 58:
	switch( (*p) ) {
		case 43u: goto tr99;
		case 45u: goto tr99;
		default: break;
	}
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr100;
	goto tr49;
tr99:
#line 27 "sam_alignment.rl"
	{ current_sign = (*p) == '-' ? -1 : 1; }
	goto st59;
st59:
	if ( ++p == pe )
		goto _test_eof59;
goto case; case 59:
#line 1723 "sam_alignment.d"
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr100;
	goto tr49;
tr100:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st221;
st221:
	if ( ++p == pe )
		goto _test_eof221;
goto case; case 221:
#line 1737 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr270;
	goto tr49;
tr270:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st222;
st222:
	if ( ++p == pe )
		goto _test_eof222;
goto case; case 222:
#line 1751 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr271;
	goto tr49;
tr271:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st223;
st223:
	if ( ++p == pe )
		goto _test_eof223;
goto case; case 223:
#line 1765 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr272;
	goto tr49;
tr272:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st224;
st224:
	if ( ++p == pe )
		goto _test_eof224;
goto case; case 224:
#line 1779 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr273;
	goto tr49;
tr273:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st225;
st225:
	if ( ++p == pe )
		goto _test_eof225;
goto case; case 225:
#line 1793 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr274;
	goto tr49;
tr274:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st226;
st226:
	if ( ++p == pe )
		goto _test_eof226;
goto case; case 226:
#line 1807 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr275;
	goto tr49;
tr275:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st227;
st227:
	if ( ++p == pe )
		goto _test_eof227;
goto case; case 227:
#line 1821 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr276;
	goto tr49;
tr276:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st228;
st228:
	if ( ++p == pe )
		goto _test_eof228;
goto case; case 228:
#line 1835 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr277;
	goto tr49;
tr277:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st229;
st229:
	if ( ++p == pe )
		goto _test_eof229;
goto case; case 229:
#line 1849 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr278;
	goto tr49;
tr278:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st230;
st230:
	if ( ++p == pe )
		goto _test_eof230;
goto case; case 230:
#line 1863 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr279;
	goto tr49;
tr279:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st231;
st231:
	if ( ++p == pe )
		goto _test_eof231;
goto case; case 231:
#line 1877 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr280;
	goto tr49;
tr280:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st232;
st232:
	if ( ++p == pe )
		goto _test_eof232;
goto case; case 232:
#line 1891 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr281;
	goto tr49;
tr281:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st233;
st233:
	if ( ++p == pe )
		goto _test_eof233;
goto case; case 233:
#line 1905 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr282;
	goto tr49;
tr282:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st234;
st234:
	if ( ++p == pe )
		goto _test_eof234;
goto case; case 234:
#line 1919 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr283;
	goto tr49;
tr283:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st235;
st235:
	if ( ++p == pe )
		goto _test_eof235;
goto case; case 235:
#line 1933 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr284;
	goto tr49;
tr284:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st236;
st236:
	if ( ++p == pe )
		goto _test_eof236;
goto case; case 236:
#line 1947 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr285;
	goto tr49;
tr285:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st237;
st237:
	if ( ++p == pe )
		goto _test_eof237;
goto case; case 237:
#line 1961 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr286;
	goto tr49;
tr286:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st238;
st238:
	if ( ++p == pe )
		goto _test_eof238;
goto case; case 238:
#line 1975 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr269;
	goto tr49;
tr41:
#line 193 "sam_alignment.rl"
	{ sequence_beg = p - line.ptr; }
	goto st60;
st60:
	if ( ++p == pe )
		goto _test_eof60;
goto case; case 60:
#line 1987 "sam_alignment.d"
	switch( (*p) ) {
		case 9u: goto tr101;
		case 46u: goto st60;
		case 61u: goto st60;
		default: break;
	}
	if ( (*p) > 90u ) {
		if ( 97u <= (*p) && (*p) <= 122u )
			goto st60;
	} else if ( (*p) >= 65u )
		goto st60;
	goto tr39;
tr38:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st61;
st61:
	if ( ++p == pe )
		goto _test_eof61;
goto case; case 61:
#line 2008 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr103;
	goto tr34;
tr103:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st62;
st62:
	if ( ++p == pe )
		goto _test_eof62;
goto case; case 62:
#line 2022 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr104;
	goto tr34;
tr104:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st63;
st63:
	if ( ++p == pe )
		goto _test_eof63;
goto case; case 63:
#line 2036 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr105;
	goto tr34;
tr105:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st64;
st64:
	if ( ++p == pe )
		goto _test_eof64;
goto case; case 64:
#line 2050 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr106;
	goto tr34;
tr106:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st65;
st65:
	if ( ++p == pe )
		goto _test_eof65;
goto case; case 65:
#line 2064 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr107;
	goto tr34;
tr107:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st66;
st66:
	if ( ++p == pe )
		goto _test_eof66;
goto case; case 66:
#line 2078 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr108;
	goto tr34;
tr108:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st67;
st67:
	if ( ++p == pe )
		goto _test_eof67;
goto case; case 67:
#line 2092 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr109;
	goto tr34;
tr109:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st68;
st68:
	if ( ++p == pe )
		goto _test_eof68;
goto case; case 68:
#line 2106 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr110;
	goto tr34;
tr110:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st69;
st69:
	if ( ++p == pe )
		goto _test_eof69;
goto case; case 69:
#line 2120 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr111;
	goto tr34;
tr111:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st70;
st70:
	if ( ++p == pe )
		goto _test_eof70;
goto case; case 70:
#line 2134 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr112;
	goto tr34;
tr112:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st71;
st71:
	if ( ++p == pe )
		goto _test_eof71;
goto case; case 71:
#line 2148 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr113;
	goto tr34;
tr113:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st72;
st72:
	if ( ++p == pe )
		goto _test_eof72;
goto case; case 72:
#line 2162 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr114;
	goto tr34;
tr114:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st73;
st73:
	if ( ++p == pe )
		goto _test_eof73;
goto case; case 73:
#line 2176 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr115;
	goto tr34;
tr115:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st74;
st74:
	if ( ++p == pe )
		goto _test_eof74;
goto case; case 74:
#line 2190 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr116;
	goto tr34;
tr116:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st75;
st75:
	if ( ++p == pe )
		goto _test_eof75;
goto case; case 75:
#line 2204 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr117;
	goto tr34;
tr117:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st76;
st76:
	if ( ++p == pe )
		goto _test_eof76;
goto case; case 76:
#line 2218 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr118;
	goto tr34;
tr118:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st77;
st77:
	if ( ++p == pe )
		goto _test_eof77;
goto case; case 77:
#line 2232 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr37;
	goto tr34;
tr33:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st78;
st78:
	if ( ++p == pe )
		goto _test_eof78;
goto case; case 78:
#line 2244 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr119;
	goto tr30;
tr119:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st79;
st79:
	if ( ++p == pe )
		goto _test_eof79;
goto case; case 79:
#line 2258 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr120;
	goto tr30;
tr120:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st80;
st80:
	if ( ++p == pe )
		goto _test_eof80;
goto case; case 80:
#line 2272 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr121;
	goto tr30;
tr121:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st81;
st81:
	if ( ++p == pe )
		goto _test_eof81;
goto case; case 81:
#line 2286 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr122;
	goto tr30;
tr122:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st82;
st82:
	if ( ++p == pe )
		goto _test_eof82;
goto case; case 82:
#line 2300 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr123;
	goto tr30;
tr123:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st83;
st83:
	if ( ++p == pe )
		goto _test_eof83;
goto case; case 83:
#line 2314 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr124;
	goto tr30;
tr124:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st84;
st84:
	if ( ++p == pe )
		goto _test_eof84;
goto case; case 84:
#line 2328 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr125;
	goto tr30;
tr125:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st85;
st85:
	if ( ++p == pe )
		goto _test_eof85;
goto case; case 85:
#line 2342 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr126;
	goto tr30;
tr126:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st86;
st86:
	if ( ++p == pe )
		goto _test_eof86;
goto case; case 86:
#line 2356 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr127;
	goto tr30;
tr127:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st87;
st87:
	if ( ++p == pe )
		goto _test_eof87;
goto case; case 87:
#line 2370 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr128;
	goto tr30;
tr128:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st88;
st88:
	if ( ++p == pe )
		goto _test_eof88;
goto case; case 88:
#line 2384 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr129;
	goto tr30;
tr129:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st89;
st89:
	if ( ++p == pe )
		goto _test_eof89;
goto case; case 89:
#line 2398 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr130;
	goto tr30;
tr130:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st90;
st90:
	if ( ++p == pe )
		goto _test_eof90;
goto case; case 90:
#line 2412 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr131;
	goto tr30;
tr131:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st91;
st91:
	if ( ++p == pe )
		goto _test_eof91;
goto case; case 91:
#line 2426 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr132;
	goto tr30;
tr132:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st92;
st92:
	if ( ++p == pe )
		goto _test_eof92;
goto case; case 92:
#line 2440 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr133;
	goto tr30;
tr133:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st93;
st93:
	if ( ++p == pe )
		goto _test_eof93;
goto case; case 93:
#line 2454 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr134;
	goto tr30;
tr134:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st94;
st94:
	if ( ++p == pe )
		goto _test_eof94;
goto case; case 94:
#line 2468 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr32;
	goto tr30;
st95:
	if ( ++p == pe )
		goto _test_eof95;
goto case; case 95:
	if ( (*p) == 9u )
		goto st14;
	goto tr24;
st96:
	if ( ++p == pe )
		goto _test_eof96;
goto case; case 96:
	if ( (*p) == 9u )
		goto tr136;
	goto tr24;
tr22:
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st97;
tr156:
#line 113 "sam_alignment.rl"
	{
        auto op = CigarOperation(cigar_op_len, cigar_op_chr);
        if (op.is_reference_consuming)
            end_pos += op.length;
        buffer.put!CigarOperation(op);
        {
        auto ptr = cast(uint*)(buffer.data.ptr + 3 * uint.sizeof);
        *ptr = (*ptr) + 1;
        }
    }
#line 28 "sam_alignment.rl"
	{ int_value = 0; }
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st97;
st97:
	if ( ++p == pe )
		goto _test_eof97;
goto case; case 97:
#line 2513 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr137;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr137:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st98;
st98:
	if ( ++p == pe )
		goto _test_eof98;
goto case; case 98:
#line 2539 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr139;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr139:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st99;
st99:
	if ( ++p == pe )
		goto _test_eof99;
goto case; case 99:
#line 2565 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr140;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr140:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st100;
st100:
	if ( ++p == pe )
		goto _test_eof100;
goto case; case 100:
#line 2591 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr141;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr141:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st101;
st101:
	if ( ++p == pe )
		goto _test_eof101;
goto case; case 101:
#line 2617 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr142;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr142:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st102;
st102:
	if ( ++p == pe )
		goto _test_eof102;
goto case; case 102:
#line 2643 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr143;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr143:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st103;
st103:
	if ( ++p == pe )
		goto _test_eof103;
goto case; case 103:
#line 2669 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr144;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr144:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st104;
st104:
	if ( ++p == pe )
		goto _test_eof104;
goto case; case 104:
#line 2695 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr145;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr145:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st105;
st105:
	if ( ++p == pe )
		goto _test_eof105;
goto case; case 105:
#line 2721 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr146;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr146:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st106;
st106:
	if ( ++p == pe )
		goto _test_eof106;
goto case; case 106:
#line 2747 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr147;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr147:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st107;
st107:
	if ( ++p == pe )
		goto _test_eof107;
goto case; case 107:
#line 2773 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr148;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr148:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st108;
st108:
	if ( ++p == pe )
		goto _test_eof108;
goto case; case 108:
#line 2799 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr149;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr149:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st109;
st109:
	if ( ++p == pe )
		goto _test_eof109;
goto case; case 109:
#line 2825 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr150;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr150:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st110;
st110:
	if ( ++p == pe )
		goto _test_eof110;
goto case; case 110:
#line 2851 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr151;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr151:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st111;
st111:
	if ( ++p == pe )
		goto _test_eof111;
goto case; case 111:
#line 2877 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr152;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr152:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st112;
st112:
	if ( ++p == pe )
		goto _test_eof112;
goto case; case 112:
#line 2903 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr153;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr153:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st113;
st113:
	if ( ++p == pe )
		goto _test_eof113;
goto case; case 113:
#line 2929 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) < 72u ) {
		if ( 48u <= (*p) && (*p) <= 57u )
			goto tr154;
	} else if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else
		goto tr138;
	goto tr20;
tr154:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st114;
st114:
	if ( ++p == pe )
		goto _test_eof114;
goto case; case 114:
#line 2955 "sam_alignment.d"
	switch( (*p) ) {
		case 61u: goto tr138;
		case 68u: goto tr138;
		case 80u: goto tr138;
		case 83u: goto tr138;
		case 88u: goto tr138;
		default: break;
	}
	if ( (*p) > 73u ) {
		if ( 77u <= (*p) && (*p) <= 78u )
			goto tr138;
	} else if ( (*p) >= 72u )
		goto tr138;
	goto tr20;
tr138:
#line 111 "sam_alignment.rl"
	{ cigar_op_len = to!uint(int_value); }
#line 112 "sam_alignment.rl"
	{ cigar_op_chr = (*p); }
	goto st115;
st115:
	if ( ++p == pe )
		goto _test_eof115;
goto case; case 115:
#line 2980 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr155;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr156;
	goto tr20;
tr19:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st116;
st116:
	if ( ++p == pe )
		goto _test_eof116;
goto case; case 116:
#line 2994 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr157;
	goto tr16;
tr157:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st117;
st117:
	if ( ++p == pe )
		goto _test_eof117;
goto case; case 117:
#line 3008 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr158;
	goto tr16;
tr158:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st118;
st118:
	if ( ++p == pe )
		goto _test_eof118;
goto case; case 118:
#line 3022 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr159;
	goto tr16;
tr159:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st119;
st119:
	if ( ++p == pe )
		goto _test_eof119;
goto case; case 119:
#line 3036 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr160;
	goto tr16;
tr160:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st120;
st120:
	if ( ++p == pe )
		goto _test_eof120;
goto case; case 120:
#line 3050 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr161;
	goto tr16;
tr161:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st121;
st121:
	if ( ++p == pe )
		goto _test_eof121;
goto case; case 121:
#line 3064 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr162;
	goto tr16;
tr162:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st122;
st122:
	if ( ++p == pe )
		goto _test_eof122;
goto case; case 122:
#line 3078 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr163;
	goto tr16;
tr163:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st123;
st123:
	if ( ++p == pe )
		goto _test_eof123;
goto case; case 123:
#line 3092 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr164;
	goto tr16;
tr164:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st124;
st124:
	if ( ++p == pe )
		goto _test_eof124;
goto case; case 124:
#line 3106 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr165;
	goto tr16;
tr165:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st125;
st125:
	if ( ++p == pe )
		goto _test_eof125;
goto case; case 125:
#line 3120 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr166;
	goto tr16;
tr166:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st126;
st126:
	if ( ++p == pe )
		goto _test_eof126;
goto case; case 126:
#line 3134 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr167;
	goto tr16;
tr167:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st127;
st127:
	if ( ++p == pe )
		goto _test_eof127;
goto case; case 127:
#line 3148 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr168;
	goto tr16;
tr168:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st128;
st128:
	if ( ++p == pe )
		goto _test_eof128;
goto case; case 128:
#line 3162 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr169;
	goto tr16;
tr169:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st129;
st129:
	if ( ++p == pe )
		goto _test_eof129;
goto case; case 129:
#line 3176 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr170;
	goto tr16;
tr170:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st130;
st130:
	if ( ++p == pe )
		goto _test_eof130;
goto case; case 130:
#line 3190 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr171;
	goto tr16;
tr171:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st131;
st131:
	if ( ++p == pe )
		goto _test_eof131;
goto case; case 131:
#line 3204 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr172;
	goto tr16;
tr172:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st132;
st132:
	if ( ++p == pe )
		goto _test_eof132;
goto case; case 132:
#line 3218 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr18;
	goto tr16;
tr15:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st133;
st133:
	if ( ++p == pe )
		goto _test_eof133;
goto case; case 133:
#line 3230 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr173;
	goto tr12;
tr173:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st134;
st134:
	if ( ++p == pe )
		goto _test_eof134;
goto case; case 134:
#line 3244 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr174;
	goto tr12;
tr174:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st135;
st135:
	if ( ++p == pe )
		goto _test_eof135;
goto case; case 135:
#line 3258 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr175;
	goto tr12;
tr175:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st136;
st136:
	if ( ++p == pe )
		goto _test_eof136;
goto case; case 136:
#line 3272 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr176;
	goto tr12;
tr176:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st137;
st137:
	if ( ++p == pe )
		goto _test_eof137;
goto case; case 137:
#line 3286 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr177;
	goto tr12;
tr177:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st138;
st138:
	if ( ++p == pe )
		goto _test_eof138;
goto case; case 138:
#line 3300 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr178;
	goto tr12;
tr178:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st139;
st139:
	if ( ++p == pe )
		goto _test_eof139;
goto case; case 139:
#line 3314 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr179;
	goto tr12;
tr179:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st140;
st140:
	if ( ++p == pe )
		goto _test_eof140;
goto case; case 140:
#line 3328 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr180;
	goto tr12;
tr180:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st141;
st141:
	if ( ++p == pe )
		goto _test_eof141;
goto case; case 141:
#line 3342 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr181;
	goto tr12;
tr181:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st142;
st142:
	if ( ++p == pe )
		goto _test_eof142;
goto case; case 142:
#line 3356 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr182;
	goto tr12;
tr182:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st143;
st143:
	if ( ++p == pe )
		goto _test_eof143;
goto case; case 143:
#line 3370 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr183;
	goto tr12;
tr183:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st144;
st144:
	if ( ++p == pe )
		goto _test_eof144;
goto case; case 144:
#line 3384 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr184;
	goto tr12;
tr184:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st145;
st145:
	if ( ++p == pe )
		goto _test_eof145;
goto case; case 145:
#line 3398 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr185;
	goto tr12;
tr185:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st146;
st146:
	if ( ++p == pe )
		goto _test_eof146;
goto case; case 146:
#line 3412 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr186;
	goto tr12;
tr186:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st147;
st147:
	if ( ++p == pe )
		goto _test_eof147;
goto case; case 147:
#line 3426 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr187;
	goto tr12;
tr187:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st148;
st148:
	if ( ++p == pe )
		goto _test_eof148;
goto case; case 148:
#line 3440 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr188;
	goto tr12;
tr188:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st149;
st149:
	if ( ++p == pe )
		goto _test_eof149;
goto case; case 149:
#line 3454 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr14;
	goto tr12;
st150:
	if ( ++p == pe )
		goto _test_eof150;
goto case; case 150:
	if ( (*p) == 9u )
		goto st6;
	goto tr7;
tr6:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st151;
st151:
	if ( ++p == pe )
		goto _test_eof151;
goto case; case 151:
#line 3473 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr190;
	goto tr3;
tr190:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st152;
st152:
	if ( ++p == pe )
		goto _test_eof152;
goto case; case 152:
#line 3487 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr191;
	goto tr3;
tr191:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st153;
st153:
	if ( ++p == pe )
		goto _test_eof153;
goto case; case 153:
#line 3501 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr192;
	goto tr3;
tr192:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st154;
st154:
	if ( ++p == pe )
		goto _test_eof154;
goto case; case 154:
#line 3515 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr193;
	goto tr3;
tr193:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st155;
st155:
	if ( ++p == pe )
		goto _test_eof155;
goto case; case 155:
#line 3529 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr194;
	goto tr3;
tr194:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st156;
st156:
	if ( ++p == pe )
		goto _test_eof156;
goto case; case 156:
#line 3543 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr195;
	goto tr3;
tr195:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st157;
st157:
	if ( ++p == pe )
		goto _test_eof157;
goto case; case 157:
#line 3557 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr196;
	goto tr3;
tr196:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st158;
st158:
	if ( ++p == pe )
		goto _test_eof158;
goto case; case 158:
#line 3571 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr197;
	goto tr3;
tr197:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st159;
st159:
	if ( ++p == pe )
		goto _test_eof159;
goto case; case 159:
#line 3585 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr198;
	goto tr3;
tr198:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st160;
st160:
	if ( ++p == pe )
		goto _test_eof160;
goto case; case 160:
#line 3599 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr199;
	goto tr3;
tr199:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st161;
st161:
	if ( ++p == pe )
		goto _test_eof161;
goto case; case 161:
#line 3613 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr200;
	goto tr3;
tr200:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st162;
st162:
	if ( ++p == pe )
		goto _test_eof162;
goto case; case 162:
#line 3627 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr201;
	goto tr3;
tr201:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st163;
st163:
	if ( ++p == pe )
		goto _test_eof163;
goto case; case 163:
#line 3641 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr202;
	goto tr3;
tr202:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st164;
st164:
	if ( ++p == pe )
		goto _test_eof164;
goto case; case 164:
#line 3655 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr203;
	goto tr3;
tr203:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st165;
st165:
	if ( ++p == pe )
		goto _test_eof165;
goto case; case 165:
#line 3669 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr204;
	goto tr3;
tr204:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st166;
st166:
	if ( ++p == pe )
		goto _test_eof166;
goto case; case 166:
#line 3683 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	if ( 48u <= (*p) && (*p) <= 57u )
		goto tr205;
	goto tr3;
tr205:
#line 29 "sam_alignment.rl"
	{ int_value *= 10; int_value += (*p) - '0'; }
	goto st167;
st167:
	if ( ++p == pe )
		goto _test_eof167;
goto case; case 167:
#line 3697 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr5;
	goto tr3;
tr2:
#line 48 "sam_alignment.rl"
	{ read_name_beg = p - line.ptr; }
	goto st168;
st168:
	if ( ++p == pe )
		goto _test_eof168;
goto case; case 168:
#line 3709 "sam_alignment.d"
	if ( (*p) == 9u )
		goto tr206;
	if ( (*p) > 63u ) {
		if ( 65u <= (*p) && (*p) <= 126u )
			goto st168;
	} else if ( (*p) >= 33u )
		goto st168;
	goto tr0;
st169:
	if ( ++p == pe )
		goto _test_eof169;
goto case; case 169:
	if ( (*p) == 9u )
		goto tr209;
	goto st169;
tr209:
#line 51 "sam_alignment.rl"
	{ p--; {if (true) goto st181;} }
	goto st239;
st239:
	if ( ++p == pe )
		goto _test_eof239;
goto case; case 239:
#line 3733 "sam_alignment.d"
	goto st0;
st170:
	if ( ++p == pe )
		goto _test_eof170;
goto case; case 170:
	if ( (*p) == 9u )
		goto tr211;
	goto st170;
tr211:
#line 59 "sam_alignment.rl"
	{ p--; {if (true) goto st182;} }
	goto st240;
st240:
	if ( ++p == pe )
		goto _test_eof240;
goto case; case 240:
#line 3750 "sam_alignment.d"
	goto st0;
st171:
	if ( ++p == pe )
		goto _test_eof171;
goto case; case 171:
	if ( (*p) == 9u )
		goto tr213;
	goto st171;
tr213:
#line 68 "sam_alignment.rl"
	{ p--; {if (true) goto st183;} }
	goto st241;
st241:
	if ( ++p == pe )
		goto _test_eof241;
goto case; case 241:
#line 3767 "sam_alignment.d"
	goto st0;
st172:
	if ( ++p == pe )
		goto _test_eof172;
goto case; case 172:
	if ( (*p) == 9u )
		goto tr215;
	goto st172;
tr215:
#line 76 "sam_alignment.rl"
	{ p--; {if (true) goto st184;} }
	goto st242;
st242:
	if ( ++p == pe )
		goto _test_eof242;
goto case; case 242:
#line 3784 "sam_alignment.d"
	goto st0;
st173:
	if ( ++p == pe )
		goto _test_eof173;
goto case; case 173:
	if ( (*p) == 9u )
		goto tr217;
	goto st173;
tr217:
#line 82 "sam_alignment.rl"
	{ p--; {if (true) goto st185;} }
	goto st243;
st243:
	if ( ++p == pe )
		goto _test_eof243;
goto case; case 243:
#line 3801 "sam_alignment.d"
	goto st0;
st174:
	if ( ++p == pe )
		goto _test_eof174;
goto case; case 174:
	if ( (*p) == 9u )
		goto tr219;
	goto st174;
tr219:
#line 131 "sam_alignment.rl"
	{ p--; {if (true) goto st186;} }
	goto st244;
st244:
	if ( ++p == pe )
		goto _test_eof244;
goto case; case 244:
#line 3818 "sam_alignment.d"
	goto st0;
st175:
	if ( ++p == pe )
		goto _test_eof175;
goto case; case 175:
	if ( (*p) == 9u )
		goto tr221;
	goto st175;
tr221:
#line 163 "sam_alignment.rl"
	{ p--; {if (true) goto st187;} }
	goto st245;
st245:
	if ( ++p == pe )
		goto _test_eof245;
goto case; case 245:
#line 3835 "sam_alignment.d"
	goto st0;
st176:
	if ( ++p == pe )
		goto _test_eof176;
goto case; case 176:
	if ( (*p) == 9u )
		goto tr223;
	goto st176;
tr223:
#line 176 "sam_alignment.rl"
	{ p--; {if (true) goto st188;} }
	goto st246;
st246:
	if ( ++p == pe )
		goto _test_eof246;
goto case; case 246:
#line 3852 "sam_alignment.d"
	goto st0;
st177:
	if ( ++p == pe )
		goto _test_eof177;
goto case; case 177:
	if ( (*p) == 9u )
		goto tr225;
	goto st177;
tr225:
#line 188 "sam_alignment.rl"
	{ p--; {if (true) goto st189;} }
	goto st247;
st247:
	if ( ++p == pe )
		goto _test_eof247;
goto case; case 247:
#line 3869 "sam_alignment.d"
	goto st0;
st178:
	if ( ++p == pe )
		goto _test_eof178;
goto case; case 178:
	if ( (*p) == 9u )
		goto tr227;
	goto st178;
tr227:
#line 221 "sam_alignment.rl"
	{ p--; {if (true) goto st190;} }
	goto st248;
st248:
	if ( ++p == pe )
		goto _test_eof248;
goto case; case 248:
#line 3886 "sam_alignment.d"
	goto st0;
st179:
	if ( ++p == pe )
		goto _test_eof179;
goto case; case 179:
	if ( (*p) == 9u )
		goto tr229;
	goto st179;
tr229:
#line 251 "sam_alignment.rl"
	{ p--; {if (true) goto st251;} }
	goto st249;
st249:
	if ( ++p == pe )
		goto _test_eof249;
goto case; case 249:
#line 3903 "sam_alignment.d"
	goto st0;
st180:
	if ( ++p == pe )
		goto _test_eof180;
goto case; case 180:
	if ( (*p) == 9u )
		goto tr231;
	goto st180;
tr231:
#line 408 "sam_alignment.rl"
	{ p--; {if (true) goto st251;} }
	goto st250;
st250:
	if ( ++p == pe )
		goto _test_eof250;
goto case; case 250:
#line 3920 "sam_alignment.d"
	goto st0;
st181:
	if ( ++p == pe )
		goto _test_eof181;
goto case; case 181:
	if ( (*p) == 9u )
		goto st2;
	goto st0;
st182:
	if ( ++p == pe )
		goto _test_eof182;
goto case; case 182:
	if ( (*p) == 9u )
		goto st4;
	goto st0;
st183:
	if ( ++p == pe )
		goto _test_eof183;
goto case; case 183:
	if ( (*p) == 9u )
		goto st6;
	goto st0;
st184:
	if ( ++p == pe )
		goto _test_eof184;
goto case; case 184:
	if ( (*p) == 9u )
		goto st8;
	goto st0;
st185:
	if ( ++p == pe )
		goto _test_eof185;
goto case; case 185:
	if ( (*p) == 9u )
		goto tr235;
	goto st0;
st186:
	if ( ++p == pe )
		goto _test_eof186;
goto case; case 186:
	if ( (*p) == 9u )
		goto tr23;
	goto st0;
st187:
	if ( ++p == pe )
		goto _test_eof187;
goto case; case 187:
	if ( (*p) == 9u )
		goto st14;
	goto st0;
st188:
	if ( ++p == pe )
		goto _test_eof188;
goto case; case 188:
	if ( (*p) == 9u )
		goto st16;
	goto st0;
st189:
	if ( ++p == pe )
		goto _test_eof189;
goto case; case 189:
	if ( (*p) == 9u )
		goto st19;
	goto st0;
st190:
	if ( ++p == pe )
		goto _test_eof190;
goto case; case 190:
	if ( (*p) == 9u )
		goto st21;
	goto st0;
st251:
	if ( ++p == pe )
		goto _test_eof251;
goto case; case 251:
	if ( (*p) == 9u )
		goto st22;
	goto st0;
		default: break;
	}
	_test_eof2: cs = 2; goto _test_eof; 
	_test_eof3: cs = 3; goto _test_eof; 
	_test_eof4: cs = 4; goto _test_eof; 
	_test_eof5: cs = 5; goto _test_eof; 
	_test_eof6: cs = 6; goto _test_eof; 
	_test_eof7: cs = 7; goto _test_eof; 
	_test_eof8: cs = 8; goto _test_eof; 
	_test_eof9: cs = 9; goto _test_eof; 
	_test_eof10: cs = 10; goto _test_eof; 
	_test_eof11: cs = 11; goto _test_eof; 
	_test_eof12: cs = 12; goto _test_eof; 
	_test_eof13: cs = 13; goto _test_eof; 
	_test_eof14: cs = 14; goto _test_eof; 
	_test_eof15: cs = 15; goto _test_eof; 
	_test_eof16: cs = 16; goto _test_eof; 
	_test_eof17: cs = 17; goto _test_eof; 
	_test_eof18: cs = 18; goto _test_eof; 
	_test_eof19: cs = 19; goto _test_eof; 
	_test_eof20: cs = 20; goto _test_eof; 
	_test_eof21: cs = 21; goto _test_eof; 
	_test_eof191: cs = 191; goto _test_eof; 
	_test_eof22: cs = 22; goto _test_eof; 
	_test_eof23: cs = 23; goto _test_eof; 
	_test_eof24: cs = 24; goto _test_eof; 
	_test_eof25: cs = 25; goto _test_eof; 
	_test_eof26: cs = 26; goto _test_eof; 
	_test_eof27: cs = 27; goto _test_eof; 
	_test_eof192: cs = 192; goto _test_eof; 
	_test_eof28: cs = 28; goto _test_eof; 
	_test_eof29: cs = 29; goto _test_eof; 
	_test_eof30: cs = 30; goto _test_eof; 
	_test_eof31: cs = 31; goto _test_eof; 
	_test_eof32: cs = 32; goto _test_eof; 
	_test_eof193: cs = 193; goto _test_eof; 
	_test_eof194: cs = 194; goto _test_eof; 
	_test_eof195: cs = 195; goto _test_eof; 
	_test_eof196: cs = 196; goto _test_eof; 
	_test_eof197: cs = 197; goto _test_eof; 
	_test_eof198: cs = 198; goto _test_eof; 
	_test_eof199: cs = 199; goto _test_eof; 
	_test_eof200: cs = 200; goto _test_eof; 
	_test_eof201: cs = 201; goto _test_eof; 
	_test_eof202: cs = 202; goto _test_eof; 
	_test_eof203: cs = 203; goto _test_eof; 
	_test_eof204: cs = 204; goto _test_eof; 
	_test_eof205: cs = 205; goto _test_eof; 
	_test_eof206: cs = 206; goto _test_eof; 
	_test_eof207: cs = 207; goto _test_eof; 
	_test_eof208: cs = 208; goto _test_eof; 
	_test_eof209: cs = 209; goto _test_eof; 
	_test_eof210: cs = 210; goto _test_eof; 
	_test_eof33: cs = 33; goto _test_eof; 
	_test_eof34: cs = 34; goto _test_eof; 
	_test_eof35: cs = 35; goto _test_eof; 
	_test_eof36: cs = 36; goto _test_eof; 
	_test_eof211: cs = 211; goto _test_eof; 
	_test_eof37: cs = 37; goto _test_eof; 
	_test_eof38: cs = 38; goto _test_eof; 
	_test_eof212: cs = 212; goto _test_eof; 
	_test_eof213: cs = 213; goto _test_eof; 
	_test_eof39: cs = 39; goto _test_eof; 
	_test_eof40: cs = 40; goto _test_eof; 
	_test_eof214: cs = 214; goto _test_eof; 
	_test_eof41: cs = 41; goto _test_eof; 
	_test_eof42: cs = 42; goto _test_eof; 
	_test_eof43: cs = 43; goto _test_eof; 
	_test_eof44: cs = 44; goto _test_eof; 
	_test_eof215: cs = 215; goto _test_eof; 
	_test_eof45: cs = 45; goto _test_eof; 
	_test_eof46: cs = 46; goto _test_eof; 
	_test_eof216: cs = 216; goto _test_eof; 
	_test_eof47: cs = 47; goto _test_eof; 
	_test_eof48: cs = 48; goto _test_eof; 
	_test_eof49: cs = 49; goto _test_eof; 
	_test_eof50: cs = 50; goto _test_eof; 
	_test_eof217: cs = 217; goto _test_eof; 
	_test_eof51: cs = 51; goto _test_eof; 
	_test_eof52: cs = 52; goto _test_eof; 
	_test_eof218: cs = 218; goto _test_eof; 
	_test_eof219: cs = 219; goto _test_eof; 
	_test_eof53: cs = 53; goto _test_eof; 
	_test_eof54: cs = 54; goto _test_eof; 
	_test_eof220: cs = 220; goto _test_eof; 
	_test_eof55: cs = 55; goto _test_eof; 
	_test_eof56: cs = 56; goto _test_eof; 
	_test_eof57: cs = 57; goto _test_eof; 
	_test_eof58: cs = 58; goto _test_eof; 
	_test_eof59: cs = 59; goto _test_eof; 
	_test_eof221: cs = 221; goto _test_eof; 
	_test_eof222: cs = 222; goto _test_eof; 
	_test_eof223: cs = 223; goto _test_eof; 
	_test_eof224: cs = 224; goto _test_eof; 
	_test_eof225: cs = 225; goto _test_eof; 
	_test_eof226: cs = 226; goto _test_eof; 
	_test_eof227: cs = 227; goto _test_eof; 
	_test_eof228: cs = 228; goto _test_eof; 
	_test_eof229: cs = 229; goto _test_eof; 
	_test_eof230: cs = 230; goto _test_eof; 
	_test_eof231: cs = 231; goto _test_eof; 
	_test_eof232: cs = 232; goto _test_eof; 
	_test_eof233: cs = 233; goto _test_eof; 
	_test_eof234: cs = 234; goto _test_eof; 
	_test_eof235: cs = 235; goto _test_eof; 
	_test_eof236: cs = 236; goto _test_eof; 
	_test_eof237: cs = 237; goto _test_eof; 
	_test_eof238: cs = 238; goto _test_eof; 
	_test_eof60: cs = 60; goto _test_eof; 
	_test_eof61: cs = 61; goto _test_eof; 
	_test_eof62: cs = 62; goto _test_eof; 
	_test_eof63: cs = 63; goto _test_eof; 
	_test_eof64: cs = 64; goto _test_eof; 
	_test_eof65: cs = 65; goto _test_eof; 
	_test_eof66: cs = 66; goto _test_eof; 
	_test_eof67: cs = 67; goto _test_eof; 
	_test_eof68: cs = 68; goto _test_eof; 
	_test_eof69: cs = 69; goto _test_eof; 
	_test_eof70: cs = 70; goto _test_eof; 
	_test_eof71: cs = 71; goto _test_eof; 
	_test_eof72: cs = 72; goto _test_eof; 
	_test_eof73: cs = 73; goto _test_eof; 
	_test_eof74: cs = 74; goto _test_eof; 
	_test_eof75: cs = 75; goto _test_eof; 
	_test_eof76: cs = 76; goto _test_eof; 
	_test_eof77: cs = 77; goto _test_eof; 
	_test_eof78: cs = 78; goto _test_eof; 
	_test_eof79: cs = 79; goto _test_eof; 
	_test_eof80: cs = 80; goto _test_eof; 
	_test_eof81: cs = 81; goto _test_eof; 
	_test_eof82: cs = 82; goto _test_eof; 
	_test_eof83: cs = 83; goto _test_eof; 
	_test_eof84: cs = 84; goto _test_eof; 
	_test_eof85: cs = 85; goto _test_eof; 
	_test_eof86: cs = 86; goto _test_eof; 
	_test_eof87: cs = 87; goto _test_eof; 
	_test_eof88: cs = 88; goto _test_eof; 
	_test_eof89: cs = 89; goto _test_eof; 
	_test_eof90: cs = 90; goto _test_eof; 
	_test_eof91: cs = 91; goto _test_eof; 
	_test_eof92: cs = 92; goto _test_eof; 
	_test_eof93: cs = 93; goto _test_eof; 
	_test_eof94: cs = 94; goto _test_eof; 
	_test_eof95: cs = 95; goto _test_eof; 
	_test_eof96: cs = 96; goto _test_eof; 
	_test_eof97: cs = 97; goto _test_eof; 
	_test_eof98: cs = 98; goto _test_eof; 
	_test_eof99: cs = 99; goto _test_eof; 
	_test_eof100: cs = 100; goto _test_eof; 
	_test_eof101: cs = 101; goto _test_eof; 
	_test_eof102: cs = 102; goto _test_eof; 
	_test_eof103: cs = 103; goto _test_eof; 
	_test_eof104: cs = 104; goto _test_eof; 
	_test_eof105: cs = 105; goto _test_eof; 
	_test_eof106: cs = 106; goto _test_eof; 
	_test_eof107: cs = 107; goto _test_eof; 
	_test_eof108: cs = 108; goto _test_eof; 
	_test_eof109: cs = 109; goto _test_eof; 
	_test_eof110: cs = 110; goto _test_eof; 
	_test_eof111: cs = 111; goto _test_eof; 
	_test_eof112: cs = 112; goto _test_eof; 
	_test_eof113: cs = 113; goto _test_eof; 
	_test_eof114: cs = 114; goto _test_eof; 
	_test_eof115: cs = 115; goto _test_eof; 
	_test_eof116: cs = 116; goto _test_eof; 
	_test_eof117: cs = 117; goto _test_eof; 
	_test_eof118: cs = 118; goto _test_eof; 
	_test_eof119: cs = 119; goto _test_eof; 
	_test_eof120: cs = 120; goto _test_eof; 
	_test_eof121: cs = 121; goto _test_eof; 
	_test_eof122: cs = 122; goto _test_eof; 
	_test_eof123: cs = 123; goto _test_eof; 
	_test_eof124: cs = 124; goto _test_eof; 
	_test_eof125: cs = 125; goto _test_eof; 
	_test_eof126: cs = 126; goto _test_eof; 
	_test_eof127: cs = 127; goto _test_eof; 
	_test_eof128: cs = 128; goto _test_eof; 
	_test_eof129: cs = 129; goto _test_eof; 
	_test_eof130: cs = 130; goto _test_eof; 
	_test_eof131: cs = 131; goto _test_eof; 
	_test_eof132: cs = 132; goto _test_eof; 
	_test_eof133: cs = 133; goto _test_eof; 
	_test_eof134: cs = 134; goto _test_eof; 
	_test_eof135: cs = 135; goto _test_eof; 
	_test_eof136: cs = 136; goto _test_eof; 
	_test_eof137: cs = 137; goto _test_eof; 
	_test_eof138: cs = 138; goto _test_eof; 
	_test_eof139: cs = 139; goto _test_eof; 
	_test_eof140: cs = 140; goto _test_eof; 
	_test_eof141: cs = 141; goto _test_eof; 
	_test_eof142: cs = 142; goto _test_eof; 
	_test_eof143: cs = 143; goto _test_eof; 
	_test_eof144: cs = 144; goto _test_eof; 
	_test_eof145: cs = 145; goto _test_eof; 
	_test_eof146: cs = 146; goto _test_eof; 
	_test_eof147: cs = 147; goto _test_eof; 
	_test_eof148: cs = 148; goto _test_eof; 
	_test_eof149: cs = 149; goto _test_eof; 
	_test_eof150: cs = 150; goto _test_eof; 
	_test_eof151: cs = 151; goto _test_eof; 
	_test_eof152: cs = 152; goto _test_eof; 
	_test_eof153: cs = 153; goto _test_eof; 
	_test_eof154: cs = 154; goto _test_eof; 
	_test_eof155: cs = 155; goto _test_eof; 
	_test_eof156: cs = 156; goto _test_eof; 
	_test_eof157: cs = 157; goto _test_eof; 
	_test_eof158: cs = 158; goto _test_eof; 
	_test_eof159: cs = 159; goto _test_eof; 
	_test_eof160: cs = 160; goto _test_eof; 
	_test_eof161: cs = 161; goto _test_eof; 
	_test_eof162: cs = 162; goto _test_eof; 
	_test_eof163: cs = 163; goto _test_eof; 
	_test_eof164: cs = 164; goto _test_eof; 
	_test_eof165: cs = 165; goto _test_eof; 
	_test_eof166: cs = 166; goto _test_eof; 
	_test_eof167: cs = 167; goto _test_eof; 
	_test_eof168: cs = 168; goto _test_eof; 
	_test_eof169: cs = 169; goto _test_eof; 
	_test_eof239: cs = 239; goto _test_eof; 
	_test_eof170: cs = 170; goto _test_eof; 
	_test_eof240: cs = 240; goto _test_eof; 
	_test_eof171: cs = 171; goto _test_eof; 
	_test_eof241: cs = 241; goto _test_eof; 
	_test_eof172: cs = 172; goto _test_eof; 
	_test_eof242: cs = 242; goto _test_eof; 
	_test_eof173: cs = 173; goto _test_eof; 
	_test_eof243: cs = 243; goto _test_eof; 
	_test_eof174: cs = 174; goto _test_eof; 
	_test_eof244: cs = 244; goto _test_eof; 
	_test_eof175: cs = 175; goto _test_eof; 
	_test_eof245: cs = 245; goto _test_eof; 
	_test_eof176: cs = 176; goto _test_eof; 
	_test_eof246: cs = 246; goto _test_eof; 
	_test_eof177: cs = 177; goto _test_eof; 
	_test_eof247: cs = 247; goto _test_eof; 
	_test_eof178: cs = 178; goto _test_eof; 
	_test_eof248: cs = 248; goto _test_eof; 
	_test_eof179: cs = 179; goto _test_eof; 
	_test_eof249: cs = 249; goto _test_eof; 
	_test_eof180: cs = 180; goto _test_eof; 
	_test_eof250: cs = 250; goto _test_eof; 
	_test_eof181: cs = 181; goto _test_eof; 
	_test_eof182: cs = 182; goto _test_eof; 
	_test_eof183: cs = 183; goto _test_eof; 
	_test_eof184: cs = 184; goto _test_eof; 
	_test_eof185: cs = 185; goto _test_eof; 
	_test_eof186: cs = 186; goto _test_eof; 
	_test_eof187: cs = 187; goto _test_eof; 
	_test_eof188: cs = 188; goto _test_eof; 
	_test_eof189: cs = 189; goto _test_eof; 
	_test_eof190: cs = 190; goto _test_eof; 
	_test_eof251: cs = 251; goto _test_eof; 

	_test_eof: {}
	if ( p == eof )
	{
	switch ( cs ) {
	case 1: 
	case 168: 
#line 50 "sam_alignment.rl"
	{ p--; {if (true) goto st169;} }
	break;
	case 2: 
	case 3: 
	case 151: 
	case 152: 
	case 153: 
	case 154: 
	case 155: 
	case 156: 
	case 157: 
	case 158: 
	case 159: 
	case 160: 
	case 161: 
	case 162: 
	case 163: 
	case 164: 
	case 165: 
	case 166: 
	case 167: 
#line 58 "sam_alignment.rl"
	{ p--; {if (true) goto st170;} }
	break;
	case 4: 
	case 5: 
	case 150: 
#line 67 "sam_alignment.rl"
	{ p--; {if (true) goto st171;} }
	break;
	case 6: 
	case 7: 
	case 133: 
	case 134: 
	case 135: 
	case 136: 
	case 137: 
	case 138: 
	case 139: 
	case 140: 
	case 141: 
	case 142: 
	case 143: 
	case 144: 
	case 145: 
	case 146: 
	case 147: 
	case 148: 
	case 149: 
#line 75 "sam_alignment.rl"
	{ p--; {if (true) goto st172;} }
	break;
	case 8: 
	case 9: 
	case 116: 
	case 117: 
	case 118: 
	case 119: 
	case 120: 
	case 121: 
	case 122: 
	case 123: 
	case 124: 
	case 125: 
	case 126: 
	case 127: 
	case 128: 
	case 129: 
	case 130: 
	case 131: 
	case 132: 
#line 81 "sam_alignment.rl"
	{ p--; {if (true) goto st173;} }
	break;
	case 10: 
	case 11: 
	case 97: 
	case 98: 
	case 99: 
	case 100: 
	case 101: 
	case 102: 
	case 103: 
	case 104: 
	case 105: 
	case 106: 
	case 107: 
	case 108: 
	case 109: 
	case 110: 
	case 111: 
	case 112: 
	case 113: 
	case 114: 
	case 115: 
#line 124 "sam_alignment.rl"
	{
        auto ptr = cast(uint*)(buffer.data.ptr + 3 * uint.sizeof);
        *ptr = (*ptr) & 0xFFFF0000;
        buffer.shrink(rollback_size);
        end_pos = pos + 1;
        p--; {if (true) goto st174;}
    }
	break;
	case 12: 
	case 13: 
	case 95: 
	case 96: 
#line 162 "sam_alignment.rl"
	{ p--; {if (true) goto st175;} }
	break;
	case 14: 
	case 15: 
	case 78: 
	case 79: 
	case 80: 
	case 81: 
	case 82: 
	case 83: 
	case 84: 
	case 85: 
	case 86: 
	case 87: 
	case 88: 
	case 89: 
	case 90: 
	case 91: 
	case 92: 
	case 93: 
	case 94: 
#line 175 "sam_alignment.rl"
	{ p--; {if (true) goto st176;} }
	break;
	case 16: 
	case 17: 
	case 18: 
	case 61: 
	case 62: 
	case 63: 
	case 64: 
	case 65: 
	case 66: 
	case 67: 
	case 68: 
	case 69: 
	case 70: 
	case 71: 
	case 72: 
	case 73: 
	case 74: 
	case 75: 
	case 76: 
	case 77: 
#line 187 "sam_alignment.rl"
	{ p--; {if (true) goto st177;} }
	break;
	case 19: 
	case 20: 
	case 60: 
#line 217 "sam_alignment.rl"
	{
        rollback_size = buffer.length;
        p--; {if (true) goto st178;}
    }
	break;
	case 21: 
#line 243 "sam_alignment.rl"
	{
        buffer.shrink(rollback_size);
        for (size_t i = 0; i < l_seq; ++i)
            buffer.putUnsafe!ubyte(0xFF);
        rollback_size = buffer.length;
        p--; {if (true) goto st179;}
    }
	break;
	case 25: 
	case 26: 
	case 27: 
	case 28: 
	case 29: 
	case 30: 
	case 31: 
	case 32: 
	case 33: 
	case 34: 
	case 35: 
	case 36: 
	case 37: 
	case 38: 
	case 39: 
	case 40: 
	case 41: 
	case 42: 
	case 43: 
	case 44: 
	case 45: 
	case 46: 
	case 47: 
	case 48: 
	case 49: 
	case 50: 
	case 51: 
	case 52: 
	case 53: 
	case 54: 
	case 55: 
	case 56: 
	case 57: 
	case 58: 
	case 59: 
#line 403 "sam_alignment.rl"
	{
        buffer.shrink(rollback_size);
        p--; {if (true) goto st180;}
    }
	break;
	case 192: 
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
	case 191: 
#line 236 "sam_alignment.rl"
	{
        // '*' may correspond either to a one-base long sequence
        // or to absence of information
        if (quals_length == 1 && quals_last_char == '*' && l_seq == 0)
            buffer.shrink(rollback_size);
    }
#line 253 "sam_alignment.rl"
	{
        if (buffer.length - rollback_size != l_seq) {
            buffer.shrink(rollback_size);
            for (size_t i = 0; i < l_seq; ++i)
                buffer.putUnsafe!ubyte(0xFF);
        }
        rollback_size = buffer.length;
    }
	break;
	case 216: 
#line 326 "sam_alignment.rl"
	{
        {
        auto data = cast(ubyte[])(line[tagvalue_beg .. p - line.ptr]);
        buffer.capacity = buffer.length + 4 + data.length;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('Z');
        buffer.putUnsafe(data);
        buffer.putUnsafe!ubyte(0);
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
	case 215: 
#line 337 "sam_alignment.rl"
	{
        {
        auto data = cast(ubyte[])(line[tagvalue_beg .. p - line.ptr]);
        buffer.capacity = buffer.length + 4 + data.length;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('H');
        buffer.putUnsafe(data);
        buffer.putUnsafe!ubyte(0);
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
	case 221: 
	case 222: 
	case 223: 
	case 224: 
	case 225: 
	case 226: 
	case 227: 
	case 228: 
	case 229: 
	case 230: 
	case 231: 
	case 232: 
	case 233: 
	case 234: 
	case 235: 
	case 236: 
	case 237: 
	case 238: 
#line 30 "sam_alignment.rl"
	{ int_value *= current_sign; current_sign = 1; }
#line 285 "sam_alignment.rl"
	{
        buffer.capacity = buffer.length + 7;
        buffer.putUnsafe(tag_key);
        if (int_value < 0) {
            if (int_value >= byte.min) {
                buffer.putUnsafe!char('c');
                buffer.putUnsafe(cast(byte)int_value);
            } else if (int_value >= short.min) {
                buffer.putUnsafe!char('s');
                buffer.putUnsafe(cast(short)int_value);
            } else if (int_value >= int.min) {
                buffer.putUnsafe!char('i');
                buffer.putUnsafe(cast(int)int_value);
            } else {
                throw new Exception("integer out of range");
            }
        } else {
            if (int_value <= ubyte.max) {
                buffer.putUnsafe!char('C');
                buffer.putUnsafe(cast(ubyte)int_value);
            } else if (int_value <= ushort.max) {
                buffer.putUnsafe!char('S');
                buffer.putUnsafe(cast(ushort)int_value);
            } else if (int_value <= uint.max) {
                buffer.putUnsafe!char('I');
                buffer.putUnsafe(cast(uint)int_value);
            } else {
                throw new Exception("integer out of range");
            }
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
	case 193: 
	case 194: 
	case 195: 
	case 196: 
	case 197: 
	case 198: 
	case 199: 
	case 200: 
	case 201: 
	case 202: 
	case 203: 
	case 204: 
	case 205: 
	case 206: 
	case 207: 
	case 208: 
	case 209: 
	case 210: 
#line 30 "sam_alignment.rl"
	{ int_value *= current_sign; current_sign = 1; }
#line 362 "sam_alignment.rl"
	{
        // here, we assume that compiler is smart enough to move switch out of loop.
        switch (arraytype) {
            case 'c': buffer.put(to!byte(int_value)); break;
            case 'C': buffer.put(to!ubyte(int_value)); break;
            case 's': buffer.put(to!short(int_value)); break;
            case 'S': buffer.put(to!ushort(int_value)); break;
            case 'i': buffer.put(to!int(int_value)); break;
            case 'I': buffer.put(to!uint(int_value)); break;
            default: assert(0);
        }
        {
            auto ptr = cast(uint*)(buffer.data.ptr + tag_array_length_offset);
            ++*ptr;
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
	case 217: 
	case 218: 
	case 219: 
	case 220: 
#line 38 "sam_alignment.rl"
	{
        float_value = to!float(line[float_beg .. p - line.ptr]);
    }
#line 319 "sam_alignment.rl"
	{
        buffer.capacity = buffer.length + 7;
        buffer.putUnsafe(tag_key);
        buffer.putUnsafe!char('f');
        buffer.putUnsafe!float(float_value);
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
	case 211: 
	case 212: 
	case 213: 
	case 214: 
#line 38 "sam_alignment.rl"
	{
        float_value = to!float(line[float_beg .. p - line.ptr]);
    }
#line 379 "sam_alignment.rl"
	{
        buffer.put!float(float_value);
        {
            auto ptr = cast(uint*)(buffer.data.ptr + tag_array_length_offset);
            ++*ptr;
        }
    }
#line 410 "sam_alignment.rl"
	{ rollback_size = buffer.length; }
	break;
#line 4659 "sam_alignment.d"
		default: break;
	}
	}

	_out: {}
	}

#line 481 "sam_alignment.rl"

    BamRead read;
    read.raw_data = buffer.data[];
    return read;
}

unittest {
    import std.algorithm;
    import std.math;

    auto line = "ERR016155.15021091\t185\t20\t60033\t25\t66S35M\t=\t60033\t0\tAGAAAAAACTGGAAGTTAATAGAGTGGTGACTCAGATCCAGTGGTGGAAGGGTAAGGGATCTTGGAACCCTATAGAGTTGCTGTGTGCCAGGGCCAGATCC\t#####################################################################################################\tX0:i:1\tX1:i:0\tXC:i:35\tMD:Z:17A8A8\tRG:Z:ERR016155\tAM:i:0\tNM:i:2\tSM:i:25\tXT:A:U\tBQ:Z:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\tY0:B:c,1,2,3\tY1:B:f,13.263,-3.1415,52.63461";

    auto header = new SamHeader("@SQ\tSN:20\tLN:1234567");
    auto alignment = parseAlignmentLine(line, header);
    assert(alignment.name == "ERR016155.15021091");
    assert(equal(alignment.sequence(), "AGAAAAAACTGGAAGTTAATAGAGTGGTGACTCAGATCCAGTGGTGGAAGGGTAAGGGATCTTGGAACCCTATAGAGTTGCTGTGTGCCAGGGCCAGATCC"));
    assert(alignment.cigarString() == "66S35M");
    assert(alignment.flag == 185);
    assert(alignment.position == 60032);
    assert(alignment.mapping_quality == 25);
    assert(alignment.mate_position == 60032);
    assert(alignment.ref_id == 0);
    assert(alignment.mate_ref_id == 0);
    assert(to!ubyte(alignment["AM"]) == 0);
    assert(to!ubyte(alignment["SM"]) == 25);
    assert(to!string(alignment["MD"]) == "17A8A8");
    assert(equal(to!(byte[])(alignment["Y0"]), [1, 2, 3]));
    assert(equal!isClose(to!(float[])(alignment["Y1"]), [13.263, -3.1415, 52.63461]));
    assert(to!char(alignment["XT"]) == 'U');

    import bio.std.hts.bam.reference;

    auto info = ReferenceSequenceInfo("20", 1234567);

    auto invalid_cigar_string = "1\t100\t20\t50000\t30\tMZABC\t=\t50000\t0\tACGT\t####";
    alignment = parseAlignmentLine(invalid_cigar_string, header);
    assert(equal(alignment.sequence(), "ACGT"));

    auto invalid_tag_and_qual = "2\t100\t20\t5\t40\t27M30X5D\t=\t3\t10\tACT\t !\n\tX1:i:7\tX3:i:zzz\tX4:i:5";
    alignment = parseAlignmentLine(invalid_tag_and_qual, header);
    assert(alignment.base_qualities == [255, 255, 255]); // i.e. invalid
    assert(to!ubyte(alignment["X1"]) == 7);
    assert(alignment["X3"].is_nothing);
    assert(to!ubyte(alignment["X4"]) == 5);
}