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WlzaCBiZXR3ZWVuIDI0IGFuZCAzMiBieXRlIHNlbnNlIGRhdGEgKi8KCWlmIChzZW5zZVsyN10gJiBEQVNEX1NFTlNFX0JJVF8wKSB7CgoJCWVyYSA9IGRhc2RfMzk5MF9lcnBfZXhhbWluZV8yNChjcXIsIHNlbnNlKTsKCgl9IGVsc2UgewoKCQllcmEgPSBkYXNkXzM5OTBfZXJwX2V4YW1pbmVfMzIoY3FyLCBzZW5zZSk7CgoJfQoKCS8qIGxvZyB0aGUgZXJwIGNoYWluIGlmIGZhdGFsIGVycm9yIG9jY3VycmVkICovCglpZiAoKGVyYSA9PSBkYXNkX2VyYV9mYXRhbCkgJiYgKGRldmljZS0+c3RhdGUgPj0gREFTRF9TVEFURV9SRUFEWSkpIHsKCQlkYXNkX2xvZ19zZW5zZShjcXIsIGlyYik7Cgl9CgoJcmV0dXJuIGVyYTsKCn0JCQkJLyogRU5EIGRhc2RfMzk5MF9lcnBfZXhhbWluZSAqLwoKLyoKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqIFNFQ1RJT04gRVJQIEhBTkRMSU5HCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogKi8KLyoKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqIDI0IGFuZCAzMiBieXRlIHNlbnNlIEVSUCBmdW5jdGlvbnMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqLwoKLyoKICogREFTRF8zOTkwX0VSUF9DTEVBTlVQCiAqCiAqIERFU0NSSVBUSU9OCiAqICAgUmVtb3ZlcyB0aGUgYWxyZWFkeSBidWlsZCBidXQ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VHLCBkZXZpY2UsICIlcyIsCgkJCQkgICAgIkEgU3RhdGUgY2hhbmdlIHBlbmRpbmcgY29uZGl0aW9uIGV4aXN0cyAiCgkJCQkgICAgImZvciB0aGUgc3Vic3lzdGVtIG9yIGRldmljZSIpOwoKCQkJZXJwID0gZGFzZF8zOTkwX2VycF9hY3Rpb25fNChlcnAsIHNlbnNlKTsKCQkJYnJlYWs7CgoJCWNhc2UgMHgxRToJLyogYnVzeSAqLwogICAgICAgICAgICAgICAgICAgICAgICBERVZfTUVTU0FHRShLRVJOX0RFQlVHLCBkZXZpY2UsICIlcyIsCgkJCQkgICAgIkJ1c3kgY29uZGl0aW9uIGV4aXN0cyAiCgkJCQkgICAgImZvciB0aGUgc3Vic3lzdGVtIG9yIGRldmljZSIpOwogICAgICAgICAgICAgICAgICAgICAgICBlcnAgPSBkYXNkXzM5OTBfZXJwX2FjdGlvbl80KGVycCwgc2Vuc2UpOwoJCQlicmVhazsKCgkJZGVmYXVsdDoJLyogYWxsIG90aGVycyBlcnJvcnMgLSBkZWZhdWx0IGVycCAgKi8KCQkJYnJlYWs7CgkJfQoJfQoKCXJldHVybiBlcnA7Cgp9CQkJCS8qIGVuZCBkYXNkXzM5OTBfZXJwX2luc3BlY3RfMzIgKi8KCi8qCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogKiBtYWluIEVSUCBjb250cm9sIGZ1Y3Rpb25zICgyNCBhbmQgMzIgYnl0ZSBzZW5zZSkKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqLwoKLyoKICogREFTRF8zOTkwX0VSUF9JTlNQRUNUCiAqCiAqIERFU0NSSVBUSU9OCiAqICAgRG9lcyBhIGRldGFpbGVkIGluc3BlY3Rpb24gZm9yIHNlbnNlIGRhdGEgYnkgY2FsbGluZyBlaXRo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