1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
|
/* Autogenerated */
/* curve description: secp256k1 */
/* requested operations: (all) */
/* m = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f (from "2^256 - 2^32 - 977") */
/* machine_wordsize = 64 (from "64") */
/* */
/* 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. */
#include <stdint.h>
typedef unsigned char fiat_secp256k1_uint1;
typedef signed char fiat_secp256k1_int1;
typedef signed __int128 fiat_secp256k1_int128;
typedef unsigned __int128 fiat_secp256k1_uint128;
/*
* The function fiat_secp256k1_addcarryx_u64 is an addition with carry.
* Postconditions:
* out1 = (arg1 + arg2 + arg3) mod 2^64
* out2 = ⌊(arg1 + arg2 + arg3) / 2^64⌋
*
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0xffffffffffffffff]
* arg3: [0x0 ~> 0xffffffffffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffffffffffff]
* out2: [0x0 ~> 0x1]
*/
static void fiat_secp256k1_addcarryx_u64(uint64_t* out1, fiat_secp256k1_uint1* out2, fiat_secp256k1_uint1 arg1, uint64_t arg2, uint64_t arg3) {
fiat_secp256k1_uint128 x1 = ((arg1 + (fiat_secp256k1_uint128)arg2) + arg3);
uint64_t x2 = (uint64_t)(x1 & UINT64_C(0xffffffffffffffff));
fiat_secp256k1_uint1 x3 = (fiat_secp256k1_uint1)(x1 >> 64);
*out1 = x2;
*out2 = x3;
}
/*
* The function fiat_secp256k1_subborrowx_u64 is a subtraction with borrow.
* Postconditions:
* out1 = (-arg1 + arg2 + -arg3) mod 2^64
* out2 = -⌊(-arg1 + arg2 + -arg3) / 2^64⌋
*
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0xffffffffffffffff]
* arg3: [0x0 ~> 0xffffffffffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffffffffffff]
* out2: [0x0 ~> 0x1]
*/
static void fiat_secp256k1_subborrowx_u64(uint64_t* out1, fiat_secp256k1_uint1* out2, fiat_secp256k1_uint1 arg1, uint64_t arg2, uint64_t arg3) {
fiat_secp256k1_int128 x1 = ((arg2 - (fiat_secp256k1_int128)arg1) - arg3);
fiat_secp256k1_int1 x2 = (fiat_secp256k1_int1)(x1 >> 64);
uint64_t x3 = (uint64_t)(x1 & UINT64_C(0xffffffffffffffff));
*out1 = x3;
*out2 = (fiat_secp256k1_uint1)(0x0 - x2);
}
/*
* The function fiat_secp256k1_mulx_u64 is a multiplication, returning the full double-width result.
* Postconditions:
* out1 = (arg1 * arg2) mod 2^64
* out2 = ⌊arg1 * arg2 / 2^64⌋
*
* Input Bounds:
* arg1: [0x0 ~> 0xffffffffffffffff]
* arg2: [0x0 ~> 0xffffffffffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffffffffffff]
* out2: [0x0 ~> 0xffffffffffffffff]
*/
static void fiat_secp256k1_mulx_u64(uint64_t* out1, uint64_t* out2, uint64_t arg1, uint64_t arg2) {
fiat_secp256k1_uint128 x1 = ((fiat_secp256k1_uint128)arg1 * arg2);
uint64_t x2 = (uint64_t)(x1 & UINT64_C(0xffffffffffffffff));
uint64_t x3 = (uint64_t)(x1 >> 64);
*out1 = x2;
*out2 = x3;
}
/*
* The function fiat_secp256k1_cmovznz_u64 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]
*/
static void fiat_secp256k1_cmovznz_u64(uint64_t* out1, fiat_secp256k1_uint1 arg1, uint64_t arg2, uint64_t arg3) {
fiat_secp256k1_uint1 x1 = (!(!arg1));
uint64_t x2 = ((fiat_secp256k1_int1)(0x0 - x1) & UINT64_C(0xffffffffffffffff));
uint64_t x3 = ((x2 & arg3) | ((~x2) & arg2));
*out1 = x3;
}
/*
* The function fiat_secp256k1_mul 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
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_mul(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) {
uint64_t x1 = (arg1[1]);
uint64_t x2 = (arg1[2]);
uint64_t x3 = (arg1[3]);
uint64_t x4 = (arg1[0]);
uint64_t x5;
uint64_t x6;
fiat_secp256k1_mulx_u64(&x5, &x6, x4, (arg2[3]));
uint64_t x7;
uint64_t x8;
fiat_secp256k1_mulx_u64(&x7, &x8, x4, (arg2[2]));
uint64_t x9;
uint64_t x10;
fiat_secp256k1_mulx_u64(&x9, &x10, x4, (arg2[1]));
uint64_t x11;
uint64_t x12;
fiat_secp256k1_mulx_u64(&x11, &x12, x4, (arg2[0]));
uint64_t x13;
fiat_secp256k1_uint1 x14;
fiat_secp256k1_addcarryx_u64(&x13, &x14, 0x0, x9, x12);
uint64_t x15;
fiat_secp256k1_uint1 x16;
fiat_secp256k1_addcarryx_u64(&x15, &x16, x14, x7, x10);
uint64_t x17;
fiat_secp256k1_uint1 x18;
fiat_secp256k1_addcarryx_u64(&x17, &x18, x16, x5, x8);
uint64_t x19;
fiat_secp256k1_uint1 x20;
fiat_secp256k1_addcarryx_u64(&x19, &x20, x18, 0x0, x6);
uint64_t x21;
uint64_t x22;
fiat_secp256k1_mulx_u64(&x21, &x22, x11, UINT64_C(0xd838091dd2253531));
uint64_t x23;
uint64_t x24;
fiat_secp256k1_mulx_u64(&x23, &x24, x21, UINT64_C(0xffffffffffffffff));
uint64_t x25;
uint64_t x26;
fiat_secp256k1_mulx_u64(&x25, &x26, x21, UINT64_C(0xffffffffffffffff));
uint64_t x27;
uint64_t x28;
fiat_secp256k1_mulx_u64(&x27, &x28, x21, UINT64_C(0xffffffffffffffff));
uint64_t x29;
uint64_t x30;
fiat_secp256k1_mulx_u64(&x29, &x30, x21, UINT64_C(0xfffffffefffffc2f));
uint64_t x31;
fiat_secp256k1_uint1 x32;
fiat_secp256k1_addcarryx_u64(&x31, &x32, 0x0, x27, x30);
uint64_t x33;
fiat_secp256k1_uint1 x34;
fiat_secp256k1_addcarryx_u64(&x33, &x34, x32, x25, x28);
uint64_t x35;
fiat_secp256k1_uint1 x36;
fiat_secp256k1_addcarryx_u64(&x35, &x36, x34, x23, x26);
uint64_t x37;
fiat_secp256k1_uint1 x38;
fiat_secp256k1_addcarryx_u64(&x37, &x38, x36, 0x0, x24);
uint64_t x39;
fiat_secp256k1_uint1 x40;
fiat_secp256k1_addcarryx_u64(&x39, &x40, 0x0, x29, x11);
uint64_t x41;
fiat_secp256k1_uint1 x42;
fiat_secp256k1_addcarryx_u64(&x41, &x42, x40, x31, x13);
uint64_t x43;
fiat_secp256k1_uint1 x44;
fiat_secp256k1_addcarryx_u64(&x43, &x44, x42, x33, x15);
uint64_t x45;
fiat_secp256k1_uint1 x46;
fiat_secp256k1_addcarryx_u64(&x45, &x46, x44, x35, x17);
uint64_t x47;
fiat_secp256k1_uint1 x48;
fiat_secp256k1_addcarryx_u64(&x47, &x48, x46, x37, x19);
uint64_t x49;
fiat_secp256k1_uint1 x50;
fiat_secp256k1_addcarryx_u64(&x49, &x50, x48, 0x0, 0x0);
uint64_t x51;
uint64_t x52;
fiat_secp256k1_mulx_u64(&x51, &x52, x1, (arg2[3]));
uint64_t x53;
uint64_t x54;
fiat_secp256k1_mulx_u64(&x53, &x54, x1, (arg2[2]));
uint64_t x55;
uint64_t x56;
fiat_secp256k1_mulx_u64(&x55, &x56, x1, (arg2[1]));
uint64_t x57;
uint64_t x58;
fiat_secp256k1_mulx_u64(&x57, &x58, x1, (arg2[0]));
uint64_t x59;
fiat_secp256k1_uint1 x60;
fiat_secp256k1_addcarryx_u64(&x59, &x60, 0x0, x55, x58);
uint64_t x61;
fiat_secp256k1_uint1 x62;
fiat_secp256k1_addcarryx_u64(&x61, &x62, x60, x53, x56);
uint64_t x63;
fiat_secp256k1_uint1 x64;
fiat_secp256k1_addcarryx_u64(&x63, &x64, x62, x51, x54);
uint64_t x65;
fiat_secp256k1_uint1 x66;
fiat_secp256k1_addcarryx_u64(&x65, &x66, x64, 0x0, x52);
uint64_t x67;
fiat_secp256k1_uint1 x68;
fiat_secp256k1_addcarryx_u64(&x67, &x68, 0x0, x57, x41);
uint64_t x69;
fiat_secp256k1_uint1 x70;
fiat_secp256k1_addcarryx_u64(&x69, &x70, x68, x59, x43);
uint64_t x71;
fiat_secp256k1_uint1 x72;
fiat_secp256k1_addcarryx_u64(&x71, &x72, x70, x61, x45);
uint64_t x73;
fiat_secp256k1_uint1 x74;
fiat_secp256k1_addcarryx_u64(&x73, &x74, x72, x63, x47);
uint64_t x75;
fiat_secp256k1_uint1 x76;
fiat_secp256k1_addcarryx_u64(&x75, &x76, x74, x65, (fiat_secp256k1_uint1)x49);
uint64_t x77;
uint64_t x78;
fiat_secp256k1_mulx_u64(&x77, &x78, x67, UINT64_C(0xd838091dd2253531));
uint64_t x79;
uint64_t x80;
fiat_secp256k1_mulx_u64(&x79, &x80, x77, UINT64_C(0xffffffffffffffff));
uint64_t x81;
uint64_t x82;
fiat_secp256k1_mulx_u64(&x81, &x82, x77, UINT64_C(0xffffffffffffffff));
uint64_t x83;
uint64_t x84;
fiat_secp256k1_mulx_u64(&x83, &x84, x77, UINT64_C(0xffffffffffffffff));
uint64_t x85;
uint64_t x86;
fiat_secp256k1_mulx_u64(&x85, &x86, x77, UINT64_C(0xfffffffefffffc2f));
uint64_t x87;
fiat_secp256k1_uint1 x88;
fiat_secp256k1_addcarryx_u64(&x87, &x88, 0x0, x83, x86);
uint64_t x89;
fiat_secp256k1_uint1 x90;
fiat_secp256k1_addcarryx_u64(&x89, &x90, x88, x81, x84);
uint64_t x91;
fiat_secp256k1_uint1 x92;
fiat_secp256k1_addcarryx_u64(&x91, &x92, x90, x79, x82);
uint64_t x93;
fiat_secp256k1_uint1 x94;
fiat_secp256k1_addcarryx_u64(&x93, &x94, x92, 0x0, x80);
uint64_t x95;
fiat_secp256k1_uint1 x96;
fiat_secp256k1_addcarryx_u64(&x95, &x96, 0x0, x85, x67);
uint64_t x97;
fiat_secp256k1_uint1 x98;
fiat_secp256k1_addcarryx_u64(&x97, &x98, x96, x87, x69);
uint64_t x99;
fiat_secp256k1_uint1 x100;
fiat_secp256k1_addcarryx_u64(&x99, &x100, x98, x89, x71);
uint64_t x101;
fiat_secp256k1_uint1 x102;
fiat_secp256k1_addcarryx_u64(&x101, &x102, x100, x91, x73);
uint64_t x103;
fiat_secp256k1_uint1 x104;
fiat_secp256k1_addcarryx_u64(&x103, &x104, x102, x93, x75);
uint64_t x105;
fiat_secp256k1_uint1 x106;
fiat_secp256k1_addcarryx_u64(&x105, &x106, x104, 0x0, x76);
uint64_t x107;
uint64_t x108;
fiat_secp256k1_mulx_u64(&x107, &x108, x2, (arg2[3]));
uint64_t x109;
uint64_t x110;
fiat_secp256k1_mulx_u64(&x109, &x110, x2, (arg2[2]));
uint64_t x111;
uint64_t x112;
fiat_secp256k1_mulx_u64(&x111, &x112, x2, (arg2[1]));
uint64_t x113;
uint64_t x114;
fiat_secp256k1_mulx_u64(&x113, &x114, x2, (arg2[0]));
uint64_t x115;
fiat_secp256k1_uint1 x116;
fiat_secp256k1_addcarryx_u64(&x115, &x116, 0x0, x111, x114);
uint64_t x117;
fiat_secp256k1_uint1 x118;
fiat_secp256k1_addcarryx_u64(&x117, &x118, x116, x109, x112);
uint64_t x119;
fiat_secp256k1_uint1 x120;
fiat_secp256k1_addcarryx_u64(&x119, &x120, x118, x107, x110);
uint64_t x121;
fiat_secp256k1_uint1 x122;
fiat_secp256k1_addcarryx_u64(&x121, &x122, x120, 0x0, x108);
uint64_t x123;
fiat_secp256k1_uint1 x124;
fiat_secp256k1_addcarryx_u64(&x123, &x124, 0x0, x113, x97);
uint64_t x125;
fiat_secp256k1_uint1 x126;
fiat_secp256k1_addcarryx_u64(&x125, &x126, x124, x115, x99);
uint64_t x127;
fiat_secp256k1_uint1 x128;
fiat_secp256k1_addcarryx_u64(&x127, &x128, x126, x117, x101);
uint64_t x129;
fiat_secp256k1_uint1 x130;
fiat_secp256k1_addcarryx_u64(&x129, &x130, x128, x119, x103);
uint64_t x131;
fiat_secp256k1_uint1 x132;
fiat_secp256k1_addcarryx_u64(&x131, &x132, x130, x121, x105);
uint64_t x133;
uint64_t x134;
fiat_secp256k1_mulx_u64(&x133, &x134, x123, UINT64_C(0xd838091dd2253531));
uint64_t x135;
uint64_t x136;
fiat_secp256k1_mulx_u64(&x135, &x136, x133, UINT64_C(0xffffffffffffffff));
uint64_t x137;
uint64_t x138;
fiat_secp256k1_mulx_u64(&x137, &x138, x133, UINT64_C(0xffffffffffffffff));
uint64_t x139;
uint64_t x140;
fiat_secp256k1_mulx_u64(&x139, &x140, x133, UINT64_C(0xffffffffffffffff));
uint64_t x141;
uint64_t x142;
fiat_secp256k1_mulx_u64(&x141, &x142, x133, UINT64_C(0xfffffffefffffc2f));
uint64_t x143;
fiat_secp256k1_uint1 x144;
fiat_secp256k1_addcarryx_u64(&x143, &x144, 0x0, x139, x142);
uint64_t x145;
fiat_secp256k1_uint1 x146;
fiat_secp256k1_addcarryx_u64(&x145, &x146, x144, x137, x140);
uint64_t x147;
fiat_secp256k1_uint1 x148;
fiat_secp256k1_addcarryx_u64(&x147, &x148, x146, x135, x138);
uint64_t x149;
fiat_secp256k1_uint1 x150;
fiat_secp256k1_addcarryx_u64(&x149, &x150, x148, 0x0, x136);
uint64_t x151;
fiat_secp256k1_uint1 x152;
fiat_secp256k1_addcarryx_u64(&x151, &x152, 0x0, x141, x123);
uint64_t x153;
fiat_secp256k1_uint1 x154;
fiat_secp256k1_addcarryx_u64(&x153, &x154, x152, x143, x125);
uint64_t x155;
fiat_secp256k1_uint1 x156;
fiat_secp256k1_addcarryx_u64(&x155, &x156, x154, x145, x127);
uint64_t x157;
fiat_secp256k1_uint1 x158;
fiat_secp256k1_addcarryx_u64(&x157, &x158, x156, x147, x129);
uint64_t x159;
fiat_secp256k1_uint1 x160;
fiat_secp256k1_addcarryx_u64(&x159, &x160, x158, x149, x131);
uint64_t x161;
fiat_secp256k1_uint1 x162;
fiat_secp256k1_addcarryx_u64(&x161, &x162, x160, 0x0, x132);
uint64_t x163;
uint64_t x164;
fiat_secp256k1_mulx_u64(&x163, &x164, x3, (arg2[3]));
uint64_t x165;
uint64_t x166;
fiat_secp256k1_mulx_u64(&x165, &x166, x3, (arg2[2]));
uint64_t x167;
uint64_t x168;
fiat_secp256k1_mulx_u64(&x167, &x168, x3, (arg2[1]));
uint64_t x169;
uint64_t x170;
fiat_secp256k1_mulx_u64(&x169, &x170, x3, (arg2[0]));
uint64_t x171;
fiat_secp256k1_uint1 x172;
fiat_secp256k1_addcarryx_u64(&x171, &x172, 0x0, x167, x170);
uint64_t x173;
fiat_secp256k1_uint1 x174;
fiat_secp256k1_addcarryx_u64(&x173, &x174, x172, x165, x168);
uint64_t x175;
fiat_secp256k1_uint1 x176;
fiat_secp256k1_addcarryx_u64(&x175, &x176, x174, x163, x166);
uint64_t x177;
fiat_secp256k1_uint1 x178;
fiat_secp256k1_addcarryx_u64(&x177, &x178, x176, 0x0, x164);
uint64_t x179;
fiat_secp256k1_uint1 x180;
fiat_secp256k1_addcarryx_u64(&x179, &x180, 0x0, x169, x153);
uint64_t x181;
fiat_secp256k1_uint1 x182;
fiat_secp256k1_addcarryx_u64(&x181, &x182, x180, x171, x155);
uint64_t x183;
fiat_secp256k1_uint1 x184;
fiat_secp256k1_addcarryx_u64(&x183, &x184, x182, x173, x157);
uint64_t x185;
fiat_secp256k1_uint1 x186;
fiat_secp256k1_addcarryx_u64(&x185, &x186, x184, x175, x159);
uint64_t x187;
fiat_secp256k1_uint1 x188;
fiat_secp256k1_addcarryx_u64(&x187, &x188, x186, x177, x161);
uint64_t x189;
uint64_t x190;
fiat_secp256k1_mulx_u64(&x189, &x190, x179, UINT64_C(0xd838091dd2253531));
uint64_t x191;
uint64_t x192;
fiat_secp256k1_mulx_u64(&x191, &x192, x189, UINT64_C(0xffffffffffffffff));
uint64_t x193;
uint64_t x194;
fiat_secp256k1_mulx_u64(&x193, &x194, x189, UINT64_C(0xffffffffffffffff));
uint64_t x195;
uint64_t x196;
fiat_secp256k1_mulx_u64(&x195, &x196, x189, UINT64_C(0xffffffffffffffff));
uint64_t x197;
uint64_t x198;
fiat_secp256k1_mulx_u64(&x197, &x198, x189, UINT64_C(0xfffffffefffffc2f));
uint64_t x199;
fiat_secp256k1_uint1 x200;
fiat_secp256k1_addcarryx_u64(&x199, &x200, 0x0, x195, x198);
uint64_t x201;
fiat_secp256k1_uint1 x202;
fiat_secp256k1_addcarryx_u64(&x201, &x202, x200, x193, x196);
uint64_t x203;
fiat_secp256k1_uint1 x204;
fiat_secp256k1_addcarryx_u64(&x203, &x204, x202, x191, x194);
uint64_t x205;
fiat_secp256k1_uint1 x206;
fiat_secp256k1_addcarryx_u64(&x205, &x206, x204, 0x0, x192);
uint64_t x207;
fiat_secp256k1_uint1 x208;
fiat_secp256k1_addcarryx_u64(&x207, &x208, 0x0, x197, x179);
uint64_t x209;
fiat_secp256k1_uint1 x210;
fiat_secp256k1_addcarryx_u64(&x209, &x210, x208, x199, x181);
uint64_t x211;
fiat_secp256k1_uint1 x212;
fiat_secp256k1_addcarryx_u64(&x211, &x212, x210, x201, x183);
uint64_t x213;
fiat_secp256k1_uint1 x214;
fiat_secp256k1_addcarryx_u64(&x213, &x214, x212, x203, x185);
uint64_t x215;
fiat_secp256k1_uint1 x216;
fiat_secp256k1_addcarryx_u64(&x215, &x216, x214, x205, x187);
uint64_t x217;
fiat_secp256k1_uint1 x218;
fiat_secp256k1_addcarryx_u64(&x217, &x218, x216, 0x0, x188);
uint64_t x219;
fiat_secp256k1_uint1 x220;
fiat_secp256k1_subborrowx_u64(&x219, &x220, 0x0, x209, UINT64_C(0xfffffffefffffc2f));
uint64_t x221;
fiat_secp256k1_uint1 x222;
fiat_secp256k1_subborrowx_u64(&x221, &x222, x220, x211, UINT64_C(0xffffffffffffffff));
uint64_t x223;
fiat_secp256k1_uint1 x224;
fiat_secp256k1_subborrowx_u64(&x223, &x224, x222, x213, UINT64_C(0xffffffffffffffff));
uint64_t x225;
fiat_secp256k1_uint1 x226;
fiat_secp256k1_subborrowx_u64(&x225, &x226, x224, x215, UINT64_C(0xffffffffffffffff));
uint64_t x227;
fiat_secp256k1_uint1 x228;
fiat_secp256k1_subborrowx_u64(&x227, &x228, x226, x217, 0x0);
uint64_t x229;
fiat_secp256k1_cmovznz_u64(&x229, x228, x219, x209);
uint64_t x230;
fiat_secp256k1_cmovznz_u64(&x230, x228, x221, x211);
uint64_t x231;
fiat_secp256k1_cmovznz_u64(&x231, x228, x223, x213);
uint64_t x232;
fiat_secp256k1_cmovznz_u64(&x232, x228, x225, x215);
out1[0] = x229;
out1[1] = x230;
out1[2] = x231;
out1[3] = x232;
}
/*
* The function fiat_secp256k1_square 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
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_square(uint64_t out1[4], const uint64_t arg1[4]) {
uint64_t x1 = (arg1[1]);
uint64_t x2 = (arg1[2]);
uint64_t x3 = (arg1[3]);
uint64_t x4 = (arg1[0]);
uint64_t x5;
uint64_t x6;
fiat_secp256k1_mulx_u64(&x5, &x6, x4, (arg1[3]));
uint64_t x7;
uint64_t x8;
fiat_secp256k1_mulx_u64(&x7, &x8, x4, (arg1[2]));
uint64_t x9;
uint64_t x10;
fiat_secp256k1_mulx_u64(&x9, &x10, x4, (arg1[1]));
uint64_t x11;
uint64_t x12;
fiat_secp256k1_mulx_u64(&x11, &x12, x4, (arg1[0]));
uint64_t x13;
fiat_secp256k1_uint1 x14;
fiat_secp256k1_addcarryx_u64(&x13, &x14, 0x0, x9, x12);
uint64_t x15;
fiat_secp256k1_uint1 x16;
fiat_secp256k1_addcarryx_u64(&x15, &x16, x14, x7, x10);
uint64_t x17;
fiat_secp256k1_uint1 x18;
fiat_secp256k1_addcarryx_u64(&x17, &x18, x16, x5, x8);
uint64_t x19;
fiat_secp256k1_uint1 x20;
fiat_secp256k1_addcarryx_u64(&x19, &x20, x18, 0x0, x6);
uint64_t x21;
uint64_t x22;
fiat_secp256k1_mulx_u64(&x21, &x22, x11, UINT64_C(0xd838091dd2253531));
uint64_t x23;
uint64_t x24;
fiat_secp256k1_mulx_u64(&x23, &x24, x21, UINT64_C(0xffffffffffffffff));
uint64_t x25;
uint64_t x26;
fiat_secp256k1_mulx_u64(&x25, &x26, x21, UINT64_C(0xffffffffffffffff));
uint64_t x27;
uint64_t x28;
fiat_secp256k1_mulx_u64(&x27, &x28, x21, UINT64_C(0xffffffffffffffff));
uint64_t x29;
uint64_t x30;
fiat_secp256k1_mulx_u64(&x29, &x30, x21, UINT64_C(0xfffffffefffffc2f));
uint64_t x31;
fiat_secp256k1_uint1 x32;
fiat_secp256k1_addcarryx_u64(&x31, &x32, 0x0, x27, x30);
uint64_t x33;
fiat_secp256k1_uint1 x34;
fiat_secp256k1_addcarryx_u64(&x33, &x34, x32, x25, x28);
uint64_t x35;
fiat_secp256k1_uint1 x36;
fiat_secp256k1_addcarryx_u64(&x35, &x36, x34, x23, x26);
uint64_t x37;
fiat_secp256k1_uint1 x38;
fiat_secp256k1_addcarryx_u64(&x37, &x38, x36, 0x0, x24);
uint64_t x39;
fiat_secp256k1_uint1 x40;
fiat_secp256k1_addcarryx_u64(&x39, &x40, 0x0, x29, x11);
uint64_t x41;
fiat_secp256k1_uint1 x42;
fiat_secp256k1_addcarryx_u64(&x41, &x42, x40, x31, x13);
uint64_t x43;
fiat_secp256k1_uint1 x44;
fiat_secp256k1_addcarryx_u64(&x43, &x44, x42, x33, x15);
uint64_t x45;
fiat_secp256k1_uint1 x46;
fiat_secp256k1_addcarryx_u64(&x45, &x46, x44, x35, x17);
uint64_t x47;
fiat_secp256k1_uint1 x48;
fiat_secp256k1_addcarryx_u64(&x47, &x48, x46, x37, x19);
uint64_t x49;
fiat_secp256k1_uint1 x50;
fiat_secp256k1_addcarryx_u64(&x49, &x50, x48, 0x0, 0x0);
uint64_t x51;
uint64_t x52;
fiat_secp256k1_mulx_u64(&x51, &x52, x1, (arg1[3]));
uint64_t x53;
uint64_t x54;
fiat_secp256k1_mulx_u64(&x53, &x54, x1, (arg1[2]));
uint64_t x55;
uint64_t x56;
fiat_secp256k1_mulx_u64(&x55, &x56, x1, (arg1[1]));
uint64_t x57;
uint64_t x58;
fiat_secp256k1_mulx_u64(&x57, &x58, x1, (arg1[0]));
uint64_t x59;
fiat_secp256k1_uint1 x60;
fiat_secp256k1_addcarryx_u64(&x59, &x60, 0x0, x55, x58);
uint64_t x61;
fiat_secp256k1_uint1 x62;
fiat_secp256k1_addcarryx_u64(&x61, &x62, x60, x53, x56);
uint64_t x63;
fiat_secp256k1_uint1 x64;
fiat_secp256k1_addcarryx_u64(&x63, &x64, x62, x51, x54);
uint64_t x65;
fiat_secp256k1_uint1 x66;
fiat_secp256k1_addcarryx_u64(&x65, &x66, x64, 0x0, x52);
uint64_t x67;
fiat_secp256k1_uint1 x68;
fiat_secp256k1_addcarryx_u64(&x67, &x68, 0x0, x57, x41);
uint64_t x69;
fiat_secp256k1_uint1 x70;
fiat_secp256k1_addcarryx_u64(&x69, &x70, x68, x59, x43);
uint64_t x71;
fiat_secp256k1_uint1 x72;
fiat_secp256k1_addcarryx_u64(&x71, &x72, x70, x61, x45);
uint64_t x73;
fiat_secp256k1_uint1 x74;
fiat_secp256k1_addcarryx_u64(&x73, &x74, x72, x63, x47);
uint64_t x75;
fiat_secp256k1_uint1 x76;
fiat_secp256k1_addcarryx_u64(&x75, &x76, x74, x65, (fiat_secp256k1_uint1)x49);
uint64_t x77;
uint64_t x78;
fiat_secp256k1_mulx_u64(&x77, &x78, x67, UINT64_C(0xd838091dd2253531));
uint64_t x79;
uint64_t x80;
fiat_secp256k1_mulx_u64(&x79, &x80, x77, UINT64_C(0xffffffffffffffff));
uint64_t x81;
uint64_t x82;
fiat_secp256k1_mulx_u64(&x81, &x82, x77, UINT64_C(0xffffffffffffffff));
uint64_t x83;
uint64_t x84;
fiat_secp256k1_mulx_u64(&x83, &x84, x77, UINT64_C(0xffffffffffffffff));
uint64_t x85;
uint64_t x86;
fiat_secp256k1_mulx_u64(&x85, &x86, x77, UINT64_C(0xfffffffefffffc2f));
uint64_t x87;
fiat_secp256k1_uint1 x88;
fiat_secp256k1_addcarryx_u64(&x87, &x88, 0x0, x83, x86);
uint64_t x89;
fiat_secp256k1_uint1 x90;
fiat_secp256k1_addcarryx_u64(&x89, &x90, x88, x81, x84);
uint64_t x91;
fiat_secp256k1_uint1 x92;
fiat_secp256k1_addcarryx_u64(&x91, &x92, x90, x79, x82);
uint64_t x93;
fiat_secp256k1_uint1 x94;
fiat_secp256k1_addcarryx_u64(&x93, &x94, x92, 0x0, x80);
uint64_t x95;
fiat_secp256k1_uint1 x96;
fiat_secp256k1_addcarryx_u64(&x95, &x96, 0x0, x85, x67);
uint64_t x97;
fiat_secp256k1_uint1 x98;
fiat_secp256k1_addcarryx_u64(&x97, &x98, x96, x87, x69);
uint64_t x99;
fiat_secp256k1_uint1 x100;
fiat_secp256k1_addcarryx_u64(&x99, &x100, x98, x89, x71);
uint64_t x101;
fiat_secp256k1_uint1 x102;
fiat_secp256k1_addcarryx_u64(&x101, &x102, x100, x91, x73);
uint64_t x103;
fiat_secp256k1_uint1 x104;
fiat_secp256k1_addcarryx_u64(&x103, &x104, x102, x93, x75);
uint64_t x105;
fiat_secp256k1_uint1 x106;
fiat_secp256k1_addcarryx_u64(&x105, &x106, x104, 0x0, x76);
uint64_t x107;
uint64_t x108;
fiat_secp256k1_mulx_u64(&x107, &x108, x2, (arg1[3]));
uint64_t x109;
uint64_t x110;
fiat_secp256k1_mulx_u64(&x109, &x110, x2, (arg1[2]));
uint64_t x111;
uint64_t x112;
fiat_secp256k1_mulx_u64(&x111, &x112, x2, (arg1[1]));
uint64_t x113;
uint64_t x114;
fiat_secp256k1_mulx_u64(&x113, &x114, x2, (arg1[0]));
uint64_t x115;
fiat_secp256k1_uint1 x116;
fiat_secp256k1_addcarryx_u64(&x115, &x116, 0x0, x111, x114);
uint64_t x117;
fiat_secp256k1_uint1 x118;
fiat_secp256k1_addcarryx_u64(&x117, &x118, x116, x109, x112);
uint64_t x119;
fiat_secp256k1_uint1 x120;
fiat_secp256k1_addcarryx_u64(&x119, &x120, x118, x107, x110);
uint64_t x121;
fiat_secp256k1_uint1 x122;
fiat_secp256k1_addcarryx_u64(&x121, &x122, x120, 0x0, x108);
uint64_t x123;
fiat_secp256k1_uint1 x124;
fiat_secp256k1_addcarryx_u64(&x123, &x124, 0x0, x113, x97);
uint64_t x125;
fiat_secp256k1_uint1 x126;
fiat_secp256k1_addcarryx_u64(&x125, &x126, x124, x115, x99);
uint64_t x127;
fiat_secp256k1_uint1 x128;
fiat_secp256k1_addcarryx_u64(&x127, &x128, x126, x117, x101);
uint64_t x129;
fiat_secp256k1_uint1 x130;
fiat_secp256k1_addcarryx_u64(&x129, &x130, x128, x119, x103);
uint64_t x131;
fiat_secp256k1_uint1 x132;
fiat_secp256k1_addcarryx_u64(&x131, &x132, x130, x121, x105);
uint64_t x133;
uint64_t x134;
fiat_secp256k1_mulx_u64(&x133, &x134, x123, UINT64_C(0xd838091dd2253531));
uint64_t x135;
uint64_t x136;
fiat_secp256k1_mulx_u64(&x135, &x136, x133, UINT64_C(0xffffffffffffffff));
uint64_t x137;
uint64_t x138;
fiat_secp256k1_mulx_u64(&x137, &x138, x133, UINT64_C(0xffffffffffffffff));
uint64_t x139;
uint64_t x140;
fiat_secp256k1_mulx_u64(&x139, &x140, x133, UINT64_C(0xffffffffffffffff));
uint64_t x141;
uint64_t x142;
fiat_secp256k1_mulx_u64(&x141, &x142, x133, UINT64_C(0xfffffffefffffc2f));
uint64_t x143;
fiat_secp256k1_uint1 x144;
fiat_secp256k1_addcarryx_u64(&x143, &x144, 0x0, x139, x142);
uint64_t x145;
fiat_secp256k1_uint1 x146;
fiat_secp256k1_addcarryx_u64(&x145, &x146, x144, x137, x140);
uint64_t x147;
fiat_secp256k1_uint1 x148;
fiat_secp256k1_addcarryx_u64(&x147, &x148, x146, x135, x138);
uint64_t x149;
fiat_secp256k1_uint1 x150;
fiat_secp256k1_addcarryx_u64(&x149, &x150, x148, 0x0, x136);
uint64_t x151;
fiat_secp256k1_uint1 x152;
fiat_secp256k1_addcarryx_u64(&x151, &x152, 0x0, x141, x123);
uint64_t x153;
fiat_secp256k1_uint1 x154;
fiat_secp256k1_addcarryx_u64(&x153, &x154, x152, x143, x125);
uint64_t x155;
fiat_secp256k1_uint1 x156;
fiat_secp256k1_addcarryx_u64(&x155, &x156, x154, x145, x127);
uint64_t x157;
fiat_secp256k1_uint1 x158;
fiat_secp256k1_addcarryx_u64(&x157, &x158, x156, x147, x129);
uint64_t x159;
fiat_secp256k1_uint1 x160;
fiat_secp256k1_addcarryx_u64(&x159, &x160, x158, x149, x131);
uint64_t x161;
fiat_secp256k1_uint1 x162;
fiat_secp256k1_addcarryx_u64(&x161, &x162, x160, 0x0, x132);
uint64_t x163;
uint64_t x164;
fiat_secp256k1_mulx_u64(&x163, &x164, x3, (arg1[3]));
uint64_t x165;
uint64_t x166;
fiat_secp256k1_mulx_u64(&x165, &x166, x3, (arg1[2]));
uint64_t x167;
uint64_t x168;
fiat_secp256k1_mulx_u64(&x167, &x168, x3, (arg1[1]));
uint64_t x169;
uint64_t x170;
fiat_secp256k1_mulx_u64(&x169, &x170, x3, (arg1[0]));
uint64_t x171;
fiat_secp256k1_uint1 x172;
fiat_secp256k1_addcarryx_u64(&x171, &x172, 0x0, x167, x170);
uint64_t x173;
fiat_secp256k1_uint1 x174;
fiat_secp256k1_addcarryx_u64(&x173, &x174, x172, x165, x168);
uint64_t x175;
fiat_secp256k1_uint1 x176;
fiat_secp256k1_addcarryx_u64(&x175, &x176, x174, x163, x166);
uint64_t x177;
fiat_secp256k1_uint1 x178;
fiat_secp256k1_addcarryx_u64(&x177, &x178, x176, 0x0, x164);
uint64_t x179;
fiat_secp256k1_uint1 x180;
fiat_secp256k1_addcarryx_u64(&x179, &x180, 0x0, x169, x153);
uint64_t x181;
fiat_secp256k1_uint1 x182;
fiat_secp256k1_addcarryx_u64(&x181, &x182, x180, x171, x155);
uint64_t x183;
fiat_secp256k1_uint1 x184;
fiat_secp256k1_addcarryx_u64(&x183, &x184, x182, x173, x157);
uint64_t x185;
fiat_secp256k1_uint1 x186;
fiat_secp256k1_addcarryx_u64(&x185, &x186, x184, x175, x159);
uint64_t x187;
fiat_secp256k1_uint1 x188;
fiat_secp256k1_addcarryx_u64(&x187, &x188, x186, x177, x161);
uint64_t x189;
uint64_t x190;
fiat_secp256k1_mulx_u64(&x189, &x190, x179, UINT64_C(0xd838091dd2253531));
uint64_t x191;
uint64_t x192;
fiat_secp256k1_mulx_u64(&x191, &x192, x189, UINT64_C(0xffffffffffffffff));
uint64_t x193;
uint64_t x194;
fiat_secp256k1_mulx_u64(&x193, &x194, x189, UINT64_C(0xffffffffffffffff));
uint64_t x195;
uint64_t x196;
fiat_secp256k1_mulx_u64(&x195, &x196, x189, UINT64_C(0xffffffffffffffff));
uint64_t x197;
uint64_t x198;
fiat_secp256k1_mulx_u64(&x197, &x198, x189, UINT64_C(0xfffffffefffffc2f));
uint64_t x199;
fiat_secp256k1_uint1 x200;
fiat_secp256k1_addcarryx_u64(&x199, &x200, 0x0, x195, x198);
uint64_t x201;
fiat_secp256k1_uint1 x202;
fiat_secp256k1_addcarryx_u64(&x201, &x202, x200, x193, x196);
uint64_t x203;
fiat_secp256k1_uint1 x204;
fiat_secp256k1_addcarryx_u64(&x203, &x204, x202, x191, x194);
uint64_t x205;
fiat_secp256k1_uint1 x206;
fiat_secp256k1_addcarryx_u64(&x205, &x206, x204, 0x0, x192);
uint64_t x207;
fiat_secp256k1_uint1 x208;
fiat_secp256k1_addcarryx_u64(&x207, &x208, 0x0, x197, x179);
uint64_t x209;
fiat_secp256k1_uint1 x210;
fiat_secp256k1_addcarryx_u64(&x209, &x210, x208, x199, x181);
uint64_t x211;
fiat_secp256k1_uint1 x212;
fiat_secp256k1_addcarryx_u64(&x211, &x212, x210, x201, x183);
uint64_t x213;
fiat_secp256k1_uint1 x214;
fiat_secp256k1_addcarryx_u64(&x213, &x214, x212, x203, x185);
uint64_t x215;
fiat_secp256k1_uint1 x216;
fiat_secp256k1_addcarryx_u64(&x215, &x216, x214, x205, x187);
uint64_t x217;
fiat_secp256k1_uint1 x218;
fiat_secp256k1_addcarryx_u64(&x217, &x218, x216, 0x0, x188);
uint64_t x219;
fiat_secp256k1_uint1 x220;
fiat_secp256k1_subborrowx_u64(&x219, &x220, 0x0, x209, UINT64_C(0xfffffffefffffc2f));
uint64_t x221;
fiat_secp256k1_uint1 x222;
fiat_secp256k1_subborrowx_u64(&x221, &x222, x220, x211, UINT64_C(0xffffffffffffffff));
uint64_t x223;
fiat_secp256k1_uint1 x224;
fiat_secp256k1_subborrowx_u64(&x223, &x224, x222, x213, UINT64_C(0xffffffffffffffff));
uint64_t x225;
fiat_secp256k1_uint1 x226;
fiat_secp256k1_subborrowx_u64(&x225, &x226, x224, x215, UINT64_C(0xffffffffffffffff));
uint64_t x227;
fiat_secp256k1_uint1 x228;
fiat_secp256k1_subborrowx_u64(&x227, &x228, x226, x217, 0x0);
uint64_t x229;
fiat_secp256k1_cmovznz_u64(&x229, x228, x219, x209);
uint64_t x230;
fiat_secp256k1_cmovznz_u64(&x230, x228, x221, x211);
uint64_t x231;
fiat_secp256k1_cmovznz_u64(&x231, x228, x223, x213);
uint64_t x232;
fiat_secp256k1_cmovznz_u64(&x232, x228, x225, x215);
out1[0] = x229;
out1[1] = x230;
out1[2] = x231;
out1[3] = x232;
}
/*
* The function fiat_secp256k1_add 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
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_add(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) {
uint64_t x1;
fiat_secp256k1_uint1 x2;
fiat_secp256k1_addcarryx_u64(&x1, &x2, 0x0, (arg2[0]), (arg1[0]));
uint64_t x3;
fiat_secp256k1_uint1 x4;
fiat_secp256k1_addcarryx_u64(&x3, &x4, x2, (arg2[1]), (arg1[1]));
uint64_t x5;
fiat_secp256k1_uint1 x6;
fiat_secp256k1_addcarryx_u64(&x5, &x6, x4, (arg2[2]), (arg1[2]));
uint64_t x7;
fiat_secp256k1_uint1 x8;
fiat_secp256k1_addcarryx_u64(&x7, &x8, x6, (arg2[3]), (arg1[3]));
uint64_t x9;
fiat_secp256k1_uint1 x10;
fiat_secp256k1_subborrowx_u64(&x9, &x10, 0x0, x1, UINT64_C(0xfffffffefffffc2f));
uint64_t x11;
fiat_secp256k1_uint1 x12;
fiat_secp256k1_subborrowx_u64(&x11, &x12, x10, x3, UINT64_C(0xffffffffffffffff));
uint64_t x13;
fiat_secp256k1_uint1 x14;
fiat_secp256k1_subborrowx_u64(&x13, &x14, x12, x5, UINT64_C(0xffffffffffffffff));
uint64_t x15;
fiat_secp256k1_uint1 x16;
fiat_secp256k1_subborrowx_u64(&x15, &x16, x14, x7, UINT64_C(0xffffffffffffffff));
uint64_t x17;
fiat_secp256k1_uint1 x18;
fiat_secp256k1_subborrowx_u64(&x17, &x18, x16, x8, 0x0);
uint64_t x19;
fiat_secp256k1_cmovznz_u64(&x19, x18, x9, x1);
uint64_t x20;
fiat_secp256k1_cmovznz_u64(&x20, x18, x11, x3);
uint64_t x21;
fiat_secp256k1_cmovznz_u64(&x21, x18, x13, x5);
uint64_t x22;
fiat_secp256k1_cmovznz_u64(&x22, x18, x15, x7);
out1[0] = x19;
out1[1] = x20;
out1[2] = x21;
out1[3] = x22;
}
/*
* The function fiat_secp256k1_sub 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
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_sub(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) {
uint64_t x1;
fiat_secp256k1_uint1 x2;
fiat_secp256k1_subborrowx_u64(&x1, &x2, 0x0, (arg1[0]), (arg2[0]));
uint64_t x3;
fiat_secp256k1_uint1 x4;
fiat_secp256k1_subborrowx_u64(&x3, &x4, x2, (arg1[1]), (arg2[1]));
uint64_t x5;
fiat_secp256k1_uint1 x6;
fiat_secp256k1_subborrowx_u64(&x5, &x6, x4, (arg1[2]), (arg2[2]));
uint64_t x7;
fiat_secp256k1_uint1 x8;
fiat_secp256k1_subborrowx_u64(&x7, &x8, x6, (arg1[3]), (arg2[3]));
uint64_t x9;
fiat_secp256k1_cmovznz_u64(&x9, x8, 0x0, UINT64_C(0xffffffffffffffff));
uint64_t x10;
fiat_secp256k1_uint1 x11;
fiat_secp256k1_addcarryx_u64(&x10, &x11, 0x0, (x9 & UINT64_C(0xfffffffefffffc2f)), x1);
uint64_t x12;
fiat_secp256k1_uint1 x13;
fiat_secp256k1_addcarryx_u64(&x12, &x13, x11, (x9 & UINT64_C(0xffffffffffffffff)), x3);
uint64_t x14;
fiat_secp256k1_uint1 x15;
fiat_secp256k1_addcarryx_u64(&x14, &x15, x13, (x9 & UINT64_C(0xffffffffffffffff)), x5);
uint64_t x16;
fiat_secp256k1_uint1 x17;
fiat_secp256k1_addcarryx_u64(&x16, &x17, x15, (x9 & UINT64_C(0xffffffffffffffff)), x7);
out1[0] = x10;
out1[1] = x12;
out1[2] = x14;
out1[3] = x16;
}
/*
* The function fiat_secp256k1_opp negates a field element in the Montgomery domain.
* Preconditions:
* 0 ≤ eval arg1 < m
* Postconditions:
* eval (from_montgomery out1) mod m = -eval (from_montgomery arg1) mod m
* 0 ≤ eval out1 < m
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_opp(uint64_t out1[4], const uint64_t arg1[4]) {
uint64_t x1;
fiat_secp256k1_uint1 x2;
fiat_secp256k1_subborrowx_u64(&x1, &x2, 0x0, 0x0, (arg1[0]));
uint64_t x3;
fiat_secp256k1_uint1 x4;
fiat_secp256k1_subborrowx_u64(&x3, &x4, x2, 0x0, (arg1[1]));
uint64_t x5;
fiat_secp256k1_uint1 x6;
fiat_secp256k1_subborrowx_u64(&x5, &x6, x4, 0x0, (arg1[2]));
uint64_t x7;
fiat_secp256k1_uint1 x8;
fiat_secp256k1_subborrowx_u64(&x7, &x8, x6, 0x0, (arg1[3]));
uint64_t x9;
fiat_secp256k1_cmovznz_u64(&x9, x8, 0x0, UINT64_C(0xffffffffffffffff));
uint64_t x10;
fiat_secp256k1_uint1 x11;
fiat_secp256k1_addcarryx_u64(&x10, &x11, 0x0, (x9 & UINT64_C(0xfffffffefffffc2f)), x1);
uint64_t x12;
fiat_secp256k1_uint1 x13;
fiat_secp256k1_addcarryx_u64(&x12, &x13, x11, (x9 & UINT64_C(0xffffffffffffffff)), x3);
uint64_t x14;
fiat_secp256k1_uint1 x15;
fiat_secp256k1_addcarryx_u64(&x14, &x15, x13, (x9 & UINT64_C(0xffffffffffffffff)), x5);
uint64_t x16;
fiat_secp256k1_uint1 x17;
fiat_secp256k1_addcarryx_u64(&x16, &x17, x15, (x9 & UINT64_C(0xffffffffffffffff)), x7);
out1[0] = x10;
out1[1] = x12;
out1[2] = x14;
out1[3] = x16;
}
/*
* The function fiat_secp256k1_from_montgomery 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
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_from_montgomery(uint64_t out1[4], const uint64_t arg1[4]) {
uint64_t x1 = (arg1[0]);
uint64_t x2;
uint64_t x3;
fiat_secp256k1_mulx_u64(&x2, &x3, x1, UINT64_C(0xd838091dd2253531));
uint64_t x4;
uint64_t x5;
fiat_secp256k1_mulx_u64(&x4, &x5, x2, UINT64_C(0xffffffffffffffff));
uint64_t x6;
uint64_t x7;
fiat_secp256k1_mulx_u64(&x6, &x7, x2, UINT64_C(0xffffffffffffffff));
uint64_t x8;
uint64_t x9;
fiat_secp256k1_mulx_u64(&x8, &x9, x2, UINT64_C(0xffffffffffffffff));
uint64_t x10;
uint64_t x11;
fiat_secp256k1_mulx_u64(&x10, &x11, x2, UINT64_C(0xfffffffefffffc2f));
uint64_t x12;
fiat_secp256k1_uint1 x13;
fiat_secp256k1_addcarryx_u64(&x12, &x13, 0x0, x8, x11);
uint64_t x14;
fiat_secp256k1_uint1 x15;
fiat_secp256k1_addcarryx_u64(&x14, &x15, x13, x6, x9);
uint64_t x16;
fiat_secp256k1_uint1 x17;
fiat_secp256k1_addcarryx_u64(&x16, &x17, x15, x4, x7);
uint64_t x18;
fiat_secp256k1_uint1 x19;
fiat_secp256k1_addcarryx_u64(&x18, &x19, 0x0, x10, x1);
uint64_t x20;
fiat_secp256k1_uint1 x21;
fiat_secp256k1_addcarryx_u64(&x20, &x21, x19, x12, 0x0);
uint64_t x22;
fiat_secp256k1_uint1 x23;
fiat_secp256k1_addcarryx_u64(&x22, &x23, x21, x14, 0x0);
uint64_t x24;
fiat_secp256k1_uint1 x25;
fiat_secp256k1_addcarryx_u64(&x24, &x25, x23, x16, 0x0);
uint64_t x26;
fiat_secp256k1_uint1 x27;
fiat_secp256k1_addcarryx_u64(&x26, &x27, x17, 0x0, x5);
uint64_t x28;
fiat_secp256k1_uint1 x29;
fiat_secp256k1_addcarryx_u64(&x28, &x29, x25, x26, 0x0);
uint64_t x30;
fiat_secp256k1_uint1 x31;
fiat_secp256k1_addcarryx_u64(&x30, &x31, 0x0, (arg1[1]), x20);
uint64_t x32;
fiat_secp256k1_uint1 x33;
fiat_secp256k1_addcarryx_u64(&x32, &x33, x31, 0x0, x22);
uint64_t x34;
fiat_secp256k1_uint1 x35;
fiat_secp256k1_addcarryx_u64(&x34, &x35, x33, 0x0, x24);
uint64_t x36;
fiat_secp256k1_uint1 x37;
fiat_secp256k1_addcarryx_u64(&x36, &x37, x35, 0x0, x28);
uint64_t x38;
uint64_t x39;
fiat_secp256k1_mulx_u64(&x38, &x39, x30, UINT64_C(0xd838091dd2253531));
uint64_t x40;
uint64_t x41;
fiat_secp256k1_mulx_u64(&x40, &x41, x38, UINT64_C(0xffffffffffffffff));
uint64_t x42;
uint64_t x43;
fiat_secp256k1_mulx_u64(&x42, &x43, x38, UINT64_C(0xffffffffffffffff));
uint64_t x44;
uint64_t x45;
fiat_secp256k1_mulx_u64(&x44, &x45, x38, UINT64_C(0xffffffffffffffff));
uint64_t x46;
uint64_t x47;
fiat_secp256k1_mulx_u64(&x46, &x47, x38, UINT64_C(0xfffffffefffffc2f));
uint64_t x48;
fiat_secp256k1_uint1 x49;
fiat_secp256k1_addcarryx_u64(&x48, &x49, 0x0, x44, x47);
uint64_t x50;
fiat_secp256k1_uint1 x51;
fiat_secp256k1_addcarryx_u64(&x50, &x51, x49, x42, x45);
uint64_t x52;
fiat_secp256k1_uint1 x53;
fiat_secp256k1_addcarryx_u64(&x52, &x53, x51, x40, x43);
uint64_t x54;
fiat_secp256k1_uint1 x55;
fiat_secp256k1_addcarryx_u64(&x54, &x55, 0x0, x46, x30);
uint64_t x56;
fiat_secp256k1_uint1 x57;
fiat_secp256k1_addcarryx_u64(&x56, &x57, x55, x48, x32);
uint64_t x58;
fiat_secp256k1_uint1 x59;
fiat_secp256k1_addcarryx_u64(&x58, &x59, x57, x50, x34);
uint64_t x60;
fiat_secp256k1_uint1 x61;
fiat_secp256k1_addcarryx_u64(&x60, &x61, x59, x52, x36);
uint64_t x62;
fiat_secp256k1_uint1 x63;
fiat_secp256k1_addcarryx_u64(&x62, &x63, x29, 0x0, 0x0);
uint64_t x64;
fiat_secp256k1_uint1 x65;
fiat_secp256k1_addcarryx_u64(&x64, &x65, x37, 0x0, (fiat_secp256k1_uint1)x62);
uint64_t x66;
fiat_secp256k1_uint1 x67;
fiat_secp256k1_addcarryx_u64(&x66, &x67, x53, 0x0, x41);
uint64_t x68;
fiat_secp256k1_uint1 x69;
fiat_secp256k1_addcarryx_u64(&x68, &x69, x61, x66, x64);
uint64_t x70;
fiat_secp256k1_uint1 x71;
fiat_secp256k1_addcarryx_u64(&x70, &x71, 0x0, (arg1[2]), x56);
uint64_t x72;
fiat_secp256k1_uint1 x73;
fiat_secp256k1_addcarryx_u64(&x72, &x73, x71, 0x0, x58);
uint64_t x74;
fiat_secp256k1_uint1 x75;
fiat_secp256k1_addcarryx_u64(&x74, &x75, x73, 0x0, x60);
uint64_t x76;
fiat_secp256k1_uint1 x77;
fiat_secp256k1_addcarryx_u64(&x76, &x77, x75, 0x0, x68);
uint64_t x78;
uint64_t x79;
fiat_secp256k1_mulx_u64(&x78, &x79, x70, UINT64_C(0xd838091dd2253531));
uint64_t x80;
uint64_t x81;
fiat_secp256k1_mulx_u64(&x80, &x81, x78, UINT64_C(0xffffffffffffffff));
uint64_t x82;
uint64_t x83;
fiat_secp256k1_mulx_u64(&x82, &x83, x78, UINT64_C(0xffffffffffffffff));
uint64_t x84;
uint64_t x85;
fiat_secp256k1_mulx_u64(&x84, &x85, x78, UINT64_C(0xffffffffffffffff));
uint64_t x86;
uint64_t x87;
fiat_secp256k1_mulx_u64(&x86, &x87, x78, UINT64_C(0xfffffffefffffc2f));
uint64_t x88;
fiat_secp256k1_uint1 x89;
fiat_secp256k1_addcarryx_u64(&x88, &x89, 0x0, x84, x87);
uint64_t x90;
fiat_secp256k1_uint1 x91;
fiat_secp256k1_addcarryx_u64(&x90, &x91, x89, x82, x85);
uint64_t x92;
fiat_secp256k1_uint1 x93;
fiat_secp256k1_addcarryx_u64(&x92, &x93, x91, x80, x83);
uint64_t x94;
fiat_secp256k1_uint1 x95;
fiat_secp256k1_addcarryx_u64(&x94, &x95, 0x0, x86, x70);
uint64_t x96;
fiat_secp256k1_uint1 x97;
fiat_secp256k1_addcarryx_u64(&x96, &x97, x95, x88, x72);
uint64_t x98;
fiat_secp256k1_uint1 x99;
fiat_secp256k1_addcarryx_u64(&x98, &x99, x97, x90, x74);
uint64_t x100;
fiat_secp256k1_uint1 x101;
fiat_secp256k1_addcarryx_u64(&x100, &x101, x99, x92, x76);
uint64_t x102;
fiat_secp256k1_uint1 x103;
fiat_secp256k1_addcarryx_u64(&x102, &x103, x69, 0x0, 0x0);
uint64_t x104;
fiat_secp256k1_uint1 x105;
fiat_secp256k1_addcarryx_u64(&x104, &x105, x77, 0x0, (fiat_secp256k1_uint1)x102);
uint64_t x106;
fiat_secp256k1_uint1 x107;
fiat_secp256k1_addcarryx_u64(&x106, &x107, x93, 0x0, x81);
uint64_t x108;
fiat_secp256k1_uint1 x109;
fiat_secp256k1_addcarryx_u64(&x108, &x109, x101, x106, x104);
uint64_t x110;
fiat_secp256k1_uint1 x111;
fiat_secp256k1_addcarryx_u64(&x110, &x111, 0x0, (arg1[3]), x96);
uint64_t x112;
fiat_secp256k1_uint1 x113;
fiat_secp256k1_addcarryx_u64(&x112, &x113, x111, 0x0, x98);
uint64_t x114;
fiat_secp256k1_uint1 x115;
fiat_secp256k1_addcarryx_u64(&x114, &x115, x113, 0x0, x100);
uint64_t x116;
fiat_secp256k1_uint1 x117;
fiat_secp256k1_addcarryx_u64(&x116, &x117, x115, 0x0, x108);
uint64_t x118;
uint64_t x119;
fiat_secp256k1_mulx_u64(&x118, &x119, x110, UINT64_C(0xd838091dd2253531));
uint64_t x120;
uint64_t x121;
fiat_secp256k1_mulx_u64(&x120, &x121, x118, UINT64_C(0xffffffffffffffff));
uint64_t x122;
uint64_t x123;
fiat_secp256k1_mulx_u64(&x122, &x123, x118, UINT64_C(0xffffffffffffffff));
uint64_t x124;
uint64_t x125;
fiat_secp256k1_mulx_u64(&x124, &x125, x118, UINT64_C(0xffffffffffffffff));
uint64_t x126;
uint64_t x127;
fiat_secp256k1_mulx_u64(&x126, &x127, x118, UINT64_C(0xfffffffefffffc2f));
uint64_t x128;
fiat_secp256k1_uint1 x129;
fiat_secp256k1_addcarryx_u64(&x128, &x129, 0x0, x124, x127);
uint64_t x130;
fiat_secp256k1_uint1 x131;
fiat_secp256k1_addcarryx_u64(&x130, &x131, x129, x122, x125);
uint64_t x132;
fiat_secp256k1_uint1 x133;
fiat_secp256k1_addcarryx_u64(&x132, &x133, x131, x120, x123);
uint64_t x134;
fiat_secp256k1_uint1 x135;
fiat_secp256k1_addcarryx_u64(&x134, &x135, 0x0, x126, x110);
uint64_t x136;
fiat_secp256k1_uint1 x137;
fiat_secp256k1_addcarryx_u64(&x136, &x137, x135, x128, x112);
uint64_t x138;
fiat_secp256k1_uint1 x139;
fiat_secp256k1_addcarryx_u64(&x138, &x139, x137, x130, x114);
uint64_t x140;
fiat_secp256k1_uint1 x141;
fiat_secp256k1_addcarryx_u64(&x140, &x141, x139, x132, x116);
uint64_t x142;
fiat_secp256k1_uint1 x143;
fiat_secp256k1_addcarryx_u64(&x142, &x143, x109, 0x0, 0x0);
uint64_t x144;
fiat_secp256k1_uint1 x145;
fiat_secp256k1_addcarryx_u64(&x144, &x145, x117, 0x0, (fiat_secp256k1_uint1)x142);
uint64_t x146;
fiat_secp256k1_uint1 x147;
fiat_secp256k1_addcarryx_u64(&x146, &x147, x133, 0x0, x121);
uint64_t x148;
fiat_secp256k1_uint1 x149;
fiat_secp256k1_addcarryx_u64(&x148, &x149, x141, x146, x144);
uint64_t x150;
fiat_secp256k1_uint1 x151;
fiat_secp256k1_subborrowx_u64(&x150, &x151, 0x0, x136, UINT64_C(0xfffffffefffffc2f));
uint64_t x152;
fiat_secp256k1_uint1 x153;
fiat_secp256k1_subborrowx_u64(&x152, &x153, x151, x138, UINT64_C(0xffffffffffffffff));
uint64_t x154;
fiat_secp256k1_uint1 x155;
fiat_secp256k1_subborrowx_u64(&x154, &x155, x153, x140, UINT64_C(0xffffffffffffffff));
uint64_t x156;
fiat_secp256k1_uint1 x157;
fiat_secp256k1_subborrowx_u64(&x156, &x157, x155, x148, UINT64_C(0xffffffffffffffff));
uint64_t x158;
fiat_secp256k1_uint1 x159;
fiat_secp256k1_addcarryx_u64(&x158, &x159, x149, 0x0, 0x0);
uint64_t x160;
fiat_secp256k1_uint1 x161;
fiat_secp256k1_subborrowx_u64(&x160, &x161, x157, (fiat_secp256k1_uint1)x158, 0x0);
uint64_t x162;
fiat_secp256k1_cmovznz_u64(&x162, x161, x150, x136);
uint64_t x163;
fiat_secp256k1_cmovznz_u64(&x163, x161, x152, x138);
uint64_t x164;
fiat_secp256k1_cmovznz_u64(&x164, x161, x154, x140);
uint64_t x165;
fiat_secp256k1_cmovznz_u64(&x165, x161, x156, x148);
out1[0] = x162;
out1[1] = x163;
out1[2] = x164;
out1[3] = x165;
}
/*
* The function fiat_secp256k1_nonzero outputs a single non-zero word if the input is non-zero and zero otherwise.
* Preconditions:
* 0 ≤ eval arg1 < m
* Postconditions:
* out1 = 0 ↔ eval (from_montgomery arg1) mod m = 0
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out1: [0x0 ~> 0xffffffffffffffff]
*/
static void fiat_secp256k1_nonzero(uint64_t* out1, const uint64_t arg1[4]) {
uint64_t x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | (uint64_t)0x0))));
*out1 = x1;
}
/*
* The function fiat_secp256k1_selectznz 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]]
*/
static void fiat_secp256k1_selectznz(uint64_t out1[4], fiat_secp256k1_uint1 arg1, const uint64_t arg2[4], const uint64_t arg3[4]) {
uint64_t x1;
fiat_secp256k1_cmovznz_u64(&x1, arg1, (arg2[0]), (arg3[0]));
uint64_t x2;
fiat_secp256k1_cmovznz_u64(&x2, arg1, (arg2[1]), (arg3[1]));
uint64_t x3;
fiat_secp256k1_cmovznz_u64(&x3, arg1, (arg2[2]), (arg3[2]));
uint64_t x4;
fiat_secp256k1_cmovznz_u64(&x4, arg1, (arg2[3]), (arg3[3]));
out1[0] = x1;
out1[1] = x2;
out1[2] = x3;
out1[3] = x4;
}
/*
* The function fiat_secp256k1_to_bytes serializes a field element 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..31]
*
* Input Bounds:
* arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* 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], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
*/
static void fiat_secp256k1_to_bytes(uint8_t out1[32], const uint64_t arg1[4]) {
uint64_t x1 = (arg1[3]);
uint64_t x2 = (arg1[2]);
uint64_t x3 = (arg1[1]);
uint64_t x4 = (arg1[0]);
uint64_t x5 = (x4 >> 8);
uint8_t x6 = (uint8_t)(x4 & UINT8_C(0xff));
uint64_t x7 = (x5 >> 8);
uint8_t x8 = (uint8_t)(x5 & UINT8_C(0xff));
uint64_t x9 = (x7 >> 8);
uint8_t x10 = (uint8_t)(x7 & UINT8_C(0xff));
uint64_t x11 = (x9 >> 8);
uint8_t x12 = (uint8_t)(x9 & UINT8_C(0xff));
uint64_t x13 = (x11 >> 8);
uint8_t x14 = (uint8_t)(x11 & UINT8_C(0xff));
uint64_t x15 = (x13 >> 8);
uint8_t x16 = (uint8_t)(x13 & UINT8_C(0xff));
uint8_t x17 = (uint8_t)(x15 >> 8);
uint8_t x18 = (uint8_t)(x15 & UINT8_C(0xff));
uint8_t x19 = (uint8_t)(x17 & UINT8_C(0xff));
uint64_t x20 = (x3 >> 8);
uint8_t x21 = (uint8_t)(x3 & UINT8_C(0xff));
uint64_t x22 = (x20 >> 8);
uint8_t x23 = (uint8_t)(x20 & UINT8_C(0xff));
uint64_t x24 = (x22 >> 8);
uint8_t x25 = (uint8_t)(x22 & UINT8_C(0xff));
uint64_t x26 = (x24 >> 8);
uint8_t x27 = (uint8_t)(x24 & UINT8_C(0xff));
uint64_t x28 = (x26 >> 8);
uint8_t x29 = (uint8_t)(x26 & UINT8_C(0xff));
uint64_t x30 = (x28 >> 8);
uint8_t x31 = (uint8_t)(x28 & UINT8_C(0xff));
uint8_t x32 = (uint8_t)(x30 >> 8);
uint8_t x33 = (uint8_t)(x30 & UINT8_C(0xff));
uint8_t x34 = (uint8_t)(x32 & UINT8_C(0xff));
uint64_t x35 = (x2 >> 8);
uint8_t x36 = (uint8_t)(x2 & UINT8_C(0xff));
uint64_t x37 = (x35 >> 8);
uint8_t x38 = (uint8_t)(x35 & UINT8_C(0xff));
uint64_t x39 = (x37 >> 8);
uint8_t x40 = (uint8_t)(x37 & UINT8_C(0xff));
uint64_t x41 = (x39 >> 8);
uint8_t x42 = (uint8_t)(x39 & UINT8_C(0xff));
uint64_t x43 = (x41 >> 8);
uint8_t x44 = (uint8_t)(x41 & UINT8_C(0xff));
uint64_t x45 = (x43 >> 8);
uint8_t x46 = (uint8_t)(x43 & UINT8_C(0xff));
uint8_t x47 = (uint8_t)(x45 >> 8);
uint8_t x48 = (uint8_t)(x45 & UINT8_C(0xff));
uint8_t x49 = (uint8_t)(x47 & UINT8_C(0xff));
uint64_t x50 = (x1 >> 8);
uint8_t x51 = (uint8_t)(x1 & UINT8_C(0xff));
uint64_t x52 = (x50 >> 8);
uint8_t x53 = (uint8_t)(x50 & UINT8_C(0xff));
uint64_t x54 = (x52 >> 8);
uint8_t x55 = (uint8_t)(x52 & UINT8_C(0xff));
uint64_t x56 = (x54 >> 8);
uint8_t x57 = (uint8_t)(x54 & UINT8_C(0xff));
uint64_t x58 = (x56 >> 8);
uint8_t x59 = (uint8_t)(x56 & UINT8_C(0xff));
uint64_t x60 = (x58 >> 8);
uint8_t x61 = (uint8_t)(x58 & UINT8_C(0xff));
uint8_t x62 = (uint8_t)(x60 >> 8);
uint8_t x63 = (uint8_t)(x60 & UINT8_C(0xff));
out1[0] = x6;
out1[1] = x8;
out1[2] = x10;
out1[3] = x12;
out1[4] = x14;
out1[5] = x16;
out1[6] = x18;
out1[7] = x19;
out1[8] = x21;
out1[9] = x23;
out1[10] = x25;
out1[11] = x27;
out1[12] = x29;
out1[13] = x31;
out1[14] = x33;
out1[15] = x34;
out1[16] = x36;
out1[17] = x38;
out1[18] = x40;
out1[19] = x42;
out1[20] = x44;
out1[21] = x46;
out1[22] = x48;
out1[23] = x49;
out1[24] = x51;
out1[25] = x53;
out1[26] = x55;
out1[27] = x57;
out1[28] = x59;
out1[29] = x61;
out1[30] = x63;
out1[31] = x62;
}
/*
* The function fiat_secp256k1_from_bytes deserializes a field element 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], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
* Output Bounds:
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_secp256k1_from_bytes(uint64_t out1[4], const uint8_t arg1[32]) {
uint64_t x1 = ((uint64_t)(arg1[31]) << 56);
uint64_t x2 = ((uint64_t)(arg1[30]) << 48);
uint64_t x3 = ((uint64_t)(arg1[29]) << 40);
uint64_t x4 = ((uint64_t)(arg1[28]) << 32);
uint64_t x5 = ((uint64_t)(arg1[27]) << 24);
uint64_t x6 = ((uint64_t)(arg1[26]) << 16);
uint64_t x7 = ((uint64_t)(arg1[25]) << 8);
uint8_t x8 = (arg1[24]);
uint64_t x9 = ((uint64_t)(arg1[23]) << 56);
uint64_t x10 = ((uint64_t)(arg1[22]) << 48);
uint64_t x11 = ((uint64_t)(arg1[21]) << 40);
uint64_t x12 = ((uint64_t)(arg1[20]) << 32);
uint64_t x13 = ((uint64_t)(arg1[19]) << 24);
uint64_t x14 = ((uint64_t)(arg1[18]) << 16);
uint64_t x15 = ((uint64_t)(arg1[17]) << 8);
uint8_t x16 = (arg1[16]);
uint64_t x17 = ((uint64_t)(arg1[15]) << 56);
uint64_t x18 = ((uint64_t)(arg1[14]) << 48);
uint64_t x19 = ((uint64_t)(arg1[13]) << 40);
uint64_t x20 = ((uint64_t)(arg1[12]) << 32);
uint64_t x21 = ((uint64_t)(arg1[11]) << 24);
uint64_t x22 = ((uint64_t)(arg1[10]) << 16);
uint64_t x23 = ((uint64_t)(arg1[9]) << 8);
uint8_t x24 = (arg1[8]);
uint64_t x25 = ((uint64_t)(arg1[7]) << 56);
uint64_t x26 = ((uint64_t)(arg1[6]) << 48);
uint64_t x27 = ((uint64_t)(arg1[5]) << 40);
uint64_t x28 = ((uint64_t)(arg1[4]) << 32);
uint64_t x29 = ((uint64_t)(arg1[3]) << 24);
uint64_t x30 = ((uint64_t)(arg1[2]) << 16);
uint64_t x31 = ((uint64_t)(arg1[1]) << 8);
uint8_t x32 = (arg1[0]);
uint64_t x33 = (x32 + (x31 + (x30 + (x29 + (x28 + (x27 + (x26 + x25)))))));
uint64_t x34 = (x33 & UINT64_C(0xffffffffffffffff));
uint64_t x35 = (x8 + (x7 + (x6 + (x5 + (x4 + (x3 + (x2 + x1)))))));
uint64_t x36 = (x16 + (x15 + (x14 + (x13 + (x12 + (x11 + (x10 + x9)))))));
uint64_t x37 = (x24 + (x23 + (x22 + (x21 + (x20 + (x19 + (x18 + x17)))))));
uint64_t x38 = (x37 & UINT64_C(0xffffffffffffffff));
uint64_t x39 = (x36 & UINT64_C(0xffffffffffffffff));
out1[0] = x34;
out1[1] = x38;
out1[2] = x39;
out1[3] = x35;
}
|