summaryrefslogtreecommitdiffstats
path: root/src/crypto/internal/nistec/fiat/p224_fiat64.go
blob: 9337bfefef0385e360d69e561e2a10910581f05c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
// Code generated by Fiat Cryptography. DO NOT EDIT.
//
// Autogenerated: word_by_word_montgomery --lang Go --no-wide-int --cmovznz-by-mul --relax-primitive-carry-to-bitwidth 32,64 --internal-static --public-function-case camelCase --public-type-case camelCase --private-function-case camelCase --private-type-case camelCase --doc-text-before-function-name '' --doc-newline-before-package-declaration --doc-prepend-header 'Code generated by Fiat Cryptography. DO NOT EDIT.' --package-name fiat --no-prefix-fiat p224 64 '2^224 - 2^96 + 1' mul square add sub one from_montgomery to_montgomery selectznz to_bytes from_bytes
//
// curve description: p224
//
// machine_wordsize = 64 (from "64")
//
// requested operations: mul, square, add, sub, one, from_montgomery, to_montgomery, selectznz, to_bytes, from_bytes
//
// m = 0xffffffffffffffffffffffffffffffff000000000000000000000001 (from "2^224 - 2^96 + 1")
//
//
//
// NOTE: In addition to the bounds specified above each function, all
//
//   functions synthesized for this Montgomery arithmetic require the
//
//   input to be strictly less than the prime modulus (m), and also
//
//   require the input to be in the unique saturated representation.
//
//   All functions also ensure that these two properties are true of
//
//   return values.
//
//
//
// Computed values:
//
//   eval z = z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192)
//
//   bytes_eval z = z[0] + (z[1] << 8) + (z[2] << 16) + (z[3] << 24) + (z[4] << 32) + (z[5] << 40) + (z[6] << 48) + (z[7] << 56) + (z[8] << 64) + (z[9] << 72) + (z[10] << 80) + (z[11] << 88) + (z[12] << 96) + (z[13] << 104) + (z[14] << 112) + (z[15] << 120) + (z[16] << 128) + (z[17] << 136) + (z[18] << 144) + (z[19] << 152) + (z[20] << 160) + (z[21] << 168) + (z[22] << 176) + (z[23] << 184) + (z[24] << 192) + (z[25] << 200) + (z[26] << 208) + (z[27] << 216)
//
//   twos_complement_eval z = let x1 := z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) in
//
//                            if x1 & (2^256-1) < 2^255 then x1 & (2^256-1) else (x1 & (2^256-1)) - 2^256

package fiat

import "math/bits"

type p224Uint1 uint64 // We use uint64 instead of a more narrow type for performance reasons; see https://github.com/mit-plv/fiat-crypto/pull/1006#issuecomment-892625927
type p224Int1 int64   // We use uint64 instead of a more narrow type for performance reasons; see https://github.com/mit-plv/fiat-crypto/pull/1006#issuecomment-892625927

// The type p224MontgomeryDomainFieldElement is a field element in the Montgomery domain.
//
// Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
type p224MontgomeryDomainFieldElement [4]uint64

// The type p224NonMontgomeryDomainFieldElement is a field element NOT in the Montgomery domain.
//
// Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
type p224NonMontgomeryDomainFieldElement [4]uint64

// p224CmovznzU64 is a single-word conditional move.
//
// Postconditions:
//
//	out1 = (if arg1 = 0 then arg2 else arg3)
//
// Input Bounds:
//
//	arg1: [0x0 ~> 0x1]
//	arg2: [0x0 ~> 0xffffffffffffffff]
//	arg3: [0x0 ~> 0xffffffffffffffff]
//
// Output Bounds:
//
//	out1: [0x0 ~> 0xffffffffffffffff]
func p224CmovznzU64(out1 *uint64, arg1 p224Uint1, arg2 uint64, arg3 uint64) {
	x1 := (uint64(arg1) * 0xffffffffffffffff)
	x2 := ((x1 & arg3) | ((^x1) & arg2))
	*out1 = x2
}

// p224Mul multiplies two field elements in the Montgomery domain.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//	0 ≤ eval arg2 < m
//
// Postconditions:
//
//	eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg2)) mod m
//	0 ≤ eval out1 < m
func p224Mul(out1 *p224MontgomeryDomainFieldElement, arg1 *p224MontgomeryDomainFieldElement, arg2 *p224MontgomeryDomainFieldElement) {
	x1 := arg1[1]
	x2 := arg1[2]
	x3 := arg1[3]
	x4 := arg1[0]
	var x5 uint64
	var x6 uint64
	x6, x5 = bits.Mul64(x4, arg2[3])
	var x7 uint64
	var x8 uint64
	x8, x7 = bits.Mul64(x4, arg2[2])
	var x9 uint64
	var x10 uint64
	x10, x9 = bits.Mul64(x4, arg2[1])
	var x11 uint64
	var x12 uint64
	x12, x11 = bits.Mul64(x4, arg2[0])
	var x13 uint64
	var x14 uint64
	x13, x14 = bits.Add64(x12, x9, uint64(0x0))
	var x15 uint64
	var x16 uint64
	x15, x16 = bits.Add64(x10, x7, uint64(p224Uint1(x14)))
	var x17 uint64
	var x18 uint64
	x17, x18 = bits.Add64(x8, x5, uint64(p224Uint1(x16)))
	x19 := (uint64(p224Uint1(x18)) + x6)
	var x20 uint64
	_, x20 = bits.Mul64(x11, 0xffffffffffffffff)
	var x22 uint64
	var x23 uint64
	x23, x22 = bits.Mul64(x20, 0xffffffff)
	var x24 uint64
	var x25 uint64
	x25, x24 = bits.Mul64(x20, 0xffffffffffffffff)
	var x26 uint64
	var x27 uint64
	x27, x26 = bits.Mul64(x20, 0xffffffff00000000)
	var x28 uint64
	var x29 uint64
	x28, x29 = bits.Add64(x27, x24, uint64(0x0))
	var x30 uint64
	var x31 uint64
	x30, x31 = bits.Add64(x25, x22, uint64(p224Uint1(x29)))
	x32 := (uint64(p224Uint1(x31)) + x23)
	var x34 uint64
	_, x34 = bits.Add64(x11, x20, uint64(0x0))
	var x35 uint64
	var x36 uint64
	x35, x36 = bits.Add64(x13, x26, uint64(p224Uint1(x34)))
	var x37 uint64
	var x38 uint64
	x37, x38 = bits.Add64(x15, x28, uint64(p224Uint1(x36)))
	var x39 uint64
	var x40 uint64
	x39, x40 = bits.Add64(x17, x30, uint64(p224Uint1(x38)))
	var x41 uint64
	var x42 uint64
	x41, x42 = bits.Add64(x19, x32, uint64(p224Uint1(x40)))
	var x43 uint64
	var x44 uint64
	x44, x43 = bits.Mul64(x1, arg2[3])
	var x45 uint64
	var x46 uint64
	x46, x45 = bits.Mul64(x1, arg2[2])
	var x47 uint64
	var x48 uint64
	x48, x47 = bits.Mul64(x1, arg2[1])
	var x49 uint64
	var x50 uint64
	x50, x49 = bits.Mul64(x1, arg2[0])
	var x51 uint64
	var x52 uint64
	x51, x52 = bits.Add64(x50, x47, uint64(0x0))
	var x53 uint64
	var x54 uint64
	x53, x54 = bits.Add64(x48, x45, uint64(p224Uint1(x52)))
	var x55 uint64
	var x56 uint64
	x55, x56 = bits.Add64(x46, x43, uint64(p224Uint1(x54)))
	x57 := (uint64(p224Uint1(x56)) + x44)
	var x58 uint64
	var x59 uint64
	x58, x59 = bits.Add64(x35, x49, uint64(0x0))
	var x60 uint64
	var x61 uint64
	x60, x61 = bits.Add64(x37, x51, uint64(p224Uint1(x59)))
	var x62 uint64
	var x63 uint64
	x62, x63 = bits.Add64(x39, x53, uint64(p224Uint1(x61)))
	var x64 uint64
	var x65 uint64
	x64, x65 = bits.Add64(x41, x55, uint64(p224Uint1(x63)))
	var x66 uint64
	var x67 uint64
	x66, x67 = bits.Add64(uint64(p224Uint1(x42)), x57, uint64(p224Uint1(x65)))
	var x68 uint64
	_, x68 = bits.Mul64(x58, 0xffffffffffffffff)
	var x70 uint64
	var x71 uint64
	x71, x70 = bits.Mul64(x68, 0xffffffff)
	var x72 uint64
	var x73 uint64
	x73, x72 = bits.Mul64(x68, 0xffffffffffffffff)
	var x74 uint64
	var x75 uint64
	x75, x74 = bits.Mul64(x68, 0xffffffff00000000)
	var x76 uint64
	var x77 uint64
	x76, x77 = bits.Add64(x75, x72, uint64(0x0))
	var x78 uint64
	var x79 uint64
	x78, x79 = bits.Add64(x73, x70, uint64(p224Uint1(x77)))
	x80 := (uint64(p224Uint1(x79)) + x71)
	var x82 uint64
	_, x82 = bits.Add64(x58, x68, uint64(0x0))
	var x83 uint64
	var x84 uint64
	x83, x84 = bits.Add64(x60, x74, uint64(p224Uint1(x82)))
	var x85 uint64
	var x86 uint64
	x85, x86 = bits.Add64(x62, x76, uint64(p224Uint1(x84)))
	var x87 uint64
	var x88 uint64
	x87, x88 = bits.Add64(x64, x78, uint64(p224Uint1(x86)))
	var x89 uint64
	var x90 uint64
	x89, x90 = bits.Add64(x66, x80, uint64(p224Uint1(x88)))
	x91 := (uint64(p224Uint1(x90)) + uint64(p224Uint1(x67)))
	var x92 uint64
	var x93 uint64
	x93, x92 = bits.Mul64(x2, arg2[3])
	var x94 uint64
	var x95 uint64
	x95, x94 = bits.Mul64(x2, arg2[2])
	var x96 uint64
	var x97 uint64
	x97, x96 = bits.Mul64(x2, arg2[1])
	var x98 uint64
	var x99 uint64
	x99, x98 = bits.Mul64(x2, arg2[0])
	var x100 uint64
	var x101 uint64
	x100, x101 = bits.Add64(x99, x96, uint64(0x0))
	var x102 uint64
	var x103 uint64
	x102, x103 = bits.Add64(x97, x94, uint64(p224Uint1(x101)))
	var x104 uint64
	var x105 uint64
	x104, x105 = bits.Add64(x95, x92, uint64(p224Uint1(x103)))
	x106 := (uint64(p224Uint1(x105)) + x93)
	var x107 uint64
	var x108 uint64
	x107, x108 = bits.Add64(x83, x98, uint64(0x0))
	var x109 uint64
	var x110 uint64
	x109, x110 = bits.Add64(x85, x100, uint64(p224Uint1(x108)))
	var x111 uint64
	var x112 uint64
	x111, x112 = bits.Add64(x87, x102, uint64(p224Uint1(x110)))
	var x113 uint64
	var x114 uint64
	x113, x114 = bits.Add64(x89, x104, uint64(p224Uint1(x112)))
	var x115 uint64
	var x116 uint64
	x115, x116 = bits.Add64(x91, x106, uint64(p224Uint1(x114)))
	var x117 uint64
	_, x117 = bits.Mul64(x107, 0xffffffffffffffff)
	var x119 uint64
	var x120 uint64
	x120, x119 = bits.Mul64(x117, 0xffffffff)
	var x121 uint64
	var x122 uint64
	x122, x121 = bits.Mul64(x117, 0xffffffffffffffff)
	var x123 uint64
	var x124 uint64
	x124, x123 = bits.Mul64(x117, 0xffffffff00000000)
	var x125 uint64
	var x126 uint64
	x125, x126 = bits.Add64(x124, x121, uint64(0x0))
	var x127 uint64
	var x128 uint64
	x127, x128 = bits.Add64(x122, x119, uint64(p224Uint1(x126)))
	x129 := (uint64(p224Uint1(x128)) + x120)
	var x131 uint64
	_, x131 = bits.Add64(x107, x117, uint64(0x0))
	var x132 uint64
	var x133 uint64
	x132, x133 = bits.Add64(x109, x123, uint64(p224Uint1(x131)))
	var x134 uint64
	var x135 uint64
	x134, x135 = bits.Add64(x111, x125, uint64(p224Uint1(x133)))
	var x136 uint64
	var x137 uint64
	x136, x137 = bits.Add64(x113, x127, uint64(p224Uint1(x135)))
	var x138 uint64
	var x139 uint64
	x138, x139 = bits.Add64(x115, x129, uint64(p224Uint1(x137)))
	x140 := (uint64(p224Uint1(x139)) + uint64(p224Uint1(x116)))
	var x141 uint64
	var x142 uint64
	x142, x141 = bits.Mul64(x3, arg2[3])
	var x143 uint64
	var x144 uint64
	x144, x143 = bits.Mul64(x3, arg2[2])
	var x145 uint64
	var x146 uint64
	x146, x145 = bits.Mul64(x3, arg2[1])
	var x147 uint64
	var x148 uint64
	x148, x147 = bits.Mul64(x3, arg2[0])
	var x149 uint64
	var x150 uint64
	x149, x150 = bits.Add64(x148, x145, uint64(0x0))
	var x151 uint64
	var x152 uint64
	x151, x152 = bits.Add64(x146, x143, uint64(p224Uint1(x150)))
	var x153 uint64
	var x154 uint64
	x153, x154 = bits.Add64(x144, x141, uint64(p224Uint1(x152)))
	x155 := (uint64(p224Uint1(x154)) + x142)
	var x156 uint64
	var x157 uint64
	x156, x157 = bits.Add64(x132, x147, uint64(0x0))
	var x158 uint64
	var x159 uint64
	x158, x159 = bits.Add64(x134, x149, uint64(p224Uint1(x157)))
	var x160 uint64
	var x161 uint64
	x160, x161 = bits.Add64(x136, x151, uint64(p224Uint1(x159)))
	var x162 uint64
	var x163 uint64
	x162, x163 = bits.Add64(x138, x153, uint64(p224Uint1(x161)))
	var x164 uint64
	var x165 uint64
	x164, x165 = bits.Add64(x140, x155, uint64(p224Uint1(x163)))
	var x166 uint64
	_, x166 = bits.Mul64(x156, 0xffffffffffffffff)
	var x168 uint64
	var x169 uint64
	x169, x168 = bits.Mul64(x166, 0xffffffff)
	var x170 uint64
	var x171 uint64
	x171, x170 = bits.Mul64(x166, 0xffffffffffffffff)
	var x172 uint64
	var x173 uint64
	x173, x172 = bits.Mul64(x166, 0xffffffff00000000)
	var x174 uint64
	var x175 uint64
	x174, x175 = bits.Add64(x173, x170, uint64(0x0))
	var x176 uint64
	var x177 uint64
	x176, x177 = bits.Add64(x171, x168, uint64(p224Uint1(x175)))
	x178 := (uint64(p224Uint1(x177)) + x169)
	var x180 uint64
	_, x180 = bits.Add64(x156, x166, uint64(0x0))
	var x181 uint64
	var x182 uint64
	x181, x182 = bits.Add64(x158, x172, uint64(p224Uint1(x180)))
	var x183 uint64
	var x184 uint64
	x183, x184 = bits.Add64(x160, x174, uint64(p224Uint1(x182)))
	var x185 uint64
	var x186 uint64
	x185, x186 = bits.Add64(x162, x176, uint64(p224Uint1(x184)))
	var x187 uint64
	var x188 uint64
	x187, x188 = bits.Add64(x164, x178, uint64(p224Uint1(x186)))
	x189 := (uint64(p224Uint1(x188)) + uint64(p224Uint1(x165)))
	var x190 uint64
	var x191 uint64
	x190, x191 = bits.Sub64(x181, uint64(0x1), uint64(0x0))
	var x192 uint64
	var x193 uint64
	x192, x193 = bits.Sub64(x183, 0xffffffff00000000, uint64(p224Uint1(x191)))
	var x194 uint64
	var x195 uint64
	x194, x195 = bits.Sub64(x185, 0xffffffffffffffff, uint64(p224Uint1(x193)))
	var x196 uint64
	var x197 uint64
	x196, x197 = bits.Sub64(x187, 0xffffffff, uint64(p224Uint1(x195)))
	var x199 uint64
	_, x199 = bits.Sub64(x189, uint64(0x0), uint64(p224Uint1(x197)))
	var x200 uint64
	p224CmovznzU64(&x200, p224Uint1(x199), x190, x181)
	var x201 uint64
	p224CmovznzU64(&x201, p224Uint1(x199), x192, x183)
	var x202 uint64
	p224CmovznzU64(&x202, p224Uint1(x199), x194, x185)
	var x203 uint64
	p224CmovznzU64(&x203, p224Uint1(x199), x196, x187)
	out1[0] = x200
	out1[1] = x201
	out1[2] = x202
	out1[3] = x203
}

// p224Square squares a field element in the Montgomery domain.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//
// Postconditions:
//
//	eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg1)) mod m
//	0 ≤ eval out1 < m
func p224Square(out1 *p224MontgomeryDomainFieldElement, arg1 *p224MontgomeryDomainFieldElement) {
	x1 := arg1[1]
	x2 := arg1[2]
	x3 := arg1[3]
	x4 := arg1[0]
	var x5 uint64
	var x6 uint64
	x6, x5 = bits.Mul64(x4, arg1[3])
	var x7 uint64
	var x8 uint64
	x8, x7 = bits.Mul64(x4, arg1[2])
	var x9 uint64
	var x10 uint64
	x10, x9 = bits.Mul64(x4, arg1[1])
	var x11 uint64
	var x12 uint64
	x12, x11 = bits.Mul64(x4, arg1[0])
	var x13 uint64
	var x14 uint64
	x13, x14 = bits.Add64(x12, x9, uint64(0x0))
	var x15 uint64
	var x16 uint64
	x15, x16 = bits.Add64(x10, x7, uint64(p224Uint1(x14)))
	var x17 uint64
	var x18 uint64
	x17, x18 = bits.Add64(x8, x5, uint64(p224Uint1(x16)))
	x19 := (uint64(p224Uint1(x18)) + x6)
	var x20 uint64
	_, x20 = bits.Mul64(x11, 0xffffffffffffffff)
	var x22 uint64
	var x23 uint64
	x23, x22 = bits.Mul64(x20, 0xffffffff)
	var x24 uint64
	var x25 uint64
	x25, x24 = bits.Mul64(x20, 0xffffffffffffffff)
	var x26 uint64
	var x27 uint64
	x27, x26 = bits.Mul64(x20, 0xffffffff00000000)
	var x28 uint64
	var x29 uint64
	x28, x29 = bits.Add64(x27, x24, uint64(0x0))
	var x30 uint64
	var x31 uint64
	x30, x31 = bits.Add64(x25, x22, uint64(p224Uint1(x29)))
	x32 := (uint64(p224Uint1(x31)) + x23)
	var x34 uint64
	_, x34 = bits.Add64(x11, x20, uint64(0x0))
	var x35 uint64
	var x36 uint64
	x35, x36 = bits.Add64(x13, x26, uint64(p224Uint1(x34)))
	var x37 uint64
	var x38 uint64
	x37, x38 = bits.Add64(x15, x28, uint64(p224Uint1(x36)))
	var x39 uint64
	var x40 uint64
	x39, x40 = bits.Add64(x17, x30, uint64(p224Uint1(x38)))
	var x41 uint64
	var x42 uint64
	x41, x42 = bits.Add64(x19, x32, uint64(p224Uint1(x40)))
	var x43 uint64
	var x44 uint64
	x44, x43 = bits.Mul64(x1, arg1[3])
	var x45 uint64
	var x46 uint64
	x46, x45 = bits.Mul64(x1, arg1[2])
	var x47 uint64
	var x48 uint64
	x48, x47 = bits.Mul64(x1, arg1[1])
	var x49 uint64
	var x50 uint64
	x50, x49 = bits.Mul64(x1, arg1[0])
	var x51 uint64
	var x52 uint64
	x51, x52 = bits.Add64(x50, x47, uint64(0x0))
	var x53 uint64
	var x54 uint64
	x53, x54 = bits.Add64(x48, x45, uint64(p224Uint1(x52)))
	var x55 uint64
	var x56 uint64
	x55, x56 = bits.Add64(x46, x43, uint64(p224Uint1(x54)))
	x57 := (uint64(p224Uint1(x56)) + x44)
	var x58 uint64
	var x59 uint64
	x58, x59 = bits.Add64(x35, x49, uint64(0x0))
	var x60 uint64
	var x61 uint64
	x60, x61 = bits.Add64(x37, x51, uint64(p224Uint1(x59)))
	var x62 uint64
	var x63 uint64
	x62, x63 = bits.Add64(x39, x53, uint64(p224Uint1(x61)))
	var x64 uint64
	var x65 uint64
	x64, x65 = bits.Add64(x41, x55, uint64(p224Uint1(x63)))
	var x66 uint64
	var x67 uint64
	x66, x67 = bits.Add64(uint64(p224Uint1(x42)), x57, uint64(p224Uint1(x65)))
	var x68 uint64
	_, x68 = bits.Mul64(x58, 0xffffffffffffffff)
	var x70 uint64
	var x71 uint64
	x71, x70 = bits.Mul64(x68, 0xffffffff)
	var x72 uint64
	var x73 uint64
	x73, x72 = bits.Mul64(x68, 0xffffffffffffffff)
	var x74 uint64
	var x75 uint64
	x75, x74 = bits.Mul64(x68, 0xffffffff00000000)
	var x76 uint64
	var x77 uint64
	x76, x77 = bits.Add64(x75, x72, uint64(0x0))
	var x78 uint64
	var x79 uint64
	x78, x79 = bits.Add64(x73, x70, uint64(p224Uint1(x77)))
	x80 := (uint64(p224Uint1(x79)) + x71)
	var x82 uint64
	_, x82 = bits.Add64(x58, x68, uint64(0x0))
	var x83 uint64
	var x84 uint64
	x83, x84 = bits.Add64(x60, x74, uint64(p224Uint1(x82)))
	var x85 uint64
	var x86 uint64
	x85, x86 = bits.Add64(x62, x76, uint64(p224Uint1(x84)))
	var x87 uint64
	var x88 uint64
	x87, x88 = bits.Add64(x64, x78, uint64(p224Uint1(x86)))
	var x89 uint64
	var x90 uint64
	x89, x90 = bits.Add64(x66, x80, uint64(p224Uint1(x88)))
	x91 := (uint64(p224Uint1(x90)) + uint64(p224Uint1(x67)))
	var x92 uint64
	var x93 uint64
	x93, x92 = bits.Mul64(x2, arg1[3])
	var x94 uint64
	var x95 uint64
	x95, x94 = bits.Mul64(x2, arg1[2])
	var x96 uint64
	var x97 uint64
	x97, x96 = bits.Mul64(x2, arg1[1])
	var x98 uint64
	var x99 uint64
	x99, x98 = bits.Mul64(x2, arg1[0])
	var x100 uint64
	var x101 uint64
	x100, x101 = bits.Add64(x99, x96, uint64(0x0))
	var x102 uint64
	var x103 uint64
	x102, x103 = bits.Add64(x97, x94, uint64(p224Uint1(x101)))
	var x104 uint64
	var x105 uint64
	x104, x105 = bits.Add64(x95, x92, uint64(p224Uint1(x103)))
	x106 := (uint64(p224Uint1(x105)) + x93)
	var x107 uint64
	var x108 uint64
	x107, x108 = bits.Add64(x83, x98, uint64(0x0))
	var x109 uint64
	var x110 uint64
	x109, x110 = bits.Add64(x85, x100, uint64(p224Uint1(x108)))
	var x111 uint64
	var x112 uint64
	x111, x112 = bits.Add64(x87, x102, uint64(p224Uint1(x110)))
	var x113 uint64
	var x114 uint64
	x113, x114 = bits.Add64(x89, x104, uint64(p224Uint1(x112)))
	var x115 uint64
	var x116 uint64
	x115, x116 = bits.Add64(x91, x106, uint64(p224Uint1(x114)))
	var x117 uint64
	_, x117 = bits.Mul64(x107, 0xffffffffffffffff)
	var x119 uint64
	var x120 uint64
	x120, x119 = bits.Mul64(x117, 0xffffffff)
	var x121 uint64
	var x122 uint64
	x122, x121 = bits.Mul64(x117, 0xffffffffffffffff)
	var x123 uint64
	var x124 uint64
	x124, x123 = bits.Mul64(x117, 0xffffffff00000000)
	var x125 uint64
	var x126 uint64
	x125, x126 = bits.Add64(x124, x121, uint64(0x0))
	var x127 uint64
	var x128 uint64
	x127, x128 = bits.Add64(x122, x119, uint64(p224Uint1(x126)))
	x129 := (uint64(p224Uint1(x128)) + x120)
	var x131 uint64
	_, x131 = bits.Add64(x107, x117, uint64(0x0))
	var x132 uint64
	var x133 uint64
	x132, x133 = bits.Add64(x109, x123, uint64(p224Uint1(x131)))
	var x134 uint64
	var x135 uint64
	x134, x135 = bits.Add64(x111, x125, uint64(p224Uint1(x133)))
	var x136 uint64
	var x137 uint64
	x136, x137 = bits.Add64(x113, x127, uint64(p224Uint1(x135)))
	var x138 uint64
	var x139 uint64
	x138, x139 = bits.Add64(x115, x129, uint64(p224Uint1(x137)))
	x140 := (uint64(p224Uint1(x139)) + uint64(p224Uint1(x116)))
	var x141 uint64
	var x142 uint64
	x142, x141 = bits.Mul64(x3, arg1[3])
	var x143 uint64
	var x144 uint64
	x144, x143 = bits.Mul64(x3, arg1[2])
	var x145 uint64
	var x146 uint64
	x146, x145 = bits.Mul64(x3, arg1[1])
	var x147 uint64
	var x148 uint64
	x148, x147 = bits.Mul64(x3, arg1[0])
	var x149 uint64
	var x150 uint64
	x149, x150 = bits.Add64(x148, x145, uint64(0x0))
	var x151 uint64
	var x152 uint64
	x151, x152 = bits.Add64(x146, x143, uint64(p224Uint1(x150)))
	var x153 uint64
	var x154 uint64
	x153, x154 = bits.Add64(x144, x141, uint64(p224Uint1(x152)))
	x155 := (uint64(p224Uint1(x154)) + x142)
	var x156 uint64
	var x157 uint64
	x156, x157 = bits.Add64(x132, x147, uint64(0x0))
	var x158 uint64
	var x159 uint64
	x158, x159 = bits.Add64(x134, x149, uint64(p224Uint1(x157)))
	var x160 uint64
	var x161 uint64
	x160, x161 = bits.Add64(x136, x151, uint64(p224Uint1(x159)))
	var x162 uint64
	var x163 uint64
	x162, x163 = bits.Add64(x138, x153, uint64(p224Uint1(x161)))
	var x164 uint64
	var x165 uint64
	x164, x165 = bits.Add64(x140, x155, uint64(p224Uint1(x163)))
	var x166 uint64
	_, x166 = bits.Mul64(x156, 0xffffffffffffffff)
	var x168 uint64
	var x169 uint64
	x169, x168 = bits.Mul64(x166, 0xffffffff)
	var x170 uint64
	var x171 uint64
	x171, x170 = bits.Mul64(x166, 0xffffffffffffffff)
	var x172 uint64
	var x173 uint64
	x173, x172 = bits.Mul64(x166, 0xffffffff00000000)
	var x174 uint64
	var x175 uint64
	x174, x175 = bits.Add64(x173, x170, uint64(0x0))
	var x176 uint64
	var x177 uint64
	x176, x177 = bits.Add64(x171, x168, uint64(p224Uint1(x175)))
	x178 := (uint64(p224Uint1(x177)) + x169)
	var x180 uint64
	_, x180 = bits.Add64(x156, x166, uint64(0x0))
	var x181 uint64
	var x182 uint64
	x181, x182 = bits.Add64(x158, x172, uint64(p224Uint1(x180)))
	var x183 uint64
	var x184 uint64
	x183, x184 = bits.Add64(x160, x174, uint64(p224Uint1(x182)))
	var x185 uint64
	var x186 uint64
	x185, x186 = bits.Add64(x162, x176, uint64(p224Uint1(x184)))
	var x187 uint64
	var x188 uint64
	x187, x188 = bits.Add64(x164, x178, uint64(p224Uint1(x186)))
	x189 := (uint64(p224Uint1(x188)) + uint64(p224Uint1(x165)))
	var x190 uint64
	var x191 uint64
	x190, x191 = bits.Sub64(x181, uint64(0x1), uint64(0x0))
	var x192 uint64
	var x193 uint64
	x192, x193 = bits.Sub64(x183, 0xffffffff00000000, uint64(p224Uint1(x191)))
	var x194 uint64
	var x195 uint64
	x194, x195 = bits.Sub64(x185, 0xffffffffffffffff, uint64(p224Uint1(x193)))
	var x196 uint64
	var x197 uint64
	x196, x197 = bits.Sub64(x187, 0xffffffff, uint64(p224Uint1(x195)))
	var x199 uint64
	_, x199 = bits.Sub64(x189, uint64(0x0), uint64(p224Uint1(x197)))
	var x200 uint64
	p224CmovznzU64(&x200, p224Uint1(x199), x190, x181)
	var x201 uint64
	p224CmovznzU64(&x201, p224Uint1(x199), x192, x183)
	var x202 uint64
	p224CmovznzU64(&x202, p224Uint1(x199), x194, x185)
	var x203 uint64
	p224CmovznzU64(&x203, p224Uint1(x199), x196, x187)
	out1[0] = x200
	out1[1] = x201
	out1[2] = x202
	out1[3] = x203
}

// p224Add adds two field elements in the Montgomery domain.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//	0 ≤ eval arg2 < m
//
// Postconditions:
//
//	eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) + eval (from_montgomery arg2)) mod m
//	0 ≤ eval out1 < m
func p224Add(out1 *p224MontgomeryDomainFieldElement, arg1 *p224MontgomeryDomainFieldElement, arg2 *p224MontgomeryDomainFieldElement) {
	var x1 uint64
	var x2 uint64
	x1, x2 = bits.Add64(arg1[0], arg2[0], uint64(0x0))
	var x3 uint64
	var x4 uint64
	x3, x4 = bits.Add64(arg1[1], arg2[1], uint64(p224Uint1(x2)))
	var x5 uint64
	var x6 uint64
	x5, x6 = bits.Add64(arg1[2], arg2[2], uint64(p224Uint1(x4)))
	var x7 uint64
	var x8 uint64
	x7, x8 = bits.Add64(arg1[3], arg2[3], uint64(p224Uint1(x6)))
	var x9 uint64
	var x10 uint64
	x9, x10 = bits.Sub64(x1, uint64(0x1), uint64(0x0))
	var x11 uint64
	var x12 uint64
	x11, x12 = bits.Sub64(x3, 0xffffffff00000000, uint64(p224Uint1(x10)))
	var x13 uint64
	var x14 uint64
	x13, x14 = bits.Sub64(x5, 0xffffffffffffffff, uint64(p224Uint1(x12)))
	var x15 uint64
	var x16 uint64
	x15, x16 = bits.Sub64(x7, 0xffffffff, uint64(p224Uint1(x14)))
	var x18 uint64
	_, x18 = bits.Sub64(uint64(p224Uint1(x8)), uint64(0x0), uint64(p224Uint1(x16)))
	var x19 uint64
	p224CmovznzU64(&x19, p224Uint1(x18), x9, x1)
	var x20 uint64
	p224CmovznzU64(&x20, p224Uint1(x18), x11, x3)
	var x21 uint64
	p224CmovznzU64(&x21, p224Uint1(x18), x13, x5)
	var x22 uint64
	p224CmovznzU64(&x22, p224Uint1(x18), x15, x7)
	out1[0] = x19
	out1[1] = x20
	out1[2] = x21
	out1[3] = x22
}

// p224Sub subtracts two field elements in the Montgomery domain.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//	0 ≤ eval arg2 < m
//
// Postconditions:
//
//	eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) - eval (from_montgomery arg2)) mod m
//	0 ≤ eval out1 < m
func p224Sub(out1 *p224MontgomeryDomainFieldElement, arg1 *p224MontgomeryDomainFieldElement, arg2 *p224MontgomeryDomainFieldElement) {
	var x1 uint64
	var x2 uint64
	x1, x2 = bits.Sub64(arg1[0], arg2[0], uint64(0x0))
	var x3 uint64
	var x4 uint64
	x3, x4 = bits.Sub64(arg1[1], arg2[1], uint64(p224Uint1(x2)))
	var x5 uint64
	var x6 uint64
	x5, x6 = bits.Sub64(arg1[2], arg2[2], uint64(p224Uint1(x4)))
	var x7 uint64
	var x8 uint64
	x7, x8 = bits.Sub64(arg1[3], arg2[3], uint64(p224Uint1(x6)))
	var x9 uint64
	p224CmovznzU64(&x9, p224Uint1(x8), uint64(0x0), 0xffffffffffffffff)
	var x10 uint64
	var x11 uint64
	x10, x11 = bits.Add64(x1, uint64((p224Uint1(x9) & 0x1)), uint64(0x0))
	var x12 uint64
	var x13 uint64
	x12, x13 = bits.Add64(x3, (x9 & 0xffffffff00000000), uint64(p224Uint1(x11)))
	var x14 uint64
	var x15 uint64
	x14, x15 = bits.Add64(x5, x9, uint64(p224Uint1(x13)))
	var x16 uint64
	x16, _ = bits.Add64(x7, (x9 & 0xffffffff), uint64(p224Uint1(x15)))
	out1[0] = x10
	out1[1] = x12
	out1[2] = x14
	out1[3] = x16
}

// p224SetOne returns the field element one in the Montgomery domain.
//
// Postconditions:
//
//	eval (from_montgomery out1) mod m = 1 mod m
//	0 ≤ eval out1 < m
func p224SetOne(out1 *p224MontgomeryDomainFieldElement) {
	out1[0] = 0xffffffff00000000
	out1[1] = 0xffffffffffffffff
	out1[2] = uint64(0x0)
	out1[3] = uint64(0x0)
}

// p224FromMontgomery translates a field element out of the Montgomery domain.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//
// Postconditions:
//
//	eval out1 mod m = (eval arg1 * ((2^64)⁻¹ mod m)^4) mod m
//	0 ≤ eval out1 < m
func p224FromMontgomery(out1 *p224NonMontgomeryDomainFieldElement, arg1 *p224MontgomeryDomainFieldElement) {
	x1 := arg1[0]
	var x2 uint64
	_, x2 = bits.Mul64(x1, 0xffffffffffffffff)
	var x4 uint64
	var x5 uint64
	x5, x4 = bits.Mul64(x2, 0xffffffff)
	var x6 uint64
	var x7 uint64
	x7, x6 = bits.Mul64(x2, 0xffffffffffffffff)
	var x8 uint64
	var x9 uint64
	x9, x8 = bits.Mul64(x2, 0xffffffff00000000)
	var x10 uint64
	var x11 uint64
	x10, x11 = bits.Add64(x9, x6, uint64(0x0))
	var x12 uint64
	var x13 uint64
	x12, x13 = bits.Add64(x7, x4, uint64(p224Uint1(x11)))
	var x15 uint64
	_, x15 = bits.Add64(x1, x2, uint64(0x0))
	var x16 uint64
	var x17 uint64
	x16, x17 = bits.Add64(uint64(0x0), x8, uint64(p224Uint1(x15)))
	var x18 uint64
	var x19 uint64
	x18, x19 = bits.Add64(uint64(0x0), x10, uint64(p224Uint1(x17)))
	var x20 uint64
	var x21 uint64
	x20, x21 = bits.Add64(uint64(0x0), x12, uint64(p224Uint1(x19)))
	var x22 uint64
	var x23 uint64
	x22, x23 = bits.Add64(x16, arg1[1], uint64(0x0))
	var x24 uint64
	var x25 uint64
	x24, x25 = bits.Add64(x18, uint64(0x0), uint64(p224Uint1(x23)))
	var x26 uint64
	var x27 uint64
	x26, x27 = bits.Add64(x20, uint64(0x0), uint64(p224Uint1(x25)))
	var x28 uint64
	_, x28 = bits.Mul64(x22, 0xffffffffffffffff)
	var x30 uint64
	var x31 uint64
	x31, x30 = bits.Mul64(x28, 0xffffffff)
	var x32 uint64
	var x33 uint64
	x33, x32 = bits.Mul64(x28, 0xffffffffffffffff)
	var x34 uint64
	var x35 uint64
	x35, x34 = bits.Mul64(x28, 0xffffffff00000000)
	var x36 uint64
	var x37 uint64
	x36, x37 = bits.Add64(x35, x32, uint64(0x0))
	var x38 uint64
	var x39 uint64
	x38, x39 = bits.Add64(x33, x30, uint64(p224Uint1(x37)))
	var x41 uint64
	_, x41 = bits.Add64(x22, x28, uint64(0x0))
	var x42 uint64
	var x43 uint64
	x42, x43 = bits.Add64(x24, x34, uint64(p224Uint1(x41)))
	var x44 uint64
	var x45 uint64
	x44, x45 = bits.Add64(x26, x36, uint64(p224Uint1(x43)))
	var x46 uint64
	var x47 uint64
	x46, x47 = bits.Add64((uint64(p224Uint1(x27)) + (uint64(p224Uint1(x21)) + (uint64(p224Uint1(x13)) + x5))), x38, uint64(p224Uint1(x45)))
	var x48 uint64
	var x49 uint64
	x48, x49 = bits.Add64(x42, arg1[2], uint64(0x0))
	var x50 uint64
	var x51 uint64
	x50, x51 = bits.Add64(x44, uint64(0x0), uint64(p224Uint1(x49)))
	var x52 uint64
	var x53 uint64
	x52, x53 = bits.Add64(x46, uint64(0x0), uint64(p224Uint1(x51)))
	var x54 uint64
	_, x54 = bits.Mul64(x48, 0xffffffffffffffff)
	var x56 uint64
	var x57 uint64
	x57, x56 = bits.Mul64(x54, 0xffffffff)
	var x58 uint64
	var x59 uint64
	x59, x58 = bits.Mul64(x54, 0xffffffffffffffff)
	var x60 uint64
	var x61 uint64
	x61, x60 = bits.Mul64(x54, 0xffffffff00000000)
	var x62 uint64
	var x63 uint64
	x62, x63 = bits.Add64(x61, x58, uint64(0x0))
	var x64 uint64
	var x65 uint64
	x64, x65 = bits.Add64(x59, x56, uint64(p224Uint1(x63)))
	var x67 uint64
	_, x67 = bits.Add64(x48, x54, uint64(0x0))
	var x68 uint64
	var x69 uint64
	x68, x69 = bits.Add64(x50, x60, uint64(p224Uint1(x67)))
	var x70 uint64
	var x71 uint64
	x70, x71 = bits.Add64(x52, x62, uint64(p224Uint1(x69)))
	var x72 uint64
	var x73 uint64
	x72, x73 = bits.Add64((uint64(p224Uint1(x53)) + (uint64(p224Uint1(x47)) + (uint64(p224Uint1(x39)) + x31))), x64, uint64(p224Uint1(x71)))
	var x74 uint64
	var x75 uint64
	x74, x75 = bits.Add64(x68, arg1[3], uint64(0x0))
	var x76 uint64
	var x77 uint64
	x76, x77 = bits.Add64(x70, uint64(0x0), uint64(p224Uint1(x75)))
	var x78 uint64
	var x79 uint64
	x78, x79 = bits.Add64(x72, uint64(0x0), uint64(p224Uint1(x77)))
	var x80 uint64
	_, x80 = bits.Mul64(x74, 0xffffffffffffffff)
	var x82 uint64
	var x83 uint64
	x83, x82 = bits.Mul64(x80, 0xffffffff)
	var x84 uint64
	var x85 uint64
	x85, x84 = bits.Mul64(x80, 0xffffffffffffffff)
	var x86 uint64
	var x87 uint64
	x87, x86 = bits.Mul64(x80, 0xffffffff00000000)
	var x88 uint64
	var x89 uint64
	x88, x89 = bits.Add64(x87, x84, uint64(0x0))
	var x90 uint64
	var x91 uint64
	x90, x91 = bits.Add64(x85, x82, uint64(p224Uint1(x89)))
	var x93 uint64
	_, x93 = bits.Add64(x74, x80, uint64(0x0))
	var x94 uint64
	var x95 uint64
	x94, x95 = bits.Add64(x76, x86, uint64(p224Uint1(x93)))
	var x96 uint64
	var x97 uint64
	x96, x97 = bits.Add64(x78, x88, uint64(p224Uint1(x95)))
	var x98 uint64
	var x99 uint64
	x98, x99 = bits.Add64((uint64(p224Uint1(x79)) + (uint64(p224Uint1(x73)) + (uint64(p224Uint1(x65)) + x57))), x90, uint64(p224Uint1(x97)))
	x100 := (uint64(p224Uint1(x99)) + (uint64(p224Uint1(x91)) + x83))
	var x101 uint64
	var x102 uint64
	x101, x102 = bits.Sub64(x94, uint64(0x1), uint64(0x0))
	var x103 uint64
	var x104 uint64
	x103, x104 = bits.Sub64(x96, 0xffffffff00000000, uint64(p224Uint1(x102)))
	var x105 uint64
	var x106 uint64
	x105, x106 = bits.Sub64(x98, 0xffffffffffffffff, uint64(p224Uint1(x104)))
	var x107 uint64
	var x108 uint64
	x107, x108 = bits.Sub64(x100, 0xffffffff, uint64(p224Uint1(x106)))
	var x110 uint64
	_, x110 = bits.Sub64(uint64(0x0), uint64(0x0), uint64(p224Uint1(x108)))
	var x111 uint64
	p224CmovznzU64(&x111, p224Uint1(x110), x101, x94)
	var x112 uint64
	p224CmovznzU64(&x112, p224Uint1(x110), x103, x96)
	var x113 uint64
	p224CmovznzU64(&x113, p224Uint1(x110), x105, x98)
	var x114 uint64
	p224CmovznzU64(&x114, p224Uint1(x110), x107, x100)
	out1[0] = x111
	out1[1] = x112
	out1[2] = x113
	out1[3] = x114
}

// p224ToMontgomery translates a field element into the Montgomery domain.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//
// Postconditions:
//
//	eval (from_montgomery out1) mod m = eval arg1 mod m
//	0 ≤ eval out1 < m
func p224ToMontgomery(out1 *p224MontgomeryDomainFieldElement, arg1 *p224NonMontgomeryDomainFieldElement) {
	x1 := arg1[1]
	x2 := arg1[2]
	x3 := arg1[3]
	x4 := arg1[0]
	var x5 uint64
	var x6 uint64
	x6, x5 = bits.Mul64(x4, 0xffffffff)
	var x7 uint64
	var x8 uint64
	x8, x7 = bits.Mul64(x4, 0xfffffffe00000000)
	var x9 uint64
	var x10 uint64
	x10, x9 = bits.Mul64(x4, 0xffffffff00000000)
	var x11 uint64
	var x12 uint64
	x12, x11 = bits.Mul64(x4, 0xffffffff00000001)
	var x13 uint64
	var x14 uint64
	x13, x14 = bits.Add64(x12, x9, uint64(0x0))
	var x15 uint64
	var x16 uint64
	x15, x16 = bits.Add64(x10, x7, uint64(p224Uint1(x14)))
	var x17 uint64
	var x18 uint64
	x17, x18 = bits.Add64(x8, x5, uint64(p224Uint1(x16)))
	var x19 uint64
	_, x19 = bits.Mul64(x11, 0xffffffffffffffff)
	var x21 uint64
	var x22 uint64
	x22, x21 = bits.Mul64(x19, 0xffffffff)
	var x23 uint64
	var x24 uint64
	x24, x23 = bits.Mul64(x19, 0xffffffffffffffff)
	var x25 uint64
	var x26 uint64
	x26, x25 = bits.Mul64(x19, 0xffffffff00000000)
	var x27 uint64
	var x28 uint64
	x27, x28 = bits.Add64(x26, x23, uint64(0x0))
	var x29 uint64
	var x30 uint64
	x29, x30 = bits.Add64(x24, x21, uint64(p224Uint1(x28)))
	var x32 uint64
	_, x32 = bits.Add64(x11, x19, uint64(0x0))
	var x33 uint64
	var x34 uint64
	x33, x34 = bits.Add64(x13, x25, uint64(p224Uint1(x32)))
	var x35 uint64
	var x36 uint64
	x35, x36 = bits.Add64(x15, x27, uint64(p224Uint1(x34)))
	var x37 uint64
	var x38 uint64
	x37, x38 = bits.Add64(x17, x29, uint64(p224Uint1(x36)))
	var x39 uint64
	var x40 uint64
	x40, x39 = bits.Mul64(x1, 0xffffffff)
	var x41 uint64
	var x42 uint64
	x42, x41 = bits.Mul64(x1, 0xfffffffe00000000)
	var x43 uint64
	var x44 uint64
	x44, x43 = bits.Mul64(x1, 0xffffffff00000000)
	var x45 uint64
	var x46 uint64
	x46, x45 = bits.Mul64(x1, 0xffffffff00000001)
	var x47 uint64
	var x48 uint64
	x47, x48 = bits.Add64(x46, x43, uint64(0x0))
	var x49 uint64
	var x50 uint64
	x49, x50 = bits.Add64(x44, x41, uint64(p224Uint1(x48)))
	var x51 uint64
	var x52 uint64
	x51, x52 = bits.Add64(x42, x39, uint64(p224Uint1(x50)))
	var x53 uint64
	var x54 uint64
	x53, x54 = bits.Add64(x33, x45, uint64(0x0))
	var x55 uint64
	var x56 uint64
	x55, x56 = bits.Add64(x35, x47, uint64(p224Uint1(x54)))
	var x57 uint64
	var x58 uint64
	x57, x58 = bits.Add64(x37, x49, uint64(p224Uint1(x56)))
	var x59 uint64
	var x60 uint64
	x59, x60 = bits.Add64(((uint64(p224Uint1(x38)) + (uint64(p224Uint1(x18)) + x6)) + (uint64(p224Uint1(x30)) + x22)), x51, uint64(p224Uint1(x58)))
	var x61 uint64
	_, x61 = bits.Mul64(x53, 0xffffffffffffffff)
	var x63 uint64
	var x64 uint64
	x64, x63 = bits.Mul64(x61, 0xffffffff)
	var x65 uint64
	var x66 uint64
	x66, x65 = bits.Mul64(x61, 0xffffffffffffffff)
	var x67 uint64
	var x68 uint64
	x68, x67 = bits.Mul64(x61, 0xffffffff00000000)
	var x69 uint64
	var x70 uint64
	x69, x70 = bits.Add64(x68, x65, uint64(0x0))
	var x71 uint64
	var x72 uint64
	x71, x72 = bits.Add64(x66, x63, uint64(p224Uint1(x70)))
	var x74 uint64
	_, x74 = bits.Add64(x53, x61, uint64(0x0))
	var x75 uint64
	var x76 uint64
	x75, x76 = bits.Add64(x55, x67, uint64(p224Uint1(x74)))
	var x77 uint64
	var x78 uint64
	x77, x78 = bits.Add64(x57, x69, uint64(p224Uint1(x76)))
	var x79 uint64
	var x80 uint64
	x79, x80 = bits.Add64(x59, x71, uint64(p224Uint1(x78)))
	var x81 uint64
	var x82 uint64
	x82, x81 = bits.Mul64(x2, 0xffffffff)
	var x83 uint64
	var x84 uint64
	x84, x83 = bits.Mul64(x2, 0xfffffffe00000000)
	var x85 uint64
	var x86 uint64
	x86, x85 = bits.Mul64(x2, 0xffffffff00000000)
	var x87 uint64
	var x88 uint64
	x88, x87 = bits.Mul64(x2, 0xffffffff00000001)
	var x89 uint64
	var x90 uint64
	x89, x90 = bits.Add64(x88, x85, uint64(0x0))
	var x91 uint64
	var x92 uint64
	x91, x92 = bits.Add64(x86, x83, uint64(p224Uint1(x90)))
	var x93 uint64
	var x94 uint64
	x93, x94 = bits.Add64(x84, x81, uint64(p224Uint1(x92)))
	var x95 uint64
	var x96 uint64
	x95, x96 = bits.Add64(x75, x87, uint64(0x0))
	var x97 uint64
	var x98 uint64
	x97, x98 = bits.Add64(x77, x89, uint64(p224Uint1(x96)))
	var x99 uint64
	var x100 uint64
	x99, x100 = bits.Add64(x79, x91, uint64(p224Uint1(x98)))
	var x101 uint64
	var x102 uint64
	x101, x102 = bits.Add64(((uint64(p224Uint1(x80)) + (uint64(p224Uint1(x60)) + (uint64(p224Uint1(x52)) + x40))) + (uint64(p224Uint1(x72)) + x64)), x93, uint64(p224Uint1(x100)))
	var x103 uint64
	_, x103 = bits.Mul64(x95, 0xffffffffffffffff)
	var x105 uint64
	var x106 uint64
	x106, x105 = bits.Mul64(x103, 0xffffffff)
	var x107 uint64
	var x108 uint64
	x108, x107 = bits.Mul64(x103, 0xffffffffffffffff)
	var x109 uint64
	var x110 uint64
	x110, x109 = bits.Mul64(x103, 0xffffffff00000000)
	var x111 uint64
	var x112 uint64
	x111, x112 = bits.Add64(x110, x107, uint64(0x0))
	var x113 uint64
	var x114 uint64
	x113, x114 = bits.Add64(x108, x105, uint64(p224Uint1(x112)))
	var x116 uint64
	_, x116 = bits.Add64(x95, x103, uint64(0x0))
	var x117 uint64
	var x118 uint64
	x117, x118 = bits.Add64(x97, x109, uint64(p224Uint1(x116)))
	var x119 uint64
	var x120 uint64
	x119, x120 = bits.Add64(x99, x111, uint64(p224Uint1(x118)))
	var x121 uint64
	var x122 uint64
	x121, x122 = bits.Add64(x101, x113, uint64(p224Uint1(x120)))
	var x123 uint64
	var x124 uint64
	x124, x123 = bits.Mul64(x3, 0xffffffff)
	var x125 uint64
	var x126 uint64
	x126, x125 = bits.Mul64(x3, 0xfffffffe00000000)
	var x127 uint64
	var x128 uint64
	x128, x127 = bits.Mul64(x3, 0xffffffff00000000)
	var x129 uint64
	var x130 uint64
	x130, x129 = bits.Mul64(x3, 0xffffffff00000001)
	var x131 uint64
	var x132 uint64
	x131, x132 = bits.Add64(x130, x127, uint64(0x0))
	var x133 uint64
	var x134 uint64
	x133, x134 = bits.Add64(x128, x125, uint64(p224Uint1(x132)))
	var x135 uint64
	var x136 uint64
	x135, x136 = bits.Add64(x126, x123, uint64(p224Uint1(x134)))
	var x137 uint64
	var x138 uint64
	x137, x138 = bits.Add64(x117, x129, uint64(0x0))
	var x139 uint64
	var x140 uint64
	x139, x140 = bits.Add64(x119, x131, uint64(p224Uint1(x138)))
	var x141 uint64
	var x142 uint64
	x141, x142 = bits.Add64(x121, x133, uint64(p224Uint1(x140)))
	var x143 uint64
	var x144 uint64
	x143, x144 = bits.Add64(((uint64(p224Uint1(x122)) + (uint64(p224Uint1(x102)) + (uint64(p224Uint1(x94)) + x82))) + (uint64(p224Uint1(x114)) + x106)), x135, uint64(p224Uint1(x142)))
	var x145 uint64
	_, x145 = bits.Mul64(x137, 0xffffffffffffffff)
	var x147 uint64
	var x148 uint64
	x148, x147 = bits.Mul64(x145, 0xffffffff)
	var x149 uint64
	var x150 uint64
	x150, x149 = bits.Mul64(x145, 0xffffffffffffffff)
	var x151 uint64
	var x152 uint64
	x152, x151 = bits.Mul64(x145, 0xffffffff00000000)
	var x153 uint64
	var x154 uint64
	x153, x154 = bits.Add64(x152, x149, uint64(0x0))
	var x155 uint64
	var x156 uint64
	x155, x156 = bits.Add64(x150, x147, uint64(p224Uint1(x154)))
	var x158 uint64
	_, x158 = bits.Add64(x137, x145, uint64(0x0))
	var x159 uint64
	var x160 uint64
	x159, x160 = bits.Add64(x139, x151, uint64(p224Uint1(x158)))
	var x161 uint64
	var x162 uint64
	x161, x162 = bits.Add64(x141, x153, uint64(p224Uint1(x160)))
	var x163 uint64
	var x164 uint64
	x163, x164 = bits.Add64(x143, x155, uint64(p224Uint1(x162)))
	x165 := ((uint64(p224Uint1(x164)) + (uint64(p224Uint1(x144)) + (uint64(p224Uint1(x136)) + x124))) + (uint64(p224Uint1(x156)) + x148))
	var x166 uint64
	var x167 uint64
	x166, x167 = bits.Sub64(x159, uint64(0x1), uint64(0x0))
	var x168 uint64
	var x169 uint64
	x168, x169 = bits.Sub64(x161, 0xffffffff00000000, uint64(p224Uint1(x167)))
	var x170 uint64
	var x171 uint64
	x170, x171 = bits.Sub64(x163, 0xffffffffffffffff, uint64(p224Uint1(x169)))
	var x172 uint64
	var x173 uint64
	x172, x173 = bits.Sub64(x165, 0xffffffff, uint64(p224Uint1(x171)))
	var x175 uint64
	_, x175 = bits.Sub64(uint64(0x0), uint64(0x0), uint64(p224Uint1(x173)))
	var x176 uint64
	p224CmovznzU64(&x176, p224Uint1(x175), x166, x159)
	var x177 uint64
	p224CmovznzU64(&x177, p224Uint1(x175), x168, x161)
	var x178 uint64
	p224CmovznzU64(&x178, p224Uint1(x175), x170, x163)
	var x179 uint64
	p224CmovznzU64(&x179, p224Uint1(x175), x172, x165)
	out1[0] = x176
	out1[1] = x177
	out1[2] = x178
	out1[3] = x179
}

// p224Selectznz is a multi-limb conditional select.
//
// Postconditions:
//
//	eval out1 = (if arg1 = 0 then eval arg2 else eval arg3)
//
// Input Bounds:
//
//	arg1: [0x0 ~> 0x1]
//	arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
//	arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
//
// Output Bounds:
//
//	out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
func p224Selectznz(out1 *[4]uint64, arg1 p224Uint1, arg2 *[4]uint64, arg3 *[4]uint64) {
	var x1 uint64
	p224CmovznzU64(&x1, arg1, arg2[0], arg3[0])
	var x2 uint64
	p224CmovznzU64(&x2, arg1, arg2[1], arg3[1])
	var x3 uint64
	p224CmovznzU64(&x3, arg1, arg2[2], arg3[2])
	var x4 uint64
	p224CmovznzU64(&x4, arg1, arg2[3], arg3[3])
	out1[0] = x1
	out1[1] = x2
	out1[2] = x3
	out1[3] = x4
}

// p224ToBytes serializes a field element NOT in the Montgomery domain to bytes in little-endian order.
//
// Preconditions:
//
//	0 ≤ eval arg1 < m
//
// Postconditions:
//
//	out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..27]
//
// Input Bounds:
//
//	arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffff]]
//
// Output Bounds:
//
//	out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
func p224ToBytes(out1 *[28]uint8, arg1 *[4]uint64) {
	x1 := arg1[3]
	x2 := arg1[2]
	x3 := arg1[1]
	x4 := arg1[0]
	x5 := (uint8(x4) & 0xff)
	x6 := (x4 >> 8)
	x7 := (uint8(x6) & 0xff)
	x8 := (x6 >> 8)
	x9 := (uint8(x8) & 0xff)
	x10 := (x8 >> 8)
	x11 := (uint8(x10) & 0xff)
	x12 := (x10 >> 8)
	x13 := (uint8(x12) & 0xff)
	x14 := (x12 >> 8)
	x15 := (uint8(x14) & 0xff)
	x16 := (x14 >> 8)
	x17 := (uint8(x16) & 0xff)
	x18 := uint8((x16 >> 8))
	x19 := (uint8(x3) & 0xff)
	x20 := (x3 >> 8)
	x21 := (uint8(x20) & 0xff)
	x22 := (x20 >> 8)
	x23 := (uint8(x22) & 0xff)
	x24 := (x22 >> 8)
	x25 := (uint8(x24) & 0xff)
	x26 := (x24 >> 8)
	x27 := (uint8(x26) & 0xff)
	x28 := (x26 >> 8)
	x29 := (uint8(x28) & 0xff)
	x30 := (x28 >> 8)
	x31 := (uint8(x30) & 0xff)
	x32 := uint8((x30 >> 8))
	x33 := (uint8(x2) & 0xff)
	x34 := (x2 >> 8)
	x35 := (uint8(x34) & 0xff)
	x36 := (x34 >> 8)
	x37 := (uint8(x36) & 0xff)
	x38 := (x36 >> 8)
	x39 := (uint8(x38) & 0xff)
	x40 := (x38 >> 8)
	x41 := (uint8(x40) & 0xff)
	x42 := (x40 >> 8)
	x43 := (uint8(x42) & 0xff)
	x44 := (x42 >> 8)
	x45 := (uint8(x44) & 0xff)
	x46 := uint8((x44 >> 8))
	x47 := (uint8(x1) & 0xff)
	x48 := (x1 >> 8)
	x49 := (uint8(x48) & 0xff)
	x50 := (x48 >> 8)
	x51 := (uint8(x50) & 0xff)
	x52 := uint8((x50 >> 8))
	out1[0] = x5
	out1[1] = x7
	out1[2] = x9
	out1[3] = x11
	out1[4] = x13
	out1[5] = x15
	out1[6] = x17
	out1[7] = x18
	out1[8] = x19
	out1[9] = x21
	out1[10] = x23
	out1[11] = x25
	out1[12] = x27
	out1[13] = x29
	out1[14] = x31
	out1[15] = x32
	out1[16] = x33
	out1[17] = x35
	out1[18] = x37
	out1[19] = x39
	out1[20] = x41
	out1[21] = x43
	out1[22] = x45
	out1[23] = x46
	out1[24] = x47
	out1[25] = x49
	out1[26] = x51
	out1[27] = x52
}

// p224FromBytes deserializes a field element NOT in the Montgomery domain from bytes in little-endian order.
//
// Preconditions:
//
//	0 ≤ bytes_eval arg1 < m
//
// Postconditions:
//
//	eval out1 mod m = bytes_eval arg1 mod m
//	0 ≤ eval out1 < m
//
// Input Bounds:
//
//	arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
//
// Output Bounds:
//
//	out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffff]]
func p224FromBytes(out1 *[4]uint64, arg1 *[28]uint8) {
	x1 := (uint64(arg1[27]) << 24)
	x2 := (uint64(arg1[26]) << 16)
	x3 := (uint64(arg1[25]) << 8)
	x4 := arg1[24]
	x5 := (uint64(arg1[23]) << 56)
	x6 := (uint64(arg1[22]) << 48)
	x7 := (uint64(arg1[21]) << 40)
	x8 := (uint64(arg1[20]) << 32)
	x9 := (uint64(arg1[19]) << 24)
	x10 := (uint64(arg1[18]) << 16)
	x11 := (uint64(arg1[17]) << 8)
	x12 := arg1[16]
	x13 := (uint64(arg1[15]) << 56)
	x14 := (uint64(arg1[14]) << 48)
	x15 := (uint64(arg1[13]) << 40)
	x16 := (uint64(arg1[12]) << 32)
	x17 := (uint64(arg1[11]) << 24)
	x18 := (uint64(arg1[10]) << 16)
	x19 := (uint64(arg1[9]) << 8)
	x20 := arg1[8]
	x21 := (uint64(arg1[7]) << 56)
	x22 := (uint64(arg1[6]) << 48)
	x23 := (uint64(arg1[5]) << 40)
	x24 := (uint64(arg1[4]) << 32)
	x25 := (uint64(arg1[3]) << 24)
	x26 := (uint64(arg1[2]) << 16)
	x27 := (uint64(arg1[1]) << 8)
	x28 := arg1[0]
	x29 := (x27 + uint64(x28))
	x30 := (x26 + x29)
	x31 := (x25 + x30)
	x32 := (x24 + x31)
	x33 := (x23 + x32)
	x34 := (x22 + x33)
	x35 := (x21 + x34)
	x36 := (x19 + uint64(x20))
	x37 := (x18 + x36)
	x38 := (x17 + x37)
	x39 := (x16 + x38)
	x40 := (x15 + x39)
	x41 := (x14 + x40)
	x42 := (x13 + x41)
	x43 := (x11 + uint64(x12))
	x44 := (x10 + x43)
	x45 := (x9 + x44)
	x46 := (x8 + x45)
	x47 := (x7 + x46)
	x48 := (x6 + x47)
	x49 := (x5 + x48)
	x50 := (x3 + uint64(x4))
	x51 := (x2 + x50)
	x52 := (x1 + x51)
	out1[0] = x35
	out1[1] = x42
	out1[2] = x49
	out1[3] = x52
}