// encodeURI/decodeURI
769745
func _builtinGlobal_encodeURI(call FunctionCall, escape *regexp.Regexp) Value {
	value := call.Argument(0)
	var input []uint16
	switch vl := value.value.(type) {
	case []uint16:
		input = vl
	default:
		input = utf16.Encode([]rune(value.string()))
	}
	if len(input) == 0 {
		return toValue_string("")
	}
	output := []byte{}
	length := len(input)
	encode := make([]byte, 4)
	for index := 0; index < length; {
		value := input[index]
		decode := utf16.Decode(input[index : index+1])
		if value >= 0xDC00 && value <= 0xDFFF {
			panic(call.runtime.panicURIError("URI malformed"))
		}
		if value >= 0xD800 && value <= 0xDBFF {
			index += 1
			if index >= length {
				panic(call.runtime.panicURIError("URI malformed"))
			}
			// input = ..., value, value1, ...
			value1 := input[index]
			if value1 < 0xDC00 || value1 > 0xDFFF {
				panic(call.runtime.panicURIError("URI malformed"))
			}
			decode = []rune{((rune(value) - 0xD800) * 0x400) + (rune(value1) - 0xDC00) + 0x10000}
		}
		index += 1
		size := utf8.EncodeRune(encode, decode[0])
		encode := encode[0:size]
		output = append(output, encode...)
	}
	{
		value := escape.ReplaceAllFunc(output, func(target []byte) []byte {
			// Probably a better way of doing this
			if target[0] == ' ' {
				return []byte("%20")
			}
			return []byte(url.QueryEscape(string(target)))
		})
		return toValue_string(string(value))
	}
}
519156
func (c *ChannelData) URI() string {
	return fmt.Sprintf("%s://%s/%s", c.Protocol, c.Server, c.Channel)
}
1349014
func (a Nodes) FilterURI(uri URI) []*Node {
	other := make([]*Node, 0, len(a))
	for _, node := range a {
		if node.URI != uri {
			other = append(other, node)
		}
	}
	return other
}
679873
func (c *Connect) GetURI() (string, error) {
	var err C.virError
	cStr := C.virConnectGetURIWrapper(c.ptr, &err)
	if cStr == nil {
		return "", makeError(&err)
	}
	uri := C.GoString(cStr)
	C.free(unsafe.Pointer(cStr))
	return uri, nil
}
318713
func DataURI(m *M, dataURI []byte) []byte {
	if mediatype, data, err := parse.DataURI(dataURI); err == nil {
		dataURI, _ = m.Bytes(string(mediatype), data)
		base64Len := len(";base64") + base64.StdEncoding.EncodedLen(len(dataURI))
		asciiLen := len(dataURI)
		for _, c := range dataURI {
			if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '-' || c == '_' || c == '.' || c == '~' || c == ' ' {
				asciiLen++
			} else {
				asciiLen += 2
			}
			if asciiLen > base64Len {
				break
			}
		}
		if asciiLen > base64Len {
			encoded := make([]byte, base64Len-len(";base64"))
			base64.StdEncoding.Encode(encoded, dataURI)
			dataURI = encoded
			mediatype = append(mediatype, []byte(";base64")...)
		} else {
			dataURI = []byte(url.QueryEscape(string(dataURI)))
			dataURI = bytes.Replace(dataURI, []byte("\""), []byte("\\\""), -1)
		}
		if len("text/plain") <= len(mediatype) && parse.EqualFold(mediatype[:len("text/plain")], []byte("text/plain")) {
			mediatype = mediatype[len("text/plain"):]
		}
		for i := 0; i+len(";charset=us-ascii") <= len(mediatype); i++ {
			// must start with semicolon and be followed by end of mediatype or semicolon
			if mediatype[i] == ';' && parse.EqualFold(mediatype[i+1:i+len(";charset=us-ascii")], []byte("charset=us-ascii")) && (i+len(";charset=us-ascii") >= len(mediatype) || mediatype[i+len(";charset=us-ascii")] == ';') {
				mediatype = append(mediatype[:i], mediatype[i+len(";charset=us-ascii"):]...)
				break
			}
		}
		dataURI = append(append(append([]byte("data:"), mediatype...), ','), dataURI...)
	}
	return dataURI
}
96117
func (r *URIBuilder) ClientURI(s string) *URIBuilder {
	r.clientURI = s
	return r
}
524875
func DecodeUvarint(b []byte) ([]byte, uint64, error) {
	v, n := binary.Uvarint(b)
	if n > 0 {
		return b[n:], v, nil
	}
	if n < 0 {
		return nil, 0, errors.New("value larger than 64 bits")
	}
	return nil, 0, errors.New("insufficient bytes to decode value")
}
581689
func (s *Integration) SetUri(v string) *Integration {
	s.Uri = &v
	return s
}
483404
func DecodeVarint(in io.Reader) (int, error) {
	u, err := DecodeUvarint(in)
	n := int(u)
	return (n >> 1) ^ -(n & 1), err
}
507830
func DecodeInt(data []byte, start int) (
	result interface{}, index int, err error) {

	if start >= len(data) || data[start] != 'i' {
		err = errors.New("invalid int bencode")
		return
	}

	index = find(data, start+1, 'e')

	if index == -1 {
		err = errors.New("':' not found when decode int")
		return
	}

	result, err = strconv.Atoi(string(data[start+1 : index]))
	if err != nil {
		return
	}
	index++

	return
}
582452
func (d *Decoder) decodeFrame1() error {
	if d.mode == ModeJointStereo {
		d.bound = 4 * (d.modeExtension + 1)
	} else {
		d.bound = 32
	}

	if err := d.decodeAllocation1(); err != nil {
		return err
	}

	if err := d.decodeScalefactors1(); err != nil {
		return err
	}

	if err := d.decodeSamples1(); err != nil {
		return err
	}

	d.dequantize12()

	return nil
}
773268
func DecodeValues(dst interface{}, vs url.Values) error {
	return NewDecoder(nil).DecodeValues(dst, vs)
}
187345
func (adapter *Encoder) Encode(val interface{}) error {
	adapter.stream.WriteVal(val)
	adapter.stream.WriteRaw("\n")
	adapter.stream.Flush()
	return adapter.stream.Error
}
797251
func encodeState(values url.Values) string {
	return base64.URLEncoding.EncodeToString([]byte(values.Encode()))
}
439854
func SafeBase64Decode(str string) (string, error) {
	str = strings.Replace(str, `-`, `/`, -1)
	str = strings.Replace(str, ` `, `+`, -1)
	var suf string
	for strings.HasSuffix(str, `_`) {
		str = strings.TrimSuffix(str, `_`)
		suf += `=`
	}
	str += suf
	return Base64Decode(str)
}
910461
func EncodeMulti(name string, value interface{}, codecs ...Codec) (string, error) {
	if len(codecs) == 0 {
		return "", errNoCodecs
	}

	var errors MultiError
	for _, codec := range codecs {
		encoded, err := codec.Encode(name, value)
		if err == nil {
			return encoded, nil
		}
		errors = append(errors, err)
	}
	return "", errors
}
1232997
func (s *InputLocation) SetUri(v string) *InputLocation {
	s.Uri = &v
	return s
}