// Autogenerated: 'src/ExtractionOCaml/unsaturated_solinas' --lang Zig --internal-static --public-function-case camelCase --private-function-case camelCase --public-type-case UpperCamelCase --private-type-case UpperCamelCase --no-prefix-fiat --package-name p448 '' 64 8 '2^448 - 2^224 - 1' carry_mul carry_square carry add sub opp selectznz to_bytes from_bytes relax // curve description (via package name): p448 // machine_wordsize = 64 (from "64") // requested operations: carry_mul, carry_square, carry, add, sub, opp, selectznz, to_bytes, from_bytes, relax // n = 8 (from "8") // s-c = 2^448 - [(2^224, 1), (1, 1)] (from "2^448 - 2^224 - 1") // tight_bounds_multiplier = 1 (from "") // // Computed values: // carry_chain = [3, 7, 4, 0, 5, 1, 6, 2, 7, 3, 4, 0] // eval z = z[0] + (z[1] << 56) + (z[2] << 112) + (z[3] << 168) + (z[4] << 224) + (z[5] << 0x118) + (z[6] << 0x150) + (z[7] << 0x188) // bytes_eval z = z[0] + (z[1] << 8) + (z[2] << 16) + (z[3] << 24) + (z[4] << 32) + (z[5] << 40) + (z[6] << 48) + (z[7] << 56) + (z[8] << 64) + (z[9] << 72) + (z[10] << 80) + (z[11] << 88) + (z[12] << 96) + (z[13] << 104) + (z[14] << 112) + (z[15] << 120) + (z[16] << 128) + (z[17] << 136) + (z[18] << 144) + (z[19] << 152) + (z[20] << 160) + (z[21] << 168) + (z[22] << 176) + (z[23] << 184) + (z[24] << 192) + (z[25] << 200) + (z[26] << 208) + (z[27] << 216) + (z[28] << 224) + (z[29] << 232) + (z[30] << 240) + (z[31] << 248) + (z[32] << 256) + (z[33] << 0x108) + (z[34] << 0x110) + (z[35] << 0x118) + (z[36] << 0x120) + (z[37] << 0x128) + (z[38] << 0x130) + (z[39] << 0x138) + (z[40] << 0x140) + (z[41] << 0x148) + (z[42] << 0x150) + (z[43] << 0x158) + (z[44] << 0x160) + (z[45] << 0x168) + (z[46] << 0x170) + (z[47] << 0x178) + (z[48] << 0x180) + (z[49] << 0x188) + (z[50] << 0x190) + (z[51] << 0x198) + (z[52] << 0x1a0) + (z[53] << 0x1a8) + (z[54] << 0x1b0) + (z[55] << 0x1b8) // balance = [0x1fffffffffffffe, 0x1fffffffffffffe, 0x1fffffffffffffe, 0x1fffffffffffffe, 0x1fffffffffffffc, 0x1fffffffffffffe, 0x1fffffffffffffe, 0x1fffffffffffffe] const std = @import("std"); const mode = @import("builtin").mode; // Checked arithmetic is disabled in non-debug modes to avoid side channels inline fn cast(comptime DestType: type, target: anytype) DestType { @setEvalBranchQuota(10000); if (@typeInfo(@TypeOf(target)) == .int) { const dest = @typeInfo(DestType).int; const source = @typeInfo(@TypeOf(target)).int; if (dest.bits < source.bits) { const T = std.meta.Int(source.signedness, dest.bits); return @bitCast(@as(T, @truncate(target))); } } return target; } // The type LooseFieldElement is a field element with loose bounds. // Bounds: [[0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000], [0x0 ~> 0x300000000000000]] pub const LooseFieldElement = [8]u64; // The type TightFieldElement is a field element with tight bounds. // Bounds: [[0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000], [0x0 ~> 0x100000000000000]] pub const TightFieldElement = [8]u64; /// The function addcarryxU56 is an addition with carry. /// /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^56 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^56⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffffffffff] /// arg3: [0x0 ~> 0xffffffffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffff] /// out2: [0x0 ~> 0x1] inline fn addcarryxU56(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { @setRuntimeSafety(mode == .Debug); const x1 = ((cast(u64, arg1) + arg2) + arg3); const x2 = (x1 & 0xffffffffffffff); const x3 = cast(u1, (x1 >> 56)); out1.* = x2; out2.* = x3; } /// The function subborrowxU56 is a subtraction with borrow. /// /// Postconditions: /// out1 = (-arg1 + arg2 + -arg3) mod 2^56 /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^56⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffffffffff] /// arg3: [0x0 ~> 0xffffffffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffff] /// out2: [0x0 ~> 0x1] inline fn subborrowxU56(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { @setRuntimeSafety(mode == .Debug); const x1 = cast(i64, (cast(i128, cast(i64, (cast(i128, arg2) - cast(i128, arg1)))) - cast(i128, arg3))); const x2 = cast(i1, (x1 >> 56)); const x3 = cast(u64, (cast(i128, x1) & cast(i128, 0xffffffffffffff))); out1.* = x3; out2.* = cast(u1, (cast(i2, 0x0) - cast(i2, x2))); } /// The function cmovznzU64 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] inline fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { @setRuntimeSafety(mode == .Debug); const x1 = (~(~arg1)); const x2 = cast(u64, (cast(i128, cast(i1, (cast(i2, 0x0) - cast(i2, x1)))) & cast(i128, 0xffffffffffffffff))); const x3 = ((x2 & arg3) | ((~x2) & arg2)); out1.* = x3; } /// The function carryMul multiplies two field elements and reduces the result. /// /// Postconditions: /// eval out1 mod m = (eval arg1 * eval arg2) mod m /// pub fn carryMul(out1: *TightFieldElement, arg1: LooseFieldElement, arg2: LooseFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = (cast(u128, (arg1[7])) * cast(u128, (arg2[7]))); const x2 = (cast(u128, (arg1[7])) * cast(u128, (arg2[6]))); const x3 = (cast(u128, (arg1[7])) * cast(u128, (arg2[5]))); const x4 = (cast(u128, (arg1[6])) * cast(u128, (arg2[7]))); const x5 = (cast(u128, (arg1[6])) * cast(u128, (arg2[6]))); const x6 = (cast(u128, (arg1[5])) * cast(u128, (arg2[7]))); const x7 = (cast(u128, (arg1[7])) * cast(u128, (arg2[7]))); const x8 = (cast(u128, (arg1[7])) * cast(u128, (arg2[6]))); const x9 = (cast(u128, (arg1[7])) * cast(u128, (arg2[5]))); const x10 = (cast(u128, (arg1[6])) * cast(u128, (arg2[7]))); const x11 = (cast(u128, (arg1[6])) * cast(u128, (arg2[6]))); const x12 = (cast(u128, (arg1[5])) * cast(u128, (arg2[7]))); const x13 = (cast(u128, (arg1[7])) * cast(u128, (arg2[7]))); const x14 = (cast(u128, (arg1[7])) * cast(u128, (arg2[6]))); const x15 = (cast(u128, (arg1[7])) * cast(u128, (arg2[5]))); const x16 = (cast(u128, (arg1[7])) * cast(u128, (arg2[4]))); const x17 = (cast(u128, (arg1[7])) * cast(u128, (arg2[3]))); const x18 = (cast(u128, (arg1[7])) * cast(u128, (arg2[2]))); const x19 = (cast(u128, (arg1[7])) * cast(u128, (arg2[1]))); const x20 = (cast(u128, (arg1[6])) * cast(u128, (arg2[7]))); const x21 = (cast(u128, (arg1[6])) * cast(u128, (arg2[6]))); const x22 = (cast(u128, (arg1[6])) * cast(u128, (arg2[5]))); const x23 = (cast(u128, (arg1[6])) * cast(u128, (arg2[4]))); const x24 = (cast(u128, (arg1[6])) * cast(u128, (arg2[3]))); const x25 = (cast(u128, (arg1[6])) * cast(u128, (arg2[2]))); const x26 = (cast(u128, (arg1[5])) * cast(u128, (arg2[7]))); const x27 = (cast(u128, (arg1[5])) * cast(u128, (arg2[6]))); const x28 = (cast(u128, (arg1[5])) * cast(u128, (arg2[5]))); const x29 = (cast(u128, (arg1[5])) * cast(u128, (arg2[4]))); const x30 = (cast(u128, (arg1[5])) * cast(u128, (arg2[3]))); const x31 = (cast(u128, (arg1[4])) * cast(u128, (arg2[7]))); const x32 = (cast(u128, (arg1[4])) * cast(u128, (arg2[6]))); const x33 = (cast(u128, (arg1[4])) * cast(u128, (arg2[5]))); const x34 = (cast(u128, (arg1[4])) * cast(u128, (arg2[4]))); const x35 = (cast(u128, (arg1[3])) * cast(u128, (arg2[7]))); const x36 = (cast(u128, (arg1[3])) * cast(u128, (arg2[6]))); const x37 = (cast(u128, (arg1[3])) * cast(u128, (arg2[5]))); const x38 = (cast(u128, (arg1[2])) * cast(u128, (arg2[7]))); const x39 = (cast(u128, (arg1[2])) * cast(u128, (arg2[6]))); const x40 = (cast(u128, (arg1[1])) * cast(u128, (arg2[7]))); const x41 = (cast(u128, (arg1[7])) * cast(u128, (arg2[4]))); const x42 = (cast(u128, (arg1[7])) * cast(u128, (arg2[3]))); const x43 = (cast(u128, (arg1[7])) * cast(u128, (arg2[2]))); const x44 = (cast(u128, (arg1[7])) * cast(u128, (arg2[1]))); const x45 = (cast(u128, (arg1[6])) * cast(u128, (arg2[5]))); const x46 = (cast(u128, (arg1[6])) * cast(u128, (arg2[4]))); const x47 = (cast(u128, (arg1[6])) * cast(u128, (arg2[3]))); const x48 = (cast(u128, (arg1[6])) * cast(u128, (arg2[2]))); const x49 = (cast(u128, (arg1[5])) * cast(u128, (arg2[6]))); const x50 = (cast(u128, (arg1[5])) * cast(u128, (arg2[5]))); const x51 = (cast(u128, (arg1[5])) * cast(u128, (arg2[4]))); const x52 = (cast(u128, (arg1[5])) * cast(u128, (arg2[3]))); const x53 = (cast(u128, (arg1[4])) * cast(u128, (arg2[7]))); const x54 = (cast(u128, (arg1[4])) * cast(u128, (arg2[6]))); const x55 = (cast(u128, (arg1[4])) * cast(u128, (arg2[5]))); const x56 = (cast(u128, (arg1[4])) * cast(u128, (arg2[4]))); const x57 = (cast(u128, (arg1[3])) * cast(u128, (arg2[7]))); const x58 = (cast(u128, (arg1[3])) * cast(u128, (arg2[6]))); const x59 = (cast(u128, (arg1[3])) * cast(u128, (arg2[5]))); const x60 = (cast(u128, (arg1[2])) * cast(u128, (arg2[7]))); const x61 = (cast(u128, (arg1[2])) * cast(u128, (arg2[6]))); const x62 = (cast(u128, (arg1[1])) * cast(u128, (arg2[7]))); const x63 = (cast(u128, (arg1[7])) * cast(u128, (arg2[0]))); const x64 = (cast(u128, (arg1[6])) * cast(u128, (arg2[1]))); const x65 = (cast(u128, (arg1[6])) * cast(u128, (arg2[0]))); const x66 = (cast(u128, (arg1[5])) * cast(u128, (arg2[2]))); const x67 = (cast(u128, (arg1[5])) * cast(u128, (arg2[1]))); const x68 = (cast(u128, (arg1[5])) * cast(u128, (arg2[0]))); const x69 = (cast(u128, (arg1[4])) * cast(u128, (arg2[3]))); const x70 = (cast(u128, (arg1[4])) * cast(u128, (arg2[2]))); const x71 = (cast(u128, (arg1[4])) * cast(u128, (arg2[1]))); const x72 = (cast(u128, (arg1[4])) * cast(u128, (arg2[0]))); const x73 = (cast(u128, (arg1[3])) * cast(u128, (arg2[4]))); const x74 = (cast(u128, (arg1[3])) * cast(u128, (arg2[3]))); const x75 = (cast(u128, (arg1[3])) * cast(u128, (arg2[2]))); const x76 = (cast(u128, (arg1[3])) * cast(u128, (arg2[1]))); const x77 = (cast(u128, (arg1[3])) * cast(u128, (arg2[0]))); const x78 = (cast(u128, (arg1[2])) * cast(u128, (arg2[5]))); const x79 = (cast(u128, (arg1[2])) * cast(u128, (arg2[4]))); const x80 = (cast(u128, (arg1[2])) * cast(u128, (arg2[3]))); const x81 = (cast(u128, (arg1[2])) * cast(u128, (arg2[2]))); const x82 = (cast(u128, (arg1[2])) * cast(u128, (arg2[1]))); const x83 = (cast(u128, (arg1[2])) * cast(u128, (arg2[0]))); const x84 = (cast(u128, (arg1[1])) * cast(u128, (arg2[6]))); const x85 = (cast(u128, (arg1[1])) * cast(u128, (arg2[5]))); const x86 = (cast(u128, (arg1[1])) * cast(u128, (arg2[4]))); const x87 = (cast(u128, (arg1[1])) * cast(u128, (arg2[3]))); const x88 = (cast(u128, (arg1[1])) * cast(u128, (arg2[2]))); const x89 = (cast(u128, (arg1[1])) * cast(u128, (arg2[1]))); const x90 = (cast(u128, (arg1[1])) * cast(u128, (arg2[0]))); const x91 = (cast(u128, (arg1[0])) * cast(u128, (arg2[7]))); const x92 = (cast(u128, (arg1[0])) * cast(u128, (arg2[6]))); const x93 = (cast(u128, (arg1[0])) * cast(u128, (arg2[5]))); const x94 = (cast(u128, (arg1[0])) * cast(u128, (arg2[4]))); const x95 = (cast(u128, (arg1[0])) * cast(u128, (arg2[3]))); const x96 = (cast(u128, (arg1[0])) * cast(u128, (arg2[2]))); const x97 = (cast(u128, (arg1[0])) * cast(u128, (arg2[1]))); const x98 = (cast(u128, (arg1[0])) * cast(u128, (arg2[0]))); const x99 = (x95 + (x88 + (x82 + (x77 + (x31 + (x27 + (x22 + x16))))))); const x100 = cast(u64, (x99 >> 56)); const x101 = cast(u64, (x99 & cast(u128, 0xffffffffffffff))); const x102 = (x91 + (x84 + (x78 + (x73 + (x69 + (x66 + (x64 + (x63 + (x53 + (x49 + (x45 + x41))))))))))); const x103 = (x92 + (x85 + (x79 + (x74 + (x70 + (x67 + (x65 + (x57 + (x54 + (x50 + (x46 + (x42 + (x13 + x7))))))))))))); const x104 = (x93 + (x86 + (x80 + (x75 + (x71 + (x68 + (x60 + (x58 + (x55 + (x51 + (x47 + (x43 + (x20 + (x14 + (x10 + x8))))))))))))))); const x105 = (x94 + (x87 + (x81 + (x76 + (x72 + (x62 + (x61 + (x59 + (x56 + (x52 + (x48 + (x44 + (x26 + (x21 + (x15 + (x12 + (x11 + x9))))))))))))))))); const x106 = (x96 + (x89 + (x83 + (x35 + (x32 + (x28 + (x23 + (x17 + x1)))))))); const x107 = (x97 + (x90 + (x38 + (x36 + (x33 + (x29 + (x24 + (x18 + (x4 + x2))))))))); const x108 = (x98 + (x40 + (x39 + (x37 + (x34 + (x30 + (x25 + (x19 + (x6 + (x5 + x3)))))))))); const x109 = (cast(u128, x100) + x105); const x110 = cast(u64, (x102 >> 56)); const x111 = cast(u64, (x102 & cast(u128, 0xffffffffffffff))); const x112 = (x109 + cast(u128, x110)); const x113 = cast(u64, (x112 >> 56)); const x114 = cast(u64, (x112 & cast(u128, 0xffffffffffffff))); const x115 = (x108 + cast(u128, x110)); const x116 = (cast(u128, x113) + x104); const x117 = cast(u64, (x115 >> 56)); const x118 = cast(u64, (x115 & cast(u128, 0xffffffffffffff))); const x119 = (cast(u128, x117) + x107); const x120 = cast(u64, (x116 >> 56)); const x121 = cast(u64, (x116 & cast(u128, 0xffffffffffffff))); const x122 = (cast(u128, x120) + x103); const x123 = cast(u64, (x119 >> 56)); const x124 = cast(u64, (x119 & cast(u128, 0xffffffffffffff))); const x125 = (cast(u128, x123) + x106); const x126 = cast(u64, (x122 >> 56)); const x127 = cast(u64, (x122 & cast(u128, 0xffffffffffffff))); const x128 = (x126 + x111); const x129 = cast(u64, (x125 >> 56)); const x130 = cast(u64, (x125 & cast(u128, 0xffffffffffffff))); const x131 = (x129 + x101); const x132 = (x128 >> 56); const x133 = (x128 & 0xffffffffffffff); const x134 = (x131 >> 56); const x135 = (x131 & 0xffffffffffffff); const x136 = (x114 + x132); const x137 = (x118 + x132); const x138 = (x134 + x136); const x139 = cast(u1, (x138 >> 56)); const x140 = (x138 & 0xffffffffffffff); const x141 = (cast(u64, x139) + x121); const x142 = cast(u1, (x137 >> 56)); const x143 = (x137 & 0xffffffffffffff); const x144 = (cast(u64, x142) + x124); out1[0] = x143; out1[1] = x144; out1[2] = x130; out1[3] = x135; out1[4] = x140; out1[5] = x141; out1[6] = x127; out1[7] = x133; } /// The function carrySquare squares a field element and reduces the result. /// /// Postconditions: /// eval out1 mod m = (eval arg1 * eval arg1) mod m /// pub fn carrySquare(out1: *TightFieldElement, arg1: LooseFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = (arg1[7]); const x2 = (arg1[7]); const x3 = (x1 * 0x2); const x4 = (x2 * 0x2); const x5 = ((arg1[7]) * 0x2); const x6 = (arg1[6]); const x7 = (arg1[6]); const x8 = (x6 * 0x2); const x9 = (x7 * 0x2); const x10 = ((arg1[6]) * 0x2); const x11 = (arg1[5]); const x12 = (arg1[5]); const x13 = (x11 * 0x2); const x14 = (x12 * 0x2); const x15 = ((arg1[5]) * 0x2); const x16 = (arg1[4]); const x17 = (arg1[4]); const x18 = ((arg1[4]) * 0x2); const x19 = ((arg1[3]) * 0x2); const x20 = ((arg1[2]) * 0x2); const x21 = ((arg1[1]) * 0x2); const x22 = (cast(u128, (arg1[7])) * cast(u128, x1)); const x23 = (cast(u128, (arg1[6])) * cast(u128, x3)); const x24 = (cast(u128, (arg1[6])) * cast(u128, x6)); const x25 = (cast(u128, (arg1[5])) * cast(u128, x3)); const x26 = (cast(u128, (arg1[7])) * cast(u128, x1)); const x27 = (cast(u128, (arg1[6])) * cast(u128, x3)); const x28 = (cast(u128, (arg1[6])) * cast(u128, x6)); const x29 = (cast(u128, (arg1[5])) * cast(u128, x3)); const x30 = (cast(u128, (arg1[7])) * cast(u128, x2)); const x31 = (cast(u128, (arg1[6])) * cast(u128, x4)); const x32 = (cast(u128, (arg1[6])) * cast(u128, x7)); const x33 = (cast(u128, (arg1[5])) * cast(u128, x4)); const x34 = (cast(u128, (arg1[5])) * cast(u128, x9)); const x35 = (cast(u128, (arg1[5])) * cast(u128, x8)); const x36 = (cast(u128, (arg1[5])) * cast(u128, x12)); const x37 = (cast(u128, (arg1[5])) * cast(u128, x11)); const x38 = (cast(u128, (arg1[4])) * cast(u128, x4)); const x39 = (cast(u128, (arg1[4])) * cast(u128, x3)); const x40 = (cast(u128, (arg1[4])) * cast(u128, x9)); const x41 = (cast(u128, (arg1[4])) * cast(u128, x8)); const x42 = (cast(u128, (arg1[4])) * cast(u128, x14)); const x43 = (cast(u128, (arg1[4])) * cast(u128, x13)); const x44 = (cast(u128, (arg1[4])) * cast(u128, x17)); const x45 = (cast(u128, (arg1[4])) * cast(u128, x16)); const x46 = (cast(u128, (arg1[3])) * cast(u128, x4)); const x47 = (cast(u128, (arg1[3])) * cast(u128, x3)); const x48 = (cast(u128, (arg1[3])) * cast(u128, x9)); const x49 = (cast(u128, (arg1[3])) * cast(u128, x8)); const x50 = (cast(u128, (arg1[3])) * cast(u128, x14)); const x51 = (cast(u128, (arg1[3])) * cast(u128, x13)); const x52 = (cast(u128, (arg1[3])) * cast(u128, x18)); const x53 = (cast(u128, (arg1[3])) * cast(u128, (arg1[3]))); const x54 = (cast(u128, (arg1[2])) * cast(u128, x4)); const x55 = (cast(u128, (arg1[2])) * cast(u128, x3)); const x56 = (cast(u128, (arg1[2])) * cast(u128, x9)); const x57 = (cast(u128, (arg1[2])) * cast(u128, x8)); const x58 = (cast(u128, (arg1[2])) * cast(u128, x15)); const x59 = (cast(u128, (arg1[2])) * cast(u128, x18)); const x60 = (cast(u128, (arg1[2])) * cast(u128, x19)); const x61 = (cast(u128, (arg1[2])) * cast(u128, (arg1[2]))); const x62 = (cast(u128, (arg1[1])) * cast(u128, x4)); const x63 = (cast(u128, (arg1[1])) * cast(u128, x3)); const x64 = (cast(u128, (arg1[1])) * cast(u128, x10)); const x65 = (cast(u128, (arg1[1])) * cast(u128, x15)); const x66 = (cast(u128, (arg1[1])) * cast(u128, x18)); const x67 = (cast(u128, (arg1[1])) * cast(u128, x19)); const x68 = (cast(u128, (arg1[1])) * cast(u128, x20)); const x69 = (cast(u128, (arg1[1])) * cast(u128, (arg1[1]))); const x70 = (cast(u128, (arg1[0])) * cast(u128, x5)); const x71 = (cast(u128, (arg1[0])) * cast(u128, x10)); const x72 = (cast(u128, (arg1[0])) * cast(u128, x15)); const x73 = (cast(u128, (arg1[0])) * cast(u128, x18)); const x74 = (cast(u128, (arg1[0])) * cast(u128, x19)); const x75 = (cast(u128, (arg1[0])) * cast(u128, x20)); const x76 = (cast(u128, (arg1[0])) * cast(u128, x21)); const x77 = (cast(u128, (arg1[0])) * cast(u128, (arg1[0]))); const x78 = (x74 + (x68 + (x38 + x34))); const x79 = cast(u64, (x78 >> 56)); const x80 = cast(u64, (x78 & cast(u128, 0xffffffffffffff))); const x81 = (x70 + (x64 + (x58 + (x52 + (x39 + x35))))); const x82 = (x71 + (x65 + (x59 + (x53 + (x47 + (x41 + (x37 + (x30 + x26)))))))); const x83 = (x72 + (x66 + (x60 + (x55 + (x49 + (x43 + (x31 + x27))))))); const x84 = (x73 + (x67 + (x63 + (x61 + (x57 + (x51 + (x45 + (x33 + (x32 + (x29 + x28)))))))))); const x85 = (x75 + (x69 + (x46 + (x40 + (x36 + x22))))); const x86 = (x76 + (x54 + (x48 + (x42 + x23)))); const x87 = (x77 + (x62 + (x56 + (x50 + (x44 + (x25 + x24)))))); const x88 = (cast(u128, x79) + x84); const x89 = cast(u64, (x81 >> 56)); const x90 = cast(u64, (x81 & cast(u128, 0xffffffffffffff))); const x91 = (x88 + cast(u128, x89)); const x92 = cast(u64, (x91 >> 56)); const x93 = cast(u64, (x91 & cast(u128, 0xffffffffffffff))); const x94 = (x87 + cast(u128, x89)); const x95 = (cast(u128, x92) + x83); const x96 = cast(u64, (x94 >> 56)); const x97 = cast(u64, (x94 & cast(u128, 0xffffffffffffff))); const x98 = (cast(u128, x96) + x86); const x99 = cast(u64, (x95 >> 56)); const x100 = cast(u64, (x95 & cast(u128, 0xffffffffffffff))); const x101 = (cast(u128, x99) + x82); const x102 = cast(u64, (x98 >> 56)); const x103 = cast(u64, (x98 & cast(u128, 0xffffffffffffff))); const x104 = (cast(u128, x102) + x85); const x105 = cast(u64, (x101 >> 56)); const x106 = cast(u64, (x101 & cast(u128, 0xffffffffffffff))); const x107 = (x105 + x90); const x108 = cast(u64, (x104 >> 56)); const x109 = cast(u64, (x104 & cast(u128, 0xffffffffffffff))); const x110 = (x108 + x80); const x111 = (x107 >> 56); const x112 = (x107 & 0xffffffffffffff); const x113 = (x110 >> 56); const x114 = (x110 & 0xffffffffffffff); const x115 = (x93 + x111); const x116 = (x97 + x111); const x117 = (x113 + x115); const x118 = cast(u1, (x117 >> 56)); const x119 = (x117 & 0xffffffffffffff); const x120 = (cast(u64, x118) + x100); const x121 = cast(u1, (x116 >> 56)); const x122 = (x116 & 0xffffffffffffff); const x123 = (cast(u64, x121) + x103); out1[0] = x122; out1[1] = x123; out1[2] = x109; out1[3] = x114; out1[4] = x119; out1[5] = x120; out1[6] = x106; out1[7] = x112; } /// The function carry reduces a field element. /// /// Postconditions: /// eval out1 mod m = eval arg1 mod m /// pub fn carry(out1: *TightFieldElement, arg1: LooseFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = (arg1[3]); const x2 = (arg1[7]); const x3 = (x2 >> 56); const x4 = (((x1 >> 56) + (arg1[4])) + x3); const x5 = ((arg1[0]) + x3); const x6 = ((x4 >> 56) + (arg1[5])); const x7 = ((x5 >> 56) + (arg1[1])); const x8 = ((x6 >> 56) + (arg1[6])); const x9 = ((x7 >> 56) + (arg1[2])); const x10 = ((x8 >> 56) + (x2 & 0xffffffffffffff)); const x11 = ((x9 >> 56) + (x1 & 0xffffffffffffff)); const x12 = cast(u1, (x10 >> 56)); const x13 = ((x5 & 0xffffffffffffff) + cast(u64, x12)); const x14 = (cast(u64, cast(u1, (x11 >> 56))) + ((x4 & 0xffffffffffffff) + cast(u64, x12))); const x15 = (x13 & 0xffffffffffffff); const x16 = (cast(u64, cast(u1, (x13 >> 56))) + (x7 & 0xffffffffffffff)); const x17 = (x9 & 0xffffffffffffff); const x18 = (x11 & 0xffffffffffffff); const x19 = (x14 & 0xffffffffffffff); const x20 = (cast(u64, cast(u1, (x14 >> 56))) + (x6 & 0xffffffffffffff)); const x21 = (x8 & 0xffffffffffffff); const x22 = (x10 & 0xffffffffffffff); out1[0] = x15; out1[1] = x16; out1[2] = x17; out1[3] = x18; out1[4] = x19; out1[5] = x20; out1[6] = x21; out1[7] = x22; } /// The function add adds two field elements. /// /// Postconditions: /// eval out1 mod m = (eval arg1 + eval arg2) mod m /// pub fn add(out1: *LooseFieldElement, arg1: TightFieldElement, arg2: TightFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = ((arg1[0]) + (arg2[0])); const x2 = ((arg1[1]) + (arg2[1])); const x3 = ((arg1[2]) + (arg2[2])); const x4 = ((arg1[3]) + (arg2[3])); const x5 = ((arg1[4]) + (arg2[4])); const x6 = ((arg1[5]) + (arg2[5])); const x7 = ((arg1[6]) + (arg2[6])); const x8 = ((arg1[7]) + (arg2[7])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; } /// The function sub subtracts two field elements. /// /// Postconditions: /// eval out1 mod m = (eval arg1 - eval arg2) mod m /// pub fn sub(out1: *LooseFieldElement, arg1: TightFieldElement, arg2: TightFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = ((0x1fffffffffffffe + (arg1[0])) - (arg2[0])); const x2 = ((0x1fffffffffffffe + (arg1[1])) - (arg2[1])); const x3 = ((0x1fffffffffffffe + (arg1[2])) - (arg2[2])); const x4 = ((0x1fffffffffffffe + (arg1[3])) - (arg2[3])); const x5 = ((0x1fffffffffffffc + (arg1[4])) - (arg2[4])); const x6 = ((0x1fffffffffffffe + (arg1[5])) - (arg2[5])); const x7 = ((0x1fffffffffffffe + (arg1[6])) - (arg2[6])); const x8 = ((0x1fffffffffffffe + (arg1[7])) - (arg2[7])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; } /// The function opp negates a field element. /// /// Postconditions: /// eval out1 mod m = -eval arg1 mod m /// pub fn opp(out1: *LooseFieldElement, arg1: TightFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = (0x1fffffffffffffe - (arg1[0])); const x2 = (0x1fffffffffffffe - (arg1[1])); const x3 = (0x1fffffffffffffe - (arg1[2])); const x4 = (0x1fffffffffffffe - (arg1[3])); const x5 = (0x1fffffffffffffc - (arg1[4])); const x6 = (0x1fffffffffffffe - (arg1[5])); const x7 = (0x1fffffffffffffe - (arg1[6])); const x8 = (0x1fffffffffffffe - (arg1[7])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; } /// The function selectznz is a multi-limb conditional select. /// /// Postconditions: /// out1 = (if arg1 = 0 then arg2 else arg3) /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn selectznz(out1: *[8]u64, arg1: u1, arg2: [8]u64, arg3: [8]u64) void { @setRuntimeSafety(mode == .Debug); var x1: u64 = undefined; cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); var x2: u64 = undefined; cmovznzU64(&x2, arg1, (arg2[1]), (arg3[1])); var x3: u64 = undefined; cmovznzU64(&x3, arg1, (arg2[2]), (arg3[2])); var x4: u64 = undefined; cmovznzU64(&x4, arg1, (arg2[3]), (arg3[3])); var x5: u64 = undefined; cmovznzU64(&x5, arg1, (arg2[4]), (arg3[4])); var x6: u64 = undefined; cmovznzU64(&x6, arg1, (arg2[5]), (arg3[5])); var x7: u64 = undefined; cmovznzU64(&x7, arg1, (arg2[6]), (arg3[6])); var x8: u64 = undefined; cmovznzU64(&x8, arg1, (arg2[7]), (arg3[7])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; } /// The function toBytes serializes a field element to bytes in little-endian order. /// /// Postconditions: /// out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..55] /// /// Output Bounds: /// 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 ~> 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]] pub fn toBytes(out1: *[56]u8, arg1: TightFieldElement) void { @setRuntimeSafety(mode == .Debug); var x1: u64 = undefined; var x2: u1 = undefined; subborrowxU56(&x1, &x2, 0x0, (arg1[0]), 0xffffffffffffff); var x3: u64 = undefined; var x4: u1 = undefined; subborrowxU56(&x3, &x4, x2, (arg1[1]), 0xffffffffffffff); var x5: u64 = undefined; var x6: u1 = undefined; subborrowxU56(&x5, &x6, x4, (arg1[2]), 0xffffffffffffff); var x7: u64 = undefined; var x8: u1 = undefined; subborrowxU56(&x7, &x8, x6, (arg1[3]), 0xffffffffffffff); var x9: u64 = undefined; var x10: u1 = undefined; subborrowxU56(&x9, &x10, x8, (arg1[4]), 0xfffffffffffffe); var x11: u64 = undefined; var x12: u1 = undefined; subborrowxU56(&x11, &x12, x10, (arg1[5]), 0xffffffffffffff); var x13: u64 = undefined; var x14: u1 = undefined; subborrowxU56(&x13, &x14, x12, (arg1[6]), 0xffffffffffffff); var x15: u64 = undefined; var x16: u1 = undefined; subborrowxU56(&x15, &x16, x14, (arg1[7]), 0xffffffffffffff); var x17: u64 = undefined; cmovznzU64(&x17, x16, cast(u64, 0x0), 0xffffffffffffffff); var x18: u64 = undefined; var x19: u1 = undefined; addcarryxU56(&x18, &x19, 0x0, x1, (x17 & 0xffffffffffffff)); var x20: u64 = undefined; var x21: u1 = undefined; addcarryxU56(&x20, &x21, x19, x3, (x17 & 0xffffffffffffff)); var x22: u64 = undefined; var x23: u1 = undefined; addcarryxU56(&x22, &x23, x21, x5, (x17 & 0xffffffffffffff)); var x24: u64 = undefined; var x25: u1 = undefined; addcarryxU56(&x24, &x25, x23, x7, (x17 & 0xffffffffffffff)); var x26: u64 = undefined; var x27: u1 = undefined; addcarryxU56(&x26, &x27, x25, x9, (x17 & 0xfffffffffffffe)); var x28: u64 = undefined; var x29: u1 = undefined; addcarryxU56(&x28, &x29, x27, x11, (x17 & 0xffffffffffffff)); var x30: u64 = undefined; var x31: u1 = undefined; addcarryxU56(&x30, &x31, x29, x13, (x17 & 0xffffffffffffff)); var x32: u64 = undefined; var x33: u1 = undefined; addcarryxU56(&x32, &x33, x31, x15, (x17 & 0xffffffffffffff)); const x34 = cast(u8, (x18 & cast(u64, 0xff))); const x35 = (x18 >> 8); const x36 = cast(u8, (x35 & cast(u64, 0xff))); const x37 = (x35 >> 8); const x38 = cast(u8, (x37 & cast(u64, 0xff))); const x39 = (x37 >> 8); const x40 = cast(u8, (x39 & cast(u64, 0xff))); const x41 = (x39 >> 8); const x42 = cast(u8, (x41 & cast(u64, 0xff))); const x43 = (x41 >> 8); const x44 = cast(u8, (x43 & cast(u64, 0xff))); const x45 = cast(u8, (x43 >> 8)); const x46 = cast(u8, (x20 & cast(u64, 0xff))); const x47 = (x20 >> 8); const x48 = cast(u8, (x47 & cast(u64, 0xff))); const x49 = (x47 >> 8); const x50 = cast(u8, (x49 & cast(u64, 0xff))); const x51 = (x49 >> 8); const x52 = cast(u8, (x51 & cast(u64, 0xff))); const x53 = (x51 >> 8); const x54 = cast(u8, (x53 & cast(u64, 0xff))); const x55 = (x53 >> 8); const x56 = cast(u8, (x55 & cast(u64, 0xff))); const x57 = cast(u8, (x55 >> 8)); const x58 = cast(u8, (x22 & cast(u64, 0xff))); const x59 = (x22 >> 8); const x60 = cast(u8, (x59 & cast(u64, 0xff))); const x61 = (x59 >> 8); const x62 = cast(u8, (x61 & cast(u64, 0xff))); const x63 = (x61 >> 8); const x64 = cast(u8, (x63 & cast(u64, 0xff))); const x65 = (x63 >> 8); const x66 = cast(u8, (x65 & cast(u64, 0xff))); const x67 = (x65 >> 8); const x68 = cast(u8, (x67 & cast(u64, 0xff))); const x69 = cast(u8, (x67 >> 8)); const x70 = cast(u8, (x24 & cast(u64, 0xff))); const x71 = (x24 >> 8); const x72 = cast(u8, (x71 & cast(u64, 0xff))); const x73 = (x71 >> 8); const x74 = cast(u8, (x73 & cast(u64, 0xff))); const x75 = (x73 >> 8); const x76 = cast(u8, (x75 & cast(u64, 0xff))); const x77 = (x75 >> 8); const x78 = cast(u8, (x77 & cast(u64, 0xff))); const x79 = (x77 >> 8); const x80 = cast(u8, (x79 & cast(u64, 0xff))); const x81 = cast(u8, (x79 >> 8)); const x82 = cast(u8, (x26 & cast(u64, 0xff))); const x83 = (x26 >> 8); const x84 = cast(u8, (x83 & cast(u64, 0xff))); const x85 = (x83 >> 8); const x86 = cast(u8, (x85 & cast(u64, 0xff))); const x87 = (x85 >> 8); const x88 = cast(u8, (x87 & cast(u64, 0xff))); const x89 = (x87 >> 8); const x90 = cast(u8, (x89 & cast(u64, 0xff))); const x91 = (x89 >> 8); const x92 = cast(u8, (x91 & cast(u64, 0xff))); const x93 = cast(u8, (x91 >> 8)); const x94 = cast(u8, (x28 & cast(u64, 0xff))); const x95 = (x28 >> 8); const x96 = cast(u8, (x95 & cast(u64, 0xff))); const x97 = (x95 >> 8); const x98 = cast(u8, (x97 & cast(u64, 0xff))); const x99 = (x97 >> 8); const x100 = cast(u8, (x99 & cast(u64, 0xff))); const x101 = (x99 >> 8); const x102 = cast(u8, (x101 & cast(u64, 0xff))); const x103 = (x101 >> 8); const x104 = cast(u8, (x103 & cast(u64, 0xff))); const x105 = cast(u8, (x103 >> 8)); const x106 = cast(u8, (x30 & cast(u64, 0xff))); const x107 = (x30 >> 8); const x108 = cast(u8, (x107 & cast(u64, 0xff))); const x109 = (x107 >> 8); const x110 = cast(u8, (x109 & cast(u64, 0xff))); const x111 = (x109 >> 8); const x112 = cast(u8, (x111 & cast(u64, 0xff))); const x113 = (x111 >> 8); const x114 = cast(u8, (x113 & cast(u64, 0xff))); const x115 = (x113 >> 8); const x116 = cast(u8, (x115 & cast(u64, 0xff))); const x117 = cast(u8, (x115 >> 8)); const x118 = cast(u8, (x32 & cast(u64, 0xff))); const x119 = (x32 >> 8); const x120 = cast(u8, (x119 & cast(u64, 0xff))); const x121 = (x119 >> 8); const x122 = cast(u8, (x121 & cast(u64, 0xff))); const x123 = (x121 >> 8); const x124 = cast(u8, (x123 & cast(u64, 0xff))); const x125 = (x123 >> 8); const x126 = cast(u8, (x125 & cast(u64, 0xff))); const x127 = (x125 >> 8); const x128 = cast(u8, (x127 & cast(u64, 0xff))); const x129 = cast(u8, (x127 >> 8)); out1[0] = x34; out1[1] = x36; out1[2] = x38; out1[3] = x40; out1[4] = x42; out1[5] = x44; out1[6] = x45; out1[7] = x46; out1[8] = x48; out1[9] = x50; out1[10] = x52; out1[11] = x54; out1[12] = x56; out1[13] = x57; out1[14] = x58; out1[15] = x60; out1[16] = x62; out1[17] = x64; out1[18] = x66; out1[19] = x68; out1[20] = x69; out1[21] = x70; out1[22] = x72; out1[23] = x74; out1[24] = x76; out1[25] = x78; out1[26] = x80; out1[27] = x81; out1[28] = x82; out1[29] = x84; out1[30] = x86; out1[31] = x88; out1[32] = x90; out1[33] = x92; out1[34] = x93; out1[35] = x94; out1[36] = x96; out1[37] = x98; out1[38] = x100; out1[39] = x102; out1[40] = x104; out1[41] = x105; out1[42] = x106; out1[43] = x108; out1[44] = x110; out1[45] = x112; out1[46] = x114; out1[47] = x116; out1[48] = x117; out1[49] = x118; out1[50] = x120; out1[51] = x122; out1[52] = x124; out1[53] = x126; out1[54] = x128; out1[55] = x129; } /// The function fromBytes deserializes a field element from bytes in little-endian order. /// /// Postconditions: /// eval out1 mod m = bytes_eval arg1 mod m /// /// Input Bounds: /// 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 ~> 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]] pub fn fromBytes(out1: *TightFieldElement, arg1: [56]u8) void { @setRuntimeSafety(mode == .Debug); const x1 = (cast(u64, (arg1[55])) << 48); const x2 = (cast(u64, (arg1[54])) << 40); const x3 = (cast(u64, (arg1[53])) << 32); const x4 = (cast(u64, (arg1[52])) << 24); const x5 = (cast(u64, (arg1[51])) << 16); const x6 = (cast(u64, (arg1[50])) << 8); const x7 = (arg1[49]); const x8 = (cast(u64, (arg1[48])) << 48); const x9 = (cast(u64, (arg1[47])) << 40); const x10 = (cast(u64, (arg1[46])) << 32); const x11 = (cast(u64, (arg1[45])) << 24); const x12 = (cast(u64, (arg1[44])) << 16); const x13 = (cast(u64, (arg1[43])) << 8); const x14 = (arg1[42]); const x15 = (cast(u64, (arg1[41])) << 48); const x16 = (cast(u64, (arg1[40])) << 40); const x17 = (cast(u64, (arg1[39])) << 32); const x18 = (cast(u64, (arg1[38])) << 24); const x19 = (cast(u64, (arg1[37])) << 16); const x20 = (cast(u64, (arg1[36])) << 8); const x21 = (arg1[35]); const x22 = (cast(u64, (arg1[34])) << 48); const x23 = (cast(u64, (arg1[33])) << 40); const x24 = (cast(u64, (arg1[32])) << 32); const x25 = (cast(u64, (arg1[31])) << 24); const x26 = (cast(u64, (arg1[30])) << 16); const x27 = (cast(u64, (arg1[29])) << 8); const x28 = (arg1[28]); const x29 = (cast(u64, (arg1[27])) << 48); const x30 = (cast(u64, (arg1[26])) << 40); const x31 = (cast(u64, (arg1[25])) << 32); const x32 = (cast(u64, (arg1[24])) << 24); const x33 = (cast(u64, (arg1[23])) << 16); const x34 = (cast(u64, (arg1[22])) << 8); const x35 = (arg1[21]); const x36 = (cast(u64, (arg1[20])) << 48); const x37 = (cast(u64, (arg1[19])) << 40); const x38 = (cast(u64, (arg1[18])) << 32); const x39 = (cast(u64, (arg1[17])) << 24); const x40 = (cast(u64, (arg1[16])) << 16); const x41 = (cast(u64, (arg1[15])) << 8); const x42 = (arg1[14]); const x43 = (cast(u64, (arg1[13])) << 48); const x44 = (cast(u64, (arg1[12])) << 40); const x45 = (cast(u64, (arg1[11])) << 32); const x46 = (cast(u64, (arg1[10])) << 24); const x47 = (cast(u64, (arg1[9])) << 16); const x48 = (cast(u64, (arg1[8])) << 8); const x49 = (arg1[7]); const x50 = (cast(u64, (arg1[6])) << 48); const x51 = (cast(u64, (arg1[5])) << 40); const x52 = (cast(u64, (arg1[4])) << 32); const x53 = (cast(u64, (arg1[3])) << 24); const x54 = (cast(u64, (arg1[2])) << 16); const x55 = (cast(u64, (arg1[1])) << 8); const x56 = (arg1[0]); const x57 = (x55 + cast(u64, x56)); const x58 = (x54 + x57); const x59 = (x53 + x58); const x60 = (x52 + x59); const x61 = (x51 + x60); const x62 = (x50 + x61); const x63 = (x48 + cast(u64, x49)); const x64 = (x47 + x63); const x65 = (x46 + x64); const x66 = (x45 + x65); const x67 = (x44 + x66); const x68 = (x43 + x67); const x69 = (x41 + cast(u64, x42)); const x70 = (x40 + x69); const x71 = (x39 + x70); const x72 = (x38 + x71); const x73 = (x37 + x72); const x74 = (x36 + x73); const x75 = (x34 + cast(u64, x35)); const x76 = (x33 + x75); const x77 = (x32 + x76); const x78 = (x31 + x77); const x79 = (x30 + x78); const x80 = (x29 + x79); const x81 = (x27 + cast(u64, x28)); const x82 = (x26 + x81); const x83 = (x25 + x82); const x84 = (x24 + x83); const x85 = (x23 + x84); const x86 = (x22 + x85); const x87 = (x20 + cast(u64, x21)); const x88 = (x19 + x87); const x89 = (x18 + x88); const x90 = (x17 + x89); const x91 = (x16 + x90); const x92 = (x15 + x91); const x93 = (x13 + cast(u64, x14)); const x94 = (x12 + x93); const x95 = (x11 + x94); const x96 = (x10 + x95); const x97 = (x9 + x96); const x98 = (x8 + x97); const x99 = (x6 + cast(u64, x7)); const x100 = (x5 + x99); const x101 = (x4 + x100); const x102 = (x3 + x101); const x103 = (x2 + x102); const x104 = (x1 + x103); out1[0] = x62; out1[1] = x68; out1[2] = x74; out1[3] = x80; out1[4] = x86; out1[5] = x92; out1[6] = x98; out1[7] = x104; } /// The function relax is the identity function converting from tight field elements to loose field elements. /// /// Postconditions: /// out1 = arg1 /// pub fn relax(out1: *LooseFieldElement, arg1: TightFieldElement) void { @setRuntimeSafety(mode == .Debug); const x1 = (arg1[0]); const x2 = (arg1[1]); const x3 = (arg1[2]); const x4 = (arg1[3]); const x5 = (arg1[4]); const x6 = (arg1[5]); const x7 = (arg1[6]); const x8 = (arg1[7]); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; }