diff --git a/src/fields/fp.rs b/src/fields/fp.rs index e0d9bc0..67f8b8c 100644 --- a/src/fields/fp.rs +++ b/src/fields/fp.rs @@ -7,13 +7,16 @@ use crate::EncodingError; pub mod arkworks; mod ops; mod u32; + +// The u64 backend requires arkworks +#[cfg(feature = "arkworks")] mod u64; cfg_if! { - if #[cfg(feature = "u32_backend")] { - pub type Fp = u32::Fp; - } else { + if #[cfg(feature = "arkworks")] { pub type Fp = u64::Fp; + } else { + pub type Fp = u32::Fp; } } diff --git a/src/fields/fp/arkworks.rs b/src/fields/fp/arkworks.rs index 9a3ba96..2596019 100644 --- a/src/fields/fp/arkworks.rs +++ b/src/fields/fp/arkworks.rs @@ -658,9 +658,7 @@ mod tests { #[test] fn test_minus_one_squared() { let minus_one = Fp::zero() - Fp::one(); - assert_eq!(Fp::one(), Fp::ONE); - - //assert_eq!(minus_one.square(), Fp::ONE); + assert_eq!(minus_one.square(), Fp::ONE); } #[test] diff --git a/src/fields/fp/u64.rs b/src/fields/fp/u64.rs index d0fedb1..144d902 100644 --- a/src/fields/fp/u64.rs +++ b/src/fields/fp/u64.rs @@ -1,4 +1,3 @@ -pub mod fiat; pub mod wrapper; pub use wrapper::Fp; diff --git a/src/fields/fp/u64/fiat.rs b/src/fields/fp/u64/fiat.rs deleted file mode 100644 index ce12d08..0000000 --- a/src/fields/fp/u64/fiat.rs +++ /dev/null @@ -1,3683 +0,0 @@ -//! Autogenerated: fiat_crypto.js word-by-word-montgomery --lang Rust fp 64 258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177 --no-prefix-fiat --public-type-case PascalCase --private-type-case PascalCase -//! curve description: fp -//! machine_wordsize = 64 (from "64") -//! requested operations: (all) -//! m = 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001 (from "258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177") -//! -//! NOTE: In addition to the bounds specified above each function, all -//! functions synthesized for this Montgomery arithmetic require the -//! input to be strictly less than the prime modulus (m), and also -//! require the input to be in the unique saturated representation. -//! All functions also ensure that these two properties are true of -//! return values. -//! -//! Computed values: -//! eval z = z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) + (z[4] << 256) + (z[5] << 0x140) -//! 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) -//! twos_complement_eval z = let x1 := z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) + (z[4] << 256) + (z[5] << 0x140) in -//! if x1 & (2^384-1) < 2^383 then x1 & (2^384-1) else (x1 & (2^384-1)) - 2^384 - -#![allow(unused_parens)] -#![allow(non_camel_case_types)] - -/** FpU1 represents values of 1 bits, stored in one byte. */ -pub type FpU1 = u8; -/** FpI1 represents values of 1 bits, stored in one byte. */ -pub type FpI1 = i8; -/** FpU2 represents values of 2 bits, stored in one byte. */ -pub type FpU2 = u8; -/** FpI2 represents values of 2 bits, stored in one byte. */ -pub type FpI2 = i8; - -/** The type FpMontgomeryDomainFieldElement is a field element in the Montgomery domain. */ -/** Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ -#[derive(Clone, Copy)] -pub struct FpMontgomeryDomainFieldElement(pub [u64; 6]); - -impl core::ops::Index for FpMontgomeryDomainFieldElement { - type Output = u64; - #[inline] - fn index(&self, index: usize) -> &Self::Output { - &self.0[index] - } -} - -impl core::ops::IndexMut for FpMontgomeryDomainFieldElement { - #[inline] - fn index_mut(&mut self, index: usize) -> &mut Self::Output { - &mut self.0[index] - } -} - -/** The type FpNonMontgomeryDomainFieldElement is a field element NOT in the Montgomery domain. */ -/** Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ -#[derive(Clone, Copy)] -pub struct FpNonMontgomeryDomainFieldElement(pub [u64; 6]); - -impl core::ops::Index for FpNonMontgomeryDomainFieldElement { - type Output = u64; - #[inline] - fn index(&self, index: usize) -> &Self::Output { - &self.0[index] - } -} - -impl core::ops::IndexMut for FpNonMontgomeryDomainFieldElement { - #[inline] - fn index_mut(&mut self, index: usize) -> &mut Self::Output { - &mut self.0[index] - } -} - -/// The function fp_addcarryx_u64 is an addition with carry. -/// -/// Postconditions: -/// out1 = (arg1 + arg2 + arg3) mod 2^64 -/// out2 = ⌊(arg1 + arg2 + arg3) / 2^64⌋ -/// -/// Input Bounds: -/// arg1: [0x0 ~> 0x1] -/// arg2: [0x0 ~> 0xffffffffffffffff] -/// arg3: [0x0 ~> 0xffffffffffffffff] -/// Output Bounds: -/// out1: [0x0 ~> 0xffffffffffffffff] -/// out2: [0x0 ~> 0x1] -pub fn fp_addcarryx_u64(out1: &mut u64, out2: &mut FpU1, arg1: FpU1, arg2: u64, arg3: u64) { - let x1: u128 = (((arg1 as u128) + (arg2 as u128)) + (arg3 as u128)); - let x2: u64 = ((x1 & (0xffffffffffffffff as u128)) as u64); - let x3: FpU1 = ((x1 >> 64) as FpU1); - *out1 = x2; - *out2 = x3; -} - -/// The function fp_subborrowx_u64 is a subtraction with borrow. -/// -/// Postconditions: -/// out1 = (-arg1 + arg2 + -arg3) mod 2^64 -/// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^64⌋ -/// -/// Input Bounds: -/// arg1: [0x0 ~> 0x1] -/// arg2: [0x0 ~> 0xffffffffffffffff] -/// arg3: [0x0 ~> 0xffffffffffffffff] -/// Output Bounds: -/// out1: [0x0 ~> 0xffffffffffffffff] -/// out2: [0x0 ~> 0x1] -pub fn fp_subborrowx_u64(out1: &mut u64, out2: &mut FpU1, arg1: FpU1, arg2: u64, arg3: u64) { - let x1: i128 = (((arg2 as i128) - (arg1 as i128)) - (arg3 as i128)); - let x2: FpI1 = ((x1 >> 64) as FpI1); - let x3: u64 = ((x1 & (0xffffffffffffffff as i128)) as u64); - *out1 = x3; - *out2 = (((0x0 as FpI2) - (x2 as FpI2)) as FpU1); -} - -/// The function fp_mulx_u64 is a multiplication, returning the full double-width result. -/// -/// Postconditions: -/// out1 = (arg1 * arg2) mod 2^64 -/// out2 = ⌊arg1 * arg2 / 2^64⌋ -/// -/// Input Bounds: -/// arg1: [0x0 ~> 0xffffffffffffffff] -/// arg2: [0x0 ~> 0xffffffffffffffff] -/// Output Bounds: -/// out1: [0x0 ~> 0xffffffffffffffff] -/// out2: [0x0 ~> 0xffffffffffffffff] -pub fn fp_mulx_u64(out1: &mut u64, out2: &mut u64, arg1: u64, arg2: u64) { - let x1: u128 = ((arg1 as u128) * (arg2 as u128)); - let x2: u64 = ((x1 & (0xffffffffffffffff as u128)) as u64); - let x3: u64 = ((x1 >> 64) as u64); - *out1 = x2; - *out2 = x3; -} - -/// The function fp_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] -pub fn fp_cmovznz_u64(out1: &mut u64, arg1: FpU1, arg2: u64, arg3: u64) { - let x1: FpU1 = (!(!arg1)); - let x2: u64 = ((((((0x0 as FpI2) - (x1 as FpI2)) as FpI1) as i128) - & (0xffffffffffffffff as i128)) as u64); - let x3: u64 = ((x2 & arg3) | ((!x2) & arg2)); - *out1 = x3; -} - -/// The function fp_mul multiplies two field elements in the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// 0 ≤ eval arg2 < m -/// Postconditions: -/// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg2)) mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_mul( - out1: &mut FpMontgomeryDomainFieldElement, - arg1: &FpMontgomeryDomainFieldElement, - arg2: &FpMontgomeryDomainFieldElement, -) { - let x1: u64 = (arg1[1]); - let x2: u64 = (arg1[2]); - let x3: u64 = (arg1[3]); - let x4: u64 = (arg1[4]); - let x5: u64 = (arg1[5]); - let x6: u64 = (arg1[0]); - let mut x7: u64 = 0; - let mut x8: u64 = 0; - fp_mulx_u64(&mut x7, &mut x8, x6, (arg2[5])); - let mut x9: u64 = 0; - let mut x10: u64 = 0; - fp_mulx_u64(&mut x9, &mut x10, x6, (arg2[4])); - let mut x11: u64 = 0; - let mut x12: u64 = 0; - fp_mulx_u64(&mut x11, &mut x12, x6, (arg2[3])); - let mut x13: u64 = 0; - let mut x14: u64 = 0; - fp_mulx_u64(&mut x13, &mut x14, x6, (arg2[2])); - let mut x15: u64 = 0; - let mut x16: u64 = 0; - fp_mulx_u64(&mut x15, &mut x16, x6, (arg2[1])); - let mut x17: u64 = 0; - let mut x18: u64 = 0; - fp_mulx_u64(&mut x17, &mut x18, x6, (arg2[0])); - let mut x19: u64 = 0; - let mut x20: FpU1 = 0; - fp_addcarryx_u64(&mut x19, &mut x20, 0x0, x18, x15); - let mut x21: u64 = 0; - let mut x22: FpU1 = 0; - fp_addcarryx_u64(&mut x21, &mut x22, x20, x16, x13); - let mut x23: u64 = 0; - let mut x24: FpU1 = 0; - fp_addcarryx_u64(&mut x23, &mut x24, x22, x14, x11); - let mut x25: u64 = 0; - let mut x26: FpU1 = 0; - fp_addcarryx_u64(&mut x25, &mut x26, x24, x12, x9); - let mut x27: u64 = 0; - let mut x28: FpU1 = 0; - fp_addcarryx_u64(&mut x27, &mut x28, x26, x10, x7); - let x29: u64 = ((x28 as u64) + x8); - let mut x30: u64 = 0; - let mut x31: u64 = 0; - fp_mulx_u64(&mut x30, &mut x31, x17, 0x8508bfffffffffff); - let mut x32: u64 = 0; - let mut x33: u64 = 0; - fp_mulx_u64(&mut x32, &mut x33, x30, 0x1ae3a4617c510ea); - let mut x34: u64 = 0; - let mut x35: u64 = 0; - fp_mulx_u64(&mut x34, &mut x35, x30, 0xc63b05c06ca1493b); - let mut x36: u64 = 0; - let mut x37: u64 = 0; - fp_mulx_u64(&mut x36, &mut x37, x30, 0x1a22d9f300f5138f); - let mut x38: u64 = 0; - let mut x39: u64 = 0; - fp_mulx_u64(&mut x38, &mut x39, x30, 0x1ef3622fba094800); - let mut x40: u64 = 0; - let mut x41: u64 = 0; - fp_mulx_u64(&mut x40, &mut x41, x30, 0x170b5d4430000000); - let mut x42: u64 = 0; - let mut x43: u64 = 0; - fp_mulx_u64(&mut x42, &mut x43, x30, 0x8508c00000000001); - let mut x44: u64 = 0; - let mut x45: FpU1 = 0; - fp_addcarryx_u64(&mut x44, &mut x45, 0x0, x43, x40); - let mut x46: u64 = 0; - let mut x47: FpU1 = 0; - fp_addcarryx_u64(&mut x46, &mut x47, x45, x41, x38); - let mut x48: u64 = 0; - let mut x49: FpU1 = 0; - fp_addcarryx_u64(&mut x48, &mut x49, x47, x39, x36); - let mut x50: u64 = 0; - let mut x51: FpU1 = 0; - fp_addcarryx_u64(&mut x50, &mut x51, x49, x37, x34); - let mut x52: u64 = 0; - let mut x53: FpU1 = 0; - fp_addcarryx_u64(&mut x52, &mut x53, x51, x35, x32); - let x54: u64 = ((x53 as u64) + x33); - let mut x55: u64 = 0; - let mut x56: FpU1 = 0; - fp_addcarryx_u64(&mut x55, &mut x56, 0x0, x17, x42); - let mut x57: u64 = 0; - let mut x58: FpU1 = 0; - fp_addcarryx_u64(&mut x57, &mut x58, x56, x19, x44); - let mut x59: u64 = 0; - let mut x60: FpU1 = 0; - fp_addcarryx_u64(&mut x59, &mut x60, x58, x21, x46); - let mut x61: u64 = 0; - let mut x62: FpU1 = 0; - fp_addcarryx_u64(&mut x61, &mut x62, x60, x23, x48); - let mut x63: u64 = 0; - let mut x64: FpU1 = 0; - fp_addcarryx_u64(&mut x63, &mut x64, x62, x25, x50); - let mut x65: u64 = 0; - let mut x66: FpU1 = 0; - fp_addcarryx_u64(&mut x65, &mut x66, x64, x27, x52); - let mut x67: u64 = 0; - let mut x68: FpU1 = 0; - fp_addcarryx_u64(&mut x67, &mut x68, x66, x29, x54); - let mut x69: u64 = 0; - let mut x70: u64 = 0; - fp_mulx_u64(&mut x69, &mut x70, x1, (arg2[5])); - let mut x71: u64 = 0; - let mut x72: u64 = 0; - fp_mulx_u64(&mut x71, &mut x72, x1, (arg2[4])); - let mut x73: u64 = 0; - let mut x74: u64 = 0; - fp_mulx_u64(&mut x73, &mut x74, x1, (arg2[3])); - let mut x75: u64 = 0; - let mut x76: u64 = 0; - fp_mulx_u64(&mut x75, &mut x76, x1, (arg2[2])); - let mut x77: u64 = 0; - let mut x78: u64 = 0; - fp_mulx_u64(&mut x77, &mut x78, x1, (arg2[1])); - let mut x79: u64 = 0; - let mut x80: u64 = 0; - fp_mulx_u64(&mut x79, &mut x80, x1, (arg2[0])); - let mut x81: u64 = 0; - let mut x82: FpU1 = 0; - fp_addcarryx_u64(&mut x81, &mut x82, 0x0, x80, x77); - let mut x83: u64 = 0; - let mut x84: FpU1 = 0; - fp_addcarryx_u64(&mut x83, &mut x84, x82, x78, x75); - let mut x85: u64 = 0; - let mut x86: FpU1 = 0; - fp_addcarryx_u64(&mut x85, &mut x86, x84, x76, x73); - let mut x87: u64 = 0; - let mut x88: FpU1 = 0; - fp_addcarryx_u64(&mut x87, &mut x88, x86, x74, x71); - let mut x89: u64 = 0; - let mut x90: FpU1 = 0; - fp_addcarryx_u64(&mut x89, &mut x90, x88, x72, x69); - let x91: u64 = ((x90 as u64) + x70); - let mut x92: u64 = 0; - let mut x93: FpU1 = 0; - fp_addcarryx_u64(&mut x92, &mut x93, 0x0, x57, x79); - let mut x94: u64 = 0; - let mut x95: FpU1 = 0; - fp_addcarryx_u64(&mut x94, &mut x95, x93, x59, x81); - let mut x96: u64 = 0; - let mut x97: FpU1 = 0; - fp_addcarryx_u64(&mut x96, &mut x97, x95, x61, x83); - let mut x98: u64 = 0; - let mut x99: FpU1 = 0; - fp_addcarryx_u64(&mut x98, &mut x99, x97, x63, x85); - let mut x100: u64 = 0; - let mut x101: FpU1 = 0; - fp_addcarryx_u64(&mut x100, &mut x101, x99, x65, x87); - let mut x102: u64 = 0; - let mut x103: FpU1 = 0; - fp_addcarryx_u64(&mut x102, &mut x103, x101, x67, x89); - let mut x104: u64 = 0; - let mut x105: FpU1 = 0; - fp_addcarryx_u64(&mut x104, &mut x105, x103, (x68 as u64), x91); - let mut x106: u64 = 0; - let mut x107: u64 = 0; - fp_mulx_u64(&mut x106, &mut x107, x92, 0x8508bfffffffffff); - let mut x108: u64 = 0; - let mut x109: u64 = 0; - fp_mulx_u64(&mut x108, &mut x109, x106, 0x1ae3a4617c510ea); - let mut x110: u64 = 0; - let mut x111: u64 = 0; - fp_mulx_u64(&mut x110, &mut x111, x106, 0xc63b05c06ca1493b); - let mut x112: u64 = 0; - let mut x113: u64 = 0; - fp_mulx_u64(&mut x112, &mut x113, x106, 0x1a22d9f300f5138f); - let mut x114: u64 = 0; - let mut x115: u64 = 0; - fp_mulx_u64(&mut x114, &mut x115, x106, 0x1ef3622fba094800); - let mut x116: u64 = 0; - let mut x117: u64 = 0; - fp_mulx_u64(&mut x116, &mut x117, x106, 0x170b5d4430000000); - let mut x118: u64 = 0; - let mut x119: u64 = 0; - fp_mulx_u64(&mut x118, &mut x119, x106, 0x8508c00000000001); - let mut x120: u64 = 0; - let mut x121: FpU1 = 0; - fp_addcarryx_u64(&mut x120, &mut x121, 0x0, x119, x116); - let mut x122: u64 = 0; - let mut x123: FpU1 = 0; - fp_addcarryx_u64(&mut x122, &mut x123, x121, x117, x114); - let mut x124: u64 = 0; - let mut x125: FpU1 = 0; - fp_addcarryx_u64(&mut x124, &mut x125, x123, x115, x112); - let mut x126: u64 = 0; - let mut x127: FpU1 = 0; - fp_addcarryx_u64(&mut x126, &mut x127, x125, x113, x110); - let mut x128: u64 = 0; - let mut x129: FpU1 = 0; - fp_addcarryx_u64(&mut x128, &mut x129, x127, x111, x108); - let x130: u64 = ((x129 as u64) + x109); - let mut x131: u64 = 0; - let mut x132: FpU1 = 0; - fp_addcarryx_u64(&mut x131, &mut x132, 0x0, x92, x118); - let mut x133: u64 = 0; - let mut x134: FpU1 = 0; - fp_addcarryx_u64(&mut x133, &mut x134, x132, x94, x120); - let mut x135: u64 = 0; - let mut x136: FpU1 = 0; - fp_addcarryx_u64(&mut x135, &mut x136, x134, x96, x122); - let mut x137: u64 = 0; - let mut x138: FpU1 = 0; - fp_addcarryx_u64(&mut x137, &mut x138, x136, x98, x124); - let mut x139: u64 = 0; - let mut x140: FpU1 = 0; - fp_addcarryx_u64(&mut x139, &mut x140, x138, x100, x126); - let mut x141: u64 = 0; - let mut x142: FpU1 = 0; - fp_addcarryx_u64(&mut x141, &mut x142, x140, x102, x128); - let mut x143: u64 = 0; - let mut x144: FpU1 = 0; - fp_addcarryx_u64(&mut x143, &mut x144, x142, x104, x130); - let x145: u64 = ((x144 as u64) + (x105 as u64)); - let mut x146: u64 = 0; - let mut x147: u64 = 0; - fp_mulx_u64(&mut x146, &mut x147, x2, (arg2[5])); - let mut x148: u64 = 0; - let mut x149: u64 = 0; - fp_mulx_u64(&mut x148, &mut x149, x2, (arg2[4])); - let mut x150: u64 = 0; - let mut x151: u64 = 0; - fp_mulx_u64(&mut x150, &mut x151, x2, (arg2[3])); - let mut x152: u64 = 0; - let mut x153: u64 = 0; - fp_mulx_u64(&mut x152, &mut x153, x2, (arg2[2])); - let mut x154: u64 = 0; - let mut x155: u64 = 0; - fp_mulx_u64(&mut x154, &mut x155, x2, (arg2[1])); - let mut x156: u64 = 0; - let mut x157: u64 = 0; - fp_mulx_u64(&mut x156, &mut x157, x2, (arg2[0])); - let mut x158: u64 = 0; - let mut x159: FpU1 = 0; - fp_addcarryx_u64(&mut x158, &mut x159, 0x0, x157, x154); - let mut x160: u64 = 0; - let mut x161: FpU1 = 0; - fp_addcarryx_u64(&mut x160, &mut x161, x159, x155, x152); - let mut x162: u64 = 0; - let mut x163: FpU1 = 0; - fp_addcarryx_u64(&mut x162, &mut x163, x161, x153, x150); - let mut x164: u64 = 0; - let mut x165: FpU1 = 0; - fp_addcarryx_u64(&mut x164, &mut x165, x163, x151, x148); - let mut x166: u64 = 0; - let mut x167: FpU1 = 0; - fp_addcarryx_u64(&mut x166, &mut x167, x165, x149, x146); - let x168: u64 = ((x167 as u64) + x147); - let mut x169: u64 = 0; - let mut x170: FpU1 = 0; - fp_addcarryx_u64(&mut x169, &mut x170, 0x0, x133, x156); - let mut x171: u64 = 0; - let mut x172: FpU1 = 0; - fp_addcarryx_u64(&mut x171, &mut x172, x170, x135, x158); - let mut x173: u64 = 0; - let mut x174: FpU1 = 0; - fp_addcarryx_u64(&mut x173, &mut x174, x172, x137, x160); - let mut x175: u64 = 0; - let mut x176: FpU1 = 0; - fp_addcarryx_u64(&mut x175, &mut x176, x174, x139, x162); - let mut x177: u64 = 0; - let mut x178: FpU1 = 0; - fp_addcarryx_u64(&mut x177, &mut x178, x176, x141, x164); - let mut x179: u64 = 0; - let mut x180: FpU1 = 0; - fp_addcarryx_u64(&mut x179, &mut x180, x178, x143, x166); - let mut x181: u64 = 0; - let mut x182: FpU1 = 0; - fp_addcarryx_u64(&mut x181, &mut x182, x180, x145, x168); - let mut x183: u64 = 0; - let mut x184: u64 = 0; - fp_mulx_u64(&mut x183, &mut x184, x169, 0x8508bfffffffffff); - let mut x185: u64 = 0; - let mut x186: u64 = 0; - fp_mulx_u64(&mut x185, &mut x186, x183, 0x1ae3a4617c510ea); - let mut x187: u64 = 0; - let mut x188: u64 = 0; - fp_mulx_u64(&mut x187, &mut x188, x183, 0xc63b05c06ca1493b); - let mut x189: u64 = 0; - let mut x190: u64 = 0; - fp_mulx_u64(&mut x189, &mut x190, x183, 0x1a22d9f300f5138f); - let mut x191: u64 = 0; - let mut x192: u64 = 0; - fp_mulx_u64(&mut x191, &mut x192, x183, 0x1ef3622fba094800); - let mut x193: u64 = 0; - let mut x194: u64 = 0; - fp_mulx_u64(&mut x193, &mut x194, x183, 0x170b5d4430000000); - let mut x195: u64 = 0; - let mut x196: u64 = 0; - fp_mulx_u64(&mut x195, &mut x196, x183, 0x8508c00000000001); - let mut x197: u64 = 0; - let mut x198: FpU1 = 0; - fp_addcarryx_u64(&mut x197, &mut x198, 0x0, x196, x193); - let mut x199: u64 = 0; - let mut x200: FpU1 = 0; - fp_addcarryx_u64(&mut x199, &mut x200, x198, x194, x191); - let mut x201: u64 = 0; - let mut x202: FpU1 = 0; - fp_addcarryx_u64(&mut x201, &mut x202, x200, x192, x189); - let mut x203: u64 = 0; - let mut x204: FpU1 = 0; - fp_addcarryx_u64(&mut x203, &mut x204, x202, x190, x187); - let mut x205: u64 = 0; - let mut x206: FpU1 = 0; - fp_addcarryx_u64(&mut x205, &mut x206, x204, x188, x185); - let x207: u64 = ((x206 as u64) + x186); - let mut x208: u64 = 0; - let mut x209: FpU1 = 0; - fp_addcarryx_u64(&mut x208, &mut x209, 0x0, x169, x195); - let mut x210: u64 = 0; - let mut x211: FpU1 = 0; - fp_addcarryx_u64(&mut x210, &mut x211, x209, x171, x197); - let mut x212: u64 = 0; - let mut x213: FpU1 = 0; - fp_addcarryx_u64(&mut x212, &mut x213, x211, x173, x199); - let mut x214: u64 = 0; - let mut x215: FpU1 = 0; - fp_addcarryx_u64(&mut x214, &mut x215, x213, x175, x201); - let mut x216: u64 = 0; - let mut x217: FpU1 = 0; - fp_addcarryx_u64(&mut x216, &mut x217, x215, x177, x203); - let mut x218: u64 = 0; - let mut x219: FpU1 = 0; - fp_addcarryx_u64(&mut x218, &mut x219, x217, x179, x205); - let mut x220: u64 = 0; - let mut x221: FpU1 = 0; - fp_addcarryx_u64(&mut x220, &mut x221, x219, x181, x207); - let x222: u64 = ((x221 as u64) + (x182 as u64)); - let mut x223: u64 = 0; - let mut x224: u64 = 0; - fp_mulx_u64(&mut x223, &mut x224, x3, (arg2[5])); - let mut x225: u64 = 0; - let mut x226: u64 = 0; - fp_mulx_u64(&mut x225, &mut x226, x3, (arg2[4])); - let mut x227: u64 = 0; - let mut x228: u64 = 0; - fp_mulx_u64(&mut x227, &mut x228, x3, (arg2[3])); - let mut x229: u64 = 0; - let mut x230: u64 = 0; - fp_mulx_u64(&mut x229, &mut x230, x3, (arg2[2])); - let mut x231: u64 = 0; - let mut x232: u64 = 0; - fp_mulx_u64(&mut x231, &mut x232, x3, (arg2[1])); - let mut x233: u64 = 0; - let mut x234: u64 = 0; - fp_mulx_u64(&mut x233, &mut x234, x3, (arg2[0])); - let mut x235: u64 = 0; - let mut x236: FpU1 = 0; - fp_addcarryx_u64(&mut x235, &mut x236, 0x0, x234, x231); - let mut x237: u64 = 0; - let mut x238: FpU1 = 0; - fp_addcarryx_u64(&mut x237, &mut x238, x236, x232, x229); - let mut x239: u64 = 0; - let mut x240: FpU1 = 0; - fp_addcarryx_u64(&mut x239, &mut x240, x238, x230, x227); - let mut x241: u64 = 0; - let mut x242: FpU1 = 0; - fp_addcarryx_u64(&mut x241, &mut x242, x240, x228, x225); - let mut x243: u64 = 0; - let mut x244: FpU1 = 0; - fp_addcarryx_u64(&mut x243, &mut x244, x242, x226, x223); - let x245: u64 = ((x244 as u64) + x224); - let mut x246: u64 = 0; - let mut x247: FpU1 = 0; - fp_addcarryx_u64(&mut x246, &mut x247, 0x0, x210, x233); - let mut x248: u64 = 0; - let mut x249: FpU1 = 0; - fp_addcarryx_u64(&mut x248, &mut x249, x247, x212, x235); - let mut x250: u64 = 0; - let mut x251: FpU1 = 0; - fp_addcarryx_u64(&mut x250, &mut x251, x249, x214, x237); - let mut x252: u64 = 0; - let mut x253: FpU1 = 0; - fp_addcarryx_u64(&mut x252, &mut x253, x251, x216, x239); - let mut x254: u64 = 0; - let mut x255: FpU1 = 0; - fp_addcarryx_u64(&mut x254, &mut x255, x253, x218, x241); - let mut x256: u64 = 0; - let mut x257: FpU1 = 0; - fp_addcarryx_u64(&mut x256, &mut x257, x255, x220, x243); - let mut x258: u64 = 0; - let mut x259: FpU1 = 0; - fp_addcarryx_u64(&mut x258, &mut x259, x257, x222, x245); - let mut x260: u64 = 0; - let mut x261: u64 = 0; - fp_mulx_u64(&mut x260, &mut x261, x246, 0x8508bfffffffffff); - let mut x262: u64 = 0; - let mut x263: u64 = 0; - fp_mulx_u64(&mut x262, &mut x263, x260, 0x1ae3a4617c510ea); - let mut x264: u64 = 0; - let mut x265: u64 = 0; - fp_mulx_u64(&mut x264, &mut x265, x260, 0xc63b05c06ca1493b); - let mut x266: u64 = 0; - let mut x267: u64 = 0; - fp_mulx_u64(&mut x266, &mut x267, x260, 0x1a22d9f300f5138f); - let mut x268: u64 = 0; - let mut x269: u64 = 0; - fp_mulx_u64(&mut x268, &mut x269, x260, 0x1ef3622fba094800); - let mut x270: u64 = 0; - let mut x271: u64 = 0; - fp_mulx_u64(&mut x270, &mut x271, x260, 0x170b5d4430000000); - let mut x272: u64 = 0; - let mut x273: u64 = 0; - fp_mulx_u64(&mut x272, &mut x273, x260, 0x8508c00000000001); - let mut x274: u64 = 0; - let mut x275: FpU1 = 0; - fp_addcarryx_u64(&mut x274, &mut x275, 0x0, x273, x270); - let mut x276: u64 = 0; - let mut x277: FpU1 = 0; - fp_addcarryx_u64(&mut x276, &mut x277, x275, x271, x268); - let mut x278: u64 = 0; - let mut x279: FpU1 = 0; - fp_addcarryx_u64(&mut x278, &mut x279, x277, x269, x266); - let mut x280: u64 = 0; - let mut x281: FpU1 = 0; - fp_addcarryx_u64(&mut x280, &mut x281, x279, x267, x264); - let mut x282: u64 = 0; - let mut x283: FpU1 = 0; - fp_addcarryx_u64(&mut x282, &mut x283, x281, x265, x262); - let x284: u64 = ((x283 as u64) + x263); - let mut x285: u64 = 0; - let mut x286: FpU1 = 0; - fp_addcarryx_u64(&mut x285, &mut x286, 0x0, x246, x272); - let mut x287: u64 = 0; - let mut x288: FpU1 = 0; - fp_addcarryx_u64(&mut x287, &mut x288, x286, x248, x274); - let mut x289: u64 = 0; - let mut x290: FpU1 = 0; - fp_addcarryx_u64(&mut x289, &mut x290, x288, x250, x276); - let mut x291: u64 = 0; - let mut x292: FpU1 = 0; - fp_addcarryx_u64(&mut x291, &mut x292, x290, x252, x278); - let mut x293: u64 = 0; - let mut x294: FpU1 = 0; - fp_addcarryx_u64(&mut x293, &mut x294, x292, x254, x280); - let mut x295: u64 = 0; - let mut x296: FpU1 = 0; - fp_addcarryx_u64(&mut x295, &mut x296, x294, x256, x282); - let mut x297: u64 = 0; - let mut x298: FpU1 = 0; - fp_addcarryx_u64(&mut x297, &mut x298, x296, x258, x284); - let x299: u64 = ((x298 as u64) + (x259 as u64)); - let mut x300: u64 = 0; - let mut x301: u64 = 0; - fp_mulx_u64(&mut x300, &mut x301, x4, (arg2[5])); - let mut x302: u64 = 0; - let mut x303: u64 = 0; - fp_mulx_u64(&mut x302, &mut x303, x4, (arg2[4])); - let mut x304: u64 = 0; - let mut x305: u64 = 0; - fp_mulx_u64(&mut x304, &mut x305, x4, (arg2[3])); - let mut x306: u64 = 0; - let mut x307: u64 = 0; - fp_mulx_u64(&mut x306, &mut x307, x4, (arg2[2])); - let mut x308: u64 = 0; - let mut x309: u64 = 0; - fp_mulx_u64(&mut x308, &mut x309, x4, (arg2[1])); - let mut x310: u64 = 0; - let mut x311: u64 = 0; - fp_mulx_u64(&mut x310, &mut x311, x4, (arg2[0])); - let mut x312: u64 = 0; - let mut x313: FpU1 = 0; - fp_addcarryx_u64(&mut x312, &mut x313, 0x0, x311, x308); - let mut x314: u64 = 0; - let mut x315: FpU1 = 0; - fp_addcarryx_u64(&mut x314, &mut x315, x313, x309, x306); - let mut x316: u64 = 0; - let mut x317: FpU1 = 0; - fp_addcarryx_u64(&mut x316, &mut x317, x315, x307, x304); - let mut x318: u64 = 0; - let mut x319: FpU1 = 0; - fp_addcarryx_u64(&mut x318, &mut x319, x317, x305, x302); - let mut x320: u64 = 0; - let mut x321: FpU1 = 0; - fp_addcarryx_u64(&mut x320, &mut x321, x319, x303, x300); - let x322: u64 = ((x321 as u64) + x301); - let mut x323: u64 = 0; - let mut x324: FpU1 = 0; - fp_addcarryx_u64(&mut x323, &mut x324, 0x0, x287, x310); - let mut x325: u64 = 0; - let mut x326: FpU1 = 0; - fp_addcarryx_u64(&mut x325, &mut x326, x324, x289, x312); - let mut x327: u64 = 0; - let mut x328: FpU1 = 0; - fp_addcarryx_u64(&mut x327, &mut x328, x326, x291, x314); - let mut x329: u64 = 0; - let mut x330: FpU1 = 0; - fp_addcarryx_u64(&mut x329, &mut x330, x328, x293, x316); - let mut x331: u64 = 0; - let mut x332: FpU1 = 0; - fp_addcarryx_u64(&mut x331, &mut x332, x330, x295, x318); - let mut x333: u64 = 0; - let mut x334: FpU1 = 0; - fp_addcarryx_u64(&mut x333, &mut x334, x332, x297, x320); - let mut x335: u64 = 0; - let mut x336: FpU1 = 0; - fp_addcarryx_u64(&mut x335, &mut x336, x334, x299, x322); - let mut x337: u64 = 0; - let mut x338: u64 = 0; - fp_mulx_u64(&mut x337, &mut x338, x323, 0x8508bfffffffffff); - let mut x339: u64 = 0; - let mut x340: u64 = 0; - fp_mulx_u64(&mut x339, &mut x340, x337, 0x1ae3a4617c510ea); - let mut x341: u64 = 0; - let mut x342: u64 = 0; - fp_mulx_u64(&mut x341, &mut x342, x337, 0xc63b05c06ca1493b); - let mut x343: u64 = 0; - let mut x344: u64 = 0; - fp_mulx_u64(&mut x343, &mut x344, x337, 0x1a22d9f300f5138f); - let mut x345: u64 = 0; - let mut x346: u64 = 0; - fp_mulx_u64(&mut x345, &mut x346, x337, 0x1ef3622fba094800); - let mut x347: u64 = 0; - let mut x348: u64 = 0; - fp_mulx_u64(&mut x347, &mut x348, x337, 0x170b5d4430000000); - let mut x349: u64 = 0; - let mut x350: u64 = 0; - fp_mulx_u64(&mut x349, &mut x350, x337, 0x8508c00000000001); - let mut x351: u64 = 0; - let mut x352: FpU1 = 0; - fp_addcarryx_u64(&mut x351, &mut x352, 0x0, x350, x347); - let mut x353: u64 = 0; - let mut x354: FpU1 = 0; - fp_addcarryx_u64(&mut x353, &mut x354, x352, x348, x345); - let mut x355: u64 = 0; - let mut x356: FpU1 = 0; - fp_addcarryx_u64(&mut x355, &mut x356, x354, x346, x343); - let mut x357: u64 = 0; - let mut x358: FpU1 = 0; - fp_addcarryx_u64(&mut x357, &mut x358, x356, x344, x341); - let mut x359: u64 = 0; - let mut x360: FpU1 = 0; - fp_addcarryx_u64(&mut x359, &mut x360, x358, x342, x339); - let x361: u64 = ((x360 as u64) + x340); - let mut x362: u64 = 0; - let mut x363: FpU1 = 0; - fp_addcarryx_u64(&mut x362, &mut x363, 0x0, x323, x349); - let mut x364: u64 = 0; - let mut x365: FpU1 = 0; - fp_addcarryx_u64(&mut x364, &mut x365, x363, x325, x351); - let mut x366: u64 = 0; - let mut x367: FpU1 = 0; - fp_addcarryx_u64(&mut x366, &mut x367, x365, x327, x353); - let mut x368: u64 = 0; - let mut x369: FpU1 = 0; - fp_addcarryx_u64(&mut x368, &mut x369, x367, x329, x355); - let mut x370: u64 = 0; - let mut x371: FpU1 = 0; - fp_addcarryx_u64(&mut x370, &mut x371, x369, x331, x357); - let mut x372: u64 = 0; - let mut x373: FpU1 = 0; - fp_addcarryx_u64(&mut x372, &mut x373, x371, x333, x359); - let mut x374: u64 = 0; - let mut x375: FpU1 = 0; - fp_addcarryx_u64(&mut x374, &mut x375, x373, x335, x361); - let x376: u64 = ((x375 as u64) + (x336 as u64)); - let mut x377: u64 = 0; - let mut x378: u64 = 0; - fp_mulx_u64(&mut x377, &mut x378, x5, (arg2[5])); - let mut x379: u64 = 0; - let mut x380: u64 = 0; - fp_mulx_u64(&mut x379, &mut x380, x5, (arg2[4])); - let mut x381: u64 = 0; - let mut x382: u64 = 0; - fp_mulx_u64(&mut x381, &mut x382, x5, (arg2[3])); - let mut x383: u64 = 0; - let mut x384: u64 = 0; - fp_mulx_u64(&mut x383, &mut x384, x5, (arg2[2])); - let mut x385: u64 = 0; - let mut x386: u64 = 0; - fp_mulx_u64(&mut x385, &mut x386, x5, (arg2[1])); - let mut x387: u64 = 0; - let mut x388: u64 = 0; - fp_mulx_u64(&mut x387, &mut x388, x5, (arg2[0])); - let mut x389: u64 = 0; - let mut x390: FpU1 = 0; - fp_addcarryx_u64(&mut x389, &mut x390, 0x0, x388, x385); - let mut x391: u64 = 0; - let mut x392: FpU1 = 0; - fp_addcarryx_u64(&mut x391, &mut x392, x390, x386, x383); - let mut x393: u64 = 0; - let mut x394: FpU1 = 0; - fp_addcarryx_u64(&mut x393, &mut x394, x392, x384, x381); - let mut x395: u64 = 0; - let mut x396: FpU1 = 0; - fp_addcarryx_u64(&mut x395, &mut x396, x394, x382, x379); - let mut x397: u64 = 0; - let mut x398: FpU1 = 0; - fp_addcarryx_u64(&mut x397, &mut x398, x396, x380, x377); - let x399: u64 = ((x398 as u64) + x378); - let mut x400: u64 = 0; - let mut x401: FpU1 = 0; - fp_addcarryx_u64(&mut x400, &mut x401, 0x0, x364, x387); - let mut x402: u64 = 0; - let mut x403: FpU1 = 0; - fp_addcarryx_u64(&mut x402, &mut x403, x401, x366, x389); - let mut x404: u64 = 0; - let mut x405: FpU1 = 0; - fp_addcarryx_u64(&mut x404, &mut x405, x403, x368, x391); - let mut x406: u64 = 0; - let mut x407: FpU1 = 0; - fp_addcarryx_u64(&mut x406, &mut x407, x405, x370, x393); - let mut x408: u64 = 0; - let mut x409: FpU1 = 0; - fp_addcarryx_u64(&mut x408, &mut x409, x407, x372, x395); - let mut x410: u64 = 0; - let mut x411: FpU1 = 0; - fp_addcarryx_u64(&mut x410, &mut x411, x409, x374, x397); - let mut x412: u64 = 0; - let mut x413: FpU1 = 0; - fp_addcarryx_u64(&mut x412, &mut x413, x411, x376, x399); - let mut x414: u64 = 0; - let mut x415: u64 = 0; - fp_mulx_u64(&mut x414, &mut x415, x400, 0x8508bfffffffffff); - let mut x416: u64 = 0; - let mut x417: u64 = 0; - fp_mulx_u64(&mut x416, &mut x417, x414, 0x1ae3a4617c510ea); - let mut x418: u64 = 0; - let mut x419: u64 = 0; - fp_mulx_u64(&mut x418, &mut x419, x414, 0xc63b05c06ca1493b); - let mut x420: u64 = 0; - let mut x421: u64 = 0; - fp_mulx_u64(&mut x420, &mut x421, x414, 0x1a22d9f300f5138f); - let mut x422: u64 = 0; - let mut x423: u64 = 0; - fp_mulx_u64(&mut x422, &mut x423, x414, 0x1ef3622fba094800); - let mut x424: u64 = 0; - let mut x425: u64 = 0; - fp_mulx_u64(&mut x424, &mut x425, x414, 0x170b5d4430000000); - let mut x426: u64 = 0; - let mut x427: u64 = 0; - fp_mulx_u64(&mut x426, &mut x427, x414, 0x8508c00000000001); - let mut x428: u64 = 0; - let mut x429: FpU1 = 0; - fp_addcarryx_u64(&mut x428, &mut x429, 0x0, x427, x424); - let mut x430: u64 = 0; - let mut x431: FpU1 = 0; - fp_addcarryx_u64(&mut x430, &mut x431, x429, x425, x422); - let mut x432: u64 = 0; - let mut x433: FpU1 = 0; - fp_addcarryx_u64(&mut x432, &mut x433, x431, x423, x420); - let mut x434: u64 = 0; - let mut x435: FpU1 = 0; - fp_addcarryx_u64(&mut x434, &mut x435, x433, x421, x418); - let mut x436: u64 = 0; - let mut x437: FpU1 = 0; - fp_addcarryx_u64(&mut x436, &mut x437, x435, x419, x416); - let x438: u64 = ((x437 as u64) + x417); - let mut x439: u64 = 0; - let mut x440: FpU1 = 0; - fp_addcarryx_u64(&mut x439, &mut x440, 0x0, x400, x426); - let mut x441: u64 = 0; - let mut x442: FpU1 = 0; - fp_addcarryx_u64(&mut x441, &mut x442, x440, x402, x428); - let mut x443: u64 = 0; - let mut x444: FpU1 = 0; - fp_addcarryx_u64(&mut x443, &mut x444, x442, x404, x430); - let mut x445: u64 = 0; - let mut x446: FpU1 = 0; - fp_addcarryx_u64(&mut x445, &mut x446, x444, x406, x432); - let mut x447: u64 = 0; - let mut x448: FpU1 = 0; - fp_addcarryx_u64(&mut x447, &mut x448, x446, x408, x434); - let mut x449: u64 = 0; - let mut x450: FpU1 = 0; - fp_addcarryx_u64(&mut x449, &mut x450, x448, x410, x436); - let mut x451: u64 = 0; - let mut x452: FpU1 = 0; - fp_addcarryx_u64(&mut x451, &mut x452, x450, x412, x438); - let x453: u64 = ((x452 as u64) + (x413 as u64)); - let mut x454: u64 = 0; - let mut x455: FpU1 = 0; - fp_subborrowx_u64(&mut x454, &mut x455, 0x0, x441, 0x8508c00000000001); - let mut x456: u64 = 0; - let mut x457: FpU1 = 0; - fp_subborrowx_u64(&mut x456, &mut x457, x455, x443, 0x170b5d4430000000); - let mut x458: u64 = 0; - let mut x459: FpU1 = 0; - fp_subborrowx_u64(&mut x458, &mut x459, x457, x445, 0x1ef3622fba094800); - let mut x460: u64 = 0; - let mut x461: FpU1 = 0; - fp_subborrowx_u64(&mut x460, &mut x461, x459, x447, 0x1a22d9f300f5138f); - let mut x462: u64 = 0; - let mut x463: FpU1 = 0; - fp_subborrowx_u64(&mut x462, &mut x463, x461, x449, 0xc63b05c06ca1493b); - let mut x464: u64 = 0; - let mut x465: FpU1 = 0; - fp_subborrowx_u64(&mut x464, &mut x465, x463, x451, 0x1ae3a4617c510ea); - let mut x466: u64 = 0; - let mut x467: FpU1 = 0; - fp_subborrowx_u64(&mut x466, &mut x467, x465, x453, (0x0 as u64)); - let mut x468: u64 = 0; - fp_cmovznz_u64(&mut x468, x467, x454, x441); - let mut x469: u64 = 0; - fp_cmovznz_u64(&mut x469, x467, x456, x443); - let mut x470: u64 = 0; - fp_cmovznz_u64(&mut x470, x467, x458, x445); - let mut x471: u64 = 0; - fp_cmovznz_u64(&mut x471, x467, x460, x447); - let mut x472: u64 = 0; - fp_cmovznz_u64(&mut x472, x467, x462, x449); - let mut x473: u64 = 0; - fp_cmovznz_u64(&mut x473, x467, x464, x451); - out1[0] = x468; - out1[1] = x469; - out1[2] = x470; - out1[3] = x471; - out1[4] = x472; - out1[5] = x473; -} - -/// The function fp_square squares a field element in the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// Postconditions: -/// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg1)) mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_square(out1: &mut FpMontgomeryDomainFieldElement, arg1: &FpMontgomeryDomainFieldElement) { - let x1: u64 = (arg1[1]); - let x2: u64 = (arg1[2]); - let x3: u64 = (arg1[3]); - let x4: u64 = (arg1[4]); - let x5: u64 = (arg1[5]); - let x6: u64 = (arg1[0]); - let mut x7: u64 = 0; - let mut x8: u64 = 0; - fp_mulx_u64(&mut x7, &mut x8, x6, (arg1[5])); - let mut x9: u64 = 0; - let mut x10: u64 = 0; - fp_mulx_u64(&mut x9, &mut x10, x6, (arg1[4])); - let mut x11: u64 = 0; - let mut x12: u64 = 0; - fp_mulx_u64(&mut x11, &mut x12, x6, (arg1[3])); - let mut x13: u64 = 0; - let mut x14: u64 = 0; - fp_mulx_u64(&mut x13, &mut x14, x6, (arg1[2])); - let mut x15: u64 = 0; - let mut x16: u64 = 0; - fp_mulx_u64(&mut x15, &mut x16, x6, (arg1[1])); - let mut x17: u64 = 0; - let mut x18: u64 = 0; - fp_mulx_u64(&mut x17, &mut x18, x6, (arg1[0])); - let mut x19: u64 = 0; - let mut x20: FpU1 = 0; - fp_addcarryx_u64(&mut x19, &mut x20, 0x0, x18, x15); - let mut x21: u64 = 0; - let mut x22: FpU1 = 0; - fp_addcarryx_u64(&mut x21, &mut x22, x20, x16, x13); - let mut x23: u64 = 0; - let mut x24: FpU1 = 0; - fp_addcarryx_u64(&mut x23, &mut x24, x22, x14, x11); - let mut x25: u64 = 0; - let mut x26: FpU1 = 0; - fp_addcarryx_u64(&mut x25, &mut x26, x24, x12, x9); - let mut x27: u64 = 0; - let mut x28: FpU1 = 0; - fp_addcarryx_u64(&mut x27, &mut x28, x26, x10, x7); - let x29: u64 = ((x28 as u64) + x8); - let mut x30: u64 = 0; - let mut x31: u64 = 0; - fp_mulx_u64(&mut x30, &mut x31, x17, 0x8508bfffffffffff); - let mut x32: u64 = 0; - let mut x33: u64 = 0; - fp_mulx_u64(&mut x32, &mut x33, x30, 0x1ae3a4617c510ea); - let mut x34: u64 = 0; - let mut x35: u64 = 0; - fp_mulx_u64(&mut x34, &mut x35, x30, 0xc63b05c06ca1493b); - let mut x36: u64 = 0; - let mut x37: u64 = 0; - fp_mulx_u64(&mut x36, &mut x37, x30, 0x1a22d9f300f5138f); - let mut x38: u64 = 0; - let mut x39: u64 = 0; - fp_mulx_u64(&mut x38, &mut x39, x30, 0x1ef3622fba094800); - let mut x40: u64 = 0; - let mut x41: u64 = 0; - fp_mulx_u64(&mut x40, &mut x41, x30, 0x170b5d4430000000); - let mut x42: u64 = 0; - let mut x43: u64 = 0; - fp_mulx_u64(&mut x42, &mut x43, x30, 0x8508c00000000001); - let mut x44: u64 = 0; - let mut x45: FpU1 = 0; - fp_addcarryx_u64(&mut x44, &mut x45, 0x0, x43, x40); - let mut x46: u64 = 0; - let mut x47: FpU1 = 0; - fp_addcarryx_u64(&mut x46, &mut x47, x45, x41, x38); - let mut x48: u64 = 0; - let mut x49: FpU1 = 0; - fp_addcarryx_u64(&mut x48, &mut x49, x47, x39, x36); - let mut x50: u64 = 0; - let mut x51: FpU1 = 0; - fp_addcarryx_u64(&mut x50, &mut x51, x49, x37, x34); - let mut x52: u64 = 0; - let mut x53: FpU1 = 0; - fp_addcarryx_u64(&mut x52, &mut x53, x51, x35, x32); - let x54: u64 = ((x53 as u64) + x33); - let mut x55: u64 = 0; - let mut x56: FpU1 = 0; - fp_addcarryx_u64(&mut x55, &mut x56, 0x0, x17, x42); - let mut x57: u64 = 0; - let mut x58: FpU1 = 0; - fp_addcarryx_u64(&mut x57, &mut x58, x56, x19, x44); - let mut x59: u64 = 0; - let mut x60: FpU1 = 0; - fp_addcarryx_u64(&mut x59, &mut x60, x58, x21, x46); - let mut x61: u64 = 0; - let mut x62: FpU1 = 0; - fp_addcarryx_u64(&mut x61, &mut x62, x60, x23, x48); - let mut x63: u64 = 0; - let mut x64: FpU1 = 0; - fp_addcarryx_u64(&mut x63, &mut x64, x62, x25, x50); - let mut x65: u64 = 0; - let mut x66: FpU1 = 0; - fp_addcarryx_u64(&mut x65, &mut x66, x64, x27, x52); - let mut x67: u64 = 0; - let mut x68: FpU1 = 0; - fp_addcarryx_u64(&mut x67, &mut x68, x66, x29, x54); - let mut x69: u64 = 0; - let mut x70: u64 = 0; - fp_mulx_u64(&mut x69, &mut x70, x1, (arg1[5])); - let mut x71: u64 = 0; - let mut x72: u64 = 0; - fp_mulx_u64(&mut x71, &mut x72, x1, (arg1[4])); - let mut x73: u64 = 0; - let mut x74: u64 = 0; - fp_mulx_u64(&mut x73, &mut x74, x1, (arg1[3])); - let mut x75: u64 = 0; - let mut x76: u64 = 0; - fp_mulx_u64(&mut x75, &mut x76, x1, (arg1[2])); - let mut x77: u64 = 0; - let mut x78: u64 = 0; - fp_mulx_u64(&mut x77, &mut x78, x1, (arg1[1])); - let mut x79: u64 = 0; - let mut x80: u64 = 0; - fp_mulx_u64(&mut x79, &mut x80, x1, (arg1[0])); - let mut x81: u64 = 0; - let mut x82: FpU1 = 0; - fp_addcarryx_u64(&mut x81, &mut x82, 0x0, x80, x77); - let mut x83: u64 = 0; - let mut x84: FpU1 = 0; - fp_addcarryx_u64(&mut x83, &mut x84, x82, x78, x75); - let mut x85: u64 = 0; - let mut x86: FpU1 = 0; - fp_addcarryx_u64(&mut x85, &mut x86, x84, x76, x73); - let mut x87: u64 = 0; - let mut x88: FpU1 = 0; - fp_addcarryx_u64(&mut x87, &mut x88, x86, x74, x71); - let mut x89: u64 = 0; - let mut x90: FpU1 = 0; - fp_addcarryx_u64(&mut x89, &mut x90, x88, x72, x69); - let x91: u64 = ((x90 as u64) + x70); - let mut x92: u64 = 0; - let mut x93: FpU1 = 0; - fp_addcarryx_u64(&mut x92, &mut x93, 0x0, x57, x79); - let mut x94: u64 = 0; - let mut x95: FpU1 = 0; - fp_addcarryx_u64(&mut x94, &mut x95, x93, x59, x81); - let mut x96: u64 = 0; - let mut x97: FpU1 = 0; - fp_addcarryx_u64(&mut x96, &mut x97, x95, x61, x83); - let mut x98: u64 = 0; - let mut x99: FpU1 = 0; - fp_addcarryx_u64(&mut x98, &mut x99, x97, x63, x85); - let mut x100: u64 = 0; - let mut x101: FpU1 = 0; - fp_addcarryx_u64(&mut x100, &mut x101, x99, x65, x87); - let mut x102: u64 = 0; - let mut x103: FpU1 = 0; - fp_addcarryx_u64(&mut x102, &mut x103, x101, x67, x89); - let mut x104: u64 = 0; - let mut x105: FpU1 = 0; - fp_addcarryx_u64(&mut x104, &mut x105, x103, (x68 as u64), x91); - let mut x106: u64 = 0; - let mut x107: u64 = 0; - fp_mulx_u64(&mut x106, &mut x107, x92, 0x8508bfffffffffff); - let mut x108: u64 = 0; - let mut x109: u64 = 0; - fp_mulx_u64(&mut x108, &mut x109, x106, 0x1ae3a4617c510ea); - let mut x110: u64 = 0; - let mut x111: u64 = 0; - fp_mulx_u64(&mut x110, &mut x111, x106, 0xc63b05c06ca1493b); - let mut x112: u64 = 0; - let mut x113: u64 = 0; - fp_mulx_u64(&mut x112, &mut x113, x106, 0x1a22d9f300f5138f); - let mut x114: u64 = 0; - let mut x115: u64 = 0; - fp_mulx_u64(&mut x114, &mut x115, x106, 0x1ef3622fba094800); - let mut x116: u64 = 0; - let mut x117: u64 = 0; - fp_mulx_u64(&mut x116, &mut x117, x106, 0x170b5d4430000000); - let mut x118: u64 = 0; - let mut x119: u64 = 0; - fp_mulx_u64(&mut x118, &mut x119, x106, 0x8508c00000000001); - let mut x120: u64 = 0; - let mut x121: FpU1 = 0; - fp_addcarryx_u64(&mut x120, &mut x121, 0x0, x119, x116); - let mut x122: u64 = 0; - let mut x123: FpU1 = 0; - fp_addcarryx_u64(&mut x122, &mut x123, x121, x117, x114); - let mut x124: u64 = 0; - let mut x125: FpU1 = 0; - fp_addcarryx_u64(&mut x124, &mut x125, x123, x115, x112); - let mut x126: u64 = 0; - let mut x127: FpU1 = 0; - fp_addcarryx_u64(&mut x126, &mut x127, x125, x113, x110); - let mut x128: u64 = 0; - let mut x129: FpU1 = 0; - fp_addcarryx_u64(&mut x128, &mut x129, x127, x111, x108); - let x130: u64 = ((x129 as u64) + x109); - let mut x131: u64 = 0; - let mut x132: FpU1 = 0; - fp_addcarryx_u64(&mut x131, &mut x132, 0x0, x92, x118); - let mut x133: u64 = 0; - let mut x134: FpU1 = 0; - fp_addcarryx_u64(&mut x133, &mut x134, x132, x94, x120); - let mut x135: u64 = 0; - let mut x136: FpU1 = 0; - fp_addcarryx_u64(&mut x135, &mut x136, x134, x96, x122); - let mut x137: u64 = 0; - let mut x138: FpU1 = 0; - fp_addcarryx_u64(&mut x137, &mut x138, x136, x98, x124); - let mut x139: u64 = 0; - let mut x140: FpU1 = 0; - fp_addcarryx_u64(&mut x139, &mut x140, x138, x100, x126); - let mut x141: u64 = 0; - let mut x142: FpU1 = 0; - fp_addcarryx_u64(&mut x141, &mut x142, x140, x102, x128); - let mut x143: u64 = 0; - let mut x144: FpU1 = 0; - fp_addcarryx_u64(&mut x143, &mut x144, x142, x104, x130); - let x145: u64 = ((x144 as u64) + (x105 as u64)); - let mut x146: u64 = 0; - let mut x147: u64 = 0; - fp_mulx_u64(&mut x146, &mut x147, x2, (arg1[5])); - let mut x148: u64 = 0; - let mut x149: u64 = 0; - fp_mulx_u64(&mut x148, &mut x149, x2, (arg1[4])); - let mut x150: u64 = 0; - let mut x151: u64 = 0; - fp_mulx_u64(&mut x150, &mut x151, x2, (arg1[3])); - let mut x152: u64 = 0; - let mut x153: u64 = 0; - fp_mulx_u64(&mut x152, &mut x153, x2, (arg1[2])); - let mut x154: u64 = 0; - let mut x155: u64 = 0; - fp_mulx_u64(&mut x154, &mut x155, x2, (arg1[1])); - let mut x156: u64 = 0; - let mut x157: u64 = 0; - fp_mulx_u64(&mut x156, &mut x157, x2, (arg1[0])); - let mut x158: u64 = 0; - let mut x159: FpU1 = 0; - fp_addcarryx_u64(&mut x158, &mut x159, 0x0, x157, x154); - let mut x160: u64 = 0; - let mut x161: FpU1 = 0; - fp_addcarryx_u64(&mut x160, &mut x161, x159, x155, x152); - let mut x162: u64 = 0; - let mut x163: FpU1 = 0; - fp_addcarryx_u64(&mut x162, &mut x163, x161, x153, x150); - let mut x164: u64 = 0; - let mut x165: FpU1 = 0; - fp_addcarryx_u64(&mut x164, &mut x165, x163, x151, x148); - let mut x166: u64 = 0; - let mut x167: FpU1 = 0; - fp_addcarryx_u64(&mut x166, &mut x167, x165, x149, x146); - let x168: u64 = ((x167 as u64) + x147); - let mut x169: u64 = 0; - let mut x170: FpU1 = 0; - fp_addcarryx_u64(&mut x169, &mut x170, 0x0, x133, x156); - let mut x171: u64 = 0; - let mut x172: FpU1 = 0; - fp_addcarryx_u64(&mut x171, &mut x172, x170, x135, x158); - let mut x173: u64 = 0; - let mut x174: FpU1 = 0; - fp_addcarryx_u64(&mut x173, &mut x174, x172, x137, x160); - let mut x175: u64 = 0; - let mut x176: FpU1 = 0; - fp_addcarryx_u64(&mut x175, &mut x176, x174, x139, x162); - let mut x177: u64 = 0; - let mut x178: FpU1 = 0; - fp_addcarryx_u64(&mut x177, &mut x178, x176, x141, x164); - let mut x179: u64 = 0; - let mut x180: FpU1 = 0; - fp_addcarryx_u64(&mut x179, &mut x180, x178, x143, x166); - let mut x181: u64 = 0; - let mut x182: FpU1 = 0; - fp_addcarryx_u64(&mut x181, &mut x182, x180, x145, x168); - let mut x183: u64 = 0; - let mut x184: u64 = 0; - fp_mulx_u64(&mut x183, &mut x184, x169, 0x8508bfffffffffff); - let mut x185: u64 = 0; - let mut x186: u64 = 0; - fp_mulx_u64(&mut x185, &mut x186, x183, 0x1ae3a4617c510ea); - let mut x187: u64 = 0; - let mut x188: u64 = 0; - fp_mulx_u64(&mut x187, &mut x188, x183, 0xc63b05c06ca1493b); - let mut x189: u64 = 0; - let mut x190: u64 = 0; - fp_mulx_u64(&mut x189, &mut x190, x183, 0x1a22d9f300f5138f); - let mut x191: u64 = 0; - let mut x192: u64 = 0; - fp_mulx_u64(&mut x191, &mut x192, x183, 0x1ef3622fba094800); - let mut x193: u64 = 0; - let mut x194: u64 = 0; - fp_mulx_u64(&mut x193, &mut x194, x183, 0x170b5d4430000000); - let mut x195: u64 = 0; - let mut x196: u64 = 0; - fp_mulx_u64(&mut x195, &mut x196, x183, 0x8508c00000000001); - let mut x197: u64 = 0; - let mut x198: FpU1 = 0; - fp_addcarryx_u64(&mut x197, &mut x198, 0x0, x196, x193); - let mut x199: u64 = 0; - let mut x200: FpU1 = 0; - fp_addcarryx_u64(&mut x199, &mut x200, x198, x194, x191); - let mut x201: u64 = 0; - let mut x202: FpU1 = 0; - fp_addcarryx_u64(&mut x201, &mut x202, x200, x192, x189); - let mut x203: u64 = 0; - let mut x204: FpU1 = 0; - fp_addcarryx_u64(&mut x203, &mut x204, x202, x190, x187); - let mut x205: u64 = 0; - let mut x206: FpU1 = 0; - fp_addcarryx_u64(&mut x205, &mut x206, x204, x188, x185); - let x207: u64 = ((x206 as u64) + x186); - let mut x208: u64 = 0; - let mut x209: FpU1 = 0; - fp_addcarryx_u64(&mut x208, &mut x209, 0x0, x169, x195); - let mut x210: u64 = 0; - let mut x211: FpU1 = 0; - fp_addcarryx_u64(&mut x210, &mut x211, x209, x171, x197); - let mut x212: u64 = 0; - let mut x213: FpU1 = 0; - fp_addcarryx_u64(&mut x212, &mut x213, x211, x173, x199); - let mut x214: u64 = 0; - let mut x215: FpU1 = 0; - fp_addcarryx_u64(&mut x214, &mut x215, x213, x175, x201); - let mut x216: u64 = 0; - let mut x217: FpU1 = 0; - fp_addcarryx_u64(&mut x216, &mut x217, x215, x177, x203); - let mut x218: u64 = 0; - let mut x219: FpU1 = 0; - fp_addcarryx_u64(&mut x218, &mut x219, x217, x179, x205); - let mut x220: u64 = 0; - let mut x221: FpU1 = 0; - fp_addcarryx_u64(&mut x220, &mut x221, x219, x181, x207); - let x222: u64 = ((x221 as u64) + (x182 as u64)); - let mut x223: u64 = 0; - let mut x224: u64 = 0; - fp_mulx_u64(&mut x223, &mut x224, x3, (arg1[5])); - let mut x225: u64 = 0; - let mut x226: u64 = 0; - fp_mulx_u64(&mut x225, &mut x226, x3, (arg1[4])); - let mut x227: u64 = 0; - let mut x228: u64 = 0; - fp_mulx_u64(&mut x227, &mut x228, x3, (arg1[3])); - let mut x229: u64 = 0; - let mut x230: u64 = 0; - fp_mulx_u64(&mut x229, &mut x230, x3, (arg1[2])); - let mut x231: u64 = 0; - let mut x232: u64 = 0; - fp_mulx_u64(&mut x231, &mut x232, x3, (arg1[1])); - let mut x233: u64 = 0; - let mut x234: u64 = 0; - fp_mulx_u64(&mut x233, &mut x234, x3, (arg1[0])); - let mut x235: u64 = 0; - let mut x236: FpU1 = 0; - fp_addcarryx_u64(&mut x235, &mut x236, 0x0, x234, x231); - let mut x237: u64 = 0; - let mut x238: FpU1 = 0; - fp_addcarryx_u64(&mut x237, &mut x238, x236, x232, x229); - let mut x239: u64 = 0; - let mut x240: FpU1 = 0; - fp_addcarryx_u64(&mut x239, &mut x240, x238, x230, x227); - let mut x241: u64 = 0; - let mut x242: FpU1 = 0; - fp_addcarryx_u64(&mut x241, &mut x242, x240, x228, x225); - let mut x243: u64 = 0; - let mut x244: FpU1 = 0; - fp_addcarryx_u64(&mut x243, &mut x244, x242, x226, x223); - let x245: u64 = ((x244 as u64) + x224); - let mut x246: u64 = 0; - let mut x247: FpU1 = 0; - fp_addcarryx_u64(&mut x246, &mut x247, 0x0, x210, x233); - let mut x248: u64 = 0; - let mut x249: FpU1 = 0; - fp_addcarryx_u64(&mut x248, &mut x249, x247, x212, x235); - let mut x250: u64 = 0; - let mut x251: FpU1 = 0; - fp_addcarryx_u64(&mut x250, &mut x251, x249, x214, x237); - let mut x252: u64 = 0; - let mut x253: FpU1 = 0; - fp_addcarryx_u64(&mut x252, &mut x253, x251, x216, x239); - let mut x254: u64 = 0; - let mut x255: FpU1 = 0; - fp_addcarryx_u64(&mut x254, &mut x255, x253, x218, x241); - let mut x256: u64 = 0; - let mut x257: FpU1 = 0; - fp_addcarryx_u64(&mut x256, &mut x257, x255, x220, x243); - let mut x258: u64 = 0; - let mut x259: FpU1 = 0; - fp_addcarryx_u64(&mut x258, &mut x259, x257, x222, x245); - let mut x260: u64 = 0; - let mut x261: u64 = 0; - fp_mulx_u64(&mut x260, &mut x261, x246, 0x8508bfffffffffff); - let mut x262: u64 = 0; - let mut x263: u64 = 0; - fp_mulx_u64(&mut x262, &mut x263, x260, 0x1ae3a4617c510ea); - let mut x264: u64 = 0; - let mut x265: u64 = 0; - fp_mulx_u64(&mut x264, &mut x265, x260, 0xc63b05c06ca1493b); - let mut x266: u64 = 0; - let mut x267: u64 = 0; - fp_mulx_u64(&mut x266, &mut x267, x260, 0x1a22d9f300f5138f); - let mut x268: u64 = 0; - let mut x269: u64 = 0; - fp_mulx_u64(&mut x268, &mut x269, x260, 0x1ef3622fba094800); - let mut x270: u64 = 0; - let mut x271: u64 = 0; - fp_mulx_u64(&mut x270, &mut x271, x260, 0x170b5d4430000000); - let mut x272: u64 = 0; - let mut x273: u64 = 0; - fp_mulx_u64(&mut x272, &mut x273, x260, 0x8508c00000000001); - let mut x274: u64 = 0; - let mut x275: FpU1 = 0; - fp_addcarryx_u64(&mut x274, &mut x275, 0x0, x273, x270); - let mut x276: u64 = 0; - let mut x277: FpU1 = 0; - fp_addcarryx_u64(&mut x276, &mut x277, x275, x271, x268); - let mut x278: u64 = 0; - let mut x279: FpU1 = 0; - fp_addcarryx_u64(&mut x278, &mut x279, x277, x269, x266); - let mut x280: u64 = 0; - let mut x281: FpU1 = 0; - fp_addcarryx_u64(&mut x280, &mut x281, x279, x267, x264); - let mut x282: u64 = 0; - let mut x283: FpU1 = 0; - fp_addcarryx_u64(&mut x282, &mut x283, x281, x265, x262); - let x284: u64 = ((x283 as u64) + x263); - let mut x285: u64 = 0; - let mut x286: FpU1 = 0; - fp_addcarryx_u64(&mut x285, &mut x286, 0x0, x246, x272); - let mut x287: u64 = 0; - let mut x288: FpU1 = 0; - fp_addcarryx_u64(&mut x287, &mut x288, x286, x248, x274); - let mut x289: u64 = 0; - let mut x290: FpU1 = 0; - fp_addcarryx_u64(&mut x289, &mut x290, x288, x250, x276); - let mut x291: u64 = 0; - let mut x292: FpU1 = 0; - fp_addcarryx_u64(&mut x291, &mut x292, x290, x252, x278); - let mut x293: u64 = 0; - let mut x294: FpU1 = 0; - fp_addcarryx_u64(&mut x293, &mut x294, x292, x254, x280); - let mut x295: u64 = 0; - let mut x296: FpU1 = 0; - fp_addcarryx_u64(&mut x295, &mut x296, x294, x256, x282); - let mut x297: u64 = 0; - let mut x298: FpU1 = 0; - fp_addcarryx_u64(&mut x297, &mut x298, x296, x258, x284); - let x299: u64 = ((x298 as u64) + (x259 as u64)); - let mut x300: u64 = 0; - let mut x301: u64 = 0; - fp_mulx_u64(&mut x300, &mut x301, x4, (arg1[5])); - let mut x302: u64 = 0; - let mut x303: u64 = 0; - fp_mulx_u64(&mut x302, &mut x303, x4, (arg1[4])); - let mut x304: u64 = 0; - let mut x305: u64 = 0; - fp_mulx_u64(&mut x304, &mut x305, x4, (arg1[3])); - let mut x306: u64 = 0; - let mut x307: u64 = 0; - fp_mulx_u64(&mut x306, &mut x307, x4, (arg1[2])); - let mut x308: u64 = 0; - let mut x309: u64 = 0; - fp_mulx_u64(&mut x308, &mut x309, x4, (arg1[1])); - let mut x310: u64 = 0; - let mut x311: u64 = 0; - fp_mulx_u64(&mut x310, &mut x311, x4, (arg1[0])); - let mut x312: u64 = 0; - let mut x313: FpU1 = 0; - fp_addcarryx_u64(&mut x312, &mut x313, 0x0, x311, x308); - let mut x314: u64 = 0; - let mut x315: FpU1 = 0; - fp_addcarryx_u64(&mut x314, &mut x315, x313, x309, x306); - let mut x316: u64 = 0; - let mut x317: FpU1 = 0; - fp_addcarryx_u64(&mut x316, &mut x317, x315, x307, x304); - let mut x318: u64 = 0; - let mut x319: FpU1 = 0; - fp_addcarryx_u64(&mut x318, &mut x319, x317, x305, x302); - let mut x320: u64 = 0; - let mut x321: FpU1 = 0; - fp_addcarryx_u64(&mut x320, &mut x321, x319, x303, x300); - let x322: u64 = ((x321 as u64) + x301); - let mut x323: u64 = 0; - let mut x324: FpU1 = 0; - fp_addcarryx_u64(&mut x323, &mut x324, 0x0, x287, x310); - let mut x325: u64 = 0; - let mut x326: FpU1 = 0; - fp_addcarryx_u64(&mut x325, &mut x326, x324, x289, x312); - let mut x327: u64 = 0; - let mut x328: FpU1 = 0; - fp_addcarryx_u64(&mut x327, &mut x328, x326, x291, x314); - let mut x329: u64 = 0; - let mut x330: FpU1 = 0; - fp_addcarryx_u64(&mut x329, &mut x330, x328, x293, x316); - let mut x331: u64 = 0; - let mut x332: FpU1 = 0; - fp_addcarryx_u64(&mut x331, &mut x332, x330, x295, x318); - let mut x333: u64 = 0; - let mut x334: FpU1 = 0; - fp_addcarryx_u64(&mut x333, &mut x334, x332, x297, x320); - let mut x335: u64 = 0; - let mut x336: FpU1 = 0; - fp_addcarryx_u64(&mut x335, &mut x336, x334, x299, x322); - let mut x337: u64 = 0; - let mut x338: u64 = 0; - fp_mulx_u64(&mut x337, &mut x338, x323, 0x8508bfffffffffff); - let mut x339: u64 = 0; - let mut x340: u64 = 0; - fp_mulx_u64(&mut x339, &mut x340, x337, 0x1ae3a4617c510ea); - let mut x341: u64 = 0; - let mut x342: u64 = 0; - fp_mulx_u64(&mut x341, &mut x342, x337, 0xc63b05c06ca1493b); - let mut x343: u64 = 0; - let mut x344: u64 = 0; - fp_mulx_u64(&mut x343, &mut x344, x337, 0x1a22d9f300f5138f); - let mut x345: u64 = 0; - let mut x346: u64 = 0; - fp_mulx_u64(&mut x345, &mut x346, x337, 0x1ef3622fba094800); - let mut x347: u64 = 0; - let mut x348: u64 = 0; - fp_mulx_u64(&mut x347, &mut x348, x337, 0x170b5d4430000000); - let mut x349: u64 = 0; - let mut x350: u64 = 0; - fp_mulx_u64(&mut x349, &mut x350, x337, 0x8508c00000000001); - let mut x351: u64 = 0; - let mut x352: FpU1 = 0; - fp_addcarryx_u64(&mut x351, &mut x352, 0x0, x350, x347); - let mut x353: u64 = 0; - let mut x354: FpU1 = 0; - fp_addcarryx_u64(&mut x353, &mut x354, x352, x348, x345); - let mut x355: u64 = 0; - let mut x356: FpU1 = 0; - fp_addcarryx_u64(&mut x355, &mut x356, x354, x346, x343); - let mut x357: u64 = 0; - let mut x358: FpU1 = 0; - fp_addcarryx_u64(&mut x357, &mut x358, x356, x344, x341); - let mut x359: u64 = 0; - let mut x360: FpU1 = 0; - fp_addcarryx_u64(&mut x359, &mut x360, x358, x342, x339); - let x361: u64 = ((x360 as u64) + x340); - let mut x362: u64 = 0; - let mut x363: FpU1 = 0; - fp_addcarryx_u64(&mut x362, &mut x363, 0x0, x323, x349); - let mut x364: u64 = 0; - let mut x365: FpU1 = 0; - fp_addcarryx_u64(&mut x364, &mut x365, x363, x325, x351); - let mut x366: u64 = 0; - let mut x367: FpU1 = 0; - fp_addcarryx_u64(&mut x366, &mut x367, x365, x327, x353); - let mut x368: u64 = 0; - let mut x369: FpU1 = 0; - fp_addcarryx_u64(&mut x368, &mut x369, x367, x329, x355); - let mut x370: u64 = 0; - let mut x371: FpU1 = 0; - fp_addcarryx_u64(&mut x370, &mut x371, x369, x331, x357); - let mut x372: u64 = 0; - let mut x373: FpU1 = 0; - fp_addcarryx_u64(&mut x372, &mut x373, x371, x333, x359); - let mut x374: u64 = 0; - let mut x375: FpU1 = 0; - fp_addcarryx_u64(&mut x374, &mut x375, x373, x335, x361); - let x376: u64 = ((x375 as u64) + (x336 as u64)); - let mut x377: u64 = 0; - let mut x378: u64 = 0; - fp_mulx_u64(&mut x377, &mut x378, x5, (arg1[5])); - let mut x379: u64 = 0; - let mut x380: u64 = 0; - fp_mulx_u64(&mut x379, &mut x380, x5, (arg1[4])); - let mut x381: u64 = 0; - let mut x382: u64 = 0; - fp_mulx_u64(&mut x381, &mut x382, x5, (arg1[3])); - let mut x383: u64 = 0; - let mut x384: u64 = 0; - fp_mulx_u64(&mut x383, &mut x384, x5, (arg1[2])); - let mut x385: u64 = 0; - let mut x386: u64 = 0; - fp_mulx_u64(&mut x385, &mut x386, x5, (arg1[1])); - let mut x387: u64 = 0; - let mut x388: u64 = 0; - fp_mulx_u64(&mut x387, &mut x388, x5, (arg1[0])); - let mut x389: u64 = 0; - let mut x390: FpU1 = 0; - fp_addcarryx_u64(&mut x389, &mut x390, 0x0, x388, x385); - let mut x391: u64 = 0; - let mut x392: FpU1 = 0; - fp_addcarryx_u64(&mut x391, &mut x392, x390, x386, x383); - let mut x393: u64 = 0; - let mut x394: FpU1 = 0; - fp_addcarryx_u64(&mut x393, &mut x394, x392, x384, x381); - let mut x395: u64 = 0; - let mut x396: FpU1 = 0; - fp_addcarryx_u64(&mut x395, &mut x396, x394, x382, x379); - let mut x397: u64 = 0; - let mut x398: FpU1 = 0; - fp_addcarryx_u64(&mut x397, &mut x398, x396, x380, x377); - let x399: u64 = ((x398 as u64) + x378); - let mut x400: u64 = 0; - let mut x401: FpU1 = 0; - fp_addcarryx_u64(&mut x400, &mut x401, 0x0, x364, x387); - let mut x402: u64 = 0; - let mut x403: FpU1 = 0; - fp_addcarryx_u64(&mut x402, &mut x403, x401, x366, x389); - let mut x404: u64 = 0; - let mut x405: FpU1 = 0; - fp_addcarryx_u64(&mut x404, &mut x405, x403, x368, x391); - let mut x406: u64 = 0; - let mut x407: FpU1 = 0; - fp_addcarryx_u64(&mut x406, &mut x407, x405, x370, x393); - let mut x408: u64 = 0; - let mut x409: FpU1 = 0; - fp_addcarryx_u64(&mut x408, &mut x409, x407, x372, x395); - let mut x410: u64 = 0; - let mut x411: FpU1 = 0; - fp_addcarryx_u64(&mut x410, &mut x411, x409, x374, x397); - let mut x412: u64 = 0; - let mut x413: FpU1 = 0; - fp_addcarryx_u64(&mut x412, &mut x413, x411, x376, x399); - let mut x414: u64 = 0; - let mut x415: u64 = 0; - fp_mulx_u64(&mut x414, &mut x415, x400, 0x8508bfffffffffff); - let mut x416: u64 = 0; - let mut x417: u64 = 0; - fp_mulx_u64(&mut x416, &mut x417, x414, 0x1ae3a4617c510ea); - let mut x418: u64 = 0; - let mut x419: u64 = 0; - fp_mulx_u64(&mut x418, &mut x419, x414, 0xc63b05c06ca1493b); - let mut x420: u64 = 0; - let mut x421: u64 = 0; - fp_mulx_u64(&mut x420, &mut x421, x414, 0x1a22d9f300f5138f); - let mut x422: u64 = 0; - let mut x423: u64 = 0; - fp_mulx_u64(&mut x422, &mut x423, x414, 0x1ef3622fba094800); - let mut x424: u64 = 0; - let mut x425: u64 = 0; - fp_mulx_u64(&mut x424, &mut x425, x414, 0x170b5d4430000000); - let mut x426: u64 = 0; - let mut x427: u64 = 0; - fp_mulx_u64(&mut x426, &mut x427, x414, 0x8508c00000000001); - let mut x428: u64 = 0; - let mut x429: FpU1 = 0; - fp_addcarryx_u64(&mut x428, &mut x429, 0x0, x427, x424); - let mut x430: u64 = 0; - let mut x431: FpU1 = 0; - fp_addcarryx_u64(&mut x430, &mut x431, x429, x425, x422); - let mut x432: u64 = 0; - let mut x433: FpU1 = 0; - fp_addcarryx_u64(&mut x432, &mut x433, x431, x423, x420); - let mut x434: u64 = 0; - let mut x435: FpU1 = 0; - fp_addcarryx_u64(&mut x434, &mut x435, x433, x421, x418); - let mut x436: u64 = 0; - let mut x437: FpU1 = 0; - fp_addcarryx_u64(&mut x436, &mut x437, x435, x419, x416); - let x438: u64 = ((x437 as u64) + x417); - let mut x439: u64 = 0; - let mut x440: FpU1 = 0; - fp_addcarryx_u64(&mut x439, &mut x440, 0x0, x400, x426); - let mut x441: u64 = 0; - let mut x442: FpU1 = 0; - fp_addcarryx_u64(&mut x441, &mut x442, x440, x402, x428); - let mut x443: u64 = 0; - let mut x444: FpU1 = 0; - fp_addcarryx_u64(&mut x443, &mut x444, x442, x404, x430); - let mut x445: u64 = 0; - let mut x446: FpU1 = 0; - fp_addcarryx_u64(&mut x445, &mut x446, x444, x406, x432); - let mut x447: u64 = 0; - let mut x448: FpU1 = 0; - fp_addcarryx_u64(&mut x447, &mut x448, x446, x408, x434); - let mut x449: u64 = 0; - let mut x450: FpU1 = 0; - fp_addcarryx_u64(&mut x449, &mut x450, x448, x410, x436); - let mut x451: u64 = 0; - let mut x452: FpU1 = 0; - fp_addcarryx_u64(&mut x451, &mut x452, x450, x412, x438); - let x453: u64 = ((x452 as u64) + (x413 as u64)); - let mut x454: u64 = 0; - let mut x455: FpU1 = 0; - fp_subborrowx_u64(&mut x454, &mut x455, 0x0, x441, 0x8508c00000000001); - let mut x456: u64 = 0; - let mut x457: FpU1 = 0; - fp_subborrowx_u64(&mut x456, &mut x457, x455, x443, 0x170b5d4430000000); - let mut x458: u64 = 0; - let mut x459: FpU1 = 0; - fp_subborrowx_u64(&mut x458, &mut x459, x457, x445, 0x1ef3622fba094800); - let mut x460: u64 = 0; - let mut x461: FpU1 = 0; - fp_subborrowx_u64(&mut x460, &mut x461, x459, x447, 0x1a22d9f300f5138f); - let mut x462: u64 = 0; - let mut x463: FpU1 = 0; - fp_subborrowx_u64(&mut x462, &mut x463, x461, x449, 0xc63b05c06ca1493b); - let mut x464: u64 = 0; - let mut x465: FpU1 = 0; - fp_subborrowx_u64(&mut x464, &mut x465, x463, x451, 0x1ae3a4617c510ea); - let mut x466: u64 = 0; - let mut x467: FpU1 = 0; - fp_subborrowx_u64(&mut x466, &mut x467, x465, x453, (0x0 as u64)); - let mut x468: u64 = 0; - fp_cmovznz_u64(&mut x468, x467, x454, x441); - let mut x469: u64 = 0; - fp_cmovznz_u64(&mut x469, x467, x456, x443); - let mut x470: u64 = 0; - fp_cmovznz_u64(&mut x470, x467, x458, x445); - let mut x471: u64 = 0; - fp_cmovznz_u64(&mut x471, x467, x460, x447); - let mut x472: u64 = 0; - fp_cmovznz_u64(&mut x472, x467, x462, x449); - let mut x473: u64 = 0; - fp_cmovznz_u64(&mut x473, x467, x464, x451); - out1[0] = x468; - out1[1] = x469; - out1[2] = x470; - out1[3] = x471; - out1[4] = x472; - out1[5] = x473; -} - -/// The function fp_add adds two field elements in the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// 0 ≤ eval arg2 < m -/// Postconditions: -/// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) + eval (from_montgomery arg2)) mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_add( - out1: &mut FpMontgomeryDomainFieldElement, - arg1: &FpMontgomeryDomainFieldElement, - arg2: &FpMontgomeryDomainFieldElement, -) { - let mut x1: u64 = 0; - let mut x2: FpU1 = 0; - fp_addcarryx_u64(&mut x1, &mut x2, 0x0, (arg1[0]), (arg2[0])); - let mut x3: u64 = 0; - let mut x4: FpU1 = 0; - fp_addcarryx_u64(&mut x3, &mut x4, x2, (arg1[1]), (arg2[1])); - let mut x5: u64 = 0; - let mut x6: FpU1 = 0; - fp_addcarryx_u64(&mut x5, &mut x6, x4, (arg1[2]), (arg2[2])); - let mut x7: u64 = 0; - let mut x8: FpU1 = 0; - fp_addcarryx_u64(&mut x7, &mut x8, x6, (arg1[3]), (arg2[3])); - let mut x9: u64 = 0; - let mut x10: FpU1 = 0; - fp_addcarryx_u64(&mut x9, &mut x10, x8, (arg1[4]), (arg2[4])); - let mut x11: u64 = 0; - let mut x12: FpU1 = 0; - fp_addcarryx_u64(&mut x11, &mut x12, x10, (arg1[5]), (arg2[5])); - let mut x13: u64 = 0; - let mut x14: FpU1 = 0; - fp_subborrowx_u64(&mut x13, &mut x14, 0x0, x1, 0x8508c00000000001); - let mut x15: u64 = 0; - let mut x16: FpU1 = 0; - fp_subborrowx_u64(&mut x15, &mut x16, x14, x3, 0x170b5d4430000000); - let mut x17: u64 = 0; - let mut x18: FpU1 = 0; - fp_subborrowx_u64(&mut x17, &mut x18, x16, x5, 0x1ef3622fba094800); - let mut x19: u64 = 0; - let mut x20: FpU1 = 0; - fp_subborrowx_u64(&mut x19, &mut x20, x18, x7, 0x1a22d9f300f5138f); - let mut x21: u64 = 0; - let mut x22: FpU1 = 0; - fp_subborrowx_u64(&mut x21, &mut x22, x20, x9, 0xc63b05c06ca1493b); - let mut x23: u64 = 0; - let mut x24: FpU1 = 0; - fp_subborrowx_u64(&mut x23, &mut x24, x22, x11, 0x1ae3a4617c510ea); - let mut x25: u64 = 0; - let mut x26: FpU1 = 0; - fp_subborrowx_u64(&mut x25, &mut x26, x24, (x12 as u64), (0x0 as u64)); - let mut x27: u64 = 0; - fp_cmovznz_u64(&mut x27, x26, x13, x1); - let mut x28: u64 = 0; - fp_cmovznz_u64(&mut x28, x26, x15, x3); - let mut x29: u64 = 0; - fp_cmovznz_u64(&mut x29, x26, x17, x5); - let mut x30: u64 = 0; - fp_cmovznz_u64(&mut x30, x26, x19, x7); - let mut x31: u64 = 0; - fp_cmovznz_u64(&mut x31, x26, x21, x9); - let mut x32: u64 = 0; - fp_cmovznz_u64(&mut x32, x26, x23, x11); - out1[0] = x27; - out1[1] = x28; - out1[2] = x29; - out1[3] = x30; - out1[4] = x31; - out1[5] = x32; -} - -/// The function fp_sub subtracts two field elements in the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// 0 ≤ eval arg2 < m -/// Postconditions: -/// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) - eval (from_montgomery arg2)) mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_sub( - out1: &mut FpMontgomeryDomainFieldElement, - arg1: &FpMontgomeryDomainFieldElement, - arg2: &FpMontgomeryDomainFieldElement, -) { - let mut x1: u64 = 0; - let mut x2: FpU1 = 0; - fp_subborrowx_u64(&mut x1, &mut x2, 0x0, (arg1[0]), (arg2[0])); - let mut x3: u64 = 0; - let mut x4: FpU1 = 0; - fp_subborrowx_u64(&mut x3, &mut x4, x2, (arg1[1]), (arg2[1])); - let mut x5: u64 = 0; - let mut x6: FpU1 = 0; - fp_subborrowx_u64(&mut x5, &mut x6, x4, (arg1[2]), (arg2[2])); - let mut x7: u64 = 0; - let mut x8: FpU1 = 0; - fp_subborrowx_u64(&mut x7, &mut x8, x6, (arg1[3]), (arg2[3])); - let mut x9: u64 = 0; - let mut x10: FpU1 = 0; - fp_subborrowx_u64(&mut x9, &mut x10, x8, (arg1[4]), (arg2[4])); - let mut x11: u64 = 0; - let mut x12: FpU1 = 0; - fp_subborrowx_u64(&mut x11, &mut x12, x10, (arg1[5]), (arg2[5])); - let mut x13: u64 = 0; - fp_cmovznz_u64(&mut x13, x12, (0x0 as u64), 0xffffffffffffffff); - let mut x14: u64 = 0; - let mut x15: FpU1 = 0; - fp_addcarryx_u64(&mut x14, &mut x15, 0x0, x1, (x13 & 0x8508c00000000001)); - let mut x16: u64 = 0; - let mut x17: FpU1 = 0; - fp_addcarryx_u64(&mut x16, &mut x17, x15, x3, (x13 & 0x170b5d4430000000)); - let mut x18: u64 = 0; - let mut x19: FpU1 = 0; - fp_addcarryx_u64(&mut x18, &mut x19, x17, x5, (x13 & 0x1ef3622fba094800)); - let mut x20: u64 = 0; - let mut x21: FpU1 = 0; - fp_addcarryx_u64(&mut x20, &mut x21, x19, x7, (x13 & 0x1a22d9f300f5138f)); - let mut x22: u64 = 0; - let mut x23: FpU1 = 0; - fp_addcarryx_u64(&mut x22, &mut x23, x21, x9, (x13 & 0xc63b05c06ca1493b)); - let mut x24: u64 = 0; - let mut x25: FpU1 = 0; - fp_addcarryx_u64(&mut x24, &mut x25, x23, x11, (x13 & 0x1ae3a4617c510ea)); - out1[0] = x14; - out1[1] = x16; - out1[2] = x18; - out1[3] = x20; - out1[4] = x22; - out1[5] = x24; -} - -/// The function fp_opp negates a field element in the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// Postconditions: -/// eval (from_montgomery out1) mod m = -eval (from_montgomery arg1) mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_opp(out1: &mut FpMontgomeryDomainFieldElement, arg1: &FpMontgomeryDomainFieldElement) { - let mut x1: u64 = 0; - let mut x2: FpU1 = 0; - fp_subborrowx_u64(&mut x1, &mut x2, 0x0, (0x0 as u64), (arg1[0])); - let mut x3: u64 = 0; - let mut x4: FpU1 = 0; - fp_subborrowx_u64(&mut x3, &mut x4, x2, (0x0 as u64), (arg1[1])); - let mut x5: u64 = 0; - let mut x6: FpU1 = 0; - fp_subborrowx_u64(&mut x5, &mut x6, x4, (0x0 as u64), (arg1[2])); - let mut x7: u64 = 0; - let mut x8: FpU1 = 0; - fp_subborrowx_u64(&mut x7, &mut x8, x6, (0x0 as u64), (arg1[3])); - let mut x9: u64 = 0; - let mut x10: FpU1 = 0; - fp_subborrowx_u64(&mut x9, &mut x10, x8, (0x0 as u64), (arg1[4])); - let mut x11: u64 = 0; - let mut x12: FpU1 = 0; - fp_subborrowx_u64(&mut x11, &mut x12, x10, (0x0 as u64), (arg1[5])); - let mut x13: u64 = 0; - fp_cmovznz_u64(&mut x13, x12, (0x0 as u64), 0xffffffffffffffff); - let mut x14: u64 = 0; - let mut x15: FpU1 = 0; - fp_addcarryx_u64(&mut x14, &mut x15, 0x0, x1, (x13 & 0x8508c00000000001)); - let mut x16: u64 = 0; - let mut x17: FpU1 = 0; - fp_addcarryx_u64(&mut x16, &mut x17, x15, x3, (x13 & 0x170b5d4430000000)); - let mut x18: u64 = 0; - let mut x19: FpU1 = 0; - fp_addcarryx_u64(&mut x18, &mut x19, x17, x5, (x13 & 0x1ef3622fba094800)); - let mut x20: u64 = 0; - let mut x21: FpU1 = 0; - fp_addcarryx_u64(&mut x20, &mut x21, x19, x7, (x13 & 0x1a22d9f300f5138f)); - let mut x22: u64 = 0; - let mut x23: FpU1 = 0; - fp_addcarryx_u64(&mut x22, &mut x23, x21, x9, (x13 & 0xc63b05c06ca1493b)); - let mut x24: u64 = 0; - let mut x25: FpU1 = 0; - fp_addcarryx_u64(&mut x24, &mut x25, x23, x11, (x13 & 0x1ae3a4617c510ea)); - out1[0] = x14; - out1[1] = x16; - out1[2] = x18; - out1[3] = x20; - out1[4] = x22; - out1[5] = x24; -} - -/// The function fp_from_montgomery translates a field element out of the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// Postconditions: -/// eval out1 mod m = (eval arg1 * ((2^64)⁻¹ mod m)^6) mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_from_montgomery( - out1: &mut FpNonMontgomeryDomainFieldElement, - arg1: &FpMontgomeryDomainFieldElement, -) { - let x1: u64 = (arg1[0]); - let mut x2: u64 = 0; - let mut x3: u64 = 0; - fp_mulx_u64(&mut x2, &mut x3, x1, 0x8508bfffffffffff); - let mut x4: u64 = 0; - let mut x5: u64 = 0; - fp_mulx_u64(&mut x4, &mut x5, x2, 0x1ae3a4617c510ea); - let mut x6: u64 = 0; - let mut x7: u64 = 0; - fp_mulx_u64(&mut x6, &mut x7, x2, 0xc63b05c06ca1493b); - let mut x8: u64 = 0; - let mut x9: u64 = 0; - fp_mulx_u64(&mut x8, &mut x9, x2, 0x1a22d9f300f5138f); - let mut x10: u64 = 0; - let mut x11: u64 = 0; - fp_mulx_u64(&mut x10, &mut x11, x2, 0x1ef3622fba094800); - let mut x12: u64 = 0; - let mut x13: u64 = 0; - fp_mulx_u64(&mut x12, &mut x13, x2, 0x170b5d4430000000); - let mut x14: u64 = 0; - let mut x15: u64 = 0; - fp_mulx_u64(&mut x14, &mut x15, x2, 0x8508c00000000001); - let mut x16: u64 = 0; - let mut x17: FpU1 = 0; - fp_addcarryx_u64(&mut x16, &mut x17, 0x0, x15, x12); - let mut x18: u64 = 0; - let mut x19: FpU1 = 0; - fp_addcarryx_u64(&mut x18, &mut x19, x17, x13, x10); - let mut x20: u64 = 0; - let mut x21: FpU1 = 0; - fp_addcarryx_u64(&mut x20, &mut x21, x19, x11, x8); - let mut x22: u64 = 0; - let mut x23: FpU1 = 0; - fp_addcarryx_u64(&mut x22, &mut x23, x21, x9, x6); - let mut x24: u64 = 0; - let mut x25: FpU1 = 0; - fp_addcarryx_u64(&mut x24, &mut x25, x23, x7, x4); - let mut x26: u64 = 0; - let mut x27: FpU1 = 0; - fp_addcarryx_u64(&mut x26, &mut x27, 0x0, x1, x14); - let mut x28: u64 = 0; - let mut x29: FpU1 = 0; - fp_addcarryx_u64(&mut x28, &mut x29, x27, (0x0 as u64), x16); - let mut x30: u64 = 0; - let mut x31: FpU1 = 0; - fp_addcarryx_u64(&mut x30, &mut x31, x29, (0x0 as u64), x18); - let mut x32: u64 = 0; - let mut x33: FpU1 = 0; - fp_addcarryx_u64(&mut x32, &mut x33, x31, (0x0 as u64), x20); - let mut x34: u64 = 0; - let mut x35: FpU1 = 0; - fp_addcarryx_u64(&mut x34, &mut x35, x33, (0x0 as u64), x22); - let mut x36: u64 = 0; - let mut x37: FpU1 = 0; - fp_addcarryx_u64(&mut x36, &mut x37, x35, (0x0 as u64), x24); - let mut x38: u64 = 0; - let mut x39: FpU1 = 0; - fp_addcarryx_u64(&mut x38, &mut x39, 0x0, x28, (arg1[1])); - let mut x40: u64 = 0; - let mut x41: FpU1 = 0; - fp_addcarryx_u64(&mut x40, &mut x41, x39, x30, (0x0 as u64)); - let mut x42: u64 = 0; - let mut x43: FpU1 = 0; - fp_addcarryx_u64(&mut x42, &mut x43, x41, x32, (0x0 as u64)); - let mut x44: u64 = 0; - let mut x45: FpU1 = 0; - fp_addcarryx_u64(&mut x44, &mut x45, x43, x34, (0x0 as u64)); - let mut x46: u64 = 0; - let mut x47: FpU1 = 0; - fp_addcarryx_u64(&mut x46, &mut x47, x45, x36, (0x0 as u64)); - let mut x48: u64 = 0; - let mut x49: u64 = 0; - fp_mulx_u64(&mut x48, &mut x49, x38, 0x8508bfffffffffff); - let mut x50: u64 = 0; - let mut x51: u64 = 0; - fp_mulx_u64(&mut x50, &mut x51, x48, 0x1ae3a4617c510ea); - let mut x52: u64 = 0; - let mut x53: u64 = 0; - fp_mulx_u64(&mut x52, &mut x53, x48, 0xc63b05c06ca1493b); - let mut x54: u64 = 0; - let mut x55: u64 = 0; - fp_mulx_u64(&mut x54, &mut x55, x48, 0x1a22d9f300f5138f); - let mut x56: u64 = 0; - let mut x57: u64 = 0; - fp_mulx_u64(&mut x56, &mut x57, x48, 0x1ef3622fba094800); - let mut x58: u64 = 0; - let mut x59: u64 = 0; - fp_mulx_u64(&mut x58, &mut x59, x48, 0x170b5d4430000000); - let mut x60: u64 = 0; - let mut x61: u64 = 0; - fp_mulx_u64(&mut x60, &mut x61, x48, 0x8508c00000000001); - let mut x62: u64 = 0; - let mut x63: FpU1 = 0; - fp_addcarryx_u64(&mut x62, &mut x63, 0x0, x61, x58); - let mut x64: u64 = 0; - let mut x65: FpU1 = 0; - fp_addcarryx_u64(&mut x64, &mut x65, x63, x59, x56); - let mut x66: u64 = 0; - let mut x67: FpU1 = 0; - fp_addcarryx_u64(&mut x66, &mut x67, x65, x57, x54); - let mut x68: u64 = 0; - let mut x69: FpU1 = 0; - fp_addcarryx_u64(&mut x68, &mut x69, x67, x55, x52); - let mut x70: u64 = 0; - let mut x71: FpU1 = 0; - fp_addcarryx_u64(&mut x70, &mut x71, x69, x53, x50); - let mut x72: u64 = 0; - let mut x73: FpU1 = 0; - fp_addcarryx_u64(&mut x72, &mut x73, 0x0, x38, x60); - let mut x74: u64 = 0; - let mut x75: FpU1 = 0; - fp_addcarryx_u64(&mut x74, &mut x75, x73, x40, x62); - let mut x76: u64 = 0; - let mut x77: FpU1 = 0; - fp_addcarryx_u64(&mut x76, &mut x77, x75, x42, x64); - let mut x78: u64 = 0; - let mut x79: FpU1 = 0; - fp_addcarryx_u64(&mut x78, &mut x79, x77, x44, x66); - let mut x80: u64 = 0; - let mut x81: FpU1 = 0; - fp_addcarryx_u64(&mut x80, &mut x81, x79, x46, x68); - let mut x82: u64 = 0; - let mut x83: FpU1 = 0; - fp_addcarryx_u64( - &mut x82, - &mut x83, - x81, - ((x47 as u64) + ((x37 as u64) + ((x25 as u64) + x5))), - x70, - ); - let mut x84: u64 = 0; - let mut x85: FpU1 = 0; - fp_addcarryx_u64(&mut x84, &mut x85, 0x0, x74, (arg1[2])); - let mut x86: u64 = 0; - let mut x87: FpU1 = 0; - fp_addcarryx_u64(&mut x86, &mut x87, x85, x76, (0x0 as u64)); - let mut x88: u64 = 0; - let mut x89: FpU1 = 0; - fp_addcarryx_u64(&mut x88, &mut x89, x87, x78, (0x0 as u64)); - let mut x90: u64 = 0; - let mut x91: FpU1 = 0; - fp_addcarryx_u64(&mut x90, &mut x91, x89, x80, (0x0 as u64)); - let mut x92: u64 = 0; - let mut x93: FpU1 = 0; - fp_addcarryx_u64(&mut x92, &mut x93, x91, x82, (0x0 as u64)); - let mut x94: u64 = 0; - let mut x95: u64 = 0; - fp_mulx_u64(&mut x94, &mut x95, x84, 0x8508bfffffffffff); - let mut x96: u64 = 0; - let mut x97: u64 = 0; - fp_mulx_u64(&mut x96, &mut x97, x94, 0x1ae3a4617c510ea); - let mut x98: u64 = 0; - let mut x99: u64 = 0; - fp_mulx_u64(&mut x98, &mut x99, x94, 0xc63b05c06ca1493b); - let mut x100: u64 = 0; - let mut x101: u64 = 0; - fp_mulx_u64(&mut x100, &mut x101, x94, 0x1a22d9f300f5138f); - let mut x102: u64 = 0; - let mut x103: u64 = 0; - fp_mulx_u64(&mut x102, &mut x103, x94, 0x1ef3622fba094800); - let mut x104: u64 = 0; - let mut x105: u64 = 0; - fp_mulx_u64(&mut x104, &mut x105, x94, 0x170b5d4430000000); - let mut x106: u64 = 0; - let mut x107: u64 = 0; - fp_mulx_u64(&mut x106, &mut x107, x94, 0x8508c00000000001); - let mut x108: u64 = 0; - let mut x109: FpU1 = 0; - fp_addcarryx_u64(&mut x108, &mut x109, 0x0, x107, x104); - let mut x110: u64 = 0; - let mut x111: FpU1 = 0; - fp_addcarryx_u64(&mut x110, &mut x111, x109, x105, x102); - let mut x112: u64 = 0; - let mut x113: FpU1 = 0; - fp_addcarryx_u64(&mut x112, &mut x113, x111, x103, x100); - let mut x114: u64 = 0; - let mut x115: FpU1 = 0; - fp_addcarryx_u64(&mut x114, &mut x115, x113, x101, x98); - let mut x116: u64 = 0; - let mut x117: FpU1 = 0; - fp_addcarryx_u64(&mut x116, &mut x117, x115, x99, x96); - let mut x118: u64 = 0; - let mut x119: FpU1 = 0; - fp_addcarryx_u64(&mut x118, &mut x119, 0x0, x84, x106); - let mut x120: u64 = 0; - let mut x121: FpU1 = 0; - fp_addcarryx_u64(&mut x120, &mut x121, x119, x86, x108); - let mut x122: u64 = 0; - let mut x123: FpU1 = 0; - fp_addcarryx_u64(&mut x122, &mut x123, x121, x88, x110); - let mut x124: u64 = 0; - let mut x125: FpU1 = 0; - fp_addcarryx_u64(&mut x124, &mut x125, x123, x90, x112); - let mut x126: u64 = 0; - let mut x127: FpU1 = 0; - fp_addcarryx_u64(&mut x126, &mut x127, x125, x92, x114); - let mut x128: u64 = 0; - let mut x129: FpU1 = 0; - fp_addcarryx_u64( - &mut x128, - &mut x129, - x127, - ((x93 as u64) + ((x83 as u64) + ((x71 as u64) + x51))), - x116, - ); - let mut x130: u64 = 0; - let mut x131: FpU1 = 0; - fp_addcarryx_u64(&mut x130, &mut x131, 0x0, x120, (arg1[3])); - let mut x132: u64 = 0; - let mut x133: FpU1 = 0; - fp_addcarryx_u64(&mut x132, &mut x133, x131, x122, (0x0 as u64)); - let mut x134: u64 = 0; - let mut x135: FpU1 = 0; - fp_addcarryx_u64(&mut x134, &mut x135, x133, x124, (0x0 as u64)); - let mut x136: u64 = 0; - let mut x137: FpU1 = 0; - fp_addcarryx_u64(&mut x136, &mut x137, x135, x126, (0x0 as u64)); - let mut x138: u64 = 0; - let mut x139: FpU1 = 0; - fp_addcarryx_u64(&mut x138, &mut x139, x137, x128, (0x0 as u64)); - let mut x140: u64 = 0; - let mut x141: u64 = 0; - fp_mulx_u64(&mut x140, &mut x141, x130, 0x8508bfffffffffff); - let mut x142: u64 = 0; - let mut x143: u64 = 0; - fp_mulx_u64(&mut x142, &mut x143, x140, 0x1ae3a4617c510ea); - let mut x144: u64 = 0; - let mut x145: u64 = 0; - fp_mulx_u64(&mut x144, &mut x145, x140, 0xc63b05c06ca1493b); - let mut x146: u64 = 0; - let mut x147: u64 = 0; - fp_mulx_u64(&mut x146, &mut x147, x140, 0x1a22d9f300f5138f); - let mut x148: u64 = 0; - let mut x149: u64 = 0; - fp_mulx_u64(&mut x148, &mut x149, x140, 0x1ef3622fba094800); - let mut x150: u64 = 0; - let mut x151: u64 = 0; - fp_mulx_u64(&mut x150, &mut x151, x140, 0x170b5d4430000000); - let mut x152: u64 = 0; - let mut x153: u64 = 0; - fp_mulx_u64(&mut x152, &mut x153, x140, 0x8508c00000000001); - let mut x154: u64 = 0; - let mut x155: FpU1 = 0; - fp_addcarryx_u64(&mut x154, &mut x155, 0x0, x153, x150); - let mut x156: u64 = 0; - let mut x157: FpU1 = 0; - fp_addcarryx_u64(&mut x156, &mut x157, x155, x151, x148); - let mut x158: u64 = 0; - let mut x159: FpU1 = 0; - fp_addcarryx_u64(&mut x158, &mut x159, x157, x149, x146); - let mut x160: u64 = 0; - let mut x161: FpU1 = 0; - fp_addcarryx_u64(&mut x160, &mut x161, x159, x147, x144); - let mut x162: u64 = 0; - let mut x163: FpU1 = 0; - fp_addcarryx_u64(&mut x162, &mut x163, x161, x145, x142); - let mut x164: u64 = 0; - let mut x165: FpU1 = 0; - fp_addcarryx_u64(&mut x164, &mut x165, 0x0, x130, x152); - let mut x166: u64 = 0; - let mut x167: FpU1 = 0; - fp_addcarryx_u64(&mut x166, &mut x167, x165, x132, x154); - let mut x168: u64 = 0; - let mut x169: FpU1 = 0; - fp_addcarryx_u64(&mut x168, &mut x169, x167, x134, x156); - let mut x170: u64 = 0; - let mut x171: FpU1 = 0; - fp_addcarryx_u64(&mut x170, &mut x171, x169, x136, x158); - let mut x172: u64 = 0; - let mut x173: FpU1 = 0; - fp_addcarryx_u64(&mut x172, &mut x173, x171, x138, x160); - let mut x174: u64 = 0; - let mut x175: FpU1 = 0; - fp_addcarryx_u64( - &mut x174, - &mut x175, - x173, - ((x139 as u64) + ((x129 as u64) + ((x117 as u64) + x97))), - x162, - ); - let mut x176: u64 = 0; - let mut x177: FpU1 = 0; - fp_addcarryx_u64(&mut x176, &mut x177, 0x0, x166, (arg1[4])); - let mut x178: u64 = 0; - let mut x179: FpU1 = 0; - fp_addcarryx_u64(&mut x178, &mut x179, x177, x168, (0x0 as u64)); - let mut x180: u64 = 0; - let mut x181: FpU1 = 0; - fp_addcarryx_u64(&mut x180, &mut x181, x179, x170, (0x0 as u64)); - let mut x182: u64 = 0; - let mut x183: FpU1 = 0; - fp_addcarryx_u64(&mut x182, &mut x183, x181, x172, (0x0 as u64)); - let mut x184: u64 = 0; - let mut x185: FpU1 = 0; - fp_addcarryx_u64(&mut x184, &mut x185, x183, x174, (0x0 as u64)); - let mut x186: u64 = 0; - let mut x187: u64 = 0; - fp_mulx_u64(&mut x186, &mut x187, x176, 0x8508bfffffffffff); - let mut x188: u64 = 0; - let mut x189: u64 = 0; - fp_mulx_u64(&mut x188, &mut x189, x186, 0x1ae3a4617c510ea); - let mut x190: u64 = 0; - let mut x191: u64 = 0; - fp_mulx_u64(&mut x190, &mut x191, x186, 0xc63b05c06ca1493b); - let mut x192: u64 = 0; - let mut x193: u64 = 0; - fp_mulx_u64(&mut x192, &mut x193, x186, 0x1a22d9f300f5138f); - let mut x194: u64 = 0; - let mut x195: u64 = 0; - fp_mulx_u64(&mut x194, &mut x195, x186, 0x1ef3622fba094800); - let mut x196: u64 = 0; - let mut x197: u64 = 0; - fp_mulx_u64(&mut x196, &mut x197, x186, 0x170b5d4430000000); - let mut x198: u64 = 0; - let mut x199: u64 = 0; - fp_mulx_u64(&mut x198, &mut x199, x186, 0x8508c00000000001); - let mut x200: u64 = 0; - let mut x201: FpU1 = 0; - fp_addcarryx_u64(&mut x200, &mut x201, 0x0, x199, x196); - let mut x202: u64 = 0; - let mut x203: FpU1 = 0; - fp_addcarryx_u64(&mut x202, &mut x203, x201, x197, x194); - let mut x204: u64 = 0; - let mut x205: FpU1 = 0; - fp_addcarryx_u64(&mut x204, &mut x205, x203, x195, x192); - let mut x206: u64 = 0; - let mut x207: FpU1 = 0; - fp_addcarryx_u64(&mut x206, &mut x207, x205, x193, x190); - let mut x208: u64 = 0; - let mut x209: FpU1 = 0; - fp_addcarryx_u64(&mut x208, &mut x209, x207, x191, x188); - let mut x210: u64 = 0; - let mut x211: FpU1 = 0; - fp_addcarryx_u64(&mut x210, &mut x211, 0x0, x176, x198); - let mut x212: u64 = 0; - let mut x213: FpU1 = 0; - fp_addcarryx_u64(&mut x212, &mut x213, x211, x178, x200); - let mut x214: u64 = 0; - let mut x215: FpU1 = 0; - fp_addcarryx_u64(&mut x214, &mut x215, x213, x180, x202); - let mut x216: u64 = 0; - let mut x217: FpU1 = 0; - fp_addcarryx_u64(&mut x216, &mut x217, x215, x182, x204); - let mut x218: u64 = 0; - let mut x219: FpU1 = 0; - fp_addcarryx_u64(&mut x218, &mut x219, x217, x184, x206); - let mut x220: u64 = 0; - let mut x221: FpU1 = 0; - fp_addcarryx_u64( - &mut x220, - &mut x221, - x219, - ((x185 as u64) + ((x175 as u64) + ((x163 as u64) + x143))), - x208, - ); - let mut x222: u64 = 0; - let mut x223: FpU1 = 0; - fp_addcarryx_u64(&mut x222, &mut x223, 0x0, x212, (arg1[5])); - let mut x224: u64 = 0; - let mut x225: FpU1 = 0; - fp_addcarryx_u64(&mut x224, &mut x225, x223, x214, (0x0 as u64)); - let mut x226: u64 = 0; - let mut x227: FpU1 = 0; - fp_addcarryx_u64(&mut x226, &mut x227, x225, x216, (0x0 as u64)); - let mut x228: u64 = 0; - let mut x229: FpU1 = 0; - fp_addcarryx_u64(&mut x228, &mut x229, x227, x218, (0x0 as u64)); - let mut x230: u64 = 0; - let mut x231: FpU1 = 0; - fp_addcarryx_u64(&mut x230, &mut x231, x229, x220, (0x0 as u64)); - let mut x232: u64 = 0; - let mut x233: u64 = 0; - fp_mulx_u64(&mut x232, &mut x233, x222, 0x8508bfffffffffff); - let mut x234: u64 = 0; - let mut x235: u64 = 0; - fp_mulx_u64(&mut x234, &mut x235, x232, 0x1ae3a4617c510ea); - let mut x236: u64 = 0; - let mut x237: u64 = 0; - fp_mulx_u64(&mut x236, &mut x237, x232, 0xc63b05c06ca1493b); - let mut x238: u64 = 0; - let mut x239: u64 = 0; - fp_mulx_u64(&mut x238, &mut x239, x232, 0x1a22d9f300f5138f); - let mut x240: u64 = 0; - let mut x241: u64 = 0; - fp_mulx_u64(&mut x240, &mut x241, x232, 0x1ef3622fba094800); - let mut x242: u64 = 0; - let mut x243: u64 = 0; - fp_mulx_u64(&mut x242, &mut x243, x232, 0x170b5d4430000000); - let mut x244: u64 = 0; - let mut x245: u64 = 0; - fp_mulx_u64(&mut x244, &mut x245, x232, 0x8508c00000000001); - let mut x246: u64 = 0; - let mut x247: FpU1 = 0; - fp_addcarryx_u64(&mut x246, &mut x247, 0x0, x245, x242); - let mut x248: u64 = 0; - let mut x249: FpU1 = 0; - fp_addcarryx_u64(&mut x248, &mut x249, x247, x243, x240); - let mut x250: u64 = 0; - let mut x251: FpU1 = 0; - fp_addcarryx_u64(&mut x250, &mut x251, x249, x241, x238); - let mut x252: u64 = 0; - let mut x253: FpU1 = 0; - fp_addcarryx_u64(&mut x252, &mut x253, x251, x239, x236); - let mut x254: u64 = 0; - let mut x255: FpU1 = 0; - fp_addcarryx_u64(&mut x254, &mut x255, x253, x237, x234); - let mut x256: u64 = 0; - let mut x257: FpU1 = 0; - fp_addcarryx_u64(&mut x256, &mut x257, 0x0, x222, x244); - let mut x258: u64 = 0; - let mut x259: FpU1 = 0; - fp_addcarryx_u64(&mut x258, &mut x259, x257, x224, x246); - let mut x260: u64 = 0; - let mut x261: FpU1 = 0; - fp_addcarryx_u64(&mut x260, &mut x261, x259, x226, x248); - let mut x262: u64 = 0; - let mut x263: FpU1 = 0; - fp_addcarryx_u64(&mut x262, &mut x263, x261, x228, x250); - let mut x264: u64 = 0; - let mut x265: FpU1 = 0; - fp_addcarryx_u64(&mut x264, &mut x265, x263, x230, x252); - let mut x266: u64 = 0; - let mut x267: FpU1 = 0; - fp_addcarryx_u64( - &mut x266, - &mut x267, - x265, - ((x231 as u64) + ((x221 as u64) + ((x209 as u64) + x189))), - x254, - ); - let x268: u64 = ((x267 as u64) + ((x255 as u64) + x235)); - let mut x269: u64 = 0; - let mut x270: FpU1 = 0; - fp_subborrowx_u64(&mut x269, &mut x270, 0x0, x258, 0x8508c00000000001); - let mut x271: u64 = 0; - let mut x272: FpU1 = 0; - fp_subborrowx_u64(&mut x271, &mut x272, x270, x260, 0x170b5d4430000000); - let mut x273: u64 = 0; - let mut x274: FpU1 = 0; - fp_subborrowx_u64(&mut x273, &mut x274, x272, x262, 0x1ef3622fba094800); - let mut x275: u64 = 0; - let mut x276: FpU1 = 0; - fp_subborrowx_u64(&mut x275, &mut x276, x274, x264, 0x1a22d9f300f5138f); - let mut x277: u64 = 0; - let mut x278: FpU1 = 0; - fp_subborrowx_u64(&mut x277, &mut x278, x276, x266, 0xc63b05c06ca1493b); - let mut x279: u64 = 0; - let mut x280: FpU1 = 0; - fp_subborrowx_u64(&mut x279, &mut x280, x278, x268, 0x1ae3a4617c510ea); - let mut x281: u64 = 0; - let mut x282: FpU1 = 0; - fp_subborrowx_u64(&mut x281, &mut x282, x280, (0x0 as u64), (0x0 as u64)); - let mut x283: u64 = 0; - fp_cmovznz_u64(&mut x283, x282, x269, x258); - let mut x284: u64 = 0; - fp_cmovznz_u64(&mut x284, x282, x271, x260); - let mut x285: u64 = 0; - fp_cmovznz_u64(&mut x285, x282, x273, x262); - let mut x286: u64 = 0; - fp_cmovznz_u64(&mut x286, x282, x275, x264); - let mut x287: u64 = 0; - fp_cmovznz_u64(&mut x287, x282, x277, x266); - let mut x288: u64 = 0; - fp_cmovznz_u64(&mut x288, x282, x279, x268); - out1[0] = x283; - out1[1] = x284; - out1[2] = x285; - out1[3] = x286; - out1[4] = x287; - out1[5] = x288; -} - -/// The function fp_to_montgomery translates a field element into the Montgomery domain. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// Postconditions: -/// eval (from_montgomery out1) mod m = eval arg1 mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_to_montgomery( - out1: &mut FpMontgomeryDomainFieldElement, - arg1: &FpNonMontgomeryDomainFieldElement, -) { - let x1: u64 = (arg1[1]); - let x2: u64 = (arg1[2]); - let x3: u64 = (arg1[3]); - let x4: u64 = (arg1[4]); - let x5: u64 = (arg1[5]); - let x6: u64 = (arg1[0]); - let mut x7: u64 = 0; - let mut x8: u64 = 0; - fp_mulx_u64(&mut x7, &mut x8, x6, 0x6dfccb1e914b88); - let mut x9: u64 = 0; - let mut x10: u64 = 0; - fp_mulx_u64(&mut x9, &mut x10, x6, 0x837e92f041790bf9); - let mut x11: u64 = 0; - let mut x12: u64 = 0; - fp_mulx_u64(&mut x11, &mut x12, x6, 0xbfdf7d03827dc3ac); - let mut x13: u64 = 0; - let mut x14: u64 = 0; - fp_mulx_u64(&mut x13, &mut x14, x6, 0x22a5f11162d6b46d); - let mut x15: u64 = 0; - let mut x16: u64 = 0; - fp_mulx_u64(&mut x15, &mut x16, x6, 0x329fcaab00431b1); - let mut x17: u64 = 0; - let mut x18: u64 = 0; - fp_mulx_u64(&mut x17, &mut x18, x6, 0xb786686c9400cd22); - let mut x19: u64 = 0; - let mut x20: FpU1 = 0; - fp_addcarryx_u64(&mut x19, &mut x20, 0x0, x18, x15); - let mut x21: u64 = 0; - let mut x22: FpU1 = 0; - fp_addcarryx_u64(&mut x21, &mut x22, x20, x16, x13); - let mut x23: u64 = 0; - let mut x24: FpU1 = 0; - fp_addcarryx_u64(&mut x23, &mut x24, x22, x14, x11); - let mut x25: u64 = 0; - let mut x26: FpU1 = 0; - fp_addcarryx_u64(&mut x25, &mut x26, x24, x12, x9); - let mut x27: u64 = 0; - let mut x28: FpU1 = 0; - fp_addcarryx_u64(&mut x27, &mut x28, x26, x10, x7); - let mut x29: u64 = 0; - let mut x30: u64 = 0; - fp_mulx_u64(&mut x29, &mut x30, x17, 0x8508bfffffffffff); - let mut x31: u64 = 0; - let mut x32: u64 = 0; - fp_mulx_u64(&mut x31, &mut x32, x29, 0x1ae3a4617c510ea); - let mut x33: u64 = 0; - let mut x34: u64 = 0; - fp_mulx_u64(&mut x33, &mut x34, x29, 0xc63b05c06ca1493b); - let mut x35: u64 = 0; - let mut x36: u64 = 0; - fp_mulx_u64(&mut x35, &mut x36, x29, 0x1a22d9f300f5138f); - let mut x37: u64 = 0; - let mut x38: u64 = 0; - fp_mulx_u64(&mut x37, &mut x38, x29, 0x1ef3622fba094800); - let mut x39: u64 = 0; - let mut x40: u64 = 0; - fp_mulx_u64(&mut x39, &mut x40, x29, 0x170b5d4430000000); - let mut x41: u64 = 0; - let mut x42: u64 = 0; - fp_mulx_u64(&mut x41, &mut x42, x29, 0x8508c00000000001); - let mut x43: u64 = 0; - let mut x44: FpU1 = 0; - fp_addcarryx_u64(&mut x43, &mut x44, 0x0, x42, x39); - let mut x45: u64 = 0; - let mut x46: FpU1 = 0; - fp_addcarryx_u64(&mut x45, &mut x46, x44, x40, x37); - let mut x47: u64 = 0; - let mut x48: FpU1 = 0; - fp_addcarryx_u64(&mut x47, &mut x48, x46, x38, x35); - let mut x49: u64 = 0; - let mut x50: FpU1 = 0; - fp_addcarryx_u64(&mut x49, &mut x50, x48, x36, x33); - let mut x51: u64 = 0; - let mut x52: FpU1 = 0; - fp_addcarryx_u64(&mut x51, &mut x52, x50, x34, x31); - let mut x53: u64 = 0; - let mut x54: FpU1 = 0; - fp_addcarryx_u64(&mut x53, &mut x54, 0x0, x17, x41); - let mut x55: u64 = 0; - let mut x56: FpU1 = 0; - fp_addcarryx_u64(&mut x55, &mut x56, x54, x19, x43); - let mut x57: u64 = 0; - let mut x58: FpU1 = 0; - fp_addcarryx_u64(&mut x57, &mut x58, x56, x21, x45); - let mut x59: u64 = 0; - let mut x60: FpU1 = 0; - fp_addcarryx_u64(&mut x59, &mut x60, x58, x23, x47); - let mut x61: u64 = 0; - let mut x62: FpU1 = 0; - fp_addcarryx_u64(&mut x61, &mut x62, x60, x25, x49); - let mut x63: u64 = 0; - let mut x64: FpU1 = 0; - fp_addcarryx_u64(&mut x63, &mut x64, x62, x27, x51); - let mut x65: u64 = 0; - let mut x66: u64 = 0; - fp_mulx_u64(&mut x65, &mut x66, x1, 0x6dfccb1e914b88); - let mut x67: u64 = 0; - let mut x68: u64 = 0; - fp_mulx_u64(&mut x67, &mut x68, x1, 0x837e92f041790bf9); - let mut x69: u64 = 0; - let mut x70: u64 = 0; - fp_mulx_u64(&mut x69, &mut x70, x1, 0xbfdf7d03827dc3ac); - let mut x71: u64 = 0; - let mut x72: u64 = 0; - fp_mulx_u64(&mut x71, &mut x72, x1, 0x22a5f11162d6b46d); - let mut x73: u64 = 0; - let mut x74: u64 = 0; - fp_mulx_u64(&mut x73, &mut x74, x1, 0x329fcaab00431b1); - let mut x75: u64 = 0; - let mut x76: u64 = 0; - fp_mulx_u64(&mut x75, &mut x76, x1, 0xb786686c9400cd22); - let mut x77: u64 = 0; - let mut x78: FpU1 = 0; - fp_addcarryx_u64(&mut x77, &mut x78, 0x0, x76, x73); - let mut x79: u64 = 0; - let mut x80: FpU1 = 0; - fp_addcarryx_u64(&mut x79, &mut x80, x78, x74, x71); - let mut x81: u64 = 0; - let mut x82: FpU1 = 0; - fp_addcarryx_u64(&mut x81, &mut x82, x80, x72, x69); - let mut x83: u64 = 0; - let mut x84: FpU1 = 0; - fp_addcarryx_u64(&mut x83, &mut x84, x82, x70, x67); - let mut x85: u64 = 0; - let mut x86: FpU1 = 0; - fp_addcarryx_u64(&mut x85, &mut x86, x84, x68, x65); - let mut x87: u64 = 0; - let mut x88: FpU1 = 0; - fp_addcarryx_u64(&mut x87, &mut x88, 0x0, x55, x75); - let mut x89: u64 = 0; - let mut x90: FpU1 = 0; - fp_addcarryx_u64(&mut x89, &mut x90, x88, x57, x77); - let mut x91: u64 = 0; - let mut x92: FpU1 = 0; - fp_addcarryx_u64(&mut x91, &mut x92, x90, x59, x79); - let mut x93: u64 = 0; - let mut x94: FpU1 = 0; - fp_addcarryx_u64(&mut x93, &mut x94, x92, x61, x81); - let mut x95: u64 = 0; - let mut x96: FpU1 = 0; - fp_addcarryx_u64(&mut x95, &mut x96, x94, x63, x83); - let mut x97: u64 = 0; - let mut x98: FpU1 = 0; - fp_addcarryx_u64( - &mut x97, - &mut x98, - x96, - (((x64 as u64) + ((x28 as u64) + x8)) + ((x52 as u64) + x32)), - x85, - ); - let mut x99: u64 = 0; - let mut x100: u64 = 0; - fp_mulx_u64(&mut x99, &mut x100, x87, 0x8508bfffffffffff); - let mut x101: u64 = 0; - let mut x102: u64 = 0; - fp_mulx_u64(&mut x101, &mut x102, x99, 0x1ae3a4617c510ea); - let mut x103: u64 = 0; - let mut x104: u64 = 0; - fp_mulx_u64(&mut x103, &mut x104, x99, 0xc63b05c06ca1493b); - let mut x105: u64 = 0; - let mut x106: u64 = 0; - fp_mulx_u64(&mut x105, &mut x106, x99, 0x1a22d9f300f5138f); - let mut x107: u64 = 0; - let mut x108: u64 = 0; - fp_mulx_u64(&mut x107, &mut x108, x99, 0x1ef3622fba094800); - let mut x109: u64 = 0; - let mut x110: u64 = 0; - fp_mulx_u64(&mut x109, &mut x110, x99, 0x170b5d4430000000); - let mut x111: u64 = 0; - let mut x112: u64 = 0; - fp_mulx_u64(&mut x111, &mut x112, x99, 0x8508c00000000001); - let mut x113: u64 = 0; - let mut x114: FpU1 = 0; - fp_addcarryx_u64(&mut x113, &mut x114, 0x0, x112, x109); - let mut x115: u64 = 0; - let mut x116: FpU1 = 0; - fp_addcarryx_u64(&mut x115, &mut x116, x114, x110, x107); - let mut x117: u64 = 0; - let mut x118: FpU1 = 0; - fp_addcarryx_u64(&mut x117, &mut x118, x116, x108, x105); - let mut x119: u64 = 0; - let mut x120: FpU1 = 0; - fp_addcarryx_u64(&mut x119, &mut x120, x118, x106, x103); - let mut x121: u64 = 0; - let mut x122: FpU1 = 0; - fp_addcarryx_u64(&mut x121, &mut x122, x120, x104, x101); - let mut x123: u64 = 0; - let mut x124: FpU1 = 0; - fp_addcarryx_u64(&mut x123, &mut x124, 0x0, x87, x111); - let mut x125: u64 = 0; - let mut x126: FpU1 = 0; - fp_addcarryx_u64(&mut x125, &mut x126, x124, x89, x113); - let mut x127: u64 = 0; - let mut x128: FpU1 = 0; - fp_addcarryx_u64(&mut x127, &mut x128, x126, x91, x115); - let mut x129: u64 = 0; - let mut x130: FpU1 = 0; - fp_addcarryx_u64(&mut x129, &mut x130, x128, x93, x117); - let mut x131: u64 = 0; - let mut x132: FpU1 = 0; - fp_addcarryx_u64(&mut x131, &mut x132, x130, x95, x119); - let mut x133: u64 = 0; - let mut x134: FpU1 = 0; - fp_addcarryx_u64(&mut x133, &mut x134, x132, x97, x121); - let mut x135: u64 = 0; - let mut x136: u64 = 0; - fp_mulx_u64(&mut x135, &mut x136, x2, 0x6dfccb1e914b88); - let mut x137: u64 = 0; - let mut x138: u64 = 0; - fp_mulx_u64(&mut x137, &mut x138, x2, 0x837e92f041790bf9); - let mut x139: u64 = 0; - let mut x140: u64 = 0; - fp_mulx_u64(&mut x139, &mut x140, x2, 0xbfdf7d03827dc3ac); - let mut x141: u64 = 0; - let mut x142: u64 = 0; - fp_mulx_u64(&mut x141, &mut x142, x2, 0x22a5f11162d6b46d); - let mut x143: u64 = 0; - let mut x144: u64 = 0; - fp_mulx_u64(&mut x143, &mut x144, x2, 0x329fcaab00431b1); - let mut x145: u64 = 0; - let mut x146: u64 = 0; - fp_mulx_u64(&mut x145, &mut x146, x2, 0xb786686c9400cd22); - let mut x147: u64 = 0; - let mut x148: FpU1 = 0; - fp_addcarryx_u64(&mut x147, &mut x148, 0x0, x146, x143); - let mut x149: u64 = 0; - let mut x150: FpU1 = 0; - fp_addcarryx_u64(&mut x149, &mut x150, x148, x144, x141); - let mut x151: u64 = 0; - let mut x152: FpU1 = 0; - fp_addcarryx_u64(&mut x151, &mut x152, x150, x142, x139); - let mut x153: u64 = 0; - let mut x154: FpU1 = 0; - fp_addcarryx_u64(&mut x153, &mut x154, x152, x140, x137); - let mut x155: u64 = 0; - let mut x156: FpU1 = 0; - fp_addcarryx_u64(&mut x155, &mut x156, x154, x138, x135); - let mut x157: u64 = 0; - let mut x158: FpU1 = 0; - fp_addcarryx_u64(&mut x157, &mut x158, 0x0, x125, x145); - let mut x159: u64 = 0; - let mut x160: FpU1 = 0; - fp_addcarryx_u64(&mut x159, &mut x160, x158, x127, x147); - let mut x161: u64 = 0; - let mut x162: FpU1 = 0; - fp_addcarryx_u64(&mut x161, &mut x162, x160, x129, x149); - let mut x163: u64 = 0; - let mut x164: FpU1 = 0; - fp_addcarryx_u64(&mut x163, &mut x164, x162, x131, x151); - let mut x165: u64 = 0; - let mut x166: FpU1 = 0; - fp_addcarryx_u64(&mut x165, &mut x166, x164, x133, x153); - let mut x167: u64 = 0; - let mut x168: FpU1 = 0; - fp_addcarryx_u64( - &mut x167, - &mut x168, - x166, - (((x134 as u64) + ((x98 as u64) + ((x86 as u64) + x66))) + ((x122 as u64) + x102)), - x155, - ); - let mut x169: u64 = 0; - let mut x170: u64 = 0; - fp_mulx_u64(&mut x169, &mut x170, x157, 0x8508bfffffffffff); - let mut x171: u64 = 0; - let mut x172: u64 = 0; - fp_mulx_u64(&mut x171, &mut x172, x169, 0x1ae3a4617c510ea); - let mut x173: u64 = 0; - let mut x174: u64 = 0; - fp_mulx_u64(&mut x173, &mut x174, x169, 0xc63b05c06ca1493b); - let mut x175: u64 = 0; - let mut x176: u64 = 0; - fp_mulx_u64(&mut x175, &mut x176, x169, 0x1a22d9f300f5138f); - let mut x177: u64 = 0; - let mut x178: u64 = 0; - fp_mulx_u64(&mut x177, &mut x178, x169, 0x1ef3622fba094800); - let mut x179: u64 = 0; - let mut x180: u64 = 0; - fp_mulx_u64(&mut x179, &mut x180, x169, 0x170b5d4430000000); - let mut x181: u64 = 0; - let mut x182: u64 = 0; - fp_mulx_u64(&mut x181, &mut x182, x169, 0x8508c00000000001); - let mut x183: u64 = 0; - let mut x184: FpU1 = 0; - fp_addcarryx_u64(&mut x183, &mut x184, 0x0, x182, x179); - let mut x185: u64 = 0; - let mut x186: FpU1 = 0; - fp_addcarryx_u64(&mut x185, &mut x186, x184, x180, x177); - let mut x187: u64 = 0; - let mut x188: FpU1 = 0; - fp_addcarryx_u64(&mut x187, &mut x188, x186, x178, x175); - let mut x189: u64 = 0; - let mut x190: FpU1 = 0; - fp_addcarryx_u64(&mut x189, &mut x190, x188, x176, x173); - let mut x191: u64 = 0; - let mut x192: FpU1 = 0; - fp_addcarryx_u64(&mut x191, &mut x192, x190, x174, x171); - let mut x193: u64 = 0; - let mut x194: FpU1 = 0; - fp_addcarryx_u64(&mut x193, &mut x194, 0x0, x157, x181); - let mut x195: u64 = 0; - let mut x196: FpU1 = 0; - fp_addcarryx_u64(&mut x195, &mut x196, x194, x159, x183); - let mut x197: u64 = 0; - let mut x198: FpU1 = 0; - fp_addcarryx_u64(&mut x197, &mut x198, x196, x161, x185); - let mut x199: u64 = 0; - let mut x200: FpU1 = 0; - fp_addcarryx_u64(&mut x199, &mut x200, x198, x163, x187); - let mut x201: u64 = 0; - let mut x202: FpU1 = 0; - fp_addcarryx_u64(&mut x201, &mut x202, x200, x165, x189); - let mut x203: u64 = 0; - let mut x204: FpU1 = 0; - fp_addcarryx_u64(&mut x203, &mut x204, x202, x167, x191); - let mut x205: u64 = 0; - let mut x206: u64 = 0; - fp_mulx_u64(&mut x205, &mut x206, x3, 0x6dfccb1e914b88); - let mut x207: u64 = 0; - let mut x208: u64 = 0; - fp_mulx_u64(&mut x207, &mut x208, x3, 0x837e92f041790bf9); - let mut x209: u64 = 0; - let mut x210: u64 = 0; - fp_mulx_u64(&mut x209, &mut x210, x3, 0xbfdf7d03827dc3ac); - let mut x211: u64 = 0; - let mut x212: u64 = 0; - fp_mulx_u64(&mut x211, &mut x212, x3, 0x22a5f11162d6b46d); - let mut x213: u64 = 0; - let mut x214: u64 = 0; - fp_mulx_u64(&mut x213, &mut x214, x3, 0x329fcaab00431b1); - let mut x215: u64 = 0; - let mut x216: u64 = 0; - fp_mulx_u64(&mut x215, &mut x216, x3, 0xb786686c9400cd22); - let mut x217: u64 = 0; - let mut x218: FpU1 = 0; - fp_addcarryx_u64(&mut x217, &mut x218, 0x0, x216, x213); - let mut x219: u64 = 0; - let mut x220: FpU1 = 0; - fp_addcarryx_u64(&mut x219, &mut x220, x218, x214, x211); - let mut x221: u64 = 0; - let mut x222: FpU1 = 0; - fp_addcarryx_u64(&mut x221, &mut x222, x220, x212, x209); - let mut x223: u64 = 0; - let mut x224: FpU1 = 0; - fp_addcarryx_u64(&mut x223, &mut x224, x222, x210, x207); - let mut x225: u64 = 0; - let mut x226: FpU1 = 0; - fp_addcarryx_u64(&mut x225, &mut x226, x224, x208, x205); - let mut x227: u64 = 0; - let mut x228: FpU1 = 0; - fp_addcarryx_u64(&mut x227, &mut x228, 0x0, x195, x215); - let mut x229: u64 = 0; - let mut x230: FpU1 = 0; - fp_addcarryx_u64(&mut x229, &mut x230, x228, x197, x217); - let mut x231: u64 = 0; - let mut x232: FpU1 = 0; - fp_addcarryx_u64(&mut x231, &mut x232, x230, x199, x219); - let mut x233: u64 = 0; - let mut x234: FpU1 = 0; - fp_addcarryx_u64(&mut x233, &mut x234, x232, x201, x221); - let mut x235: u64 = 0; - let mut x236: FpU1 = 0; - fp_addcarryx_u64(&mut x235, &mut x236, x234, x203, x223); - let mut x237: u64 = 0; - let mut x238: FpU1 = 0; - fp_addcarryx_u64( - &mut x237, - &mut x238, - x236, - (((x204 as u64) + ((x168 as u64) + ((x156 as u64) + x136))) + ((x192 as u64) + x172)), - x225, - ); - let mut x239: u64 = 0; - let mut x240: u64 = 0; - fp_mulx_u64(&mut x239, &mut x240, x227, 0x8508bfffffffffff); - let mut x241: u64 = 0; - let mut x242: u64 = 0; - fp_mulx_u64(&mut x241, &mut x242, x239, 0x1ae3a4617c510ea); - let mut x243: u64 = 0; - let mut x244: u64 = 0; - fp_mulx_u64(&mut x243, &mut x244, x239, 0xc63b05c06ca1493b); - let mut x245: u64 = 0; - let mut x246: u64 = 0; - fp_mulx_u64(&mut x245, &mut x246, x239, 0x1a22d9f300f5138f); - let mut x247: u64 = 0; - let mut x248: u64 = 0; - fp_mulx_u64(&mut x247, &mut x248, x239, 0x1ef3622fba094800); - let mut x249: u64 = 0; - let mut x250: u64 = 0; - fp_mulx_u64(&mut x249, &mut x250, x239, 0x170b5d4430000000); - let mut x251: u64 = 0; - let mut x252: u64 = 0; - fp_mulx_u64(&mut x251, &mut x252, x239, 0x8508c00000000001); - let mut x253: u64 = 0; - let mut x254: FpU1 = 0; - fp_addcarryx_u64(&mut x253, &mut x254, 0x0, x252, x249); - let mut x255: u64 = 0; - let mut x256: FpU1 = 0; - fp_addcarryx_u64(&mut x255, &mut x256, x254, x250, x247); - let mut x257: u64 = 0; - let mut x258: FpU1 = 0; - fp_addcarryx_u64(&mut x257, &mut x258, x256, x248, x245); - let mut x259: u64 = 0; - let mut x260: FpU1 = 0; - fp_addcarryx_u64(&mut x259, &mut x260, x258, x246, x243); - let mut x261: u64 = 0; - let mut x262: FpU1 = 0; - fp_addcarryx_u64(&mut x261, &mut x262, x260, x244, x241); - let mut x263: u64 = 0; - let mut x264: FpU1 = 0; - fp_addcarryx_u64(&mut x263, &mut x264, 0x0, x227, x251); - let mut x265: u64 = 0; - let mut x266: FpU1 = 0; - fp_addcarryx_u64(&mut x265, &mut x266, x264, x229, x253); - let mut x267: u64 = 0; - let mut x268: FpU1 = 0; - fp_addcarryx_u64(&mut x267, &mut x268, x266, x231, x255); - let mut x269: u64 = 0; - let mut x270: FpU1 = 0; - fp_addcarryx_u64(&mut x269, &mut x270, x268, x233, x257); - let mut x271: u64 = 0; - let mut x272: FpU1 = 0; - fp_addcarryx_u64(&mut x271, &mut x272, x270, x235, x259); - let mut x273: u64 = 0; - let mut x274: FpU1 = 0; - fp_addcarryx_u64(&mut x273, &mut x274, x272, x237, x261); - let mut x275: u64 = 0; - let mut x276: u64 = 0; - fp_mulx_u64(&mut x275, &mut x276, x4, 0x6dfccb1e914b88); - let mut x277: u64 = 0; - let mut x278: u64 = 0; - fp_mulx_u64(&mut x277, &mut x278, x4, 0x837e92f041790bf9); - let mut x279: u64 = 0; - let mut x280: u64 = 0; - fp_mulx_u64(&mut x279, &mut x280, x4, 0xbfdf7d03827dc3ac); - let mut x281: u64 = 0; - let mut x282: u64 = 0; - fp_mulx_u64(&mut x281, &mut x282, x4, 0x22a5f11162d6b46d); - let mut x283: u64 = 0; - let mut x284: u64 = 0; - fp_mulx_u64(&mut x283, &mut x284, x4, 0x329fcaab00431b1); - let mut x285: u64 = 0; - let mut x286: u64 = 0; - fp_mulx_u64(&mut x285, &mut x286, x4, 0xb786686c9400cd22); - let mut x287: u64 = 0; - let mut x288: FpU1 = 0; - fp_addcarryx_u64(&mut x287, &mut x288, 0x0, x286, x283); - let mut x289: u64 = 0; - let mut x290: FpU1 = 0; - fp_addcarryx_u64(&mut x289, &mut x290, x288, x284, x281); - let mut x291: u64 = 0; - let mut x292: FpU1 = 0; - fp_addcarryx_u64(&mut x291, &mut x292, x290, x282, x279); - let mut x293: u64 = 0; - let mut x294: FpU1 = 0; - fp_addcarryx_u64(&mut x293, &mut x294, x292, x280, x277); - let mut x295: u64 = 0; - let mut x296: FpU1 = 0; - fp_addcarryx_u64(&mut x295, &mut x296, x294, x278, x275); - let mut x297: u64 = 0; - let mut x298: FpU1 = 0; - fp_addcarryx_u64(&mut x297, &mut x298, 0x0, x265, x285); - let mut x299: u64 = 0; - let mut x300: FpU1 = 0; - fp_addcarryx_u64(&mut x299, &mut x300, x298, x267, x287); - let mut x301: u64 = 0; - let mut x302: FpU1 = 0; - fp_addcarryx_u64(&mut x301, &mut x302, x300, x269, x289); - let mut x303: u64 = 0; - let mut x304: FpU1 = 0; - fp_addcarryx_u64(&mut x303, &mut x304, x302, x271, x291); - let mut x305: u64 = 0; - let mut x306: FpU1 = 0; - fp_addcarryx_u64(&mut x305, &mut x306, x304, x273, x293); - let mut x307: u64 = 0; - let mut x308: FpU1 = 0; - fp_addcarryx_u64( - &mut x307, - &mut x308, - x306, - (((x274 as u64) + ((x238 as u64) + ((x226 as u64) + x206))) + ((x262 as u64) + x242)), - x295, - ); - let mut x309: u64 = 0; - let mut x310: u64 = 0; - fp_mulx_u64(&mut x309, &mut x310, x297, 0x8508bfffffffffff); - let mut x311: u64 = 0; - let mut x312: u64 = 0; - fp_mulx_u64(&mut x311, &mut x312, x309, 0x1ae3a4617c510ea); - let mut x313: u64 = 0; - let mut x314: u64 = 0; - fp_mulx_u64(&mut x313, &mut x314, x309, 0xc63b05c06ca1493b); - let mut x315: u64 = 0; - let mut x316: u64 = 0; - fp_mulx_u64(&mut x315, &mut x316, x309, 0x1a22d9f300f5138f); - let mut x317: u64 = 0; - let mut x318: u64 = 0; - fp_mulx_u64(&mut x317, &mut x318, x309, 0x1ef3622fba094800); - let mut x319: u64 = 0; - let mut x320: u64 = 0; - fp_mulx_u64(&mut x319, &mut x320, x309, 0x170b5d4430000000); - let mut x321: u64 = 0; - let mut x322: u64 = 0; - fp_mulx_u64(&mut x321, &mut x322, x309, 0x8508c00000000001); - let mut x323: u64 = 0; - let mut x324: FpU1 = 0; - fp_addcarryx_u64(&mut x323, &mut x324, 0x0, x322, x319); - let mut x325: u64 = 0; - let mut x326: FpU1 = 0; - fp_addcarryx_u64(&mut x325, &mut x326, x324, x320, x317); - let mut x327: u64 = 0; - let mut x328: FpU1 = 0; - fp_addcarryx_u64(&mut x327, &mut x328, x326, x318, x315); - let mut x329: u64 = 0; - let mut x330: FpU1 = 0; - fp_addcarryx_u64(&mut x329, &mut x330, x328, x316, x313); - let mut x331: u64 = 0; - let mut x332: FpU1 = 0; - fp_addcarryx_u64(&mut x331, &mut x332, x330, x314, x311); - let mut x333: u64 = 0; - let mut x334: FpU1 = 0; - fp_addcarryx_u64(&mut x333, &mut x334, 0x0, x297, x321); - let mut x335: u64 = 0; - let mut x336: FpU1 = 0; - fp_addcarryx_u64(&mut x335, &mut x336, x334, x299, x323); - let mut x337: u64 = 0; - let mut x338: FpU1 = 0; - fp_addcarryx_u64(&mut x337, &mut x338, x336, x301, x325); - let mut x339: u64 = 0; - let mut x340: FpU1 = 0; - fp_addcarryx_u64(&mut x339, &mut x340, x338, x303, x327); - let mut x341: u64 = 0; - let mut x342: FpU1 = 0; - fp_addcarryx_u64(&mut x341, &mut x342, x340, x305, x329); - let mut x343: u64 = 0; - let mut x344: FpU1 = 0; - fp_addcarryx_u64(&mut x343, &mut x344, x342, x307, x331); - let mut x345: u64 = 0; - let mut x346: u64 = 0; - fp_mulx_u64(&mut x345, &mut x346, x5, 0x6dfccb1e914b88); - let mut x347: u64 = 0; - let mut x348: u64 = 0; - fp_mulx_u64(&mut x347, &mut x348, x5, 0x837e92f041790bf9); - let mut x349: u64 = 0; - let mut x350: u64 = 0; - fp_mulx_u64(&mut x349, &mut x350, x5, 0xbfdf7d03827dc3ac); - let mut x351: u64 = 0; - let mut x352: u64 = 0; - fp_mulx_u64(&mut x351, &mut x352, x5, 0x22a5f11162d6b46d); - let mut x353: u64 = 0; - let mut x354: u64 = 0; - fp_mulx_u64(&mut x353, &mut x354, x5, 0x329fcaab00431b1); - let mut x355: u64 = 0; - let mut x356: u64 = 0; - fp_mulx_u64(&mut x355, &mut x356, x5, 0xb786686c9400cd22); - let mut x357: u64 = 0; - let mut x358: FpU1 = 0; - fp_addcarryx_u64(&mut x357, &mut x358, 0x0, x356, x353); - let mut x359: u64 = 0; - let mut x360: FpU1 = 0; - fp_addcarryx_u64(&mut x359, &mut x360, x358, x354, x351); - let mut x361: u64 = 0; - let mut x362: FpU1 = 0; - fp_addcarryx_u64(&mut x361, &mut x362, x360, x352, x349); - let mut x363: u64 = 0; - let mut x364: FpU1 = 0; - fp_addcarryx_u64(&mut x363, &mut x364, x362, x350, x347); - let mut x365: u64 = 0; - let mut x366: FpU1 = 0; - fp_addcarryx_u64(&mut x365, &mut x366, x364, x348, x345); - let mut x367: u64 = 0; - let mut x368: FpU1 = 0; - fp_addcarryx_u64(&mut x367, &mut x368, 0x0, x335, x355); - let mut x369: u64 = 0; - let mut x370: FpU1 = 0; - fp_addcarryx_u64(&mut x369, &mut x370, x368, x337, x357); - let mut x371: u64 = 0; - let mut x372: FpU1 = 0; - fp_addcarryx_u64(&mut x371, &mut x372, x370, x339, x359); - let mut x373: u64 = 0; - let mut x374: FpU1 = 0; - fp_addcarryx_u64(&mut x373, &mut x374, x372, x341, x361); - let mut x375: u64 = 0; - let mut x376: FpU1 = 0; - fp_addcarryx_u64(&mut x375, &mut x376, x374, x343, x363); - let mut x377: u64 = 0; - let mut x378: FpU1 = 0; - fp_addcarryx_u64( - &mut x377, - &mut x378, - x376, - (((x344 as u64) + ((x308 as u64) + ((x296 as u64) + x276))) + ((x332 as u64) + x312)), - x365, - ); - let mut x379: u64 = 0; - let mut x380: u64 = 0; - fp_mulx_u64(&mut x379, &mut x380, x367, 0x8508bfffffffffff); - let mut x381: u64 = 0; - let mut x382: u64 = 0; - fp_mulx_u64(&mut x381, &mut x382, x379, 0x1ae3a4617c510ea); - let mut x383: u64 = 0; - let mut x384: u64 = 0; - fp_mulx_u64(&mut x383, &mut x384, x379, 0xc63b05c06ca1493b); - let mut x385: u64 = 0; - let mut x386: u64 = 0; - fp_mulx_u64(&mut x385, &mut x386, x379, 0x1a22d9f300f5138f); - let mut x387: u64 = 0; - let mut x388: u64 = 0; - fp_mulx_u64(&mut x387, &mut x388, x379, 0x1ef3622fba094800); - let mut x389: u64 = 0; - let mut x390: u64 = 0; - fp_mulx_u64(&mut x389, &mut x390, x379, 0x170b5d4430000000); - let mut x391: u64 = 0; - let mut x392: u64 = 0; - fp_mulx_u64(&mut x391, &mut x392, x379, 0x8508c00000000001); - let mut x393: u64 = 0; - let mut x394: FpU1 = 0; - fp_addcarryx_u64(&mut x393, &mut x394, 0x0, x392, x389); - let mut x395: u64 = 0; - let mut x396: FpU1 = 0; - fp_addcarryx_u64(&mut x395, &mut x396, x394, x390, x387); - let mut x397: u64 = 0; - let mut x398: FpU1 = 0; - fp_addcarryx_u64(&mut x397, &mut x398, x396, x388, x385); - let mut x399: u64 = 0; - let mut x400: FpU1 = 0; - fp_addcarryx_u64(&mut x399, &mut x400, x398, x386, x383); - let mut x401: u64 = 0; - let mut x402: FpU1 = 0; - fp_addcarryx_u64(&mut x401, &mut x402, x400, x384, x381); - let mut x403: u64 = 0; - let mut x404: FpU1 = 0; - fp_addcarryx_u64(&mut x403, &mut x404, 0x0, x367, x391); - let mut x405: u64 = 0; - let mut x406: FpU1 = 0; - fp_addcarryx_u64(&mut x405, &mut x406, x404, x369, x393); - let mut x407: u64 = 0; - let mut x408: FpU1 = 0; - fp_addcarryx_u64(&mut x407, &mut x408, x406, x371, x395); - let mut x409: u64 = 0; - let mut x410: FpU1 = 0; - fp_addcarryx_u64(&mut x409, &mut x410, x408, x373, x397); - let mut x411: u64 = 0; - let mut x412: FpU1 = 0; - fp_addcarryx_u64(&mut x411, &mut x412, x410, x375, x399); - let mut x413: u64 = 0; - let mut x414: FpU1 = 0; - fp_addcarryx_u64(&mut x413, &mut x414, x412, x377, x401); - let x415: u64 = - (((x414 as u64) + ((x378 as u64) + ((x366 as u64) + x346))) + ((x402 as u64) + x382)); - let mut x416: u64 = 0; - let mut x417: FpU1 = 0; - fp_subborrowx_u64(&mut x416, &mut x417, 0x0, x405, 0x8508c00000000001); - let mut x418: u64 = 0; - let mut x419: FpU1 = 0; - fp_subborrowx_u64(&mut x418, &mut x419, x417, x407, 0x170b5d4430000000); - let mut x420: u64 = 0; - let mut x421: FpU1 = 0; - fp_subborrowx_u64(&mut x420, &mut x421, x419, x409, 0x1ef3622fba094800); - let mut x422: u64 = 0; - let mut x423: FpU1 = 0; - fp_subborrowx_u64(&mut x422, &mut x423, x421, x411, 0x1a22d9f300f5138f); - let mut x424: u64 = 0; - let mut x425: FpU1 = 0; - fp_subborrowx_u64(&mut x424, &mut x425, x423, x413, 0xc63b05c06ca1493b); - let mut x426: u64 = 0; - let mut x427: FpU1 = 0; - fp_subborrowx_u64(&mut x426, &mut x427, x425, x415, 0x1ae3a4617c510ea); - let mut x428: u64 = 0; - let mut x429: FpU1 = 0; - fp_subborrowx_u64(&mut x428, &mut x429, x427, (0x0 as u64), (0x0 as u64)); - let mut x430: u64 = 0; - fp_cmovznz_u64(&mut x430, x429, x416, x405); - let mut x431: u64 = 0; - fp_cmovznz_u64(&mut x431, x429, x418, x407); - let mut x432: u64 = 0; - fp_cmovznz_u64(&mut x432, x429, x420, x409); - let mut x433: u64 = 0; - fp_cmovznz_u64(&mut x433, x429, x422, x411); - let mut x434: u64 = 0; - fp_cmovznz_u64(&mut x434, x429, x424, x413); - let mut x435: u64 = 0; - fp_cmovznz_u64(&mut x435, x429, x426, x415); - out1[0] = x430; - out1[1] = x431; - out1[2] = x432; - out1[3] = x433; - out1[4] = x434; - out1[5] = x435; -} - -/// The function fp_nonzero outputs a single non-zero word if the input is non-zero and zero otherwise. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// Postconditions: -/// out1 = 0 ↔ eval (from_montgomery arg1) mod m = 0 -/// -/// Input Bounds: -/// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -/// Output Bounds: -/// out1: [0x0 ~> 0xffffffffffffffff] -pub fn fp_nonzero(out1: &mut u64, arg1: &[u64; 6]) { - let x1: u64 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5])))))); - *out1 = x1; -} - -/// The function fp_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]] -/// arg3: [[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]] -pub fn fp_selectznz(out1: &mut [u64; 6], arg1: FpU1, arg2: &[u64; 6], arg3: &[u64; 6]) { - let mut x1: u64 = 0; - fp_cmovznz_u64(&mut x1, arg1, (arg2[0]), (arg3[0])); - let mut x2: u64 = 0; - fp_cmovznz_u64(&mut x2, arg1, (arg2[1]), (arg3[1])); - let mut x3: u64 = 0; - fp_cmovznz_u64(&mut x3, arg1, (arg2[2]), (arg3[2])); - let mut x4: u64 = 0; - fp_cmovznz_u64(&mut x4, arg1, (arg2[3]), (arg3[3])); - let mut x5: u64 = 0; - fp_cmovznz_u64(&mut x5, arg1, (arg2[4]), (arg3[4])); - let mut x6: u64 = 0; - fp_cmovznz_u64(&mut x6, arg1, (arg2[5]), (arg3[5])); - out1[0] = x1; - out1[1] = x2; - out1[2] = x3; - out1[3] = x4; - out1[4] = x5; - out1[5] = x6; -} - -/// The function fp_to_bytes serializes a field element NOT in the Montgomery domain to bytes in little-endian order. -/// -/// Preconditions: -/// 0 ≤ eval arg1 < m -/// Postconditions: -/// out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..47] -/// -/// Input Bounds: -/// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0x1ffffffffffffff]] -/// 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 ~> 0x1]] -pub fn fp_to_bytes(out1: &mut [u8; 48], arg1: &[u64; 6]) { - let x1: u64 = (arg1[5]); - let x2: u64 = (arg1[4]); - let x3: u64 = (arg1[3]); - let x4: u64 = (arg1[2]); - let x5: u64 = (arg1[1]); - let x6: u64 = (arg1[0]); - let x7: u8 = ((x6 & (0xff as u64)) as u8); - let x8: u64 = (x6 >> 8); - let x9: u8 = ((x8 & (0xff as u64)) as u8); - let x10: u64 = (x8 >> 8); - let x11: u8 = ((x10 & (0xff as u64)) as u8); - let x12: u64 = (x10 >> 8); - let x13: u8 = ((x12 & (0xff as u64)) as u8); - let x14: u64 = (x12 >> 8); - let x15: u8 = ((x14 & (0xff as u64)) as u8); - let x16: u64 = (x14 >> 8); - let x17: u8 = ((x16 & (0xff as u64)) as u8); - let x18: u64 = (x16 >> 8); - let x19: u8 = ((x18 & (0xff as u64)) as u8); - let x20: u8 = ((x18 >> 8) as u8); - let x21: u8 = ((x5 & (0xff as u64)) as u8); - let x22: u64 = (x5 >> 8); - let x23: u8 = ((x22 & (0xff as u64)) as u8); - let x24: u64 = (x22 >> 8); - let x25: u8 = ((x24 & (0xff as u64)) as u8); - let x26: u64 = (x24 >> 8); - let x27: u8 = ((x26 & (0xff as u64)) as u8); - let x28: u64 = (x26 >> 8); - let x29: u8 = ((x28 & (0xff as u64)) as u8); - let x30: u64 = (x28 >> 8); - let x31: u8 = ((x30 & (0xff as u64)) as u8); - let x32: u64 = (x30 >> 8); - let x33: u8 = ((x32 & (0xff as u64)) as u8); - let x34: u8 = ((x32 >> 8) as u8); - let x35: u8 = ((x4 & (0xff as u64)) as u8); - let x36: u64 = (x4 >> 8); - let x37: u8 = ((x36 & (0xff as u64)) as u8); - let x38: u64 = (x36 >> 8); - let x39: u8 = ((x38 & (0xff as u64)) as u8); - let x40: u64 = (x38 >> 8); - let x41: u8 = ((x40 & (0xff as u64)) as u8); - let x42: u64 = (x40 >> 8); - let x43: u8 = ((x42 & (0xff as u64)) as u8); - let x44: u64 = (x42 >> 8); - let x45: u8 = ((x44 & (0xff as u64)) as u8); - let x46: u64 = (x44 >> 8); - let x47: u8 = ((x46 & (0xff as u64)) as u8); - let x48: u8 = ((x46 >> 8) as u8); - let x49: u8 = ((x3 & (0xff as u64)) as u8); - let x50: u64 = (x3 >> 8); - let x51: u8 = ((x50 & (0xff as u64)) as u8); - let x52: u64 = (x50 >> 8); - let x53: u8 = ((x52 & (0xff as u64)) as u8); - let x54: u64 = (x52 >> 8); - let x55: u8 = ((x54 & (0xff as u64)) as u8); - let x56: u64 = (x54 >> 8); - let x57: u8 = ((x56 & (0xff as u64)) as u8); - let x58: u64 = (x56 >> 8); - let x59: u8 = ((x58 & (0xff as u64)) as u8); - let x60: u64 = (x58 >> 8); - let x61: u8 = ((x60 & (0xff as u64)) as u8); - let x62: u8 = ((x60 >> 8) as u8); - let x63: u8 = ((x2 & (0xff as u64)) as u8); - let x64: u64 = (x2 >> 8); - let x65: u8 = ((x64 & (0xff as u64)) as u8); - let x66: u64 = (x64 >> 8); - let x67: u8 = ((x66 & (0xff as u64)) as u8); - let x68: u64 = (x66 >> 8); - let x69: u8 = ((x68 & (0xff as u64)) as u8); - let x70: u64 = (x68 >> 8); - let x71: u8 = ((x70 & (0xff as u64)) as u8); - let x72: u64 = (x70 >> 8); - let x73: u8 = ((x72 & (0xff as u64)) as u8); - let x74: u64 = (x72 >> 8); - let x75: u8 = ((x74 & (0xff as u64)) as u8); - let x76: u8 = ((x74 >> 8) as u8); - let x77: u8 = ((x1 & (0xff as u64)) as u8); - let x78: u64 = (x1 >> 8); - let x79: u8 = ((x78 & (0xff as u64)) as u8); - let x80: u64 = (x78 >> 8); - let x81: u8 = ((x80 & (0xff as u64)) as u8); - let x82: u64 = (x80 >> 8); - let x83: u8 = ((x82 & (0xff as u64)) as u8); - let x84: u64 = (x82 >> 8); - let x85: u8 = ((x84 & (0xff as u64)) as u8); - let x86: u64 = (x84 >> 8); - let x87: u8 = ((x86 & (0xff as u64)) as u8); - let x88: u64 = (x86 >> 8); - let x89: u8 = ((x88 & (0xff as u64)) as u8); - let x90: FpU1 = ((x88 >> 8) as FpU1); - out1[0] = x7; - out1[1] = x9; - out1[2] = x11; - out1[3] = x13; - out1[4] = x15; - out1[5] = x17; - out1[6] = x19; - out1[7] = x20; - out1[8] = x21; - out1[9] = x23; - out1[10] = x25; - out1[11] = x27; - out1[12] = x29; - out1[13] = x31; - out1[14] = x33; - out1[15] = x34; - out1[16] = x35; - out1[17] = x37; - out1[18] = x39; - out1[19] = x41; - out1[20] = x43; - out1[21] = x45; - out1[22] = x47; - out1[23] = x48; - out1[24] = x49; - out1[25] = x51; - out1[26] = x53; - out1[27] = x55; - out1[28] = x57; - out1[29] = x59; - out1[30] = x61; - out1[31] = x62; - out1[32] = x63; - out1[33] = x65; - out1[34] = x67; - out1[35] = x69; - out1[36] = x71; - out1[37] = x73; - out1[38] = x75; - out1[39] = x76; - out1[40] = x77; - out1[41] = x79; - out1[42] = x81; - out1[43] = x83; - out1[44] = x85; - out1[45] = x87; - out1[46] = x89; - out1[47] = (x90 as u8); -} - -/// The function fp_from_bytes deserializes a field element NOT in the Montgomery domain from bytes in little-endian order. -/// -/// Preconditions: -/// 0 ≤ bytes_eval arg1 < m -/// Postconditions: -/// eval out1 mod m = bytes_eval arg1 mod m -/// 0 ≤ eval out1 < 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 ~> 0x1]] -/// Output Bounds: -/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0x1ffffffffffffff]] -pub fn fp_from_bytes(out1: &mut [u64; 6], arg1: &[u8; 48]) { - let x1: u64 = ((((arg1[47]) as FpU1) as u64) << 56); - let x2: u64 = (((arg1[46]) as u64) << 48); - let x3: u64 = (((arg1[45]) as u64) << 40); - let x4: u64 = (((arg1[44]) as u64) << 32); - let x5: u64 = (((arg1[43]) as u64) << 24); - let x6: u64 = (((arg1[42]) as u64) << 16); - let x7: u64 = (((arg1[41]) as u64) << 8); - let x8: u8 = (arg1[40]); - let x9: u64 = (((arg1[39]) as u64) << 56); - let x10: u64 = (((arg1[38]) as u64) << 48); - let x11: u64 = (((arg1[37]) as u64) << 40); - let x12: u64 = (((arg1[36]) as u64) << 32); - let x13: u64 = (((arg1[35]) as u64) << 24); - let x14: u64 = (((arg1[34]) as u64) << 16); - let x15: u64 = (((arg1[33]) as u64) << 8); - let x16: u8 = (arg1[32]); - let x17: u64 = (((arg1[31]) as u64) << 56); - let x18: u64 = (((arg1[30]) as u64) << 48); - let x19: u64 = (((arg1[29]) as u64) << 40); - let x20: u64 = (((arg1[28]) as u64) << 32); - let x21: u64 = (((arg1[27]) as u64) << 24); - let x22: u64 = (((arg1[26]) as u64) << 16); - let x23: u64 = (((arg1[25]) as u64) << 8); - let x24: u8 = (arg1[24]); - let x25: u64 = (((arg1[23]) as u64) << 56); - let x26: u64 = (((arg1[22]) as u64) << 48); - let x27: u64 = (((arg1[21]) as u64) << 40); - let x28: u64 = (((arg1[20]) as u64) << 32); - let x29: u64 = (((arg1[19]) as u64) << 24); - let x30: u64 = (((arg1[18]) as u64) << 16); - let x31: u64 = (((arg1[17]) as u64) << 8); - let x32: u8 = (arg1[16]); - let x33: u64 = (((arg1[15]) as u64) << 56); - let x34: u64 = (((arg1[14]) as u64) << 48); - let x35: u64 = (((arg1[13]) as u64) << 40); - let x36: u64 = (((arg1[12]) as u64) << 32); - let x37: u64 = (((arg1[11]) as u64) << 24); - let x38: u64 = (((arg1[10]) as u64) << 16); - let x39: u64 = (((arg1[9]) as u64) << 8); - let x40: u8 = (arg1[8]); - let x41: u64 = (((arg1[7]) as u64) << 56); - let x42: u64 = (((arg1[6]) as u64) << 48); - let x43: u64 = (((arg1[5]) as u64) << 40); - let x44: u64 = (((arg1[4]) as u64) << 32); - let x45: u64 = (((arg1[3]) as u64) << 24); - let x46: u64 = (((arg1[2]) as u64) << 16); - let x47: u64 = (((arg1[1]) as u64) << 8); - let x48: u8 = (arg1[0]); - let x49: u64 = (x47 + (x48 as u64)); - let x50: u64 = (x46 + x49); - let x51: u64 = (x45 + x50); - let x52: u64 = (x44 + x51); - let x53: u64 = (x43 + x52); - let x54: u64 = (x42 + x53); - let x55: u64 = (x41 + x54); - let x56: u64 = (x39 + (x40 as u64)); - let x57: u64 = (x38 + x56); - let x58: u64 = (x37 + x57); - let x59: u64 = (x36 + x58); - let x60: u64 = (x35 + x59); - let x61: u64 = (x34 + x60); - let x62: u64 = (x33 + x61); - let x63: u64 = (x31 + (x32 as u64)); - let x64: u64 = (x30 + x63); - let x65: u64 = (x29 + x64); - let x66: u64 = (x28 + x65); - let x67: u64 = (x27 + x66); - let x68: u64 = (x26 + x67); - let x69: u64 = (x25 + x68); - let x70: u64 = (x23 + (x24 as u64)); - let x71: u64 = (x22 + x70); - let x72: u64 = (x21 + x71); - let x73: u64 = (x20 + x72); - let x74: u64 = (x19 + x73); - let x75: u64 = (x18 + x74); - let x76: u64 = (x17 + x75); - let x77: u64 = (x15 + (x16 as u64)); - let x78: u64 = (x14 + x77); - let x79: u64 = (x13 + x78); - let x80: u64 = (x12 + x79); - let x81: u64 = (x11 + x80); - let x82: u64 = (x10 + x81); - let x83: u64 = (x9 + x82); - let x84: u64 = (x7 + (x8 as u64)); - let x85: u64 = (x6 + x84); - let x86: u64 = (x5 + x85); - let x87: u64 = (x4 + x86); - let x88: u64 = (x3 + x87); - let x89: u64 = (x2 + x88); - let x90: u64 = (x1 + x89); - out1[0] = x55; - out1[1] = x62; - out1[2] = x69; - out1[3] = x76; - out1[4] = x83; - out1[5] = x90; -} - -/// The function fp_set_one returns the field element one in the Montgomery domain. -/// -/// Postconditions: -/// eval (from_montgomery out1) mod m = 1 mod m -/// 0 ≤ eval out1 < m -/// -pub fn fp_set_one(out1: &mut FpMontgomeryDomainFieldElement) { - out1[0] = 0x2cdffffffffff68; - out1[1] = 0x51409f837fffffb1; - out1[2] = 0x9f7db3a98a7d3ff2; - out1[3] = 0x7b4e97b76e7c6305; - out1[4] = 0x4cf495bf803c84e8; - out1[5] = 0x8d6661e2fdf49a; -} - -/// The function fp_msat returns the saturated representation of the prime modulus. -/// -/// Postconditions: -/// twos_complement_eval out1 = m -/// 0 ≤ eval out1 < m -/// -/// Output Bounds: -/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -pub fn fp_msat(out1: &mut [u64; 7]) { - out1[0] = 0x8508c00000000001; - out1[1] = 0x170b5d4430000000; - out1[2] = 0x1ef3622fba094800; - out1[3] = 0x1a22d9f300f5138f; - out1[4] = 0xc63b05c06ca1493b; - out1[5] = 0x1ae3a4617c510ea; - out1[6] = (0x0 as u64); -} - -/// The function fp_divstep_precomp returns the precomputed value for Bernstein-Yang-inversion (in montgomery form). -/// -/// Postconditions: -/// eval (from_montgomery out1) = ⌊(m - 1) / 2⌋^(if ⌊log2 m⌋ + 1 < 46 then ⌊(49 * (⌊log2 m⌋ + 1) + 80) / 17⌋ else ⌊(49 * (⌊log2 m⌋ + 1) + 57) / 17⌋) -/// 0 ≤ eval out1 < m -/// -/// Output Bounds: -/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -pub fn fp_divstep_precomp(out1: &mut [u64; 6]) { - out1[0] = 0xeb11183b2eebc317; - out1[1] = 0x447e9167fce381c0; - out1[2] = 0xd3d82e38e1b8e754; - out1[3] = 0xa29ef9d47643f061; - out1[4] = 0x10aa1869af8a8f8e; - out1[5] = 0xb5d780bb6d9e65; -} - -/// The function fp_divstep computes a divstep. -/// -/// Preconditions: -/// 0 ≤ eval arg4 < m -/// 0 ≤ eval arg5 < m -/// Postconditions: -/// out1 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then 1 - arg1 else 1 + arg1) -/// twos_complement_eval out2 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then twos_complement_eval arg3 else twos_complement_eval arg2) -/// twos_complement_eval out3 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then ⌊(twos_complement_eval arg3 - twos_complement_eval arg2) / 2⌋ else ⌊(twos_complement_eval arg3 + (twos_complement_eval arg3 mod 2) * twos_complement_eval arg2) / 2⌋) -/// eval (from_montgomery out4) mod m = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then (2 * eval (from_montgomery arg5)) mod m else (2 * eval (from_montgomery arg4)) mod m) -/// eval (from_montgomery out5) mod m = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then (eval (from_montgomery arg4) - eval (from_montgomery arg4)) mod m else (eval (from_montgomery arg5) + (twos_complement_eval arg3 mod 2) * eval (from_montgomery arg4)) mod m) -/// 0 ≤ eval out5 < m -/// 0 ≤ eval out5 < m -/// 0 ≤ eval out2 < m -/// 0 ≤ eval out3 < m -/// -/// Input Bounds: -/// arg1: [0x0 ~> 0xffffffffffffffff] -/// arg2: [[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]] -/// arg4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -/// arg5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -/// Output Bounds: -/// out1: [0x0 ~> 0xffffffffffffffff] -/// out2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -/// out3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] -pub fn fp_divstep( - out1: &mut u64, - out2: &mut [u64; 7], - out3: &mut [u64; 7], - out4: &mut [u64; 6], - out5: &mut [u64; 6], - arg1: u64, - arg2: &[u64; 7], - arg3: &[u64; 7], - arg4: &[u64; 6], - arg5: &[u64; 6], -) { - let mut x1: u64 = 0; - let mut x2: FpU1 = 0; - fp_addcarryx_u64(&mut x1, &mut x2, 0x0, (!arg1), (0x1 as u64)); - let x3: FpU1 = (((x1 >> 63) as FpU1) & (((arg3[0]) & (0x1 as u64)) as FpU1)); - let mut x4: u64 = 0; - let mut x5: FpU1 = 0; - fp_addcarryx_u64(&mut x4, &mut x5, 0x0, (!arg1), (0x1 as u64)); - let mut x6: u64 = 0; - fp_cmovznz_u64(&mut x6, x3, arg1, x4); - let mut x7: u64 = 0; - fp_cmovznz_u64(&mut x7, x3, (arg2[0]), (arg3[0])); - let mut x8: u64 = 0; - fp_cmovznz_u64(&mut x8, x3, (arg2[1]), (arg3[1])); - let mut x9: u64 = 0; - fp_cmovznz_u64(&mut x9, x3, (arg2[2]), (arg3[2])); - let mut x10: u64 = 0; - fp_cmovznz_u64(&mut x10, x3, (arg2[3]), (arg3[3])); - let mut x11: u64 = 0; - fp_cmovznz_u64(&mut x11, x3, (arg2[4]), (arg3[4])); - let mut x12: u64 = 0; - fp_cmovznz_u64(&mut x12, x3, (arg2[5]), (arg3[5])); - let mut x13: u64 = 0; - fp_cmovznz_u64(&mut x13, x3, (arg2[6]), (arg3[6])); - let mut x14: u64 = 0; - let mut x15: FpU1 = 0; - fp_addcarryx_u64(&mut x14, &mut x15, 0x0, (0x1 as u64), (!(arg2[0]))); - let mut x16: u64 = 0; - let mut x17: FpU1 = 0; - fp_addcarryx_u64(&mut x16, &mut x17, x15, (0x0 as u64), (!(arg2[1]))); - let mut x18: u64 = 0; - let mut x19: FpU1 = 0; - fp_addcarryx_u64(&mut x18, &mut x19, x17, (0x0 as u64), (!(arg2[2]))); - let mut x20: u64 = 0; - let mut x21: FpU1 = 0; - fp_addcarryx_u64(&mut x20, &mut x21, x19, (0x0 as u64), (!(arg2[3]))); - let mut x22: u64 = 0; - let mut x23: FpU1 = 0; - fp_addcarryx_u64(&mut x22, &mut x23, x21, (0x0 as u64), (!(arg2[4]))); - let mut x24: u64 = 0; - let mut x25: FpU1 = 0; - fp_addcarryx_u64(&mut x24, &mut x25, x23, (0x0 as u64), (!(arg2[5]))); - let mut x26: u64 = 0; - let mut x27: FpU1 = 0; - fp_addcarryx_u64(&mut x26, &mut x27, x25, (0x0 as u64), (!(arg2[6]))); - let mut x28: u64 = 0; - fp_cmovznz_u64(&mut x28, x3, (arg3[0]), x14); - let mut x29: u64 = 0; - fp_cmovznz_u64(&mut x29, x3, (arg3[1]), x16); - let mut x30: u64 = 0; - fp_cmovznz_u64(&mut x30, x3, (arg3[2]), x18); - let mut x31: u64 = 0; - fp_cmovznz_u64(&mut x31, x3, (arg3[3]), x20); - let mut x32: u64 = 0; - fp_cmovznz_u64(&mut x32, x3, (arg3[4]), x22); - let mut x33: u64 = 0; - fp_cmovznz_u64(&mut x33, x3, (arg3[5]), x24); - let mut x34: u64 = 0; - fp_cmovznz_u64(&mut x34, x3, (arg3[6]), x26); - let mut x35: u64 = 0; - fp_cmovznz_u64(&mut x35, x3, (arg4[0]), (arg5[0])); - let mut x36: u64 = 0; - fp_cmovznz_u64(&mut x36, x3, (arg4[1]), (arg5[1])); - let mut x37: u64 = 0; - fp_cmovznz_u64(&mut x37, x3, (arg4[2]), (arg5[2])); - let mut x38: u64 = 0; - fp_cmovznz_u64(&mut x38, x3, (arg4[3]), (arg5[3])); - let mut x39: u64 = 0; - fp_cmovznz_u64(&mut x39, x3, (arg4[4]), (arg5[4])); - let mut x40: u64 = 0; - fp_cmovznz_u64(&mut x40, x3, (arg4[5]), (arg5[5])); - let mut x41: u64 = 0; - let mut x42: FpU1 = 0; - fp_addcarryx_u64(&mut x41, &mut x42, 0x0, x35, x35); - let mut x43: u64 = 0; - let mut x44: FpU1 = 0; - fp_addcarryx_u64(&mut x43, &mut x44, x42, x36, x36); - let mut x45: u64 = 0; - let mut x46: FpU1 = 0; - fp_addcarryx_u64(&mut x45, &mut x46, x44, x37, x37); - let mut x47: u64 = 0; - let mut x48: FpU1 = 0; - fp_addcarryx_u64(&mut x47, &mut x48, x46, x38, x38); - let mut x49: u64 = 0; - let mut x50: FpU1 = 0; - fp_addcarryx_u64(&mut x49, &mut x50, x48, x39, x39); - let mut x51: u64 = 0; - let mut x52: FpU1 = 0; - fp_addcarryx_u64(&mut x51, &mut x52, x50, x40, x40); - let mut x53: u64 = 0; - let mut x54: FpU1 = 0; - fp_subborrowx_u64(&mut x53, &mut x54, 0x0, x41, 0x8508c00000000001); - let mut x55: u64 = 0; - let mut x56: FpU1 = 0; - fp_subborrowx_u64(&mut x55, &mut x56, x54, x43, 0x170b5d4430000000); - let mut x57: u64 = 0; - let mut x58: FpU1 = 0; - fp_subborrowx_u64(&mut x57, &mut x58, x56, x45, 0x1ef3622fba094800); - let mut x59: u64 = 0; - let mut x60: FpU1 = 0; - fp_subborrowx_u64(&mut x59, &mut x60, x58, x47, 0x1a22d9f300f5138f); - let mut x61: u64 = 0; - let mut x62: FpU1 = 0; - fp_subborrowx_u64(&mut x61, &mut x62, x60, x49, 0xc63b05c06ca1493b); - let mut x63: u64 = 0; - let mut x64: FpU1 = 0; - fp_subborrowx_u64(&mut x63, &mut x64, x62, x51, 0x1ae3a4617c510ea); - let mut x65: u64 = 0; - let mut x66: FpU1 = 0; - fp_subborrowx_u64(&mut x65, &mut x66, x64, (x52 as u64), (0x0 as u64)); - let x67: u64 = (arg4[5]); - let x68: u64 = (arg4[4]); - let x69: u64 = (arg4[3]); - let x70: u64 = (arg4[2]); - let x71: u64 = (arg4[1]); - let x72: u64 = (arg4[0]); - let mut x73: u64 = 0; - let mut x74: FpU1 = 0; - fp_subborrowx_u64(&mut x73, &mut x74, 0x0, (0x0 as u64), x72); - let mut x75: u64 = 0; - let mut x76: FpU1 = 0; - fp_subborrowx_u64(&mut x75, &mut x76, x74, (0x0 as u64), x71); - let mut x77: u64 = 0; - let mut x78: FpU1 = 0; - fp_subborrowx_u64(&mut x77, &mut x78, x76, (0x0 as u64), x70); - let mut x79: u64 = 0; - let mut x80: FpU1 = 0; - fp_subborrowx_u64(&mut x79, &mut x80, x78, (0x0 as u64), x69); - let mut x81: u64 = 0; - let mut x82: FpU1 = 0; - fp_subborrowx_u64(&mut x81, &mut x82, x80, (0x0 as u64), x68); - let mut x83: u64 = 0; - let mut x84: FpU1 = 0; - fp_subborrowx_u64(&mut x83, &mut x84, x82, (0x0 as u64), x67); - let mut x85: u64 = 0; - fp_cmovznz_u64(&mut x85, x84, (0x0 as u64), 0xffffffffffffffff); - let mut x86: u64 = 0; - let mut x87: FpU1 = 0; - fp_addcarryx_u64(&mut x86, &mut x87, 0x0, x73, (x85 & 0x8508c00000000001)); - let mut x88: u64 = 0; - let mut x89: FpU1 = 0; - fp_addcarryx_u64(&mut x88, &mut x89, x87, x75, (x85 & 0x170b5d4430000000)); - let mut x90: u64 = 0; - let mut x91: FpU1 = 0; - fp_addcarryx_u64(&mut x90, &mut x91, x89, x77, (x85 & 0x1ef3622fba094800)); - let mut x92: u64 = 0; - let mut x93: FpU1 = 0; - fp_addcarryx_u64(&mut x92, &mut x93, x91, x79, (x85 & 0x1a22d9f300f5138f)); - let mut x94: u64 = 0; - let mut x95: FpU1 = 0; - fp_addcarryx_u64(&mut x94, &mut x95, x93, x81, (x85 & 0xc63b05c06ca1493b)); - let mut x96: u64 = 0; - let mut x97: FpU1 = 0; - fp_addcarryx_u64(&mut x96, &mut x97, x95, x83, (x85 & 0x1ae3a4617c510ea)); - let mut x98: u64 = 0; - fp_cmovznz_u64(&mut x98, x3, (arg5[0]), x86); - let mut x99: u64 = 0; - fp_cmovznz_u64(&mut x99, x3, (arg5[1]), x88); - let mut x100: u64 = 0; - fp_cmovznz_u64(&mut x100, x3, (arg5[2]), x90); - let mut x101: u64 = 0; - fp_cmovznz_u64(&mut x101, x3, (arg5[3]), x92); - let mut x102: u64 = 0; - fp_cmovznz_u64(&mut x102, x3, (arg5[4]), x94); - let mut x103: u64 = 0; - fp_cmovznz_u64(&mut x103, x3, (arg5[5]), x96); - let x104: FpU1 = ((x28 & (0x1 as u64)) as FpU1); - let mut x105: u64 = 0; - fp_cmovznz_u64(&mut x105, x104, (0x0 as u64), x7); - let mut x106: u64 = 0; - fp_cmovznz_u64(&mut x106, x104, (0x0 as u64), x8); - let mut x107: u64 = 0; - fp_cmovznz_u64(&mut x107, x104, (0x0 as u64), x9); - let mut x108: u64 = 0; - fp_cmovznz_u64(&mut x108, x104, (0x0 as u64), x10); - let mut x109: u64 = 0; - fp_cmovznz_u64(&mut x109, x104, (0x0 as u64), x11); - let mut x110: u64 = 0; - fp_cmovznz_u64(&mut x110, x104, (0x0 as u64), x12); - let mut x111: u64 = 0; - fp_cmovznz_u64(&mut x111, x104, (0x0 as u64), x13); - let mut x112: u64 = 0; - let mut x113: FpU1 = 0; - fp_addcarryx_u64(&mut x112, &mut x113, 0x0, x28, x105); - let mut x114: u64 = 0; - let mut x115: FpU1 = 0; - fp_addcarryx_u64(&mut x114, &mut x115, x113, x29, x106); - let mut x116: u64 = 0; - let mut x117: FpU1 = 0; - fp_addcarryx_u64(&mut x116, &mut x117, x115, x30, x107); - let mut x118: u64 = 0; - let mut x119: FpU1 = 0; - fp_addcarryx_u64(&mut x118, &mut x119, x117, x31, x108); - let mut x120: u64 = 0; - let mut x121: FpU1 = 0; - fp_addcarryx_u64(&mut x120, &mut x121, x119, x32, x109); - let mut x122: u64 = 0; - let mut x123: FpU1 = 0; - fp_addcarryx_u64(&mut x122, &mut x123, x121, x33, x110); - let mut x124: u64 = 0; - let mut x125: FpU1 = 0; - fp_addcarryx_u64(&mut x124, &mut x125, x123, x34, x111); - let mut x126: u64 = 0; - fp_cmovznz_u64(&mut x126, x104, (0x0 as u64), x35); - let mut x127: u64 = 0; - fp_cmovznz_u64(&mut x127, x104, (0x0 as u64), x36); - let mut x128: u64 = 0; - fp_cmovznz_u64(&mut x128, x104, (0x0 as u64), x37); - let mut x129: u64 = 0; - fp_cmovznz_u64(&mut x129, x104, (0x0 as u64), x38); - let mut x130: u64 = 0; - fp_cmovznz_u64(&mut x130, x104, (0x0 as u64), x39); - let mut x131: u64 = 0; - fp_cmovznz_u64(&mut x131, x104, (0x0 as u64), x40); - let mut x132: u64 = 0; - let mut x133: FpU1 = 0; - fp_addcarryx_u64(&mut x132, &mut x133, 0x0, x98, x126); - let mut x134: u64 = 0; - let mut x135: FpU1 = 0; - fp_addcarryx_u64(&mut x134, &mut x135, x133, x99, x127); - let mut x136: u64 = 0; - let mut x137: FpU1 = 0; - fp_addcarryx_u64(&mut x136, &mut x137, x135, x100, x128); - let mut x138: u64 = 0; - let mut x139: FpU1 = 0; - fp_addcarryx_u64(&mut x138, &mut x139, x137, x101, x129); - let mut x140: u64 = 0; - let mut x141: FpU1 = 0; - fp_addcarryx_u64(&mut x140, &mut x141, x139, x102, x130); - let mut x142: u64 = 0; - let mut x143: FpU1 = 0; - fp_addcarryx_u64(&mut x142, &mut x143, x141, x103, x131); - let mut x144: u64 = 0; - let mut x145: FpU1 = 0; - fp_subborrowx_u64(&mut x144, &mut x145, 0x0, x132, 0x8508c00000000001); - let mut x146: u64 = 0; - let mut x147: FpU1 = 0; - fp_subborrowx_u64(&mut x146, &mut x147, x145, x134, 0x170b5d4430000000); - let mut x148: u64 = 0; - let mut x149: FpU1 = 0; - fp_subborrowx_u64(&mut x148, &mut x149, x147, x136, 0x1ef3622fba094800); - let mut x150: u64 = 0; - let mut x151: FpU1 = 0; - fp_subborrowx_u64(&mut x150, &mut x151, x149, x138, 0x1a22d9f300f5138f); - let mut x152: u64 = 0; - let mut x153: FpU1 = 0; - fp_subborrowx_u64(&mut x152, &mut x153, x151, x140, 0xc63b05c06ca1493b); - let mut x154: u64 = 0; - let mut x155: FpU1 = 0; - fp_subborrowx_u64(&mut x154, &mut x155, x153, x142, 0x1ae3a4617c510ea); - let mut x156: u64 = 0; - let mut x157: FpU1 = 0; - fp_subborrowx_u64(&mut x156, &mut x157, x155, (x143 as u64), (0x0 as u64)); - let mut x158: u64 = 0; - let mut x159: FpU1 = 0; - fp_addcarryx_u64(&mut x158, &mut x159, 0x0, x6, (0x1 as u64)); - let x160: u64 = ((x112 >> 1) | ((x114 << 63) & 0xffffffffffffffff)); - let x161: u64 = ((x114 >> 1) | ((x116 << 63) & 0xffffffffffffffff)); - let x162: u64 = ((x116 >> 1) | ((x118 << 63) & 0xffffffffffffffff)); - let x163: u64 = ((x118 >> 1) | ((x120 << 63) & 0xffffffffffffffff)); - let x164: u64 = ((x120 >> 1) | ((x122 << 63) & 0xffffffffffffffff)); - let x165: u64 = ((x122 >> 1) | ((x124 << 63) & 0xffffffffffffffff)); - let x166: u64 = ((x124 & 0x8000000000000000) | (x124 >> 1)); - let mut x167: u64 = 0; - fp_cmovznz_u64(&mut x167, x66, x53, x41); - let mut x168: u64 = 0; - fp_cmovznz_u64(&mut x168, x66, x55, x43); - let mut x169: u64 = 0; - fp_cmovznz_u64(&mut x169, x66, x57, x45); - let mut x170: u64 = 0; - fp_cmovznz_u64(&mut x170, x66, x59, x47); - let mut x171: u64 = 0; - fp_cmovznz_u64(&mut x171, x66, x61, x49); - let mut x172: u64 = 0; - fp_cmovznz_u64(&mut x172, x66, x63, x51); - let mut x173: u64 = 0; - fp_cmovznz_u64(&mut x173, x157, x144, x132); - let mut x174: u64 = 0; - fp_cmovznz_u64(&mut x174, x157, x146, x134); - let mut x175: u64 = 0; - fp_cmovznz_u64(&mut x175, x157, x148, x136); - let mut x176: u64 = 0; - fp_cmovznz_u64(&mut x176, x157, x150, x138); - let mut x177: u64 = 0; - fp_cmovznz_u64(&mut x177, x157, x152, x140); - let mut x178: u64 = 0; - fp_cmovznz_u64(&mut x178, x157, x154, x142); - *out1 = x158; - out2[0] = x7; - out2[1] = x8; - out2[2] = x9; - out2[3] = x10; - out2[4] = x11; - out2[5] = x12; - out2[6] = x13; - out3[0] = x160; - out3[1] = x161; - out3[2] = x162; - out3[3] = x163; - out3[4] = x164; - out3[5] = x165; - out3[6] = x166; - out4[0] = x167; - out4[1] = x168; - out4[2] = x169; - out4[3] = x170; - out4[4] = x171; - out4[5] = x172; - out5[0] = x173; - out5[1] = x174; - out5[2] = x175; - out5[3] = x176; - out5[4] = x177; - out5[5] = x178; -} diff --git a/src/fields/fp/u64/wrapper.rs b/src/fields/fp/u64/wrapper.rs index bcff7e0..36d8d97 100644 --- a/src/fields/fp/u64/wrapper.rs +++ b/src/fields/fp/u64/wrapper.rs @@ -1,19 +1,17 @@ -use super::{ - super::{B, N_64, N_8}, - fiat, -}; +use ark_bls12_377::Fq as ArkworksFp; +use ark_ff::{BigInt, Field, PrimeField}; +use ark_serialize::CanonicalSerialize; + +use super::super::{N_64, N_8}; const N: usize = N_64; #[derive(Copy, Clone)] -pub struct Fp(fiat::FpMontgomeryDomainFieldElement); +pub struct Fp(ArkworksFp); impl PartialEq for Fp { fn eq(&self, other: &Self) -> bool { - let sub = self.sub(other); - let mut check_word = 0; - fiat::fp_nonzero(&mut check_word, &sub.0 .0); - check_word == 0 + self.0 == other.0 } } @@ -27,73 +25,74 @@ impl zeroize::Zeroize for Fp { impl Fp { pub(crate) fn from_le_limbs(limbs: [u64; N_64]) -> Fp { - let x_non_monty = fiat::FpNonMontgomeryDomainFieldElement(limbs); - let mut x = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_to_montgomery(&mut x, &x_non_monty); - Self(x) + let mut bytes = [0u8; N_8]; + for i in 0..N_64 { + let this_byte = limbs[i].to_le_bytes(); + for j in 0..8 { + bytes[8 * i + j] = this_byte[j]; + } + } + + Self::from_raw_bytes(&bytes) } pub(crate) fn from_raw_bytes(bytes: &[u8; N_8]) -> Fp { - let mut x_non_montgomery = fiat::FpNonMontgomeryDomainFieldElement([0; N]); - let mut x = fiat::FpMontgomeryDomainFieldElement([0; N]); - - fiat::fp_from_bytes(&mut x_non_montgomery.0, &bytes); - fiat::fp_to_montgomery(&mut x, &x_non_montgomery); - - Self(x) + Self(ArkworksFp::from_le_bytes_mod_order(bytes)) } pub(crate) fn to_le_limbs(&self) -> [u64; N_64] { - let mut x_non_montgomery = fiat::FpNonMontgomeryDomainFieldElement([0; N]); - fiat::fp_from_montgomery(&mut x_non_montgomery, &self.0); - x_non_montgomery.0 + let le_bytes = self.to_bytes_le(); + let mut out = [0u64; N_64]; + for i in 0..N_64 { + out[i] = u64::from_le_bytes([ + le_bytes[8 * i], + le_bytes[8 * i + 1], + le_bytes[8 * i + 2], + le_bytes[8 * i + 3], + le_bytes[8 * i + 4], + le_bytes[8 * i + 5], + le_bytes[8 * i + 6], + le_bytes[8 * i + 7], + ]); + } + out } pub fn to_bytes_le(&self) -> [u8; N_8] { - let mut bytes = [0u8; N_8]; - let mut x_non_montgomery = fiat::FpNonMontgomeryDomainFieldElement([0; N]); - fiat::fp_from_montgomery(&mut x_non_montgomery, &self.0); - fiat::fp_to_bytes(&mut bytes, &x_non_montgomery.0); + let mut bytes = [0u8; 48]; + self.0 + .serialize_compressed(&mut bytes[..]) + .expect("serialization into array should be infallible"); bytes } pub(crate) const fn from_montgomery_limbs(limbs: [u64; N]) -> Fp { - Self(fiat::FpMontgomeryDomainFieldElement(limbs)) + Self(ArkworksFp::new_unchecked(BigInt::new(limbs))) } - pub const ZERO: Self = Self(fiat::FpMontgomeryDomainFieldElement([0; N])); + pub const ZERO: Self = Self(ArkworksFp::new(BigInt::new([0; N]))); + pub const ONE: Self = Self(ArkworksFp::new(BigInt::one())); - pub const ONE: Self = Self(fiat::FpMontgomeryDomainFieldElement([ - 202099033278250856, - 5854854902718660529, - 11492539364873682930, - 8885205928937022213, - 5545221690922665192, - 39800542322357402, - ])); - - pub const MINUS_ONE: Self = Self(fiat::FpMontgomeryDomainFieldElement([ + pub const MINUS_ONE: Self = Self::from_montgomery_limbs([ 9384023879812382873, 14252412606051516495, 9184438906438551565, 11444845376683159689, 8738795276227363922, 81297770384137296, - ])); + ]); - pub const QUADRATIC_NON_RESIDUE: Self = Self(fiat::FpMontgomeryDomainFieldElement([ + pub const QUADRATIC_NON_RESIDUE: Self = Self::from_montgomery_limbs([ 18161750659790013178, 10940260503947051403, 2338003791965605956, 14680817040264804354, 841925479686732267, 43193913801202386, - ])); + ]); pub fn square(&self) -> Fp { - let mut result = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_square(&mut result, &self.0); - Self(result) + Fp(self.0.square()) } pub fn inverse(&self) -> Option { @@ -101,100 +100,22 @@ impl Fp { return None; } - const I: usize = (49 * B + 57) / 17; - - let mut a = fiat::FpNonMontgomeryDomainFieldElement([0; N]); - fiat::fp_from_montgomery(&mut a, &self.0); - let mut d = 1; - let mut f: [u64; N + 1] = [0u64; N + 1]; - fiat::fp_msat(&mut f); - let mut g: [u64; N + 1] = [0u64; N + 1]; - let mut v: [u64; N] = [0u64; N]; - let mut r: [u64; N] = Self::ONE.0 .0; - let mut i = 0; - let mut j = 0; - - while j < N { - g[j] = a[j]; - j += 1; - } - - let mut out1: u64 = 0; - let mut out2: [u64; N + 1] = [0; N + 1]; - let mut out3: [u64; N + 1] = [0; N + 1]; - let mut out4: [u64; N] = [0; N]; - let mut out5: [u64; N] = [0; N]; - let mut out6: u64 = 0; - let mut out7: [u64; N + 1] = [0; N + 1]; - let mut out8: [u64; N + 1] = [0; N + 1]; - let mut out9: [u64; N] = [0; N]; - let mut out10: [u64; N] = [0; N]; - - while i < I - I % 2 { - fiat::fp_divstep( - &mut out1, &mut out2, &mut out3, &mut out4, &mut out5, d, &f, &g, &v, &r, - ); - fiat::fp_divstep( - &mut out6, &mut out7, &mut out8, &mut out9, &mut out10, out1, &out2, &out3, &out4, - &out5, - ); - d = out6; - f = out7; - g = out8; - v = out9; - r = out10; - i += 2; - } - - if I % 2 != 0 { - fiat::fp_divstep( - &mut out1, &mut out2, &mut out3, &mut out4, &mut out5, d, &f, &g, &v, &r, - ); - v = out4; - f = out2; - } - - let s = ((f[f.len() - 1] >> (64 - 1)) & 1) as u8; - let mut neg = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_opp(&mut neg, &fiat::FpMontgomeryDomainFieldElement(v)); - - let mut v_prime: [u64; N] = [0u64; N]; - fiat::fp_selectznz(&mut v_prime, s, &v, &neg.0); - - let mut pre_comp: [u64; N] = [0u64; N]; - fiat::fp_divstep_precomp(&mut pre_comp); - - let mut result = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_mul( - &mut result, - &fiat::FpMontgomeryDomainFieldElement(v_prime), - &fiat::FpMontgomeryDomainFieldElement(pre_comp), - ); - - Some(Fp(result)) + Some(Fp(self.0.inverse()?)) } pub fn add(self, other: &Fp) -> Fp { - let mut result = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_add(&mut result, &self.0, &other.0); - Fp(result) + Fp(self.0 + other.0) } pub fn sub(self, other: &Fp) -> Fp { - let mut result = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_sub(&mut result, &self.0, &other.0); - Fp(result) + Fp(self.0 - other.0) } pub fn mul(self, other: &Fp) -> Fp { - let mut result = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_mul(&mut result, &self.0, &other.0); - Fp(result) + Fp(self.0 * other.0) } pub fn neg(self) -> Fp { - let mut result = fiat::FpMontgomeryDomainFieldElement([0; N]); - fiat::fp_opp(&mut result, &self.0); - Fp(result) + Fp(-self.0) } }