-
Notifications
You must be signed in to change notification settings - Fork 147
/
curve25519_solinas_64.c
503 lines (489 loc) · 18 KB
/
curve25519_solinas_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
/* Autogenerated: 'src/ExtractionOCaml/bedrock2_solinas_reduction' --lang bedrock2 --static --no-wide-int --widen-carry --widen-bytes --split-multiret --no-select --no-field-element-typedefs curve25519_solinas 64 '2^255 - 19' mul square */
/* curve description: curve25519_solinas */
/* machine_wordsize = 64 (from "64") */
/* requested operations: mul, square */
/* s-c = 2^255 - [(1, 19)] (from "2^255 - 19") */
/* */
/* Computed values: */
/* */
#include <stdint.h>
#include <string.h>
#include <assert.h>
static __attribute__((constructor)) void _br2_preconditions(void) {
static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement");
assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1));
uintptr_t u = 1;
assert(((void)"little-endian", 1 == *(unsigned char *)&u));
intptr_t i = 1;
assert(((void)"little-endian", 1 == *(unsigned char *)&i));
}
// We use memcpy to work around -fstrict-aliasing.
// A plain memcpy is enough on clang 10, but not on gcc 10, which fails
// to infer the bounds on an integer loaded by memcpy.
// Adding a range mask after memcpy in turn makes slower code in clang.
// Loading individual bytes, shifting them together, and or-ing is fast
// on clang and sometimes on GCC, but other times GCC inlines individual
// byte operations without reconstructing wider accesses.
// The little-endian idiom below seems fast in gcc 9+ and clang 10.
static inline __attribute__((always_inline, unused))
uintptr_t _br2_load(uintptr_t a, uintptr_t sz) {
switch (sz) {
case 1: { uint8_t r = 0; memcpy(&r, (void*)a, 1); return r; }
case 2: { uint16_t r = 0; memcpy(&r, (void*)a, 2); return r; }
case 4: { uint32_t r = 0; memcpy(&r, (void*)a, 4); return r; }
case 8: { uint64_t r = 0; memcpy(&r, (void*)a, 8); return r; }
default: __builtin_unreachable();
}
}
static inline __attribute__((always_inline, unused))
void _br2_store(uintptr_t a, uintptr_t v, uintptr_t sz) {
memcpy((void*)a, &v, sz);
}
static inline __attribute__((always_inline, unused))
uintptr_t _br2_mulhuu(uintptr_t a, uintptr_t b) {
#if (UINTPTR_MAX == (UINTMAX_C(1)<<31) - 1 + (UINTMAX_C(1)<<31))
return ((uint64_t)a * b) >> 32;
#elif (UINTPTR_MAX == (UINTMAX_C(1)<<63) - 1 + (UINTMAX_C(1)<<63))
return ((unsigned __int128)a * b) >> 64;
#else
#error "32-bit or 64-bit uintptr_t required"
#endif
}
static inline __attribute__((always_inline, unused))
uintptr_t _br2_divu(uintptr_t a, uintptr_t b) {
if (!b) return -1;
return a/b;
}
static inline __attribute__((always_inline, unused))
uintptr_t _br2_remu(uintptr_t a, uintptr_t b) {
if (!b) return a;
return a%b;
}
static inline __attribute__((always_inline, unused))
uintptr_t _br2_shamt(uintptr_t a) {
return a&(sizeof(uintptr_t)*8-1);
}
/*
* Input Bounds:
* in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* in1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static
void internal_fiat_curve25519_solinas_mul(uintptr_t out0, uintptr_t in0, uintptr_t in1) {
uintptr_t x3, x2, x1, x7, x6, x5, x0, x4, x14, x35, x41, x33, x42, x12, x43, x45, x46, x25, x20, x40, x49, x44, x50, x15, x51, x53, x54, x47, x56, x17, x22, x37, x59, x48, x60, x23, x61, x63, x64, x52, x65, x18, x66, x68, x69, x55, x70, x10, x71, x73, x74, x57, x76, x9, x28, x58, x79, x62, x80, x26, x81, x83, x84, x67, x85, x21, x86, x88, x89, x72, x90, x13, x91, x93, x94, x75, x96, x77, x30, x39, x99, x78, x100, x31, x101, x103, x104, x82, x105, x29, x106, x108, x109, x87, x110, x24, x111, x113, x114, x92, x115, x16, x116, x118, x119, x95, x120, x8, x121, x123, x124, x97, x36, x98, x127, x102, x128, x34, x129, x131, x132, x107, x133, x32, x134, x136, x137, x112, x138, x27, x139, x141, x142, x117, x143, x19, x144, x146, x147, x122, x148, x11, x149, x151, x152, x125, x153, x150, x145, x140, x158, x126, x163, x130, x164, x156, x165, x167, x168, x135, x169, x154, x170, x172, x173, x155, x160, x38, x176, x162, x177, x161, x178, x180, x181, x166, x182, x159, x183, x185, x186, x171, x187, x157, x188, x190, x191, x174, x192, x193, x175, x195, x179, x197, x184, x199, x189, x201, x202, x203, x204, x194, x205, x196, x198, x200, x206, x207, x208, x209;
x0 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(0))), sizeof(uintptr_t));
x1 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(8))), sizeof(uintptr_t));
x2 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(16))), sizeof(uintptr_t));
x3 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(24))), sizeof(uintptr_t));
/*skip*/
x4 = _br2_load((in1)+((uintptr_t)(UINTMAX_C(0))), sizeof(uintptr_t));
x5 = _br2_load((in1)+((uintptr_t)(UINTMAX_C(8))), sizeof(uintptr_t));
x6 = _br2_load((in1)+((uintptr_t)(UINTMAX_C(16))), sizeof(uintptr_t));
x7 = _br2_load((in1)+((uintptr_t)(UINTMAX_C(24))), sizeof(uintptr_t));
/*skip*/
/*skip*/
x8 = (x3)*(x7);
x9 = _br2_mulhuu((x3), (x7));
x10 = (x3)*(x6);
x11 = _br2_mulhuu((x3), (x6));
x12 = (x3)*(x5);
x13 = _br2_mulhuu((x3), (x5));
x14 = (x3)*(x4);
x15 = _br2_mulhuu((x3), (x4));
x16 = (x2)*(x7);
x17 = _br2_mulhuu((x2), (x7));
x18 = (x2)*(x6);
x19 = _br2_mulhuu((x2), (x6));
x20 = (x2)*(x5);
x21 = _br2_mulhuu((x2), (x5));
x22 = (x2)*(x4);
x23 = _br2_mulhuu((x2), (x4));
x24 = (x1)*(x7);
x25 = _br2_mulhuu((x1), (x7));
x26 = (x1)*(x6);
x27 = _br2_mulhuu((x1), (x6));
x28 = (x1)*(x5);
x29 = _br2_mulhuu((x1), (x5));
x30 = (x1)*(x4);
x31 = _br2_mulhuu((x1), (x4));
x32 = (x0)*(x7);
x33 = _br2_mulhuu((x0), (x7));
x34 = (x0)*(x6);
x35 = _br2_mulhuu((x0), (x6));
x36 = (x0)*(x5);
x37 = _br2_mulhuu((x0), (x5));
x38 = (x0)*(x4);
x39 = _br2_mulhuu((x0), (x4));
x40 = (x35)+(x14);
x41 = (uintptr_t)((x40)<(x35));
x42 = (x41)+(x33);
x43 = (uintptr_t)((x42)<(x33));
x44 = (x42)+(x12);
x45 = (uintptr_t)((x44)<(x12));
x46 = (x43)+(x45);
x47 = (x46)+(x25);
x48 = (x40)+(x20);
x49 = (uintptr_t)((x48)<(x40));
x50 = (x49)+(x44);
x51 = (uintptr_t)((x50)<(x44));
x52 = (x50)+(x15);
x53 = (uintptr_t)((x52)<(x15));
x54 = (x51)+(x53);
x55 = (x54)+(x47);
x56 = (uintptr_t)((x55)<(x47));
x57 = (x56)+(x17);
x58 = (x37)+(x22);
x59 = (uintptr_t)((x58)<(x37));
x60 = (x59)+(x48);
x61 = (uintptr_t)((x60)<(x48));
x62 = (x60)+(x23);
x63 = (uintptr_t)((x62)<(x23));
x64 = (x61)+(x63);
x65 = (x64)+(x52);
x66 = (uintptr_t)((x65)<(x52));
x67 = (x65)+(x18);
x68 = (uintptr_t)((x67)<(x18));
x69 = (x66)+(x68);
x70 = (x69)+(x55);
x71 = (uintptr_t)((x70)<(x55));
x72 = (x70)+(x10);
x73 = (uintptr_t)((x72)<(x10));
x74 = (x71)+(x73);
x75 = (x74)+(x57);
x76 = (uintptr_t)((x75)<(x57));
x77 = (x76)+(x9);
x78 = (x58)+(x28);
x79 = (uintptr_t)((x78)<(x58));
x80 = (x79)+(x62);
x81 = (uintptr_t)((x80)<(x62));
x82 = (x80)+(x26);
x83 = (uintptr_t)((x82)<(x26));
x84 = (x81)+(x83);
x85 = (x84)+(x67);
x86 = (uintptr_t)((x85)<(x67));
x87 = (x85)+(x21);
x88 = (uintptr_t)((x87)<(x21));
x89 = (x86)+(x88);
x90 = (x89)+(x72);
x91 = (uintptr_t)((x90)<(x72));
x92 = (x90)+(x13);
x93 = (uintptr_t)((x92)<(x13));
x94 = (x91)+(x93);
x95 = (x94)+(x75);
x96 = (uintptr_t)((x95)<(x75));
x97 = (x96)+(x77);
x98 = (x39)+(x30);
x99 = (uintptr_t)((x98)<(x39));
x100 = (x99)+(x78);
x101 = (uintptr_t)((x100)<(x78));
x102 = (x100)+(x31);
x103 = (uintptr_t)((x102)<(x31));
x104 = (x101)+(x103);
x105 = (x104)+(x82);
x106 = (uintptr_t)((x105)<(x82));
x107 = (x105)+(x29);
x108 = (uintptr_t)((x107)<(x29));
x109 = (x106)+(x108);
x110 = (x109)+(x87);
x111 = (uintptr_t)((x110)<(x87));
x112 = (x110)+(x24);
x113 = (uintptr_t)((x112)<(x24));
x114 = (x111)+(x113);
x115 = (x114)+(x92);
x116 = (uintptr_t)((x115)<(x92));
x117 = (x115)+(x16);
x118 = (uintptr_t)((x117)<(x16));
x119 = (x116)+(x118);
x120 = (x119)+(x95);
x121 = (uintptr_t)((x120)<(x95));
x122 = (x120)+(x8);
x123 = (uintptr_t)((x122)<(x8));
x124 = (x121)+(x123);
x125 = (x124)+(x97);
x126 = (x98)+(x36);
x127 = (uintptr_t)((x126)<(x98));
x128 = (x127)+(x102);
x129 = (uintptr_t)((x128)<(x102));
x130 = (x128)+(x34);
x131 = (uintptr_t)((x130)<(x34));
x132 = (x129)+(x131);
x133 = (x132)+(x107);
x134 = (uintptr_t)((x133)<(x107));
x135 = (x133)+(x32);
x136 = (uintptr_t)((x135)<(x32));
x137 = (x134)+(x136);
x138 = (x137)+(x112);
x139 = (uintptr_t)((x138)<(x112));
x140 = (x138)+(x27);
x141 = (uintptr_t)((x140)<(x27));
x142 = (x139)+(x141);
x143 = (x142)+(x117);
x144 = (uintptr_t)((x143)<(x117));
x145 = (x143)+(x19);
x146 = (uintptr_t)((x145)<(x19));
x147 = (x144)+(x146);
x148 = (x147)+(x122);
x149 = (uintptr_t)((x148)<(x122));
x150 = (x148)+(x11);
x151 = (uintptr_t)((x150)<(x11));
x152 = (x149)+(x151);
x153 = (x152)+(x125);
x154 = ((uintptr_t)(UINTMAX_C(38)))*(x153);
x155 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x153));
x156 = ((uintptr_t)(UINTMAX_C(38)))*(x150);
x157 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x150));
x158 = ((uintptr_t)(UINTMAX_C(38)))*(x145);
x159 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x145));
x160 = ((uintptr_t)(UINTMAX_C(38)))*(x140);
x161 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x140));
x162 = (x126)+(x158);
x163 = (uintptr_t)((x162)<(x126));
x164 = (x163)+(x130);
x165 = (uintptr_t)((x164)<(x130));
x166 = (x164)+(x156);
x167 = (uintptr_t)((x166)<(x156));
x168 = (x165)+(x167);
x169 = (x168)+(x135);
x170 = (uintptr_t)((x169)<(x135));
x171 = (x169)+(x154);
x172 = (uintptr_t)((x171)<(x154));
x173 = (x170)+(x172);
x174 = (x173)+(x155);
x175 = (x38)+(x160);
x176 = (uintptr_t)((x175)<(x38));
x177 = (x176)+(x162);
x178 = (uintptr_t)((x177)<(x162));
x179 = (x177)+(x161);
x180 = (uintptr_t)((x179)<(x161));
x181 = (x178)+(x180);
x182 = (x181)+(x166);
x183 = (uintptr_t)((x182)<(x166));
x184 = (x182)+(x159);
x185 = (uintptr_t)((x184)<(x159));
x186 = (x183)+(x185);
x187 = (x186)+(x171);
x188 = (uintptr_t)((x187)<(x171));
x189 = (x187)+(x157);
x190 = (uintptr_t)((x189)<(x157));
x191 = (x188)+(x190);
x192 = (x191)+(x174);
x193 = ((uintptr_t)(UINTMAX_C(38)))*(x192);
x194 = (x175)+(x193);
x195 = (uintptr_t)((x194)<(x175));
x196 = (x195)+(x179);
x197 = (uintptr_t)((x196)<(x179));
x198 = (x197)+(x184);
x199 = (uintptr_t)((x198)<(x184));
x200 = (x199)+(x189);
x201 = (uintptr_t)((x200)<(x189));
x202 = ((uintptr_t)(UINTMAX_C(-1)))+((uintptr_t)((x201)==((uintptr_t)(UINTMAX_C(0)))));
x203 = (x202)^((uintptr_t)(UINTMAX_C(18446744073709551615)));
x204 = (((uintptr_t)(UINTMAX_C(38)))&(x202))|(((uintptr_t)(UINTMAX_C(0)))&(x203));
x205 = (x204)+(x194);
x206 = x205;
x207 = x196;
x208 = x198;
x209 = x200;
/*skip*/
_br2_store((out0)+((uintptr_t)(UINTMAX_C(0))), x206, sizeof(uintptr_t));
_br2_store((out0)+((uintptr_t)(UINTMAX_C(8))), x207, sizeof(uintptr_t));
_br2_store((out0)+((uintptr_t)(UINTMAX_C(16))), x208, sizeof(uintptr_t));
_br2_store((out0)+((uintptr_t)(UINTMAX_C(24))), x209, sizeof(uintptr_t));
/*skip*/
return;
}
/* NOTE: The following wrapper function is not covered by Coq proofs */
static void fiat_curve25519_solinas_mul(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) {
internal_fiat_curve25519_solinas_mul((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2);
}
/*
* Input Bounds:
* in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
* Output Bounds:
* out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static
void internal_fiat_curve25519_solinas_square(uintptr_t out0, uintptr_t in0) {
uintptr_t x6, x9, x15, x7, x16, x4, x17, x19, x20, x5, x21, x12, x22, x24, x25, x13, x26, x10, x27, x29, x30, x11, x32, x18, x35, x23, x36, x33, x37, x39, x40, x28, x42, x31, x8, x46, x47, x14, x48, x50, x51, x52, x34, x53, x55, x56, x57, x38, x58, x60, x61, x62, x41, x63, x65, x66, x67, x43, x68, x70, x71, x44, x3, x2, x1, x0, x80, x45, x82, x49, x83, x77, x84, x86, x87, x54, x88, x78, x89, x91, x92, x59, x93, x75, x94, x96, x97, x64, x98, x76, x99, x101, x102, x69, x103, x73, x104, x106, x107, x72, x108, x74, x109, x105, x100, x95, x114, x81, x119, x85, x120, x112, x121, x123, x124, x90, x125, x110, x126, x128, x129, x111, x116, x79, x132, x118, x133, x117, x134, x136, x137, x122, x138, x115, x139, x141, x142, x127, x143, x113, x144, x146, x147, x130, x148, x149, x131, x151, x135, x153, x140, x155, x145, x157, x158, x159, x160, x150, x161, x152, x154, x156, x162, x163, x164, x165;
x0 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(0))), sizeof(uintptr_t));
x1 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(8))), sizeof(uintptr_t));
x2 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(16))), sizeof(uintptr_t));
x3 = _br2_load((in0)+((uintptr_t)(UINTMAX_C(24))), sizeof(uintptr_t));
/*skip*/
/*skip*/
x4 = (x0)*(x3);
x5 = _br2_mulhuu((x0), (x3));
x6 = (x0)*(x2);
x7 = _br2_mulhuu((x0), (x2));
x8 = (x0)*(x1);
x9 = _br2_mulhuu((x0), (x1));
x10 = (x3)*(x2);
x11 = _br2_mulhuu((x3), (x2));
x12 = (x3)*(x1);
x13 = _br2_mulhuu((x3), (x1));
x14 = (x9)+(x6);
x15 = (uintptr_t)((x14)<(x9));
x16 = (x15)+(x7);
x17 = (uintptr_t)((x16)<(x7));
x18 = (x16)+(x4);
x19 = (uintptr_t)((x18)<(x4));
x20 = (x17)+(x19);
x21 = (x20)+(x5);
x22 = (uintptr_t)((x21)<(x5));
x23 = (x21)+(x12);
x24 = (uintptr_t)((x23)<(x12));
x25 = (x22)+(x24);
x26 = (x25)+(x13);
x27 = (uintptr_t)((x26)<(x13));
x28 = (x26)+(x10);
x29 = (uintptr_t)((x28)<(x10));
x30 = (x27)+(x29);
x31 = (x30)+(x11);
x32 = (x1)*(x2);
x33 = _br2_mulhuu((x1), (x2));
x34 = (x18)+(x32);
x35 = (uintptr_t)((x34)<(x18));
x36 = (x35)+(x23);
x37 = (uintptr_t)((x36)<(x23));
x38 = (x36)+(x33);
x39 = (uintptr_t)((x38)<(x33));
x40 = (x37)+(x39);
x41 = (x40)+(x28);
x42 = (uintptr_t)((x41)<(x28));
x43 = (x42)+(x31);
x44 = (uintptr_t)((x43)<(x31));
x45 = (x8)+(x8);
x46 = (uintptr_t)((x45)<(x8));
x47 = (x46)+(x14);
x48 = (uintptr_t)((x47)<(x14));
x49 = (x47)+(x14);
x50 = (uintptr_t)((x49)<(x14));
x51 = (x48)+(x50);
x52 = (x51)+(x34);
x53 = (uintptr_t)((x52)<(x34));
x54 = (x52)+(x34);
x55 = (uintptr_t)((x54)<(x34));
x56 = (x53)+(x55);
x57 = (x56)+(x38);
x58 = (uintptr_t)((x57)<(x38));
x59 = (x57)+(x38);
x60 = (uintptr_t)((x59)<(x38));
x61 = (x58)+(x60);
x62 = (x61)+(x41);
x63 = (uintptr_t)((x62)<(x41));
x64 = (x62)+(x41);
x65 = (uintptr_t)((x64)<(x41));
x66 = (x63)+(x65);
x67 = (x66)+(x43);
x68 = (uintptr_t)((x67)<(x43));
x69 = (x67)+(x43);
x70 = (uintptr_t)((x69)<(x43));
x71 = (x68)+(x70);
x72 = ((x71)+(x44))+(x44);
x73 = (x3)*(x3);
x74 = _br2_mulhuu((x3), (x3));
x75 = (x2)*(x2);
x76 = _br2_mulhuu((x2), (x2));
x77 = (x1)*(x1);
x78 = _br2_mulhuu((x1), (x1));
x79 = (x0)*(x0);
x80 = _br2_mulhuu((x0), (x0));
x81 = (x45)+(x80);
x82 = (uintptr_t)((x81)<(x45));
x83 = (x82)+(x49);
x84 = (uintptr_t)((x83)<(x49));
x85 = (x83)+(x77);
x86 = (uintptr_t)((x85)<(x77));
x87 = (x84)+(x86);
x88 = (x87)+(x54);
x89 = (uintptr_t)((x88)<(x54));
x90 = (x88)+(x78);
x91 = (uintptr_t)((x90)<(x78));
x92 = (x89)+(x91);
x93 = (x92)+(x59);
x94 = (uintptr_t)((x93)<(x59));
x95 = (x93)+(x75);
x96 = (uintptr_t)((x95)<(x75));
x97 = (x94)+(x96);
x98 = (x97)+(x64);
x99 = (uintptr_t)((x98)<(x64));
x100 = (x98)+(x76);
x101 = (uintptr_t)((x100)<(x76));
x102 = (x99)+(x101);
x103 = (x102)+(x69);
x104 = (uintptr_t)((x103)<(x69));
x105 = (x103)+(x73);
x106 = (uintptr_t)((x105)<(x73));
x107 = (x104)+(x106);
x108 = (x107)+(x72);
x109 = (x108)+(x74);
x110 = ((uintptr_t)(UINTMAX_C(38)))*(x109);
x111 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x109));
x112 = ((uintptr_t)(UINTMAX_C(38)))*(x105);
x113 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x105));
x114 = ((uintptr_t)(UINTMAX_C(38)))*(x100);
x115 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x100));
x116 = ((uintptr_t)(UINTMAX_C(38)))*(x95);
x117 = _br2_mulhuu(((uintptr_t)(UINTMAX_C(38))), (x95));
x118 = (x81)+(x114);
x119 = (uintptr_t)((x118)<(x81));
x120 = (x119)+(x85);
x121 = (uintptr_t)((x120)<(x85));
x122 = (x120)+(x112);
x123 = (uintptr_t)((x122)<(x112));
x124 = (x121)+(x123);
x125 = (x124)+(x90);
x126 = (uintptr_t)((x125)<(x90));
x127 = (x125)+(x110);
x128 = (uintptr_t)((x127)<(x110));
x129 = (x126)+(x128);
x130 = (x129)+(x111);
x131 = (x79)+(x116);
x132 = (uintptr_t)((x131)<(x79));
x133 = (x132)+(x118);
x134 = (uintptr_t)((x133)<(x118));
x135 = (x133)+(x117);
x136 = (uintptr_t)((x135)<(x117));
x137 = (x134)+(x136);
x138 = (x137)+(x122);
x139 = (uintptr_t)((x138)<(x122));
x140 = (x138)+(x115);
x141 = (uintptr_t)((x140)<(x115));
x142 = (x139)+(x141);
x143 = (x142)+(x127);
x144 = (uintptr_t)((x143)<(x127));
x145 = (x143)+(x113);
x146 = (uintptr_t)((x145)<(x113));
x147 = (x144)+(x146);
x148 = (x147)+(x130);
x149 = ((uintptr_t)(UINTMAX_C(38)))*(x148);
x150 = (x131)+(x149);
x151 = (uintptr_t)((x150)<(x131));
x152 = (x151)+(x135);
x153 = (uintptr_t)((x152)<(x135));
x154 = (x153)+(x140);
x155 = (uintptr_t)((x154)<(x140));
x156 = (x155)+(x145);
x157 = (uintptr_t)((x156)<(x145));
x158 = ((uintptr_t)(UINTMAX_C(-1)))+((uintptr_t)((x157)==((uintptr_t)(UINTMAX_C(0)))));
x159 = (x158)^((uintptr_t)(UINTMAX_C(18446744073709551615)));
x160 = (((uintptr_t)(UINTMAX_C(38)))&(x158))|(((uintptr_t)(UINTMAX_C(0)))&(x159));
x161 = (x160)+(x150);
x162 = x161;
x163 = x152;
x164 = x154;
x165 = x156;
/*skip*/
_br2_store((out0)+((uintptr_t)(UINTMAX_C(0))), x162, sizeof(uintptr_t));
_br2_store((out0)+((uintptr_t)(UINTMAX_C(8))), x163, sizeof(uintptr_t));
_br2_store((out0)+((uintptr_t)(UINTMAX_C(16))), x164, sizeof(uintptr_t));
_br2_store((out0)+((uintptr_t)(UINTMAX_C(24))), x165, sizeof(uintptr_t));
/*skip*/
return;
}
/* NOTE: The following wrapper function is not covered by Coq proofs */
static void fiat_curve25519_solinas_square(uint64_t out1[4], const uint64_t arg1[4]) {
internal_fiat_curve25519_solinas_square((uintptr_t)out1, (uintptr_t)arg1);
}