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NvbXByZXNzIi4gICAqLwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFpSVzMuQyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBBdXRob3IgIDogUm9zcyBXaWxsaWFtcy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRGF0ZSAgICA6IDMwLUp1bi0xOTkxLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJlbGVhc2UgOiAxLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBUaGlzIGZpbGUgY29udGFpbnMgYW4gaW1wbGVtZW50YXRpb24gb2YgdGhlIExaUlczIGRhdGEgY29tcHJlc3Npb24gICAgICAgICAqLwotLyogYWxnb3JpdGhtIGluIEMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBUaGUgYWxnb3JpdGhtIGlzIGEgZ2VuZXJhbCBwdXJwb3NlIGNvbXByZXNzaW9uIGFsZ29yaXRobSB0aGF0IHJ1bnMgZmFzdCAgICAqLwotLyogYW5kIGdpdmVzIHJlYXNvbmFibGUgY29tcHJlc3Npb24uIFRoZSBhbGdvcml0aG0gaXMgYSBtZW1iZXIgb2YgdGhlIExlbXBlbCAgKi8KLS8qIFppdiBmYW1pbHkgb2YgYWxnb3JpdGhtcyBhbmQgYmFzZXMgaXRzIGNvbXByZXNzaW9uIG9uIHRoZSBwcmVzZW5jZSBpbiB0aGUgICovCi0vKiBkYXRhIG9mIHJlcGVhdGVkIHN1YnN0cmluZ3MuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFRoaXMgYWxnb3JpdGhtIGlzIHVucGF0ZW50ZWQgYW5kIHRoZSBjb2RlIGlzIHB1YmxpYyBkb21haW4uIEFzIHRoZSAgICAgICAgICovCi0vKiBhbGdvcml0aG0gaXMgYmFzZWQgb24gdGhlIExaNzcgY2xhc3Mgb2YgYWxnb3JpdGhtcywgaXQgaXMgdW5saWtlbHkgdG8gYmUgICAqLwotLyogdGhlIHN1YmplY3Qgb2YgYSBwYXRlbnQgY2hhbGxlbmdlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBVbmxpa2UgdGhlIExaUlcxIGFuZCBMWlJXMS1BIGFsZ29yaXRobXMsIHRoZSBMWlJXMyBhbGdvcml0aG0gaXMgICAgICAgICAgICAqLwotLyogZGV0ZXJtaW5pc3RpYyBhbmQgaXMgZ3VhcmFudGVlZCB0byB5aWVsZCB0aGUgc2FtZSBjb21wcmVzc2VkICAgICAgICAgICAgICAgKi8KLS8qIHJlcHJlc2VudGF0aW9uIGZvciBhIGdpdmVuIGZpbGUgZWFjaCB0aW1lIGl0IGlzIHJ1bi4gICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogVGhlIExaUlczIGFsZ29yaXRobSB3YXMgb3JpZ2luYWxseSBkZXNpZ25lZCBhbmQgaW1wbGVtZW50ZWQgICAgICAgICAgICAgICAgKi8KLS8qIGJ5IFJvc3MgV2lsbGlhbXMgb24gMzEtRGVjLTE5OTAuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogSGVyZSBhcmUgdGhlIHJlc3VsdHMgb2YgYXBwbHlpbmcgdGhpcyBjb2RlLCBjb21waWxlZCB1bmRlciBUSElOSyBDIDQuMCAgICAgKi8KLS8qIGFuZCBydW5uaW5nIG9uIGEgTWFjLVNFICg4TUh6IDY4MDAwKSwgdG8gdGhlIHN0YW5kYXJkIGNhbGdhcnkgY29ycHVzLiAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rICAgICAgKi8KLS8qICAgIHwgREFUQSBDT01QUkVTU0lPTiBURVNUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICovCi0vKiAgICB8ID09PT09PT09PT09PT09PT09PT09PSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAqLwotLyogICAgfCBUaW1lIG9mIHJ1biAgICAgOiBTdW4gMzAtSnVuLTE5OTEgMDk6MzFQTSAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgKi8KLS8qICAgIHwgVGltaW5nIGFjY3VyYWN5IDogT25lIHBhcnQgaW4gMTAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICovCi0vKiAgICB8IENvbnRleHQgbGVuZ3RoICA6IDI2MjE0NCBieXRlcyAoPSAyNTYuMDAwMEspICAgICAgICAgICAgICAgICAgIHwgICAgICAqLwotLyogICAgfCBUZXN0IHN1aXRlICAgICAgOiBDYWxnYXJ5IENvcnB1cyBTdWl0ZSAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgKi8KLS8qICAgIHwgRmlsZXMgaW4gc3VpdGUgIDogMTQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICovCi0vKiAgICB8IEFsZ29yaXRobSAgICAgICA6IExaUlczICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAqLwotLyogICAgfCBOb3RlOiBBbGwgYXZlcmFnZXMgYXJlIGNhbGN1bGF0ZWQgZnJvbSB0aGUgdW4tcm91bmRlZCB2YWx1ZXMuICB8ICAgICAgKi8KLS8qICAgICstLS0tLS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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLS8qIFRoZSBmb2xsb3dpbmcgc3RydWN0dXJlIGlzIHJldHVybmVkIGJ5IHRoZSAiY29tcHJlc3MiIGZ1bmN0aW9uIGJlbG93IHdoZW4gICovCi0vKiB0aGUgdXNlciBhc2tzIHRoZSBmdW5jdGlvbiB0byByZXR1cm4gaWRlbnRpZnlpbmcgaW5mb3JtYXRpb24uICAgICAgICAgICAgICAqLwotLyogVGhlIG1vc3QgaW1wb3J0YW50IGZpZWxkIGluIHRoZSByZWNvcmQgaXMgdGhlIHdvcmtpbmcgbWVtb3J5IGZpZWxkIHdoaWNoICAgKi8KLS8qIHRlbGxzIHRoZSBjYWxsaW5nIHByb2dyYW0gaG93IG11Y2ggd29ya2luZyBtZW1vcnkgc2hvdWxkIGJlIHBhc3NlZCB0byAgICAgICovCi0vKiAiY29tcHJlc3MiIHdoZW4gaXQgaXMgY2FsbGVkIHRvIHBlcmZvcm0gYSBjb21wcmVzc2lvbiBvciBkZWNvbXByZXNzaW9uLiAgICAqLwotLyogTFpSVzMgdXNlcyB0aGUgc2FtZSBhbW91bnQgb2YgbWVtb3J5IGR1cmluZyBjb21wcmVzc2lvbiBhbmQgZGVjb21wcmVzc2lvbi4gKi8KLS8qIEZvciBtb3JlIGluZm9ybWF0aW9uIG9uIHRoaXMgc3RydWN0dXJlIHNlZSAiY29tcHJlc3MuaCIuICAgICAgICAgICAgICAgICAgICovCi0gIAotI2RlZmluZSBVKFgpICAgICAgICAgICAgKChVTE9ORykgWCkKLSNkZWZpbmUgU0laRV9QX0JZVEUgICAgIChVKHNpemVvZihVQllURSAqKSkpCi0jZGVmaW5lIFNJWkVfV09SRCAgICAgICAoVShzaXplb2YoVVdPUkQgICkpKQotI2RlZmluZSBBTElHTk1FTlRfRlVER0UgKFUoMTYpKQotI2RlZmluZSBNRU1fUkVRICggVSg0MDk2KSooU0laRV9QX0JZVEUpICsgQUxJR05NRU5UX0ZVREdFICkKLQotc3RhdGljIHN0cnVjdCBjb21wcmVzc19pZGVudGl0eSBpZGVudGl0eSA9Ci17Ci0gVSgweDAzMkRERUE4KSwgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBbGdvcml0aG0gaWRlbnRpZmljYXRpb24gbnVtYmVyLiAqLwotIE1FTV9SRVEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogV29ya2luZyBtZW1vcnkgKGJ5dGVzKSByZXF1aXJlZC4gKi8KLSAiTFpSVzMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE5hbWUgb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICAgICovCi0gIjEuMCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBWZXJzaW9uIG51bWJlciBvZiBhbGdvcml0aG0uICAgICAqLwotICIzMS1EZWMtMTk5MCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGF0ZSBvZiBhbGdvcml0aG0uICAgICAgICAgICAgICAgKi8KLSAiUHVibGljIERvbWFpbiIsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENvcHlyaWdodCBub3RpY2UuICAgICAgICAgICAgICAgICovCi0gIlJvc3MgTi4gV2lsbGlhbXMiLCAgICAgICAgICAgICAgICAgICAgICAvKiBBdXRob3Igb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICAqLwotICJSZW5haXNzYW5jZSBTb2Z0d2FyZSIsICAgICAgICAgICAgICAgICAgLyogQWZmaWxpYXRpb24gb2YgYXV0aG9yLiAgICAgICAgICAgKi8KLSAiUHVibGljIERvbWFpbiIgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFZlbmRvciBvZiBhbGdvcml0aG0uICAgICAgICAgICAgICovCi19OwotIAotTE9DQUwgdm9pZCBjb21wcmVzc19jb21wcmVzcyAgKFVCWVRFICosVUJZVEUgKixVTE9ORyxVQllURSAqLCBMT05HICopOwotTE9DQUwgdm9pZCBjb21wcmVzc19kZWNvbXByZXNzKFVCWVRFICosVUJZVEUgKixMT05HLCBVQllURSAqLCBVTE9ORyAqKTsKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotLyogVGhpcyBmdW5jdGlvbiBpcyB0aGUgb25seSBmdW5jdGlvbiBleHBvcnRlZCBieSB0aGlzIG1vZHVsZS4gICAgICAgICAgICAgICAgKi8KLS8qIERlcGVuZGluZyBvbiBpdHMgZmlyc3QgcGFyYW1ldGVyLCB0aGUgZnVuY3Rpb24gY2FuIGJlIHJlcXVlc3RlZCB0byAgICAgICAgICovCi0vKiBjb21wcmVzcyBhIGJsb2NrIG9mIG1lbW9yeSwgZGVjb21wcmVzcyBhIGJsb2NrIG9mIG1lbW9yeSwgb3IgdG8gaWRlbnRpZnkgICAqLwotLyogaXRzZWxmLiBGb3IgbW9yZSBpbmZvcm1hdGlvbiwgc2VlIHRoZSBzcGVjaWZpY2F0aW9uIGZpbGUgImNvbXByZXNzLmgiLiAgICAgKi8KLQotRVhQT1JUIHZvaWQgbHpydzNfY29tcHJlc3MoCi0JVVdPUkQgICAgIGFjdGlvbiwgICAgICAvKiBBY3Rpb24gdG8gYmUgcGVyZm9ybWVkLgkJKi8KLQlVQllURSAgICp3cmtfbWVtLAkvKiBBZGRyZXNzIG9mIHdvcmtpbmcgbWVtb3J5IHdlIGNhbiB1c2UuKi8KLQlVQllURSAgICpzcmNfYWRyLAkvKiBBZGRyZXNzIG9mIGlucHV0IGRhdGEuCQkqLwotCUxPTkcgICAgIHNyY19sZW4sCS8qIExlbmd0aCAgb2YgaW5wdXQgZGF0YS4JCSovCi0JVUJZVEUgICAqZHN0X2FkciwJLyogQWRkcmVzcyB0byBwdXQgb3V0cHV0IGRhdGEuCQkqLwotCXZvaWQgICpwX2RzdF9sZW4JLyogQWRkcmVzcyBvZiBsb25nd29yZCBmb3IgbGVuZ3RoIG9mIG91dHB1dCBkYXRhLiovCi0pCi17Ci0gc3dpdGNoIChhY3Rpb24pCi0gICB7Ci0gICAgY2FzZSBDT01QUkVTU19BQ1RJT05fSURFTlRJVFk6Ci0gICAgICAgKigoc3RydWN0IGNvbXByZXNzX2lkZW50aXR5ICoqKXBfZHN0X2xlbik9ICZpZGVudGl0eTsKLSAgICAgICBicmVhazsKLSAgICBjYXNlIENPTVBSRVNTX0FDVElPTl9DT01QUkVTUzoKLSAgICAgICBjb21wcmVzc19jb21wcmVzcyh3cmtfbWVtLHNyY19hZHIsc3JjX2xlbixkc3RfYWRyLChMT05HICopcF9kc3RfbGVuKTsKLSAgICAgICBicmVhazsKLSAgICBjYXNlIENPTVBSRVNTX0FDVElPTl9ERUNPTVBSRVNTOgotICAgICAgIGNvbXByZXNzX2RlY29tcHJlc3Mod3JrX21lbSxzcmNfYWRyLHNyY19sZW4sZHN0X2FkciwoTE9ORyAqKXBfZHN0X2xlbik7Ci0gICAgICAgYnJlYWs7Ci0gICB9Ci19Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogQlJJRUYgREVTQ1JJUFRJT04gT0YgVEhFIExaUlczIEFMR09SSVRITSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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dG8gICAgICAqLwotLyogcGVyZm9ybSB0aGUgdGhyZWUtYnl0ZSBoYXNoLiBUbyBzb2x2ZSB0aGlzIHByb2JsZW0sIGluIExaUlczLCBib3RoIHRoZSAgICAgKi8KLS8qIGNvbXByZXNzb3IgYW5kIGRlY29tcHJlc3NvciBhcmUgd2lyZWQgdXAgc28gdGhhdCB0aGV5ICJidWZmZXIiIHRoZXNlICAgICAgICovCi0vKiBsaXRlcmFscyBhbmQgdXBkYXRlIHRoZWlyIGhhc2ggdGFibGVzIG9ubHkgd2hlbiB0aHJlZSBieXRlcyBhcmUgYXZhaWxhYmxlLiAqLwotLyogVGhpcyBtYWtlcyB0aGUgbWF4aW11bSBidWZmZXJpbmcgMiBieXRlcy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSZXBsYWNlbWVudCBvZiBvZmZzZXRzIGJ5IGhhc2ggdGFibGUgaW5kZXhlcyB5aWVsZHMgYSBmZXcgcGVyY2VudCBleHRyYSAgICAqLwotLyogY29tcHJlc3Npb24gYXQgdGhlIGNvc3Qgb2Ygc29tZSBzcGVlZC4gTFpSVzMgaXMgc2xvd2VyIHRoYW4gTFpSVzEsIExaUlcxLUEgKi8KLS8qIGFuZCBMWlJXMiwgYnV0IHlpZWxkcyBiZXR0ZXIgY29tcHJlc3Npb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRXh0cmEgY29tcHJlc3Npb24gY291bGQgYmUgb2J0YWluZWQgYnkgdXNpbmcgYSBoYXNoIHRhYmxlIG9mIGRlcHRoIHR3by4gICAgKi8KLS8qIEhvd2V2ZXIsIGluY3JlYXNpbmcgdGhlIGRlcHRoIGFib3ZlIG9uZSBpbmN1cnMgYSBzaWduaWZpY2FudCBkZWNyZWFzZSBpbiAgICovCi0vKiBjb21wcmVzc2lvbiBzcGVlZCB3aGljaCB3YXMgbm90IGNvbnNpZGVyZWQgd29ydGh3aGlsZS4gQW5vdGhlciByZWFzb24gZm9yICAqLwotLyoga2VlcGluZyB0aGUgZGVwdGggZG93biB0byBvbmUgd2FzIHRvIGFsbG93IGVhc3kgY29tcGFyaXNvbiB3aXRoIHRoZSAgICAgICAgKi8KLS8qIExaUlcxLUEgYW5kIExaUlcyIGFsZ29yaXRobXMgc28gYXMgdG8gZGVtb25zdHJhdGUgdGhlIGV4YWN0IGVmZmVjdCBvZiB0aGUgICovCi0vKiB1c2Ugb2YgZGlyZWN0IGhhc2ggaW5kZXhlcy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICstLS0rICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8X19ffDQwOTUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fX3wgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICArLS0tLS0tLS0tLS0tLS0tLS0tLS0tKl98PC0tLSsgICAvLS0tLSstLS1cICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICB8X19ffCAgICArLS0tfEhhc2ggICAgfCAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgfF9fX3wgICAgICAgIHxGdW5jdGlvbnwgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgIHxfX198ICAgICAgICBcLS0tLS0tLS0vICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICB8X19ffDAgICAgICAgICAgICBeICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgKy0tLSsgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgIEhhc2ggICAgICAgICstLS0tLSsgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICBUYWJsZSAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICB2ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXl5eICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tfC0tLS0tLS0tLS0tLS0tLS0rICAgICAgICAgICAgICAqLwotLyogICAgICB8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fCAgICAgICAgICAgICAgKi8KLS8qICAgICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS18LS0tLS0tLS0tLS0tLS0tLSsgICAgICAgICAgICAgICovCi0vKiAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfDEuLi4uLi4xOHwgICAgICB8ICAgICAgICAgICAgICAqLwotLyogICAgICB8PC0tLS0tLS0gTGVtcGVsPUhpc3RvcnkgLS0tLS0tLS0tLS0tPnw8LS1aaXYtLT58ICAgICAgfCAgICAgICAgICAgICAgKi8KLS8qICAgICAgfCAgICAgKD1ieXRlcyBhbHJlYWR5IHByb2Nlc3NlZCkgICAgICB8PC1TdGlsbCB0byBnby0tPnwgICAgICAgICAgICAgICovCi0vKiAgICAgIHw8LS0tLS0tLS0tLS0tLS0tLS0tLS0gSU5QVVQgQkxPQ0sgLS0tLS0tLS0tLS0tLS0tLS0tLT58ICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFRoZSBkaWFncmFtIGFib3ZlIGZvciBMWlJXMyBsb29rcyBhbG1vc3QgaWRlbnRpY2FsIHRvIHRoZSBkaWFncmFtIGZvciAgICAgICovCi0vKiBMWlJXMS4gVGhlIGRpZmZlcmVuY2UgaXMgdGhhdCBpbiBMWlJXMywgdGhlIGNvbXByZXNzb3IgdHJhbnNtaXRzIGhhc2ggICAgICAqLwotLyogdGFibGUgaW5kaWNlcyBpbnN0ZWFkIG9mIExlbXBlbCBvZmZzZXRzLiBGb3IgdGhpcyB0byB3b3JrLCB0aGUgICAgICAgICAgICAgKi8KLS8qIGRlY29tcHJlc3NvciBtdXN0IG1haW50YWluIGEgaGFzaCB0YWJsZSBhcyB3ZWxsIGFzIHRoZSBjb21wcmVzc29yIGFuZCBib3RoICovCi0vKiBjb21wcmVzc29yIGFuZCBkZWNvbXByZXNzb3IgbXVzdCAiYnVmZmVyIiBsaXRlcmFscywgYXMgdGhlIGRlY29tcHJlc3NvciAgICAqLwotLyogY2Fubm90IGhhc2ggcGhyYXNlcyBjb21tZW5jaW5nIHdpdGggYSBsaXRlcmFsIHVudGlsIGFub3RoZXIgdHdvIGJ5dGVzIGhhdmUgKi8KLS8qIGFycml2ZWQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExaUlczIEFsZ29yaXRobSBFeGVjdXRpb24gU3VtbWFyeSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgMS4gSGFzaCB0aGUgZmlyc3QgdGhyZWUgYnl0ZXMgb2YgdGhlIFppdiB0byB5aWVsZCBhIGhhc2ggdGFibGUgaW5kZXggaC4gICAqLwotLyogIDIuIExvb2sgdXAgdGhlIGhhc2ggdGFibGUgeWllbGRpbmcgaGlzdG9yeSBwb2ludGVyIHAuICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAzLiBNYXRjaCB3aGVyZSBwIHBvaW50cyB3aXRoIHRoZSBaaXYuIElmIHRoZXJlIGlzIGEgbWF0Y2ggb2YgdGhyZWUgb3IgICAgICovCi0vKiAgICAgbW9yZSBieXRlcywgY29kZSB0aG9zZSBieXRlcyAoaW4gdGhlIFppdikgYXMgYSBjb3B5IGl0ZW0sIG90aGVyd2lzZSAgICAqLwotLyogICAgIGNvZGUgdGhlIG5leHQgYnl0ZSBpbiB0aGUgWml2IGFzIGEgbGl0ZXJhbCBpdGVtLiAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICA0LiBVcGRhdGUgdGhlIGhhc2ggdGFibGUgYXMgcG9zc2libGUgc3ViamVjdCB0byB0aGUgY29uc3RyYWludCB0aGF0IG9ubHkgICovCi0vKiAgICAgcGhyYXNlcyBjb21tZW5jaW5nIHRocmVlIGJ5dGVzIGJhY2sgZnJvbSB0aGUgWml2IGNhbiBiZSBoYXNoZWQgYW5kICAgICAqLwotLyogICAgIGVudGVyZWQgaW50byB0aGUgaGFzaCB0YWJsZS4gKFRoaXMgZW5hYmxlcyB0aGUgZGVjb21wcmVzc29yIHRvIGtlZXAgICAgKi8KLS8qICAgICBwYWNlKS4gU2VlIHRoZSBkZXNjcmlwdGlvbiBhbmQgY29kZSBmb3IgbW9yZSBkZXRhaWxzLiAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgIERFRklOSVRJT04gT0YgQ09NUFJFU1NFRCBGSUxFIEZPUk1BVCAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gICAgICAgICAgICAgICAgICAgKi8KLS8qICAqIEEgY29tcHJlc3NlZCBmaWxlIGNvbnNpc3RzIG9mIGEgQ09QWSBGTEFHIGZvbGxvd2VkIGJ5IGEgUkVNQUlOREVSLiAgICAgICovCi0vKiAgKiBUaGUgY29weSBmbGFnIENGIHVzZXMgdXAgZm91ciBieXRlcyB3aXRoIHRoZSBmaXJzdCBieXRlIGJlaW5nIHRoZSAgICAgICAqLwotLyogICAgbGVhc3Qgc2lnbmlmaWNhbnQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAqIElmIENGPTEsIHRoZW4gdGhlIGNvbXByZXNzZWQgZmlsZSByZXByZXNlbnRzIHRoZSByZW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leGFtcGxlOiBDMVswLi4zXSBpcyB0aGUgbG93IG5pYmJsZSBvZiB0aGUgZmlyc3QgY29udHJvbCBieXRlLiAgICAgICovCi0vKiAgICBvZiBjb3B5IGl0ZW0gQzEuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICogVGhlIExFTkdUSCBvZiBhIGNvcHkgaXRlbSBpcyBkZWZpbmVkIHRvIGJlIEMxWzAuLjNdKzMgd2hpY2ggaXMgYSBudW1iZXIgKi8KLS8qICAgIGluIHRoZSByYW5nZSBbMywxOF0uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgKiBUaGUgSU5ERVggb2YgYSBjb3B5IGl0ZW0gaXMgZGVmaW5lZCB0byBiZSBDMVs0Li43XSoyNTYrQzJbMC4uOF0gd2hpY2ggICAqLwotLyogICAgaXMgYSBudW1iZXIgaW4gdGhlIHJhbmdlIFswLDQwOTVdLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAqIEEgY29weSBpdGVtIHJlcHJlc2VudHMgdGhlIHNlcXVlbmNlIG9mIGJ5dGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICB0ZXh0W1BPUy1PRkZTRVQuLlBPUy1PRkZTRVQrTEVOR1RILTFdIHdoZXJlICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgdGV4dCAgIGlzIHRoZSBlbnRpcmUgdGV4dCBvZiB0aGUgdW5jb21wcmVzc2VkIHN0cmluZy4gICAgICAgICAgICAgKi8KLS8qICAgICAgICAgIFBPUyAgICBpcyB0aGUgaW5kZXggaW4gdGhlIHRleHQgb2YgdGhlIGNoYXJhY3RlciBmb2xsb3dpbmcgdGhlICAgICovCi0vKiAgICAgICAgICAgICAgICAgICBzdHJpbmcgcmVwcmVzZW50ZWQgYnkgYWxsIHRoZSBpdGVtcyBwcmVjZWVkaW5nIHRoZSBpdGVtICAqLwotLyogICAgICAgICAgICAgICAgICAgYmVpbmcgZGVmaW5lZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgIE9GRlNFVCBpcyBvYnRhaW5lZCBmcm9tIElOREVYIGJ5IGxvb2tpbmcgdXAgdGhlIGhhc2ggdGFibGUuICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotLyogVGhlIGZvbGxvd2luZyAjZGVmaW5lIGRlZmluZXMgdGhlIGxlbmd0aCBvZiB0aGUgY29weSBmbGFnIHRoYXQgYXBwZWFycyBhdCAgKi8KLS8qIHRoZSBzdGFydCBvZiB0aGUgY29tcHJlc3NlZCBmaWxlLiBUaGUgdmFsdWUgb2YgZm91ciBieXRlcyB3YXMgY2hvc2VuICAgICAgICovCi0vKiBiZWNhdXNlIHRoZSBmYXN0X2NvcHkgcm91dGluZSBvbiBteSBNYWNpbnRvc2ggcnVucyBmYXN0ZXIgaWYgdGhlIHNvdXJjZSAgICAqLwotLyogYW5kIGRlc3RpbmF0aW9uIGJsb2NrcyBhcmUgcmVsYXRpdmVseSBsb25nd29yZCBhbGlnbmVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFRoZSBhY3R1YWwgZmxhZyBkYXRhIGFwcGVhcnMgaW4gdGhlIGZpcnN0IGJ5dGUuIFRoZSByZXN0IGFyZSB6ZXJvZWQgc28gYXMgICovCi0vKiB0byBub3JtYWxpemUgdGhlIGNvbXByZXNzZWQgcmVwcmVzZW50YXRpb24gKGkuZS4gbm90IG5vbi1kZXRlcm1pbmlzdGljKS4gICAqLwotI2RlZmluZSBGTEFHX0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mVudCBoYXNoIHRhYmxlIGVudHJ5LiAgICAgICAqLwotICAgICAKLSAgICAvKiBUZXN0IGZvciBvdmVycnVuIGFuZCBqdW1wIHRvIG92ZXJydW4gY29kZSBpZiBuZWNlc3NhcnkuICAgICAgICAgICAgICAgICovCi0gICAgaWYgKHBfZHN0PnBfZHN0X3Bvc3QpCi0gICAgICAgZ290byBvdmVycnVuOwotICAgICAgIAotICAgIC8qIFRoZSBmb2xsb3dpbmcgY2FzY2FkZSBvZiBpZiBzdGF0ZW1lbnRzIGVmZmljaWVudGx5IGNhdGNoZXMgYW5kIGRlYWxzICAgKi8KLSAgICAvKiB3aXRoIHZhcnlpbmcgZGVncmVlcyBvZiBjbG9zZW5lc3MgdG8gdGhlIGVuZCBvZiB0aGUgaW5wdXQgYmxvY2suICAgICAgICovCi0gICAgLyogV2hlbiB3ZSBnZXQgdmVyeSBjbG9zZSB0byB0aGUgZW5kLCB3ZSBzdG9wIHVwZGF0aW5nIHRoZSB0YWJsZSBhbmQgICAgICAqLwotICAgIC8qIGNvZGUgdGhlIHJlbWFpbmluZyBieXRlcyBhcyBsaXRlcmFscy4gVGhpcyBtYWtlcyB0aGUgY29kZSBzaW1wbGVyLiAgICAgKi8KLSAgICB1bnJvbGw9MTY7Ci0gICAgaWYgKHBfc3JjPnBfc3JjX21heDE2KQotICAgICAgewotICAgICAgIHVucm9sbD0xOwotICAgICAgIGlmIChwX3NyYz5wX3NyY19tYXgxKQotICAgICAgICAgewotICAgICAgICAgIGlmIChwX3NyYz09cF9zcmNfcG9zdCkKLSAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgZ290byBsaXRlcmFsOwotICAgICAgICAgfQotICAgICAgfQotICAgICAgICAgCi0gICAgLyogVGhpcyBpbm5lciB1bnJvbGxlZCBsb29wIHByb2Nlc3NlcyAndW5yb2xsJyAod2hvc2UgdmFsdWUgaXMgZWl0aGVyIDEgICAqLwotICAgIC8qIG9yIDE2KSBpdG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1c3QgY29kZWQgYSBsaXRlcmFsLiBJZiB3ZSBoYWQgdHdvIHBlbmRpbmcgb25lcywgdGhhdCAgICovCi0gICAgICAgICAgLyogbWFrZXMgdGhyZWUgYW5kIHdlIGNhbiB1cGRhdGUgdGhlIGhhc2ggdGFibGUuICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgIGlmIChwX2gyIT0wKQotICAgICAgICAgICAgIHsqcF9oMj1wX3ppdi0yO30KLSAgICAgICAgICAgICAKLSAgICAgICAgICAvKiBJbiBhbnkgY2FzZSwgcm90YXRlIHRoZSBoYXNoIHRhYmxlIHBvaW50ZXJzIGZvciBuZXh0IHRpbWUuICovCi0gICAgICAgICAgcF9oMj1wX2gxOyBwX2gxPXBfaDA7Ci0gICAgICAgICAgCi0gICAgICAgICB9Ci0gICAgICAgZWxzZQotICAgICAgICAgewotICAgICAgICAgIC8qIENvcHkgKi8KLSAgICAgICAgICAKLSAgICAgICAgICAvKiBNYXRjaCB1cCB0byAxNSByZW1haW5pbmcgYnl0ZXMgdXNpbmcgYW4gdW5yb2xsZWQgbG9vcCBhbmQgY29kZS4gKi8KLSNpZiAwCi0gICAgICAgICAgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwKLSAgICAgICAgICBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBwX3NyYysrOwotI2Vsc2UgICAgIAotICAgICAgICAgIGlmICgKLSAgICAgICAgICAgICAgICEoIFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8Ci0gICAgICAgICAgICAgICAgICBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyApIAotICAgICAgICAgICAgICkgcF9zcmMrKzsKLSNlbmRpZgotICAgICAgICAgICpwX2RzdCsrPSgoaW5kZXgmMHhGMDApPj40KXwoLS1wX3NyYy1wX3ppdi0zKTsKLSAgICAgICAgICAqcF9kc3QrKz1pbmRleCYweEZGOwotICAgICAgICAgIAotICAgICAgICAgIC8qIEFzIHdlIGhhdmUganVzdCBjb2RlZCB0aHJlZSBieXRlcywgd2UgYXJlIG5vdyBpbiBhIHBvc2l0aW9uIHRvICAgKi8KLSAgICAgICAgICAvKiB1cGRhdGUgdGhlIGhhc2ggdGFibGUgd2l0aCB0aGUgbGl0ZXJhbCBieXRlcyB0aGF0IHdlcmUgcGVuZGluZyAgICovCi0gICAgICAgICAgLyogdXBvbiB0aGUgYXJyaXZhbCBvZiBleHRyYSBjb250ZXh0IGJ5dGVzLiAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgIGlmIChwX2gxIT0wKQotICAgICAgICAgICAgewotICAgICAgICAgICAgIGlmIChwX2gyKQotICAgICAgICAgICAgICAgeypwX2gyPXBfeml2LTI7IHBfaDI9TlVMTDt9Ci0gICAgICAgICAgICAgKnBfaDE9cF96aXYtMTsgcF9oMT1OVUxMOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgLyogSW4gYW55IGNhc2UsIHdlIGNhbiB1cGRhdGUgdGhlIGhhc2ggdGFibGUgYmFzZWQgb24gdGhlIGN1cnJlbnQgICAqLwotICAgICAgICAgIC8qIHBvc2l0aW9uIGFzIHdlIGp1c3QgY29kZWQgYXQgbGVhc3QgdGhyZWUgYnl0ZXMgaW4gYSBjb3B5IGl0ZW1zLiAgKi8KLSAgICAgICAgICAqcF9oMD1wX3ppdjsKLSAgICAgICAgICAKLSAgICAgICAgIH0KLSAgICAgICBjb250cm9sPj49MTsKLSAgICAgICAgICAgICAgICAKLSAgICAgICAvKiBUaGlzIGxvb3AgaXMgYWxsIHNldCB1cCBmb3IgYSBkZWNyZW1lbnQgYW5kIGp1bXAgaW5zdHJ1Y3Rpb24hICovCi0jaWZuZGVmIGxpbnV4Ci1gICAgIGVuZF91bnJvbGxlZF9sb29wOiBpZiAoL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ogb3BlcmF0aW9uIGluc3RlYWQgb2YgYSBjb21wcmVzc2lvbiBvcGVyYXRpb24uIElmIGEgY29weSBvcGVyYXRpb24gd2FzICAgICAqLwotIC8qIHVzZWQsIHRoZW4gYWxsIHdlIG5lZWQgdG8gZG8gaXMgY29weSB0aGUgZGF0YSBvdmVyLCBzZXQgdGhlIG91dHB1dCBsZW5ndGggKi8KLSAvKiBhbmQgcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jaWYgMAotIGlmICgqcF9zcmNfZmlyc3Q9PUZMQUdfQ09QWSkKLSAgIHsKLSAgICBmYXN0X2NvcHkocF9zcmNfZmlyc3QrRkxBR19CWVRFUyxwX2RzdF9maXJzdCxzcmNfbGVuLUZMQUdfQllURVMpOwotICAgICpwX2RzdF9sZW49c3JjX2xlbi1GTEFHX0JZVEVTOwotICAgIHJldHVybjsKLSAgIH0KLSNlbHNlCi0gIGlmICggc3JjX2xlbiA8IDAgKQotICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKLSAgIGZhc3RfY29weShwX3NyY19maXJzdCxwX2RzdF9maXJzdCwtc3JjX2xlbiApOwotICAgKnBfZHN0X2xlbiA9IChVTE9ORyktc3JjX2xlbjsKLSAgIHJldHVybjsKLSAgfQotI2VuZGlmCi0gICAKLSAvKiBJbml0aWFsaXplIGFsbCBlbGVtZW50cyBvZiB0aGUgaGFzaCB0YWJsZSB0byBwb2ludCB0byBhIGNvbnN0YW50IHN0cmluZy4gICovCi0gLyogVXNlIG9mIGFuIHVucm9sbGVkIGxvb3Agc3BlZWRzIHRoaXMgdXAgY29uc2lkZXJhYmx5LiAgICAgICAgICAgICAgICAgICAgICAqLwotIHtVV09SRCBpOyBVQllURSAqKnBfaD1oYXNoOwotIyAgZGVmaW5lIFpKICpwX2grKz1TVEFSVF9TVFJJTkdfMTgKLSAgZm9yIChpPTA7aTwyNTY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BsZW5tdDsgICAgICAgIC8qIExlbmd0aCBvZiBjb3B5IGl0ZW0gbWludXMgdGhyZWUuICAgICovCi0gICAgICAgICAgcmVnaXN0ZXIgVUJZVEUgKipwX2h0ZTsgICAgICAvKiBQb2ludGVyIHRvIGN1cnJlbnQgaGFzaCB0YWJsZSBlbnRyeS4qLwotICAgICAgICAgIHJlZ2lzdGVyIFVCWVRFICpwX3ppdj1wX2RzdDsgLyogUG9pbnRlciB0byBzdGFydCBvZiBjdXJyZW50IFppdi4gICAgKi8KLSAgICAgICAgICAKLSAgICAgICAgICAvKiBSZWFkIGFuZCBkaXNtYW50bGUgdGhlIGNvcHkgd29yZC4gV29yayBvdXQgZnJvbSB3aGVyZSB0byBjb3B5LiAgICovCi0gICAgICAgICAgbGVubXQ9KnBfc3JjKys7Ci0gICAgICAgICAgcF9odGU9Jmhhc2hbKChsZW5tdCYweEYwKTw8NCl8KnBfc3JjKytdOwotICAgICAgICAgIHA9KnBfaHRlOwotICAgICAgICAgIGxlbm10Jj0weEY7Ci0gICAgICAgICAgCi0gICAgICAgICAgLyogTm93IHBlcmZvcm0gdGhlIGNvcHkgdXNpbmcgYSBoYWxmIHVucm9sbGVkIGxvb3AuICovCi0gICAgICAgICAgKnBfZHN0Kys9KnArKzsKLSAgICAgICAgICAqcF9kc3QrKz0qcCsrOwotICAgICAgICAgICpwX2RzdCsrPSpwKys7Ci0gICAgICAgICAgd2hpbGUgKGxlbm10LS0pCi0gICAgICAgICAgICAgKnBfZHN0Kys9KnArKzsKLSAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgLyogQmVjYXVzZSB3ZSBoYXZlIGp1c3QgcmVjZWl2ZWQgMyBvciBtb3JlIGJ5dGVzIGluIGEgY29weSBpdGVtICAgICAqLwotICAgICAgICAgIC8qICh3aG9zZSBieXRlcyB3ZSBoYXZlIGp1c3QgaW5zdGFsbGVkIGluIHRoZSBvdXRwdXQpLCB3ZSBhcmUgbm93ICAgKi8KLSAgICAgICAgICAvKiBpbiBhIHBvc2l0aW9uIHRvIGZsdXNoIGFsbCB0aGUgcGVuZGluZyBsaXRlcmFsIGhhc2hpbmdzIHRoYXQgaGFkICovCi0gICAgICAgICAgLyogYmVlbiBwb3N0cG9uZWQgZm9yIGxhY2sgb2YgYnl0ZXMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgIGlmIChsaXRlcmFscz4wKQotICAgICAgICAgICAgewotICAgICAgICAgICAgIHJlZ2lzdGVyIFVCWVRFICpyPXBfeml2LWxpdGVyYWxzOwotICAgICAgICAgICAgIGhhc2hbSEFTSChyKV09cjsKLSAgICAgICAgICAgICBpZiAobGl0ZXJhbHM9PTIpCi0gICAgICAgICAgICAgICAge3IrKzsgaGFzaFtIQVNIKHIpXT1yO30KLSAgICAgICAgICAgICBsaXRlcmFscz0wOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgLyogSW4gYW55IGNhc2UsIHdlIGNhbiBpbW1lZGlhdGVseSB1cGRhdGUgdGhlIGhhc2ggdGFibGUgd2l0aCB0aGUgICAqLwotICAgICAgICAgIC8qIGN1cnJlbnQgcG9zaXRpb24uIFdlIGRvbid0IG5lZWQgdG8gZG8gYSBIQVNIKC4uLikgdG8gd29yayBvdXQgICAgKi8KLSAgICAgICAgICAvKiB3aGVyZSB0byBwdXQgdGhlIHBvaW50ZXIsIGFzIHRoZSBjb21wcmVzc29yIGp1c3QgdG9sZCB1cyEhISAgICAgICovCi0gICAgICAgICAgKnBfaHRlPXBfeml2OwotICAgICAgICAgIAotICAgICAgICAgfQotICAgICAgIGVsc2UKLSAgICAgICAgIHsKLSAgICAgICAgICAvKiBMaXRlcmFsIGl0ZW0uICovCi0gICAgICAgICAgCi0gICAgICAgICAgLyogQ29weSBvdmVyIHRoZSBsaXRlcmFsIGJ5dGUuICovCi0gICAgICAgICAgKnBfZHN0Kys9KnBfc3JjKys7Ci0gICAgICAgICAgCi0gICAgICAgICAgLyogSWYgd2Ugbm93IGhhdmUgdGhyZWUgbGl0ZXJhbHMgd2FpdGluZyB0byBiZSBoYXNoZWQgaW50byB0aGUgaGFzaCAqLwotICAgICAgICAgIC8qIHRhYmxlLCB3ZSBjYW4gZG8gb25lIG9mIHRoZW0gbm93IChiZWNhdXNlIHRoZXJlIGFyZSB0aHJlZSkuICAgICAgKi8KLSAgICAgICAgICBpZiAoKytsaXRlcmFscyA9PSAzKQotICAgICAgICAgICAgIHtyZWdpc3RlciBVQllURSAqcD1wX2RzdC0zOyBoYXNoW0hBU0gocCldPXA7IGxpdGVyYWxzPTI7fQotICAgICAgICAgfQotICAgICAgICAgIAotICAgICAgIC8qIFNoaWZ0IHRoZSBjb250cm9sIGJ1ZmZlciBzbyB0aGUgbmV4dCBjb250cm9sIGJpdCBpcyBpbiBiaXQgMC4gKi8KLSAgICAgICBjb250cm9sPj49MTsKLSNpZiAxCi0gICAgICAgaWYgKHBfZHN0ID4gcF9kc3RfcG9zdCkgCi0gICAgICAgewotCSAgICAgICAvKiBTaGl0OiB3ZSB0cmllZCB0byBkZWNvbXByZXNzIGNvcnJ1cHQgZGF0YSAqLwotCSAgICAgICAqcF9kc3RfbGVuID0gMDsKLQkgICAgICAgcmV0dXJuOwotICAgICAgIH0KLSNlbmRpZgotICAgICAgfSAvKiBFbmQgdW5yb2xsZWQgaW5uZXIgbG9vcC4gKi8KLSAgICAgICAgICAgICAgIAotICAgfSAvKiBFbmQgb2Ygb3V0ZXIgbG9vcCAqLwotICAgCi0gLyogV3JpdGUgdGhlIGxlbmd0aCBvZiB0aGUgZGVjb21wcmVzc2VkIGRhdGEgYmVmb3JlIHJldHVybmluZy4gKi8KLSAgKnBfZHN0X2xlbj1wX2RzdC1wX2RzdF9maXJzdDsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVuZCBvZ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qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTVBSRVNTLkggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogQXV0aG9yIDogUm9zcyBXaWxsaWFtcy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERhdGUgICA6IERlY2VtYmVyIDE5ODkuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogVGhpcyBoZWFkZXIgZmlsZSBkZWZpbmVzIHRoZSBpbnRlcmZhY2UgdG8gYSBzZXQgb2YgZnVuY3Rpb25zIGNhbGxlZCAgICAgICAgKi8KLS8qICdjb21wcmVzcycsIGVhY2ggbWVtYmVyIG9mIHdoaWNoIGltcGxlbWVudHMgYSBwYXJ0aWN1bGFyIGRhdGEgY29tcHJlc3Npb24gICovCi0vKiBhbGdvcml0aG0uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIE5vcm1hbGx5IGluIEMgcHJvZ3JhbW1pbmcsIGZvciBlYWNoIC5IIGZpbGUsIHRoZXJlIGlzIGEgY29ycmVzcG9uZGluZyAuQyAgICovCi0vKiBmaWxlIHRoYXQgaW1wbGVtZW50cyB0aGUgZnVuY3Rpb25zIHByb21pc2VkIGluIHRoZSAuSCBmaWxlLiAgICAgICAgICAgICAgICAqLwotLyogSGVyZSwgdGhlcmUgYXJlIG1hbnkgLkMgZmlsZXMgY29ycmVzcG9uZGluZyB0byB0aGlzIGhlYWRlciBmaWxlLiAgICAgICAgICAgKi8KLS8qIEVhY2ggY29tZm9ybWluZyBpbXBsZW1lbnRhdGlvbiBmaWxlIGNvbnRhaW5zIGEgc2luZ2xlIGZ1bmN0aW9uICAgICAgICAgICAgICovCi0vKiBjYWxsZWQgJ2NvbXByZXNzJyB0aGF0IGltcGxlbWVudHMgYSBzaW5nbGUgZGF0YSBjb21wcmVzc2lvbiAgICAgICAgICAgICAgICAqLwotLyogYWxnb3JpdGhtIHRoYXQgY29uZm9ybXMgd2l0aCB0aGUgaW50ZXJmYWNlIHNwZWNpZmllZCBpbiB0aGlzIGhlYWRlciBmaWxlLiAgKi8KLS8qIE9ubHkgb25lIGFsZ29yaXRobSBjYW4gYmUgbGlua2VkIGluIGF0IGEgdGltZSBpbiB0aGlzIG9yZ2FuaXphdGlvbi4gICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgREVGSU5JVElPTiBPRiBGVU5DVElPTiBDT01QUkVTUyAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBTdW1tYXJ5IG9mIEZ1bmN0aW9uIENvbXByZXNzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFRoZSBhY3Rpb24gdGhhdCAnY29tcHJlc3MnIHRha2VzIGRlcGVuZHMgb24gaXRzIGZpcnN0IGFyZ3VtZW50IGNhbGxlZCAgICAgICovCi0vKiAnYWN0aW9uJy4gIFRoZSBmdW5jdGlvbiBwcm92aWRlcyB0aHJlZSBhY3Rpb25zOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgIC0gUmV0dXJuIGluZm9ybWF0aW9uIGFib3V0IHRoZSBhbGdvcml0aG0uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAtIENvbXByZXNzICAgYSBibG9jayBvZiBtZW1vcnkuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgLSBEZWNvbXByZXNzIGEgYmxvY2sgb2YgbWVtb3J5LiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogLS0tLS0tLS0tLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFNlZSB0aGUgZm9ybWFsIEMgZGVmaW5pdGlvbiBsYXRlciBmb3IgYSBkZXNjcmlwdGlvbiBvZiB0aGUgcGFyYW1ldGVycy4gICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogQ29uc3RhbnRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIC0tLS0tLS0tLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBDT01QUkVTU19PVkVSUlVOOiBUaGUgY29uc3RhbnQgQ09NUFJFU1NfT1ZFUlJVTiBkZWZpbmVzIGJ5IGhvdyBtYW55IGJ5dGVzICAqLwotLyogYW4gYWxnb3JpdGhtIGlzIGFsbG93ZWQgdG8gZXhwYW5kIGEgYmxvY2sgZHVyaW5nIGEgY29tcHJlc3Npb24gb3BlcmF0aW9uLiAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBBbHRob3VnaCBjb21wcmVzc2lvbiBhbGdvcml0aG1zIHVzdWFsbHkgY29tcHJlc3MgZGF0YSwgdGhlcmUgd2lsbCBhbHdheXMgICAqLwotLyogYmUgZGF0YSB0aGF0IGEgZ2l2ZW4gY29tcHJlc3NvciB3aWxsIGV4cGFuZCAod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XJuZWQuICAqLwotLyogICBUaGlzIGFsbG93cyBhbiBhbGdvcml0aG0gdG8gb3ZlcnJ1biB0aGUgbGVuZ3RoIG9mIHRoZSBpbnB1dCBibG9jayBpbiB0aGUgKi8KLS8qICAgb3V0cHV0IGJsb2NrIGJ5IHVwIHRvIENPTVBSRVNTX09WRVJSVU4gYnl0ZXMgYmV0d2VlbiBleHBhbnNpb24gY2hlY2tzLiAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogVGhlIHByb2JsZW0gZG9lcyBub3QgYXJpc2UgZm9yIGRlY29tcHJlc3Npb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBJZGVudGl0eSBBY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogLS0tLS0tLS0tLS0tLS0tICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gYWN0aW9uIG11c3QgYmUgQ09NUFJFU1NfQUNUSU9OX0lERU5USVRZLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA+IHBfZHN0X2xlbiBtdXN0IHBvaW50IHRvIGEgbG9uZ3dvcmQgdG8gcmVjZWl2ZSBhIGxvbmd3b3JkIGFkZHJlc3MuICAgICAgICAqLwotLyogPiBUaGUgdmFsdWUgb2YgdGhlIG90aGVyIHBhcmFtZXRlcnMgZG9lcyBub3QgbWF0dGVyLiAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gQWZ0ZXIgZXhlY3V0aW9uLCB0aGUgbG9uZ3dvcmQgdGhhdCBwX2RzdF9sZW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W5lZCBieSAgICAqLwotLyogICBtYWtpbmcgYSBzZXBhcmF0ZSBjYWxsIHRvIGNvbXByZXNzLCBzcGVjaWZ5aW5nIHRoZSBpZGVudGl0eSBhY3Rpb24uICAgICAgKi8KLS8qID4gVGhlIElOUFVUIEJMT0NLIGlzIGRlZmluZWQgdG8gYmUgTWVtb3J5W3NyY19hZGRyLHNyY19hZGRyK3NyY19sZW4tMV0uICAgICovCi0vKiA+IGRzdF9sZW4gd2lsbCBiZSB1c2VkIHRvIGRlbm90ZSAqcF9kc3RfbGVuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPiBkc3RfbGVuIGlzIG5vdCByZWFkIGJ5IGNvbXByZXNzLCBvbmx5IHdyaXR0ZW4uICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gVGhlIHZhbHVlIG9mIGRzdF9sZW4gaXMgZGVmaW5lZCBvbmx5IHVwb24gdGVybWluYXRpb24uICAgICAgICAgICAgICAgICAgICovCi0vKiA+IFRoZSBPVVRQVVQgQkxPQ0sgaXMgZGVmaW5lZCB0byBiZSBNZW1vcnlbZHN0X2FkZHIsZHN0X2FkZHIrZHN0X2xlbi0xXS4gICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIENvbXByZXNzaW9uIEFjdGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAtLS0tLS0tLS0tLS0tLS0tLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPiBhY3Rpb24gbXVzdCBiZSBDT01QUkVTU19BQ1RJT05fQ09NUFJFU1MuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gc3JjX2xlbiBtdXN0IGJlIGluIHRoZSByYW5nZSBbMCxDT01QUkVTU19NQVhfT1JHXS4gICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA+IFRoZSBPVVRQVVQgWk9ORSBpcyBkZWZpbmVkIHRvIGJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICBNZW1vcnlbZHN0X2FkZHIsZHN0X2FkZHIrc3JjX2xlbi0xK0NPTVBSRVNTX09WRVJSVU5dLiAgICAgICAgICAgICAgICAgKi8KLS8qID4gVGhlIGZ1bmN0aW9uIGNhbiBtb2RpZnkgYW55IHBhcnQgb2YgdGhlIG91dHB1dCB6b25lIHJlZ2FyZGxlc3Mgb2YgdGhlICAgICovCi0vKiAgIGZpbmFsIGxlbmd0aCBvZiB0aGUgb3V0cHV0IGJsb2NrLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPiBUaGUgaW5wdXQgYmxvY2sgYW5kIHRoZSBvdXRwdXQgem9uZSBtdXN0IG5vdCBvdmVybGFwLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gZHN0X2xlbiB3aWxsIGJlIGluIHRoZSByYW5nZSBbMCxzcmNfbGVuK0NPTVBSRVNTX09WRVJSVU5dLiAgICAgICAgICAgICAgICovCi0vKiA+IGRzdF9sZW4gd2lsbCBiZSBpbiB0aGUgcmFuZ2UgWzAsQ09NUFJFU1NfTUFYX0NPTV0gKGZyb20gcHJldiBmYWN0KS4gICAgICAqLwotLyogPiBUaGUgb3V0cHV0IGJsb2NrIHdpbGwgY29uc2lzdCBvZiBhIHJlcHJlc2VudGF0aW9uIG9mIHRoZSBpbnB1dCBibG9jay4gICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBEZWNvbXByZXNzaW9uIEFjdGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogLS0tLS0tLS0tLS0tLS0tLS0tLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gYWN0aW9uIG11c3QgYmUgQ09NUFJFU1NfQUNUSU9OX0RFQ09NUFJFU1MuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA+IFRoZSBpbnB1dCBibG9jayBtdXN0IGJlIHRoZSByZXN1bHQgb2YgYW4gZWFybGllciBjb21wcmVzc2lvbiBvcGVyYXRpb24uICAqLwotLyogPiBJZiB0aGUgcHJldmlvdXMgZmFjdCBpcyB0cnVlLCB0aGUgZm9sbG93aW5nIGZhY3RzIG11c3QgYWxzbyBiZSB0cnVlOiAgICAgKi8KLS8qICAgPiBzcmNfbGVuIHdpbGwgYmUgaW4gdGhlIHJhbmdlIFswLENPTVBSRVNTX01BWF9DT01dLiAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgID4gZHN0X2xlbiB3aWxsIGJlIGluIHRoZSByYW5nZSBbMCxDT01QUkVTU19NQVhfT1JHXS4gICAgICAgICAgICAgICAgICAgICAqLwotLyogPiBUaGUgaW5wdXQgYW5kIG91dHB1dCBibG9ja3MgbXVzdCBub3Qgb3ZlcmxhcC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID4gT25seSB0aGUgb3V0cHV0IGJsb2NrIGlzIG1vZGlmaWVkLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA+IFVwb24gdGVybWluYXRpb24sIHRoZSBvdXRwdXQgYmxvY2sgd2lsbCBjb25zaXN0IG9mIHRoZSBieXRlcyBjb250YWluZWQgICAqLwotLyogICBpbiB0aGUgaW5wdXQgYmxvY2sgcGFzc2VkIHRvIHRoZSBlYXJsaWVyIGNvbXByZXNzaW9uIG9wZXJhdGlvbi4gICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9SVC5IICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBUaGlzIG1vZHVsZSBjb250YWlucyBtYWNybyBkZWZpbml0aW9ucyBhbmQgdHlwZXMgdGhhdCBhcmUgbGlrZWx5IHRvICAgICAgICAqLwotLyogY2hhbmdlIGJldHdlZW4gY29tcHV0ZXJzLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0jaWZuZGVmIERPTkVfUE9SVCAgICAgICAvKiBPbmx5IGRvIHRoaXMgaWYgbm90IHByZXZpb3VzbHkgZG9uZS4gICAgICAgICAgICAgICAqLwotCi0gICAjaWZkZWYgVEhJTktfQwotICAgICAgI2RlZmluZSBVQllURSB1bnNpZ25lZCBjaGFyICAgICAgLyogVW5zaWduZWQgYnl0ZSAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICNkZWZpbmUgVVdPUkQgdW5zaWduZWQgaW50ICAgICAgIC8qIFVuc2lnbmVkIHdvcmQgKDIgYnl0ZXMpICAgICAgICAgICAgICovCi0gICAgICAjZGVmaW5lIFVMT05HIHVuc2lnbmVkIGxvbmcgICAgICAvKiBVbnNpZ25lZCB3b3JkICg0IGJ5dGVzKSAgICAgICAgICAgICAqLwotICAgICAgI2RlZmluZSBCT09MICB1bnNpZ25lZCBjaGFyICAgICAgLyogQm9vbGVhbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICNkZWZpbmUgRk9QRU5fQklOQVJZX1JFQUQgICJyYiIgIC8qIE1vZGUgc3RyaW5nIGZvciBiaW5hcnkgcmVhZGluZy4gICAgICovCi0gICAgICAjZGVmaW5lIEZPUEVOX0JJTkFSWV9XUklURSAid2IiICAvKiBNb2RlIHN0cmluZyBmb3IgYmluYXJ5IHdyaXRpbmcuICAgICAqLwotICAgICAgI2RlZmluZSBGT1BFTl9URVhUX0FQUEVORCAgImEiICAgLyogTW9kZSBzdHJpbmcgZm9yIHRleHQgYXBwZW5kaW5nLiAgICAgKi8KLSAgICAgICNkZWZpbmUgUkVBTCBkb3VibGUgICAgICAgICAgICAgIC8qIFVTZWQgZm9yIGZsb2F0aW5nIHBvaW50IHN0dWZmLiAgICAgICovCi0gICAjZW5kaWYKLSAgICNpZiBkZWZpbmVkKExJTlVYKSB8fCBkZWZpbmVkKGxpbnV4KQotICAgICAgI2RlZmluZSBVQllURSBfX3U4ICAgICAgICAgICAgICAgLyogVW5zaWduZWQgYnl0ZSAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICNkZWZpbmUgVVdPUkQgX191MTYgICAgICAgICAgICAgIC8qIFVuc2lnbmVkIHdvcmQgKDIgYnl0ZXMpICAgICAgICAgICAgICovCi0gICAgICAjZGVmaW5lIFVMT05HIF9fdTMyICAgICAgICAgICAgICAvKiBVbnNpZ25lZCB3b3JkICg0IGJ5dGVzKSAgICAgICAgICAgICAqLwotICAgICAgI2RlZmluZSBMT05HICBfX3MzMiAgICAgICAgICAgICAgLyogU2lnbmVkICAgd29yZCAoNCBieXRlcykgICAgICAgICAgICAgKi8KLSAgICAgICNkZWZpbmUgQk9PTCAgaXMgbm90IHVzZWQgaGVyZSAgIC8qIEJvb2xlYW4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAjZGVmaW5lIEZPUEVOX0JJTkFSWV9SRUFEICBub3QgdXNlZCAgLyogTW9kZSBzdHJpbmcgZm9yIGJpbmFyeSByZWFkaW5nLiAqLwotICAgICAgI2RlZmluZSBGT1BFTl9CSU5BUllfV1JJVEUgbm90IHVzZWQgIC8qIE1vZGUgc3RyaW5nIGZvciBiaW5hcnkgd3JpdGluZy4gKi8KLSAgICAgICNkZWZpbmUgRk9QRU5fVEVYVF9BUFBFTkQgIG5vdCB1c2VkICAvKiBNb2RlIHN0cmluZyBmb3IgdGV4dCBhcHBlbmRpbmcuICovCi0gICAgICAjZGVmaW5lIFJFQUwgbm90IHVzZWQgICAgICAgICAgICAgICAgLyogVVNlZCBmb3IgZmxvYXRpbmcgcG9pbnQgc3R1ZmYuICAqLwotICAgICAgI2lmbmRlZiBUUlVFCi0gICAgICAjZGVmaW5lIFRSVUUgMQotICAgICAgI2VuZGlmCi0gICAjZW5kaWYKLQotICAgI2RlZmluZSBET05FX1BPUlQgICAgICAgICAgICAgICAgICAgLyogRG9uJ3QgZG8gYWxsIHRoaXMgYWdhaW4uICAgICAgICAgICAgKi8KLSAgICNkZWZpbmUgTUFMTE9DX0ZBSUwgTlVMTCAgICAgICAgICAgIC8qIEZhaWx1cmUgc3RhdHVzIGZyb20gbWFsbG9jKCkgICAgICAgICovCi0gICAjZGVmaW5lIExPQ0FMIHN0YXRpYyAgICAgICAgICAgICAgICAvKiBGb3Igbm9uLWV4cG9ydGVkIHJvdXRpbmVzLiAgICAgICAgICAqLwotICAgI2RlZmluZSBFWFBPUlQgICAgICAgICAgICAgICAgICAgICAgLyogU2lnbmFscyBleHBvcnRlZCBmdW5jdGlvbi4gICAgICAgICAgKi8KLSAgICNkZWZpbmUgdGhlbiAgICAgICAgICAgICAgICAgICAgICAgIC8qIFVzZWZ1bCBmb3IgYWxpZ25pbmcgaWZzLiAgICAgICAgICAgICovCi0KLSNlbmRpZgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbmQgb2YgUE9SVC5IICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNkZWZpbmUgQ09NUFJFU1NfQUNUSU9OX0lERU5USVRZICAgMAotI2RlZmluZSBDT01QUkVTU19BQ1RJT05fQ09NUFJFU1MgICAxCi0jZGVmaW5lIENPTVBSRVNTX0FDVElPTl9ERUNPTVBSRVNTIDIKLQotI2RlZmluZSBDT01QUkVTU19PVkVSUlVOIDEwMjQKLSNkZWZpbmUgQ09NUFJFU1NfTUFYX0NPTSAweDcwMDAwMDAwCi0jZGVmaW5lIENPTVBSRVNTX01BWF9PUkcgKENPTVBSRVNTX01BWF9DT00tQ09NUFJFU1NfT1ZFUlJVTikKLQotI2RlZmluZSBDT01QUkVTU19NQVhfU1RSTEVOIDI1NQotCi0vKiBUaGUgZm9sbG93aW5nIHN0cnVjdHVyZSBwcm92aWRlcyBpbmZvcm1hdGlvbiBhYm91dCB0aGUgYWxnb3JpdGhtLiAgICAgICAgICovCi0vKiA+IFRoZSB0b3AgYml0IG9mIGlkIG11c3QgYmUgemVyby4gVGhlIHJlbWFpbmluZyBiaXRzIG11c3QgYmUgY2hvc2VuIGJ5ICAgICovCi0vKiAgIHRoZSBhdXRob3Igb2YgdGhlIGFsZ29yaXRobSBieSB0b3NzaW5nIGEgY29pbiAzMSB0aW1lcy4gICAgICAgICAgICAgICAgICovCi0vKiA+IFRoZSBhbW91bnQgb2YgbWVtb3J5IHJlcXVlc3RlZCBieSB0aGUgYWxnb3JpdGhtIGlzIHNwZWNpZmllZCBpbiBieXRlcyAgICovCi0vKiAgIGFuZCBtdXN0IGJlIGluIHRoZSByYW5nZSBbMCwweDcwMDAwMDAwXS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA+IEFsbCBzdHJpbmdzIHMgbXVzdCBiZSBzdWNoIHRoYXQgc3RybGVuKHMpPD1DT01QUkVTU19NQVhfU1RSTEVOLiAgICAgICAgICovCi1zdHJ1Y3QgY29tcHJlc3NfaWRlbnRpdHkKLSAgewotICAgVUxPTkcgaWQ7ICAgICAgICAgICAvKiBJZGVudGlmeWluZyBudW1iZXIgb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICovCi0gICBVTE9ORyBtZW1vcnk7ICAgICAgIC8qIE51bWJlciBvZiBieXRlcyBvZiB3b3JraW5nIG1lbW9yeSByZXF1aXJlZC4gKi8KLQotICAgY2hhciAgKm5hbWU7ICAgICAgICAvKiBOYW1lIG9mIGFsZ29yaXRobS4gICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICBjaGFyICAqdmVyc2lvbjsgICAgIC8qIFZlcnNpb24gbnVtYmVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgIGNoYXIgICpkYXRlOyAgICAgICAgLyogRGF0ZSBvZiByZWxlYXNlIG9mIHRoaXMgdmVyc2lvbi4gICAgICAgICAgICAqLwotICAgY2hhciAgKmNvcHlyaWdodDsgICAvKiBDb3B5cmlnaHQgbWVzc2FnZS4gICAgICAgICAgICAgICAgICAgICAgICAgICovCi0KLSAgIGNoYXIgICphdXRob3I7ICAgICAgLyogQXV0aG9yIG9mIGFsZ29yaXRobS4gICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgY2hhciAgKmFmZmlsaWF0aW9uOyAvKiBBZmZpbGlhdGlvbiBvZiBhdXRob3IuICAgICAgICAgICAgICAgICAgICAgICovCi0gICBjaGFyICAqdmVuZG9yOyAgICAgIC8qIFdoZXJlIHRoZSBhbGdvcml0aG0gY2FuIGJlIG9idGFpbmVkLiAgICAgICAgKi8KLSAgfTsKLQotdm9pZCAgbHpydzNfY29tcHJlc3MoICAgICAgICAvKiBTaW5nbGUgZnVuY3Rpb24gaW50ZXJmYWNlIHRvIGNvbXByZXNzaW9uIGFsZ29yaXRobS4gKi8KLVVXT1JEICAgICBhY3Rpb24sICAgICAgLyogQWN0aW9uIHRvIGJlIHBlcmZvcm1lZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi1VQllURSAgICp3cmtfbWVtLCAgICAgIC8qIFdvcmtpbmcgbWVtb3J5IHRlbXBvcmFyaWx5IGdpdmVuIHRvIHJvdXRpbmUgdG8gdXNlLiAqLwotVUJZVEUgICAqc3JjX2FkciwgICAgICAvKiBBZGRyZXNzIG9mIGlucHV0ICBkYXRhLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLUxPTkcgICAgIHNyY19sZW4sICAgICAgLyogTGVuZ3RoICBvZiBpbnB1dCAgZGF0YS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi1VQllURSAgICpkc3RfYWRyLCAgICAgIC8qIEFkZHJlc3Mgb2Ygb3V0cHV0IGRhdGEuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotdm9pZCAgKnBfZHN0X2xlbiAgICAgICAvKiBQb2ludGVyIHRvIGEgbG9uZ3dvcmQgd2hlcmUgcm91dGluZSB3aWxsIHdyaXRlOiAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgLyogICAgSWYgYWN0aW9uPS4uSURFTlRJVFkgICA9PiBBZHIgb2YgaWQgc3RydWN0dXJlLiAgICovCi0gICAgICAgICAgICAgICAgICAgICAgIC8qICAgIElmIGFjdGlvbj0uLkNPTVBSRVNTICAgPT4gTGVuZ3RoIG9mIG91dHB1dCBkYXRhLiAqLwotICAgICAgICAgICAgICAgICAgICAgICAvKiAgICBJZiBhY3Rpb249Li5ERUNPTVBSRVNTID0+IExlbmd0aCBvZiBvdXRwdXQgZGF0YS4gKi8KLSk7Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRW5kIG9mIENPTVBSRVNTLkggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFzdF9jb3B5LmggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLS8qIFRoaXMgZnVuY3Rpb24gY29waWVzIGEgYmxvY2sgb2YgbWVtb3J5IHZlcnkgcXVpY2tseS4gICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBUaGUgZXhhY3Qgc3BlZWQgZGVwZW5kcyBvbiB0aGUgcmVsYXRpdmUgYWxpZ25tZW50IG9mIHRoZSBibG9ja3Mgb2YgbWVtb3J5LiAqLwotLyogUFJFICA6IDA8PXNyY19sZW48PSgyXjMyKS0xIC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBSRSAgOiBTb3VyY2UgYW5kIGRlc3RpbmF0aW9uIGJsb2NrcyBtdXN0IG5vdCBvdmVybGFwLiAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQT1NUIDogTUVNW2RzdF9hZHIsZHN0X2FkcitzcmNfbGVuLTFdPU1FTVtzcmNfYWRyLHNyY19hZHIrc3JjX2xlbi0xXS4gICAgICAqLwotLyogUE9TVCA6IE1FTVtkc3RfYWRyLGRzdF9hZHIrc3JjX2xlbi0xXSBpcyB0aGUgb25seSBtZW1vcnkgY2hhbmdlZC4gICAgICAgICAgKi8KLQotI2RlZmluZSBmYXN0X2NvcHkoc3JjLGRzdCxsZW4pIG1lbWNweShkc3Qsc3JjLGxlbikKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVuZCBvZiBmYXN0X2NvcHkuaCAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0jZW5kaWYKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9mdGFwZS9jb21wcmVzc29yL3pmdGFwZS1jb21wcmVzcy5jIGIvZHJpdmVycy9jaGFyL2Z0YXBlL2NvbXByZXNzb3IvemZ0YXBlLWNvbXByZXNzLmMKZGVsZXRlZCBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDY1ZmZjMGIuLjAwMDAwMDAKLS0tIGEvZHJpdmVycy9jaGFyL2Z0YXBlL2NvbXByZXNzb3IvemZ0YXBlLWNvbXByZXNzLmMKKysrIC9k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HNlZ21lbnQgc3RydWN0dXJlCi0gKiAgICAgICAgICAyOWsgPiBvZmZzZXQgPj0gMjlrLTE4OiBkYXRhIGZyb20gcHJldmlvdXMgc2VnbWVudCBlbnMgaW4gdGhpcwotICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnbWVudCBhbmQgbm8gY29tcHJlc3NlZCBibG9jayBzdGFydHMKLSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIHRoaXMgc2VnbWVudAotICogICAgICAgICAgICAgICAgICAgICBvZmZzZXQgPT0gMDogZGF0YSBmcm9tIHByZXZpb3VzIHNlZ21lbnQgb2NjdXBpZXMgZW50aXJlCi0gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWdtZW50IGFuZCBjb250aW51ZXMgaW4gbmV4dCBzZWdtZW50Ci0gKiBuIGJ5dGVzOiByZW1haW5kZXIgZnJvbSBwcmV2aW91cyBzZWdtZW50Ci0gKiAKLSAqIFJldi4gSzogIAotICogNCBieXRlczogNCBieXRlczogZmlsZXMgc2V0IGJ5dGUgb2Zmc2V0Ci0gKiBQb3N0IFJldi4gSyBhbmQgUUlDLTMwMjAvMzAyMDoKLSAqIDggYnl0ZXM6IDggYnl0ZXM6IGZpbGVzIHNldCBieXRlIG9mZnNldAotICogMiBieXRlczogYnl0ZSBjb3VudCBOIChhbW91bnQgb2YgZGF0YSBmb2xsb3dpbmcpCi0gKiAgICAgICAgICBiaXQgMTUgaXMgc2V0IGlmIGRhdGEgaXMgY29tcHJlc3NlZCwgYml0IDE1IGlzIG5vdAotICogICAgICAgICAgc2V0IGlmIGRhdGEgaXMgdW5jb21wcmVzc2VkCi0gKiBOIGJ5dGVzOiBkYXRhIChhcyBtdWNoIGFzIHNwZWNpZmllZCBpbiB0aGUgYnl0ZSBjb3VudCkKLSAqIDIgYnl0ZXM6IGJ5dGUgY291bnQgTl8xIG9mIG5leHQgY2x1c3RlcgotICogTl8xIGJ5dGVzOiBkYXRhI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0Y2hfYnVmLCBhbGxvY19ibGtzeiArIENNUFJfT1ZFUlJVTik7Ci0JY21wcl9tZW1faW5pdGlhbGl6ZWQgPSBhbGxvY19ibGtzeiA9IDA7Ci0JVFJBQ0VfRVhJVDsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAqICBUaGUgZm9sbG93aW5nIHR3byBmdW5jdGlvbnMgImZ0YXBlX2NvbXByZXNzKCkiIGFuZCAgICAgICAgICAgICAgICAgICAgICAgKgotICogICJmdGFwZV91bmNvbXByZXNzKCkiIGFyZSB0aGUgaW50ZXJmYWNlIHRvIHRoZSBhY3R1YWwgY29tcHJlc3Npb24gICAgICAgICAqCi0gKiAgYWxnb3JpdGhtIChpLmUuIHRoZXkgYXJlIGNhbGxpbmcgdGhlICJjb21wcmVzcygpIiBmdW5jdGlvbiBmcm9tICAgICAgICAgICoKLSAqICB0aGUgbHpydzMgcGFja2FnZSBmb3Igbm93KS4gVGhlc2Ugcm91dGluZXMgY291bGQgcXVpdGUgZWFzaWx5IGJlICAgICAgICAgKgotICogIGNoYW5nZWQgdG8gYWRvcHQgYW5vdGhlciBjb21wcmVzc2lvbiBhbGdvcml0aG0gaW5zdGVhZCBvZiBsenJ3MywgICAgICAgICAqCi0gKiAgd2hpY2ggY3VycmVudGx5IGlzIHVzZWQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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LSAqCi0gKiAgaW50ICp3cml0ZV9jbnQgICAgICAgICAgIDogaG93IG11Y2ggYWN0dWFsbHkgaGFzIGJlZW4gbW92ZWQgdG8gdGhlCi0gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0X2J1Zi4gTmVlZCBub3QgYmUgaW5pdGlhbGl6ZWQgd2hlbgotICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJldHVybnMgd2l0aCBhbiBlcnJvciBjb2RlCi0gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG5lZ2F0aXYgcmV0dXJuIHZhbHVlKSAKLSAqICBfX3U4ICpkc3RfYnVmICAgICAgICAgICAgOiBrZXJuZWwgc3BhY2UgYnVmZmVyIHdoZXJlIHRoZSBoYXMgdG8gYmUKLSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3BpZWQgdG8uIFRoZSBjb250ZW50cyBvZiB0aGlzIGJ1ZmZlcnMKLSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb2VzIHRvIGEgc3BlY2lmaWMgc2VnbWVudC4KLSAqICBjb25zdCBpbnQgc2VnX3N6ICAgICAgICAgOiB0aGUgc2l6ZSBvZiB0aGUgc2VnbWVudCBkc3RfYnVmIHdpbGwgYmUKLSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3BpZWQgdG8uCi0gKiAgY29uc3QgemZ0X3Bvc2l0aW9uICpwb3MgIDogc3RydWN0IGNvbnRhaW5pbmcgdGhlIGNvb3JkaW5hdGVzIGluCi0gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIGN1cnJlbnQgdm9sdW1lIChieXRlIHBvc2l0aW9uLAotICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlZ21lbnQgaWQgb2YgY3VycmVudCBzZWdtZW50IGV0YykKLSAqICBjb25zdCB6ZnRfdm9saW5mbyAqdm9sdW1lOiBpbmZvcm1hdGlvbiBhYm91dCB0aGUgY3VycmV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byBsb2cgOgotICogICAgICAgMCAgICAgICAgICAgICAgYnVncwotICogICAgICAgMSAgICAgICAgICAgICAgKyBlcnJvcnMKLSAqICAgICAgIDIgICAgICAgICAgICAgICsgd2FybmluZ3MKLSAqICAgICAgIDMgICAgICAgICAgICAgICsgaW5mb3JtYXRpb24KLSAqICAgICAgIDQgICAgICAgICAgICAgICsgbW9yZSBpbmZvcm1hdGlvbgotICogICAgICAgNSAgICAgICAgICAgICAgKyBwcm9ncmFtIGZsb3cKLSAqICAgICAgIDYgICAgICAgICAgICAgICsgZmRjL2RtYSBpbmZvCi0gKiAgICAgICA3ICAgICAgICAgICAgICArIGRhdGEgZmxvdwotICogICAgICAgOCAgICAgICAgICAgICAgKyBldmVyeXRoaW5nIGVsc2UKLSAqLwotZnRfdHJhY2VfdCBmdGFwZV90cmFjaW5nID0gZnRfdF9pbmZvOyAvKiBEZWZhdWx0IGxldmVsOiBpbmZvcm1hdGlvbiBhbmQgdXAgKi8KLWludCAgZnRhcGVfZnVuY3Rpb25fbmVzdF9sZXZlbDsKLQotLyogICAgICBMb2NhbCB2YXJzLgotICovCi1zdGF0aWMgX191OCB0cmFjZV9pZDsKLXN0YXRpYyBjaGFyIHNwYWNpbmdbXSA9ICIqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjsKLQotdm9pZCBmdGFwZV90cmFjZV9jYWxsKGNvbnN0IGNoYXIgKmZpbGUsIGNvbnN0IGNoYXIgKm5hbWUpCi17Ci0JY2hhciAqaW5kZW50OwotCi0JLyogICAgU2luY2UgcHJpbnRrIHNlZW1zIG5vdCB0byB3b3JrIHdpdGggIiUqcyIgZm9ybWF0Ci0JICogICAgd2UnbGwgdXNlIHRoaXMgd29yay1hcm91bmQuCi0JICovCi0JaWYgKGZ0YXBlX2Z1bmN0aW9uX25lc3RfbGV2ZWwgPCAwKSB7Ci0JCXByaW50ayhLRVJOX0lORk8gImZ1bmN0aW9uIG5lc3QgbGV2ZWwgKCVkKSA8IDBcbiIsCi0JC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AgICAgICAgICAgICAgICAgICAqCi0gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotc3RhdGljIGludCBtdF9kdW1teShpbnQgKmR1bW15KQotewotCVRSQUNFX0ZVTihmdF90X2Zsb3cpOwotCQotCVRSQUNFX0VYSVQgLUVOT1NZUzsKLX0KLQotc3RhdGljIGludCBtdF9yZXNldChpbnQgKmR1bW15KQoteyAgICAgICAgCi0JVFJBQ0VfRlVOKGZ0X3RfZmxvdyk7Ci0JCi0JKHZvaWQpZnRhcGVfc2Vla190b19ib3QoKTsKLQlUUkFDRV9DQVRDSChmdGFwZV9yZXNldF9kcml2ZSgpLAotCQkgICAgemZ0X2luaXRfZHJpdmVyKCk7IHpmdF91bmluaXRfbWVtKCk7IHpmdF9vZmZsaW5lID0gMSk7Ci0JLyogIGZha2UgYSByZS1vcGVuIG9mIHRoZSBkZXZpY2UuIFRoaXMgd2lsbCBzZXQgYWxsIGZsYWdlIGFuZCAKLQkgKiAgYWxsb2NhdGUgYnVmZmVycyBhcyBhcHByb3ByaWF0ZS4gVGhlIG5ldyB0YXBlIGNvbmRpdGlvbiB3aWxsCi0JICogIGZvcmNlIHRoZSBvcGVuIHJvdXRpbmUgdG8gZG8gYW55dGhpbmcgd2UgbmVlZC4KLQkgKi8KLQlUUkFDRV9DQVRDSChfemZ0X29wZW4oLTEgLyogZmFrZSByZW9wZW4gKi8sIDAgLyogZHVtbXkgKi8pLCk7Ci0JVFJBQ0VfRVhJVCAwOwotfQotCi1zdGF0aWMgaW50IG10X2ZzZihpbnQgKmFyZykKLXsKLQlpbnQgcmVzdWx0OwotCVRSQUNFX0ZVTihmdF90X2Zsb3cpOwotCi0JcmVzdWx0ID0gemZ0X3NraXBfdm9sdW1lc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SBhbmQgdGltZSBvZiBtb3N0IHJlY2VudCBmb3JtYXQsIHNlZSBiZWxvdyAgKi8KLSNkZWZpbmUgRlRfV1JfREFURSAgICAxOCAgLyogZGF0ZSBhbmQgdGltZSBvZiBtb3N0IHJlY2VudCB3cml0ZSBvciBmb3JtYXQgICAgKi8KLSNkZWZpbmUgRlRfU1BUICAgICAgICAyNCAgLyogc2VnbWVudHMgcGVyIHRyYWNrICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSNkZWZpbmUgRlRfVFBDICAgICAgICAyNiAgLyogdHJhY2tzIHBlciBjYXJ0cmlkZ2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSNkZWZpbmUgRlRfRkhNICAgICAgICAyNyAgLyogZmxvcHB5IGRyaXZlIGhlYWQgKG1heGltdW0gb2YgaXQpICAgICAgICAgICAgICAgKi8KLSNkZWZpbmUgRlRfRlRNICAgICAgICAyOCAgLyogZmxvcHB5IHRyYWNrIG1heC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSNkZWZpbmUgRlRfRlNNICAgICAgICAyOSAgLyogZmxvcHB5IHNlY3RvciBtYXguICgxMjgpICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSNkZWZpbmUgRlRfTEFCRUwgICAgICAzMCAgLyogZmxvcHB5IHRhcGUgbGFiZWwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSNkZWZpbmUgRlRfTEFCRUxfREFURSA3NCAgLyogZGF0ZSBhbmQgdGltZSB0aGUgdGFwZSBsYWJlbCB3YXMgd3JpdHRlbiAgICAgICAgKi8KLSNkZWZpbmUgRlRfTEFCRUxfU1ogICAoRlRfTEFCRUxfREFURSAtIEZUX0xBQkVMKQotI2RlZmluZSBGVF9DTUFQX1NUQVJUIDc4ICAvKiBzdGFydGluZyBzZWdtZW50IG9mIGNvbXByZXNzaW9uIG1hcCAgICAgICAgICAgICAqLwotI2RlZmluZSBGVF9GTVRfRVJST1IgMTI4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