Skip to content

Instantly share code, notes, and snippets.

@jadephilipoom
Created July 10, 2020 14:31
Show Gist options
  • Save jadephilipoom/b7620241a17e2283d30c69b9aa5c775b to your computer and use it in GitHub Desktop.
Save jadephilipoom/b7620241a17e2283d30c69b9aa5c775b to your computer and use it in GitHub Desktop.
Replace boringssl curve25519_64 function bodies with bedrock2 implementations
diff --git a/third_party/fiat/curve25519_64.h b/third_party/fiat/curve25519_64.h
index 02679bbbd..a9bfe21e7 100644
--- a/third_party/fiat/curve25519_64.h
+++ b/third_party/fiat/curve25519_64.h
@@ -19,75 +19,6 @@ typedef unsigned __int128 fiat_25519_uint128;
#endif
-/*
- * The function fiat_25519_addcarryx_u51 is an addition with carry.
- * Postconditions:
- * out1 = (arg1 + arg2 + arg3) mod 2^51
- * out2 = ⌊(arg1 + arg2 + arg3) / 2^51⌋
- *
- * Input Bounds:
- * arg1: [0x0 ~> 0x1]
- * arg2: [0x0 ~> 0x7ffffffffffff]
- * arg3: [0x0 ~> 0x7ffffffffffff]
- * Output Bounds:
- * out1: [0x0 ~> 0x7ffffffffffff]
- * out2: [0x0 ~> 0x1]
- */
-static void fiat_25519_addcarryx_u51(uint64_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
- uint64_t x1 = ((arg1 + arg2) + arg3);
- uint64_t x2 = (x1 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 51);
- *out1 = x2;
- *out2 = x3;
-}
-
-/*
- * The function fiat_25519_subborrowx_u51 is a subtraction with borrow.
- * Postconditions:
- * out1 = (-arg1 + arg2 + -arg3) mod 2^51
- * out2 = -⌊(-arg1 + arg2 + -arg3) / 2^51⌋
- *
- * Input Bounds:
- * arg1: [0x0 ~> 0x1]
- * arg2: [0x0 ~> 0x7ffffffffffff]
- * arg3: [0x0 ~> 0x7ffffffffffff]
- * Output Bounds:
- * out1: [0x0 ~> 0x7ffffffffffff]
- * out2: [0x0 ~> 0x1]
- */
-static void fiat_25519_subborrowx_u51(uint64_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
- int64_t x1 = ((int64_t)(arg2 - (int64_t)arg1) - (int64_t)arg3);
- fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 51);
- uint64_t x3 = (x1 & UINT64_C(0x7ffffffffffff));
- *out1 = x3;
- *out2 = (fiat_25519_uint1)(0x0 - x2);
-}
-
-/*
- * The function fiat_25519_cmovznz_u64 is a single-word conditional move.
- * Postconditions:
- * out1 = (if arg1 = 0 then arg2 else arg3)
- *
- * Input Bounds:
- * arg1: [0x0 ~> 0x1]
- * arg2: [0x0 ~> 0xffffffffffffffff]
- * arg3: [0x0 ~> 0xffffffffffffffff]
- * Output Bounds:
- * out1: [0x0 ~> 0xffffffffffffffff]
- */
-static void fiat_25519_cmovznz_u64(uint64_t* out1, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
- fiat_25519_uint1 x1 = (!(!arg1));
- uint64_t x2 = ((fiat_25519_int1)(0x0 - x1) & UINT64_C(0xffffffffffffffff));
- // Note this line has been patched from the synthesized code to add value
- // barriers.
- //
- // Clang recognizes this pattern as a select. While it usually transforms it
- // to a cmov, it sometimes further transforms it into a branch, which we do
- // not want.
- uint64_t x3 = ((value_barrier_u64(x2) & arg3) | (value_barrier_u64(~x2) & arg2));
- *out1 = x3;
-}
-
/*
* The function fiat_25519_carry_mul multiplies two field elements and reduces the result.
* Postconditions:
@@ -100,63 +31,197 @@ static void fiat_25519_cmovznz_u64(uint64_t* out1, fiat_25519_uint1 arg1, uint64
* out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
*/
static void fiat_25519_carry_mul(uint64_t out1[5], const uint64_t arg1[5], const uint64_t arg2[5]) {
- fiat_25519_uint128 x1 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[4]) * UINT8_C(0x13)));
- fiat_25519_uint128 x2 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[3]) * UINT8_C(0x13)));
- fiat_25519_uint128 x3 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[2]) * UINT8_C(0x13)));
- fiat_25519_uint128 x4 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[1]) * UINT8_C(0x13)));
- fiat_25519_uint128 x5 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[4]) * UINT8_C(0x13)));
- fiat_25519_uint128 x6 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[3]) * UINT8_C(0x13)));
- fiat_25519_uint128 x7 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[2]) * UINT8_C(0x13)));
- fiat_25519_uint128 x8 = ((fiat_25519_uint128)(arg1[2]) * ((arg2[4]) * UINT8_C(0x13)));
- fiat_25519_uint128 x9 = ((fiat_25519_uint128)(arg1[2]) * ((arg2[3]) * UINT8_C(0x13)));
- fiat_25519_uint128 x10 = ((fiat_25519_uint128)(arg1[1]) * ((arg2[4]) * UINT8_C(0x13)));
- fiat_25519_uint128 x11 = ((fiat_25519_uint128)(arg1[4]) * (arg2[0]));
- fiat_25519_uint128 x12 = ((fiat_25519_uint128)(arg1[3]) * (arg2[1]));
- fiat_25519_uint128 x13 = ((fiat_25519_uint128)(arg1[3]) * (arg2[0]));
- fiat_25519_uint128 x14 = ((fiat_25519_uint128)(arg1[2]) * (arg2[2]));
- fiat_25519_uint128 x15 = ((fiat_25519_uint128)(arg1[2]) * (arg2[1]));
- fiat_25519_uint128 x16 = ((fiat_25519_uint128)(arg1[2]) * (arg2[0]));
- fiat_25519_uint128 x17 = ((fiat_25519_uint128)(arg1[1]) * (arg2[3]));
- fiat_25519_uint128 x18 = ((fiat_25519_uint128)(arg1[1]) * (arg2[2]));
- fiat_25519_uint128 x19 = ((fiat_25519_uint128)(arg1[1]) * (arg2[1]));
- fiat_25519_uint128 x20 = ((fiat_25519_uint128)(arg1[1]) * (arg2[0]));
- fiat_25519_uint128 x21 = ((fiat_25519_uint128)(arg1[0]) * (arg2[4]));
- fiat_25519_uint128 x22 = ((fiat_25519_uint128)(arg1[0]) * (arg2[3]));
- fiat_25519_uint128 x23 = ((fiat_25519_uint128)(arg1[0]) * (arg2[2]));
- fiat_25519_uint128 x24 = ((fiat_25519_uint128)(arg1[0]) * (arg2[1]));
- fiat_25519_uint128 x25 = ((fiat_25519_uint128)(arg1[0]) * (arg2[0]));
- fiat_25519_uint128 x26 = (x25 + (x10 + (x9 + (x7 + x4))));
- uint64_t x27 = (uint64_t)(x26 >> 51);
- uint64_t x28 = (uint64_t)(x26 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x29 = (x21 + (x17 + (x14 + (x12 + x11))));
- fiat_25519_uint128 x30 = (x22 + (x18 + (x15 + (x13 + x1))));
- fiat_25519_uint128 x31 = (x23 + (x19 + (x16 + (x5 + x2))));
- fiat_25519_uint128 x32 = (x24 + (x20 + (x8 + (x6 + x3))));
- fiat_25519_uint128 x33 = (x27 + x32);
- uint64_t x34 = (uint64_t)(x33 >> 51);
- uint64_t x35 = (uint64_t)(x33 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x36 = (x34 + x31);
- uint64_t x37 = (uint64_t)(x36 >> 51);
- uint64_t x38 = (uint64_t)(x36 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x39 = (x37 + x30);
- uint64_t x40 = (uint64_t)(x39 >> 51);
- uint64_t x41 = (uint64_t)(x39 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x42 = (x40 + x29);
- uint64_t x43 = (uint64_t)(x42 >> 51);
- uint64_t x44 = (uint64_t)(x42 & UINT64_C(0x7ffffffffffff));
- uint64_t x45 = (x43 * UINT8_C(0x13));
- uint64_t x46 = (x28 + x45);
- uint64_t x47 = (x46 >> 51);
- uint64_t x48 = (x46 & UINT64_C(0x7ffffffffffff));
- uint64_t x49 = (x47 + x35);
- fiat_25519_uint1 x50 = (fiat_25519_uint1)(x49 >> 51);
- uint64_t x51 = (x49 & UINT64_C(0x7ffffffffffff));
- uint64_t x52 = (x50 + x38);
- out1[0] = x48;
- out1[1] = x51;
- out1[2] = x52;
- out1[3] = x41;
- out1[4] = x44;
+ uintptr_t x4, x3, x2, x1, x9, x8, x7, x6, x0, x5, x16, x22, x61, x23, x62, x17, x60, x26, x65, x27, x66, x63, x64, x28, x69, x29, x70, x67, x68, x58, x73, x59, x74, x71, x75, x72, x30, x32, x79, x33, x80, x31, x78, x36, x83, x37, x84, x81, x82, x42, x87, x43, x88, x85, x86, x50, x91, x51, x92, x89, x10, x34, x95, x35, x96, x11, x94, x38, x99, x39, x100, x97, x98, x44, x103, x45, x104, x101, x102, x52, x107, x53, x108, x105, x12, x18, x111, x19, x112, x13, x110, x40, x115, x41, x116, x113, x114, x46, x119, x47, x120, x117, x118, x54, x123, x55, x124, x121, x14, x20, x127, x21, x128, x15, x126, x24, x131, x25, x132, x129, x130, x48, x135, x49, x136, x133, x134, x56, x139, x57, x140, x137, x138, x76, x143, x141, x144, x142, x122, x145, x148, x125, x149, x147, x106, x150, x153, x109, x154, x152, x90, x155, x158, x93, x159, x157, x160, x77, x162, x163, x164, x146, x166, x167, x151, x165, x168, x169, x156, x161, x170, x171, x172, x173, x174;
+ uintptr_t in0, in1, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ in1 = (uintptr_t) (&arg2[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ x5 = *(uintptr_t*)((in1)+((uintptr_t)0ULL));
+ x6 = *(uintptr_t*)((in1)+((uintptr_t)8ULL));
+ x7 = *(uintptr_t*)((in1)+((uintptr_t)16ULL));
+ x8 = *(uintptr_t*)((in1)+((uintptr_t)24ULL));
+ x9 = *(uintptr_t*)((in1)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x10 = (x4)*((x9)*((uintptr_t)19ULL));
+ x11 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*((x9)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x4)*((x9)*((uintptr_t)19ULL)))>>64;
+ x12 = (x4)*((x8)*((uintptr_t)19ULL));
+ x13 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*((x8)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x4)*((x8)*((uintptr_t)19ULL)))>>64;
+ x14 = (x4)*((x7)*((uintptr_t)19ULL));
+ x15 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*((x7)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x4)*((x7)*((uintptr_t)19ULL)))>>64;
+ x16 = (x4)*((x6)*((uintptr_t)19ULL));
+ x17 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*((x6)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x4)*((x6)*((uintptr_t)19ULL)))>>64;
+ x18 = (x3)*((x9)*((uintptr_t)19ULL));
+ x19 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*((x9)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x3)*((x9)*((uintptr_t)19ULL)))>>64;
+ x20 = (x3)*((x8)*((uintptr_t)19ULL));
+ x21 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*((x8)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x3)*((x8)*((uintptr_t)19ULL)))>>64;
+ x22 = (x3)*((x7)*((uintptr_t)19ULL));
+ x23 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*((x7)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x3)*((x7)*((uintptr_t)19ULL)))>>64;
+ x24 = (x2)*((x9)*((uintptr_t)19ULL));
+ x25 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*((x9)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x2)*((x9)*((uintptr_t)19ULL)))>>64;
+ x26 = (x2)*((x8)*((uintptr_t)19ULL));
+ x27 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*((x8)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x2)*((x8)*((uintptr_t)19ULL)))>>64;
+ x28 = (x1)*((x9)*((uintptr_t)19ULL));
+ x29 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*((x9)*((uintptr_t)19ULL)))>>32 : ((__uint128_t)(x1)*((x9)*((uintptr_t)19ULL)))>>64;
+ x30 = (x4)*(x5);
+ x31 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*(x5))>>32 : ((__uint128_t)(x4)*(x5))>>64;
+ x32 = (x3)*(x6);
+ x33 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*(x6))>>32 : ((__uint128_t)(x3)*(x6))>>64;
+ x34 = (x3)*(x5);
+ x35 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*(x5))>>32 : ((__uint128_t)(x3)*(x5))>>64;
+ x36 = (x2)*(x7);
+ x37 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*(x7))>>32 : ((__uint128_t)(x2)*(x7))>>64;
+ x38 = (x2)*(x6);
+ x39 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*(x6))>>32 : ((__uint128_t)(x2)*(x6))>>64;
+ x40 = (x2)*(x5);
+ x41 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*(x5))>>32 : ((__uint128_t)(x2)*(x5))>>64;
+ x42 = (x1)*(x8);
+ x43 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x8))>>32 : ((__uint128_t)(x1)*(x8))>>64;
+ x44 = (x1)*(x7);
+ x45 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x7))>>32 : ((__uint128_t)(x1)*(x7))>>64;
+ x46 = (x1)*(x6);
+ x47 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x6))>>32 : ((__uint128_t)(x1)*(x6))>>64;
+ x48 = (x1)*(x5);
+ x49 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x5))>>32 : ((__uint128_t)(x1)*(x5))>>64;
+ x50 = (x0)*(x9);
+ x51 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x9))>>32 : ((__uint128_t)(x0)*(x9))>>64;
+ x52 = (x0)*(x8);
+ x53 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x8))>>32 : ((__uint128_t)(x0)*(x8))>>64;
+ x54 = (x0)*(x7);
+ x55 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x7))>>32 : ((__uint128_t)(x0)*(x7))>>64;
+ x56 = (x0)*(x6);
+ x57 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x6))>>32 : ((__uint128_t)(x0)*(x6))>>64;
+ x58 = (x0)*(x5);
+ x59 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x5))>>32 : ((__uint128_t)(x0)*(x5))>>64;
+ x60 = (x22)+(x16);
+ x61 = (x60)<(x22);
+ x62 = (x61)+(x23);
+ x63 = (x62)+(x17);
+ x64 = (x26)+(x60);
+ x65 = (x64)<(x26);
+ x66 = (x65)+(x27);
+ x67 = (x66)+(x63);
+ x68 = (x28)+(x64);
+ x69 = (x68)<(x28);
+ x70 = (x69)+(x29);
+ x71 = (x70)+(x67);
+ x72 = (x58)+(x68);
+ x73 = (x72)<(x58);
+ x74 = (x73)+(x59);
+ x75 = (x74)+(x71);
+ x76 = ((x72)>>((uintptr_t)51ULL))|((x75)<<((uintptr_t)13ULL));
+ x77 = (x72)&((uintptr_t)2251799813685247ULL);
+ x78 = (x32)+(x30);
+ x79 = (x78)<(x32);
+ x80 = (x79)+(x33);
+ x81 = (x80)+(x31);
+ x82 = (x36)+(x78);
+ x83 = (x82)<(x36);
+ x84 = (x83)+(x37);
+ x85 = (x84)+(x81);
+ x86 = (x42)+(x82);
+ x87 = (x86)<(x42);
+ x88 = (x87)+(x43);
+ x89 = (x88)+(x85);
+ x90 = (x50)+(x86);
+ x91 = (x90)<(x50);
+ x92 = (x91)+(x51);
+ x93 = (x92)+(x89);
+ x94 = (x34)+(x10);
+ x95 = (x94)<(x34);
+ x96 = (x95)+(x35);
+ x97 = (x96)+(x11);
+ x98 = (x38)+(x94);
+ x99 = (x98)<(x38);
+ x100 = (x99)+(x39);
+ x101 = (x100)+(x97);
+ x102 = (x44)+(x98);
+ x103 = (x102)<(x44);
+ x104 = (x103)+(x45);
+ x105 = (x104)+(x101);
+ x106 = (x52)+(x102);
+ x107 = (x106)<(x52);
+ x108 = (x107)+(x53);
+ x109 = (x108)+(x105);
+ x110 = (x18)+(x12);
+ x111 = (x110)<(x18);
+ x112 = (x111)+(x19);
+ x113 = (x112)+(x13);
+ x114 = (x40)+(x110);
+ x115 = (x114)<(x40);
+ x116 = (x115)+(x41);
+ x117 = (x116)+(x113);
+ x118 = (x46)+(x114);
+ x119 = (x118)<(x46);
+ x120 = (x119)+(x47);
+ x121 = (x120)+(x117);
+ x122 = (x54)+(x118);
+ x123 = (x122)<(x54);
+ x124 = (x123)+(x55);
+ x125 = (x124)+(x121);
+ x126 = (x20)+(x14);
+ x127 = (x126)<(x20);
+ x128 = (x127)+(x21);
+ x129 = (x128)+(x15);
+ x130 = (x24)+(x126);
+ x131 = (x130)<(x24);
+ x132 = (x131)+(x25);
+ x133 = (x132)+(x129);
+ x134 = (x48)+(x130);
+ x135 = (x134)<(x48);
+ x136 = (x135)+(x49);
+ x137 = (x136)+(x133);
+ x138 = (x56)+(x134);
+ x139 = (x138)<(x56);
+ x140 = (x139)+(x57);
+ x141 = (x140)+(x137);
+ x142 = (x76)+(x138);
+ x143 = (x142)<(x76);
+ x144 = (x143)+(x141);
+ x145 = ((x142)>>((uintptr_t)51ULL))|((x144)<<((uintptr_t)13ULL));
+ x146 = (x142)&((uintptr_t)2251799813685247ULL);
+ x147 = (x145)+(x122);
+ x148 = (x147)<(x145);
+ x149 = (x148)+(x125);
+ x150 = ((x147)>>((uintptr_t)51ULL))|((x149)<<((uintptr_t)13ULL));
+ x151 = (x147)&((uintptr_t)2251799813685247ULL);
+ x152 = (x150)+(x106);
+ x153 = (x152)<(x150);
+ x154 = (x153)+(x109);
+ x155 = ((x152)>>((uintptr_t)51ULL))|((x154)<<((uintptr_t)13ULL));
+ x156 = (x152)&((uintptr_t)2251799813685247ULL);
+ x157 = (x155)+(x90);
+ x158 = (x157)<(x155);
+ x159 = (x158)+(x93);
+ x160 = ((x157)>>((uintptr_t)51ULL))|((x159)<<((uintptr_t)13ULL));
+ x161 = (x157)&((uintptr_t)2251799813685247ULL);
+ x162 = (x160)*((uintptr_t)19ULL);
+ x163 = (x77)+(x162);
+ x164 = (x163)>>((uintptr_t)51ULL);
+ x165 = (x163)&((uintptr_t)2251799813685247ULL);
+ x166 = (x164)+(x146);
+ x167 = (x166)>>((uintptr_t)51ULL);
+ x168 = (x166)&((uintptr_t)2251799813685247ULL);
+ x169 = (x167)+(x151);
+ x170 = x165;
+ x171 = x168;
+ x172 = x169;
+ x173 = x156;
+ x174 = x161;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x170;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x171;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x172;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x173;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x174;
+ /*skip*/
+ return;
}
/*
@@ -170,61 +235,138 @@ static void fiat_25519_carry_mul(uint64_t out1[5], const uint64_t arg1[5], const
* out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
*/
static void fiat_25519_carry_square(uint64_t out1[5], const uint64_t arg1[5]) {
- uint64_t x1 = ((arg1[4]) * UINT8_C(0x13));
- uint64_t x2 = (x1 * 0x2);
- uint64_t x3 = ((arg1[4]) * 0x2);
- uint64_t x4 = ((arg1[3]) * UINT8_C(0x13));
- uint64_t x5 = (x4 * 0x2);
- uint64_t x6 = ((arg1[3]) * 0x2);
- uint64_t x7 = ((arg1[2]) * 0x2);
- uint64_t x8 = ((arg1[1]) * 0x2);
- fiat_25519_uint128 x9 = ((fiat_25519_uint128)(arg1[4]) * x1);
- fiat_25519_uint128 x10 = ((fiat_25519_uint128)(arg1[3]) * x2);
- fiat_25519_uint128 x11 = ((fiat_25519_uint128)(arg1[3]) * x4);
- fiat_25519_uint128 x12 = ((fiat_25519_uint128)(arg1[2]) * x2);
- fiat_25519_uint128 x13 = ((fiat_25519_uint128)(arg1[2]) * x5);
- fiat_25519_uint128 x14 = ((fiat_25519_uint128)(arg1[2]) * (arg1[2]));
- fiat_25519_uint128 x15 = ((fiat_25519_uint128)(arg1[1]) * x2);
- fiat_25519_uint128 x16 = ((fiat_25519_uint128)(arg1[1]) * x6);
- fiat_25519_uint128 x17 = ((fiat_25519_uint128)(arg1[1]) * x7);
- fiat_25519_uint128 x18 = ((fiat_25519_uint128)(arg1[1]) * (arg1[1]));
- fiat_25519_uint128 x19 = ((fiat_25519_uint128)(arg1[0]) * x3);
- fiat_25519_uint128 x20 = ((fiat_25519_uint128)(arg1[0]) * x6);
- fiat_25519_uint128 x21 = ((fiat_25519_uint128)(arg1[0]) * x7);
- fiat_25519_uint128 x22 = ((fiat_25519_uint128)(arg1[0]) * x8);
- fiat_25519_uint128 x23 = ((fiat_25519_uint128)(arg1[0]) * (arg1[0]));
- fiat_25519_uint128 x24 = (x23 + (x15 + x13));
- uint64_t x25 = (uint64_t)(x24 >> 51);
- uint64_t x26 = (uint64_t)(x24 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x27 = (x19 + (x16 + x14));
- fiat_25519_uint128 x28 = (x20 + (x17 + x9));
- fiat_25519_uint128 x29 = (x21 + (x18 + x10));
- fiat_25519_uint128 x30 = (x22 + (x12 + x11));
- fiat_25519_uint128 x31 = (x25 + x30);
- uint64_t x32 = (uint64_t)(x31 >> 51);
- uint64_t x33 = (uint64_t)(x31 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x34 = (x32 + x29);
- uint64_t x35 = (uint64_t)(x34 >> 51);
- uint64_t x36 = (uint64_t)(x34 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x37 = (x35 + x28);
- uint64_t x38 = (uint64_t)(x37 >> 51);
- uint64_t x39 = (uint64_t)(x37 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x40 = (x38 + x27);
- uint64_t x41 = (uint64_t)(x40 >> 51);
- uint64_t x42 = (uint64_t)(x40 & UINT64_C(0x7ffffffffffff));
- uint64_t x43 = (x41 * UINT8_C(0x13));
- uint64_t x44 = (x26 + x43);
- uint64_t x45 = (x44 >> 51);
- uint64_t x46 = (x44 & UINT64_C(0x7ffffffffffff));
- uint64_t x47 = (x45 + x33);
- fiat_25519_uint1 x48 = (fiat_25519_uint1)(x47 >> 51);
- uint64_t x49 = (x47 & UINT64_C(0x7ffffffffffff));
- uint64_t x50 = (x48 + x36);
- out1[0] = x46;
- out1[1] = x49;
- out1[2] = x50;
- out1[3] = x39;
- out1[4] = x42;
+ uintptr_t x4, x5, x3, x8, x9, x2, x6, x1, x7, x10, x11, x12, x0, x21, x25, x44, x26, x45, x22, x43, x41, x48, x42, x49, x46, x50, x47, x23, x27, x54, x28, x55, x24, x53, x33, x58, x34, x59, x56, x13, x29, x62, x30, x63, x14, x61, x35, x66, x36, x67, x64, x15, x31, x70, x32, x71, x16, x69, x37, x74, x38, x75, x72, x17, x19, x78, x20, x79, x18, x77, x39, x82, x40, x83, x80, x81, x51, x86, x84, x87, x85, x73, x88, x91, x76, x92, x90, x65, x93, x96, x68, x97, x95, x57, x98, x101, x60, x102, x100, x103, x52, x105, x106, x107, x89, x109, x110, x94, x108, x111, x112, x99, x104, x113, x114, x115, x116, x117;
+ uintptr_t in0, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x5 = (x4)*((uintptr_t)19ULL);
+ x6 = (x5)*((uintptr_t)2ULL);
+ x7 = (x4)*((uintptr_t)2ULL);
+ x8 = (x3)*((uintptr_t)19ULL);
+ x9 = (x8)*((uintptr_t)2ULL);
+ x10 = (x3)*((uintptr_t)2ULL);
+ x11 = (x2)*((uintptr_t)2ULL);
+ x12 = (x1)*((uintptr_t)2ULL);
+ x13 = (x4)*(x5);
+ x14 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*(x5))>>32 : ((__uint128_t)(x4)*(x5))>>64;
+ x15 = (x3)*(x6);
+ x16 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*(x6))>>32 : ((__uint128_t)(x3)*(x6))>>64;
+ x17 = (x3)*(x8);
+ x18 = sizeof(intptr_t) == 4 ? ((uint64_t)(x3)*(x8))>>32 : ((__uint128_t)(x3)*(x8))>>64;
+ x19 = (x2)*(x6);
+ x20 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*(x6))>>32 : ((__uint128_t)(x2)*(x6))>>64;
+ x21 = (x2)*(x9);
+ x22 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*(x9))>>32 : ((__uint128_t)(x2)*(x9))>>64;
+ x23 = (x2)*(x2);
+ x24 = sizeof(intptr_t) == 4 ? ((uint64_t)(x2)*(x2))>>32 : ((__uint128_t)(x2)*(x2))>>64;
+ x25 = (x1)*(x6);
+ x26 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x6))>>32 : ((__uint128_t)(x1)*(x6))>>64;
+ x27 = (x1)*(x10);
+ x28 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x10))>>32 : ((__uint128_t)(x1)*(x10))>>64;
+ x29 = (x1)*(x11);
+ x30 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x11))>>32 : ((__uint128_t)(x1)*(x11))>>64;
+ x31 = (x1)*(x1);
+ x32 = sizeof(intptr_t) == 4 ? ((uint64_t)(x1)*(x1))>>32 : ((__uint128_t)(x1)*(x1))>>64;
+ x33 = (x0)*(x7);
+ x34 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x7))>>32 : ((__uint128_t)(x0)*(x7))>>64;
+ x35 = (x0)*(x10);
+ x36 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x10))>>32 : ((__uint128_t)(x0)*(x10))>>64;
+ x37 = (x0)*(x11);
+ x38 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x11))>>32 : ((__uint128_t)(x0)*(x11))>>64;
+ x39 = (x0)*(x12);
+ x40 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x12))>>32 : ((__uint128_t)(x0)*(x12))>>64;
+ x41 = (x0)*(x0);
+ x42 = sizeof(intptr_t) == 4 ? ((uint64_t)(x0)*(x0))>>32 : ((__uint128_t)(x0)*(x0))>>64;
+ x43 = (x25)+(x21);
+ x44 = (x43)<(x25);
+ x45 = (x44)+(x26);
+ x46 = (x45)+(x22);
+ x47 = (x41)+(x43);
+ x48 = (x47)<(x41);
+ x49 = (x48)+(x42);
+ x50 = (x49)+(x46);
+ x51 = ((x47)>>((uintptr_t)51ULL))|((x50)<<((uintptr_t)13ULL));
+ x52 = (x47)&((uintptr_t)2251799813685247ULL);
+ x53 = (x27)+(x23);
+ x54 = (x53)<(x27);
+ x55 = (x54)+(x28);
+ x56 = (x55)+(x24);
+ x57 = (x33)+(x53);
+ x58 = (x57)<(x33);
+ x59 = (x58)+(x34);
+ x60 = (x59)+(x56);
+ x61 = (x29)+(x13);
+ x62 = (x61)<(x29);
+ x63 = (x62)+(x30);
+ x64 = (x63)+(x14);
+ x65 = (x35)+(x61);
+ x66 = (x65)<(x35);
+ x67 = (x66)+(x36);
+ x68 = (x67)+(x64);
+ x69 = (x31)+(x15);
+ x70 = (x69)<(x31);
+ x71 = (x70)+(x32);
+ x72 = (x71)+(x16);
+ x73 = (x37)+(x69);
+ x74 = (x73)<(x37);
+ x75 = (x74)+(x38);
+ x76 = (x75)+(x72);
+ x77 = (x19)+(x17);
+ x78 = (x77)<(x19);
+ x79 = (x78)+(x20);
+ x80 = (x79)+(x18);
+ x81 = (x39)+(x77);
+ x82 = (x81)<(x39);
+ x83 = (x82)+(x40);
+ x84 = (x83)+(x80);
+ x85 = (x51)+(x81);
+ x86 = (x85)<(x51);
+ x87 = (x86)+(x84);
+ x88 = ((x85)>>((uintptr_t)51ULL))|((x87)<<((uintptr_t)13ULL));
+ x89 = (x85)&((uintptr_t)2251799813685247ULL);
+ x90 = (x88)+(x73);
+ x91 = (x90)<(x88);
+ x92 = (x91)+(x76);
+ x93 = ((x90)>>((uintptr_t)51ULL))|((x92)<<((uintptr_t)13ULL));
+ x94 = (x90)&((uintptr_t)2251799813685247ULL);
+ x95 = (x93)+(x65);
+ x96 = (x95)<(x93);
+ x97 = (x96)+(x68);
+ x98 = ((x95)>>((uintptr_t)51ULL))|((x97)<<((uintptr_t)13ULL));
+ x99 = (x95)&((uintptr_t)2251799813685247ULL);
+ x100 = (x98)+(x57);
+ x101 = (x100)<(x98);
+ x102 = (x101)+(x60);
+ x103 = ((x100)>>((uintptr_t)51ULL))|((x102)<<((uintptr_t)13ULL));
+ x104 = (x100)&((uintptr_t)2251799813685247ULL);
+ x105 = (x103)*((uintptr_t)19ULL);
+ x106 = (x52)+(x105);
+ x107 = (x106)>>((uintptr_t)51ULL);
+ x108 = (x106)&((uintptr_t)2251799813685247ULL);
+ x109 = (x107)+(x89);
+ x110 = (x109)>>((uintptr_t)51ULL);
+ x111 = (x109)&((uintptr_t)2251799813685247ULL);
+ x112 = (x110)+(x94);
+ x113 = x108;
+ x114 = x111;
+ x115 = x112;
+ x116 = x99;
+ x117 = x104;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x113;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x114;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x115;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x116;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x117;
+ /*skip*/
+ return;
}
/*
@@ -238,23 +380,42 @@ static void fiat_25519_carry_square(uint64_t out1[5], const uint64_t arg1[5]) {
* out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
*/
static void fiat_25519_carry(uint64_t out1[5], const uint64_t arg1[5]) {
- uint64_t x1 = (arg1[0]);
- uint64_t x2 = ((x1 >> 51) + (arg1[1]));
- uint64_t x3 = ((x2 >> 51) + (arg1[2]));
- uint64_t x4 = ((x3 >> 51) + (arg1[3]));
- uint64_t x5 = ((x4 >> 51) + (arg1[4]));
- uint64_t x6 = ((x1 & UINT64_C(0x7ffffffffffff)) + ((x5 >> 51) * UINT8_C(0x13)));
- uint64_t x7 = ((fiat_25519_uint1)(x6 >> 51) + (x2 & UINT64_C(0x7ffffffffffff)));
- uint64_t x8 = (x6 & UINT64_C(0x7ffffffffffff));
- uint64_t x9 = (x7 & UINT64_C(0x7ffffffffffff));
- uint64_t x10 = ((fiat_25519_uint1)(x7 >> 51) + (x3 & UINT64_C(0x7ffffffffffff)));
- uint64_t x11 = (x4 & UINT64_C(0x7ffffffffffff));
- uint64_t x12 = (x5 & UINT64_C(0x7ffffffffffff));
- out1[0] = x8;
- out1[1] = x9;
- out1[2] = x10;
- out1[3] = x11;
- out1[4] = x12;
+ uintptr_t x0, x1, x2, x3, x4, x5, x6, x10, x11, x7, x8, x9, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21;
+ uintptr_t in0, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x5 = x0;
+ x6 = ((x5)>>((uintptr_t)51ULL))+(x1);
+ x7 = ((x6)>>((uintptr_t)51ULL))+(x2);
+ x8 = ((x7)>>((uintptr_t)51ULL))+(x3);
+ x9 = ((x8)>>((uintptr_t)51ULL))+(x4);
+ x10 = ((x5)&((uintptr_t)2251799813685247ULL))+(((x9)>>((uintptr_t)51ULL))*((uintptr_t)19ULL));
+ x11 = ((x10)>>((uintptr_t)51ULL))+((x6)&((uintptr_t)2251799813685247ULL));
+ x12 = (x10)&((uintptr_t)2251799813685247ULL);
+ x13 = (x11)&((uintptr_t)2251799813685247ULL);
+ x14 = ((x11)>>((uintptr_t)51ULL))+((x7)&((uintptr_t)2251799813685247ULL));
+ x15 = (x8)&((uintptr_t)2251799813685247ULL);
+ x16 = (x9)&((uintptr_t)2251799813685247ULL);
+ x17 = x12;
+ x18 = x13;
+ x19 = x14;
+ x20 = x15;
+ x21 = x16;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x17;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x18;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x19;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x20;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x21;
+ /*skip*/
+ return;
}
/*
@@ -269,16 +430,42 @@ static void fiat_25519_carry(uint64_t out1[5], const uint64_t arg1[5]) {
* out1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
*/
static void fiat_25519_add(uint64_t out1[5], const uint64_t arg1[5], const uint64_t arg2[5]) {
- uint64_t x1 = ((arg1[0]) + (arg2[0]));
- uint64_t x2 = ((arg1[1]) + (arg2[1]));
- uint64_t x3 = ((arg1[2]) + (arg2[2]));
- uint64_t x4 = ((arg1[3]) + (arg2[3]));
- uint64_t x5 = ((arg1[4]) + (arg2[4]));
- out1[0] = x1;
- out1[1] = x2;
- out1[2] = x3;
- out1[3] = x4;
- out1[4] = x5;
+ uintptr_t x0, x5, x1, x6, x2, x7, x3, x8, x4, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19;
+ uintptr_t in0, in1, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ in1 = (uintptr_t) (&arg2[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ x5 = *(uintptr_t*)((in1)+((uintptr_t)0ULL));
+ x6 = *(uintptr_t*)((in1)+((uintptr_t)8ULL));
+ x7 = *(uintptr_t*)((in1)+((uintptr_t)16ULL));
+ x8 = *(uintptr_t*)((in1)+((uintptr_t)24ULL));
+ x9 = *(uintptr_t*)((in1)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x10 = (x0)+(x5);
+ x11 = (x1)+(x6);
+ x12 = (x2)+(x7);
+ x13 = (x3)+(x8);
+ x14 = (x4)+(x9);
+ x15 = x10;
+ x16 = x11;
+ x17 = x12;
+ x18 = x13;
+ x19 = x14;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x15;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x16;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x17;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x18;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x19;
+ /*skip*/
+ return;
}
/*
@@ -293,16 +480,42 @@ static void fiat_25519_add(uint64_t out1[5], const uint64_t arg1[5], const uint6
* out1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
*/
static void fiat_25519_sub(uint64_t out1[5], const uint64_t arg1[5], const uint64_t arg2[5]) {
- uint64_t x1 = ((UINT64_C(0xfffffffffffda) + (arg1[0])) - (arg2[0]));
- uint64_t x2 = ((UINT64_C(0xffffffffffffe) + (arg1[1])) - (arg2[1]));
- uint64_t x3 = ((UINT64_C(0xffffffffffffe) + (arg1[2])) - (arg2[2]));
- uint64_t x4 = ((UINT64_C(0xffffffffffffe) + (arg1[3])) - (arg2[3]));
- uint64_t x5 = ((UINT64_C(0xffffffffffffe) + (arg1[4])) - (arg2[4]));
- out1[0] = x1;
- out1[1] = x2;
- out1[2] = x3;
- out1[3] = x4;
- out1[4] = x5;
+ uintptr_t x0, x5, x1, x6, x2, x7, x3, x8, x4, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19;
+ uintptr_t in0, in1, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ in1 = (uintptr_t) (&arg2[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ x5 = *(uintptr_t*)((in1)+((uintptr_t)0ULL));
+ x6 = *(uintptr_t*)((in1)+((uintptr_t)8ULL));
+ x7 = *(uintptr_t*)((in1)+((uintptr_t)16ULL));
+ x8 = *(uintptr_t*)((in1)+((uintptr_t)24ULL));
+ x9 = *(uintptr_t*)((in1)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x10 = (((uintptr_t)4503599627370458ULL)+(x0))-(x5);
+ x11 = (((uintptr_t)4503599627370494ULL)+(x1))-(x6);
+ x12 = (((uintptr_t)4503599627370494ULL)+(x2))-(x7);
+ x13 = (((uintptr_t)4503599627370494ULL)+(x3))-(x8);
+ x14 = (((uintptr_t)4503599627370494ULL)+(x4))-(x9);
+ x15 = x10;
+ x16 = x11;
+ x17 = x12;
+ x18 = x13;
+ x19 = x14;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x15;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x16;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x17;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x18;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x19;
+ /*skip*/
+ return;
}
/*
@@ -316,16 +529,35 @@ static void fiat_25519_sub(uint64_t out1[5], const uint64_t arg1[5], const uint6
* out1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
*/
static void fiat_25519_opp(uint64_t out1[5], const uint64_t arg1[5]) {
- uint64_t x1 = (UINT64_C(0xfffffffffffda) - (arg1[0]));
- uint64_t x2 = (UINT64_C(0xffffffffffffe) - (arg1[1]));
- uint64_t x3 = (UINT64_C(0xffffffffffffe) - (arg1[2]));
- uint64_t x4 = (UINT64_C(0xffffffffffffe) - (arg1[3]));
- uint64_t x5 = (UINT64_C(0xffffffffffffe) - (arg1[4]));
- out1[0] = x1;
- out1[1] = x2;
- out1[2] = x3;
- out1[3] = x4;
- out1[4] = x5;
+ uintptr_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14;
+ uintptr_t in0, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x5 = ((uintptr_t)4503599627370458ULL)-(x0);
+ x6 = ((uintptr_t)4503599627370494ULL)-(x1);
+ x7 = ((uintptr_t)4503599627370494ULL)-(x2);
+ x8 = ((uintptr_t)4503599627370494ULL)-(x3);
+ x9 = ((uintptr_t)4503599627370494ULL)-(x4);
+ x10 = x5;
+ x11 = x6;
+ x12 = x7;
+ x13 = x8;
+ x14 = x9;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x10;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x11;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x12;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x13;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x14;
+ /*skip*/
+ return;
}
/*
@@ -341,21 +573,54 @@ static void fiat_25519_opp(uint64_t out1[5], const uint64_t arg1[5]) {
* out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
*/
static void fiat_25519_selectznz(uint64_t out1[5], fiat_25519_uint1 arg1, const uint64_t arg2[5], const uint64_t arg3[5]) {
- uint64_t x1;
- fiat_25519_cmovznz_u64(&x1, arg1, (arg2[0]), (arg3[0]));
- uint64_t x2;
- fiat_25519_cmovznz_u64(&x2, arg1, (arg2[1]), (arg3[1]));
- uint64_t x3;
- fiat_25519_cmovznz_u64(&x3, arg1, (arg2[2]), (arg3[2]));
- uint64_t x4;
- fiat_25519_cmovznz_u64(&x4, arg1, (arg2[3]), (arg3[3]));
- uint64_t x5;
- fiat_25519_cmovznz_u64(&x5, arg1, (arg2[4]), (arg3[4]));
- out1[0] = x1;
- out1[1] = x2;
- out1[2] = x3;
- out1[3] = x4;
- out1[4] = x5;
+ uintptr_t x5, x10, x0, x11, x6, x13, x1, x14, x7, x16, x2, x17, x8, x19, x3, x20, x9, x22, x4, x23, x12, x15, x18, x21, x24, x25, x26, x27, x28, x29;
+ /*skip*/
+ uintptr_t in0, in1, in2, out0;
+ in0 = (uintptr_t) (arg1);
+ in1 = (uintptr_t) (&arg2[0]);
+ in2 = (uintptr_t) (&arg3[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in1)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in1)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in1)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in1)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in1)+((uintptr_t)32ULL));
+ /*skip*/
+ x5 = *(uintptr_t*)((in2)+((uintptr_t)0ULL));
+ x6 = *(uintptr_t*)((in2)+((uintptr_t)8ULL));
+ x7 = *(uintptr_t*)((in2)+((uintptr_t)16ULL));
+ x8 = *(uintptr_t*)((in2)+((uintptr_t)24ULL));
+ x9 = *(uintptr_t*)((in2)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x10 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL));
+ x11 = (x10)^((uintptr_t)18446744073709551615ULL);
+ x12 = ((x5)&(x10))|((x0)&(x11));
+ x13 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL));
+ x14 = (x13)^((uintptr_t)18446744073709551615ULL);
+ x15 = ((x6)&(x13))|((x1)&(x14));
+ x16 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL));
+ x17 = (x16)^((uintptr_t)18446744073709551615ULL);
+ x18 = ((x7)&(x16))|((x2)&(x17));
+ x19 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL));
+ x20 = (x19)^((uintptr_t)18446744073709551615ULL);
+ x21 = ((x8)&(x19))|((x3)&(x20));
+ x22 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL));
+ x23 = (x22)^((uintptr_t)18446744073709551615ULL);
+ x24 = ((x9)&(x22))|((x4)&(x23));
+ x25 = x12;
+ x26 = x15;
+ x27 = x18;
+ x28 = x21;
+ x29 = x24;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x25;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x26;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x27;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x28;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x29;
+ /*skip*/
+ return;
}
/*
@@ -369,140 +634,217 @@ static void fiat_25519_selectznz(uint64_t out1[5], fiat_25519_uint1 arg1, const
* 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]]
*/
static void fiat_25519_to_bytes(uint8_t out1[32], const uint64_t arg1[5]) {
- uint64_t x1;
- fiat_25519_uint1 x2;
- fiat_25519_subborrowx_u51(&x1, &x2, 0x0, (arg1[0]), UINT64_C(0x7ffffffffffed));
- uint64_t x3;
- fiat_25519_uint1 x4;
- fiat_25519_subborrowx_u51(&x3, &x4, x2, (arg1[1]), UINT64_C(0x7ffffffffffff));
- uint64_t x5;
- fiat_25519_uint1 x6;
- fiat_25519_subborrowx_u51(&x5, &x6, x4, (arg1[2]), UINT64_C(0x7ffffffffffff));
- uint64_t x7;
- fiat_25519_uint1 x8;
- fiat_25519_subborrowx_u51(&x7, &x8, x6, (arg1[3]), UINT64_C(0x7ffffffffffff));
- uint64_t x9;
- fiat_25519_uint1 x10;
- fiat_25519_subborrowx_u51(&x9, &x10, x8, (arg1[4]), UINT64_C(0x7ffffffffffff));
- uint64_t x11;
- fiat_25519_cmovznz_u64(&x11, x10, 0x0, UINT64_C(0xffffffffffffffff));
- uint64_t x12;
- fiat_25519_uint1 x13;
- fiat_25519_addcarryx_u51(&x12, &x13, 0x0, x1, (x11 & UINT64_C(0x7ffffffffffed)));
- uint64_t x14;
- fiat_25519_uint1 x15;
- fiat_25519_addcarryx_u51(&x14, &x15, x13, x3, (x11 & UINT64_C(0x7ffffffffffff)));
- uint64_t x16;
- fiat_25519_uint1 x17;
- fiat_25519_addcarryx_u51(&x16, &x17, x15, x5, (x11 & UINT64_C(0x7ffffffffffff)));
- uint64_t x18;
- fiat_25519_uint1 x19;
- fiat_25519_addcarryx_u51(&x18, &x19, x17, x7, (x11 & UINT64_C(0x7ffffffffffff)));
- uint64_t x20;
- fiat_25519_uint1 x21;
- fiat_25519_addcarryx_u51(&x20, &x21, x19, x9, (x11 & UINT64_C(0x7ffffffffffff)));
- uint64_t x22 = (x20 << 4);
- uint64_t x23 = (x18 * (uint64_t)0x2);
- uint64_t x24 = (x16 << 6);
- uint64_t x25 = (x14 << 3);
- uint64_t x26 = (x12 >> 8);
- uint8_t x27 = (uint8_t)(x12 & UINT8_C(0xff));
- uint64_t x28 = (x26 >> 8);
- uint8_t x29 = (uint8_t)(x26 & UINT8_C(0xff));
- uint64_t x30 = (x28 >> 8);
- uint8_t x31 = (uint8_t)(x28 & UINT8_C(0xff));
- uint64_t x32 = (x30 >> 8);
- uint8_t x33 = (uint8_t)(x30 & UINT8_C(0xff));
- uint64_t x34 = (x32 >> 8);
- uint8_t x35 = (uint8_t)(x32 & UINT8_C(0xff));
- uint8_t x36 = (uint8_t)(x34 >> 8);
- uint8_t x37 = (uint8_t)(x34 & UINT8_C(0xff));
- uint64_t x38 = (x36 + x25);
- uint64_t x39 = (x38 >> 8);
- uint8_t x40 = (uint8_t)(x38 & UINT8_C(0xff));
- uint64_t x41 = (x39 >> 8);
- uint8_t x42 = (uint8_t)(x39 & UINT8_C(0xff));
- uint64_t x43 = (x41 >> 8);
- uint8_t x44 = (uint8_t)(x41 & UINT8_C(0xff));
- uint64_t x45 = (x43 >> 8);
- uint8_t x46 = (uint8_t)(x43 & UINT8_C(0xff));
- uint64_t x47 = (x45 >> 8);
- uint8_t x48 = (uint8_t)(x45 & UINT8_C(0xff));
- uint8_t x49 = (uint8_t)(x47 >> 8);
- uint8_t x50 = (uint8_t)(x47 & UINT8_C(0xff));
- uint64_t x51 = (x49 + x24);
- uint64_t x52 = (x51 >> 8);
- uint8_t x53 = (uint8_t)(x51 & UINT8_C(0xff));
- uint64_t x54 = (x52 >> 8);
- uint8_t x55 = (uint8_t)(x52 & UINT8_C(0xff));
- uint64_t x56 = (x54 >> 8);
- uint8_t x57 = (uint8_t)(x54 & UINT8_C(0xff));
- uint64_t x58 = (x56 >> 8);
- uint8_t x59 = (uint8_t)(x56 & UINT8_C(0xff));
- uint64_t x60 = (x58 >> 8);
- uint8_t x61 = (uint8_t)(x58 & UINT8_C(0xff));
- uint64_t x62 = (x60 >> 8);
- uint8_t x63 = (uint8_t)(x60 & UINT8_C(0xff));
- fiat_25519_uint1 x64 = (fiat_25519_uint1)(x62 >> 8);
- uint8_t x65 = (uint8_t)(x62 & UINT8_C(0xff));
- uint64_t x66 = (x64 + x23);
- uint64_t x67 = (x66 >> 8);
- uint8_t x68 = (uint8_t)(x66 & UINT8_C(0xff));
- uint64_t x69 = (x67 >> 8);
- uint8_t x70 = (uint8_t)(x67 & UINT8_C(0xff));
- uint64_t x71 = (x69 >> 8);
- uint8_t x72 = (uint8_t)(x69 & UINT8_C(0xff));
- uint64_t x73 = (x71 >> 8);
- uint8_t x74 = (uint8_t)(x71 & UINT8_C(0xff));
- uint64_t x75 = (x73 >> 8);
- uint8_t x76 = (uint8_t)(x73 & UINT8_C(0xff));
- uint8_t x77 = (uint8_t)(x75 >> 8);
- uint8_t x78 = (uint8_t)(x75 & UINT8_C(0xff));
- uint64_t x79 = (x77 + x22);
- uint64_t x80 = (x79 >> 8);
- uint8_t x81 = (uint8_t)(x79 & UINT8_C(0xff));
- uint64_t x82 = (x80 >> 8);
- uint8_t x83 = (uint8_t)(x80 & UINT8_C(0xff));
- uint64_t x84 = (x82 >> 8);
- uint8_t x85 = (uint8_t)(x82 & UINT8_C(0xff));
- uint64_t x86 = (x84 >> 8);
- uint8_t x87 = (uint8_t)(x84 & UINT8_C(0xff));
- uint64_t x88 = (x86 >> 8);
- uint8_t x89 = (uint8_t)(x86 & UINT8_C(0xff));
- uint8_t x90 = (uint8_t)(x88 >> 8);
- uint8_t x91 = (uint8_t)(x88 & UINT8_C(0xff));
- out1[0] = x27;
- out1[1] = x29;
- out1[2] = x31;
- out1[3] = x33;
- out1[4] = x35;
- out1[5] = x37;
- out1[6] = x40;
- out1[7] = x42;
- out1[8] = x44;
- out1[9] = x46;
- out1[10] = x48;
- out1[11] = x50;
- out1[12] = x53;
- out1[13] = x55;
- out1[14] = x57;
- out1[15] = x59;
- out1[16] = x61;
- out1[17] = x63;
- out1[18] = x65;
- out1[19] = x68;
- out1[20] = x70;
- out1[21] = x72;
- out1[22] = x74;
- out1[23] = x76;
- out1[24] = x78;
- out1[25] = x81;
- out1[26] = x83;
- out1[27] = x85;
- out1[28] = x87;
- out1[29] = x89;
- out1[30] = x91;
- out1[31] = x90;
+ uintptr_t x0, x6, x7, x8, x5, x1, x10, x11, x12, x14, x15, x13, x2, x17, x18, x19, x21, x22, x20, x3, x24, x25, x26, x28, x29, x27, x4, x31, x32, x33, x35, x36, x34, x38, x9, x40, x41, x43, x16, x44, x45, x47, x46, x48, x50, x23, x51, x52, x54, x53, x55, x57, x30, x58, x59, x61, x60, x62, x64, x37, x65, x39, x66, x67, x63, x56, x49, x42, x72, x74, x76, x78, x80, x82, x71, x84, x85, x87, x89, x91, x93, x95, x70, x97, x98, x100, x102, x104, x106, x108, x110, x69, x112, x113, x115, x117, x119, x121, x123, x68, x125, x126, x128, x130, x132, x134, x73, x75, x77, x79, x81, x83, x86, x88, x90, x92, x94, x96, x99, x101, x103, x105, x107, x109, x111, x114, x116, x118, x120, x122, x124, x127, x129, x131, x133, x135, x137, x136, x138, x139, x140, x141, x142, x143, x144, x145, x146, x147, x148, x149, x150, x151, x152, x153, x154, x155, x156, x157, x158, x159, x160, x161, x162, x163, x164, x165, x166, x167, x168, x169;
+ uintptr_t in0, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x5 = (x0)-((uintptr_t)2251799813685229ULL);
+ x6 = (x0)<(x5);
+ x7 = 0;
+ x8 = (x6)+(x7);
+ x9 = (x5)&((uintptr_t)2251799813685247ULL);
+ x10 = ((x8)<<((uintptr_t)13ULL))-((x5)>>((uintptr_t)51ULL));
+ x11 = (x1)-((uintptr_t)2251799813685247ULL);
+ x12 = (x1)<(x11);
+ x13 = (x11)-(x10);
+ x14 = (x11)<(x13);
+ x15 = (x12)+(x14);
+ x16 = (x13)&((uintptr_t)2251799813685247ULL);
+ x17 = ((x15)<<((uintptr_t)13ULL))-((x13)>>((uintptr_t)51ULL));
+ x18 = (x2)-((uintptr_t)2251799813685247ULL);
+ x19 = (x2)<(x18);
+ x20 = (x18)-(x17);
+ x21 = (x18)<(x20);
+ x22 = (x19)+(x21);
+ x23 = (x20)&((uintptr_t)2251799813685247ULL);
+ x24 = ((x22)<<((uintptr_t)13ULL))-((x20)>>((uintptr_t)51ULL));
+ x25 = (x3)-((uintptr_t)2251799813685247ULL);
+ x26 = (x3)<(x25);
+ x27 = (x25)-(x24);
+ x28 = (x25)<(x27);
+ x29 = (x26)+(x28);
+ x30 = (x27)&((uintptr_t)2251799813685247ULL);
+ x31 = ((x29)<<((uintptr_t)13ULL))-((x27)>>((uintptr_t)51ULL));
+ x32 = (x4)-((uintptr_t)2251799813685247ULL);
+ x33 = (x4)<(x32);
+ x34 = (x32)-(x31);
+ x35 = (x32)<(x34);
+ x36 = (x33)+(x35);
+ x37 = (x34)&((uintptr_t)2251799813685247ULL);
+ x38 = ((x36)<<((uintptr_t)13ULL))-((x34)>>((uintptr_t)51ULL));
+ x39 = ((uintptr_t)-1ULL)+((x38)==((uintptr_t)0ULL));
+ x40 = (x9)+((x39)&((uintptr_t)2251799813685229ULL));
+ x41 = (x40)<(x9);
+ x42 = (x40)&((uintptr_t)2251799813685247ULL);
+ x43 = ((x40)>>((uintptr_t)51ULL))+((x41)<<((uintptr_t)13ULL));
+ x44 = (x43)+(x16);
+ x45 = (x44)<(x16);
+ x46 = (x44)+((x39)&((uintptr_t)2251799813685247ULL));
+ x47 = (x46)<((x39)&((uintptr_t)2251799813685247ULL));
+ x48 = (x45)+(x47);
+ x49 = (x46)&((uintptr_t)2251799813685247ULL);
+ x50 = ((x46)>>((uintptr_t)51ULL))+((x48)<<((uintptr_t)13ULL));
+ x51 = (x50)+(x23);
+ x52 = (x51)<(x23);
+ x53 = (x51)+((x39)&((uintptr_t)2251799813685247ULL));
+ x54 = (x53)<((x39)&((uintptr_t)2251799813685247ULL));
+ x55 = (x52)+(x54);
+ x56 = (x53)&((uintptr_t)2251799813685247ULL);
+ x57 = ((x53)>>((uintptr_t)51ULL))+((x55)<<((uintptr_t)13ULL));
+ x58 = (x57)+(x30);
+ x59 = (x58)<(x30);
+ x60 = (x58)+((x39)&((uintptr_t)2251799813685247ULL));
+ x61 = (x60)<((x39)&((uintptr_t)2251799813685247ULL));
+ x62 = (x59)+(x61);
+ x63 = (x60)&((uintptr_t)2251799813685247ULL);
+ x64 = ((x60)>>((uintptr_t)51ULL))+((x62)<<((uintptr_t)13ULL));
+ x65 = (x64)+(x37);
+ x66 = (x65)+((x39)&((uintptr_t)2251799813685247ULL));
+ x67 = (x66)&((uintptr_t)2251799813685247ULL);
+ x68 = (x67)<<((uintptr_t)4ULL);
+ x69 = (x63)*((uintptr_t)2ULL);
+ x70 = (x56)<<((uintptr_t)6ULL);
+ x71 = (x49)<<((uintptr_t)3ULL);
+ x72 = (x42)>>((uintptr_t)8ULL);
+ x73 = (x42)&((uintptr_t)255ULL);
+ x74 = (x72)>>((uintptr_t)8ULL);
+ x75 = (x72)&((uintptr_t)255ULL);
+ x76 = (x74)>>((uintptr_t)8ULL);
+ x77 = (x74)&((uintptr_t)255ULL);
+ x78 = (x76)>>((uintptr_t)8ULL);
+ x79 = (x76)&((uintptr_t)255ULL);
+ x80 = (x78)>>((uintptr_t)8ULL);
+ x81 = (x78)&((uintptr_t)255ULL);
+ x82 = (x80)>>((uintptr_t)8ULL);
+ x83 = (x80)&((uintptr_t)255ULL);
+ x84 = (x82)+(x71);
+ x85 = (x84)>>((uintptr_t)8ULL);
+ x86 = (x84)&((uintptr_t)255ULL);
+ x87 = (x85)>>((uintptr_t)8ULL);
+ x88 = (x85)&((uintptr_t)255ULL);
+ x89 = (x87)>>((uintptr_t)8ULL);
+ x90 = (x87)&((uintptr_t)255ULL);
+ x91 = (x89)>>((uintptr_t)8ULL);
+ x92 = (x89)&((uintptr_t)255ULL);
+ x93 = (x91)>>((uintptr_t)8ULL);
+ x94 = (x91)&((uintptr_t)255ULL);
+ x95 = (x93)>>((uintptr_t)8ULL);
+ x96 = (x93)&((uintptr_t)255ULL);
+ x97 = (x95)+(x70);
+ x98 = (x97)>>((uintptr_t)8ULL);
+ x99 = (x97)&((uintptr_t)255ULL);
+ x100 = (x98)>>((uintptr_t)8ULL);
+ x101 = (x98)&((uintptr_t)255ULL);
+ x102 = (x100)>>((uintptr_t)8ULL);
+ x103 = (x100)&((uintptr_t)255ULL);
+ x104 = (x102)>>((uintptr_t)8ULL);
+ x105 = (x102)&((uintptr_t)255ULL);
+ x106 = (x104)>>((uintptr_t)8ULL);
+ x107 = (x104)&((uintptr_t)255ULL);
+ x108 = (x106)>>((uintptr_t)8ULL);
+ x109 = (x106)&((uintptr_t)255ULL);
+ x110 = (x108)>>((uintptr_t)8ULL);
+ x111 = (x108)&((uintptr_t)255ULL);
+ x112 = (x110)+(x69);
+ x113 = (x112)>>((uintptr_t)8ULL);
+ x114 = (x112)&((uintptr_t)255ULL);
+ x115 = (x113)>>((uintptr_t)8ULL);
+ x116 = (x113)&((uintptr_t)255ULL);
+ x117 = (x115)>>((uintptr_t)8ULL);
+ x118 = (x115)&((uintptr_t)255ULL);
+ x119 = (x117)>>((uintptr_t)8ULL);
+ x120 = (x117)&((uintptr_t)255ULL);
+ x121 = (x119)>>((uintptr_t)8ULL);
+ x122 = (x119)&((uintptr_t)255ULL);
+ x123 = (x121)>>((uintptr_t)8ULL);
+ x124 = (x121)&((uintptr_t)255ULL);
+ x125 = (x123)+(x68);
+ x126 = (x125)>>((uintptr_t)8ULL);
+ x127 = (x125)&((uintptr_t)255ULL);
+ x128 = (x126)>>((uintptr_t)8ULL);
+ x129 = (x126)&((uintptr_t)255ULL);
+ x130 = (x128)>>((uintptr_t)8ULL);
+ x131 = (x128)&((uintptr_t)255ULL);
+ x132 = (x130)>>((uintptr_t)8ULL);
+ x133 = (x130)&((uintptr_t)255ULL);
+ x134 = (x132)>>((uintptr_t)8ULL);
+ x135 = (x132)&((uintptr_t)255ULL);
+ x136 = (x134)>>((uintptr_t)8ULL);
+ x137 = (x134)&((uintptr_t)255ULL);
+ x138 = x73;
+ x139 = x75;
+ x140 = x77;
+ x141 = x79;
+ x142 = x81;
+ x143 = x83;
+ x144 = x86;
+ x145 = x88;
+ x146 = x90;
+ x147 = x92;
+ x148 = x94;
+ x149 = x96;
+ x150 = x99;
+ x151 = x101;
+ x152 = x103;
+ x153 = x105;
+ x154 = x107;
+ x155 = x109;
+ x156 = x111;
+ x157 = x114;
+ x158 = x116;
+ x159 = x118;
+ x160 = x120;
+ x161 = x122;
+ x162 = x124;
+ x163 = x127;
+ x164 = x129;
+ x165 = x131;
+ x166 = x133;
+ x167 = x135;
+ x168 = x137;
+ x169 = x136;
+ /*skip*/
+ *(uint8_t*)((out0)+((uintptr_t)0ULL)) = x138;
+ *(uint8_t*)((out0)+((uintptr_t)1ULL)) = x139;
+ *(uint8_t*)((out0)+((uintptr_t)2ULL)) = x140;
+ *(uint8_t*)((out0)+((uintptr_t)3ULL)) = x141;
+ *(uint8_t*)((out0)+((uintptr_t)4ULL)) = x142;
+ *(uint8_t*)((out0)+((uintptr_t)5ULL)) = x143;
+ *(uint8_t*)((out0)+((uintptr_t)6ULL)) = x144;
+ *(uint8_t*)((out0)+((uintptr_t)7ULL)) = x145;
+ *(uint8_t*)((out0)+((uintptr_t)8ULL)) = x146;
+ *(uint8_t*)((out0)+((uintptr_t)9ULL)) = x147;
+ *(uint8_t*)((out0)+((uintptr_t)10ULL)) = x148;
+ *(uint8_t*)((out0)+((uintptr_t)11ULL)) = x149;
+ *(uint8_t*)((out0)+((uintptr_t)12ULL)) = x150;
+ *(uint8_t*)((out0)+((uintptr_t)13ULL)) = x151;
+ *(uint8_t*)((out0)+((uintptr_t)14ULL)) = x152;
+ *(uint8_t*)((out0)+((uintptr_t)15ULL)) = x153;
+ *(uint8_t*)((out0)+((uintptr_t)16ULL)) = x154;
+ *(uint8_t*)((out0)+((uintptr_t)17ULL)) = x155;
+ *(uint8_t*)((out0)+((uintptr_t)18ULL)) = x156;
+ *(uint8_t*)((out0)+((uintptr_t)19ULL)) = x157;
+ *(uint8_t*)((out0)+((uintptr_t)20ULL)) = x158;
+ *(uint8_t*)((out0)+((uintptr_t)21ULL)) = x159;
+ *(uint8_t*)((out0)+((uintptr_t)22ULL)) = x160;
+ *(uint8_t*)((out0)+((uintptr_t)23ULL)) = x161;
+ *(uint8_t*)((out0)+((uintptr_t)24ULL)) = x162;
+ *(uint8_t*)((out0)+((uintptr_t)25ULL)) = x163;
+ *(uint8_t*)((out0)+((uintptr_t)26ULL)) = x164;
+ *(uint8_t*)((out0)+((uintptr_t)27ULL)) = x165;
+ *(uint8_t*)((out0)+((uintptr_t)28ULL)) = x166;
+ *(uint8_t*)((out0)+((uintptr_t)29ULL)) = x167;
+ *(uint8_t*)((out0)+((uintptr_t)30ULL)) = x168;
+ *(uint8_t*)((out0)+((uintptr_t)31ULL)) = x169;
+ /*skip*/
+ return;
}
/*
@@ -516,60 +858,106 @@ static void fiat_25519_to_bytes(uint8_t out1[32], const uint64_t arg1[5]) {
* out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
*/
static void fiat_25519_from_bytes(uint64_t out1[5], const uint8_t arg1[32]) {
- uint64_t x1 = ((uint64_t)(arg1[31]) << 44);
- uint64_t x2 = ((uint64_t)(arg1[30]) << 36);
- uint64_t x3 = ((uint64_t)(arg1[29]) << 28);
- uint64_t x4 = ((uint64_t)(arg1[28]) << 20);
- uint64_t x5 = ((uint64_t)(arg1[27]) << 12);
- uint64_t x6 = ((uint64_t)(arg1[26]) << 4);
- uint64_t x7 = ((uint64_t)(arg1[25]) << 47);
- uint64_t x8 = ((uint64_t)(arg1[24]) << 39);
- uint64_t x9 = ((uint64_t)(arg1[23]) << 31);
- uint64_t x10 = ((uint64_t)(arg1[22]) << 23);
- uint64_t x11 = ((uint64_t)(arg1[21]) << 15);
- uint64_t x12 = ((uint64_t)(arg1[20]) << 7);
- uint64_t x13 = ((uint64_t)(arg1[19]) << 50);
- uint64_t x14 = ((uint64_t)(arg1[18]) << 42);
- uint64_t x15 = ((uint64_t)(arg1[17]) << 34);
- uint64_t x16 = ((uint64_t)(arg1[16]) << 26);
- uint64_t x17 = ((uint64_t)(arg1[15]) << 18);
- uint64_t x18 = ((uint64_t)(arg1[14]) << 10);
- uint64_t x19 = ((uint64_t)(arg1[13]) << 2);
- uint64_t x20 = ((uint64_t)(arg1[12]) << 45);
- uint64_t x21 = ((uint64_t)(arg1[11]) << 37);
- uint64_t x22 = ((uint64_t)(arg1[10]) << 29);
- uint64_t x23 = ((uint64_t)(arg1[9]) << 21);
- uint64_t x24 = ((uint64_t)(arg1[8]) << 13);
- uint64_t x25 = ((uint64_t)(arg1[7]) << 5);
- uint64_t x26 = ((uint64_t)(arg1[6]) << 48);
- uint64_t x27 = ((uint64_t)(arg1[5]) << 40);
- uint64_t x28 = ((uint64_t)(arg1[4]) << 32);
- uint64_t x29 = ((uint64_t)(arg1[3]) << 24);
- uint64_t x30 = ((uint64_t)(arg1[2]) << 16);
- uint64_t x31 = ((uint64_t)(arg1[1]) << 8);
- uint8_t x32 = (arg1[0]);
- uint64_t x33 = (x32 + (x31 + (x30 + (x29 + (x28 + (x27 + x26))))));
- uint8_t x34 = (uint8_t)(x33 >> 51);
- uint64_t x35 = (x33 & UINT64_C(0x7ffffffffffff));
- uint64_t x36 = (x6 + (x5 + (x4 + (x3 + (x2 + x1)))));
- uint64_t x37 = (x12 + (x11 + (x10 + (x9 + (x8 + x7)))));
- uint64_t x38 = (x19 + (x18 + (x17 + (x16 + (x15 + (x14 + x13))))));
- uint64_t x39 = (x25 + (x24 + (x23 + (x22 + (x21 + x20)))));
- uint64_t x40 = (x34 + x39);
- uint8_t x41 = (uint8_t)(x40 >> 51);
- uint64_t x42 = (x40 & UINT64_C(0x7ffffffffffff));
- uint64_t x43 = (x41 + x38);
- uint8_t x44 = (uint8_t)(x43 >> 51);
- uint64_t x45 = (x43 & UINT64_C(0x7ffffffffffff));
- uint64_t x46 = (x44 + x37);
- uint8_t x47 = (uint8_t)(x46 >> 51);
- uint64_t x48 = (x46 & UINT64_C(0x7ffffffffffff));
- uint64_t x49 = (x47 + x36);
- out1[0] = x35;
- out1[1] = x42;
- out1[2] = x45;
- out1[3] = x48;
- out1[4] = x49;
+ uintptr_t x31, x30, x29, x28, x27, x26, x25, x24, x23, x22, x21, x20, x19, x18, x17, x16, x15, x14, x13, x12, x11, x10, x9, x8, x7, x6, x5, x4, x3, x2, x1, x0, x63, x62, x61, x60, x59, x58, x57, x64, x37, x36, x35, x34, x33, x32, x43, x42, x41, x40, x39, x38, x50, x49, x48, x47, x46, x45, x44, x56, x55, x54, x53, x52, x51, x65, x70, x71, x72, x69, x74, x75, x68, x77, x78, x67, x66, x73, x76, x79, x80, x81, x82, x83, x84, x85;
+ uintptr_t in0, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uint8_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uint8_t*)((in0)+((uintptr_t)1ULL));
+ x2 = *(uint8_t*)((in0)+((uintptr_t)2ULL));
+ x3 = *(uint8_t*)((in0)+((uintptr_t)3ULL));
+ x4 = *(uint8_t*)((in0)+((uintptr_t)4ULL));
+ x5 = *(uint8_t*)((in0)+((uintptr_t)5ULL));
+ x6 = *(uint8_t*)((in0)+((uintptr_t)6ULL));
+ x7 = *(uint8_t*)((in0)+((uintptr_t)7ULL));
+ x8 = *(uint8_t*)((in0)+((uintptr_t)8ULL));
+ x9 = *(uint8_t*)((in0)+((uintptr_t)9ULL));
+ x10 = *(uint8_t*)((in0)+((uintptr_t)10ULL));
+ x11 = *(uint8_t*)((in0)+((uintptr_t)11ULL));
+ x12 = *(uint8_t*)((in0)+((uintptr_t)12ULL));
+ x13 = *(uint8_t*)((in0)+((uintptr_t)13ULL));
+ x14 = *(uint8_t*)((in0)+((uintptr_t)14ULL));
+ x15 = *(uint8_t*)((in0)+((uintptr_t)15ULL));
+ x16 = *(uint8_t*)((in0)+((uintptr_t)16ULL));
+ x17 = *(uint8_t*)((in0)+((uintptr_t)17ULL));
+ x18 = *(uint8_t*)((in0)+((uintptr_t)18ULL));
+ x19 = *(uint8_t*)((in0)+((uintptr_t)19ULL));
+ x20 = *(uint8_t*)((in0)+((uintptr_t)20ULL));
+ x21 = *(uint8_t*)((in0)+((uintptr_t)21ULL));
+ x22 = *(uint8_t*)((in0)+((uintptr_t)22ULL));
+ x23 = *(uint8_t*)((in0)+((uintptr_t)23ULL));
+ x24 = *(uint8_t*)((in0)+((uintptr_t)24ULL));
+ x25 = *(uint8_t*)((in0)+((uintptr_t)25ULL));
+ x26 = *(uint8_t*)((in0)+((uintptr_t)26ULL));
+ x27 = *(uint8_t*)((in0)+((uintptr_t)27ULL));
+ x28 = *(uint8_t*)((in0)+((uintptr_t)28ULL));
+ x29 = *(uint8_t*)((in0)+((uintptr_t)29ULL));
+ x30 = *(uint8_t*)((in0)+((uintptr_t)30ULL));
+ x31 = *(uint8_t*)((in0)+((uintptr_t)31ULL));
+ /*skip*/
+ /*skip*/
+ x32 = (x31)<<((uintptr_t)44ULL);
+ x33 = (x30)<<((uintptr_t)36ULL);
+ x34 = (x29)<<((uintptr_t)28ULL);
+ x35 = (x28)<<((uintptr_t)20ULL);
+ x36 = (x27)<<((uintptr_t)12ULL);
+ x37 = (x26)<<((uintptr_t)4ULL);
+ x38 = (x25)<<((uintptr_t)47ULL);
+ x39 = (x24)<<((uintptr_t)39ULL);
+ x40 = (x23)<<((uintptr_t)31ULL);
+ x41 = (x22)<<((uintptr_t)23ULL);
+ x42 = (x21)<<((uintptr_t)15ULL);
+ x43 = (x20)<<((uintptr_t)7ULL);
+ x44 = (x19)<<((uintptr_t)50ULL);
+ x45 = (x18)<<((uintptr_t)42ULL);
+ x46 = (x17)<<((uintptr_t)34ULL);
+ x47 = (x16)<<((uintptr_t)26ULL);
+ x48 = (x15)<<((uintptr_t)18ULL);
+ x49 = (x14)<<((uintptr_t)10ULL);
+ x50 = (x13)<<((uintptr_t)2ULL);
+ x51 = (x12)<<((uintptr_t)45ULL);
+ x52 = (x11)<<((uintptr_t)37ULL);
+ x53 = (x10)<<((uintptr_t)29ULL);
+ x54 = (x9)<<((uintptr_t)21ULL);
+ x55 = (x8)<<((uintptr_t)13ULL);
+ x56 = (x7)<<((uintptr_t)5ULL);
+ x57 = (x6)<<((uintptr_t)48ULL);
+ x58 = (x5)<<((uintptr_t)40ULL);
+ x59 = (x4)<<((uintptr_t)32ULL);
+ x60 = (x3)<<((uintptr_t)24ULL);
+ x61 = (x2)<<((uintptr_t)16ULL);
+ x62 = (x1)<<((uintptr_t)8ULL);
+ x63 = x0;
+ x64 = (x63)+((x62)+((x61)+((x60)+((x59)+((x58)+(x57))))));
+ x65 = (x64)>>((uintptr_t)51ULL);
+ x66 = (x64)&((uintptr_t)2251799813685247ULL);
+ x67 = (x37)+((x36)+((x35)+((x34)+((x33)+(x32)))));
+ x68 = (x43)+((x42)+((x41)+((x40)+((x39)+(x38)))));
+ x69 = (x50)+((x49)+((x48)+((x47)+((x46)+((x45)+(x44))))));
+ x70 = (x56)+((x55)+((x54)+((x53)+((x52)+(x51)))));
+ x71 = (x65)+(x70);
+ x72 = (x71)>>((uintptr_t)51ULL);
+ x73 = (x71)&((uintptr_t)2251799813685247ULL);
+ x74 = (x72)+(x69);
+ x75 = (x74)>>((uintptr_t)51ULL);
+ x76 = (x74)&((uintptr_t)2251799813685247ULL);
+ x77 = (x75)+(x68);
+ x78 = (x77)>>((uintptr_t)51ULL);
+ x79 = (x77)&((uintptr_t)2251799813685247ULL);
+ x80 = (x78)+(x67);
+ x81 = x66;
+ x82 = x73;
+ x83 = x76;
+ x84 = x79;
+ x85 = x80;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x81;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x82;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x83;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x84;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x85;
+ /*skip*/
+ return;
}
/*
@@ -583,37 +971,69 @@ static void fiat_25519_from_bytes(uint64_t out1[5], const uint8_t arg1[32]) {
* out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
*/
static void fiat_25519_carry_scmul_121666(uint64_t out1[5], const uint64_t arg1[5]) {
- fiat_25519_uint128 x1 = ((fiat_25519_uint128)UINT32_C(0x1db42) * (arg1[4]));
- fiat_25519_uint128 x2 = ((fiat_25519_uint128)UINT32_C(0x1db42) * (arg1[3]));
- fiat_25519_uint128 x3 = ((fiat_25519_uint128)UINT32_C(0x1db42) * (arg1[2]));
- fiat_25519_uint128 x4 = ((fiat_25519_uint128)UINT32_C(0x1db42) * (arg1[1]));
- fiat_25519_uint128 x5 = ((fiat_25519_uint128)UINT32_C(0x1db42) * (arg1[0]));
- uint64_t x6 = (uint64_t)(x5 >> 51);
- uint64_t x7 = (uint64_t)(x5 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x8 = (x6 + x4);
- uint64_t x9 = (uint64_t)(x8 >> 51);
- uint64_t x10 = (uint64_t)(x8 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x11 = (x9 + x3);
- uint64_t x12 = (uint64_t)(x11 >> 51);
- uint64_t x13 = (uint64_t)(x11 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x14 = (x12 + x2);
- uint64_t x15 = (uint64_t)(x14 >> 51);
- uint64_t x16 = (uint64_t)(x14 & UINT64_C(0x7ffffffffffff));
- fiat_25519_uint128 x17 = (x15 + x1);
- uint64_t x18 = (uint64_t)(x17 >> 51);
- uint64_t x19 = (uint64_t)(x17 & UINT64_C(0x7ffffffffffff));
- uint64_t x20 = (x18 * UINT8_C(0x13));
- uint64_t x21 = (x7 + x20);
- fiat_25519_uint1 x22 = (fiat_25519_uint1)(x21 >> 51);
- uint64_t x23 = (x21 & UINT64_C(0x7ffffffffffff));
- uint64_t x24 = (x22 + x10);
- fiat_25519_uint1 x25 = (fiat_25519_uint1)(x24 >> 51);
- uint64_t x26 = (x24 & UINT64_C(0x7ffffffffffff));
- uint64_t x27 = (x25 + x13);
- out1[0] = x23;
- out1[1] = x26;
- out1[2] = x27;
- out1[3] = x16;
- out1[4] = x19;
+ uintptr_t x4, x3, x2, x1, x0, x14, x13, x11, x15, x18, x12, x19, x17, x9, x20, x23, x10, x24, x22, x7, x25, x28, x8, x29, x27, x5, x30, x33, x6, x34, x32, x35, x16, x37, x38, x39, x21, x41, x42, x26, x40, x43, x44, x31, x36, x45, x46, x47, x48, x49;
+ uintptr_t in0, out0;
+ in0 = (uintptr_t) (&arg1[0]);
+ out0 = (uintptr_t) (&out1[0]);
+ x0 = *(uintptr_t*)((in0)+((uintptr_t)0ULL));
+ x1 = *(uintptr_t*)((in0)+((uintptr_t)8ULL));
+ x2 = *(uintptr_t*)((in0)+((uintptr_t)16ULL));
+ x3 = *(uintptr_t*)((in0)+((uintptr_t)24ULL));
+ x4 = *(uintptr_t*)((in0)+((uintptr_t)32ULL));
+ /*skip*/
+ /*skip*/
+ x5 = ((uintptr_t)121666ULL)*(x4);
+ x6 = sizeof(intptr_t) == 4 ? ((uint64_t)((uintptr_t)121666ULL)*(x4))>>32 : ((__uint128_t)((uintptr_t)121666ULL)*(x4))>>64;
+ x7 = ((uintptr_t)121666ULL)*(x3);
+ x8 = sizeof(intptr_t) == 4 ? ((uint64_t)((uintptr_t)121666ULL)*(x3))>>32 : ((__uint128_t)((uintptr_t)121666ULL)*(x3))>>64;
+ x9 = ((uintptr_t)121666ULL)*(x2);
+ x10 = sizeof(intptr_t) == 4 ? ((uint64_t)((uintptr_t)121666ULL)*(x2))>>32 : ((__uint128_t)((uintptr_t)121666ULL)*(x2))>>64;
+ x11 = ((uintptr_t)121666ULL)*(x1);
+ x12 = sizeof(intptr_t) == 4 ? ((uint64_t)((uintptr_t)121666ULL)*(x1))>>32 : ((__uint128_t)((uintptr_t)121666ULL)*(x1))>>64;
+ x13 = ((uintptr_t)121666ULL)*(x0);
+ x14 = sizeof(intptr_t) == 4 ? ((uint64_t)((uintptr_t)121666ULL)*(x0))>>32 : ((__uint128_t)((uintptr_t)121666ULL)*(x0))>>64;
+ x15 = ((x13)>>((uintptr_t)51ULL))|((x14)<<((uintptr_t)13ULL));
+ x16 = (x13)&((uintptr_t)2251799813685247ULL);
+ x17 = (x15)+(x11);
+ x18 = (x17)<(x15);
+ x19 = (x18)+(x12);
+ x20 = ((x17)>>((uintptr_t)51ULL))|((x19)<<((uintptr_t)13ULL));
+ x21 = (x17)&((uintptr_t)2251799813685247ULL);
+ x22 = (x20)+(x9);
+ x23 = (x22)<(x20);
+ x24 = (x23)+(x10);
+ x25 = ((x22)>>((uintptr_t)51ULL))|((x24)<<((uintptr_t)13ULL));
+ x26 = (x22)&((uintptr_t)2251799813685247ULL);
+ x27 = (x25)+(x7);
+ x28 = (x27)<(x25);
+ x29 = (x28)+(x8);
+ x30 = ((x27)>>((uintptr_t)51ULL))|((x29)<<((uintptr_t)13ULL));
+ x31 = (x27)&((uintptr_t)2251799813685247ULL);
+ x32 = (x30)+(x5);
+ x33 = (x32)<(x30);
+ x34 = (x33)+(x6);
+ x35 = ((x32)>>((uintptr_t)51ULL))|((x34)<<((uintptr_t)13ULL));
+ x36 = (x32)&((uintptr_t)2251799813685247ULL);
+ x37 = (x35)*((uintptr_t)19ULL);
+ x38 = (x16)+(x37);
+ x39 = (x38)>>((uintptr_t)51ULL);
+ x40 = (x38)&((uintptr_t)2251799813685247ULL);
+ x41 = (x39)+(x21);
+ x42 = (x41)>>((uintptr_t)51ULL);
+ x43 = (x41)&((uintptr_t)2251799813685247ULL);
+ x44 = (x42)+(x26);
+ x45 = x40;
+ x46 = x43;
+ x47 = x44;
+ x48 = x31;
+ x49 = x36;
+ /*skip*/
+ *(uintptr_t*)((out0)+((uintptr_t)0ULL)) = x45;
+ *(uintptr_t*)((out0)+((uintptr_t)8ULL)) = x46;
+ *(uintptr_t*)((out0)+((uintptr_t)16ULL)) = x47;
+ *(uintptr_t*)((out0)+((uintptr_t)24ULL)) = x48;
+ *(uintptr_t*)((out0)+((uintptr_t)32ULL)) = x49;
+ /*skip*/
+ return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment