-
Notifications
You must be signed in to change notification settings - Fork 147
/
sm2_scalar_32.c
5846 lines (5821 loc) · 203 KB
/
sm2_scalar_32.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 sm2_scalar 32 '2^256 - 2^224 - 188730267045675049073202170516080344797' mul square add sub opp from_montgomery to_montgomery nonzero selectznz to_bytes from_bytes one msat divstep divstep_precomp */
/* curve description: sm2_scalar */
/* machine_wordsize = 32 (from "32") */
/* requested operations: mul, square, add, sub, opp, from_montgomery, to_montgomery, nonzero, selectznz, to_bytes, from_bytes, one, msat, divstep, divstep_precomp */
/* m = 0xfffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123 (from "2^256 - 2^224 - 188730267045675049073202170516080344797") */
/* */
/* 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] << 32) + (z[2] << 64) + (z[3] << 96) + (z[4] << 128) + (z[5] << 160) + (z[6] << 192) + (z[7] << 224) */
/* 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) */
/* twos_complement_eval z = let x1 := z[0] + (z[1] << 32) + (z[2] << 64) + (z[3] << 96) + (z[4] << 128) + (z[5] << 160) + (z[6] << 192) + (z[7] << 224) in */
/* if x1 & (2^256-1) < 2^255 then x1 & (2^256-1) else (x1 & (2^256-1)) - 2^256 */
#include <stdint.h>
typedef unsigned char fiat_sm2_scalar_uint1;
typedef signed char fiat_sm2_scalar_int1;
#if defined(__GNUC__) || defined(__clang__)
# define FIAT_SM2_SCALAR_FIAT_INLINE __inline__
#else
# define FIAT_SM2_SCALAR_FIAT_INLINE
#endif
/* The type fiat_sm2_scalar_montgomery_domain_field_element is a field element in the Montgomery domain. */
/* Bounds: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] */
typedef uint32_t fiat_sm2_scalar_montgomery_domain_field_element[8];
/* The type fiat_sm2_scalar_non_montgomery_domain_field_element is a field element NOT in the Montgomery domain. */
/* Bounds: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] */
typedef uint32_t fiat_sm2_scalar_non_montgomery_domain_field_element[8];
#if (-1 & 3) != 3
#error "This code only works on a two's complement system"
#endif
#if !defined(FIAT_SM2_SCALAR_NO_ASM) && (defined(__GNUC__) || defined(__clang__))
static __inline__ uint32_t fiat_sm2_scalar_value_barrier_u32(uint32_t a) {
__asm__("" : "+r"(a) : /* no inputs */);
return a;
}
#else
# define fiat_sm2_scalar_value_barrier_u32(x) (x)
#endif
/*
* The function fiat_sm2_scalar_addcarryx_u32 is an addition with carry.
*
* Postconditions:
* out1 = (arg1 + arg2 + arg3) mod 2^32
* out2 = ⌊(arg1 + arg2 + arg3) / 2^32⌋
*
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0xffffffff]
* arg3: [0x0 ~> 0xffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffff]
* out2: [0x0 ~> 0x1]
*/
static FIAT_SM2_SCALAR_FIAT_INLINE void fiat_sm2_scalar_addcarryx_u32(uint32_t* out1, fiat_sm2_scalar_uint1* out2, fiat_sm2_scalar_uint1 arg1, uint32_t arg2, uint32_t arg3) {
uint64_t x1;
uint32_t x2;
fiat_sm2_scalar_uint1 x3;
x1 = ((arg1 + (uint64_t)arg2) + arg3);
x2 = (uint32_t)(x1 & UINT32_C(0xffffffff));
x3 = (fiat_sm2_scalar_uint1)(x1 >> 32);
*out1 = x2;
*out2 = x3;
}
/*
* The function fiat_sm2_scalar_subborrowx_u32 is a subtraction with borrow.
*
* Postconditions:
* out1 = (-arg1 + arg2 + -arg3) mod 2^32
* out2 = -⌊(-arg1 + arg2 + -arg3) / 2^32⌋
*
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0xffffffff]
* arg3: [0x0 ~> 0xffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffff]
* out2: [0x0 ~> 0x1]
*/
static FIAT_SM2_SCALAR_FIAT_INLINE void fiat_sm2_scalar_subborrowx_u32(uint32_t* out1, fiat_sm2_scalar_uint1* out2, fiat_sm2_scalar_uint1 arg1, uint32_t arg2, uint32_t arg3) {
int64_t x1;
fiat_sm2_scalar_int1 x2;
uint32_t x3;
x1 = ((arg2 - (int64_t)arg1) - arg3);
x2 = (fiat_sm2_scalar_int1)(x1 >> 32);
x3 = (uint32_t)(x1 & UINT32_C(0xffffffff));
*out1 = x3;
*out2 = (fiat_sm2_scalar_uint1)(0x0 - x2);
}
/*
* The function fiat_sm2_scalar_mulx_u32 is a multiplication, returning the full double-width result.
*
* Postconditions:
* out1 = (arg1 * arg2) mod 2^32
* out2 = ⌊arg1 * arg2 / 2^32⌋
*
* Input Bounds:
* arg1: [0x0 ~> 0xffffffff]
* arg2: [0x0 ~> 0xffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffff]
* out2: [0x0 ~> 0xffffffff]
*/
static FIAT_SM2_SCALAR_FIAT_INLINE void fiat_sm2_scalar_mulx_u32(uint32_t* out1, uint32_t* out2, uint32_t arg1, uint32_t arg2) {
uint64_t x1;
uint32_t x2;
uint32_t x3;
x1 = ((uint64_t)arg1 * arg2);
x2 = (uint32_t)(x1 & UINT32_C(0xffffffff));
x3 = (uint32_t)(x1 >> 32);
*out1 = x2;
*out2 = x3;
}
/*
* The function fiat_sm2_scalar_cmovznz_u32 is a single-word conditional move.
*
* Postconditions:
* out1 = (if arg1 = 0 then arg2 else arg3)
*
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0xffffffff]
* arg3: [0x0 ~> 0xffffffff]
* Output Bounds:
* out1: [0x0 ~> 0xffffffff]
*/
static FIAT_SM2_SCALAR_FIAT_INLINE void fiat_sm2_scalar_cmovznz_u32(uint32_t* out1, fiat_sm2_scalar_uint1 arg1, uint32_t arg2, uint32_t arg3) {
fiat_sm2_scalar_uint1 x1;
uint32_t x2;
uint32_t x3;
x1 = (!(!arg1));
x2 = ((fiat_sm2_scalar_int1)(0x0 - x1) & UINT32_C(0xffffffff));
x3 = ((fiat_sm2_scalar_value_barrier_u32(x2) & arg3) | (fiat_sm2_scalar_value_barrier_u32((~x2)) & arg2));
*out1 = x3;
}
/*
* The function fiat_sm2_scalar_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_SM2_SCALAR_FIAT_INLINE void fiat_sm2_scalar_mul(fiat_sm2_scalar_montgomery_domain_field_element out1, const fiat_sm2_scalar_montgomery_domain_field_element arg1, const fiat_sm2_scalar_montgomery_domain_field_element arg2) {
uint32_t x1;
uint32_t x2;
uint32_t x3;
uint32_t x4;
uint32_t x5;
uint32_t x6;
uint32_t x7;
uint32_t x8;
uint32_t x9;
uint32_t x10;
uint32_t x11;
uint32_t x12;
uint32_t x13;
uint32_t x14;
uint32_t x15;
uint32_t x16;
uint32_t x17;
uint32_t x18;
uint32_t x19;
uint32_t x20;
uint32_t x21;
uint32_t x22;
uint32_t x23;
uint32_t x24;
uint32_t x25;
fiat_sm2_scalar_uint1 x26;
uint32_t x27;
fiat_sm2_scalar_uint1 x28;
uint32_t x29;
fiat_sm2_scalar_uint1 x30;
uint32_t x31;
fiat_sm2_scalar_uint1 x32;
uint32_t x33;
fiat_sm2_scalar_uint1 x34;
uint32_t x35;
fiat_sm2_scalar_uint1 x36;
uint32_t x37;
fiat_sm2_scalar_uint1 x38;
uint32_t x39;
uint32_t x40;
uint32_t x41;
uint32_t x42;
uint32_t x43;
uint32_t x44;
uint32_t x45;
uint32_t x46;
uint32_t x47;
uint32_t x48;
uint32_t x49;
uint32_t x50;
uint32_t x51;
uint32_t x52;
uint32_t x53;
uint32_t x54;
uint32_t x55;
uint32_t x56;
uint32_t x57;
uint32_t x58;
fiat_sm2_scalar_uint1 x59;
uint32_t x60;
fiat_sm2_scalar_uint1 x61;
uint32_t x62;
fiat_sm2_scalar_uint1 x63;
uint32_t x64;
fiat_sm2_scalar_uint1 x65;
uint32_t x66;
fiat_sm2_scalar_uint1 x67;
uint32_t x68;
fiat_sm2_scalar_uint1 x69;
uint32_t x70;
fiat_sm2_scalar_uint1 x71;
uint32_t x72;
uint32_t x73;
fiat_sm2_scalar_uint1 x74;
uint32_t x75;
fiat_sm2_scalar_uint1 x76;
uint32_t x77;
fiat_sm2_scalar_uint1 x78;
uint32_t x79;
fiat_sm2_scalar_uint1 x80;
uint32_t x81;
fiat_sm2_scalar_uint1 x82;
uint32_t x83;
fiat_sm2_scalar_uint1 x84;
uint32_t x85;
fiat_sm2_scalar_uint1 x86;
uint32_t x87;
fiat_sm2_scalar_uint1 x88;
uint32_t x89;
fiat_sm2_scalar_uint1 x90;
uint32_t x91;
uint32_t x92;
uint32_t x93;
uint32_t x94;
uint32_t x95;
uint32_t x96;
uint32_t x97;
uint32_t x98;
uint32_t x99;
uint32_t x100;
uint32_t x101;
uint32_t x102;
uint32_t x103;
uint32_t x104;
uint32_t x105;
uint32_t x106;
uint32_t x107;
fiat_sm2_scalar_uint1 x108;
uint32_t x109;
fiat_sm2_scalar_uint1 x110;
uint32_t x111;
fiat_sm2_scalar_uint1 x112;
uint32_t x113;
fiat_sm2_scalar_uint1 x114;
uint32_t x115;
fiat_sm2_scalar_uint1 x116;
uint32_t x117;
fiat_sm2_scalar_uint1 x118;
uint32_t x119;
fiat_sm2_scalar_uint1 x120;
uint32_t x121;
uint32_t x122;
fiat_sm2_scalar_uint1 x123;
uint32_t x124;
fiat_sm2_scalar_uint1 x125;
uint32_t x126;
fiat_sm2_scalar_uint1 x127;
uint32_t x128;
fiat_sm2_scalar_uint1 x129;
uint32_t x130;
fiat_sm2_scalar_uint1 x131;
uint32_t x132;
fiat_sm2_scalar_uint1 x133;
uint32_t x134;
fiat_sm2_scalar_uint1 x135;
uint32_t x136;
fiat_sm2_scalar_uint1 x137;
uint32_t x138;
fiat_sm2_scalar_uint1 x139;
uint32_t x140;
uint32_t x141;
uint32_t x142;
uint32_t x143;
uint32_t x144;
uint32_t x145;
uint32_t x146;
uint32_t x147;
uint32_t x148;
uint32_t x149;
uint32_t x150;
uint32_t x151;
uint32_t x152;
uint32_t x153;
uint32_t x154;
uint32_t x155;
uint32_t x156;
uint32_t x157;
uint32_t x158;
fiat_sm2_scalar_uint1 x159;
uint32_t x160;
fiat_sm2_scalar_uint1 x161;
uint32_t x162;
fiat_sm2_scalar_uint1 x163;
uint32_t x164;
fiat_sm2_scalar_uint1 x165;
uint32_t x166;
fiat_sm2_scalar_uint1 x167;
uint32_t x168;
fiat_sm2_scalar_uint1 x169;
uint32_t x170;
fiat_sm2_scalar_uint1 x171;
uint32_t x172;
uint32_t x173;
fiat_sm2_scalar_uint1 x174;
uint32_t x175;
fiat_sm2_scalar_uint1 x176;
uint32_t x177;
fiat_sm2_scalar_uint1 x178;
uint32_t x179;
fiat_sm2_scalar_uint1 x180;
uint32_t x181;
fiat_sm2_scalar_uint1 x182;
uint32_t x183;
fiat_sm2_scalar_uint1 x184;
uint32_t x185;
fiat_sm2_scalar_uint1 x186;
uint32_t x187;
fiat_sm2_scalar_uint1 x188;
uint32_t x189;
fiat_sm2_scalar_uint1 x190;
uint32_t x191;
uint32_t x192;
uint32_t x193;
uint32_t x194;
uint32_t x195;
uint32_t x196;
uint32_t x197;
uint32_t x198;
uint32_t x199;
uint32_t x200;
uint32_t x201;
uint32_t x202;
uint32_t x203;
uint32_t x204;
uint32_t x205;
uint32_t x206;
uint32_t x207;
uint32_t x208;
fiat_sm2_scalar_uint1 x209;
uint32_t x210;
fiat_sm2_scalar_uint1 x211;
uint32_t x212;
fiat_sm2_scalar_uint1 x213;
uint32_t x214;
fiat_sm2_scalar_uint1 x215;
uint32_t x216;
fiat_sm2_scalar_uint1 x217;
uint32_t x218;
fiat_sm2_scalar_uint1 x219;
uint32_t x220;
fiat_sm2_scalar_uint1 x221;
uint32_t x222;
uint32_t x223;
fiat_sm2_scalar_uint1 x224;
uint32_t x225;
fiat_sm2_scalar_uint1 x226;
uint32_t x227;
fiat_sm2_scalar_uint1 x228;
uint32_t x229;
fiat_sm2_scalar_uint1 x230;
uint32_t x231;
fiat_sm2_scalar_uint1 x232;
uint32_t x233;
fiat_sm2_scalar_uint1 x234;
uint32_t x235;
fiat_sm2_scalar_uint1 x236;
uint32_t x237;
fiat_sm2_scalar_uint1 x238;
uint32_t x239;
fiat_sm2_scalar_uint1 x240;
uint32_t x241;
uint32_t x242;
uint32_t x243;
uint32_t x244;
uint32_t x245;
uint32_t x246;
uint32_t x247;
uint32_t x248;
uint32_t x249;
uint32_t x250;
uint32_t x251;
uint32_t x252;
uint32_t x253;
uint32_t x254;
uint32_t x255;
uint32_t x256;
uint32_t x257;
uint32_t x258;
uint32_t x259;
fiat_sm2_scalar_uint1 x260;
uint32_t x261;
fiat_sm2_scalar_uint1 x262;
uint32_t x263;
fiat_sm2_scalar_uint1 x264;
uint32_t x265;
fiat_sm2_scalar_uint1 x266;
uint32_t x267;
fiat_sm2_scalar_uint1 x268;
uint32_t x269;
fiat_sm2_scalar_uint1 x270;
uint32_t x271;
fiat_sm2_scalar_uint1 x272;
uint32_t x273;
uint32_t x274;
fiat_sm2_scalar_uint1 x275;
uint32_t x276;
fiat_sm2_scalar_uint1 x277;
uint32_t x278;
fiat_sm2_scalar_uint1 x279;
uint32_t x280;
fiat_sm2_scalar_uint1 x281;
uint32_t x282;
fiat_sm2_scalar_uint1 x283;
uint32_t x284;
fiat_sm2_scalar_uint1 x285;
uint32_t x286;
fiat_sm2_scalar_uint1 x287;
uint32_t x288;
fiat_sm2_scalar_uint1 x289;
uint32_t x290;
fiat_sm2_scalar_uint1 x291;
uint32_t x292;
uint32_t x293;
uint32_t x294;
uint32_t x295;
uint32_t x296;
uint32_t x297;
uint32_t x298;
uint32_t x299;
uint32_t x300;
uint32_t x301;
uint32_t x302;
uint32_t x303;
uint32_t x304;
uint32_t x305;
uint32_t x306;
uint32_t x307;
uint32_t x308;
uint32_t x309;
fiat_sm2_scalar_uint1 x310;
uint32_t x311;
fiat_sm2_scalar_uint1 x312;
uint32_t x313;
fiat_sm2_scalar_uint1 x314;
uint32_t x315;
fiat_sm2_scalar_uint1 x316;
uint32_t x317;
fiat_sm2_scalar_uint1 x318;
uint32_t x319;
fiat_sm2_scalar_uint1 x320;
uint32_t x321;
fiat_sm2_scalar_uint1 x322;
uint32_t x323;
uint32_t x324;
fiat_sm2_scalar_uint1 x325;
uint32_t x326;
fiat_sm2_scalar_uint1 x327;
uint32_t x328;
fiat_sm2_scalar_uint1 x329;
uint32_t x330;
fiat_sm2_scalar_uint1 x331;
uint32_t x332;
fiat_sm2_scalar_uint1 x333;
uint32_t x334;
fiat_sm2_scalar_uint1 x335;
uint32_t x336;
fiat_sm2_scalar_uint1 x337;
uint32_t x338;
fiat_sm2_scalar_uint1 x339;
uint32_t x340;
fiat_sm2_scalar_uint1 x341;
uint32_t x342;
uint32_t x343;
uint32_t x344;
uint32_t x345;
uint32_t x346;
uint32_t x347;
uint32_t x348;
uint32_t x349;
uint32_t x350;
uint32_t x351;
uint32_t x352;
uint32_t x353;
uint32_t x354;
uint32_t x355;
uint32_t x356;
uint32_t x357;
uint32_t x358;
uint32_t x359;
uint32_t x360;
fiat_sm2_scalar_uint1 x361;
uint32_t x362;
fiat_sm2_scalar_uint1 x363;
uint32_t x364;
fiat_sm2_scalar_uint1 x365;
uint32_t x366;
fiat_sm2_scalar_uint1 x367;
uint32_t x368;
fiat_sm2_scalar_uint1 x369;
uint32_t x370;
fiat_sm2_scalar_uint1 x371;
uint32_t x372;
fiat_sm2_scalar_uint1 x373;
uint32_t x374;
uint32_t x375;
fiat_sm2_scalar_uint1 x376;
uint32_t x377;
fiat_sm2_scalar_uint1 x378;
uint32_t x379;
fiat_sm2_scalar_uint1 x380;
uint32_t x381;
fiat_sm2_scalar_uint1 x382;
uint32_t x383;
fiat_sm2_scalar_uint1 x384;
uint32_t x385;
fiat_sm2_scalar_uint1 x386;
uint32_t x387;
fiat_sm2_scalar_uint1 x388;
uint32_t x389;
fiat_sm2_scalar_uint1 x390;
uint32_t x391;
fiat_sm2_scalar_uint1 x392;
uint32_t x393;
uint32_t x394;
uint32_t x395;
uint32_t x396;
uint32_t x397;
uint32_t x398;
uint32_t x399;
uint32_t x400;
uint32_t x401;
uint32_t x402;
uint32_t x403;
uint32_t x404;
uint32_t x405;
uint32_t x406;
uint32_t x407;
uint32_t x408;
uint32_t x409;
uint32_t x410;
fiat_sm2_scalar_uint1 x411;
uint32_t x412;
fiat_sm2_scalar_uint1 x413;
uint32_t x414;
fiat_sm2_scalar_uint1 x415;
uint32_t x416;
fiat_sm2_scalar_uint1 x417;
uint32_t x418;
fiat_sm2_scalar_uint1 x419;
uint32_t x420;
fiat_sm2_scalar_uint1 x421;
uint32_t x422;
fiat_sm2_scalar_uint1 x423;
uint32_t x424;
uint32_t x425;
fiat_sm2_scalar_uint1 x426;
uint32_t x427;
fiat_sm2_scalar_uint1 x428;
uint32_t x429;
fiat_sm2_scalar_uint1 x430;
uint32_t x431;
fiat_sm2_scalar_uint1 x432;
uint32_t x433;
fiat_sm2_scalar_uint1 x434;
uint32_t x435;
fiat_sm2_scalar_uint1 x436;
uint32_t x437;
fiat_sm2_scalar_uint1 x438;
uint32_t x439;
fiat_sm2_scalar_uint1 x440;
uint32_t x441;
fiat_sm2_scalar_uint1 x442;
uint32_t x443;
uint32_t x444;
uint32_t x445;
uint32_t x446;
uint32_t x447;
uint32_t x448;
uint32_t x449;
uint32_t x450;
uint32_t x451;
uint32_t x452;
uint32_t x453;
uint32_t x454;
uint32_t x455;
uint32_t x456;
uint32_t x457;
uint32_t x458;
uint32_t x459;
uint32_t x460;
uint32_t x461;
fiat_sm2_scalar_uint1 x462;
uint32_t x463;
fiat_sm2_scalar_uint1 x464;
uint32_t x465;
fiat_sm2_scalar_uint1 x466;
uint32_t x467;
fiat_sm2_scalar_uint1 x468;
uint32_t x469;
fiat_sm2_scalar_uint1 x470;
uint32_t x471;
fiat_sm2_scalar_uint1 x472;
uint32_t x473;
fiat_sm2_scalar_uint1 x474;
uint32_t x475;
uint32_t x476;
fiat_sm2_scalar_uint1 x477;
uint32_t x478;
fiat_sm2_scalar_uint1 x479;
uint32_t x480;
fiat_sm2_scalar_uint1 x481;
uint32_t x482;
fiat_sm2_scalar_uint1 x483;
uint32_t x484;
fiat_sm2_scalar_uint1 x485;
uint32_t x486;
fiat_sm2_scalar_uint1 x487;
uint32_t x488;
fiat_sm2_scalar_uint1 x489;
uint32_t x490;
fiat_sm2_scalar_uint1 x491;
uint32_t x492;
fiat_sm2_scalar_uint1 x493;
uint32_t x494;
uint32_t x495;
uint32_t x496;
uint32_t x497;
uint32_t x498;
uint32_t x499;
uint32_t x500;
uint32_t x501;
uint32_t x502;
uint32_t x503;
uint32_t x504;
uint32_t x505;
uint32_t x506;
uint32_t x507;
uint32_t x508;
uint32_t x509;
uint32_t x510;
uint32_t x511;
fiat_sm2_scalar_uint1 x512;
uint32_t x513;
fiat_sm2_scalar_uint1 x514;
uint32_t x515;
fiat_sm2_scalar_uint1 x516;
uint32_t x517;
fiat_sm2_scalar_uint1 x518;
uint32_t x519;
fiat_sm2_scalar_uint1 x520;
uint32_t x521;
fiat_sm2_scalar_uint1 x522;
uint32_t x523;
fiat_sm2_scalar_uint1 x524;
uint32_t x525;
uint32_t x526;
fiat_sm2_scalar_uint1 x527;
uint32_t x528;
fiat_sm2_scalar_uint1 x529;
uint32_t x530;
fiat_sm2_scalar_uint1 x531;
uint32_t x532;
fiat_sm2_scalar_uint1 x533;
uint32_t x534;
fiat_sm2_scalar_uint1 x535;
uint32_t x536;
fiat_sm2_scalar_uint1 x537;
uint32_t x538;
fiat_sm2_scalar_uint1 x539;
uint32_t x540;
fiat_sm2_scalar_uint1 x541;
uint32_t x542;
fiat_sm2_scalar_uint1 x543;
uint32_t x544;
uint32_t x545;
uint32_t x546;
uint32_t x547;
uint32_t x548;
uint32_t x549;
uint32_t x550;
uint32_t x551;
uint32_t x552;
uint32_t x553;
uint32_t x554;
uint32_t x555;
uint32_t x556;
uint32_t x557;
uint32_t x558;
uint32_t x559;
uint32_t x560;
uint32_t x561;
uint32_t x562;
fiat_sm2_scalar_uint1 x563;
uint32_t x564;
fiat_sm2_scalar_uint1 x565;
uint32_t x566;
fiat_sm2_scalar_uint1 x567;
uint32_t x568;
fiat_sm2_scalar_uint1 x569;
uint32_t x570;
fiat_sm2_scalar_uint1 x571;
uint32_t x572;
fiat_sm2_scalar_uint1 x573;
uint32_t x574;
fiat_sm2_scalar_uint1 x575;
uint32_t x576;
uint32_t x577;
fiat_sm2_scalar_uint1 x578;
uint32_t x579;
fiat_sm2_scalar_uint1 x580;
uint32_t x581;
fiat_sm2_scalar_uint1 x582;
uint32_t x583;
fiat_sm2_scalar_uint1 x584;
uint32_t x585;
fiat_sm2_scalar_uint1 x586;
uint32_t x587;
fiat_sm2_scalar_uint1 x588;
uint32_t x589;
fiat_sm2_scalar_uint1 x590;
uint32_t x591;
fiat_sm2_scalar_uint1 x592;
uint32_t x593;
fiat_sm2_scalar_uint1 x594;
uint32_t x595;
uint32_t x596;
uint32_t x597;
uint32_t x598;
uint32_t x599;
uint32_t x600;
uint32_t x601;
uint32_t x602;
uint32_t x603;
uint32_t x604;
uint32_t x605;
uint32_t x606;
uint32_t x607;
uint32_t x608;
uint32_t x609;
uint32_t x610;
uint32_t x611;
uint32_t x612;
fiat_sm2_scalar_uint1 x613;
uint32_t x614;
fiat_sm2_scalar_uint1 x615;
uint32_t x616;
fiat_sm2_scalar_uint1 x617;
uint32_t x618;
fiat_sm2_scalar_uint1 x619;
uint32_t x620;
fiat_sm2_scalar_uint1 x621;
uint32_t x622;
fiat_sm2_scalar_uint1 x623;
uint32_t x624;
fiat_sm2_scalar_uint1 x625;
uint32_t x626;
uint32_t x627;
fiat_sm2_scalar_uint1 x628;
uint32_t x629;
fiat_sm2_scalar_uint1 x630;
uint32_t x631;
fiat_sm2_scalar_uint1 x632;
uint32_t x633;
fiat_sm2_scalar_uint1 x634;
uint32_t x635;
fiat_sm2_scalar_uint1 x636;
uint32_t x637;
fiat_sm2_scalar_uint1 x638;
uint32_t x639;
fiat_sm2_scalar_uint1 x640;
uint32_t x641;
fiat_sm2_scalar_uint1 x642;
uint32_t x643;
fiat_sm2_scalar_uint1 x644;
uint32_t x645;
uint32_t x646;
uint32_t x647;
uint32_t x648;
uint32_t x649;
uint32_t x650;
uint32_t x651;
uint32_t x652;
uint32_t x653;
uint32_t x654;
uint32_t x655;
uint32_t x656;
uint32_t x657;
uint32_t x658;
uint32_t x659;
uint32_t x660;
uint32_t x661;
uint32_t x662;
uint32_t x663;
fiat_sm2_scalar_uint1 x664;
uint32_t x665;
fiat_sm2_scalar_uint1 x666;
uint32_t x667;
fiat_sm2_scalar_uint1 x668;
uint32_t x669;
fiat_sm2_scalar_uint1 x670;
uint32_t x671;
fiat_sm2_scalar_uint1 x672;
uint32_t x673;
fiat_sm2_scalar_uint1 x674;
uint32_t x675;
fiat_sm2_scalar_uint1 x676;
uint32_t x677;
uint32_t x678;
fiat_sm2_scalar_uint1 x679;
uint32_t x680;
fiat_sm2_scalar_uint1 x681;
uint32_t x682;
fiat_sm2_scalar_uint1 x683;
uint32_t x684;
fiat_sm2_scalar_uint1 x685;
uint32_t x686;
fiat_sm2_scalar_uint1 x687;
uint32_t x688;
fiat_sm2_scalar_uint1 x689;
uint32_t x690;
fiat_sm2_scalar_uint1 x691;
uint32_t x692;
fiat_sm2_scalar_uint1 x693;
uint32_t x694;
fiat_sm2_scalar_uint1 x695;
uint32_t x696;
uint32_t x697;
uint32_t x698;
uint32_t x699;
uint32_t x700;
uint32_t x701;
uint32_t x702;
uint32_t x703;
uint32_t x704;
uint32_t x705;
uint32_t x706;
uint32_t x707;
uint32_t x708;
uint32_t x709;
uint32_t x710;
uint32_t x711;
uint32_t x712;
uint32_t x713;
fiat_sm2_scalar_uint1 x714;
uint32_t x715;
fiat_sm2_scalar_uint1 x716;
uint32_t x717;
fiat_sm2_scalar_uint1 x718;
uint32_t x719;
fiat_sm2_scalar_uint1 x720;
uint32_t x721;
fiat_sm2_scalar_uint1 x722;
uint32_t x723;
fiat_sm2_scalar_uint1 x724;
uint32_t x725;
fiat_sm2_scalar_uint1 x726;
uint32_t x727;
uint32_t x728;
fiat_sm2_scalar_uint1 x729;
uint32_t x730;
fiat_sm2_scalar_uint1 x731;
uint32_t x732;
fiat_sm2_scalar_uint1 x733;
uint32_t x734;
fiat_sm2_scalar_uint1 x735;
uint32_t x736;
fiat_sm2_scalar_uint1 x737;
uint32_t x738;
fiat_sm2_scalar_uint1 x739;
uint32_t x740;
fiat_sm2_scalar_uint1 x741;
uint32_t x742;
fiat_sm2_scalar_uint1 x743;
uint32_t x744;
fiat_sm2_scalar_uint1 x745;
uint32_t x746;
uint32_t x747;
uint32_t x748;
uint32_t x749;
uint32_t x750;
uint32_t x751;
uint32_t x752;
uint32_t x753;
uint32_t x754;
uint32_t x755;
uint32_t x756;
uint32_t x757;
uint32_t x758;
uint32_t x759;
uint32_t x760;
uint32_t x761;
uint32_t x762;
uint32_t x763;
uint32_t x764;
fiat_sm2_scalar_uint1 x765;
uint32_t x766;
fiat_sm2_scalar_uint1 x767;
uint32_t x768;
fiat_sm2_scalar_uint1 x769;
uint32_t x770;
fiat_sm2_scalar_uint1 x771;
uint32_t x772;
fiat_sm2_scalar_uint1 x773;
uint32_t x774;
fiat_sm2_scalar_uint1 x775;
uint32_t x776;
fiat_sm2_scalar_uint1 x777;
uint32_t x778;
uint32_t x779;
fiat_sm2_scalar_uint1 x780;
uint32_t x781;
fiat_sm2_scalar_uint1 x782;
uint32_t x783;
fiat_sm2_scalar_uint1 x784;
uint32_t x785;
fiat_sm2_scalar_uint1 x786;
uint32_t x787;
fiat_sm2_scalar_uint1 x788;
uint32_t x789;
fiat_sm2_scalar_uint1 x790;
uint32_t x791;
fiat_sm2_scalar_uint1 x792;
uint32_t x793;
fiat_sm2_scalar_uint1 x794;
uint32_t x795;
fiat_sm2_scalar_uint1 x796;
uint32_t x797;
uint32_t x798;
fiat_sm2_scalar_uint1 x799;
uint32_t x800;
fiat_sm2_scalar_uint1 x801;
uint32_t x802;
fiat_sm2_scalar_uint1 x803;
uint32_t x804;
fiat_sm2_scalar_uint1 x805;
uint32_t x806;
fiat_sm2_scalar_uint1 x807;
uint32_t x808;
fiat_sm2_scalar_uint1 x809;
uint32_t x810;
fiat_sm2_scalar_uint1 x811;
uint32_t x812;
fiat_sm2_scalar_uint1 x813;
uint32_t x814;
fiat_sm2_scalar_uint1 x815;
uint32_t x816;
uint32_t x817;
uint32_t x818;
uint32_t x819;
uint32_t x820;
uint32_t x821;
uint32_t x822;
uint32_t x823;
x1 = (arg1[1]);
x2 = (arg1[2]);
x3 = (arg1[3]);
x4 = (arg1[4]);
x5 = (arg1[5]);
x6 = (arg1[6]);
x7 = (arg1[7]);
x8 = (arg1[0]);
fiat_sm2_scalar_mulx_u32(&x9, &x10, x8, (arg2[7]));
fiat_sm2_scalar_mulx_u32(&x11, &x12, x8, (arg2[6]));
fiat_sm2_scalar_mulx_u32(&x13, &x14, x8, (arg2[5]));
fiat_sm2_scalar_mulx_u32(&x15, &x16, x8, (arg2[4]));
fiat_sm2_scalar_mulx_u32(&x17, &x18, x8, (arg2[3]));
fiat_sm2_scalar_mulx_u32(&x19, &x20, x8, (arg2[2]));
fiat_sm2_scalar_mulx_u32(&x21, &x22, x8, (arg2[1]));