func cswap(xPx, xPz, xQx, xQz *common.Fp2, choice uint8) {
	cswapP503(&xPx.A, &xQx.A, choice)
	cswapP503(&xPx.B, &xQx.B, choice)
	cswapP503(&xPz.A, &xQz.A, choice)
	cswapP503(&xPz.B, &xQz.B, choice)
}
In case choice == 1, performs following swap in constant time:
xPx <-> xQx
xPz <-> xQz
Otherwise returns xPx, xPz, xQx, xQz unchanged
package p503
import (
	"github.com/cloudflare/circl/dh/sidh/internal/common"
)
func mulP(dest, lhs, rhs *common.Fp) {
	var ab common.FpX2
	mulP503(&ab, lhs, rhs)  
	rdcP503(dest, &ab)      
}
func p34(dest, x *common.Fp) {
	var lookup [16]common.Fp
	powStrategy := []uint8{12, 5, 5, 2, 7, 11, 3, 8, 4, 11, 4, 7, 5, 6, 3, 7, 5, 7, 2, 12, 5, 6, 4, 6, 8, 6, 4, 7, 5, 5, 8, 5, 8, 5, 5, 8, 9, 3, 6, 2, 10, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3}
	mulStrategy := []uint8{12, 11, 10, 0, 1, 8, 3, 7, 1, 8, 3, 6, 7, 14, 2, 14, 14, 9, 0, 13, 9, 15, 5, 12, 7, 13, 7, 15, 6, 7, 9, 0, 5, 7, 6, 8, 8, 3, 7, 0, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3}
	initialMul := uint8(0)
	var xx common.Fp
	mulP(&xx, x, x)
	lookup[0] = *x
	for i := 1; i < 16; i++ {
		mulP(&lookup[i], &lookup[i-1], &xx)
	}
	*dest = lookup[initialMul]
	for i := uint8(0); i < uint8(len(powStrategy)); i++ {
		mulP(dest, dest, dest)
		for j := uint8(1); j < powStrategy[i]; j++ {
			mulP(dest, dest, dest)
		}
		mulP(dest, dest, &lookup[mulStrategy[i]])
	}
}
func add(dest, lhs, rhs *common.Fp2) {
	addP503(&dest.A, &lhs.A, &rhs.A)
	addP503(&dest.B, &lhs.B, &rhs.B)
}
func sub(dest, lhs, rhs *common.Fp2) {
	subP503(&dest.A, &lhs.A, &rhs.A)
	subP503(&dest.B, &lhs.B, &rhs.B)
}
func mul(dest, lhs, rhs *common.Fp2) {
	var bMinA, cMinD common.Fp
	var ac, bd common.FpX2
	var adPlusBc common.FpX2
	var acMinBd common.FpX2
	mulP503(&ac, &lhs.A, &rhs.A)        
	mulP503(&bd, &lhs.B, &rhs.B)        
	subP503(&bMinA, &lhs.B, &lhs.A)     
	subP503(&cMinD, &rhs.A, &rhs.B)     
	mulP503(&adPlusBc, &bMinA, &cMinD)  
	adlP503(&adPlusBc, &adPlusBc, &ac)  
	adlP503(&adPlusBc, &adPlusBc, &bd)  
	rdcP503(&dest.B, &adPlusBc)         
	sulP503(&acMinBd, &ac, &bd)         
	rdcP503(&dest.A, &acMinBd)          
}
func inv(dest, x *common.Fp2) {
	var e1, e2 common.FpX2
	var f1, f2 common.Fp
	mulP503(&e1, &x.A, &x.A)  
	mulP503(&e2, &x.B, &x.B)  
	adlP503(&e1, &e1, &e2)    
	rdcP503(&f1, &e1)         
	mulP(&f2, &f1, &f1)
	p34(&f2, &f2)
	mulP(&f2, &f2, &f2)
	mulP(&f2, &f2, &f1)
	mulP503(&e1, &x.A, &f2)
	rdcP503(&dest.A, &e1)
	subP503(&f1, &common.Fp{}, &x.B)
	mulP503(&e1, &f1, &f2)
	rdcP503(&dest.B, &e1)
}
func sqr(dest, x *common.Fp2) {
	var a2, aPlusB, aMinusB common.Fp
	var a2MinB2, ab2 common.FpX2
	a := &x.A
	b := &x.B
	addP503(&a2, a, a)                    
	addP503(&aPlusB, a, b)                
	subP503(&aMinusB, a, b)               
	mulP503(&a2MinB2, &aPlusB, &aMinusB)  
	mulP503(&ab2, &a2, b)                 
	rdcP503(&dest.A, &a2MinB2)            
	rdcP503(&dest.B, &ab2)                
}