#! Performs raw subtraction of scalar element ( say b ) from another one ( say a ), #! without any reduction i.e. r = a - b #! #! Expected stack state #! #! [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ...] #! #! Final stack state #! #! [c, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, ...] #! #! Note, if c == 0xffff_ffff, overflow has occurred during subtraction #! else c == 0, no overflow occurred during subtraction. #! #! Adapted from equivalent Rust implementation https://github.com/itzmeanjan/miden/blob/e7038e45865a7032a0629346921a77010e82862d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L56-L74 proc.sub_inner push.0 movup.11 movup.2 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.3 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.4 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.5 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.6 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.7 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.8 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.9 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.10 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or movup.11 movup.11 swap u32overflowing_sub swap movup.2 u32overflowing_sub movup.2 or push.0 swap u32wrapping_sub swap movup.2 movup.3 movup.4 movup.5 movup.6 movup.7 movup.8 movup.9 movup.10 # = (r0, r1, r2, r3, r4, r5, r6, r7, r8, r9) movup.10 # = c end #! Selects scalar based on value of c i.e. r = c == 0 ? a : b | c ∈ {0, 0xffff_ffff} #! #! Expected stack state #! #! [c, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ...] #! #! Final stack state #! #! [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, ...] #! #! Adapted from equivalent Rust implementation https://github.com/itzmeanjan/miden/blob/e7038e45865a7032a0629346921a77010e82862d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L76-L87 proc.select dup movup.12 dup.3 u32xor u32and movup.2 u32xor dup.1 movup.12 dup.4 u32xor u32and movup.3 u32xor dup.2 movup.12 dup.5 u32xor u32and movup.4 u32xor dup.3 movup.12 dup.6 u32xor u32and movup.5 u32xor dup.4 movup.12 dup.7 u32xor u32and movup.6 u32xor dup.5 movup.12 dup.8 u32xor u32and movup.7 u32xor dup.6 movup.12 dup.9 u32xor u32and movup.8 u32xor dup.7 movup.12 dup.10 u32xor u32and movup.9 u32xor dup.8 movup.12 dup.11 u32xor u32and movup.10 u32xor movup.9 movup.11 dup.11 u32xor u32and movup.10 u32xor swap movup.2 movup.3 movup.4 movup.5 movup.6 movup.7 movup.8 movup.9 # = (r0, r1, r2, r3, r4, r5, r6, r7, r8, r9) end #! Montgomery multiplication of two radix-2^32 scalar field elements s.t. each #! number can be represented using 10 limbs, each of 32 -bit width, returning #! #! r = (a * b) / 2^320 (mod N) | N = 319 -bit prime ( See https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L24-L35 ) #! #! Expected stack state #! #! [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ...] #! #! Final stack state #! #! [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, ...] #! #! Adapted from equivalent Rust implementation https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L92-L132 export.mont_mul.8 dup loc_store.0 loc_storew.1 dropw loc_storew.2 dropw push.0.0 movup.3 movup.3 loc_storew.3 dropw # cached (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) # when i = 0 dup loc_load.0 u32wrapping_mul u32wrapping_mul.91978719 # more about this literal constant loc_store.4 # https://github.com/itzmeanjan/miden/blob/e7038e45865a7032a0629346921a77010e82862d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L46-L54 # cached f push.0.0.0.0 loc_loadw.1 dup.4 u32overflowing_mul loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop dup.5 movup.3 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.3 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0 loc_loadw.2 movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.5 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.3 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0 loc_loadw.3 movup.3 movup.3 drop drop movdn.3 movdn.3 movup.2 dup.4 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 movup.3 u32overflowing_mul swap movup.3 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0 movup.2 movup.4 movup.4 u32wrapping_add swap loc_storew.7 dropw # when i = 1 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 2 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 3 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 4 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 5 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 6 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 7 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 8 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # when i = 9 dup loc_load.0 u32wrapping_mul push.0.0.0.0 loc_loadw.5 dup movup.5 u32wrapping_add u32wrapping_mul.91978719 loc_store.4 push.0.0.0.0 loc_loadw.1 dup.8 u32overflowing_mul swap movup.5 u32overflowing_add movup.2 u32wrapping_add loc_load.4 u32overflowing_mul.2492202977 swap movup.3 u32overflowing_add movup.2 u32wrapping_add swap drop movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3893352854 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.5 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3609501852 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 swap drop movup.3 swap loc_storew.5 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3901250617 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.2 drop movup.3 movdn.2 loc_storew.5 dropw push.0.0.0.0.0.0.0.0 loc_loadw.6 swapw loc_loadw.2 movup.9 movup.9 movup.2 dup.10 u32overflowing_mul swap movup.7 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.3484943929 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.5 movup.3 drop loc_storew.5 dropw movup.2 dup.8 u32overflowing_mul swap movup.6 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483622 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0 movup.3 loc_storew.6 dropw movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.22 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 swap drop movup.3 swap loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483633 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.2 drop movup.3 movdn.2 loc_storew.6 dropw push.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.3 movup.3 movup.3 drop drop movup.5 movup.5 drop drop movup.5 movup.5 movup.2 dup.6 u32overflowing_mul swap movup.5 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483655 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 swap push.0.0.0.0 loc_loadw.6 movup.3 drop loc_storew.6 dropw movup.2 dup.4 u32overflowing_mul swap movup.4 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 loc_load.4 u32overflowing_mul.2147483645 swap movup.3 u32overflowing_add swap movup.4 u32overflowing_add movup.3 movup.3 u32wrapping_add3 movup.2 u32wrapping_add swap push.0.0 movup.3 movup.3 loc_storew.7 dropw drop # bring r back to stack, from memory # # this will be used when executing https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L131 push.0.0.0.0.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.6 movupw.2 loc_loadw.5 movup.11 movup.11 drop drop # push scalar field prime N push.2147483645.2147483655.2147483633.22.2147483622.3484943929.3901250617.3609501852.3893352854.2492202977 # bring r back to stack, from memory ( again ) # # this will be used when executing https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L130 push.0.0.0.0.0.0.0.0.0.0.0.0 loc_loadw.7 swapw loc_loadw.6 movupw.2 loc_loadw.5 movup.11 movup.11 drop drop exec.sub_inner exec.select end #! Given a scalar field element in radix-2^32 form, this routine converts it to #! Montgomery representation, by multiplying input scalar by R2 = ((2 ^ 320) ^ 2) % N | N = scalar field prime #! #! Expected stack state #! #! [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, ...] #! #! Final stack state #! #! [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, ...] #! #! Adapted from equivalent Rust implementation https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L134-L139 export.to_mont push.1254757298.2359448053.2866806621.359973336.3520566988.2446296357.1815226579.1063431375.2685403612.3812476729 exec.mont_mul end #! Given a scalar field element in Montgomery representation, this routine converts it to #! standard radix-2^32 form, by multiplying input by 1 ( in radix-2^32 form ) #! #! Expected stack state #! #! [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, ...] #! #! Final stack state #! #! [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, ...] #! #! Adapted from equivalent Rust implementation https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L141-L146 export.from_mont push.0.0.0.0.0.0.0.0.0.1 exec.mont_mul end #! Just a wrapper function for ease of squaring an element of scalar field, which #! is represented in Montgomery form #! #! Expected stack state #! #! [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, ...] #! #! Final stack state #! #! [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ...] | b = a * a ( mod N ) when N = scalar field prime proc.sqr repeat.10 dup.9 end exec.mont_mul end #! Given an element ( say a ) of scalar field, this routine computes multiplicative inverse ( say a' ) #! of that element s.t. a * a' = 1 ( mod N ) | N = Scalar field prime #! #! Expected stack state #! #! [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, ...] | a[0..10] is a 319 -bit number, represented in radix-2^32 form #! #! Final stack state #! #! [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ...] | b[0..10] is a 319 -bit number s.t. b = a^-1 ( mod N ), represented in radix-2^32 form #! #! Note, if input operand is 0, then multiplicative inverse can't be computed, which is why output result is also 0. #! #! Adapted from equivalent Rust implementation https://github.com/itzmeanjan/miden/blob/6a611e693601577864da3e43e745525b83c0030d/miden/tests/integration/stdlib/math/ext5_scalar.rs#L162-L176 export.inv.6 # cache result initial value 1 ( in Montgomery form ) push.0.0.4.4294967281.29.4294967251.50.1620046732.787433356.1370930886.803228882.3605528638 loc_storew.0 dropw loc_storew.1 dropw loc_storew.2 dropw # compute Montgomery form of base and cache it # # note, base ( i.e. input operand ) is expected in radix-2^32 form exec.to_mont loc_storew.3 dropw loc_storew.4 dropw push.0.0 movup.3 movup.3 loc_storew.5 dropw push.2492202975.3893352854.3609501852.3901250617.3484943929.2147483622.22.2147483633.2147483655.2147483645 repeat.10 repeat.32 # bring res back to stack push.0.0.0.0.0.0.0.0.0.0.0.0 loc_loadw.2 swapw loc_loadw.1 movupw.2 loc_loadw.0 movup.11 movup.11 drop drop exec.sqr # write res back to memory loc_storew.0 dropw loc_storew.1 dropw push.0.0 movup.3 movup.3 loc_storew.2 dropw dup u32shr.31 if.true # bring base back to stack push.0.0.0.0.0.0.0.0.0.0.0.0 loc_loadw.5 swapw loc_loadw.4 movupw.2 loc_loadw.3 movup.11 movup.11 drop drop # bring res back to stack push.0.0.0.0.0.0.0.0.0.0.0.0 loc_loadw.2 swapw loc_loadw.1 movupw.2 loc_loadw.0 movup.11 movup.11 drop drop exec.mont_mul # write res back to memory loc_storew.0 dropw loc_storew.1 dropw push.0.0 movup.3 movup.3 loc_storew.2 dropw end u32shl.1 end drop end # bring res back to stack push.0.0.0.0.0.0.0.0.0.0.0.0 loc_loadw.2 swapw loc_loadw.1 movupw.2 loc_loadw.0 movup.11 movup.11 drop drop # result, on stack, in radix-2^32 form exec.from_mont end