1 /* Autogenerated */
2 /* curve description: 25519 */
3 /* requested operations: carry_mul, carry_square, carry_scmul121666, carry, add, sub, opp, selectznz, to_bytes, from_bytes */
4 /* n = 10 (from "10") */
5 /* s = 0x8000000000000000000000000000000000000000000000000000000000000000 (from "2^255") */
6 /* c = [(1, 19)] (from "1,19") */
7 /* machine_wordsize = 32 (from "32") */
8
9 #include <stdint.h>
10 typedef unsigned char fiat_25519_uint1;
11 typedef signed char fiat_25519_int1;
12
13
14 /*
15 * Input Bounds:
16 * arg1: [0x0 ~> 0x1]
17 * arg2: [0x0 ~> 0x3ffffff]
18 * arg3: [0x0 ~> 0x3ffffff]
19 * Output Bounds:
20 * out1: [0x0 ~> 0x3ffffff]
21 * out2: [0x0 ~> 0x1]
22 */
fiat_25519_addcarryx_u26(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)23 static void fiat_25519_addcarryx_u26(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
24 uint32_t x1 = ((arg1 + arg2) + arg3);
25 uint32_t x2 = (x1 & UINT32_C(0x3ffffff));
26 fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 26);
27 *out1 = x2;
28 *out2 = x3;
29 }
30
31 /*
32 * Input Bounds:
33 * arg1: [0x0 ~> 0x1]
34 * arg2: [0x0 ~> 0x3ffffff]
35 * arg3: [0x0 ~> 0x3ffffff]
36 * Output Bounds:
37 * out1: [0x0 ~> 0x3ffffff]
38 * out2: [0x0 ~> 0x1]
39 */
fiat_25519_subborrowx_u26(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)40 static void fiat_25519_subborrowx_u26(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
41 int32_t x1 = ((int32_t)(arg2 - arg1) - (int32_t)arg3);
42 fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 26);
43 uint32_t x3 = (x1 & UINT32_C(0x3ffffff));
44 *out1 = x3;
45 *out2 = (fiat_25519_uint1)(0x0 - x2);
46 }
47
48 /*
49 * Input Bounds:
50 * arg1: [0x0 ~> 0x1]
51 * arg2: [0x0 ~> 0x1ffffff]
52 * arg3: [0x0 ~> 0x1ffffff]
53 * Output Bounds:
54 * out1: [0x0 ~> 0x1ffffff]
55 * out2: [0x0 ~> 0x1]
56 */
fiat_25519_addcarryx_u25(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)57 static void fiat_25519_addcarryx_u25(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
58 uint32_t x1 = ((arg1 + arg2) + arg3);
59 uint32_t x2 = (x1 & UINT32_C(0x1ffffff));
60 fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 25);
61 *out1 = x2;
62 *out2 = x3;
63 }
64
65 /*
66 * Input Bounds:
67 * arg1: [0x0 ~> 0x1]
68 * arg2: [0x0 ~> 0x1ffffff]
69 * arg3: [0x0 ~> 0x1ffffff]
70 * Output Bounds:
71 * out1: [0x0 ~> 0x1ffffff]
72 * out2: [0x0 ~> 0x1]
73 */
fiat_25519_subborrowx_u25(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)74 static void fiat_25519_subborrowx_u25(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
75 int32_t x1 = ((int32_t)(arg2 - arg1) - (int32_t)arg3);
76 fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 25);
77 uint32_t x3 = (x1 & UINT32_C(0x1ffffff));
78 *out1 = x3;
79 *out2 = (fiat_25519_uint1)(0x0 - x2);
80 }
81
82 /*
83 * Input Bounds:
84 * arg1: [0x0 ~> 0x1]
85 * arg2: [0x0 ~> 0xffffffff]
86 * arg3: [0x0 ~> 0xffffffff]
87 * Output Bounds:
88 * out1: [0x0 ~> 0xffffffff]
89 */
fiat_25519_cmovznz_u32(uint32_t * out1,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)90 static void fiat_25519_cmovznz_u32(uint32_t* out1, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
91 fiat_25519_uint1 x1 = (!(!arg1));
92 uint32_t x2 = ((fiat_25519_int1)(0x0 - x1) & UINT32_C(0xffffffff));
93 uint32_t x3 = ((x2 & arg3) | ((~x2) & arg2));
94 *out1 = x3;
95 }
96
97 /*
98 * Input Bounds:
99 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
100 * arg2: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
101 * Output Bounds:
102 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
103 */
fiat_25519_carry_mul(uint32_t out1[10],const uint32_t arg1[10],const uint32_t arg2[10])104 static void fiat_25519_carry_mul(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
105 uint64_t x1 = ((uint64_t)(arg1[9]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
106 uint64_t x2 = ((uint64_t)(arg1[9]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
107 uint64_t x3 = ((uint64_t)(arg1[9]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
108 uint64_t x4 = ((uint64_t)(arg1[9]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
109 uint64_t x5 = ((uint64_t)(arg1[9]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
110 uint64_t x6 = ((uint64_t)(arg1[9]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
111 uint64_t x7 = ((uint64_t)(arg1[9]) * ((arg2[3]) * ((uint32_t)0x2 * UINT8_C(0x13))));
112 uint64_t x8 = ((uint64_t)(arg1[9]) * ((arg2[2]) * (uint32_t)UINT8_C(0x13)));
113 uint64_t x9 = ((uint64_t)(arg1[9]) * ((arg2[1]) * ((uint32_t)0x2 * UINT8_C(0x13))));
114 uint64_t x10 = ((uint64_t)(arg1[8]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
115 uint64_t x11 = ((uint64_t)(arg1[8]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
116 uint64_t x12 = ((uint64_t)(arg1[8]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
117 uint64_t x13 = ((uint64_t)(arg1[8]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
118 uint64_t x14 = ((uint64_t)(arg1[8]) * ((arg2[5]) * (uint32_t)UINT8_C(0x13)));
119 uint64_t x15 = ((uint64_t)(arg1[8]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
120 uint64_t x16 = ((uint64_t)(arg1[8]) * ((arg2[3]) * (uint32_t)UINT8_C(0x13)));
121 uint64_t x17 = ((uint64_t)(arg1[8]) * ((arg2[2]) * (uint32_t)UINT8_C(0x13)));
122 uint64_t x18 = ((uint64_t)(arg1[7]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
123 uint64_t x19 = ((uint64_t)(arg1[7]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
124 uint64_t x20 = ((uint64_t)(arg1[7]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
125 uint64_t x21 = ((uint64_t)(arg1[7]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
126 uint64_t x22 = ((uint64_t)(arg1[7]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
127 uint64_t x23 = ((uint64_t)(arg1[7]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
128 uint64_t x24 = ((uint64_t)(arg1[7]) * ((arg2[3]) * ((uint32_t)0x2 * UINT8_C(0x13))));
129 uint64_t x25 = ((uint64_t)(arg1[6]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
130 uint64_t x26 = ((uint64_t)(arg1[6]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
131 uint64_t x27 = ((uint64_t)(arg1[6]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
132 uint64_t x28 = ((uint64_t)(arg1[6]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
133 uint64_t x29 = ((uint64_t)(arg1[6]) * ((arg2[5]) * (uint32_t)UINT8_C(0x13)));
134 uint64_t x30 = ((uint64_t)(arg1[6]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
135 uint64_t x31 = ((uint64_t)(arg1[5]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
136 uint64_t x32 = ((uint64_t)(arg1[5]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
137 uint64_t x33 = ((uint64_t)(arg1[5]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
138 uint64_t x34 = ((uint64_t)(arg1[5]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
139 uint64_t x35 = ((uint64_t)(arg1[5]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
140 uint64_t x36 = ((uint64_t)(arg1[4]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
141 uint64_t x37 = ((uint64_t)(arg1[4]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
142 uint64_t x38 = ((uint64_t)(arg1[4]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
143 uint64_t x39 = ((uint64_t)(arg1[4]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
144 uint64_t x40 = ((uint64_t)(arg1[3]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
145 uint64_t x41 = ((uint64_t)(arg1[3]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
146 uint64_t x42 = ((uint64_t)(arg1[3]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
147 uint64_t x43 = ((uint64_t)(arg1[2]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
148 uint64_t x44 = ((uint64_t)(arg1[2]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
149 uint64_t x45 = ((uint64_t)(arg1[1]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
150 uint64_t x46 = ((uint64_t)(arg1[9]) * (arg2[0]));
151 uint64_t x47 = ((uint64_t)(arg1[8]) * (arg2[1]));
152 uint64_t x48 = ((uint64_t)(arg1[8]) * (arg2[0]));
153 uint64_t x49 = ((uint64_t)(arg1[7]) * (arg2[2]));
154 uint64_t x50 = ((uint64_t)(arg1[7]) * ((arg2[1]) * (uint32_t)0x2));
155 uint64_t x51 = ((uint64_t)(arg1[7]) * (arg2[0]));
156 uint64_t x52 = ((uint64_t)(arg1[6]) * (arg2[3]));
157 uint64_t x53 = ((uint64_t)(arg1[6]) * (arg2[2]));
158 uint64_t x54 = ((uint64_t)(arg1[6]) * (arg2[1]));
159 uint64_t x55 = ((uint64_t)(arg1[6]) * (arg2[0]));
160 uint64_t x56 = ((uint64_t)(arg1[5]) * (arg2[4]));
161 uint64_t x57 = ((uint64_t)(arg1[5]) * ((arg2[3]) * (uint32_t)0x2));
162 uint64_t x58 = ((uint64_t)(arg1[5]) * (arg2[2]));
163 uint64_t x59 = ((uint64_t)(arg1[5]) * ((arg2[1]) * (uint32_t)0x2));
164 uint64_t x60 = ((uint64_t)(arg1[5]) * (arg2[0]));
165 uint64_t x61 = ((uint64_t)(arg1[4]) * (arg2[5]));
166 uint64_t x62 = ((uint64_t)(arg1[4]) * (arg2[4]));
167 uint64_t x63 = ((uint64_t)(arg1[4]) * (arg2[3]));
168 uint64_t x64 = ((uint64_t)(arg1[4]) * (arg2[2]));
169 uint64_t x65 = ((uint64_t)(arg1[4]) * (arg2[1]));
170 uint64_t x66 = ((uint64_t)(arg1[4]) * (arg2[0]));
171 uint64_t x67 = ((uint64_t)(arg1[3]) * (arg2[6]));
172 uint64_t x68 = ((uint64_t)(arg1[3]) * ((arg2[5]) * (uint32_t)0x2));
173 uint64_t x69 = ((uint64_t)(arg1[3]) * (arg2[4]));
174 uint64_t x70 = ((uint64_t)(arg1[3]) * ((arg2[3]) * (uint32_t)0x2));
175 uint64_t x71 = ((uint64_t)(arg1[3]) * (arg2[2]));
176 uint64_t x72 = ((uint64_t)(arg1[3]) * ((arg2[1]) * (uint32_t)0x2));
177 uint64_t x73 = ((uint64_t)(arg1[3]) * (arg2[0]));
178 uint64_t x74 = ((uint64_t)(arg1[2]) * (arg2[7]));
179 uint64_t x75 = ((uint64_t)(arg1[2]) * (arg2[6]));
180 uint64_t x76 = ((uint64_t)(arg1[2]) * (arg2[5]));
181 uint64_t x77 = ((uint64_t)(arg1[2]) * (arg2[4]));
182 uint64_t x78 = ((uint64_t)(arg1[2]) * (arg2[3]));
183 uint64_t x79 = ((uint64_t)(arg1[2]) * (arg2[2]));
184 uint64_t x80 = ((uint64_t)(arg1[2]) * (arg2[1]));
185 uint64_t x81 = ((uint64_t)(arg1[2]) * (arg2[0]));
186 uint64_t x82 = ((uint64_t)(arg1[1]) * (arg2[8]));
187 uint64_t x83 = ((uint64_t)(arg1[1]) * ((arg2[7]) * (uint32_t)0x2));
188 uint64_t x84 = ((uint64_t)(arg1[1]) * (arg2[6]));
189 uint64_t x85 = ((uint64_t)(arg1[1]) * ((arg2[5]) * (uint32_t)0x2));
190 uint64_t x86 = ((uint64_t)(arg1[1]) * (arg2[4]));
191 uint64_t x87 = ((uint64_t)(arg1[1]) * ((arg2[3]) * (uint32_t)0x2));
192 uint64_t x88 = ((uint64_t)(arg1[1]) * (arg2[2]));
193 uint64_t x89 = ((uint64_t)(arg1[1]) * ((arg2[1]) * (uint32_t)0x2));
194 uint64_t x90 = ((uint64_t)(arg1[1]) * (arg2[0]));
195 uint64_t x91 = ((uint64_t)(arg1[0]) * (arg2[9]));
196 uint64_t x92 = ((uint64_t)(arg1[0]) * (arg2[8]));
197 uint64_t x93 = ((uint64_t)(arg1[0]) * (arg2[7]));
198 uint64_t x94 = ((uint64_t)(arg1[0]) * (arg2[6]));
199 uint64_t x95 = ((uint64_t)(arg1[0]) * (arg2[5]));
200 uint64_t x96 = ((uint64_t)(arg1[0]) * (arg2[4]));
201 uint64_t x97 = ((uint64_t)(arg1[0]) * (arg2[3]));
202 uint64_t x98 = ((uint64_t)(arg1[0]) * (arg2[2]));
203 uint64_t x99 = ((uint64_t)(arg1[0]) * (arg2[1]));
204 uint64_t x100 = ((uint64_t)(arg1[0]) * (arg2[0]));
205 uint64_t x101 = (x100 + (x45 + (x44 + (x42 + (x39 + (x35 + (x30 + (x24 + (x17 + x9)))))))));
206 uint64_t x102 = (x101 >> 26);
207 uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x3ffffff));
208 uint64_t x104 = (x91 + (x82 + (x74 + (x67 + (x61 + (x56 + (x52 + (x49 + (x47 + x46)))))))));
209 uint64_t x105 = (x92 + (x83 + (x75 + (x68 + (x62 + (x57 + (x53 + (x50 + (x48 + x1)))))))));
210 uint64_t x106 = (x93 + (x84 + (x76 + (x69 + (x63 + (x58 + (x54 + (x51 + (x10 + x2)))))))));
211 uint64_t x107 = (x94 + (x85 + (x77 + (x70 + (x64 + (x59 + (x55 + (x18 + (x11 + x3)))))))));
212 uint64_t x108 = (x95 + (x86 + (x78 + (x71 + (x65 + (x60 + (x25 + (x19 + (x12 + x4)))))))));
213 uint64_t x109 = (x96 + (x87 + (x79 + (x72 + (x66 + (x31 + (x26 + (x20 + (x13 + x5)))))))));
214 uint64_t x110 = (x97 + (x88 + (x80 + (x73 + (x36 + (x32 + (x27 + (x21 + (x14 + x6)))))))));
215 uint64_t x111 = (x98 + (x89 + (x81 + (x40 + (x37 + (x33 + (x28 + (x22 + (x15 + x7)))))))));
216 uint64_t x112 = (x99 + (x90 + (x43 + (x41 + (x38 + (x34 + (x29 + (x23 + (x16 + x8)))))))));
217 uint64_t x113 = (x102 + x112);
218 uint64_t x114 = (x113 >> 25);
219 uint32_t x115 = (uint32_t)(x113 & UINT32_C(0x1ffffff));
220 uint64_t x116 = (x114 + x111);
221 uint64_t x117 = (x116 >> 26);
222 uint32_t x118 = (uint32_t)(x116 & UINT32_C(0x3ffffff));
223 uint64_t x119 = (x117 + x110);
224 uint64_t x120 = (x119 >> 25);
225 uint32_t x121 = (uint32_t)(x119 & UINT32_C(0x1ffffff));
226 uint64_t x122 = (x120 + x109);
227 uint64_t x123 = (x122 >> 26);
228 uint32_t x124 = (uint32_t)(x122 & UINT32_C(0x3ffffff));
229 uint64_t x125 = (x123 + x108);
230 uint64_t x126 = (x125 >> 25);
231 uint32_t x127 = (uint32_t)(x125 & UINT32_C(0x1ffffff));
232 uint64_t x128 = (x126 + x107);
233 uint64_t x129 = (x128 >> 26);
234 uint32_t x130 = (uint32_t)(x128 & UINT32_C(0x3ffffff));
235 uint64_t x131 = (x129 + x106);
236 uint64_t x132 = (x131 >> 25);
237 uint32_t x133 = (uint32_t)(x131 & UINT32_C(0x1ffffff));
238 uint64_t x134 = (x132 + x105);
239 uint64_t x135 = (x134 >> 26);
240 uint32_t x136 = (uint32_t)(x134 & UINT32_C(0x3ffffff));
241 uint64_t x137 = (x135 + x104);
242 uint64_t x138 = (x137 >> 25);
243 uint32_t x139 = (uint32_t)(x137 & UINT32_C(0x1ffffff));
244 uint64_t x140 = (x138 * (uint64_t)UINT8_C(0x13));
245 uint64_t x141 = (x103 + x140);
246 uint32_t x142 = (uint32_t)(x141 >> 26);
247 uint32_t x143 = (uint32_t)(x141 & UINT32_C(0x3ffffff));
248 uint32_t x144 = (x142 + x115);
249 uint32_t x145 = (x144 >> 25);
250 uint32_t x146 = (x144 & UINT32_C(0x1ffffff));
251 uint32_t x147 = (x145 + x118);
252 out1[0] = x143;
253 out1[1] = x146;
254 out1[2] = x147;
255 out1[3] = x121;
256 out1[4] = x124;
257 out1[5] = x127;
258 out1[6] = x130;
259 out1[7] = x133;
260 out1[8] = x136;
261 out1[9] = x139;
262 }
263
264 /*
265 * Input Bounds:
266 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
267 * Output Bounds:
268 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
269 */
fiat_25519_carry_square(uint32_t out1[10],const uint32_t arg1[10])270 static void fiat_25519_carry_square(uint32_t out1[10], const uint32_t arg1[10]) {
271 uint32_t x1 = ((arg1[9]) * (uint32_t)UINT8_C(0x13));
272 uint32_t x2 = (x1 * (uint32_t)0x2);
273 uint32_t x3 = ((arg1[9]) * (uint32_t)0x2);
274 uint32_t x4 = ((arg1[8]) * (uint32_t)UINT8_C(0x13));
275 uint64_t x5 = (x4 * (uint64_t)0x2);
276 uint32_t x6 = ((arg1[8]) * (uint32_t)0x2);
277 uint32_t x7 = ((arg1[7]) * (uint32_t)UINT8_C(0x13));
278 uint32_t x8 = (x7 * (uint32_t)0x2);
279 uint32_t x9 = ((arg1[7]) * (uint32_t)0x2);
280 uint32_t x10 = ((arg1[6]) * (uint32_t)UINT8_C(0x13));
281 uint64_t x11 = (x10 * (uint64_t)0x2);
282 uint32_t x12 = ((arg1[6]) * (uint32_t)0x2);
283 uint32_t x13 = ((arg1[5]) * (uint32_t)UINT8_C(0x13));
284 uint32_t x14 = ((arg1[5]) * (uint32_t)0x2);
285 uint32_t x15 = ((arg1[4]) * (uint32_t)0x2);
286 uint32_t x16 = ((arg1[3]) * (uint32_t)0x2);
287 uint32_t x17 = ((arg1[2]) * (uint32_t)0x2);
288 uint32_t x18 = ((arg1[1]) * (uint32_t)0x2);
289 uint64_t x19 = ((uint64_t)(arg1[9]) * (x1 * (uint32_t)0x2));
290 uint64_t x20 = ((uint64_t)(arg1[8]) * x2);
291 uint64_t x21 = ((uint64_t)(arg1[8]) * x4);
292 uint64_t x22 = ((arg1[7]) * (x2 * (uint64_t)0x2));
293 uint64_t x23 = ((arg1[7]) * x5);
294 uint64_t x24 = ((uint64_t)(arg1[7]) * (x7 * (uint32_t)0x2));
295 uint64_t x25 = ((uint64_t)(arg1[6]) * x2);
296 uint64_t x26 = ((arg1[6]) * x5);
297 uint64_t x27 = ((uint64_t)(arg1[6]) * x8);
298 uint64_t x28 = ((uint64_t)(arg1[6]) * x10);
299 uint64_t x29 = ((arg1[5]) * (x2 * (uint64_t)0x2));
300 uint64_t x30 = ((arg1[5]) * x5);
301 uint64_t x31 = ((arg1[5]) * (x8 * (uint64_t)0x2));
302 uint64_t x32 = ((arg1[5]) * x11);
303 uint64_t x33 = ((uint64_t)(arg1[5]) * (x13 * (uint32_t)0x2));
304 uint64_t x34 = ((uint64_t)(arg1[4]) * x2);
305 uint64_t x35 = ((arg1[4]) * x5);
306 uint64_t x36 = ((uint64_t)(arg1[4]) * x8);
307 uint64_t x37 = ((arg1[4]) * x11);
308 uint64_t x38 = ((uint64_t)(arg1[4]) * x14);
309 uint64_t x39 = ((uint64_t)(arg1[4]) * (arg1[4]));
310 uint64_t x40 = ((arg1[3]) * (x2 * (uint64_t)0x2));
311 uint64_t x41 = ((arg1[3]) * x5);
312 uint64_t x42 = ((arg1[3]) * (x8 * (uint64_t)0x2));
313 uint64_t x43 = ((uint64_t)(arg1[3]) * x12);
314 uint64_t x44 = ((uint64_t)(arg1[3]) * (x14 * (uint32_t)0x2));
315 uint64_t x45 = ((uint64_t)(arg1[3]) * x15);
316 uint64_t x46 = ((uint64_t)(arg1[3]) * ((arg1[3]) * (uint32_t)0x2));
317 uint64_t x47 = ((uint64_t)(arg1[2]) * x2);
318 uint64_t x48 = ((arg1[2]) * x5);
319 uint64_t x49 = ((uint64_t)(arg1[2]) * x9);
320 uint64_t x50 = ((uint64_t)(arg1[2]) * x12);
321 uint64_t x51 = ((uint64_t)(arg1[2]) * x14);
322 uint64_t x52 = ((uint64_t)(arg1[2]) * x15);
323 uint64_t x53 = ((uint64_t)(arg1[2]) * x16);
324 uint64_t x54 = ((uint64_t)(arg1[2]) * (arg1[2]));
325 uint64_t x55 = ((arg1[1]) * (x2 * (uint64_t)0x2));
326 uint64_t x56 = ((uint64_t)(arg1[1]) * x6);
327 uint64_t x57 = ((uint64_t)(arg1[1]) * (x9 * (uint32_t)0x2));
328 uint64_t x58 = ((uint64_t)(arg1[1]) * x12);
329 uint64_t x59 = ((uint64_t)(arg1[1]) * (x14 * (uint32_t)0x2));
330 uint64_t x60 = ((uint64_t)(arg1[1]) * x15);
331 uint64_t x61 = ((uint64_t)(arg1[1]) * (x16 * (uint32_t)0x2));
332 uint64_t x62 = ((uint64_t)(arg1[1]) * x17);
333 uint64_t x63 = ((uint64_t)(arg1[1]) * ((arg1[1]) * (uint32_t)0x2));
334 uint64_t x64 = ((uint64_t)(arg1[0]) * x3);
335 uint64_t x65 = ((uint64_t)(arg1[0]) * x6);
336 uint64_t x66 = ((uint64_t)(arg1[0]) * x9);
337 uint64_t x67 = ((uint64_t)(arg1[0]) * x12);
338 uint64_t x68 = ((uint64_t)(arg1[0]) * x14);
339 uint64_t x69 = ((uint64_t)(arg1[0]) * x15);
340 uint64_t x70 = ((uint64_t)(arg1[0]) * x16);
341 uint64_t x71 = ((uint64_t)(arg1[0]) * x17);
342 uint64_t x72 = ((uint64_t)(arg1[0]) * x18);
343 uint64_t x73 = ((uint64_t)(arg1[0]) * (arg1[0]));
344 uint64_t x74 = (x73 + (x55 + (x48 + (x42 + (x37 + x33)))));
345 uint64_t x75 = (x74 >> 26);
346 uint32_t x76 = (uint32_t)(x74 & UINT32_C(0x3ffffff));
347 uint64_t x77 = (x64 + (x56 + (x49 + (x43 + x38))));
348 uint64_t x78 = (x65 + (x57 + (x50 + (x44 + (x39 + x19)))));
349 uint64_t x79 = (x66 + (x58 + (x51 + (x45 + x20))));
350 uint64_t x80 = (x67 + (x59 + (x52 + (x46 + (x22 + x21)))));
351 uint64_t x81 = (x68 + (x60 + (x53 + (x25 + x23))));
352 uint64_t x82 = (x69 + (x61 + (x54 + (x29 + (x26 + x24)))));
353 uint64_t x83 = (x70 + (x62 + (x34 + (x30 + x27))));
354 uint64_t x84 = (x71 + (x63 + (x40 + (x35 + (x31 + x28)))));
355 uint64_t x85 = (x72 + (x47 + (x41 + (x36 + x32))));
356 uint64_t x86 = (x75 + x85);
357 uint64_t x87 = (x86 >> 25);
358 uint32_t x88 = (uint32_t)(x86 & UINT32_C(0x1ffffff));
359 uint64_t x89 = (x87 + x84);
360 uint64_t x90 = (x89 >> 26);
361 uint32_t x91 = (uint32_t)(x89 & UINT32_C(0x3ffffff));
362 uint64_t x92 = (x90 + x83);
363 uint64_t x93 = (x92 >> 25);
364 uint32_t x94 = (uint32_t)(x92 & UINT32_C(0x1ffffff));
365 uint64_t x95 = (x93 + x82);
366 uint64_t x96 = (x95 >> 26);
367 uint32_t x97 = (uint32_t)(x95 & UINT32_C(0x3ffffff));
368 uint64_t x98 = (x96 + x81);
369 uint64_t x99 = (x98 >> 25);
370 uint32_t x100 = (uint32_t)(x98 & UINT32_C(0x1ffffff));
371 uint64_t x101 = (x99 + x80);
372 uint64_t x102 = (x101 >> 26);
373 uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x3ffffff));
374 uint64_t x104 = (x102 + x79);
375 uint64_t x105 = (x104 >> 25);
376 uint32_t x106 = (uint32_t)(x104 & UINT32_C(0x1ffffff));
377 uint64_t x107 = (x105 + x78);
378 uint64_t x108 = (x107 >> 26);
379 uint32_t x109 = (uint32_t)(x107 & UINT32_C(0x3ffffff));
380 uint64_t x110 = (x108 + x77);
381 uint64_t x111 = (x110 >> 25);
382 uint32_t x112 = (uint32_t)(x110 & UINT32_C(0x1ffffff));
383 uint64_t x113 = (x111 * (uint64_t)UINT8_C(0x13));
384 uint64_t x114 = (x76 + x113);
385 uint32_t x115 = (uint32_t)(x114 >> 26);
386 uint32_t x116 = (uint32_t)(x114 & UINT32_C(0x3ffffff));
387 uint32_t x117 = (x115 + x88);
388 uint32_t x118 = (x117 >> 25);
389 uint32_t x119 = (x117 & UINT32_C(0x1ffffff));
390 uint32_t x120 = (x118 + x91);
391 out1[0] = x116;
392 out1[1] = x119;
393 out1[2] = x120;
394 out1[3] = x94;
395 out1[4] = x97;
396 out1[5] = x100;
397 out1[6] = x103;
398 out1[7] = x106;
399 out1[8] = x109;
400 out1[9] = x112;
401 }
402
403 /*
404 * Input Bounds:
405 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
406 * Output Bounds:
407 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
408 */
fiat_25519_carry_scmul_121666(uint32_t out1[10],const uint32_t arg1[10])409 static void fiat_25519_carry_scmul_121666(uint32_t out1[10], const uint32_t arg1[10]) {
410 uint64_t x1 = ((uint64_t)UINT32_C(0x1db42) * (arg1[9]));
411 uint64_t x2 = ((uint64_t)UINT32_C(0x1db42) * (arg1[8]));
412 uint64_t x3 = ((uint64_t)UINT32_C(0x1db42) * (arg1[7]));
413 uint64_t x4 = ((uint64_t)UINT32_C(0x1db42) * (arg1[6]));
414 uint64_t x5 = ((uint64_t)UINT32_C(0x1db42) * (arg1[5]));
415 uint64_t x6 = ((uint64_t)UINT32_C(0x1db42) * (arg1[4]));
416 uint64_t x7 = ((uint64_t)UINT32_C(0x1db42) * (arg1[3]));
417 uint64_t x8 = ((uint64_t)UINT32_C(0x1db42) * (arg1[2]));
418 uint64_t x9 = ((uint64_t)UINT32_C(0x1db42) * (arg1[1]));
419 uint64_t x10 = ((uint64_t)UINT32_C(0x1db42) * (arg1[0]));
420 uint32_t x11 = (uint32_t)(x10 >> 26);
421 uint32_t x12 = (uint32_t)(x10 & UINT32_C(0x3ffffff));
422 uint64_t x13 = (x11 + x9);
423 uint32_t x14 = (uint32_t)(x13 >> 25);
424 uint32_t x15 = (uint32_t)(x13 & UINT32_C(0x1ffffff));
425 uint64_t x16 = (x14 + x8);
426 uint32_t x17 = (uint32_t)(x16 >> 26);
427 uint32_t x18 = (uint32_t)(x16 & UINT32_C(0x3ffffff));
428 uint64_t x19 = (x17 + x7);
429 uint32_t x20 = (uint32_t)(x19 >> 25);
430 uint32_t x21 = (uint32_t)(x19 & UINT32_C(0x1ffffff));
431 uint64_t x22 = (x20 + x6);
432 uint32_t x23 = (uint32_t)(x22 >> 26);
433 uint32_t x24 = (uint32_t)(x22 & UINT32_C(0x3ffffff));
434 uint64_t x25 = (x23 + x5);
435 uint32_t x26 = (uint32_t)(x25 >> 25);
436 uint32_t x27 = (uint32_t)(x25 & UINT32_C(0x1ffffff));
437 uint64_t x28 = (x26 + x4);
438 uint32_t x29 = (uint32_t)(x28 >> 26);
439 uint32_t x30 = (uint32_t)(x28 & UINT32_C(0x3ffffff));
440 uint64_t x31 = (x29 + x3);
441 uint32_t x32 = (uint32_t)(x31 >> 25);
442 uint32_t x33 = (uint32_t)(x31 & UINT32_C(0x1ffffff));
443 uint64_t x34 = (x32 + x2);
444 uint32_t x35 = (uint32_t)(x34 >> 26);
445 uint32_t x36 = (uint32_t)(x34 & UINT32_C(0x3ffffff));
446 uint64_t x37 = (x35 + x1);
447 uint32_t x38 = (uint32_t)(x37 >> 25);
448 uint32_t x39 = (uint32_t)(x37 & UINT32_C(0x1ffffff));
449 uint32_t x40 = (x38 * (uint32_t)UINT8_C(0x13));
450 uint32_t x41 = (x12 + x40);
451 uint32_t x42 = (x41 >> 26);
452 uint32_t x43 = (x41 & UINT32_C(0x3ffffff));
453 uint32_t x44 = (x42 + x15);
454 uint32_t x45 = (x44 >> 25);
455 uint32_t x46 = (x44 & UINT32_C(0x1ffffff));
456 uint32_t x47 = (x45 + x18);
457 out1[0] = x43;
458 out1[1] = x46;
459 out1[2] = x47;
460 out1[3] = x21;
461 out1[4] = x24;
462 out1[5] = x27;
463 out1[6] = x30;
464 out1[7] = x33;
465 out1[8] = x36;
466 out1[9] = x39;
467 }
468
469 /*
470 * Input Bounds:
471 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
472 * Output Bounds:
473 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
474 */
fiat_25519_carry(uint32_t out1[10],const uint32_t arg1[10])475 static void fiat_25519_carry(uint32_t out1[10], const uint32_t arg1[10]) {
476 uint32_t x1 = (arg1[0]);
477 uint32_t x2 = ((x1 >> 26) + (arg1[1]));
478 uint32_t x3 = ((x2 >> 25) + (arg1[2]));
479 uint32_t x4 = ((x3 >> 26) + (arg1[3]));
480 uint32_t x5 = ((x4 >> 25) + (arg1[4]));
481 uint32_t x6 = ((x5 >> 26) + (arg1[5]));
482 uint32_t x7 = ((x6 >> 25) + (arg1[6]));
483 uint32_t x8 = ((x7 >> 26) + (arg1[7]));
484 uint32_t x9 = ((x8 >> 25) + (arg1[8]));
485 uint32_t x10 = ((x9 >> 26) + (arg1[9]));
486 uint32_t x11 = ((x1 & UINT32_C(0x3ffffff)) + ((x10 >> 25) * (uint32_t)UINT8_C(0x13)));
487 uint32_t x12 = ((x11 >> 26) + (x2 & UINT32_C(0x1ffffff)));
488 uint32_t x13 = (x11 & UINT32_C(0x3ffffff));
489 uint32_t x14 = (x12 & UINT32_C(0x1ffffff));
490 uint32_t x15 = ((x12 >> 25) + (x3 & UINT32_C(0x3ffffff)));
491 uint32_t x16 = (x4 & UINT32_C(0x1ffffff));
492 uint32_t x17 = (x5 & UINT32_C(0x3ffffff));
493 uint32_t x18 = (x6 & UINT32_C(0x1ffffff));
494 uint32_t x19 = (x7 & UINT32_C(0x3ffffff));
495 uint32_t x20 = (x8 & UINT32_C(0x1ffffff));
496 uint32_t x21 = (x9 & UINT32_C(0x3ffffff));
497 uint32_t x22 = (x10 & UINT32_C(0x1ffffff));
498 out1[0] = x13;
499 out1[1] = x14;
500 out1[2] = x15;
501 out1[3] = x16;
502 out1[4] = x17;
503 out1[5] = x18;
504 out1[6] = x19;
505 out1[7] = x20;
506 out1[8] = x21;
507 out1[9] = x22;
508 }
509
510 /*
511 * Input Bounds:
512 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
513 * arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
514 * Output Bounds:
515 * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
516 */
fiat_25519_add(uint32_t out1[10],const uint32_t arg1[10],const uint32_t arg2[10])517 static void fiat_25519_add(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
518 uint32_t x1 = ((arg1[0]) + (arg2[0]));
519 uint32_t x2 = ((arg1[1]) + (arg2[1]));
520 uint32_t x3 = ((arg1[2]) + (arg2[2]));
521 uint32_t x4 = ((arg1[3]) + (arg2[3]));
522 uint32_t x5 = ((arg1[4]) + (arg2[4]));
523 uint32_t x6 = ((arg1[5]) + (arg2[5]));
524 uint32_t x7 = ((arg1[6]) + (arg2[6]));
525 uint32_t x8 = ((arg1[7]) + (arg2[7]));
526 uint32_t x9 = ((arg1[8]) + (arg2[8]));
527 uint32_t x10 = ((arg1[9]) + (arg2[9]));
528 out1[0] = x1;
529 out1[1] = x2;
530 out1[2] = x3;
531 out1[3] = x4;
532 out1[4] = x5;
533 out1[5] = x6;
534 out1[6] = x7;
535 out1[7] = x8;
536 out1[8] = x9;
537 out1[9] = x10;
538 }
539
540 /*
541 * Input Bounds:
542 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
543 * arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
544 * Output Bounds:
545 * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
546 */
fiat_25519_sub(uint32_t out1[10],const uint32_t arg1[10],const uint32_t arg2[10])547 static void fiat_25519_sub(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
548 uint32_t x1 = ((UINT32_C(0x7ffffda) + (arg1[0])) - (arg2[0]));
549 uint32_t x2 = ((UINT32_C(0x3fffffe) + (arg1[1])) - (arg2[1]));
550 uint32_t x3 = ((UINT32_C(0x7fffffe) + (arg1[2])) - (arg2[2]));
551 uint32_t x4 = ((UINT32_C(0x3fffffe) + (arg1[3])) - (arg2[3]));
552 uint32_t x5 = ((UINT32_C(0x7fffffe) + (arg1[4])) - (arg2[4]));
553 uint32_t x6 = ((UINT32_C(0x3fffffe) + (arg1[5])) - (arg2[5]));
554 uint32_t x7 = ((UINT32_C(0x7fffffe) + (arg1[6])) - (arg2[6]));
555 uint32_t x8 = ((UINT32_C(0x3fffffe) + (arg1[7])) - (arg2[7]));
556 uint32_t x9 = ((UINT32_C(0x7fffffe) + (arg1[8])) - (arg2[8]));
557 uint32_t x10 = ((UINT32_C(0x3fffffe) + (arg1[9])) - (arg2[9]));
558 out1[0] = x1;
559 out1[1] = x2;
560 out1[2] = x3;
561 out1[3] = x4;
562 out1[4] = x5;
563 out1[5] = x6;
564 out1[6] = x7;
565 out1[7] = x8;
566 out1[8] = x9;
567 out1[9] = x10;
568 }
569
570 /*
571 * Input Bounds:
572 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
573 * Output Bounds:
574 * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
575 */
fiat_25519_opp(uint32_t out1[10],const uint32_t arg1[10])576 static void fiat_25519_opp(uint32_t out1[10], const uint32_t arg1[10]) {
577 uint32_t x1 = (UINT32_C(0x7ffffda) - (arg1[0]));
578 uint32_t x2 = (UINT32_C(0x3fffffe) - (arg1[1]));
579 uint32_t x3 = (UINT32_C(0x7fffffe) - (arg1[2]));
580 uint32_t x4 = (UINT32_C(0x3fffffe) - (arg1[3]));
581 uint32_t x5 = (UINT32_C(0x7fffffe) - (arg1[4]));
582 uint32_t x6 = (UINT32_C(0x3fffffe) - (arg1[5]));
583 uint32_t x7 = (UINT32_C(0x7fffffe) - (arg1[6]));
584 uint32_t x8 = (UINT32_C(0x3fffffe) - (arg1[7]));
585 uint32_t x9 = (UINT32_C(0x7fffffe) - (arg1[8]));
586 uint32_t x10 = (UINT32_C(0x3fffffe) - (arg1[9]));
587 out1[0] = x1;
588 out1[1] = x2;
589 out1[2] = x3;
590 out1[3] = x4;
591 out1[4] = x5;
592 out1[5] = x6;
593 out1[6] = x7;
594 out1[7] = x8;
595 out1[8] = x9;
596 out1[9] = x10;
597 }
598
599 /*
600 * Input Bounds:
601 * arg1: [0x0 ~> 0x1]
602 * arg2: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]]
603 * arg3: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]]
604 * Output Bounds:
605 * out1: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]]
606 */
fiat_25519_selectznz(uint32_t out1[10],fiat_25519_uint1 arg1,const uint32_t arg2[10],const uint32_t arg3[10])607 static void fiat_25519_selectznz(uint32_t out1[10], fiat_25519_uint1 arg1, const uint32_t arg2[10], const uint32_t arg3[10]) {
608 uint32_t x1;
609 fiat_25519_cmovznz_u32(&x1, arg1, (arg2[0]), (arg3[0]));
610 uint32_t x2;
611 fiat_25519_cmovznz_u32(&x2, arg1, (arg2[1]), (arg3[1]));
612 uint32_t x3;
613 fiat_25519_cmovznz_u32(&x3, arg1, (arg2[2]), (arg3[2]));
614 uint32_t x4;
615 fiat_25519_cmovznz_u32(&x4, arg1, (arg2[3]), (arg3[3]));
616 uint32_t x5;
617 fiat_25519_cmovznz_u32(&x5, arg1, (arg2[4]), (arg3[4]));
618 uint32_t x6;
619 fiat_25519_cmovznz_u32(&x6, arg1, (arg2[5]), (arg3[5]));
620 uint32_t x7;
621 fiat_25519_cmovznz_u32(&x7, arg1, (arg2[6]), (arg3[6]));
622 uint32_t x8;
623 fiat_25519_cmovznz_u32(&x8, arg1, (arg2[7]), (arg3[7]));
624 uint32_t x9;
625 fiat_25519_cmovznz_u32(&x9, arg1, (arg2[8]), (arg3[8]));
626 uint32_t x10;
627 fiat_25519_cmovznz_u32(&x10, arg1, (arg2[9]), (arg3[9]));
628 out1[0] = x1;
629 out1[1] = x2;
630 out1[2] = x3;
631 out1[3] = x4;
632 out1[4] = x5;
633 out1[5] = x6;
634 out1[6] = x7;
635 out1[7] = x8;
636 out1[8] = x9;
637 out1[9] = x10;
638 }
639
640 /*
641 * Input Bounds:
642 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
643 * Output Bounds:
644 * 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 ~> 0x7f]]
645 */
fiat_25519_to_bytes(uint8_t out1[32],const uint32_t arg1[10])646 static void fiat_25519_to_bytes(uint8_t out1[32], const uint32_t arg1[10]) {
647 uint32_t x1;
648 fiat_25519_uint1 x2;
649 fiat_25519_subborrowx_u26(&x1, &x2, 0x0, (arg1[0]), UINT32_C(0x3ffffed));
650 uint32_t x3;
651 fiat_25519_uint1 x4;
652 fiat_25519_subborrowx_u25(&x3, &x4, x2, (arg1[1]), UINT32_C(0x1ffffff));
653 uint32_t x5;
654 fiat_25519_uint1 x6;
655 fiat_25519_subborrowx_u26(&x5, &x6, x4, (arg1[2]), UINT32_C(0x3ffffff));
656 uint32_t x7;
657 fiat_25519_uint1 x8;
658 fiat_25519_subborrowx_u25(&x7, &x8, x6, (arg1[3]), UINT32_C(0x1ffffff));
659 uint32_t x9;
660 fiat_25519_uint1 x10;
661 fiat_25519_subborrowx_u26(&x9, &x10, x8, (arg1[4]), UINT32_C(0x3ffffff));
662 uint32_t x11;
663 fiat_25519_uint1 x12;
664 fiat_25519_subborrowx_u25(&x11, &x12, x10, (arg1[5]), UINT32_C(0x1ffffff));
665 uint32_t x13;
666 fiat_25519_uint1 x14;
667 fiat_25519_subborrowx_u26(&x13, &x14, x12, (arg1[6]), UINT32_C(0x3ffffff));
668 uint32_t x15;
669 fiat_25519_uint1 x16;
670 fiat_25519_subborrowx_u25(&x15, &x16, x14, (arg1[7]), UINT32_C(0x1ffffff));
671 uint32_t x17;
672 fiat_25519_uint1 x18;
673 fiat_25519_subborrowx_u26(&x17, &x18, x16, (arg1[8]), UINT32_C(0x3ffffff));
674 uint32_t x19;
675 fiat_25519_uint1 x20;
676 fiat_25519_subborrowx_u25(&x19, &x20, x18, (arg1[9]), UINT32_C(0x1ffffff));
677 uint32_t x21;
678 fiat_25519_cmovznz_u32(&x21, x20, 0x0, UINT32_C(0xffffffff));
679 uint32_t x22;
680 fiat_25519_uint1 x23;
681 fiat_25519_addcarryx_u26(&x22, &x23, 0x0, (x21 & UINT32_C(0x3ffffed)), x1);
682 uint32_t x24;
683 fiat_25519_uint1 x25;
684 fiat_25519_addcarryx_u25(&x24, &x25, x23, (x21 & UINT32_C(0x1ffffff)), x3);
685 uint32_t x26;
686 fiat_25519_uint1 x27;
687 fiat_25519_addcarryx_u26(&x26, &x27, x25, (x21 & UINT32_C(0x3ffffff)), x5);
688 uint32_t x28;
689 fiat_25519_uint1 x29;
690 fiat_25519_addcarryx_u25(&x28, &x29, x27, (x21 & UINT32_C(0x1ffffff)), x7);
691 uint32_t x30;
692 fiat_25519_uint1 x31;
693 fiat_25519_addcarryx_u26(&x30, &x31, x29, (x21 & UINT32_C(0x3ffffff)), x9);
694 uint32_t x32;
695 fiat_25519_uint1 x33;
696 fiat_25519_addcarryx_u25(&x32, &x33, x31, (x21 & UINT32_C(0x1ffffff)), x11);
697 uint32_t x34;
698 fiat_25519_uint1 x35;
699 fiat_25519_addcarryx_u26(&x34, &x35, x33, (x21 & UINT32_C(0x3ffffff)), x13);
700 uint32_t x36;
701 fiat_25519_uint1 x37;
702 fiat_25519_addcarryx_u25(&x36, &x37, x35, (x21 & UINT32_C(0x1ffffff)), x15);
703 uint32_t x38;
704 fiat_25519_uint1 x39;
705 fiat_25519_addcarryx_u26(&x38, &x39, x37, (x21 & UINT32_C(0x3ffffff)), x17);
706 uint32_t x40;
707 fiat_25519_uint1 x41;
708 fiat_25519_addcarryx_u25(&x40, &x41, x39, (x21 & UINT32_C(0x1ffffff)), x19);
709 uint32_t x42 = (x40 << 6);
710 uint32_t x43 = (x38 << 4);
711 uint32_t x44 = (x36 << 3);
712 uint32_t x45 = (x34 * (uint32_t)0x2);
713 uint32_t x46 = (x30 << 6);
714 uint32_t x47 = (x28 << 5);
715 uint32_t x48 = (x26 << 3);
716 uint32_t x49 = (x24 << 2);
717 uint32_t x50 = (x22 >> 8);
718 uint8_t x51 = (uint8_t)(x22 & UINT8_C(0xff));
719 uint32_t x52 = (x50 >> 8);
720 uint8_t x53 = (uint8_t)(x50 & UINT8_C(0xff));
721 uint8_t x54 = (uint8_t)(x52 >> 8);
722 uint8_t x55 = (uint8_t)(x52 & UINT8_C(0xff));
723 uint32_t x56 = (x54 + x49);
724 uint32_t x57 = (x56 >> 8);
725 uint8_t x58 = (uint8_t)(x56 & UINT8_C(0xff));
726 uint32_t x59 = (x57 >> 8);
727 uint8_t x60 = (uint8_t)(x57 & UINT8_C(0xff));
728 uint8_t x61 = (uint8_t)(x59 >> 8);
729 uint8_t x62 = (uint8_t)(x59 & UINT8_C(0xff));
730 uint32_t x63 = (x61 + x48);
731 uint32_t x64 = (x63 >> 8);
732 uint8_t x65 = (uint8_t)(x63 & UINT8_C(0xff));
733 uint32_t x66 = (x64 >> 8);
734 uint8_t x67 = (uint8_t)(x64 & UINT8_C(0xff));
735 uint8_t x68 = (uint8_t)(x66 >> 8);
736 uint8_t x69 = (uint8_t)(x66 & UINT8_C(0xff));
737 uint32_t x70 = (x68 + x47);
738 uint32_t x71 = (x70 >> 8);
739 uint8_t x72 = (uint8_t)(x70 & UINT8_C(0xff));
740 uint32_t x73 = (x71 >> 8);
741 uint8_t x74 = (uint8_t)(x71 & UINT8_C(0xff));
742 uint8_t x75 = (uint8_t)(x73 >> 8);
743 uint8_t x76 = (uint8_t)(x73 & UINT8_C(0xff));
744 uint32_t x77 = (x75 + x46);
745 uint32_t x78 = (x77 >> 8);
746 uint8_t x79 = (uint8_t)(x77 & UINT8_C(0xff));
747 uint32_t x80 = (x78 >> 8);
748 uint8_t x81 = (uint8_t)(x78 & UINT8_C(0xff));
749 uint8_t x82 = (uint8_t)(x80 >> 8);
750 uint8_t x83 = (uint8_t)(x80 & UINT8_C(0xff));
751 uint8_t x84 = (uint8_t)(x82 & UINT8_C(0xff));
752 uint32_t x85 = (x32 >> 8);
753 uint8_t x86 = (uint8_t)(x32 & UINT8_C(0xff));
754 uint32_t x87 = (x85 >> 8);
755 uint8_t x88 = (uint8_t)(x85 & UINT8_C(0xff));
756 fiat_25519_uint1 x89 = (fiat_25519_uint1)(x87 >> 8);
757 uint8_t x90 = (uint8_t)(x87 & UINT8_C(0xff));
758 uint32_t x91 = (x89 + x45);
759 uint32_t x92 = (x91 >> 8);
760 uint8_t x93 = (uint8_t)(x91 & UINT8_C(0xff));
761 uint32_t x94 = (x92 >> 8);
762 uint8_t x95 = (uint8_t)(x92 & UINT8_C(0xff));
763 uint8_t x96 = (uint8_t)(x94 >> 8);
764 uint8_t x97 = (uint8_t)(x94 & UINT8_C(0xff));
765 uint32_t x98 = (x96 + x44);
766 uint32_t x99 = (x98 >> 8);
767 uint8_t x100 = (uint8_t)(x98 & UINT8_C(0xff));
768 uint32_t x101 = (x99 >> 8);
769 uint8_t x102 = (uint8_t)(x99 & UINT8_C(0xff));
770 uint8_t x103 = (uint8_t)(x101 >> 8);
771 uint8_t x104 = (uint8_t)(x101 & UINT8_C(0xff));
772 uint32_t x105 = (x103 + x43);
773 uint32_t x106 = (x105 >> 8);
774 uint8_t x107 = (uint8_t)(x105 & UINT8_C(0xff));
775 uint32_t x108 = (x106 >> 8);
776 uint8_t x109 = (uint8_t)(x106 & UINT8_C(0xff));
777 uint8_t x110 = (uint8_t)(x108 >> 8);
778 uint8_t x111 = (uint8_t)(x108 & UINT8_C(0xff));
779 uint32_t x112 = (x110 + x42);
780 uint32_t x113 = (x112 >> 8);
781 uint8_t x114 = (uint8_t)(x112 & UINT8_C(0xff));
782 uint32_t x115 = (x113 >> 8);
783 uint8_t x116 = (uint8_t)(x113 & UINT8_C(0xff));
784 uint8_t x117 = (uint8_t)(x115 >> 8);
785 uint8_t x118 = (uint8_t)(x115 & UINT8_C(0xff));
786 out1[0] = x51;
787 out1[1] = x53;
788 out1[2] = x55;
789 out1[3] = x58;
790 out1[4] = x60;
791 out1[5] = x62;
792 out1[6] = x65;
793 out1[7] = x67;
794 out1[8] = x69;
795 out1[9] = x72;
796 out1[10] = x74;
797 out1[11] = x76;
798 out1[12] = x79;
799 out1[13] = x81;
800 out1[14] = x83;
801 out1[15] = x84;
802 out1[16] = x86;
803 out1[17] = x88;
804 out1[18] = x90;
805 out1[19] = x93;
806 out1[20] = x95;
807 out1[21] = x97;
808 out1[22] = x100;
809 out1[23] = x102;
810 out1[24] = x104;
811 out1[25] = x107;
812 out1[26] = x109;
813 out1[27] = x111;
814 out1[28] = x114;
815 out1[29] = x116;
816 out1[30] = x118;
817 out1[31] = x117;
818 }
819
820 /*
821 * Input Bounds:
822 * 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 ~> 0x7f]]
823 * Output Bounds:
824 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
825 */
fiat_25519_from_bytes(uint32_t out1[10],const uint8_t arg1[32])826 static void fiat_25519_from_bytes(uint32_t out1[10], const uint8_t arg1[32]) {
827 uint32_t x1 = ((uint32_t)(arg1[31]) << 18);
828 uint32_t x2 = ((uint32_t)(arg1[30]) << 10);
829 uint32_t x3 = ((uint32_t)(arg1[29]) << 2);
830 uint32_t x4 = ((uint32_t)(arg1[28]) << 20);
831 uint32_t x5 = ((uint32_t)(arg1[27]) << 12);
832 uint32_t x6 = ((uint32_t)(arg1[26]) << 4);
833 uint32_t x7 = ((uint32_t)(arg1[25]) << 21);
834 uint32_t x8 = ((uint32_t)(arg1[24]) << 13);
835 uint32_t x9 = ((uint32_t)(arg1[23]) << 5);
836 uint32_t x10 = ((uint32_t)(arg1[22]) << 23);
837 uint32_t x11 = ((uint32_t)(arg1[21]) << 15);
838 uint32_t x12 = ((uint32_t)(arg1[20]) << 7);
839 uint32_t x13 = ((uint32_t)(arg1[19]) << 24);
840 uint32_t x14 = ((uint32_t)(arg1[18]) << 16);
841 uint32_t x15 = ((uint32_t)(arg1[17]) << 8);
842 uint8_t x16 = (arg1[16]);
843 uint32_t x17 = ((uint32_t)(arg1[15]) << 18);
844 uint32_t x18 = ((uint32_t)(arg1[14]) << 10);
845 uint32_t x19 = ((uint32_t)(arg1[13]) << 2);
846 uint32_t x20 = ((uint32_t)(arg1[12]) << 19);
847 uint32_t x21 = ((uint32_t)(arg1[11]) << 11);
848 uint32_t x22 = ((uint32_t)(arg1[10]) << 3);
849 uint32_t x23 = ((uint32_t)(arg1[9]) << 21);
850 uint32_t x24 = ((uint32_t)(arg1[8]) << 13);
851 uint32_t x25 = ((uint32_t)(arg1[7]) << 5);
852 uint32_t x26 = ((uint32_t)(arg1[6]) << 22);
853 uint32_t x27 = ((uint32_t)(arg1[5]) << 14);
854 uint32_t x28 = ((uint32_t)(arg1[4]) << 6);
855 uint32_t x29 = ((uint32_t)(arg1[3]) << 24);
856 uint32_t x30 = ((uint32_t)(arg1[2]) << 16);
857 uint32_t x31 = ((uint32_t)(arg1[1]) << 8);
858 uint8_t x32 = (arg1[0]);
859 uint32_t x33 = (x32 + (x31 + (x30 + x29)));
860 uint8_t x34 = (uint8_t)(x33 >> 26);
861 uint32_t x35 = (x33 & UINT32_C(0x3ffffff));
862 uint32_t x36 = (x3 + (x2 + x1));
863 uint32_t x37 = (x6 + (x5 + x4));
864 uint32_t x38 = (x9 + (x8 + x7));
865 uint32_t x39 = (x12 + (x11 + x10));
866 uint32_t x40 = (x16 + (x15 + (x14 + x13)));
867 uint32_t x41 = (x19 + (x18 + x17));
868 uint32_t x42 = (x22 + (x21 + x20));
869 uint32_t x43 = (x25 + (x24 + x23));
870 uint32_t x44 = (x28 + (x27 + x26));
871 uint32_t x45 = (x34 + x44);
872 uint8_t x46 = (uint8_t)(x45 >> 25);
873 uint32_t x47 = (x45 & UINT32_C(0x1ffffff));
874 uint32_t x48 = (x46 + x43);
875 uint8_t x49 = (uint8_t)(x48 >> 26);
876 uint32_t x50 = (x48 & UINT32_C(0x3ffffff));
877 uint32_t x51 = (x49 + x42);
878 uint8_t x52 = (uint8_t)(x51 >> 25);
879 uint32_t x53 = (x51 & UINT32_C(0x1ffffff));
880 uint32_t x54 = (x52 + x41);
881 uint32_t x55 = (x54 & UINT32_C(0x3ffffff));
882 uint8_t x56 = (uint8_t)(x40 >> 25);
883 uint32_t x57 = (x40 & UINT32_C(0x1ffffff));
884 uint32_t x58 = (x56 + x39);
885 uint8_t x59 = (uint8_t)(x58 >> 26);
886 uint32_t x60 = (x58 & UINT32_C(0x3ffffff));
887 uint32_t x61 = (x59 + x38);
888 uint8_t x62 = (uint8_t)(x61 >> 25);
889 uint32_t x63 = (x61 & UINT32_C(0x1ffffff));
890 uint32_t x64 = (x62 + x37);
891 uint8_t x65 = (uint8_t)(x64 >> 26);
892 uint32_t x66 = (x64 & UINT32_C(0x3ffffff));
893 uint32_t x67 = (x65 + x36);
894 out1[0] = x35;
895 out1[1] = x47;
896 out1[2] = x50;
897 out1[3] = x53;
898 out1[4] = x55;
899 out1[5] = x57;
900 out1[6] = x60;
901 out1[7] = x63;
902 out1[8] = x66;
903 out1[9] = x67;
904 }
905
906