lpn 0.2.0

Software to study attacks on the Learning Parity with Noise problem
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
use std::boxed::Box;
use std::default::Default;
use std::sync::Once;

use fnv::FnvHashMap;

use m4ri_rust::friendly::BinMatrix;
use m4ri_rust::friendly::BinVector;

use crate::codes::BinaryCode;

/// ``[22, 12]`` Guava code
///
/// Best code found from the GUAVA database version 3.15
///
/// Decodes using Syndrome decoding
#[derive(Clone, Serialize)]
pub struct GuavaCode22_12;

static INIT: Once = Once::new();
static mut GENERATOR_MATRIX: *const BinMatrix = 0 as *const BinMatrix;
static mut PARITY_MATRIX: *const BinMatrix = 0 as *const BinMatrix;
static mut PARITY_MATRIX_T: *const BinMatrix = 0 as *const BinMatrix;
static mut SYNDROME_MAP: *const FnvHashMap<u64, &'static [usize; 1]> = 0 as *const FnvHashMap<u64, &'static [usize; 1]>;

fn init() {
    INIT.call_once(|| {
        unsafe {
            let matrix = Box::new(BinMatrix::from_slices(&[
                &[ 3301377 ],
                &[ 1953794 ],
                &[ 1859588 ],
                &[ 2707464 ],
                &[ 2981904 ],
                &[ 1552416 ],
                &[ 2281536 ],
                &[ 3928192 ],
                &[ 3469568 ],
                &[ 3543552 ],
                &[ 3654656 ],
                &[ 3835904 ],
                
            ], 22));
            GENERATOR_MATRIX = Box::into_raw(matrix);

            let matrix = Box::new(BinMatrix::from_slices(&[
                &[ 1017857 ],
                &[ 2465794 ],
                &[ 2965764 ],
                &[ 1796360 ],
                &[ 3045648 ],
                &[ 1511712 ],
                &[ 1761344 ],
                &[ 3537280 ],
                &[ 446976 ],
                &[ 3365888 ],
                
            ], 22));
            let matrix_t = Box::new(matrix.transposed());
            PARITY_MATRIX = Box::into_raw(matrix);
            PARITY_MATRIX_T = Box::into_raw(matrix_t);

            let mut map = Box::new(FnvHashMap::with_capacity_and_hasher(1024, Default::default()));
            map.insert(0, &[0]);     // 0 => [0]
            map.insert(1, &[1]);     // 1 => [1]
            map.insert(2, &[2]);     // 2 => [2]
            map.insert(4, &[4]);     // 4 => [4]
            map.insert(8, &[8]);     // 8 => [8]
            map.insert(16, &[16]);     // 16 => [16]
            map.insert(32, &[32]);     // 32 => [32]
            map.insert(64, &[64]);     // 64 => [64]
            map.insert(128, &[128]);     // 128 => [128]
            map.insert(188, &[256]);     // 188 => [256]
            map.insert(256, &[512]);     // 256 => [512]
            map.insert(512, &[1024]);     // 512 => [1024]
            map.insert(665, &[2048]);     // 665 => [2048]
            map.insert(944, &[4096]);     // 944 => [4096]
            map.insert(218, &[8192]);     // 218 => [8192]
            map.insert(988, &[16384]);     // 988 => [16384]
            map.insert(451, &[32768]);     // 451 => [32768]
            map.insert(687, &[65536]);     // 687 => [65536]
            map.insert(889, &[131072]);     // 889 => [131072]
            map.insert(439, &[262144]);     // 439 => [262144]
            map.insert(93, &[524288]);     // 93 => [524288]
            map.insert(744, &[1048576]);     // 744 => [1048576]
            map.insert(662, &[2097152]);     // 662 => [2097152]
            map.insert(3, &[3]);     // 3 => [3]
            map.insert(5, &[5]);     // 5 => [5]
            map.insert(9, &[9]);     // 9 => [9]
            map.insert(17, &[17]);     // 17 => [17]
            map.insert(33, &[33]);     // 33 => [33]
            map.insert(65, &[65]);     // 65 => [65]
            map.insert(129, &[129]);     // 129 => [129]
            map.insert(189, &[257]);     // 189 => [257]
            map.insert(257, &[513]);     // 257 => [513]
            map.insert(513, &[1025]);     // 513 => [1025]
            map.insert(664, &[2049]);     // 664 => [2049]
            map.insert(945, &[4097]);     // 945 => [4097]
            map.insert(219, &[8193]);     // 219 => [8193]
            map.insert(989, &[16385]);     // 989 => [16385]
            map.insert(450, &[32769]);     // 450 => [32769]
            map.insert(686, &[65537]);     // 686 => [65537]
            map.insert(888, &[131073]);     // 888 => [131073]
            map.insert(438, &[262145]);     // 438 => [262145]
            map.insert(92, &[524289]);     // 92 => [524289]
            map.insert(745, &[1048577]);     // 745 => [1048577]
            map.insert(663, &[2097153]);     // 663 => [2097153]
            map.insert(6, &[6]);     // 6 => [6]
            map.insert(10, &[10]);     // 10 => [10]
            map.insert(18, &[18]);     // 18 => [18]
            map.insert(34, &[34]);     // 34 => [34]
            map.insert(66, &[66]);     // 66 => [66]
            map.insert(130, &[130]);     // 130 => [130]
            map.insert(190, &[258]);     // 190 => [258]
            map.insert(258, &[514]);     // 258 => [514]
            map.insert(514, &[1026]);     // 514 => [1026]
            map.insert(667, &[2050]);     // 667 => [2050]
            map.insert(946, &[4098]);     // 946 => [4098]
            map.insert(216, &[8194]);     // 216 => [8194]
            map.insert(990, &[16386]);     // 990 => [16386]
            map.insert(449, &[32770]);     // 449 => [32770]
            map.insert(685, &[65538]);     // 685 => [65538]
            map.insert(891, &[131074]);     // 891 => [131074]
            map.insert(437, &[262146]);     // 437 => [262146]
            map.insert(95, &[524290]);     // 95 => [524290]
            map.insert(746, &[1048578]);     // 746 => [1048578]
            map.insert(660, &[2097154]);     // 660 => [2097154]
            map.insert(12, &[12]);     // 12 => [12]
            map.insert(20, &[20]);     // 20 => [20]
            map.insert(36, &[36]);     // 36 => [36]
            map.insert(68, &[68]);     // 68 => [68]
            map.insert(132, &[132]);     // 132 => [132]
            map.insert(184, &[260]);     // 184 => [260]
            map.insert(260, &[516]);     // 260 => [516]
            map.insert(516, &[1028]);     // 516 => [1028]
            map.insert(669, &[2052]);     // 669 => [2052]
            map.insert(948, &[4100]);     // 948 => [4100]
            map.insert(222, &[8196]);     // 222 => [8196]
            map.insert(984, &[16388]);     // 984 => [16388]
            map.insert(455, &[32772]);     // 455 => [32772]
            map.insert(683, &[65540]);     // 683 => [65540]
            map.insert(893, &[131076]);     // 893 => [131076]
            map.insert(435, &[262148]);     // 435 => [262148]
            map.insert(89, &[524292]);     // 89 => [524292]
            map.insert(748, &[1048580]);     // 748 => [1048580]
            map.insert(658, &[2097156]);     // 658 => [2097156]
            map.insert(24, &[24]);     // 24 => [24]
            map.insert(40, &[40]);     // 40 => [40]
            map.insert(72, &[72]);     // 72 => [72]
            map.insert(136, &[136]);     // 136 => [136]
            map.insert(180, &[264]);     // 180 => [264]
            map.insert(264, &[520]);     // 264 => [520]
            map.insert(520, &[1032]);     // 520 => [1032]
            map.insert(657, &[2056]);     // 657 => [2056]
            map.insert(952, &[4104]);     // 952 => [4104]
            map.insert(210, &[8200]);     // 210 => [8200]
            map.insert(980, &[16392]);     // 980 => [16392]
            map.insert(459, &[32776]);     // 459 => [32776]
            map.insert(679, &[65544]);     // 679 => [65544]
            map.insert(881, &[131080]);     // 881 => [131080]
            map.insert(447, &[262152]);     // 447 => [262152]
            map.insert(85, &[524296]);     // 85 => [524296]
            map.insert(736, &[1048584]);     // 736 => [1048584]
            map.insert(670, &[2097160]);     // 670 => [2097160]
            map.insert(48, &[48]);     // 48 => [48]
            map.insert(80, &[80]);     // 80 => [80]
            map.insert(144, &[144]);     // 144 => [144]
            map.insert(172, &[272]);     // 172 => [272]
            map.insert(272, &[528]);     // 272 => [528]
            map.insert(528, &[1040]);     // 528 => [1040]
            map.insert(649, &[2064]);     // 649 => [2064]
            map.insert(928, &[4112]);     // 928 => [4112]
            map.insert(202, &[8208]);     // 202 => [8208]
            map.insert(972, &[16400]);     // 972 => [16400]
            map.insert(467, &[32784]);     // 467 => [32784]
            map.insert(703, &[65552]);     // 703 => [65552]
            map.insert(873, &[131088]);     // 873 => [131088]
            map.insert(423, &[262160]);     // 423 => [262160]
            map.insert(77, &[524304]);     // 77 => [524304]
            map.insert(760, &[1048592]);     // 760 => [1048592]
            map.insert(646, &[2097168]);     // 646 => [2097168]
            map.insert(96, &[96]);     // 96 => [96]
            map.insert(160, &[160]);     // 160 => [160]
            map.insert(156, &[288]);     // 156 => [288]
            map.insert(288, &[544]);     // 288 => [544]
            map.insert(544, &[1056]);     // 544 => [1056]
            map.insert(697, &[2080]);     // 697 => [2080]
            map.insert(912, &[4128]);     // 912 => [4128]
            map.insert(250, &[8224]);     // 250 => [8224]
            map.insert(1020, &[16416]);     // 1020 => [16416]
            map.insert(483, &[32800]);     // 483 => [32800]
            map.insert(655, &[65568]);     // 655 => [65568]
            map.insert(857, &[131104]);     // 857 => [131104]
            map.insert(407, &[262176]);     // 407 => [262176]
            map.insert(125, &[524320]);     // 125 => [524320]
            map.insert(712, &[1048608]);     // 712 => [1048608]
            map.insert(694, &[2097184]);     // 694 => [2097184]
            map.insert(192, &[192]);     // 192 => [192]
            map.insert(252, &[320]);     // 252 => [320]
            map.insert(320, &[576]);     // 320 => [576]
            map.insert(576, &[1088]);     // 576 => [1088]
            map.insert(729, &[2112]);     // 729 => [2112]
            map.insert(1008, &[4160]);     // 1008 => [4160]
            map.insert(154, &[8256]);     // 154 => [8256]
            map.insert(924, &[16448]);     // 924 => [16448]
            map.insert(387, &[32832]);     // 387 => [32832]
            map.insert(751, &[65600]);     // 751 => [65600]
            map.insert(825, &[131136]);     // 825 => [131136]
            map.insert(503, &[262208]);     // 503 => [262208]
            map.insert(29, &[524352]);     // 29 => [524352]
            map.insert(680, &[1048640]);     // 680 => [1048640]
            map.insert(726, &[2097216]);     // 726 => [2097216]
            map.insert(60, &[384]);     // 60 => [384]
            map.insert(384, &[640]);     // 384 => [640]
            map.insert(640, &[1152]);     // 640 => [1152]
            map.insert(537, &[2176]);     // 537 => [2176]
            map.insert(816, &[4224]);     // 816 => [4224]
            map.insert(90, &[8320]);     // 90 => [8320]
            map.insert(860, &[16512]);     // 860 => [16512]
            map.insert(323, &[32896]);     // 323 => [32896]
            map.insert(559, &[65664]);     // 559 => [65664]
            map.insert(1017, &[131200]);     // 1017 => [131200]
            map.insert(311, &[262272]);     // 311 => [262272]
            map.insert(221, &[524416]);     // 221 => [524416]
            map.insert(616, &[1048704]);     // 616 => [1048704]
            map.insert(534, &[2097280]);     // 534 => [2097280]
            map.insert(444, &[768]);     // 444 => [768]
            map.insert(700, &[1280]);     // 700 => [1280]
            map.insert(549, &[2304]);     // 549 => [2304]
            map.insert(780, &[4352]);     // 780 => [4352]
            map.insert(102, &[8448]);     // 102 => [8448]
            map.insert(864, &[16640]);     // 864 => [16640]
            map.insert(383, &[33024]);     // 383 => [33024]
            map.insert(531, &[65792]);     // 531 => [65792]
            map.insert(965, &[131328]);     // 965 => [131328]
            map.insert(267, &[262400]);     // 267 => [262400]
            map.insert(225, &[524544]);     // 225 => [524544]
            map.insert(596, &[1048832]);     // 596 => [1048832]
            map.insert(554, &[2097408]);     // 554 => [2097408]
            map.insert(768, &[1536]);     // 768 => [1536]
            map.insert(921, &[2560]);     // 921 => [2560]
            map.insert(688, &[4608]);     // 688 => [4608]
            map.insert(474, &[8704]);     // 474 => [8704]
            map.insert(732, &[16896]);     // 732 => [16896]
            map.insert(195, &[33280]);     // 195 => [33280]
            map.insert(943, &[66048]);     // 943 => [66048]
            map.insert(633, &[131584]);     // 633 => [131584]
            map.insert(183, &[262656]);     // 183 => [262656]
            map.insert(349, &[524800]);     // 349 => [524800]
            map.insert(1000, &[1049088]);     // 1000 => [1049088]
            map.insert(918, &[2097664]);     // 918 => [2097664]
            map.insert(153, &[3072]);     // 153 => [3072]
            map.insert(432, &[5120]);     // 432 => [5120]
            map.insert(730, &[9216]);     // 730 => [9216]
            map.insert(476, &[17408]);     // 476 => [17408]
            map.insert(963, &[33792]);     // 963 => [33792]
            map.insert(175, &[66560]);     // 175 => [66560]
            map.insert(377, &[132096]);     // 377 => [132096]
            map.insert(951, &[263168]);     // 951 => [263168]
            map.insert(605, &[525312]);     // 605 => [525312]
            map.insert(232, &[1049600]);     // 232 => [1049600]
            map.insert(150, &[2098176]);     // 150 => [2098176]
            map.insert(297, &[6144]);     // 297 => [6144]
            map.insert(579, &[10240]);     // 579 => [10240]
            map.insert(325, &[18432]);     // 325 => [18432]
            map.insert(858, &[34816]);     // 858 => [34816]
            map.insert(54, &[67584]);     // 54 => [67584]
            map.insert(480, &[133120]);     // 480 => [133120]
            map.insert(814, &[264192]);     // 814 => [264192]
            map.insert(708, &[526336]);     // 708 => [526336]
            map.insert(113, &[1050624]);     // 113 => [1050624]
            map.insert(15, &[2099200]);     // 15 => [2099200]
            map.insert(874, &[12288]);     // 874 => [12288]
            map.insert(108, &[20480]);     // 108 => [20480]
            map.insert(627, &[36864]);     // 627 => [36864]
            map.insert(287, &[69632]);     // 287 => [69632]
            map.insert(201, &[135168]);     // 201 => [135168]
            map.insert(519, &[266240]);     // 519 => [266240]
            map.insert(1005, &[528384]);     // 1005 => [528384]
            map.insert(344, &[1052672]);     // 344 => [1052672]
            map.insert(294, &[2101248]);     // 294 => [2101248]
            map.insert(774, &[24576]);     // 774 => [24576]
            map.insert(281, &[40960]);     // 281 => [40960]
            map.insert(629, &[73728]);     // 629 => [73728]
            map.insert(931, &[139264]);     // 931 => [139264]
            map.insert(365, &[270336]);     // 365 => [270336]
            map.insert(135, &[532480]);     // 135 => [532480]
            map.insert(562, &[1056768]);     // 562 => [1056768]
            map.insert(588, &[2105344]);     // 588 => [2105344]
            map.insert(543, &[49152]);     // 543 => [49152]
            map.insert(371, &[81920]);     // 371 => [81920]
            map.insert(165, &[147456]);     // 165 => [147456]
            map.insert(619, &[278528]);     // 619 => [278528]
            map.insert(897, &[540672]);     // 897 => [540672]
            map.insert(308, &[1064960]);     // 308 => [1064960]
            map.insert(330, &[2113536]);     // 330 => [2113536]
            map.insert(876, &[98304]);     // 876 => [98304]
            map.insert(698, &[163840]);     // 698 => [163840]
            map.insert(116, &[294912]);     // 116 => [294912]
            map.insert(414, &[557056]);     // 414 => [557056]
            map.insert(811, &[1081344]);     // 811 => [1081344]
            map.insert(853, &[2129920]);     // 853 => [2129920]
            map.insert(470, &[196608]);     // 470 => [196608]
            map.insert(792, &[327680]);     // 792 => [327680]
            map.insert(754, &[589824]);     // 754 => [589824]
            map.insert(71, &[1114112]);     // 71 => [1114112]
            map.insert(57, &[2162688]);     // 57 => [2162688]
            map.insert(718, &[393216]);     // 718 => [393216]
            map.insert(804, &[655360]);     // 804 => [655360]
            map.insert(401, &[1179648]);     // 401 => [1179648]
            map.insert(495, &[2228224]);     // 495 => [2228224]
            map.insert(490, &[786432]);     // 490 => [786432]
            map.insert(863, &[1310720]);     // 863 => [1310720]
            map.insert(801, &[2359296]);     // 801 => [2359296]
            map.insert(693, &[1572864]);     // 693 => [1572864]
            map.insert(715, &[2621440]);     // 715 => [2621440]
            map.insert(126, &[3145728]);     // 126 => [3145728]
            map.insert(7, &[7]);     // 7 => [7]
            map.insert(11, &[11]);     // 11 => [11]
            map.insert(19, &[19]);     // 19 => [19]
            map.insert(35, &[35]);     // 35 => [35]
            map.insert(67, &[67]);     // 67 => [67]
            map.insert(131, &[131]);     // 131 => [131]
            map.insert(191, &[259]);     // 191 => [259]
            map.insert(259, &[515]);     // 259 => [515]
            map.insert(515, &[1027]);     // 515 => [1027]
            map.insert(666, &[2051]);     // 666 => [2051]
            map.insert(947, &[4099]);     // 947 => [4099]
            map.insert(217, &[8195]);     // 217 => [8195]
            map.insert(991, &[16387]);     // 991 => [16387]
            map.insert(448, &[32771]);     // 448 => [32771]
            map.insert(684, &[65539]);     // 684 => [65539]
            map.insert(890, &[131075]);     // 890 => [131075]
            map.insert(436, &[262147]);     // 436 => [262147]
            map.insert(94, &[524291]);     // 94 => [524291]
            map.insert(747, &[1048579]);     // 747 => [1048579]
            map.insert(661, &[2097155]);     // 661 => [2097155]
            map.insert(13, &[13]);     // 13 => [13]
            map.insert(21, &[21]);     // 21 => [21]
            map.insert(37, &[37]);     // 37 => [37]
            map.insert(69, &[69]);     // 69 => [69]
            map.insert(133, &[133]);     // 133 => [133]
            map.insert(185, &[261]);     // 185 => [261]
            map.insert(261, &[517]);     // 261 => [517]
            map.insert(517, &[1029]);     // 517 => [1029]
            map.insert(668, &[2053]);     // 668 => [2053]
            map.insert(949, &[4101]);     // 949 => [4101]
            map.insert(223, &[8197]);     // 223 => [8197]
            map.insert(985, &[16389]);     // 985 => [16389]
            map.insert(454, &[32773]);     // 454 => [32773]
            map.insert(682, &[65541]);     // 682 => [65541]
            map.insert(892, &[131077]);     // 892 => [131077]
            map.insert(434, &[262149]);     // 434 => [262149]
            map.insert(88, &[524293]);     // 88 => [524293]
            map.insert(749, &[1048581]);     // 749 => [1048581]
            map.insert(659, &[2097157]);     // 659 => [2097157]
            map.insert(25, &[25]);     // 25 => [25]
            map.insert(41, &[41]);     // 41 => [41]
            map.insert(73, &[73]);     // 73 => [73]
            map.insert(137, &[137]);     // 137 => [137]
            map.insert(181, &[265]);     // 181 => [265]
            map.insert(265, &[521]);     // 265 => [521]
            map.insert(521, &[1033]);     // 521 => [1033]
            map.insert(656, &[2057]);     // 656 => [2057]
            map.insert(953, &[4105]);     // 953 => [4105]
            map.insert(211, &[8201]);     // 211 => [8201]
            map.insert(981, &[16393]);     // 981 => [16393]
            map.insert(458, &[32777]);     // 458 => [32777]
            map.insert(678, &[65545]);     // 678 => [65545]
            map.insert(880, &[131081]);     // 880 => [131081]
            map.insert(446, &[262153]);     // 446 => [262153]
            map.insert(84, &[524297]);     // 84 => [524297]
            map.insert(737, &[1048585]);     // 737 => [1048585]
            map.insert(671, &[2097161]);     // 671 => [2097161]
            map.insert(49, &[49]);     // 49 => [49]
            map.insert(81, &[81]);     // 81 => [81]
            map.insert(145, &[145]);     // 145 => [145]
            map.insert(173, &[273]);     // 173 => [273]
            map.insert(273, &[529]);     // 273 => [529]
            map.insert(529, &[1041]);     // 529 => [1041]
            map.insert(648, &[2065]);     // 648 => [2065]
            map.insert(929, &[4113]);     // 929 => [4113]
            map.insert(203, &[8209]);     // 203 => [8209]
            map.insert(973, &[16401]);     // 973 => [16401]
            map.insert(466, &[32785]);     // 466 => [32785]
            map.insert(702, &[65553]);     // 702 => [65553]
            map.insert(872, &[131089]);     // 872 => [131089]
            map.insert(422, &[262161]);     // 422 => [262161]
            map.insert(76, &[524305]);     // 76 => [524305]
            map.insert(761, &[1048593]);     // 761 => [1048593]
            map.insert(647, &[2097169]);     // 647 => [2097169]
            map.insert(97, &[97]);     // 97 => [97]
            map.insert(161, &[161]);     // 161 => [161]
            map.insert(157, &[289]);     // 157 => [289]
            map.insert(289, &[545]);     // 289 => [545]
            map.insert(545, &[1057]);     // 545 => [1057]
            map.insert(696, &[2081]);     // 696 => [2081]
            map.insert(913, &[4129]);     // 913 => [4129]
            map.insert(251, &[8225]);     // 251 => [8225]
            map.insert(1021, &[16417]);     // 1021 => [16417]
            map.insert(482, &[32801]);     // 482 => [32801]
            map.insert(654, &[65569]);     // 654 => [65569]
            map.insert(856, &[131105]);     // 856 => [131105]
            map.insert(406, &[262177]);     // 406 => [262177]
            map.insert(124, &[524321]);     // 124 => [524321]
            map.insert(713, &[1048609]);     // 713 => [1048609]
            map.insert(695, &[2097185]);     // 695 => [2097185]
            map.insert(193, &[193]);     // 193 => [193]
            map.insert(253, &[321]);     // 253 => [321]
            map.insert(321, &[577]);     // 321 => [577]
            map.insert(577, &[1089]);     // 577 => [1089]
            map.insert(728, &[2113]);     // 728 => [2113]
            map.insert(1009, &[4161]);     // 1009 => [4161]
            map.insert(155, &[8257]);     // 155 => [8257]
            map.insert(925, &[16449]);     // 925 => [16449]
            map.insert(386, &[32833]);     // 386 => [32833]
            map.insert(750, &[65601]);     // 750 => [65601]
            map.insert(824, &[131137]);     // 824 => [131137]
            map.insert(502, &[262209]);     // 502 => [262209]
            map.insert(28, &[524353]);     // 28 => [524353]
            map.insert(681, &[1048641]);     // 681 => [1048641]
            map.insert(727, &[2097217]);     // 727 => [2097217]
            map.insert(61, &[385]);     // 61 => [385]
            map.insert(385, &[641]);     // 385 => [641]
            map.insert(641, &[1153]);     // 641 => [1153]
            map.insert(536, &[2177]);     // 536 => [2177]
            map.insert(817, &[4225]);     // 817 => [4225]
            map.insert(91, &[8321]);     // 91 => [8321]
            map.insert(861, &[16513]);     // 861 => [16513]
            map.insert(322, &[32897]);     // 322 => [32897]
            map.insert(558, &[65665]);     // 558 => [65665]
            map.insert(1016, &[131201]);     // 1016 => [131201]
            map.insert(310, &[262273]);     // 310 => [262273]
            map.insert(220, &[524417]);     // 220 => [524417]
            map.insert(617, &[1048705]);     // 617 => [1048705]
            map.insert(535, &[2097281]);     // 535 => [2097281]
            map.insert(445, &[769]);     // 445 => [769]
            map.insert(701, &[1281]);     // 701 => [1281]
            map.insert(548, &[2305]);     // 548 => [2305]
            map.insert(781, &[4353]);     // 781 => [4353]
            map.insert(103, &[8449]);     // 103 => [8449]
            map.insert(865, &[16641]);     // 865 => [16641]
            map.insert(382, &[33025]);     // 382 => [33025]
            map.insert(530, &[65793]);     // 530 => [65793]
            map.insert(964, &[131329]);     // 964 => [131329]
            map.insert(266, &[262401]);     // 266 => [262401]
            map.insert(224, &[524545]);     // 224 => [524545]
            map.insert(597, &[1048833]);     // 597 => [1048833]
            map.insert(555, &[2097409]);     // 555 => [2097409]
            map.insert(769, &[1537]);     // 769 => [1537]
            map.insert(920, &[2561]);     // 920 => [2561]
            map.insert(689, &[4609]);     // 689 => [4609]
            map.insert(475, &[8705]);     // 475 => [8705]
            map.insert(733, &[16897]);     // 733 => [16897]
            map.insert(194, &[33281]);     // 194 => [33281]
            map.insert(942, &[66049]);     // 942 => [66049]
            map.insert(632, &[131585]);     // 632 => [131585]
            map.insert(182, &[262657]);     // 182 => [262657]
            map.insert(348, &[524801]);     // 348 => [524801]
            map.insert(1001, &[1049089]);     // 1001 => [1049089]
            map.insert(919, &[2097665]);     // 919 => [2097665]
            map.insert(152, &[3073]);     // 152 => [3073]
            map.insert(433, &[5121]);     // 433 => [5121]
            map.insert(731, &[9217]);     // 731 => [9217]
            map.insert(477, &[17409]);     // 477 => [17409]
            map.insert(962, &[33793]);     // 962 => [33793]
            map.insert(174, &[66561]);     // 174 => [66561]
            map.insert(376, &[132097]);     // 376 => [132097]
            map.insert(950, &[263169]);     // 950 => [263169]
            map.insert(604, &[525313]);     // 604 => [525313]
            map.insert(233, &[1049601]);     // 233 => [1049601]
            map.insert(151, &[2098177]);     // 151 => [2098177]
            map.insert(296, &[6145]);     // 296 => [6145]
            map.insert(578, &[10241]);     // 578 => [10241]
            map.insert(324, &[18433]);     // 324 => [18433]
            map.insert(859, &[34817]);     // 859 => [34817]
            map.insert(55, &[67585]);     // 55 => [67585]
            map.insert(481, &[133121]);     // 481 => [133121]
            map.insert(815, &[264193]);     // 815 => [264193]
            map.insert(709, &[526337]);     // 709 => [526337]
            map.insert(112, &[1050625]);     // 112 => [1050625]
            map.insert(14, &[2099201]);     // 14 => [2099201]
            map.insert(875, &[12289]);     // 875 => [12289]
            map.insert(109, &[20481]);     // 109 => [20481]
            map.insert(626, &[36865]);     // 626 => [36865]
            map.insert(286, &[69633]);     // 286 => [69633]
            map.insert(200, &[135169]);     // 200 => [135169]
            map.insert(518, &[266241]);     // 518 => [266241]
            map.insert(1004, &[528385]);     // 1004 => [528385]
            map.insert(345, &[1052673]);     // 345 => [1052673]
            map.insert(295, &[2101249]);     // 295 => [2101249]
            map.insert(775, &[24577]);     // 775 => [24577]
            map.insert(280, &[40961]);     // 280 => [40961]
            map.insert(628, &[73729]);     // 628 => [73729]
            map.insert(930, &[139265]);     // 930 => [139265]
            map.insert(364, &[270337]);     // 364 => [270337]
            map.insert(134, &[532481]);     // 134 => [532481]
            map.insert(563, &[1056769]);     // 563 => [1056769]
            map.insert(589, &[2105345]);     // 589 => [2105345]
            map.insert(542, &[49153]);     // 542 => [49153]
            map.insert(370, &[81921]);     // 370 => [81921]
            map.insert(164, &[147457]);     // 164 => [147457]
            map.insert(618, &[278529]);     // 618 => [278529]
            map.insert(896, &[540673]);     // 896 => [540673]
            map.insert(309, &[1064961]);     // 309 => [1064961]
            map.insert(331, &[2113537]);     // 331 => [2113537]
            map.insert(877, &[98305]);     // 877 => [98305]
            map.insert(699, &[163841]);     // 699 => [163841]
            map.insert(117, &[294913]);     // 117 => [294913]
            map.insert(415, &[557057]);     // 415 => [557057]
            map.insert(810, &[1081345]);     // 810 => [1081345]
            map.insert(852, &[2129921]);     // 852 => [2129921]
            map.insert(471, &[196609]);     // 471 => [196609]
            map.insert(793, &[327681]);     // 793 => [327681]
            map.insert(755, &[589825]);     // 755 => [589825]
            map.insert(70, &[1114113]);     // 70 => [1114113]
            map.insert(56, &[2162689]);     // 56 => [2162689]
            map.insert(719, &[393217]);     // 719 => [393217]
            map.insert(805, &[655361]);     // 805 => [655361]
            map.insert(400, &[1179649]);     // 400 => [1179649]
            map.insert(494, &[2228225]);     // 494 => [2228225]
            map.insert(491, &[786433]);     // 491 => [786433]
            map.insert(862, &[1310721]);     // 862 => [1310721]
            map.insert(800, &[2359297]);     // 800 => [2359297]
            map.insert(692, &[1572865]);     // 692 => [1572865]
            map.insert(714, &[2621441]);     // 714 => [2621441]
            map.insert(127, &[3145729]);     // 127 => [3145729]
            map.insert(22, &[22]);     // 22 => [22]
            map.insert(38, &[38]);     // 38 => [38]
            map.insert(186, &[262]);     // 186 => [262]
            map.insert(262, &[518]);     // 262 => [518]
            map.insert(986, &[16390]);     // 986 => [16390]
            map.insert(453, &[32774]);     // 453 => [32774]
            map.insert(895, &[131078]);     // 895 => [131078]
            map.insert(26, &[26]);     // 26 => [26]
            map.insert(42, &[42]);     // 42 => [42]
            map.insert(74, &[74]);     // 74 => [74]
            map.insert(138, &[138]);     // 138 => [138]
            map.insert(522, &[1034]);     // 522 => [1034]
            map.insert(954, &[4106]);     // 954 => [4106]
            map.insert(208, &[8202]);     // 208 => [8202]
            map.insert(982, &[16394]);     // 982 => [16394]
            map.insert(457, &[32778]);     // 457 => [32778]
            map.insert(677, &[65546]);     // 677 => [65546]
            map.insert(883, &[131082]);     // 883 => [131082]
            map.insert(87, &[524298]);     // 87 => [524298]
            map.insert(738, &[1048586]);     // 738 => [1048586]
            map.insert(50, &[50]);     // 50 => [50]
            map.insert(82, &[82]);     // 82 => [82]
            map.insert(146, &[146]);     // 146 => [146]
            map.insert(274, &[530]);     // 274 => [530]
            map.insert(651, &[2066]);     // 651 => [2066]
            map.insert(974, &[16402]);     // 974 => [16402]
            map.insert(465, &[32786]);     // 465 => [32786]
            map.insert(421, &[262162]);     // 421 => [262162]
            map.insert(79, &[524306]);     // 79 => [524306]
            map.insert(762, &[1048594]);     // 762 => [1048594]
            map.insert(644, &[2097170]);     // 644 => [2097170]
            map.insert(98, &[98]);     // 98 => [98]
            map.insert(162, &[162]);     // 162 => [162]
            map.insert(158, &[290]);     // 158 => [290]
            map.insert(290, &[546]);     // 290 => [546]
            map.insert(546, &[1058]);     // 546 => [1058]
            map.insert(914, &[4130]);     // 914 => [4130]
            map.insert(248, &[8226]);     // 248 => [8226]
            map.insert(1022, &[16418]);     // 1022 => [16418]
            map.insert(653, &[65570]);     // 653 => [65570]
            map.insert(405, &[262178]);     // 405 => [262178]
            map.insert(254, &[322]);     // 254 => [322]
            map.insert(1010, &[4162]);     // 1010 => [4162]
            map.insert(926, &[16450]);     // 926 => [16450]
            map.insert(827, &[131138]);     // 827 => [131138]
            map.insert(501, &[262210]);     // 501 => [262210]
            map.insert(31, &[524354]);     // 31 => [524354]
            map.insert(724, &[2097218]);     // 724 => [2097218]
            map.insert(62, &[386]);     // 62 => [386]
            map.insert(642, &[1154]);     // 642 => [1154]
            map.insert(539, &[2178]);     // 539 => [2178]
            map.insert(818, &[4226]);     // 818 => [4226]
            map.insert(557, &[65666]);     // 557 => [65666]
            map.insert(1019, &[131202]);     // 1019 => [131202]
            map.insert(532, &[2097282]);     // 532 => [2097282]
            map.insert(551, &[2306]);     // 551 => [2306]
            map.insert(782, &[4354]);     // 782 => [4354]
            map.insert(100, &[8450]);     // 100 => [8450]
            map.insert(866, &[16642]);     // 866 => [16642]
            map.insert(381, &[33026]);     // 381 => [33026]
            map.insert(967, &[131330]);     // 967 => [131330]
            map.insert(227, &[524546]);     // 227 => [524546]
            map.insert(598, &[1048834]);     // 598 => [1048834]
            map.insert(552, &[2097410]);     // 552 => [2097410]
            map.insert(770, &[1538]);     // 770 => [1538]
            map.insert(923, &[2562]);     // 923 => [2562]
            map.insert(690, &[4610]);     // 690 => [4610]
            map.insert(472, &[8706]);     // 472 => [8706]
            map.insert(734, &[16898]);     // 734 => [16898]
            map.insert(941, &[66050]);     // 941 => [66050]
            map.insert(635, &[131586]);     // 635 => [131586]
            map.insert(351, &[524802]);     // 351 => [524802]
            map.insert(1002, &[1049090]);     // 1002 => [1049090]
            map.insert(916, &[2097666]);     // 916 => [2097666]
            map.insert(478, &[17410]);     // 478 => [17410]
            map.insert(961, &[33794]);     // 961 => [33794]
            map.insert(379, &[132098]);     // 379 => [132098]
            map.insert(607, &[525314]);     // 607 => [525314]
            map.insert(234, &[1049602]);     // 234 => [1049602]
            map.insert(148, &[2098178]);     // 148 => [2098178]
            map.insert(299, &[6146]);     // 299 => [6146]
            map.insert(327, &[18434]);     // 327 => [18434]
            map.insert(52, &[67586]);     // 52 => [67586]
            map.insert(812, &[264194]);     // 812 => [264194]
            map.insert(710, &[526338]);     // 710 => [526338]
            map.insert(115, &[1050626]);     // 115 => [1050626]
            map.insert(110, &[20482]);     // 110 => [20482]
            map.insert(625, &[36866]);     // 625 => [36866]
            map.insert(285, &[69634]);     // 285 => [69634]
            map.insert(1007, &[528386]);     // 1007 => [528386]
            map.insert(346, &[1052674]);     // 346 => [1052674]
            map.insert(292, &[2101250]);     // 292 => [2101250]
            map.insert(772, &[24578]);     // 772 => [24578]
            map.insert(283, &[40962]);     // 283 => [40962]
            map.insert(631, &[73730]);     // 631 => [73730]
            map.insert(367, &[270338]);     // 367 => [270338]
            map.insert(560, &[1056770]);     // 560 => [1056770]
            map.insert(590, &[2105346]);     // 590 => [2105346]
            map.insert(541, &[49154]);     // 541 => [49154]
            map.insert(369, &[81922]);     // 369 => [81922]
            map.insert(167, &[147458]);     // 167 => [147458]
            map.insert(899, &[540674]);     // 899 => [540674]
            map.insert(328, &[2113538]);     // 328 => [2113538]
            map.insert(878, &[98306]);     // 878 => [98306]
            map.insert(118, &[294914]);     // 118 => [294914]
            map.insert(412, &[557058]);     // 412 => [557058]
            map.insert(809, &[1081346]);     // 809 => [1081346]
            map.insert(855, &[2129922]);     // 855 => [2129922]
            map.insert(468, &[196610]);     // 468 => [196610]
            map.insert(794, &[327682]);     // 794 => [327682]
            map.insert(752, &[589826]);     // 752 => [589826]
            map.insert(59, &[2162690]);     // 59 => [2162690]
            map.insert(716, &[393218]);     // 716 => [393218]
            map.insert(806, &[655362]);     // 806 => [655362]
            map.insert(403, &[1179650]);     // 403 => [1179650]
            map.insert(493, &[2228226]);     // 493 => [2228226]
            map.insert(488, &[786434]);     // 488 => [786434]
            map.insert(803, &[2359298]);     // 803 => [2359298]
            map.insert(44, &[44]);     // 44 => [44]
            map.insert(140, &[140]);     // 140 => [140]
            map.insert(176, &[268]);     // 176 => [268]
            map.insert(268, &[524]);     // 268 => [524]
            map.insert(524, &[1036]);     // 524 => [1036]
            map.insert(956, &[4108]);     // 956 => [4108]
            map.insert(214, &[8204]);     // 214 => [8204]
            map.insert(976, &[16396]);     // 976 => [16396]
            map.insert(463, &[32780]);     // 463 => [32780]
            map.insert(675, &[65548]);     // 675 => [65548]
            map.insert(885, &[131084]);     // 885 => [131084]
            map.insert(443, &[262156]);     // 443 => [262156]
            map.insert(740, &[1048588]);     // 740 => [1048588]
            map.insert(168, &[276]);     // 168 => [276]
            map.insert(276, &[532]);     // 276 => [532]
            map.insert(932, &[4116]);     // 932 => [4116]
            map.insert(206, &[8212]);     // 206 => [8212]
            map.insert(968, &[16404]);     // 968 => [16404]
            map.insert(419, &[262164]);     // 419 => [262164]
            map.insert(764, &[1048596]);     // 764 => [1048596]
            map.insert(487, &[32804]);     // 487 => [32804]
            map.insert(121, &[524324]);     // 121 => [524324]
            map.insert(196, &[196]);     // 196 => [196]
            map.insert(580, &[1092]);     // 580 => [1092]
            map.insert(1012, &[4164]);     // 1012 => [4164]
            map.insert(391, &[32836]);     // 391 => [32836]
            map.insert(829, &[131140]);     // 829 => [131140]
            map.insert(499, &[262212]);     // 499 => [262212]
            map.insert(722, &[2097220]);     // 722 => [2097220]
            map.insert(388, &[644]);     // 388 => [644]
            map.insert(820, &[4228]);     // 820 => [4228]
            map.insert(307, &[262276]);     // 307 => [262276]
            map.insert(620, &[1048708]);     // 620 => [1048708]
            map.insert(440, &[772]);     // 440 => [772]
            map.insert(776, &[4356]);     // 776 => [4356]
            map.insert(868, &[16644]);     // 868 => [16644]
            map.insert(271, &[262404]);     // 271 => [262404]
            map.insert(229, &[524548]);     // 229 => [524548]
            map.insert(592, &[1048836]);     // 592 => [1048836]
            map.insert(199, &[33284]);     // 199 => [33284]
            map.insert(939, &[66052]);     // 939 => [66052]
            map.insert(637, &[131588]);     // 637 => [131588]
            map.insert(179, &[262660]);     // 179 => [262660]
            map.insert(171, &[66564]);     // 171 => [66564]
            map.insert(601, &[525316]);     // 601 => [525316]
            map.insert(236, &[1049604]);     // 236 => [1049604]
            map.insert(301, &[6148]);     // 301 => [6148]
            map.insert(583, &[10244]);     // 583 => [10244]
            map.insert(484, &[133124]);     // 484 => [133124]
            map.insert(704, &[526340]);     // 704 => [526340]
            map.insert(104, &[20484]);     // 104 => [20484]
            map.insert(205, &[135172]);     // 205 => [135172]
            map.insert(935, &[139268]);     // 935 => [139268]
            map.insert(361, &[270340]);     // 361 => [270340]
            map.insert(566, &[1056772]);     // 566 => [1056772]
            map.insert(584, &[2105348]);     // 584 => [2105348]
            map.insert(375, &[81924]);     // 375 => [81924]
            map.insert(623, &[278532]);     // 623 => [278532]
            map.insert(901, &[540676]);     // 901 => [540676]
            map.insert(304, &[1064964]);     // 304 => [1064964]
            map.insert(334, &[2113540]);     // 334 => [2113540]
            map.insert(410, &[557060]);     // 410 => [557060]
            map.insert(849, &[2129924]);     // 849 => [2129924]
            map.insert(796, &[327684]);     // 796 => [327684]
            map.insert(758, &[589828]);     // 758 => [589828]
            map.insert(122, &[3145732]);     // 122 => [3145732]
            map.insert(936, &[4120]);     // 936 => [4120]
            map.insert(431, &[262168]);     // 431 => [262168]
            map.insert(242, &[8232]);     // 242 => [8232]
            map.insert(244, &[328]);     // 244 => [328]
            map.insert(721, &[2120]);     // 721 => [2120]
            map.insert(395, &[32840]);     // 395 => [32840]
            map.insert(743, &[65608]);     // 743 => [65608]
            map.insert(511, &[262216]);     // 511 => [262216]
            map.insert(672, &[1048648]);     // 672 => [1048648]
            map.insert(392, &[648]);     // 392 => [648]
            map.insert(319, &[262280]);     // 319 => [262280]
            map.insert(213, &[524424]);     // 213 => [524424]
            map.insert(608, &[1048712]);     // 608 => [1048712]
            map.insert(341, &[524808]);     // 341 => [524808]
            map.insert(992, &[1049096]);     // 992 => [1049096]
            map.insert(971, &[33800]);     // 971 => [33800]
            map.insert(959, &[263176]);     // 959 => [263176]
            map.insert(587, &[10248]);     // 587 => [10248]
            map.insert(333, &[18440]);     // 333 => [18440]
            map.insert(850, &[34824]);     // 850 => [34824]
            map.insert(279, &[69640]);     // 279 => [69640]
            map.insert(527, &[266248]);     // 527 => [266248]
            map.insert(997, &[528392]);     // 997 => [528392]
            map.insert(336, &[1052680]);     // 336 => [1052680]
            map.insert(302, &[2101256]);     // 302 => [2101256]
            map.insert(357, &[270344]);     // 357 => [270344]
            map.insert(143, &[532488]);     // 143 => [532488]
            map.insert(570, &[1056776]);     // 570 => [1056776]
            map.insert(611, &[278536]);     // 611 => [278536]
            map.insert(905, &[540680]);     // 905 => [540680]
            map.insert(316, &[1064968]);     // 316 => [1064968]
            map.insert(784, &[327688]);     // 784 => [327688]
            map.insert(409, &[1179656]);     // 409 => [1179656]
            map.insert(707, &[2621448]);     // 707 => [2621448]
            map.insert(841, &[131120]);     // 841 => [131120]
            map.insert(908, &[16464]);     // 908 => [16464]
            map.insert(767, &[65616]);     // 767 => [65616]
            map.insert(844, &[16528]);     // 844 => [16528]
            map.insert(339, &[32912]);     // 339 => [32912]
            map.insert(575, &[65680]);     // 575 => [65680]
            map.insert(428, &[784]);     // 428 => [784]
            map.insert(565, &[2320]);     // 565 => [2320]
            map.insert(241, &[524560]);     // 241 => [524560]
            map.insert(902, &[2097680]);     // 902 => [2097680]
            map.insert(416, &[5136]);     // 416 => [5136]
            map.insert(460, &[17424]);     // 460 => [17424]
            map.insert(979, &[33808]);     // 979 => [33808]
            map.insert(313, &[6160]);     // 313 => [6160]
            map.insert(595, &[10256]);     // 595 => [10256]
            map.insert(842, &[34832]);     // 842 => [34832]
            map.insert(496, &[133136]);     // 496 => [133136]
            map.insert(830, &[264208]);     // 830 => [264208]
            map.insert(790, &[24592]);     // 790 => [24592]
            map.insert(613, &[73744]);     // 613 => [73744]
            map.insert(355, &[81936]);     // 355 => [81936]
            map.insert(398, &[557072]);     // 398 => [557072]
            map.insert(837, &[2129936]);     // 837 => [2129936]
            map.insert(506, &[786448]);     // 506 => [786448]
            map.insert(847, &[1310736]);     // 847 => [1310736]
            map.insert(352, &[608]);     // 352 => [608]
            map.insert(569, &[2208]);     // 569 => [2208]
            map.insert(832, &[16672]);     // 832 => [16672]
            map.insert(911, &[66080]);     // 911 => [66080]
            map.insert(508, &[17440]);     // 508 => [17440]
            map.insert(995, &[33824]);     // 995 => [33824]
            map.insert(47, &[2099232]);     // 47 => [2099232]
            map.insert(362, &[2113568]);     // 362 => [2113568]
            map.insert(779, &[1081376]);     // 779 => [1081376]
            map.insert(247, &[262720]);     // 247 => [262720]
            map.insert(239, &[66624]);     // 239 => [66624]
            map.insert(1015, &[263232]);     // 1015 => [263232]
            map.insert(358, &[2101312]);     // 358 => [2101312]
            map.insert(838, &[24640]);     // 838 => [24640]
            map.insert(372, &[1065024]);     // 372 => [1065024]
            map.insert(789, &[2129984]);     // 789 => [2129984]
            map.insert(426, &[786496]);     // 426 => [786496]
            map.insert(799, &[1310784]);     // 799 => [1310784]
            map.insert(757, &[1572928]);     // 757 => [1572928]
            map.insert(572, &[1408]);     // 572 => [1408]
            map.insert(230, &[8576]);     // 230 => [8576]
            map.insert(602, &[9344]);     // 602 => [9344]
            map.insert(835, &[33920]);     // 835 => [33920]
            map.insert(505, &[132224]);     // 505 => [132224]
            map.insert(823, &[263296]);     // 823 => [263296]
            map.insert(425, &[6272]);     // 425 => [6272]
            map.insert(342, &[196736]);     // 342 => [196736]
            map.insert(787, &[66304]);     // 787 => [66304]
            map.insert(614, &[9472]);     // 614 => [9472]
            map.insert(998, &[35072]);     // 998 => [35072]
            map.insert(107, &[279552]);     // 107 => [279552]
            map.insert(638, &[3146752]);     // 638 => [3146752]
            map.insert(314, &[141312]);     // 314 => [141312]
            map.insert(886, &[2230272]);     // 886 => [2230272]
            map.insert(23, &[23]);     // 23 => [23]
            map.insert(39, &[39]);     // 39 => [39]
            map.insert(187, &[263]);     // 187 => [263]
            map.insert(263, &[519]);     // 263 => [519]
            map.insert(987, &[16391]);     // 987 => [16391]
            map.insert(452, &[32775]);     // 452 => [32775]
            map.insert(894, &[131079]);     // 894 => [131079]
            map.insert(27, &[27]);     // 27 => [27]
            map.insert(43, &[43]);     // 43 => [43]
            map.insert(75, &[75]);     // 75 => [75]
            map.insert(139, &[139]);     // 139 => [139]
            map.insert(523, &[1035]);     // 523 => [1035]
            map.insert(955, &[4107]);     // 955 => [4107]
            map.insert(209, &[8203]);     // 209 => [8203]
            map.insert(983, &[16395]);     // 983 => [16395]
            map.insert(456, &[32779]);     // 456 => [32779]
            map.insert(676, &[65547]);     // 676 => [65547]
            map.insert(882, &[131083]);     // 882 => [131083]
            map.insert(86, &[524299]);     // 86 => [524299]
            map.insert(739, &[1048587]);     // 739 => [1048587]
            map.insert(51, &[51]);     // 51 => [51]
            map.insert(83, &[83]);     // 83 => [83]
            map.insert(147, &[147]);     // 147 => [147]
            map.insert(275, &[531]);     // 275 => [531]
            map.insert(650, &[2067]);     // 650 => [2067]
            map.insert(975, &[16403]);     // 975 => [16403]
            map.insert(464, &[32787]);     // 464 => [32787]
            map.insert(420, &[262163]);     // 420 => [262163]
            map.insert(78, &[524307]);     // 78 => [524307]
            map.insert(763, &[1048595]);     // 763 => [1048595]
            map.insert(645, &[2097171]);     // 645 => [2097171]
            map.insert(99, &[99]);     // 99 => [99]
            map.insert(163, &[163]);     // 163 => [163]
            map.insert(159, &[291]);     // 159 => [291]
            map.insert(291, &[547]);     // 291 => [547]
            map.insert(547, &[1059]);     // 547 => [1059]
            map.insert(915, &[4131]);     // 915 => [4131]
            map.insert(249, &[8227]);     // 249 => [8227]
            map.insert(1023, &[16419]);     // 1023 => [16419]
            map.insert(652, &[65571]);     // 652 => [65571]
            map.insert(404, &[262179]);     // 404 => [262179]
            map.insert(255, &[323]);     // 255 => [323]
            map.insert(1011, &[4163]);     // 1011 => [4163]
            map.insert(927, &[16451]);     // 927 => [16451]
            map.insert(826, &[131139]);     // 826 => [131139]
            map.insert(500, &[262211]);     // 500 => [262211]
            map.insert(30, &[524355]);     // 30 => [524355]
            map.insert(725, &[2097219]);     // 725 => [2097219]
            map.insert(63, &[387]);     // 63 => [387]
            map.insert(643, &[1155]);     // 643 => [1155]
            map.insert(538, &[2179]);     // 538 => [2179]
            map.insert(819, &[4227]);     // 819 => [4227]
            map.insert(556, &[65667]);     // 556 => [65667]
            map.insert(1018, &[131203]);     // 1018 => [131203]
            map.insert(533, &[2097283]);     // 533 => [2097283]
            map.insert(550, &[2307]);     // 550 => [2307]
            map.insert(783, &[4355]);     // 783 => [4355]
            map.insert(101, &[8451]);     // 101 => [8451]
            map.insert(867, &[16643]);     // 867 => [16643]
            map.insert(380, &[33027]);     // 380 => [33027]
            map.insert(966, &[131331]);     // 966 => [131331]
            map.insert(226, &[524547]);     // 226 => [524547]
            map.insert(599, &[1048835]);     // 599 => [1048835]
            map.insert(553, &[2097411]);     // 553 => [2097411]
            map.insert(771, &[1539]);     // 771 => [1539]
            map.insert(922, &[2563]);     // 922 => [2563]
            map.insert(691, &[4611]);     // 691 => [4611]
            map.insert(473, &[8707]);     // 473 => [8707]
            map.insert(735, &[16899]);     // 735 => [16899]
            map.insert(940, &[66051]);     // 940 => [66051]
            map.insert(634, &[131587]);     // 634 => [131587]
            map.insert(350, &[524803]);     // 350 => [524803]
            map.insert(1003, &[1049091]);     // 1003 => [1049091]
            map.insert(917, &[2097667]);     // 917 => [2097667]
            map.insert(479, &[17411]);     // 479 => [17411]
            map.insert(960, &[33795]);     // 960 => [33795]
            map.insert(378, &[132099]);     // 378 => [132099]
            map.insert(606, &[525315]);     // 606 => [525315]
            map.insert(235, &[1049603]);     // 235 => [1049603]
            map.insert(149, &[2098179]);     // 149 => [2098179]
            map.insert(298, &[6147]);     // 298 => [6147]
            map.insert(326, &[18435]);     // 326 => [18435]
            map.insert(53, &[67587]);     // 53 => [67587]
            map.insert(813, &[264195]);     // 813 => [264195]
            map.insert(711, &[526339]);     // 711 => [526339]
            map.insert(114, &[1050627]);     // 114 => [1050627]
            map.insert(111, &[20483]);     // 111 => [20483]
            map.insert(624, &[36867]);     // 624 => [36867]
            map.insert(284, &[69635]);     // 284 => [69635]
            map.insert(1006, &[528387]);     // 1006 => [528387]
            map.insert(347, &[1052675]);     // 347 => [1052675]
            map.insert(293, &[2101251]);     // 293 => [2101251]
            map.insert(773, &[24579]);     // 773 => [24579]
            map.insert(282, &[40963]);     // 282 => [40963]
            map.insert(630, &[73731]);     // 630 => [73731]
            map.insert(366, &[270339]);     // 366 => [270339]
            map.insert(561, &[1056771]);     // 561 => [1056771]
            map.insert(591, &[2105347]);     // 591 => [2105347]
            map.insert(540, &[49155]);     // 540 => [49155]
            map.insert(368, &[81923]);     // 368 => [81923]
            map.insert(166, &[147459]);     // 166 => [147459]
            map.insert(898, &[540675]);     // 898 => [540675]
            map.insert(329, &[2113539]);     // 329 => [2113539]
            map.insert(879, &[98307]);     // 879 => [98307]
            map.insert(119, &[294915]);     // 119 => [294915]
            map.insert(413, &[557059]);     // 413 => [557059]
            map.insert(808, &[1081347]);     // 808 => [1081347]
            map.insert(854, &[2129923]);     // 854 => [2129923]
            map.insert(469, &[196611]);     // 469 => [196611]
            map.insert(795, &[327683]);     // 795 => [327683]
            map.insert(753, &[589827]);     // 753 => [589827]
            map.insert(58, &[2162691]);     // 58 => [2162691]
            map.insert(717, &[393219]);     // 717 => [393219]
            map.insert(807, &[655363]);     // 807 => [655363]
            map.insert(402, &[1179651]);     // 402 => [1179651]
            map.insert(492, &[2228227]);     // 492 => [2228227]
            map.insert(489, &[786435]);     // 489 => [786435]
            map.insert(802, &[2359299]);     // 802 => [2359299]
            map.insert(45, &[45]);     // 45 => [45]
            map.insert(141, &[141]);     // 141 => [141]
            map.insert(177, &[269]);     // 177 => [269]
            map.insert(269, &[525]);     // 269 => [525]
            map.insert(525, &[1037]);     // 525 => [1037]
            map.insert(957, &[4109]);     // 957 => [4109]
            map.insert(215, &[8205]);     // 215 => [8205]
            map.insert(977, &[16397]);     // 977 => [16397]
            map.insert(462, &[32781]);     // 462 => [32781]
            map.insert(674, &[65549]);     // 674 => [65549]
            map.insert(884, &[131085]);     // 884 => [131085]
            map.insert(442, &[262157]);     // 442 => [262157]
            map.insert(741, &[1048589]);     // 741 => [1048589]
            map.insert(169, &[277]);     // 169 => [277]
            map.insert(277, &[533]);     // 277 => [533]
            map.insert(933, &[4117]);     // 933 => [4117]
            map.insert(207, &[8213]);     // 207 => [8213]
            map.insert(969, &[16405]);     // 969 => [16405]
            map.insert(418, &[262165]);     // 418 => [262165]
            map.insert(765, &[1048597]);     // 765 => [1048597]
            map.insert(486, &[32805]);     // 486 => [32805]
            map.insert(120, &[524325]);     // 120 => [524325]
            map.insert(197, &[197]);     // 197 => [197]
            map.insert(581, &[1093]);     // 581 => [1093]
            map.insert(1013, &[4165]);     // 1013 => [4165]
            map.insert(390, &[32837]);     // 390 => [32837]
            map.insert(828, &[131141]);     // 828 => [131141]
            map.insert(498, &[262213]);     // 498 => [262213]
            map.insert(723, &[2097221]);     // 723 => [2097221]
            map.insert(389, &[645]);     // 389 => [645]
            map.insert(821, &[4229]);     // 821 => [4229]
            map.insert(306, &[262277]);     // 306 => [262277]
            map.insert(621, &[1048709]);     // 621 => [1048709]
            map.insert(441, &[773]);     // 441 => [773]
            map.insert(777, &[4357]);     // 777 => [4357]
            map.insert(869, &[16645]);     // 869 => [16645]
            map.insert(270, &[262405]);     // 270 => [262405]
            map.insert(228, &[524549]);     // 228 => [524549]
            map.insert(593, &[1048837]);     // 593 => [1048837]
            map.insert(198, &[33285]);     // 198 => [33285]
            map.insert(938, &[66053]);     // 938 => [66053]
            map.insert(636, &[131589]);     // 636 => [131589]
            map.insert(178, &[262661]);     // 178 => [262661]
            map.insert(170, &[66565]);     // 170 => [66565]
            map.insert(600, &[525317]);     // 600 => [525317]
            map.insert(237, &[1049605]);     // 237 => [1049605]
            map.insert(300, &[6149]);     // 300 => [6149]
            map.insert(582, &[10245]);     // 582 => [10245]
            map.insert(485, &[133125]);     // 485 => [133125]
            map.insert(705, &[526341]);     // 705 => [526341]
            map.insert(105, &[20485]);     // 105 => [20485]
            map.insert(204, &[135173]);     // 204 => [135173]
            map.insert(934, &[139269]);     // 934 => [139269]
            map.insert(360, &[270341]);     // 360 => [270341]
            map.insert(567, &[1056773]);     // 567 => [1056773]
            map.insert(585, &[2105349]);     // 585 => [2105349]
            map.insert(374, &[81925]);     // 374 => [81925]
            map.insert(622, &[278533]);     // 622 => [278533]
            map.insert(900, &[540677]);     // 900 => [540677]
            map.insert(305, &[1064965]);     // 305 => [1064965]
            map.insert(335, &[2113541]);     // 335 => [2113541]
            map.insert(411, &[557061]);     // 411 => [557061]
            map.insert(848, &[2129925]);     // 848 => [2129925]
            map.insert(797, &[327685]);     // 797 => [327685]
            map.insert(759, &[589829]);     // 759 => [589829]
            map.insert(123, &[3145733]);     // 123 => [3145733]
            map.insert(937, &[4121]);     // 937 => [4121]
            map.insert(430, &[262169]);     // 430 => [262169]
            map.insert(243, &[8233]);     // 243 => [8233]
            map.insert(245, &[329]);     // 245 => [329]
            map.insert(720, &[2121]);     // 720 => [2121]
            map.insert(394, &[32841]);     // 394 => [32841]
            map.insert(742, &[65609]);     // 742 => [65609]
            map.insert(510, &[262217]);     // 510 => [262217]
            map.insert(673, &[1048649]);     // 673 => [1048649]
            map.insert(393, &[649]);     // 393 => [649]
            map.insert(318, &[262281]);     // 318 => [262281]
            map.insert(212, &[524425]);     // 212 => [524425]
            map.insert(609, &[1048713]);     // 609 => [1048713]
            map.insert(340, &[524809]);     // 340 => [524809]
            map.insert(993, &[1049097]);     // 993 => [1049097]
            map.insert(970, &[33801]);     // 970 => [33801]
            map.insert(958, &[263177]);     // 958 => [263177]
            map.insert(586, &[10249]);     // 586 => [10249]
            map.insert(332, &[18441]);     // 332 => [18441]
            map.insert(851, &[34825]);     // 851 => [34825]
            map.insert(278, &[69641]);     // 278 => [69641]
            map.insert(526, &[266249]);     // 526 => [266249]
            map.insert(996, &[528393]);     // 996 => [528393]
            map.insert(337, &[1052681]);     // 337 => [1052681]
            map.insert(303, &[2101257]);     // 303 => [2101257]
            map.insert(356, &[270345]);     // 356 => [270345]
            map.insert(142, &[532489]);     // 142 => [532489]
            map.insert(571, &[1056777]);     // 571 => [1056777]
            map.insert(610, &[278537]);     // 610 => [278537]
            map.insert(904, &[540681]);     // 904 => [540681]
            map.insert(317, &[1064969]);     // 317 => [1064969]
            map.insert(785, &[327689]);     // 785 => [327689]
            map.insert(408, &[1179657]);     // 408 => [1179657]
            map.insert(706, &[2621449]);     // 706 => [2621449]
            map.insert(840, &[131121]);     // 840 => [131121]
            map.insert(909, &[16465]);     // 909 => [16465]
            map.insert(766, &[65617]);     // 766 => [65617]
            map.insert(845, &[16529]);     // 845 => [16529]
            map.insert(338, &[32913]);     // 338 => [32913]
            map.insert(574, &[65681]);     // 574 => [65681]
            map.insert(429, &[785]);     // 429 => [785]
            map.insert(564, &[2321]);     // 564 => [2321]
            map.insert(240, &[524561]);     // 240 => [524561]
            map.insert(903, &[2097681]);     // 903 => [2097681]
            map.insert(417, &[5137]);     // 417 => [5137]
            map.insert(461, &[17425]);     // 461 => [17425]
            map.insert(978, &[33809]);     // 978 => [33809]
            map.insert(312, &[6161]);     // 312 => [6161]
            map.insert(594, &[10257]);     // 594 => [10257]
            map.insert(843, &[34833]);     // 843 => [34833]
            map.insert(497, &[133137]);     // 497 => [133137]
            map.insert(831, &[264209]);     // 831 => [264209]
            map.insert(791, &[24593]);     // 791 => [24593]
            map.insert(612, &[73745]);     // 612 => [73745]
            map.insert(354, &[81937]);     // 354 => [81937]
            map.insert(399, &[557073]);     // 399 => [557073]
            map.insert(836, &[2129937]);     // 836 => [2129937]
            map.insert(507, &[786449]);     // 507 => [786449]
            map.insert(846, &[1310737]);     // 846 => [1310737]
            map.insert(353, &[609]);     // 353 => [609]
            map.insert(568, &[2209]);     // 568 => [2209]
            map.insert(833, &[16673]);     // 833 => [16673]
            map.insert(910, &[66081]);     // 910 => [66081]
            map.insert(509, &[17441]);     // 509 => [17441]
            map.insert(994, &[33825]);     // 994 => [33825]
            map.insert(46, &[2099233]);     // 46 => [2099233]
            map.insert(363, &[2113569]);     // 363 => [2113569]
            map.insert(778, &[1081377]);     // 778 => [1081377]
            map.insert(246, &[262721]);     // 246 => [262721]
            map.insert(238, &[66625]);     // 238 => [66625]
            map.insert(1014, &[263233]);     // 1014 => [263233]
            map.insert(359, &[2101313]);     // 359 => [2101313]
            map.insert(839, &[24641]);     // 839 => [24641]
            map.insert(373, &[1065025]);     // 373 => [1065025]
            map.insert(788, &[2129985]);     // 788 => [2129985]
            map.insert(427, &[786497]);     // 427 => [786497]
            map.insert(798, &[1310785]);     // 798 => [1310785]
            map.insert(756, &[1572929]);     // 756 => [1572929]
            map.insert(573, &[1409]);     // 573 => [1409]
            map.insert(231, &[8577]);     // 231 => [8577]
            map.insert(603, &[9345]);     // 603 => [9345]
            map.insert(834, &[33921]);     // 834 => [33921]
            map.insert(504, &[132225]);     // 504 => [132225]
            map.insert(822, &[263297]);     // 822 => [263297]
            map.insert(424, &[6273]);     // 424 => [6273]
            map.insert(343, &[196737]);     // 343 => [196737]
            map.insert(786, &[66305]);     // 786 => [66305]
            map.insert(615, &[9473]);     // 615 => [9473]
            map.insert(999, &[35073]);     // 999 => [35073]
            map.insert(106, &[279553]);     // 106 => [279553]
            map.insert(639, &[3146753]);     // 639 => [3146753]
            map.insert(315, &[141313]);     // 315 => [141313]
            map.insert(887, &[2230273]);     // 887 => [2230273]
            map.insert(870, &[16646]);     // 870 => [16646]
            map.insert(907, &[540682]);     // 907 => [540682]
            map.insert(396, &[557074]);     // 396 => [557074]
            map.insert(871, &[16647]);     // 871 => [16647]
            map.insert(906, &[540683]);     // 906 => [540683]
            map.insert(397, &[557075]);     // 397 => [557075]
            
            SYNDROME_MAP = Box::into_raw(map);
        }
    });
}

impl GuavaCode22_12 {
    fn parity_check_matrix_transposed(&self) -> &BinMatrix {
        init();
        unsafe {
            PARITY_MATRIX_T.as_ref().unwrap()
        }
    }
}

impl BinaryCode for GuavaCode22_12 {
    fn name(&self) -> String {
        "[22, 12] Guava code".to_owned()
    }

    fn length(&self) -> usize {
        22
    }

    fn dimension(&self) -> usize {
        12
    }

    fn generator_matrix(&self) -> &BinMatrix {
        init();
        unsafe {
            GENERATOR_MATRIX.as_ref().unwrap()
        }
    }

    fn parity_check_matrix(&self) -> &BinMatrix {
        init();
        unsafe {
            PARITY_MATRIX.as_ref().unwrap()
        }
    }

    fn decode_to_code(&self, c: &BinVector) -> Result<BinVector, &str> {
        init();
        let map = unsafe {
            SYNDROME_MAP.as_ref().unwrap()
        };
        debug_assert_eq!(c.len(), self.length(), "the length doesn't match the expected length (length of the code)");
        let he = c * self.parity_check_matrix_transposed();
        let mut error = BinVector::with_capacity(22);
        let stor = unsafe { error.get_storage_mut() };
        let errbytes = map[&he.as_u64()];
        debug_assert_eq!(errbytes.len(), 22 / 64 + if 22 % 64 != 0 { 1 } else { 0 });
        stor.clear();
        stor.extend_from_slice(&errbytes[..]);
        unsafe { error.set_len(22) };
        debug_assert_eq!(error.len(), self.length(), "internal: the error vector is of the wrong length");
        let result = c + &error;
        debug_assert_eq!(result.len(), self.length(), "internal: the result vector is of the wrong length");
        debug_assert_eq!((&result * self.parity_check_matrix_transposed()).count_ones(), 0);
        Ok(result)
    }

    fn decode_to_message(&self, c: &BinVector) -> Result<BinVector, &str> {
        
        let mut codeword = self.decode_to_code(c)?;
        codeword.truncate(12);
        Ok(codeword)
        
    }

    fn decode_slice(&self, c: &mut [u64]) {
        init();
        
        debug_assert_eq!(c[22 / 64] & !((1 << 22) - 1), 0, "this message has excess bits");

        let map = unsafe {
            SYNDROME_MAP.as_ref().unwrap()
        };
        let he = &BinMatrix::from_slices(&[&c[..]], self.length()) * self.parity_check_matrix_transposed();
        let error = map[unsafe { &he.get_word_unchecked(0, 0) }];
        c.iter_mut().zip(error.iter().copied()).for_each(|(sample, error)| *sample ^= error as u64);
    }

    
}

#[cfg(test)]
mod tests {
    use super::*;
    use m4ri_rust::friendly::BinVector;
    use crate::oracle::Sample;

    #[test]
    fn size() {
        let code = GuavaCode22_12.generator_matrix();
        assert_eq!(code.ncols(), 22);
        assert_eq!(code.nrows(), 12);
    }

    #[test]
    fn test_decode_sample() {
        let code = GuavaCode22_12;
        for _ in 0..1000 {
            // setup
            let vec = BinVector::random(code.length());
            let mut sample_a = Sample::from_binvector(&vec, false);
            let mut sample_b = Sample::from_binvector(&vec, true);
            
            let decoded_vec = code.decode_to_message(&vec).unwrap();
            println!("decoded_vec: {:?}", decoded_vec);

            // test vectors
            let decoded_vec_sample_a = Sample::from_binvector(&decoded_vec, false);
            let decoded_vec_sample_b = Sample::from_binvector(&decoded_vec, true);

            code.decode_sample(&mut sample_a);
            code.decode_sample(&mut sample_b);
            assert_eq!(sample_a.get_product(), false);
            assert_eq!(sample_b.get_product(), true);
            assert_eq!(sample_a, decoded_vec_sample_a);
            assert_eq!(sample_b, decoded_vec_sample_b);
        }
    }

    #[test]
    fn random_decode_tests() {

        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, true, true, true, true, true, true, false, false, false, true, false, false, true, false, true, false, true, true, true, false, false]);
            let codeword = BinVector::from_bools(&[true, false, true, true, true, true, false, false, false, false, true, false, false, true, false, true, false, true, false, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, true, true, false, true, true, true, false, true, false, false, true, false, false, false, true, false, true, false, false, false, true]);
            let codeword = BinVector::from_bools(&[true, true, true, false, true, true, true, false, true, false, true, true, false, false, false, true, false, true, false, false, true, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, true, true, true, false, true, true, true, false, false, false, true, true, true, false, true, false, true, true, false, false, true]);
            let codeword = BinVector::from_bools(&[true, true, true, true, false, true, true, true, false, false, false, true, true, false, false, true, false, true, true, true, false, true]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, true, false, true, false, true, true]);
            let codeword = BinVector::from_bools(&[false, false, false, false, false, false, false, false, true, true, true, false, false, true, false, false, true, false, true, false, true, true]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, false, false, true, true, true, true, false, false, false, true, false, true, true, false, true, false, true, true, false, true, true]);
            let codeword = BinVector::from_bools(&[true, false, false, false, true, true, true, true, false, false, true, false, true, true, false, true, false, true, true, false, false, true]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, true, true, false, true, false, true, true, false, true, true, false, false, false, false, true, false, true, false, true, true, false]);
            let codeword = BinVector::from_bools(&[true, true, false, false, true, false, true, true, false, true, true, false, false, false, true, true, false, true, false, true, true, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, false, true, false, false, true, true, false, true, false, true, false, false, false, true, true, true, true, true, true, false, false]);
            let codeword = BinVector::from_bools(&[true, false, true, false, false, false, true, false, true, false, true, false, false, true, true, true, true, true, true, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, false, false, false, false, false, false, false, false, true, false, true, false, true, true, false, true, true, false, true, true, true]);
            let codeword = BinVector::from_bools(&[false, false, false, false, false, true, false, false, false, true, false, true, false, true, false, false, true, true, false, true, true, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, true, false, false, true, false, true, true, true, false, false, false, true, false, false, false, false, false, false, true, true, false]);
            let codeword = BinVector::from_bools(&[true, true, false, false, true, true, true, true, true, false, false, false, true, false, true, false, false, false, false, true, true, true]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, true, true, true, false, false, true, true, false, false, true, true, true, false, true, false, true, false, false, true, false, false]);
            let codeword = BinVector::from_bools(&[true, true, true, true, false, true, true, true, false, false, true, true, true, false, true, false, true, false, false, true, true, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, true, false, false, false, false, false, true, true, true, true, false, false, true, true, false, true, false, false, false, true, true]);
            let codeword = BinVector::from_bools(&[true, true, false, false, false, false, false, true, true, true, true, false, false, true, true, false, true, false, false, false, false, true]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, true, false, true, true, true, false, false, false, true, false, false, true, true, true, true, true, true, true, false, true, false]);
            let codeword = BinVector::from_bools(&[false, false, false, true, true, true, false, false, false, true, false, true, true, true, true, true, true, true, true, true, true, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, true, true, false, true, false, true, true, true, true, true, false, false, true, false, true, false, false, true, false, true, true]);
            let codeword = BinVector::from_bools(&[false, false, true, true, true, false, true, true, true, true, true, false, true, true, false, true, false, false, true, false, true, true]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, false, true, false, true, true, true, true, true, true, true, false, false, true, false, false, true, false, false, false, false, false]);
            let codeword = BinVector::from_bools(&[true, false, true, true, true, true, true, true, true, true, true, false, false, true, true, false, true, false, false, false, true, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, false, false, true, true, true, false, false, true, true, false, true, false, false, false, true, true, false, true, false, false, true]);
            let codeword = BinVector::from_bools(&[true, false, true, true, true, true, false, false, true, true, false, true, false, false, false, false, true, false, true, false, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, false, false, false, true, true, true, false, true, true, false, true, true, false, true, true, true, false, false, false, false, true]);
            let codeword = BinVector::from_bools(&[false, false, false, true, true, true, true, false, true, true, false, true, true, false, true, true, true, false, false, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, false, false, false, true, false, false, false, false, true, true, false, false, false, false, true, false, false, true, true, false, false]);
            let codeword = BinVector::from_bools(&[false, false, false, false, true, false, true, false, false, true, true, false, false, false, false, true, false, true, true, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, false, true, true, true, false, true, true, true, false, false, true, true, false, false, true, false, true, false, true, false, false]);
            let codeword = BinVector::from_bools(&[true, false, true, true, true, false, true, true, true, true, false, true, true, false, false, true, true, true, false, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[false, true, true, false, true, true, true, true, false, true, false, true, false, true, true, false, false, true, false, true, false, false]);
            let codeword = BinVector::from_bools(&[true, true, true, false, false, true, true, false, false, true, false, true, false, true, false, false, false, true, false, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
        {
            let code = GuavaCode22_12;
            let randvec = BinVector::from_bools(&[true, false, true, true, false, false, true, true, false, false, false, false, false, true, false, true, true, false, true, true, false, false]);
            let codeword = BinVector::from_bools(&[true, false, true, false, false, false, true, true, false, false, false, true, false, true, false, true, true, false, true, true, false, false]);
            assert_eq!(code.decode_to_code(&randvec), Ok(codeword));
        }
        
    }

    #[test]
    fn test_generator_representation() {
        init();
        let generator_matrix = unsafe { GENERATOR_MATRIX.as_ref().unwrap() };
        let first_row = generator_matrix.get_window(0, 0, 1, generator_matrix.ncols());
        let vector = BinVector::from_bools(&[ true, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, true, false, false, true, true ]);
        assert_eq!(vector, first_row.as_vector());
    }

}