-
Notifications
You must be signed in to change notification settings - Fork 146
/
p434_64.c
4818 lines (4792 loc) · 156 KB
/
p434_64.c
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
/* Autogenerated: 'src/ExtractionOCaml/word_by_word_montgomery' --inline --static --use-value-barrier p434 64 '2^216 * 3^137 - 1' mul square add sub opp from_montgomery to_montgomery nonzero selectznz to_bytes from_bytes one msat divstep divstep_precomp */
/* curve description: p434 */
/* machine_wordsize = 64 (from "64") */
/* requested operations: mul, square, add, sub, opp, from_montgomery, to_montgomery, nonzero, selectznz, to_bytes, from_bytes, one, msat, divstep, divstep_precomp */
/* m = 0x2341f271773446cfc5fd681c520567bc65c783158aea3fdc1767ae2ffffffffffffffffffffffffffffffffffffffffffffffffffffff (from "2^216 * 3^137 - 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) + (z[4] << 256) + (z[5] << 0x140) + (z[6] << 0x180) */
/* 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) + (z[28] << 224) + (z[29] << 232) + (z[30] << 240) + (z[31] << 248) + (z[32] << 256) + (z[33] << 0x108) + (z[34] << 0x110) + (z[35] << 0x118) + (z[36] << 0x120) + (z[37] << 0x128) + (z[38] << 0x130) + (z[39] << 0x138) + (z[40] << 0x140) + (z[41] << 0x148) + (z[42] << 0x150) + (z[43] << 0x158) + (z[44] << 0x160) + (z[45] << 0x168) + (z[46] << 0x170) + (z[47] << 0x178) + (z[48] << 0x180) + (z[49] << 0x188) + (z[50] << 0x190) + (z[51] << 0x198) + (z[52] << 0x1a0) + (z[53] << 0x1a8) + (z[54] << 0x1b0) */
/* twos_complement_eval z = let x1 := z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) + (z[4] << 256) + (z[5] << 0x140) + (z[6] << 0x180) in */
/* if x1 & (2^448-1) < 2^447 then x1 & (2^448-1) else (x1 & (2^448-1)) - 2^448 */
#include <stdint.h>
typedef unsigned char fiat_p434_uint1;
typedef signed char fiat_p434_int1;
#if defined(__GNUC__) || defined(__clang__)
# define FIAT_P434_FIAT_EXTENSION __extension__
# define FIAT_P434_FIAT_INLINE __inline__
#else
# define FIAT_P434_FIAT_EXTENSION
# define FIAT_P434_FIAT_INLINE
#endif
FIAT_P434_FIAT_EXTENSION typedef signed __int128 fiat_p434_int128;
FIAT_P434_FIAT_EXTENSION typedef unsigned __int128 fiat_p434_uint128;
/* The type fiat_p434_montgomery_domain_field_element is a field element in the Montgomery domain. */
/* Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */
typedef uint64_t fiat_p434_montgomery_domain_field_element[7];
/* The type fiat_p434_non_montgomery_domain_field_element is a field element NOT in the Montgomery domain. */
/* Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */
typedef uint64_t fiat_p434_non_montgomery_domain_field_element[7];
#if (-1 & 3) != 3
#error "This code only works on a two's complement system"
#endif
#if !defined(FIAT_P434_NO_ASM) && (defined(__GNUC__) || defined(__clang__))
static __inline__ uint64_t fiat_p434_value_barrier_u64(uint64_t a) {
__asm__("" : "+r"(a) : /* no inputs */);
return a;
}
#else
# define fiat_p434_value_barrier_u64(x) (x)
#endif
/*
* The function fiat_p434_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 FIAT_P434_FIAT_INLINE void fiat_p434_addcarryx_u64(uint64_t* out1, fiat_p434_uint1* out2, fiat_p434_uint1 arg1, uint64_t arg2, uint64_t arg3) {
fiat_p434_uint128 x1;
uint64_t x2;
fiat_p434_uint1 x3;
x1 = ((arg1 + (fiat_p434_uint128)arg2) + arg3);
x2 = (uint64_t)(x1 & UINT64_C(0xffffffffffffffff));
x3 = (fiat_p434_uint1)(x1 >> 64);
*out1 = x2;
*out2 = x3;
}
/*
* The function fiat_p434_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 FIAT_P434_FIAT_INLINE void fiat_p434_subborrowx_u64(uint64_t* out1, fiat_p434_uint1* out2, fiat_p434_uint1 arg1, uint64_t arg2, uint64_t arg3) {
fiat_p434_int128 x1;
fiat_p434_int1 x2;
uint64_t x3;
x1 = ((arg2 - (fiat_p434_int128)arg1) - arg3);
x2 = (fiat_p434_int1)(x1 >> 64);
x3 = (uint64_t)(x1 & UINT64_C(0xffffffffffffffff));
*out1 = x3;
*out2 = (fiat_p434_uint1)(0x0 - x2);
}
/*
* The function fiat_p434_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 FIAT_P434_FIAT_INLINE void fiat_p434_mulx_u64(uint64_t* out1, uint64_t* out2, uint64_t arg1, uint64_t arg2) {
fiat_p434_uint128 x1;
uint64_t x2;
uint64_t x3;
x1 = ((fiat_p434_uint128)arg1 * arg2);
x2 = (uint64_t)(x1 & UINT64_C(0xffffffffffffffff));
x3 = (uint64_t)(x1 >> 64);
*out1 = x2;
*out2 = x3;
}
/*
* The function fiat_p434_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 FIAT_P434_FIAT_INLINE void fiat_p434_cmovznz_u64(uint64_t* out1, fiat_p434_uint1 arg1, uint64_t arg2, uint64_t arg3) {
fiat_p434_uint1 x1;
uint64_t x2;
uint64_t x3;
x1 = (!(!arg1));
x2 = ((fiat_p434_int1)(0x0 - x1) & UINT64_C(0xffffffffffffffff));
x3 = ((fiat_p434_value_barrier_u64(x2) & arg3) | (fiat_p434_value_barrier_u64((~x2)) & arg2));
*out1 = x3;
}
/*
* The function fiat_p434_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
*
*/
static FIAT_P434_FIAT_INLINE void fiat_p434_mul(fiat_p434_montgomery_domain_field_element out1, const fiat_p434_montgomery_domain_field_element arg1, const fiat_p434_montgomery_domain_field_element arg2) {
uint64_t x1;
uint64_t x2;
uint64_t x3;
uint64_t x4;
uint64_t x5;
uint64_t x6;
uint64_t x7;
uint64_t x8;
uint64_t x9;
uint64_t x10;
uint64_t x11;
uint64_t x12;
uint64_t x13;
uint64_t x14;
uint64_t x15;
uint64_t x16;
uint64_t x17;
uint64_t x18;
uint64_t x19;
uint64_t x20;
uint64_t x21;
uint64_t x22;
fiat_p434_uint1 x23;
uint64_t x24;
fiat_p434_uint1 x25;
uint64_t x26;
fiat_p434_uint1 x27;
uint64_t x28;
fiat_p434_uint1 x29;
uint64_t x30;
fiat_p434_uint1 x31;
uint64_t x32;
fiat_p434_uint1 x33;
uint64_t x34;
uint64_t x35;
uint64_t x36;
uint64_t x37;
uint64_t x38;
uint64_t x39;
uint64_t x40;
uint64_t x41;
uint64_t x42;
uint64_t x43;
uint64_t x44;
uint64_t x45;
uint64_t x46;
uint64_t x47;
uint64_t x48;
uint64_t x49;
fiat_p434_uint1 x50;
uint64_t x51;
fiat_p434_uint1 x52;
uint64_t x53;
fiat_p434_uint1 x54;
uint64_t x55;
fiat_p434_uint1 x56;
uint64_t x57;
fiat_p434_uint1 x58;
uint64_t x59;
fiat_p434_uint1 x60;
uint64_t x61;
uint64_t x62;
fiat_p434_uint1 x63;
uint64_t x64;
fiat_p434_uint1 x65;
uint64_t x66;
fiat_p434_uint1 x67;
uint64_t x68;
fiat_p434_uint1 x69;
uint64_t x70;
fiat_p434_uint1 x71;
uint64_t x72;
fiat_p434_uint1 x73;
uint64_t x74;
fiat_p434_uint1 x75;
uint64_t x76;
fiat_p434_uint1 x77;
uint64_t x78;
uint64_t x79;
uint64_t x80;
uint64_t x81;
uint64_t x82;
uint64_t x83;
uint64_t x84;
uint64_t x85;
uint64_t x86;
uint64_t x87;
uint64_t x88;
uint64_t x89;
uint64_t x90;
uint64_t x91;
uint64_t x92;
fiat_p434_uint1 x93;
uint64_t x94;
fiat_p434_uint1 x95;
uint64_t x96;
fiat_p434_uint1 x97;
uint64_t x98;
fiat_p434_uint1 x99;
uint64_t x100;
fiat_p434_uint1 x101;
uint64_t x102;
fiat_p434_uint1 x103;
uint64_t x104;
uint64_t x105;
fiat_p434_uint1 x106;
uint64_t x107;
fiat_p434_uint1 x108;
uint64_t x109;
fiat_p434_uint1 x110;
uint64_t x111;
fiat_p434_uint1 x112;
uint64_t x113;
fiat_p434_uint1 x114;
uint64_t x115;
fiat_p434_uint1 x116;
uint64_t x117;
fiat_p434_uint1 x118;
uint64_t x119;
fiat_p434_uint1 x120;
uint64_t x121;
uint64_t x122;
uint64_t x123;
uint64_t x124;
uint64_t x125;
uint64_t x126;
uint64_t x127;
uint64_t x128;
uint64_t x129;
uint64_t x130;
uint64_t x131;
uint64_t x132;
uint64_t x133;
uint64_t x134;
uint64_t x135;
fiat_p434_uint1 x136;
uint64_t x137;
fiat_p434_uint1 x138;
uint64_t x139;
fiat_p434_uint1 x140;
uint64_t x141;
fiat_p434_uint1 x142;
uint64_t x143;
fiat_p434_uint1 x144;
uint64_t x145;
fiat_p434_uint1 x146;
uint64_t x147;
uint64_t x148;
fiat_p434_uint1 x149;
uint64_t x150;
fiat_p434_uint1 x151;
uint64_t x152;
fiat_p434_uint1 x153;
uint64_t x154;
fiat_p434_uint1 x155;
uint64_t x156;
fiat_p434_uint1 x157;
uint64_t x158;
fiat_p434_uint1 x159;
uint64_t x160;
fiat_p434_uint1 x161;
uint64_t x162;
fiat_p434_uint1 x163;
uint64_t x164;
uint64_t x165;
uint64_t x166;
uint64_t x167;
uint64_t x168;
uint64_t x169;
uint64_t x170;
uint64_t x171;
uint64_t x172;
uint64_t x173;
uint64_t x174;
uint64_t x175;
uint64_t x176;
uint64_t x177;
uint64_t x178;
uint64_t x179;
fiat_p434_uint1 x180;
uint64_t x181;
fiat_p434_uint1 x182;
uint64_t x183;
fiat_p434_uint1 x184;
uint64_t x185;
fiat_p434_uint1 x186;
uint64_t x187;
fiat_p434_uint1 x188;
uint64_t x189;
fiat_p434_uint1 x190;
uint64_t x191;
uint64_t x192;
fiat_p434_uint1 x193;
uint64_t x194;
fiat_p434_uint1 x195;
uint64_t x196;
fiat_p434_uint1 x197;
uint64_t x198;
fiat_p434_uint1 x199;
uint64_t x200;
fiat_p434_uint1 x201;
uint64_t x202;
fiat_p434_uint1 x203;
uint64_t x204;
fiat_p434_uint1 x205;
uint64_t x206;
fiat_p434_uint1 x207;
uint64_t x208;
uint64_t x209;
uint64_t x210;
uint64_t x211;
uint64_t x212;
uint64_t x213;
uint64_t x214;
uint64_t x215;
uint64_t x216;
uint64_t x217;
uint64_t x218;
uint64_t x219;
uint64_t x220;
uint64_t x221;
uint64_t x222;
fiat_p434_uint1 x223;
uint64_t x224;
fiat_p434_uint1 x225;
uint64_t x226;
fiat_p434_uint1 x227;
uint64_t x228;
fiat_p434_uint1 x229;
uint64_t x230;
fiat_p434_uint1 x231;
uint64_t x232;
fiat_p434_uint1 x233;
uint64_t x234;
uint64_t x235;
fiat_p434_uint1 x236;
uint64_t x237;
fiat_p434_uint1 x238;
uint64_t x239;
fiat_p434_uint1 x240;
uint64_t x241;
fiat_p434_uint1 x242;
uint64_t x243;
fiat_p434_uint1 x244;
uint64_t x245;
fiat_p434_uint1 x246;
uint64_t x247;
fiat_p434_uint1 x248;
uint64_t x249;
fiat_p434_uint1 x250;
uint64_t x251;
uint64_t x252;
uint64_t x253;
uint64_t x254;
uint64_t x255;
uint64_t x256;
uint64_t x257;
uint64_t x258;
uint64_t x259;
uint64_t x260;
uint64_t x261;
uint64_t x262;
uint64_t x263;
uint64_t x264;
uint64_t x265;
uint64_t x266;
fiat_p434_uint1 x267;
uint64_t x268;
fiat_p434_uint1 x269;
uint64_t x270;
fiat_p434_uint1 x271;
uint64_t x272;
fiat_p434_uint1 x273;
uint64_t x274;
fiat_p434_uint1 x275;
uint64_t x276;
fiat_p434_uint1 x277;
uint64_t x278;
uint64_t x279;
fiat_p434_uint1 x280;
uint64_t x281;
fiat_p434_uint1 x282;
uint64_t x283;
fiat_p434_uint1 x284;
uint64_t x285;
fiat_p434_uint1 x286;
uint64_t x287;
fiat_p434_uint1 x288;
uint64_t x289;
fiat_p434_uint1 x290;
uint64_t x291;
fiat_p434_uint1 x292;
uint64_t x293;
fiat_p434_uint1 x294;
uint64_t x295;
uint64_t x296;
uint64_t x297;
uint64_t x298;
uint64_t x299;
uint64_t x300;
uint64_t x301;
uint64_t x302;
uint64_t x303;
uint64_t x304;
uint64_t x305;
uint64_t x306;
uint64_t x307;
uint64_t x308;
uint64_t x309;
fiat_p434_uint1 x310;
uint64_t x311;
fiat_p434_uint1 x312;
uint64_t x313;
fiat_p434_uint1 x314;
uint64_t x315;
fiat_p434_uint1 x316;
uint64_t x317;
fiat_p434_uint1 x318;
uint64_t x319;
fiat_p434_uint1 x320;
uint64_t x321;
uint64_t x322;
fiat_p434_uint1 x323;
uint64_t x324;
fiat_p434_uint1 x325;
uint64_t x326;
fiat_p434_uint1 x327;
uint64_t x328;
fiat_p434_uint1 x329;
uint64_t x330;
fiat_p434_uint1 x331;
uint64_t x332;
fiat_p434_uint1 x333;
uint64_t x334;
fiat_p434_uint1 x335;
uint64_t x336;
fiat_p434_uint1 x337;
uint64_t x338;
uint64_t x339;
uint64_t x340;
uint64_t x341;
uint64_t x342;
uint64_t x343;
uint64_t x344;
uint64_t x345;
uint64_t x346;
uint64_t x347;
uint64_t x348;
uint64_t x349;
uint64_t x350;
uint64_t x351;
uint64_t x352;
uint64_t x353;
fiat_p434_uint1 x354;
uint64_t x355;
fiat_p434_uint1 x356;
uint64_t x357;
fiat_p434_uint1 x358;
uint64_t x359;
fiat_p434_uint1 x360;
uint64_t x361;
fiat_p434_uint1 x362;
uint64_t x363;
fiat_p434_uint1 x364;
uint64_t x365;
uint64_t x366;
fiat_p434_uint1 x367;
uint64_t x368;
fiat_p434_uint1 x369;
uint64_t x370;
fiat_p434_uint1 x371;
uint64_t x372;
fiat_p434_uint1 x373;
uint64_t x374;
fiat_p434_uint1 x375;
uint64_t x376;
fiat_p434_uint1 x377;
uint64_t x378;
fiat_p434_uint1 x379;
uint64_t x380;
fiat_p434_uint1 x381;
uint64_t x382;
uint64_t x383;
uint64_t x384;
uint64_t x385;
uint64_t x386;
uint64_t x387;
uint64_t x388;
uint64_t x389;
uint64_t x390;
uint64_t x391;
uint64_t x392;
uint64_t x393;
uint64_t x394;
uint64_t x395;
uint64_t x396;
fiat_p434_uint1 x397;
uint64_t x398;
fiat_p434_uint1 x399;
uint64_t x400;
fiat_p434_uint1 x401;
uint64_t x402;
fiat_p434_uint1 x403;
uint64_t x404;
fiat_p434_uint1 x405;
uint64_t x406;
fiat_p434_uint1 x407;
uint64_t x408;
uint64_t x409;
fiat_p434_uint1 x410;
uint64_t x411;
fiat_p434_uint1 x412;
uint64_t x413;
fiat_p434_uint1 x414;
uint64_t x415;
fiat_p434_uint1 x416;
uint64_t x417;
fiat_p434_uint1 x418;
uint64_t x419;
fiat_p434_uint1 x420;
uint64_t x421;
fiat_p434_uint1 x422;
uint64_t x423;
fiat_p434_uint1 x424;
uint64_t x425;
uint64_t x426;
uint64_t x427;
uint64_t x428;
uint64_t x429;
uint64_t x430;
uint64_t x431;
uint64_t x432;
uint64_t x433;
uint64_t x434;
uint64_t x435;
uint64_t x436;
uint64_t x437;
uint64_t x438;
uint64_t x439;
uint64_t x440;
fiat_p434_uint1 x441;
uint64_t x442;
fiat_p434_uint1 x443;
uint64_t x444;
fiat_p434_uint1 x445;
uint64_t x446;
fiat_p434_uint1 x447;
uint64_t x448;
fiat_p434_uint1 x449;
uint64_t x450;
fiat_p434_uint1 x451;
uint64_t x452;
uint64_t x453;
fiat_p434_uint1 x454;
uint64_t x455;
fiat_p434_uint1 x456;
uint64_t x457;
fiat_p434_uint1 x458;
uint64_t x459;
fiat_p434_uint1 x460;
uint64_t x461;
fiat_p434_uint1 x462;
uint64_t x463;
fiat_p434_uint1 x464;
uint64_t x465;
fiat_p434_uint1 x466;
uint64_t x467;
fiat_p434_uint1 x468;
uint64_t x469;
uint64_t x470;
uint64_t x471;
uint64_t x472;
uint64_t x473;
uint64_t x474;
uint64_t x475;
uint64_t x476;
uint64_t x477;
uint64_t x478;
uint64_t x479;
uint64_t x480;
uint64_t x481;
uint64_t x482;
uint64_t x483;
fiat_p434_uint1 x484;
uint64_t x485;
fiat_p434_uint1 x486;
uint64_t x487;
fiat_p434_uint1 x488;
uint64_t x489;
fiat_p434_uint1 x490;
uint64_t x491;
fiat_p434_uint1 x492;
uint64_t x493;
fiat_p434_uint1 x494;
uint64_t x495;
uint64_t x496;
fiat_p434_uint1 x497;
uint64_t x498;
fiat_p434_uint1 x499;
uint64_t x500;
fiat_p434_uint1 x501;
uint64_t x502;
fiat_p434_uint1 x503;
uint64_t x504;
fiat_p434_uint1 x505;
uint64_t x506;
fiat_p434_uint1 x507;
uint64_t x508;
fiat_p434_uint1 x509;
uint64_t x510;
fiat_p434_uint1 x511;
uint64_t x512;
uint64_t x513;
uint64_t x514;
uint64_t x515;
uint64_t x516;
uint64_t x517;
uint64_t x518;
uint64_t x519;
uint64_t x520;
uint64_t x521;
uint64_t x522;
uint64_t x523;
uint64_t x524;
uint64_t x525;
uint64_t x526;
uint64_t x527;
fiat_p434_uint1 x528;
uint64_t x529;
fiat_p434_uint1 x530;
uint64_t x531;
fiat_p434_uint1 x532;
uint64_t x533;
fiat_p434_uint1 x534;
uint64_t x535;
fiat_p434_uint1 x536;
uint64_t x537;
fiat_p434_uint1 x538;
uint64_t x539;
uint64_t x540;
fiat_p434_uint1 x541;
uint64_t x542;
fiat_p434_uint1 x543;
uint64_t x544;
fiat_p434_uint1 x545;
uint64_t x546;
fiat_p434_uint1 x547;
uint64_t x548;
fiat_p434_uint1 x549;
uint64_t x550;
fiat_p434_uint1 x551;
uint64_t x552;
fiat_p434_uint1 x553;
uint64_t x554;
fiat_p434_uint1 x555;
uint64_t x556;
uint64_t x557;
uint64_t x558;
uint64_t x559;
uint64_t x560;
uint64_t x561;
uint64_t x562;
uint64_t x563;
uint64_t x564;
uint64_t x565;
uint64_t x566;
uint64_t x567;
uint64_t x568;
uint64_t x569;
uint64_t x570;
fiat_p434_uint1 x571;
uint64_t x572;
fiat_p434_uint1 x573;
uint64_t x574;
fiat_p434_uint1 x575;
uint64_t x576;
fiat_p434_uint1 x577;
uint64_t x578;
fiat_p434_uint1 x579;
uint64_t x580;
fiat_p434_uint1 x581;
uint64_t x582;
uint64_t x583;
fiat_p434_uint1 x584;
uint64_t x585;
fiat_p434_uint1 x586;
uint64_t x587;
fiat_p434_uint1 x588;
uint64_t x589;
fiat_p434_uint1 x590;
uint64_t x591;
fiat_p434_uint1 x592;
uint64_t x593;
fiat_p434_uint1 x594;
uint64_t x595;
fiat_p434_uint1 x596;
uint64_t x597;
fiat_p434_uint1 x598;
uint64_t x599;
uint64_t x600;
fiat_p434_uint1 x601;
uint64_t x602;
fiat_p434_uint1 x603;
uint64_t x604;
fiat_p434_uint1 x605;
uint64_t x606;
fiat_p434_uint1 x607;
uint64_t x608;
fiat_p434_uint1 x609;
uint64_t x610;
fiat_p434_uint1 x611;
uint64_t x612;
fiat_p434_uint1 x613;
uint64_t x614;
fiat_p434_uint1 x615;
uint64_t x616;
uint64_t x617;
uint64_t x618;
uint64_t x619;
uint64_t x620;
uint64_t x621;
uint64_t x622;
x1 = (arg1[1]);
x2 = (arg1[2]);
x3 = (arg1[3]);
x4 = (arg1[4]);
x5 = (arg1[5]);
x6 = (arg1[6]);
x7 = (arg1[0]);
fiat_p434_mulx_u64(&x8, &x9, x7, (arg2[6]));
fiat_p434_mulx_u64(&x10, &x11, x7, (arg2[5]));
fiat_p434_mulx_u64(&x12, &x13, x7, (arg2[4]));
fiat_p434_mulx_u64(&x14, &x15, x7, (arg2[3]));
fiat_p434_mulx_u64(&x16, &x17, x7, (arg2[2]));
fiat_p434_mulx_u64(&x18, &x19, x7, (arg2[1]));
fiat_p434_mulx_u64(&x20, &x21, x7, (arg2[0]));
fiat_p434_addcarryx_u64(&x22, &x23, 0x0, x21, x18);
fiat_p434_addcarryx_u64(&x24, &x25, x23, x19, x16);
fiat_p434_addcarryx_u64(&x26, &x27, x25, x17, x14);
fiat_p434_addcarryx_u64(&x28, &x29, x27, x15, x12);
fiat_p434_addcarryx_u64(&x30, &x31, x29, x13, x10);
fiat_p434_addcarryx_u64(&x32, &x33, x31, x11, x8);
x34 = (x33 + x9);
fiat_p434_mulx_u64(&x35, &x36, x20, UINT64_C(0x2341f27177344));
fiat_p434_mulx_u64(&x37, &x38, x20, UINT64_C(0x6cfc5fd681c52056));
fiat_p434_mulx_u64(&x39, &x40, x20, UINT64_C(0x7bc65c783158aea3));
fiat_p434_mulx_u64(&x41, &x42, x20, UINT64_C(0xfdc1767ae2ffffff));
fiat_p434_mulx_u64(&x43, &x44, x20, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x45, &x46, x20, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x47, &x48, x20, UINT64_C(0xffffffffffffffff));
fiat_p434_addcarryx_u64(&x49, &x50, 0x0, x48, x45);
fiat_p434_addcarryx_u64(&x51, &x52, x50, x46, x43);
fiat_p434_addcarryx_u64(&x53, &x54, x52, x44, x41);
fiat_p434_addcarryx_u64(&x55, &x56, x54, x42, x39);
fiat_p434_addcarryx_u64(&x57, &x58, x56, x40, x37);
fiat_p434_addcarryx_u64(&x59, &x60, x58, x38, x35);
x61 = (x60 + x36);
fiat_p434_addcarryx_u64(&x62, &x63, 0x0, x20, x47);
fiat_p434_addcarryx_u64(&x64, &x65, x63, x22, x49);
fiat_p434_addcarryx_u64(&x66, &x67, x65, x24, x51);
fiat_p434_addcarryx_u64(&x68, &x69, x67, x26, x53);
fiat_p434_addcarryx_u64(&x70, &x71, x69, x28, x55);
fiat_p434_addcarryx_u64(&x72, &x73, x71, x30, x57);
fiat_p434_addcarryx_u64(&x74, &x75, x73, x32, x59);
fiat_p434_addcarryx_u64(&x76, &x77, x75, x34, x61);
fiat_p434_mulx_u64(&x78, &x79, x1, (arg2[6]));
fiat_p434_mulx_u64(&x80, &x81, x1, (arg2[5]));
fiat_p434_mulx_u64(&x82, &x83, x1, (arg2[4]));
fiat_p434_mulx_u64(&x84, &x85, x1, (arg2[3]));
fiat_p434_mulx_u64(&x86, &x87, x1, (arg2[2]));
fiat_p434_mulx_u64(&x88, &x89, x1, (arg2[1]));
fiat_p434_mulx_u64(&x90, &x91, x1, (arg2[0]));
fiat_p434_addcarryx_u64(&x92, &x93, 0x0, x91, x88);
fiat_p434_addcarryx_u64(&x94, &x95, x93, x89, x86);
fiat_p434_addcarryx_u64(&x96, &x97, x95, x87, x84);
fiat_p434_addcarryx_u64(&x98, &x99, x97, x85, x82);
fiat_p434_addcarryx_u64(&x100, &x101, x99, x83, x80);
fiat_p434_addcarryx_u64(&x102, &x103, x101, x81, x78);
x104 = (x103 + x79);
fiat_p434_addcarryx_u64(&x105, &x106, 0x0, x64, x90);
fiat_p434_addcarryx_u64(&x107, &x108, x106, x66, x92);
fiat_p434_addcarryx_u64(&x109, &x110, x108, x68, x94);
fiat_p434_addcarryx_u64(&x111, &x112, x110, x70, x96);
fiat_p434_addcarryx_u64(&x113, &x114, x112, x72, x98);
fiat_p434_addcarryx_u64(&x115, &x116, x114, x74, x100);
fiat_p434_addcarryx_u64(&x117, &x118, x116, x76, x102);
fiat_p434_addcarryx_u64(&x119, &x120, x118, x77, x104);
fiat_p434_mulx_u64(&x121, &x122, x105, UINT64_C(0x2341f27177344));
fiat_p434_mulx_u64(&x123, &x124, x105, UINT64_C(0x6cfc5fd681c52056));
fiat_p434_mulx_u64(&x125, &x126, x105, UINT64_C(0x7bc65c783158aea3));
fiat_p434_mulx_u64(&x127, &x128, x105, UINT64_C(0xfdc1767ae2ffffff));
fiat_p434_mulx_u64(&x129, &x130, x105, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x131, &x132, x105, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x133, &x134, x105, UINT64_C(0xffffffffffffffff));
fiat_p434_addcarryx_u64(&x135, &x136, 0x0, x134, x131);
fiat_p434_addcarryx_u64(&x137, &x138, x136, x132, x129);
fiat_p434_addcarryx_u64(&x139, &x140, x138, x130, x127);
fiat_p434_addcarryx_u64(&x141, &x142, x140, x128, x125);
fiat_p434_addcarryx_u64(&x143, &x144, x142, x126, x123);
fiat_p434_addcarryx_u64(&x145, &x146, x144, x124, x121);
x147 = (x146 + x122);
fiat_p434_addcarryx_u64(&x148, &x149, 0x0, x105, x133);
fiat_p434_addcarryx_u64(&x150, &x151, x149, x107, x135);
fiat_p434_addcarryx_u64(&x152, &x153, x151, x109, x137);
fiat_p434_addcarryx_u64(&x154, &x155, x153, x111, x139);
fiat_p434_addcarryx_u64(&x156, &x157, x155, x113, x141);
fiat_p434_addcarryx_u64(&x158, &x159, x157, x115, x143);
fiat_p434_addcarryx_u64(&x160, &x161, x159, x117, x145);
fiat_p434_addcarryx_u64(&x162, &x163, x161, x119, x147);
x164 = ((uint64_t)x163 + x120);
fiat_p434_mulx_u64(&x165, &x166, x2, (arg2[6]));
fiat_p434_mulx_u64(&x167, &x168, x2, (arg2[5]));
fiat_p434_mulx_u64(&x169, &x170, x2, (arg2[4]));
fiat_p434_mulx_u64(&x171, &x172, x2, (arg2[3]));
fiat_p434_mulx_u64(&x173, &x174, x2, (arg2[2]));
fiat_p434_mulx_u64(&x175, &x176, x2, (arg2[1]));
fiat_p434_mulx_u64(&x177, &x178, x2, (arg2[0]));
fiat_p434_addcarryx_u64(&x179, &x180, 0x0, x178, x175);
fiat_p434_addcarryx_u64(&x181, &x182, x180, x176, x173);
fiat_p434_addcarryx_u64(&x183, &x184, x182, x174, x171);
fiat_p434_addcarryx_u64(&x185, &x186, x184, x172, x169);
fiat_p434_addcarryx_u64(&x187, &x188, x186, x170, x167);
fiat_p434_addcarryx_u64(&x189, &x190, x188, x168, x165);
x191 = (x190 + x166);
fiat_p434_addcarryx_u64(&x192, &x193, 0x0, x150, x177);
fiat_p434_addcarryx_u64(&x194, &x195, x193, x152, x179);
fiat_p434_addcarryx_u64(&x196, &x197, x195, x154, x181);
fiat_p434_addcarryx_u64(&x198, &x199, x197, x156, x183);
fiat_p434_addcarryx_u64(&x200, &x201, x199, x158, x185);
fiat_p434_addcarryx_u64(&x202, &x203, x201, x160, x187);
fiat_p434_addcarryx_u64(&x204, &x205, x203, x162, x189);
fiat_p434_addcarryx_u64(&x206, &x207, x205, x164, x191);
fiat_p434_mulx_u64(&x208, &x209, x192, UINT64_C(0x2341f27177344));
fiat_p434_mulx_u64(&x210, &x211, x192, UINT64_C(0x6cfc5fd681c52056));
fiat_p434_mulx_u64(&x212, &x213, x192, UINT64_C(0x7bc65c783158aea3));
fiat_p434_mulx_u64(&x214, &x215, x192, UINT64_C(0xfdc1767ae2ffffff));
fiat_p434_mulx_u64(&x216, &x217, x192, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x218, &x219, x192, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x220, &x221, x192, UINT64_C(0xffffffffffffffff));
fiat_p434_addcarryx_u64(&x222, &x223, 0x0, x221, x218);
fiat_p434_addcarryx_u64(&x224, &x225, x223, x219, x216);
fiat_p434_addcarryx_u64(&x226, &x227, x225, x217, x214);
fiat_p434_addcarryx_u64(&x228, &x229, x227, x215, x212);
fiat_p434_addcarryx_u64(&x230, &x231, x229, x213, x210);
fiat_p434_addcarryx_u64(&x232, &x233, x231, x211, x208);
x234 = (x233 + x209);
fiat_p434_addcarryx_u64(&x235, &x236, 0x0, x192, x220);
fiat_p434_addcarryx_u64(&x237, &x238, x236, x194, x222);
fiat_p434_addcarryx_u64(&x239, &x240, x238, x196, x224);
fiat_p434_addcarryx_u64(&x241, &x242, x240, x198, x226);
fiat_p434_addcarryx_u64(&x243, &x244, x242, x200, x228);
fiat_p434_addcarryx_u64(&x245, &x246, x244, x202, x230);
fiat_p434_addcarryx_u64(&x247, &x248, x246, x204, x232);
fiat_p434_addcarryx_u64(&x249, &x250, x248, x206, x234);
x251 = ((uint64_t)x250 + x207);
fiat_p434_mulx_u64(&x252, &x253, x3, (arg2[6]));
fiat_p434_mulx_u64(&x254, &x255, x3, (arg2[5]));
fiat_p434_mulx_u64(&x256, &x257, x3, (arg2[4]));
fiat_p434_mulx_u64(&x258, &x259, x3, (arg2[3]));
fiat_p434_mulx_u64(&x260, &x261, x3, (arg2[2]));
fiat_p434_mulx_u64(&x262, &x263, x3, (arg2[1]));
fiat_p434_mulx_u64(&x264, &x265, x3, (arg2[0]));
fiat_p434_addcarryx_u64(&x266, &x267, 0x0, x265, x262);
fiat_p434_addcarryx_u64(&x268, &x269, x267, x263, x260);
fiat_p434_addcarryx_u64(&x270, &x271, x269, x261, x258);
fiat_p434_addcarryx_u64(&x272, &x273, x271, x259, x256);
fiat_p434_addcarryx_u64(&x274, &x275, x273, x257, x254);
fiat_p434_addcarryx_u64(&x276, &x277, x275, x255, x252);
x278 = (x277 + x253);
fiat_p434_addcarryx_u64(&x279, &x280, 0x0, x237, x264);
fiat_p434_addcarryx_u64(&x281, &x282, x280, x239, x266);
fiat_p434_addcarryx_u64(&x283, &x284, x282, x241, x268);
fiat_p434_addcarryx_u64(&x285, &x286, x284, x243, x270);
fiat_p434_addcarryx_u64(&x287, &x288, x286, x245, x272);
fiat_p434_addcarryx_u64(&x289, &x290, x288, x247, x274);
fiat_p434_addcarryx_u64(&x291, &x292, x290, x249, x276);
fiat_p434_addcarryx_u64(&x293, &x294, x292, x251, x278);
fiat_p434_mulx_u64(&x295, &x296, x279, UINT64_C(0x2341f27177344));
fiat_p434_mulx_u64(&x297, &x298, x279, UINT64_C(0x6cfc5fd681c52056));
fiat_p434_mulx_u64(&x299, &x300, x279, UINT64_C(0x7bc65c783158aea3));
fiat_p434_mulx_u64(&x301, &x302, x279, UINT64_C(0xfdc1767ae2ffffff));
fiat_p434_mulx_u64(&x303, &x304, x279, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x305, &x306, x279, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x307, &x308, x279, UINT64_C(0xffffffffffffffff));
fiat_p434_addcarryx_u64(&x309, &x310, 0x0, x308, x305);
fiat_p434_addcarryx_u64(&x311, &x312, x310, x306, x303);
fiat_p434_addcarryx_u64(&x313, &x314, x312, x304, x301);
fiat_p434_addcarryx_u64(&x315, &x316, x314, x302, x299);
fiat_p434_addcarryx_u64(&x317, &x318, x316, x300, x297);
fiat_p434_addcarryx_u64(&x319, &x320, x318, x298, x295);
x321 = (x320 + x296);
fiat_p434_addcarryx_u64(&x322, &x323, 0x0, x279, x307);
fiat_p434_addcarryx_u64(&x324, &x325, x323, x281, x309);
fiat_p434_addcarryx_u64(&x326, &x327, x325, x283, x311);
fiat_p434_addcarryx_u64(&x328, &x329, x327, x285, x313);
fiat_p434_addcarryx_u64(&x330, &x331, x329, x287, x315);
fiat_p434_addcarryx_u64(&x332, &x333, x331, x289, x317);
fiat_p434_addcarryx_u64(&x334, &x335, x333, x291, x319);
fiat_p434_addcarryx_u64(&x336, &x337, x335, x293, x321);
x338 = ((uint64_t)x337 + x294);
fiat_p434_mulx_u64(&x339, &x340, x4, (arg2[6]));
fiat_p434_mulx_u64(&x341, &x342, x4, (arg2[5]));
fiat_p434_mulx_u64(&x343, &x344, x4, (arg2[4]));
fiat_p434_mulx_u64(&x345, &x346, x4, (arg2[3]));
fiat_p434_mulx_u64(&x347, &x348, x4, (arg2[2]));
fiat_p434_mulx_u64(&x349, &x350, x4, (arg2[1]));
fiat_p434_mulx_u64(&x351, &x352, x4, (arg2[0]));
fiat_p434_addcarryx_u64(&x353, &x354, 0x0, x352, x349);
fiat_p434_addcarryx_u64(&x355, &x356, x354, x350, x347);
fiat_p434_addcarryx_u64(&x357, &x358, x356, x348, x345);
fiat_p434_addcarryx_u64(&x359, &x360, x358, x346, x343);
fiat_p434_addcarryx_u64(&x361, &x362, x360, x344, x341);
fiat_p434_addcarryx_u64(&x363, &x364, x362, x342, x339);
x365 = (x364 + x340);
fiat_p434_addcarryx_u64(&x366, &x367, 0x0, x324, x351);
fiat_p434_addcarryx_u64(&x368, &x369, x367, x326, x353);
fiat_p434_addcarryx_u64(&x370, &x371, x369, x328, x355);
fiat_p434_addcarryx_u64(&x372, &x373, x371, x330, x357);
fiat_p434_addcarryx_u64(&x374, &x375, x373, x332, x359);
fiat_p434_addcarryx_u64(&x376, &x377, x375, x334, x361);
fiat_p434_addcarryx_u64(&x378, &x379, x377, x336, x363);
fiat_p434_addcarryx_u64(&x380, &x381, x379, x338, x365);
fiat_p434_mulx_u64(&x382, &x383, x366, UINT64_C(0x2341f27177344));
fiat_p434_mulx_u64(&x384, &x385, x366, UINT64_C(0x6cfc5fd681c52056));
fiat_p434_mulx_u64(&x386, &x387, x366, UINT64_C(0x7bc65c783158aea3));
fiat_p434_mulx_u64(&x388, &x389, x366, UINT64_C(0xfdc1767ae2ffffff));
fiat_p434_mulx_u64(&x390, &x391, x366, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x392, &x393, x366, UINT64_C(0xffffffffffffffff));
fiat_p434_mulx_u64(&x394, &x395, x366, UINT64_C(0xffffffffffffffff));
fiat_p434_addcarryx_u64(&x396, &x397, 0x0, x395, x392);
fiat_p434_addcarryx_u64(&x398, &x399, x397, x393, x390);
fiat_p434_addcarryx_u64(&x400, &x401, x399, x391, x388);
fiat_p434_addcarryx_u64(&x402, &x403, x401, x389, x386);