// mulMod computes z = (x * y) % p.
432384
func mulMod(x *big.Int, y *big.Int, p *big.Int) (z *big.Int) {
	n := new(big.Int).Set(x)
	z = big.NewInt(0)

	for i := 0; i < y.BitLen(); i++ {
		if y.Bit(i) == 1 {
			z = addMod(z, n, p)
		}
		n = addMod(n, n, p)
	}

	return z
}
363157
func FuzzMul(data []byte) int {
	// Ensure we have enough data in the first place
	if len(data) != 96 {
		return 0
	}
	// Ensure both libs can parse the curve point
	pc := new(cloudflare.G1)
	_, errc := pc.Unmarshal(data[:64])

	pg := new(google.G1)
	_, errg := pg.Unmarshal(data[:64])

	if (errc == nil) != (errg == nil) {
		panic("parse mismatch")
	} else if errc != nil {
		return 0
	}
	// Add the two points and ensure they result in the same output
	rc := new(cloudflare.G1)
	rc.ScalarMult(pc, new(big.Int).SetBytes(data[64:]))

	rg := new(google.G1)
	rg.ScalarMult(pg, new(big.Int).SetBytes(data[64:]))

	if !bytes.Equal(rc.Marshal(), rg.Marshal()) {
		panic("scalar mul mismatch")
	}
	return 0
}
1303169
func mul(x, y, poly int) int {
	z := 0
	for x > 0 {
		if x&1 != 0 {
			z ^= y
		}
		x >>= 1
		y <<= 1
		if y&0x100 != 0 {
			y ^= poly
		}
	}
	return z
}
433419
func (m1 Mat4x2) Mul2(m2 Mat2) Mat4x2 {
	return Mat4x2{
		m1[0]*m2[0] + m1[4]*m2[1],
		m1[1]*m2[0] + m1[5]*m2[1],
		m1[2]*m2[0] + m1[6]*m2[1],
		m1[3]*m2[0] + m1[7]*m2[1],
		m1[0]*m2[2] + m1[4]*m2[3],
		m1[1]*m2[2] + m1[5]*m2[3],
		m1[2]*m2[2] + m1[6]*m2[3],
		m1[3]*m2[2] + m1[7]*m2[3],
	}
}
297543
func Mul(a, b *T) T {
	q := T{
		a[3]*b[0] + a[0]*b[3] + a[1]*b[2] - a[2]*b[1],
		a[3]*b[1] + a[1]*b[3] + a[2]*b[0] - a[0]*b[2],
		a[3]*b[2] + a[2]*b[3] + a[0]*b[1] - a[1]*b[0],
		a[3]*b[3] - a[0]*b[0] - a[1]*b[1] - a[2]*b[2],
	}
	return q.Normalized()
}
230293
func (t Term) Mul(args ...interface{}) Term {
	return constructMethodTerm(t, "Mul", p.Term_MUL, args, map[string]interface{}{})
}
584508
func (z *Dec) Mul(x, y *Dec) *Dec {
	z.SetScale(x.Scale() + y.Scale())
	z.UnscaledBig().Mul(x.UnscaledBig(), y.UnscaledBig())
	return z
}
1032091
func Mult(in, base *[Size]byte) *[Size]byte {
	key := new([Size]byte)
	curve25519.ScalarMult(key, in, base)
	return key
}
1175930
func (m1 Mat4x2) Mul2x1(m2 Vec2) Vec4 {
	return Vec4{
		m1[0]*m2[0] + m1[4]*m2[1],
		m1[1]*m2[0] + m1[5]*m2[1],
		m1[2]*m2[0] + m1[6]*m2[1],
		m1[3]*m2[0] + m1[7]*m2[1],
	}
}
1211096
func Mul(a, b *Matrix) (*Matrix, error) {
	if a.Cols != b.Rows {
		return nil, errors.New("Size was wrong")
	}
	res := make([][]float32, a.Rows)
	var wg sync.WaitGroup
	for i := 0; i < int(a.Rows); i++ {
		wg.Add(1)
		go execMul(res, i, a, b, &wg)
	}
	wg.Wait()
	return NewMatrix(res), nil
}
72668
func (m1 Mat3x4) Mul(c float32) Mat3x4 {
	return Mat3x4{m1[0] * c, m1[1] * c, m1[2] * c, m1[3] * c, m1[4] * c, m1[5] * c, m1[6] * c, m1[7] * c, m1[8] * c, m1[9] * c, m1[10] * c, m1[11] * c}
}
269891
func Mul(a, b []float64) {
	if len(a) != len(b) {
		panic("vectors must be the same length")
	}
	mulAsm(a, b)
}
207626
func (c Context) Mul(z, x, y *Big) *Big {
	if z.invalidContext(c) {
		return z
	}
	return c.round(c.mul(z, x, y))
}
647795
func (m1 Mat3) Mul3(m2 Mat3) Mat3 {
	return Mat3{
		m1[0]*m2[0] + m1[3]*m2[1] + m1[6]*m2[2],
		m1[1]*m2[0] + m1[4]*m2[1] + m1[7]*m2[2],
		m1[2]*m2[0] + m1[5]*m2[1] + m1[8]*m2[2],
		m1[0]*m2[3] + m1[3]*m2[4] + m1[6]*m2[5],
		m1[1]*m2[3] + m1[4]*m2[4] + m1[7]*m2[5],
		m1[2]*m2[3] + m1[5]*m2[4] + m1[8]*m2[5],
		m1[0]*m2[6] + m1[3]*m2[7] + m1[6]*m2[8],
		m1[1]*m2[6] + m1[4]*m2[7] + m1[7]*m2[8],
		m1[2]*m2[6] + m1[5]*m2[7] + m1[8]*m2[8],
	}
}
1114048
func (g *gcm) mul(y *gcmFieldElement) {
	var z gcmFieldElement

	for i := 0; i < 2; i++ {
		word := y.high
		if i == 1 {
			word = y.low
		}

		// Multiplication works by multiplying z by 16 and adding in
		// one of the precomputed multiples of H.
		for j := 0; j < 64; j += 4 {
			msw := z.high & 0xf
			z.high >>= 4
			z.high |= z.low << 60
			z.low >>= 4
			z.low ^= uint64(gcmReductionTable[msw]) << 48

			// the values in |table| are ordered for
			// little-endian bit positions. See the comment
			// in NewGCMWithNonceSize.
			t := &g.productTable[word&0xf]

			z.low ^= t.low
			z.high ^= t.high
			word >>= 4
		}
	}

	*y = z
}
873126
func Mul(a, b *T) T {
	return T{a[0] * b[0], a[1] * b[1], a[2] * b[2]}
}
1108213
func (m1 Mat3x2) Mul(c float32) Mat3x2 {
	return Mat3x2{m1[0] * c, m1[1] * c, m1[2] * c, m1[3] * c, m1[4] * c, m1[5] * c}
}