// FuzzAdd fuzzez bn256 addition between the Google and Cloudflare libraries.
764290
func FuzzAdd(data []byte) int {
	// Ensure we have enough data in the first place
	if len(data) != 128 {
		return 0
	}
	// Ensure both libs can parse the first curve point
	xc := new(cloudflare.G1)
	_, errc := xc.Unmarshal(data[:64])

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

	if (errc == nil) != (errg == nil) {
		panic("parse mismatch")
	} else if errc != nil {
		return 0
	}
	// Ensure both libs can parse the second curve point
	yc := new(cloudflare.G1)
	_, errc = yc.Unmarshal(data[64:])

	yg := new(google.G1)
	_, errg = yg.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.Add(xc, yc)

	rg := new(google.G1)
	rg.Add(xg, yg)

	if !bytes.Equal(rc.Marshal(), rg.Marshal()) {
		panic("add mismatch")
	}
	return 0
}
1123615
func (c *ConfigLocal) BGFlushPeriod() time.Duration {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.bgFlushPeriod
}
322455
func NewFuzzyQuery(name string, value interface{}) *FuzzyQuery {
	q := &FuzzyQuery{
		name:  name,
		value: value,
	}
	return q
}
43511
func Fuzz(data []byte) int {
	if p, err := ReadPackageFile(bytes.NewReader(data)); err != nil {
		// handled errors are not very interesting
		return 0
	} else {
		// call some tag handlers
		_ = p.String()
		_ = p.Requires()
		_ = p.Conflicts()
		_ = p.Obsoletes()
		_ = p.Provides()

		// read all index values
		for _, h := range p.Headers {
			for _, x := range h.Indexes {
				switch x.Type {
				case IndexDataTypeBinary:
					_ = h.Indexes.BytesByTag(x.Tag)

				case IndexDataTypeChar, IndexDataTypeInt8, IndexDataTypeInt16, IndexDataTypeInt32, IndexDataTypeInt64:
					_ = h.Indexes.IntsByTag(x.Tag)
					_ = h.Indexes.IntByTag(x.Tag)

				case IndexDataTypeString, IndexDataTypeI8NString, IndexDataTypeStringArray:
					_ = h.Indexes.StringsByTag(x.Tag)
					_ = h.Indexes.StringByTag(x.Tag)
				}
			}
		}

		// everything worked with random input... interesting :|
		return 1
	}
}
477694
func Fuzz(data []byte) int {
	// Use the first two bytes to determine the proof index.
	if len(data) < 2 {
		return -1
	}
	index := 256*uint64(data[0]) + uint64(data[1])
	data = data[2:]

	// Build a reader proof for index 'index' using the remaining data as input
	// to the reader. '64' is chosen as the only input size because that is the
	// size relevant to the Sia project.
	merkleRoot, proofSet, numLeaves, err := BuildReaderProof(bytes.NewReader(data), sha256.New(), 64, index)
	if err != nil {
		return 0
	}
	if !VerifyProof(sha256.New(), merkleRoot, proofSet, index, numLeaves) {
		panic("verification failed!")
	}

	// Output is more interesting when there is enough data to contain the
	// index.
	if uint64(len(data)) > 64*index {
		return 1
	}
	return 0
}
584148
func Fuzz(data []byte) int {
	// Because go-fuzz requires this function signature with a []byte parameter,
	// and we want to emulate the behavior of mainScenario in lnwire_test.go,
	// we first parse the []byte parameter into a Message type.

	// Parsing []byte into Message
	r := bytes.NewReader(data)
	msg, err := lnwire.ReadMessage(r, 0)
	if err != nil {
		// Ignore this input - go-fuzz generated []byte that cannot be represented as Message
		return 0
	}

	// We will serialize Message into a new bytes buffer
	var b bytes.Buffer
	if _, err := lnwire.WriteMessage(&b, msg, 0); err != nil {
		// Could not serialize Message into bytes buffer, panic
		panic(err)
	}

	// Make sure serialized bytes buffer (excluding 2 bytes for message type
	// is less than max payload size for this specific message,.
	payloadLen := uint32(b.Len()) - 2
	if payloadLen > msg.MaxPayloadLength(0) {
		// Ignore this input - max payload constraint violated
		return 0
	}

	// Deserialize the message from the serialized bytes buffer and
	// assert that the original message is equal to the newly deserialized message.
	newMsg, err := lnwire.ReadMessage(&b, 0)
	if err != nil {
		// Could not deserialize message from bytes buffer, panic
		panic(err)
	}
	if !reflect.DeepEqual(msg, newMsg) {
		// Deserialized message and original message are not deeply equal
		panic(fmt.Errorf("Deserialized message and original message " +
			"are not deeply equal."))
	}

	return 1
}
1242170
func (lab *LevenshteinAutomatonBuilder) BuildDfa(query string,
	fuzziness uint8) (*DFA, error) {
	return lab.pDfa.buildDfa(query, fuzziness, false)
}
266601
func (b *UpdateBuilder) AddFunc(column string, fn *Func) *UpdateBuilder {
	return b.addValue(column, fn)
}
1369096
func Fuzz(data []byte) int {
	if len(data) == 0 {
		return -1
	}
	if data[0]%2 == 0 {
		return fuzzEncode(data[1:])
	}
	return fuzzDecode(data[1:])
}
674146
func (conn *Conn) FidGet(fidno uint32) *SrvFid {
	conn.Lock()
	fid, present := conn.fidpool[fidno]
	conn.Unlock()
	if present {
		fid.IncRef()
	}

	return fid
}
1153762
func DiffAddr(newConfig []*net.IPNet, oldConfig []*net.IPNet) (toBeDeleted []*net.IPNet, toBeAdded []*net.IPNet) {
	var add []*net.IPNet
	var del []*net.IPNet
	//sort
	n := SortedIPs(newConfig)
	sort.Sort(&n)
	o := SortedIPs(oldConfig)
	sort.Sort(&o)

	//compare
	i := 0
	j := 0
	for i < len(n) && j < len(o) {
		if eqAddr(n[i], o[j]) {
			i++
			j++
		} else {
			if lessAdrr(n[i], o[j]) {
				add = append(add, n[i])
				i++
			} else {
				del = append(del, o[j])
				j++
			}
		}
	}

	for ; i < len(n); i++ {
		add = append(add, n[i])
	}

	for ; j < len(o); j++ {
		del = append(del, o[j])
	}
	return del, add
}
568316
func fuzzEncode(data []byte) int {
	proc, _ := bitsetDecodeBytes(bitsetEncodeBytes(data), len(data))
	if !bytes.Equal(data, proc) {
		panic("content mismatch")
	}
	return 0
}
649743
func Fuzz(data []byte) int {
	list := pubsub.NewRecordList()
	isAdded := map[pubsub.Listener]bool{}
	for i := 0; i < len(data); i++ {
		listener := listeners[data[i]]
		if isAdded[listener] {
			list.Remove(event, listener)
			isAdded[listener] = false
		} else {
			list.Add(event, listener)
			isAdded[listener] = true
		}
	}

	result := list.ListenersFor(event)
	for i, l := range listeners {
		exists := false
		for _, l2 := range result {
			if l2 == l {
				exists = true
				break
			}
		}

		if exists != isAdded[l] {
			panic(fmt.Sprintf("expected listener %d exists=%+v, but it was not", i, isAdded[l]))
		}
	}

	return 0
}
1237233
func (ef *FeeEstimator) newEstimateFeeSet() *estimateFeeSet {
	set := &estimateFeeSet{}

	capacity := 0
	for i, b := range ef.bin {
		l := len(b)
		set.bin[i] = uint32(l)
		capacity += l
	}

	set.feeRate = make([]SatoshiPerByte, capacity)

	i := 0
	for _, b := range ef.bin {
		for _, o := range b {
			set.feeRate[i] = o.feeRate
			i++
		}
	}

	sort.Sort(set)

	return set
}
370507
func (tag *Tag) AddUFIDFrame(ufid UFIDFrame) {
	tag.AddFrame(tag.CommonID("Unique file identifier"), ufid)
}
872144
func (f FibmapFile) Figetbsz() (int, syscall.Errno) {
	bsz := int(0)
	_, _, err := syscall.Syscall(syscall.SYS_IOCTL, f.Fd(), FIGETBSZ, uintptr(unsafe.Pointer(&bsz)))
	return bsz, err
}
684800
func (c *lruCache) BulkAdd(id, n uint64) {
	c.Add(id, n)
}