1816 lines
42 KiB
Plaintext
1816 lines
42 KiB
Plaintext
(module
|
|
(import "js" "table" (table 3 anyfunc))
|
|
(import "js" "mem" (memory 1))
|
|
|
|
(type $fe_mul (func
|
|
(param $f_0 i64)
|
|
(param $f_1 i64)
|
|
(param $f_2 i64)
|
|
(param $f_3 i64)
|
|
(param $f_4 i64)
|
|
(param $f_5 i64)
|
|
(param $f_6 i64)
|
|
(param $f_7 i64)
|
|
(param $f_8 i64)
|
|
(param $f_9 i64)
|
|
(param $g_0 i64)
|
|
(param $g_1 i64)
|
|
(param $g_2 i64)
|
|
(param $g_3 i64)
|
|
(param $g_4 i64)
|
|
(param $g_5 i64)
|
|
(param $g_6 i64)
|
|
(param $g_7 i64)
|
|
(param $g_8 i64)
|
|
(param $g_9 i64)
|
|
(param $res i32)))
|
|
|
|
(type $fe_sq (func
|
|
(param $f_0 i64)
|
|
(param $f_1 i64)
|
|
(param $f_2 i64)
|
|
(param $f_3 i64)
|
|
(param $f_4 i64)
|
|
(param $f_5 i64)
|
|
(param $f_6 i64)
|
|
(param $f_7 i64)
|
|
(param $f_8 i64)
|
|
(param $f_9 i64)
|
|
(param $double i32)
|
|
(param $repeat i32)
|
|
(param $res i32)))
|
|
|
|
(type $fe_invert (func
|
|
(param $f_0 i64)
|
|
(param $f_1 i64)
|
|
(param $f_2 i64)
|
|
(param $f_3 i64)
|
|
(param $f_4 i64)
|
|
(param $f_5 i64)
|
|
(param $f_6 i64)
|
|
(param $f_7 i64)
|
|
(param $f_8 i64)
|
|
(param $f_9 i64)
|
|
(param $res i32)))
|
|
|
|
(func $i32.log (import "debug" "log") (param i32))
|
|
(func $i32.log_tee (import "debug" "log_tee") (param i32) (result i32))
|
|
;; No i64 interop with JS yet - but maybe coming with WebAssembly BigInt
|
|
;; So we can instead fake this by splitting the i64 into two i32 limbs,
|
|
;; however these are WASM functions using i32x2.log:
|
|
(func $i32x2.log (import "debug" "log") (param i32) (param i32))
|
|
(func $f32.log (import "debug" "log") (param f32))
|
|
(func $f32.log_tee (import "debug" "log_tee") (param f32) (result f32))
|
|
(func $f64.log (import "debug" "log") (param f64))
|
|
(func $f64.log_tee (import "debug" "log_tee") (param f64) (result f64))
|
|
|
|
;; i64 logging by splitting into two i32 limbs
|
|
(func $i64.log
|
|
(param $0 i64)
|
|
(call $i32x2.log
|
|
;; Upper limb
|
|
(i32.wrap/i64
|
|
(i64.shr_s (get_local $0)
|
|
(i64.const 32)))
|
|
;; Lower limb
|
|
(i32.wrap/i64 (get_local $0))))
|
|
|
|
(func $i64.log_tee
|
|
(param $0 i64)
|
|
(result i64)
|
|
(call $i64.log (get_local $0))
|
|
(return (get_local $0)))
|
|
|
|
;; (memory $0 1)
|
|
;; (export "memory" (memory $0))
|
|
|
|
(func $scalarmult (export "scalarmult")
|
|
(param $res_x2 i32)
|
|
|
|
(param $ptr_x1 i32)
|
|
(param $ptr_t i32)
|
|
|
|
(local $swap i32)
|
|
(local $b i32)
|
|
(local $pos i32)
|
|
|
|
(local $ptr0 i32)
|
|
(local $ptr1 i32)
|
|
(local $ptr2 i32)
|
|
(local $ptr3 i32)
|
|
|
|
(local $mask i64)
|
|
|
|
(local $t i64)
|
|
(local $t_0 i64)
|
|
(local $t_1 i64)
|
|
(local $t_2 i64)
|
|
(local $t_3 i64)
|
|
|
|
(local $x1_0 i64)
|
|
(local $x1_1 i64)
|
|
(local $x1_2 i64)
|
|
(local $x1_3 i64)
|
|
(local $x1_4 i64)
|
|
(local $x1_5 i64)
|
|
(local $x1_6 i64)
|
|
(local $x1_7 i64)
|
|
(local $x1_8 i64)
|
|
(local $x1_9 i64)
|
|
|
|
(local $x2_0 i64)
|
|
(local $x2_1 i64)
|
|
(local $x2_2 i64)
|
|
(local $x2_3 i64)
|
|
(local $x2_4 i64)
|
|
(local $x2_5 i64)
|
|
(local $x2_6 i64)
|
|
(local $x2_7 i64)
|
|
(local $x2_8 i64)
|
|
(local $x2_9 i64)
|
|
|
|
(local $z2_0 i64)
|
|
(local $z2_1 i64)
|
|
(local $z2_2 i64)
|
|
(local $z2_3 i64)
|
|
(local $z2_4 i64)
|
|
(local $z2_5 i64)
|
|
(local $z2_6 i64)
|
|
(local $z2_7 i64)
|
|
(local $z2_8 i64)
|
|
(local $z2_9 i64)
|
|
|
|
(local $x3_0 i64)
|
|
(local $x3_1 i64)
|
|
(local $x3_2 i64)
|
|
(local $x3_3 i64)
|
|
(local $x3_4 i64)
|
|
(local $x3_5 i64)
|
|
(local $x3_6 i64)
|
|
(local $x3_7 i64)
|
|
(local $x3_8 i64)
|
|
(local $x3_9 i64)
|
|
|
|
(local $z3_0 i64)
|
|
(local $z3_1 i64)
|
|
(local $z3_2 i64)
|
|
(local $z3_3 i64)
|
|
(local $z3_4 i64)
|
|
(local $z3_5 i64)
|
|
(local $z3_6 i64)
|
|
(local $z3_7 i64)
|
|
(local $z3_8 i64)
|
|
(local $z3_9 i64)
|
|
|
|
(local $tmp0_0 i64)
|
|
(local $tmp0_1 i64)
|
|
(local $tmp0_2 i64)
|
|
(local $tmp0_3 i64)
|
|
(local $tmp0_4 i64)
|
|
(local $tmp0_5 i64)
|
|
(local $tmp0_6 i64)
|
|
(local $tmp0_7 i64)
|
|
(local $tmp0_8 i64)
|
|
(local $tmp0_9 i64)
|
|
|
|
(local $tmp1_0 i64)
|
|
(local $tmp1_1 i64)
|
|
(local $tmp1_2 i64)
|
|
(local $tmp1_3 i64)
|
|
(local $tmp1_4 i64)
|
|
(local $tmp1_5 i64)
|
|
(local $tmp1_6 i64)
|
|
(local $tmp1_7 i64)
|
|
(local $tmp1_8 i64)
|
|
(local $tmp1_9 i64)
|
|
|
|
(i32.const 400)
|
|
(set_local $ptr0)
|
|
(i32.const 440)
|
|
(set_local $ptr1)
|
|
(i32.const 480)
|
|
(set_local $ptr2)
|
|
(i32.const 520)
|
|
(set_local $ptr3)
|
|
|
|
(set_local $t_0 (i64.load offset=0 (get_local $ptr_t)))
|
|
(set_local $t_1 (i64.load offset=8 (get_local $ptr_t)))
|
|
(set_local $t_2 (i64.load offset=16 (get_local $ptr_t)))
|
|
(set_local $t_3 (i64.load offset=24 (get_local $ptr_t)))
|
|
|
|
(set_local $x1_0 (i64.load32_u offset=0 (get_local $ptr_x1)))
|
|
(set_local $x1_1 (i64.load32_u offset=4 (get_local $ptr_x1)))
|
|
(set_local $x1_2 (i64.load32_u offset=8 (get_local $ptr_x1)))
|
|
(set_local $x1_3 (i64.load32_u offset=12 (get_local $ptr_x1)))
|
|
(set_local $x1_4 (i64.load32_u offset=16 (get_local $ptr_x1)))
|
|
(set_local $x1_5 (i64.load32_u offset=20 (get_local $ptr_x1)))
|
|
(set_local $x1_6 (i64.load32_u offset=24 (get_local $ptr_x1)))
|
|
(set_local $x1_7 (i64.load32_u offset=28 (get_local $ptr_x1)))
|
|
(set_local $x1_8 (i64.load32_u offset=32 (get_local $ptr_x1)))
|
|
(set_local $x1_9 (i64.load32_u offset=36 (get_local $ptr_x1)))
|
|
|
|
(set_local $x2_0 (i64.const 1))
|
|
(set_local $x2_1 (i64.const 0))
|
|
(set_local $x2_2 (i64.const 0))
|
|
(set_local $x2_3 (i64.const 0))
|
|
(set_local $x2_4 (i64.const 0))
|
|
(set_local $x2_5 (i64.const 0))
|
|
(set_local $x2_6 (i64.const 0))
|
|
(set_local $x2_7 (i64.const 0))
|
|
(set_local $x2_8 (i64.const 0))
|
|
(set_local $x2_9 (i64.const 0))
|
|
|
|
(set_local $x3_0 (i64.load32_u offset=0 (get_local $ptr_x1)))
|
|
(set_local $x3_1 (i64.load32_u offset=4 (get_local $ptr_x1)))
|
|
(set_local $x3_2 (i64.load32_u offset=8 (get_local $ptr_x1)))
|
|
(set_local $x3_3 (i64.load32_u offset=12 (get_local $ptr_x1)))
|
|
(set_local $x3_4 (i64.load32_u offset=16 (get_local $ptr_x1)))
|
|
(set_local $x3_5 (i64.load32_u offset=20 (get_local $ptr_x1)))
|
|
(set_local $x3_6 (i64.load32_u offset=24 (get_local $ptr_x1)))
|
|
(set_local $x3_7 (i64.load32_u offset=28 (get_local $ptr_x1)))
|
|
(set_local $x3_8 (i64.load32_u offset=32 (get_local $ptr_x1)))
|
|
(set_local $x3_9 (i64.load32_u offset=36 (get_local $ptr_x1)))
|
|
|
|
(set_local $z2_0 (i64.const 0))
|
|
(set_local $z2_1 (i64.const 0))
|
|
(set_local $z2_2 (i64.const 0))
|
|
(set_local $z2_3 (i64.const 0))
|
|
(set_local $z2_4 (i64.const 0))
|
|
(set_local $z2_5 (i64.const 0))
|
|
(set_local $z2_6 (i64.const 0))
|
|
(set_local $z2_7 (i64.const 0))
|
|
(set_local $z2_8 (i64.const 0))
|
|
(set_local $z2_9 (i64.const 0))
|
|
|
|
(set_local $z3_0 (i64.const 1))
|
|
(set_local $z3_1 (i64.const 0))
|
|
(set_local $z3_2 (i64.const 0))
|
|
(set_local $z3_3 (i64.const 0))
|
|
(set_local $z3_4 (i64.const 0))
|
|
(set_local $z3_5 (i64.const 0))
|
|
(set_local $z3_6 (i64.const 0))
|
|
(set_local $z3_7 (i64.const 0))
|
|
(set_local $z3_8 (i64.const 0))
|
|
(set_local $z3_9 (i64.const 0))
|
|
|
|
(i32.const 254)
|
|
(set_local $pos)
|
|
|
|
(block $end
|
|
(loop $start
|
|
(get_local $pos)
|
|
(i32.const 0)
|
|
(i32.lt_s)
|
|
(br_if $end)
|
|
|
|
;; choose which limb of t
|
|
(block $break
|
|
(block $0
|
|
(block $1
|
|
(block $2
|
|
(block $3
|
|
(block $switch
|
|
(get_local $pos)
|
|
(i32.const 64)
|
|
(i32.div_u)
|
|
(br_table $0 $1 $2 $3)))
|
|
|
|
(get_local $t_3)
|
|
(set_local $t)
|
|
(br $break))
|
|
|
|
(get_local $t_2)
|
|
(set_local $t)
|
|
(br $break))
|
|
|
|
(get_local $t_1)
|
|
(set_local $t)
|
|
(br $break))
|
|
|
|
(get_local $t_0)
|
|
(set_local $t))
|
|
;; end of switch statement
|
|
|
|
(get_local $t)
|
|
(get_local $pos)
|
|
(i32.const 8)
|
|
(i32.div_u)
|
|
(i32.const 8)
|
|
(i32.rem_u)
|
|
(i32.const 8)
|
|
(i32.mul)
|
|
(i64.extend_u/i32)
|
|
(i64.shr_u)
|
|
(i64.const 0xff)
|
|
(i64.and)
|
|
(get_local $pos)
|
|
(i32.const 7)
|
|
(i32.and)
|
|
(i64.extend_u/i32)
|
|
(i64.shr_u)
|
|
(i64.const 1)
|
|
(i64.and)
|
|
(i32.wrap/i64)
|
|
(set_local $b)
|
|
|
|
(get_local $swap)
|
|
(get_local $b)
|
|
(i32.xor)
|
|
(set_local $swap)
|
|
|
|
(i32.const 0)
|
|
(get_local $swap)
|
|
(i32.sub)
|
|
(i64.extend_u/i32)
|
|
(set_local $mask)
|
|
|
|
(get_local $x2_0)
|
|
(get_local $x3_0)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_0)
|
|
|
|
(get_local $x2_1)
|
|
(get_local $x3_1)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_1)
|
|
|
|
(get_local $x2_2)
|
|
(get_local $x3_2)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_2)
|
|
|
|
(get_local $x2_3)
|
|
(get_local $x3_3)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_3)
|
|
|
|
(get_local $x2_4)
|
|
(get_local $x3_4)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_4)
|
|
|
|
(get_local $x2_5)
|
|
(get_local $x3_5)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_5)
|
|
|
|
(get_local $x2_6)
|
|
(get_local $x3_6)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_6)
|
|
|
|
(get_local $x2_7)
|
|
(get_local $x3_7)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_7)
|
|
|
|
(get_local $x2_8)
|
|
(get_local $x3_8)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_8)
|
|
|
|
(get_local $x2_9)
|
|
(get_local $x3_9)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_9)
|
|
|
|
|
|
(get_local $x2_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $x2_0)
|
|
|
|
(get_local $x2_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $x2_1)
|
|
|
|
(get_local $x2_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $x2_2)
|
|
|
|
(get_local $x2_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $x2_3)
|
|
|
|
(get_local $x2_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $x2_4)
|
|
|
|
(get_local $x2_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $x2_5)
|
|
|
|
(get_local $x2_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $x2_6)
|
|
|
|
(get_local $x2_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $x2_7)
|
|
|
|
(get_local $x2_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $x2_8)
|
|
|
|
(get_local $x2_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $x2_9)
|
|
|
|
|
|
(get_local $x3_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $x3_0)
|
|
|
|
(get_local $x3_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $x3_1)
|
|
|
|
(get_local $x3_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $x3_2)
|
|
|
|
(get_local $x3_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $x3_3)
|
|
|
|
(get_local $x3_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $x3_4)
|
|
|
|
(get_local $x3_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $x3_5)
|
|
|
|
(get_local $x3_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $x3_6)
|
|
|
|
(get_local $x3_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $x3_7)
|
|
|
|
(get_local $x3_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $x3_8)
|
|
|
|
(get_local $x3_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $x3_9)
|
|
|
|
|
|
(get_local $z3_0)
|
|
(get_local $z2_0)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_0)
|
|
|
|
(get_local $z3_1)
|
|
(get_local $z2_1)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_1)
|
|
|
|
(get_local $z3_2)
|
|
(get_local $z2_2)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_2)
|
|
|
|
(get_local $z3_3)
|
|
(get_local $z2_3)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_3)
|
|
|
|
(get_local $z3_4)
|
|
(get_local $z2_4)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_4)
|
|
|
|
(get_local $z3_5)
|
|
(get_local $z2_5)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_5)
|
|
|
|
(get_local $z3_6)
|
|
(get_local $z2_6)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_6)
|
|
|
|
(get_local $z3_7)
|
|
(get_local $z2_7)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_7)
|
|
|
|
(get_local $z3_8)
|
|
(get_local $z2_8)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_8)
|
|
|
|
(get_local $z3_9)
|
|
(get_local $z2_9)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_9)
|
|
|
|
|
|
(get_local $z2_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $z2_0)
|
|
|
|
(get_local $z2_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $z2_1)
|
|
|
|
(get_local $z2_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $z2_2)
|
|
|
|
(get_local $z2_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $z2_3)
|
|
|
|
(get_local $z2_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $z2_4)
|
|
|
|
(get_local $z2_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $z2_5)
|
|
|
|
(get_local $z2_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $z2_6)
|
|
|
|
(get_local $z2_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $z2_7)
|
|
|
|
(get_local $z2_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $z2_8)
|
|
|
|
(get_local $z2_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $z2_9)
|
|
|
|
|
|
(get_local $z3_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $z3_0)
|
|
|
|
(get_local $z3_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $z3_1)
|
|
|
|
(get_local $z3_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $z3_2)
|
|
|
|
(get_local $z3_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $z3_3)
|
|
|
|
(get_local $z3_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $z3_4)
|
|
|
|
(get_local $z3_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $z3_5)
|
|
|
|
(get_local $z3_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $z3_6)
|
|
|
|
(get_local $z3_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $z3_7)
|
|
|
|
(get_local $z3_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $z3_8)
|
|
|
|
(get_local $z3_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $z3_9)
|
|
|
|
(get_local $b)
|
|
(set_local $swap)
|
|
|
|
;; fe25519_sub(tmp0, x3, z3)
|
|
(get_local $x3_0)
|
|
(get_local $z3_0)
|
|
(i64.sub)
|
|
(set_local $tmp0_0)
|
|
|
|
(get_local $x3_1)
|
|
(get_local $z3_1)
|
|
(i64.sub)
|
|
(set_local $tmp0_1)
|
|
|
|
(get_local $x3_2)
|
|
(get_local $z3_2)
|
|
(i64.sub)
|
|
(set_local $tmp0_2)
|
|
|
|
(get_local $x3_3)
|
|
(get_local $z3_3)
|
|
(i64.sub)
|
|
(set_local $tmp0_3)
|
|
|
|
(get_local $x3_4)
|
|
(get_local $z3_4)
|
|
(i64.sub)
|
|
(set_local $tmp0_4)
|
|
|
|
(get_local $x3_5)
|
|
(get_local $z3_5)
|
|
(i64.sub)
|
|
(set_local $tmp0_5)
|
|
|
|
(get_local $x3_6)
|
|
(get_local $z3_6)
|
|
(i64.sub)
|
|
(set_local $tmp0_6)
|
|
|
|
(get_local $x3_7)
|
|
(get_local $z3_7)
|
|
(i64.sub)
|
|
(set_local $tmp0_7)
|
|
|
|
(get_local $x3_8)
|
|
(get_local $z3_8)
|
|
(i64.sub)
|
|
(set_local $tmp0_8)
|
|
|
|
(get_local $x3_9)
|
|
(get_local $z3_9)
|
|
(i64.sub)
|
|
(set_local $tmp0_9)
|
|
|
|
;; fe25519_sub(tmp0, x3, z3)
|
|
(get_local $x2_0)
|
|
(get_local $z2_0)
|
|
(i64.sub)
|
|
(set_local $tmp1_0)
|
|
|
|
(get_local $x2_1)
|
|
(get_local $z2_1)
|
|
(i64.sub)
|
|
(set_local $tmp1_1)
|
|
|
|
(get_local $x2_2)
|
|
(get_local $z2_2)
|
|
(i64.sub)
|
|
(set_local $tmp1_2)
|
|
|
|
(get_local $x2_3)
|
|
(get_local $z2_3)
|
|
(i64.sub)
|
|
(set_local $tmp1_3)
|
|
|
|
(get_local $x2_4)
|
|
(get_local $z2_4)
|
|
(i64.sub)
|
|
(set_local $tmp1_4)
|
|
|
|
(get_local $x2_5)
|
|
(get_local $z2_5)
|
|
(i64.sub)
|
|
(set_local $tmp1_5)
|
|
|
|
(get_local $x2_6)
|
|
(get_local $z2_6)
|
|
(i64.sub)
|
|
(set_local $tmp1_6)
|
|
|
|
(get_local $x2_7)
|
|
(get_local $z2_7)
|
|
(i64.sub)
|
|
(set_local $tmp1_7)
|
|
|
|
(get_local $x2_8)
|
|
(get_local $z2_8)
|
|
(i64.sub)
|
|
(set_local $tmp1_8)
|
|
|
|
(get_local $x2_9)
|
|
(get_local $z2_9)
|
|
(i64.sub)
|
|
(set_local $tmp1_9)
|
|
|
|
;; fe25519_add(x2, x2, z2)
|
|
(get_local $x2_0)
|
|
(get_local $z2_0)
|
|
(i64.add)
|
|
(set_local $x2_0)
|
|
|
|
(get_local $x2_1)
|
|
(get_local $z2_1)
|
|
(i64.add)
|
|
(set_local $x2_1)
|
|
|
|
(get_local $x2_2)
|
|
(get_local $z2_2)
|
|
(i64.add)
|
|
(set_local $x2_2)
|
|
|
|
(get_local $x2_3)
|
|
(get_local $z2_3)
|
|
(i64.add)
|
|
(set_local $x2_3)
|
|
|
|
(get_local $x2_4)
|
|
(get_local $z2_4)
|
|
(i64.add)
|
|
(set_local $x2_4)
|
|
|
|
(get_local $x2_5)
|
|
(get_local $z2_5)
|
|
(i64.add)
|
|
(set_local $x2_5)
|
|
|
|
(get_local $x2_6)
|
|
(get_local $z2_6)
|
|
(i64.add)
|
|
(set_local $x2_6)
|
|
|
|
(get_local $x2_7)
|
|
(get_local $z2_7)
|
|
(i64.add)
|
|
(set_local $x2_7)
|
|
|
|
(get_local $x2_8)
|
|
(get_local $z2_8)
|
|
(i64.add)
|
|
(set_local $x2_8)
|
|
|
|
(get_local $x2_9)
|
|
(get_local $z2_9)
|
|
(i64.add)
|
|
(set_local $x2_9)
|
|
|
|
;; fe25519_add(z2, x3, z3)
|
|
(get_local $x3_0)
|
|
(get_local $z3_0)
|
|
(i64.add)
|
|
(set_local $z2_0)
|
|
|
|
(get_local $x3_1)
|
|
(get_local $z3_1)
|
|
(i64.add)
|
|
(set_local $z2_1)
|
|
|
|
(get_local $x3_2)
|
|
(get_local $z3_2)
|
|
(i64.add)
|
|
(set_local $z2_2)
|
|
|
|
(get_local $x3_3)
|
|
(get_local $z3_3)
|
|
(i64.add)
|
|
(set_local $z2_3)
|
|
|
|
(get_local $x3_4)
|
|
(get_local $z3_4)
|
|
(i64.add)
|
|
(set_local $z2_4)
|
|
|
|
(get_local $x3_5)
|
|
(get_local $z3_5)
|
|
(i64.add)
|
|
(set_local $z2_5)
|
|
|
|
(get_local $x3_6)
|
|
(get_local $z3_6)
|
|
(i64.add)
|
|
(set_local $z2_6)
|
|
|
|
(get_local $x3_7)
|
|
(get_local $z3_7)
|
|
(i64.add)
|
|
(set_local $z2_7)
|
|
|
|
(get_local $x3_8)
|
|
(get_local $z3_8)
|
|
(i64.add)
|
|
(set_local $z2_8)
|
|
|
|
(get_local $x3_9)
|
|
(get_local $z3_9)
|
|
(i64.add)
|
|
(set_local $z2_9)
|
|
|
|
;; ptr0 <- z3 = x2 * tmp0
|
|
(get_local $x2_0)
|
|
(get_local $x2_1)
|
|
(get_local $x2_2)
|
|
(get_local $x2_3)
|
|
(get_local $x2_4)
|
|
(get_local $x2_5)
|
|
(get_local $x2_6)
|
|
(get_local $x2_7)
|
|
(get_local $x2_8)
|
|
(get_local $x2_9)
|
|
(get_local $tmp0_0)
|
|
(get_local $tmp0_1)
|
|
(get_local $tmp0_2)
|
|
(get_local $tmp0_3)
|
|
(get_local $tmp0_4)
|
|
(get_local $tmp0_5)
|
|
(get_local $tmp0_6)
|
|
(get_local $tmp0_7)
|
|
(get_local $tmp0_8)
|
|
(get_local $tmp0_9)
|
|
(get_local $ptr0)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))
|
|
|
|
;; ptr1 <- z2 = z2 * tmp1
|
|
(get_local $tmp1_0)
|
|
(get_local $tmp1_1)
|
|
(get_local $tmp1_2)
|
|
(get_local $tmp1_3)
|
|
(get_local $tmp1_4)
|
|
(get_local $tmp1_5)
|
|
(get_local $tmp1_6)
|
|
(get_local $tmp1_7)
|
|
(get_local $tmp1_8)
|
|
(get_local $tmp1_9)
|
|
(get_local $z2_0)
|
|
(get_local $z2_1)
|
|
(get_local $z2_2)
|
|
(get_local $z2_3)
|
|
(get_local $z2_4)
|
|
(get_local $z2_5)
|
|
(get_local $z2_6)
|
|
(get_local $z2_7)
|
|
(get_local $z2_8)
|
|
(get_local $z2_9)
|
|
(get_local $ptr1)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))
|
|
|
|
;; ptr2 <- tmp0 = tmp1 ^ 2
|
|
(get_local $tmp1_0)
|
|
(get_local $tmp1_1)
|
|
(get_local $tmp1_2)
|
|
(get_local $tmp1_3)
|
|
(get_local $tmp1_4)
|
|
(get_local $tmp1_5)
|
|
(get_local $tmp1_6)
|
|
(get_local $tmp1_7)
|
|
(get_local $tmp1_8)
|
|
(get_local $tmp1_9)
|
|
(i32.const 0)
|
|
(i32.const 0)
|
|
(get_local $ptr2)
|
|
(i32.const 2)
|
|
(call_indirect (type $fe_sq))
|
|
|
|
;; ptr3 <- tmp1 = x2 ^ 2
|
|
(get_local $x2_0)
|
|
(get_local $x2_1)
|
|
(get_local $x2_2)
|
|
(get_local $x2_3)
|
|
(get_local $x2_4)
|
|
(get_local $x2_5)
|
|
(get_local $x2_6)
|
|
(get_local $x2_7)
|
|
(get_local $x2_8)
|
|
(get_local $x2_9)
|
|
(i32.const 0)
|
|
(i32.const 0)
|
|
(get_local $ptr3)
|
|
(i32.const 2)
|
|
(call_indirect (type $fe_sq))
|
|
|
|
;; z3 <- load(ptr0)
|
|
(set_local $z3_0 (i64.load32_u offset=0 (get_local $ptr0)))
|
|
(set_local $z3_1 (i64.load32_u offset=4 (get_local $ptr0)))
|
|
(set_local $z3_2 (i64.load32_u offset=8 (get_local $ptr0)))
|
|
(set_local $z3_3 (i64.load32_u offset=12 (get_local $ptr0)))
|
|
(set_local $z3_4 (i64.load32_u offset=16 (get_local $ptr0)))
|
|
(set_local $z3_5 (i64.load32_u offset=20 (get_local $ptr0)))
|
|
(set_local $z3_6 (i64.load32_u offset=24 (get_local $ptr0)))
|
|
(set_local $z3_7 (i64.load32_u offset=28 (get_local $ptr0)))
|
|
(set_local $z3_8 (i64.load32_u offset=32 (get_local $ptr0)))
|
|
(set_local $z3_9 (i64.load32_u offset=36 (get_local $ptr0)))
|
|
|
|
;; z2 <- load(ptr1)
|
|
(set_local $z2_0 (i64.load32_u offset=0 (get_local $ptr1)))
|
|
(set_local $z2_1 (i64.load32_u offset=4 (get_local $ptr1)))
|
|
(set_local $z2_2 (i64.load32_u offset=8 (get_local $ptr1)))
|
|
(set_local $z2_3 (i64.load32_u offset=12 (get_local $ptr1)))
|
|
(set_local $z2_4 (i64.load32_u offset=16 (get_local $ptr1)))
|
|
(set_local $z2_5 (i64.load32_u offset=20 (get_local $ptr1)))
|
|
(set_local $z2_6 (i64.load32_u offset=24 (get_local $ptr1)))
|
|
(set_local $z2_7 (i64.load32_u offset=28 (get_local $ptr1)))
|
|
(set_local $z2_8 (i64.load32_u offset=32 (get_local $ptr1)))
|
|
(set_local $z2_9 (i64.load32_u offset=36 (get_local $ptr1)))
|
|
|
|
;; tmp0 <- load(ptr2)
|
|
(set_local $tmp0_0 (i64.load32_u offset=0 (get_local $ptr2)))
|
|
(set_local $tmp0_1 (i64.load32_u offset=4 (get_local $ptr2)))
|
|
(set_local $tmp0_2 (i64.load32_u offset=8 (get_local $ptr2)))
|
|
(set_local $tmp0_3 (i64.load32_u offset=12 (get_local $ptr2)))
|
|
(set_local $tmp0_4 (i64.load32_u offset=16 (get_local $ptr2)))
|
|
(set_local $tmp0_5 (i64.load32_u offset=20 (get_local $ptr2)))
|
|
(set_local $tmp0_6 (i64.load32_u offset=24 (get_local $ptr2)))
|
|
(set_local $tmp0_7 (i64.load32_u offset=28 (get_local $ptr2)))
|
|
(set_local $tmp0_8 (i64.load32_u offset=32 (get_local $ptr2)))
|
|
(set_local $tmp0_9 (i64.load32_u offset=36 (get_local $ptr2)))
|
|
|
|
;; tmp1 <- load(ptr3)
|
|
(set_local $tmp1_0 (i64.load32_u offset=0 (get_local $ptr3)))
|
|
(set_local $tmp1_1 (i64.load32_u offset=4 (get_local $ptr3)))
|
|
(set_local $tmp1_2 (i64.load32_u offset=8 (get_local $ptr3)))
|
|
(set_local $tmp1_3 (i64.load32_u offset=12 (get_local $ptr3)))
|
|
(set_local $tmp1_4 (i64.load32_u offset=16 (get_local $ptr3)))
|
|
(set_local $tmp1_5 (i64.load32_u offset=20 (get_local $ptr3)))
|
|
(set_local $tmp1_6 (i64.load32_u offset=24 (get_local $ptr3)))
|
|
(set_local $tmp1_7 (i64.load32_u offset=28 (get_local $ptr3)))
|
|
(set_local $tmp1_8 (i64.load32_u offset=32 (get_local $ptr3)))
|
|
(set_local $tmp1_9 (i64.load32_u offset=36 (get_local $ptr3)))
|
|
|
|
;; fe25519_add(x3, z3, z2)
|
|
(get_local $z3_0)
|
|
(get_local $z2_0)
|
|
(i64.add)
|
|
(set_local $x3_0)
|
|
|
|
(get_local $z3_1)
|
|
(get_local $z2_1)
|
|
(i64.add)
|
|
(set_local $x3_1)
|
|
|
|
(get_local $z3_2)
|
|
(get_local $z2_2)
|
|
(i64.add)
|
|
(set_local $x3_2)
|
|
|
|
(get_local $z3_3)
|
|
(get_local $z2_3)
|
|
(i64.add)
|
|
(set_local $x3_3)
|
|
|
|
(get_local $z3_4)
|
|
(get_local $z2_4)
|
|
(i64.add)
|
|
(set_local $x3_4)
|
|
|
|
(get_local $z3_5)
|
|
(get_local $z2_5)
|
|
(i64.add)
|
|
(set_local $x3_5)
|
|
|
|
(get_local $z3_6)
|
|
(get_local $z2_6)
|
|
(i64.add)
|
|
(set_local $x3_6)
|
|
|
|
(get_local $z3_7)
|
|
(get_local $z2_7)
|
|
(i64.add)
|
|
(set_local $x3_7)
|
|
|
|
(get_local $z3_8)
|
|
(get_local $z2_8)
|
|
(i64.add)
|
|
(set_local $x3_8)
|
|
|
|
(get_local $z3_9)
|
|
(get_local $z2_9)
|
|
(i64.add)
|
|
(set_local $x3_9)
|
|
|
|
;; fe25519_sub(z2, z3, z2)
|
|
(get_local $z3_0)
|
|
(get_local $z2_0)
|
|
(i64.sub)
|
|
(set_local $z2_0)
|
|
|
|
(get_local $z3_1)
|
|
(get_local $z2_1)
|
|
(i64.sub)
|
|
(set_local $z2_1)
|
|
|
|
(get_local $z3_2)
|
|
(get_local $z2_2)
|
|
(i64.sub)
|
|
(set_local $z2_2)
|
|
|
|
(get_local $z3_3)
|
|
(get_local $z2_3)
|
|
(i64.sub)
|
|
(set_local $z2_3)
|
|
|
|
(get_local $z3_4)
|
|
(get_local $z2_4)
|
|
(i64.sub)
|
|
(set_local $z2_4)
|
|
|
|
(get_local $z3_5)
|
|
(get_local $z2_5)
|
|
(i64.sub)
|
|
(set_local $z2_5)
|
|
|
|
(get_local $z3_6)
|
|
(get_local $z2_6)
|
|
(i64.sub)
|
|
(set_local $z2_6)
|
|
|
|
(get_local $z3_7)
|
|
(get_local $z2_7)
|
|
(i64.sub)
|
|
(set_local $z2_7)
|
|
|
|
(get_local $z3_8)
|
|
(get_local $z2_8)
|
|
(i64.sub)
|
|
(set_local $z2_8)
|
|
|
|
(get_local $z3_9)
|
|
(get_local $z2_9)
|
|
(i64.sub)
|
|
(set_local $z2_9)
|
|
|
|
;; ptr1 <- x2 = tmp0 * tmp1
|
|
(get_local $tmp1_0)
|
|
(get_local $tmp1_1)
|
|
(get_local $tmp1_2)
|
|
(get_local $tmp1_3)
|
|
(get_local $tmp1_4)
|
|
(get_local $tmp1_5)
|
|
(get_local $tmp1_6)
|
|
(get_local $tmp1_7)
|
|
(get_local $tmp1_8)
|
|
(get_local $tmp1_9)
|
|
(get_local $tmp0_0)
|
|
(get_local $tmp0_1)
|
|
(get_local $tmp0_2)
|
|
(get_local $tmp0_3)
|
|
(get_local $tmp0_4)
|
|
(get_local $tmp0_5)
|
|
(get_local $tmp0_6)
|
|
(get_local $tmp0_7)
|
|
(get_local $tmp0_8)
|
|
(get_local $tmp0_9)
|
|
(get_local $ptr0)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))
|
|
|
|
;; tmp1 = tmp1 - tmp0
|
|
(get_local $tmp1_0)
|
|
(get_local $tmp0_0)
|
|
(i64.sub)
|
|
(set_local $tmp1_0)
|
|
|
|
(get_local $tmp1_1)
|
|
(get_local $tmp0_1)
|
|
(i64.sub)
|
|
(set_local $tmp1_1)
|
|
|
|
(get_local $tmp1_2)
|
|
(get_local $tmp0_2)
|
|
(i64.sub)
|
|
(set_local $tmp1_2)
|
|
|
|
(get_local $tmp1_3)
|
|
(get_local $tmp0_3)
|
|
(i64.sub)
|
|
(set_local $tmp1_3)
|
|
|
|
(get_local $tmp1_4)
|
|
(get_local $tmp0_4)
|
|
(i64.sub)
|
|
(set_local $tmp1_4)
|
|
|
|
(get_local $tmp1_5)
|
|
(get_local $tmp0_5)
|
|
(i64.sub)
|
|
(set_local $tmp1_5)
|
|
|
|
(get_local $tmp1_6)
|
|
(get_local $tmp0_6)
|
|
(i64.sub)
|
|
(set_local $tmp1_6)
|
|
|
|
(get_local $tmp1_7)
|
|
(get_local $tmp0_7)
|
|
(i64.sub)
|
|
(set_local $tmp1_7)
|
|
|
|
(get_local $tmp1_8)
|
|
(get_local $tmp0_8)
|
|
(i64.sub)
|
|
(set_local $tmp1_8)
|
|
|
|
(get_local $tmp1_9)
|
|
(get_local $tmp0_9)
|
|
(i64.sub)
|
|
(set_local $tmp1_9)
|
|
|
|
;; ptr0 <- z2 = z2 ^ 2
|
|
(get_local $z2_0)
|
|
(get_local $z2_1)
|
|
(get_local $z2_2)
|
|
(get_local $z2_3)
|
|
(get_local $z2_4)
|
|
(get_local $z2_5)
|
|
(get_local $z2_6)
|
|
(get_local $z2_7)
|
|
(get_local $z2_8)
|
|
(get_local $z2_9)
|
|
(i32.const 0)
|
|
(i32.const 0)
|
|
(get_local $ptr1)
|
|
(i32.const 2)
|
|
(call_indirect (type $fe_sq))
|
|
|
|
;; ptr1 <- z3 = tmp1 * _121666
|
|
(i64.const 121666)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(i64.const 0)
|
|
(get_local $tmp1_0)
|
|
(get_local $tmp1_1)
|
|
(get_local $tmp1_2)
|
|
(get_local $tmp1_3)
|
|
(get_local $tmp1_4)
|
|
(get_local $tmp1_5)
|
|
(get_local $tmp1_6)
|
|
(get_local $tmp1_7)
|
|
(get_local $tmp1_8)
|
|
(get_local $tmp1_9)
|
|
(get_local $ptr2)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))
|
|
|
|
;; ptr2 <- x3 = x3 ^ 2
|
|
(get_local $x3_0)
|
|
(get_local $x3_1)
|
|
(get_local $x3_2)
|
|
(get_local $x3_3)
|
|
(get_local $x3_4)
|
|
(get_local $x3_5)
|
|
(get_local $x3_6)
|
|
(get_local $x3_7)
|
|
(get_local $x3_8)
|
|
(get_local $x3_9)
|
|
(i32.const 0)
|
|
(i32.const 0)
|
|
(get_local $ptr3)
|
|
(i32.const 2)
|
|
(call_indirect (type $fe_sq))
|
|
|
|
;; x2 <- load(ptr0)
|
|
(set_local $x2_0 (i64.load32_u offset=0 (get_local $ptr0)))
|
|
(set_local $x2_1 (i64.load32_u offset=4 (get_local $ptr0)))
|
|
(set_local $x2_2 (i64.load32_u offset=8 (get_local $ptr0)))
|
|
(set_local $x2_3 (i64.load32_u offset=12 (get_local $ptr0)))
|
|
(set_local $x2_4 (i64.load32_u offset=16 (get_local $ptr0)))
|
|
(set_local $x2_5 (i64.load32_u offset=20 (get_local $ptr0)))
|
|
(set_local $x2_6 (i64.load32_u offset=24 (get_local $ptr0)))
|
|
(set_local $x2_7 (i64.load32_u offset=28 (get_local $ptr0)))
|
|
(set_local $x2_8 (i64.load32_u offset=32 (get_local $ptr0)))
|
|
(set_local $x2_9 (i64.load32_u offset=36 (get_local $ptr0)))
|
|
|
|
;; z2 <- load(ptr1)
|
|
(set_local $z2_0 (i64.load32_u offset=0 (get_local $ptr1)))
|
|
(set_local $z2_1 (i64.load32_u offset=4 (get_local $ptr1)))
|
|
(set_local $z2_2 (i64.load32_u offset=8 (get_local $ptr1)))
|
|
(set_local $z2_3 (i64.load32_u offset=12 (get_local $ptr1)))
|
|
(set_local $z2_4 (i64.load32_u offset=16 (get_local $ptr1)))
|
|
(set_local $z2_5 (i64.load32_u offset=20 (get_local $ptr1)))
|
|
(set_local $z2_6 (i64.load32_u offset=24 (get_local $ptr1)))
|
|
(set_local $z2_7 (i64.load32_u offset=28 (get_local $ptr1)))
|
|
(set_local $z2_8 (i64.load32_u offset=32 (get_local $ptr1)))
|
|
(set_local $z2_9 (i64.load32_u offset=36 (get_local $ptr1)))
|
|
|
|
;; z3 <- load(ptr2)
|
|
(set_local $z3_0 (i64.load32_u offset=0 (get_local $ptr2)))
|
|
(set_local $z3_1 (i64.load32_u offset=4 (get_local $ptr2)))
|
|
(set_local $z3_2 (i64.load32_u offset=8 (get_local $ptr2)))
|
|
(set_local $z3_3 (i64.load32_u offset=12 (get_local $ptr2)))
|
|
(set_local $z3_4 (i64.load32_u offset=16 (get_local $ptr2)))
|
|
(set_local $z3_5 (i64.load32_u offset=20 (get_local $ptr2)))
|
|
(set_local $z3_6 (i64.load32_u offset=24 (get_local $ptr2)))
|
|
(set_local $z3_7 (i64.load32_u offset=28 (get_local $ptr2)))
|
|
(set_local $z3_8 (i64.load32_u offset=32 (get_local $ptr2)))
|
|
(set_local $z3_9 (i64.load32_u offset=36 (get_local $ptr2)))
|
|
|
|
;; x3 <- load(ptr3)
|
|
(set_local $x3_0 (i64.load32_u offset=0 (get_local $ptr3)))
|
|
(set_local $x3_1 (i64.load32_u offset=4 (get_local $ptr3)))
|
|
(set_local $x3_2 (i64.load32_u offset=8 (get_local $ptr3)))
|
|
(set_local $x3_3 (i64.load32_u offset=12 (get_local $ptr3)))
|
|
(set_local $x3_4 (i64.load32_u offset=16 (get_local $ptr3)))
|
|
(set_local $x3_5 (i64.load32_u offset=20 (get_local $ptr3)))
|
|
(set_local $x3_6 (i64.load32_u offset=24 (get_local $ptr3)))
|
|
(set_local $x3_7 (i64.load32_u offset=28 (get_local $ptr3)))
|
|
(set_local $x3_8 (i64.load32_u offset=32 (get_local $ptr3)))
|
|
(set_local $x3_9 (i64.load32_u offset=36 (get_local $ptr3)))
|
|
|
|
(get_local $tmp0_0)
|
|
(get_local $z3_0)
|
|
(i64.add)
|
|
(set_local $tmp0_0)
|
|
|
|
(get_local $tmp0_1)
|
|
(get_local $z3_1)
|
|
(i64.add)
|
|
(set_local $tmp0_1)
|
|
|
|
(get_local $tmp0_2)
|
|
(get_local $z3_2)
|
|
(i64.add)
|
|
(set_local $tmp0_2)
|
|
|
|
(get_local $tmp0_3)
|
|
(get_local $z3_3)
|
|
(i64.add)
|
|
(set_local $tmp0_3)
|
|
|
|
(get_local $tmp0_4)
|
|
(get_local $z3_4)
|
|
(i64.add)
|
|
(set_local $tmp0_4)
|
|
|
|
(get_local $tmp0_5)
|
|
(get_local $z3_5)
|
|
(i64.add)
|
|
(set_local $tmp0_5)
|
|
|
|
(get_local $tmp0_6)
|
|
(get_local $z3_6)
|
|
(i64.add)
|
|
(set_local $tmp0_6)
|
|
|
|
(get_local $tmp0_7)
|
|
(get_local $z3_7)
|
|
(i64.add)
|
|
(set_local $tmp0_7)
|
|
|
|
(get_local $tmp0_8)
|
|
(get_local $z3_8)
|
|
(i64.add)
|
|
(set_local $tmp0_8)
|
|
|
|
(get_local $tmp0_9)
|
|
(get_local $z3_9)
|
|
(i64.add)
|
|
(set_local $tmp0_9)
|
|
|
|
;; ptr1 <- z3 = x1 * z2
|
|
(get_local $x1_0)
|
|
(get_local $x1_1)
|
|
(get_local $x1_2)
|
|
(get_local $x1_3)
|
|
(get_local $x1_4)
|
|
(get_local $x1_5)
|
|
(get_local $x1_6)
|
|
(get_local $x1_7)
|
|
(get_local $x1_8)
|
|
(get_local $x1_9)
|
|
(get_local $z2_0)
|
|
(get_local $z2_1)
|
|
(get_local $z2_2)
|
|
(get_local $z2_3)
|
|
(get_local $z2_4)
|
|
(get_local $z2_5)
|
|
(get_local $z2_6)
|
|
(get_local $z2_7)
|
|
(get_local $z2_8)
|
|
(get_local $z2_9)
|
|
(get_local $ptr1)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))
|
|
|
|
;; ptr0 <- z2 = tmp1 * tmp0
|
|
(get_local $tmp0_0)
|
|
(get_local $tmp0_1)
|
|
(get_local $tmp0_2)
|
|
(get_local $tmp0_3)
|
|
(get_local $tmp0_4)
|
|
(get_local $tmp0_5)
|
|
(get_local $tmp0_6)
|
|
(get_local $tmp0_7)
|
|
(get_local $tmp0_8)
|
|
(get_local $tmp0_9)
|
|
(get_local $tmp1_0)
|
|
(get_local $tmp1_1)
|
|
(get_local $tmp1_2)
|
|
(get_local $tmp1_3)
|
|
(get_local $tmp1_4)
|
|
(get_local $tmp1_5)
|
|
(get_local $tmp1_6)
|
|
(get_local $tmp1_7)
|
|
(get_local $tmp1_8)
|
|
(get_local $tmp1_9)
|
|
(get_local $ptr0)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))
|
|
|
|
;; tmp0 <- load(ptr2)
|
|
(set_local $z2_0 (i64.load32_u offset=0 (get_local $ptr0)))
|
|
(set_local $z2_1 (i64.load32_u offset=4 (get_local $ptr0)))
|
|
(set_local $z2_2 (i64.load32_u offset=8 (get_local $ptr0)))
|
|
(set_local $z2_3 (i64.load32_u offset=12 (get_local $ptr0)))
|
|
(set_local $z2_4 (i64.load32_u offset=16 (get_local $ptr0)))
|
|
(set_local $z2_5 (i64.load32_u offset=20 (get_local $ptr0)))
|
|
(set_local $z2_6 (i64.load32_u offset=24 (get_local $ptr0)))
|
|
(set_local $z2_7 (i64.load32_u offset=28 (get_local $ptr0)))
|
|
(set_local $z2_8 (i64.load32_u offset=32 (get_local $ptr0)))
|
|
(set_local $z2_9 (i64.load32_u offset=36 (get_local $ptr0)))
|
|
|
|
;; tmp0 <- load(ptr2)
|
|
(set_local $z3_0 (i64.load32_u offset=0 (get_local $ptr1)))
|
|
(set_local $z3_1 (i64.load32_u offset=4 (get_local $ptr1)))
|
|
(set_local $z3_2 (i64.load32_u offset=8 (get_local $ptr1)))
|
|
(set_local $z3_3 (i64.load32_u offset=12 (get_local $ptr1)))
|
|
(set_local $z3_4 (i64.load32_u offset=16 (get_local $ptr1)))
|
|
(set_local $z3_5 (i64.load32_u offset=20 (get_local $ptr1)))
|
|
(set_local $z3_6 (i64.load32_u offset=24 (get_local $ptr1)))
|
|
(set_local $z3_7 (i64.load32_u offset=28 (get_local $ptr1)))
|
|
(set_local $z3_8 (i64.load32_u offset=32 (get_local $ptr1)))
|
|
(set_local $z3_9 (i64.load32_u offset=36 (get_local $ptr1)))
|
|
|
|
(get_local $pos)
|
|
(i32.const 1)
|
|
(i32.sub)
|
|
(set_local $pos)
|
|
(br $start)))
|
|
|
|
;; (call $i32.log (get_local $res_x2))
|
|
(i32.const 0)
|
|
(get_local $swap)
|
|
(i32.sub)
|
|
(i64.extend_u/i32)
|
|
(set_local $mask)
|
|
|
|
(get_local $x2_0)
|
|
(get_local $x3_0)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_0)
|
|
|
|
(get_local $x2_1)
|
|
(get_local $x3_1)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_1)
|
|
|
|
(get_local $x2_2)
|
|
(get_local $x3_2)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_2)
|
|
|
|
(get_local $x2_3)
|
|
(get_local $x3_3)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_3)
|
|
|
|
(get_local $x2_4)
|
|
(get_local $x3_4)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_4)
|
|
|
|
(get_local $x2_5)
|
|
(get_local $x3_5)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_5)
|
|
|
|
(get_local $x2_6)
|
|
(get_local $x3_6)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_6)
|
|
|
|
(get_local $x2_7)
|
|
(get_local $x3_7)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_7)
|
|
|
|
(get_local $x2_8)
|
|
(get_local $x3_8)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_8)
|
|
|
|
(get_local $x2_9)
|
|
(get_local $x3_9)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_9)
|
|
|
|
|
|
(get_local $x2_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $x2_0)
|
|
|
|
(get_local $x2_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $x2_1)
|
|
|
|
(get_local $x2_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $x2_2)
|
|
|
|
(get_local $x2_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $x2_3)
|
|
|
|
(get_local $x2_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $x2_4)
|
|
|
|
(get_local $x2_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $x2_5)
|
|
|
|
(get_local $x2_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $x2_6)
|
|
|
|
(get_local $x2_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $x2_7)
|
|
|
|
(get_local $x2_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $x2_8)
|
|
|
|
(get_local $x2_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $x2_9)
|
|
|
|
|
|
(get_local $x3_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $x3_0)
|
|
|
|
(get_local $x3_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $x3_1)
|
|
|
|
(get_local $x3_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $x3_2)
|
|
|
|
(get_local $x3_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $x3_3)
|
|
|
|
(get_local $x3_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $x3_4)
|
|
|
|
(get_local $x3_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $x3_5)
|
|
|
|
(get_local $x3_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $x3_6)
|
|
|
|
(get_local $x3_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $x3_7)
|
|
|
|
(get_local $x3_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $x3_8)
|
|
|
|
(get_local $x3_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $x3_9)
|
|
|
|
|
|
(get_local $z2_0)
|
|
(get_local $z3_0)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_0)
|
|
|
|
(get_local $z2_1)
|
|
(get_local $z3_1)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_1)
|
|
|
|
(get_local $z2_2)
|
|
(get_local $z3_2)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_2)
|
|
|
|
(get_local $z2_3)
|
|
(get_local $z3_3)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_3)
|
|
|
|
(get_local $z2_4)
|
|
(get_local $z3_4)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_4)
|
|
|
|
(get_local $z2_5)
|
|
(get_local $z3_5)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_5)
|
|
|
|
(get_local $z2_6)
|
|
(get_local $z3_6)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_6)
|
|
|
|
(get_local $z2_7)
|
|
(get_local $z3_7)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_7)
|
|
|
|
(get_local $z2_8)
|
|
(get_local $z3_8)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_8)
|
|
|
|
(get_local $z2_9)
|
|
(get_local $z3_9)
|
|
(i64.xor)
|
|
(get_local $mask)
|
|
(i64.and)
|
|
(set_local $tmp0_9)
|
|
|
|
|
|
(get_local $z2_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $z2_0)
|
|
|
|
(get_local $z2_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $z2_1)
|
|
|
|
(get_local $z2_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $z2_2)
|
|
|
|
(get_local $z2_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $z2_3)
|
|
|
|
(get_local $z2_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $z2_4)
|
|
|
|
(get_local $z2_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $z2_5)
|
|
|
|
(get_local $z2_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $z2_6)
|
|
|
|
(get_local $z2_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $z2_7)
|
|
|
|
(get_local $z2_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $z2_8)
|
|
|
|
(get_local $z2_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $z2_9)
|
|
|
|
|
|
(get_local $z3_0)
|
|
(get_local $tmp0_0)
|
|
(i64.xor)
|
|
(set_local $z3_0)
|
|
|
|
(get_local $z3_1)
|
|
(get_local $tmp0_1)
|
|
(i64.xor)
|
|
(set_local $z3_1)
|
|
|
|
(get_local $z3_2)
|
|
(get_local $tmp0_2)
|
|
(i64.xor)
|
|
(set_local $z3_2)
|
|
|
|
(get_local $z3_3)
|
|
(get_local $tmp0_3)
|
|
(i64.xor)
|
|
(set_local $z3_3)
|
|
|
|
(get_local $z3_4)
|
|
(get_local $tmp0_4)
|
|
(i64.xor)
|
|
(set_local $z3_4)
|
|
|
|
(get_local $z3_5)
|
|
(get_local $tmp0_5)
|
|
(i64.xor)
|
|
(set_local $z3_5)
|
|
|
|
(get_local $z3_6)
|
|
(get_local $tmp0_6)
|
|
(i64.xor)
|
|
(set_local $z3_6)
|
|
|
|
(get_local $z3_7)
|
|
(get_local $tmp0_7)
|
|
(i64.xor)
|
|
(set_local $z3_7)
|
|
|
|
(get_local $z3_8)
|
|
(get_local $tmp0_8)
|
|
(i64.xor)
|
|
(set_local $z3_8)
|
|
|
|
(get_local $z3_9)
|
|
(get_local $tmp0_9)
|
|
(i64.xor)
|
|
(set_local $z3_9)
|
|
|
|
|
|
(get_local $z2_0)
|
|
(get_local $z2_1)
|
|
(get_local $z2_2)
|
|
(get_local $z2_3)
|
|
(get_local $z2_4)
|
|
(get_local $z2_5)
|
|
(get_local $z2_6)
|
|
(get_local $z2_7)
|
|
(get_local $z2_8)
|
|
(get_local $z2_9)
|
|
(get_local $ptr0)
|
|
(i32.const 3)
|
|
(call_indirect (type $fe_invert))
|
|
|
|
(i64.load32_u offset=0 (get_local $ptr0))
|
|
(i64.load32_u offset=4 (get_local $ptr0))
|
|
(i64.load32_u offset=8 (get_local $ptr0))
|
|
(i64.load32_u offset=12 (get_local $ptr0))
|
|
(i64.load32_u offset=16 (get_local $ptr0))
|
|
(i64.load32_u offset=20 (get_local $ptr0))
|
|
(i64.load32_u offset=24 (get_local $ptr0))
|
|
(i64.load32_u offset=28 (get_local $ptr0))
|
|
(i64.load32_u offset=32 (get_local $ptr0))
|
|
(i64.load32_u offset=36 (get_local $ptr0))
|
|
(get_local $x2_0)
|
|
(get_local $x2_1)
|
|
(get_local $x2_2)
|
|
(get_local $x2_3)
|
|
(get_local $x2_4)
|
|
(get_local $x2_5)
|
|
(get_local $x2_6)
|
|
(get_local $x2_7)
|
|
(get_local $x2_8)
|
|
(get_local $x2_9)
|
|
(get_local $res_x2)
|
|
(i32.const 1)
|
|
(call_indirect (type $fe_mul))))
|