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Kz0gc3gubyBnZW5lcmljX3NlcmlhbC5vCitvYmotJChDT05GSUdfUklPKQkJKz0gcmlvLyBnZW5lcmljX3NlcmlhbC5vCitvYmotJChDT05GSUdfSFZDX0NPTlNPTEUpCSs9IGh2Y19jb25zb2xlLm8gaHZzaS5vCitvYmotJChDT05GSUdfUkFXX0RSSVZFUikJKz0gcmF3Lm8KK29iai0kKENPTkZJR19TR0lfU05TQykJCSs9IHNuc2Mubworb2JqLSQoQ09ORklHX01NVElNRVIpCQkrPSBtbXRpbWVyLm8KK29iai0kKENPTkZJR19WSU9DT05TKSArPSB2aW9jb25zLm8KK29iai0kKENPTkZJR19WSU9UQVBFKQkJKz0gdmlvdGFwZS5vCitvYmotJChDT05GSUdfSFZDUykJCSs9IGh2Y3MubworCitvYmotJChDT05GSUdfUFJJTlRFUikgKz0gbHAubworb2JqLSQoQ09ORklHX1RJUEFSKSArPSB0aXBhci5vCisKK29iai0kKENPTkZJR19EVExLKSArPSBkdGxrLm8KK29iai0kKENPTkZJR19SMzk2NCkgKz0gbl9yMzk2NC5vCitvYmotJChDT05GSUdfQVBQTElDT00pICs9IGFwcGxpY29tLm8KK29iai0kKENPTkZJR19TT05ZUEkpICs9IHNvbnlwaS5vCitvYmotJChDT05GSUdfUlRDKSArPSBydGMubworb2JqLSQoQ09ORklHX0hQRVQpICs9IGhwZXQubworb2JqLSQoQ09ORklHX0dFTl9SVEMpICs9IGdlbnJ0Yy5vCitvYmotJChDT05GSUdfRUZJX1JUQykgKz0gZWZpcnRjLm8KK29iai0kKENPTkZJR19TR0lfRFMxMjg2KSArPSBkczEyODYubworb2JqLSQoQ09ORklHX1NHSV9JUDI3X1JUQykgKz0gaXAyNy1ydGMubworb2JqLSQoQ09ORklHX0RTMTMwMikgKz0gZHMxMzAyLm8KK29iai0kKENPTkZJR19TM0MyNDEwX1JUQykgKz0gczNjMjQxMC1ydGMubworb2JqLSQoQ09ORklHX1JUQ19WUjQxWFgpICs9IHZyNDF4eF9ydGMubworaWZlcSAoJChDT05GSUdfR0VORVJJQ19OVlJBTSkseSkKKyAgb2JqLSQoQ09ORklHX05WUkFNKSArPSBnZW5lcmljX252cmFtLm8KK2Vsc2UKKyAgb2JqLSQoQ09ORklHX05WUkFNKSArPSBudnJhbS5vCitlbmRpZgorb2JqLSQoQ09ORklHX1RPU0hJQkEpICs9IHRvc2hpYmEubworb2JqLSQoQ09ORklHX0k4SykgKz0gaThrLm8KK29iai0kKENPTkZJR19EUzE2MjApICs9IGRzMTYyMC5vCitvYmotJChDT05GSUdfSFdfUkFORE9NKSArPSBod19yYW5kb20ubworb2JqLSQoQ09ORklHX0ZUQVBFKSArPSBmdGFwZS8KK29iai0kKENPTkZJR19DT0JBTFRfTENEKSArPSBsY2Qubworb2JqLSQoQ09ORklHX1BQREVWKSArPSBwcGRldi5vCitvYmotJChDT05GSUdfTldCVVRUT04pICs9IG53YnV0dG9uLm8KK29iai0kKENPTkZJR19OV0ZMQVNIKSArPSBud2ZsYXNoLm8KK29iai0kKENPTkZJR19TQ3gyMDBfR1BJTykgKz0gc2N4MjAwX2dwaW8ubworb2JqLSQoQ09ORklHX1RBTkJBQ19UQjAyMTkpICs9IHRiMDIxOS5vCisKK29iai0kKENPTkZJR19XQVRDSERPRykJKz0gd2F0Y2hkb2cvCitvYmotJChDT05GSUdfTVdBVkUpICs9IG13YXZlLworb2JqLSQoQ09ORklHX0FHUCkgKz0gYWdwLworb2JqLSQoQ09ORklHX0RSTSkgKz0gZHJtLworb2JqLSQoQ09ORklHX1BDTUNJQSkgKz0gcGNtY2lhLworb2JqLSQoQ09ORklHX0lQTUlfSEFORExFUikgKz0gaXBtaS8KKworb2JqLSQoQ09ORklHX0hBTkdDSEVDS19USU1FUikgKz0gaGFuZ2NoZWNrLXRpbWVyLm8KK29iai0kKENPTkZJR19UQ0dfVFBNKSArPSB0cG0vCisjIEZpbGVzIGdlbmVyYXRlZCB0aGF0IHNoYWxsIGJlIHJlbW92ZWQgdXBvbiBtYWtlIGNsZWFuC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mVzIG1hbmFnZSB0aGUgY3VycmVudCBjb250cm9sbGVyLCBhbmQgdGhlIGxpc3Qgb2YKKyAqIGNvbnRyb2xsZXJzCisgKi8KKworc3RhdGljIHN0cnVjdCBhZ3BfY29udHJvbGxlciAqYWdwX2ZpbmRfY29udHJvbGxlcl9ieV9waWQocGlkX3QgaWQpCit7CisJc3RydWN0IGFncF9jb250cm9sbGVyICpjb250cm9sbGVyOworCisJY29udHJvbGxlciA9IGFncF9mZS5jb250cm9sbGVyczsKKworCXdoaWxlIChjb250cm9sbGVyICE9IE5VTEwpIHsKKwkJaWYgKGNvbnRyb2xsZXItPnBpZCA9PSBpZCkKKwkJCXJldHVybiBjb250cm9sbGVyOworCQljb250cm9sbGVyID0gY29udHJvbGxlci0+bmV4dDsKKwl9CisKKwlyZXR1cm4gTlVMTDsKK30KKworc3RhdGljIHN0cnVjdCBhZ3BfY29udHJvbGxlciAqYWdwX2NyZWF0ZV9jb250cm9sbGVyKHBpZF90IGlkKQoreworCXN0cnVjdCBhZ3BfY29udHJvbGxlciAqY29udHJvbGxlcjsKKworCWNvbnRyb2xsZXIgPSBrbWFsbG9jKHNpemVvZihzdHJ1Y3QgYWdwX2NvbnRyb2xsZXIpLCBHRlBfS0VSTkVMKTsKKworCWlmIChjb250cm9sbGVyID09IE5VTEwpCisJCXJldHVybiBOVUxMOworCisJbWVtc2V0KGNvbnRyb2xsZXIsIDAsIHNpemVvZihzdHJ1Y3QgYWdwX2NvbnRyb2xsZXIpKTsKKwljb250cm9sbGVyLT5waWQgPSBpZDsKKworCXJldHVybiBjb250cm9sbGVyOworfQorCitzdGF0aWMgaW50IGFncF9pbnNlcnRfY29udHJvbGxlcihzdHJ1Y3QgYWdwX2NvbnRyb2xsZXIgKmNvbnRyb2xsZXIpCit7CisJc3RydWN0IGFncF9jb250cm9sbGVyICpwcmV2X2NvbnRyb2xsZXI7CisKKwlwcmV2X2NvbnRyb2xsZXIgPSBhZ3BfZmUuY29udHJvbGxlcnM7CisJY29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bGUgKG1lbW9yeSkgeworCQl0ZW1wID0gbWVtb3J5OworCQltZW1vcnkgPSBtZW1vcnktPm5leHQ7CisJCWFncF9mcmVlX21lbW9yeV93cmFwKHRlbXApOworCX0KK30KKworc3RhdGljIGludCBhZ3BfcmVtb3ZlX2NvbnRyb2xsZXIoc3RydWN0IGFncF9jb250cm9sbGVyICpjb250cm9sbGVyKQoreworCXN0cnVjdCBhZ3BfY29udHJvbGxlciAqcHJldl9jb250cm9sbGVyOworCXN0cnVjdCBhZ3BfY29udHJvbGxlciAqbmV4dF9jb250cm9sbGVyOworCisJcHJldl9jb250cm9sbGVyID0gY29udHJvbGxlci0+cHJldjsKKwluZXh0X2NvbnRyb2xsZXIgPSBjb250cm9sbGVyLT5uZXh0OworCisJaWYgKHByZXZfY29udHJvbGxlciAhPSBOVUxMKSB7CisJCXByZXZfY29udHJvbGxlci0+bmV4dCA9IG5leHRfY29udHJvbGxlcjsKKwkJaWYgKG5leHRfY29udHJvbGxlciAhPSBOVUxMKQorCQkJbmV4dF9jb250cm9sbGVyLT5wcmV2ID0gcHJldl9jb250cm9sbGVyOworCisJfSBlbHNlIHsKKwkJaWYgKG5leHRfY29udHJvbGxlciAhPSBOVUxMKQorCQkJbmV4dF9jb250cm9sbGVyLT5wcmV2ID0gTlVMTDsKKworCQlhZ3BfZmUuY29udHJvbGxlcnMgPSBuZXh0X2NvbnRyb2xsZXI7CisJfQorCisJYWdwX3JlbW92ZV9hbGxfbWVtb3J5KGNvbnRyb2xsZXIpOworCWFncF9yZW1vdmVfYWxsX2NsaWVudHMoY29udHJvbGxlcik7CisKKwlpZiAoYWdwX2ZlLmN1cnJlbnRfY29udHJvbGxlciA9PSBjb250cm9sbGVyKSB7CisJCWFncF9mZS5jdXJyZW50X2NvbnRyb2xsZXIgPSBOVUxMOworCQlhZ3BfZmUuYmFja2VuZF9hY3F1aXJlZCA9IEZBTFNFOworCQlhZ3BfYmFja2VuZF9yZWxlYXNlKGFncF9icmlkZ2UpOworCX0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jbGllbnQocGlkX3QgaWQpCit7CisJc3RydWN0IGFncF9jbGllbnQgKm5ld19jbGllbnQ7CisKKwluZXdfY2xpZW50ID0ga21hbGxvYyhzaXplb2Yoc3RydWN0IGFncF9jbGllbnQpLCBHRlBfS0VSTkVMKTsKKworCWlmIChuZXdfY2xpZW50ID09IE5VTEwpCisJCXJldHVybiBOVUxMOworCisJbWVtc2V0KG5ld19jbGllbnQsIDAsIHNpemVvZihzdHJ1Y3QgYWdwX2NsaWVudCkpOworCW5ld19jbGllbnQtPnBpZCA9IGlkOworCWFncF9pbnNlcnRfY2xpZW50KG5ld19jbGllbnQpOworCXJldHVybiBuZXdfY2xpZW50OworfQorCitzdGF0aWMgaW50IGFncF9yZW1vdmVfY2xpZW50KHBpZF90IGlkKQoreworCXN0cnVjdCBhZ3BfY2xpZW50ICpjbGllbnQ7CisJc3RydWN0IGFncF9jbGllbnQgKnByZXZfY2xpZW50OworCXN0cnVjdCBhZ3BfY2xpZW50ICpuZXh0X2NsaWVudDsKKwlzdHJ1Y3QgYWdwX2NvbnRyb2xsZXIgKmNvbnRyb2xsZXI7CisKKwljb250cm9sbGVyID0gYWdwX2ZpbmRfY29udHJvbGxlcl9mb3JfY2xpZW50KGlkKTsKKwlpZiAoY29udHJvbGxlciA9PSBOVUxMKQorCQlyZXR1cm4gLUVJTlZBTDsKKworCWNsaWVudCA9IGFncF9maW5kX2NsaWVudF9pbl9jb250cm9sbGVyKGNvbnRyb2xsZXIsIGlkKTsKKwlpZiAoY2xpZW50ID09IE5VTEwpCisJCXJldHVybiAtRUlOVkFMOworCisJcHJldl9jbGllbnQgPSBjbGllbnQtPnByZXY7CisJbmV4dF9jbGllbnQgPSBjbGllbnQtPm5leHQ7CisKKwlpZiAocHJldl9jbGllbnQgIT0gTlVMTCkgeworCQlwcmV2X2NsaWVudC0+bmV4dCA9IG5leHRfY2xpZW50OworCQlpZiAobmV4dF9jbGllbnQgIT0gTlVMTCkKKwkJCW5leHRfY2xpZW50LT5wcm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N0cnVjdCBhZ3BfaW5mbykpKQorCQlyZXR1cm4gLUVGQVVMVDsKKworCXJldHVybiAwOworfQorCitzdGF0aWMgaW50IGFncGlvY19hY3F1aXJlX3dyYXAoc3RydWN0IGFncF9maWxlX3ByaXZhdGUgKnByaXYpCit7CisJc3RydWN0IGFncF9jb250cm9sbGVyICpjb250cm9sbGVyOworCisJREJHKCIiKTsKKworCWlmICghKHRlc3RfYml0KEFHUF9GRl9BTExPV19DT05UUk9MTEVSLCAmcHJpdi0+YWNjZXNzX2ZsYWdzKSkpCisJCXJldHVybiAtRVBFUk07CisKKwlpZiAoYWdwX2ZlLmN1cnJlbnRfY29udHJvbGxlciAhPSBOVUxMKQorCQlyZXR1cm4gLUVCVVNZOworCisJaWYoIWFncF9icmlkZ2UpCisJCXJldHVybiAtRU5PREVWOworCisgICAgICAgIGlmIChhdG9taWNfcmVhZCgmYWdwX2JyaWRnZS0+YWdwX2luX3VzZSkpCisgICAgICAgICAgICAgICAgcmV0dXJuIC1FQlVTWTsKKworCWF0b21pY19pbmMoJmFncF9icmlkZ2UtPmFncF9pbl91c2UpOworCisJYWdwX2ZlLmJhY2tlbmRfYWNxdWlyZWQgPSBUUlVFOworCisJY29udHJvbGxlciA9IGFncF9maW5kX2NvbnRyb2xsZXJfYnlfcGlkKHByaXYtPm15X3BpZCk7CisKKwlpZiAoY29udHJvbGxlciAhPSBOVUxMKSB7CisJCWFncF9jb250cm9sbGVyX21ha2VfY3VycmVudChjb250cm9sbGVyKTsKKwl9IGVsc2UgeworCQljb250cm9sbGVyID0gYWdwX2NyZWF0ZV9jb250cm9sbGVyKHByaXYtPm15X3BpZCk7CisKKwkJaWYgKGNvbnRyb2xsZXIgPT0gTlVMTCkgeworCQkJYWdwX2ZlLmJhY2tlbmRfYWNxdWlyZWQgPSBGQUxTRTsKKwkJCWFncF9iYWNrZW5kX3JlbGVhc2UoYWdwX2JyaWRnZSk7CisJCQlyZXR1cm4gLUVOT01FTTsKKwkJfQorCQlhZ3B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VOF9BUEVSX1NJWkU6CisJCW51bV9lbnRyaWVzID0gQV9TSVpFXzgodGVtcCktPm51bV9lbnRyaWVzOworCQlicmVhazsKKwljYXNlIFUxNl9BUEVSX1NJWkU6CisJCW51bV9lbnRyaWVzID0gQV9TSVpFXzE2KHRlbXApLT5udW1fZW50cmllczsKKwkJYnJlYWs7CisJY2FzZSBVMzJfQVBFUl9TSVpFOgorCQludW1fZW50cmllcyA9IEFfU0laRV8zMih0ZW1wKS0+bnVtX2VudHJpZXM7CisJCWJyZWFrOworCWNhc2UgRklYRURfQVBFUl9TSVpFOgorCQludW1fZW50cmllcyA9IEFfU0laRV9GSVgodGVtcCktPm51bV9lbnRyaWVzOworCQlicmVhazsKKwljYXNlIExWTDJfQVBFUl9TSVpFOgorCQlyZXR1cm4gLUVJTlZBTDsKKwkJYnJlYWs7CisJZGVmYXVsdDoKKwkJbnVtX2VudHJpZXMgPSAwOworCQlicmVhazsKKwl9CisKKwludW1fZW50cmllcyAtPSBhZ3BfbWVtb3J5X3Jlc2VydmVkIC8gUEFHRV9TSVpFOworCWlmIChudW1fZW50cmllcyA8IDApCisJCW51bV9lbnRyaWVzID0gMDsKKworCWlmICh0eXBlICE9IDAgfHwgbWVtLT50eXBlICE9IDApIHsKKwkJcmV0dXJuIC1FSU5WQUw7CisJfQorCisJaWYgKChwZ19zdGFydCArIG1lbS0+cGFnZV9jb3VudCkgPiBudW1fZW50cmllcykKKwkJcmV0dXJuIC1FSU5WQUw7CisKKwlqID0gcGdfc3RhcnQ7CisKKwl3aGlsZSAoaiA8IChwZ19zdGFydCArIG1lbS0+cGFnZV9jb3VudCkpIHsKKwkJaWYgKCooYnJpZGdlLT5nYXR0X3RhYmxlICsgaikpCisJCQlyZXR1cm4gLUVCVVNZOworCQlqKys7CisJfQorCisJaWYgKG1lbS0+aXNfZmx1c2hlZCA9PSBGQUxTRSkgeworCQlicmlkZ2UtPmRyaXZlci0+Y2FjaGVfZmx1c2goKTsKKwkJbWVtLT5pc19mb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vY2hhci9hcHBsaWNvbS5jCkBAIC0wLDAgKzEsODYyIEBACisvKiBEZXJpdmVkIGZyb20gQXBwbGljb20gZHJpdmVyIGFjLmMgZm9yIFNDTyBVbml4ICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQb3J0ZWQgYnkgRGF2aWQgV29vZGhvdXNlLCBBeGlvbSAoQ2FtYnJpZGdlKSBMdGQuICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBkd213MkBpbmZyYWRlYWQub3JnIDMwLzgvOTggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAkSWQ6IGFjLmMsdiAxLjMwIDIwMDAvMDMvMjIgMTY6MDM6NTcgZHdtdzIgRXhwICQJCQkgICAgICovCisvKiBUaGlzIG1vZHVsZSBpcyBmb3IgTGludXggMi4xIGFuZCAyLjIgc2VyaWVzIGtlcm5lbHMuICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBKIFBBR0VUIDE4LzAyLzk0IHBhc3NhZ2UgVjIuNC4yIGlvY3RsIGF2ZWMgY29kZSAyIHJlc2V0IHRvIGxlcyBpbnRlcnJ1cHQgICovCisvKiBjZWNpIHBvdXIgcmVzZXRlciBjb3JyZWN0ZW1lbnQgYXByZXMgdW5lIHNvcnRpZSBzYXV2YWdlICAgICAgICAgICAgICAgICAgICovCisvKiBKIFBBR0VUIDAyLzA1Lzk0IHBhc3NhZ2UgVjIuNC4zIGRhbnMgbGUgdHJhaXRlbWVudCBkZSBkJ2ludGVycnVwdGlvbiwgICAgICovCisvKiBMb29wQ291bnQgbidldGFpdCBwYXMgaW5pdGlhbGlzZSBhIDAuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBGIExBRk9SU0UgMDQvMDcvOTUgdmVyc2lvbiBWMi42LjAgbGVjdHVyZSBiaWRvbiBhcHJlcyBhY2NlcyBhIHVuZSBjYXJ0ZSAgICovCisvKiAgICAgICAgICAgcG91ciBsaWJlcmVyIGxlIGJ1cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBKLlBBR0VUIDE5LzExLzk1IHZlcnNpb24gVjIuNi4xIE5vbWJyZSwgYWRkcmVzc2UsaXJxIG4nZXN0IHBsdXMgY29uZmlndXJlICovCisvKiBldCBwYXNzZSBlbiBhcmd1bWVudCBhIGFjaW5pdCwgbWFpcyBlc3Qgc2NydXRlIHN1ciBsZSBidXMgcG91ciBzJ2FkYXB0ZXIgICovCisvKiBhdSBub21icmUgZGUgY2FydGVzIHByZXNlbnRlcyBzdXIgbGUgYnVzLiBJT0NMIGNvZGUgNiBhZmZpY2hhaXQgVjIuNC4zICAgICovCisvKiBGLkxBRk9SU0UgMjgvMTEvOTUgY3JlYXRpb24gZGUgZmljaGllcnMgYWNYWC5vIGF2ZWMgbGVzIGRpZmZlcmVudGVzICAgICAgICovCisvKiBhZHJlc3NlcyBkZSBiYXNlIGRlcyBjYXJ0ZXMsIElPQ1RMIDYgcGx1cyBjb21wbGV0ICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBKLlBBR0VUIGxlIDE5LzA4Lzk2IGNvcGllIGRlIGxhIHZlcnNpb24gVjIuNiBlbiBWMi44LjAgc2FucyBtb2RpZmljYXRpb24gICovCisvKiBkZSBjb2RlIGF1dHJlIHF1ZSBsZSB0ZXh0ZSBWMi42LjEgZW4gVjIuOC4wICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKworI2luY2x1ZGUgPGxpbnV4L2tlcm5lbC5oPgorI2luY2x1ZGUgPGxpbnV4L21vZHVsZS5oPgorI2luY2x1ZGUgPGxpbnV4L2ludGVycn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IE1PRFVMRQorCisjZGVmaW5lIGFwcGxpY29tX2luaXQgaW5pdF9tb2R1bGUKKwordm9pZCBjbGVhbnVwX21vZHVsZSh2b2lkKQoreworCWludCBpOworCisJbWlzY19kZXJlZ2lzdGVyKCZhY19taXNjZGV2KTsKKworCWZvciAoaSA9IDA7IGkgPCBNQVhfQk9BUkQ7IGkrKykgeworCisJCWlmICghYXBic1tpXS5SYW1JTykKKwkJCWNvbnRpbnVlOworCisJCWlmIChhcGJzW2ldLmlycSkKKwkJCWZyZWVfaXJxKGFwYnNbaV0uaXJxLCAmZHVtbXkpOworCisJCWlvdW5tYXAoYXBic1tpXS5SYW1JTyk7CisJfQorfQorCisjZW5kaWYJCQkJLyogTU9EVUxFICovCisKK2ludCBfX2luaXQgYXBwbGljb21faW5pdCh2b2lkKQoreworCWludCBpLCBudW1pc2EgPSAwOworCXN0cnVjdCBwY2lfZGV2ICpkZXYgPSBOVUxMOworCXZvaWQgX19pb21lbSAqUmFtSU87CisJaW50IGJvYXJkbm87CisKKwlwcmludGsoS0VSTl9JTkZPICJBcHBsaWNvbSBkcml2ZXI6ICRJZDogYWMuYyx2IDEuMzAgMjAwMC8wMy8yMiAxNjowMzo1NyBkd213MiBFeHAgJFxuIik7CisKKwkvKiBObyBtZW0gYW5kIGlycSBnaXZlbiAtIGNoZWNrIGZvciBhIFBDSSBjYXJkICovCisKKwl3aGlsZSAoIChkZXYgPSBwY2lfZ2V0X2NsYXNzKFBDSV9DTEFTU19PVEhFUlMgPDwgMTYsIGRldikpKSB7CisKKwkJaWYgKGRldi0+dmVuZG9yICE9IFBDSV9WRU5ET1JfSURfQVBQTElDT00pCisJCQljb250aW51ZTsKKwkJCisJCWlmIChkZXYtPmRldmljZSAgPiBNQVhfUENJX0RFVklDRV9OVU0gfHwgZGV2LT5kZXZpY2UgPT0gMCkKKwkJCWNvbnRpbnVlOworCQkKKwkJaWYgKHBjaV9lbmFibGVfZGV2aWNlKGRldikpCisJCQlyZXR1cm4gLUVJTz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V0ZXgsIGZsYWdzKTsKKwlyZXR1cm4gMDsKK30KKworc3RhdGljIGludCBkb19hY19yZWFkKGludCBJbmRleENhcmQsIGNoYXIgX191c2VyICpidWYsCisJCXN0cnVjdCBzdF9yYW1faW8gKnN0X2xvYywgc3RydWN0IG1haWxib3ggKm1haWxib3gpCit7CisJdm9pZCBfX2lvbWVtICpmcm9tID0gYXBic1tJbmRleENhcmRdLlJhbUlPICsgUkFNX1RPX1BDOworCXVuc2lnbmVkIGNoYXIgKnRvID0gKHVuc2lnbmVkIGNoYXIgKikmbWFpbGJveDsKKyNpZmRlZiBERUJVRworCWludCBjOworI2VuZGlmCisKKwlzdF9sb2MtPnRpY19vd25lcl90b19wYyA9IHJlYWRiKGFwYnNbSW5kZXhDYXJkXS5SYW1JTyArIFRJQ19PV05FUl9UT19QQyk7CisJc3RfbG9jLT5udW1jYXJkX293bmVyX3RvX3BjID0gcmVhZGIoYXBic1tJbmRleENhcmRdLlJhbUlPICsgTlVNQ0FSRF9PV05FUl9UT19QQyk7CisKKworCXsKKwkJaW50IGM7CisKKwkJZm9yIChjID0gMDsgYyA8IHNpemVvZihzdHJ1Y3QgbWFpbGJveCk7IGMrKykKKwkJCSoodG8rKykgPSByZWFkYihmcm9tKyspOworCX0KKwl3cml0ZWIoMSwgYXBic1tJbmRleENhcmRdLlJhbUlPICsgQUNLX0ZST01fUENfUkVBRFkpOworCXdyaXRlYigxLCBhcGJzW0luZGV4Q2FyZF0uUmFtSU8gKyBUWVBfQUNLX0ZST01fUEMpOworCXdyaXRlYihJbmRleENhcmQrMSwgYXBic1tJbmRleENhcmRdLlJhbUlPICsgTlVNQ0FSRF9BQ0tfRlJPTV9QQyk7CisJd3JpdGViKHJlYWRiKGFwYnNbSW5kZXhDYXJkXS5SYW1JTyArIFRJQ19PV05FUl9UT19QQyksIAorCSAgICAgICBhcGJzW0luZGV4Q2FyZF0uUmFtSU8gKyBUSUNfQUNLX0ZST01fUEMpOworCXdyaXRlYigyLCBhcGJzW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IDB4NzcgICAgLyogZ29lcyB0byBQSUxSMyAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKy8qIENoaXAgSUQgKGlzIHVzZWQgd2hlbiBjaGlwcyBhciBkYWlzeSBjaGFpbmVkLikgKi8KKyNkZWZpbmUgU1hfSUQgICAgICAgICAgIDB4MTAKKworLyogRGVmaW5pdGlvbnMgZm9yIENpcnJ1cyBMb2dpYyBDTC1DRDE4NnggOC1wb3J0IGFzeW5jIG11eCBjaGlwICovCisgCisjZGVmaW5lIENEMTg2eF9OQ0ggICAgICAgOCAgICAgICAvKiBUb3RhbCBudW1iZXIgb2YgY2hhbm5lbHMgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0QxODZ4X1RQQyAgICAgICAxNiAgICAgIC8qIFRpY2tzIHBlciBjaGFyYWN0ZXIgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDRDE4NnhfTkZJRk8JIDgJIC8qIFRYIEZJRk8gc2l6ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworCisKKy8qIEdsb2JhbCByZWdpc3RlcnMgKi8KKworI2RlZmluZSBDRDE4NnhfR0lWUiAgICAgIDB4NDAgICAgLyogR2xvYmFsIEludGVycnVwdCBWZWN0b3IgUmVnaXN0ZXIgICAgICAgICovCisjZGVmaW5lIENEMTg2eF9HSUNSICAgICAgMHg0MSAgICAvKiBHbG9iYWwgSW50ZXJydXB0aW5nIENoYW5uZWwgUmVnaXN0ZXIgICAgKi8KKyNkZWZpbmUgQ0QxODZ4X1BJTFIxICAgICAweDYxICAgIC8qIFByaW9yaXR5IEludGVycnVwdCBMZXZlbCBSZWdpc3RlciAxICAgICAqLworI2RlZmluZSBDRDE4NnhfUElMUjIgICAgIDB4NjIgICAgLyogUHJpb3JpdHkgSW50ZXJydXB0IExldmVsIFJlZ2lzdGVyIDIgICAgICovCisjZGVmaW5lIENEMTg2eF9QSUxSMyAgICAgMHg2MyAgICAvKiBQcmlvcml0eSBJbnRlcnJ1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J1cHQgQ2hhbm5lbCBSZWdpc3RlciAoUi9XKSAqLworIAorI2RlZmluZSBHSUNSX0NIQU4gICAgICAgMHgxYyAgICAvKiBDaGFubmVsIE51bWJlciBNYXNrICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgR0lDUl9DSEFOX09GRiAgIDIgICAgICAgLyogQ2hhbm5lbCBOdW1iZXIgc2hpZnQgICAgICAgICAgICAgICAgICAgICovCisKKworLyogQ2hhbm5lbCBBZGRyZXNzIFJlZ2lzdGVyIChSL1cpICovCisKKyNkZWZpbmUgQ0FSX0NIQU4gICAgICAgIDB4MDcgICAgLyogQ2hhbm5lbCBOdW1iZXIgTWFzayAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENBUl9BNyAgICAgICAgICAweDA4ICAgIC8qIEE3IEFkZHJlc3MgRXh0ZW5zaW9uICh1bnVzZWQpICAgICAgICAgICAqLworCisKKy8qIFJlY2VpdmUgQ2hhcmFjdGVyIFN0YXR1cyBSZWdpc3RlciAoUi9PKSAqLworCisjZGVmaW5lIFJDU1JfVE9VVCAgICAgICAweDgwICAgIC8qIFJ4IFRpbWVvdXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSQ1NSX1NDREVUICAgICAgMHg3MCAgICAvKiBTcGVjaWFsIENoYXJhY3RlciBEZXRlY3RlZCBNYXNrICAgICAgICAgKi8KKyNkZWZpbmUgIFJDU1JfTk9fU0MgICAgICAweDAwICAgLyogTm8gU3BlY2lhbCBDaGFyYWN0ZXJzIERldGVjdGVkICAgICAgICAgICovCisjZGVmaW5lICBSQ1NSX1NDXzEgICAgICAgMHgxMCAgIC8qIFNwZWNpYWwgQ2hhciAxIChvciAxICYgMykgRGV0ZWN0ZWQgICAgICAqLworI2RlZmluZSAgUkNTUl9TQ18yICAgICAgIDB4MjAgICAvKiBTcGVjaWFsIENoYXIgMiAob3IgMiAmIDQpIERldGVjdGVkICAgICAgKi8KKyNkZWZpbmUgIFJDU1JfU0NfMyAgICAgICAweDMwICAgLyogU3BlY2lhbCBDaGFyIDMgRGV0ZWN0ZWQgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBSQ1NSX1NDXzQgICAgICAgMHg0MCAgIC8qIFNwZWNpYWwgQ2hhciA0IERldGVjdGVkICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSQ1NSX0JSRUFLICAgICAgMHgwOCAgICAvKiBCcmVhayBoYXMgYmVlbiBkZXRlY3RlZCAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgUkNTUl9QRSAgICAgICAgIDB4MDQgICAgLyogUGFyaXR5IEVycm9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIFJDU1JfRkUgICAgICAgICAweDAyICAgIC8qIEZyYW1lIEVycm9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSQ1NSX09FICAgICAgICAgMHgwMSAgICAvKiBPdmVycnVuIEVycm9yICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworCisvKiBDaGFubmVsIENvbW1hbmQgUmVnaXN0ZXIgKFIvVykgKGNvbW1hbmRzIGluIGdyb3VwcyBjYW4gYmUgT1ItZWQpICovCisKKyNkZWZpbmUgQ0NSX0hBUkRSRVNFVCAgIDB4ODEgICAgLyogUmVzZXQgdGhlIGNoaXAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKyNkZWZpbmUgQ0NSX1NPRlRSRVNFVCAgIDB4ODAgICAgLyogU29mdCBDaGFubmVsIFJlc2V0ICAgICAgICAgICAgICAgICAgICAgICovCisKKyNkZWZpbmUgQ0NSX0NPUkNIRzEgICAgIDB4NDIgICAgLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgMSBDaGFuZ2VkICAgICAgICovCisjZGVmaW5lIENDUl9DT1JDSEcyICAgICAweDQ0ICAgIC8qIENoYW5uZWwgT3B0aW9uIFJlZ2lzdGVyIDIgQ2hhbmdlZCAgICAgICAqLworI2RlZmluZSBDQ1JfQ09SQ0hHMyAgICAgMHg0OCAgICAvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAzIENoYW5nZWQgICAgICAgKi8KKworI2RlZmluZSBDQ1JfU1NDSDEgICAgICAgMHgyMSAgICAvKiBTZW5kIFNwZWNpYWwgQ2hhcmFjdGVyIDEgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfU1NDSDIgICAgICAgMHgyMiAgICAvKiBTZW5kIFNwZWNpYWwgQ2hhcmFjdGVyIDIgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfU1NDSDMgICAgICAgMHgyMyAgICAvKiBTZW5kIFNwZWNpYWwgQ2hhcmFjdGVyIDMgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfU1NDSDQgICAgICAgMHgyNCAgICAvKiBTZW5kIFNwZWNpYWwgQ2hhcmFjdGVyIDQgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfVFhFTiAgICAgICAgMHgxOCAgICAvKiBFbmFibGUgVHJhbnNtaXR0ZXIgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0NSX1JYRU4gICAgICAgIDB4MTIgICAgLyogRW5hYmxlIFJlY2VpdmVyICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKyNkZWZpbmUgQ0NSX1RYRElTICAgICAgIDB4MTQgICAgLyogRGlzYWJsZSBUcmFuc21pdHRlciAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENDUl9SWERJUyAgICAgICAweDExICAgIC8qIERpc2FibGUgUmVjZWl2ZXIgICAgICAgICAgICAgICAgICAgICAgICAqLworCisKKy8qIEludGVycnVwdCBFbmFibGUgUmVnaXN0ZXIgKFIvVykgKi8KKworI2RlZmluZSBJRVJfRFNSICAgICAgICAgMHg4MCAgICAvKiBFbmFibGUgaW50ZXJydXB0IG9uIERTUiBjaGFuZ2UgICAgICAgICAgKi8KKyNkZWZpbmUgSUVSX0NEICAgICAgICAgIDB4NDAgICAgLyogRW5hYmxlIGludGVycnVwdCBvbiBDRCBjaGFuZ2UgICAgICAgICAgICovCisjZGVmaW5lIElFUl9DVFMgICAgICAgICAweDIwICAgIC8qIEVuYWJsZSBpbnRlcnJ1cHQgb24gQ1RTIGNoYW5nZSAgICAgICAgICAqLworI2RlZmluZSBJRVJfUlhEICAgICAgICAgMHgxMCAgICAvKiBFbmFibGUgaW50ZXJydXB0IG9uIFJlY2VpdmUgRGF0YSAgICAgICAgKi8KKyNkZWZpbmUgSUVSX1JYU0MgICAgICAgIDB4MDggICAgLyogRW5hYmxlIGludGVycnVwdCBvbiBSZWNlaXZlIFNwZWMuIENoYXIgICovCisjZGVmaW5lIElFUl9UWFJEWSAgICAgICAweDA0ICAgIC8qIEVuYWJsZSBpbnRlcnJ1cHQgb24gVFggRklGTyBlbXB0eSAgICAgICAqLworI2RlZmluZSBJRVJfVFhFTVBUWSAgICAgMHgwMiAgICAvKiBFbmFibGUgaW50ZXJydXB0IG9uIFRYIGNvbXBsZXRlbHkgZW1wdHkgKi8KKyNkZWZpbmUgSUVSX1JFVCAgICAgICAgIDB4MDEgICAgLyogRW5hYmxlIGludGVycnVwdCBvbiBSWCBFeGMuIFRpbWVvdXQgICAgICovCisKKworLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgMSAoUi9XKSAqLworCisjZGVmaW5lIENPUjFfT0REUCAgICAgICAweDgwICAgIC8qIE9kZCBQYXJpdHkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IxX1BBUk1PREUgICAgMHg2MCAgICAvKiBQYXJpdHkgTW9kZSBtYXNrICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfTk9QQVIgICAgICAweDAwICAgLyogTm8gUGFyaXR5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBDT1IxX0ZPUkNFUEFSICAgMHgyMCAgIC8qIEZvcmNlIFBhcml0eSAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV9OT1JNUEFSICAgIDB4NDAgICAvKiBOb3JtYWwgUGFyaXR5ICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ09SMV9JR05PUkUgICAgIDB4MTAgICAgLyogSWdub3JlIFBhcml0eSBvbiBSWCAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjFfU1RPUEJJVFMgICAweDBjICAgIC8qIE51bWJlciBvZiBTdG9wIEJpdHMgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV8xU0IgICAgICAgIDB4MDAgICAvKiAxIFN0b3AgQml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfMTVTQiAgICAgICAweDA0ICAgLyogMS41IFN0b3AgQml0cyAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBDT1IxXzJTQiAgICAgICAgMHgwOCAgIC8qIDIgU3RvcCBCaXRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IxX0NIQVJMRU4gICAgMHgwMyAgICAvKiBDaGFyYWN0ZXIgTGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfNUJJVFMgICAgICAweDAwICAgLyogNSBiaXRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBDT1IxXzZCSVRTICAgICAgMHgwMSAgIC8qIDYgYml0cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV83QklUUyAgICAgIDB4MDIgICAvKiA3IGJpdHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfOEJJVFMgICAgICAweDAzICAgLyogOCBiaXRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKworLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgMiAoUi9XKSAqLworCisjZGVmaW5lIENPUjJfSVhNICAgICAgICAweDgwICAgIC8qIEltcGxpZWQgWE9OIG1vZGUgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IyX1RYSUJFICAgICAgMHg0MCAgICAvKiBFbmFibGUgSW4tQmFuZCAoWE9OL1hPRkYpIEZsb3cgQ29udHJvbCAgKi8KKyNkZWZpbmUgQ09SMl9FVEMgICAgICAgIDB4MjAgICAgLyogRW1iZWRkZWQgVHggQ29tbWFuZHMgRW5hYmxlICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjJfTExNICAgICAgICAweDEwICAgIC8qIExvY2FsIExvb3BiYWNrIE1vZGUgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IyX1JMTSAgICAgICAgMHgwOCAgICAvKiBSZW1vdGUgTG9vcGJhY2sgTW9kZSAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ09SMl9SVFNBTyAgICAgIDB4MDQgICAgLyogUlRTIEF1dG9tYXRpYyBPdXRwdXQgRW5hYmxlICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjJfQ1RTQUUgICAgICAweDAyICAgIC8qIENUUyBBdXRvbWF0aWMgRW5hYmxlICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IyX0RTUkFFICAgICAgMHgwMSAgICAvKiBEU1IgQXV0b21hdGljIEVuYWJsZSAgICAgICAgICAgICAgICAgICAgKi8KKworCisvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAzIChSL1cpICovCisKKyNkZWZpbmUgQ09SM19YT05DSCAgICAgIDB4ODAgICAgLyogWE9OIGlzIGEgcGFpciBvZiBjaGFyYWN0ZXJzICgxICYgMykgICAgICovCisjZGVmaW5lIENPUjNfWE9GRkNIICAgICAweDQwICAgIC8qIFhPRkYgaXMgYSBwYWlyIG9mIGNoYXJhY3RlcnMgKDIgJiA0KSAgICAqLworI2RlZmluZSBDT1IzX0ZDVCAgICAgICAgMHgyMCAgICAvKiBGbG93LUNvbnRyb2wgVHJhbnNwYXJlbmN5IE1vZGUgICAgICAgICAgKi8KKyNkZWZpbmUgQ09SM19TQ0RFICAgICAgIDB4MTAgICAgLyogU3BlY2lhbCBDaGFyYWN0ZXIgRGV0ZWN0aW9uIEVuYWJsZSAgICAgICovCisjZGVmaW5lIENPUjNfUlhUSCAgICAgICAweDBmICAgIC8qIFJYIEZJRk8gVGhyZXNob2xkIHZhbHVlICgxLTgpICAgICAgICAgICAqLworCisKKy8qIENoYW5uZWwgQ29udHJvbCBTdGF0dXMgUmVnaXN0ZXIgKFIvTykgKi8KKworI2RlZmluZSBDQ1NSX1JYRU4gICAgICAgMHg4MCAgICAvKiBSZWNlaXZlciBFbmFibGVkICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0NTUl9SWEZMT0ZGICAgIDB4NDAgICAgLyogUmVjZWl2ZSBGbG93IE9mZiAoWE9GRiB3YXMgc2VudCkgICAgICAgICovCisjZGVmaW5lIENDU1JfUlhGTE9OICAgICAweDIwICAgIC8qIFJlY2VpdmUgRmxvdyBPbiAoWE9OIHdhcyBzZW50KSAgICAgICAgICAqLworI2RlZmluZSBDQ1NSX1RYRU4gICAgICAgMHgwOCAgICAvKiBUcmFuc21pdHRlciBFbmFibGVkICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0NTUl9UWEZMT0ZGICAgIDB4MDQgICAgLyogVHJhbnNtaXQgRmxvdyBPZmYgKGdvdCBYT0ZGKSAgICAgICAgICAgICovCisjZGVmaW5lIENDU1JfVFhGTE9OICAgICAweDAyICAgIC8qIFRyYW5zbWl0IEZsb3cgT24gKGdvdCBYT04pICAgICAgICAgICAgICAqLworCisKKy8qIE1vZGVtIENoYW5nZSBPcHRpb24gUmVnaXN0ZXIgMSAoUi9XKSAqLworCisjZGVmaW5lIE1DT1IxX0RTUlpEICAgICAweDgwICAgIC8qIERldGVjdCAwLT4xIHRyYW5zaXRpb24gb2YgRFNSICAgICAgICAgICAqLworI2RlZmluZSBNQ09SMV9DRFpEICAgICAgMHg0MCAgICAvKiBEZXRlY3QgMC0+MSB0cmFuc2l0aW9uIG9mIENEICAgICAgICAgICAgKi8KKyNkZWZpbmUgTUNPUjFfQ1RTWkQgICAgIDB4MjAgICAgLyogRGV0ZWN0IDAtPjEgdHJhbnNpdGlvbiBvZiBDVFMgICAgICAgICAgICovCisjZGVmaW5lIE1DT1IxX0RUUlRIICAgICAweDBmICAgIC8qIEF1dG8gRFRSIGZsb3cgY29udHJvbCBUaHJlc2hvbGQgKDEtOCkgICAqLworI2RlZmluZSAgTUNPUjFfTk9EVFJGQyAgIDB4MCAgICAgLyogQXV0b21hdGljIERUUiBmbG93IGNvbnRyb2wgZGlzYWJsZWQgICAgICovCisKKworLyogTW9kZW0gQ2hhbmdlIE9wdGlvbiBSZWdpc3RlciAyIChSL1cpICovCisKKyNkZWZpbmUgTUNPUjJfRFNST0QgICAgIDB4ODAgICAgLyogRGV0ZWN0IDEtPjAgdHJhbnNpdGlvbiBvZiBEU1IgICAgICAgICAgICovCisjZGVmaW5lIE1DT1IyX0NET0QgICAgICAweDQwICAgIC8qIERldGVjdCAxLT4wIHRyYW5zaXRpb24gb2YgQ0QgICAgICAgICAgICAqLworI2RlZmluZSBNQ09SMl9DVFNPRCAgICAgMHgyMCAgICAvKiBEZXRlY3QgMS0+MCB0cmFuc2l0aW9uIG9mIENUUyAgICAgICAgICAgKi8KKworLyogTW9kZW0gQ2hhbmdlIFJlZ2lzdGVyIChSL1cpICovCisKKyNkZWZpbmUgTUNSX0RTUkNIRyAgICAgIDB4ODAgICAgLyogRFNSIENoYW5nZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIE1DUl9DRENIRyAgICAgICAweDQwICAgIC8qIENEIENoYW5nZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBNQ1JfQ1RTQ0hHICAgICAgMHgyMCAgICAvKiBDVFMgQ2hhbmdlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworCisvKiBNb2RlbSBTaWduYWwgVmFsdWUgUmVnaXN0ZXIgKFIvVykgKi8KKworI2RlZmluZSBNU1ZSX0RTUiAgICAgICAgMHg4MCAgICAvKiBDdXJyZW50IHN0YXRlIG9mIERTUiBpbnB1dCAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgTVNWUl9DRCAgICAgICAgIDB4NDAgICAgLyogQ3VycmVudCBzdGF0ZSBvZiBDRCBpbnB1dCAgICAgICAgICAgICAgICovCisjZGVmaW5lIE1TVlJfQ1RTICAgICAgICAweDIwICAgIC8qIEN1cnJlbnQgc3RhdGUgb2YgQ1RTIGlucHV0ICAgICAgICAgICAgICAqLworI2RlZmluZSBNU1ZSX0RUUiAgICAgICAgMHgwMiAgICAvKiBDdXJyZW50IHN0YXRlIG9mIERUUiBvdXRwdXQgICAgICAgICAgICAgKi8KKyNkZWZpbmUgTVNWUl9SVFMgICAgICAgIDB4MDEgICAgLyogQ3VycmVudCBzdGF0ZSBvZiBSVFMgb3V0cHV0ICAgICAgICAgICAgICovCisKKworLyogRXNjYXBlIGNoYXJhY3RlcnMgKi8KKworI2RlZmluZSBDRDE4NnhfQ19FU0MgICAgIDB4MDAgICAgLyogRXNjYXBlIGNoYXJhY3RlciAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTg2eF9DX1NCUksgICAgMHg4MSAgICAvKiBTdGFydCBzZW5kaW5nIEJSRUFLICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0QxODZ4X0NfREVMQVkgICAweDgyICAgIC8qIERlbGF5IG91dHB1dCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDRDE4NnhfQ19FQlJLICAgIDB4ODMgICAgLyogU3RvcCBzZW5kaW5nIEJSRUFLICAgICA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KKwkJdW5zaWduZWQgY2hhciB1YzsKKwkJX19nZXRfdXNlcih1YywgYXJnK2kpOworCQlwW2ldID0gVU5JX0RJUkVDVF9CQVNFIHwgdWM7CisJfQorCisJdXBkYXRlX3VzZXJfbWFwcygpOworCXJldHVybiAwOworfQorCitpbnQgY29uX2dldF90cmFuc19vbGQodW5zaWduZWQgY2hhciBfX3VzZXIgKiBhcmcpCit7CisJaW50IGksIGNoOworCXVuc2lnbmVkIHNob3J0ICpwID0gdHJhbnNsYXRpb25zW1VTRVJfTUFQXTsKKworCWlmICghYWNjZXNzX29rKFZFUklGWV9XUklURSwgYXJnLCBFX1RBQlNaKSkKKwkJcmV0dXJuIC1FRkFVTFQ7CisKKwlmb3IgKGk9MDsgaTxFX1RBQlNaIDsgaSsrKQorCSAgeworCSAgICBjaCA9IGNvbnZfdW5pX3RvX3BjKHZjX2NvbnNbZmdfY29uc29sZV0uZCwgcFtpXSk7CisJICAgIF9fcHV0X3VzZXIoKGNoICYgfjB4ZmYpID8gMCA6IGNoLCBhcmcraSk7CisJICB9CisJcmV0dXJuIDA7Cit9CisKK2ludCBjb25fc2V0X3RyYW5zX25ldyh1c2hvcnQgX191c2VyICogYXJnKQoreworCWludCBpOworCXVuc2lnbmVkIHNob3J0ICpwID0gdHJhbnNsYXRpb25zW1VTRVJfTUFQXTsKKworCWlmICghYWNjZXNzX29rKFZFUklGWV9SRUFELCBhcmcsIEVfVEFCU1oqc2l6ZW9mKHVuc2lnbmVkIHNob3J0KSkpCisJCXJldHVybiAtRUZBVUxUOworCisJZm9yIChpPTA7IGk8RV9UQUJTWiA7IGkrKykgeworCQl1bnNpZ25lZCBzaG9ydCB1czsKKwkJX19nZXRfdXNlcih1cywgYXJnK2kpOworCQlwW2ldID0gdXM7CisJfQorCisJdXBkYXRlX3VzZXJfbWFwcygpOworCXJldHVybiAwOworfQorCitpbnQgY29uX2dldF90cmFuc19uZXcodXNob3J0IF9fdXNlciAqIGFyZykKK3sKKwlpbnQgaTsKKw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nZWRpcl9sb2M7CisJCWlmICghcSB8fCBxID09IHAgfHwgcS0+c3VtICE9IHAtPnN1bSkKKwkJCWNvbnRpbnVlOworCQlmb3IgKGogPSAwOyBqIDwgMzI7IGorKykgeworCQkJdTE2ICoqcDEsICoqcTE7CisJCQlwMSA9IHAtPnVuaV9wZ2RpcltqXTsgcTEgPSBxLT51bmlfcGdkaXJbal07CisJCQlpZiAoIXAxICYmICFxMSkKKwkJCQljb250aW51ZTsKKwkJCWlmICghcDEgfHwgIXExKQorCQkJCWJyZWFrOworCQkJZm9yIChrID0gMDsgayA8IDMyOyBrKyspIHsKKwkJCQlpZiAoIXAxW2tdICYmICFxMVtrXSkKKwkJCQkJY29udGludWU7CisJCQkJaWYgKCFwMVtrXSB8fCAhcTFba10pCisJCQkJCWJyZWFrOworCQkJCWlmIChtZW1jbXAocDFba10sIHExW2tdLCA2NCpzaXplb2YodTE2KSkpCisJCQkJCWJyZWFrOworCQkJfQorCQkJaWYgKGsgPCAzMikKKwkJCQlicmVhazsKKwkJfQorCQlpZiAoaiA9PSAzMikgeworCQkJcS0+cmVmY291bnQrKzsKKwkJCSpjb25wLT52Y191bmlfcGFnZWRpcl9sb2MgPSAodW5zaWduZWQgbG9uZylxOworCQkJY29uX3JlbGVhc2VfdW5pbWFwKHApOworCQkJa2ZyZWUocCk7CisJCQlyZXR1cm4gMTsKKwkJfQorCX0KKwlyZXR1cm4gMDsKK30KKworc3RhdGljIGludAorY29uX2luc2VydF91bmlwYWlyKHN0cnVjdCB1bmlfcGFnZWRpciAqcCwgdV9zaG9ydCB1bmljb2RlLCB1X3Nob3J0IGZvbnRwb3MpCit7CisJaW50IGksIG47CisJdTE2ICoqcDEsICpwMjsKKworCWlmICghKHAxID0gcC0+dW5pX3BnZGlyW24gPSB1bmljb2RlID4+IDExXSkpIHsKKwkJcDEgPSBwLT51bmlfcGdkaXJbbl0gPSBrbWFsbG9jKDMyKnNpemVvZih1MTYgKiksIEdGUF9LRVJORUwpOworCQlpZiA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zZXJpYWwgc3RydWN0ICglcykgaW4gJXNcbiI7CisgICAgc3RhdGljIGNvbnN0IGNoYXIgKmJhZGluZm8gPQorICAgICAgICAiY3ljIFdhcm5pbmc6IG51bGwgY3ljbGFkZXNfcG9ydCBmb3IgKCVzKSBpbiAlc1xuIjsKKyAgICBzdGF0aWMgY29uc3QgY2hhciAqYmFkcmFuZ2UgPQorICAgICAgICAiY3ljIFdhcm5pbmc6IGN5Y2xhZGVzX3BvcnQgb3V0IG9mIHJhbmdlIGZvciAoJXMpIGluICVzXG4iOworCisgICAgaWYgKCFpbmZvKSB7CisgICAgICAgIHByaW50ayhiYWRpbmZvLCBuYW1lLCByb3V0aW5lKTsKKyAgICAgICAgcmV0dXJuIDE7CisgICAgfQorCisgICAgaWYoIChsb25nKWluZm8gPCAobG9uZykoJmN5X3BvcnRbMF0pCisgICAgfHwgKGxvbmcpKCZjeV9wb3J0W05SX1BPUlRTXSkgPCAobG9uZylpbmZvICl7CisgICAgICAgIHByaW50ayhiYWRyYW5nZSwgbmFtZSwgcm91dGluZSk7CisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIGlmIChpbmZvLT5tYWdpYyAhPSBDWUNMQURFU19NQUdJQykgeworICAgICAgICBwcmludGsoYmFkbWFnaWMsIG5hbWUsIHJvdXRpbmUpOworICAgICAgICByZXR1cm4gMTsKKyAgICB9CisjZW5kaWYKKyAgICAgICAgcmV0dXJuIDA7Cit9IC8qIHNlcmlhbF9wYXJhbm9pYV9jaGVjayAqLworCisvKgorICogVGhpcyByb3V0aW5lIGlzIHVzZWQgYnkgdGhlIGludGVycnVwdCBoYW5kbGVyIHRvIHNjaGVkdWxlCisgKiBwcm9jZXNzaW5nIGluIHRoZSBzb2Z0d2FyZSBpbnRlcnJ1cHQgcG9ydGlvbiBvZiB0aGUgZHJpdmVyCisgKiAoYWxzbyBrbm93biBhcyB0aGUgImJvdHRvbSBoYWxmIikuICBUaGlzIGNhbiBiZSBjYWxsZWQgYW55CisgKiBudW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IoYmFzZV9hZGRyKyhDeVNWUlI8PGluZGV4KSkpICE9IDB4MDApIHsKKyAgICAgICAgICAgICAgICBoYWRfd29yaysrOworICAgICAgICAgICAgICAgIC8qIFRoZSBwdXJwb3NlIG9mIHRoZSBmb2xsb3dpbmcgdGVzdCBpcyB0byBlbnN1cmUgdGhhdAorICAgICAgICAgICAgICAgICAgIG5vIGNoaXAgY2FuIG1vbm9wb2xpemUgdGhlIGRyaXZlci4gIFRoaXMgZm9yY2VzIHRoZQorICAgICAgICAgICAgICAgICAgIGNoaXBzIHRvIGJlIGNoZWNrZWQgaW4gYSByb3VuZC1yb2JpbiBmYXNoaW9uIChhZnRlcgorICAgICAgICAgICAgICAgICAgIGRyYWluaW5nIGVhY2ggb2YgYSBidW5jaCAoMTAwMCkgb2YgY2hhcmFjdGVycykuCisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgaWYoMTAwMDx0b29fbWFueSsrKXsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgJiBDeVNSUmVjZWl2ZSkgeyAvKiByZWNlcHRpb24gaW50ZXJydXB0ICovCisjaWZkZWYgQ1lfREVCVUdfSU5URVJSVVBUUworCQkgICAgcHJpbnRrKCJjeXlfaW50ZXJydXB0OiByY3ZkIGludHIsIGNoaXAgJWRcblxyIiwgY2hpcCk7CisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgLyogZGV0ZXJtaW5lIHRoZSBjaGFubmVsICYgY2hhbmdlIHRvIHRoYXQgY29udGV4dCAqLworCQkgICAgc3Bpbl9sb2NrKCZjaW5mby0+Y2FyZF9sb2NrKTsKKyAgICAgICAgICAgICAgICAgICAgc2F2ZV94aXIgPSAodV9jaGFyKSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UklSPDxpbmRleCkpOworICAgICAgICAgICAgICAgICAgICBjaGFubmVsID0gKHVfc2hvcnQgKSAoc2F2ZV94aXIgJiBDeUlSQ2hhbm5lbCk7CisgICAgICAgICAgICAgICAgICAgIGkgPSBjaGFubmVsICsgY2hpcCAqIDQgKyBjaW5mby0+Zmlyc3RfbGluZTsKKyAgICAgICAgICAgICAgICAgICAgaW5mbyA9ICZjeV9wb3J0W2ldOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5sYXN0X2FjdGl2ZSA9IGppZmZpZXM7CisgICAgICAgICAgICAgICAgICAgIHNhdmVfY2FyID0gY3lfcmVhZGIoYmFzZV9hZGRyKyhDeUNBUjw8aW5kZXgpKTsKKyAgICAgICAgICAgICAgICAgICAgY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lDQVI8PGluZGV4KSwgc2F2ZV94aXIpOworCisgICAgICAgICAgICAgICAgICAgIC8qIGlmIHRoZXJlIGlzIG5vd2hlcmUgdG8gcHV0IHRoZSBkYXRhLCBkaXNjYXJkIGl0ICovCisgICAgICAgICAgICAgICAgICAgIGlmKGluZm8tPnR0eSA9PSAwKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIGogPSAoY3lfcmVhZGIoYmFzZV9hZGRyKyhDeVJJVlI8PGluZGV4KSkgJiBDeUlWUk1hc2spOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBqID09IEN5SVZSUnhFeCApIHsgLyogZXhjZXB0aW9uICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lSRFNSPDxpbmRleCkpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsgLyogbm9ybWFsIGNoYXJhY3RlciByZWNlcHRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyX2NvdW50ID0gY3lfcmVhZGIoYmFzZV9hZGRyKyhDeVJEQ1I8PGluZGV4KSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUoY2hhcl9jb3VudC0tKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lSRFNSPDxpbmRleCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfWVsc2V7IC8qIHRoZXJlIGlzIGFuIG9wZW4gcG9ydCBmb3IgdGhpcyBkYXRhICovCisgICAgICAgICAgICAgICAgICAgICAgICB0dHkgPSBpbmZvLT50dHk7CisgICAgICAgICAgICAgICAgICAgICAgICBqID0gKGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lSSVZSPDxpbmRleCkpICYgQ3lJVlJNYXNrKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICggaiA9PSBDeUlWUlJ4RXggKSB7IC8qIGV4Y2VwdGlvbiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UkRTUjw8aW5kZXgpKTsKKworCQkJICAgIC8qIEZvciBzdGF0aXN0aWNzIG9ubHkgKi8KKwkJCSAgICBpZiAoZGF0YSAmIEN5QlJFQUspCisJCQkJaW5mby0+aWNvdW50LmJyaysrOworCQkJICAgIGVsc2UgaWYoZGF0YSAmIEN5RlJBTUUpCisJCQkJaW5mby0+aWNvdW50LmZyYW1lKys7CisJCQkgICAgZWxzZSBpZihkYXRhICYgQ3lQQVJJVFkpCisJCQkJaW5mby0+aWNvdW50LnBhcml0eSsrOworCQkJICAgIGVsc2UgaWYoZGF0YSAmIEN5T1ZFUlJVTikKKwkJCQlpbmZvLT5pY291bnQub3ZlcnJ1bisrOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoZGF0YSAmIGluZm8tPmlnbm9yZV9zdGF0dXNfbWFzayl7CisJCQkJaW5mby0+aWNvdW50LnJ4Kys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHR5LT5mbGlwLmNvdW50IDwgVFRZX0ZMSVBCVUZfU0laRSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0eS0+ZmxpcC5jb3VudCsrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YSAmIGluZm8tPnJlYWRfc3RhdHVzX21hc2speworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoZGF0YSAmIEN5QlJFQUspeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuZmxhZ19idWZfcHRyKysgPQorCSAgICAJCQkJCQkgICAgVFRZX0JSRUFLOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuY2hhcl9idWZfcHRyKysgPQorCQkJCQkgIGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lSRFNSPDxpbmRleCkpOworCQkJCQlpbmZvLT5pY291bnQucngrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5mby0+ZmxhZ3MgJiBBU1lOQ19TQUspeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb19TQUsodHR5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9ZWxzZSBpZihkYXRhICYgQ3lGUkFNRSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnR0eS0+ZmxpcC5mbGFnX2J1Zl9wdHIrKyA9CisJCQkJCQkJICAgIFRUWV9GUkFNRTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqdHR5LT5mbGlwLmNoYXJfYnVmX3B0cisrID0KKwkJCQkJICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UkRTUjw8aW5kZXgpKTsKKwkJCQkJaW5mby0+aWNvdW50LnJ4Kys7CisJCQkJCWluZm8tPmlkbGVfc3RhdHMuZnJhbWVfZXJycysrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2UgaWYoZGF0YSAmIEN5UEFSSVRZKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqdHR5LT5mbGlwLmZsYWdfYnVmX3B0cisrID0KKwkJCQkJCQkgICAgVFRZX1BBUklUWTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqdHR5LT5mbGlwLmNoYXJfYnVmX3B0cisrID0KKwkJCQkJICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UkRTUjw8aW5kZXgpKTsKKwkJCQkJaW5mby0+aWNvdW50LnJ4Kys7CisJCQkJCWluZm8tPmlkbGVfc3RhdHMucGFyaXR5X2VycnMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNlIGlmKGRhdGEgJiBDeU9WRVJSVU4peworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuZmxhZ19idWZfcHRyKysgPQorCQkJCQkJCSAgICBUVFlfT1ZFUlJVTjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqdHR5LT5mbGlwLmNoYXJfYnVmX3B0cisrID0gMDsKKwkJCQkJaW5mby0+aWNvdW50LnJ4Kys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSWYgdGhlIGZsaXAgYnVmZmVyIGl0c2VsZiBpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJmbG93aW5nLCB3ZSBzdGlsbCBsb3NlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIG5leHQgaW5jb21pbmcgY2hhcmFjdGVyLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHR0eS0+ZmxpcC5jb3VudAorCQkJCQkgICAgICAgICAgIDwgVFRZX0ZMSVBCVUZfU0laRSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0eS0+ZmxpcC5jb3VudCsrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqdHR5LT5mbGlwLmZsYWdfYnVmX3B0cisrID0KKwkJCQkJCQkgICAgIFRUWV9OT1JNQUw7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnR0eS0+ZmxpcC5jaGFyX2J1Zl9wdHIrKyA9CisJCQkJCSAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UkRTUjw8aW5kZXgpKTsKKwkJCQkJICAgIGluZm8tPmljb3VudC5yeCsrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKwkJCQkJaW5mby0+aWRsZV9zdGF0cy5vdmVycnVucysrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVGhlc2UgdHdvIGNvbmRpdGlvbnMgbWF5IGltcGx5ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhIG5vcm1hbCByZWFkIHNob3VsZCBiZSBkb25lLiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogfWVsc2UgaWYoZGF0YSAmIEN5VElNRU9VVCl7ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB9ZWxzZSBpZihkYXRhICYgQ3lTUEVDSEFSKXsgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNleworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuZmxhZ19idWZfcHRyKysgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuY2hhcl9idWZfcHRyKysgPSAwOworCQkJCQlpbmZvLT5pY291bnQucngrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqdHR5LT5mbGlwLmZsYWdfYnVmX3B0cisrID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuY2hhcl9idWZfcHRyKysgPSAwOworCQkJCSAgICBpbmZvLT5pY291bnQucngrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNleworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB0aGVyZSB3YXMgYSBzb2Z0d2FyZSBidWZmZXIKKwkJCQkgICBvdmVycnVuIGFuZCBub3RoaW5nIGNvdWxkIGJlCisJCQkJICAgZG9uZSBhYm91dCBpdCEhISAqLworCQkJCWluZm8tPmljb3VudC5idWZfb3ZlcnJ1bisrOworCQkJCWluZm8tPmlkbGVfc3RhdHMub3ZlcnJ1bnMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeyAvKiBub3JtYWwgY2hhcmFjdGVyIHJlY2VwdGlvbiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGxvYWQgIyBjaGFycyBhdmFpbGFibGUgZnJvbSB0aGUgY2hpcCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJfY291bnQgPSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UkRDUjw8aW5kZXgpKTsKKworI2lmZGVmIENZX0VOQUJMRV9NT05JVE9SSU5HCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKytpbmZvLT5tb24uaW50X2NvdW50OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPm1vbi5jaGFyX2NvdW50ICs9IGNoYXJfY291bnQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoYXJfY291bnQgPiBpbmZvLT5tb24uY2hhcl9tYXgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+bW9uLmNoYXJfbWF4ID0gY2hhcl9jb3VudDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT5tb24uY2hhcl9sYXN0ID0gY2hhcl9jb3VudDsKKyNlbmRpZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlKGNoYXJfY291bnQtLSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0dHktPmZsaXAuY291bnQgPj0gVFRZX0ZMSVBCVUZfU0laRSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHR5LT5mbGlwLmNvdW50Kys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5UkRTUjw8aW5kZXgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnR0eS0+ZmxpcC5mbGFnX2J1Zl9wdHIrKyA9IFRUWV9OT1JNQUw7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICp0dHktPmZsaXAuY2hhcl9idWZfcHRyKysgPSBkYXRhOworCQkJCWluZm8tPmlkbGVfc3RhdHMucmVjdl9ieXRlcysrOworCQkJCWluZm8tPmljb3VudC5yeCsrOworI2lmZGVmIENZXzE2WV9IQUNLCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVkZWxheSgxMEwpOworI2VuZGlmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT5pZGxlX3N0YXRzLnJlY3ZfaWRsZSA9IGppZmZpZXM7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBzY2hlZHVsZV9kZWxheWVkX3dvcmsoJnR0eS0+ZmxpcC53b3JrLCAxKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvKiBlbmQgb2Ygc2VydmljZSAqLworICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeVJJUjw8aW5kZXgpLCAoc2F2ZV94aXIgJiAweDNmKSk7CisgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5Q0FSPDxpbmRleCksIChzYXZlX2NhcikpOworCQkgICAgc3Bpbl91bmxvY2soJmNpbmZvLT5jYXJkX2xvY2spOworICAgICAgICAgICAgICAgIH0KKworCisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAmIEN5U1JUcmFuc21pdCkgeyAvKiB0cmFuc21pc3Npb24gaW50ZXJydXB0ICovCisgICAgICAgICAgICAgICAgICAgIC8qIFNpbmNlIHdlIG9ubHkgZ2V0IGhlcmUgd2hlbiB0aGUgdHJhbnNtaXQgYnVmZmVyCisgICAgICAgICAgICAgICAgICAgICAgIGlzIGVtcHR5LCB3ZSBrbm93IHdlIGNhbiBhbHdheXMgc3R1ZmYgYSBkb3plbgorICAgICAgICAgICAgICAgICAgICAgICBjaGFyYWN0ZXJzLiAqLworI2lmZGVmIENZX0RFQlVHX0lOVEVSUlVQVFMKKwkJICAgIHByaW50aygiY3l5X2ludGVycnVwdDogeG1pdCBpbnRyLCBjaGlwICVkXG5cciIsIGNoaXApOworI2VuZGlmCisKKyAgICAgICAgICAgICAgICAgICAgLyogZGV0ZXJtaW5lIHRoZSBjaGFubmVsICYgY2hhbmdlIHRvIHRoYXQgY29udGV4dCAqLworCQkgICAgc3Bpbl9sb2NrKCZjaW5mby0+Y2FyZF9sb2NrKTsKKyAgICAgICAgICAgICAgICAgICAgc2F2ZV94aXIgPSAodV9jaGFyKSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5VElSPDxpbmRleCkpOworICAgICAgICAgICAgICAgICAgICBjaGFubmVsID0gKHVfc2hvcnQgKSAoc2F2ZV94aXIgJiBDeUlSQ2hhbm5lbCk7CisgICAgICAgICAgICAgICAgICAgIGkgPSBjaGFubmVsICsgY2hpcCAqIDQgKyBjaW5mby0+Zmlyc3RfbGluZTsKKyAgICAgICAgICAgICAgICAgICAgc2F2ZV9jYXIgPSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5Q0FSPDxpbmRleCkpOworICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeUNBUjw8aW5kZXgpLCBzYXZlX3hpcik7CisKKyAgICAgICAgICAgICAgICAgICAgLyogdmFsaWRhdGUgdGhlIHBvcnQjIChhcyBjb25maWd1cmVkIGFuZCBvcGVuKSAqLworICAgICAgICAgICAgICAgICAgICBpZiggKGkgPCAwKSB8fCAoTlJfUE9SVFMgPD0gaSkgKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpKSAmIH5DeVR4UmR5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gdHhlbmQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaW5mbyA9ICZjeV9wb3J0W2ldOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5sYXN0X2FjdGl2ZSA9IGppZmZpZXM7CisgICAgICAgICAgICAgICAgICAgIGlmKGluZm8tPnR0eSA9PSAwKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpKSAmIH5DeVR4UmR5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gdHhkb25lOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLyogbG9hZCB0aGUgb24tY2hpcCBzcGFjZSBmb3Igb3V0Ym91bmQgZGF0YSAqLworICAgICAgICAgICAgICAgICAgICBjaGFyX2NvdW50ID0gaW5mby0+eG1pdF9maWZvX3NpemU7CisKKyAgICAgICAgICAgICAgICAgICAgaWYoaW5mby0+eF9jaGFyKSB7IC8qIHNlbmQgc3BlY2lhbCBjaGFyICovCisgICAgICAgICAgICAgICAgICAgICAgICBvdXRjaCA9IGluZm8tPnhfY2hhcjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5VERSPDxpbmRleCksIG91dGNoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJfY291bnQtLTsKKwkJCWluZm8tPmljb3VudC50eCsrOworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+eF9jaGFyID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmIChpbmZvLT5icmVha29uIHx8IGluZm8tPmJyZWFrb2ZmKSB7CisJCQlpZiAoaW5mby0+YnJlYWtvbikgeworCQkJICAgIGN5X3dyaXRlYihiYXNlX2FkZHIgKyAoQ3lURFI8PGluZGV4KSwgMCk7IAorCQkJICAgIGN5X3dyaXRlYihiYXNlX2FkZHIgKyAoQ3lURFI8PGluZGV4KSwgMHg4MSk7CisJCQkgICAgaW5mby0+YnJlYWtvbiA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcl9jb3VudCAtPSAyOworCQkJfQorCQkJaWYgKGluZm8tPmJyZWFrb2ZmKSB7CisJCQkgICAgY3lfd3JpdGViKGJhc2VfYWRkciArIChDeVREUjw8aW5kZXgpLCAwKTsgCisJCQkgICAgY3lfd3JpdGViKGJhc2VfYWRkciArIChDeVREUjw8aW5kZXgpLCAweDgzKTsKKwkJCSAgICBpbmZvLT5icmVha29mZiA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcl9jb3VudCAtPSAyOworCQkJfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGNoYXJfY291bnQtLSA+IDApeworCQkJaWYgKCFpbmZvLT54bWl0X2NudCl7CisJCQkgICAgaWYgKGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCkpJkN5VHhNcHR5KSB7CisJCQkJY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCksCisJCQkJCSAgY3lfcmVhZGIoYmFzZV9hZGRyKyhDeVNSRVI8PGluZGV4KSkgJgorCQkJCQkgIH5DeVR4TXB0eSk7CisJCQkgICAgfSBlbHNlIHsKKwkJCQljeV93cml0ZWIoYmFzZV9hZGRyKyhDeVNSRVI8PGluZGV4KSwKKwkJCQkJICAoKGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCkpCisJCQkJCSAgICAmIH5DeVR4UmR5KQorCQkJCQkgICB8IEN5VHhNcHR5KSk7CisJCQkgICAgfQorCQkJICAgIGdvdG8gdHhkb25lOworCQkJfQorCQkJaWYgKGluZm8tPnhtaXRfYnVmID09IDApeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpLAorCQkJCWN5X3JlYWRiKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCkpICYgCisJCQk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IHNlbmQgYSBOVUxMLikKKyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgb3V0Y2ggPSBpbmZvLT54bWl0X2J1ZltpbmZvLT54bWl0X3RhaWxdOworICAgICAgICAgICAgICAgICAgICAgICAgaWYoIG91dGNoICl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+eG1pdF9jbnQtLTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT54bWl0X3RhaWwgPSAoaW5mby0+eG1pdF90YWlsICsgMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYgKFNFUklBTF9YTUlUX1NJWkUgLSAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeVREUjw8aW5kZXgpLCBvdXRjaCk7CisJCQkgICAgaW5mby0+aWNvdW50LnR4Kys7CisgICAgICAgICAgICAgICAgICAgICAgICB9ZWxzZXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihjaGFyX2NvdW50ID4gMSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnhtaXRfY250LS07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnhtaXRfdGFpbCA9IChpbmZvLT54bWl0X3RhaWwgKyAxKQorCQkJCQkJICAgICAgJiAoU0VSSUFMX1hNSVRfU0laRSAtIDEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeVREUjw8aW5kZXgpLCAKKwkJCQkJICBvdXRjaCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5VERSPDxpbmRleCksIDApOworCQkJCWluZm8tPmljb3VudC50eCsrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyX2NvdW50LS07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgdHhkb25lOgorICAgICAgICAgICAgICAgICAgICBpZiAoaW5mby0+eG1pdF9jbnQgPCBXQUtFVVBfQ0hBUlMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN5X3NjaGVkX2V2ZW50KGluZm8sIEN5X0VWRU5UX1dSSVRFX1dBS0VVUCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgdHhlbmQ6CisgICAgICAgICAgICAgICAgICAgIC8qIGVuZCBvZiBzZXJ2aWNlICovCisgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5VElSPDxpbmRleCksIAorCQkJICAgICAgKHNhdmVfeGlyICYgMHgzZikpOworICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeUNBUjw8aW5kZXgpLCAoc2F2ZV9jYXIpKTsKKwkJICAgIHNwaW5fdW5sb2NrKCZjaW5mby0+Y2FyZF9sb2NrKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICYgQ3lTUk1vZGVtKSB7ICAgICAgICAvKiBtb2RlbSBpbnRlcnJ1cHQgKi8KKworICAgICAgICAgICAgICAgICAgICAvKiBkZXRlcm1pbmUgdGhlIGNoYW5uZWwgJiBjaGFuZ2UgdG8gdGhhdCBjb250ZXh0ICovCisJCSAgICBzcGluX2xvY2soJmNpbmZvLT5jYXJkX2xvY2spOworICAgICAgICAgICAgICAgICAgICBzYXZlX3hpciA9ICh1X2NoYXIpIGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lNSVI8PGluZGV4KSk7CisgICAgICAgICAgICAgICAgICAgIGNoYW5uZWwgPSAodV9zaG9ydCApIChzYXZlX3hpciAmIEN5SVJDaGFubmVsKTsKKyAgICAgICAgICAgICAgICAgICAgaW5mbyA9ICZjeV9wb3J0W2NoYW5uZWwgKyBjaGlwICogNAorCQkgICAgICAgICAgICAgICAgICAgICAgICAgICArIGNpbmZvLT5maXJzdF9saW5lXTsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+bGFzdF9hY3RpdmUgPSBqaWZmaWVzOworICAgICAgICAgICAgICAgICAgICBzYXZlX2NhciA9IGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lDQVI8PGluZGV4KSk7CisgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5Q0FSPDxpbmRleCksIHNhdmVfeGlyKTsKKworICAgICAgICAgICAgICAgICAgICBtZG1fY2hhbmdlID0gY3lfcmVhZGIoYmFzZV9hZGRyKyhDeU1JU1I8PGluZGV4KSk7CisgICAgICAgICAgICAgICAgICAgIG1kbV9zdGF0dXMgPSBjeV9yZWFkYihiYXNlX2FkZHIrKEN5TVNWUjE8PGluZGV4KSk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYoaW5mby0+dHR5ID09IDApey8qIG5vIHBsYWNlIGZvciBkYXRhLCBpZ25vcmUgaXQqLworICAgICAgICAgICAgICAgICAgICAgICAgOworICAgICAgICAgICAgICAgICAgICB9ZWxzZXsKKwkJCWlmIChtZG1fY2hhbmdlICYgQ3lBTllfREVMVEEpIHsKKwkJCSAgICAvKiBGb3Igc3RhdGlzdGljcyBvbmx5ICovCisJCQkgICAgaWYgKG1kbV9jaGFuZ2UgJiBDeURDRCkJaW5mby0+aWNvdW50LmRjZCsrOworCQkJICAgIGlmIChtZG1fY2hhbmdlICYgQ3lDVFMpCWluZm8tPmljb3VudC5jdHMrKzsKKwkJCSAgICBpZiAobWRtX2NoYW5nZSAmIEN5RFNSKQlpbmZvLT5pY291bnQuZHNyKys7CisJCQkgICAgaWYgKG1kbV9jaGFuZ2UgJiBDeVJJKQlpbmZvLT5pY291bnQucm5nKys7CisKKwkJCSAgICBjeV9zY2hlZF9ldmVudChpbmZvLCBDeV9FVkVOVF9ERUxUQV9XQUtFVVApOworCQkJfQorCisgICAgICAgICAgICAgICAgICAgICAgICBpZigobWRtX2NoYW5nZSAmIEN5RENEKQorICAgICAgICAgICAgICAgICAgICAgICAgJiYgKGluZm8tPmZsYWdzICYgQVNZTkNfQ0hFQ0tfQ0QpKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihtZG1fc3RhdHVzICYgQ3lEQ0QpeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV9zY2hlZF9ldmVudChpbmZvLAorCQkJCSAgICBDeV9FVkVOVF9PUEVOX1dBS0VVUCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN5X3NjaGVkX2V2ZW50KGluZm8sCisJCQkJICAgIEN5X0VWRU5UX0hBTkdVUCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYoKG1kbV9jaGFuZ2UgJiBDeUNUUykKKyAgICAgICAgICAgICAgICAgICAgICAgICYmIChpbmZvLT5mbGFncyAmIEFTWU5DX0NUU19GTE9XKSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoaW5mby0+dHR5LT5od19zdG9wcGVkKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYobWRtX3N0YXR1cyAmIEN5Q1RTKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGN5X3N0YXJ0IGlzbid0IHVzZWQKKwkJCQkgICAgICAgICBiZWNhdXNlLi4uICEhISAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+dHR5LT5od19zdG9wcGVkID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeVNSRVI8PGluZGV4KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCkpIHwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDeVR4UmR5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN5X3NjaGVkX2V2ZW50KGluZm8sCisJCQkJICAgICAgICBDeV9FVkVOVF9XUklURV9XQUtFVVApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCEobWRtX3N0YXR1cyAmIEN5Q1RTKSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBjeV9zdG9wIGlzbid0IHVzZWQKKwkJCQkgICAgICAgICBiZWNhdXNlIC4uLiAhISEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnR0eS0+aHdfc3RvcHBlZCA9IDE7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpKSAmIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfkN5VHhSZHkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYobWRtX2NoYW5nZSAmIEN5RFNSKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1kbV9jaGFuZ2UgJiBDeVJJKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvKiBlbmQgb2Ygc2VydmljZSAqLworICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeU1JUjw8aW5kZXgpLCAKKwkJCSAgICAgIChzYXZlX3hpciAmIDB4M2YpKTsKKyAgICAgICAgICAgICAgICAgICAgY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lDQVI8PGluZGV4KSwgc2F2ZV9jYXIpOworCQkgICAgc3Bpbl91bmxvY2soJmNpbmZvLT5jYXJkX2xvY2spOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gICAgICAgICAgLyogZW5kIHdoaWxlIHN0YXR1cyAhPSAwICovCisgICAgICAgIH0gICAgICAgICAgICAvKiBlbmQgbG9vcCBmb3IgY2hpcHMuLi4gKi8KKyAgICB9IHdoaWxlKGhhZF93b3JrKTsKKworICAgLyogY2xlYXIgaW50ZXJydXB0cyAqLworICAgc3Bpbl9sb2NrKCZjaW5mby0+Y2FyZF9sb2NrKTsKKyAgIGN5X3dyaXRlYihjYXJkX2Jhc2VfYWRkciArIChDeV9DbHJJbnRyPDxpbmRleCksIDApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDeV9DbHJJbnRyIGlzIDB4MTgwMCAqLworICAgc3Bpbl91bmxvY2soJmNpbmZvLT5jYXJkX2xvY2spOworICAgcmV0dXJuIElSUV9IQU5ETEVEOworfSAvKiBjeXlfaW50ZXJydXB0ICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKioqKioqKiogRW5kIG9mIGJsb2NrIG9mIEN5Y2xvbS1ZIHNwZWNpZmljIGNvZGUgKioqKioqKioqKi8KKy8qKioqKioqKiB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OworCQlzcGVjaWFsX2NvdW50Kys7CisJCWJyZWFrOworCSAgICBjYXNlIENfQ01fUlhCUks6CisJCXR0eS0+ZmxpcC5jb3VudCsrOworCQkqdHR5LT5mbGlwLmZsYWdfYnVmX3B0cisrID0gVFRZX0JSRUFLOworCQkqdHR5LT5mbGlwLmNoYXJfYnVmX3B0cisrID0gMDsKKwkJaW5mby0+aWNvdW50LnJ4Kys7CisJCXNwZWNpYWxfY291bnQrKzsKKwkJYnJlYWs7CisJICAgIGNhc2UgQ19DTV9NRENEOgorCQlpbmZvLT5pY291bnQuZGNkKys7CisJCWRlbHRhX2NvdW50Kys7CisJCWlmIChpbmZvLT5mbGFncyAmIEFTWU5DX0NIRUNLX0NEKXsKKwkJICAgIGlmICgoZndfdmVyID4gMjQxID8gCisJCQkgICgodV9sb25nKXBhcmFtKSA6IAorCQkJICBjeV9yZWFkbCgmY2hfY3RybC0+cnNfc3RhdHVzKSkgJiBDX1JTX0RDRCkgeworCQkJY3lfc2NoZWRfZXZlbnQoaW5mbywgQ3lfRVZFTlRfT1BFTl9XQUtFVVApOworCQkgICAgfWVsc2V7CisJCQljeV9zY2hlZF9ldmVudChpbmZvLCBDeV9FVkVOVF9IQU5HVVApOworCQkgICAgfQorCQl9CisJCWJyZWFrOworCSAgICBjYXNlIENfQ01fTUNUUzoKKwkJaW5mby0+aWNvdW50LmN0cysrOworCQlkZWx0YV9jb3VudCsrOworCQlicmVhazsKKwkgICAgY2FzZSBDX0NNX01SSToKKwkJaW5mby0+aWNvdW50LnJuZysrOworCQlkZWx0YV9jb3VudCsrOworCQlicmVhazsKKwkgICAgY2FzZSBDX0NNX01EU1I6CisJCWluZm8tPmljb3VudC5kc3IrKzsKKwkJZGVsdGFfY291bnQrKzsKKwkJYnJlYWs7CisjaWZkZWYgWl9XQUtFCisJICAgIGNhc2UgQ19DTV9JT0NUTFc6CisJCWN5X3NjaGVkX2V2ZW50KGluZm8sIEN5X0VWRU5UX1NIVVRET1dOX1dBS0VVUCk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X3JlYWR5IHdpdGggJWRcbiIsCisgICAgICAgICAgICAgICByZXR2YWwpOworI2VuZGlmCisgICAgICAgIHJldHVybiByZXR2YWw7CisgICAgfQorCisgICAgaW5mby0+dGhyb3R0bGUgPSAwOworCisjaWZkZWYgQ1lfREVCVUdfT1BFTgorICAgIHByaW50aygiIGN5YzpjeV9vcGVuIGRvbmVcbiIpOy8qKi8KKyNlbmRpZgorCisgICAgcmV0dXJuIDA7Cit9IC8qIGN5X29wZW4gKi8KKworCisvKgorICogY3lfd2FpdF91bnRpbF9zZW50KCkgLS0tIHdhaXQgdW50aWwgdGhlIHRyYW5zbWl0dGVyIGlzIGVtcHR5CisgKi8KK3N0YXRpYyB2b2lkIAorY3lfd2FpdF91bnRpbF9zZW50KHN0cnVjdCB0dHlfc3RydWN0ICp0dHksIGludCB0aW1lb3V0KQoreworICBzdHJ1Y3QgY3ljbGFkZXNfcG9ydCAqIGluZm8gPSAoc3RydWN0IGN5Y2xhZGVzX3BvcnQgKil0dHktPmRyaXZlcl9kYXRhOworICB2b2lkIF9faW9tZW0gKmJhc2VfYWRkcjsKKyAgaW50IGNhcmQsY2hpcCxjaGFubmVsLGluZGV4OworICB1bnNpZ25lZCBsb25nIG9yaWdfamlmZmllczsKKyAgaW50IGNoYXJfdGltZTsKKwkKKyAgICBpZiAoc2VyaWFsX3BhcmFub2lhX2NoZWNrKGluZm8sIHR0eS0+bmFtZSwgImN5X3dhaXRfdW50aWxfc2VudCIpKQorCXJldHVybjsKKworICAgIGlmIChpbmZvLT54bWl0X2ZpZm9fc2l6ZSA9PSAwKQorCXJldHVybjsgLyogSnVzdCBpbiBjYXNlLi4uLiAqLworCisKKyAgICBvcmlnX2ppZmZpZXMgPSBqaWZmaWVzOworICAgIC8qCisgICAgICogU2V0IHRoZSBjaGVjayBpbnRlcnZhbCB0byBiZSAxLzUgb2YgdGhlIGVzdGltYXRlZCB0aW1lIHRvCisgICAgICogc2VuZCBhIHNpbmdsZSBjaGFyYWN0ZXIsI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isjaWZkZWYgQ1lfREVCVUdfT1BFTgorICAgIHByaW50aygiY3ljOmN5X2Nsb3NlIHR0eUMlZCwgY291bnQgPSAlZFxuIiwgaW5mby0+bGluZSwgaW5mby0+Y291bnQpOworI2VuZGlmCisgICAgaWYgKCh0dHktPmNvdW50ID09IDEpICYmIChpbmZvLT5jb3VudCAhPSAxKSkgeworICAgICAgICAvKgorICAgICAgICAgKiBVaCwgb2guICB0dHktPmNvdW50IGlzIDEsIHdoaWNoIG1lYW5zIHRoYXQgdGhlIHR0eQorICAgICAgICAgKiBzdHJ1Y3R1cmUgd2lsbCBiZSBmcmVlZC4gIEluZm8tPmNvdW50IHNob3VsZCBhbHdheXMKKyAgICAgICAgICogYmUgb25lIGluIHRoZXNlIGNvbmRpdGlvbnMuICBJZiBpdCdzIGdyZWF0ZXIgdGhhbgorICAgICAgICAgKiBvbmUsIHdlJ3ZlIGdvdCByZWFsIHByb2JsZW1zLCBzaW5jZSBpdCBtZWFucyB0aGUKKyAgICAgICAgICogc2VyaWFsIHBvcnQgd29uJ3QgYmUgc2h1dGRvd24uCisgICAgICAgICAqLworICAgICAgICBwcmludGsoImN5YzpjeV9jbG9zZTogYmFkIHNlcmlhbCBwb3J0IGNvdW50OyB0dHktPmNvdW50IGlzIDEsICIKKyAgICAgICAgICAgImluZm8tPmNvdW50IGlzICVkXG4iLCBpbmZvLT5jb3VudCk7CisgICAgICAgIGluZm8tPmNvdW50ID0gMTsKKyAgICB9CisjaWZkZWYgQ1lfREVCVUdfQ09VTlQKKyAgICBwcmludGsoImN5YzpjeV9jbG9zZSBhdCAoJWQpOiBkZWNyZW1lbnRpbmcgY291bnQgdG8gJWRcbiIsCisgICAgICAgIGN1cnJlbnQtPnBpZCwgaW5mby0+Y291bnQgLSAxKTsKKyNlbmRpZgorICAgIGlmICgtLWluZm8tPmNvdW50IDwgMCkgeworI2lmZGVmIENZX0RFQlVHX0NPVU5UCisgICAgcHJpbnRrKCJjeWM6Y3ljX2Nsb3NlIHNld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1KQorCWJwciA9IDI1NTsKKworICAgIGluZm8tPnRicHIgPSBpbmZvLT5yYnByID0gYnByOworICAgIGluZm8tPnRjbyA9IGluZm8tPnJjbyA9IGNvOworfQorCisvKgorICogVGhpcyByb3V0aW5lIGZpbmRzIG9yIGNvbXB1dGVzIHRoZSB2YXJpb3VzIGxpbmUgY2hhcmFjdGVyaXN0aWNzLgorICogSXQgdXNlZCB0byBiZSBjYWxsZWQgY29uZmlnX3NldHVwCisgKi8KK3N0YXRpYyB2b2lkCitzZXRfbGluZV9jaGFyKHN0cnVjdCBjeWNsYWRlc19wb3J0ICogaW5mbykKK3sKKyAgdW5zaWduZWQgbG9uZyBmbGFnczsKKyAgdm9pZCBfX2lvbWVtICpiYXNlX2FkZHI7CisgIGludCBjYXJkLGNoaXAsY2hhbm5lbCxpbmRleDsKKyAgdW5zaWduZWQgY2ZsYWcsIGlmbGFnOworICB1bnNpZ25lZCBzaG9ydCBjaGlwX251bWJlcjsKKyAgaW50IGJhdWQsIGJhdWRfcmF0ZSA9IDA7CisgIGludCAgIGk7CisKKworICAgIGlmICghaW5mby0+dHR5IHx8ICFpbmZvLT50dHktPnRlcm1pb3MpeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGlmIChpbmZvLT5saW5lID09IC0xKXsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBjZmxhZyA9IGluZm8tPnR0eS0+dGVybWlvcy0+Y19jZmxhZzsKKyAgICBpZmxhZyA9IGluZm8tPnR0eS0+dGVybWlvcy0+Y19pZmxhZzsKKworICAgIC8qCisgICAgICogU2V0IHVwIHRoZSB0dHktPmFsdF9zcGVlZCBrbHVkZ2UKKyAgICAgKi8KKyAgICBpZiAoaW5mby0+dHR5KSB7CisJaWYgKChpbmZvLT5mbGFncyAmIEFTWU5DX1NQRF9NQVNLKSA9PSBBU1lOQ19TUERfSEkpCisJICAgIGluZm8tPnR0eS0+YWx0X3NwZWVkID0gNTc2MDA7CisJaWYgKChpbmZvLT5mbGFnc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CQkJICAgICAgICAgOiAweDAyKSk7IC8qIDEwbXMgcnggdGltZW91dCAqLworCisJICAgIGlmIChDX0NMT0NBTChpbmZvLT50dHkpKSB7CisJCS8qIHdpdGhvdXQgbW9kZW0gaW50ciAqLworCQljeV93cml0ZWIoYmFzZV9hZGRyKyhDeVNSRVI8PGluZGV4KSwKKyAgICAgICAgICAgICAgICAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5U1JFUjw8aW5kZXgpKSB8IEN5TWRtQ2gpOyAKKwkJCQkJLyogYWN0IG9uIDEtPjAgbW9kZW0gdHJhbnNpdGlvbnMgKi8KKyAgICAgICAgICAgICAgICBpZiAoKGNmbGFnICYgQ1JUU0NUUykgJiYgaW5mby0+cmZsb3cpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5TUNPUjE8PGluZGV4KSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEN5Q1RTfHJmbG93X3RocltpXSkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjeV93cml0ZWIoYmFzZV9hZGRyKyhDeU1DT1IxPDxpbmRleCksIEN5Q1RTKTsKKyAgICAgICAgICAgICAgICB9CisJCQkJCS8qIGFjdCBvbiAwLT4xIG1vZGVtIHRyYW5zaXRpb25zICovCisJCWN5X3dyaXRlYihiYXNlX2FkZHIrKEN5TUNPUjI8PGluZGV4KSwgQ3lDVFMpOworCSAgICB9IGVsc2UgeworCQkvKiB3aXRob3V0IG1vZGVtIGludHIgKi8KKwkJY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lTUkVSPDxpbmRleCksCisgICAgICAgICAgICAgICAgICAgY3lfcmVhZGIoYmFzZV9hZGRyKyhDeVNSRVI8PGluZGV4KSkgfCBDeU1kbUNoKTsgCisJCQkJCS8qIGFjdCBvbiAxLT4wIG1vZGVtIHRyYW5zaXRpb25zICovCisgICAgICAgICAgICAgICAg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RSKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworCQkJY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lNU1ZSMTw8aW5kZXgpLCB+Q3lSVFMpOworICAgICAgICAgICAgICAgIH0KKwkJQ1lfVU5MT0NLKGluZm8sIGZsYWdzKTsKKwl9CisJaWYgKHNldCAmIFRJT0NNX0RUUil7CisJCUNZX0xPQ0soaW5mbywgZmxhZ3MpOworCQljeV93cml0ZWIoYmFzZV9hZGRyKyhDeUNBUjw8aW5kZXgpLCAodV9jaGFyKWNoYW5uZWwpOworICAgICAgICAgICAgICAgIGlmIChpbmZvLT5ydHNkdHJfaW52KSB7CisJCQljeV93cml0ZWIoYmFzZV9hZGRyKyhDeU1TVlIxPDxpbmRleCksIEN5UlRTKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworCQkJY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lNU1ZSMjw8aW5kZXgpLCBDeURUUik7CisgICAgICAgICAgICAgICAgfQorI2lmZGVmIENZX0RFQlVHX0RUUgorCQlwcmludGsoImN5YzpzZXRfbW9kZW1faW5mbyByYWlzaW5nIERUUlxuIik7CisJCXByaW50aygiICAgICBzdGF0dXM6IDB4JXgsIDB4JXhcbiIsCisJCSAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5TVNWUjE8PGluZGV4KSksIAorICAgICAgICAgICAgICAgICAgICBjeV9yZWFkYihiYXNlX2FkZHIrKEN5TVNWUjI8PGluZGV4KSkpOworI2VuZGlmCisJCUNZX1VOTE9DSyhpbmZvLCBmbGFncyk7CisJfQorCWlmIChjbGVhciAmIFRJT0NNX0RUUikgeworCQlDWV9MT0NLKGluZm8sIGZsYWdzKTsKKwkJY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lDQVI8PGluZGV4KSwgKHVfY2hhciljaGFubmVsKTsKKyAgICAgICAgICAgICAgICBpZiAoaW5mby0+cnRzZHRyX2ludikgeworCQkJY3lfd3JpdGViKGJhc2VfYWRkcisoQ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5lbF0ucnNfY29udHJvbCkgfCBDX1JTX1JUUyk7CisJCSAgICBDWV9VTkxPQ0soaW5mbywgZmxhZ3MpOworCSAgICB9CisJICAgIGlmIChjbGVhciAmIFRJT0NNX1JUUykgeworCQkgICAgQ1lfTE9DSyhpbmZvLCBmbGFncyk7CisJCSAgICBjeV93cml0ZWwoJmNoX2N0cmxbY2hhbm5lbF0ucnNfY29udHJvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgY3lfcmVhZGwoJmNoX2N0cmxbY2hhbm5lbF0ucnNfY29udHJvbCkgJiB+Q19SU19SVFMpOworCQkgICAgQ1lfVU5MT0NLKGluZm8sIGZsYWdzKTsKKwkgICAgfQorCSAgICBpZiAoc2V0ICYgVElPQ01fRFRSKXsKKwkJICAgIENZX0xPQ0soaW5mbywgZmxhZ3MpOworCQkgICAgY3lfd3JpdGVsKCZjaF9jdHJsW2NoYW5uZWxdLnJzX2NvbnRyb2wsCisgICAgICAgICAgICAgICAgICAgICAgIGN5X3JlYWRsKCZjaF9jdHJsW2NoYW5uZWxdLnJzX2NvbnRyb2wpIHwgQ19SU19EVFIpOworI2lmZGVmIENZX0RFQlVHX0RUUgorCQkgICAgcHJpbnRrKCJjeWM6c2V0X21vZGVtX2luZm8gcmFpc2luZyBaIERUUlxuIik7CisjZW5kaWYKKwkJICAgIENZX1VOTE9DSyhpbmZvLCBmbGFncyk7CisJICAgIH0KKwkgICAgaWYgKGNsZWFyICYgVElPQ01fRFRSKSB7CisJCSAgICBDWV9MT0NLKGluZm8sIGZsYWdzKTsKKwkJICAgIGN5X3dyaXRlbCgmY2hfY3RybFtjaGFubmVsXS5yc19jb250cm9sLAorICAgICAgICAgICAgICAgICAgICAgICBjeV9yZWFkbCgmY2hfY3RybFtjaGFubmVsXS5yc19jb250cm9sKSAmIH5DX1JTX0RUUik7CisjaWZkZWYgQ1lfREVCVUdfRFRSCisJCSAgICBwcmludGsoImN5YzpzZXRfbW9kZW1faW5mbyBjbGVhcmluZyBaIERUU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0gc2V0X3RocmVzaG9sZChpbmZvLCBhcmcpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQ1lHRVRERUZUSFJFU0g6CisgICAgICAgICAgICByZXRfdmFsID0gZ2V0X2RlZmF1bHRfdGhyZXNob2xkKGluZm8sIGFyZ3ApOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQ1lTRVRERUZUSFJFU0g6CisgICAgICAgICAgICByZXRfdmFsID0gc2V0X2RlZmF1bHRfdGhyZXNob2xkKGluZm8sIGFyZyk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWUdFVFRJTUVPVVQ6CisgICAgICAgICAgICByZXRfdmFsID0gZ2V0X3RpbWVvdXQoaW5mbywgYXJncCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWVNFVFRJTUVPVVQ6CisgICAgICAgICAgICByZXRfdmFsID0gc2V0X3RpbWVvdXQoaW5mbywgYXJnKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIENZR0VUREVGVElNRU9VVDoKKyAgICAgICAgICAgIHJldF92YWwgPSBnZXRfZGVmYXVsdF90aW1lb3V0KGluZm8sIGFyZ3ApOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQ1lTRVRERUZUSU1FT1VUOgorICAgICAgICAgICAgcmV0X3ZhbCA9IHNldF9kZWZhdWx0X3RpbWVvdXQoaW5mbywgYXJnKTsKKyAgICAgICAgICAgIGJyZWFrOworCWNhc2UgQ1lTRVRSRkxPVzoKKyAgICAJICAgIGluZm8tPnJmbG93ID0gKGludClhcmc7CisJICAgIHJldF92YWwgPSAwOworCSAgICBicmVhazsKKwljYXNlIENZR0VUUkZMT1c6CisJICAgIHJldF92YWwgPSBpbmZvLT5yZmxvdzsKKwkgICAgYnJlYWs7CisJY2FzZSBDWVNFVFJUU0RUUl9JTlY6CisgICAgCSAgICBpbmZvLT5ydHNkdHJfaW52ID0gKG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oKKwkgICAgQ1lfTE9DSyhpbmZvLCBmbGFncyk7CisJICAgIGNub3cgPSBpbmZvLT5pY291bnQ7CisJICAgIENZX1VOTE9DSyhpbmZvLCBmbGFncyk7CisJICAgIHBfY3VzZXIgPSBhcmdwOworCSAgICByZXRfdmFsID0gcHV0X3VzZXIoY25vdy5jdHMsICZwX2N1c2VyLT5jdHMpOworCSAgICBpZiAocmV0X3ZhbCkgcmV0dXJuIHJldF92YWw7CisJICAgIHJldF92YWwgPSBwdXRfdXNlcihjbm93LmRzciwgJnBfY3VzZXItPmRzcik7CisJICAgIGlmIChyZXRfdmFsKSByZXR1cm4gcmV0X3ZhbDsKKwkgICAgcmV0X3ZhbCA9IHB1dF91c2VyKGNub3cucm5nLCAmcF9jdXNlci0+cm5nKTsKKwkgICAgaWYgKHJldF92YWwpIHJldHVybiByZXRfdmFsOworCSAgICByZXRfdmFsID0gcHV0X3VzZXIoY25vdy5kY2QsICZwX2N1c2VyLT5kY2QpOworCSAgICBpZiAocmV0X3ZhbCkgcmV0dXJuIHJldF92YWw7CisJICAgIHJldF92YWwgPSBwdXRfdXNlcihjbm93LnJ4LCAmcF9jdXNlci0+cngpOworCSAgICBpZiAocmV0X3ZhbCkgcmV0dXJuIHJldF92YWw7CisJICAgIHJldF92YWwgPSBwdXRfdXNlcihjbm93LnR4LCAmcF9jdXNlci0+dHgpOworCSAgICBpZiAocmV0X3ZhbCkgcmV0dXJuIHJldF92YWw7CisJICAgIHJldF92YWwgPSBwdXRfdXNlcihjbm93LmZyYW1lLCAmcF9jdXNlci0+ZnJhbWUpOworCSAgICBpZiAocmV0X3ZhbCkgcmV0dXJuIHJldF92YWw7CisJICAgIHJldF92YWwgPSBwdXRfdXNlcihjbm93Lm92ZXJydW4sICZwX2N1c2VyLT5vdmVycnVuKTsKKwkgICAgaWYgKHJldF92YWwpIHJldHVybiByZXRfdmFsOworCSAgICByZXRfdmFsID0gcHV0X3VzZXIoY25vdy5wYXJpdHksICZwX2N1c2VyLT5w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xOworICAgIH0KKworICAgIGlmICh0dHktPnRlcm1pb3MtPmNfY2ZsYWcgJiBDUlRTQ1RTKSB7CisgICAgICAgIGNoYW5uZWwgPSBpbmZvLT5saW5lIC0gY3lfY2FyZFtjYXJkXS5maXJzdF9saW5lOworICAgICAgICBpZiAoIUlTX0NZQ19aKGN5X2NhcmRbY2FyZF0pKSB7CisgICAgICAgICAgICBjaGlwID0gY2hhbm5lbD4+MjsKKyAgICAgICAgICAgIGNoYW5uZWwgJj0gMHgwMzsKKyAgICAgICAgICAgIGluZGV4ID0gY3lfY2FyZFtjYXJkXS5idXNfaW5kZXg7CisgICAgICAgICAgICBiYXNlX2FkZHIgPSBjeV9jYXJkW2NhcmRdLmJhc2VfYWRkciArIChjeV9jaGlwX29mZnNldFtjaGlwXTw8aW5kZXgpOworCisgICAgICAgICAgICBDWV9MT0NLKGluZm8sIGZsYWdzKTsKKyAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5Q0FSPDxpbmRleCksICh1X2NoYXIpY2hhbm5lbCk7CisgICAgICAgICAgICBpZiAoaW5mby0+cnRzZHRyX2ludikgeworICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5TVNWUjI8PGluZGV4KSwgfkN5RFRSKTsKKyAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGN5X3dyaXRlYihiYXNlX2FkZHIrKEN5TVNWUjE8PGluZGV4KSwgfkN5UlRTKTsKKwkgICAgIH0KKwkgICAgQ1lfVU5MT0NLKGluZm8sIGZsYWdzKTsKKwl9IGVsc2UgeworCSAgICBpbmZvLT50aHJvdHRsZSA9IDE7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm47Cit9IC8qIGN5X3Rocm90dGxlICovCisKKworLyoKKyAqIFRoaXMgcm91dGluZSBub3RpZmllcyB0aGUgdHR5IGRyaXZlciB0aGF0IGl0IHNob3VsZCBzaWduYWwKKyAqIHRoYXQgY2hhcmF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80KSAqLworc3RhdGljIHVuc2lnbmVkIHNob3J0IF9faW5pdAorY3l5X2luaXRfY2FyZCh2b2lkIF9faW9tZW0gKnRydWVfYmFzZV9hZGRyLGludCBpbmRleCkKK3sKKyAgdW5zaWduZWQgaW50IGNoaXBfbnVtYmVyOworICB2b2lkIF9faW9tZW0gKmJhc2VfYWRkcjsKKworICAgIGN5X3dyaXRlYih0cnVlX2Jhc2VfYWRkcisoQ3lfSHdSZXNldDw8aW5kZXgpLCAwKTsgCisJCQkJCQkvKiBDeV9Id1Jlc2V0IGlzIDB4MTQwMCAqLworICAgIGN5X3dyaXRlYih0cnVlX2Jhc2VfYWRkcisoQ3lfQ2xySW50cjw8aW5kZXgpLCAwKTsgCisJCQkJCQkvKiBDeV9DbHJJbnRyIGlzIDB4MTgwMCAqLworICAgIHVkZWxheSg1MDBMKTsKKworICAgIGZvcihjaGlwX251bWJlcj0wOyBjaGlwX251bWJlcjxDeU1BWF9DSElQU19QRVJfQ0FSRDsgY2hpcF9udW1iZXIrKyl7CisgICAgICAgIGJhc2VfYWRkciA9IHRydWVfYmFzZV9hZGRyICsgKGN5X2NoaXBfb2Zmc2V0W2NoaXBfbnVtYmVyXTw8aW5kZXgpOworICAgICAgICBtZGVsYXkoMSk7CisgICAgICAgIGlmKGN5X3JlYWRiKGJhc2VfYWRkcisoQ3lDQ1I8PGluZGV4KSkgIT0gMHgwMCl7CisgICAgICAgICAgICAvKioqKioqKioqKioqKgorICAgICAgICAgICAgcHJpbnRrKCIgY2hpcCAjJWQgYXQgJSM2bHggaXMgbmV2ZXIgaWRsZSAoQ0NSICE9IDApXG4iLAorICAgICAgICAgICAgICAgY2hpcF9udW1iZXIsICh1bnNpZ25lZCBsb25nKWJhc2VfYWRkcik7CisgICAgICAgICAgICAqKioqKioqKioqKioqLworICAgICAgICAgICAgcmV0dXJuIGNoaXBfbnVtYmVyOworICAgICAgICB9CisKKyAgICAgICAgY3lfd3JpdGViKGJhc2VfYWRkcisoQ3lHRlJDUj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TlJfQ0FSRFM7IGkrKykgeworCSAgICBpZiAobWFkZHJbaV0gfHwgaSkgeworCQlpc3BhcmFtID0gMTsKKwkJY3lfaXNhX2FkZHJlc3Nlc1tpXSA9IG1hZGRyW2ldOworCSAgICB9CisJICAgIGlmICghbWFkZHJbaV0pCisJCWJyZWFrOworCX0KKyNlbmRpZgorCisgICAgICAgIC8qIHNjYW4gdGhlIGFkZHJlc3MgdGFibGUgcHJvYmluZyBmb3IgQ3ljbG9tLVkvSVNBIGJvYXJkcyAqLworICAgICAgICBmb3IgKGkgPSAwIDsgaSA8IE5SX0lTQV9BRERSUyA7IGkrKykgeworICAgICAgICAJdW5zaWduZWQgaW50IGlzYV9hZGRyZXNzID0gY3lfaXNhX2FkZHJlc3Nlc1tpXTsKKyAgICAgICAgICAgICAgICBpZiAoaXNhX2FkZHJlc3MgID09IDB4MDAwMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuKG5ib2FyZCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLyogcHJvYmUgZm9yIENEMTQwMC4uLiAqLworCQljeV9pc2FfYWRkcmVzcyA9IGlvcmVtYXAoaXNhX2FkZHJlc3MsIEN5SVNBX1l3aW4pOworICAgICAgICAgICAgICAgIGN5X2lzYV9uY2hhbiA9IEN5UE9SVFNfUEVSX0NISVAgKiAKKyAgICAgICAgICAgICAgICAgICAgIGN5eV9pbml0X2NhcmQoY3lfaXNhX2FkZHJlc3MsMCk7CisgICAgICAgICAgICAgICAgaWYgKGN5X2lzYV9uY2hhbiA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyNpZmRlZiBNT0RVTEUKKwkJaWYgKGlzcGFyYW0gJiYgaXJxW2ldKQorCQkgICAgY3lfaXNhX2lycSA9IGlycVtpXTsKKwkJZWxzZQorI2VuZGlmCisgICAgICAgICAgICAgICAgLyogZmluZCBvdXQgdGhlIGJvYXJkJ3MgaXJxIGJ5IHByb2JpbmcgKi8KKyAgICAgICAgICAgICAgICBjeV9pc2FfaXJxID0gZGV0ZWN0X2lzYV9pcnEoY3lfaXNhX2FkZHJlc3MpOworICAgICAgICAgICAgICAgIGlmIChjeV9pc2FfaXJxID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLVkvSVNBIGZvdW5kIGF0IDB4JWx4ICIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1bnNpZ25lZCBsb25nKSBjeV9pc2FfYWRkcmVzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoImJ1dCB0aGUgSVJRIGNvdWxkIG5vdCBiZSBkZXRlY3RlZC5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYoKGN5X25leHRfY2hhbm5lbCtjeV9pc2FfbmNoYW4pID4gTlJfUE9SVFMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLVkvSVNBIGZvdW5kIGF0IDB4JWx4ICIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1bnNpZ25lZCBsb25nKSBjeV9pc2FfYWRkcmVzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoImJ1dCBubyBtb3JlIGNoYW5uZWxzIGFyZSBhdmFpbGFibGUuXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ2hhbmdlIE5SX1BPUlRTIGluIGN5Y2xhZGVzLmMgYW5kIHJlY29tcGlsZSBrZXJuZWwuXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybihuYm9hcmQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvKiBmaWxsIHRoZSBuZXh0IGN5X2NhcmQgc3RydWN0dXJlIGF2YWlsYWJsZSAqLworICAgICAgICAgICAgICAgIGZvciAoaiA9IDAgOyBqIDwgTlJfQ0FSRFMgOyBqKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjeV9jYXJkW2pdLmJhc2VfYWRkciA9PSAwKSAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChqID09IE5SX0NBUkRTKSB7ICAgIC8qIG5vIG1vcmUgY3lfY2FyZHMgYXZhaWxhYmxlICovCisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoIkN5Y2xvbS1ZL0lTQSBmb3VuZCBhdCAweCVseCAiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodW5zaWduZWQgbG9uZykgY3lfaXNhX2FkZHJlc3MpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJidXQgbm8gbW9yZSBjYXJkcyBjYW4gYmUgdXNlZCAuXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ2hhbmdlIE5SX0NBUkRTIGluIGN5Y2xhZGVzLmMgYW5kIHJlY29tcGlsZSBrZXJuZWwuXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybihuYm9hcmQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8qIGFsbG9jYXRlIElSUSAqLworICAgICAgICAgICAgICAgIGlmKHJlcXVlc3RfaXJxKGN5X2lzYV9pcnEsIGN5eV9pbnRlcnJ1cHQsCisJCQkJICAgU0FfSU5URVJSVVBULCAiQ3ljbG9tLVkiLCAmY3lfY2FyZFtqXSkpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJDeWNsb20tWS9JU0EgZm91bmQgYXQgMHglbHggIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHVuc2lnbmVkIGxvbmcpIGN5X2lzYV9hZGRyZXNzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiYnV0IGNvdWxkIG5vdCBhbGxvY2F0ZSBJUlEjJWQuXG4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjeV9pc2FfaXJxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybihuYm9hcmQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8qIHNldCBjeV9jYXJkICovCisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5iYXNlX2FkZHIgPSBjeV9pc2FfYWRkcmVzczsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmN0bF9hZGRyID0gTlVMTDsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmlycSA9IChpbnQpIGN5X2lzYV9pcnE7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5idXNfaW5kZXggPSAwOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uZmlyc3RfbGluZSA9IGN5X25leHRfY2hhbm5lbDsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLm51bV9jaGlwcyA9IGN5X2lzYV9uY2hhbi80OworICAgICAgICAgICAgICAgIG5ib2FyZCsrOworICAgICAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgLyogcHJpbnQgbWVzc2FnZSAqLworICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLVkvSVNBICMlZDogMHglbHgtMHglbHgsIElSUSVkLCAiLAorICAgICAgICAgICAgICAgICAgICBqKzEsICh1bnNpZ25lZCBsb25nKSBjeV9pc2FfYWRkcmVzcywKKyAgICAgICAgICAgICAgICAgICAgKHVuc2lnbmVkIGxvbmcpKGN5X2lzYV9hZGRyZXNzICsgKEN5SVNBX1l3aW4gLSAxKSksCisJCSAgICBjeV9pc2FfaXJxKTsKKyAgICAgICAgICAgICAgICBwcmludGsoIiVkIGNoYW5uZWxzIHN0YXJ0aW5nIGZyb20gcG9ydCAlZC5cbiIsCisgICAgICAgICAgICAgICAgICAgICAgICBjeV9pc2FfbmNoYW4sI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kZXZfaWRbZGV2X2luZGV4XSkgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYoKHBkZXYgPSBwY2lfZ2V0X2RldmljZShQQ0lfVkVORE9SX0lEX0NZQ0xBREVTLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9pZCwgcGRldikpID09IE5VTEwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2X2luZGV4Kys7ICAgIC8qIHRyeSBuZXh0IGRldmljZSBpZCAqLworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7ICAgICAgICAgIC8qIGZvdW5kIGEgYm9hcmQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKwkJaWYgKGRldmljZV9pZCA9PSAwKQorCQkgICAgYnJlYWs7CisKKwkJaWYgKHBjaV9lbmFibGVfZGV2aWNlKHBkZXYpKQorCQkgICAgY29udGludWU7CisKKyAgICAgICAgICAgICAgICAvKiByZWFkIFBDSSBjb25maWd1cmF0aW9uIGFyZWEgKi8KKwkJY3lfcGNpX2lycSA9IHBkZXYtPmlycTsKKwkJY3lfcGNpX3BoeXMwID0gcGNpX3Jlc291cmNlX3N0YXJ0KHBkZXYsIDApOworCQljeV9wY2lfcGh5czIgPSBwY2lfcmVzb3VyY2Vfc3RhcnQocGRldiwgMik7CisJCXBjaV9yZWFkX2NvbmZpZ19ieXRlKHBkZXYsIFBDSV9SRVZJU0lPTl9JRCwgJmN5eV9yZXZfaWQpOworCisJCWRldmljZV9pZCAmPSB+UENJX0RFVklDRV9JRF9NQVNLOworCisgICAgaWYgKChkZXZpY2VfaWQgPT0gUENJX0RFVklDRV9JRF9DWUNMT01fWV9MbykKKwkgICB8fCAoZGV2aWNlX2lkID09IFBDSV9ERVZJQ0VfSURfQ1lDTE9NX1lfSGkpKXsKKyNpZm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scGhhX18pCisgICAgICAgICAgICAgICAgaWYgKGRldmljZV9pZCAgPT0gUENJX0RFVklDRV9JRF9DWUNMT01fWV9MbykgeyAvKiBiZWxvdyAxTT8gKi8KKwkJICAgIHByaW50aygiQ3ljbG9tLVkvUENJIChidXM9MHgwJXgsIHBjaV9pZD0weCV4LCAiLAorCQkJcGRldi0+YnVzLT5udW1iZXIsIHBkZXYtPmRldmZuKTsKKwkJICAgIHByaW50aygicmV2X2lkPSVkKSBJUlElZFxuIiwKKwkJICAgICAgICBjeXlfcmV2X2lkLCAoaW50KWN5X3BjaV9pcnEpOworICAgICAgICAgICAgICAgICAgICBwcmludGsoIkN5Y2xvbS1ZL1BDSTpmb3VuZCAgd2luYWRkcj0weCVseCBjdGxhZGRyPTB4JWx4XG4iLAorCQkgICAgICAgICh1bG9uZyljeV9wY2lfcGh5czIsICh1bG9uZyljeV9wY2lfcGh5czApOworCSAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLVkvUENJIG5vdCBzdXBwb3J0ZWQgZm9yIGxvdyBhZGRyZXNzZXMgaW4gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIkFscGhhIHN5c3RlbXMuXG4iKTsKKwkJICAgIGktLTsKKwkgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisjZW5kaWYKKwkJY3lfcGNpX2FkZHIwID0gaW9yZW1hcChjeV9wY2lfcGh5czAsIEN5UENJX1ljdGwpOworCQljeV9wY2lfYWRkcjIgPSBpb3JlbWFwKGN5X3BjaV9waHlzMiwgQ3lQQ0lfWXdpbik7CisKKyNpZmRlZiBDWV9QQ0lfREVCVUcKKyAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLVkvUENJOiByZWxvY2F0ZSB3aW5hZGRyPTB4JWx4IGN0bGFkZHI9MHglbHhcbiIsCisJCSh1X2xvbmcpY3lfcGNpX2FkZHIyLCAodV9sb25nKWN5X3BjaV9hZGRyMCk7CisjZW5kaWYKKyAgICAgICAgICAgICAgICBjeV9wY2lfbmNoYW4gPSAodW5zaWduZWQgc2hvcnQpKEN5UE9SVFNfUEVSX0NISVAgKiAKKyAgICAgICAgICAgICAgICAgICAgICAgY3l5X2luaXRfY2FyZChjeV9wY2lfYWRkcjIsIDEpKTsKKyAgICAgICAgICAgICAgICBpZihjeV9wY2lfbmNoYW4gPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJDeWNsb20tWSBQQ0kgaG9zdCBjYXJkIHdpdGggIik7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoIm5vIFNlcmlhbC1Nb2R1bGVzIGF0IDB4JWx4LlxuIiwKKwkJCSAgICAodWxvbmcpIGN5X3BjaV9waHlzMik7CisgICAgICAgICAgICAgICAgICAgICAgICBpLS07CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYoKGN5X25leHRfY2hhbm5lbCtjeV9wY2lfbmNoYW4pID4gTlJfUE9SVFMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLVkvUENJIGZvdW5kIGF0IDB4JWx4ICIsCisJCQkgICAgKHVsb25nKSBjeV9wY2lfcGh5czIpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJidXQgbm8gY2hhbm5lbHMgYXJlIGF2YWlsYWJsZS5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJDaGFuZ2UgTlJfUE9SVFMgaW4gY3ljbGFkZXMuYyBhbmQgcmVjb21waWxlIGtlcm5lbC5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuKGkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvKiBmaWxsIHRoZSBuZXh0IGN5X2NhcmQgc3RydWN0dXJlIGF2YWlsYWJsZSAqLworICAgICAgICAgICAgICAgIGZvciAoaiA9IDAgOyBqIDwgTlJfQ0FSRFMgOyBqKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjeV9jYXJkW2pdLmJhc2VfYWRkciA9PSAwKSAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChqID09IE5SX0NBUkRTKSB7ICAgIC8qIG5vIG1vcmUgY3lfY2FyZHMgYXZhaWxhYmxlICovCisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoIkN5Y2xvbS1ZL1BDSSBmb3VuZCBhdCAweCVseCAiLAorCQkJICAgICh1bG9uZykgY3lfcGNpX3BoeXMyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiYnV0IG5vIG1vcmUgY2FyZHMgY2FuIGJlIHVzZWQuXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ2hhbmdlIE5SX0NBUkRTIGluIGN5Y2xhZGVzLmMgYW5kIHJlY29tcGlsZSBrZXJuZWwuXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybihpKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvKiBhbGxvY2F0ZSBJUlEgKi8KKyAgICAgICAgICAgICAgICBpZihyZXF1ZXN0X2lycShjeV9wY2lfaXJxLCBjeXlfaW50ZXJydXB0LAorCQkgICAgICAgIFNBX1NISVJRLCAiQ3ljbG9tLVkiLCAmY3lfY2FyZFtqXSkpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJDeWNsb20tWS9QQ0kgZm91bmQgYXQgMHglbHggIiwKKwkJCSAgICAodWxvbmcpIGN5X3BjaV9waHlzMik7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoImJ1dCBjb3VsZCBub3QgYWxsb2NhdGUgSVJRJWQuXG4iLAorCQkJICAgIGN5X3BjaV9pcnEpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuKGkpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8qIHNldCBjeV9jYXJkICovCisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5iYXNlX3BoeXMgPSAodWxvbmcpY3lfcGNpX3BoeXMyOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uY3RsX3BoeXMgPSAodWxvbmcpY3lfcGNpX3BoeXMwOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uYmFzZV9hZGRyID0gY3lfcGNpX2FkZHIyOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uY3RsX2FkZHIgPSBjeV9wY2lfYWRkcjA7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5pcnEgPSAoaW50KSBjeV9wY2lfaXJxOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uYnVzX2luZGV4ID0gMTsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmZpcnN0X2xpbmUgPSBjeV9uZXh0X2NoYW5uZWw7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5udW1fY2hpcHMgPSBjeV9wY2lfbmNoYW4vNDsKKwkJY3lfY2FyZFtqXS5wZGV2ID0gcGRldjsKKwkKKyAgICAgICAgICAgICAgICAvKiBlbmFibGUgaW50ZXJydXB0cyBpbiB0aGUgUENJIGludGVyZmFjZSAqLworCQlwbHhfdmVyID0gY3lfcmVhZGIoY3lfcGNpX2FkZHIyICsgQ3lQTFhfVkVSKSAmIDB4MGY7CisJCXN3aXRjaCAocGx4X3ZlcikgeworCQkgICAgY2FzZSBQTFhfOTA1MDoKKworCQkgICAgY3lfd3JpdGViKGN5X3BjaV9hZGRyMCsweDRjLCAweDQzKTsKKwkJICAgIGJyZWFrOworCisJCSAgICBjYXNlIFBMWF85MDYwOgorCQkgICAgY2FzZSBQTFhfOTA4MDoKKwkJICAgIGRlZmF1bHQ6IC8qIE9sZCBib2FyZHMsIHVzZSBQTFhfOTA2MCAqLworCisJCSAgICBwbHhfaW5pdChjeV9wY2lfYWRkcjAsID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KwkgICAgfQorI2VuZGlmCisJICAgIC8qIFRoZSBmb2xsb3dpbmcgY2xlYXJzIHRoZSBmaXJtd2FyZSBpZCB3b3JkLiAgVGhpcyBlbnN1cmVzCisJICAgICAgIHRoYXQgdGhlIGRyaXZlciB3aWxsIG5vdCBhdHRlbXB0IHRvIHRhbGsgdG8gdGhlIGJvYXJkCisJICAgICAgIHVudGlsIGl0IGhhcyBiZWVuIHByb3Blcmx5IGluaXRpYWxpemVkLgorCSAgICAgKi8KKwkJUEFVU0UKKwkJaWYgKChtYWlsYm94ID09IFpPX1YxKSB8fCAobWFpbGJveCA9PSBaT19WMikpCisJCSAgICBjeV93cml0ZWwoY3lfcGNpX2FkZHIyICsgSURfQUREUkVTUywgMEwpOworCisgICAgICAgICAgICAgICAgLyogVGhpcyBtdXN0IGJlIGEgQ3ljbGFkZXMtOFpvL1BDSS4gIFRoZSBleHRlbmRhYmxlCisgICAgICAgICAgICAgICAgICAgdmVyc2lvbiB3aWxsIGhhdmUgYSBkaWZmZXJlbnQgZGV2aWNlX2lkIGFuZCB3aWxsCisgICAgICAgICAgICAgICAgICAgYmUgYWxsb2NhdGVkIGl0cyBtYXhpbXVtIG51bWJlciBvZiBwb3J0cy4gKi8KKyAgICAgICAgICAgICAgICBjeV9wY2lfbmNoYW4gPSA4OworCisgICAgICAgICAgICAgICAgaWYoKGN5X25leHRfY2hhbm5lbCtjeV9wY2lfbmNoYW4pID4gTlJfUE9SVFMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbGFkZXMtOFpvL1BDSSBmb3VuZCBhdCAweCVseCAiLAorCQkJICAgICh1bG9uZyljeV9wY2lfcGh5czIpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJidXQgbm8gY2hhbm5lbHMgYXJlIGF2YWlsYWJsZS5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRrKCJDaGFuZ2UgTlJfUE9SVFMgaW4gY3ljbGFkZXMuYyBhbmQgcmVjb21waWxlIGtlcm5lbC5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuKGkpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8qIGZpbGwgdGhlIG5leHQgY3lfY2FyZCBzdHJ1Y3R1cmUgYXZhaWxhYmxlICovCisgICAgICAgICAgICAgICAgZm9yIChqID0gMCA7IGogPCBOUl9DQVJEUyA7IGorKykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN5X2NhcmRbal0uYmFzZV9hZGRyID09IDApICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGogPT0gTlJfQ0FSRFMpIHsgICAgLyogbm8gbW9yZSBjeV9jYXJkcyBhdmFpbGFibGUgKi8KKwkJICAgIHByaW50aygiQ3ljbGFkZXMtOFpvL1BDSSBmb3VuZCBhdCAweCVseCAiLAorCQkJKHVsb25nKWN5X3BjaV9waHlzMik7CisJCSAgICBwcmludGsoImJ1dCBubyBtb3JlIGNhcmRzIGNhbiBiZSB1c2VkLlxuIik7CisgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ2hhbmdlIE5SX0NBUkRTIGluIGN5Y2xhZGVzLmMgYW5kIHJlY29tcGlsZSBrZXJuZWwuXG4iKTsKKwkJICAgIHJldHVybihpKTsKKyAgICAgICAgICAgICAgICB9CisKKyNpZmRlZiBDT05GSUdfQ1laX0lOVFIKKyAgICAgICAgICAgICAgICAvKiBhbGxvY2F0ZSBJUlEgb25seSBpZiBib2FyZCBoYXMgYW4gSVJRICovCisJCWlmKCAoY3lfcGNpX2lycSAhPSAwKSAmJiAoY3lfcGNpX2lycSAhPSAyNTUpICkgeworCQkgICAgaWYocmVxdWVzdF9pcnEoY3lfcGNpX2lycSwgY3l6X2ludGVycnVwdCwKKwkJCVNBX1NISVJRLCAiQ3ljbGFkZXMtWiIsICZjeV9jYXJkW2pdKSkKKwkJICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbG9tLThaby9QQ0kgZm91bmQgYXQgMHglbHggIiwKKwkJCSAgICAodWxvbmcpIGN5X3BjaV9waHlzMik7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoImJ1dCBjb3VsZCBub3QgYWxsb2NhdGUgSVJRJWQuXG4iLAorCQkJICAgIGN5X3BjaV9pcnEpOworCQkJcmV0dXJuKGkpOworCQkgICAgfQorCQl9CisjZW5kaWYgLyogQ09ORklHX0NZWl9JTlRSICovCisKKworICAgICAgICAgICAgICAgIC8qIHNldCBjeV9jYXJkICovCisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5iYXNlX3BoeXMgPSBjeV9wY2lfcGh5czI7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5jdGxfcGh5cyA9IGN5X3BjaV9waHlzMDsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmJhc2VfYWRkciA9IGN5X3BjaV9hZGRyMjsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmN0bF9hZGRyID0gY3lfcGNpX2FkZHIwOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uaXJxID0gKGludCkgY3lfcGNpX2lycTsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmJ1c19pbmRleCA9IDE7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5maXJzdF9saW5lID0gY3lfbmV4dF9jaGFubmVsOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0ubnVtX2NoaXBzID0gLTE7CisJCWN5X2NhcmRbal0ucGRldiA9IHBkZXY7CisKKyAgICAgICAgICAgICAgICAvKiBwcmludCBtZXNzYWdlICovCisjaWZkZWYgQ09ORklHX0NZWl9JTlRSCisJCS8qIGRvbid0IHJlcG9ydCBJUlEgaWYgYm9hcmQgaXMgbm8gSVJRICovCisJCWlmKCAoY3lfcGNpX2lycSAhPSAwKSAmJiAoY3lfcGNpX2lycSAhPSAyNTUpICkKKwkJICAgIHByaW50aygiQ3ljbGFkZXMtOFpvL1BDSSAjJWQ6IDB4JWx4LTB4JWx4LCBJUlElZCwgIiwKKwkJCWorMSwodWxvbmcpY3lfcGNpX3BoeXMyLAorCQkJKHVsb25nKShjeV9wY2lfcGh5czIgKyBDeVBDSV9ad2luIC0gMSksCisJCQkoaW50KWN5X3BjaV9pcnEpOworCQllbHNlCisjZW5kaWYgLyogQ09ORklHX0NZWl9JTlRSICovCisJCSAgICBwcmludGsoIkN5Y2xhZGVzLThaby9QQ0kgIyVkOiAweCVseC0weCVseCwgIiwKKwkJCWorMSwodWxvbmcpY3lfcGNpX3BoeXMyLAorCQkJKHVsb25nKShjeV9wY2lfcGh5czIgKyBDeVBDSV9ad2luIC0gMSkpOworCisgICAgICAgICAgICAgICAgcHJpbnRrKCIlZCBjaGFubmVscyBzdGFydGluZyBmcm9tIHBvcnQgJWQuXG4iLAorCQkgICAgY3lfcGNpX25jaGFuLGN5X25leHRfY2hhbm5lbCk7CisgICAgICAgICAgICAgICAgY3lfbmV4dF9jaGFubmVsICs9IGN5X3BjaV9uY2hhbjsKKwkgICAgfQorICAgICAgICB9CisKKyAgICAgICAgZm9yICg7IFplSW5kZXggIT0gMCAmJiBpIDwgTlJfQ0FSRFM7IGkrKykgeworCSAgICBjeV9wY2lfcGh5czAgPSBaZV9waHlzMFswXTsKKwkgICAgY3lfcGNpX3BoeXMyID0gWmVfcGh5czJbMF07CisJICAgIGN5X3BjaV9hZGRyMCA9IFplX2FkZHIwWzBdOworCSAgICBjeV9wY2lfYWRkcjIgPSBaZV9hZGRyMlswXTsKKwkgICAgY3lfcGNpX2lycSA9IFplX2lycVswXTsKKwkgICAgcGRldiA9IFplX3BkZXZbMF07CisJICAgIGZvciAoaiA9IDAgOyBqIDwgWmVJbmRleC0xIDsgaisrKSB7CisJCVplX3BoeXMwW2pdID0gWmVfcGh5czBbaisxXTsKKwkJWmVfcGh5czJbal0gPSBaZV9waHlzMltqKzFdOworCQlaZV9hZGRyMFtqXSA9IFplX2FkZHIwW2orMV07CisJCVplX2FkZHIyW2pdID0gWmVfYWRkcjJbaisxXTsKKwkJWmVfaXJxW2pdID0gWmVfaXJxW2orMV07CisJCVplX3BkZXZbal0gPSBaZV9wZGV2W2orMV07CisJICAgIH0KKwkgICAgWmVJbmRleC0tOworCQltYWlsYm94ID0gKHVjbG9uZyljeV9yZWFkbCgmKChzdHJ1Y3QgUlVOVElNRV85MDYwIF9faW9tZW0gKikgCisJCQkJCSAgIGN5X3BjaV9hZGRyMCktPm1haWxfYm94XzApOworI2lmZGVmIENZX1BDSV9ERUJVRworICAgICAgICAgICAgcHJpbnRrKCJDeWNsYWRlcy1aL1BDSTogcmVsb2NhdGUgd2luYWRkcj0weCVseCBjdGxhZGRyPTB4JWx4XG4iLAorICAgICAgICAgICAgICAgICh1bG9uZyljeV9wY2lfYWRkcjIsICh1bG9uZyljeV9wY2lfYWRkcjApOworCSAgICBwcmludGsoIkN5Y2xhZGVzLVovUENJOiBOZXcgQ3ljbGFkZXMtWiBib2FyZC4gIEZQR0Egbm90IGxvYWRlZFxuIik7CisjZW5kaWYKKwkJUEFVU0UKKyAgICAgICAgICAgICAgICAvKiBUaGlzIG11c3QgYmUgdGhlIG5ldyBDeWNsYWRlcy1aZS9QQ0kuICovCisgICAgICAgICAgICAgICAgY3lfcGNpX25jaGFuID0gWkVfVjFfTlBPUlRTOworCisgICAgICAgICAgICAgICAgaWYoKGN5X25leHRfY2hhbm5lbCtjeV9wY2lfbmNoYW4pID4gTlJfUE9SVFMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50aygiQ3ljbGFkZXMtWmUvUENJIGZvdW5kIGF0IDB4JWx4ICIsCisJCQkgICAgKHVsb25nKWN5X3BjaV9waHlzMik7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoImJ1dCBubyBjaGFubmVscyBhcmUgYXZhaWxhYmxlLlxuIik7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoIkNoYW5nZSBOUl9QT1JUUyBpbiBjeWNsYWRlcy5jIGFuZCByZWNvbXBpbGUga2VybmVsLlxuIik7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4oaSk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLyogZmlsbCB0aGUgbmV4dCBjeV9jYXJkIHN0cnVjdHVyZSBhdmFpbGFibGUgKi8KKyAgICAgICAgICAgICAgICBmb3IgKGogPSAwIDsgaiA8IE5SX0NBUkRTIDsgaisrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3lfY2FyZFtqXS5iYXNlX2FkZHIgPT0gMCkgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoaiA9PSBOUl9DQVJEUykgeyAgICAvKiBubyBtb3JlIGN5X2NhcmRzIGF2YWlsYWJsZSAqLworCQkgICAgcHJpbnRrKCJDeWNsYWRlcy1aZS9QQ0kgZm91bmQgYXQgMHglbHggIiwKKwkJCSh1bG9uZyljeV9wY2lfcGh5czIpOworCQkgICAgcHJpbnRrKCJidXQgbm8gbW9yZSBjYXJkcyBjYW4gYmUgdXNlZC5cbiIpOworICAgICAgICAgICAgICAgICAgICBwcmludGsoIkNoYW5nZSBOUl9DQVJEUyBpbiBjeWNsYWRlcy5jIGFuZCByZWNvbXBpbGUga2VybmVsLlxuIik7CisJCSAgICByZXR1cm4oaSk7CisgICAgICAgICAgICAgICAgfQorCisjaWZkZWYgQ09ORklHX0NZWl9JTlRSCisgICAgICAgICAgICAgICAgLyogYWxsb2NhdGUgSVJRIG9ubHkgaWYgYm9hcmQgaGFzIGFuIElSUSAqLworCQlpZiggKGN5X3BjaV9pcnEgIT0gMCkgJiYgKGN5X3BjaV9pcnEgIT0gMjU1KSApIHsKKwkJICAgIGlmKHJlcXVlc3RfaXJxKGN5X3BjaV9pcnEsIGN5el9pbnRlcnJ1cHQsCisJCQlTQV9TSElSUSwgIkN5Y2xhZGVzLVoiLCAmY3lfY2FyZFtqXSkpCisJCSAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoIkN5Y2xvbS1aZS9QQ0kgZm91bmQgYXQgMHglbHggIiwKKwkJCSAgICAodWxvbmcpIGN5X3BjaV9waHlzMik7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludGsoImJ1dCBjb3VsZCBub3QgYWxsb2NhdGUgSVJRJWQuXG4iLAorCQkJICAgIGN5X3BjaV9pcnEpOworCQkJcmV0dXJuKGkpOworCQkgICAgfQorCQl9CisjZW5kaWYgLyogQ09ORklHX0NZWl9JTlRSICovCisKKyAgICAgICAgICAgICAgICAvKiBzZXQgY3lfY2FyZCAqLworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uYmFzZV9waHlzID0gY3lfcGNpX3BoeXMyOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uY3RsX3BoeXMgPSBjeV9wY2lfcGh5czA7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5iYXNlX2FkZHIgPSBjeV9wY2lfYWRkcjI7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5jdGxfYWRkciA9IGN5X3BjaV9hZGRyMDsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLmlycSA9IChpbnQpIGN5X3BjaV9pcnE7CisgICAgICAgICAgICAgICAgY3lfY2FyZFtqXS5idXNfaW5kZXggPSAxOworICAgICAgICAgICAgICAgIGN5X2NhcmRbal0uZmlyc3RfbGluZSA9IGN5X25leHRfY2hhbm5lbDsKKyAgICAgICAgICAgICAgICBjeV9jYXJkW2pdLm51bV9jaGlwcyA9IC0xOworCQljeV9jYXJkW2pdLnBkZXYgPSBwZGV2OworCisgICAgICAgICAgICAgICAgLyogcHJpbnQgbWVzc2FnZSAqLworI2lmZGVmIENPTkZJR19DWVpfSU5UUgorCQkvKiBkb24ndCByZXBvcnQgSVJRIGlmIGJvYXJkIGlzIG5vIElSUSAqLworCQlpZiggKGN5X3BjaV9pcnEgIT0gMCkgJiYgKGN5X3Bj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ICAgICAgICAgICAgZm9yIChwb3J0ID0gY2luZm8tPmZpcnN0X2xpbmUgOworICAgICAgICAgICAgICAgICAgICAgcG9ydCA8IGNpbmZvLT5maXJzdF9saW5lICsgbnBvcnRzOworICAgICAgICAgICAgICAgICAgICAgcG9ydCsrKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaW5mbyA9ICZjeV9wb3J0W3BvcnRdOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5tYWdpYyA9IENZQ0xBREVTX01BR0lDOworICAgICAgICAgICAgICAgICAgICBpbmZvLT50eXBlID0gUE9SVF9TVEFSVEVDSDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y2FyZCA9IGJvYXJkOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5saW5lID0gcG9ydDsKKwkJICAgIGluZm8tPmNoaXBfcmV2ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+ZmxhZ3MgPSBTVERfQ09NX0ZMQUdTOworICAgICAgICAgICAgICAgICAgICBpbmZvLT50dHkgPSBOVUxMOworCQkgICAgaWYgKG1haWxib3ggPT0gWk9fVjEpCisJCQlpbmZvLT54bWl0X2ZpZm9fc2l6ZSA9IENZWl9GSUZPX1NJWkU7CisJCSAgICBlbHNlCisJCQlpbmZvLT54bWl0X2ZpZm9fc2l6ZSA9IDQgKiBDWVpfRklGT19TSVpFOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5jb3IxID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y29yMiA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmNvcjMgPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5jb3I0ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y29yNSA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPnRicHIgPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT50Y28gPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5yYnByID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+cmNvID0gMDsKKwkJICAgIGluZm8tPmN1c3RvbV9kaXZpc29yID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y2xvc2VfZGVsYXkgPSA1KkhaLzEwOworCQkgICAgaW5mby0+Y2xvc2luZ193YWl0ID0gQ0xPU0lOR19XQUlUX0RFTEFZOworCQkgICAgaW5mby0+aWNvdW50LmN0cyA9IGluZm8tPmljb3VudC5kc3IgPSAKKwkJCWluZm8tPmljb3VudC5ybmcgPSBpbmZvLT5pY291bnQuZGNkID0gMDsKKwkJICAgIGluZm8tPmljb3VudC5yeCA9IGluZm8tPmljb3VudC50eCA9IDA7CisJCSAgICBpbmZvLT5pY291bnQuZnJhbWUgPSBpbmZvLT5pY291bnQucGFyaXR5ID0gMDsKKwkJICAgIGluZm8tPmljb3VudC5vdmVycnVuID0gaW5mby0+aWNvdW50LmJyayA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPnhfY2hhciA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmV2ZW50ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y291bnQgPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5ibG9ja2VkX29wZW4gPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5kZWZhdWx0X3RocmVzaG9sZCA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmRlZmF1bHRfdGltZW91dCA9IDA7CisJCSAgICBJTklUX1dPUksoJmluZm8tPnRxdWV1ZSwgZG9fc29mdGludCwgaW5mbyk7CisJCSAgICBpbml0X3dhaXRxdWV1ZV9oZWFkKCZpbmZvLT5vcGVuX3dhaXQpOworCQkgICAgaW5pdF93YWl0cXVldWVfaGVhZCgmaW5mby0+Y2xvc2Vfd2FpdCk7CisJCSAgICBpbml0X3dhaXRxdWV1ZV9oZWFkKCZpbmZvLT5zaHV0ZG93bl93YWl0KTsKKwkJICAgIGluaXRfd2FpdHF1ZXVlX2hlYWQoJmluZm8tPmRlbHRhX21zcl93YWl0KTsKKyAgICAgICAgICAgICAgICAgICAgLyogaW5mby0+c2Vzc2lvbiAqLworICAgICAgICAgICAgICAgICAgICAvKiBpbmZvLT5wZ3JwICovCisgICAgICAgICAgICAgICAgICAgIGluZm8tPnJlYWRfc3RhdHVzX21hc2sgPSAwOworICAgICAgICAgICAgICAgICAgICAvKiBpbmZvLT50aW1lb3V0ICovCisJCSAgICAvKiBCZW50c29uJ3MgdmFycyAqLworICAgICAgICAgICAgICAgICAgICBpbmZvLT5qaWZmaWVzWzBdID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+amlmZmllc1sxXSA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmppZmZpZXNbMl0gPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5yZmx1c2hfY291bnQgPSAwOworI2lmZGVmIENPTkZJR19DWVpfSU5UUgorCQkgICAgaW5pdF90aW1lcigmY3l6X3J4X2Z1bGxfdGltZXJbcG9ydF0pOworCQkgICAgY3l6X3J4X2Z1bGxfdGltZXJbcG9ydF0uZnVuY3Rpb24gPSBOVUxMOworI2VuZGlmCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfWVsc2V7IC8qIEN5Y2xvbS1ZIG9mIHNvbWUga2luZCovCisgICAgICAgICAgICAgICAgaW5kZXggPSBjaW5mby0+YnVzX2luZGV4OworCQlzcGluX2xvY2tfaW5pdCgmY2luZm8tPmNhcmRfbG9jayk7CisJCWNpbmZvLT5ucG9ydHMgPSBDeVBPUlRTX1BFUl9DSElQICogY2luZm8tPm51bV9jaGlwczsKKyAgICAgICAgICAgICAgICBmb3IgKHBvcnQgPSBjaW5mby0+Zmlyc3RfbGluZSA7CisgICAgICAgICAgICAgICAgICAgICBwb3J0IDwgY2luZm8tPmZpcnN0X2xpbmUgKyBjaW5mby0+bnBvcnRzIDsKKyAgICAgICAgICAgICAgICAgICAgIHBvcnQrKykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGluZm8gPSAmY3lfcG9ydFtwb3J0XTsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+bWFnaWMgPSBDWUNMQURFU19NQUdJQzsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+dHlwZSA9IFBPUlRfQ0lSUlVTOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5jYXJkID0gYm9hcmQ7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmxpbmUgPSBwb3J0OworICAgICAgICAgICAgICAgICAgICBpbmZvLT5mbGFncyA9IFNURF9DT01fRkxBR1M7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPnR0eSA9IE5VTEw7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPnhtaXRfZmlmb19zaXplID0gQ3lNQVhfQ0hBUl9GSUZPOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5jb3IxID0gQ3lQQVJJVFlfTk9ORXxDeV8xX1NUT1B8Q3lfOF9CSVRTOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5jb3IyID0gQ3lFVEM7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmNvcjMgPSAweDA4OyAvKiBfdmVyeV8gc21hbGwgcmN2IHRocmVzaG9sZCAqLworICAgICAgICAgICAgICAgICAgICBpbmZvLT5jb3I0ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y29yNSA9IDA7CisJCSAgICBpbmZvLT5jdXN0b21fZGl2aXNvciA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmNsb3NlX2RlbGF5ID0gNSpIWi8xMDsKKwkJICAgIGluZm8tPmNsb3Npbmdfd2FpdCA9IENMT1NJTkdfV0FJVF9ERUxBWTsKKwkJICAgIGluZm8tPmljb3VudC5jdHMgPSBpbmZvLT5pY291bnQuZHNyID0gCisJCQlpbmZvLT5pY291bnQucm5nID0gaW5mby0+aWNvdW50LmRjZCA9IDA7CisJCSAgICBpbmZvLT5pY291bnQucnggPSBpbmZvLT5pY291bnQudHggPSAwOworCQkgICAgaW5mby0+aWNvdW50LmZyYW1lID0gaW5mby0+aWNvdW50LnBhcml0eSA9IDA7CisJCSAgICBpbmZvLT5pY291bnQub3ZlcnJ1biA9IGluZm8tPmljb3VudC5icmsgPSAwOworCQkgICAgY2hpcF9udW1iZXIgPSAocG9ydCAtIGNpbmZvLT5maXJzdF9saW5lKSAvIDQ7CisJCSAgICBpZiAoKGluZm8tPmNoaXBfcmV2ID0KKwkJCSBjeV9yZWFkYihjaW5mby0+YmFzZV9hZGRyICsKKwkJCQkgIChjeV9jaGlwX29mZnNldFtjaGlwX251bWJlcl08PGluZGV4KSArCisJCQkJICAoQ3lHRlJDUjw8aW5kZXgpKSkgPj0gQ0QxNDAwX1JFVl9KKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBJdCBpcyBhIENEMTQwMCByZXYuIEogb3IgbGF0ZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnRicHIgPSBiYXVkX2Jwcl82MFsxM107IC8qIFR4IEJQUiAqLworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+dGNvID0gYmF1ZF9jb182MFsxM107IC8qIFR4IENPICovCisgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT5yYnByID0gYmF1ZF9icHJfNjBbMTNdOyAvKiBSeCBCUFIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnJjbyA9IGJhdWRfY29fNjBbMTNdOyAvKiBSeCBDTyAqLworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+cmZsb3cgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+cnRzZHRyX2ludiA9IDE7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT50YnByID0gYmF1ZF9icHJfMjVbMTNdOyAvKiBUeCBCUFIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnRjbyA9IGJhdWRfY29fMjVbMTNdOyAvKiBUeCBDTyAqLworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+cmJwciA9IGJhdWRfYnByXzI1WzEzXTsgLyogUnggQlBSICovCisgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT5yY28gPSBiYXVkX2NvXzI1WzEzXTsgLyogUnggQ08gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnJmbG93ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnJ0c2R0cl9pbnYgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGluZm8tPnhfY2hhciA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmV2ZW50ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW5mby0+Y291bnQgPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5ibG9ja2VkX29wZW4gPSAwOworICAgICAgICAgICAgICAgICAgICBpbmZvLT5kZWZhdWx0X3RocmVzaG9sZCA9IDA7CisgICAgICAgICAgICAgICAgICAgIGluZm8tPmRlZmF1bHRfdGltZW91dCA9IDA7CisJCSAgICBJTklUX1dPUksoJmluZm8tPnRxdWV1ZSwgZG9fc29mdGludCwgaW5mbyk7CisJCSAgICBpbml0X3dhaXRxdWV1ZV9oZWFkKCZpbmZvLT5vcGVuX3dhaXQpOworCQkgICAgaW5pdF93YWl0cXVldWVfaGVhZCgmaW5mby0+Y2xvc2Vfd2FpdCk7CisJCSAgICBpbml0X3dhaXRxdWV1ZV9oZWFkKCZpbmZvLT5zaHV0ZG93bl93YWl0KTsKKwkJICAgIGluaXRfd2FpdHF1ZXVlX2hlYWQoJmluZm8tPmRlbHRhX21zcl93YWl0KTsKKyAgICAgICAgICAgICAgICAgICAgLyogaW5mby0+c2Vzc2lvbiAqLworICAgICAgICAgICAgICAgICAgICAvKiBpbmZvLT5wZ3JwICovCisgICAgICAgICAgICAgICAgICAgIGluZm8tPnJlYWRfc3RhdHVzX21hc2sgPQorCQkgICAgICAgICAgICAgICAgICBDeVRJTUVPVVR8IEN5U1BFQ0hBUnwgQ3lCUkVBSworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgQ3lQQVJJVFl8IEN5RlJBTUV8IEN5T1ZFUlJVTjsKKyAgICAgICAgICAgICAgICAgICAgLyogaW5mby0+dGltZW91dCAqLworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICB9CisKKyNpZm5kZWYgQ09ORklHX0NZWl9JTlRSCisgICAgaWYgKG51bWJlcl96X2JvYXJkcyAmJiAhY3l6X3RpbWVyb24peworCWN5el90aW1lcm9uKys7CisJY3l6X3RpbWVybGlzdC5leHBpcmVzID0gamlmZmllcyArIDE7CisJYWRkX3RpbWVyKCZjeXpfdGltZXJsaXN0KTsKKyNpZmRlZiBDWV9QQ0lfREVCVUcKKwlwcmludGsoIkN5Y2xhZGVzLVogcG9sbGluZyBpbml0aWFsaXplZFxuIik7CisjZW5kaWYKKyAgICB9CisjZW5kaWYgLyogQ09ORklHX0NZWl9JTlRSICovCisKKyAgICByZXR1cm4gMDsKKyAgICAKK30gLyogY3lfaW5pdCAqLworCitzdGF0aWMgdm9pZCBfX2V4aXQKK2N5X2NsZWFudXBfbW9kdWxlKHZvaWQpCit7CisgICAgaW50IGksIGUxOworCisjaWZuZGVmIENPTkZJR19DWVpfSU5UUgorICAgIGlmIChjeXpfdGltZXJvbil7CisJY3l6X3RpbWVyb24gPSAwOworCWRlbF90aW1lcigmY3l6X3RpbWVybGlzdCk7CisgICAgfQorI2VuZGlmIC8qIENPTkZJR19DWVpfSU5UUiAqLworCisgICAgaWYgKChlMSA9IHR0eV91bnJlZ2lzdGVyX2RyaXZlcihjeV9zZXJpYWxfZHJpdmVyKSkpCisgICAgICAgICAgICBwcmludG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lLgorICovCisKKyNpbmNsdWRlIDxsaW51eC9jb25maWcuaD4KKyNpbmNsdWRlIDxsaW51eC9pbml0Lmg+CisjaW5jbHVkZSA8YXNtL2RlYy9tYWNodHlwZS5oPgorCisjaWZkZWYgQ09ORklHX1pTCitleHRlcm4gaW50IHpzX2luaXQodm9pZCk7CisjZW5kaWYKKworI2lmZGVmIENPTkZJR19EWgorZXh0ZXJuIGludCBkel9pbml0KHZvaWQpOworI2VuZGlmCisKKyNpZmRlZiBDT05GSUdfU0VSSUFMX0NPTlNPTEUKKworI2lmZGVmIENPTkZJR19aUworZXh0ZXJuIHZvaWQgenNfc2VyaWFsX2NvbnNvbGVfaW5pdCh2b2lkKTsKKyNlbmRpZgorCisjaWZkZWYgQ09ORklHX0RaCitleHRlcm4gdm9pZCBkel9zZXJpYWxfY29uc29sZV9pbml0KHZvaWQpOworI2VuZGlmCisKKyNlbmRpZgorCisvKiByc19pbml0IC0gc3RhcnRzIHVwIHRoZSBzZXJpYWwgaW50ZXJmYWNlIC0KKyAgIGhhbmRsZSBub3JtYWwgY2FzZSBvZiBzdGFydGluZyB1cCB0aGUgc2VyaWFsIGludGVyZmFjZSAqLworCisjaWZkZWYgQ09ORklHX1NFUklBTAorCitpbnQgX19pbml0IHJzX2luaXQodm9pZCkKK3sKKworI2lmIGRlZmluZWQoQ09ORklHX1pTKSAmJiBkZWZpbmVkKENPTkZJR19EWikKKyAgICBpZiAoSU9BU0lDKQorCXJldHVybiB6c19pbml0KCk7CisgICAgZWxzZQorCXJldHVybiBkel9pbml0KCk7CisjZWxzZQorCisjaWZkZWYgQ09ORklHX1pTCisgICAgcmV0dXJuIHpzX2luaXQoKTsKKyNlbmRpZgorCisjaWZkZWYgQ09ORklHX0RaCisgICAgcmV0dXJuIGR6X2luaXQoKTsKKyNlbmRpZgorCisjZW5kaWYKK30KKworX19pbml0Y2FsbChyc19pbml0KTsKKworI2VuZGlmCisKKyNpZmRlZiBDT05GSUdfU0VSSUFMX0NPTlNPTEU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lVMTCwKKwljdHJsX21hcCwgc2hpZnRfY3RybF9tYXAsIE5VTEwsIE5VTEwsCisJYWx0X21hcCwgTlVMTCwgTlVMTCwgTlVMTCwKKwljdHJsX2FsdF9tYXAsIE5VTEwKK307CisKK3Vuc2lnbmVkIGludCBrZXltYXBfY291bnQgPSA3OworCisvKgorICogUGhpbG9zb3BoeTogbW9zdCBwZW9wbGUgZG8gbm90IGRlZmluZSBtb3JlIHN0cmluZ3MsIGJ1dCB0aGV5IHdobyBkbworICogb2Z0ZW4gd2FudCBxdWl0ZSBhIGxvdCBvZiBzdHJpbmcgc3BhY2UuIFNvLCB3ZSBzdGF0aWNhbGx5IGFsbG9jYXRlCisgKiB0aGUgZGVmYXVsdCBhbmQgYWxsb2NhdGUgZHluYW1pY2FsbHkgaW4gY2h1bmtzIG9mIDUxMiBieXRlcy4KKyAqLworCitjaGFyIGZ1bmNfYnVmW10gPSB7CisJJ1wwMzMnLCAnWycsICdbJywgJ0EnLCAwLCAKKwknXDAzMycsICdbJywgJ1snLCAnQicsIDAsIAorCSdcMDMzJywgJ1snLCAnWycsICdDJywgMCwgCisJJ1wwMzMnLCAnWycsICdbJywgJ0QnLCAwLCAKKwknXDAzMycsICdbJywgJ1snLCAnRScsIDAsIAorCSdcMDMzJywgJ1snLCAnMScsICc3JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzEnLCAnOCcsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcxJywgJzknLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMicsICcwJywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzInLCAnMScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcyJywgJzMnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMicsICc0JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzInLCAnNScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcyJywgJzYnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMicsICc4JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzInLCAnOScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICczJywgJzEnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMycsICcyJywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzMnLCAnMycsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICczJywgJzQnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcyJywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzMnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnNCcsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICc1JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzYnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnTScsIDAsIAorCSdcMDMzJywgJ1snLCAnUCcsIDAsIAorfTsKKworY2hhciAqZnVuY2J1ZnB0ciA9IGZ1bmNfYnVmOworaW50IGZ1bmNidWZzaXplID0gc2l6ZW9mKGZ1bmNfYnVmKTsKK2ludCBmdW5jYnVmbGVmdCA9IDA7ICAgICAgICAgIC8qIHNwYWNlIGxlZnQgKi8KKworY2hhciAqZnVuY190YWJsZVtNQVhfTlJfRlVOQ10gPSB7CisJZnVuY19idWYgKyAwLAorCWZ1bmNfYnVmICsgNSwKKwlmdW5jX2J1ZiArIDEwLAorCWZ1bmNfYnVmICsgMTUsCisJZnVuY19idWYgKyAyMCwKKwlmdW5jX2J1ZiArIDI1LAorCWZ1bmNfYnVmICsgMzEsCisJZnVuY19idWYgKyAzNywKKwlmdW5jX2J1ZiArIDQzLAorCWZ1bmNfYnVmICsgNDksCisJZnVuY19idWYgKyA1NSwKKwlmdW5jX2J1ZiArIDYxLAorCWZ1bmNfYnVmICsgNjcsCisJZnVuY19idWYgKyA3MywKKwlmdW5jX2J1ZiArIDc5LAorCWZ1bmNfYnVmICsgODUsCisJZnVuY19idWYgKyA5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nIicsICdFJywgJ1wzMTMnfSwJeyciJywgJ2UnLCAnXDM1Myd9LAorCXsnYCcsICdJJywgJ1wzMTQnfSwJeydgJywgJ2knLCAnXDM1NCd9LAorCXsnXCcnLCAnSScsICdcMzE1J30sCXsnXCcnLCAnaScsICdcMzU1J30sCisJeydeJywgJ0knLCAnXDMxNid9LAl7J14nLCAnaScsICdcMzU2J30sCisJeyciJywgJ0knLCAnXDMxNyd9LAl7JyInLCAnaScsICdcMzU3J30sCisJeyctJywgJ0QnLCAnXDMyMCd9LAl7Jy0nLCAnZCcsICdcMzYwJ30sCisJeyd+JywgJ04nLCAnXDMyMSd9LAl7J34nLCAnbicsICdcMzYxJ30sCisJeydgJywgJ08nLCAnXDMyMid9LAl7J2AnLCAnbycsICdcMzYyJ30sCisJeydcJycsICdPJywgJ1wzMjMnfSwJeydcJycsICdvJywgJ1wzNjMnfSwKKwl7J14nLCAnTycsICdcMzI0J30sCXsnXicsICdvJywgJ1wzNjQnfSwKKwl7J34nLCAnTycsICdcMzI1J30sCXsnficsICdvJywgJ1wzNjUnfSwKKwl7JyInLCAnTycsICdcMzI2J30sCXsnIicsICdvJywgJ1wzNjYnfSwKKwl7Jy8nLCAnTycsICdcMzMwJ30sCXsnLycsICdvJywgJ1wzNzAnfSwKKwl7J2AnLCAnVScsICdcMzMxJ30sCXsnYCcsICd1JywgJ1wzNzEnfSwKKwl7J1wnJywgJ1UnLCAnXDMzMid9LAl7J1wnJywgJ3UnLCAnXDM3Mid9LAorCXsnXicsICdVJywgJ1wzMzMnfSwJeydeJywgJ3UnLCAnXDM3Myd9LAorCXsnIicsICdVJywgJ1wzMzQnfSwJeyciJywgJ3UnLCAnXDM3NCd9LAorCXsnXCcnLCAnWScsICdcMzM1J30sCXsnXCcnLCAneScsICdcMzc1J30sCisJeydUJywgJ0gnLCAnXDMzNid9LAl7J3QnLCAnaCcsICdcMzc2J30sCisJeydzJywgJ3MnLCAnXDMzNyd9LAl7JyInLCAneScsICdcMzc3J30sCis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ICAgICBrZXljb2RlICAgMiA9IE1ldGFfb25lICAgICAgICAKK2tleWNvZGUgICAzID0gdHdvICAgICAgICAgICAgICBhdCAgICAgICAgICAgICAgIGF0ICAgICAgICAgICAgICAKKwljb250cm9sCWtleWNvZGUgICAzID0gbnVsICAgICAgICAgICAgIAorCXNoaWZ0CWNvbnRyb2wJa2V5Y29kZSAgIDMgPSBudWwgICAgICAgICAgICAgCisJYWx0CWtleWNvZGUgICAzID0gTWV0YV90d28gICAgICAgIAora2V5Y29kZSAgIDQgPSB0aHJlZSAgICAgICAgICAgIG51bWJlcnNpZ24gICAgICAKKwljb250cm9sIGtleWNvZGUgICA0ID0gRXNjYXBlICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgIDQgPSBNZXRhX3RocmVlICAgICAgCitrZXljb2RlICAgNSA9IGZvdXIgICAgICAgICAgICAgZG9sbGFyICAgICAgICAgICBkb2xsYXIgICAgICAgICAgCisJY29udHJvbCBrZXljb2RlICAgNSA9IENvbnRyb2xfYmFja3NsYXNoCisJYWx0ICAgICBrZXljb2RlICAgNSA9IE1ldGFfZm91ciAgICAgICAKK2tleWNvZGUgICA2ID0gZml2ZSAgICAgICAgICAgICBwZXJjZW50ICAgICAgICAgCisJY29udHJvbCBrZXljb2RlICAgNiA9IENvbnRyb2xfYnJhY2tldHJpZ2h0CisJYWx0ICAgICBrZXljb2RlICAgNiA9IE1ldGFfZml2ZSAgICAgICAKK2tleWNvZGUgICA3ID0gc2l4ICAgICAgICAgICAgICBhc2NpaWNpcmN1bSAgICAgCisJY29udHJvbCBrZXljb2RlICAgNyA9IENvbnRyb2xfYXNjaWljaXJjdW0KKwlhbHQgICAgIGtleWNvZGUgICA3ID0gTWV0YV9zaXggICAgICAgIAora2V5Y29kZSAgIDggPSBzZXZlbiAgICAgICAgICAgIGFtcGVyc2FuZCAgICAgICAgYnJhY2VsZWZ0ICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgIDggPSBDb250cm9sX3VuZGVyc2NvcmUKKwlhbHQgICAgIGtleWNvZGUgICA4ID0gTWV0YV9zZXZlbiAgICAgIAora2V5Y29kZSAgIDkgPSBlaWdodCAgICAgICAgICAgIGFzdGVyaXNrICAgICAgICAgYnJhY2tldGxlZnQgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgIDkgPSBEZWxldGUgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAgOSA9IE1ldGFfZWlnaHQgICAgICAKK2tleWNvZGUgIDEwID0gbmluZSAgICAgICAgICAgICBwYXJlbmxlZnQgICAgICAgIGJyYWNrZXRyaWdodCAgICAKKwlhbHQgICAgIGtleWNvZGUgIDEwID0gTWV0YV9uaW5lICAgICAgIAora2V5Y29kZSAgMTEgPSB6ZXJvICAgICAgICAgICAgIHBhcmVucmlnaHQgICAgICAgYnJhY2VyaWdodCAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgMTEgPSBNZXRhX3plcm8gICAgICAgCitrZXljb2RlICAxMiA9IG1pbnVzICAgICAgICAgICAgdW5kZXJzY29yZSAgICAgICBiYWNrc2xhc2ggICAgICAgCisJY29udHJvbAlrZXljb2RlICAxMiA9IENvbnRyb2xfdW5kZXJzY29yZQorCXNoaWZ0CWNvbnRyb2wJa2V5Y29kZSAgMTIgPSBDb250cm9sX3VuZGVyc2NvcmUKKwlhbHQJa2V5Y29kZSAgMTIgPSBNZXRhX21pbnVzICAgICAgCitrZXljb2RlICAxMyA9IGVxdWFsICAgICAgICAgICAgcGx1cyAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgMTMgPSBNZXRhX2VxdWFsICAgICAgCitrZXljb2RlICAxNCA9IERlbGV0ZSAgICAgICAgICAgRGVsZXRlICAgICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMTQgPSBCYWNrU3BhY2UKKwlhbHQgICAgIGtleWNvZGUgIDE0ID0gTWV0YV9EZWxldGUgICAgIAora2V5Y29kZSAgMTUgPSBUYWIgICAgICAgICAgICAgIFRhYiAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDE1ID0gTWV0YV9UYWIgICAgICAgIAora2V5Y29kZSAgMTYgPSBxICAgICAgICAgICAgICAgCitrZXljb2RlICAxNyA9IHcgICAgICAgICAgICAgICAKK2tleWNvZGUgIDE4ID0gZQorCWFsdGdyICAga2V5Y29kZSAgMTggPSBIZXhfRSAgIAora2V5Y29kZSAgMTkgPSByICAgICAgICAgICAgICAgCitrZXljb2RlICAyMCA9IHQgICAgICAgICAgICAgICAKK2tleWNvZGUgIDIxID0geSAgICAgICAgICAgICAgIAora2V5Y29kZSAgMjIgPSB1ICAgICAgICAgICAgICAgCitrZXljb2RlICAyMyA9IGkgICAgICAgICAgICAgICAKK2tleWNvZGUgIDI0ID0gbyAgICAgICAgICAgICAgIAora2V5Y29kZSAgMjUgPSBwICAgICAgICAgICAgICAgCitrZXljb2RlICAyNiA9IGJyYWNrZXRsZWZ0ICAgICAgYnJhY2VsZWZ0ICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMjYgPSBFc2NhcGUgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAyNiA9IE1ldGFfYnJhY2tldGxlZnQKK2tleWNvZGUgIDI3ID0gYnJhY2tldHJpZ2h0ICAgICBicmFjZXJpZ2h0ICAgICAgIGFzY2lpdGlsZGUgICAgICAKKwljb250cm9sIGtleWNvZGUgIDI3ID0gQ29udHJvbF9icmFja2V0cmlnaHQKKwlhbHQgICAgIGtleWNvZGUgIDI3ID0gTWV0YV9icmFja2V0cmlnaHQKK2tleWNvZGUgIDI4ID0gUmV0dXJuICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgMjggPSBNZXRhX0NvbnRyb2xfbSAgCitrZXljb2RlICAyOSA9IENvbnRyb2wgICAgICAgICAKK2tleWNvZGUgIDMwID0gYQorCWFsdGdyICAga2V5Y29kZSAgMzAgPSBIZXhfQQora2V5Y29kZSAgMzEgPSBzICAgICAgICAgICAgICAgCitrZXljb2RlICAzMiA9IGQKKwlhbHRnciAgIGtleWNvZGUgIDMyID0gSGV4X0QgICAKK2tleWNvZGUgIDMzID0gZgorCWFsdGdyICAga2V5Y29kZSAgMzMgPSBIZXhfRiAgICAgICAgICAgICAgIAora2V5Y29kZSAgMzQgPSBnICAgICAgICAgICAgICAgCitrZXljb2RlICAzNSA9IGggICAgICAgICAgICAgICAKK2tleWNvZGUgIDM2ID0gaiAgICAgICAgICAgICAgIAora2V5Y29kZSAgMzcgPSBrICAgICAgICAgICAgICAgCitrZXljb2RlICAzOCA9IGwgICAgICAgICAgICAgICAKK2tleWNvZGUgIDM5ID0gc2VtaWNvbG9uICAgICAgICBjb2xvbiAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAzOSA9IE1ldGFfc2VtaWNvbG9uICAKK2tleWNvZGUgIDQwID0gYXBvc3Ryb3BoZSAgICAgICBxdW90ZWRibCAgICAgICAgCisJY29udHJvbCBrZXljb2RlICA0MCA9IENvbnRyb2xfZyAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDQwID0gTWV0YV9hcG9zdHJvcGhlIAora2V5Y29kZSAgNDEgPSBncmF2ZSAgICAgICAgICAgIGFzY2lpdGlsZGUgICAgICAKKwljb250cm9sIGtleWNvZGUgIDQxID0gbnVsICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNDEgPSBNZXRhX2dyYXZlICAgICAgCitrZXljb2RlICA0MiA9IFNoaWZ0ICAgICAgICAgICAKK2tleWNvZGUgIDQzID0gYmFja3NsYXNoICAgICAgICBiYXIgICAgICAgICAgICAgCisJY29udHJvbCBrZXljb2RlICA0MyA9IENvbnRyb2xfYmFja3NsYXNoCisJYWx0ICAgICBrZXljb2RlICA0MyA9IE1ldGFfYmFja3NsYXNoICAKK2tleWNvZGUgIDQ0ID0geiAgICAgICAgICAgICAgIAora2V5Y29kZSAgNDUgPSB4ICAgICAgICAgICAgICAgCitrZXljb2RlICA0NiA9IGMKKwlhbHRnciAgIGtleWNvZGUgIDQ2ID0gSGV4X0MgICAKK2tleWNvZGUgIDQ3ID0gdiAgICAgICAgICAgICAgIAora2V5Y29kZSAgNDggPSBiCisJYWx0Z3IgICBrZXljb2RlICA0OCA9IEhleF9CCitrZXljb2RlICA0OSA9IG4gICAgICAgICAgICAgICAKK2tleWNvZGUgIDUwID0gbSAgICAgICAgICAgICAgIAora2V5Y29kZSAgNTEgPSBjb21tYSAgICAgICAgICAgIGxlc3MgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDUxID0gTWV0YV9jb21tYSAgICAgIAora2V5Y29kZSAgNTIgPSBwZXJpb2QgICAgICAgICAgIGdyZWF0ZXIgICAgICAgICAKKwljb250cm9sIGtleWNvZGUgIDUyID0gQ29tcG9zZSAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNTIgPSBNZXRhX3BlcmlvZCAgICAgCitrZXljb2RlICA1MyA9IHNsYXNoICAgICAgICAgICAgcXVlc3Rpb24gICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgNTMgPSBEZWxldGUgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA1MyA9IE1ldGFfc2xhc2ggICAgICAKK2tleWNvZGUgIDU0ID0gU2hpZnQgICAgICAgICAgIAora2V5Y29kZSAgNTUgPSBLUF9NdWx0aXBseSAgICAgCitrZXljb2RlICA1NiA9IEFsdCAgICAgICAgICAgICAKK2tleWNvZGUgIDU3ID0gc3BhY2UgICAgICAgICAgICBzcGFjZSAgICAgICAgICAgCisJY29udHJvbCBrZXljb2RlICA1NyA9IG51bCAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDU3ID0gTWV0YV9zcGFjZSAgICAgIAora2V5Y29kZSAgNTggPSBDYXBzX0xvY2sgICAgICAgCitrZXljb2RlICA1OSA9IEYxICAgICAgICAgICAgICAgRjExICAgICAgICAgICAgICBDb25zb2xlXzEzICAgICAgCisJY29udHJvbCBrZXljb2RlICA1OSA9IEYxICAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDU5ID0gQ29uc29sZV8xICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICA1OSA9IENvbnNvbGVfMSAgICAgICAKK2tleWNvZGUgIDYwID0gRjIgICAgICAgICAgICAgICBGMTIgICAgICAgICAgICAgIENvbnNvbGVfMTQgICAgICAKKwljb250cm9sIGtleWNvZGUgIDYwID0gRjIgICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNjAgPSBDb25zb2xlXzIgICAgICAgCisJY29udHJvbCBhbHQgICAgIGtleWNvZGUgIDYwID0gQ29uc29sZV8yICAgICAgIAora2V5Y29kZSAgNjEgPSBGMyAgICAgICAgICAgICAgIEYxMyAgICAgICAgICAgICAgQ29uc29sZV8xNSAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgNjEgPSBGMyAgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA2MSA9IENvbnNvbGVfMyAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgNjEgPSBDb25zb2xlXzMgICAgICAgCitrZXljb2RlICA2MiA9IEY0ICAgICAgICAgICAgICAgRjE0ICAgICAgICAgICAgICBDb25zb2xlXzE2ICAgICAgCisJY29udHJvbCBrZXljb2RlICA2MiA9IEY0ICAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDYyID0gQ29uc29sZV80ICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICA2MiA9IENvbnNvbGVfNCAgICAgICAKK2tleWNvZGUgIDYzID0gRjUgICAgICAgICAgICAgICBGMTUgICAgICAgICAgICAgIENvbnNvbGVfMTcgICAgICAKKwljb250cm9sIGtleWNvZGUgIDYzID0gRjUgICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNjMgPSBDb25zb2xlXzUgICAgICAgCisJY29udHJvbCBhbHQgICAgIGtleWNvZGUgIDYzID0gQ29uc29sZV81ICAgICAgIAora2V5Y29kZSAgNjQgPSBGNiAgICAgICAgICAgICAgIEYxNiAgICAgICAgICAgICAgQ29uc29sZV8xOCAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgNjQgPSBGNiAgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA2NCA9IENvbnNvbGVfNiAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgNjQgPSBDb25zb2xlXzYgICAgICAgCitrZXljb2RlICA2NSA9IEY3ICAgICAgICAgICAgICAgRjE3ICAgICAgICAgICAgICBDb25zb2xlXzE5ICAgICAgCisJY29udHJvbCBrZXljb2RlICA2NSA9IEY3ICAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDY1ID0gQ29uc29sZV83ICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICA2NSA9IENvbnNvbGVfNyAgICAgICAKK2tleWNvZGUgIDY2ID0gRjggICAgICAgICAgICAgICBGMTggICAgICAgICAgICAgIENvbnNvbGVfMjAgICAgICAKKwljb250cm9sIGtleWNvZGUgIDY2ID0gRjggICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNjYgPSBDb25zb2xlXzggICAgICAgCisJY29udHJvbCBhbHQgICAgIGtleWNvZGUgIDY2ID0gQ29uc29sZV84ICAgICAgIAora2V5Y29kZSAgNjcgPSBGOSAgICAgICAgICAgICAgIEYxOSAgICAgICAgICAgICAgQ29uc29sZV8yMSAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgNjcgPSBGOSAgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA2NyA9IENvbnNvbGVfOSAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgNjcgPSBDb25zb2xlXzkgICAgICAgCitrZXljb2RlICA2OCA9IEYxMCAgICAgICAgICAgICAgRjIwICAgICAgICAgICAgICBDb25zb2xlXzIyICAgICAgCisJY29udHJvbCBrZXljb2RlICA2OCA9IEYxMCAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDY4ID0gQ29uc29sZV8xMCAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICA2OCA9IENvbnNvbGVfMTAgICAgICAKK2tleWNvZGUgIDY5ID0gTnVtX0xvY2sKKwlzaGlmdCAgIGtleWNvZGUgIDY5ID0gQmFyZV9OdW1fTG9jawora2V5Y29kZSAgNzAgPSBTY3JvbGxfTG9jayAgICAgIFNob3dfTWVtb3J5ICAgICAgU2hvd19SZWdpc3RlcnMgIAorCWNvbnRyb2wga2V5Y29kZSAgNzAgPSBTaG93X1N0YXRlICAgICAgCisJYWx0ICAgICBrZXljb2RlICA3MCA9IFNjcm9sbF9Mb2NrICAgICAKK2tleWNvZGUgIDcxID0gS1BfNyAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNzEgPSBBc2NpaV83ICAgICAgICAgCisJYWx0Z3IgICBrZXljb2RlICA3MSA9IEhleF83ICAgICAgICAgCitrZXljb2RlICA3MiA9IEtQXzggICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDcyID0gQXNjaWlfOCAgICAgICAgIAorCWFsdGdyICAga2V5Y29kZSAgNzIgPSBIZXhfOCAgICAgICAgIAora2V5Y29kZSAgNzMgPSBLUF85ICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA3MyA9IEFzY2lpXzkgICAgICAgICAKKwlhbHRnciAgIGtleWNvZGUgIDczID0gSGV4XzkgICAgICAgICAKK2tleWNvZGUgIDc0ID0gS1BfU3VidHJhY3QgICAgIAora2V5Y29kZSAgNzUgPSBLUF80ICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA3NSA9IEFzY2lpXzQgICAgICAgICAKKwlhbHRnciAgIGtleWNvZGUgIDc1ID0gSGV4XzQgICAgICAgICAKK2tleWNvZGUgIDc2ID0gS1BfNSAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNzYgPSBBc2NpaV81ICAgICAgICAgCisJYWx0Z3IgICBrZXljb2RlICA3NiA9IEhleF81ICAgICAgICAgCitrZXljb2RlICA3NyA9IEtQXzYgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDc3ID0gQXNjaWlfNiAgICAgICAgIAorCWFsdGdyICAga2V5Y29kZSAgNzcgPSBIZXhfNiAgICAgICAgIAora2V5Y29kZSAgNzggPSBLUF9BZGQgICAgICAgICAgCitrZXljb2RlICA3OSA9IEtQXzEgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDc5ID0gQXNjaWlfMSAgICAgICAgIAorCWFsdGdyICAga2V5Y29kZSAgNzkgPSBIZXhfMSAgICAgICAgIAora2V5Y29kZSAgODAgPSBLUF8yICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA4MCA9IEFzY2lpXzIgICAgICAgICAKKwlhbHRnciAgIGtleWNvZGUgIDgwID0gSGV4XzIgICAgICAgICAKK2tleWNvZGUgIDgxID0gS1BfMyAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgODEgPSBBc2NpaV8zICAgICAgICAgCisJYWx0Z3IgICBrZXljb2RlICA4MSA9IEhleF8zICAgICAgICAgCitrZXljb2RlICA4MiA9IEtQXzAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDgyID0gQXNjaWlfMCAgICAgICAgIAorCWFsdGdyICAga2V5Y29kZSAgODIgPSBIZXhfMCAgICAgICAgIAora2V5Y29kZSAgODMgPSBLUF9QZXJpb2QgICAgICAgCisjCWFsdGdyICAgY29udHJvbCBrZXljb2RlICA4MyA9IEJvb3QgICAgICAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgODMgPSBCb290ICAgICAgICAgICAgCitrZXljb2RlICA4NCA9IExhc3RfQ29uc29sZSAgICAKK2tleWNvZGUgIDg1ID0KK2tleWNvZGUgIDg2ID0gbGVzcyAgICAgICAgICAgICBncmVhdGVyICAgICAgICAgIGJhciAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDg2ID0gTWV0YV9sZXNzICAgICAgIAora2V5Y29kZSAgODcgPSBGMTEgICAgICAgICAgICAgIEYxMSAgICAgICAgICAgICAgQ29uc29sZV8yMyAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgODcgPSBGMTEgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA4NyA9IENvbnNvbGVfMTEgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgODcgPSBDb25zb2xlXzExICAgICAgCitrZXljb2RlICA4OCA9IEYxMiAgICAgICAgICAgICAgRjEyICAgICAgICAgICAgICBDb25zb2xlXzI0ICAgICAgCisJY29udHJvbCBrZXljb2RlICA4OCA9IEYxMiAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDg4ID0gQ29uc29sZV8xMiAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICA4OCA9IENvbnNvbGVfMTIgICAgICAKK2tleWNvZGUgIDg5ID0KK2tleWNvZGUgIDkwID0KK2tleWNvZGUgIDkxID0KK2tleWNvZGUgIDkyID0KK2tleWNvZGUgIDkzID0KK2tleWNvZGUgIDk0ID0KK2tleWNvZGUgIDk1ID0KK2tleWNvZGUgIDk2ID0gS1BfRW50ZXIgICAgICAgIAora2V5Y29kZSAgOTcgPSBDb250cm9sICAgICAgICAgCitrZXljb2RlICA5OCA9IEtQX0RpdmlkZSAgICAgICAKK2tleWNvZGUgIDk5ID0gQ29udHJvbF9iYWNrc2xhc2gKKwljb250cm9sIGtleWNvZGUgIDk5ID0gQ29udHJvbF9iYWNrc2xhc2gKKwlhbHQgICAgIGtleWNvZGUgIDk5ID0gQ29udHJvbF9iYWNrc2xhc2gKK2tleWNvZGUgMTAwID0gQWx0R3IgICAgICAgICAgIAora2V5Y29kZSAxMDEgPSBCcmVhayAgICAgICAgICAgCitrZXljb2RlIDEwMiA9IEZpbmQgICAgICAgICAgICAKK2tleWNvZGUgMTAzID0gVXAgICAgICAgICAgICAgIAora2V5Y29kZSAxMDQgPSBQcmlvciAgICAgICAgICAgCisJc2hpZnQgICBrZXljb2RlIDEwNCA9IFNjcm9sbF9CYWNrd2FyZCAKK2tleWNvZGUgMTA1ID0gTGVmdCAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAxMDUgPSBEZWNyX0NvbnNvbGUKK2tleWNvZGUgMTA2ID0gUmlnaHQgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAxMDYgPSBJbmNyX0NvbnNvbGUKK2tleWNvZGUgMTA3ID0gU2VsZWN0ICAgICAgICAgIAora2V5Y29kZSAxMDggPSBEb3duICAgICAgICAgICAgCitrZXljb2RlIDEwOSA9IE5leHQgICAgICAgICAgICAKKwlzaGlmdCAgIGtleWNvZGUgMTA5ID0gU2Nyb2xsX0ZvcndhcmQgIAora2V5Y29kZSAxMTAgPSBJbnNlcnQgICAgICAgICAgCitrZXljb2RlIDExMSA9IFJlbW92ZSAgICAgICAgICAKKyMJYWx0Z3IgICBjb250cm9sIGtleWNvZGUgMTExID0gQm9vdCAgICAgICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlIDExMSA9IEJvb3QgICAgICAgICAgICAKK2tleWNvZGUgMTEyID0gTWFjcm8gICAgICAgICAgIAora2V5Y29kZSAxMTMgPSBGMTMgICAgICAgICAgICAgCitrZXljb2RlIDExNCA9IEYxNCAgICAgICAgICAgICAKK2tleWNvZGUgMTE1ID0gSGVscCAgICAgICAgICAgIAora2V5Y29kZSAxMTYgPSBEbyAgICAgICAgICAgICAgCitrZXljb2RlIDExNyA9IEYxNyAgICAgICAgICAgICAKK2tleWNvZGUgMTE4ID0gS1BfTWluUGx1cyAgICAgIAora2V5Y29kZSAxMTkgPSBQYXVzZSAgICAgICAgICAgCitrZXljb2RlIDEyMCA9CitrZXljb2RlIDEyMSA9CitrZXljb2RlIDEyMiA9CitrZXljb2RlIDEyMyA9CitrZXljb2RlIDEyNCA9CitrZXljb2RlIDEyNSA9CitrZXljb2RlID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25lZCBjaGFyCXN0b3BjOwkJCQkvKiBmbG93IGNudGwgc3RvcCBjaGFyCSovCit9OworCit0eXBlZGVmIHN0cnVjdCBkaWdpZmxvd19zdHJ1Y3QgZGlnaWZsb3dfdDsKKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBWYWx1ZXMgZm9yIGRpZ2lfZmxhZ3MgCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBESUdJX0lYT04JMHgwMDAxCQkvKiBIYW5kbGUgSVhPTiBpbiB0aGUgRkVQCSovCisjZGVmaW5lIERJR0lfRkFTVAkweDAwMDIJCS8qIEZhc3QgYmF1ZCByYXRlcwkJKi8KKyNkZWZpbmUgUlRTUEFDRQkJMHgwMDA0CQkvKiBSVFMgaW5wdXQgZmxvdyBjb250cm9sCSovCisjZGVmaW5lIENUU1BBQ0UJCTB4MDAwOAkJLyogQ1RTIG91dHB1dCBmbG93IGNvbnRyb2wJKi8KKyNkZWZpbmUgRFNSUEFDRQkJMHgwMDEwCQkvKiBEU1Igb3V0cHV0IGZsb3cgY29udHJvbAkqLworI2RlZmluZSBEQ0RQQUNFCQkweDAwMjAJCS8qIERDRCBvdXRwdXQgZmxvdyBjb250cm9sCSovCisjZGVmaW5lIERUUlBBQ0UJCTB4MDA0MAkJLyogRFRSIGlucHV0IGZsb3cgY29udHJvbAkqLworI2RlZmluZSBESUdJX0ZPUkNFRENECTB4MDEwMAkJLyogRm9yY2UgY2FycmllcgkJKi8KKyNkZWZpbmUJRElHSV9BTFRQSU4JMHgwMjAwCQkvKiBBbHRlcm5hdGUgUkotNDUgcGluIGNvbmZpZwkqLworI2RlZmluZQlESUdJX0FJWE9OCTB4MDQwMAkJLyogQXV4IGZsb3cgY29udHJvbCBpbiBmZXAJKi8KKworCisvKioqKioqKioqKio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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIERJR0lfSVhPTgkweDAwMDEJCS8qIEhhbmRsZSBJWE9OIGluIHRoZSBGRVAJKi8KKyNkZWZpbmUgRElHSV9GQVNUCTB4MDAwMgkJLyogRmFzdCBiYXVkIHJhdGVzCQkqLworI2RlZmluZSBSVFNQQUNFCQkweDAwMDQJCS8qIFJUUyBpbnB1dCBmbG93IGNvbnRyb2wJKi8KKyNkZWZpbmUgQ1RTUEFDRQkJMHgwMDA4CQkvKiBDVFMgb3V0cHV0IGZsb3cgY29udHJvbAkqLworI2RlZmluZSBEU1JQQUNFCQkweDAwMTAJCS8qIERTUiBvdXRwdXQgZmxvdyBjb250cm9sCSovCisjZGVmaW5lIERDRFBBQ0UJCTB4MDAyMAkJLyogRENEIG91dHB1dCBmbG93IGNvbnRyb2wJKi8KKyNkZWZpbmUgRFRSUEFDRQkJMHgwMDQwCQkvKiBEVFIgaW5wdXQgZmxvdyBjb250cm9sCSovCisjZGVmaW5lIERJR0lfRk9SQ0VEQ0QJMHgwMTAwCQkvKiBGb3JjZSBjYXJyaWVyCQkqLworI2RlZmluZQlESUdJX0FMVFBJTgkweDAyMDAJCS8qIEFsdGVybmF0ZSBSSi00NSBwaW4gY29uZmlnCSovCisjZGVmaW5lCURJR0lfQUlYT04JMHgwNDAwCQkvKiBBdXggZmxvdyBjb250cm9sIGluIGZlcAkqLworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIFZhbHVlcyBmb3IgZGlnaURsb2FkCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBOT1JNQUwgIDAKKyNkZWZpbmUgUENJX0NUTCAxCisKKyNkZWZpbmUgU0laRTggIDAKKyNkZWZpbmUgU0laRTE2IDEK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AgIDB4RUMKKyNkZWZpbmUgUEFVU0VSWCAgICAgICAgMHhFRQorI2RlZmluZSBSRVNVTUVSWCAgICAgICAweEVGCisjZGVmaW5lIFNFVEJVRkZFUiAgICAgIDB4RjIKKyNkZWZpbmUgU0VUQ09PS0VEICAgICAgMHhGMworI2RlZmluZSBTRVRIRkxPVyAgICAgICAweEY0CisjZGVmaW5lIFNFVENUUkxGTEFHUyAgIDB4RjUKKyNkZWZpbmUgU0VUVk5FWFQgICAgICAgMHhGNgorCisKKworI2RlZmluZSBCUkVBS19JTkQgICAgICAgIDB4MDEKKyNkZWZpbmUgTE9XVFhfSU5EICAgICAgICAweDAyCisjZGVmaW5lIEVNUFRZVFhfSU5EICAgICAgMHgwNAorI2RlZmluZSBEQVRBX0lORCAgICAgICAgIDB4MDgKKyNkZWZpbmUgTU9ERU1DSEdfSU5EICAgICAweDIwCisKKyNkZWZpbmUgRkVQX0hVUENMICAwMDAyMDAwCisjaWYgMAorI2RlZmluZSBSVFMgICAweDAyCisjZGVmaW5lIENEICAgIDB4MDgKKyNkZWZpbmUgRFNSICAgMHgxMAorI2RlZmluZSBDVFMgICAweDIwCisjZGVmaW5lIFJJICAgIDB4NDAKKyNkZWZpbmUgRFRSICAgMHg4MAorI2VuZGlmCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvZGlnaVBDSS5oIGIvZHJpdmVycy9jaGFyL2RpZ2lQQ0kuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi42Y2E3ODE5Ci0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL2RpZ2lQQ0kuaApAQCAtMCwwICsxLDQyIEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogRGVmaW5lcyBhbmQgc3RydWN0dXJlIGRlZmluaXRpb25zIGZvciBQQ0kgQklPUyBJbnRlcmZhY2UgCisgKioqKioq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mNsdWRlIDxsaW51eC9wb2xsLmg+CisjaW5jbHVkZSA8YXNtL3BnYWxsb2MuaD4KKyNpbmNsdWRlICJkcm0uaCIKKworI2RlZmluZSBfX09TX0hBU19BR1AgKGRlZmluZWQoQ09ORklHX0FHUCkgfHwgKGRlZmluZWQoQ09ORklHX0FHUF9NT0RVTEUpICYmIGRlZmluZWQoTU9EVUxFKSkpCisjZGVmaW5lIF9fT1NfSEFTX01UUlIgKGRlZmluZWQoQ09ORklHX01UUlIpKQorCisjaW5jbHVkZSAiZHJtX29zX2xpbnV4LmgiCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKiBcbmFtZSBEUk0gdGVtcGxhdGUgY3VzdG9taXphdGlvbiBkZWZhdWx0cyAqLworLypAeyovCisKKy8qIGRyaXZlciBjYXBhYmlsaXRpZXMgYW5kIHJlcXVpcmVtZW50cyBtYXNrICovCisjZGVmaW5lIERSSVZFUl9VU0VfQUdQICAgICAweDEKKyNkZWZpbmUgRFJJVkVSX1JFUVVJUkVfQUdQIDB4MgorI2RlZmluZSBEUklWRVJfVVNFX01UUlIgICAgMHg0CisjZGVmaW5lIERSSVZFUl9QQ0lfRE1BICAgICAweDgKKyNkZWZpbmUgRFJJVkVSX1NHICAgICAgICAgIDB4MTAKKyNkZWZpbmUgRFJJVkVSX0hBVkVfRE1BICAgIDB4MjAKKyNkZWZpbmUgRFJJVkVSX0hBVkVfSVJRICAgIDB4NDAKKyNkZWZpbmUgRFJJVkVSX0lSUV9TSEFSRUQgIDB4ODAKKyNkZWZpbmUgRFJJVkVSX0lSUV9WQkwgICAgIDB4MTAwCisjZGVmaW5lIERSSVZFUl9ETUFfUVVFVUUgICAweDIwMAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiogXG5hbWUgQmVnaW4gdGhlIER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CisjZGVmaW5lIERSTV9NRU1fVk1BUwkgICA2CisjZGVmaW5lIERSTV9NRU1fQlVGUwkgICA3CisjZGVmaW5lIERSTV9NRU1fU0VHUwkgICA4CisjZGVmaW5lIERSTV9NRU1fUEFHRVMJICAgOQorI2RlZmluZSBEUk1fTUVNX0ZJTEVTCSAgMTAKKyNkZWZpbmUgRFJNX01FTV9RVUVVRVMJICAxMQorI2RlZmluZSBEUk1fTUVNX0NNRFMJICAxMgorI2RlZmluZSBEUk1fTUVNX01BUFBJTkdTICAxMworI2RlZmluZSBEUk1fTUVNX0JVRkxJU1RTICAxNAorI2RlZmluZSBEUk1fTUVNX0FHUExJU1RTICAxNQorI2RlZmluZSBEUk1fTUVNX1RPVEFMQUdQICAxNgorI2RlZmluZSBEUk1fTUVNX0JPVU5EQUdQICAxNworI2RlZmluZSBEUk1fTUVNX0NUWEJJVE1BUCAxOAorI2RlZmluZSBEUk1fTUVNX1NUVUIgICAgICAxOQorI2RlZmluZSBEUk1fTUVNX1NHTElTVFMgICAyMAorI2RlZmluZSBEUk1fTUVNX0NUWExJU1QgIDIxCisKKyNkZWZpbmUgRFJNX01BWF9DVFhCSVRNQVAgKFBBR0VfU0laRSAqIDgpCisJCisvKkB9Ki8KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiogXG5hbWUgQmFja3dhcmQgY29tcGF0aWJpbGl0eSBzZWN0aW9uICovCisvKkB7Ki8KKworI2lmbmRlZiBNT0RVTEVfTElDRU5TRQorI2RlZmluZSBNT0RVTEVfTElDRU5TRSh4KSAKKyNlbmRpZgorCisjaWZuZGVmIHByZWVtcHRfZGlzYWJsZQorI2RlZmluZSBwcmVlbXB0X2Rpc2FibGUoKQorI2RlZmluZSBwcmVlbXB0X2VuYWJsZSgpCisjZW5kaWYKKworI2lmbmRlZiBwdGVfb2Zmc2V0X21hcCAKKyNkZWZpbmUgcHRlX29mZnNld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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyoqIFxuYW1lIE1hY3JvcyB0byBtYWtlIHByaW50ayBlYXNpZXIgKi8KKy8qQHsqLworCisvKioKKyAqIEVycm9yIG91dHB1dC4KKyAqCisgKiBccGFyYW0gZm10IHByaW50ZigpIGxpa2UgZm9ybWF0IHN0cmluZy4KKyAqIFxwYXJhbSBhcmcgYXJndW1lbnRzCisgKi8KKyNkZWZpbmUgRFJNX0VSUk9SKGZtdCwgYXJnLi4uKSBcCisJcHJpbnRrKEtFUk5fRVJSICJbIiBEUk1fTkFNRSAiOiVzXSAqRVJST1IqICIgZm10ICwgX19GVU5DVElPTl9fICwgIyNhcmcpCisKKy8qKgorICogTWVtb3J5IGVycm9yIG91dHB1dC4KKyAqCisgKiBccGFyYW0gYXJlYSBtZW1vcnkgYXJlYSB3aGVyZSB0aGUgZXJyb3Igb2NjdXJyZWQuCisgKiBccGFyYW0gZm10IHByaW50ZigpIGxpa2UgZm9ybWF0IHN0cmluZy4KKyAqIFxwYXJhbSBhcmcgYXJndW1lbnRzCisgKi8KKyNkZWZpbmUgRFJNX01FTV9FUlJPUihhcmVhLCBmbXQsIGFyZy4uLikgXAorCXByaW50ayhLRVJOX0VSUiAiWyIgRFJNX05BTUUgIjolczolc10gKkVSUk9SKiAiIGZtdCAsIF9fRlVOQ1RJT05fXywgXAorCSAgICAgICBkcm1fbWVtX3N0YXRzW2FyZWFdLm5hbWUgLCAjI2FyZykKKworI2RlZmluZSBEUk1fSU5GTyhmbXQsIGFyZy4uLikgIHByaW50ayhLRVJOX0lORk8gIlsiIERSTV9OQU1FICJdICIgZm10ICwgIyNhcmcpCisKKy8qKgorICogRGVidWcgb3V0cHV0LgorICogCisgKiBccGFyYW0gZm10IHByaW50ZigpIGxpa2UgZm9ybWF0IHN0cmluZy4KKyAqIFxwYXJhbSBhcmcgYXJndW1lbnRzCisgKi8KKyNpZiBEUk1fREVCV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WNlIHN0cnVjdHVyZSAqLworCWludCAgICAgICAgICAgICAgIHBjaV9kb21haW47CS8qKjwgUENJIGJ1cyBkb21haW4gbnVtYmVyICovCisJaW50ICAgICAgICAgICAgICAgcGNpX2J1czsJLyoqPCBQQ0kgYnVzIG51bWJlciAqLworCWludCAgICAgICAgICAgICAgIHBjaV9zbG90OwkvKio8IFBDSSBzbG90IG51bWJlciAqLworCWludCAgICAgICAgICAgICAgIHBjaV9mdW5jOwkvKio8IFBDSSBmdW5jdGlvbiBudW1iZXIgKi8KKyNpZmRlZiBfX2FscGhhX18KKyNpZiBMSU5VWF9WRVJTSU9OX0NPREUgPCBLRVJORUxfVkVSU0lPTigyLDQsMykKKwlzdHJ1Y3QgcGNpX2NvbnRyb2xlciAqaG9zZTsKKyNlbHNlCisJc3RydWN0IHBjaV9jb250cm9sbGVyICpob3NlOworI2VuZGlmCisjZW5kaWYKKwlkcm1fc2dfbWVtX3QgICAgICAqc2c7ICAvKio8IFNjYXR0ZXIgZ2F0aGVyIG1lbW9yeSAqLworCXVuc2lnbmVkIGxvbmcgICAgICpjdHhfYml0bWFwOwkvKio8IGNvbnRleHQgYml0bWFwICovCisJdm9pZAkJICAqZGV2X3ByaXZhdGU7IC8qKjwgZGV2aWNlIHByaXZhdGUgZGF0YSAqLworCWRybV9zaWdkYXRhX3QgICAgIHNpZ2RhdGE7IC8qKjwgRm9yIGJsb2NrX2FsbF9zaWduYWxzICovCisJc2lnc2V0X3QgICAgICAgICAgc2lnbWFzazsKKworCXN0cnVjdCAgICAgICAgICAgIGRybV9kcml2ZXIgKmRyaXZlcjsKKwlkcm1fbG9jYWxfbWFwX3QgICAqYWdwX2J1ZmZlcl9tYXA7CisJZHJtX2hlYWRfdCBwcmltYXJ5OwkJLyoqPCBwcmltYXJ5IHNjcmVlbiBoZWFkICovCit9IGRybV9kZXZpY2VfdDsKKworc3RhdGljIF9faW5saW5lX18gaW50IGRybV9jb3JlX2NoZWNrX2ZlYXR1cmUoc3RydWN0IGRybV9kZXZpY2UgKmRldiwgaW50IGZlYXR1cmUpCit7CisJcmV0dXJuICgoZGV2LT5kcml2ZXItPmRyaXZlcl9mZWF0dXJlcyAmIGZlYXR1cmUpID8gMSA6IDApOworfQorCisjaWYgX19PU19IQVNfQUdQCitzdGF0aWMgaW5saW5lIGludCBkcm1fY29yZV9oYXNfQUdQKHN0cnVjdCBkcm1fZGV2aWNlICpkZXYpCit7CisgIHJldHVybiBkcm1fY29yZV9jaGVja19mZWF0dXJlKGRldiwgRFJJVkVSX1VTRV9BR1ApOworfQorI2Vsc2UKKyNkZWZpbmUgZHJtX2NvcmVfaGFzX0FHUChkZXYpICgwKQorI2VuZGlmCisKKyNpZiBfX09TX0hBU19NVFJSCitzdGF0aWMgaW5saW5lIGludCBkcm1fY29yZV9oYXNfTVRSUihzdHJ1Y3QgZHJtX2RldmljZSAqZGV2KQoreworICByZXR1cm4gZHJtX2NvcmVfY2hlY2tfZmVhdHVyZShkZXYsIERSSVZFUl9VU0VfTVRSUik7Cit9CisjZWxzZQorI2RlZmluZSBkcm1fY29yZV9oYXNfTVRSUihkZXYpICgwKQorI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiogXG5hbWUgSW50ZXJuYWwgZnVuY3Rpb24gZGVmaW5pdGlvbnMgKi8KKy8qQHsqLworCisJCQkJLyogTWlzYy4gc3VwcG9ydCAoZHJtX2luaXQuaCkgKi8KK2V4dGVybiBpbnQJICAgICBkcm1fZmxhZ3M7CitleHRlcm4gdm9pZAkgICAgIGRybV9wYXJzZV9vcHRpb25zKCBjaGFyICpzICk7CitleHRlcm4gaW50ICAgICAgICAgICBkcm1fY3B1X3ZhbGlkKCB2b2lkICk7CisKKwkJCQkvKiBEcml2ZXIgc3VwcG9ydCAoZHJtX2Rydi5oKSAqLworZXh0ZXJuIGludCAgICAgICAgICAgZHJtX2luaXQoc3RydWN0IGRybV9kcml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1lbnQgPSAocmVxdWVzdC5mbGFncyAmIF9EUk1fUEFHRV9BTElHTikKKwkJPyBQQUdFX0FMSUdOKHNpemUpIDogc2l6ZTsKKwlwYWdlX29yZGVyID0gb3JkZXIgLSBQQUdFX1NISUZUID4gMCA/IG9yZGVyIC0gUEFHRV9TSElGVCA6IDA7CisJdG90YWwgPSBQQUdFX1NJWkUgPDwgcGFnZV9vcmRlcjsKKworCXNwaW5fbG9jayggJmRldi0+Y291bnRfbG9jayApOworCWlmICggZGV2LT5idWZfdXNlICkgeworCQlzcGluX3VubG9jayggJmRldi0+Y291bnRfbG9jayApOworCQlyZXR1cm4gLUVCVVNZOworCX0KKwlhdG9taWNfaW5jKCAmZGV2LT5idWZfYWxsb2MgKTsKKwlzcGluX3VubG9jayggJmRldi0+Y291bnRfbG9jayApOworCisJZG93biggJmRldi0+c3RydWN0X3NlbSApOworCWVudHJ5ID0gJmRtYS0+YnVmc1tvcmRlcl07CisJaWYgKCBlbnRyeS0+YnVmX2NvdW50ICkgeworCQl1cCggJmRldi0+c3RydWN0X3NlbSApOworCQlhdG9taWNfZGVjKCAmZGV2LT5idWZfYWxsb2MgKTsKKwkJcmV0dXJuIC1FTk9NRU07CS8qIE1heSBvbmx5IGNhbGwgb25jZSBmb3IgZWFjaCBvcmRlciAqLworCX0KKworCWlmIChjb3VudCA8IDAgfHwgY291bnQgPiA0MDk2KSB7CisJCXVwKCAmZGV2LT5zdHJ1Y3Rfc2VtICk7CisJCWF0b21pY19kZWMoICZkZXYtPmJ1Zl9hbGxvYyApOworCQlyZXR1cm4gLUVJTlZBTDsKKwl9CisKKwllbnRyeS0+YnVmbGlzdCA9IGRybV9hbGxvYyggY291bnQgKiBzaXplb2YoKmVudHJ5LT5idWZsaXN0KSwKKwkJCQkgICAgRFJNX01FTV9CVUZTICk7CisJaWYgKCAhZW50cnktPmJ1Zmxpc3QgKSB7CisJCXVwKCAmZGV2LT5zdHJ1Y3Rfc2VtICk7CisJCWF0b21pY19kZWMoICZ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WdwX3N0YXJ0OworCisJRFJNX0RFQlVHKCAiY291bnQ6ICAgICAgJWRcbiIsICBjb3VudCApOworCURSTV9ERUJVRyggIm9yZGVyOiAgICAgICVkXG4iLCAgb3JkZXIgKTsKKwlEUk1fREVCVUcoICJzaXplOiAgICAgICAlZFxuIiwgIHNpemUgKTsKKwlEUk1fREVCVUcoICJhZ3Bfb2Zmc2V0OiAlbHVcbiIsIGFncF9vZmZzZXQgKTsKKwlEUk1fREVCVUcoICJhbGlnbm1lbnQ6ICAlZFxuIiwgIGFsaWdubWVudCApOworCURSTV9ERUJVRyggInBhZ2Vfb3JkZXI6ICVkXG4iLCAgcGFnZV9vcmRlciApOworCURSTV9ERUJVRyggInRvdGFsOiAgICAgICVkXG4iLCAgdG90YWwgKTsKKworCWlmICggb3JkZXIgPCBEUk1fTUlOX09SREVSIHx8IG9yZGVyID4gRFJNX01BWF9PUkRFUiApIHJldHVybiAtRUlOVkFMOworCWlmICggZGV2LT5xdWV1ZV9jb3VudCApIHJldHVybiAtRUJVU1k7IC8qIE5vdCB3aGlsZSBpbiB1c2UgKi8KKworCXNwaW5fbG9jayggJmRldi0+Y291bnRfbG9jayApOworCWlmICggZGV2LT5idWZfdXNlICkgeworCQlzcGluX3VubG9jayggJmRldi0+Y291bnRfbG9jayApOworCQlyZXR1cm4gLUVCVVNZOworCX0KKwlhdG9taWNfaW5jKCAmZGV2LT5idWZfYWxsb2MgKTsKKwlzcGluX3VubG9jayggJmRldi0+Y291bnRfbG9jayApOworCisJZG93biggJmRldi0+c3RydWN0X3NlbSApOworCWVudHJ5ID0gJmRtYS0+YnVmc1tvcmRlcl07CisJaWYgKCBlbnRyeS0+YnVmX2NvdW50ICkgeworCQl1cCggJmRldi0+c3RydWN0X3NlbSApOworCQlhdG9taWNfZGVjKCAmZGV2LT5idWZfYWxsb2MgKTsKKwkJcmV0dXJuIC1FTk9NRU07IC8qIE1heSBvbmx5IGNhbGwgb25jZSBmb3IgZWFjaCBvcmRlciAqLworCX0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zIGhlbGQsIGNsZWFycyB0aGUgZHJtX2RldmljZTo6Y29udGV4dF9mbGFnIGFuZCB3YWtlcyB1cAorICogZHJtX2RldmljZTo6Y29udGV4dF93YWl0LgorICovCitpbnQgZHJtX2NvbnRleHRfc3dpdGNoX2NvbXBsZXRlKCBkcm1fZGV2aWNlX3QgKmRldiwgaW50IG5ldyApCit7CisgICAgICAgIGRldi0+bGFzdF9jb250ZXh0ID0gbmV3OyAgLyogUFJFL1BPU1Q6IFRoaXMgaXMgdGhlIF9vbmx5XyB3cml0ZXIuICovCisgICAgICAgIGRldi0+bGFzdF9zd2l0Y2ggID0gamlmZmllczsKKworICAgICAgICBpZiAoICFfRFJNX0xPQ0tfSVNfSEVMRChkZXYtPmxvY2suaHdfbG9jay0+bG9jaykgKSB7CisgICAgICAgICAgICAgICAgRFJNX0VSUk9SKCAiTG9jayBpc24ndCBoZWxkIGFmdGVyIGNvbnRleHQgc3dpdGNoXG4iICk7CisgICAgICAgIH0KKworCQkJCS8qIElmIGEgY29udGV4dCBzd2l0Y2ggaXMgZXZlciBpbml0aWF0ZWQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hlbiB0aGUga2VybmVsIGhvbGRzIHRoZSBsb2NrLCByZWxlYXNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQgbG9jayBoZXJlLiAqLworICAgICAgICBjbGVhcl9iaXQoIDAsICZkZXYtPmNvbnRleHRfZmxhZyApOworICAgICAgICB3YWtlX3VwKCAmZGV2LT5jb250ZXh0X3dhaXQgKTsKKworICAgICAgICByZXR1cm4gMDsKK30KKworLyoqCisgKiBSZXNlcnZlIGNvbnRleHRzLgorICoKKyAqIFxwYXJhbSBpbm9kZSBkZXZpY2UgaW5vZGUuCisgKiBccGFyYW0gZmlscCBmaWxlIHBvaW50ZXIuCisgKiBccGFyYW0gY21kIGNvbW1hbmQuCisgKiBccGFyYW0gYXJnIHVzZXIgYXJndW1lbnQgcG9pbnR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GlzIG9wZW4sIHRoZW4gY2FsbHMgc2V0dXAoKS4KKyAqLworaW50IGRybV9vcGVuKCBzdHJ1Y3QgaW5vZGUgKmlub2RlLCBzdHJ1Y3QgZmlsZSAqZmlscCApCit7CisJZHJtX2RldmljZV90ICpkZXYgPSBOVUxMOworCWludCBtaW5vciA9IGltaW5vcihpbm9kZSk7CisJaW50IHJldGNvZGUgPSAwOworCisJaWYgKCEoKG1pbm9yID49IDApICYmIChtaW5vciA8IGRybV9jYXJkc19saW1pdCkpKQorCQlyZXR1cm4gLUVOT0RFVjsKKwkJCisJaWYgKCFkcm1faGVhZHNbbWlub3JdKQorCQlyZXR1cm4gLUVOT0RFVjsKKworCWlmICghKGRldiA9IGRybV9oZWFkc1ttaW5vcl0tPmRldikpCisJCXJldHVybiAtRU5PREVWOworCQorCXJldGNvZGUgPSBkcm1fb3Blbl9oZWxwZXIoIGlub2RlLCBmaWxwLCBkZXYgKTsKKwlpZiAoICFyZXRjb2RlICkgeworCQlhdG9taWNfaW5jKCAmZGV2LT5jb3VudHNbX0RSTV9TVEFUX09QRU5TXSApOworCQlzcGluX2xvY2soICZkZXYtPmNvdW50X2xvY2sgKTsKKwkJaWYgKCAhZGV2LT5vcGVuX2NvdW50KysgKSB7CisJCQlzcGluX3VubG9jayggJmRldi0+Y291bnRfbG9jayApOworCQkJcmV0dXJuIGRybV9zZXR1cCggZGV2ICk7CisJCX0KKwkJc3Bpbl91bmxvY2soICZkZXYtPmNvdW50X2xvY2sgKTsKKwl9CisKKwlyZXR1cm4gcmV0Y29kZTsKK30KK0VYUE9SVF9TWU1CT0woZHJtX29wZW4pOworCisvKioKKyAqIFJlbGVhc2UgZmlsZS4KKyAqCisgKiBccGFyYW0gaW5vZGUgZGV2aWNlIGlub2RlCisgKiBccGFyYW0gZmlscCBmaWxlIHBvaW50ZXIuCisgKiBccmV0dXJuIHplcm8gb24gc3VjY2VzcyBvciBhIG5lZ2F0aXZlIG51bWJlciBvbiBmYWlsdXJlLgorICoKKyAqIElmIHRoZSBoYXJkd2FyZSBsb2NrIGlzIGhlbGQgdGhlbiBmcmVlIGl0LCBhbmQgdGFrZSBpdCBhZ2FpbiBmb3IgdGhlIGtlcm5lbAorICogY29udGV4dCBzaW5jZSBpdCdzIG5lY2Vzc2FyeSB0byByZWNsYWltIGJ1ZmZlcnMuIFVubGluayB0aGUgZmlsZSBwcml2YXRlCisgKiBkYXRhIGZyb20gaXRzIGxpc3QgYW5kIGZyZWUgaXQuIERlY3JlYXNlcyB0aGUgb3BlbiBjb3VudCBhbmQgaWYgaXQgcmVhY2hlcworICogemVybyBjYWxscyB0YWtlZG93bigpLgorICovCitpbnQgZHJtX3JlbGVhc2UoIHN0cnVjdCBpbm9kZSAqaW5vZGUsIHN0cnVjdCBmaWxlICpmaWxwICkKK3sKKwlkcm1fZmlsZV90ICpwcml2ID0gZmlscC0+cHJpdmF0ZV9kYXRhOworCWRybV9kZXZpY2VfdCAqZGV2OworCWludCByZXRjb2RlID0gMDsKKworCWxvY2tfa2VybmVsKCk7CisJZGV2ID0gcHJpdi0+aGVhZC0+ZGV2OworCisJRFJNX0RFQlVHKCAib3Blbl9jb3VudCA9ICVkXG4iLCBkZXYtPm9wZW5fY291bnQgKTsKKworCWlmIChkZXYtPmRyaXZlci0+cHJlcmVsZWFzZSkKKwkJZGV2LT5kcml2ZXItPnByZXJlbGVhc2UoZGV2LCBmaWxwKTsKKworCS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisJICogQmVnaW4gaW5saW5lIGRybV9yZWxlYXNlCisJICovCisKKwlEUk1fREVCVUcoICJwaWQgPSAlZCwgZGV2aWNlID0gMHglbHgsIG9wZW5fY291bnQgPSAlZFxuIiwKKwkJICAgY3VycmVudC0+cGlkLCAobG9uZylvbGRfZW5jb2RlX2Rldihwcml2LT5oZWFkLT5kZXZpY2UpLCBkZXYtPm9wZW5fY291bnQgKTsKKworCWlmICggcHJpdi0+bG9ja19jb3VudCAmJiBkZXYtPmxvY2suaHdfbG9jayAmJgorCSAgICAgX0RSTV9MT0NLX0lTX0hFTEQoZGV2LT5sb2NrLmh3X2xvY2stPmxvY2spICYmCisJICAgICBkZXYtPmxvY2suZmlscCA9PSBmaWxwICkgeworCQlEUk1fREVCVUcoICJGaWxlICVwIHJlbGVhc2VkLCBmcmVlaW5nIGxvY2sgZm9yIGNvbnRleHQgJWRcbiIsCisJCQlmaWxwLAorCQkJX0RSTV9MT0NLSU5HX0NPTlRFWFQoZGV2LT5sb2NrLmh3X2xvY2stPmxvY2spICk7CisJCQorCQlpZiAoZGV2LT5kcml2ZXItPnJlbGVhc2UpCisJCQlkZXYtPmRyaXZlci0+cmVsZWFzZShkZXYsIGZpbHApOworCisJCWRybV9sb2NrX2ZyZWUoIGRldiwgJmRldi0+bG9jay5od19sb2NrLT5sb2NrLAorCQkJCV9EUk1fTE9DS0lOR19DT05URVhUKGRldi0+bG9jay5od19sb2NrLT5sb2NrKSApOworCisJCQkJLyogRklYTUU6IG1heSByZXF1aXJlIGhlYXZ5LWhhbmRlZCByZXNldCBvZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXJkd2FyZSBhdCB0aGlzIHBvaW50LCBwb3NzaWJseQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzZWQgdmlhIGEgY2FsbGJhY2sgdG8gdGhlIFgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyLiAqLworCX0KKwllbHNlIGlmICggZGV2LT5kcml2ZXItPnJlbGVhc2UgJiYgcHJpdi0+bG9ja19jb3VudCAmJiBkZXYtPmxvY2suaHdfbG9jayApIHsKKwkJLyogVGhlIGxvY2sgaXMgcmVxdWlyZWQgdG8gcmVjbGFpbSBidWZmZXJzICovCisJCURFQ0xBUkVfV0FJVFFVRVVFKCBlbnRyeSwgY3VycmVudCApOworCisJCWFkZF93YWl0X3F1ZXVlKCAmZGV2LT5sb2NrL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IHwgX0RSTV9MT0NLX0hFTEQpKSB7CisJCQkJLyogSGF2ZSBsb2NrICovCisJCXJldHVybiAxOworCX0KKwlyZXR1cm4gMDsKK30KKworLyoqCisgKiBUaGlzIHRha2VzIGEgbG9jayBmb3JjaWJseSBhbmQgaGFuZHMgaXQgdG8gY29udGV4dC4JU2hvdWxkIE9OTFkgYmUgdXNlZAorICogaW5zaWRlICpfdW5sb2NrIHRvIGdpdmUgbG9jayB0byBrZXJuZWwgYmVmb3JlIGNhbGxpbmcgKl9kbWFfc2NoZWR1bGUuIAorICogCisgKiBccGFyYW0gZGV2IERSTSBkZXZpY2UuCisgKiBccGFyYW0gbG9jayBsb2NrIHBvaW50ZXIuCisgKiBccGFyYW0gY29udGV4dCBsb2NraW5nIGNvbnRleHQuCisgKiBccmV0dXJuIGFsd2F5cyBvbmUuCisgKgorICogUmVzZXRzIHRoZSBsb2NrIGZpbGUgcG9pbnRlci4KKyAqIE1hcmtzIHRoZSBsb2NrIGFzIGhlbGQgYnkgdGhlIGdpdmVuIGNvbnRleHQsIHZpYSB0aGUgXHAgY21weGNoZyBpbnN0cnVjdGlvbi4KKyAqLworaW50IGRybV9sb2NrX3RyYW5zZmVyKGRybV9kZXZpY2VfdCAqZGV2LAorCQkgICAgICAgX192b2xhdGlsZV9fIHVuc2lnbmVkIGludCAqbG9jaywgdW5zaWduZWQgaW50IGNvbnRleHQpCit7CisJdW5zaWduZWQgaW50IG9sZCwgbmV3LCBwcmV2OworCisJZGV2LT5sb2NrLmZpbHAgPSBOVUxMOworCWRvIHsKKwkJb2xkICA9ICpsb2NrOworCQluZXcgID0gY29udGV4dCB8IF9EUk1fTE9DS19IRUxEOworCQlwcmV2ID0gY21weGNoZyhsb2NrLCBvbGQsIG5ldyk7CisJfSB3aGlsZSAocHJldiAhPSBvbGQpOworCXJldHVybiAxOworfQorCisvKioKKyAqIEZyZWUgbG9jay4KKyAqIAorICogXHBhcmFtIGRldiBEUk0gZGV2aWNlLgorICogXHBhcmFtI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GFuZCB2aWNlCisJICogdmVyc2EuCisJICovCisJeworCWludCBlcnJvciA9IDA7CisKKwlmb3IgKCBpID0gMCA7IGkgPCBwYWdlcyA7IGkrKyApIHsKKwkJdW5zaWduZWQgbG9uZyAqdG1wOworCisJCXRtcCA9IHBhZ2VfYWRkcmVzcyggZW50cnktPnBhZ2VsaXN0W2ldICk7CisJCWZvciAoIGogPSAwIDsKKwkJICAgICAgaiA8IFBBR0VfU0laRSAvIHNpemVvZih1bnNpZ25lZCBsb25nKSA7CisJCSAgICAgIGorKywgdG1wKysgKSB7CisJCQkqdG1wID0gMHhjYWZlYmFiZTsKKwkJfQorCQl0bXAgPSAodW5zaWduZWQgbG9uZyAqKSgodTggKillbnRyeS0+dmlydHVhbCArCisJCQkJCShQQUdFX1NJWkUgKiBpKSk7CisJCWZvciggaiA9IDAgOworCQkgICAgIGogPCBQQUdFX1NJWkUgLyBzaXplb2YodW5zaWduZWQgbG9uZykgOworCQkgICAgIGorKywgdG1wKysgKSB7CisJCQlpZiAoICp0bXAgIT0gMHhjYWZlYmFiZSAmJiBlcnJvciA9PSAwICkgeworCQkJCWVycm9yID0gMTsKKwkJCQlEUk1fRVJST1IoICJTY2F0dGVyIGFsbG9jYXRpb24gZXJyb3IsICIKKwkJCQkJICAgInBhZ2VsaXN0IGRvZXMgbm90IG1hdGNoICIKKwkJCQkJICAgInZpcnR1YWwgbWFwcGluZ1xuIiApOworCQkJfQorCQl9CisJCXRtcCA9IHBhZ2VfYWRkcmVzcyggZW50cnktPnBhZ2VsaXN0W2ldICk7CisJCWZvcihqID0gMCA7CisJCSAgICBqIDwgUEFHRV9TSVpFIC8gc2l6ZW9mKHVuc2lnbmVkIGxvbmcpIDsKKwkJICAgIGorKywgdG1wKyspIHsKKwkJCSp0bXAgPSAwOworCQl9CisJfQorCWlmIChlcnJvciA9PSAwKQorCQlEUk1fRVJST1IoICJTY2F0dGVyIGFsbG9jYXRpb24gbWF0Y2hlcyBwYWdlbGlzdFxuIiApOworCX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ldF9jeWNsZXMoKTsKKyNlbmRpZgorICAgICAgICAKKyAgICAgICAgRFJNX0RFQlVHKCJDb250ZXh0IHN3aXRjaCBmcm9tICVkIHRvICVkXG4iLCBvbGQsIG5ldyk7CisKKyAgICAgICAgaWYgKG5ldyA9PSBkZXYtPmxhc3RfY29udGV4dCB8fAorCSAgICBkZXYtPmxhc3RfY29udGV4dCA9PSAwKSB7CisJCWRldi0+bGFzdF9jb250ZXh0ID0gbmV3OworICAgICAgICAgICAgICAgIHJldHVybiAwOworCX0KKyAgICAgICAgCisJRkZCV2FpdChmcHJpdi0+cmVncyk7CisJZmZiX3NhdmVfY29udGV4dChmcHJpdiwgb2xkKTsKKwlmZmJfcmVzdG9yZV9jb250ZXh0KGZwcml2LCBvbGQsIG5ldyk7CisJRkZCV2FpdChmcHJpdi0+cmVncyk7CisgICAgICAgIAorCWRldi0+bGFzdF9jb250ZXh0ID0gbmV3OworCisgICAgICAgIHJldHVybiAwOworfQorCitpbnQgZmZiX2RyaXZlcl9yZXNjdHgoc3RydWN0IGlub2RlICppbm9kZSwgc3RydWN0IGZpbGUgKmZpbHAsIHVuc2lnbmVkIGludCBjbWQsCisJCXVuc2lnbmVkIGxvbmcgYXJnKQoreworCWRybV9jdHhfcmVzX3QJcmVzOworCWRybV9jdHhfdAljdHg7CisJaW50CQlpOworCisJRFJNX0RFQlVHKCIlZFxuIiwgRFJNX1JFU0VSVkVEX0NPTlRFWFRTKTsKKwlpZiAoY29weV9mcm9tX3VzZXIoJnJlcywgKGRybV9jdHhfcmVzX3QgX191c2VyICopYXJnLCBzaXplb2YocmVzKSkpCisJCXJldHVybiAtRUZBVUxUOworCWlmIChyZXMuY291bnQgPj0gRFJNX1JFU0VSVkVEX0NPTlRFWFRTKSB7CisJCW1lbXNldCgmY3R4LCAwLCBzaXplb2YoY3R4KSk7CisJCWZvciAoaSA9IDA7IGkgPCBEUk1fUkVTRVJWRURfQ09OVEVYVFM7IGkrKykgeworCQkJY3R4LmhhbmRsZSA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GludCBudW0pCit7CisgICAJZHJtX2k4MzBfcHJpdmF0ZV90ICpkZXZfcHJpdiA9IGRldi0+ZGV2X3ByaXZhdGU7CisJaW50IGksIGogPSAwOworCXVuc2lnbmVkIGludCB0bXA7CisJUklOR19MT0NBTFM7CisKKwlpZiAoIW51bSkKKwkJcmV0dXJuOworCisJQkVHSU5fTFBfUklORyggbnVtICsgMSApOworCisJZm9yICggaSA9IDAgOyBpIDwgbnVtIDsgaSsrICkgeworCQl0bXAgPSBjb2RlW2ldOworCQlPVVRfUklORyggdG1wICk7CisJCWorKzsKKwl9CisKKwlpZiAoaiAmIDEpIAorCQlPVVRfUklORyggMCApOyAKKworCUFEVkFOQ0VfTFBfUklORygpOworfQorCitzdGF0aWMgdm9pZCBpODMwRW1pdFRleFBhbGV0dGUoIGRybV9kZXZpY2VfdCAqZGV2LAorCQkJICAgICAgICB1bnNpZ25lZCBpbnQgKnBhbGV0dGUsCisJCQkgICAgICAgIGludCBudW1iZXIsCisJCQkgICAgICAgIGludCBpc19zaGFyZWQgKQoreworICAgCWRybV9pODMwX3ByaXZhdGVfdCAqZGV2X3ByaXYgPSBkZXYtPmRldl9wcml2YXRlOworCWludCBpOworCVJJTkdfTE9DQUxTOworCisJcmV0dXJuOworCisJQkVHSU5fTFBfUklORyggMjU4ICk7CisKKwlpZihpc19zaGFyZWQgPT0gMSkgeworCQlPVVRfUklORyhDTURfT1BfTUFQX1BBTEVUVEVfTE9BRCB8CisJCQkgTUFQX1BBTEVUVEVfTlVNKDApIHwKKwkJCSBNQVBfUEFMRVRURV9CT1RIKTsKKwl9IGVsc2UgeworCQlPVVRfUklORyhDTURfT1BfTUFQX1BBTEVUVEVfTE9BRCB8IE1BUF9QQUxFVFRFX05VTShudW1iZXIpKTsKKwl9CisJZm9yKGkgPSAwOyBpIDwgMjU2OyBpKyspIHsKKwkJT1VUX1JJTkcocGFsZXR0ZVtpXSk7CisJfQorCU9VVF9SSU5HKDApOworCS8qIEtXOiAgV0hFUkUgSV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VVRfUklORyggKHBib3gtPnkxIDw8IDE2KSB8IHBib3gtPngxICk7CisJCQlPVVRfUklORyggKHBib3gtPnkyIDw8IDE2KSB8IHBib3gtPngyICk7CisJCQlPVVRfUklORyggZGV2X3ByaXYtPmZyb250X29mZnNldCApOworCQkJT1VUX1JJTkcoIGNsZWFyX2NvbG9yICk7CisJCQlBRFZBTkNFX0xQX1JJTkcoKTsKKwkJfQorCisJCWlmICggZmxhZ3MgJiBJODMwX0JBQ0sgKSB7CisJCQlEUk1fREVCVUcoImNsZWFyIGJhY2tcbiIpOworCQkJQkVHSU5fTFBfUklORyggNiApOwkgICAgCisJCQlPVVRfUklORyggQ01EICk7CisJCQlPVVRfUklORyggQlIxMyApOworCQkJT1VUX1JJTkcoIChwYm94LT55MSA8PCAxNikgfCBwYm94LT54MSApOworCQkJT1VUX1JJTkcoIChwYm94LT55MiA8PCAxNikgfCBwYm94LT54MiApOworCQkJT1VUX1JJTkcoIGRldl9wcml2LT5iYWNrX29mZnNldCApOworCQkJT1VUX1JJTkcoIGNsZWFyX2NvbG9yICk7CisJCQlBRFZBTkNFX0xQX1JJTkcoKTsKKwkJfQorCisJCWlmICggZmxhZ3MgJiBJODMwX0RFUFRIICkgeworCQkJRFJNX0RFQlVHKCJjbGVhciBkZXB0aFxuIik7CisJCQlCRUdJTl9MUF9SSU5HKCA2ICk7CisJCQlPVVRfUklORyggRF9DTUQgKTsKKwkJCU9VVF9SSU5HKCBCUjEzICk7CisJCQlPVVRfUklORyggKHBib3gtPnkxIDw8IDE2KSB8IHBib3gtPngxICk7CisJCQlPVVRfUklORyggKHBib3gtPnkyIDw8IDE2KSB8IHBib3gtPngyICk7CisJCQlPVVRfUklORyggZGV2X3ByaXYtPmRlcHRoX29mZnNldCApOworCQkJT1VUX1JJTkcoIGNsZWFyX3p2YWwgKTsKKwkJCUFEVkFOQ0VfTFBfUklORygpOworCQl9CisJfQorfQorCitzdGF0aWMgdm9pZCBpODMwX2RtYV9kaXNwYXRjaF9zd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QpOworCQlDTUQgPSBYWV9TUkNfQ09QWV9CTFRfQ01EOworCQlicmVhazsKKwl9CisKKworICAgICAgCWlmIChuYm94ID4gSTgzMF9OUl9TQVJFQV9DTElQUkVDVFMpCisgICAgIAkJbmJveCA9IEk4MzBfTlJfU0FSRUFfQ0xJUFJFQ1RTOworCisJZm9yIChpID0gMCA7IGkgPCBuYm94OyBpKyssIHBib3grKykgCisJeworCQlpZiAocGJveC0+eDEgPiBwYm94LT54MiB8fAorCQkgICAgcGJveC0+eTEgPiBwYm94LT55MiB8fAorCQkgICAgcGJveC0+eDIgPiBkZXZfcHJpdi0+dyB8fAorCQkgICAgcGJveC0+eTIgPiBkZXZfcHJpdi0+aCkKKwkJCWNvbnRpbnVlOworIAorCQlEUk1fREVCVUcoImRpc3BhdGNoIHN3YXAgJWQsJWQtJWQsJWQhXG4iLAorCQkJICBwYm94LT54MSwgcGJveC0+eTEsCisJCQkgIHBib3gtPngyLCBwYm94LT55Mik7CisKKwkJQkVHSU5fTFBfUklORyggOCApOworCQlPVVRfUklORyggQ01EICk7CisJCU9VVF9SSU5HKCBCUjEzICk7CisJCU9VVF9SSU5HKCAocGJveC0+eTEgPDwgMTYpIHwgcGJveC0+eDEgKTsKKwkJT1VUX1JJTkcoIChwYm94LT55MiA8PCAxNikgfCBwYm94LT54MiApOworCisJCWlmIChkZXZfcHJpdi0+Y3VycmVudF9wYWdlID09IDApIAorCQkJT1VUX1JJTkcoIGRldl9wcml2LT5mcm9udF9vZmZzZXQgKTsKKwkJZWxzZQorCQkJT1VUX1JJTkcoIGRldl9wcml2LT5iYWNrX29mZnNldCApOwkJCQorCisJCU9VVF9SSU5HKCAocGJveC0+eTEgPDwgMTYpIHwgcGJveC0+eDEgKTsKKwkJT1VUX1JJTkcoIEJSMTMgJiAweGZmZmYgKTsKKworCQlpZiAoZGV2X3ByaXYtPmN1cnJlbnRfcGFnZSA9PSAwKSAKKwkJCU9VVF9SSU5HKCBkZXZfcHJpdi0+YmFja19vZmZz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wlpZiAoIWRldl9wcml2KQorCQlyZXR1cm47CisKKwlJODMwX1dSSVRFMTYoIEk4MzBSRUdfSU5UX01BU0tfUiwgMHhmZmZmICk7CisJSTgzMF9XUklURTE2KCBJODMwUkVHX0lOVF9FTkFCTEVfUiwgMHgwICk7Cit9CmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvZHJtL2k5MTVfZG1hLmMgYi9kcml2ZXJzL2NoYXIvZHJtL2k5MTVfZG1hLmMKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNzMwMGEwOQotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9kcm0vaTkxNV9kbWEuYwpAQCAtMCwwICsxLDcyNSBAQAorLyogaTkxNV9kbWEuYyAtLSBETUEgc3VwcG9ydCBmb3IgdGhlIEk5MTUgLSotIGxpbnV4LWMgLSotCisgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogCisgKiBDb3B5cmlnaHQgMjAwMyBUdW5nc3RlbiBHcmFwaGljcywgSW5jLiwgQ2VkYXIgUGFyaywgVGV4YXMuCisgKiBBbGwgUmlnaHRzIFJlc2VydmVkLgorICogCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpbmNsdWRlICJkcm1QLmgiCisjaW5jbHVkZSAiZHJtLmgiCisjaW5jbHVkZSAiaTkxNV9kcm0uaCIKKyNpbmNsdWRlICJpOTE1X2Rydi5oIgorCitkcm1faW9jdGxfZGVzY190IGk5MTVfaW9jdGxzW10gPSB7CisJW0RSTV9JT0NUTF9OUihEUk1fSTkxNV9JTklUKV0gPSB7aTkxNV9kbWFfaW5pdCwgMSwgMX0sCisJW0RSTV9JT0NUTF9OUihEUk1fSTkxNV9GTFVTSCldID0ge2k5MTVfZmx1c2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UgZHJpdmVyIC0qLSBsaW51eC1jIC0qLQorICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogCisgKiBDb3B5cmlnaHQgMjAwMyBUdW5nc3RlbiBHcmFwaGljcywgSW5jLiwgQ2VkYXIgUGFyaywgVGV4YXMuCisgKiBBbGwgUmlnaHRzIFJlc2VydmVkLgorICogCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpbmNsdWRlICJkcm1QLmgiCisjaW5jbHVkZSAiZHJtLmgiCisjaW5jbHVkZSAiaTkxNV9kcm0uaCIKKyNpbmNsdWRlICJpOTE1X2Rydi5oIgorCisjaW5jbHVkZSAiZHJtX3BjaWlkcy5oIgorCitpbnQgcG9zdGluaXQoIHN0cnVjdCBkcm1fZGV2aWNlICpkZXYsIHVuc2lnbmVkIGxvbmcgZmxhZ3MgKQoreworCWRldi0+Y291bnRlcnMgKz0gNDsKKwlkZXYtPnR5cGVzWzZdID0gX0RSTV9TVEFUX0lSUTsKKwlkZXYtPnR5cGVzWzddID0gX0RSTV9TVEFUX1BSSU1BUlk7CisJZGV2LT50eXBlc1s4XSA9IF9EUk1fU1RBVF9TRUNPTkRBUlk7CisJZGV2LT50eXBlc1s5XSA9IF9EUk1fU1RBVF9ETUE7CisJCisJRFJNX0lORk8oICJJbml0aWFsaXplZCAlcyAlZC4lZC4lZCAlcyBvbiBtaW5vciAlZDogJXNcbiIsCisJCURSSVZFUl9OQU1FLAorCQlEUklWRVJfTUFKT1IsCisJCURSSVZFUl9NSU5PUiwKKwkJRFJJVkVSX1BBVENITEVWRUwsCisJCURSSVZFUl9EQVRFLAorCQlkZXYtPnByaW1hcnkubWlub3IsCisJCXBjaV9wcmV0dHlfbmFtZShkZXYtPnBkZXYpCisJCSk7CisJcmV0dXJuIDA7Cit9CisKK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OKCBEUklWRVJfREVTQyApOworTU9EVUxFX0xJQ0VOU0UoIkdQTCBhbmQgYWRkaXRpb25hbCByaWdodHMiKTsKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9kcm0vaTkxNV9kcnYuaCBiL2RyaXZlcnMvY2hhci9kcm0vaTkxNV9kcnYuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5mNmNhOTJhCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL2RybS9pOTE1X2Rydi5oCkBAIC0wLDAgKzEsMjQzIEBACisvKiBpOTE1X2Rydi5oIC0tIFByaXZhdGUgaGVhZGVyIGZvciB0aGUgSTkxNSBkcml2ZXIgLSotIGxpbnV4LWMgLSotCisgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogCisgKiBDb3B5cmlnaHQgMjAwMyBUdW5nc3RlbiBHcmFwaGljcywgSW5jLiwgQ2VkYXIgUGFyaywgVGV4YXMuCisgKiBBbGwgUmlnaHRzIFJlc2VydmVkLgorICogCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgX0k5MTVfRFJWX0hfCisjZGVmaW5lIF9JOTE1X0RSVl9IXworCisvKiBHZW5lcmFsIGN1c3RvbWl6YXRpb246CisgKi8KKworI2RlZmluZSBEUklWRVJfQVVUSE9SCQkiVHVuZ3N0ZW4gR3JhcGhpY3MsIEluYy4iCisKKyNkZWZpbmUgRFJJVkVSX05BTUUJCSJpOTE1IgorI2RlZmluZSBEUklWRVJfREVTQwkJIkludGVsIEdyYXBoaWNzIgorI2RlZmluZSBEUklWRVJfREFURQkJIjIwMDQwNDA1IgorCisvKiBJbnRlcmZhY2UgaGlzdG9yeToKKyAqCisgKiAxLjE6IE9yaWdpbmFs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JldjsKKwkJZW50cnktPm5leHQgPSBOVUxMOworCX0gZWxzZSB7CisJCXByZXYgPSBoZWFkLT5uZXh0OworCQloZWFkLT5uZXh0ID0gZW50cnk7CisJCXByZXYtPnByZXYgPSBlbnRyeTsKKwkJZW50cnktPnByZXYgPSBoZWFkOworCQllbnRyeS0+bmV4dCA9IHByZXY7CisJfQorCisJcmV0dXJuIDA7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICogRE1BIGluaXRpYWxpemF0aW9uLCBjbGVhbnVwCisgKi8KKworc3RhdGljIGludCBtZ2FfZG9faW5pdF9kbWEoIGRybV9kZXZpY2VfdCAqZGV2LCBkcm1fbWdhX2luaXRfdCAqaW5pdCApCit7CisJZHJtX21nYV9wcml2YXRlX3QgKmRldl9wcml2OworCWludCByZXQ7CisJRFJNX0RFQlVHKCAiXG4iICk7CisKKwlkZXZfcHJpdiA9IGRybV9hbGxvYyggc2l6ZW9mKGRybV9tZ2FfcHJpdmF0ZV90KSwgRFJNX01FTV9EUklWRVIgKTsKKwlpZiAoICFkZXZfcHJpdiApCisJCXJldHVybiBEUk1fRVJSKEVOT01FTSk7CisKKwltZW1zZXQoIGRldl9wcml2LCAwLCBzaXplb2YoZHJtX21nYV9wcml2YXRlX3QpICk7CisKKwlkZXZfcHJpdi0+Y2hpcHNldCA9IGluaXQtPmNoaXBzZXQ7CisKKwlkZXZfcHJpdi0+dXNlY190aW1lb3V0ID0gTUdBX0RFRkFVTFRfVVNFQ19USU1FT1VUOworCisJaWYgKCBpbml0LT5zZ3JhbSApIHsKKwkJZGV2X3ByaXYtPmNsZWFyX2NtZCA9IE1HQV9EV0dDVExfQ0xFQVIgfCBNR0FfQVRZUEVfQkxLOworCX0gZWxzZSB7CisJCWRldl9wcml2LT5jbGVhcl9jbWQgPSBNR0FfRFdHQ1RMX0NMRUFSIHwgTUdBX0FUWVBFX1JTVFI7CisJfQorCWR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LAorCisweDIwLCAweDczLAorMHgzMywgMHg2QSwKKzB4MDAsIDB4RTAsCisweDI4LCAweDczLAorCisweDFDLCAweDcyLAorMHg4MywgMHhFMiwKKzB4NjAsIDB4ODAsIDB4MTUsIDB4RUEsCisKKzB4QjgsIDB4M0QsIDB4MjgsIDB4REYsCisweDMwLCAweDM1LCAweDIwLCAweERGLAorCisweDQwLCAweDMwLAorMHgwMCwgMHhFMCwKKzB4Q0MsIDB4RTIsCisweDY0LCAweDcyLAorCisweDI1LCAweDQyLCAweDUyLCAweEJGLAorMHgyRCwgMHg0MiwgMHg0QSwgMHhCRiwKKworMHgzMCwgMHgyRSwgMHgzMCwgMHhERiwKKzB4MzgsIDB4MkUsIDB4MzgsIDB4REYsCisKKzB4MTgsIDB4MUQsIDB4NDUsIDB4RTksCisweDFFLCAweDE1LCAweDQ1LCAweEU5LAorCisweDJCLCAweDQ5LCAweDUxLCAweEJELAorMHgwMCwgMHhFMCwKKzB4MUYsIDB4NzMsCisKKzB4MzgsIDB4MzgsIDB4NDAsIDB4QUYsCisweDMwLCAweDMwLCAweDQwLCAweEFGLAorCisweDI0LCAweDFGLCAweDI0LCAweERGLAorMHgxRCwgMHgzMiwgMHgyMCwgMHhFOSwKKworMHgyQywgMHgxRiwgMHgyQywgMHhERiwKKzB4MUEsIDB4MzMsIDB4MjAsIDB4RTksCisKKzB4QjAsIDB4MTAsCisweDA4LCAweEUzLAorMHg0MCwgMHgxMCwKKzB4QjgsIDB4MTAsCisKKzB4MjYsIDB4RjAsIDB4MzAsIDB4Q0QsCisweDJGLCAweEYwLCAweDM4LCAweENELAorCisweDJCLCAweDgwLCAweDIwLCAweEU5LAorMHgyQSwgMHg4MCwgMHgyMCwgMHhFOSwKKworMHhBNiwgMHgyMCwKKzB4ODgsIDB4RTIsCisweDAwLCAweEUwLAorMHhBRiwgMHgyMCwKKworMHgyOCwgMHgyQSwgMHgyNiwgMHhBRiwKKzB4MjAsIDB4MkEsIDB4QzAsIDB4QUYsCisKKzB4MzQsIDB4MUYsIDB4MzQsIDB4REYsCisweDQ2LCAweDI0LCAweDQ2LCAweERGLAorCisweDI4LCAweDMwLCAweDgwLCAweEJGLAorMHgyMCwgMHgzOCwgMHg4MCwgMHhCRiwKKworMHg0NywgMHgyNCwgMHg0NywgMHhERiwKKzB4NEUsIDB4MkMsIDB4NEUsIDB4REYsCisKKzB4NEYsIDB4MkMsIDB4NEYsIDB4REYsCisweDU2LCAweDM0LCAweDU2LCAweERGLAorCisweDI4LCAweDE1LCAweDI4LCAweERGLAorMHgyMCwgMHgxRCwgMHgyMCwgMHhERiwKKworMHg1NywgMHgzNCwgMHg1NywgMHhERiwKKzB4MDAsIDB4RTAsCisweDFELCAweDA1LAorCisweDA0LCAweDgwLCAweDEwLCAweEVBLAorMHg4OSwgMHhFMiwKKzB4MkIsIDB4MzAsCisKKzB4M0YsIDB4QzEsIDB4MUQsIDB4QkQsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHhBMCwgMHg2OCwKKzB4QkYsIDB4MjUsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDIwLCAweEMwLCAweDIwLCAweEFGLAorMHgyOCwgMHgwNSwKKzB4OTcsIDB4NzQsCisKKzB4MDAsIDB4RTAsCisweDJBLCAweDEwLAorMHgxNiwgMHhDMCwgMHgyMCwgMHhFOSwKKworMHgwNCwgMHg4MCwgMHgxMCwgMHhFQSwKKzB4OEMsIDB4RTIsCisweDk1LCAweDA1LAorCisweDI4LCAweEMxLCAweDI4LCAweEFELAorMHgxRiwgMHhDMSwgMHgxNSwgMHhCRCwKKworMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4QTgsIDB4NjcsCisweDlGLCAweDZCLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgyOCwgM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jUsIDB4MDUsCisKKzB4QkQsIDB4MDUsCisweDJFLCAweDMwLAorMHgzMiwgMHhDMCwgMHhBMCwgMHhFOCwKKworMHgzMywgMHhDMCwgMHhBMCwgMHhFOCwKKzB4NzQsIDB4NjQsIDB4QzgsIDB4RUMsCisKKzB4NDAsIDB4M0MsIDB4NDAsIDB4QUQsCisweDMyLCAweDZBLAorMHgyQSwgMHgzMCwKKworMHgyMCwgMHg3MywKKzB4MzMsIDB4NkEsCisweDAwLCAweEUwLAorMHgyOCwgMHg3MywKKworMHgxQywgMHg3MiwKKzB4ODMsIDB4RTIsCisweDZCLCAweDgwLCAweDE1LCAweEVBLAorCisweEI4LCAweDNELCAweDI4LCAweERGLAorMHgzMCwgMHgzNSwgMHgyMCwgMHhERiwKKworMHg0MCwgMHgzMCwKKzB4MDAsIDB4RTAsCisweENDLCAweEUyLAorMHg2NCwgMHg3MiwKKworMHgyNSwgMHg0MiwgMHg1MiwgMHhCRiwKKzB4MkQsIDB4NDIsIDB4NEEsIDB4QkYsCisKKzB4MzAsIDB4MkUsIDB4MzAsIDB4REYsCisweDM4LCAweDJFLCAweDM4LCAweERGLAorCisweDE4LCAweDFELCAweDQ1LCAweEU5LAorMHgxRSwgMHgxNSwgMHg0NSwgMHhFOSwKKworMHgyQiwgMHg0OSwgMHg1MSwgMHhCRCwKKzB4MDAsIDB4RTAsCisweDFGLCAweDczLAorCisweDM4LCAweDM4LCAweDQwLCAweEFGLAorMHgzMCwgMHgzMCwgMHg0MCwgMHhBRiwKKworMHgyNCwgMHgxRiwgMHgyNCwgMHhERiwKKzB4MUQsIDB4MzIsIDB4MjAsIDB4RTksCisKKzB4MkMsIDB4MUYsIDB4MkMsIDB4REYsCisweDFBLCAweDMzLCAweDIwLCAweEU5LAorCisweEIwLCAweDEwLAorMHgwOCwgMHhFMywKKzB4NDAsIDB4MTAsCisweEI4LCAweDEwLAorCisweDI2LCAweEYwLCAweDMwLCAweENELAorMHgyRiwgMHhGMCwgMHgzOCwgMH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weDE5LCAweEMwLCAweEIwLCAweEU4LAorMHgzNCwgMHhDMCwgMHg0NCwgMHhDNCwKKworMHgzMywgMHg3MywKKzB4MDAsIDB4RTAsCisweDNFLCAweDYyLCAweDU3LCAweDlGLAorCisweDFFLCAweEFGLCAweDU5LCAweDlGLAorMHgwMCwgMHhFMCwKKzB4MEQsIDB4MjAsCisKKzB4ODQsIDB4M0UsIDB4NTgsIDB4RTksCisweDI4LCAweDFELCAweDZGLCAweDhGLAorCisweDA1LCAweDIwLAorMHgwMCwgMHhFMCwKKzB4ODUsIDB4MUUsIDB4NTgsIDB4RTksCisKKzB4OUIsIDB4M0IsIDB4MzMsIDB4REYsCisweDIwLCAweDIwLCAweDQyLCAweEFGLAorCisweDMwLCAweDQyLCAweDU2LCAweDlGLAorMHg4MCwgMHgzRSwgMHg1NywgMHhFOSwKKworMHgzRiwgMHg4RiwgMHg1MSwgMHg5RiwKKzB4MzAsIDB4ODAsIDB4NUYsIDB4RTksCisKKzB4MjgsIDB4MjgsIDB4MjQsIDB4QUYsCisweDgxLCAweDFFLCAweDU3LCAweEU5LAorCisweDA1LCAweDQ3LCAweDU3LCAweEJGLAorMHgwRCwgMHg0NywgMHg0RiwgMHhCRiwKKworMHg4OCwgMHg4MCwgMHg1OCwgMHhFOSwKKzB4MUIsIDB4MjksIDB4MUIsIDB4REYsCisKKzB4MzAsIDB4MUQsIDB4NkYsIDB4OEYsCisweDNBLCAweDMwLCAweDRGLCAweEU5LAorCisweDFDLCAweDMwLCAweDI2LCAweERGLAorMHgwOSwgMHhFMywKKzB4M0IsIDB4MDUsCisKKzB4M0UsIDB4NTAsIDB4NTYsIDB4OUYsCisweDNCLCAweDNGLCAweDRGLCAweEU5LAorCisweDFFLCAweDhGLCAweDUxLCAweDlGLAorMHgwMCwgMHhFMCwKKzB4QUMsIDB4MjAsCisKKzB4MkQsIDB4NDQsIDB4NEMsIDB4QjQsCisweDJDLCAweDFDLCAweEMwLCAweEFGLAorCisweDI1LCAweDQ0LC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AwLCAweEU4LAorMHgyOCwgMHgxOSwgMHg2MCwgMHhFQywKKworMHhCMywgMHgwNSwKKzB4MDAsIDB4RTAsCisweDE3LCAweDI2LCAweDE3LCAweERGLAorCisweDIzLCAweDNCLCAweDMzLCAweEFELAorMHgzNSwgMHgxNywgMHg0RiwgMHhFOSwKKworMHgxRiwgMHgyNiwgMHgxRiwgMHhERiwKKzB4OUQsIDB4MUYsIDB4NEYsIDB4RTksCisKKzB4OUUsIDB4M0YsIDB4NEYsIDB4RTksCisweDM5LCAweDM3LCAweDRGLCAweEU5LAorCisweDJGLCAweDJGLCAweDE3LCAweEFGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgwNywgMHgwNywgMHgxRiwgMHhBRiwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MzEsIDB4ODAsIDB4NEYsIDB4RTksCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDlDLCAweDgwLCAweDRGLCAweEU5LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKzB4NTcsIDB4MzksIDB4MjAsIDB4RTksCisKKzB4MTYsIDB4MjgsIDB4MjAsIDB4RTksCisweDFELCAweDNCLCAweDIwLCAweEU5LAorCisweDFFLCAweDJCLCAweDIwLCAweEU5LAorMHgyQiwgMHgzMiwgMHgyMCwgMHhFOSwKKworMHgxQywgMHgyMywgMHgyMCwgMHhFOSwKKzB4NTcsIDB4MzYsIDB4MjAsIDB4RTksCisKKzB4MDAsIDB4ODAsIDB4QTAsIDB4RTksCisweDQwLCAweDQwLCAweEQ4LCAweEVDLAorCisweEZGLCAweDgwLCAweEMwLCAweEU5LAorMHg5MCwgMHhFMiwKKzB4MDAsIDB4RTAsCisKKzB4NzQsIDB4RkYsIDB4MjAsIDB4RUEsCisweDE5LCAweEM4LCAweEMxLCAweENELAorCisweDFGLCAweEQ3LCAweDE4LCAweEJELAorMHgzRiw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sCisweDM4LCAweDJFLCAweDM4LCAweERGLAorCisweDE4LCAweDFELCAweDQ1LCAweEU5LAorMHgxRSwgMHgxNSwgMHg0NSwgMHhFOSwKKworMHgyQiwgMHg0OSwgMHg1MSwgMHhCRCwKKzB4MDAsIDB4RTAsCisweDFGLCAweDczLAorCisweDM4LCAweDM4LCAweDQwLCAweEFGLAorMHgzMCwgMHgzMCwgMHg0MCwgMHhBRiwKKworMHgyNCwgMHgxRiwgMHgyNCwgMHhERiwKKzB4MUQsIDB4MzIsIDB4MjAsIDB4RTksCisKKzB4MkMsIDB4MUYsIDB4MkMsIDB4REYsCisweDFBLCAweDMzLCAweDIwLCAweEU5LAorCisweEIwLCAweDEwLAorMHgwOCwgMHhFMywKKzB4NDAsIDB4MTAsCisweEI4LCAweDEwLAorCisweDI2LCAweEYwLCAweDMwLCAweENELAorMHgyRiwgMHhGMCwgMHgzOCwgMHhDRCwKKworMHgyQiwgMHg4MCwgMHgyMCwgMHhFOSwKKzB4MkEsIDB4ODAsIDB4MjAsIDB4RTksCisKKzB4QTYsIDB4MjAsCisweDg4LCAweEUyLAorMHgwMCwgMHhFMCwKKzB4QUYsIDB4MjAsCisKKzB4MjgsIDB4MkEsIDB4MjYsIDB4QUYsCisweDIwLCAweDJBLCAweEMwLCAweEFGLAorCisweDM0LCAweDFGLCAweDM0LCAweERGLAorMHg0NiwgMHgyNCwgMHg0NiwgMHhERiwKKworMHgyOCwgMHgzMCwgMHg4MCwgMHhCRiwKKzB4MjAsIDB4MzgsIDB4ODAsIDB4QkYsCisKKzB4NDcsIDB4MjQsIDB4NDcsIDB4REYsCisweDRFLCAweDJDLCAweDRFLCAweERGLAorCisweDRGLCAweDJDLCAweDRGLCAweERGLAorMHg1NiwgMHgzNCwgMHg1NiwgMHhERiwKKworMHgyOCwgMHgxNSwgMHgyOCwgMHhERiwKKzB4MjAsIDB4MUQsIDB4MjAsIDB4REYsCisKKzB4NTcsIDB4MzQsIDB4NTcsIDB4REYsCisweDAwLCAwe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BMCwgMHhFOCwKKworMHgxNSwgMHg3MiwKKzB4MDksIDB4RTMsCisweDAwLCAweEUwLAorMHgxRCwgMHg3MiwKKworMHgzNSwgMHgzMCwKKzB4QjUsIDB4MzAsCisweEJELCAweDMwLAorMHgzRCwgMHgzMCwKKworMHg5QywgMHg5NywgMHg1NywgMHg5RiwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4NkMsIDB4NjQsIDB4QzgsIDB4RUMsCisweDk4LCAweEUxLAorMHhCNSwgMHgwNSwKKworMHhCRCwgMHgwNSwKKzB4MkUsIDB4MzAsCisweDMyLCAweEMwLCAweEEwLCAweEU4LAorCisweDMzLCAweEMwLCAweEEwLCAweEU4LAorMHg3NCwgMHg2NCwgMHhDOCwgMHhFQywKKworMHg0MCwgMHgzQywgMHg0MCwgMHhBRCwKKzB4MzIsIDB4NkEsCisweDJBLCAweDMwLAorCisweDIwLCAweDczLAorMHgzMywgMHg2QSwKKzB4MDAsIDB4RTAsCisweDI4LCAweDczLAorCisweDFDLCAweDcyLAorMHg4MywgMHhFMiwKKzB4NzcsIDB4ODAsIDB4MTUsIDB4RUEsCisKKzB4QjgsIDB4M0QsIDB4MjgsIDB4REYsCisweDMwLCAweDM1LCAweDIwLCAweERGLAorCisweDQwLCAweDMwLAorMHgwMCwgMHhFMCwKKzB4Q0MsIDB4RTIsCisweDY0LCAweDcyLAorCisweDI1LCAweDQyLCAweDUyLCAweEJGLAorMHgyRCwgMHg0MiwgMHg0QSwgMHhCRiwKKworMHgzMCwgMHgyRSwgMHgzMCwgMHhERiwKKzB4MzgsIDB4MkUsIDB4MzgsIDB4REYsCisKKzB4MTgsIDB4MUQsIDB4NDUsIDB4RTksCisweDFFLCAweDE1LCAweDQ1LCAweEU5LAorCisweDJCLCAweDQ5LCAweDUxLCAweEJELAorMHgwMCwgMHhFMCwKKzB4MUYsIDB4NzMsCisKKzB4MzgsIDB4MzgsIDB4NDAsIDB4QUYsCisweDMwLCAweDMwLCAweDQwLCAweEFGLAorCisweDI0LCAweDFGLCAweDI0LCAweERGLAorMHgxRCwgMHgzMiwgMHgyMCwgMHhFOSwKKworMHgyQywgMHgxRiwgMHgyQywgMHhERiwKKzB4MUEsIDB4MzMsIDB4MjAsIDB4RTksCisKKzB4QjAsIDB4MTAsCisweDA4LCAweEUzLAorMHg0MCwgMHgxMCwKKzB4QjgsIDB4MTAsCisKKzB4MjYsIDB4RjAsIDB4MzAsIDB4Q0QsCisweDJGLCAweEYwLCAweDM4LCAweENELAorCisweDJCLCAweDgwLCAweDIwLCAweEU5LAorMHgyQSwgMHg4MCwgMHgyMCwgMHhFOSwKKworMHhBNiwgMHgyMCwKKzB4ODgsIDB4RTIsCisweDAwLCAweEUwLAorMHhBRiwgMHgyMCwKKworMHgyOCwgMHgyQSwgMHgyNiwgMHhBRiwKKzB4MjAsIDB4MkEsIDB4QzAsIDB4QUYsCisKKzB4MzQsIDB4MUYsIDB4MzQsIDB4REYsCisweDQ2LCAweDI0LCAweDQ2LCAweERGLAorCisweDI4LCAweDMwLCAweDgwLCAweEJGLAorMHgyMCwgMHgzOCwgMHg4MCwgMHhCRiwKKworMHg0NywgMHgyNCwgMHg0NywgMHhERiwKKzB4NEUsIDB4MkMsIDB4NEUsIDB4REYsCisKKzB4NEYsIDB4MkMsIDB4NEYsIDB4REYsCisweDU2LCAweDM0LCAweDU2LCAweERGLAorCisweDI4LCAweDE1LCAweDI4LCAweERGLAorMHgyMCwgMHgxRCwgMHgyMCwgMHhERiwKKworMHg1NywgMHgzNCwgMHg1NywgMHhERiwKKzB4MDAsIDB4RTAsCisweDFELCAweDA1LAorCisweDA0LCAweDgwLCAweDEwLCAweEVBLAorMHg4OSwgMHhFMiwKKzB4MkIsIDB4MzAsCisKKzB4M0YsIDB4QzEsIDB4MUQsIDB4QkQsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMH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yNSwgMHgyMSwgMHgzMSwgMHhCMCwKKworMHgwRCwgMHgyMSwgMHgxQSwgMHhCMiwKKzB4MDUsIDB4MjEsIDB4MzEsIDB4QjIsCisKKzB4MDMsIDB4ODAsIDB4MkEsIDB4RUEsCisweDE3LCAweEMxLCAweDJCLCAweEJELAorCisweDJELCAweDIwLAorMHgyNSwgMHgyMCwKKzB4MDUsIDB4MjAsCisweDBELCAweDIwLAorCisweEIzLCAweDY4LAorMHg5NywgMHgyNSwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MzMsIDB4QzAsIDB4MzMsIDB4QUYsCisweDJGLCAweEMwLCAweDIxLCAweEMwLAorCisweDE2LCAweDQyLCAweDU2LCAweDlGLAorMHgzQywgMHgyNywgMHg0RiwgMHhFOSwKKworMHgxRSwgMHg2MiwgMHg1NywgMHg5RiwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MjUsIDB4MjEsIDB4MzEsIDB4QjQsCisweDJELCAweDIxLCAweDFBLCAweEI0LAorCisweDNGLCAweDJGLCAweDVELCAweDlGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgzMywgMHgwNSwKKzB4MDAsIDB4RTAsCisweDI4LCAweDE5LCAweDYwLCAweEVDLAorCisweDM3LCAweDBGLCAweDVDLCAweDlGLAorMHgwMCwgMHhFMCwKKzB4MkYsIDB4MjAsCisKKzB4MjMsIDB4M0IsIDB4MzMsIDB4QUQsCisweDFFLCAweDI2LCAweDFFLCAweERGLAorCisweEE3LCAweDFFLCAweDRGLCAweEU5LAorMHgxNywgMHgyNiwgMHgxNiwgMHhERiwKKworMHgyRCwgMHgyMCwKKzB4MDAsIDB4RTAsCisweEE4LCAweDNGLCAweDRGLCAweEU5LAorCisweDJGLCAweDJGLCAweDFFLCAweEFGLAorMHgyNSwgMHgyMCwKKzB4MDAsIDB4RTAsCisKKzB4QTQsIDB4MTYsIDB4NEYsIDB4RTksCisweDBGLCAweEMwLCA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wLCAweDU2LCAweDlGLAorMHgzQiwgMHgzRiwgMHg0RiwgMHhFOSwKKworMHgxRSwgMHg4RiwgMHg1MSwgMHg5RiwKKzB4MDAsIDB4RTAsCisweEFDLCAweDIwLAorCisweDJELCAweDQ0LCAweDRDLCAweEI0LAorMHgyQywgMHgxQywgMHhDMCwgMHhBRiwKKworMHgyNSwgMHg0NCwgMHg1NCwgMHhCNCwKKzB4MDAsIDB4RTAsCisweEM4LCAweDMwLAorCisweDMwLCAweDQ2LCAweDMwLCAweEFGLAorMHgxQiwgMHgxQiwgMHg0OCwgMHhBRiwKKworMHgwMCwgMHhFMCwKKzB4MjUsIDB4MjAsCisweDM4LCAweDJDLCAweDRGLCAweEU5LAorCisweDg2LCAweDgwLCAweDU3LCAweEU5LAorMHgzOCwgMHgxRCwgMHg2RiwgMHg4RiwKKworMHgyOCwgMHg3NCwKKzB4MDAsIDB4RTAsCisweDBELCAweDQ0LCAweDRDLCAweEIwLAorCisweDA1LCAweDQ0LCAweDU0LCAweEIwLAorMHgyRCwgMHgyMCwKKzB4OUIsIDB4MTAsCisKKzB4ODIsIDB4M0UsIDB4NTcsIDB4RTksCisweDMyLCAweEYwLCAweDFCLCAweENELAorCisweDFFLCAweEJELCAweDU5LCAweDlGLAorMHg4MywgMHgxRSwgMHg1NywgMHhFOSwKKworMHgzOCwgMHg0NywgMHgzOCwgMHhBRiwKKzB4MzQsIDB4MjAsCisweDJBLCAweDMwLAorCisweDAwLCAweEUwLAorMHgwRCwgMHgyMCwKKzB4MzIsIDB4MjAsCisweDA1LCAweDIwLAorCisweDg3LCAweDgwLCAweDU3LCAweEU5LAorMHgxRiwgMHg1NCwgMHg1NywgMHg5RiwKKworMHgxNywgMHg0MiwgMHg1NiwgMHg5RiwKKzB4MDAsIDB4RTAsCisweDNCLCAweDZBLAorCisweDNGLCAweDhGLCAweDUxLCAweDlGLAorMHgzNywgMHgxRSwgMHg0RiwgMHhFOSwKKworMHgzNywgMHgzMiwgMHgyQSwgMHhB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CNCwKKzB4MkQsIDB4MjEsIDB4MUEsIDB4QjQsCisKKzB4M0YsIDB4MkYsIDB4NUQsIDB4OUYsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDMzLCAweDA1LAorMHgwMCwgMHhFMCwKKzB4MjgsIDB4MTksIDB4NjAsIDB4RUMsCisKKzB4MEQsIDB4NDQsIDB4NEMsIDB4QjYsCisweDA1LCAweDQ0LCAweDU0LCAweEI2LAorCisweDM3LCAweDBGLCAweDVDLCAweDlGLAorMHgwMCwgMHhFMCwKKzB4MkYsIDB4MjAsCisKKzB4MjMsIDB4M0IsIDB4MzMsIDB4QUQsCisweDFFLCAweDI2LCAweDFFLCAweERGLAorCisweEE3LCAweDFFLCAweDRGLCAweEU5LAorMHgxNywgMHgyNiwgMHgxNiwgMHhERiwKKworMHgyRCwgMHgyMCwKKzB4MDAsIDB4RTAsCisweEE4LCAweDNGLCAweDRGLCAweEU5LAorCisweDJGLCAweDJGLCAweDFFLCAweEFGLAorMHgyNSwgMHgyMCwKKzB4MDAsIDB4RTAsCisKKzB4QTQsIDB4MTYsIDB4NEYsIDB4RTksCisweDBGLCAweEMwLCAweDIxLCAweEMyLAorCisweEE2LCAweDgwLCAweDRGLCAweEU5LAorMHgxRiwgMHg2MiwgMHg1NywgMHg5RiwKKworMHgwRCwgMHgyMCwKKzB4MDUsIDB4MjAsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDNGLCAweDJGLCAweDVELCAweDlGLAorMHgwMCwgMHhFMCwKKzB4MEYsIDB4MjAsCisKKzB4MTcsIDB4NTAsIDB4NTYsIDB4OUYsCisweEE1LCAweDM3LCAweDRGLCAweEU5LAorCisweDA2LCAweEMwLCAweDIxLCAweEM0LAorMHgwRiwgMHgxNywgMHgwRiwgMHhBRiwKKworMHgzNywgMHgwRiwgMHg1QywgMHg5RiwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MkYsIDB4QzAsIDB4NDQsIDB4QzYsCisweEEz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CAweDgwLCAweDAwLCAweEU4LAorCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworfTsKKworc3RhdGljIHVuc2lnbmVkIGNoYXIgd2FycF9nMjAwX3RnenNhZltdID0geworCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDAwLCAweDk4LCAweEEwLCAweEU5LAorMHg0MCwgMHg0MCwgMHhEOCwgMHhFQywKKworMHhGRiwgMHg4MCwgMHhDMCwgMHhFOSwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MUYsIDB4RDcsIDB4MTgsIDB4QkQsCisweDNGLCAweEQ3LCAweDIyLCAweEJELAorCisweDgxLCAweDA0LAorMHg4OSwgMHgwNCwKKzB4MDEsIDB4MDQsCisweDA5LCAweDA0LAorCisweEM5LCAweDQxLCAweEMwLCAweEVDLAorMHgxMSwgMHgwNCwKKzB4MDAsIDB4RTAsCisKKzB4NDEsIDB4Q0MsIDB4NDEsIDB4Q0QsCisweDQ5LCAweENDLCAweDQ5LCAweENELAorCisweEQxLCAweDQxLCAweEMwLCAweEVDLAorMHg1MSwgMHhDQywgMHg1MSwgMHhDRCwKKworMHg4MCwgMHgwNCwKKzB4MTAsIDB4MDQsCisweDA4LCAweDA0LAorMHgwMCwgMHhFMCwKKworMHgwMCwgMHhDQywgMHhDMCwgMHhDRCwKKzB4RDEsIDB4NDksIDB4QzAsIDB4RUMsCisKKzB4OEEsIDB4MUYsIDB4MjAsIDB4RTksCisweDhCLCAweDNGLCAweDIwLCAweEU5LAorCisweDQxLCAweDNDLCAweDQxLCAweEFELAorMHg0OSwgMHgzQywgMHg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LCAweDlGLAorCisweDE3LCAweDQyLCAweDU2LCAweDlGLAorMHgwMCwgMHhFMCwKKzB4M0IsIDB4NkEsCisKKzB4M0YsIDB4OEYsIDB4NTEsIDB4OUYsCisweDM3LCAweDFFLCAweDRGLCAweEU5LAorCisweDM3LCAweDMyLCAweDJBLCAweEFGLAorMHgwMCwgMHhFMCwKKzB4MzIsIDB4MDAsCisKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisweDI3LCAweEMwLCAweDQ0LCAweEMwLAorCisweDM2LCAweDFGLCAweDRGLCAweEU5LAorMHgxRiwgMHgxRiwgMHgyNiwgMHhERiwKKworMHgzNywgMHgxQiwgMHgzNywgMHhCRiwKKzB4MTcsIDB4MjYsIDB4MTcsIDB4REYsCisKKzB4M0UsIDB4MTcsIDB4NEYsIDB4RTksCisweDNGLCAweDNGLCAweDRGLCAweEU5LAorCisweDM0LCAweDFGLCAweDM0LCAweEFGLAorMHgyQiwgMHgwNSwKKzB4QTcsIDB4MjAsCisKKzB4MzMsIDB4MkIsIDB4MzcsIDB4REYsCisweDI3LCAweDE3LCAweEMwLCAweEFGLAorCisweDM0LCAweDgwLCAweDRGLCAweEU5LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgyRCwgMHgyMSwgMHgxQSwgMHhCMCwKKzB4MjUsIDB4MjEsIDB4MzEsIDB4QjAsCisKKzB4MEQsIDB4MjEsIDB4MUEsIDB4QjIsCisweDA1LCAweDIxLCAweDMxLCAweEIyLAorCisweDAzLCAweDgwLCAweDJBLCAweEVBLAorMHgxNywgMHhDMSwgMHgyQiwgMHhCRCwKKworMHgyRCwgMHgyMCwKKzB4MjUsIDB4MjAsCisweDA1LCAweDIwLAorMHgwRCwgMHgyMCwKKworMHhCMywgMHg2OCwKKzB4OTcsIDB4MjUsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDMzLCAweEMwLCAweDMzLCAweEFGLAorMHgyRiwgMHhDMCwgMHgyMSwgMHhDMCwK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4LAorCisweDZDLCAweDY0LCAweEM4LCAweEVDLAorMHg5OCwgMHhFMSwKKzB4QjUsIDB4MDUsCisKKzB4QkQsIDB4MDUsCisweDJFLCAweDMwLAorMHgzMiwgMHhDMCwgMHhBMCwgMHhFOCwKKworMHgzMywgMHhDMCwgMHhBMCwgMHhFOCwKKzB4NzQsIDB4NjQsIDB4QzgsIDB4RUMsCisKKzB4NDAsIDB4M0MsIDB4NDAsIDB4QUQsCisweDMyLCAweDZBLAorMHgyQSwgMHgzMCwKKworMHgyMCwgMHg3MywKKzB4MzMsIDB4NkEsCisweDAwLCAweEUwLAorMHgyOCwgMHg3MywKKworMHgxQywgMHg3MiwKKzB4ODMsIDB4RTIsCisweDdCLCAweDgwLCAweDE1LCAweEVBLAorCisweEI4LCAweDNELCAweDI4LCAweERGLAorMHgzMCwgMHgzNSwgMHgyMCwgMHhERiwKKworMHg0MCwgMHgzMCwKKzB4MDAsIDB4RTAsCisweENDLCAweEUyLAorMHg2NCwgMHg3MiwKKworMHgyNSwgMHg0MiwgMHg1MiwgMHhCRiwKKzB4MkQsIDB4NDIsIDB4NEEsIDB4QkYsCisKKzB4MzAsIDB4MkUsIDB4MzAsIDB4REYsCisweDM4LCAweDJFLCAweDM4LCAweERGLAorCisweDE4LCAweDFELCAweDQ1LCAweEU5LAorMHgxRSwgMHgxNSwgMHg0NSwgMHhFOSwKKworMHgyQiwgMHg0OSwgMHg1MSwgMHhCRCwKKzB4MDAsIDB4RTAsCisweDFGLCAweDczLAorCisweDM4LCAweDM4LCAweDQwLCAweEFGLAorMHgzMCwgMHgzMCwgMHg0MCwgMHhBRiwKKworMHgyNCwgMHgxRiwgMHgyNCwgMHhERiwKKzB4MUQsIDB4MzIsIDB4MjAsIDB4RTksCisKKzB4MkMsIDB4MUYsIDB4MkMsIDB4REYsCisweDFBLCAweDMzLCAweDIwLCAweEU5LAorCisweEIwLCAweDEwLAorMHgwOCwgMHhFMywKKzB4NDAsIDB4MTAsCisweEI4LCAweDEwLA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B4MDAsIDB4RTAsCisweDBELCAweDIwLAorMHgzMiwgMHgyMCwKKzB4MDUsIDB4MjAsCisKKzB4ODcsIDB4ODAsIDB4NTcsIDB4RTksCisweDFGLCAweDU0LCAweDU3LCAweDlGLAorCisweDE3LCAweDQyLCAweDU2LCAweDlGLAorMHgwMCwgMHhFMCwKKzB4M0IsIDB4NkEsCisKKzB4M0YsIDB4OEYsIDB4NTEsIDB4OUYsCisweDM3LCAweDFFLCAweDRGLCAweEU5LAorCisweDM3LCAweDMyLCAweDJBLCAweEFGLAorMHgwMCwgMHhFMCwKKzB4MzIsIDB4MDAsCisKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisweDI3LCAweEMwLCAweDQ0LCAweEMwLAorCisweDM2LCAweDFGLCAweDRGLCAweEU5LAorMHgxRiwgMHgxRiwgMHgyNiwgMHhERiwKKworMHgzNywgMHgxQiwgMHgzNywgMHhCRiwKKzB4MTcsIDB4MjYsIDB4MTcsIDB4REYsCisKKzB4M0UsIDB4MTcsIDB4NEYsIDB4RTksCisweDNGLCAweDNGLCAweDRGLCAweEU5LAorCisweDM0LCAweDFGLCAweDM0LCAweEFGLAorMHgyQiwgMHgwNSwKKzB4QTcsIDB4MjAsCisKKzB4MzMsIDB4MkIsIDB4MzcsIDB4REYsCisweDI3LCAweDE3LCAweEMwLCAweEFGLAorCisweDM0LCAweDgwLCAweDRGLCAweEU5LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgyRCwgMHgyMSwgMHgxQSwgMHhCMCwKKzB4MjUsIDB4MjEsIDB4MzEsIDB4QjAsCisKKzB4MEQsIDB4MjEsIDB4MUEsIDB4QjIsCisweDA1LCAweDIxLCAweDMxLCAweEIyLAorCisweDAzLCAweDgwLCAweDJBLCAweEVBLAorMHgxNywgMHhDMSwgMHgyQiwgMHhCRCwKKworMHgyRCwgMHgyMCwKKzB4MjUsIDB4MjAsCisweDA1LCAweDIwLAorMHgwRCwgMHgyMCwKKworMHhCMywgM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CisweEIzLCAweEUyLCAweDJELCAweDlGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHg2NiwgMHgzMSwgMHg2NiwgMHhCRiwKKzB4NDcsIDB4MzksIDB4NDcsIDB4QkYsCisKKzB4NTcsIDB4MzksIDB4NTcsIDB4QkYsCisweDY3LCAweDM5LCAweDY3LCAweEJGLAorCisweDY5LCAweDgwLCAweDA3LCAweEVBLAorMHgyNCwgMHg0MSwgMHgyMCwgMHhFOSwKKworMHgzNSwgMHgwMCwKKzB4M0QsIDB4MDAsCisweDAwLCAweEUwLAorMHgyRCwgMHg3MywKKworMHgzMywgMHg3MiwKKzB4MEMsIDB4RTMsCisweDhELCAweDJGLCAweDFFLCAweEJELAorCisweDQzLCAweDc1LCAweEY4LCAweEVDLAorMHgzNSwgMHgyMCwKKzB4M0QsIDB4MjAsCisKKzB4NDMsIDB4NDMsIDB4MkQsIDB4REYsCisweDUzLCAweDUzLCAweDJELCAweERGLAorCisweEFFLCAweDFFLCAweDBFLCAweEJELAorMHg1OCwgMHhFMywKKzB4MzMsIDB4NjYsCisKKzB4NDgsIDB4MzUsIDB4NDgsIDB4QkYsCisweDU4LCAweDM1LCAweDU4LCAweEJGLAorCisweDY4LCAweDM1LCAweDY4LCAweEJGLAorMHg0OSwgMHgzRCwgMHg0OSwgMHhCRiwKKworMHg1OSwgMHgzRCwgMHg1OSwgMHhCRiwKKzB4NjksIDB4M0QsIDB4NjksIDB4QkYsCisKKzB4NjMsIDB4NjMsIDB4MkQsIDB4REYsCisweDRELCAweDdELCAweEY4LCAweEVDLAorCisweDU5LCAweEUzLAorMHgwMCwgMHhFMCwKKzB4QjgsIDB4MzgsIDB4MzMsIDB4QkYsCisKKzB4MkQsIDB4NzMsCisweDMwLCAweDc2LAorMHgxOCwgMHgzQSwgMHg0MSwgMHhFOSwKKworMHgzRiwgMHg1MywgMHhBMCwgMHhFOCwKKzB4MDUsIDB4ODAsIDB4M0QsIDB4RUEsCisKKzB4MzcsIDB4NDMsIDB4QTAsIDB4RTgsCisweDNELCAweDYzLCAweEEwLCAweEU4LAorCisweDUwLCAweDcwLCAweEY4LCAweEVDLAorMHgyQiwgMHg1MCwgMHgzQywgMHhFOSwKKworMHgxRiwgMHgwRiwgMHhCQywgMHhFOCwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4NTksIDB4NzgsIDB4RjgsIDB4RUMsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDE1LCAweEMwLCAweDIwLCAweEU5LAorMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKworMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisKKzB4MUUsIDB4MTIsIDB4NDEsIDB4RTksCisweDFBLCAweDIyLCAweDQxLCAweEU5LAorCisweDQ2LCAweDM3LCAweDQ2LCAweERGLAorMHg1NiwgMHgzRiwgMHg1NiwgMHhERiwKKworMHgyQiwgMHg0MCwgMHgzRCwgMHhFOSwKKzB4NjYsIDB4M0QsIDB4NjYsIDB4REYsCisKKzB4MUQsIDB4MzIsIDB4NDEsIDB4RTksCisweDY3LCAweDNELCAweDY3LCAweERGLAorCisweDQ3LCAweDM3LCAweDQ3LCAweERGLAorMHg1NywgMHgzRiwgMHg1NywgMHhERiwKKworMHgyQSwgMHg0MCwgMHgyMCwgMHhFOSwKKzB4NTksIDB4M0YsIDB4NTksIDB4REYsCisKKzB4MTYsIDB4MzAsIDB4MjAsIDB4RTksCisweDY5LCAweDNELCAweDY5LCAweERGLAorCisweDQ4LCAweDM3LCAweDQ4LCAweERGLAorMHg1OCwgMHgzRiwgMHg1OCwgMHhERiwKKworMHgxMiwgMHgxMiwgMHgyRCwgMHhERiwKKzB4MjIsIDB4MjIsIDB4MkQsIDB4REYsCisKKzB4MzIsIDB4MzIsIDB4MkQsIDB4REYsCisweDNBLCAweDNBLCAweDJELCAweERGLAorCisweDY4LCAweDNELCAweDY4LCAweERGLAorMH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sIDB4RUEsCisKKzB4NzMsIDB4N0IsIDB4QzgsIDB4RUMsCisweDBFLCAweDYxLCAweDYwLCAweEVBLAorCisweDMyLCAweDQwLCAweDUwLCAweEJELAorMHgyMiwgMHg0MCwgMHg2MCwgMHhCRCwKKworMHgxMiwgMHg0MSwgMHg1MSwgMHhCRCwKKzB4M0EsIDB4NDEsIDB4NjEsIDB4QkQsCisKKzB4QkYsIDB4MkYsIDB4MEUsIDB4QkQsCisweDk3LCAweEUyLAorMHg3QiwgMHg3MiwKKworMHgzMiwgMHgyMCwKKzB4MjIsIDB4MjAsCisweDEyLCAweDIwLAorMHgzQSwgMHgyMCwKKworMHgzNSwgMHg0OCwgMHhCMSwgMHhFOCwKKzB4M0QsIDB4NTksIDB4QjEsIDB4RTgsCisKKzB4NDYsIDB4MzEsIDB4NDYsIDB4QkYsCisweDU2LCAweDMxLCAweDU2LCAweEJGLAorCisweEIzLCAweEUyLCAweDJELCAweDlGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHg2NiwgMHgzMSwgMHg2NiwgMHhCRiwKKzB4NDcsIDB4MzksIDB4NDcsIDB4QkYsCisKKzB4NTcsIDB4MzksIDB4NTcsIDB4QkYsCisweDY3LCAweDM5LCAweDY3LCAweEJGLAorCisweDZELCAweDgwLCAweDA3LCAweEVBLAorMHgyNCwgMHg0MSwgMHgyMCwgMHhFOSwKKworMHgzNSwgMHgwMCwKKzB4M0QsIDB4MDAsCisweDAwLCAweEUwLAorMHgyRCwgMHg3MywKKworMHgzMywgMHg3MiwKKzB4MEMsIDB4RTMsCisweDhELCAweDJGLCAweDFFLCAweEJELAorCisweDQzLCAweDc1LCAweEY4LCAweEVDLAorMHgzNSwgMHgyMCwKKzB4M0QsIDB4MjAsCisKKzB4NDMsIDB4NDMsIDB4MkQsIDB4REYsCisweDUzLCAweDUzLCAweDJELCAweERGLAorCisweEFFLCAweDFFLCAweDBFLCAweEJELAorMHg1OCwgMHhFMywKKzB4MzMsIDB4NjY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KKzB4MUQsIDB4MzIsIDB4NDEsIDB4RTksCisweDY3LCAweDNELCAweDY3LCAweERGLAorCisweDQ3LCAweDM3LCAweDQ3LCAweERGLAorMHg1NywgMHgzRiwgMHg1NywgMHhERiwKKworMHgyQSwgMHg0MCwgMHgyMCwgMHhFOSwKKzB4NTksIDB4M0YsIDB4NTksIDB4REYsCisKKzB4MTYsIDB4MzAsIDB4MjAsIDB4RTksCisweDY5LCAweDNELCAweDY5LCAweERGLAorCisweDQ4LCAweDM3LCAweDQ4LCAweERGLAorMHg1OCwgMHgzRiwgMHg1OCwgMHhERiwKKworMHgxMiwgMHgxMiwgMHgyRCwgMHhERiwKKzB4MjIsIDB4MjIsIDB4MkQsIDB4REYsCisKKzB4MzIsIDB4MzIsIDB4MkQsIDB4REYsCisweDNBLCAweDNBLCAweDJELCAweERGLAorCisweDY4LCAweDNELCAweDY4LCAweERGLAorMHg0OSwgMHgzNywgMHg0OSwgMHhERiwKKworMHgzRCwgMHhDRiwgMHg3NCwgMHhDMCwKKzB4MzcsIDB4Q0YsIDB4NzQsIDB4QzQsCisKKzB4MzEsIDB4NTMsIDB4MkYsIDB4OUYsCisweDM0LCAweDgwLCAweDIwLCAweEU5LAorCisweDM5LCAweEU1LCAweDJDLCAweDlGLAorMHgzQywgMHgzRCwgMHgyMCwgMHhFOSwKKworMHgwQSwgMHg0NCwgMHg1NCwgMHhCMCwKKzB4MDIsIDB4NDQsIDB4NjQsIDB4QjAsCisKKzB4MkEsIDB4NDQsIDB4NTQsIDB4QjIsCisweDFBLCAweDQ0LCAweDY0LCAweEIyLAorCisweDI5LCAweDgwLCAweDNBLCAweEVBLAorMHgwQSwgMHgyMCwKKzB4MDIsIDB4MjAsCisKKzB4MEYsIDB4Q0YsIDB4NzQsIDB4QzYsCisweDNELCAweENGLCAweDc0LCAweEMyLAorCisweDg4LCAweDczLCAweDVFLCAweEU5LAorMHgyQSwgMHgyMCwKKzB4MUEsIDB4MjAsCisKKzB4MzAsIDB4NTAsID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4MkUsIDB4OUYsCisweDlELCAweDMxLCAweDRGLCAweEU5LAorCisweDM4LCAweDIxLCAweDJDLCAweDlGLAorMHg5RSwgMHgzOSwgMHg0RiwgMHhFOSwKKworMHgwQSwgMHg0OCwgMHg1OCwgMHhCRiwKKzB4MDIsIDB4NDgsIDB4NjgsIDB4QkYsCisKKzB4MzEsIDB4NTMsIDB4MkYsIDB4OUYsCisweDgwLCAweDMxLCAweDU3LCAweEU5LAorCisweDM5LCAweEU1LCAweDJDLCAweDlGLAorMHg4MSwgMHgzOSwgMHg1NywgMHhFOSwKKworMHgyQSwgMHg0OSwgMHg1OSwgMHhCRiwKKzB4MUEsIDB4NDksIDB4NjksIDB4QkYsCisKKzB4MzAsIDB4NTAsIDB4MkUsIDB4OUYsCisweDgyLCAweDMwLCAweDU3LCAweEU5LAorCisweDM4LCAweDIxLCAweDJDLCAweDlGLAorMHg4MywgMHgzOCwgMHg1NywgMHhFOSwKKworMHgzMSwgMHg1MywgMHgyRiwgMHg5RiwKKzB4ODQsIDB4MzEsIDB4NUUsIDB4RTksCisKKzB4MzksIDB4RTUsIDB4MkMsIDB4OUYsCisweDg1LCAweDM5LCAweDVFLCAweEU5LAorCisweDg2LCAweDc2LCAweDU3LCAweEU5LAorMHg4QSwgMHgzNiwgMHgyMCwgMHhFOSwKKworMHg4NywgMHg3NywgMHg1NywgMHhFOSwKKzB4OEIsIDB4M0UsIDB4QkYsIDB4RUEsCisKKzB4ODAsIDB4MzAsIDB4NTcsIDB4RTksCisweDgxLCAweDM4LCAweDU3LCAweEU5LAorCisweDgyLCAweDMxLCAweDU3LCAweEU5LAorMHg4NiwgMHg3OCwgMHg1NywgMHhFOSwKKworMHg4MywgMHgzOSwgMHg1NywgMHhFOSwKKzB4ODcsIDB4NzksIDB4NTcsIDB4RTksCisKKzB4MzAsIDB4MUYsIDB4NUYsIDB4RTksCisweDhBLCAweDM0LCAweDIwLCAweEU5LAorCisweDhCLCAweDNDLCAweDIwLCAweEU5LAorMHgzN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yLCAweDIwLAorMHgzQSwgMHgyMCwKKworMHgzNSwgMHg0OCwgMHhCMSwgMHhFOCwKKzB4M0QsIDB4NTksIDB4QjEsIDB4RTgsCisKKzB4NDYsIDB4MzEsIDB4NDYsIDB4QkYsCisweDU2LCAweDMxLCAweDU2LCAweEJGLAorCisweEIzLCAweEUyLCAweDJELCAweDlGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHg2NiwgMHgzMSwgMHg2NiwgMHhCRiwKKzB4NDcsIDB4MzksIDB4NDcsIDB4QkYsCisKKzB4NTcsIDB4MzksIDB4NTcsIDB4QkYsCisweDY3LCAweDM5LCAweDY3LCAweEJGLAorCisweDcyLCAweDgwLCAweDA3LCAweEVBLAorMHgyNCwgMHg0MSwgMHgyMCwgMHhFOSwKKworMHgzNSwgMHgwMCwKKzB4M0QsIDB4MDAsCisweDAwLCAweEUwLAorMHgyRCwgMHg3MywKKworMHgzMywgMHg3MiwKKzB4MEMsIDB4RTMsCisweDhELCAweDJGLCAweDFFLCAweEJELAorCisweDQzLCAweDc1LCAweEY4LCAweEVDLAorMHgzNSwgMHgyMCwKKzB4M0QsIDB4MjAsCisKKzB4NDMsIDB4NDMsIDB4MkQsIDB4REYsCisweDUzLCAweDUzLCAweDJELCAweERGLAorCisweEFFLCAweDFFLCAweDBFLCAweEJELAorMHg1OCwgMHhFMywKKzB4MzMsIDB4NjYsCisKKzB4NDgsIDB4MzUsIDB4NDgsIDB4QkYsCisweDU4LCAweDM1LCAweDU4LCAweEJGLAorCisweDY4LCAweDM1LCAweDY4LCAweEJGLAorMHg0OSwgMHgzRCwgMHg0OSwgMHhCRiwKKworMHg1OSwgMHgzRCwgMHg1OSwgMHhCRiwKKzB4NjksIDB4M0QsIDB4NjksIDB4QkYsCisKKzB4NjMsIDB4NjMsIDB4MkQsIDB4REYsCisweDRELCAweDdELCAweEY4LCAweEVDLAorCisweDU5LCAweEUzLAorMHgwMCwgMHhFMCwKKzB4QjgsIDB4MzgsIDB4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weDU3LCAweEU5LAorCisweDM5LCAweEU1LCAweDJDLCAweDlGLAorMHg4MSwgMHgzOSwgMHg1NywgMHhFOSwKKworMHgyQSwgMHg0OSwgMHg1OSwgMHhCRiwKKzB4MUEsIDB4NDksIDB4NjksIDB4QkYsCisKKzB4MzAsIDB4NTAsIDB4MkUsIDB4OUYsCisweDgyLCAweDMwLCAweDU3LCAweEU5LAorCisweDM4LCAweDIxLCAweDJDLCAweDlGLAorMHg4MywgMHgzOCwgMHg1NywgMHhFOSwKKworMHgzMSwgMHg1MywgMHgyRiwgMHg5RiwKKzB4ODQsIDB4MzEsIDB4NUUsIDB4RTksCisKKzB4MzksIDB4RTUsIDB4MkMsIDB4OUYsCisweDg1LCAweDM5LCAweDVFLCAweEU5LAorCisweDg2LCAweDc2LCAweDU3LCAweEU5LAorMHg4QSwgMHgzNiwgMHgyMCwgMHhFOSwKKworMHg4NywgMHg3NywgMHg1NywgMHhFOSwKKzB4OEIsIDB4M0UsIDB4QkYsIDB4RUEsCisKKzB4ODAsIDB4MzAsIDB4NTcsIDB4RTksCisweDgxLCAweDM4LCAweDU3LCAweEU5LAorCisweDgyLCAweDMxLCAweDU3LCAweEU5LAorMHg4NiwgMHg3OCwgMHg1NywgMHhFOSwKKworMHg4MywgMHgzOSwgMHg1NywgMHhFOSwKKzB4ODcsIDB4NzksIDB4NTcsIDB4RTksCisKKzB4MzAsIDB4MUYsIDB4NUYsIDB4RTksCisweDhBLCAweDM0LCAweDIwLCAweEU5LAorCisweDhCLCAweDNDLCAweDIwLCAweEU5LAorMHgzNywgMHg1MCwgMHg2MCwgMHhCRCwKKworMHg1NywgMHgwRCwgMHgyMCwgMHhFOSwKKzB4MzUsIDB4NTEsIDB4NjEsIDB4QkQsCisKKzB4MkIsIDB4NTAsIDB4MjAsIDB4RTksCisweDFELCAweDM3LCAweEUxLCAweEVBLAorCisweDFFLCAweDM1LCAweEUxLCAweEVBLAorMHgwMCwgMHhFMCwKKzB4MEUsIDB4NzcsCisKKz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IDB4RjgsIDB4RUMsCisweDJCLCAweDUwLCAweDNDLCAweEU5LAorCisweDFGLCAweDBGLCAweEJDLCAweEU4LAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHg1OSwgMHg3OCwgMHhGOCwgMHhFQywKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisweDE1LCAweEMwLCAweDIwLCAweEU5LAorCisweDE1LCAweEMwLCAweDIwLCAweEU5LAorMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKworMHgxRSwgMHgxMiwgMHg0MSwgMHhFOSwKKzB4MUEsIDB4MjIsIDB4NDEsIDB4RTksCisKKzB4NDYsIDB4MzcsIDB4NDYsIDB4REYsCisweDU2LCAweDNGLCAweDU2LCAweERGLAorCisweDJCLCAweDQwLCAweDNELCAweEU5LAorMHg2NiwgMHgzRCwgMHg2NiwgMHhERiwKKworMHgxRCwgMHgzMiwgMHg0MSwgMHhFOSwKKzB4NjcsIDB4M0QsIDB4NjcsIDB4REYsCisKKzB4NDcsIDB4MzcsIDB4NDcsIDB4REYsCisweDU3LCAweDNGLCAweDU3LCAweERGLAorCisweDJBLCAweDQwLCAweDIwLCAweEU5LAorMHg1OSwgMHgzRiwgMHg1OSwgMHhERiwKKworMHgxNiwgMHgzMCwgMHgyMCwgMHhFOSwKKzB4NjksIDB4M0QsIDB4NjksIDB4REYsCisKKzB4NDgsIDB4MzcsIDB4NDgsIDB4REYsCisweDU4LCAweDNGLCAweDU4LCAweERGLAorCisweDY4LCAweDNELCAweDY4LCAweERGLAorMHg0OSwgMHgzNywgMHg0OSwgMHhERiwKKworMHgzMiwgMHgzMiwgMHgyRCwgMHhERiwKKzB4MjIsIDB4MjIsIDB4MkQsIDB4REYsCisKKzB4MTIsIDB4MTIsIDB4MkQsIDB4REYsCisweDNBLCAweDNBLCAweDJELCAweERGLAorCisweDBGLCAweENGLCAweDc0LCAweEMyLAorMHgzNywgMH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gMHhFQywKKworMHg1OSwgMHhFMywKKzB4MDAsIDB4RTAsCisweEI4LCAweDM4LCAweDMzLCAweEJGLAorCisweDJELCAweDczLAorMHgzMCwgMHg3NiwKKzB4MTgsIDB4M0EsIDB4NDEsIDB4RTksCisKKzB4M0YsIDB4NTMsIDB4QTAsIDB4RTgsCisweDA1LCAweDgwLCAweDNELCAweEVBLAorCisweDM3LCAweDQzLCAweEEwLCAweEU4LAorMHgzRCwgMHg2MywgMHhBMCwgMHhFOCwKKworMHg1MCwgMHg3MCwgMHhGOCwgMHhFQywKKzB4MkIsIDB4NTAsIDB4M0MsIDB4RTksCisKKzB4MUYsIDB4MEYsIDB4QkMsIDB4RTgsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDU5LCAweDc4LCAweEY4LCAweEVDLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisweDE1LCAweEMwLCAweDIwLCAweEU5LAorCisweDFFLCAweDEyLCAweDQxLCAweEU5LAorMHgxQSwgMHgyMiwgMHg0MSwgMHhFOSwKKworMHg0NiwgMHgzNywgMHg0NiwgMHhERiwKKzB4NTYsIDB4M0YsIDB4NTYsIDB4REYsCisKKzB4MkIsIDB4NDAsIDB4M0QsIDB4RTksCisweDY2LCAweDNELCAweDY2LCAweERGLAorCisweDFELCAweDMyLCAweDQxLCAweEU5LAorMHg2NywgMHgzRCwgMHg2NywgMHhERiwKKworMHg0NywgMHgzNywgMHg0NywgMHhERiwKKzB4NTcsIDB4M0YsIDB4NTcsIDB4REYsCisKKzB4MkEsIDB4NDAsIDB4MjAsIDB4RTksCisweDU5LCAweDNGLCAweDU5LCAweERGLAorCisweDE2LCAweDMwLCAweDIwLCAweEU5LAorMHg2OSwgMHgzRCwgMHg2OSwgMHhERiwKKworMHg0OCwgMHgzNywg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AsIDB4MkUsIDB4OUYsCisweDgyLCAweDMwLCAweDU3LCAweEU5LAorCisweDM4LCAweDIxLCAweDJDLCAweDlGLAorMHg4MywgMHgzOCwgMHg1NywgMHhFOSwKKworMHgzMSwgMHg1MywgMHgyRiwgMHg5RiwKKzB4ODQsIDB4MzEsIDB4NUUsIDB4RTksCisKKzB4MzksIDB4RTUsIDB4MkMsIDB4OUYsCisweDg1LCAweDM5LCAweDVFLCAweEU5LAorCisweDg2LCAweDc2LCAweDU3LCAweEU5LAorMHg4QSwgMHgzNiwgMHgyMCwgMHhFOSwKKworMHg4NywgMHg3NywgMHg1NywgMHhFOSwKKzB4OEIsIDB4M0UsIDB4QkYsIDB4RUEsCisKKzB4ODAsIDB4MzAsIDB4NTcsIDB4RTksCisweDgxLCAweDM4LCAweDU3LCAweEU5LAorCisweDgyLCAweDMxLCAweDU3LCAweEU5LAorMHg4NiwgMHg3OCwgMHg1NywgMHhFOSwKKworMHg4MywgMHgzOSwgMHg1NywgMHhFOSwKKzB4ODcsIDB4NzksIDB4NTcsIDB4RTksCisKKzB4MzAsIDB4MUYsIDB4NUYsIDB4RTksCisweDhBLCAweDM0LCAweDIwLCAweEU5LAorCisweDhCLCAweDNDLCAweDIwLCAweEU5LAorMHgzNywgMHg1MCwgMHg2MCwgMHhCRCwKKworMHg1NywgMHgwRCwgMHgyMCwgMHhFOSwKKzB4MzUsIDB4NTEsIDB4NjEsIDB4QkQsCisKKzB4MkIsIDB4NTAsIDB4MjAsIDB4RTksCisweDFELCAweDM3LCAweEUxLCAweEVBLAorCisweDFFLCAweDM1LCAweEUxLCAweEVBLAorMHgwMCwgMHhFMCwKKzB4MEUsIDB4NzcsCisKKzB4MjQsIDB4NTEsIDB4MjAsIDB4RTksCisweDhELCAweEZGLCAweDIwLCAweEVBLAorCisweDE2LCAweDBFLCAweDIwLCAweEU5LAorMHg1NywgMHgyRSwgMHhCRiwgMHhFQSwKKworMHgwQiwgMHg0NiwgMHhBMCwgMHhFOCwKKzB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NywgMHhFQSwKKzB4MjQsIDB4NDEsIDB4MjAsIDB4RTksCisKKzB4MzUsIDB4MDAsCisweDNELCAweDAwLAorMHgwMCwgMHhFMCwKKzB4MkQsIDB4NzMsCisKKzB4MzMsIDB4NzIsCisweDBDLCAweEUzLAorMHg4RCwgMHgyRiwgMHgxRSwgMHhCRCwKKworMHg0MywgMHg3NSwgMHhGOCwgMHhFQywKKzB4MzUsIDB4MjAsCisweDNELCAweDIwLAorCisweDQzLCAweDQzLCAweDJELCAweERGLAorMHg1MywgMHg1MywgMHgyRCwgMHhERiwKKworMHhBRSwgMHgxRSwgMHgwRSwgMHhCRCwKKzB4NTgsIDB4RTMsCisweDMzLCAweDY2LAorCisweDQ4LCAweDM1LCAweDQ4LCAweEJGLAorMHg1OCwgMHgzNSwgMHg1OCwgMHhCRiwKKworMHg2OCwgMHgzNSwgMHg2OCwgMHhCRiwKKzB4NDksIDB4M0QsIDB4NDksIDB4QkYsCisKKzB4NTksIDB4M0QsIDB4NTksIDB4QkYsCisweDY5LCAweDNELCAweDY5LCAweEJGLAorCisweDYzLCAweDYzLCAweDJELCAweERGLAorMHg0RCwgMHg3RCwgMHhGOCwgMHhFQywKKworMHg1OSwgMHhFMywKKzB4MDAsIDB4RTAsCisweEI4LCAweDM4LCAweDMzLCAweEJGLAorCisweDJELCAweDczLAorMHgzMCwgMHg3NiwKKzB4MTgsIDB4M0EsIDB4NDEsIDB4RTksCisKKzB4M0YsIDB4NTMsIDB4QTAsIDB4RTgsCisweDA1LCAweDgwLCAweDNELCAweEVBLAorCisweDM3LCAweDQzLCAweEEwLCAweEU4LAorMHgzRCwgMHg2MywgMHhBMCwgMHhFOCwKKworMHg1MCwgMHg3MCwgMHhGOCwgMHhFQywKKzB4MkIsIDB4NTAsIDB4M0MsIDB4RTksCisKKzB4MUYsIDB4MEYsIDB4QkMsIDB4RTgsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDU5LCAweDc4LCAweEY4LCAweEVDLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisweDE1LCAweEMwLCAweDIwLCAweEU5LAorCisweDFFLCAweDEyLCAweDQxLCAweEU5LAorMHgxQSwgMHgyMiwgMHg0MSwgMHhFOSwKKworMHg0NiwgMHgzNywgMHg0NiwgMHhERiwKKzB4NTYsIDB4M0YsIDB4NTYsIDB4REYsCisKKzB4MkIsIDB4NDAsIDB4M0QsIDB4RTksCisweDY2LCAweDNELCAweDY2LCAweERGLAorCisweDFELCAweDMyLCAweDQxLCAweEU5LAorMHg2NywgMHgzRCwgMHg2NywgMHhERiwKKworMHg0NywgMHgzNywgMHg0NywgMHhERiwKKzB4NTcsIDB4M0YsIDB4NTcsIDB4REYsCisKKzB4MkEsIDB4NDAsIDB4MjAsIDB4RTksCisweDU5LCAweDNGLCAweDU5LCAweERGLAorCisweDE2LCAweDMwLCAweDIwLCAweEU5LAorMHg2OSwgMHgzRCwgMHg2OSwgMHhERiwKKworMHg0OCwgMHgzNywgMHg0OCwgMHhERiwKKzB4NTgsIDB4M0YsIDB4NTgsIDB4REYsCisKKzB4NjgsIDB4M0QsIDB4NjgsIDB4REYsCisweDQ5LCAweDM3LCAweDQ5LCAweERGLAorCisweDMyLCAweDMyLCAweDJELCAweERGLAorMHgyMiwgMHgyMiwgMHgyRCwgMHhERiwKKworMHgxMiwgMHgxMiwgMHgyRCwgMHhERiwKKzB4M0EsIDB4M0EsIDB4MkQsIDB4REYsCisKKzB4MEYsIDB4Q0YsIDB4NzQsIDB4QzIsCisweDM3LCAweENGLCAweDc0LCAweEM0LAorCisweDBBLCAweDQ0LCAweDU0LCAweEIwLAorMHgwMiwgMHg0NCwgMHg2NCwgMHhCMCwKKworMHgzRCwgMHhDRiwgMHg3NCwgMHhDMCwKKzB4MzQsIDB4MzcsIDB4MjAsID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isweDBCLCAweDAwLAorMHgxQiwgMHgwMCwKKzB4MkIsIDB4MDAsCisweDAwLCAweEUwLAorCisweDBDLCAweDAwLAorMHgxQywgMHgwMCwKKzB4MkMsIDB4MDAsCisweDAwLCAweEUwLAorCisweDBCLCAweDY1LAorMHgxQiwgMHg2NSwKKzB4MkIsIDB4NjUsCisweDAwLCAweEUwLAorCisweDBDLCAweDY1LAorMHgxQywgMHg2NSwKKzB4MkMsIDB4NjUsCisweDAwLCAweEUwLAorCisweDBCLCAweDFCLCAweDYwLCAweEVDLAorMHgzNiwgMHhENywgMHgzNiwgMHhBRCwKKworMHgyQiwgMHg4MCwgMHg2MCwgMHhFQywKKzB4MEMsIDB4MUMsIDB4NjAsIDB4RUMsCisKKzB4M0UsIDB4RDcsIDB4M0UsIDB4QUQsCisweDJDLCAweDgwLCAweDYwLCAweEVDLAorCisweDBCLCAweDJCLCAweERFLCAweEU4LAorMHgxQiwgMHg4MCwgMHhERSwgMHhFOCwKKworMHgzNiwgMHg4MCwgMHgzNiwgMHhCRCwKKzB4M0UsIDB4ODAsIDB4M0UsIDB4QkQsCisKKzB4MzMsIDB4RDcsIDB4MEIsIDB4QkQsCisweDNCLCAweEQ3LCAweDFCLCAweEJELAorCisweDQ2LCAweDgwLCAweDQ2LCAweENGLAorMHg1NywgMHg4MCwgMHg1NywgMHhDRiwKKworMHg2NiwgMHgzMywgMHg2NiwgMHhDRiwKKzB4NDcsIDB4M0IsIDB4NDcsIDB4Q0YsCisKKzB4NTYsIDB4MzMsIDB4NTYsIDB4Q0YsCisweDY3LCAweDNCLCAweDY3LCAweENGLAorCisweDBCLCAweDQ4LCAweEEwLCAweEU4LAorMHgxQiwgMHg1OCwgMHhBMCwgMHhFOCwKKworMHgyQiwgMHg2OCwgMHhBMCwgMHhFOCwKKzB4MEMsIDB4NDksIDB4QTAsIDB4RTgsCisKKzB4MUMsIDB4NTksIDB4QTAsIDB4RTgsCisweDJDLCAweDY5LCAweEEwLCAweEU4LAorCisweDBCLCAweDAwLAorMHgxQiwgMHgwMCwKKzB4MkIsIDB4MDAsCisweDAwLCAweEUwLAorCisweDBDLCAweDAwLAorMHgxQywgMHgwMCwKKzB4MkMsIDB4MDAsCisweDAwLCAweEUwLAorCisweDBCLCAweDY1LAorMHgxQiwgMHg2NSwKKzB4MkIsIDB4NjUsCisweDAwLCAweEUwLAorCisweDBDLCAweDY1LAorMHgxQywgMHg2NSwKKzB4MkMsIDB4NjUsCisweDAwLCAweEUwLAorCisweDBCLCAweDFCLCAweDYwLCAweEVDLAorMHgzNCwgMHhENywgMHgzNCwgMHhBRCwKKworMHgyQiwgMHg4MCwgMHg2MCwgMHhFQywKKzB4MEMsIDB4MUMsIDB4NjAsIDB4RUMsCisKKzB4M0MsIDB4RDcsIDB4M0MsIDB4QUQsCisweDJDLCAweDgwLCAweDYwLCAweEVDLAorCisweDBCLCAweDJCLCAweERFLCAweEU4LAorMHgxQiwgMHg4MCwgMHhERSwgMHhFOCwKKworMHgzNCwgMHg4MCwgMHgzNCwgMHhCRCwKKzB4M0MsIDB4ODAsIDB4M0MsIDB4QkQsCisKKzB4MzMsIDB4RDcsIDB4MEIsIDB4QkQsCisweDNCLCAweEQ3LCAweDFCLCAweEJELAorCisweDQ4LCAweDgwLCAweDQ4LCAweENGLAorMHg1OSwgMHg4MCwgMHg1OSwgMHhDRiwKKworMHg2OCwgMHgzMywgMHg2OCwgMHhDRiwKKzB4NDksIDB4M0IsIDB4NDksIDB4Q0YsCisKKzB4QTksIDB4RkYsIDB4MjAsIDB4RUEsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDU4LCAweDMzLCAweDU4LCAweENGLAorMHg2OSwgMHgzQiwgMHg2OSwgMHhDRiwKKworMHg2NywgMHhGRiwgMHgyMCwgMHhFQSwKKzB4NTcsIDB4QzAsIDB4QkYsIDB4RUEsCisKKzB4MDAsIDB4ODAsIDB4QTAsIDB4RTksCisweDAwLCAweDAwLCAweEQ4LCAweEVDLAorCit9OworCitzdGF0aWMgdW5zaWduZWQgY2hhciB3YXJwX2c0MDBfdDJnenNmW10gPSB7CisKKzB4MDAsIDB4OEEsIDB4OTgsIDB4RTksCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDAwLCAweDgwLCAweEEwLCAweEU5LAorMHgwMCwgMHgwMCwgMHhEOCwgMHhFQywKKworMHhGRiwgMHg4MCwgMHhDMCwgMHhFOSwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MEEsIDB4NDAsIDB4NTAsIDB4QkYsCisweDJBLCAweDQwLCAweDYwLCAweEJGLAorCisweDMyLCAweDQxLCAweDUxLCAweEJGLAorMHgzQSwgMHg0MSwgMHg2MSwgMHhCRiwKKworMHhDMywgMHg2QiwKKzB4RDMsIDB4NkIsCisweDAwLCAweDhBLCAweDk4LCAweEU5LAorCisweDczLCAweDdCLCAweEM4LCAweEVDLAorMHg5NiwgMHhFMiwKKzB4NDEsIDB4MDQsCisKKzB4N0IsIDB4NDMsIDB4QTAsIDB4RTgsCisweDczLCAweDUzLCAweEEwLCAweEU4LAorCisweEFELCAweEVFLCAweDIzLCAweDlGLAorMHgwMCwgMHhFMCwKKzB4NTEsIDB4MDQsCisKKzB4OTAsIDB4RTIsCisweDYxLCAweDA0LAorMHgzMSwgMHg0NiwgMHhCMSwgMHhFOCwKKworMHg1MSwgMHg0MSwgMHhFMCwgMHhFQywKKzB4MzksIDB4NjcsIDB4QjEsIDB4RTgsCisKKzB4MDAsIDB4MDQsCisweDQ2LCAweEUyLAorMHg3MywgMHg2MywgMHhBMCwgMHhFOCwKKworMHg2MSwgMHg0MSwgMHhFMCwgMHhFQywKKzB4MzEsIDB4MDAsCisweDM5LCAweDAwLAorCisweDhBLCAweDgwLCAweDE1LCAweEVBLAorMHgxMCwgMHgwNCwKKzB4MjAsIDB4MDQsCisKKzB4NjEsIDB4NTEsIDB4RTAsIDB4RUMsCisweDJGLCAweDQxLCAweDYwLCAweEVBLAorCisweDMxLCAweDIwLAorMHgzO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OSwKKzB4MUEsIDB4MjIsIDB4NDEsIDB4RTksCisKKzB4NDYsIDB4MzcsIDB4NDYsIDB4REYsCisweDU2LCAweDNGLCAweDU2LCAweERGLAorCisweDJCLCAweDQwLCAweDNELCAweEU5LAorMHg2NiwgMHgzRCwgMHg2NiwgMHhERiwKKworMHgxRCwgMHgzMiwgMHg0MSwgMHhFOSwKKzB4NjcsIDB4M0QsIDB4NjcsIDB4REYsCisKKzB4NDcsIDB4MzcsIDB4NDcsIDB4REYsCisweDU3LCAweDNGLCAweDU3LCAweERGLAorCisweDJBLCAweDQwLCAweDIwLCAweEU5LAorMHg1OSwgMHgzRiwgMHg1OSwgMHhERiwKKworMHgxNiwgMHgzMCwgMHgyMCwgMHhFOSwKKzB4NjksIDB4M0QsIDB4NjksIDB4REYsCisKKzB4NDgsIDB4MzcsIDB4NDgsIDB4REYsCisweDU4LCAweDNGLCAweDU4LCAweERGLAorCisweDY4LCAweDNELCAweDY4LCAweERGLAorMHg0OSwgMHgzNywgMHg0OSwgMHhERiwKKworMHgzMiwgMHgzMiwgMHgyRCwgMHhERiwKKzB4MjIsIDB4MjIsIDB4MkQsIDB4REYsCisKKzB4MTIsIDB4MTIsIDB4MkQsIDB4REYsCisweDNBLCAweDNBLCAweDJELCAweERGLAorCisweDBGLCAweENGLCAweDc0LCAweEMyLAorMHgzNywgMHhDRiwgMHg3NCwgMHhDNCwKKworMHgwQSwgMHg0NCwgMHg1NCwgMHhCMCwKKzB4MDIsIDB4NDQsIDB4NjQsIDB4QjAsCisKKzB4M0QsIDB4Q0YsIDB4NzQsIDB4QzAsCisweDM0LCAweDM3LCAweDIwLCAweEU5LAorCisweDMxLCAweDUzLCAweDJGLCAweDlGLAorMHgzOCwgMHgwRiwgMHgyMCwgMHhFOSwKKworMHgzOSwgMHhFNSwgMHgyQywgMHg5RiwKKzB4M0MsIDB4M0QsIDB4MjAsIDB4RTksCisKKzB4MkEsIDB4NDQsIDB4NTQsIDB4QjIsCisweDFBLCAweDQ0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zLCAweDYzLCAweEJGLAorCisweDMwLCAweDUwLCAweDJFLCAweDlGLAorMHgzNSwgMHgzMSwgMHg0RiwgMHhFOSwKKworMHgzOCwgMHgyMSwgMHgyQywgMHg5RiwKKzB4MzksIDB4MzksIDB4NEYsIDB4RTksCisKKzB4MEEsIDB4NDgsIDB4NTgsIDB4QkYsCisweDAyLCAweDQ4LCAweDY4LCAweEJGLAorCisweDMxLCAweDUzLCAweDJGLCAweDlGLAorMHg4MCwgMHgzMSwgMHg1NywgMHhFOSwKKworMHgzOSwgMHhFNSwgMHgyQywgMHg5RiwKKzB4ODEsIDB4MzksIDB4NTcsIDB4RTksCisKKzB4MkEsIDB4NDksIDB4NTksIDB4QkYsCisweDFBLCAweDQ5LCAweDY5LCAweEJGLAorCisweDMwLCAweDUwLCAweDJFLCAweDlGLAorMHg4MiwgMHgzMCwgMHg1NywgMHhFOSwKKworMHgzOCwgMHgyMSwgMHgyQywgMHg5RiwKKzB4ODMsIDB4MzgsIDB4NTcsIDB4RTksCisKKzB4MzEsIDB4NTMsIDB4MkYsIDB4OUYsCisweDg0LCAweDMxLCAweDVFLCAweEU5LAorCisweDM5LCAweEU1LCAweDJDLCAweDlGLAorMHg4NSwgMHgzOSwgMHg1RSwgMHhFOSwKKworMHg4NiwgMHg3NiwgMHg1NywgMHhFOSwKKzB4OEEsIDB4MzYsIDB4MjAsIDB4RTksCisKKzB4ODcsIDB4NzcsIDB4NTcsIDB4RTksCisweDhCLCAweDNFLCAweEJGLCAweEVBLAorCisweDgwLCAweDMwLCAweDU3LCAweEU5LAorMHg4MSwgMHgzOCwgMHg1NywgMHhFOSwKKworMHg4MiwgMHgzMSwgMHg1NywgMHhFOSwKKzB4ODYsIDB4NzgsIDB4NTcsIDB4RTksCisKKzB4ODMsIDB4MzksIDB4NTcsIDB4RTksCisweDg3LCAweDc5LCAweDU3LCAweEU5LAorCisweDMwLCAweDFGLCAweDVGLCAweEU5LAorMHg4QSwgMHgzNCwgMHgyMCwgMHhFOS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sCisKKzB4MzIsIDB4MjAsCisweDIyLCAweDIwLAorMHgxMiwgMHgyMCwKKzB4M0EsIDB4MjAsCisKKzB4NDYsIDB4MzEsIDB4NDYsIDB4QkYsCisweDRFLCAweDMxLCAweDRFLCAweEJGLAorCisweEIzLCAweEUyLCAweDJELCAweDlGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHg1NiwgMHgzMSwgMHg1NiwgMHhCRiwKKzB4NDcsIDB4MzksIDB4NDcsIDB4QkYsCisKKzB4NEYsIDB4MzksIDB4NEYsIDB4QkYsCisweDU3LCAweDM5LCAweDU3LCAweEJGLAorCisweDRBLCAweDgwLCAweDA3LCAweEVBLAorMHgyNCwgMHg0MSwgMHgyMCwgMHhFOSwKKworMHg0MiwgMHg3MywgMHhGOCwgMHhFQywKKzB4MDAsIDB4RTAsCisweDJELCAweDczLAorCisweDMzLCAweDcyLAorMHgwQywgMHhFMywKKzB4QTUsIDB4MkYsIDB4MUUsIDB4QkQsCisKKzB4NDMsIDB4NDMsIDB4MkQsIDB4REYsCisweDRCLCAweDRCLCAweDJELCAweERGLAorCisweEFFLCAweDFFLCAweDI2LCAweEJELAorMHg1OCwgMHhFMywKKzB4MzMsIDB4NjYsCisKKzB4NTMsIDB4NTMsIDB4MkQsIDB4REYsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweEI4LCAweDM4LCAweDMzLCAweEJGLAorMHgwMCwgMHhFMCwKKzB4NTksIDB4RTMsCisKKzB4MUUsIDB4MTIsIDB4NDEsIDB4RTksCisweDFBLCAweDIyLCAweDQxLCAweEU5LAorCisweDJCLCAweDQwLCAweDNELCAweEU5LAorMHgzRiwgMHg0QiwgMHhBMCwgMHhFOCwKKworMHgyRCwgMHg3MywKKzB4MzAsIDB4NzYsCisweDA1LCAweDgwLCAweDNELCAweEVBLAorCisweDM3LCAweDQzLCAweEEwLCAweEU4LAorMHgzRCwgMHg1MywgMHhBMCwgMHhFOCwKKworMHg0OCwgMHg3MCwgMH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weDJDLCAweDU3LCAweEEwLCAweEU4LAorCisweDFDLCAweDAwLAorMHgyMywgMHgwMCwKKzB4MkIsIDB4MDAsCisweDAwLCAweEUwLAorCisweDFELCAweDAwLAorMHgyNCwgMHgwMCwKKzB4MkMsIDB4MDAsCisweDAwLCAweEUwLAorCisweDFDLCAweDY1LAorMHgyMywgMHg2NSwKKzB4MkIsIDB4NjUsCisweDAwLCAweEUwLAorCisweDFELCAweDY1LAorMHgyNCwgMHg2NSwKKzB4MkMsIDB4NjUsCisweDAwLCAweEUwLAorCisweDFDLCAweDIzLCAweDYwLCAweEVDLAorMHgzNiwgMHhENywgMHgzNiwgMHhBRCwKKworMHgyQiwgMHg4MCwgMHg2MCwgMHhFQywKKzB4MUQsIDB4MjQsIDB4NjAsIDB4RUMsCisKKzB4M0UsIDB4RDcsIDB4M0UsIDB4QUQsCisweDJDLCAweDgwLCAweDYwLCAweEVDLAorCisweDFDLCAweDJCLCAweERFLCAweEU4LAorMHgyMywgMHg4MCwgMHhERSwgMHhFOCwKKworMHgzNiwgMHg4MCwgMHgzNiwgMHhCRCwKKzB4M0UsIDB4ODAsIDB4M0UsIDB4QkQsCisKKzB4MzMsIDB4RDcsIDB4MUMsIDB4QkQsCisweDNCLCAweEQ3LCAweDIzLCAweEJELAorCisweDQ2LCAweDgwLCAweDQ2LCAweENGLAorMHg0RiwgMHg4MCwgMHg0RiwgMHhDRiwKKworMHg1NiwgMHgzMywgMHg1NiwgMHhDRiwKKzB4NDcsIDB4M0IsIDB4NDcsIDB4Q0YsCisKKzB4RDYsIDB4RkYsIDB4MjAsIDB4RUEsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDRFLCAweDMzLCAweDRFLCAweENGLAorMHg1NywgMHgzQiwgMHg1NywgMHhDRiwKKworMHg5RCwgMHhGRiwgMHgyMCwgMHhFQSwKKzB4NTcsIDB4QzAsIDB4QkYsIDB4RUEsCisKKzB4MDAsIDB4ODAsIDB4QTAsIDB4RTksCisweDAwLCAweD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LCAweDRGLCAweERGLAorCisweDMyLCAweDMyLCAweDJELCAweERGLAorMHgyMiwgMHgyMiwgMHgyRCwgMHhERiwKKworMHgxMiwgMHgxMiwgMHgyRCwgMHhERiwKKzB4M0EsIDB4M0EsIDB4MkQsIDB4REYsCisKKzB4NDcsIDB4MzcsIDB4NDcsIDB4REYsCisweDU3LCAweDNELCAweDU3LCAweERGLAorCisweDNELCAweENGLCAweDc0LCAweEMwLAorMHgzNywgMHhDRiwgMHg3NCwgMHhDNCwKKworMHgzMSwgMHg1MywgMHgyRiwgMHg5RiwKKzB4MzQsIDB4ODAsIDB4MjAsIDB4RTksCisKKzB4MzksIDB4RTUsIDB4MkMsIDB4OUYsCisweDNDLCAweDNELCAweDIwLCAweEU5LAorCisweDI3LCAweENGLCAweDc0LCAweEM2LAorMHgzRCwgMHhDRiwgMHg3NCwgMHhDMiwKKworMHgwQSwgMHg0NCwgMHg0QywgMHhCMCwKKzB4MDIsIDB4NDQsIDB4NTQsIDB4QjAsCisKKzB4MkEsIDB4NDQsIDB4NEMsIDB4QjIsCisweDFBLCAweDQ0LCAweDU0LCAweEIyLAorCisweDIwLCAweDgwLCAweDNBLCAweEVBLAorMHgwQSwgMHgyMCwKKzB4MDIsIDB4MjAsCisKKzB4ODgsIDB4NzMsIDB4NUUsIDB4RTksCisweDJBLCAweDIwLAorMHgxQSwgMHgyMCwKKworMHgzMCwgMHg1MCwgMHgyRSwgMHg5RiwKKzB4MzIsIDB4MzEsIDB4NUYsIDB4RTksCisKKzB4MzgsIDB4MjEsIDB4MkMsIDB4OUYsCisweDMzLCAweDM5LCAweDVGLCAweEU5LAorCisweDMxLCAweDUzLCAweDJGLCAweDlGLAorMHg5QywgMHgyNywgMHgyMCwgMHhFOSwKKworMHgwQSwgMHg0NCwgMHg0QywgMHhCNCwKKzB4MDIsIDB4NDQsIDB4NTQsIDB4QjQsCisKKzB4MkEsIDB4NDQsIDB4NEMsIDB4QjYsCisweDFBLCAweDQ0LCAweDU0LCAweEI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CisweDg2LCAweDc2LCAweDU3LCAweEU5LAorMHg4QiwgMHgzRSwgMHgyMCwgMHhFOSwKKworMHg4MiwgMHgzMCwgMHg1NywgMHhFOSwKKzB4ODcsIDB4NzcsIDB4NTcsIDB4RTksCisKKzB4ODMsIDB4MzgsIDB4NTcsIDB4RTksCisweDM1LCAweDQ5LCAweDUxLCAweEJELAorCisweDg0LCAweDMxLCAweDVFLCAweEU5LAorMHgzMCwgMHgxRiwgMHg1RiwgMHhFOSwKKworMHg4NSwgMHgzOSwgMHg1RSwgMHhFOSwKKzB4NTcsIDB4MjUsIDB4MjAsIDB4RTksCisKKzB4MkIsIDB4NDgsIDB4MjAsIDB4RTksCisweDFELCAweDM3LCAweEUxLCAweEVBLAorCisweDFFLCAweDM1LCAweEUxLCAweEVBLAorMHgwMCwgMHhFMCwKKzB4MjYsIDB4NzcsCisKKzB4MjQsIDB4NDksIDB4MjAsIDB4RTksCisweEFCLCAweEZGLCAweDIwLCAweEVBLAorCisweDE2LCAweDI2LCAweDIwLCAweEU5LAorMHg1NywgMHgyRSwgMHhCRiwgMHhFQSwKKworMHgxQywgMHg0NiwgMHhBMCwgMHhFOCwKKzB4MjMsIDB4NEUsIDB4QTAsIDB4RTgsCisKKzB4MkIsIDB4NTYsIDB4QTAsIDB4RTgsCisweDFELCAweDQ3LCAweEEwLCAweEU4LAorCisweDI0LCAweDRGLCAweEEwLCAweEU4LAorMHgyQywgMHg1NywgMHhBMCwgMHhFOCwKKworMHgxQywgMHgwMCwKKzB4MjMsIDB4MDAsCisweDJCLCAweDAwLAorMHgwMCwgMHhFMCwKKworMHgxRCwgMHgwMCwKKzB4MjQsIDB4MDAsCisweDJDLCAweDAwLAorMHgwMCwgMHhFMCwKKworMHgxQywgMHg2NSwKKzB4MjMsIDB4NjUsCisweDJCLCAweDY1LAorMHgwMCwgMHhFMCwKKworMHgxRCwgMHg2NSwKKzB4MjQsIDB4NjUsCisweDJDLCAweDY1LAorMHgwMCwgMHhFMCwKKworMHgx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NDgsIDB4QkQsCisweDIyLCAweDQwLCAweDUwLCAweEJELAorCisweDEyLCAweDQxLCAweDQ5LCAweEJELAorMHgzQSwgMHg0MSwgMHg1MSwgMHhCRCwKKworMHhCRiwgMHgyRiwgMHgyNiwgMHhCRCwKKzB4MDAsIDB4RTAsCisweDdCLCAweDcyLAorCisweDMyLCAweDIwLAorMHgyMiwgMHgyMCwKKzB4MTIsIDB4MjAsCisweDNBLCAweDIwLAorCisweDQ2LCAweDMxLCAweDQ2LCAweEJGLAorMHg0RSwgMHgzMSwgMHg0RSwgMHhCRiwKKworMHhCMywgMHhFMiwgMHgyRCwgMHg5RiwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4NTYsIDB4MzEsIDB4NTYsIDB4QkYsCisweDQ3LCAweDM5LCAweDQ3LCAweEJGLAorCisweDRGLCAweDM5LCAweDRGLCAweEJGLAorMHg1NywgMHgzOSwgMHg1NywgMHhCRiwKKworMHg1MywgMHg4MCwgMHgwNywgMHhFQSwKKzB4MjQsIDB4NDEsIDB4MjAsIDB4RTksCisKKzB4NDIsIDB4NzMsIDB4RjgsIDB4RUMsCisweDAwLCAweEUwLAorMHgyRCwgMHg3MywKKworMHgzMywgMHg3MiwKKzB4MEMsIDB4RTMsCisweEE1LCAweDJGLCAweDFFLCAweEJELAorCisweDQzLCAweDQzLCAweDJELCAweERGLAorMHg0QiwgMHg0QiwgMHgyRCwgMHhERiwKKworMHhBRSwgMHgxRSwgMHgyNiwgMHhCRCwKKzB4NTgsIDB4RTMsCisweDMzLCAweDY2LAorCisweDUzLCAweDUzLCAweDJELCAweERGLAorMHgwMCwgMHg4MCwgMHgwMCwgMHhFOCwKKworMHhCOCwgMHgzOCwgMHgzMywgMHhCRiwKKzB4MDAsIDB4RTAsCisweDU5LCAweEUzLAorCisweDFFLCAweDEyLCAweDQxLCAweEU5LAorMHgxQSwgMHgyMiwgMHg0MSwgMHhFOSwKKworMHgyQiwgMHg0MCwgMHgzRCwgMHhFOS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IDB4RTksCisKKzB4ODYsIDB4NzYsIDB4NTcsIDB4RTksCisweDhCLCAweDNFLCAweDIwLCAweEU5LAorCisweDgyLCAweDMwLCAweDU3LCAweEU5LAorMHg4NywgMHg3NywgMHg1NywgMHhFOSwKKworMHg4MywgMHgzOCwgMHg1NywgMHhFOSwKKzB4MzUsIDB4NDksIDB4NTEsIDB4QkQsCisKKzB4ODQsIDB4MzEsIDB4NUUsIDB4RTksCisweDMwLCAweDFGLCAweDVGLCAweEU5LAorCisweDg1LCAweDM5LCAweDVFLCAweEU5LAorMHg1NywgMHgyNSwgMHgyMCwgMHhFOSwKKworMHgyQiwgMHg0OCwgMHgyMCwgMHhFOSwKKzB4MUQsIDB4MzcsIDB4RTEsIDB4RUEsCisKKzB4MUUsIDB4MzUsIDB4RTEsIDB4RUEsCisweDAwLCAweEUwLAorMHgyNiwgMHg3NywKKworMHgyNCwgMHg0OSwgMHgyMCwgMHhFOSwKKzB4QTYsIDB4RkYsIDB4MjAsIDB4RUEsCisKKzB4MTYsIDB4MjYsIDB4MjAsIDB4RTksCisweDU3LCAweDJFLCAweEJGLCAweEVBLAorCisweDFDLCAweDQ2LCAweEEwLCAweEU4LAorMHgyMywgMHg0RSwgMHhBMCwgMHhFOCwKKworMHgyQiwgMHg1NiwgMHhBMCwgMHhFOCwKKzB4MUQsIDB4NDcsIDB4QTAsIDB4RTgsCisKKzB4MjQsIDB4NEYsIDB4QTAsIDB4RTgsCisweDJDLCAweDU3LCAweEEwLCAweEU4LAorCisweDFDLCAweDAwLAorMHgyMywgMHgwMCwKKzB4MkIsIDB4MDAsCisweDAwLCAweEUwLAorCisweDFELCAweDAwLAorMHgyNCwgMHgwMCwKKzB4MkMsIDB4MDAsCisweDAwLCAweEUwLAorCisweDFDLCAweDY1LAorMHgyMywgMHg2NSwKKzB4MkIsIDB4NjUsCisweDAwLCAweEUwLAorCisweDFELCAweDY1LAorMHgyNCwgMHg2NSwKKzB4MkMsIDB4NjUsCisweDAwLCAweEUwLA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B4RTksCisKKzB4MkIsIDB4NDAsIDB4M0QsIDB4RTksCisweDNGLCAweDRCLCAweEEwLCAweEU4LAorCisweDJELCAweDczLAorMHgzMCwgMHg3NiwKKzB4MDUsIDB4ODAsIDB4M0QsIDB4RUEsCisKKzB4MzcsIDB4NDMsIDB4QTAsIDB4RTgsCisweDNELCAweDUzLCAweEEwLCAweEU4LAorCisweDQ4LCAweDcwLCAweEY4LCAweEVDLAorMHgyQiwgMHg0OCwgMHgzQywgMHhFOSwKKworMHgxRiwgMHgyNywgMHhCQywgMHhFOCwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDE1LCAweEMwLCAweDIwLCAweEU5LAorMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKworMHgxNSwgMHhDMCwgMHgyMCwgMHhFOSwKKzB4MTUsIDB4QzAsIDB4MjAsIDB4RTksCisKKzB4MTgsIDB4M0EsIDB4NDEsIDB4RTksCisweDFELCAweDMyLCAweDQxLCAweEU5LAorCisweDJBLCAweDQwLCAweDIwLCAweEU5LAorMHg1NiwgMHgzRCwgMHg1NiwgMHhERiwKKworMHg0NiwgMHgzNywgMHg0NiwgMHhERiwKKzB4NEUsIDB4M0YsIDB4NEUsIDB4REYsCisKKzB4MTYsIDB4MzAsIDB4MjAsIDB4RTksCisweDRGLCAweDNGLCAweDRGLCAweERGLAorCisweDMyLCAweDMyLCAweDJELCAweERGLAorMHgyMiwgMHgyMiwgMHgyRCwgMHhERiwKKworMHgxMiwgMHgxMiwgMHgyRCwgMHhERiwKKzB4M0EsIDB4M0EsIDB4MkQsIDB4REYsCisKKzB4NDcsIDB4MzcsIDB4NDcsIDB4REYsCisweDU3LCAweDNELCAweDU3LCAweERGLAorCisweDNELCAweENGLCAweDc0LCAweEMwLAorMHgzNywgMHhDRiwgMHg3NCwgMHhDNCwKKworMHgzOSwgMHhFNSw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IsIDB4REUsIDB4RTgsCisweDIzLCAweDgwLCAweERFLCAweEU4LAorCisweDM2LCAweDgwLCAweDM2LCAweEJELAorMHgzRSwgMHg4MCwgMHgzRSwgMHhCRCwKKworMHgzMywgMHhENywgMHgxQywgMHhCRCwKKzB4M0IsIDB4RDcsIDB4MjMsIDB4QkQsCisKKzB4NDYsIDB4ODAsIDB4NDYsIDB4Q0YsCisweDRGLCAweDgwLCAweDRGLCAweENGLAorCisweDU2LCAweDMzLCAweDU2LCAweENGLAorMHg0NywgMHgzQiwgMHg0NywgMHhDRiwKKworMHhEMywgMHhGRiwgMHgyMCwgMHhFQSwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4NEUsIDB4MzMsIDB4NEUsIDB4Q0YsCisweDU3LCAweDNCLCAweDU3LCAweENGLAorCisweDk4LCAweEZGLCAweDIwLCAweEVBLAorMHg1NywgMHhDMCwgMHhCRiwgMHhFQSwKKworMHgwMCwgMHg4MCwgMHhBMCwgMHhFOSwKKzB4MDAsIDB4MDAsIDB4RDgsIDB4RUMsCisKK307CisKK3N0YXRpYyB1bnNpZ25lZCBjaGFyIHdhcnBfZzQwMF90Z3pzW10gPSB7CisKKzB4MDAsIDB4ODgsIDB4OTgsIDB4RTksCisweDAwLCAweDgwLCAweDAwLCAweEU4LAorCisweDAwLCAweDgwLCAweEEwLCAweEU5LAorMHgwMCwgMHgwMCwgMHhEOCwgMHhFQywKKworMHhGRiwgMHg4MCwgMHhDMCwgMHhFOSwKKzB4MDAsIDB4ODAsIDB4MDAsIDB4RTgsCisKKzB4MjIsIDB4NDAsIDB4NDgsIDB4QkYsCisweDJBLCAweDQwLCAweDUwLCAweEJGLAorCisweDMyLCAweDQxLCAweDQ5LCAweEJGLAorMHgzQSwgMHg0MSwgMHg1MSwgMHhCRiwKKworMHhDMywgMHg2QiwKKzB4Q0IsIDB4NkIsCisweDAwLCAweDg4LCAweDk4LCAweEU5LAorCisweDczLCAweDdCLCAweEM4LCAweEVDLA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LCAweEJGLAorCisweDMxLCAweDUzLCAweDJGLCAweDlGLAorMHhBNCwgMHgzMSwgMHg0RiwgMHhFOSwKKworMHgzOSwgMHhFNSwgMHgyQywgMHg5RiwKKzB4QTUsIDB4MzksIDB4NEYsIDB4RTksCisKKzB4MEEsIDB4NDcsIDB4NEYsIDB4QkYsCisweDAyLCAweDQ3LCAweDU3LCAweEJGLAorCisweDMxLCAweDUzLCAweDJGLCAweDlGLAorMHhBMSwgMHgzMCwgMHg0RiwgMHhFOSwKKworMHgzOSwgMHhFNSwgMHgyQywgMHg5RiwKKzB4QTIsIDB4MzgsIDB4NEYsIDB4RTksCisKKzB4MkEsIDB4NDMsIDB4NEIsIDB4QkYsCisweDFBLCAweDQzLCAweDUzLCAweEJGLAorCisweDMwLCAweDUwLCAweDJFLCAweDlGLAorMHg5RCwgMHgzMSwgMHg0RiwgMHhFOSwKKworMHgzOCwgMHgyMSwgMHgyQywgMHg5RiwKKzB4OUUsIDB4MzksIDB4NEYsIDB4RTksCisKKzB4MzEsIDB4NTMsIDB4MkYsIDB4OUYsCisweDgwLCAweDMxLCAweDU3LCAweEU5LAorCisweDM5LCAweEU1LCAweDJDLCAweDlGLAorMHg4MSwgMHgzOSwgMHg1NywgMHhFOSwKKworMHgzNywgMHg0OCwgMHg1MCwgMHhCRCwKKzB4OEEsIDB4MzYsIDB4MjAsIDB4RTksCisKKzB4ODYsIDB4NzYsIDB4NTcsIDB4RTksCisweDhCLCAweDNFLCAweDIwLCAweEU5LAorCisweDgyLCAweDMwLCAweDU3LCAweEU5LAorMHg4NywgMHg3NywgMHg1NywgMHhFOSwKKworMHg4MywgMHgzOCwgMHg1NywgMHhFOSwKKzB4MzUsIDB4NDksIDB4NTEsIDB4QkQsCisKKzB4ODQsIDB4MzEsIDB4NUUsIDB4RTksCisweDMwLCAweDFGLCAweDVGLCAweEU5LAorCisweDg1LCAweDM5LCAweDVFLCAweEU5LAorMHg1NywgMHgyNSwgMHgyMCwgMHhFOSwKKworMHgy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pZiBSMTI4X0ZJRk9fREVCVUcKKwlEUk1fRVJST1IoICJmYWlsZWQhXG4iICk7CisjZW5kaWYKKwlyZXR1cm4gRFJNX0VSUihFQlVTWSk7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICogQ0NFIGNvbnRyb2wsIGluaXRpYWxpemF0aW9uCisgKi8KKworLyogTG9hZCB0aGUgbWljcm9jb2RlIGZvciB0aGUgQ0NFICovCitzdGF0aWMgdm9pZCByMTI4X2NjZV9sb2FkX21pY3JvY29kZSggZHJtX3IxMjhfcHJpdmF0ZV90ICpkZXZfcHJpdiApCit7CisJaW50IGk7CisKKwlEUk1fREVCVUcoICJcbiIgKTsKKworCXIxMjhfZG9fd2FpdF9mb3JfaWRsZSggZGV2X3ByaXYgKTsKKworCVIxMjhfV1JJVEUoIFIxMjhfUE00X01JQ1JPQ09ERV9BRERSLCAwICk7CisJZm9yICggaSA9IDAgOyBpIDwgMjU2IDsgaSsrICkgeworCQlSMTI4X1dSSVRFKCBSMTI4X1BNNF9NSUNST0NPREVfREFUQUgsCisJCQkgICAgcjEyOF9jY2VfbWljcm9jb2RlW2kgKiAyXSApOworCQlSMTI4X1dSSVRFKCBSMTI4X1BNNF9NSUNST0NPREVfREFUQUwsCisJCQkgICAgcjEyOF9jY2VfbWljcm9jb2RlW2kgKiAyICsgMV0gKTsKKwl9Cit9CisKKy8qIEZsdXNoIGFueSBwZW5kaW5nIGNvbW1hbmRzIHRvIHRoZSBDQ0UuICBUaGlzIHNob3VsZCBvbmx5IGJlIHVzZWQganVzdAorICogcHJpb3IgdG8gYSB3YWl0IGZvciBpZGxlLCBhcyBpdCBpbmZvcm1zIHRoZSBlbmdpbmUgdGhhdCB0aGUgY29tbWFuZAorICogc3RyZWFtIGlzIGVuZGluZy4KKyAqLworc3RhdGljIHZvaWQgcjEyOF9kb19jY2VfZmx1c2goIGRybV9yMTI4X3ByaXZhdG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CSAqLworCXIxMjhfZG9fY2NlX3N0b3AoIGRldl9wcml2ICk7CisKKwkvKiBSZXNldCB0aGUgZW5naW5lICovCisJcjEyOF9kb19lbmdpbmVfcmVzZXQoIGRldiApOworCisJcmV0dXJuIDA7Cit9CisKKy8qIEp1c3QgcmVzZXQgdGhlIENDRSByaW5nLiAgQ2FsbGVkIGFzIHBhcnQgb2YgYW4gWCBTZXJ2ZXIgZW5naW5lIHJlc2V0LgorICovCitpbnQgcjEyOF9jY2VfcmVzZXQoIERSTV9JT0NUTF9BUkdTICkKK3sKKwlEUk1fREVWSUNFOworCWRybV9yMTI4X3ByaXZhdGVfdCAqZGV2X3ByaXYgPSBkZXYtPmRldl9wcml2YXRlOworCURSTV9ERUJVRyggIlxuIiApOworCisJTE9DS19URVNUX1dJVEhfUkVUVVJOKCBkZXYsIGZpbHAgKTsKKworCWlmICggIWRldl9wcml2ICkgeworCQlEUk1fREVCVUcoICIlcyBjYWxsZWQgYmVmb3JlIGluaXQgZG9uZVxuIiwgX19GVU5DVElPTl9fICk7CisJCXJldHVybiBEUk1fRVJSKEVJTlZBTCk7CisJfQorCisJcjEyOF9kb19jY2VfcmVzZXQoIGRldl9wcml2ICk7CisKKwkvKiBUaGUgQ0NFIGlzIG5vIGxvbmdlciBydW5uaW5nIGFmdGVyIGFuIGVuZ2luZSByZXNldCAqLworCWRldl9wcml2LT5jY2VfcnVubmluZyA9IDA7CisKKwlyZXR1cm4gMDsKK30KKworaW50IHIxMjhfY2NlX2lkbGUoIERSTV9JT0NUTF9BUkdTICkKK3sKKwlEUk1fREVWSUNFOworCWRybV9yMTI4X3ByaXZhdGVfdCAqZGV2X3ByaXYgPSBkZXYtPmRldl9wcml2YXRlOworCURSTV9ERUJVRyggIlxuIiApOworCisJTE9DS19URVNUX1dJVEhfUkVUVVJOKCBkZXYsIGZpbHAgKTsKKworCWlmICggZGV2X3ByaXYtPmNjZV9ydW5uaW5nICkgeworCQlyMTI4X2RvX2NjZV9mbHVzaCggZGV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ICk7CisJcmV0dXJuIE5VTEw7Cit9CisKK3ZvaWQgcjEyOF9mcmVlbGlzdF9yZXNldCggZHJtX2RldmljZV90ICpkZXYgKQoreworCWRybV9kZXZpY2VfZG1hX3QgKmRtYSA9IGRldi0+ZG1hOworCWludCBpOworCisJZm9yICggaSA9IDAgOyBpIDwgZG1hLT5idWZfY291bnQgOyBpKysgKSB7CisJCWRybV9idWZfdCAqYnVmID0gZG1hLT5idWZsaXN0W2ldOworCQlkcm1fcjEyOF9idWZfcHJpdl90ICpidWZfcHJpdiA9IGJ1Zi0+ZGV2X3ByaXZhdGU7CisJCWJ1Zl9wcml2LT5hZ2UgPSAwOworCX0KK30KKworCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisgKiBDQ0UgY29tbWFuZCBzdWJtaXNzaW9uCisgKi8KKworaW50IHIxMjhfd2FpdF9yaW5nKCBkcm1fcjEyOF9wcml2YXRlX3QgKmRldl9wcml2LCBpbnQgbiApCit7CisJZHJtX3IxMjhfcmluZ19idWZmZXJfdCAqcmluZyA9ICZkZXZfcHJpdi0+cmluZzsKKwlpbnQgaTsKKworCWZvciAoIGkgPSAwIDsgaSA8IGRldl9wcml2LT51c2VjX3RpbWVvdXQgOyBpKysgKSB7CisJCXIxMjhfdXBkYXRlX3Jpbmdfc25hcHNob3QoIGRldl9wcml2ICk7CisJCWlmICggcmluZy0+c3BhY2UgPj0gbiApCisJCQlyZXR1cm4gMDsKKwkJRFJNX1VERUxBWSggMSApOworCX0KKworCS8qIEZJWE1FOiBUaGlzIGlzIGJlaW5nIGlnbm9yZWQuLi4gKi8KKwlEUk1fRVJST1IoICJmYWlsZWQhXG4iICk7CisJcmV0dXJuIERSTV9FUlIoRUJVU1kpOworfQorCitzdGF0aWMgaW50IHIxMjhfY2NlX2dldF9idWZmZXJzKCBEUk1GSUxFIGZpbHAsIGRybV9kZXZpY2VfdCAqZGV2LCBkcm1fZG1hX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SB7CisJCXIxMjhfY2xlYXJfYm94KCBkZXZfcHJpdiwgNjQsIDQsIDgsIDgsIDAsIDI1NSwgMCApOworCX0gZWxzZSB7CisJCWF0b21pY19zZXQoICZkZXZfcHJpdi0+aWRsZV9jb3VudCwgMCApOworCX0KK30KKworI2VuZGlmCisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICogQ0NFIGNvbW1hbmQgZGlzcGF0Y2ggZnVuY3Rpb25zCisgKi8KKworc3RhdGljIHZvaWQgcjEyOF9wcmludF9kaXJ0eSggY29uc3QgY2hhciAqbXNnLCB1bnNpZ25lZCBpbnQgZmxhZ3MgKQoreworCURSTV9JTkZPKCAiJXM6ICgweCV4KSAlcyVzJXMlcyVzJXMlcyVzJXNcbiIsCisJCSAgbXNnLAorCQkgIGZsYWdzLAorCQkgIChmbGFncyAmIFIxMjhfVVBMT0FEX0NPUkUpICAgICAgICA/ICJjb3JlLCAiIDogIiIsCisJCSAgKGZsYWdzICYgUjEyOF9VUExPQURfQ09OVEVYVCkgICAgID8gImNvbnRleHQsICIgOiAiIiwKKwkJICAoZmxhZ3MgJiBSMTI4X1VQTE9BRF9TRVRVUCkgICAgICAgPyAic2V0dXAsICIgOiAiIiwKKwkJICAoZmxhZ3MgJiBSMTI4X1VQTE9BRF9URVgwKSAgICAgICAgPyAidGV4MCwgIiA6ICIiLAorCQkgIChmbGFncyAmIFIxMjhfVVBMT0FEX1RFWDEpICAgICAgICA/ICJ0ZXgxLCAiIDogIiIsCisJCSAgKGZsYWdzICYgUjEyOF9VUExPQURfTUFTS1MpICAgICAgID8gIm1hc2tzLCAiIDogIiIsCisJCSAgKGZsYWdzICYgUjEyOF9VUExPQURfV0lORE9XKSAgICAgID8gIndpbmRvdywgIiA6ICIiLAorCQkgIChmbGFncyAmIFIxMjhfVVBMT0FEX0NMSVBSRUNUUykgICA/ICJjbGlwcmVjdHMsICIgOiAiIiwKKwkJIC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fUklORyggUjEyOF9QQ19GTFVTSF9HVUkgKTsKKworCUFEVkFOQ0VfUklORygpOworCisJcmV0dXJuIDA7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICogVGlsZWQgZGVwdGggYnVmZmVyIG1hbmFnZW1lbnQKKyAqCisgKiBGSVhNRTogVGhlc2Ugc2hvdWxkIGFsbCBzZXQgdGhlIGRlc3RpbmF0aW9uIHdyaXRlIG1hc2sgZm9yIHdoZW4gd2UKKyAqIGhhdmUgaGFyZHdhcmUgc3RlbmNpbCBzdXBwb3J0LgorICovCisKK3N0YXRpYyBpbnQgcjEyOF9jY2VfZGlzcGF0Y2hfd3JpdGVfc3BhbiggZHJtX2RldmljZV90ICpkZXYsCisJCQkJCSBkcm1fcjEyOF9kZXB0aF90ICpkZXB0aCApCit7CisJZHJtX3IxMjhfcHJpdmF0ZV90ICpkZXZfcHJpdiA9IGRldi0+ZGV2X3ByaXZhdGU7CisJaW50IGNvdW50LCB4LCB5OworCXUzMiAqYnVmZmVyOworCXU4ICptYXNrOworCWludCBpLCBidWZmZXJfc2l6ZSwgbWFza19zaXplOworCVJJTkdfTE9DQUxTOworCURSTV9ERUJVRyggIlxuIiApOworCisJY291bnQgPSBkZXB0aC0+bjsKKwlpZiAoY291bnQgPiA0MDk2IHx8IGNvdW50IDw9IDApCisJCXJldHVybiBEUk1fRVJSKEVNU0dTSVpFKTsKKworCWlmICggRFJNX0NPUFlfRlJPTV9VU0VSKCAmeCwgZGVwdGgtPngsIHNpemVvZih4KSApICkgeworCQlyZXR1cm4gRFJNX0VSUihFRkFVTFQpOworCX0KKwlpZiAoIERSTV9DT1BZX0ZST01fVVNFUiggJnksIGRlcHRoLT55LCBzaXplb2YoeSkgKSApIHsKKwkJcmV0dXJuIERSTV9FUlIoRUZBVUxUKTsKKwl9CisKKwlidWZmZXJfc2l6ZSA9IGRlcHRoLT5uICogc2l6ZW9mK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JCSh1bnNpZ25lZCBpbnQpUkFERU9OX1JFQUQoIFJBREVPTl9BSUNfUFRfQkFTRSApICk7CisJcHJpbnRrKCAiVExCX0FERFIgPSAweCUwOHhcbiIsCisJCSh1bnNpZ25lZCBpbnQpUkFERU9OX1JFQUQoIFJBREVPTl9BSUNfVExCX0FERFIgKSApOworCXByaW50ayggIlRMQl9EQVRBID0gMHglMDh4XG4iLAorCQkodW5zaWduZWQgaW50KVJBREVPTl9SRUFEKCBSQURFT05fQUlDX1RMQl9EQVRBICkgKTsKK30KKyNlbmRpZgorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKyAqIEVuZ2luZSwgRklGTyBjb250cm9sCisgKi8KKworc3RhdGljIGludCByYWRlb25fZG9fcGl4Y2FjaGVfZmx1c2goIGRybV9yYWRlb25fcHJpdmF0ZV90ICpkZXZfcHJpdiApCit7CisJdTMyIHRtcDsKKwlpbnQgaTsKKworCWRldl9wcml2LT5zdGF0cy5ib3hlcyB8PSBSQURFT05fQk9YX1dBSVRfSURMRTsKKworCXRtcCAgPSBSQURFT05fUkVBRCggUkFERU9OX1JCMkRfRFNUQ0FDSEVfQ1RMU1RBVCApOworCXRtcCB8PSBSQURFT05fUkIyRF9EQ19GTFVTSF9BTEw7CisJUkFERU9OX1dSSVRFKCBSQURFT05fUkIyRF9EU1RDQUNIRV9DVExTVEFULCB0bXAgKTsKKworCWZvciAoIGkgPSAwIDsgaSA8IGRldl9wcml2LT51c2VjX3RpbWVvdXQgOyBpKysgKSB7CisJCWlmICggIShSQURFT05fUkVBRCggUkFERU9OX1JCMkRfRFNUQ0FDSEVfQ1RMU1RBVCApCisJCSAgICAgICAmIFJBREVPTl9SQjJEX0RDX0JVU1kpICkgeworCQkJcmV0dXJuIDA7CisJCX0KKwkJRFJNX1VERUxBWSggMSApOworCX0KKworI2lmIFJBREVPTl9GSUZPX0RFQlVHCisJRFJNX0VSUk9SKCAiZmFpbGVkIVxuIiApOworCXJhZGVvbl9zdGF0dXMoIGRldl9wcml2ICk7CisjZW5kaWYKKwlyZXR1cm4gRFJNX0VSUihFQlVTWSk7Cit9CisKK3N0YXRpYyBpbnQgcmFkZW9uX2RvX3dhaXRfZm9yX2ZpZm8oIGRybV9yYWRlb25fcHJpdmF0ZV90ICpkZXZfcHJpdiwKKwkJCQkgICAgaW50IGVudHJpZXMgKQoreworCWludCBpOworCisJZGV2X3ByaXYtPnN0YXRzLmJveGVzIHw9IFJBREVPTl9CT1hfV0FJVF9JRExFOworCisJZm9yICggaSA9IDAgOyBpIDwgZGV2X3ByaXYtPnVzZWNfdGltZW91dCA7IGkrKyApIHsKKwkJaW50IHNsb3RzID0gKCBSQURFT05fUkVBRCggUkFERU9OX1JCQk1fU1RBVFVTICkKKwkJCSAgICAgICYgUkFERU9OX1JCQk1fRklGT0NOVF9NQVNLICk7CisJCWlmICggc2xvdHMgPj0gZW50cmllcyApIHJldHVybiAwOworCQlEUk1fVURFTEFZKCAxICk7CisJfQorCisjaWYgUkFERU9OX0ZJRk9fREVCVUcKKwlEUk1fRVJST1IoICJmYWlsZWQhXG4iICk7CisJcmFkZW9uX3N0YXR1cyggZGV2X3ByaXYgKTsKKyNlbmRpZgorCXJldHVybiBEUk1fRVJSKEVCVVNZKTsKK30KKworc3RhdGljIGludCByYWRlb25fZG9fd2FpdF9mb3JfaWRsZSggZHJtX3JhZGVvbl9wcml2YXRlX3QgKmRldl9wcml2ICkKK3sKKwlpbnQgaSwgcmV0OworCisJZGV2X3ByaXYtPnN0YXRzLmJveGVzIHw9IFJBREVPTl9CT1hfV0FJVF9JRExFOworCisJcmV0ID0gcmFkZW9uX2RvX3dhaXRfZm9yX2ZpZm8oIGRldl9wcml2LCA2NCApOworCWlmICggcmV0ICkgcmV0dXJuIHJldDsKKworCWZvciAoIGkgPSAwIDsgaSA8IGRldl9wcml2LT51c2VjX3RpbWVvdXQgOyBpKysgKSB7CisJCWlmICggIShSQURFT05fUkVBRCggUkFERU9OX1JCQk1fU1RBVFVTICkKKwkJICAgICAgICYgUkFERU9OX1JCQk1fQUNUSVZFKSApIHsKKwkJCXJhZGVvbl9kb19waXhjYWNoZV9mbHVzaCggZGV2X3ByaXYgKTsKKwkJCXJldHVybiAwOworCQl9CisJCURSTV9VREVMQVkoIDEgKTsKKwl9CisKKyNpZiBSQURFT05fRklGT19ERUJVRworCURSTV9FUlJPUiggImZhaWxlZCFcbiIgKTsKKwlyYWRlb25fc3RhdHVzKCBkZXZfcHJpdiApOworI2VuZGlmCisJcmV0dXJuIERSTV9FUlIoRUJVU1kpOworfQorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKyAqIENQIGNvbnRyb2wsIGluaXRpYWxpemF0aW9uCisgKi8KKworLyogTG9hZCB0aGUgbWljcm9jb2RlIGZvciB0aGUgQ1AgKi8KK3N0YXRpYyB2b2lkIHJhZGVvbl9jcF9sb2FkX21pY3JvY29kZSggZHJtX3JhZGVvbl9wcml2YXRlX3QgKmRldl9wcml2ICkKK3sKKwlpbnQgaTsKKwlEUk1fREVCVUcoICJcbiIgKTsKKworCXJhZGVvbl9kb193YWl0X2Zvcl9pZGxlKCBkZXZfcHJpdiApOworCisJUkFERU9OX1dSSVRFKCBSQURFT05fQ1BfTUVfUkFNX0FERFIsIDAgKTsKKworCWlmIChkZXZfcHJpdi0+bWljcm9jb2RlX3ZlcnNpb249PVVDT0RFX1IyMDApIHsKKwkJRFJNX0lORk8oIkxvYWRpbmcgUjIwMCBNaWNyb2NvZGVcbiIpOworCQlmb3IgKCBpID0gMCA7IGkgPCAyNTYgOyBpKysgKSAKKwkJeworCQkJUkFERU9OX1dSSVRFKCBSQURFT05fQ1BfTUVfUkFNX0RBVEFILAorCQkJCSAgICAgIFIyMDBfY3BfbWljcm9jb2RlW2ldWzFdICk7CisJCQlSQURFT05fV1JJVEUoIFJBREVPTl9DUF9NRV9S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fREVCVUcoICJcbiIgKTsKKyNpZiAwCisJdTMyIHRtcDsKKworCXRtcCA9IFJBREVPTl9SRUFEKCBSQURFT05fQ1BfUkJfV1BUUiApIHwgKDEgPDwgMzEpOworCVJBREVPTl9XUklURSggUkFERU9OX0NQX1JCX1dQVFIsIHRtcCApOworI2VuZGlmCit9CisKKy8qIFdhaXQgZm9yIHRoZSBDUCB0byBnbyBpZGxlLgorICovCitpbnQgcmFkZW9uX2RvX2NwX2lkbGUoIGRybV9yYWRlb25fcHJpdmF0ZV90ICpkZXZfcHJpdiApCit7CisJUklOR19MT0NBTFM7CisJRFJNX0RFQlVHKCAiXG4iICk7CisKKwlCRUdJTl9SSU5HKCA2ICk7CisKKwlSQURFT05fUFVSR0VfQ0FDSEUoKTsKKwlSQURFT05fUFVSR0VfWkNBQ0hFKCk7CisJUkFERU9OX1dBSVRfVU5USUxfSURMRSgpOworCisJQURWQU5DRV9SSU5HKCk7CisJQ09NTUlUX1JJTkcoKTsKKworCXJldHVybiByYWRlb25fZG9fd2FpdF9mb3JfaWRsZSggZGV2X3ByaXYgKTsKK30KKworLyogU3RhcnQgdGhlIENvbW1hbmQgUHJvY2Vzc29yLgorICovCitzdGF0aWMgdm9pZCByYWRlb25fZG9fY3Bfc3RhcnQoIGRybV9yYWRlb25fcHJpdmF0ZV90ICpkZXZfcHJpdiApCit7CisJUklOR19MT0NBTFM7CisJRFJNX0RFQlVHKCAiXG4iICk7CisKKwlyYWRlb25fZG9fd2FpdF9mb3JfaWRsZSggZGV2X3ByaXYgKTsKKworCVJBREVPTl9XUklURSggUkFERU9OX0NQX0NTUV9DTlRMLCBkZXZfcHJpdi0+Y3BfbW9kZSApOworCisJZGV2X3ByaXYtPmNwX3J1bm5pbmcgPSAxOworCisJQkVHSU5fUklORyggNiApOworCisJUkFERU9OX1BVUkdFX0NBQ0hFKCk7CisJUkFERU9OX1BVUkdFX1pDQUNIRSgpOworCVJBREVPTl9XQUlUX1VOVElMX0lETEUoKTsKKworCUFE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JVEhfUkVUVVJOKCBkZXYsIGZpbHAgKTsKKworCWlmICggIWRldl9wcml2ICkgeworCQlEUk1fREVCVUcoICIlcyBjYWxsZWQgYmVmb3JlIGluaXQgZG9uZVxuIiwgX19GVU5DVElPTl9fICk7CisJCXJldHVybiBEUk1fRVJSKEVJTlZBTCk7CisJfQorCisJcmFkZW9uX2RvX2NwX3Jlc2V0KCBkZXZfcHJpdiApOworCisJLyogVGhlIENQIGlzIG5vIGxvbmdlciBydW5uaW5nIGFmdGVyIGFuIGVuZ2luZSByZXNldCAqLworCWRldl9wcml2LT5jcF9ydW5uaW5nID0gMDsKKworCXJldHVybiAwOworfQorCitpbnQgcmFkZW9uX2NwX2lkbGUoIERSTV9JT0NUTF9BUkdTICkKK3sKKwlEUk1fREVWSUNFOworCWRybV9yYWRlb25fcHJpdmF0ZV90ICpkZXZfcHJpdiA9IGRldi0+ZGV2X3ByaXZhdGU7CisJRFJNX0RFQlVHKCAiXG4iICk7CisKKwlMT0NLX1RFU1RfV0lUSF9SRVRVUk4oIGRldiwgZmlscCApOworCisJcmV0dXJuIHJhZGVvbl9kb19jcF9pZGxlKCBkZXZfcHJpdiApOworfQorCisvKiBBZGRlZCBieSBDaGFybCBQLiBCb3RoYSB0byBjYWxsIHJhZGVvbl9kb19yZXN1bWVfY3AoKS4KKyAqLworaW50IHJhZGVvbl9jcF9yZXN1bWUoIERSTV9JT0NUTF9BUkdTICkKK3sKKwlEUk1fREVWSUNFOworCisJcmV0dXJuIHJhZGVvbl9kb19yZXN1bWVfY3AoZGV2KTsKK30KKworCitpbnQgcmFkZW9uX2VuZ2luZV9yZXNldCggRFJNX0lPQ1RMX0FSR1MgKQoreworCURSTV9ERVZJQ0U7CisJRFJNX0RFQlVHKCAiXG4iICk7CisKKwlMT0NLX1RFU1RfV0lUSF9SRVRVUk4oIGRldiwgZmlscCApOworCisJcmV0dXJuIHJhZGVvbl9kb19lbmdpbmVfcmVzZXQoIGRldiApOworfQorCisKKy8qID09PT09PT09P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saW5lLzEgKi8KKyNkZWZpbmUgUkFERU9OX0VNSVRfUFBfTFVNX01BVFJJWCAgICAgICAgICAgICAgICAgICA1IC8qIGJ1bXBtYXAvMSAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9ST1RfTUFUUklYXzAgICAgICAgICAgICAgICAgIDYgLyogYnVtcG1hcC8yICovCisjZGVmaW5lIFJBREVPTl9FTUlUX1JCM0RfU1RFTkNJTFJFRk1BU0sgICAgICAgICAgICAgNyAvKiBtYXNrcy8zICovCisjZGVmaW5lIFJBREVPTl9FTUlUX1NFX1ZQT1JUX1hTQ0FMRSAgICAgICAgICAgICAgICAgOCAvKiB2aWV3cG9ydC82ICovCisjZGVmaW5lIFJBREVPTl9FTUlUX1NFX0NOVEwgICAgICAgICAgICAgICAgICAgICAgICAgOSAvKiBzZXR1cC8yICovCisjZGVmaW5lIFJBREVPTl9FTUlUX1NFX0NOVExfU1RBVFVTICAgICAgICAgICAgICAgICAgMTAgLyogc2V0dXAvMSAqLworI2RlZmluZSBSQURFT05fRU1JVF9SRV9NSVNDICAgICAgICAgICAgICAgICAgICAgICAgIDExIC8qIG1pc2MvMSAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9UWEZJTFRFUl8wICAgICAgICAgICAgICAgICAgIDEyIC8qIHRleDAvNiAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9CT1JERVJfQ09MT1JfMCAgICAgICAgICAgICAgIDEzIC8qIHRleDAvMSAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9UWEZJTFRFUl8xICAgICAgICAgICAgICAgICAgIDE0IC8qIHRleDEvNiAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9CT1JERVJfQ09MT1JfMSAgICAgICAgICAgICAgIDE1IC8qIHRleDEvMSAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9UWEZJTFRFUl8yICAgICAgICAgICAgICAgICAgIDE2IC8qIHRleDIvNiAqLworI2RlZmluZSBSQURFT05fRU1JVF9QUF9CT1JERVJfQ09MT1JfMiAgICAgICAgICAgICAgIDE3IC8qIHRleDIvMSAqLworI2RlZmluZSBSQURFT05fRU1JVF9TRV9aQklBU19GQUNUT1IgICAgICAgICAgICAgICAgIDE4IC8qIHpiaWFzLzIgKi8KKyNkZWZpbmUgUkFERU9OX0VNSVRfU0VfVENMX09VVFBVVF9WVFhfRk1UICAgICAgICAgICAxOSAvKiB0Y2wvMTEgKi8KKyNkZWZpbmUgUkFERU9OX0VNSVRfU0VfVENMX01BVEVSSUFMX0VNTUlTU0lWRV9SRUQgICAyMCAvKiBtYXRlcmlhbC8xNyAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfMCAgICAgICAgICAgICAgICAgICAgIDIxIC8qIHRleDAvNCAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfMSAgICAgICAgICAgICAgICAgICAgIDIyIC8qIHRleDEvNCAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfMiAgICAgICAgICAgICAgICAgICAgIDIzIC8qIHRleDIvNCAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfMyAgICAgICAgICAgICAgICAgICAgIDI0IC8qIHRleDMvNCAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfNCAgICAgICAgICAgICAgICAgICAgIDI1IC8qIHRleDQvNCAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfNSAgICAgICAgICAgICAgICAgICAgIDI2IC8qIHRleDUvNCAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVFhDQkxFTkRfNiAgICAgICAgICAgICAgICAgICAgIDI3IC8qIC80ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWENCTEVORF83ICAgICAgICAgICAgICAgICAgICAgMjggLyogLzQgKi8KKyNkZWZpbmUgUjIwMF9FTUlUX1RDTF9MSUdIVF9NT0RFTF9DVExfMCAgICAgICAgICAgICAyOSAvKiB0Y2wvNyAqLworI2RlZmluZSBSMjAwX0VNSVRfVEZBQ1RPUl8wICAgICAgICAgICAgICAgICAgICAgICAgIDMwIC8qIHRmLzcgKi8KKyNkZWZpbmUgUjIwMF9FTUlUX1ZUWF9GTVRfMCAgICAgICAgICAgICAgICAgICAgICAgICAzMSAvKiB2dHgvNSAqLworI2RlZmluZSBSMjAwX0VNSVRfVkFQX0NUTCAgICAgICAgICAgICAgICAgICAgICAgICAgIDMyIC8qIHZhcC8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9NQVRSSVhfU0VMRUNUXzAgICAgICAgICAgICAgICAgICAgMzMgLyogbXNsLzUgKi8KKyNkZWZpbmUgUjIwMF9FTUlUX1RFWF9QUk9DX0NUTF8yICAgICAgICAgICAgICAgICAgICAzNCAvKiB0Y2cvNSAqLworI2RlZmluZSBSMjAwX0VNSVRfVENMX1VDUF9WRVJUX0JMRU5EX0NUTCAgICAgICAgICAgIDM1IC8qIHRjbC8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWEZJTFRFUl8wICAgICAgICAgICAgICAgICAgICAgMzYgLyogdGV4MC82ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWEZJTFRFUl8xICAgICAgICAgICAgICAgICAgICAgMzcgLyogdGV4MS82ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWEZJTFRFUl8yICAgICAgICAgICAgICAgICAgICAgMzggLyogdGV4Mi82ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWEZJTFRFUl8zICAgICAgICAgICAgICAgICAgICAgMzkgLyogdGV4My82ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWEZJTFRFUl80ICAgICAgICAgICAgICAgICAgICAgNDAgLyogdGV4NC82ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWEZJTFRFUl81ICAgICAgICAgICAgICAgICAgICAgNDEgLyogdGV4NS82ICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWE9GRlNFVF8wICAgICAgICAgICAgICAgICAgICAgNDIgLyogdGV4MC8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWE9GRlNFVF8xICAgICAgICAgICAgICAgICAgICAgNDMgLyogdGV4MS8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWE9GRlNFVF8yICAgICAgICAgICAgICAgICAgICAgNDQgLyogdGV4Mi8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWE9GRlNFVF8zICAgICAgICAgICAgICAgICAgICAgNDUgLyogdGV4My8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWE9GRlNFVF80ICAgICAgICAgICAgICAgICAgICAgNDYgLyogdGV4NC8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9UWE9GRlNFVF81ICAgICAgICAgICAgICAgICAgICAgNDcgLyogdGV4NS8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9WVEVfQ05UTCAgICAgICAgICAgICAgICAgICAgICAgICAgNDggLyogdnRlLzEgKi8KKyNkZWZpbmUgUjIwMF9FTUlUX09VVFBVVF9WVFhfQ09NUF9TRUwgICAgICAgICAgICAgICA0OSAvKiB2dHgvMSAqLworI2RlZmluZSBSMjAwX0VNSVRfUFBfVEFNX0RFQlVHMyAgICAgICAgICAgICAgICAgICAgIDUwIC8qIHRhbS8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9DTlRMX1ggICAgICAgICAgICAgICAgICAgICAgICAgNTEgLyogY3N0LzEgKi8KKyNkZWZpbmUgUjIwMF9FTUlUX1JCM0RfREVQVEhYWV9PRkZTRVQgICAgICAgICAgICAgICA1MiAvKiBjc3QvMSAqLworI2RlZmluZSBSMjAwX0VNSVRfUkVfQVVYX1NDSVNTT1JfQ05UTCAgICAgICAgICAgICAgIDUzIC8qIGNzdC8xICovCisjZGVmaW5lIFIyMDBfRU1JVF9SRV9TQ0lTU09SX1RMXzAgICAgICAgICAgICAgICAgICAgNTQgLyogY3N0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ZGU0VUU18zICAgICAgICAgICAgICAgIDY4CisjZGVmaW5lIFIyMDBfRU1JVF9QUF9DVUJJQ19GQUNFU180ICAgICAgICAgICAgICAgICAgNjkKKyNkZWZpbmUgUjIwMF9FTUlUX1BQX0NVQklDX09GRlNFVFNfNCAgICAgICAgICAgICAgICA3MAorI2RlZmluZSBSMjAwX0VNSVRfUFBfQ1VCSUNfRkFDRVNfNSAgICAgICAgICAgICAgICAgIDcxCisjZGVmaW5lIFIyMDBfRU1JVF9QUF9DVUJJQ19PRkZTRVRTXzUgICAgICAgICAgICAgICAgNzIKKyNkZWZpbmUgUkFERU9OX0VNSVRfUFBfVEVYX1NJWkVfMCAgICAgICAgICAgICAgICAgICA3MworI2RlZmluZSBSQURFT05fRU1JVF9QUF9URVhfU0laRV8xICAgICAgICAgICAgICAgICAgIDc0CisjZGVmaW5lIFJBREVPTl9FTUlUX1BQX1RFWF9TSVpFXzIgICAgICAgICAgICAgICAgICAgNzUKKyNkZWZpbmUgUjIwMF9FTUlUX1JCM0RfQkxFTkRDT0xPUiAgICAgICAgICAgICAgICAgICA3NgorI2RlZmluZSBSMjAwX0VNSVRfVENMX1BPSU5UX1NQUklURV9DTlRMICAgICAgICAgICAgIDc3CisjZGVmaW5lIFJBREVPTl9FTUlUX1BQX0NVQklDX0ZBQ0VTXzAgICAgICAgICAgICAgICAgNzgKKyNkZWZpbmUgUkFERU9OX0VNSVRfUFBfQ1VCSUNfT0ZGU0VUU19UMCAgICAgICAgICAgICA3OQorI2RlZmluZSBSQURFT05fRU1JVF9QUF9DVUJJQ19GQUNFU18xICAgICAgICAgICAgICAgIDgwCisjZGVmaW5lIFJBREVPTl9FTUlUX1BQX0NVQklDX09GRlNFVFNfVDEgICAgICAgICAgICAgODEKKyNkZWZpbmUgUkFERU9OX0VNSVRfUFBfQ1VCSUNfRkFDRVNfMiAgICAgICAgICAgICAgICA4MgorI2RlZmluZSBSQURFT05fRU1JVF9QUF9DVUJJQ19PRkZTRVRTX1QyICAg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5EXzIgICAgICAgICAgICAgICAgMHgyZjIwCisjZGVmaW5lIFIyMDBfUFBfVFhDQkxFTkRfMyAgICAgICAgICAgICAgICAweDJmMzAKKyNkZWZpbmUgUjIwMF9QUF9UWENCTEVORF80ICAgICAgICAgICAgICAgIDB4MmY0MAorI2RlZmluZSBSMjAwX1BQX1RYQ0JMRU5EXzUgICAgICAgICAgICAgICAgMHgyZjUwCisjZGVmaW5lIFIyMDBfUFBfVFhDQkxFTkRfNiAgICAgICAgICAgICAgICAweDJmNjAKKyNkZWZpbmUgUjIwMF9QUF9UWENCTEVORF83ICAgICAgICAgICAgICAgIDB4MmY3MAorI2RlZmluZSBSMjAwX1NFX1RDTF9MSUdIVF9NT0RFTF9DVExfMCAgICAgMHgyMjY4IAorI2RlZmluZSBSMjAwX1BQX1RGQUNUT1JfMCAgICAgICAgICAgICAgICAgMHgyZWUwCisjZGVmaW5lIFIyMDBfU0VfVlRYX0ZNVF8wICAgICAgICAgICAgICAgICAweDIwODgKKyNkZWZpbmUgUjIwMF9TRV9WQVBfQ05UTCAgICAgICAgICAgICAgICAgIDB4MjA4MAorI2RlZmluZSBSMjAwX1NFX1RDTF9NQVRSSVhfU0VMXzAgICAgICAgICAgMHgyMjMwCisjZGVmaW5lIFIyMDBfU0VfVENMX1RFWF9QUk9DX0NUTF8yICAgICAgICAweDIyYTggCisjZGVmaW5lIFIyMDBfU0VfVENMX1VDUF9WRVJUX0JMRU5EX0NUTCAgICAweDIyYzAgCisjZGVmaW5lIFIyMDBfUFBfVFhGSUxURVJfNSAgICAgICAgICAgICAgICAweDJjYTAgCisjZGVmaW5lIFIyMDBfUFBfVFhGSUxURVJfNCAgICAgICAgICAgICAgICAweDJjODAgCisjZGVmaW5lIFIyMDBfUFBfVFhGSUxURVJfMyAgICAgICAgICAgICAgICAweDJjNjAgCisjZGVmaW5lIFIyMDBfUFBfVFhGSUxURVJfMiAgICAgICAgICAgICAgICAweDJjNDAgCisjZGVmaW5lIFIyMDBfUFBfVFh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JfQUdFKCBhZ2UgKSBkbyB7CQkJCQlcCisJT1VUX1JJTkcoIENQX1BBQ0tFVDAoIFJBREVPTl9MQVNUX0NMRUFSX1JFRywgMCApICk7CQlcCisJT1VUX1JJTkcoIGFnZSApOwkJCQkJCVwKK30gd2hpbGUgKDApCisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICogUmluZyBjb250cm9sCisgKi8KKworI2RlZmluZSBSQURFT05fVkVSQk9TRQkwCisKKyNkZWZpbmUgUklOR19MT0NBTFMJaW50IHdyaXRlLCBfbnI7IHVuc2lnbmVkIGludCBtYXNrOyB1MzIgKnJpbmc7CisKKyNkZWZpbmUgQkVHSU5fUklORyggbiApIGRvIHsJCQkJCQlcCisJaWYgKCBSQURFT05fVkVSQk9TRSApIHsJCQkJCQlcCisJCURSTV9JTkZPKCAiQkVHSU5fUklORyggJWQgKSBpbiAlc1xuIiwJCQlcCisJCQkgICBuLCBfX0ZVTkNUSU9OX18gKTsJCQkJXAorCX0JCQkJCQkJCVwKKwlpZiAoIGRldl9wcml2LT5yaW5nLnNwYWNlIDw9IChuKSAqIHNpemVvZih1MzIpICkgewkJXAorICAgICAgICAgICAgICAgIENPTU1JVF9SSU5HKCk7CQkJCQkJXAorCQlyYWRlb25fd2FpdF9yaW5nKCBkZXZfcHJpdiwgKG4pICogc2l6ZW9mKHUzMikgKTsJXAorCX0JCQkJCQkJCVwKKwlfbnIgPSBuOyBkZXZfcHJpdi0+cmluZy5zcGFjZSAtPSAobikgKiBzaXplb2YodTMyKTsJCVwKKwlyaW5nID0gZGV2X3ByaXYtPnJpbmcuc3RhcnQ7CQkJCQlcCisJd3JpdGUgPSBkZXZfcHJpdi0+cmluZy50YWlsOwkJCQkJXAorCW1hc2sgPSBkZXZfcHJpdi0+cmluZy50YWlsX21hc2s7CQkJCVwKK30gd2hpbGUgKDApCisKKyNkZWZpbmUgQURWQU5DRV9SSU5HKCkgZ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hlYXAgPSBOVUxMOworfQorCisKKworLyogSU9DVEwgSEFORExFUlMgKi8KKworc3RhdGljIHN0cnVjdCBtZW1fYmxvY2sgKipnZXRfaGVhcCggZHJtX3JhZGVvbl9wcml2YXRlX3QgKmRldl9wcml2LAorCQkJCSAgIGludCByZWdpb24gKQoreworCXN3aXRjaCggcmVnaW9uICkgeworCWNhc2UgUkFERU9OX01FTV9SRUdJT05fR0FSVDoKKyAJCXJldHVybiAmZGV2X3ByaXYtPmdhcnRfaGVhcDsgCisJY2FzZSBSQURFT05fTUVNX1JFR0lPTl9GQjoKKwkJcmV0dXJuICZkZXZfcHJpdi0+ZmJfaGVhcDsKKwlkZWZhdWx0OgorCQlyZXR1cm4gTlVMTDsKKwl9Cit9CisKK2ludCByYWRlb25fbWVtX2FsbG9jKCBEUk1fSU9DVExfQVJHUyApCit7CisJRFJNX0RFVklDRTsKKwlkcm1fcmFkZW9uX3ByaXZhdGVfdCAqZGV2X3ByaXYgPSBkZXYtPmRldl9wcml2YXRlOworCWRybV9yYWRlb25fbWVtX2FsbG9jX3QgYWxsb2M7CisJc3RydWN0IG1lbV9ibG9jayAqYmxvY2ssICoqaGVhcDsKKworCWlmICggIWRldl9wcml2ICkgeworCQlEUk1fRVJST1IoICIlcyBjYWxsZWQgd2l0aCBubyBpbml0aWFsaXphdGlvblxuIiwgX19GVU5DVElPTl9fICk7CisJCXJldHVybiBEUk1fRVJSKEVJTlZBTCk7CisJfQorCisJRFJNX0NPUFlfRlJPTV9VU0VSX0lPQ1RMKCBhbGxvYywgKGRybV9yYWRlb25fbWVtX2FsbG9jX3QgX191c2VyICopZGF0YSwKKwkJCQkgIHNpemVvZihhbGxvYykgKTsKKworCWhlYXAgPSBnZXRfaGVhcCggZGV2X3ByaXYsIGFsbG9jLnJlZ2lvbiApOworCWlmICghaGVhcCB8fCAhKmhlYXApCisJCXJldHVybiBEUk1fRVJSKEVGQVVMVCk7CisJCisJLyogTWFrZSB0aGluZ3MgZWFzaWVyIG9uIG91cnNlbHZlczogYWxsIGFsbG9jYXRpb25zIGF0IGxlYXN0CisJICogNGsgYWxpZ25lZC4KKwkgKi8KKwlpZiAoYWxsb2MuYWxpZ25tZW50IDwgMTIpCisJCWFsbG9jLmFsaWdubWVudCA9IDEyOworCisJYmxvY2sgPSBhbGxvY19ibG9jayggKmhlYXAsIGFsbG9jLnNpemUsIGFsbG9jLmFsaWdubWVudCwKKwkJCSAgICAgZmlscCApOworCisJaWYgKCFibG9jaykgCisJCXJldHVybiBEUk1fRVJSKEVOT01FTSk7CisKKwlpZiAoIERSTV9DT1BZX1RPX1VTRVIoIGFsbG9jLnJlZ2lvbl9vZmZzZXQsICZibG9jay0+c3RhcnQsIAorCQkJICAgICAgIHNpemVvZihpbnQpICkgKSB7CisJCURSTV9FUlJPUiggImNvcHlfdG9fdXNlclxuIiApOworCQlyZXR1cm4gRFJNX0VSUihFRkFVTFQpOworCX0KKwkKKwlyZXR1cm4gMDsKK30KKworCisKK2ludCByYWRlb25fbWVtX2ZyZWUoIERSTV9JT0NUTF9BUkdTICkKK3sKKwlEUk1fREVWSUNFOworCWRybV9yYWRlb25fcHJpdmF0ZV90ICpkZXZfcHJpdiA9IGRldi0+ZGV2X3ByaXZhdGU7CisJZHJtX3JhZGVvbl9tZW1fZnJlZV90IG1lbWZyZWU7CisJc3RydWN0IG1lbV9ibG9jayAqYmxvY2ssICoqaGVhcDsKKworCWlmICggIWRldl9wcml2ICkgeworCQlEUk1fRVJST1IoICIlcyBjYWxsZWQgd2l0aCBubyBpbml0aWFsaXphdGlvblxuIiwgX19GVU5DVElPTl9fICk7CisJCXJldHVybiBEUk1fRVJSKEVJTlZBTCk7CisJfQorCisJRFJNX0NPUFlfRlJPTV9VU0VSX0lPQ1RMKCBtZW1mcmVlLCAoZHJtX3JhZGVvbl9tZW1fZnJlZV90IF9fdXNlciAqKWRhdGEsCisJCQkJICBzaXplb2YobWVtZnJlZSkgKTsKKworCWhlYXAgPSBnZXRfaGVhcCggZGV2X3By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bnZhbGlkIGRlcHRoIGJ1ZmZlciBvZmZzZXRcbiIgKTsKKwkJCXJldHVybiBEUk1fRVJSKCBFSU5WQUwgKTsKKwkJfQorCisJCWlmICggcmFkZW9uX2NoZWNrX2FuZF9maXh1cF9vZmZzZXQoIGRldl9wcml2LCBmaWxwX3ByaXYsCisJCQkJCQkgICAgJmN0eC0+cmIzZF9jb2xvcm9mZnNldCApICkgeworCQkJRFJNX0VSUk9SKCAiSW52YWxpZCBkZXB0aCBidWZmZXIgb2Zmc2V0XG4iICk7CisJCQlyZXR1cm4gRFJNX0VSUiggRUlOVkFMICk7CisJCX0KKworCQlCRUdJTl9SSU5HKCAxNCApOworCQlPVVRfUklORyggQ1BfUEFDS0VUMCggUkFERU9OX1BQX01JU0MsIDYgKSApOworCQlPVVRfUklORyggY3R4LT5wcF9taXNjICk7CisJCU9VVF9SSU5HKCBjdHgtPnBwX2ZvZ19jb2xvciApOworCQlPVVRfUklORyggY3R4LT5yZV9zb2xpZF9jb2xvciApOworCQlPVVRfUklORyggY3R4LT5yYjNkX2JsZW5kY250bCApOworCQlPVVRfUklORyggY3R4LT5yYjNkX2RlcHRob2Zmc2V0ICk7CisJCU9VVF9SSU5HKCBjdHgtPnJiM2RfZGVwdGhwaXRjaCApOworCQlPVVRfUklORyggY3R4LT5yYjNkX3pzdGVuY2lsY250bCApOworCQlPVVRfUklORyggQ1BfUEFDS0VUMCggUkFERU9OX1BQX0NOVEwsIDIgKSApOworCQlPVVRfUklORyggY3R4LT5wcF9jbnRsICk7CisJCU9VVF9SSU5HKCBjdHgtPnJiM2RfY250bCApOworCQlPVVRfUklORyggY3R4LT5yYjNkX2NvbG9yb2Zmc2V0ICk7CisJCU9VVF9SSU5HKCBDUF9QQUNLRVQwKCBSQURFT05fUkIzRF9DT0xPUlBJVENILCAwICkgKTsKKwkJT1VUX1JJTkcoIGN0eC0+cmIzZF9jb2xvcnBpdGNoICk7CisJCUFEVkFOQ0VfUklORygpOworCX0KKworCWlmICggZGlyd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taW4sIGFuZCB0bV9zZWMgdmFsdWVzIGFyZSBmaWxsZWQgaW4uCisJCSAqLworCisJCW1lbXNldCgmd3RpbWUsIDAsIHNpemVvZih3dGltZSkpOworCQlkczEyODZfZ2V0X2FsbV90aW1lKCZ3dGltZSk7CisJCWJyZWFrOworCX0KKwljYXNlIFJUQ19BTE1fU0VUOgkvKiBTdG9yZSBhIHRpbWUgaW50byB0aGUgYWxhcm0gKi8KKwl7CisJCS8qCisJCSAqIFRoaXMgZXhwZWN0cyBhIHN0cnVjdCBydGNfdGltZS4gV3JpdGluZyAweGZmIG1lYW5zCisJCSAqICJkb24ndCBjYXJlIiBvciAibWF0Y2ggYWxsIi4gT25seSB0aGUgdG1faG91ciwKKwkJICogdG1fbWluIGFuZCB0bV9zZWMgYXJlIHVzZWQuCisJCSAqLworCQl1bnNpZ25lZCBjaGFyIGhycywgbWluLCBzZWM7CisJCXN0cnVjdCBydGNfdGltZSBhbG1fdG07CisKKwkJaWYgKCFjYXBhYmxlKENBUF9TWVNfVElNRSkpCisJCQlyZXR1cm4gLUVBQ0NFUzsKKworCQlpZiAoY29weV9mcm9tX3VzZXIoJmFsbV90bSwgKHN0cnVjdCBydGNfdGltZSopYXJnLAorCQkJCSAgIHNpemVvZihzdHJ1Y3QgcnRjX3RpbWUpKSkKKwkJCXJldHVybiAtRUZBVUxUOworCisJCWhycyA9IGFsbV90bS50bV9ob3VyOworCQltaW4gPSBhbG1fdG0udG1fbWluOworCisJCWlmIChocnMgPj0gMjQpCisJCQlocnMgPSAweGZmOworCisJCWlmIChtaW4gPj0gNjApCisJCQltaW4gPSAweGZmOworCisJCUJJTl9UT19CQ0Qoc2VjKTsKKwkJQklOX1RPX0JDRChtaW4pOworCQlCSU5fVE9fQkNEKGhycyk7CisKKwkJc3Bpbl9sb2NrKCZkczEyODZfbG9jayk7CisJCXJ0Y193cml0ZShocnMsIFJUQ19IT1VSU19BTEFSTSk7CisJCXJ0Y193cml0ZShtaW4sIFJUQ19NSU5VVE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lRIKTsKKwlwICs9IHNwcmludGYocCwKKwkgICAgICAgICAgICAgIm9zY2lsbGF0b3JcdDogJXNcbiIKKwkgICAgICAgICAgICAgInNxdWFyZV93YXZlXHQ6ICVzXG4iLAorCSAgICAgICAgICAgICAobW9udGggJiBSVENfRU9TQykgPyAiZGlzYWJsZWQiIDogImVuYWJsZWQiLAorCSAgICAgICAgICAgICAobW9udGggJiBSVENfRVNRVykgPyAiZGlzYWJsZWQiIDogImVuYWJsZWQiKTsKKworCWFtb2RlID0gKChydGNfcmVhZChSVENfTUlOVVRFU19BTEFSTSkgJiAweDgwKSA+PiA1KSB8CisJICAgICAgICAoKHJ0Y19yZWFkKFJUQ19IT1VSU19BTEFSTSkgJiAweDgwKSA+PiA2KSB8CisJICAgICAgICAoKHJ0Y19yZWFkKFJUQ19EQVlfQUxBUk0pICYgMHg4MCkgPj4gNyk7CisJaWYgKGFtb2RlID09IDcpICAgICAgcyA9ICJlYWNoIG1pbnV0ZSI7CisJZWxzZSBpZiAoYW1vZGUgPT0gMykgcyA9ICJtaW51dGVzIG1hdGNoIjsKKwllbHNlIGlmIChhbW9kZSA9PSAxKSBzID0gImhvdXJzIGFuZCBtaW51dGVzIG1hdGNoIjsKKwllbHNlIGlmIChhbW9kZSA9PSAwKSBzID0gImRheXMsIGhvdXJzIGFuZCBtaW51dGVzIG1hdGNoIjsKKwllbHNlICAgICAgICAgICAgICAgICBzID0gImludmFsaWQiOworCXAgKz0gc3ByaW50ZihwLCAiYWxhcm1fbW9kZVx0OiAlc1xuIiwgcyk7CisKKwljbWQgPSBydGNfcmVhZChSVENfQ01EKTsKKwlwICs9IHNwcmludGYocCwKKwkgICAgICAgICAgICAgImFsYXJtX2VuYWJsZVx0OiAlc1xuIgorCSAgICAgICAgICAgICAid2RvZ19hbGFybVx0OiAlc1xuIgorCSAgICAgICAgICAgICAiYWxhcm1fbWFza1x0OiAlc1xuIgorCSAgICAgICAgICAgICAid2RvZ19hbGFybV9tYXNrXHQ6ICVzXG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KTsKKworCXVkZWxheSgxKTsKKworCW5ldHdpbmRlcl9kczE2MjBfcmVzZXQoKTsKKwluZXR3aW5kZXJfdW5sb2NrKCZmbGFncyk7CisKKwlzZXRfY3VycmVudF9zdGF0ZShUQVNLX0lOVEVSUlVQVElCTEUpOworCXNjaGVkdWxlX3RpbWVvdXQoMik7Cit9CisKK3N0YXRpYyB1bnNpZ25lZCBpbnQgZHMxNjIwX2luKGludCBjbWQsIGludCBiaXRzKQoreworCXVuc2lnbmVkIGxvbmcgZmxhZ3M7CisJdW5zaWduZWQgaW50IHZhbHVlOworCisJbmV0d2luZGVyX2xvY2soJmZsYWdzKTsKKwluZXR3aW5kZXJfZHMxNjIwX3NldF9jbGsoMSk7CisJbmV0d2luZGVyX2RzMTYyMF9zZXRfZGF0YV9kaXIoMCk7CisJbmV0d2luZGVyX2RzMTYyMF9yZXNldCgpOworCisJdWRlbGF5KDEpOworCisJZHMxNjIwX3NlbmRfYml0cyg4LCBjbWQpOworCisJbmV0d2luZGVyX2RzMTYyMF9zZXRfZGF0YV9kaXIoMSk7CisJdmFsdWUgPSBkczE2MjBfcmVjdl9iaXRzKGJpdHMpOworCisJbmV0d2luZGVyX2RzMTYyMF9yZXNldCgpOworCW5ldHdpbmRlcl91bmxvY2soJmZsYWdzKTsKKworCXJldHVybiB2YWx1ZTsKK30KKworc3RhdGljIGludCBjdnRfOV90b19pbnQodW5zaWduZWQgaW50IHZhbCkKK3sKKwlpZiAodmFsICYgMHgxMDApCisJCXZhbCB8PSAweGZmZmZmZTAwOworCisJcmV0dXJuIHZhbDsKK30KKworc3RhdGljIHZvaWQgZHMxNjIwX3dyaXRlX3N0YXRlKHN0cnVjdCB0aGVybSAqdGhlcm0pCit7CisJZHMxNjIwX291dChUSEVSTV9XUklURV9DT05GSUcsIDgsIENGR19DUFUpOworCWRzMTYyMF9vdXQoVEhFUk1fV1JJVEVfVEwsIDksIHRoZXJtLT5sbyk7CisJZHMxNjIwX291dChUSEVSTV9XUklURV9USCw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J0Y19sb2NrLCBmbGFncyk7CisKKwllZmkuZ2V0X3RpbWUoJmVmdCwgJmNhcCk7CisJZWZpLmdldF93YWtldXBfdGltZSgmZW5hYmxlZCwgJnBlbmRpbmcsICZhbG0pOworCisJc3Bpbl91bmxvY2tfaXJxcmVzdG9yZSgmZWZpX3J0Y19sb2NrLGZsYWdzKTsKKworCXAgKz0gc3ByaW50ZihwLAorCQkgICAgICJUaW1lICAgICAgICAgICA6ICV1OiV1OiV1LiUwOXVcbiIKKwkJICAgICAiRGF0ZSAgICAgICAgICAgOiAldS0ldS0ldVxuIgorCQkgICAgICJEYXlsaWdodCAgICAgICA6ICV1XG4iLAorCQkgICAgIGVmdC5ob3VyLCBlZnQubWludXRlLCBlZnQuc2Vjb25kLCBlZnQubmFub3NlY29uZCwgCisJCSAgICAgZWZ0LnllYXIsIGVmdC5tb250aCwgZWZ0LmRheSwKKwkJICAgICBlZnQuZGF5bGlnaHQpOworCisJaWYgKGVmdC50aW1lem9uZSA9PSBFRklfVU5TUEVDSUZJRURfVElNRVpPTkUpCisJCXAgKz0gc3ByaW50ZihwLCAiVGltZXpvbmUgICAgICAgOiB1bnNwZWNpZmllZFxuIik7CisJZWxzZQorCQkvKiBYWFggZml4bWU6IGNvbnZlcnQgdG8gc3RyaW5nPyAqLworCQlwICs9IHNwcmludGYocCwgIlRpbWV6b25lICAgICAgIDogJXVcbiIsIGVmdC50aW1lem9uZSk7CisJCQorCisJcCArPSBzcHJpbnRmKHAsCisJCSAgICAgIkFsYXJtIFRpbWUgICAgIDogJXU6JXU6JXUuJTA5dVxuIgorCQkgICAgICJBbGFybSBEYXRlICAgICA6ICV1LSV1LSV1XG4iCisJCSAgICAgIkFsYXJtIERheWxpZ2h0IDogJXVcbiIKKwkJICAgICAiRW5hYmxlZCAgICAgICAgOiAlc1xuIgorCQkgICAgICJQZW5kaW5nICAgICAgICA6ICVzXG4iLAorCQkgICAgIGFsbS5ob3VyLCBhbG0ubWludXRlLCBhbG0uc2Vjb25kLCBhbG0ubmFub3NlY29uZCwgCisJCSAgICAgYWxtLnllYXIsIGFsbS5tb250aCwgYWxtLmRheSwgCisJCSAgICAgYWxtLmRheWxpZ2h0LAorCQkgICAgIGVuYWJsZWQgPT0gMSA/ICJ5ZXMiIDogIm5vIiwKKwkJICAgICBwZW5kaW5nID09IDEgPyAieWVzIiA6ICJubyIpOworCisJaWYgKGVmdC50aW1lem9uZSA9PSBFRklfVU5TUEVDSUZJRURfVElNRVpPTkUpCisJCXAgKz0gc3ByaW50ZihwLCAiVGltZXpvbmUgICAgICAgOiB1bnNwZWNpZmllZFxuIik7CisJZWxzZQorCQkvKiBYWFggZml4bWU6IGNvbnZlcnQgdG8gc3RyaW5nPyAqLworCQlwICs9IHNwcmludGYocCwgIlRpbWV6b25lICAgICAgIDogJXVcbiIsIGFsbS50aW1lem9uZSk7CisKKwkvKgorCSAqIG5vdyBwcmludHMgdGhlIGNhcGFiaWxpdGllcworCSAqLworCXAgKz0gc3ByaW50ZihwLAorCQkgICAgICJSZXNvbHV0aW9uICAgICA6ICV1XG4iCisJCSAgICAgIkFjY3VyYWN5ICAgICAgIDogJXVcbiIKKwkJICAgICAiU2V0c3RvWmVybyAgICAgOiAldVxuIiwKKwkJICAgICAgY2FwLnJlc29sdXRpb24sIGNhcC5hY2N1cmFjeSwgY2FwLnNldHNfdG9femVybyk7CisKKwlyZXR1cm4gIHAgLSBidWY7Cit9CisKK3N0YXRpYyBpbnQKK2VmaV9ydGNfcmVhZF9wcm9jKGNoYXIgKnBhZ2UsIGNoYXIgKipzdGFydCwgb2ZmX3Qgb2ZmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50LCBpbnQgKmVvZiwgdm9pZCAqZGF0YSkKK3sKKyAgICAgICAgaW50IGxlbiA9IGVmaV9ydGNfZ2V0X3N0YXR1cyhwYWdlKTsKKyAgICAgICAgaWYgKGxlbiA8PSBvZmYrY291bnQpICplb2YgPSAxOworICAgICAgICAqc3RhcnQ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9uZyBmbGFnczsKKworCS8qIFBlcmhhcHMgYSBub24tc3lzYWRtaW4gdXNlciBzaG91bGQgYmUgYWJsZSB0byBkbyBzb21lIG9mIHRoZXNlICovCisJLyogb3BlcmF0aW9ucy4gIEkgaGF2ZW4ndCBkZWNpZGVkIHlldC4gKi8KKworCWlmICghY2FwYWJsZShDQVBfU1lTX0FETUlOKSkKKwkJcmV0dXJuIC1FUEVSTTsKKworCWlmIChjb3B5X2Zyb21fdXNlcigmbmV3X2NvbmZpZywgbmV3X2luZm8sIHNpemVvZihuZXdfY29uZmlnKSkpCisJCXJldHVybiAtRUZBVUxUOworCisJaWYgKChuZXdfY29uZmlnLmZsb3dfb24gPj0gbmV3X2NvbmZpZy5mbG93X29mZikgfHwKKwkgICAgKG5ld19jb25maWcucnhfdHJpZ2dlciA8IDEpIHx8CisJICAgIChuZXdfY29uZmlnLnR4X3RyaWdnZXIgPCAxKSB8fAorCSAgICAobmV3X2NvbmZpZy5mbG93X29mZiA8IDEpIHx8CisJICAgIChuZXdfY29uZmlnLmZsb3dfb24gPCAxKSB8fAorCSAgICAobmV3X2NvbmZpZy5yeF90cmlnZ2VyID4gMTAyMykgfHwKKwkgICAgKG5ld19jb25maWcudHhfdHJpZ2dlciA+IDEwMjMpIHx8CisJICAgIChuZXdfY29uZmlnLmZsb3dfb2ZmID4gMTAyMykgfHwKKwkgICAgKG5ld19jb25maWcuZmxvd19vbiA+IDEwMjMpIHx8CisJICAgIChuZXdfY29uZmlnLnBpb190aHJlc2hvbGQgPCAwKSB8fAorCSAgICAobmV3X2NvbmZpZy5waW9fdGhyZXNob2xkID4gMTAyNCkpCisJCXJldHVybiAtRUlOVkFMOworCisJaWYgKChuZXdfY29uZmlnLmRtYV9jaGFubmVsICE9IDEpICYmIChuZXdfY29uZmlnLmRtYV9jaGFubmVsICE9IDMpKQorCQluZXdfY29uZmlnLmRtYV9jaGFubmVsID0gMDsKKworCWlmIChpbmZvLT5zdGF0X2ZsYWdzICYgRVNQX1NU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Q0CmluZGV4IDAwMDAwMDAuLmEwMzJhMGUKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvZnRhcGUvY29tcHJlc3Nvci9senJ3My5jCkBAIC0wLDAgKzEsNzQzIEBACisvKgorICogJFNvdXJjZTogL2hvbWVzL2N2cy9mdGFwZS1zdGFja2VkL2Z0YXBlL2NvbXByZXNzb3IvbHpydzMuYyx2ICQKKyAqICRSZXZpc2lvbjogMS4xICQKKyAqICREYXRlOiAxOTk3LzEwLzA1IDE5OjEyOjI5ICQKKyAqCisgKiBJbXBsZW1lbnRhdGlvbiBvZiBSb3NzIFdpbGxpYW1zIGx6cnczIGFsZ29yaXRobS4gQWRhcHRpb24gZm9yIHpmdGFwZS4KKyAqCisgKi8KKworI2luY2x1ZGUgIi4uL2NvbXByZXNzb3IvbHpydzMuaCIgICAgICAgLyogRGVmaW5lcyBzaW5nbGUgZXhwb3J0ZWQgZnVuY3Rpb24gImNvbXByZXNzIi4gICAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFpSVzMuQyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBBdXRob3IgIDogUm9zcyBXaWxsaWFtcy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGF0ZSAgICA6IDMwLUp1bi0xOTkxLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJlbGVhc2UgOiAxLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGlzIGZpbGUgY29udGFpbnMgYW4gaW1wbGVtZW50YXRpb24gb2YgdGhlIExaUlczIGRhdGEgY29tcHJlc3Npb24gICAgICAgICAqLworLyogYWxnb3JpdGhtIGluIEMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGUgYWxnb3JpdGhtIGlzIGEgZ2VuZXJhbCBwdXJwb3NlIGNvbXByZXNzaW9uIGFsZ29yaXRobSB0aGF0IHJ1bnMgZmFzdCAgICAqLworLyogYW5kIGdpdmVzIHJlYXNvbmFibGUgY29tcHJlc3Npb24uIFRoZSBhbGdvcml0aG0gaXMgYSBtZW1iZXIgb2YgdGhlIExlbXBlbCAgKi8KKy8qIFppdiBmYW1pbHkgb2YgYWxnb3JpdGhtcyBhbmQgYmFzZXMgaXRzIGNvbXByZXNzaW9uIG9uIHRoZSBwcmVzZW5jZSBpbiB0aGUgICovCisvKiBkYXRhIG9mIHJlcGVhdGVkIHN1YnN0cmluZ3MuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFRoaXMgYWxnb3JpdGhtIGlzIHVucGF0ZW50ZWQgYW5kIHRoZSBjb2RlIGlzIHB1YmxpYyBkb21haW4uIEFzIHRoZSAgICAgICAgICovCisvKiBhbGdvcml0aG0gaXMgYmFzZWQgb24gdGhlIExaNzcgY2xhc3Mgb2YgYWxnb3JpdGhtcywgaXQgaXMgdW5saWtlbHkgdG8gYmUgICAqLworLyogdGhlIHN1YmplY3Qgb2YgYSBwYXRlbnQgY2hhbGxlbmdlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBVbmxpa2UgdGhlIExaUlcxIGFuZCBMWlJXMS1BIGFsZ29yaXRobXMsIHRoZSBMWlJXMyBhbGdvcml0aG0gaXMgICAgICAgICAgICAqLworLyogZGV0ZXJtaW5pc3RpYyBhbmQgaXMgZ3VhcmFudGVlZCB0byB5aWVsZCB0aGUgc2FtZSBjb21wcmVzc2VkICAgICAgICAgICAgICAgKi8KKy8qIHJlcHJlc2VudGF0aW9uIGZvciBhIGdpdmVuIGZpbGUgZWFjaCB0aW1lIGl0IGlzIHJ1bi4gICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhlIExaUlczIGFsZ29yaXRobSB3YXMgb3JpZ2luYWxseSBkZXNpZ25lZCBhbmQgaW1wbGVtZW50ZWQgICAgICAgICAgICAgICAgKi8KKy8qIGJ5IFJvc3MgV2lsbGlhbXMgb24gMzEtRGVjLTE5OTAuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogSGVyZSBhcmUgdGhlIHJlc3VsdHMgb2YgYXBwbHlpbmcgdGhpcyBjb2RlLCBjb21waWxlZCB1bmRlciBUSElOSyBDIDQuMCAgICAgKi8KKy8qIGFuZCBydW5uaW5nIG9uIGEgTWFjLVNFICg4TUh6IDY4MDAwKSwgdG8gdGhlIHN0YW5kYXJkIGNhbGdhcnkgY29ycHVzLiAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rICAgICAgKi8KKy8qICAgIHwgREFUQSBDT01QUkVTU0lPTiBURVNUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICovCisvKiAgICB8ID09PT09PT09PT09PT09PT09PT09PSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAqLworLyogICAgfCBUaW1lIG9mIHJ1biAgICAgOiBTdW4gMzAtSnVuLTE5OTEgMDk6MzFQTSAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgKi8KKy8qICAgIHwgVGltaW5nIGFjY3VyYWN5IDogT25lIHBhcnQgaW4gMTAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICovCisvKiAgICB8IENvbnRleHQgbGVuZ3RoICA6IDI2MjE0NCBieXRlcyAoPSAyNTYuMDAwMEspICAgICAgICAgICAgICAgICAgIHwgICAgICAqLworLyogICAgfCBUZXN0IHN1aXRlICAgICAgOiBDYWxnYXJ5IENvcnB1cyBTdWl0ZSAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgKi8KKy8qICAgIHwgRmlsZXMgaW4gc3VpdGUgIDogMTQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICovCisvKiAgICB8IEFsZ29yaXRobSAgICAgICA6IExaUlczICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAqLworLyogICAgfCBOb3RlOiBBbGwgYXZlcmFnZXMgYXJlIGNhbGN1bGF0ZWQgZnJvbSB0aGUgdW4tcm91bmRlZCB2YWx1ZXMuICB8ICAgICAgKi8KKy8qICAgICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKyAgICAgICovCisvKiAgICB8IEZpbGUgTmFtZSAgIExlbmd0aCAgQ3hCICBDb21MZW4gICVSZW1uICBCaXRzICBDb20gSy9zICBEZWMgSy9zIHwgICAgICAqLworLyogICAgfCAtLS0tLS0tLS0tICAtLS0tLS0gIC0tLSAgLS0tLS0tICAtLS0tLSAgLS0tLSAgLS0tLS0tLSAgLS0tLS0tLSB8ICAgICAgKi8KKy8qICAgIHwgcnB1czpCaWIuRCAgMTExMjYxICAgIDEgICA1NTAzMyAgIDQ5LjUgIDMuOTYgICAgMTkuNDYgICAgMzIuMjcgfCAgICAgICovCisvKiAgICB8IHVzOkJvb2sxLkQgIDc2ODc3MSAgICAzICA0Njc5NjIgICA2MC45ICA0Ljg3ICAgIDE3LjAzICAgIDMxLjA3IHwgICAgICAqLworLyogICAgfCB1czpCb29rMi5EICA2MTA4NTYgICAgMyAgMzE3MTAyICAgNTEuOSAgNC4xNSAgICAxOS4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gICovCisvKiAgICB8IHVzOlRyYW5zLkQgICA5MzY5NSAgICAxICAgMzM0ODEgICAzNS43ICAyLjg2ICAgIDI1LjQ4ICAgIDQwLjM3IHwgICAgICAqLworLyogICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rICAgICAgKi8KKy8qICAgIHwgQXZlcmFnZSAgICAgMjI0NDAxICAgIDEgIDExMDk1MyAgIDUwLjAgIDQuMDAgICAgMjAuMTcgICAgMzIuNzIgfCAgICAgICovCisvKiAgICArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIFRoZSBmb2xsb3dpbmcgc3RydWN0dXJlIGlzIHJldHVybmVkIGJ5IHRoZSAiY29tcHJlc3MiIGZ1bmN0aW9uIGJlbG93IHdoZW4gICovCisvKiB0aGUgdXNlciBhc2tzIHRoZSBmdW5jdGlvbiB0byByZXR1cm4gaWRlbnRpZnlpbmcgaW5mb3JtYXRpb24uICAgICAgICAgICAgICAqLworLyogVGhlIG1vc3QgaW1wb3J0YW50IGZpZWxkIGluIHRoZSByZWNvcmQgaXMgdGhlIHdvcmtpbmcgbWVtb3J5IGZpZWxkIHdoaWNoICAgKi8KKy8qIHRlbGxzIHRoZSBjYWxsaW5nIHByb2dyYW0gaG93IG11Y2ggd29ya2luZyBtZW1vcnkgc2hvdWxkIGJlIHBhc3NlZCB0byAgICAgICovCisvKiAiY29tcHJlc3MiIHdoZW4gaXQgaXMgY2FsbGVkIHRvIHBlcmZvcm0gYSBjb21wcmVzc2lvbiBvciBkZWNvbXByZXNzaW9uLiAgICAqLworLyogTFpSVzMgdXNlcyB0aGUgc2FtZSBhbW91bnQgb2YgbWVtb3J5IGR1cmluZyBjb21wcmVzc2lvbiBhbmQgZGVjb21wcmVzc2lvbi4gKi8KKy8qIEZvciBtb3JlIGluZm9ybWF0aW9uIG9uIHRoaXMgc3RydWN0dXJlIHNlZSAiY29tcHJlc3MuaCIuICAgICAgICAgICAgICAgICAgICovCisgIAorI2RlZmluZSBVKFgpICAgICAgICAgICAgKChVTE9ORykgWCkKKyNkZWZpbmUgU0laRV9QX0JZVEUgICAgIChVKHNpemVvZihVQllURSAqKSkpCisjZGVmaW5lIFNJWkVfV09SRCAgICAgICAoVShzaXplb2YoVVdPUkQgICkpKQorI2RlZmluZSBBTElHTk1FTlRfRlVER0UgKFUoMTYpKQorI2RlZmluZSBNRU1fUkVRICggVSg0MDk2KSooU0laRV9QX0JZVEUpICsgQUxJR05NRU5UX0ZVREdFICkKKworc3RhdGljIHN0cnVjdCBjb21wcmVzc19pZGVudGl0eSBpZGVudGl0eSA9Cit7CisgVSgweDAzMkRERUE4KSwgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBbGdvcml0aG0gaWRlbnRpZmljYXRpb24gbnVtYmVyLiAqLworIE1FTV9SRVEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogV29ya2luZyBtZW1vcnkgKGJ5dGVzKSByZXF1aXJlZC4gKi8KKyAiTFpSVzMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE5hbWUgb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICAgICovCisgIjEuMCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBWZXJzaW9uIG51bWJlciBvZiBhbGdvcml0aG0uICAgICAqLworICIzMS1EZWMtMTk5MCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGF0ZSBvZiBhbGdvcml0aG0uICAgICAgICAgICAgICAgKi8KKyAiUHVibGljIERvbWFpbiIsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENvcHlyaWdodCBub3RpY2UuICAgICAgICAgICAgICAgICovCisgIlJvc3MgTi4gV2lsbGlhbXMiLCAgICAgICAgICAgICAgICAgICAgICAvKiBBdXRob3Igb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICAqLworICJSZW5haXNzYW5jZSBTb2Z0d2FyZSIsICAgICAgICAgICAgICAgICAgLyogQWZmaWxpYXRpb24gb2YgYXV0aG9yLiAgICAgICAgICAgKi8KKyAiUHVibGljIERvbWFpbiIgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFZlbmRvciBvZiBhbGdvcml0aG0uICAgICAgICAgICAgICovCit9OworIAorTE9DQUwgdm9pZCBjb21wcmVzc19jb21wcmVzcyAgKFVCWVRFICosVUJZVEUgKixVTE9ORyxVQllURSAqLCBMT05HICopOworTE9DQUwgdm9pZCBjb21wcmVzc19kZWNvbXByZXNzKFVCWVRFICosVUJZVEUgKixMT05HLCBVQllURSAqLCBVTE9ORyAqKTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogVGhpcyBmdW5jdGlvbiBpcyB0aGUgb25seSBmdW5jdGlvbiBleHBvcnRlZCBieSB0aGlzIG1vZHVsZS4gICAgICAgICAgICAgICAgKi8KKy8qIERlcGVuZGluZyBvbiBpdHMgZmlyc3QgcGFyYW1ldGVyLCB0aGUgZnVuY3Rpb24gY2FuIGJlIHJlcXVlc3RlZCB0byAgICAgICAgICovCisvKiBjb21wcmVzcyBhIGJsb2NrIG9mIG1lbW9yeSwgZGVjb21wcmVzcyBhIGJsb2NrIG9mIG1lbW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NyY19sZW4sZHN0X2FkciwoTE9ORyAqKXBfZHN0X2xlbik7CisgICAgICAgYnJlYWs7CisgICB9Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogQlJJRUYgREVTQ1JJUFRJT04gT0YgVEhFIExaUlczIEFMR09SSVRITSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGUgTFpSVzMgYWxnb3JpdGhtIGlzIGlkZW50aWNhbCB0byB0aGUgTFpSVzEtQSBhbGdvcml0aG0gZXhjZXB0IHRoYXQgICAgICAqLworLyogaW5zdGVhZCBvZiB0cmFuc21pdHRpbmcgaGlzdG9yeSBvZmZzZXRzLCBpdCB0cmFuc21pdHMgaGFzaCB0YWJsZSBpbmRleGVzLiAgKi8KKy8qIEluIG9yZGVyIHRvIGRlY29kZSB0aGUgaW5kZXhlcywgdGhlIGRlY29tcHJlc3NvciBtdXN0IG1haW50YWluIGFuICAgICAgICAgICovCisvKiBpZGVudGljYWwgaGFzaCB0YWJsZS4gQ29weSBpdGVtcyBhcmUgc3RyYWlnaHRmb3J3YXJkOndoZW4gdGhlIGRlY29tcHJlc3NvciAqLworLyogcmVjZWl2ZXMgYSBjb3B5IGl0ZW0sIGl0IHNpbXBseSBsb29rcyB1cCB0aGUgaGFzaCB0YWJsZSB0byB0cmFuc2xhdGUgdGhlICAgKi8KKy8qIGluZGV4IGludG8gYSBwb2ludGVyIGludG8gdGhlIGRhdGEgYWxyZWFkeSBkZWNvbXByZXNzZWQuIFRvIHVwZGF0ZSB0aGUgICAgICovCisv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GNvc3Qgb2Ygc29tZSBzcGVlZC4gTFpSVzMgaXMgc2xvd2VyIHRoYW4gTFpSVzEsIExaUlcxLUEgKi8KKy8qIGFuZCBMWlJXMiwgYnV0IHlpZWxkcyBiZXR0ZXIgY29tcHJlc3Npb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRXh0cmEgY29tcHJlc3Npb24gY291bGQgYmUgb2J0YWluZWQgYnkgdXNpbmcgYSBoYXNoIHRhYmxlIG9mIGRlcHRoIHR3by4gICAgKi8KKy8qIEhvd2V2ZXIsIGluY3JlYXNpbmcgdGhlIGRlcHRoIGFib3ZlIG9uZSBpbmN1cnMgYSBzaWduaWZpY2FudCBkZWNyZWFzZSBpbiAgICovCisvKiBjb21wcmVzc2lvbiBzcGVlZCB3aGljaCB3YXMgbm90IGNvbnNpZGVyZWQgd29ydGh3aGlsZS4gQW5vdGhlciByZWFzb24gZm9yICAqLworLyoga2VlcGluZyB0aGUgZGVwdGggZG93biB0byBvbmUgd2FzIHRvIGFsbG93IGVhc3kgY29tcGFyaXNvbiB3aXRoIHRoZSAgICAgICAgKi8KKy8qIExaUlcxLUEgYW5kIExaUlcyIGFsZ29yaXRobXMgc28gYXMgdG8gZGVtb25zdHJhdGUgdGhlIGV4YWN0IGVmZmVjdCBvZiB0aGUgICovCisvKiB1c2Ugb2YgZGlyZWN0IGhhc2ggaW5kZXhlcy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICstLS0rICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8X19ffDQwOTUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fX3wgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICArLS0tLS0tLS0tLS0tLS0tLS0tLS0tKl98PC0tLSsgICAvLS0tLSstLS1cICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICB8X19ffCAgICArLS0tfEhhc2ggICAgfCAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgfF9fX3wgICAgICAgIHxGdW5jdGlvbnwgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgIHxfX198ICAgICAgICBcLS0tLS0tLS0vICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICB8X19ffDAgICAgICAgICAgICBeICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgKy0tLSsgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgIEhhc2ggICAgICAgICstLS0tLSsgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICBUYWJsZSAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICB2ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXl5eICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tfC0tLS0tLS0tLS0tLS0tLS0rICAgICAgICAgICAgICAqLworLyogICAgICB8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fCAgICAgICAgICAgICAgKi8KKy8qICAgICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS18LS0tLS0tLS0tLS0tLS0tLSsgICAgICAgICAgICAgICovCisvKiAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfDEuLi4uLi4xOHwgICAgICB8ICAgICAgICAgICAgICAqLworLyogICAgICB8PC0tLS0tLS0gTGVtcGVsPUhpc3RvcnkgLS0tLS0tLS0tLS0tPnw8LS1aaXYtLT58ICAgICAgfCAgICAgICAgICAgICAgKi8KKy8qICAgICAgfCAgICAgKD1ieXRlcyBhbHJlYWR5IHByb2Nlc3NlZCkgICAgICB8PC1TdGlsbCB0byBnby0tPnwgICAgICAgICAgICAgICovCisvKiAgICAgIHw8LS0tLS0tLS0tLS0tLS0tLS0tLS0gSU5QVVQgQkxPQ0sgLS0tLS0tLS0tLS0tLS0tLS0tLT58ICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFRoZSBkaWFncmFtIGFib3ZlIGZvciBMWlJXMyBsb29rcyBhbG1vc3QgaWRlbnRpY2FsIHRvIHRoZSBkaWFncmFtIGZvciAgICAgICovCisvKiBMWlJXMS4gVGhlIGRpZmZlcmVuY2UgaXMgdGhhdCBpbiBMWlJXMywgdGhlIGNvbXByZXNzb3IgdHJhbnNtaXRzIGhhc2ggICAgICAqLworLyogdGFibGUgaW5kaWNlcyBpbnN0ZWFkIG9mIExlbXBlbCBvZmZzZXRzLiBGb3IgdGhpcyB0byB3b3JrLCB0aGUgICAgICAgICAgICAgKi8KKy8qIGRlY29tcHJlc3NvciBtdXN0IG1haW50YWluIGEgaGFzaCB0YWJsZSBhcyB3ZWxsIGFzIHRoZSBjb21wcmVzc29yIGFuZCBib3RoICovCisvKiBjb21wcmVzc29yIGFuZCBkZWNvbXByZXNzb3IgbXVzdCAiYnVmZmVyIiBsaXRlcmFscywgYXMgdGhlIGRlY29tcHJlc3NvciAgICAqLworLyogY2Fubm90IGhhc2ggcGhyYXNlcyBjb21tZW5jaW5nIHdpdGggYSBsaXRlcmFsIHVudGlsIGFub3RoZXIgdHdvIGJ5dGVzIGhhdmUgKi8KKy8qIGFycml2ZWQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIExaUlczIEFsZ29yaXRobSBFeGVjdXRpb24gU3VtbWFyeSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgMS4gSGFzaCB0aGUgZmlyc3QgdGhyZWUgYnl0ZXMgb2YgdGhlIFppdiB0byB5aWVsZCBhIGhhc2ggdGFibGUgaW5kZXggaC4gICAqLworLyogIDIuIExvb2sgdXAgdGhlIGhhc2ggdGFibGUgeWllbGRpbmcgaGlzdG9yeSBwb2ludGVyIHAuICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAzLiBNYXRjaCB3aGVyZSBwIHBvaW50cyB3aXRoIHRoZSBaaXYuIElmIHRoZXJlIGlzIGEgbWF0Y2ggb2YgdGhyZWUgb3IgICAgICovCisvKiAgICAgbW9yZSBieXRlcywgY29kZSB0aG9zZSBieXRlcyAoaW4gdGhlIFppdikgYXMgYSBjb3B5IGl0ZW0sIG90aGVyd2lzZSAgICAqLworLyogICAgIGNvZGUgdGhlIG5leHQgYnl0ZSBpbiB0aGUgWml2IGFzIGEgbGl0ZXJhbCBpdGVtLiAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICA0LiBVcGRhdGUgdGhlIGhhc2ggdGFibGUgYXMgcG9zc2libGUgc3ViamVjdCB0byB0aGUgY29uc3RyYWludCB0aGF0IG9ubHkgICovCisvKiAgICAgcGhyYXNlcyBjb21tZW5jaW5nIHRocmVlIGJ5dGVzIGJhY2sgZnJvbSB0aGUgWml2IGNhbiBiZSBoYXNoZWQgYW5kICAgICAqLworLyogICAgIGVudGVyZWQgaW50byB0aGUgaGFzaCB0YWJsZS4gKFRoaXMgZW5hYmxlcyB0aGUgZGVjb21wcmVzc29yIHRvIGtlZXAgICAgKi8KKy8qICAgICBwYWNlKS4gU2VlIHRoZSBkZXNjcmlwdGlvbiBhbmQgY29kZSBmb3IgbW9yZSBkZXRhaWxzLiAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgIERFRklOSVRJT04gT0YgQ09NUFJFU1NFRCBGSUxFIEZPUk1BVCAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gICAgICAgICAgICAgICAgICAgKi8KKy8qICAqI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50IGZyb20gMyB0byAxOCBieXRlcy4gICAgKi8KKy8qICAqIFRoZSBmaXJzdCAgYnl0ZSBpbiBhIGNvcHkgaXRlbSB3aWxsIGJlIGRlbm90ZWQgQzEuICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgKiBUaGUgc2Vjb25kIGJ5dGUgaW4gYSBjb3B5IGl0ZW0gd2lsbCBiZSBkZW5vdGVkIEMyLiAgICAgICAgICAgICAgICAgICAgICAqLworLyogICogQml0cyB3aWxsIGJlIHNlbGVjdGVkIHVzaW5nIHNxdWFyZSBicmFja2V0cy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgIEZvciBleGFtcGxlOiBDMVswLi4zXSBpcyB0aGUgbG93IG5pYmJsZSBvZiB0aGUgZmlyc3QgY29udHJvbCBieXRlLiAgICAgICovCisvKiAgICBvZiBjb3B5IGl0ZW0gQzEuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICogVGhlIExFTkdUSCBvZiBhIGNvcHkgaXRlbSBpcyBkZWZpbmVkIHRvIGJlIEMxWzAuLjNdKzMgd2hpY2ggaXMgYSBudW1iZXIgKi8KKy8qICAgIGluIHRoZSByYW5nZSBbMywxOF0uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgKiBUaGUgSU5ERVggb2YgYSBjb3B5IGl0ZW0gaXMgZGVmaW5lZCB0byBiZSBDMVs0Li43XSoyNTYrQzJbMC4uOF0gd2hpY2ggICAqLworLyogICAgaXMgYSBudW1iZXIgaW4gdGhlIHJhbmdlIFswLDQwOTVdLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAqIEEgY29weSBpdGVtIHJlcHJlc2VudHMgdGhlIHNlcXVlbmNlIG9mIGJ5dGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICB0ZXh0W1BPUy1PRkZTRVQuLlBPUy1PRkZTRVQrTEVOR1RILTFdIHdoZXJlICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgdGV4dCAgIGlzIHRoZSBlbnRpcmUgdGV4dCBvZiB0aGUgdW5jb21wcmVzc2VkIHN0cmluZy4gICAgICAgICAgICAgKi8KKy8qICAgICAgICAgIFBPUyAgICBpcyB0aGUgaW5kZXggaW4gdGhlIHRleHQgb2YgdGhlIGNoYXJhY3RlciBmb2xsb3dpbmcgdGhlICAgICovCisvKiAgICAgICAgICAgICAgICAgICBzdHJpbmcgcmVwcmVzZW50ZWQgYnkgYWxsIHRoZSBpdGVtcyBwcmVjZWVkaW5nIHRoZSBpdGVtICAqLworLyogICAgICAgICAgICAgICAgICAgYmVpbmcgZGVmaW5lZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgIE9GRlNFVCBpcyBvYnRhaW5lZCBmcm9tIElOREVYIGJ5IGxvb2tpbmcgdXAgdGhlIGhhc2ggdGFibGUuICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogVGhlIGZvbGxvd2luZyAjZGVmaW5lIGRlZmluZXMgdGhlIGxlbmd0aCBvZiB0aGUgY29weSBmbGFnIHRoYXQgYXBwZWFycyBhdCAgKi8KKy8qIHRoZSBzdGFydCBvZiB0aGUgY29tcHJlc3NlZCBmaWxlLiBUaGUgdmFsdWUgb2YgZm91ciBieXRlcyB3YXMgY2hvc2VuICAgICAgICovCisvKiBiZWNhdXNlIHRoZSBmYXN0X2NvcHkgcm91dGluZSBvbiBteSBNYWNpbnRvc2ggcnVucyBmYXN0ZXIgaWYgdGhlIHNvdXJjZSA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RSSU5HXzE4ICgoVUJZVEUgKikgIjEyMzQ1Njc4OTAxMjM0NTY3OCIpCisKKy8qIEluIHRoaXMgYWxnb3JpdGhtLCBoYXNoIHZhbHVlcyBoYXZlIHRvIGJlIGNhbGN1bGF0ZWQgYXQgbW9yZSB0aGFuIG9uZSAgICAgICovCisvKiBwb2ludC4gVGhlIGZvbGxvd2luZyBtYWNybyBuZWF0ZW5zIHRoZSBjb2RlIHVwIGZvciB0aGlzLiAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBIQVNIKFBUUikgXAorICAgKCgoNDA1NDMqKCgoKihQVFIpKTw8OCleKCgqKChQVFIpKzEpKTw8NCleKCooKFBUUikrMikpKSk+PjQpICYgMHhGRkYpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIElucHV0ICA6IEhhbmQgb3ZlciB0aGUgcmVxdWlyZWQgYW1vdW50IG9mIHdvcmtpbmcgbWVtb3J5IGluIHBfd3JrX21lbS4gICAgICovCisvKiBJbnB1dCAgOiBTcGVjaWZ5IGlucHV0IGJsb2NrIHVzaW5nIHBfc3JjX2ZpcnN0IGFuZCBzcmNfbGVuLiAgICAgICAgICAgICAgICAqLworLyogSW5wdXQgIDogUG9pbnQgcF9kc3RfZmlyc3QgdG8gdGhlIHN0YXJ0IG9mIHRoZSBvdXRwdXQgem9uZSAoT1opLiAgICAgICAgICAgKi8KKy8qIElucHV0ICA6IFBvaW50IHBfZHN0X2xlbiB0byBhIFVMT05HIHRvIHJlY2VpdmUgdGhlIG91dHB1dCBsZW5ndGguICAgICAgICAgICovCisvKiBJbnB1dCAgOiBJbnB1dCBibG9jayBhbmQgb3V0cHV0IHpvbmUgbXVzdCBub3Qgb3ZlcmxhcC4gICAgICAgICAgICAgICAgICAgICAqLworLyogT3V0cHV0IDogTGVuZ3RoIG9mIG91dHB1dCBibG9jayB3cml0dGVuIHRvICpw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b2xsOyAgICAgLyogTG9vcCBjb3VudGVyIGZvciB1bnJvbGxlZCBpbm5lciBsb29wLiAgICAgICovCisgICAgIHJlZ2lzdGVyIFVXT1JEIGluZGV4OyAgICAgIC8qIEluZGV4IG9mIGN1cnJlbnQgaGFzaCB0YWJsZSBlbnRyeS4gICAgICAgICAqLworICAgICByZWdpc3RlciBVQllURSAqKnBfaDAgPSBOVUxMIDsgICAgIC8qIFBvaW50ZXIgdG8gY3VycmVudCBoYXNoIHRhYmxlIGVudHJ5LiAgICAgICAqLworICAgICAKKyAgICAvKiBUZXN0IGZvciBvdmVycnVuIGFuZCBqdW1wIHRvIG92ZXJydW4gY29kZSBpZiBuZWNlc3NhcnkuICAgICAgICAgICAgICAgICovCisgICAgaWYgKHBfZHN0PnBfZHN0X3Bvc3QpCisgICAgICAgZ290byBvdmVycnVuOworICAgICAgIAorICAgIC8qIFRoZSBmb2xsb3dpbmcgY2FzY2FkZSBvZiBpZiBzdGF0ZW1lbnRzIGVmZmljaWVudGx5IGNhdGNoZXMgYW5kIGRlYWxzICAgKi8KKyAgICAvKiB3aXRoIHZhcnlpbmcgZGVncmVlcyBvZiBjbG9zZW5lc3MgdG8gdGhlIGVuZCBvZiB0aGUgaW5wdXQgYmxvY2suICAgICAgICovCisgICAgLyogV2hlbiB3ZSBnZXQgdmVyeSBjbG9zZSB0byB0aGUgZW5kLCB3ZSBzdG9wIHVwZGF0aW5nIHRoZSB0YWJsZSBhbmQgICAgICAqLworICAgIC8qIGNvZGUgdGhlIHJlbWFpbmluZyBieXRlcyBhcyBsaXRlcmFscy4gVGhpcyBtYWtlcyB0aGUgY29kZSBzaW1wbGVyLiAgICAgKi8KKyAgICB1bnJvbGw9MTY7CisgICAgaWYgKHBfc3JjPnBfc3JjX21heDE2KQorICAgICAgeworICAgICAgIHVucm9sbD0xOworICAgICAgIGlmIChwX3NyYz5wX3NyY19tYXgxKQorICAgICAgICAgeworICAgICAgICAgIGlmIChwX3NyYz09cF9zcmNfcG9zd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yBhcyB0byBhdm9pZCBhbiBhcnJheSBsb29rdXAuIFRoZSAgKi8KKyAgICAgICAvKiBoYXNoIHRhYmxlIGVudHJ5ICpwX2gwIGlzIGxvb2tlZCB1cCB5aWVsZGluZyBhIHBvaW50ZXIgcCB0byBhICAgICAgICovCisgICAgICAgLyogcG90ZW50aWFsIG1hdGNoIG9mIHRoZSBaaXYgaW4gdGhlIGhpc3RvcnkuICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgIGluZGV4PUhBU0gocF9zcmMpOworICAgICAgIHBfaDA9Jmhhc2hbaW5kZXhdOworICAgICAgIHA9KnBfaDA7CisgICAgICAgCisgICAgICAgLyogSGF2aW5nIGxvb2tlZCB1cCB0aGUgY2FuZGlkYXRlIHBvc2l0aW9uLCB3ZSBhcmUgaW4gYSBwb3NpdGlvbiB0byAgICAqLworICAgICAgIC8qIGF0dGVtcHQgYSBtYXRjaC4gVGhlIG1hdGNoIGxvb3AgaGFzIGJlZW4gdW5yb2xsZWQgdXNpbmcgdGhlIFBTICAgICAgKi8KKyAgICAgICAvKiBtYWNybyBzbyB0aGF0IGZhaWx1cmUgd2l0aGluIHRoZSBmaXJzdCB0aHJlZSBieXRlcyBhdXRvbWF0aWNhbGx5ICAgICovCisgICAgICAgLyogcmVzdWx0cyBpbiB0aGUgbGl0ZXJhbCBicmFuY2ggYmVpbmcgdGFrZW4uIFRoZSBjb2RpbmcgaXMgc2ltcGxlLiAgICAqLworICAgICAgIC8qIHBfeml2IHNhdmVzIHBfc3JjIHNvIHdlIGNhbiBsZXQgcF9zcmMgd2FuZGVyLiAgICAgICAgICAgICAgICAgICAgICAgKi8KKyMgICAgICAgZGVmaW5lIFBTICpwKyshPSpwX3NyYysrCisgICAgICAgcF96aXY9cF9zcmM7CisgICAgICAgaWYgKFBTIHx8IFBTIHx8IFBTKQorICAgICAgICAgeworICAgICAgICAgIC8qIExpdGVyYWwuICovCisgICAgICAgICAgCisgICAgICAgICAgLyogQ29kZSB0aGUgbGl0ZXJhbCBieXRlIGFzIGl0c2VsZiBhbmQgYSB6ZXJvIGNvbnRyb2wgYml0LiAgICAgICAgICAqLworICAgICAgICAgIHBfc3JjPXBfeml2OyBsaXRlcmFsOiAqcF9kc3QrKz0qcF9zcmMrKzsgY29udHJvbCY9MHhGRkZFRkZGRjsKKyAgICAgICAgICAKKyAgICAgICAgICAvKiBXZSBoYXZlIGp1c3QgY29kZWQgYSBsaXRlcmFsLiBJZiB3ZSBoYWQgdHdvIHBlbmRpbmcgb25lcywgdGhhdCAgICovCisgICAgICAgICAgLyogbWFrZXMgdGhyZWUgYW5kIHdlIGNhbiB1cGRhdGUgdGhlIGhhc2ggdGFibGUuICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgIGlmIChwX2gyIT0wKQorICAgICAgICAgICAgIHsqcF9oMj1wX3ppdi0yO30KKyAgICAgICAgICAgICAKKyAgICAgICAgICAvKiBJbiBhbnkgY2FzZSwgcm90YXRlIHRoZSBoYXNoIHRhYmxlIHBvaW50ZXJzIGZvciBuZXh0IHRpbWUuICovCisgICAgICAgICAgcF9oMj1wX2gxOyBwX2gxPXBfaDA7CisgICAgICAgICAgCisgICAgICAgICB9CisgICAgICAgZWxzZQorICAgICAgICAgeworICAgICAgICAgIC8qIENvcHkgKi8KKyAgICAgICAgICAKKyAgICAgICAgICAvKiBNYXRjaCB1cCB0byAxNSByZW1haW5pbmcgYnl0ZXMgdXNpbmcgYW4gdW5yb2xsZWQgbG9vcCBhbmQgY29kZS4gKi8KKyNpZiAwCisgICAgICAgICAgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwgUFMgfHwKKyAgICAgICAgICBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBwX3NyYysrOworI2Vsc2UgICAgIAorICAgICAgICAgIGlmICgKKyAgICAgICAgICAgICAgICEoIFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8IFBTIHx8CisgICAgICAgICAgICAgICAgICBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyB8fCBQUyApIAorICAgICAgICAgICAgICkgcF9zcmMrKzsKKyNlbmRpZgorICAgICAgICAgICpwX2RzdCsrPSgoaW5kZXgmMHhGMDApPj40KXwoLS1wX3NyYy1wX3ppdi0zKTsKKyAgICAgICAgICAqcF9kc3QrKz1pbmRleCYweEZGOworICAgICAgICAgIAorICAgICAgICAgIC8qIEFzIHdlIGhhdmUganVzdCBjb2RlZCB0aHJlZSBieXRlcywgd2UgYXJlIG5vdyBpbiBhIHBvc2l0aW9uIHRvICAgKi8KKyAgICAgICAgICAvKiB1cGRhdGUgdGhlIGhhc2ggdGFibGUgd2l0aCB0aGUgbGl0ZXJhbCBieXRlcyB0aGF0IHdlcmUgcGVuZGluZyAgICovCisgICAgICAgICAgLyogdXBvbiB0aGUgYXJyaXZhbCBvZiBleHRyYSBjb250ZXh0IGJ5dGVzLiAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgIGlmIChwX2gxIT0wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgIGlmIChwX2gyKQorICAgICAgICAgICAgICAgeypwX2gyPXBfeml2LTI7IHBfaDI9TlVMTDt9CisgICAgICAgICAgICAgKnBfaDE9cF96aXYtMTsgcF9oMT1OVUxMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgLyogSW4gYW55IGNhc2UsIHdlIGNhbiB1cGRhdGUgdGhlIGhhc2ggdGFibGUgYmFzZWQgb24gdGhlIGN1cnJlbnQgICAqLworICAgICAgICAgIC8qIHBvc2l0aW9uIGFzIHdlIGp1c3QgY29kZWQgYXQgbGVhc3QgdGhyZWUgYnl0ZXMgaW4gYSBjb3B5IGl0ZW1zLiAgKi8KKyAgICAgICAgICAqcF9oMD1wX3ppdjsKKyAgICAgICAgICAKKyAgICAgICAgIH0KKyAgICAgICBjb250cm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Ki8KKyAvKiBjb3B5IHRoZSBpbnB1dCBvdmVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgb3ZlcnJ1bjoKKyNpZiAwCisgKnBfZHN0X2ZpcnN0PUZMQUdfQ09QWTsKKyBmYXN0X2NvcHkocF9zcmNfZmlyc3QscF9kc3RfZmlyc3QrRkxBR19CWVRFUyxzcmNfbGVuKTsKKyAqcF9kc3RfbGVuPXNyY19sZW4rRkxBR19CWVRFUzsKKyNlbHNlCisgZmFzdF9jb3B5KHBfc3JjX2ZpcnN0LHBfZHN0X2ZpcnN0LHNyY19sZW4pOworICpwX2RzdF9sZW49IC1zcmNfbGVuOyAvKiByZXR1cm4gYSBuZWdhdGl2ZSBudW1iZXIgdG8gaW5kaWNhdGUgdW5jb21wcmVzc2VkIGRhdGEgKi8KKyNlbmRpZgorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiBJbnB1dCAgOiBIYW5kIG92ZXIgdGhlIHJlcXVpcmVkIGFtb3VudCBvZiB3b3JraW5nIG1lbW9yeSBpbiBwX3dya19tZW0uICAgICAqLworLyogSW5wdXQgIDogU3BlY2lmeSBpbnB1dCBibG9jayB1c2luZyBwX3NyY19maXJzdCBhbmQgc3JjX2xlbi4gICAgICAgICAgICAgICAgKi8KKy8qIElucHV0ICA6IFBvaW50IHBfZHN0X2ZpcnN0IHRvIHRoZSBzdGFydCBvZiB0aGUgb3V0cHV0IHpvbmUuICAgICAgICAgICAgICAgICovCisvKiBJbnB1dCAgOiBQb2ludCBwX2RzdF9sZW4gdG8gYSBVTE9ORyB0byByZWNlaXZlIHRoZSBvdXRwdXQgbGVuZ3RoLiAgICAgICAgICAqLworLyogSW5wdXQgIDogSW5wdXQgYmxvY2sgYW5kIG91dHB1dCB6b25lIG11c3Qgbm90IG92ZXJsYXAuIFVzZXIga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DsKKyAKKyAvKiBDaGVjayB0aGUgbGVhZGluZyBjb3B5IGZsYWcgdG8gc2VlIGlmIHRoZSBjb21wcmVzc29yIGNob3NlIHRvIHVzZSBhIGNvcHkgICovCisgLyogb3BlcmF0aW9uIGluc3RlYWQgb2YgYSBjb21wcmVzc2lvbiBvcGVyYXRpb24uIElmIGEgY29weSBvcGVyYXRpb24gd2FzICAgICAqLworIC8qIHVzZWQsIHRoZW4gYWxsIHdlIG5lZWQgdG8gZG8gaXMgY29weSB0aGUgZGF0YSBvdmVyLCBzZXQgdGhlIG91dHB1dCBsZW5ndGggKi8KKyAvKiBhbmQgcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjaWYgMAorIGlmICgqcF9zcmNfZmlyc3Q9PUZMQUdfQ09QWSkKKyAgIHsKKyAgICBmYXN0X2NvcHkocF9zcmNfZmlyc3QrRkxBR19CWVRFUyxwX2RzdF9maXJzdCxzcmNfbGVuLUZMQUdfQllURVMpOworICAgICpwX2RzdF9sZW49c3JjX2xlbi1GTEFHX0JZVEVTOworICAgIHJldHVybjsKKyAgIH0KKyNlbHNlCisgIGlmICggc3JjX2xlbiA8IDAgKQorICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKKyAgIGZhc3RfY29weShwX3NyY19maXJzdCxwX2RzdF9maXJzdCwtc3JjX2xlbiApOworICAgKnBfZHN0X2xlbiA9IChVTE9ORyktc3JjX2xlbjsKKyAgIHJldHVybjsKKyAgfQorI2VuZGlmCisgICAKKyAvKiBJbml0aWFsaXplIGFsbCBlbGVtZW50cyBvZiB0aGUgaGFzaCB0YWJsZSB0byBwb2ludCB0byBhIGNvbnN0YW50IHN0cmluZy4gICovCisgLyogVXNlIG9mIGFuIHVucm9sbGVkIGxvb3Agc3BlZWRzIHRoaXMgdXAgY29uc2lkZXJhYmx5LiAgICAgICAgICAgICAgICAgICAgICAqLwor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ZSByZWFjaCB0aGUgZW5kICAgKi8KKyAgICAvKiBvZiBhIGdyb3VwLCB3ZSBoYXZlIHRvIGxvYWQgYSBuZXcgY29udHJvbCB3b3JkIGFuZCBpbmplY3QgYSBuZXcgMSBiaXQuICovCisgICAgaWYgKGNvbnRyb2w9PTEpCisgICAgICB7CisgICAgICAgY29udHJvbD0weDEwMDAwfCpwX3NyYysrOworICAgICAgIGNvbnRyb2x8PSgqcF9zcmMrKyk8PDg7CisgICAgICB9CisKKyAgICAvKiBJZiBpdCBpcyBwb3NzaWJsZSB0aGF0IHdlIGFyZSB3aXRoaW4gMTYgZ3JvdXBzIGZyb20gdGhlIGVuZCBvZiB0aGUgICAgICovCisgICAgLyogaW5wdXQsIGV4ZWN1dGUgdGhlIHVucm9sbGVkIGxvb3Agb25seSBvbmNlLCBlbHNlIHByb2Nlc3MgYSB3aG9sZSBncm91cCAqLworICAgIC8qIG9mIDE2IGl0ZW1zIGJ5IGxvb3BpbmcgMTYgdGltZXMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICB1bnJvbGw9IHBfc3JjPD1wX3NyY19tYXgxNiA/IDE2IDogMTsKKworICAgIC8qIFRoaXMgaW5uZXIgbG9vcCBwcm9jZXNzZXMgb25lIHBocmFzZSAoaXRlbSkgcGVyIGl0ZXJhdGlvbi4gKi8KKyAgICB3aGlsZSAodW5yb2xsLS0pCisgICAgICB7IC8qIEJlZ2luIHVucm9sbGVkIGlubmVyIGxvb3AuICovCisgICAgICAKKyAgICAgICAvKiBQcm9jZXNzIGEgbGl0ZXJhbCBvciBjb3B5IGl0ZW0gZGVwZW5kaW5nIG9uIHRoZSBuZXh0IGNvbnRyb2wgYml0LiAqLworICAgICAgIGlmIChjb250cm9sJjEpCisgICAgICAgICB7CisgICAgICAgICAgLyogQ29weSBpdGVtLiAqLworICAgICAgICAgIAorICAgICAgICAgIHJlZ2lzdGVyIFVCWVRFICpwOyAgICAgICAgICAgLyogUG9pbnRzIHRvIHBsYWNlIGZyb20gd2hpY2ggdG8gY29weS4gKi8KKyAgICAgICAgICByZWdpc3RlciBVV09SRCBsZW5tdDsgICAgICAgIC8qIExlbmd0aCBvZiBjb3B5IGl0ZW0gbWludXMgdGhyZWUuICAgICovCisgICAgICAgICAgcmVnaXN0ZXIgVUJZVEUgKipwX2h0ZTsgICAgICAvKiBQb2ludGVyIHRvIGN1cnJlbnQgaGFzaCB0YWJsZSBlbnRyeS4qLworICAgICAgICAgIHJlZ2lzdGVyIFVCWVRFICpwX3ppdj1wX2RzdDsgLyogUG9pbnRlciB0byBzdGFydCBvZiBjdXJyZW50IFppdi4gICAgKi8KKyAgICAgICAgICAKKyAgICAgICAgICAvKiBSZWFkIGFuZCBkaXNtYW50bGUgdGhlIGNvcHkgd29yZC4gV29yayBvdXQgZnJvbSB3aGVyZSB0byBjb3B5LiAgICovCisgICAgICAgICAgbGVubXQ9KnBfc3JjKys7CisgICAgICAgICAgcF9odGU9Jmhhc2hbKChsZW5tdCYweEYwKTw8NCl8KnBfc3JjKytdOworICAgICAgICAgIHA9KnBfaHRlOworICAgICAgICAgIGxlbm10Jj0weEY7CisgICAgICAgICAgCisgICAgICAgICAgLyogTm93IHBlcmZvcm0gdGhlIGNvcHkgdXNpbmcgYSBoYWxmIHVucm9sbGVkIGxvb3AuICovCisgICAgICAgICAgKnBfZHN0Kys9KnArKzsKKyAgICAgICAgICAqcF9kc3QrKz0qcCsrOworICAgICAgICAgICpwX2RzdCsrPSpwKys7CisgICAgICAgICAgd2hpbGUgKGxlbm10LS0pCisgICAgICAgICAgICAgKnBfZHN0Kys9KnArKzsKKyAgICAgICAgICAgICAgICAgCisgICAgICAgICAgLyogQmVjYXVzZSB3ZSBoYXZlIGp1c3QgcmVjZWl2ZWQgMyBvciBtb3JlIGJ5dGVzIGluIGEgY29weSBpdGVtICAgICAqLworICAgICAgICAgIC8qICh3aG9zZSBieXRlcyB3ZSBoYXZlIGp1c3QgaW5zdGFsbGVkIGluIHRoZSBvdXRwdXQpLCB3ZSBhcmUgbm93ICAgKi8KKyAgICAgICAgICAvKiBpbiBhIHBvc2l0aW9uIHRvIGZsdXNoIGFsbCB0aGUgcGVuZGluZyBsaXRlcmFsIGhhc2hpbmdzIHRoYXQgaGFkICovCisgICAgICAgICAgLyogYmVlbiBwb3N0cG9uZWQgZm9yIGxhY2sgb2YgYnl0ZXMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgIGlmIChsaXRlcmFscz4wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgIHJlZ2lzdGVyIFVCWVRFICpyPXBfeml2LWxpdGVyYWxzOworICAgICAgICAgICAgIGhhc2hbSEFTSChyKV09cjsKKyAgICAgICAgICAgICBpZiAobGl0ZXJhbHM9PTIpCisgICAgICAgICAgICAgICAge3IrKzsgaGFzaFtIQVNIKHIpXT1yO30KKyAgICAgICAgICAgICBsaXRlcmFscz0wOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgLyogSW4gYW55IGNhc2UsIHdlIGNhbiBpbW1lZGlhdGVseSB1cGRhdGUgdGhlIGhhc2ggdGFibGUgd2l0aCB0aGUgICAqLworICAgICAgICAgIC8qIGN1cnJlbnQgcG9zaXRpb24uIFdlIGRvbid0IG5lZWQgdG8gZG8gYSBIQVNIKC4uLikgdG8gd29yayBvdXQgICAgKi8KKyAgICAgICAgICAvKiB3aGVyZSB0byBwdXQgdGhlIHBvaW50ZXIsIGFzIHRoZSBjb21wcmVzc29yIGp1c3QgdG9sZCB1cyEhISAgICAgICovCisgICAgICAgICAgKnBfaHRlPXBfeml2OworICAgICAgICAgIAorICAgICAgICAgfQorICAgICAgIGVsc2UKKyAgICAgICAgIHsKKyAgICAgICAgICAvKiBMaXRlcmFsIGl0ZW0uICovCisgICAgICAgICAgCisgICAgICAgICAgLyogQ29weSBvdmVyIHRoZSBsaXRlcmFsIGJ5dGUuICovCisgICAgICAgICAgKnBfZHN0Kys9KnBfc3JjKys7CisgICAgICAgICAgCisgICAgICAgICAgLyogSWYgd2Ugbm93IGhhdmUgdGhyZWUgbGl0ZXJhbHMgd2FpdGluZyB0byBiZSBoYXNoZWQgaW50byB0aGUgaGFzaCAqLworICAgICAgICAgIC8qIHRhYmxlLCB3ZSBjYW4gZG8gb25lIG9mIHRoZW0gbm93IChiZWNhdXNlIHRoZXJlIGFyZSB0aHJlZSkuICAgICAgKi8KKyAgICAgICAgICBpZiAoKytsaXRlcmFscyA9PSAzKQorICAgICAgICAgICAgIHtyZWdpc3RlciBVQllURSAqcD1wX2RzdC0zOyBoYXNoW0hBU0gocCldPXA7IGxpdGVyYWxzPTI7fQorICAgICAgICAgfQorICAgICAgICAgIAorICAgICAgIC8qIFNoaWZ0IHRoZSBjb250cm9sIGJ1ZmZlciBzbyB0aGUgbmV4dCBjb250cm9sIGJpdCBpcyBpbiBiaXQgMC4gKi8KKyAgICAgICBjb250cm9sPj49MTsKKyNpZiAxCisgICAgICAgaWYgKHBfZHN0ID4gcF9kc3RfcG9zdCkgCisgICAgICAgeworCSAgICAgICAvKiBTaGl0OiB3ZSB0cmllZCB0byBkZWNvbXByZXNzIGNvcnJ1cHQgZGF0YSAqLworCSAgICAgICAqcF9kc3RfbGVuID0gMDsKKwkgICAgICAgcmV0dXJuOworICAgICAgIH0KKyNlbmRpZgorICAgICAgfSAvKiBFbmQgdW5yb2xsZWQgaW5uZXIgbG9vcC4gKi8KKyAgICAgICAgICAgICAgIAorICAgfSAvKiBFbmQgb2Ygb3V0ZXIgbG9vcCAqLworICAgCisgLyogV3JpdGUgdGhlIGxlbmd0aCBvZiB0aGUgZGVjb21wcmVzc2VkIGRhdGEgYmVmb3JlIHJldHVybmluZy4gKi8KKyAgKnBfZHN0X2xlbj1wX2RzdC1wX2RzdF9maXJzdDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVuZCBvZiBMWlJXMy5DICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL2Z0YXBlL2NvbXByZXNzb3IvbHpydzMuaCBiL2RyaXZlcnMvY2hhci9mdGFwZS9jb21wcmVzc29yL2x6cnczLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNTMzZmViYQotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9mdGFwZS9jb21wcmVzc29yL2x6cnczLmgKQEAgLTAsMCArMSwyNTMgQEAKKyNpZm5kZWYgX0xaUlczX0gKKyNkZWZpbmUgX0xaUlczX0gKKy8qCisgKiAkU291cmNlOiAvaG9tZXMvY3ZzL2Z0YXBlLXN0YWNrZWQvZnRhcGUvY29tcHJlc3Nvci9senJ3My5oLHYgJAorICogJFJldmlzaW9uOiAxLjEgJAorICogJERhdGU6IDE5OTcvMTAvMDUgMTk6MTI6MzAgJAorICoKKyAqICBpbmNsdWRlIGZpbGVzIGZvciBsenJ3My4gT25seSBzbGlnaHR5IG1vZGlmaWVkIGZyb20gdGhlIG9yaWdpbmFsCisgKiAgdmVyc2lvbi4gQXNzZW1ibGVzIHRoZSB0aHJlZSBpbmNsdWRlIGZpbGVzIGNvbXByZXNzLmgsIHBvcnQuaCBhbmQKKyAqICBmYXN0Y29weS5oIGZyb20gdGhlIG9yaWdpbmFsIGx6cnczIHBhY2thZ2UuCisgKgorICovCisKKyNpbmNsdWRlIDxsaW51eC90eXBlcy5oPgorI2luY2x1ZGUgPGxpbnV4L3N0cmluZy5oPgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ09NUFJFU1MuSCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBBdXRob3IgOiBSb3NzIFdpbGxpYW1zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGF0ZSAgIDogRGVjZW1iZXIgMTk4OS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGlzIGhlYWRlciBmaWxlIGRlZmluZXMgdGhlIGludGVyZmFjZSB0byBhIHNldCBvZiBmdW5jdGlvbnMgY2FsbGVkICAgICAgICAqLworLyogJ2NvbXByZXNzJywgZWFjaCBtZW1iZXIgb2Ygd2hpY2ggaW1wbGVtZW50cyBhIHBhcnRpY3VsYXIgZGF0YSBjb21wcmVzc2lvbiAgKi8KKy8qIGFsZ29yaXRobS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogTm9ybWFsbHkgaW4gQyBwcm9ncmFtbWluZywgZm9yIGVhY2ggLkggZmlsZSwgdGhlcmUgaXMgYSBjb3JyZXNwb25kaW5nIC5DICAgKi8KKy8qIGZpbGUgdGhhdCBpbXBsZW1lbnRzIHRoZSBmdW5jdGlvbnMgcHJvbWlzZWQgaW4gdGhlIC5IIGZpbGUuICAgICAgICAgICAgICAgICovCisvKiBIZXJlLCB0aGVyZSBhcmUgbWFueSAuQyBmaWxlcyBjb3JyZXNwb25kaW5nIHRvIHRoaXMgaGVhZGVyIGZpbGUuICAgICAgICAgICAqLworLyogRWFjaCBjb21mb3JtaW5nIGltcGxlbWVudGF0aW9uIGZpbGUgY29udGFpbnMgYSBzaW5nbGUgZnVuY3Rpb24gICAgICAgICAgICAgKi8KKy8qIGNhbGxlZCAnY29tcHJlc3MnIHRoYXQgaW1wbGVtZW50cyBhIHNpbmdsZSBkYXRhIGNvbXByZXNzaW9uICAgICAgICAgICAgICAgICovCisvKiBhbGdvcml0aG0gdGhhdCBjb25mb3JtcyB3aXRoIHRoZSBpbnRlcmZhY2Ugc3BlY2lmaWVkIGluIHRoaXMgaGVhZGVyIGZpbGUuICAqLworLyogT25seSBvbmUgYWxnb3JpdGhtIGNhbiBiZSBsaW5rZWQgaW4gYXQgYSB0aW1lIGluIHRoaXMgb3JnYW5pemF0aW9uLiAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICBERUZJTklUSU9OIE9GIEZVTkNUSU9OIENPTVBSRVNTICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFN1bW1hcnkgb2YgRnVuY3Rpb24gQ29tcHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhlIGFjdGlvbiB0aGF0ICdjb21wcmVzcycgdGFrZXMgZGVwZW5kcyBvbiBpdHMgZmlyc3QgYXJndW1lbnQgY2FsbGVkICAgICAgKi8KKy8qICdhY3Rpb24nLiAgVGhlIGZ1bmN0aW9uIHByb3ZpZGVzIHRocmVlIGFjdGlvbnM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgLSBSZXR1cm4gaW5mb3JtYXRpb24gYWJvdXQgdGhlIGFsZ29yaXRobS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgIC0gQ29tcHJlc3MgICBhIGJsb2NrIG9mIG1lbW9yeS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAtIERlY29tcHJlc3MgYSBibG9jayBvZiBtZW1vcnkuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAtLS0tLS0tLS0tICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogU2VlIHRoZSBmb3JtYWwgQyBkZWZpbml0aW9uIGxhdGVyIGZvciBhIGRlc2NyaXB0aW9uIG9mIHRoZSBwYXJhbWV0ZXJzLiAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBDb25zdGFudHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogLS0tLS0tLS0tICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIENPTVBSRVNTX09WRVJSVU46IFRoZSBjb25zdGFudCBDT01QUkVTU19PVkVSUlVOIGRlZmluZXMgYnkgaG93IG1hbnkgYnl0ZXMgICovCisvKiBhbiBhbGdvcml0aG0gaXMgYWxsb3dlZCB0byBleHBhbmQgYSBibG9jayBkdXJpbmcgYSBjb21wcmVzc2lvbiBvcGVyYXRpb24uICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEFsdGhvdWdoIGNvbXByZXNzaW9uIGFsZ29yaXRobXMgdXN1YWxseSBjb21wcmVzcyBkYXRhLCB0aGVyZSB3aWxsIGFsd2F5cyAgICovCisvKiBiZSBkYXRhIHRoYXQgYSBnaXZlbiBjb21wcmVzc29yIHdpbGwgZXhwYW5kICh0aGlzIGNhbiBiZSBwcm92ZW4pLiAgICAgICAg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LCBpdCBtaWdodCB3cml0ZSBhbiBvdXRwdXQgYmxvY2sgZmFyIGxhcmdlciB0aGFuIHRoZSBpbnB1dCAgICAgICovCisvKiBibG9jayBiZWZvcmUgcmVhbGl6aW5nIHRoYXQgaXQgaGFzIGRvbmUgc28uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogT24gdGhlIG90aGVyIGhhbmQsIGNvbnRpbnVvdXMgY2hlY2tzIG9uIG91dHB1dCBsZW5ndGggYXJlIGluZWZmaWNpZW50LiAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUbyBjYXRlciBmb3IgYWxsIHRoZXNlIHByb2JsZW1zLCB0aGlzIGludGVyZmFjZSBkZWZpbml0aW9uOiAgICAgICAgICAgICAgICAqLworLyogPiBBbGxvd3MgYSBjb21wcmVzc2lvbiBhbGdvcml0aG0gdG8gcmV0dXJuIGFuIG91dHB1dCBibG9jayB0aGF0IGlzIHVwIHRvICAgKi8KKy8qICAgQ09NUFJFU1NfT1ZFUlJVTiBieXRlcyBsb25nZXIgdGhhbiB0aGUgaW5wdXQgYmxvY2suICAgICAgICAgICAgICAgICAgICAgICovCisvKiA+IEFsbG93cyBhIGNvbXByZXNzaW9uIGFsZ29yaXRobSB0byB3cml0ZSB1cCB0byBDT01QUkVTU19PVkVSUlVOIGJ5dGVzICAgICAqLworLyogICBtb3JlIHRoYW4gdGhlIGxlbmd0aCBvZiB0aGUgaW5wdXQgYmxvY2sgdG8gdGhlIG1lbW9yeSBvZiB0aGUgb3V0cHV0ICAgICAgKi8KKy8qICAgYmxvY2sgcmVnYXJkbGVzcyBvZiB0aGUgbGVuZ3RoIG9mIHRoZSBvdXRwdXQgYmxvY2sgZXZlbnR1YWxseSByZXR1cm5lZC4gICovCisvKiAgIFRoaXMgYWxsb3dzIGFuIGFsZ29yaXRobSB0byBvdmVycnVuIHRoZSBsZW5ndGggb2YgdGhlIGlucHV0IGJsb2NrIGluIHRoZSAqLworLyogICBvdXRwdXQgYmxvY2sgYnkgdXAgdG8gQ09NUFJFU1NfT1ZFUlJVTiBieXRlcyBiZXR3ZWVuIGV4cGFuc2lvbiBjaGVja3MuICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGUgcHJvYmxlbSBkb2VzIG5vdCBhcmlzZSBmb3IgZGVjb21wcmVzc2lvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIElkZW50aXR5IEFjdGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAtLS0tLS0tLS0tLS0tLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPiBhY3Rpb24gbXVzdCBiZSBDT01QUkVTU19BQ1RJT05fSURFTlRJVFkuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID4gcF9kc3RfbGVuIG11c3QgcG9pbnQgdG8gYSBsb25nd29yZCB0byByZWNlaXZlIGEgbG9uZ3dvcmQgYWRkcmVzcy4gICAgICAgICovCisvKiA+IFRoZSB2YWx1ZSBvZiB0aGUgb3RoZXIgcGFyYW1ldGVycyBkb2VzIG5vdCBtYXR0ZXIuICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPiBBZnRlciBleGVjdXRpb24sIHRoZSBsb25nd29yZCB0aGF0IHBfZHN0X2xlbiBwb2ludHMgdG8gd2lsbCBiZSBhIHBvaW50ZXIgKi8KKy8qICAgdG8gYSBzdHJ1Y3R1cmUgb2YgdHlwZSBjb21wc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IGlkZW50aXR5IGFjdGlvbi4gICAgICAqLworLyogPiBUaGUgSU5QVVQgQkxPQ0sgaXMgZGVmaW5lZCB0byBiZSBNZW1vcnlbc3JjX2FkZHIsc3JjX2FkZHIrc3JjX2xlbi0xXS4gICAgKi8KKy8qID4gZHN0X2xlbiB3aWxsIGJlIHVzZWQgdG8gZGVub3RlICpwX2RzdF9sZW4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA+IGRzdF9sZW4gaXMgbm90IHJlYWQgYnkgY29tcHJlc3MsIG9ubHkgd3JpdHRlbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPiBUaGUgdmFsdWUgb2YgZHN0X2xlbiBpcyBkZWZpbmVkIG9ubHkgdXBvbiB0ZXJtaW5hdGlvbi4gICAgICAgICAgICAgICAgICAgKi8KKy8qID4gVGhlIE9VVFBVVCBCTE9DSyBpcyBkZWZpbmVkIHRvIGJlIE1lbW9yeVtkc3RfYWRkcixkc3RfYWRkcitkc3RfbGVuLTFdLiAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogQ29tcHJlc3Npb24gQWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIC0tLS0tLS0tLS0tLS0tLS0tLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA+IGFjdGlvbiBtdXN0IGJlIENPTVBSRVNTX0FDVElPTl9DT01QUkVTUy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPiBzcmNfbGVuIG11c3QgYmUgaW4gdGhlIHJhbmdlIFswLENPTVBSRVNTX01BWF9PUkddLiAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID4gVGhlIE9VVFBVVCBaT05FIGlzIGRlZmluZWQgdG8gYmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgIE1lbW9yeVtkc3RfYWRkcixkc3RfYWRkcitzcmNfbGVuLTErQ09NUFJFU1NfT1ZFUlJVTl0uICAgICAgICAgICAgICAgICAqLworLyogPiBUaGUgZnVuY3Rpb24gY2FuIG1vZGlmeSBhbnkgcGFydCBvZiB0aGUgb3V0cHV0IHpvbmUgcmVnYXJkbGVzcyBvZiB0aGUgICAgKi8KKy8qICAgZmluYWwgbGVuZ3RoIG9mIHRoZSBvdXRwdXQgYmxvY2suICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA+IFRoZSBpbnB1dCBibG9jayBhbmQgdGhlIG91dHB1dCB6b25lIG11c3Qgbm90IG92ZXJsYXAuICAgICAgICAgICAgICAgICAgICAqLworLyogPiBkc3RfbGVuIHdpbGwgYmUgaW4gdGhlIHJhbmdlIFswLHNyY19sZW4rQ09NUFJFU1NfT1ZFUlJVTl0uICAgICAgICAgICAgICAgKi8KKy8qID4gZHN0X2xlbiB3aWxsIGJlIGluIHRoZSByYW5nZSBbMCxDT01QUkVTU19NQVhfQ09NXSAoZnJvbSBwcmV2IGZhY3QpLiAgICAgICovCisvKiA+IFRoZSBvdXRwdXQgYmxvY2sgd2lsbCBjb25zaXN0IG9mIGEgcmVwcmVzZW50YXRpb24gb2YgdGhlIGlucHV0IGJsb2NrLiAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlY29tcHJlc3Npb24gQWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAtLS0tLS0tLS0tLS0tLS0tLS0tLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPiBhY3Rpb24gbXVzdCBiZSBDT01QUkVTU19BQ1RJT05fREVDT01QUkVTUy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID4gVGhlIGlucHV0IGJsb2NrIG11c3QgYmUgdGhlIHJlc3VsdCBvZiBhbiBlYXJsaWVyIGNvbXByZXNzaW9uIG9wZXJhdGlvbi4gICovCisvKiA+IElmIHRoZSBwcmV2aW91cyBmYWN0IGlzIHRydWUsIHRoZSBmb2xsb3dpbmcgZmFjdHMgbXVzdCBhbHNvIGJlIHRydWU6ICAgICAqLworLyogICA+IHNyY19sZW4gd2lsbCBiZSBpbiB0aGUgcmFuZ2UgWzAsQ09NUFJFU1NfTUFYX0NPTV0uICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgPiBkc3RfbGVuIHdpbGwgYmUgaW4gdGhlIHJhbmdlIFswLENPTVBSRVNTX01BWF9PUkddLiAgICAgICAgICAgICAgICAgICAgICovCisvKiA+IFRoZSBpbnB1dCBhbmQgb3V0cHV0IGJsb2NrcyBtdXN0IG5vdCBvdmVybGFwLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPiBPbmx5IHRoZSBvdXRwdXQgYmxvY2sgaXMgbW9kaWZpZWQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID4gVXBvbiB0ZXJtaW5hdGlvbiwgdGhlIG91dHB1dCBibG9jayB3aWxsIGNvbnNpc3Qgb2YgdGhlIGJ5dGVzIGNvbnRhaW5lZCAgICovCisvKiAgIGluIHRoZSBpbnB1dCBibG9jayBwYXNzZWQgdG8gdGhlIGVhcmxpZXIgY29tcHJlc3Npb24gb3BlcmF0aW9uLiAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1JULkggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFRoaXMgbW9kdWxlIGNvbnRhaW5zIG1hY3JvIGRlZmluaXRpb25zIGFuZCB0eXBlcyB0aGF0IGFyZSBsaWtlbHkgdG8gICAgICAgICovCisvKiBjaGFuZ2UgYmV0d2VlbiBjb21wdXRlcnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgRE9ORV9QT1JUICAgICAgIC8qIE9ubHkgZG8gdGhpcyBpZiBub3QgcHJldmlvdXNseSBkb25lLiAgICAgICAgICAgICAgICovCisKKyAgICNpZmRlZiBUSElOS19DCisgICAgICAjZGVmaW5lIFVCWVRFIHVuc2lnbmVkIGNoYXIgICAgICAvKiBVbnNpZ25lZCBieXRlICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgI2RlZmluZSBVV09SRCB1bnNpZ25lZCBpbnQgICAgICAgLyogVW5zaWduZWQgd29yZCAoMiBieXRlcykgICAgICAgICAgICAgKi8KKyAgICAgICNkZWZpbmUgVUxPTkcgdW5zaWduZWQgbG9uZyAgICAgIC8qIFVuc2lnbmVkIHdvcmQgKDQgYnl0ZXMpICAgICAgICAgICAgICovCisgICAgICAjZGVmaW5lIEJPT0wgIHVuc2lnbmVkIGNoYXIgICAgICAvKiBCb29sZWFuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgI2RlZmluZSBGT1BFTl9CSU5BUllfUkVBRCAgInJiIiAgLyogTW9kZSBzdHJpbmcgZm9yIGJpbmFyeSByZWFkaW5nLiAgICAgKi8KKyAgICAgICNkZWZpbmUgRk9QRU5fQklOQVJZX1dSSVRFICJ3YiIgIC8qIE1vZGUgc3RyaW5nIGZvciBiaW5hcnkgd3JpdGluZy4gICAgICovCisgICAgICAjZGVmaW5lIEZPUEVOX1RFWFRfQVBQRU5EICAiYSIgICAvKiBNb2RlIHN0cmluZyBmb3IgdGV4dCBhcHBlbmRpbmcuICAgICAqLworICAgICAgI2RlZmluZSBSRUFMIGRvdWJsZSAgICAgICAgICAgICAgLyogVVNlZCBmb3IgZmxvYXRpbmcgcG9pbnQgc3R1ZmYuICAgICAgKi8KKyAgICNlbmRpZgorICAgI2lmIGRlZmluZWQoTElOVVgpIHx8IGRlZmluZWQobGludXgpCisgICAgICAjZGVmaW5lIFVCWVRFIF9fdTggICAgICAgICAgICAgICAvKiBVbnNpZ25lZCBieXRlICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgI2RlZmluZSBVV09SRCBfX3UxNiAgICAgICAgICAgICAgLyogVW5zaWduZWQgd29yZCAoMiBieXRlcykgICAgICAgICAgICAgKi8KKyAgICAgICNkZWZpbmUgVUxPTkcgX191MzIgICAgICAgICAgICAgIC8qIFVuc2lnbmVkIHdvcmQgKDQgYnl0ZXMpICAgICAgICAgICAgICovCisgICAgICAjZGVmaW5lIExPTkcgIF9fczMyICAgICAgICAgICAgICAvKiBTaWduZWQgICB3b3JkICg0IGJ5dGVzKSAgICAgICAgICAgICAqLworICAgICAgI2RlZmluZSBCT09MICBpcyBub3QgdXNlZCBoZXJlICAgLyogQm9vbGVhbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICNkZWZpbmUgRk9QRU5fQklOQVJZX1JFQUQgIG5vdCB1c2VkICAvKiBNb2RlIHN0cmluZyBmb3IgYmluYXJ5IHJlYWRpbmcuICovCisgICAgICAjZGVmaW5lIEZPUEVOX0JJTkFSWV9XUklURSBub3QgdXNlZCAgLyogTW9kZSBzdHJpbmcgZm9yIGJpbmFyeSB3cml0aW5nLiAqLworICAgICAgI2RlZmluZSBGT1BFTl9URVhUX0FQUEVORCAgbm90IHVzZWQgIC8qIE1vZGUgc3RyaW5nIGZvciB0ZXh0IGFwcGVuZGluZy4gKi8KKyAgICAgICNkZWZpbmUgUkVBTCBub3QgdXNlZCAgICAgICAgICAgICAgICAvKiBVU2VkIGZvciBmbG9hdGluZyBwb2ludCBzdHVmZi4gICovCisgICAgICAjaWZuZGVmIFRSVUUKKyAgICAgICNkZWZpbmUgVFJVRSAxCisgICAgICAjZW5kaWYKKyAgICNlbmRpZgorCisgICAjZGVmaW5lIERPTkVfUE9SVCAgICAgICAgICAgICAgICAgICAvKiBEb24ndCBkbyBhbGwgdGhpcyBhZ2Fpbi4gICAgICAgICAgICAqLworICAgI2RlZmluZSBNQUxMT0NfRkFJTCBOVUxMICAgICAgICAgICAgLyogRmFpbHVyZSBzdGF0dXMgZnJvbSBtYWxsb2MoKSAgICAgICAgKi8KKyAgICNkZWZpbmUgTE9DQUwgc3RhdGljICAgICAgICAgICAgICAgIC8qIEZvciBub24tZXhwb3J0ZWQgcm91dGluZXMuICAgICAgICAgICovCisgICAjZGVmaW5lIEVYUE9SVCAgICAgICAgICAgICAgICAgICAgICAvKiBTaWduYWxzIGV4cG9ydGVkIGZ1bmN0aW9uLiAgICAgICAgICAqLworICAgI2RlZmluZSB0aGVuICAgICAgICAgICAgICAgICAgICAgICAgLyogVXNlZnVsIGZvciBhbGlnbmluZyBpZnMuICAgICAgICAgICAgKi8KKworI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVuZCBvZiBQT1JULkggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2RlZmluZSBDT01QUkVTU19BQ1RJT05fSURFTlRJVFkgICAwCisjZGVmaW5lIENPTVBSRVNTX0FDVElPTl9DT01QUkVTUyAgIDEKKyNkZWZpbmUgQ09NUFJFU1NfQUNUSU9OX0RFQ09NUFJFU1MgMgorCisjZGVmaW5lIENPTVBSRVNTX09WRVJSVU4gMTAyNAorI2RlZmluZSBDT01QUkVTU19NQVhfQ09NIDB4NzAwMDAwMDAKKyNkZWZpbmUgQ09NUFJFU1NfTUFYX09SRyAoQ09NUFJFU1NfTUFYX0NPTS1DT01QUkVTU19PVkVSUlVOKQorCisjZGVmaW5lIENPTVBSRVNTX01BWF9TVFJMRU4gMjU1CisKKy8qIFRoZSBmb2xsb3dpbmcgc3RydWN0dXJlIHByb3ZpZGVzIGluZm9ybWF0aW9uIGFib3V0IHRoZSBhbGdvcml0aG0uICAgICAgICAgKi8KKy8qID4gVGhlIHRvcCBiaXQgb2YgaWQgbXVzdCBiZSB6ZXJvLiBUaGUgcmVtYWluaW5nIGJpdHMgbXVzdCBiZSBjaG9zZW4gYnkgICAgKi8KKy8qICAgdGhlIGF1dGhvciBvZiB0aGUgYWxnb3JpdGhtIGJ5IHRvc3NpbmcgYSBjb2luIDMxIHRpbWVzLiAgICAgICAgICAgICAgICAgKi8KKy8qID4gVGhlIGFtb3VudCBvZiBtZW1vcnkgcmVxdWVzdGVkIGJ5IHRoZSBhbGdvcml0aG0gaXMgc3BlY2lmaWVkIGluIGJ5dGVzICAgKi8KKy8qICAgYW5kIG11c3QgYmUgaW4gdGhlIHJhbmdlIFswLDB4NzAwMDAwMDBdLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID4gQWxsIHN0cmluZ3MgcyBtdXN0IGJlIHN1Y2ggdGhhdCBzdHJsZW4ocyk8PUNPTVBSRVNTX01BWF9TVFJMRU4uICAgICAgICAgKi8KK3N0cnVjdCBjb21wcmVzc19pZGVudGl0eQorICB7CisgICBVTE9ORyBpZDsgICAgICAgICAgIC8qIElkZW50aWZ5aW5nIG51bWJlciBvZiBhbGdvcml0aG0uICAgICAgICAgICAgKi8KKyAgIFVMT05HIG1lbW9yeTsgICAgICAgLyogTnVtYmVyIG9mIGJ5dGVzIG9mIHdvcmtpbmcgbWVtb3J5IHJlcXVpcmVkLiAqLworCisgICBjaGFyICAqbmFtZTsgICAgICAgIC8qIE5hbWUgb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgIGNoYXIgICp2ZXJzaW9uOyAgICAgLyogVmVyc2lvbiBudW1iZXIuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgY2hhciAgKmRhdGU7ICAgICAgICAvKiBEYXRlIG9mIHJlbGVhc2Ugb2YgdGhpcyB2ZXJzaW9uLiAgICAgICAgICAgICovCisgICBjaGFyICAqY29weXJpZ2h0OyAgIC8qIENvcHlyaWdodCBtZXNzYWdlLiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworICAgY2hhciAgKmF1dGhvcjsgICAgICAvKiBBdXRob3Igb2YgYWxnb3JpdGhtLiAgICAgICAgICAgICAgICAgICAgICAgICovCisgICBjaGFyICAqYWZmaWxpYXRpb247IC8qIEFmZmlsaWF0aW9uIG9mIGF1dGhvci4gICAgICAgICAgICAgICAgICAgICAgKi8KKyAgIGNoYXIgICp2ZW5kb3I7ICAgICAgLyogV2hlcmUgdGhlIGFsZ29yaXRobSBjYW4gYmUgb2J0YWluZWQuICAgICAgICAqLworICB9OworCit2b2lkICBsenJ3M19jb21wcmVzcyggICAgICAgIC8qIFNpbmdsZSBmdW5jdGlvbiBpbnRlcmZhY2UgdG8gY29tcHJlc3Npb24gYWxnb3JpdGhtLiAqLworVVdPUkQgICAgIGFjdGlvbiwgICAgICAvKiBBY3Rpb24gdG8gYmUgcGVyZm9ybWVkLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KK1VCWVRFICAgKndya19tZW0sICAgICAgLyogV29ya2luZyBtZW1vcnkgdGVtcG9yYXJpbHkgZ2l2ZW4gdG8gcm91dGluZSB0byB1c2UuICovCitVQllURSAgICpzcmNfYWRyLCAgICAgIC8qIEFkZHJlc3Mgb2YgaW5wdXQgIGRhdGEuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworTE9ORyAgICAgc3JjX2xlbiwgICAgICAvKiBMZW5ndGggIG9mIGlucHV0ICBkYXRhLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KK1VCWVRFICAgKmRzdF9hZHIsICAgICAgLyogQWRkcmVzcyBvZiBvdXRwdXQgZGF0YS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCit2b2lkICAqcF9kc3RfbGVuICAgICAgIC8qIFBvaW50ZXIgdG8gYSBsb25nd29yZCB3aGVyZSByb3V0aW5lIHdpbGwgd3JpdGU6ICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAvKiAgICBJZiBhY3Rpb249Li5JREVOVElUWSAgID0+IEFkciBvZiBpZCBzdHJ1Y3R1cmUuICAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgLyogICAgSWYgYWN0aW9uPS4uQ09NUFJFU1MgICA9PiBMZW5ndGggb2Ygb3V0cHV0IGRhdGEuICovCisgICAgICAgICAgICAgICAgICAgICAgIC8qICAgIElmIGFjdGlvbj0uLkRFQ09NUFJFU1MgPT4gTGVuZ3RoIG9mIG91dHB1dCBkYXRhLiAqLworKTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbmQgb2YgQ09NUFJFU1MuSCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYXN0X2NvcHkuaCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogVGhpcyBmdW5jdGlvbiBjb3BpZXMgYSBibG9jayBvZiBtZW1vcnkgdmVyeSBxdWlja2x5LiAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFRoZSBleGFjdCBzcGVlZCBkZXBlbmRzIG9uIHRoZSByZWxhdGl2ZSBhbGlnbm1lbnQgb2YgdGhlIGJsb2NrcyBvZiBtZW1vcnkuICovCisvKiBQUkUgIDogMDw9c3JjX2xlbjw9KDJeMzIpLTEgLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUFJFICA6IFNvdXJjZSBhbmQgZGVzdGluYXRpb24gYmxvY2tzIG11c3Qgbm90IG92ZXJsYXAuICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBPU1QgOiBNRU1bZHN0X2Fkcixkc3RfYWRyK3NyY19sZW4tMV09TUVNW3NyY19hZHIsc3JjX2FkcitzcmNfbGVuLTFdLiAgICAgICovCisvKiBQT1NUIDogTUVNW2RzdF9hZHIsZHN0X2FkcitzcmNfbGVuLTFdIGlzIHRoZSBvbmx5IG1lbW9yeSBjaGFuZ2VkLiAgICAgICAgICAqLworCisjZGVmaW5lIGZhc3RfY29weShzcmMsZHN0LGxlbikgbWVtY3B5KGRzdCxzcmMsbGVuKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRW5kIG9mIGZhc3RfY29weS5oICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNlbmRpZgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL2Z0YXBlL2NvbXByZXNzb3IvemZ0YXBlLWNvbXByZXNzLmMgYi9kcml2ZXJzL2NoYXIvZnRhcGUvY29tcHJlc3Nvci96ZnRhcGUtY29tcHJlc3MuYwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4yMjBhMjI3Ci0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL2Z0YXBlL2NvbXByZXNzb3IvemZ0YXBlLWNvbXByZXNzLmMKQEAgLTAsMCArMSwxMjAzIEBACisvKgorICogICAgICBDb3B5cmlnaHQgKEMpIDE5OTQtMTk5NyBDbGF1cy1KdXN0dXMgSGVpbmUKKworIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSB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Z0Y19jbGVhbnVwKCkpOworCVRSQUNFX0NBVENIKHpmdF92bWFsbG9jX2Fsd2F5cygmemZ0Y19idWYsIGJsa3N6ICsgQ01QUl9PVkVSUlVOKSwKKwkJICAgIHpmdGNfY2xlYW51cCgpKTsKKwlhbGxvY19ibGtzeiA9IGJsa3N6OworCVRSQUNFX0NBVENIKHpmdF92bWFsbG9jX2Fsd2F5cygmemZ0Y19zY3JhdGNoX2J1ZiwgYmxrc3orQ01QUl9PVkVSUlVOKSwKKwkJICAgIHpmdGNfY2xlYW51cCgpKTsKKwljbXByX21lbV9pbml0aWFsaXplZCA9IDE7CisJVFJBQ0VfRVhJVCAwOworfQorCitzdGF0aWMgdm9pZCB6ZnRjX2NsZWFudXAodm9pZCkKK3sKKwlUUkFDRV9GVU4oZnRfdF9mbG93KTsKKworCXpmdF92ZnJlZSgmemZ0Y193cmtfbWVtLCBDTVBSX1dSS19NRU1fU0laRSk7CisJemZ0X3ZmcmVlKCZ6ZnRjX2J1ZiwgYWxsb2NfYmxrc3ogKyBDTVBSX09WRVJSVU4pOworCXpmdF92ZnJlZSgmemZ0Y19zY3JhdGNoX2J1ZiwgYWxsb2NfYmxrc3ogKyBDTVBSX09WRVJSVU4pOworCWNtcHJfbWVtX2luaXRpYWxpemVkID0gYWxsb2NfYmxrc3ogPSAwOworCVRSQUNFX0VYSVQ7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgKiAgVGhlIGZvbGxvd2luZyB0d28gZnVuY3Rpb25zICJmdGFwZV9jb21wcmVzcygpIiBhbmQgICAgICAgICAgICAgICAgICAgICAgICoKKyAqICAiZnRhcGVfdW5jb21wcmVzcygpIiBhcmUgdGhlIGludGVyZmFjZSB0byB0aGUgYWN0dWFsIGNvbXByZXNzaW9uICAgICAgICAgKgorICogIGFsZ29yaXRobSAoaS5lLiB0aGV5IGFyZSBjYWxsaW5nIHRoZSAiY29tcHJlc3MoKSIgZnVuY3Rpb24gZnJvbSAgICAgICAgICAqCisgKiAgdGhlIGx6cnczIHBhY2thZ2UgZm9yIG5vdykuIFRoZXNlIHJvdXRpbmVzIGNvdWxkIHF1aXRlIGVhc2lseSBiZSAgICAgICAgICoKKyAqICBjaGFuZ2VkIHRvIGFkb3B0IGFub3RoZXIgY29tcHJlc3Npb24gYWxnb3JpdGhtIGluc3RlYWQgb2YgbHpydzMsICAgICAgICAgKgorICogIHdoaWNoIGN1cnJlbnRseSBpcyB1c2VkLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogY2FsbGVkIGJ5IHpmdF9jb21wcmVzc193cml0ZSgpIHRvIHBlcmZvcm0gdGhlIGNvbXByZXNzaW9uLiBNdXN0CisgKiByZXR1cm4gdGhlIHNpemUgb2YgdGhlIGNvbXByZXNzZWQgZGF0YS4KKyAqCisgKiBOT1RFOiBUaGUgc2l6ZSBvZiB0aGUgY29tcHJlc3NlZCBkYXRhIHNob3VsZCBub3QgZXhjZWVkIHRoZSBzaXplIG9mCisgKiAgICAgICB0aGUgdW5jb21wcmVzc2VkIGRhdGEuIE1vc3QgY29tcHJlc3Npb24gYWxnb3JpdGhtcyBoYXZlIG1lYW5zCisgKiAgICAgICB0byBzdG9yZSBkYXRhIHVuY2hhbmdlZCBpZiB0aGUgImNvbXByZXNzZWQiIGRhdGEgYW1vdW50IHdvdWxkCisgKiAgICAgICBleGNlZWQgdGhlIG9y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vbXByLi91bmNtcHIuICAgOiAlM2QgJSUiLAorCQkJICAgICAgKCgoemZ0Y193cl9jb21wcmVzc2VkPj4xMCkgKiAxMDApCisJCQkgICAgICAgLyAoemZ0Y193cl91bmNvbXByZXNzZWQ+PjEwKSkpOworCQl9IGVsc2UgeworCQkJVFJBQ0UoZnRfdF9pbmZvLCAiY29tcHJlc3Npb24gc3RhdGlzdGljcyAod3JpdGluZyk6XG4iCisJCQkgICAgICBLRVJOX0lORk8gIiBjb21wci4vdW5jbXByLiAgIDogJTNkICUlIiwKKwkJCSAgICAgICgoemZ0Y193cl9jb21wcmVzc2VkICogMTAwKQorCQkJICAgICAgIC8gemZ0Y193cl91bmNvbXByZXNzZWQpKTsKKwkJfQorCX0KKwlpZiAoemZ0Y19yZF91bmNvbXByZXNzZWQgIT0gMCkgeworCQlpZiAoemZ0Y19yZF9jb21wcmVzc2VkID4gKDE8PDE0KSkgeworCQkJVFJBQ0UoZnRfdF9pbmZvLCAiY29tcHJlc3Npb24gc3RhdGlzdGljcyAocmVhZGluZyk6XG4iCisJCQkgICAgICBLRVJOX0lORk8gIiBjb21wci4vdW5jbXByLiAgIDogJTNkICUlIiwKKwkJCSAgICAgICgoKHpmdGNfcmRfY29tcHJlc3NlZD4+MTApICogMTAwKQorCQkJICAgICAgIC8gKHpmdGNfcmRfdW5jb21wcmVzc2VkPj4xMCkpKTsKKwkJfSBlbHNlIHsKKwkJCVRSQUNFKGZ0X3RfaW5mbywgImNvbXByZXNzaW9uIHN0YXRpc3RpY3MgKHJlYWRpbmcpOlxuIgorCQkJICAgICAgS0VSTl9JTkZPICIgY29tcHIuL3VuY21wci4gICA6ICUzZCAlJSIsCisJCQkgICAgICAoKHpmdGNfcmRfY29tcHJlc3NlZCAqIDEwMCkKKwkJCSAgICAgICAvIHpmdGNfcmRfdW5jb21wcmVzc2VkKSk7CisJCX0KKwl9CisJLyogb25seSBwcmludCBpdCBvbmNlOiAqLworCXpmdGNfd3JfdW5jb21wcmVzc2VkID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2J1ZiwgMCwgMCk7IAorCQljcF9jbnQgPSB0aGlzX3NlZ3Nfc3ogLSBzaXplb2YoX191MTYpOworCQljbHVzdGVyLT5jbXByX3N6ICAtPSBjcF9jbnQ7CisJCWJ1Zl9wb3MgPSB0aGlzX3NlZ3Nfc3o7CisJfQorCW1lbWNweShkc3RfYnVmICsgc2l6ZW9mKF9fdTE2KSwgc3JjX2J1ZiArIGNsdXN0ZXItPmNtcHJfcG9zLCBjcF9jbnQpOworCWNsdXN0ZXItPmNtcHJfcG9zICs9IGNwX2NudDsKKwlUUkFDRV9FWElUIGJ1Zl9wb3M7Cit9CisKKy8qIHJldHVybi12YWx1ZTogdGhlIG51bWJlciBvZiBieXRlcyByZW1vdmVkIGZyb20gdGhlIHVzZXItYnVmZmVyCisgKiAgICAgICAgICAgICAgIGBzcmNfYnVmJyBvciBlcnJvciBjb2RlCisgKgorICogIGludCAqd3JpdGVfY250ICAgICAgICAgICA6IGhvdyBtdWNoIGFjdHVhbGx5IGhhcyBiZWVuIG1vdmVkIHRvIHRoZQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdF9idWYuIE5lZWQgbm90IGJlIGluaXRpYWxpemVkIHdoZW4KKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByZXR1cm5zIHdpdGggYW4gZXJyb3IgY29kZQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuZWdhdGl2IHJldHVybiB2YWx1ZSkgCisgKiAgX191OCAqZHN0X2J1ZiAgICAgICAgICAgIDoga2VybmVsIHNwYWNlIGJ1ZmZlciB3aGVyZSB0aGUgaGFzIHRvIGJlCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29waWVkIHRvLiBUaGUgY29udGVudHMgb2YgdGhpcyBidWZmZXJzCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ29lcyB0byBhIHNwZWNpZmljIHNlZ21lbnQuCisgKiAgY29uc3QgaW50IHNlZ19zeiAgICAgICAgIDogdGhlIHNpemUgb2YgdGhlIHNlZ21lbnQgZHN0X2J1ZiB3aWxsIGJlCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29waWVkIHRvLgorICogIGNvbnN0IHpmdF9wb3NpdGlvbiAqcG9zICA6IHN0cnVjdCBjb250YWluaW5nIHRoZSBjb29yZGluYXRlcyBpbgorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSBjdXJyZW50IHZvbHVtZSAoYnl0ZSBwb3NpdGlvbiwKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWdtZW50IGlkIG9mIGN1cnJlbnQgc2VnbWVudCBldGMpCisgKiAgY29uc3QgemZ0X3ZvbGluZm8gKnZvbHVtZTogaW5mb3JtYXRpb24gYWJvdXQgdGhlIGN1cnJlbnQgdm9sdW1lLAorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUgZXRjLgorICogIGNvbnN0IF9fdTggKnNyY19idWYgICAgICA6IHVzZXIgc3BhY2UgYnVmZmVyIHRoYXQgY29udGFpbnMgdGhlCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSB0aGUgdXNlciB3YW50cyB0byBiZSB3cml0dGVuIHRvCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFwZS4KKyAqICBjb25zdCBpbnQgcmVxX2xlbiAgICAgICAgOiB0aGUgYW1vdW50IG9mIGRhdGEgdGhlIHVzZXIgd2FudHMgdG8gYmUKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0dGVuIHRvIHRhcGUuCisgKi8KK3N0YXRpYyBpbnQgemZ0Y193cml0ZShpbnQgKndyaXRlX2NudCwKKwkJICAgICAgX191OCAqZHN0X2J1ZiwgY29uc3QgaW50IHNlZ19zeiwKKwkJICAgICAgY29uc3QgX191OCBfX3VzZXIgKnNyY19idWYsIGNvbnN0IGludCByZXFfbGVuLAorCQkgICAgICBjb25zdCB6ZnRfcG9zaXRpb24gKnB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RjLmRvcik7CisJb3V0YihGRENfRE1BX01PREUgLyogOCAqLywgZmRjLmRvcik7CisJb3V0YigxLCBmZGMuZG9yMik7CisKKwkvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCSAqCisJICogY0g6IHdoeSB0aGUgaGVsbCBzaG91bGQgdGhpcyBiZSBuZWNlc3Nhcnk/IFRoaXMgaXMgZG9uZSAKKwkgKiAgICAgYnkgZmRjX3Jlc2V0KCkhISEKKwkgKgorCSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCS8qICBJbml0aWFsaXplIGZkYywgc2VsZWN0IGRyaXZlIEI6CisJICovCisJb3V0YihGRENfRE1BX01PREUsIGZkYy5kb3IpOwkvKiBhc3NlcnQgcmVzZXQsIGRtYSAmIGlycSBlbmFibGVkICovCisJLyogICAgICAgMHgwOCAgICAqLworCW91dGIoRkRDX0RNQV9NT0RFfEZEQ19SRVNFVF9OT1QsIGZkYy5kb3IpOwkvKiByZWxlYXNlIHJlc2V0ICovCisJLyogICAgICAgMHgwOCAgICB8ICAgMHgwNCAgID0gMHgwYyAqLworCW91dGIoRkRDX0RNQV9NT0RFfEZEQ19SRVNFVF9OT1R8RkRDX01PVE9SXzF8RlRBUEVfU0VMX0IsIGZkYy5kb3IpOworCS8qICAgICAgIDB4MDggICAgfCAgIDB4MDQgICAgICB8ICAweDIwICAgICB8ICAweDAxICA9IDB4MmQgKi8gICAgCisJLyogc2VsZWN0IGRyaXZlIDEgKi8gLyogd2h5IG5vdCBkcml2ZSAwID8/Pz8gKi8KKwlUUkFDRV9FWElUICh4ID09IDB4OTMpID8gMiA6IDE7Cit9CmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvZnRhcGUvbG93bGV2ZWwvZmMtMTAuaCBiL2RyaXZlcnMvY2hhci9mdGFwZS9sb3dsZXZlbC9mYy0xMC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmRhN2I4OG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X3Rfd2FybiwgIlxuIgorCQkgICAgIEtFUk5fSU5GTyAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4iCisJCSAgICAgS0VSTl9JTkZPICJ3YWtldXAgdHlwZSBtaXNtYXRjaDpcbiIKKwkJICAgICBLRVJOX0lORk8gImZvdW5kOiAlcywgZXhwZWN0ZWQ6ICVzXG4iCisJCSAgICAgS0VSTl9JTkZPICJwbGVhc2UgcmVwb3J0IHRoaXMgdG8gIlRIRV9GVEFQRV9NQUlOVEFJTkVSIlxuIgorCQkgICAgIEtFUk5fSU5GTyAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09IiwKKwkJCSAgICAgIG1ldGhvZHNbZnRfZHJpdmVfdHlwZS53YWtlX3VwXS5uYW1lLAorCQkJICAgICAgbWV0aG9kc1t2ZW5kb3JzW3ZlbmRvcl9pbmRleF0ud2FrZV91cF0ubmFtZSk7CisJCX0KKwl9CisJVFJBQ0VfRVhJVDsKK30KKwordm9pZCBmdGFwZV9jYWxjX3RpbWVvdXRzKHVuc2lnbmVkIGludCBxaWNfc3RkLAorCQkJIHVuc2lnbmVkIGludCBkYXRhX3JhdGUsCisJCQkgdW5zaWduZWQgaW50IHRhcGVfbGVuKQoreworCWludCBzcGVlZDsJCS8qIGRlY2ktaXBzICEgKi8KKwlpbnQgZmZfc3BlZWQ7CisJaW50IGxlbmd0aDsKKwlUUkFDRV9GVU4oZnRfdF9hbnkpOworCisJLyogICAgICAgICAgICAgICAgICAgICAgICAgICB0YXBlIHRyYW5zcG9ydCBzcGVlZAorCSAqICBkYXRhIHJhdGU6ICAgICAgICBRSUMtNDAgICBRSUMtODAgICBRSUMtMzAxMCBRSUMtMzAyMAorCSAqCisJICogICAgMjUwIEticHMgICAgICAgIDI1IGlwcyAgICAgbi9hICAgICAgbi9hICAgICAgbi9hCisJICogICAgNTAwIEticHMgICAgICAgIDUwIGlwcyAgIDM0IGlwcyAgIDIyLjYgaXB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fbGFzdF9kYXRhX3NlZ21lbnQpOworCVRSQUNFKGZ0X3Rfbm9pc2UsICJoZWFkZXIgc2VnbWVudHMgYXJlICVkIGFuZCAlZCIsCisJICAgICAgZnRfaGVhZGVyX3NlZ21lbnRfMSwgZnRfaGVhZGVyX3NlZ21lbnRfMik7CisKKwkvKiAgICBWZXJpZnkgdGFwZSBwYXJhbWV0ZXJzLi4uCisJICogICAgUUlDLTQwLzgwIHNwZWM6ICAgICAgICAgICAgICAgICB0YXBlX3BhcmFtZXRlcnM6CisJICoKKwkgKiAgICBzZWdtZW50cy1wZXItdHJhY2sgICAgICAgICAgICAgIHNlZ21lbnRzX3Blcl90cmFjaworCSAqICAgIHRyYWNrcy1wZXItY2FydHJpZGdlICAgICAgICAgICAgdHJhY2tzX3Blcl90YXBlCisJICogICAgbWF4LWZsb3BweS1zaWRlICAgICAgICAgICAgICAgICAoc2VnbWVudHNfcGVyX3RyYWNrICoKKwkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrc19wZXJfdGFwZSAtIDEpIC8KKwkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ0YXBlX3NlZ21lbnRzX3Blcl9oZWFkCisJICogICAgbWF4LWZsb3BweS10cmFjayAgICAgICAgICAgICAgICBmdGFwZV9zZWdtZW50c19wZXJfaGVhZCAvCisJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdGFwZV9zZWdtZW50c19wZXJfY3lsaW5kZXIgLSAxCisJICogICAgbWF4LWZsb3BweS1zZWN0b3IgICAgICAgICAgICAgICBmdGFwZV9zZWdtZW50c19wZXJfY3lsaW5kZXIgKgorCSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRlRfU0VDVE9SU19QRVJfU0VHTUVOVAorCSAqLworCWZ0X3NlZ21lbnRzX3Blcl90cmFjayA9IEdFVDIoYWRkcmVzcywgRlRfU1BUKTsKKwlmdF90cmFja3NfcGVyX3R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HRvCisgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbiwgNjc1IE1hc3MgQXZlLCBDYW1icmlkZ2UsIE1BIDAyMTM5LCBVU0EuCisKKyAqCisgKiAkU291cmNlOiAvaG9tZXMvY3ZzL2Z0YXBlLXN0YWNrZWQvZnRhcGUvbG93bGV2ZWwvZnRhcGUtdHJhY2luZy5jLHYgJAorICogJFJldmlzaW9uOiAxLjIgJAorICogJERhdGU6IDE5OTcvMTAvMDUgMTk6MTg6MjcgJAorICoKKyAqICAgICAgVGhpcyBmaWxlIGNvbnRhaW5zIHRoZSByZWFkaW5nIGNvZGUKKyAqICAgICAgZm9yIHRoZSBRSUMtMTE3IGZsb3BweS10YXBlIGRyaXZlciBmb3IgTGludXguCisgKi8KKworI2luY2x1ZGUgPGxpbnV4L2Z0YXBlLmg+CisjaW5jbHVkZSAiLi4vbG93bGV2ZWwvZnRhcGUtdHJhY2luZy5oIgorCisvKiAgICAgIEdsb2JhbCB2YXJzLgorICovCisvKiAgICAgIHRyYWNpbmcKKyAqICAgICAgc2V0IGl0IHRvOiAgICAgdG8gbG9nIDoKKyAqICAgICAgIDAgICAgICAgICAgICAgIGJ1Z3MKKyAqICAgICAgIDEgICAgICAgICAgICAgICsgZXJyb3JzCisgKiAgICAgICAyICAgICAgICAgICAgICArIHdhcm5pbmdzCisgKiAgICAgICAzICAgICAgICAgICAgICArIGluZm9ybWF0aW9uCisgKiAgICAgICA0ICAgICAgICAgICAgICArIG1vcmUgaW5mb3JtYXRpb24KKyAqICAgICAgIDUgICAgICAgICAgICAgICsgcHJvZ3JhbSBmbG93CisgKiAgICAgICA2ICAgICAgICAgICAgICArIGZkYy9kbWEgaW5mbworICogICAgICAgNyAgICAgICAgICAgICAgKyBkYXRhIGZsb3cKKyAqICAgICAgIDggICAgICAgICAgICAgICsgZXZlcnl0aGluZyBlbHNlCisgKi8KK2Z0X3RyYWNlX3QgZnRhcGVfdHJhY2luZyA9IGZ0X3RfaW5mbzsgLyogR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Ck7CisJZnRhcGVfc2V0X3N0YXRlKGlkbGUpOworCVRSQUNFX0VYSVQ7Cit9CisKK2ludCB6ZnRfZGVmX2lkbGVfc3RhdGUodm9pZCkKK3sgCisJaW50IHJlc3VsdCA9IDA7CisJVFJBQ0VfRlVOKGZ0X3RfZmxvdyk7CisJCisJaWYgKCF6ZnRfaGVhZGVyX3JlYWQpIHsKKwkJcmVzdWx0ID0gemZ0X3JlYWRfaGVhZGVyX3NlZ21lbnRzKCk7CisJfSBlbHNlIGlmICgocmVzdWx0ID0gemZ0X2ZsdXNoX2J1ZmZlcnMoKSkgPj0gMCAmJiB6ZnRfcWljX21vZGUpIHsKKwkJLyogIGRvbid0IG1vdmUgcGFzdCBlb2YKKwkJICovCisJCSh2b2lkKXpmdF9jbG9zZV92b2x1bWUoJnpmdF9wb3MpOworCX0KKwlpZiAoZnRhcGVfYWJvcnRfb3BlcmF0aW9uKCkgPCAwKSB7CisJCVRSQUNFKGZ0X3Rfd2FybiwgImZ0YXBlX2Fib3J0X29wZXJhdGlvbigpIGZhaWxlZCIpOworCQlyZXN1bHQgPSAtRUlPOworCX0KKwkvKiBjbGVhciByZW1haW5pbmcgcmVhZCBidWZmZXJzICovCisJemZ0X3phcF9yZWFkX2J1ZmZlcnMoKTsKKwl6ZnRfaW9fc3RhdGUgPSB6ZnRfaWRsZTsKKwlUUkFDRV9FWElUIHJlc3VsdDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAqICBmdW5jdGlvbnMgZm9yIHRoZSBNVElPQ1RPUCBjb21tYW5kcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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ICAgICAgICBwcmV2aW91c2x5IGlzc3VlZCAoYHNvZnQgZWplY3QnKQorICogICsgZnRfZm9ybWF0dGVkID09IDAgICAgICAgIC0tIHRoaXMgbWVhbnMgdGhhdCB0aGUgY2FydHJpZGdlIGlzIG5vdAorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1hdHRlZAorICogIFRoZW4gd2UgZGlzdGludWd1aXNoIHR3byBjYXNlcy4gV2hlbiB6ZnRfcWljX21vZGUgaXMgVFJVRSwgdGhlbiB3ZSB0cnkKKyAqICB0byBlbXVsYXRlIGEgYHRyYWRpdGlvbmFsJyAoYWthIFNDU0kgbGlrZSkgVU4qWCB0YXBlIGRldmljZS4gVGhlcmVmb3JlIHdlCisgKiAgZGVueSB3cml0ZXMgd2hlbgorICogICsgemZ0X3FpY19tb2RlID09MSAmJiAKKyAqICAgICAgICghemZ0X3RhcGVfYXRfbGJvdCgpICYmICAgLS0gdGFwZSBubyBhdCBsb2dpY2FsIEJPVAorICogICAgICAgICEoemZ0X3RhcGVfYXRfZW9tKCkgfHwgICAtLSB0YXBlIG5vdCBhdCBsb2dpY2FsIEVPTSAob3IgRU9EKQorICogICAgICAgICAgKHpmdF90YXBlX2F0X2VvbSgpICYmCisgKiAgICAgICAgICAgemZ0X29sZF9mdGFwZSgpKSkpICAgIC0tIHdlIGNhbid0IGFkZCBuZXcgdm9sdW1lIHRvIHRhcGVzIAorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0dGVuIGJ5IG9sZCBmdGFwZSBiZWNhdXNlIGZ0YXBlCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbid0IHVzZSB0aGUgdm9sdW1lIHRhYmxlCisgKgorICogIHdoZW4gdGhlIGRyaXZlIGlzIGluIHRydWUgcmF3IG1vZGUgKGFrYSAvZGV2L3Jhd2Z0MCkgdGhlbiB3ZSBkb24ndCAKKyAqICBjYXJlIGFib3V0IExCT1QgYW5kIEVPTSB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vZGU7CisJaW50ICAgICAgICAgIGNvdW50OworCXVuc2lnbmVkIGludCBzdGFydF9zZWc7ICAgICAgICAgLyogMzIgYml0cyBhcmUgZW5vdWdoIGZvciBub3cgKi8KKwl1bnNpZ25lZCBpbnQgZW5kX3NlZzsgICAgICAgICAgIC8qIDMyIGJpdHMgYXJlIGVub3VnaCBmb3Igbm93ICovCisJX19zNjQgICAgICAgIHNpemU7ICAgICAgICAgICAgICAvKiB1bmNvbXByZXNzZWQgc2l6ZSAqLworICAgICAgICB1bnNpZ25lZCBpbnQgYmxrX3N6OyAgICAgICAgICAgIC8qIGJsb2NrIHNpemUgZm9yIHRoaXMgdm9sdW1lICovCisJdW5zaWduZWQgaW50IHpmdF92b2x1bWUgICAgIDoxOyAvKiB6ZnRhcGUgY3JlYXRlZCB0aGlzIHZvbHVtZSAqLworCXVuc2lnbmVkIGludCB1c2VfY29tcHJlc3Npb246MTsgLyogY29tcHJlc3NlZCB2b2x1bWUgICovCisJdW5zaWduZWQgaW50IHFpYzExMyAgICAgICAgIDoxOyAvKiBsYXlvdXQgb2YgY29tcHJlc3NlZCBibG9jaworCQkJCQkgKiBpbmZvIGFuZCB2dGJsIGNvbmZvcm1zIHRvCisJCQkJCSAqIFFJQy0xMTMsIFJldi4gRyAKKwkJCQkJICovCisJdW5zaWduZWQgaW50IG5ld192b2x1bWUgICAgIDoxOyAvKiBpdCB3YXMgY3JlYXRlZCBieSB1cywgdGhpcworCQkJCQkgKiBydW4uICB0aGlzIGFsbG93cyB0aGUKKwkJCQkJICogZmllbGRzIHRoYXQgYXJlbid0IHJlYWxseQorCQkJCQkgKiB1c2VkIGJ5IHpmdGFwZSB0byBiZSBmaWxsZWQKKwkJCQkJICogaW4gYnkgc29tZSB1c2VyIGxldmVsCisJCQkJCSAqIHByb2dyYW0uCisJCQkJCSAqLworCXVuc2lnbmVkIGludCBvcGVuICAgICAgICAgICA6MTsgLyoganVzdCBpbiBwcm9ncmVzcyBvZiBiZWluZyAKKwkJCQk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2NrIHNpemUgICA6ICVkXG4iCQkJCVwKKwkgICAgICBLRVJOX0lORk8gImNvbXByZXNzaW9uICA6ICVkXG4iCQkJCVwKKwkgICAgICBLRVJOX0lORk8gInpmdGFwZSB2b2x1bWU6ICVkXG4iCQkJCVwKKwkgICAgICBLRVJOX0lORk8gIlFJQy0xMTMgY29uZi46ICVkIiwJCQkJXAorCSAgICAgIChpbmZvKS0+Y291bnQsIHRtcCwgKGluZm8pLT5zdGFydF9zZWcsIChpbmZvKS0+ZW5kX3NlZywJXAorCSAgICAgIExMKChpbmZvKS0+c2l6ZSksIChpbmZvKS0+YmxrX3N6LAkJCQlcCisJICAgICAgKGluZm8pLT51c2VfY29tcHJlc3Npb24gIT0gMCwgKGluZm8pLT56ZnRfdm9sdW1lICE9IDAsCVwKKwkgICAgICAoaW5mbyktPnFpYzExMyAhPSAwKTsJCQkJCVwKK30KKworZXh0ZXJuIGludCB6ZnRfcWljX21vZGU7CitleHRlcm4gaW50IHpmdF9vbGRfZnRhcGU7CitleHRlcm4gaW50IHpmdF92b2x1bWVfdGFibGVfY2hhbmdlZDsKKworLyogZXhwb3J0ZWQgZnVuY3Rpb25zICovCitleHRlcm4gdm9pZCAgemZ0X2luaXRfdnRibCAgICAgICAgICAgICAodm9pZCk7CitleHRlcm4gdm9pZCAgemZ0X2ZyZWVfdnRibCAgICAgICAgICAgICAodm9pZCk7CitleHRlcm4gaW50ICAgemZ0X2V4dHJhY3Rfdm9sdW1lX2hlYWRlcnMoX191OCAqYnVmZmVyKTsKK2V4dGVybiBpbnQgICB6ZnRfdXBkYXRlX3ZvbHVtZV90YWJsZSAgICh1bnNpZ25lZCBpbnQgc2VnbWVudCk7CitleHRlcm4gaW50ICAgemZ0X29wZW5fdm9sdW1lICAgICAgICAgICAoemZ0X3Bvc2l0aW9uICpwb3MsCisJCQkJCWludCBibGtfc3osIGludCB1c2VfY29tcHJlc3Npb24pOworZXh0ZXJuIGludCAgIHpmdF9jbG9zZV92b2x1bWUgICAgIC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hlY2sgdGltZXIgJXMgKHRpY2sgaXMgJWQgc2Vjb25kcywgbWFyZ2luIGlzICVkIHNlY29uZHMpLlxuIiwKKwkgICAgICAgVkVSU0lPTl9TVFIsIGhhbmdjaGVja190aWNrLCBoYW5nY2hlY2tfbWFyZ2luKTsKKworCWhhbmdjaGVja190c2NfbWFyZ2luID0gaGFuZ2NoZWNrX21hcmdpbiArIGhhbmdjaGVja190aWNrOworCWhhbmdjaGVja190c2NfbWFyZ2luICo9IDEwMDAwMDAwMDA7CisKKworCWhhbmdjaGVja190c2MgPSBtb25vdG9uaWNfY2xvY2soKTsKKwltb2RfdGltZXIoJmhhbmdjaGVja190aWNrdG9jaywgamlmZmllcyArIChoYW5nY2hlY2tfdGljaypIWikpOworCisJcmV0dXJuIDA7Cit9CisKKworc3RhdGljIHZvaWQgX19leGl0IGhhbmdjaGVja19leGl0KHZvaWQpCit7CisJZGVsX3RpbWVyX3N5bmMoJmhhbmdjaGVja190aWNrdG9jayk7Cit9CisKK21vZHVsZV9pbml0KGhhbmdjaGVja19pbml0KTsKK21vZHVsZV9leGl0KGhhbmdjaGVja19leGl0KTsKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9ocGV0LmMgYi9kcml2ZXJzL2NoYXIvaHBldC5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjVlYzczMmUKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvaHBldC5jCkBAIC0wLDAgKzEsOTk0IEBACisvKgorICogSW50ZWwgJiBNUyBIaWdoIFByZWNpc2lvbiBFdmVudCBUaW1lciBJbXBsZW1lbnRhdGlvbi4KKyAqCisgKiBDb3B5cmlnaHQgKEMpIDIwMDMgSW50ZWwgQ29ycG9yYXRpb24KKyAqCVZlbmtpIFBhbGxpcGFkaQorICogKGMpIENvcHlyaWdodCAyMDA0IEhld2xldHQtUGFja2FyZCBEZXZlbG9wbWVudCBDb21wYW55LCBMLlAuCisgK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NZOworfQorCitzdGF0aWMgaW5saW5lIGludCBocGV0X3RwY2hlY2soc3RydWN0IGhwZXRfdGFzayAqdHApCit7CisJc3RydWN0IGhwZXRfZGV2ICpkZXZwOworCXN0cnVjdCBocGV0cyAqaHBldHA7CisKKwlkZXZwID0gdHAtPmh0X29wYXF1ZTsKKworCWlmICghZGV2cCkKKwkJcmV0dXJuIC1FTlhJTzsKKworCWZvciAoaHBldHAgPSBocGV0czsgaHBldHA7IGhwZXRwID0gaHBldHAtPmhwX25leHQpCisJCWlmIChkZXZwID49IGhwZXRwLT5ocF9kZXYKKwkJICAgICYmIGRldnAgPCAoaHBldHAtPmhwX2RldiArIGhwZXRwLT5ocF9udGltZXIpCisJCSAgICAmJiBkZXZwLT5oZF9ocGV0ID09IGhwZXRwLT5ocF9ocGV0KQorCQkJcmV0dXJuIDA7CisKKwlyZXR1cm4gLUVOWElPOworfQorCitpbnQgaHBldF91bnJlZ2lzdGVyKHN0cnVjdCBocGV0X3Rhc2sgKnRwKQoreworCXN0cnVjdCBocGV0X2RldiAqZGV2cDsKKwlzdHJ1Y3QgaHBldF90aW1lciBfX2lvbWVtICp0aW1lcjsKKwlpbnQgZXJyOworCisJaWYgKChlcnIgPSBocGV0X3RwY2hlY2sodHApKSkKKwkJcmV0dXJuIGVycjsKKworCXNwaW5fbG9ja19pcnEoJmhwZXRfdGFza19sb2NrKTsKKwlzcGluX2xvY2soJmhwZXRfbG9jayk7CisKKwlkZXZwID0gdHAtPmh0X29wYXF1ZTsKKwlpZiAoZGV2cC0+aGRfdGFzayAhPSB0cCkgeworCQlzcGluX3VubG9jaygmaHBldF9sb2NrKTsKKwkJc3Bpbl91bmxvY2tfaXJxKCZocGV0X3Rhc2tfbG9jayk7CisJCXJldHVybiAtRU5YSU87CisJfQorCisJdGltZXIgPSBkZXZwLT5oZF90aW1lcjsKKwl3cml0ZXEoKHJlYWRxKCZ0aW1lci0+aHBldF9jb25maWcpICYgflRuX0lOVF9FTkJfQ05GX01BU0spLAorCSAgICAgICAmdGltZXItPmhwZXRfY29uZmlnKTsKKwlkZXZwLT5oZF9mbGFncyAmPSB+KEhQRVRfSUUgfCBIUEVUX1BFUklPRElDKTsKKwlkZXZwLT5oZF90YXNrID0gTlVMTDsKKwlzcGluX3VubG9jaygmaHBldF9sb2NrKTsKKwlzcGluX3VubG9ja19pcnEoJmhwZXRfdGFza19sb2NrKTsKKworCXJldHVybiAwOworfQorCitpbnQgaHBldF9jb250cm9sKHN0cnVjdCBocGV0X3Rhc2sgKnRwLCB1bnNpZ25lZCBpbnQgY21kLCB1bnNpZ25lZCBsb25nIGFyZykKK3sKKwlzdHJ1Y3QgaHBldF9kZXYgKmRldnA7CisJaW50IGVycjsKKworCWlmICgoZXJyID0gaHBldF90cGNoZWNrKHRwKSkpCisJCXJldHVybiBlcnI7CisKKwlzcGluX2xvY2tfaXJxKCZocGV0X2xvY2spOworCWRldnAgPSB0cC0+aHRfb3BhcXVlOworCWlmIChkZXZwLT5oZF90YXNrICE9IHRwKSB7CisJCXNwaW5fdW5sb2NrX2lycSgmaHBldF9sb2NrKTsKKwkJcmV0dXJuIC1FTlhJTzsKKwl9CisJc3Bpbl91bmxvY2tfaXJxKCZocGV0X2xvY2spOworCXJldHVybiBocGV0X2lvY3RsX2NvbW1vbihkZXZwLCBjbWQsIGFyZywgMSk7Cit9CisKK3N0YXRpYyBjdGxfdGFibGUgaHBldF90YWJsZVtdID0geworCXsKKwkgLmN0bF9uYW1lID0gMSwKKwkgLnByb2NuYW1lID0gIm1heC11c2VyLWZyZXEiLAorCSAuZGF0YSA9ICZocGV0X21heF9mcmVxLAorCSAubWF4bGVuID0gc2l6ZW9mKGludCksCisJIC5tb2RlID0gMDY0NCwKKwkgLnByb2NfaGFuZGxlciA9ICZwcm9jX2RvaW50dmVjLAorCSB9LAorCXsuY3RsX25hbWUgPSAwfQorfTsKKworc3RhdGljIGN0bF90YWJsZSBocGV0X3Jvb3RbXSA9IHsKKwl7CisJIC5jdGxfbmFtZSA9I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0aWMgaW5saW5lIGludCBpc19oZWFkZXIoY29uc3QgdWludDhfdCAqcGFja2V0KQoreworCXN0cnVjdCBodnNpX2hlYWRlciAqaGVhZGVyID0gKHN0cnVjdCBodnNpX2hlYWRlciAqKXBhY2tldDsKKwlyZXR1cm4gaGVhZGVyLT50eXBlID49IFZTX1FVRVJZX1JFU1BPTlNFX1BBQ0tFVF9IRUFERVI7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50IGdvdF9wYWNrZXQoY29uc3Qgc3RydWN0IGh2c2lfc3RydWN0ICpocCwgdWludDhfdCAqcGFja2V0KQoreworCWlmIChocC0+aW5idWZfZW5kIDwgcGFja2V0ICsgc2l6ZW9mKHN0cnVjdCBodnNpX2hlYWRlcikpCisJCXJldHVybiAwOyAvKiBkb24ndCBldmVuIGhhdmUgdGhlIHBhY2tldCBoZWFkZXIgKi8KKworCWlmIChocC0+aW5idWZfZW5kIDwgKHBhY2tldCArIGxlbl9wYWNrZXQocGFja2V0KSkpCisJCXJldHVybiAwOyAvKiBkb24ndCBoYXZlIHRoZSByZXN0IG9mIHRoZSBwYWNrZXQgKi8KKworCXJldHVybiAxOworfQorCisvKiBzaGlmdCByZW1haW5pbmcgYnl0ZXMgaW4gcGFja2V0YnVmIGRvd24gKi8KK3N0YXRpYyB2b2lkIGNvbXBhY3RfaW5idWYoc3RydWN0IGh2c2lfc3RydWN0ICpocCwgdWludDhfdCAqcmVhZF90bykKK3sKKwlpbnQgcmVtYWluaW5nID0gKGludCkoaHAtPmluYnVmX2VuZCAtIHJlYWRfdG8pOworCisJcHJfZGVidWcoIiVzOiAlaSBjaGFycyByZW1haW5cbiIsIF9fRlVOQ1RJT05fXywgcmVtYWluaW5nKTsKKworCWlmIChyZWFkX3RvICE9IGhwLT5pbmJ1ZikKKwkJbWVtbW92ZShocC0+aW5idWYsIHJlYWRfdG8sIHJlbWFpbmluZyk7CisKKwlocC0+aW5idWZfZW5kID0gaHAtPmluYnVmICsgcmVtYWluaW5nOworfQorC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5HLCBhYm9ydGluZ1xuIik7CisJCXJjID0gLUVJTzsKKwkJZ290byBlcnJfb3V0X2ZyZWVfbWFwOworCX0KKworCURQUklOVEsgKCJFWElULCByZXR1cm5pbmcgMFxuIik7CisJcmV0dXJuIDA7CisKK2Vycl9vdXRfZnJlZV9tYXA6CisJaW91bm1hcCAocm5nX21lbSk7CisJcm5nX21lbSA9IE5VTEw7CitlcnJfb3V0OgorCURQUklOVEsgKCJFWElULCByZXR1cm5pbmcgJWRcbiIsIHJjKTsKKwlyZXR1cm4gcmM7Cit9CisKK3N0YXRpYyB2b2lkIGludGVsX2NsZWFudXAodm9pZCkKK3sKKwl1OCBod19zdGF0dXM7CisKKwlod19zdGF0dXMgPSBpbnRlbF9od3N0YXR1cyAoKTsKKwlpZiAoaHdfc3RhdHVzICYgSU5URUxfUk5HX0VOQUJMRUQpCisJCWludGVsX2h3c3RhdHVzX3NldCAoaHdfc3RhdHVzICYgfklOVEVMX1JOR19FTkFCTEVEKTsKKwllbHNlCisJCXByaW50ayhLRVJOX1dBUk5JTkcgUEZYICJ1bnVzdWFsOiBSTkcgYWxyZWFkeSBkaXNhYmxlZFxuIik7CisJaW91bm1hcChybmdfbWVtKTsKKwlybmdfbWVtID0gTlVMTDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKgorICogQU1EIFJORyBvcGVyYXRpb25zCisgKgorICovCisKK3N0YXRpYyB1MzIgcG1iYXNlOwkJCS8qIFBNeHggSS9PIGJhc2UgKi8KK3N0YXRpYyBzdHJ1Y3QgcGNpX2RldiAqYW1kX2RldjsKKworc3RhdGljIHVuc2lnbmVkIGludCBhbWRfZGF0YV9wcmVzZW50ICh2b2lkKQoreworICAgICAgCXJldHVybiBpbmwocG1iYXNlICsgMHhGNCkgJiAxOworfQorCisKK3N0YXRpYyB1MzIgYW1kX2RhdGFfcmVhZCAodm9pZCkKK3sKKwlyZXR1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ZWVkZWQgKi8KKwlyZG1zcihNU1JfVklBX1JORywgbG8sIGhpKTsKKwlpZiAoKGxvICYgVklBX1JOR19FTkFCTEUpID09IDApIHsKKwkJcHJpbnRrKEtFUk5fRVJSIFBGWCAiY2Fubm90IGVuYWJsZSBWSUEgQzMgUk5HLCBhYm9ydGluZ1xuIik7CisJCXJldHVybiAtRU5PREVWOworCX0KKworCXJldHVybiAwOworfQorCitzdGF0aWMgdm9pZCB2aWFfY2xlYW51cCh2b2lkKQoreworCS8qIGRvIG5vdGhpbmcgKi8KK30KKyNlbmRpZgorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoKKyAqIC9kZXYvaHdyYW5kb20gY2hhcmFjdGVyIGRldmljZSBoYW5kbGluZyAobWFqb3IgMTAsIG1pbm9yIDE4MykKKyAqCisgKi8KKworc3RhdGljIGludCBybmdfZGV2X29wZW4gKHN0cnVjdCBpbm9kZSAqaW5vZGUsIHN0cnVjdCBmaWxlICpmaWxwKQoreworCS8qIGVuZm9yY2UgcmVhZC1vbmx5IGFjY2VzcyB0byB0aGlzIGNocmRldiAqLworCWlmICgoZmlscC0+Zl9tb2RlICYgRk1PREVfUkVBRCkgPT0gMCkKKwkJcmV0dXJuIC1FSU5WQUw7CisJaWYgKGZpbHAtPmZfbW9kZSAmIEZNT0RFX1dSSVRFKQorCQlyZXR1cm4gLUVJTlZBTDsKKworCXJldHVybiAwOworfQorCisKK3N0YXRpYyBzc2l6ZV90IHJuZ19kZXZfcmVhZCAoc3RydWN0IGZpbGUgKmZpbHAsIGNoYXIgX191c2VyICpidWYsIHNpemVfdCBzaXplLAorCQkJCWxvZmZfdCAqIG9mZnApCit7CisJc3RhdGljIERFRklORV9TUElOTE9DSyhybmdfbG9jayk7CisJdW5zaWduZWQgaW50IGhhdmVfZGF0YTsKKwl1MzIgZGF0YSA9IDA7CisJc3NpemVfdCByZXQgPSAwOworCisJd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worCisJRFBSSU5USyAoIkVOVEVSXG4iKTsKKworCWFzc2VydChybmdfb3BzICE9IE5VTEwpOworCisJcmMgPSBybmdfb3BzLT5pbml0KGRldik7CisJaWYgKHJjKQorCQlnb3RvIGVycl9vdXQ7CisKKwlyYyA9IG1pc2NfcmVnaXN0ZXIgKCZybmdfbWlzY2Rldik7CisJaWYgKHJjKSB7CisJCXByaW50ayAoS0VSTl9FUlIgUEZYICJtaXNjIGRldmljZSByZWdpc3RlciBmYWlsZWRcbiIpOworCQlnb3RvIGVycl9vdXRfY2xlYW51cF9odzsKKwl9CisKKwlEUFJJTlRLICgiRVhJVCwgcmV0dXJuaW5nIDBcbiIpOworCXJldHVybiAwOworCitlcnJfb3V0X2NsZWFudXBfaHc6CisJcm5nX29wcy0+Y2xlYW51cCgpOworZXJyX291dDoKKwlEUFJJTlRLICgiRVhJVCwgcmV0dXJuaW5nICVkXG4iLCByYyk7CisJcmV0dXJuIHJjOworfQorCisKKworTU9EVUxFX0FVVEhPUigiVGhlIExpbnV4IEtlcm5lbCB0ZWFtIik7CitNT0RVTEVfREVTQ1JJUFRJT04oIkgvVyBSYW5kb20gTnVtYmVyIEdlbmVyYXRvciAoUk5HKSBkcml2ZXIiKTsKK01PRFVMRV9MSUNFTlNFKCJHUEwiKTsKKworCisvKgorICogcm5nX2luaXQgLSBpbml0aWFsaXplIFJORyBtb2R1bGUKKyAqLworc3RhdGljIGludCBfX2luaXQgcm5nX2luaXQgKHZvaWQpCit7CisJaW50IHJjOworCXN0cnVjdCBwY2lfZGV2ICpwZGV2ID0gTlVMTDsKKwljb25zdCBzdHJ1Y3QgcGNpX2RldmljZV9pZCAqZW50OworCisJRFBSSU5USyAoIkVOVEVSXG4iKTsKKworCS8qIFByb2JlIGZvciBJbnRlbCwgQU1EIFJOR3MgKi8KKwlmb3JfZWFjaF9wY2lfZGV2KHBkZXYpIHsKKwkJZW50ID0gcGNpX21hdGNoX2RldmljZSAocm5nX3BjaV90YmwsIHBkZXYpOworCQ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mYpOworfQorCisvKgorICogUmVhZCB0aGUgZmFuIHNwZWVkIGluIFJQTS4KKyAqLworc3RhdGljIGludCBpOGtfZ2V0X2Zhbl9zcGVlZChpbnQgZmFuKQoreworICAgIFNNTVJlZ2lzdGVycyByZWdzID0geyAwLCAwLCAwLCAwLCAwLCAwIH07CisgICAgaW50IHJjOworCisgICAgcmVncy5lYXggPSBJOEtfU01NX0dFVF9TUEVFRDsKKyAgICByZWdzLmVieCA9IGZhbiAmIDB4ZmY7CisgICAgaWYgKChyYz1pOGtfc21tKCZyZWdzKSkgPCAwKSB7CisJcmV0dXJuIHJjOworICAgIH0KKworICAgIHJldHVybiAocmVncy5lYXggJiAweGZmZmYpICogSThLX0ZBTl9NVUxUOworfQorCisvKgorICogU2V0IHRoZSBmYW4gc3BlZWQgKG9mZiwgbG93LCBoaWdoKS4gUmV0dXJucyB0aGUgbmV3IGZhbiBzdGF0dXMuCisgKi8KK3N0YXRpYyBpbnQgaThrX3NldF9mYW4oaW50IGZhbiwgaW50IHNwZWVkKQoreworICAgIFNNTVJlZ2lzdGVycyByZWdzID0geyAwLCAwLCAwLCAwLCAwLCAwIH07CisgICAgaW50IHJjOworCisgICAgc3BlZWQgPSAoc3BlZWQgPCAwKSA/IDAgOiAoKHNwZWVkID4gSThLX0ZBTl9NQVgpID8gSThLX0ZBTl9NQVggOiBzcGVlZCk7CisKKyAgICByZWdzLmVheCA9IEk4S19TTU1fU0VUX0ZBTjsKKyAgICByZWdzLmVieCA9IChmYW4gJiAweGZmKSB8IChzcGVlZCA8PCA4KTsKKyAgICBpZiAoKHJjPWk4a19zbW0oJnJlZ3MpKSA8IDApIHsKKwlyZXR1cm4gcmM7CisgICAgfQorCisgICAgcmV0dXJuIChpOGtfZ2V0X2Zhbl9zdGF0dXMoZmFuKSk7Cit9CisKKy8qCisgKiBSZWFkIHRoZSBjcHUgdGVtcGVyYXR1cmUuCisgKi8KK3N0YXRpYyBpbnQgaThrX2dldF9jcHVfdGVtcCh2b2lkK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gMCwgMTI4KTsKKyAgICBpZiAobiA8PSAwKSB7CisJcmV0dXJuIG47CisgICAgfQorCisgICAgaWYgKCpmcG9zID49IG4pIHsKKwlyZXR1cm4gMDsKKyAgICB9CisKKyAgICBpZiAoKCpmcG9zICsgbGVuKSA+PSBuKSB7CisJbGVuID0gbiAtICpmcG9zOworICAgIH0KKworICAgIGlmIChjb3B5X3RvX3VzZXIoYnVmZmVyLCBpbmZvLCBsZW4pICE9IDApIHsKKwlyZXR1cm4gLUVGQVVMVDsKKyAgICB9CisKKyAgICAqZnBvcyArPSBsZW47CisgICAgcmV0dXJuIGxlbjsKK30KKworc3RhdGljIGNoYXIqIF9faW5pdCBzdHJpbmdfdHJpbShjaGFyICpzLCBpbnQgc2l6ZSkKK3sKKyAgICBpbnQgbGVuOworICAgIGNoYXIgKnA7CisKKyAgICBpZiAoKGxlbiA9IHN0cmxlbihzKSkgPiBzaXplKSB7CisJbGVuID0gc2l6ZTsKKyAgICB9CisKKyAgICBmb3IgKHA9cytsZW4tMTsgbGVuICYmICgqcD09JyAnKTsgbGVuLS0scC0tKSB7CisJKnAgPSAnXDAnOworICAgIH0KKworICAgIHJldHVybiBzOworfQorCisvKiBETUkgY29kZSwgc3RvbGVuIGZyb20gYXJjaC9pMzg2L2tlcm5lbC9kbWlfc2Nhbi5jICovCisKKy8qCisgKiB8PC0tIGRtaS0+bGVuZ3RoIC0tPnwKKyAqIHwgICAgICAgICAgICAgICAgICAgfAorICogfGRtaSBoZWFkZXIgICAgcz1OICB8IHN0cmluZzEsXDAsIC4uLiwgc3RyaW5nTixcMCwgLi4uLCBcMAorICogICAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgfAorICogICAgICAgICAgICAgICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworICovCitzdGF0aWMgY2hhciogX19pbml0IGRtaV9zdHJpbmcoRE1JSGVhZGVyICpkbWksIHU4IHMpCit7CisgICAgdTggKnA7CisKKyAgICBpZiAoIXM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KKyAgICB9CisKKyAgICBmb3IgKHA9c3VwcG9ydGVkX21vZGVsczsgOyBwKyspIHsKKwlpZiAoISpwKSB7CisJICAgIHByaW50ayhLRVJOX0lORk8gImk4azogdW5zdXBwb3J0ZWQgbW9kZWw6ICVzXG4iLCBwcm9kdWN0X25hbWUpOworCSAgICByZXR1cm4gLUVOT0RFVjsKKwl9CisJaWYgKHN0cm5jbXAocHJvZHVjdF9uYW1lLCpwLHN0cmxlbigqcCkpID09IDApIHsKKwkgICAgYnJlYWs7CisJfQorICAgIH0KKworICAgIHJldHVybiAwOworfQorCisvKgorICogUHJvYmUgZm9yIHRoZSBwcmVzZW5jZSBvZiBhIHN1cHBvcnRlZCBsYXB0b3AuCisgKi8KK3N0YXRpYyBpbnQgX19pbml0IGk4a19wcm9iZSh2b2lkKQoreworICAgIGNoYXIgYnVmZls0XTsKKyAgICBpbnQgdmVyc2lvbjsKKyAgICBpbnQgc21tX2ZvdW5kID0gMDsKKworICAgIC8qCisgICAgICogR2V0IERNSSBpbmZvcm1hdGlvbgorICAgICAqLworICAgIGlmIChpOGtfZG1pX3Byb2JlKCkgIT0gMCkgeworCXByaW50ayhLRVJOX0lORk8gImk4azogdmVuZG9yPSVzLCBtb2RlbD0lcywgdmVyc2lvbj0lc1xuIiwKKwkgICAgICAgc3lzdGVtX3ZlbmRvciwgcHJvZHVjdF9uYW1lLCBiaW9zX3ZlcnNpb24pOworICAgIH0KKworICAgIC8qCisgICAgICogR2V0IFNNTSBEZWxsIHNpZ25hdHVyZQorICAgICAqLworICAgIGlmIChpOGtfZ2V0X2RlbGxfc2lnbmF0dXJlKCkgIT0gMCkgeworCXByaW50ayhLRVJOX0lORk8gImk4azogdW5hYmxlIHRvIGdldCBTTU0gRGVsbCBzaWduYXR1cmVcbiIpOworICAgIH0gZWxzZSB7CisJc21tX2ZvdW5kID0gMTsKKyAgICB9CisKKyAgICAvKgorICAgICAqIEdldCBTTU0gQklPUyB2ZXJzaW9uLgorICAgICAqLworICAgIH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1cm4gaXAyX2xvYWRtYWluKGlvLGlycSwodW5zaWduZWQgY2hhciAqKWZpcF9maXJtLHNpemVvZihmaXBfZmlybSkpOworfQorbW9kdWxlX2luaXQoaXAyX2luaXQpOworCitNT0RVTEVfTElDRU5TRSgiR1BMIik7CisKKyNpZm5kZWYgTU9EVUxFCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKglpcDJfc2V0dXA6CisgKgkJc3RyOiBrZXJuZWwgY29tbWFuZCBsaW5lIHN0cmluZworICoKKyAqCUNhbid0IGF1dG9wcm9iZSB0aGUgYm9hcmRzIHNvIHVzZXIgbXVzdCBzcGVjaWZ5IGNvbmZpZ3VyYXRpb24gb24KKyAqCWtlcm5lbCBjb21tYW5kIGxpbmUuICBTYW5lIHBlb3BsZSBidWlsZCBpdCBtb2R1bGFyIGJ1dCB0aGUgb3RoZXJzCisgKgljb21lIGhlcmUuCisgKgorICoJQWx0ZXJuYXRpbmcgcGFpcnMgb2YgaW8saXJxIGZvciB1cCB0byA0IGJvYXJkcy4KKyAqCQlpcDI9aW8wLGlycTAsaW8xLGlycTEsaW8yLGlycTIsaW8zLGlycTMKKyAqCisgKgkJaW89MCA9PiBObyBib2FyZAorICoJCWlvPTEgPT4gUENJCisgKgkJaW89MiA9PiBFSVNBCisgKgkJZWxzZSA9PiBJU0EgSS9PIGFkZHJlc3MKKyAqCisgKgkJaXJxPTAgb3IgaW52YWxpZCBmb3IgSVNBIHdpbGwgcmV2ZXJ0IHRvIHBvbGxpbmcgbW9kZQorICoKKyAqCQlBbnkgdmFsdWUgPSAtMSwgZG8gbm90IG92ZXJ3cml0ZSBjb21waWxlZCBpbiB2YWx1ZS4KKyAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCBfX2luaXQgaXAyX3N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kLmMKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZmQyOTlkNgotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9pcDIvaTJjbWQuYwpAQCAtMCwwICsxLDIwOSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyogICAoYykgMTk5OCBieSBDb21wdXRvbmUgQ29ycG9yYXRpb24KKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqCisqICAgUEFDS0FHRTogICAgIExpbnV4IHR0eSBEZXZpY2UgRHJpdmVyIGZvciBJbnRlbGxpUG9ydCBmYW1pbHkgb2YgbXVsdGlwb3J0CisqICAgICAgICAgICAgICAgIHNlcmlhbCBJL08gY29udHJvbGxlcnMuCisqCisqICAgREVTQ1JJUFRJT046IERlZmluaXRpb24gdGFibGUgZm9yIEluLWxpbmUgYW5kIEJ5cGFzcyBjb21tYW5kcy4gQXBwbGljYWJsZQorKiAgICAgICAgICAgICAgICBvbmx5IHdoZW4gdGhlIHN0YW5kYXJkIGxvYWR3YXJlIGlzIGFjdGl2ZS4gKFRoaXMgaXMgaW5jbHVkZWQKKyogICAgICAgICAgICAgICAgc291cmNlIGNvZGUsIG5vdCBhIHNlcGFyYXRlIGNvbXBpbGF0aW9uIG1vZHVsZS4pCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorLy8KKy8vIFJldmlzaW9uIEhpc3Rvcnk6CisvLwor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gMHgwNiAgICAgICAgICAgICAgICAgICAgIH07IC8vIFNUQVJUIEZMCitzdGF0aWMgVUNIQVIgY3QwN1tdID0geyAyLCBCVEgsICAgICAweDA3LDAgICAgICAgICAgICAgICAgICAgfTsgLy8gQkFVRAorc3RhdGljIFVDSEFSIGN0MDhbXSA9IHsgMiwgQlRILCAgICAgMHgwOCwwICAgICAgICAgICAgICAgICAgIH07IC8vIEJJVFMKK3N0YXRpYyBVQ0hBUiBjdDA5W10gPSB7IDIsIEJUSCwgICAgIDB4MDksMCAgICAgICAgICAgICAgICAgICB9OyAvLyBTVE9QCitzdGF0aWMgVUNIQVIgY3QxMFtdID0geyAyLCBCVEgsICAgICAweDBBLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gUEFSSVRZCitzdGF0aWMgVUNIQVIgY3QxMVtdID0geyAyLCBCVEgsICAgICAweDBCLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gWE9OCitzdGF0aWMgVUNIQVIgY3QxMltdID0geyAyLCBCVEgsICAgICAweDBDLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gWE9GRgorc3RhdGljIFVDSEFSIGN0MTNbXSA9IHsgMSwgQlRILCAgICAgMHgwRCAgICAgICAgICAgICAgICAgICAgIH07IC8vIFNUT1AgRkwKK3N0YXRpYyBVQ0hBUiBjdDE0W10gPSB7IDEsIEJZUHxWSVAsIDB4MEUgICAgICAgICAgICAgICAgICAgICB9OyAvLyBBQ0sgSE9USworLy9zdGF0aWMgVUNIQVIgY3QxNVtdPXsgMiwgQlRIfFZJUCwgMHgwRiwwICAgICAgICAgICAgICAgICAgIH07IC8vIElSUSBTRVQKK3N0YXRpYyBVQ0hBUiBjdDE2W10gPSB7IDIsIElOTCwgICAgIDB4MTAsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBJWE9OT1BUUworc3RhdGljIFVDSEFSIGN0MTdbXSA9IHsgMiwgSU5MLCAgICAgMHgxMSwwICAgICAgICAgICAgICAgICAgIH07IC8vIE9YT05PUFRTCitzdGF0aWMgVUNIQVIgY3QxOFtdID0geyAxLCBJTkwsICAgICAweDEyICAgICAgICAgICAgICAgICAgICAgfTsgLy8gQ1RTRU5BQgorc3RhdGljIFVDSEFSIGN0MTlbXSA9IHsgMSwgQlRILCAgICAgMHgxMyAgICAgICAgICAgICAgICAgICAgIH07IC8vIENUU0RTQUIKK3N0YXRpYyBVQ0hBUiBjdDIwW10gPSB7IDEsIElOTCwgICAgIDB4MTQgICAgICAgICAgICAgICAgICAgICB9OyAvLyBEQ0RFTkFCCitzdGF0aWMgVUNIQVIgY3QyMVtdID0geyAxLCBCVEgsICAgICAweDE1ICAgICAgICAgICAgICAgICAgICAgfTsgLy8gRENERFNBQgorc3RhdGljIFVDSEFSIGN0MjJbXSA9IHsgMSwgQlRILCAgICAgMHgxNiAgICAgICAgICAgICAgICAgICAgIH07IC8vIERTUkVOQUIKK3N0YXRpYyBVQ0hBUiBjdDIzW10gPSB7IDEsIEJUSCwgICAgIDB4MTcgICAgICAgICAgICAgICAgICAgICB9OyAvLyBEU1JEU0FCCitzdGF0aWMgVUNIQVIgY3QyNFtdID0geyAxLCBCVEgsICAgICAweDE4ICAgICAgICAgICAgICAgICAgICAgfTsgLy8gUklFTkFCCitzdGF0aWMgVUNIQVIgY3QyNVtdID0geyAxLCBCVEgsICAgICAweDE5ICAgICAgICAgICAgICAgICAgICAgfTsgLy8gUklEU0FCCitzdGF0aWMgVUNIQVIgY3QyNltdID0geyAyLCBCVEgsICAgICAweDFBLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gQlJLRU5BQgorc3RhdGljIFVDSEFSIGN0MjdbXSA9IHsgMSwgQlRILCAgICAgMHgxQiAgICAgICAgICAgICAgICAgICAgIH07IC8vIEJSS0RTQUIKKy8vc3RhdGljIFVDSEFSIGN0MjhbXT17IDIsIEJUSCwgICAgIDB4MUMsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBNQVhCTE9LU0laRQorLy9zdGF0aWMgVUNIQVIgY3QyOVtdPXsgMiwgMCwgICAgICAgMHgxRCwwICAgICAgICAgICAgICAgICAgIH07IC8vIHJlc2VydmVkCitzdGF0aWMgVUNIQVIgY3QzMFtdID0geyAxLCBJTkwsICAgICAweDFFICAgICAgICAgICAgICAgICAgICAgfTsgLy8gQ1RTRkxPV0VOQUIKK3N0YXRpYyBVQ0hBUiBjdDMxW10gPSB7IDEsIElOTCwgICAgIDB4MUYgICAgICAgICAgICAgICAgICAgICB9OyAvLyBDVFNGTE9XRFNBQgorc3RhdGljIFVDSEFSIGN0MzJbXSA9IHsgMSwgSU5MLCAgICAgMHgyMCAgICAgICAgICAgICAgICAgICAgIH07IC8vIFJUU0ZMT1dFTkFCCitzdGF0aWMgVUNIQVIgY3QzM1tdID0geyAxLCBJTkwsICAgICAweDIxICAgICAgICAgICAgICAgICAgICAgfTsgLy8gUlRTRkxPV0RTQUIKK3N0YXRpYyBVQ0hBUiBjdDM0W10gPSB7IDIsIEJUSCwgICAgIDB4MjIsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBJU1RSSVBNT0RFCitzdGF0aWMgVUNIQVIgY3QzNVtdID0geyAyLCBCVEh8RU5ELCAweDIzLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gU0VOREJSRUFLCitzdGF0aWMgVUNIQVIgY3QzNltdID0geyAyLCBCVEgsICAgICAweDI0LDAgICAgICAgICAgICAgICAgICAgfTsgLy8gU0VURVJSTU9ERQorLy9zdGF0aWMgVUNIQVIgY3QzNmFbXT17IDMsIElOTCwgICAgMHgyNCwwLDAgICAgICAgICAgICAgICAgIH07IC8vIFNFVF9SRVBMQUNFCisKKy8vIFRoZSBmb2xsb3dpbmcgaXMgbGlzdGVkIGZvciBjb21wbGV0ZW5lc3MsIGJ1dCBzaG91bGQgbmV2ZXIgYmUgc2VudCBkaXJlY3RseQorLy8gYnkgdXNlci1sZXZlbCBjb2RlLiBJdCBpcyBzZW50IG9ubHkgYnkgbGlicmFyeSByb3V0aW5lcyBpbiByZXNwb25zZSB0byB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sIEJUSCwgICAgIDB4MkYsMCwwLDAsMCwwLDAgICAgICAgICB9OyAvLyBVTklYIEZMQUdTCisvL3N0YXRpYyBVQ0hBUiBjdDQ4W109eyAxLCBCVEgsICAgICAweDMwICAgICAgICAgICAgICAgICAgICAgfTsgLy8gRFNSRkxPV0VOQUIKKy8vc3RhdGljIFVDSEFSIGN0NDlbXT17IDEsIEJUSCwgICAgIDB4MzEgICAgICAgICAgICAgICAgICAgICB9OyAvLyBEU1JGTE9XRFNBQgorLy9zdGF0aWMgVUNIQVIgY3Q1MFtdPXsgMSwgQlRILCAgICAgMHgzMiAgICAgICAgICAgICAgICAgICAgIH07IC8vIERUUkZMT1dFTkFCCisvL3N0YXRpYyBVQ0hBUiBjdDUxW109eyAxLCBCVEgsICAgICAweDMzICAgICAgICAgICAgICAgICAgICAgfTsgLy8gRFRSRkxPV0RTQUIKKy8vc3RhdGljIFVDSEFSIGN0NTJbXT17IDEsIEJUSCwgICAgIDB4MzQgICAgICAgICAgICAgICAgICAgICB9OyAvLyBCQVVEVEFCUkVTRVQKKy8vc3RhdGljIFVDSEFSIGN0NTNbXSA9IHsgMywgQlRILCAgICAgMHgzNSwwLDAgICAgICAgICAgICAgICAgIH07IC8vIEJBVURSRU1BUAorc3RhdGljIFVDSEFSIGN0NTRbXSA9IHsgMywgQlRILCAgICAgMHgzNiwwLDAgICAgICAgICAgICAgICAgIH07IC8vIENVU1RPTUJBVUQxCitzdGF0aWMgVUNIQVIgY3Q1NVtdID0geyAzLCBCVEgsICAgICAweDM3LDAsMCAgICAgICAgICAgICAgICAgfTsgLy8gQ1VTVE9NQkFVRDIKK3N0YXRpYyBVQ0hBUiBjdDU2W10gPSB7IDIsIEJUSHxFTkQsIDB4MzgsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBQQVVTRQorc3RhdGljIFVDSEFSIGN0NTdbXSA9IHsgMSwgQllQLCAgICAgMHgzOSAgICAgICAgICAgICAgICAgICAgIH07IC8vIFNVU1BFTkQKK3N0YXRpYyBVQ0hBUiBjdDU4W10gPSB7IDEsIEJZUCwgICAgIDB4M0EgICAgICAgICAgICAgICAgICAgICB9OyAvLyBVTlNVU1BFTkQKK3N0YXRpYyBVQ0hBUiBjdDU5W10gPSB7IDIsIEJUSCwgICAgIDB4M0IsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBQQVJJVFlDSEsKK3N0YXRpYyBVQ0hBUiBjdDYwW10gPSB7IDEsIElOTHxWSVAsIDB4M0MgICAgICAgICAgICAgICAgICAgICB9OyAvLyBCT09LTUFSS1JFUQorLy9zdGF0aWMgVUNIQVIgY3Q2MVtdPXsgMiwgQlRILCAgICAgMHgzRCwwICAgICAgICAgICAgICAgICAgIH07IC8vIElOVEVSTkFMTE9PUAorLy9zdGF0aWMgVUNIQVIgY3Q2MltdPXsgMiwgQlRILCAgICAgMHgzRSwwICAgICAgICAgICAgICAgICAgIH07IC8vIEhPVEtUSU1FT1VUCitzdGF0aWMgVUNIQVIgY3Q2M1tdID0geyAyLCBJTkwsICAgICAweDNGLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gU0VUVFhPTgorc3RhdGljIFVDSEFSIGN0NjRbXSA9IHsgMiwgSU5MLCAgICAgMHg0MCwwICAgICAgICAgICAgICAgICAgIH07IC8vIFNFVFRYT0ZGCisvL3N0YXRpYyBVQ0hBUiBjdDY1W109eyAyLCBCVEgsICAgICAweDQxLDAgICAgICAgICAgICAgICAgICAgfTsgLy8gU0VUQVVUT1JUUworLy9zdGF0aWMgVUNIQVIgY3Q2NltdPXsgMiwgQlRILCAgICAgMHg0MiwwICAgICAgICAgICAgICAgICAgIH07IC8vIFNFVEhJR0hXQVQKKy8vc3RhdGljIFVDSEFSIGN0NjdbXT17IDIsIEJZUCwgICAgIDB4NDMsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBTVEFSVFNFTEZMCisvL3N0YXRpYyBVQ0hBUiBjdDY4W109eyAyLCBJTkwsICAgICAweDQ0LDAgICAgICAgICAgICAgICAgICAgfTsgLy8gRU5EU0VMRkwKKy8vc3RhdGljIFVDSEFSIGN0NjlbXT17IDEsIEJZUCwgICAgIDB4NDUgICAgICAgICAgICAgICAgICAgICB9OyAvLyBIV0ZMT1dfT0ZGCisvL3N0YXRpYyBVQ0hBUiBjdDcwW109eyAxLCBCVEgsICAgICAweDQ2ICAgICAgICAgICAgICAgICAgICAgfTsgLy8gT0RTUkZMX0VOQUIKKy8vc3RhdGljIFVDSEFSIGN0NzFbXT17IDEsIEJUSCwgICAgIDB4NDcgICAgICAgICAgICAgICAgICAgICB9OyAvLyBPRFNSRkxfRFNBQgorLy9zdGF0aWMgVUNIQVIgY3Q3MltdPXsgMSwgQlRILCAgICAgMHg0OCAgICAgICAgICAgICAgICAgICAgIH07IC8vIE9EQ0RGTF9FTkFCCisvL3N0YXRpYyBVQ0hBUiBjdDczW109eyAxLCBCVEgsICAgICAweDQ5ICAgICAgICAgICAgICAgICAgICAgfTsgLy8gT0RDREZMX0RTQUIKKy8vc3RhdGljIFVDSEFSIGN0NzRbXT17IDIsIEJUSCwgICAgIDB4NEEsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBMT0FETEVWRUwKKy8vc3RhdGljIFVDSEFSIGN0NzVbXT17IDIsIEJUSCwgICAgIDB4NEIsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBTVEFUREFUQQorLy9zdGF0aWMgVUNIQVIgY3Q3NltdPXsgMSwgQllQLCAgICAgMHg0QyAgICAgICAgICAgICAgICAgICAgIH07IC8vIEJSRUFLX09OCisvL3N0YXRpYyBVQ0hBUiBjdDc3W109eyAxLCBCWVAsICAgICAweDREICAgICAgICAgICAgICAgICAgICAgfTsgLy8gQlJFQUtfT0ZGCisvL3N0YXRpYyBVQ0hBUiBjdDc4W109eyAxLCBCWVAsICAgICAweDRFICAgICAgICAgICAgICAgICAgICAgfTsgLy8gR0VURkMKK3N0YXRpYyBVQ0hBUiBjdDc5W10gPSB7IDIsIEJZUCwgICAgIDB4NEYsMCAgICAgICAgICAgICAgICAgICB9OyAvLyBYTUlUX05PVworLy9zdGF0aWMgVUNIQVIgY3Q4MFtdPXsgNCwgQlRILCAgICAgMHg1MCwwLDAsMCAgICAgICAgICAgICAgIH07IC8vIERJVklTT1JfTEFUQ0gKKy8vc3RhdGljIFVDSEFSIGN0ODFbXT17IDEsIEJZUCwgICAgIDB4NTEgICAgICAgICAgICAgICAgICAgICB9OyAvLyBHRVRfU1RBVFVTCisvL3N0YXRpYyBVQ0hBUiBjdDgyW109eyAxLCBCWVAsICAgICAweDUyICAgICAgICAgICAgICAgICAgICAgfTsgLy8gR0VUX1RYQ05UCisvL3N0YXRpYyBVQ0hBUiBjdDgzW109eyAxLCBCWVAsICAgICAweDUzICAgICAgICAgICAgICAgICAgICAgfTsgLy8gR0VUX1JYQ05UCisvL3N0YXRpYyBVQ0hBUiBjdDg0W109eyAxLCBCWVAsICAgICAweDU0ICAgICAgICAgICAgICAgICAgICAgfTsgLy8gR0VUX0JPWElEUworLy9zdGF0aWMgVUNIQVIgY3Q4NVtdPXsxMCwgQllQLCAgICAgMHg1NSwwLDAsMCwwLDAsMCwwLDAsMCAgIH07IC8vIEVOQUJfTVVMVAorLy9zdGF0aWMgVUNIQVIgY3Q4NltdPXsgMiwgQlRILCAgICAgMHg1NiwwICAgICAgICAgICAgICAgICAgIH07IC8vIFJDVl9FTkFCTEUKK3N0YXRpYyBVQ0hBUiBjdDg3W10gPSB7IDEsIEJZUCwgICAgIDB4NTcgICAgICAgICAgICAgICAgICAgICB9OyAvLyBIV19URVNUCisvL3N0YXRpYyBVQ0hBUiBjdDg4W109eyAzLCBCVEgsICAgICAweDU4LDAsMCAgICAgICAgICAgICAgICAgfTsgLy8gUkNWX1RIUkVTSE9MRAorc3RhdGljIFVDSEFSIGN0ODlbXT17IDEsIEJZUCwgICAgIDB4NTkgICAgICAgICAgICAgICAgICAgICB9OyAvLyBEU1NfTk9XCisvL3N0YXRpYyBVQ0hBUiBjdDkwW109eyAzLCBCWVAsICAgICAweDVBLDAsMCAgICAgICAgICAgICAgICAgfTsgLy8gU2V0IFNJTE8KKy8vc3RhdGljIFVDSEFSIGN0OTFbXT17IDIsIEJZUCwgICAgIDB4NUIsMCAgICAgICAgICAgICAgICAgICB9OyAvLyB0aW1lZCBicmVhaworCisvLyBTb21lIGNvbXBvc2l0ZSBjb21tYW5kcyBhcyB3ZWxsCisvL3N0YXRpYyBVQ0hBUiBjYzAxW109eyAyLCBCVEgsICAgICAweDAyLDB4MDQgICAgICAgICAgICAgICAgfTsgLy8gRFRSICYgUlRTIFVQCisvL3N0YXRpYyBVQ0hBUiBjYzAyW109eyAyLCBCVEgsICAgICAweDAzLDB4MDUgICAgICAgICAgICAgICAgfTsgLy8gRFRSICYgUlRTIEROCisKKy8vKioqKioqKioKKy8vKiBDb2RlICoKKy8vKioqKioqKioKKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGkyY21kVW5peEZsYWdzKGlmbGFnLCBjZmxhZywgbGZsYWcpCisvLyBQYXJhbWV0ZXJzOiBVbml4IHR0eSBmbGFncworLy8KKy8vIFJldHVybnM6ICAgIFBvaW50ZXIgdG8gY29tbWFuZCBzdHJ1Y3R1cmUKKy8vCisvLyBEZXNjcmlwdGlvbjoKKy8vCisvLyBUaGlzIHJvdXRpbmUgc2V0cyB0aGUgcGFyYW1ldGVycyBvZiBjb21tYW5kIDQ3IGFuZCByZXR1cm5zIGEgcG9pbnRlciB0byB0aGUKKy8vIGFwcHJvcHJpYXRlIHN0cnVjdHVyZS4KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitjbWRTeW50YXhQdHIKK2kyY21kVW5peEZsYWdzKHVuc2lnbmVkIHNob3J0IGlmbGFnLHVuc2lnbmVkIHNob3J0IGNmbGFnLHVuc2lnbmVkIHNob3J0IGxmbGFnKQoreworCWNtZFN5bnRheFB0ciBwQ00gPSAoY21kU3ludGF4UHRyKSBjdDQ3OworCisJcENNLT5jbWRbMV0gPSAodW5zaWduZWQgY2hhcikgIGlmbGFnOworCXBDTS0+Y21kWzJdID0gKHVuc2lnbmVkIGNoYXIpIChpZmxhZyA+PiA4KTsKKwlwQ00tPmNtZFszXSA9ICh1bnNpZ25lZCBjaGFyKSAgY2ZsYWc7CisJcENNLT5jbWRbNF0gPSAodW5zaWduZWQgY2hhcikgKGNmbGFnID4+IDgpOworCXBDTS0+Y21kWzVdID0gKHVuc2lnbmVkIGNoYXIpICBsZmxhZzsKKwlwQ00tPmNtZFs2XSA9ICh1bnNpZ25lZCBjaGFyKSAobGZsYWcgPj4gOCk7CisJcmV0dXJuIHBDTTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGkyY21kQmF1ZERlZih3aGljaCwgcmF0ZSkKKy8vIFBhcmFtZXRlcnM6ID8KKy8vCisvLyBSZXR1cm5zOiAgICBQb2ludGVyIHRvIGNvbW1hbmQgc3RydWN0dXJlCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gVGhpcyByb3V0aW5lIHNldHMgdGhlIHBhcmFtZXRlcnMgb2YgY29tbWFuZHMgNTQgb3IgNTUgKGFjY29yZGluZyB0byB0aGUKKy8vIGFyZ3VtZW50IHdoaWNoKSwgYW5kIHJldHVybnMgYSBwb2ludGVyIHRvIHRoZSBhcHByb3ByaWF0ZSBzdHJ1Y3R1cmUuCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorY21kU3ludGF4UHRyCitpMmNtZEJhdWREZWYoaW50IHdoaWNoLCB1bnNpZ25lZCBzaG9ydCByYXRlKQoreworCWNtZFN5bnRheFB0ciBwQ007CisKKwlzd2l0Y2god2hpY2gpCisJeworCWNhc2UgMToKKwkJcENNID0gKGNtZFN5bnRheFB0cikgY3Q1NDsKKwkJYnJlYWs7CisJZGVmYXVsdDoKKwljYXNlIDI6CisJCXBDTSA9IChjbWRTeW50YXhQdHIpIGN0NTU7CisJCWJyZWFrOworCX0KKwlwQ00tPmNtZFsxXSA9ICh1bnNpZ25lZCBjaGFyKSByYXRlOworCXBDTS0+Y21kWzJdID0gKHVuc2lnbmVkIGNoYXIpIChyYXRlID4+IDgpOworCXJldHVybiBwQ007Cit9CisKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9pcDIvaTJjbWQuaCBiL2RyaXZlcnMvY2hhci9pcDIvaTJjbWQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jNDE3MjhhCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL2lwMi9pMmNtZC5oCkBAIC0wLDAgKzEsNjQzIEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKiAgIChjKSAxOTk5IGJ5IENvbXB1dG9uZSBDb3Jwb3JhdGlvbgorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyoKKyogICBQQUNLQUdFOiAgICAgTGludXggdHR5IERldmljZSBEcml2ZXIgZm9yIEludGVsbGlQb3J0IElJIGZhbWlseSBvZiBtdWx0aXBvcnQKKyogICAgICAgICAgICAgICAgc2VyaWFsIEkvTyBjb250cm9sbGVycy4KKyoKKyogICBERVNDUklQVElPTjogRGVmaW5pdGlvbnMgYW5kIHN1cHBvcnQgZm9yIEluLWxpbmUgYW5kIEJ5cGFzcyBjb21tYW5kcy4KKyogICAgICAgICAgICAgICAgQXBwbGlj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KGN0OTEpKS0+Y21kWzFdID0gKGRzKSwoY21kU3ludGF4UHRyKShjdDY2KSkKKworCisKKyNlbmRpZiAvLyBJMkNNRF9ICmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvaXAyL2kyZWxsaXMuYyBiL2RyaXZlcnMvY2hhci9pcDIvaTJlbGxpcy5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmY4MzRkMDUKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvaXAyL2kyZWxsaXMuYwpAQCAtMCwwICsxLDE0ODcgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqICAgKGMpIDE5OTggYnkgQ29tcHV0b25lIENvcnBvcmF0aW9uCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKgorKiAgIFBBQ0tBR0U6ICAgICBMaW51eCB0dHkgRGV2aWNlIERyaXZlciBmb3IgSW50ZWxsaVBvcnQgZmFtaWx5IG9mIG11bHRpcG9ydAorKiAgICAgICAgICAgICAgICBzZXJpYWwgSS9PIGNvbnRyb2xsZXJzLgorKgorKiAgIERFU0NSSVBUSU9OOiBMb3ctbGV2ZWwgaW50ZXJmYWNlIGNvZGUgZm9yIHRoZSBkZXZpY2UgZHJpdmVyCisqICAgICAgICAgICAgICAgIChUaGlzIGlzIGluY2x1ZGVkIHNvdXJjZSBjb2RlLCBub3QgYSBzZXBhcmF0ZSBjb21waWxhdGlvbgorKiAgICAgICAgICAgICAgICBtb2R1bGUuKQorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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bGVkLiBDbGVhcmVkIHdoZW4gQU5ZIGJvYXJkIGlzIHJlc2V0Lgorc3RhdGljIHN0cnVjdCB0aW1lcl9saXN0ICogcERlbGF5VGltZXI7ICAgLy8gVXNlZCBieSBpaURlbGF5VGltZXIKK3N0YXRpYyB3YWl0X3F1ZXVlX2hlYWRfdCBwRGVsYXlXYWl0OyAgICAvLyBVc2VkIGJ5IGlpRGVsYXlUaW1lcgorc3RhdGljIHJ3bG9ja190IERsX3NwaW5sb2NrOworCisvLyoqKioqKioqCisvLyogQ29kZSAqCisvLyoqKioqKioqCisKKy8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorLy8gSW5pdGlhbGl6YXRpb24gUm91dGluZXMKKy8vCisvLyBpaVNldEFkZHJlc3MKKy8vIGlpUmVzZXQKKy8vIGlpUmVzZXREZWxheQorLy8gaWlJbml0aWFsaXplCisvLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpRWxsaXNJbml0KCkKKy8vIFBhcmFtZXRlcnM6IE5vbmUKKy8vCisvLyBSZXR1cm5zOiAgICBOb3RoaW5nCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gVGhpcyByb3V0aW5lIHBlcmZvcm1zIGFueSByZXF1aXJlZCBpbml0aWFsaXphdGlvbiBvZiB0aGUgaWlFbGxpcyBzdWJzeXN0ZW0uCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB2b2lkCitpaUVsbGlzSW5pdCh2b2lkKQoreworCXBEZWxheVRpbWVyID0ga21hbGxvYyAoIHNpemVvZiAoc3RydWN0IHRpbWVyX2xpc3QpLCBHRlBfS0VSTkVMICk7CisJaW5pdF90aW1lcihwRGVsYXlUaW1lcik7CisJaW5pdF93YWl0cXVldWVfaGVhZCgmcERlbGF5V2FpdCk7CisJTE9DS19JTklUKCZEbF9zcGlubG9jayk7Cit9CisKKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisvLyBGdW5jdGlvbjogICBpaUVsbGlzQ2xlYW51cCgpCisvLyBQYXJhbWV0ZXJzOiBOb25lCisvLworLy8gUmV0dXJuczogICAgTm90aGluZworLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIFRoaXMgcm91dGluZSBwZXJmb3JtcyBhbnkgcmVxdWlyZWQgY2xlYW51cCBvZiB0aGUgaWlFbGxpcyBzdWJzeXN0ZW0uCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB2b2lkCitpaUVsbGlzQ2xlYW51cCh2b2lkKQoreworCWlmICggcERlbGF5VGltZXIgIT0gTlVMTCApIHsKKwkJa2ZyZWUgKCBwRGVsYXlUaW1lciApOworCX0KK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpU2V0QWRkcmVzcyhwQiwgYWRkcmVzcywgZGVsYXkpCisvLyBQYXJhbWV0ZXJzOiBwQiAgICAgIC0gcG9pbnRlciB0byB0aGUgYm9hcmQgc3RydWN0dXJlCisvLyAgICAgICAgICAgICBhZGRyZXNzIC0gdGhlIHB1cnBvcnRlZCBJL08gYWRkcmVzcyBvZiB0aGUgYm9hcmQKKy8vICAgICAgICAgICAgIGRlbGF5ICAgLSBwb2ludGVyIHRvIHRoZSAxLW1zI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yA8PSAweDEwMAorCQl8fCAodW5zaWduZWQgaW50KWFkZHJlc3MgPj0gMHhmZmY4CisJCXx8IChhZGRyZXNzICYgMHg3KQorCQkpCisJeworCQlDT01QTEVURShwQixJMkVFX0JBREFERFIpOworCX0KKworCS8vIEluaXRpYWxpemUgYWNjZWxlcmF0b3JzCisJcEItPmkyZUJhc2UgICAgPSBhZGRyZXNzOworCXBCLT5pMmVEYXRhICAgID0gYWRkcmVzcyArIEZJRk9fREFUQTsKKwlwQi0+aTJlU3RhdHVzICA9IGFkZHJlc3MgKyBGSUZPX1NUQVRVUzsKKwlwQi0+aTJlUG9pbnRlciA9IGFkZHJlc3MgKyBGSUZPX1BUUjsKKwlwQi0+aTJlWE1haWwgICA9IGFkZHJlc3MgKyBGSUZPX01BSUw7CisJcEItPmkyZVhNYXNrICAgPSBhZGRyZXNzICsgRklGT19NQVNLOworCisJLy8gSW5pdGlhbGl6ZSBpL28gYWRkcmVzcyBmb3IgaWkyRGVsYXlJTworCWlpMlNhZmUgPSBhZGRyZXNzICsgRklGT19OT1A7CisKKwkvLyBJbml0aWFsaXplIHRoZSBkZWxheSByb3V0aW5lCisJcEItPmkyZURlbGF5ID0gKChkZWxheSAhPSAoZGVsYXlGdW5jX3QpTlVMTCkgPyBkZWxheSA6IChkZWxheUZ1bmNfdClpaTJOb3ApOworCisJcEItPmkyZVZhbGlkID0gSTJFX01BR0lDOworCXBCLT5pMmVTdGF0ZSA9IElJX1NUQVRFX0NPTEQ7CisKKwlDT01QTEVURShwQiwgSTJFRV9HT09EKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpUmVzZXQocEIpCisvLyBQYXJhbWV0ZXJzOiBwQiAtIHBvaW50ZXIgdG8gdGhlIGJvYXJkIHN0cnVjdHVyZQorLy8KKy8vIFJldHVybnM6ICAgIFRydWUgaWY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cm5zOiAgICBUcnVlIGlmIGV2ZXJ5dGhpbmcgYXBwZWFycyBjb3BhY2V0aWMuCisvLyAgICAgICAgICAgICBGYWxzZSBpZiB0aGVyZSBpcyBhbnkgZXJyb3I6IHRoZSBwQi0+aTJlRXJyb3IgZmllbGQgaGFzIHRoZSBlcnJvcgorLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIFVzaW5nIHRoZSBkZWxheSBkZWZpbmVkIGluIGJvYXJkIHN0cnVjdHVyZSwgd2FpdHMgdHdvIHNlY29uZHMgKGZvciBib2FyZCB0bworLy8gcmVzZXQpLgorLy8KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitzdGF0aWMgaW50CitpaVJlc2V0RGVsYXkoaTJlQm9yZFN0clB0ciBwQikKK3sKKwlpZiAocEItPmkyZVZhbGlkICE9IEkyRV9NQUdJQykgeworCQlDT01QTEVURShwQiwgSTJFRV9CQURNQUdJQyk7CisJfQorCWlmIChwQi0+aTJlU3RhdGUgIT0gSUlfU1RBVEVfUkVTRVQpIHsKKwkJQ09NUExFVEUocEIsIEkyRUVfQkFEU1RBVEUpOworCX0KKwlpaURlbGF5KHBCLDIwMDApOyAgICAgICAvKiBOb3cgd2Ugd2FpdCBmb3IgdHdvIHNlY29uZHMuICovCisJaWlEZWxheWVkID0gMTsgICAgICAgICAgLyogRGVsYXkgaGFzIGJlZW4gY2FsbGVkOiBvayB0byBpbml0aWFsaXplICovCisJQ09NUExFVEUocEIsIEkyRUVfR09PRCk7Cit9CisKKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisvLyBGdW5jdGlvbjogICBpaUluaXRpYWxpemUocEIpCisvLyBQYXJhbWV0ZXJzOiBwQiAtIHBvaW50ZXIgdG8gdGhlIGJvYXJkIHN0cnVjdHVyZQorLy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TVBMRVRFKHBCLCBJMkVFX0dPT0QpOworfQorCisvLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKy8vIERlbGF5IFJvdXRpbmVzCisvLworLy8gaWlEZWxheUlPCisvLyBpaU5vcAorLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisKK3N0YXRpYyB2b2lkCitpaTJEZWxheVdha2V1cCh1bnNpZ25lZCBsb25nIGlkKQoreworCXdha2VfdXBfaW50ZXJydXB0aWJsZSAoICZwRGVsYXlXYWl0ICk7Cit9CisKKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisvLyBGdW5jdGlvbjogICBpaTJEZWxheVRpbWVyKG1zZWNvbmRzKQorLy8gUGFyYW1ldGVyczogbXNlY29uZHMgLSBudW1iZXIgb2YgbWlsbGlzZWNvbmRzIHRvIGRlbGF5CisvLworLy8gUmV0dXJuczogICAgTm90aGluZworLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIFRoaXMgcm91dGluZSBkZWxheXMgZm9yIGFwcHJveGltYXRlbHkgbXNlY29uZHMgbWlsbGlzZWNvbmRzIGFuZCBpcyBpbnRlbmRlZAorLy8gdG8gYmUgY2FsbGVkIGluZGlyZWN0bHkgdGhyb3VnaCBpMkRlbGF5IGZpZWxkIGluIGkyZUJvcmRTdHIuIEl0IHVzZXMgdGhlCisvLyBMaW51eCB0aW1lcl9saXN0IG1lY2hhbmlzbS4KKy8vCisvLyBUaGUgTGludXggdGltZXJzIHVzZSBhIHVuaXQgY2FsbGVkICJqaWZmaWVzIiB3aGljaCBhcmUgMTBtUyBpbiB0aGUgSW50ZWwKKy8vIGFyY2hpdGVjdHVyZS4gVGhpcyBmdW5jdGlvbiByb3VuZHMgdGhlIGRlbGF5IHBlcmlvZCB1cCB0byB0aGUgbmV4dCAiamlmZnkiLgorLy8gSW4gdGhlIEFscGhhIGFyY2hpdGVjdHVyZSB0aGUgImppZmZ5IiBpcyAxbVMsIGJ1dCB0aGlzIGRyaXZlciBpcyBub3QgaW50ZW5kZWQKKy8vIGZvciBBbHBoYSBwbGF0Zm9ybXMgYXQgdGhpcyB0aW1lLgorLy8KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitzdGF0aWMgdm9pZAoraWkyRGVsYXlUaW1lcih1bnNpZ25lZCBpbnQgbXNlY29uZHMpCit7CisJd2FpdF9xdWV1ZV90IHdhaXQ7CisKKwlpbml0X3dhaXRxdWV1ZV9lbnRyeSgmd2FpdCwgY3VycmVudCk7CisKKwlpbml0X3RpbWVyICggcERlbGF5VGltZXIgKTsKKworCWFkZF93YWl0X3F1ZXVlKCZwRGVsYXlXYWl0LCAmd2FpdCk7CisKKwlzZXRfY3VycmVudF9zdGF0ZSggVEFTS19JTlRFUlJVUFRJQkxFICk7CisKKwlwRGVsYXlUaW1lci0+ZXhwaXJlcyAgPSBqaWZmaWVzICsgKCBtc2Vjb25kcyArIDkgKSAvIDEwOworCXBEZWxheVRpbWVyLT5mdW5jdGlvbiA9IGlpMkRlbGF5V2FrZXVwOworCXBEZWxheVRpbWVyLT5kYXRhICAgICA9IDA7CisKKwlhZGRfdGltZXIgKCBwRGVsYXlUaW1lciApOworCisJc2NoZWR1bGUoKTsKKworCXNldF9jdXJyZW50X3N0YXRlKCBUQVNLX1JVTk5JTkcgKTsKKwlyZW1vdmVfd2FpdF9xdWV1ZSgmcERlbGF5V2FpdCwgJndhaXQpOworCisJZGVsX3RpbWVyICggcERlbGF5VGltZXIgKTsKK30KKworI2lmIDAKKy8vc3RhdGljIHZvaWQgaWkyRGVsYXlJTyh1bnNpZ25lZCBpbnQpOworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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Ly8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpMk5vcCgpCisvLyBQYXJhbWV0ZXJzOiBOb25lCisvLworLy8gUmV0dXJuczogICAgTm90aGluZworLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIGlpSW5pdGlhbGl6ZSB3aWxsIHNldCBpMmVEZWxheSB0byB0aGlzIGlmIHRoZSBkZWxheSBwYXJhbWV0ZXIgaXMgTlVMTC4gVGhpcworLy8gc2F2ZXMgY2hlY2tpbmcgZm9yIGEgTlVMTCBwb2ludGVyIGF0IGV2ZXJ5IGNhbGwuCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIHZvaWQKK2lpMk5vcCh2b2lkKQoreworCXJldHVybjsJLy8gbm8gbXlzdGVyeSBoZXJlCit9CisKKy8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorLy8gUm91dGluZXMgd2hpY2ggYXJlIGF2YWlsYWJsZSBpbiA4LzE2LWJpdCB2ZXJzaW9ucywgb3IKKy8vIGluIGRpZmZlcmVudCBmaWZvIHN0eWxlcy4gVGhlc2UgYXJlIEFMTCBjYWxsZWQKKy8vIGluZGlyZWN0bHkgdGhyb3VnaCB0aGUgYm9hcmQgc3RydWN0dXJlLgorLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisKKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisvLyBGdW5jdGlvbjogICBpaVdyaXRlQnVmMTYocEIsIGFkZHJlc3MsIGNvdW50KQorLy8gUGFyYW1ldGVyczogcEIgICAg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GlyZWN0bHkgdGhyb3VnaCBwQi0+aTJlV3JpdGVCdWYuCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyBpbnQKK2lpV3JpdGVCdWY4KGkyZUJvcmRTdHJQdHIgcEIsIHVuc2lnbmVkIGNoYXIgKmFkZHJlc3MsIGludCBjb3VudCkKK3sKKwkvKiBSdWRpbWVudGFyeSBzYW5pdHkgY2hlY2tpbmcgaGVyZSAqLworCWlmIChwQi0+aTJlVmFsaWQgIT0gSTJFX01BR0lDKQorCQlDT01QTEVURShwQiwgSTJFRV9JTlZBTElEKTsKKworCU9VVFNCICggcEItPmkyZURhdGEsIGFkZHJlc3MsIGNvdW50ICk7CisKKwlDT01QTEVURShwQiwgSTJFRV9HT09EKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpUmVhZEJ1ZjE2KHBCLCBhZGRyZXNzLCBjb3VudCkKKy8vIFBhcmFtZXRlcnM6IHBCICAgICAgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8gICAgICAgICAgICAgYWRkcmVzcyAtIGFkZHJlc3MgdG8gcHV0IGRhdGEgcmVhZAorLy8gICAgICAgICAgICAgY291bnQgICAtIG51bWJlciBvZiBkYXRhIGJ5dGVzIHRvIHJlYWQKKy8vCisvLyBSZXR1cm5zOiAgICBUcnVlIGlmIGV2ZXJ5dGhpbmcgYXBwZWFycyBjb3BhY2V0aWMuCisvLyAgICAgICAgICAgICBGYWxzZSBpZiB0aGVyZSBpcyBhbnkgZXJyb3I6IHRoZSBwQi0+aTJlRXJyb3IgZmllbGQgaGFzIHRoZSBlcnJvcgorLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIFJlYWRzICdjb3VudCcgYnl0ZXMgaW50byAnYWRkcmVzcycgZnJvbSB0aGUgZGF0YSBmaWZvIHNwZWNpZmllZCBieSB0aGUgYm9hcmQKKy8vIHN0cnVjdHVyZSBwb2ludGVyIHBCLiBTaG91bGQgY291bnQgaGFwcGVuIHRvIGJlIG9kZCwgYW4gZXh0cmEgcGFkIGJ5dGUgaXMKKy8vIHJlY2VpdmVkIChpZGVudGl0eSB1bmtub3duLi4uKS4gVXNlcyAxNi1iaXQgKHdvcmQpIG9wZXJhdGlvbnMuIElzIGNhbGxlZAorLy8gaW5kaXJlY3RseSB0aHJvdWdoIHBCLT5pMmVSZWFkQnVmLgorLy8KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitzdGF0aWMgaW50CitpaVJlYWRCdWYxNihpMmVCb3JkU3RyUHRyIHBCLCB1bnNpZ25lZCBjaGFyICphZGRyZXNzLCBpbnQgY291bnQpCit7CisJLy8gUnVkaW1lbnRhcnkgc2FuaXR5IGNoZWNraW5nIGhlcmUuCisJaWYgKHBCLT5pMmVWYWxpZCAhPSBJMkVfTUFHSUMpCisJCUNPTVBMRVRFKHBCLCBJMkVFX0lOVkFMSUQpOworCisJSU5TVyAoIHBCLT5pMmVEYXRhLCBhZGRyZXNzLCBjb3VudCk7CisKKwlDT01QTEVURShwQiwgSTJFRV9HT09EKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpUmVhZEJ1ZjgocEIsIGFkZHJlc3MsIGNvdW50KQorLy8gUGFyYW1ldGVyczogcEIgICAgICAtIHBvaW50ZXIgdG8gYm9hcmQgc3RydWN0dXJlCisvLyAgICAgICAgICAgICBhZGRyZXNzIC0gYWRkcmVzcyB0byBwdXQgZGF0YSByZWFkCisvLyAgICAgIC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udCk7CisKKwlDT01QTEVURShwQiwgSTJFRV9HT09EKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpUmVhZFdvcmQxNihwQikKKy8vIFBhcmFtZXRlcnM6IHBCICAgICAgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8KKy8vIFJldHVybnM6ICAgIFRydWUgaWYgZXZlcnl0aGluZyBhcHBlYXJzIGNvcGFjZXRpYy4KKy8vICAgICAgICAgICAgIEZhbHNlIGlmIHRoZXJlIGlzIGFueSBlcnJvcjogdGhlIHBCLT5pMmVFcnJvciBmaWVsZCBoYXMgdGhlIGVycm9yCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gUmV0dXJucyB0aGUgd29yZCByZWFkIGZyb20gdGhlIGRhdGEgZmlmbyBzcGVjaWZpZWQgYnkgdGhlIGJvYXJkLXN0cnVjdHVyZQorLy8gcG9pbnRlciBwQi4gVXNlcyBhIDE2LWJpdCBvcGVyYXRpb24uIElzIGNhbGxlZCBpbmRpcmVjdGx5IHRocm91Z2gKKy8vIHBCLT5pMmVSZWFkV29yZC4KKy8vCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIHVuc2lnbmVkIHNob3J0CitpaVJlYWRXb3JkMTYoaTJlQm9yZFN0clB0ciBwQikKK3sKKwlyZXR1cm4gKHVuc2lnbmVkIHNob3J0KSggSU5XKHBCLT5pMmVEYXRhKSApOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlSZWFkV29yZDgocEIpCisvLyBQYXJhbWV0ZXJzOiBwQiAgIC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dmFsdWUgLSBkYXRhIHRvIHdyaXRlCisvLworLy8gUmV0dXJuczogICAgVHJ1ZSBpZiBldmVyeXRoaW5nIGFwcGVhcnMgY29wYWNldGljLgorLy8gICAgICAgICAgICAgRmFsc2UgaWYgdGhlcmUgaXMgYW55IGVycm9yOiB0aGUgcEItPmkyZUVycm9yIGZpZWxkIGhhcyB0aGUgZXJyb3IKKy8vCisvLyBEZXNjcmlwdGlvbjoKKy8vCisvLyBXcml0ZXMgdGhlIHdvcmQgJ3ZhbHVlJyB0byB0aGUgZGF0YSBmaWZvIHNwZWNpZmllZCBieSB0aGUgYm9hcmQtc3RydWN0dXJlCisvLyBwb2ludGVyIHBCLiBVc2VzIDE2LWJpdCBvcGVyYXRpb24uIElzIGNhbGxlZCBpbmRpcmVjdGx5IHRocm91Z2gKKy8vIHBCLT5pMmVXcml0ZVdvcmQuCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB2b2lkCitpaVdyaXRlV29yZDE2KGkyZUJvcmRTdHJQdHIgcEIsIHVuc2lnbmVkIHNob3J0IHZhbHVlKQoreworCVdPUkRfVE8ocEIsIChpbnQpdmFsdWUpOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlXcml0ZVdvcmQ4KHBCLCB2YWx1ZSkKKy8vIFBhcmFtZXRlcnM6IHBCICAgIC0gcG9pbnRlciB0byBib2FyZCBzdHJ1Y3R1cmUKKy8vICAgICAgICAgICAgIHZhbHVlIC0gZGF0YSB0byB3cml0ZQorLy8KKy8vIFJldHVybnM6ICAgIFRydWUgaWYgZXZlcnl0aGluZyBhcHBlYXJzIGNvcGFjZXRpYy4KKy8vICAgICAgICAgICAgIEZhbHNlIGlmIHRoZXJlIGlzIGFueSBlcnJvcjogdGhlIHBCLT5pMmVFcnJvciBmaWVsZCBoYXMgdGhlIGVycm9yCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gV3JpdGVzIHRoZSB3b3JkICd2YWx1ZScgdG8gdGhlIGRhdGEgZmlmbyBzcGVjaWZpZWQgYnkgdGhlIGJvYXJkLXN0cnVjdHVyZQorLy8gcG9pbnRlciBwQi4gVXNlcyB0d28gOC1iaXQgb3BlcmF0aW9ucyAod3JpdGVzIExTQiBmaXJzdCkuIElzIGNhbGxlZAorLy8gaW5kaXJlY3RseSB0aHJvdWdoIHBCLT5pMmVXcml0ZVdvcmQuCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB2b2lkCitpaVdyaXRlV29yZDgoaTJlQm9yZFN0clB0ciBwQiwgdW5zaWduZWQgc2hvcnQgdmFsdWUpCit7CisJQllURV9UTyhwQiwgKGNoYXIpdmFsdWUpOworCUJZVEVfVE8ocEIsIChjaGFyKSh2YWx1ZSA+PiA4KSApOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlXYWl0Rm9yVHhFbXB0eUlJKHBCLCBtU2RlbGF5KQorLy8gUGFyYW1ldGVyczogcEIgICAgICAtIHBvaW50ZXIgdG8gYm9hcmQgc3RydWN0dXJlCisvLyAgICAgICAgICAgICBtU2RlbGF5IC0gcGVyaW9kIHRvIHdhaXQgYmVmb3JlIHJldHVybmluZworLy8KKy8vIFJldHVybnM6ICAgIFRydWUgaWYgdGhlIEZJRk8gaXMgZW1wdHkuCisvLyAgICAgICAgICAgICBGYWxzZSBpZiBpdCBub3QgZW1wdHkgaW4gdGhlIHJlcXVpcmVkIHRpbWU6IHRoZSBwQi0+aTJlRXJyb3IKKy8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ioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlUeE1haWxFbXB0eUlJKHBCKQorLy8gUGFyYW1ldGVyczogcEIgICAgICAtIHBvaW50ZXIgdG8gYm9hcmQgc3RydWN0dXJlCisvLworLy8gUmV0dXJuczogICAgVHJ1ZSBpZiB0aGUgdHJhbnNtaXQgbWFpbGJveCBpcyBlbXB0eS4KKy8vICAgICAgICAgICAgIEZhbHNlIGlmIGl0IG5vdCBlbXB0eS4KKy8vCisvLyBEZXNjcmlwdGlvbjoKKy8vCisvLyBSZXR1cm5zIHRydWUgb3IgZmFsc2UgYWNjb3JkaW5nIHRvIHdoZXRoZXIgdGhlIHRyYW5zbWl0IG1haWxib3ggaXMgZW1wdHkgKGFuZAorLy8gdGhlcmVmb3JlIGFibGUgdG8gYWNjZXB0IG1vcmUgbWFpbCkKKy8vCisvLyBUaGlzIHZlcnNpb24gb3BlcmF0ZXMgb24gSW50ZWxsaVBvcnQtSUkgLSBzdHlsZSBGSUZPJ3MKKy8vCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIGludAoraWlUeE1haWxFbXB0eUlJKGkyZUJvcmRTdHJQdHIgcEIpCit7CisJaW50IHBvcnQgPSBwQi0+aTJlUG9pbnRlcjsKKwlPVVRCICggcG9ydCwgU0VMX09VVE1BSUwgKTsKKwlyZXR1cm4gKCBJTkIocG9ydCkgPT0gMCApOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlUeE1haWxFbXB0eUlJRVgocEIpCisvLyBQYXJhbWV0ZXJzOiBwQiAgICAgIC0gcG9pbnRlciB0byBib2FyZCBzdHJ1Y3R1cmUKKy8vCisvLyBSZXR1cm5zOiAgICBUcnVlIGlmIHRoZSB0cmFuc21pdCBtYWlsYm94IGlzIGVtcHR5LgorLy8gICAgICAgICAgICAgRmFsc2UgaWYgaXQgbm90IGVtcHR5LgorLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIFJldHVybnMgdHJ1ZSBvciBmYWxzZSBhY2NvcmRpbmcgdG8gd2hldGhlciB0aGUgdHJhbnNtaXQgbWFpbGJveCBpcyBlbXB0eSAoYW5kCisvLyB0aGVyZWZvcmUgYWJsZSB0byBhY2NlcHQgbW9yZSBtYWlsKQorLy8KKy8vIFRoaXMgdmVyc2lvbiBvcGVyYXRlcyBvbiBJbnRlbGxpUG9ydC1JSUVYIC0gc3R5bGUgRklGTydzCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyBpbnQKK2lpVHhNYWlsRW1wdHlJSUVYKGkyZUJvcmRTdHJQdHIgcEIpCit7CisJcmV0dXJuICEoSU5CKHBCLT5pMmVTdGF0dXMpICYgU1RFX09VVF9NQUlMKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpVHJ5U2VuZE1haWxJSShwQixtYWlsKQorLy8gUGFyYW1ldGVyczogcEIgICAtIHBvaW50ZXIgdG8gYm9hcmQgc3RydWN0dXJlCisvLyAgICAgICAgICAgICBtYWlsIC0gdmFsdWUgdG8gd3JpdGUgdG8gbWFpbGJveAorLy8KKy8vIFJldHVybnM6ICAgIFRydWUgaWYgdGhlIHRyYW5zbWl0IG1haWxib3ggaXMgZW1wdHksIGFuZCBtYWlsIGlzIHNlbnQuCisvLyAgICAgICAgICAgICBGYWxzZSBpZiBpdCBub3QgZW1wdHkuCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gSWYgb3V0Z29pbmcgbWFpbGJveCBpcyBlbXB0eSwgc2VuZHMgbWFpbCBhbmQgcmV0dXJucyB0cnVlLiBJZiBvdXRnb2luZworLy8gbWFpbGJveCBpcyBub3QgZW1wdHksIHJldHVybnMgZmFsc2UuCisvLworLy8gVGhpcyB2ZXJzaW9uIG9wZXJhdGVzIG9uIEludGVsbGlQb3J0LUlJIC0gc3R5bGUgRklGTydzCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyBpbnQKK2lpVHJ5U2VuZE1haWxJSShpMmVCb3JkU3RyUHRyIHBCLCB1bnNpZ25lZCBjaGFyIG1haWwpCit7CisJaW50IHBvcnQgPSBwQi0+aTJlUG9pbnRlcjsKKworCU9VVEIocG9ydCwgU0VMX09VVE1BSUwpOworCWlmIChJTkIocG9ydCkgPT0gMCkgeworCQlPVVRCKHBvcnQsIFNFTF9PVVRNQUlMKTsKKwkJT1VUQihwb3J0LCBtYWlsKTsKKwkJcmV0dXJuIDE7CisJfQorCXJldHVybiAwOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlUcnlTZW5kTWFpbElJRVgocEIsbWFpbCkKKy8vIFBhcmFtZXRlcnM6IHBCICAgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8gICAgICAgICAgICAgbWFpbCAtIHZhbHVlIHRvIHdyaXRlIHRvIG1haWxib3gKKy8vCisvLyBSZXR1cm5zOiAgICBUcnVlIGlmIHRoZSB0cmFuc21pdCBtYWlsYm94IGlzIGVtcHR5LCBhbmQgbWFpbCBpcyBzZW50LgorLy8gICAgICAgICAgICAgRmFsc2UgaWYgaXQgbm90IGVtcHR5LgorLy8KKy8vIERlc2NyaXB0aW9uOgorLy8KKy8vIElmIG91dGdvaW5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VsbGlQb3J0LUlJIC0gc3R5bGUgRklGTydzCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB1bnNpZ25lZCBzaG9ydAoraWlHZXRNYWlsSUkoaTJlQm9yZFN0clB0ciBwQikKK3sKKwlpZiAoSEFTX01BSUwocEIpKSB7CisJCU9VVEIocEItPmkyZVBvaW50ZXIsIFNFTF9JTk1BSUwpOworCQlyZXR1cm4gSU5CKHBCLT5pMmVQb2ludGVyKTsKKwl9IGVsc2UgeworCQlyZXR1cm4gTk9fTUFJTF9IRVJFOworCX0KK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpR2V0TWFpbElJRVgocEIsbWFpbCkKKy8vIFBhcmFtZXRlcnM6IHBCICAgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8KKy8vIFJldHVybnM6ICAgIE1haWxib3ggZGF0YSBvciBOT19NQUlMX0hFUkUuCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gSWYgbm8gbWFpbCBhdmFpbGFibGUsIHJldHVybnMgTk9fTUFJTF9IRVJFIG90aGVyd2lzZSByZXR1cm5zIHRoZSBkYXRhIGZyb20KKy8vIHRoZSBtYWlsYm94LCB3aGljaCBpcyBndWFyYW50ZWVkICE9IE5PX01BSUxfSEVSRS4KKy8vCisvLyBUaGlzIHZlcnNpb24gb3BlcmF0ZXMgb24gSW50ZWxsaVBvcnQtSUlFWCAtIHN0eWxlIEZJRk8ncworLy8KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitzdGF0aWMgdW5zaWduZWQgc2hvcnQKK2lpR2V0TWFpbElJRVgoaTJlQm9yZFN0clB0ciBwQikKK3sKKwlpZiAoSEFTX01BSUwocEIpKSB7CisJCXJldHVybiBJTkIocEItPmkyZVhNYWlsKTsKKwl9IGVsc2UgeworCQlyZXR1cm4gTk9fTUFJTF9IRVJFOworCX0KK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpRW5hYmxlTWFpbElycUlJKHBCKQorLy8gUGFyYW1ldGVyczogcEIgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8KKy8vIFJldHVybnM6ICAgIE5vdGhpbmcKKy8vCisvLyBEZXNjcmlwdGlvbjoKKy8vCisvLyBFbmFibGVzIGJvYXJkIHRvIGludGVycnVwdCBob3N0IChvbmx5KSBieSB3cml0aW5nIHRvIGhvc3QncyBpbi1ib3VuZCBtYWlsYm94LgorLy8KKy8vIFRoaXMgdmVyc2lvbiBvcGVyYXRlcyBvbiBJbnRlbGxpUG9ydC1JSSAtIHN0eWxlIEZJRk8ncworLy8KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitzdGF0aWMgdm9pZAoraWlFbmFibGVNYWlsSXJxSUkoaTJlQm9yZFN0clB0ciBwQikKK3sKKwlPVVRCKHBCLT5pMmVQb2ludGVyLCBTRUxfTUFTSyk7CisJT1VUQihwQi0+aTJlUG9pbnRlciwgU1RfSU5fTUFJTCk7Cit9CisKKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisvLyBGdW5jdGlvbjogICBpaUVuYWJsZU1haWxJcnFJSUVYKHBCKQorLy8gUGFyYW1ldGVyczogcEIgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8KKy8vIFJldHVybnM6ICAgIE5vdGhpbmcKKy8vCisvLyBEZXNjcmlwdGlvbjoKKy8vCisvLyBFbmFibGVzIGJvYXJkIHRvIGludGVycnVwdCBob3N0IChvbmx5KSBieSB3cml0aW5nIHRvIGhvc3QncyBpbi1ib3VuZCBtYWlsYm94LgorLy8KKy8vIFRoaXMgdmVyc2lvbiBvcGVyYXRlcyBvbiBJbnRlbGxpUG9ydC1JSUVYIC0gc3R5bGUgRklGTydzCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB2b2lkCitpaUVuYWJsZU1haWxJcnFJSUVYKGkyZUJvcmRTdHJQdHIgcEIpCit7CisJT1VUQihwQi0+aTJlWE1hc2ssIE1YX0lOX01BSUwpOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlXcml0ZU1hc2tJSShwQikKKy8vIFBhcmFtZXRlcnM6IHBCIC0gcG9pbnRlciB0byBib2FyZCBzdHJ1Y3R1cmUKKy8vCisvLyBSZXR1cm5zOiAgICBOb3RoaW5nCisvLworLy8gRGVzY3JpcHRpb246CisvLworLy8gV3JpdGVzIGFyYml0cmFyeSB2YWx1ZSB0byB0aGUgbWFzayByZWdpc3Rlci4KKy8vCisvLyBUaGlzIHZlcnNpb24gb3BlcmF0ZXMgb24gSW50ZWxsaVBvcnQtSUkgLSBzdHlsZSBGSUZPJ3MKKy8vCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIHZvaWQKK2lpV3JpdGVNYXNrSUkoaTJlQm9yZFN0clB0ciBwQiwgdW5zaWduZWQgY2hhciB2YWx1ZSkKK3sKKwlPVVRCKHBCLT5pMmVQb2ludGVyLCBTRUxfTUFTSyk7CisJT1VUQihwQi0+aTJlUG9pbnRlciwgdmFsdWUpOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlXcml0ZU1hc2tJSUVYKHBCKQorLy8gUGFyYW1ldGVyczogcEIgLSBwb2ludGVyIHRvIGJvYXJkIHN0cnVjdHVyZQorLy8KKy8vIFJldHVybnM6ICAgIE5vdGhpbmcKKy8vCisvLyBEZXNjcmlwdGlvbjoKKy8vCisvLyBXcml0ZXMgYXJiaXRyYXJ5IHZhbHVlIHRvIHRoZSBtYXNrIHJlZ2lzdGVyLgorLy8KKy8vIFRoaXMgdmVyc2lvbiBvcGVyYXRlcyBvbiBJbnRlbGxpUG9ydC1JSUVYIC0gc3R5bGUgRklGTydzCisvLworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK3N0YXRpYyB2b2lkCitpaVdyaXRlTWFza0lJRVgoaTJlQm9yZFN0clB0ciBwQiwgdW5zaWduZWQgY2hhciB2YWx1ZSkKK3sKKwlPVVRCKHBCLT5pMmVYTWFzaywgdmFsdWUpOworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaWlEb3dubG9hZEJsb2NrKHBCLCBwU291cmNlLCBpc1N0YW5kYXJkKQorLy8gUGFyYW1ldGVyczogcEIgICAgICAgICAtIHBvaW50ZXIgdG8gYm9hcmQgc3RydWN0dXJlCisvLyAgICAgICAgICAgICBwU291cmNlICAgIC0gbG9hZHdhcmUgYmxvY2sgdG8gZG93bmxvYWQKKy8vICAgICAgICAgICAgIGlzU3RhbmRhcm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gorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyoKKyogICBQQUNLQUdFOiAgICAgTGludXggdHR5IERldmljZSBEcml2ZXIgZm9yIEludGVsbGlQb3J0IElJIGZhbWlseSBvZiBtdWx0aXBvcnQKKyogICAgICAgICAgICAgICAgc2VyaWFsIEkvTyBjb250cm9sbGVycy4KKyoKKyogICBERVNDUklQVElPTjogTWFpbmxpbmUgY29kZSBmb3IgdGhlIGRldmljZSBkcml2ZXIKKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorLy8gaTJlbGxpcy5oCisvLworLy8gSW50ZWxsaVBvcnQtSUkgYW5kIEludGVsbGlQb3J0LUlJRVgKKy8vCisvLyBFeHRyZW1lbHkKKy8vIExvdworLy8gTGV2ZWwKKy8vIEludGVyZmFjZQorLy8gU2VydmljZXMKKy8vCisvLyBTdHJ1Y3R1cmUgRGVmaW5pdGlvbnMgYW5kIGRlY2xhcmF0aW9ucyBmb3IgIkVMTElTIiBzZXJ2aWNlIHJvdXRpbmVzIGZvdW5kIGluCisvLyBpMmVsbGlzLmMKKy8vCisvLyBUaGVzZSByb3V0aW5lcyBhcmUgYmFzZWQgb24gcHJvcGVydGllcyBvZiB0aGUgSW50ZWxsaVBvcnQtSUkgYW5kIC1JSUVYCisvLyBoYXJkd2FyZSBhbmQgYm9vdHN0cmFwIGZpcm13YXJlLCBhbmQgYXJlIG5vdCBzZW5zaXRpdmUgdG8gcGFydGljdWxhcgorLy8gY29udmVudGlvbnMgb2YgYW55IHBhcnRpY3VsYXIgbG9hZHdhcmUuCisvL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gIC0gIEludGVsbGlwb3J0IElJIEVYIC8gSVNBLTgKKy8vICAgMSAgIDAgICAtICBJbnRlbGxpU2VydmVyCisvLyAgIDAgICAxICAgLSAgU0FDIC0gUG9ydCBEZXZpY2UgKEludGVsbGlwb3J0IElJSSA/Pz8gKQorLy8gICAgICAgICAgID09PT09KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCisvLyAgICAgICAgICAgTiAgIE4gICAtICBOdW1iZXIgb2YgUG9ydHMKKy8vICAgICAgICAgICAwICAgMCAgIC0gIDggIChlaWdodCkKKy8vICAgICAgICAgICAwICAgMSAgIC0gIDQgIChmb3VyKQorLy8gICAgICAgICAgIDEgICAwICAgLSAgMTIgKHR3ZWx2ZSkKKy8vICAgICAgICAgICAxICAgMSAgIC0gIDE2IChzaXh0ZWVuKQorLy8gICAgICAgICAgICAgICAgICAgPSsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysKKy8vICAgICAgICAgICAgICAgICAgIEwgIC0gICBMQ0QgRGlzcGxheSBNb2R1bGUgUHJlc2VudAorLy8gICAgICAgICAgICAgICAgICAgMCAgLSAgIE5vCisvLyAgICAgICAgICAgICAgICAgICAxICAtICAgTENEIG1vZHVsZSBwcmVzZW50CisvLyAgICAgICAgICAgICAgICAgICA9PT09PT09PT0rKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCisvLyAgICAgICAgICAgICAgICAgICAgICBTICAgUyAgIFMgLSBBc3luYyBTaWduYWxzIFN1cHBvcnRlZCBEZXNpZ25hdG9yCisvLyAgICAgICAgICAgICAgICAgICAgICAwICAgMCAgIDAgLSA4ZHNzLCBNb2QgRENFIERCMjUgRmVtYWxlCisvLyAgICAgICAgICAgICAgICAgICAgICAwICAgMCAgIDEgLSA2ZHNzLCBSSi00NQorLy8gICAgICAgICAgICAgICAgICAgICAgMCAgIDEgICAwIC0gUlMtMjMyLzQyMiBkc3MsIERCMjUgRmVtYWxlCisvLyAgICAgICAgICAgICAgICAgICAgICAwICAgMSAgIDEgLSBSUy0yMzIvNDIyIGRzcywgc2VwYXJhdGUgMjMyLzQyMiBEQjI1IEZlbWFsZQorLy8gICAgICAgICAgICAgICAgICAgICAgMSAgIDAgICAwIC0gNmRzcywgOTIxLjYgSS9GIHdpdGggU1Q2NTQncworLy8gICAgICAgICAgICAgICAgICAgICAgMSAgIDAgICAxIC0gUlMtNDIzLzIzMiA4ZHNzLCBSSi00NSAxMFBpbgorLy8gICAgICAgICAgICAgICAgICAgICAgMSAgIDEgICAwIC0gNmRzcywgTW9kIERDRSBEQjI1IEZlbWFsZQorLy8gICAgICAgICAgICAgICAgICAgICAgMSAgIDEgICAxIC0gTk8gQk9YIFBSRVNFTlQKKworI2RlZmluZSBGRihjKQkoKGMgJiAweEMwKSA+PiA2KQorI2RlZmluZSBOTihjKQkoKGMgJiAweDMwKSA+PiA0KQorI2RlZmluZSBMKGMpCSgoYyAmIDB4MDgpID4+IDMpCisjZGVmaW5lIFNTUyhjKQkgKGMgJiAweDA3KQorCisjZGVmaW5lIEJJRF9IQVNfNjU0KHgpCShTU1MoeCkgPT0gMHgwNCkKKyNkZWZpbmUgQklEX05PX0JPWAkweGZmIC8qIG5vIGJveCAqLworI2RlZmluZSBCSURfOFBPUlQgIAkweDgwIC8qIElQMi04IHBvcnQgKi8KKyNkZWZpbmUgQklEXzRQT1JUICAgCTB4ODEgLyogSVAyLTQgcG9ydCAqLworI2RlZmluZSBCSURfRVhQX01BU0sgICAJMHgzMCAvKiBJUDItRVggICovCisjZGVmaW5lIEJJRF9FWFBfOFBPUlQJMHgwMCAvKiAgICAgOCwgKi8KKyNkZWZpbmUgQklEX0VYUF80UE9SVAkweDEwIC8qICAgICA0LCAqLworI2RlZmluZSBCSURfRVhQX1VOREVGCTB4MjAgLyogICAgIFVOREVGLCAqLworI2RlZmluZSBCSURfRVhQXzE2UE9SVAkweDMwIC8qICAgIDE2LCAqLworI2RlZmluZSBCSURfTENEX0NUUkwgICAJMHgwOCAvKiBM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bnNpZ25lZCBpbnQpOwkvLyBOLW1pbGxpc2Vjb25kIGRlbGF5IHVzaW5nIExpbnV4CisJCQkJCQkJCQkJCS8vdGltZXIKKworLy8gTWFueSBmdW5jdGlvbnMgZGVmaW5lZCBoZXJlIHJldHVybiBUcnVlIGlmIGdvb2QsIEZhbHNlIG90aGVyd2lzZSwgd2l0aCBhbgorLy8gZXJyb3IgY29kZSBpbiBpMmVFcnJvciBmaWVsZC4gSGVyZSBpcyBhIGhhbmR5IG1hY3JvIGZvciBzZXR0aW5nIHRoZSBlcnJvcgorLy8gY29kZSBhbmQgcmV0dXJuaW5nLgorLy8KKyNkZWZpbmUgQ09NUExFVEUocEIsY29kZSkgXAorCWlmKDEpeyBcCisJCSBwQi0+aTJlRXJyb3IgPSBjb2RlOyBcCisJCSByZXR1cm4gKGNvZGUgPT0gSTJFRV9HT09EKTtcCisJfQorCisjZW5kaWYgICAvLyBJMkVMTElTX0gKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9pcDIvaTJody5oIGIvZHJpdmVycy9jaGFyL2lwMi9pMmh3LmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMTVmZTA0ZQotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9pcDIvaTJody5oCkBAIC0wLDAgKzEsNjQ4IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKiAgIChjKSAxOTk5IGJ5IENvbXB1dG9uZSBDb3Jwb3JhdGlvbgorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyoKKyogICBQQUNLQUdFOiAgICAgTGludXggdHR5IERldmljZSBEcml2ZXIgZm9yIEludGVsbGlQb3J0IElJIGZhbWlseSBvZiBtdWx0aXBvcnQKKy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vaXAyL2kybGliLmMKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uODJjNWYzMDMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvaXAyL2kybGliLmMKQEAgLTAsMCArMSwyMjE5IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKiAgIChjKSAxOTk5IGJ5IENvbXB1dG9uZSBDb3Jwb3JhdGlvbgorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyoKKyogICBQQUNLQUdFOiAgICAgTGludXggdHR5IERldmljZSBEcml2ZXIgZm9yIEludGVsbGlQb3J0IGZhbWlseSBvZiBtdWx0aXBvcnQKKyogICAgICAgICAgICAgICAgc2VyaWFsIEkvTyBjb250cm9sbGVycy4KKyoKKyogICBERVNDUklQVElPTjogSGlnaC1sZXZlbCBpbnRlcmZhY2UgY29kZSBmb3IgdGhlIGRldmljZSBkcml2ZXIuIFVzZXMgdGhlCisqICAgICAgICAgICAgICAgIEV4dHJlbWVseSBMb3cgTGV2ZWwgSW50ZXJmYWNlIFN1cHBvcnQgKGkyZWxsaXMuYykuIFByb3ZpZGVzIGFuCisqICAgICAgICAgICAgICAgIGludGVyZmFjZSB0byB0aGUgc3RhbmRhcmQgbG9hZHdhcmUsIHRvIHN1cHBvcnQgZHJpdmVycyBvcgorKiAgICAgICAgICAgICAgICBhcHBsaWNhdGlvbiBjb2RlLiAoVGhpcyBpcyBpbmNsdWRlZCBzb3VyY2UgY29kZSwgbm90IGEgc2VwYXJhdGUKKyogICAgICAgICAgICAgICAgY29tcGlsYXRpb24gbW9kdWxlLikKKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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aW50ZXJydXB0IGhhbmRsaW5nCitzdGF0aWMgdm9pZCBkb19pbnB1dCh2b2lkICopOworc3RhdGljIHZvaWQgZG9fc3RhdHVzKHZvaWQgKik7CisKKy8vKioqKioqKioqKioqKioqCisvLyogRGVidWcgIERhdGEgKgorLy8qKioqKioqKioqKioqKioKKyNpZmRlZiBERUJVR19GSUZPCisKK3Vuc2lnbmVkIGNoYXIgREJHQnVmWzB4NDAwMF07Cit1bnNpZ25lZCBzaG9ydCBJID0gMDsKKworc3RhdGljIHZvaWQKK1dyaXRlREJHQnVmKGNoYXIgKnMsIHVuc2lnbmVkIGNoYXIgKnNyYywgdW5zaWduZWQgc2hvcnQgbiApIAoreworCWNoYXIgKnAgPSBzcmM7CisKKwkvLyBYWFg6IFdlIG5lZWQgYSBzcGluIGxvY2sgaGVyZSBpZiB3ZSBldmVyIHVzZSB0aGlzIGFnYWluCisKKwl3aGlsZSAoKnMpIHsJLy8gY29weSBsYWJlbAorCQlEQkdCdWZbSV0gPSAqcysrOworCQlJID0gSSsrICYgMHgzZmZmOworCX0KKwl3aGlsZSAobi0tKSB7CS8vIGNvcHkgZGF0YQorCQlEQkdCdWZbSV0gPSAqcCsrOworCQlJID0gSSsrICYgMHgzZmZmOworCX0KK30KKworc3RhdGljIHZvaWQKK2ZhdGFsaXR5KGkyZUJvcmRTdHJQdHIgcEIgKQoreworCWludCBpOworCisJZm9yIChpPTA7aTxzaXplb2YoREJHQnVmKTtpKyspIHsKKwkJaWYgKChpJTE2KSA9PSAwKQorCQkJcHJpbnRrKCJcbiU0eDoiLGkpOworCQlwcmludGsoIiUwMnggIixEQkdCdWZbaV0pOworCX0KKwlwcmludGsoIlxuIik7CisJZm9yIChpPTA7aTxzaXplb2YoREJHQnVmKTtpKyspIHsKKwkJaWYgKChpJTE2KSA9PSAwKQorCQkJcHJpbnRrKCJcbiU0eDoiLGkpOworCQlpZiAoREJHQnVmW2ldID49ICcgJyAmJiBEQkdCdWZbaV0gPD0gJ34nKSB7CisJCQlwcmludGsoIiAlYyAiLERCR0J1ZltpXSk7CisJCX0gZWxzZSB7CisJCQlwcmludGsoIiAuICIpOworCQl9CisJfQorCXByaW50aygiXG4iKTsKKwlwcmludGsoIkxhc3QgaW5kZXggJXhcbiIsSSk7Cit9CisjZW5kaWYgLyogREVCVUdfRklGTyAqLworCisvLyoqKioqKioqCisvLyogQ29kZSAqCisvLyoqKioqKioqCisKK3N0YXRpYyBpbmxpbmUgaW50CitpMlZhbGlkYXRlICggaTJDaGFuU3RyUHRyIHBDaCApCit7CisJLy9pcDJ0cmFjZShwQ2gtPnBvcnRfaW5kZXgsIElUUkNfVkVSSUZZLElUUkNfRU5URVIsMixwQ2gtPnZhbGlkaXR5LAorCS8vCShDSEFOTkVMX01BR0lDIHwgQ0hBTk5FTF9TVVBQT1JUKSk7CisJcmV0dXJuICgocENoLT52YWxpZGl0eSAmIChDSEFOTkVMX01BR0lDX0JJVFMgfCBDSEFOTkVMX1NVUFBPUlQpKSAKKwkJCSAgPT0gKENIQU5ORUxfTUFHSUMgfCBDSEFOTkVMX1NVUFBPUlQpKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGlpU2VuZFBlbmRpbmdNYWlsKHBCKQorLy8gUGFyYW1ldGVyczogUG9pbnRlciB0byBhIGJvYXJkIHN0cnVjdHVyZQorLy8gUmV0dXJuczogICAgTm90aGluZworLy8KKy8vIERlc2NyaXB0aW9uOgorLy8gSWYgYW55IG91dGdvaW5nIG1haWwgYml0cyBhcmUgc2V0IGFuZCB0aGVyZSBpcyBvdXRnb2luZyBtYWlsYm94IGlzIGVtcHR5LAorLy8gc2VuZCB0aGUgbWFpbCBhbmQgY2xlYXIgdGhlIGJpdHMuCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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pZgorCisJCSsrcENoOworICAgICAJLS1uQ2hhbm5lbHM7CisJfQorCS8vIE5vIG5lZWQgdG8gY2hlY2sgZm9yIHdyYXAgaGVyZTsgdGhpcyBpcyBpbml0aWFsaXphdGlvbi4KKwlwQi0+aTJGYnVmX3N0dWZmID0gc3R1ZmZJbmRleDsKKwlDT01QTEVURShwQiwgSTJFRV9HT09EKTsKKworfQorCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaTJEZVF1ZXVlTmVlZHMocEIsIHR5cGUpCisvLyBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIGEgYm9hcmQgc3RydWN0dXJlCisvLyAgICAgICAgICAgICB0eXBlIGJpdCBtYXA6IG1heSBpbmNsdWRlIE5FRURfSU5MSU5FLCBORUVEX0JZUEFTUywgb3IgTkVFRF9GTE9XCisvLyBSZXR1cm5zOiAgIAorLy8gICAgICAgICAgICAgUG9pbnRlciB0byBhIGNoYW5uZWwgc3RydWN0dXJlCisvLworLy8gRGVzY3JpcHRpb246IFJldHVybnMgcG9pbnRlciBzdHJ1Y3Qgb2YgbmV4dCBjaGFubmVsIHRoYXQgbmVlZHMgc2VydmljZSBvZgorLy8gIHRoZSB0eXBlIHNwZWNpZmllZC4gT3RoZXJ3aXNlIHJldHVybnMgYSBOVUxMIHJlZmVyZW5jZS4KKy8vCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIGkyQ2hhblN0clB0ciAKK2kyRGVRdWV1ZU5lZWRzKGkyZUJvcmRTdHJQdHIgcEIsIGludCB0eXBlKQoreworCXVuc2lnbmVkIHNob3J0IHF1ZXVlSW5kZXg7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworCWkyQ2hhblN0clB0ciBwQ2ggPSBOVU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isJeworCQlwQ2gtPmRhdGFTZXRJbiAmPSB+KHJlc2V0Qml0cyAmIChJMl9CUksgfCBJMl9QQVIgfCBJMl9GUkEgfCBJMl9PVlIpKTsKKwkJcENoLT5kYXRhU2V0SW4gJj0gfihJMl9ERENEIHwgSTJfRENUUyB8IEkyX0REU1IgfCBJMl9EUkkpOworCX0KKworCWlwMnRyYWNlIChDSEFOTiwgSVRSQ19TVEFUVVMsIElUUkNfUkVUVVJOLCAxLCBwQ2gtPmRhdGFTZXRJbiApOworCisJcmV0dXJuIHN0YXR1czsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGkySW5wdXQocENocERlc3QsY291bnQpCisvLyBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIGEgY2hhbm5lbCBzdHJ1Y3R1cmUKKy8vICAgICAgICAgICAgIFBvaW50ZXIgdG8gZGF0YSBidWZmZXIKKy8vICAgICAgICAgICAgIE51bWJlciBvZiBieXRlcyB0byByZWFkCisvLyBSZXR1cm5zOiAgICBOdW1iZXIgb2YgYnl0ZXMgcmVhZCwgb3IgLTEgZm9yIGVycm9yCisvLworLy8gRGVzY3JpcHRpb246CisvLyBTdHJpcHMgZGF0YSBmcm9tIHRoZSBpbnB1dCBidWZmZXIgYW5kIHdyaXRlcyBpdCB0byBwRGVzdC4gSWYgdGhlcmUgaXMgYQorLy8gY29sbG9zYWwgYmx1bmRlciwgKGludmFsaWQgc3RydWN0dXJlIHBvaW50ZXJzIG9yIHRoZSBsaWtlKSwgcmV0dXJucyAtMS4KKy8vIE90aGVyd2lzZSwgcmV0dXJucyB0aGUgbnVtYmVyIG9mIGJ5dGVzIHJlYWQuCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIGludAora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OTklORyApOworCXJlbW92ZV93YWl0X3F1ZXVlKCYocENoLT5wQm9va21hcmtXYWl0KSwgJndhaXQpOworCisJLy8gaWYgZXhwaXJlcyA9PSAwIHRoZW4gdGltZXIgcG9wZWQsIHRoZW4gZG8gbm90IG5lZWQgdG8gZGVsX3RpbWVyCisJaWYgKCh0aW1lb3V0ID4gMCkgJiYgcENoLT5Cb29rbWFya1RpbWVyLmV4cGlyZXMgJiYgCisJICAgICAgICAgICAgICAgICAgICAgdGltZV9iZWZvcmUoamlmZmllcywgcENoLT5Cb29rbWFya1RpbWVyLmV4cGlyZXMpKSB7CisJCWRlbF90aW1lciggJihwQ2gtPkJvb2ttYXJrVGltZXIpICk7CisJCXBDaC0+Qm9va21hcmtUaW1lci5leHBpcmVzID0gMDsKKworCQlpcDJ0cmFjZSAoQ0hBTk4sIElUUkNfRFJBSU4sIDMsIDEsIHBDaC0+Qm9va21hcmtUaW1lci5leHBpcmVzICk7CisKKwl9CisJaXAydHJhY2UgKENIQU5OLCBJVFJDX0RSQUlOLCBJVFJDX1JFVFVSTiwgMSwgcENoLT5Cb29rbWFya1RpbWVyLmV4cGlyZXMgKTsKKwlyZXR1cm47Cit9CisKKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisvLyBGdW5jdGlvbjogICBpMk91dHB1dEZyZWUocENoKQorLy8gUGFyYW1ldGVyczogUG9pbnRlciB0byBhIGNoYW5uZWwgc3RydWN0dXJlCisvLyBSZXR1cm5zOiAgICBTcGFjZSBpbiBvdXRwdXQgYnVmZmVyCisvLworLy8gRGVzY3JpcHRpb246CisvLyBSZXR1cm5zIC0xIGlmIHZlcnkgZ3Jvc3MgZXJyb3IuIE90aGVyd2lzZSByZXR1cm5zIHRoZSBhbW91bnQgb2YgYnl0ZXMgc3RpbGwKKy8vIGZyZWUgaW4gdGhlIG91dHB1dCBidWZmZXIuCisvLyoqKioqKioqKio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Ky8vICBXcml0ZXMgY291bnQgYnl0ZXMgdG8gYm9hcmQgaW8gYWRkcmVzcyhpbXBsaWVkKSBmcm9tIHNvdXJjZQorLy8gIEFkanVzdHMgY291bnQsIGxlYXZlcyByZXNlcnZlIGZvciBuZXh0IHRpbWUgYXJvdW5kIGJ5cGFzcyBjbWRzCisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorc3RhdGljIGludAoraTJXcml0ZTJGaWZvKGkyZUJvcmRTdHJQdHIgcEIsIHVuc2lnbmVkIGNoYXIgKnNvdXJjZSwgaW50IGNvdW50LGludCByZXNlcnZlKQoreworCWludCByYyA9IDA7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKwlXUklURV9MT0NLX0lSUVNBVkUoJnBCLT53cml0ZV9maWZvX3NwaW5sb2NrLGZsYWdzKTsKKwlpZiAoIXBCLT5pMmVXYWl0aW5nRm9yRW1wdHlGaWZvKSB7CisJCWlmIChwQi0+aTJlRmlmb1JlbWFpbnMgPiAoY291bnQrcmVzZXJ2ZSkpIHsKKwkJCXBCLT5pMmVGaWZvUmVtYWlucyAtPSBjb3VudDsKKwkJCWlpV3JpdGVCdWYocEIsIHNvdXJjZSwgY291bnQpOworCQkJcEItPmkyZU91dE1haWxXYWl0aW5nIHw9IE1CX09VVF9TVFVGRkVEOworCQkJcmMgPSAgY291bnQ7CisJCX0KKwl9CisJV1JJVEVfVU5MT0NLX0lSUVJFU1RPUkUoJnBCLT53cml0ZV9maWZvX3NwaW5sb2NrLGZsYWdzKTsKKwlyZXR1cm4gcmM7Cit9CisvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorLy8gRnVuY3Rpb246ICAgaTJTdHVmZkZpZm9CeXBhc3MocEIpCisvLyBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIGEgYm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ElUUkNfTk9fUE9SVCwgSVRSQ19TRkxPVywgSVRSQ19SRVRVUk4sIDAgKTsKK30KKworLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKy8vIEZ1bmN0aW9uOiAgIGkyU3R1ZmZGaWZvSW5saW5lKHBCKQorLy8gUGFyYW1ldGVyczogUG9pbnRlciB0byBhIGJvYXJkIHN0cnVjdHVyZQorLy8gUmV0dXJuczogICAgTm90aGluZworLy8KKy8vIERlc2NyaXB0aW9uOgorLy8gU3R1ZmZzIGFzIG11Y2ggZGF0YSBhbmQgaW5saW5lIGNvbW1hbmRzIGludG8gdGhlIGZpZm8gYXMgcG9zc2libGUuIFRoaXMgaXMKKy8vIHRoZSBtb3N0IGNvbXBsZXggZmlmby1zdHVmZmluZyBvcGVyYXRpb24sIHNpbmNlIHRoZXJlIGlmIG5vdyB0aGUgY2hhbm5lbAorLy8gZmxvdy1jb250cm9sIGlzc3VlIHRvIGRlYWwgd2l0aC4KKy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitzdGF0aWMgaW5saW5lIHZvaWQKK2kyU3R1ZmZGaWZvSW5saW5lKGkyZUJvcmRTdHJQdHIgcEIpCit7CisJaTJDaGFuU3RyUHRyIHBDaDsKKwl1bnNpZ25lZCBjaGFyICpwUmVtb3ZlOworCXVuc2lnbmVkIHNob3J0IHN0cmlwSW5kZXg7CisJdW5zaWduZWQgc2hvcnQgcGFja2V0U2l6ZTsKKwl1bnNpZ25lZCBzaG9ydCBwYWRkZWRTaXplOworCXVuc2lnbmVkIHNob3J0IG5vdENsb2dnZWQgPSAxOworCXVuc2lnbmVkIHNob3J0IGZsb3dzaXplOworCXVuc2lnbmVkIGxvbmcgZmxhZ3M7CisKKwlpbnQgYmFpbG91dCAgPSAxMDAwOworCWludCBiYWlsb3V0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ludHMrKzsKKwkJCVdSSVRFX0xPQ0tfSVJRU0FWRSgmcEItPndyaXRlX2ZpZm9fc3BpbmxvY2ssZmxhZ3MpOworCQkJcEItPmkyZUZpZm9SZW1haW5zID0gcEItPmkyZUZpZm9TaXplOworCQkJcEItPmkyZVdhaXRpbmdGb3JFbXB0eUZpZm8gPSAwOworCQkJV1JJVEVfVU5MT0NLX0lSUVJFU1RPUkUoJnBCLT53cml0ZV9maWZvX3NwaW5sb2NrLGZsYWdzKTsKKworCQkJaXAydHJhY2UgKElUUkNfTk9fUE9SVCwgSVRSQ19JTlRSLCAzMCwgMSwgcEItPmkyZUZpZm9SZW1haW5zICk7CisKKwkJfQorCQlzZXJ2aWNlT3V0Z29pbmdGaWZvKHBCKTsKKwl9CisKKwlpcDJ0cmFjZSAoSVRSQ19OT19QT1JULCBJVFJDX0lOVFIsIDgsIDAgKTsKKworZXhpdF9pMlNlcnZpY2VCb2FyZDoKKworCXJldHVybiAwOworfQpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL2lwMi9pMmxpYi5oIGIvZHJpdmVycy9jaGFyL2lwMi9pMmxpYi5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjk1MmUxMTMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvaXAyL2kybGliLmgKQEAgLTAsMCArMSwzNTEgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqICAgKGMpIDE5OTggYnkgQ29tcHV0b25lIENvcnBvcmF0aW9uCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKgorKiAgIFBBQ0tBR0U6ICAgICBMaW51eCB0dHkgRGV2aWNlIERyaXZlciBmb3IgSW50ZWxsaVBvcnQgSUk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KioqKioqKioqKioqKioqKioKKyoKKyogICAoYykgMTk5OSBieSBDb21wdXRvbmUgQ29ycG9yYXRpb24KKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqCisqICAgUEFDS0FHRTogICAgIExpbnV4IHR0eSBEZXZpY2UgRHJpdmVyIGZvciBJbnRlbGxpUG9ydCBJSSBmYW1pbHkgb2YgbXVsdGlwb3J0CisqICAgICAgICAgICAgICAgIHNlcmlhbCBJL08gY29udHJvbGxlcnMuCisqCisqICAgREVTQ1JJUFRJT046IERlZmluZXMsIGRlZmluaXRpb25zIGFuZCBpbmNsdWRlcyB3aGljaCBhcmUgaGVhdmlseSBkZXBlbmRlbnQKKyogICAgICAgICAgICAgICAgb24gTy9TLCBob3N0LCBjb21waWxlciwgZXRjLiBUaGlzIGZpbGUgaXMgdGFpbG9yZWQgZm9yOgorKiAgICAgICAgICAgICAgICAgTGludXggdjIuMC4wIGFuZCBsYXRlcgorKiAgICAgICAgICAgICAgICAgR251IGdjYyBjMi43LjIKKyogICAgICAgICAgICAgICAgIDgweDg2IGFyY2hpdGVjdHVyZQorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2lmbmRlZiBJMk9TX0ggICAgLyogVG8gcHJldmVudCBtdWx0aXBsZSBpbmNsdWRlcyAqLworI2RlZmluZSBJMk9TX0ggMQorCisvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKy8vIFJlcXVpcmVkIEluY2x1ZGVzCisvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworI2luY2x1ZGUgImlwMnR5cGVzLmgiCisjaW5jbHVkZSA8YXNtL2lvLm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rLmgKQEAgLTAsMCArMSwzNjQgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqICAgKGMpIDE5OTggYnkgQ29tcHV0b25lIENvcnBvcmF0aW9uCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKgorKiAgIFBBQ0tBR0U6ICAgICBMaW51eCB0dHkgRGV2aWNlIERyaXZlciBmb3IgSW50ZWxsaVBvcnQgSUkgZmFtaWx5IG9mIG11bHRpcG9ydAorKiAgICAgICAgICAgICAgICBzZXJpYWwgSS9PIGNvbnRyb2xsZXJzLgorKgorKiAgIERFU0NSSVBUSU9OOiBEZWZpbml0aW9ucyBvZiB0aGUgcGFja2V0cyB1c2VkIHRvIHRyYW5zZmVyIGRhdGEgYW5kIGNvbW1hbmRzCisqICAgICAgICAgICAgICAgIEhvc3QgPC0tPiBCb2FyZC4gSW5mb3JtYXRpb24gcHJvdmlkZWQgaGVyZSBpcyBvbmx5IGFwcGxpY2FibGUKKyogICAgICAgICAgICAgICAgd2hlbiB0aGUgc3RhbmRhcmQgbG9hZHdhcmUgaXMgYWN0aXZlLgorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNpZm5kZWYgSTJQQUNLX0gKKyNkZWZpbmUgSTJQQUNLX0ggIDEKKworLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorLy8gUmV2aXNpb24gSGlzdG9yeToKKy8vCisvLyAxMCBPY3RvYmVyIDE5OTEgICBNQUcgRmlyc3QgZHJhZnQKKy8vIDI0IEZlYnJ1YXJ5IDE5OTIgIE1BRyBBZGRpdGlvbnMgZm9yIDEuN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gKKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL2lwMi9pcDIuaCBiL2RyaXZlcnMvY2hhci9pcDIvaXAyLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uOTM2Y2NjNQotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9pcDIvaXAyLmgKQEAgLTAsMCArMSwxMDcgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqICAgKGMpIDE5OTggYnkgQ29tcHV0b25lIENvcnBvcmF0aW9uCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKgorKiAgIFBBQ0tBR0U6ICAgICBMaW51eCB0dHkgRGV2aWNlIERyaXZlciBmb3IgSW50ZWxsaVBvcnQgSUkgZmFtaWx5IG9mIG11bHRpcG9ydAorKiAgICAgICAgICAgICAgICBzZXJpYWwgSS9PIGNvbnRyb2xsZXJzLgorKgorKiAgIERFU0NSSVBUSU9OOiBEcml2ZXIgY29uc3RhbnRzIGZvciBjb25maWd1cmF0aW9uIGFuZCB0dW5pbmcKKyoKKyogICBOT1RFUzoKKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaWZuZGVmIElQMl9ICisjZGVmaW5lIElQMl9ICisKKyNpbmNsdWRlICJpcDJ0eXBlcy5oIgorI2luY2x1ZGUgImkyY21kLmgiCisKKy8qKioqKioqKioqKioqLworLyogQ29uc3RhbnRzICovCisvKioqKioqKioqKioqKi8KKworLyogRGV2aWNlIG1ham9yIG51bWJlcnMgLSBzaW5jZSB2ZXJzaW9uIDIuMC4yNi4gKi8KKyNkZWZpbmUgSVAyX1RUWV9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YXIvaXAyL2lwMmlvY3RsLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYWEwYTlkYQotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9pcDIvaXAyaW9jdGwuaApAQCAtMCwwICsxLDM1IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKgorKiAgIChjKSAxOTk4IGJ5IENvbXB1dG9uZSBDb3Jwb3JhdGlvbgorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyoKKyogICBQQUNLQUdFOiAgICAgTGludXggdHR5IERldmljZSBEcml2ZXIgZm9yIEludGVsbGlQb3J0IElJIGZhbWlseSBvZiBtdWx0aXBvcnQKKyogICAgICAgICAgICAgICAgc2VyaWFsIEkvTyBjb250cm9sbGVycy4KKyoKKyogICBERVNDUklQVElPTjogRHJpdmVyIGNvbnN0YW50cyBmb3IgY29uZmlndXJhdGlvbiBhbmQgdHVuaW5nCisqCisqICAgTk9URVM6CisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIElQMklPQ1RMX0gKKyNkZWZpbmUgSVAySU9DVExfSAorCisvLyoqKioqKioqKioqKioKKy8vKiBDb25zdGFudHMgKgorLy8qKioqKioqKioqKioqCisKKy8vIEhpZ2ggYmF1ZCByYXRlcyAoaWYgbm90IGRlZmluZWQgZWxzZXdoZXJlLgorI2lmbmRlZiBCMTUzNjAwICAgCisjCWRlZmluZSBCMTUzNjAwICAgMDAxMDAwNQorI2VuZGlmCisjaWZuZGVmIEIzMDcyMDAgICAKKyMJZGVmaW5lIEIzMDcyMDAgICAwMDEwMDA2CisjZW5kaWYK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I2RlZmluZQlJVFJDX09VVFBVVAknTycKKyNkZWZpbmUJSVRSQ19QVVRDCSdQJworI2RlZmluZQlJVFJDX1FVRVVFCSdRJworI2RlZmluZQlJVFJDX1NURkxXCSdSJworI2RlZmluZQlJVFJDX1NGSUZPCSdTJworI2RlZmluZQlJVFJDX1ZFUklGWQknVicKKyNkZWZpbmUJSVRSQ19XUklURQknVycKKworI2RlZmluZQlJVFJDX0VOVEVSCTB4MDAKKyNkZWZpbmUJSVRSQ19SRVRVUk4JMHhGRgorCisjZGVmaW5lCUlUUkNfUVVFVUVfUk9PTQkyCisjZGVmaW5lCUlUUkNfUVVFVUVfQ01ECTYKKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL2lwMi9pcDJ0eXBlcy5oIGIvZHJpdmVycy9jaGFyL2lwMi9pcDJ0eXBlcy5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjlkNjdiMjYKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvaXAyL2lwMnR5cGVzLmgKQEAgLTAsMCArMSw1NyBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoKKyogICAoYykgMTk5OCBieSBDb21wdXRvbmUgQ29ycG9yYXRpb24KKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqCisqICAgUEFDS0FHRTogICAgIExpbnV4IHR0eSBEZXZpY2UgRHJpdmVyIGZvciBJbnRlbGxpUG9ydCBJSSBmYW1pbHkgb2YgbXVsdGlwb3J0CisqICAgICAgICAgICAgICAgIHNlcmlhbCBJL08gY29udHJvbGxlcnMuCisqCisqICAgREVTQ1JJUFRJT046IERyaXZlciBjb25zdGFudHMgYW5kIHR5cGUgZGVmaW5pdGlvbnMuCisqCisqICAgTk9URVM6CisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2lmbmRlZiBJUDJUWVBFU19ICisjZGVmaW5lIElQMlRZUEVTX0gKKworLy8qKioqKioqKioqKioqCisvLyogQ29uc3RhbnRzICoKKy8vKioqKioqKioqKioqKgorCisvLyBEZWZpbmUgc29tZSBsaW1pdHMgZm9yIHRoaXMgZHJpdmVyLiBQb3J0cyBwZXIgYm9hcmQgaXMgYSBoYXJkd2FyZSBsaW1pdGF0aW9uCisvLyB0aGF0IHdpbGwgbm90IGNoYW5nZS4gQ3VycmVudCBoYXJkd2FyZSBsaW1pdHMgdGhpcyB0byA2NCBwb3J0cyBwZXIgYm9hcmQuCisvLyBCb2FyZHMgcGVyIGRyaXZlciBpcyBhIHNlbGYtaW1wb3NlZCBsaW1pdC4KKy8vCisjZGVmaW5lIElQMl9NQVhfQk9BUkRTICAgICAgICA0CisjZGVmaW5lIElQMl9QT1JUU19QRVJfQk9BUkQgICBBQlNfTU9TVF9QT1JUUworI2RlZmluZSBJUDJfTUFYX1BPUlRTICAgICAgICAgKElQMl9NQVhfQk9BUkRTKklQMl9QT1JUU19QRVJfQk9BUkQpCisKKyNkZWZpbmUgSVNBICAgIDAKKyNkZWZpbmUgUENJICAgIDEKKyNkZWZpbmUgRUlTQSAgIDIKKworLy8qKioqKioqKioqKioqKioqKioqKgorLy8qIFR5cGUgRGVmaW5pdGlvbnMgKgorLy8qKioqKioqKioqKioqKioqKioqKgorCit0eXBlZGVmIHN0cnVjdCB0dHlfc3RydWN0ICogICBQVFRZOwordHlwZWRlZiB3YWl0X3F1ZXVlX2hlYWRfdCAgIFBXQUlUUTsKKwordHlwZWRlZiB1bnNpZ25lZCBjaGFyICAgICAgICAgVUNIQVI7Cit0eXBlZGVmIHVuc2lnbmVkIGludCAgICAgICAgICBVSU5UOwordHlwZWRlZiB1bnNpZ25lZCB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LT50bV95ZWFyKTsKKworCS8qCisJICogQWNjb3VudCBmb3IgZGlmZmVyZW5jZXMgYmV0d2VlbiBob3cgdGhlIFJUQyB1c2VzIHRoZSB2YWx1ZXMKKwkgKiBhbmQgaG93IHRoZXkgYXJlIGRlZmluZWQgaW4gYSBzdHJ1Y3QgcnRjX3RpbWU7CisJICovCisJaWYgKChydGNfdG0tPnRtX3llYXIgKz0gKGVwb2NoIC0gMTkwMCkpIDw9IDY5KQorCQlydGNfdG0tPnRtX3llYXIgKz0gMTAwOworCisJcnRjX3RtLT50bV9tb24tLTsKK30KZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9pcDJtYWluLmMgYi9kcml2ZXJzL2NoYXIvaXAybWFpbi5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmZjYTlhOTcKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvaXAybWFpbi5jCkBAIC0wLDAgKzEsMzI2NSBAQAorLyoKKyoKKyogICAoYykgMTk5OSBieSBDb21wdXRvbmUgQ29ycG9yYXRpb24KKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqCisqICAgUEFDS0FHRTogICAgIExpbnV4IHR0eSBEZXZpY2UgRHJpdmVyIGZvciBJbnRlbGxpUG9ydCBmYW1pbHkgb2YgbXVsdGlwb3J0CisqICAgICAgICAgICAgICAgIHNlcmlhbCBJL08gY29udHJvbGxlcnMuCisqCisqICAgREVTQ1JJUFRJT046IE1haW5saW5lIGNvZGUgZm9yIHRoZSBkZXZpY2UgZHJpdmVyCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLy8gVG9EbzoKKy8vCisvLyBGaXggdGhlIGltbWVkaWF0ZSBEU1NfTk9XIHByb2JsZW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kZSA8YXNtL3VhY2Nlc3MuaD4KKworI2luY2x1ZGUgIi4vaXAyL2lwMnR5cGVzLmgiCisjaW5jbHVkZSAiLi9pcDIvaXAydHJhY2UuaCIKKyNpbmNsdWRlICIuL2lwMi9pcDJpb2N0bC5oIgorI2luY2x1ZGUgIi4vaXAyL2lwMi5oIgorI2luY2x1ZGUgIi4vaXAyL2kyZWxsaXMuaCIKKyNpbmNsdWRlICIuL2lwMi9pMmxpYi5oIgorCisvKioqKioqKioqKioqKioqKioKKyAqIC9wcm9jL2lwMm1lbSAgKgorICoqKioqKioqKioqKioqKioqLworCisjaW5jbHVkZSA8bGludXgvcHJvY19mcy5oPgorCitzdGF0aWMgaW50IGlwMl9yZWFkX3Byb2NtZW0oY2hhciAqLCBjaGFyICoqLCBvZmZfdCwgaW50KTsKK3N0YXRpYyBpbnQgaXAyX3JlYWRfcHJvYyhjaGFyICosIGNoYXIgKiosIG9mZl90LCBpbnQsIGludCAqLCB2b2lkICogKTsKKworLyoqKioqKioqKioqKioqKioqKioqLworLyogVHlwZSBEZWZpbml0aW9ucyAqLworLyoqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKi8KKy8qIENvbnN0YW50cyAqLworLyoqKioqKioqKioqKiovCisKKy8qIFN0cmluZyBjb25zdGFudHMgdG8gaWRlbnRpZnkgb3Vyc2VsdmVzICovCitzdGF0aWMgY2hhciAqcGNOYW1lICAgID0gIkNvbXB1dG9uZSBJbnRlbGxpUG9ydCBQbHVzIG11bHRpcG9ydCBkcml2ZXIiOworc3RhdGljIGNoYXIgKnBjVmVyc2lvbiA9ICIxLjIuMTQiOworCisvKiBTdHJpbmcgY29uc3RhbnRzIGZvciBwb3J0IG5hbWVzICovCitzdGF0aWMgY2hhciAqcGNEcml2ZXJfbmFtZSAgID0gImlwMiI7CitzdGF0aWMgY2hhciAqcGNJcGwgICAgCQkgPSAiaXAyaXBsIjsKKworLyogU2VyaWFsIHN1YnR5cGUgZGVmaW5pdGlvbnMgKi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WFya19yZXF1ZXN0ZWRfaXJxKCBjaGFyIGlycSApCit7CisJcmlycXNbaWluZHgrK10gPSBpcnE7Cit9CisKKyNpZmRlZiBNT0RVTEUKK3N0YXRpYyBpbnQgX19pbml0CitjbGVhcl9yZXF1ZXN0ZWRfaXJxKCBjaGFyIGlycSApCit7CisJaW50IGk7CisJZm9yICggaSA9IDA7IGkgPCBJUDJfTUFYX0JPQVJEUzsgKytpICkgeworCQlpZiAocmlycXNbaV0gPT0gaXJxKSB7CisJCQlyaXJxc1tpXSA9IDA7CisJCQlyZXR1cm4gMTsKKwkJfQorCX0KKwlyZXR1cm4gMDsKK30KKyNlbmRpZgorCitzdGF0aWMgaW50IF9faW5pdAoraGF2ZV9yZXF1ZXN0ZWRfaXJxKCBjaGFyIGlycSApCit7CisJLy8gYXJyYXkgaW5pdCB0byB6ZXJvcyBzbyAwIGlycSB3aWxsIG5vdCBiZSByZXF1ZXN0ZWQgYXMgYSBzaWRlIGVmZmVjdAorCWludCBpOworCWZvciAoIGkgPSAwOyBpIDwgSVAyX01BWF9CT0FSRFM7ICsraSApIHsKKwkJaWYgKHJpcnFzW2ldID09IGlycSkKKwkJCXJldHVybiAxOworCX0KKwlyZXR1cm4gMDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGluaXRfbW9kdWxlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiBOb25lICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgU3VjY2VzcyAoMCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhpcyBpcyBhIHJlcXVpcmVkIGVudHJ5IHBvaW50IGZvciBhbiBpbnN0YWxsYWJsZSBtb2R1bGUuIEl0IHNpbXBseSBjYWxscyAgKi8KKy8qIHRoZSBkcml2ZXIgaW5pdGlhbGlzYXRpb24gZnVuY3Rpb24gYW5kIHJldHVybnMgd2hhdCBpdCByZXR1cm5zLiAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2lmZGVmIE1PRFVMRQoraW50Citpbml0X21vZHVsZSh2b2lkKQoreworI2lmZGVmIElQMkRFQlVHX0lOSVQKKwlwcmludGsgKEtFUk5fREVCVUcgIkxvYWRpbmcgbW9kdWxlIC4uLlxuIiApOworI2VuZGlmCisgICAgcmV0dXJuIDA7Cit9CisjZW5kaWYgLyogTU9EVUxFICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBjbGVhbnVwX21vZHVsZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogTm9uZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE5vdGhpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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9IGlwMl9pb2N0bCwKKwkudGhyb3R0bGUgICAgICAgID0gaXAyX3Rocm90dGxlLAorCS51bnRocm90dGxlICAgICAgPSBpcDJfdW50aHJvdHRsZSwKKwkuc2V0X3Rlcm1pb3MgICAgID0gaXAyX3NldF90ZXJtaW9zLAorCS5zZXRfbGRpc2MgICAgICAgPSBpcDJfc2V0X2xpbmVfZGlzY2lwbGluZSwKKwkuc3RvcCAgICAgICAgICAgID0gaXAyX3N0b3AsCisJLnN0YXJ0ICAgICAgICAgICA9IGlwMl9zdGFydCwKKwkuaGFuZ3VwICAgICAgICAgID0gaXAyX2hhbmd1cCwKKwkucmVhZF9wcm9jICAgICAgID0gaXAyX3JlYWRfcHJvYywKKwkudGlvY21nZXQJID0gaXAyX3Rpb2NtZ2V0LAorCS50aW9jbXNldAkgPSBpcDJfdGlvY21zZXQsCit9OworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX2xvYWRtYWluKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IGlycSwgaW8gZnJvbSBjb21tYW5kIGxpbmUgb2YgaW5zbW9kIGV0LiBhbC4gICAgICAgICAgICAgICAgICAgICovCisvKgkJcG9pbnRlciB0byBmaXAgZmlybXdhcmUgYW5kIGZpcm13YXJlIHNpemUgZm9yIGJvYXJkcwkgICAgICAqLworLyogUmV0dXJuczogICAgU3VjY2VzcyAoMCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhpcyB3YXMgdGhlIHJlcXVpcmVkIGVudHJ5IHBvaW50IGZvciBhbGwgZHJpdmVycyAobm93IGluIGlwMi5jKSAgICAgICAgICAgKi8KKy8qIEl0IHBlcmZvcm1zIGFsbCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBpbml0aWFsaXNhdGlvbiBvZiB0aGUgZGV2aWNlcyBhbmQgZHJpdmVyIHN0cnVjdHVyZXMsIGFuZCByZWdpc3RlcnMgaXRzZWxmICAqLworLyogd2l0aCB0aGUgcmVsZXZhbnQga2VybmVsIG1vZHVsZXMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBTQV9JTlRFUlJVUFQtIGlmIHNldCBibG9ja3MgYWxsIGludGVycnVwdHMgZWxzZSBvbmx5IHRoaXMgbGluZSAqLworLyogU0FfU0hJUlEgICAgLSBmb3Igc2hhcmVkIGlycSBQQ0kgb3IgbWF5YmUgRUlTQSBvbmx5ICovCisvKiBTQV9SQU5ET00gICAtIGNhbiBiZSBzb3VyY2UgZm9yIGNlcnQuIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9ycyAqLworI2RlZmluZSBJUDJfU0FfRkxBR1MJMAorCitpbnQKK2lwMl9sb2FkbWFpbihpbnQgKmlvcCwgaW50ICppcnFwLCB1bnNpZ25lZCBjaGFyICpmaXJtd2FyZSwgaW50IGZpcm1zaXplKSAKK3sKKwlpbnQgaSwgaiwgYm94OworCWludCBlcnIgPSAwOworCWludCBzdGF0dXMgPSAwOworCXN0YXRpYyBpbnQgbG9hZGVkOworCWkyZUJvcmRTdHJQdHIgcEIgPSBOVUxMOworCWludCByYyA9IC0xOworCisJaXAydHJhY2UgKEl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X0lOSVQsIElUUkNfUkVUVVJOLCAwICk7CisJZ290byBvdXQ7CisKK291dF9jbGFzczoKKwljbGFzc19zaW1wbGVfZGVzdHJveShpcDJfY2xhc3MpOworb3V0X2NocmRldjoKKwl1bnJlZ2lzdGVyX2NocmRldihJUDJfSVBMX01BSk9SLCAiaXAyIik7CitvdXQ6CisJcmV0dXJuIGVycjsKK30KKworRVhQT1JUX1NZTUJPTChpcDJfbG9hZG1haW4pOworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX2luaXRfYm9hcmQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IEluZGV4IG9mIGJvYXJkIGluIGNvbmZpZ3VyYXRpb24gc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBTdWNjZXNzICgwKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGlzIGZ1bmN0aW9uIGluaXRpYWxpemVzIHRoZSBzcGVjaWZpZWQgYm9hcmQuIFRoZSBsb2Fkd2FyZSBpcyBjb3BpZWQgdG8gICAqLworLyogdGhlIGJvYXJkLCB0aGUgY2hhbm5lbCBzdHJ1Y3R1cmVzIGFyZSBpbml0aWFsaXplZCwgYW5kIHRoZSBib2FyZCBkZXRhaWxzICAgKi8KKy8qIGFyZSByZXBvcnRlZCBvbiB0aGUgY29uc29sZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgX19pbml0CitpcDJfaW5pdF9ib2FyZCggaW50IGJvYXJkbnVtICkKK3sKKwlpbnQgaTsKKwlpbnQgbnBvcnRzID0gMCwgbmJveGVzID0gMDsKKwlpMkNoYW5TdHJQdHIgcENoOworCWkyZUJvcmRTdHJQdHIgcEIgPSBpMkJvYXJkUHRyVGFibGVbYm9hcmRudW1dOworCisJaWYgKCAhaWlJbml0aWFsaXplICggcEIgKSApIHsKKwkJcHJpbnRrICggS0VSTl9FUlIgIklQMjogRmFpbGVkIHRvIGluaXRpYWxpemUgYm9hcmQgYXQgMHgleCwgZXJyb3IgJWRcbiIsCisJCQkgcEItPmkyZUJhc2UsIHBCLT5pMmVFcnJvciApOworCQlnb3RvIGVycl9pbml0aWFsaXplOworCX0KKwlwcmludGsoS0VSTl9JTkZPICJJUDI6IEJvYXJkICVkOiBhZGRyPTB4JXggaXJxPSVkXG4iLCBib2FyZG51bSArIDEsCisJICAgICAgIGlwMmNvbmZpZy5hZGRyW2JvYXJkbnVtXSwgaXAyY29uZmlnLmlycVtib2FyZG51bV0gKTsKKworCWlmICghcmVxdWVzdF9yZWdpb24oIGlwMmNvbmZpZy5hZGRyW2JvYXJkbnVtXSwgOCwgcGNOYW1lICkpIHsKKwkJcHJpbnRrKEtFUk5fRVJSICJJUDI6IGJhZCBhZGRyPTB4JXhcbiIsIGlwMmNvbmZpZy5hZGRyW2JvYXJkbnVtXSk7CisJCWdvdG8gZXJyX2luaXRpYWxpemU7CisJfQorCisJaWYgKCBpaURvd25sb2FkQWxsICggcEIsIChsb2FkSGRyU3RyUHRyKUZpcF9maXJtd2FyZSwgMSwgRmlwX2Zpcm13YXJlX3NpemUgKQorCSAgICAhPSBJSV9ET1dOX0dPT0QgKSB7C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iAlZFxuIixwQi0+aTJlRXJyb3IpOworCQlrZnJlZSAoIHBDaCApOworCQlnb3RvIGVycl9yZWxlYXNlX3JlZ2lvbjsKKwl9CisJcEItPmkyZUNoYW5uZWxQdHIgPSAmRGV2VGFibGVbSVAyX1BPUlRTX1BFUl9CT0FSRCAqIGJvYXJkbnVtXTsKKworCWZvciggaSA9IDA7IGkgPCBwQi0+aTJlQ2hhbm5lbENudDsgKytpICkgeworCQlEZXZUYWJsZVtJUDJfUE9SVFNfUEVSX0JPQVJEICogYm9hcmRudW0gKyBpXSA9IHBDaDsKKwkJcENoLT5wb3J0X2luZGV4ID0gKElQMl9QT1JUU19QRVJfQk9BUkQgKiBib2FyZG51bSkgKyBpOworCQlwQ2grKzsKKwl9CitleF9leGl0OgorCUlOSVRfV09SSygmcEItPnRxdWV1ZV9pbnRlcnJ1cHQsICh2b2lkKCopKHZvaWQqKSkgaXAyX2ludGVycnVwdF9iaCwgcEIpOworCXJldHVybjsKKworZXJyX3JlbGVhc2VfcmVnaW9uOgorCXJlbGVhc2VfcmVnaW9uKGlwMmNvbmZpZy5hZGRyW2JvYXJkbnVtXSwgOCk7CitlcnJfaW5pdGlhbGl6ZToKKwlrZnJlZSAoIHBCICk7CisJaTJCb2FyZFB0clRhYmxlW2JvYXJkbnVtXSA9IE5VTEw7CisJcmV0dXJuOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgZmluZF9laXNhX2JvYXJkICggaW50IHN0YXJ0X3Nsb3QgKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IEZpcnN0IHNsb3QgdG8gY2hlY2sgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBBZGRyZXNzIG9mIEVJU0EgSW50ZWxsaVBvcnQgSUkgY29udHJvbGxlciAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBUaGlzIGZ1bmN0aW9uIHNlYXJjaGVzIGZvciBhbiBFSVNBIEludGVsbGlQb3J0IGNvbnRyb2xsZXIsIHN0YXJ0aW5nICAgICAgICAqLworLyogZnJvbSB0aGUgc3BlY2lmaWVkIHNsb3QgbnVtYmVyLiBJZiB0aGUgbW90aGVyYm9hcmQgaXMgbm90IGlkZW50aWZpZWQgYXMgYW4gKi8KKy8qIEVJU0EgbW90aGVyYm9hcmQsIG9yIG5vIHZhbGlkIGJvYXJkIElEIGlzIHNlbGVjdGVkIGl0IHJldHVybnMgMC4gT3RoZXJ3aXNlICovCisvKiBpdCByZXR1cm5zIHRoZSBiYXNlIGFkZHJlc3Mgb2YgdGhlIGNvbnRyb2xsZXIuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB1bnNpZ25lZCBzaG9ydCBfX2luaXQKK2ZpbmRfZWlzYV9ib2FyZCggaW50IHN0YXJ0X3Nsb3QgKQoreworCWludCBpLCBqOworCXVuc2lnbmVkIGludCBpZG0gPSAwOworCXVuc2lnbmVkIGludCBpZHAgPSAwOworCXVuc2lnbmVkIGludCBiYXNlID0gMDsKKwl1bnNpZ25lZCBpbnQgdmFsdWU7CisJaW50IHNldHVwX2FkZHJlc3M7CisJaW50IHNldHVwX2lycTsKKwlpbnQgaXNtaW5lID0gMDsKKworCS8qCisJICogRmlyc3QgYSBjaGVjayBmb3IgYW4gRUlTQS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CBJLkQuIDB4JXgleCwgQWRkcmVzcyAweCV4IiwKKwkgICAgICAgYmFzZSA+PiAxMiwgaWRtLCBpZHAsIHNldHVwX2FkZHJlc3MpOworCWlmICggRWlzYV9pcnEgKSB7CisJCXByaW50ayhLRVJOX0RFQlVHICIsIEludGVycnVwdCAlZCAlc1xuIiwKKwkJICAgICAgIHNldHVwX2lycSwgKGlzbWluZSAmIDIpID8gIihlZGdlKSIgOiAiKGxldmVsKSIpOworCX0gZWxzZSB7CisJCXByaW50ayhLRVJOX0RFQlVHICIsIChwb2xsZWQpXG4iKTsKKwl9CisjZW5kaWYKKwlyZXR1cm4gc2V0dXBfYWRkcmVzczsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIHNldF9pcnEoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiBpbmRleCB0byBib2FyZCBpbiBib2FyZCB0YWJsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgSVJRIHRvIHVzZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIFN1Y2Nlc3MgKDApICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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Q0tfSVJRUkVTVE9SRSgmcEItPndyaXRlX2ZpZm9fc3BpbmxvY2ssZmxhZ3MpOworI2VuZGlmCisKKwlpaUVuYWJsZU1haWxJcnEocEIpOworCWlpU2VuZFBlbmRpbmdNYWlsKHBCKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEludGVycnVwdCBIYW5kbGVyIFNlY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgaW5saW5lIHZvaWQKK3NlcnZpY2VfYWxsX2JvYXJkcyh2b2lkKQoreworCWludCBpOworCWkyZUJvcmRTdHJQdHIgIHBCOworCisJLyogU2VydmljZSBldmVyeSBib2FyZCBvbiB0aGUgbGlzdCAqLworCWZvciggaSA9IDA7IGkgPCBJUDJfTUFYX0JPQVJEUzsgKytpICkgeworCQlwQiA9IGkyQm9hcmRQdHJUYWJsZVtpXTsKKwkJaWYgKCBwQiApIHsKKwkJCWkyU2VydmljZUJvYXJkKCBwQiApOworCQl9CisJfQorfQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfaW50ZXJydXB0X2JoKHBCKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogcEIgLSBwb2ludGVyIHRvIHRoZSBib2FyZCBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE5vdGhpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qCVNlcnZpY2UgdGhlIGJvYXJkIGluIGEgYm90dG9tIGhhbGYgaW50ZXJydXB0IGhhbmRsZXIgYW5kIHRoZW4gICAgICAgICAqLworLyoJcmVlbmFibGUgdGhlIGJvYXJkJ3MgaW50ZXJydXB0cyBpZiBpdCBoYXMgYW4gSVJRIG51bWJlciAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkCitpcDJfaW50ZXJydXB0X2JoKGkyZUJvcmRTdHJQdHIgcEIpCit7CisvLwlwQiBiZXR0ZXIgd2VsbCBiZSBzZXQgb3Igd2UgaGF2ZSBhIHByb2JsZW0hICBXZSBjYW4gb25seSBnZXQKKy8vCWhlcmUgZnJvbSB0aGUgSU1NRURJQVRFIHF1ZXVlLiAgSGVyZSwgd2UgcHJvY2VzcyB0aGUgYm9hcmRzLgorLy8JQ2hlY2tpbmcgcEIgZG9lc24ndCBjb3N0IG11Y2ggYW5kIGl0IHNhdmVzIHVzIGZyb20gdGhlIHNhbml0eSBjaGVja2Vycy4KKworCWJoX2NvdW50ZXIrKzsgCisKKwlpZiAoIHBCICkgeworCQlpMlNlcnZpY2VCb2FyZCggcEIgKTsKKwkJaWYoIHBCLT5pMmVVc2luZ0lycSApIHsKKy8vCQkJUmUtZW5hYmxlIGhpcyBpbnRlcnJ1cHRzCisJCQlpaUVuYWJsZU1haWxJcnEocEIpOworCQl9CisJfQorfQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfaW50ZXJydXB0KGludCBpcnEsIHZvaWQgKmRldl9pZCwgc3RydWN0IHB0X3JlZ3MgKiByZWdzKSAgICAqLworLyogUGFyYW1ldGVyczogaXJxIC0gaW50ZXJydXB0IG51bWJlciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIHBvaW50ZXIgdG8gb3B0aW9uYWwgZGV2aWNlIElEIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBwb2ludGVyIHRvIHJlZ2lzdGVyIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qCU91ciB0YXNrIGhlcmUgaXMgc2ltcGx5IHRvIGlkZW50aWZ5IGVhY2ggYm9hcmQgd2hpY2ggbmVlZHMgc2VydmljaW5nLiAqLworLyoJSWYgd2UgYXJlIHF1ZXVpbmcgdGhlbiwgcXVldWUgaXQgdG8gYmUgc2VydmljZWQsIGFuZCBkaXNhYmxlIGl0cyBpcnEgICovCisvKgltYXNrIG90aGVyd2lzZSBwcm9jZXNzIHRoZSBib2FyZCBkaXJlY3RseS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKglXZSBjb3VsZCBxdWV1ZSBieSBJUlEgYnV0IHRoYXQganVzdCBjb21wbGljYXRlcyB0aGluZ3Mgb24gYm90aCBlbmRzICAgKi8KKy8qCXdpdGggdmVyeSBsaXR0bGUgZ2FpbiBpbiBwZXJmb3JtYW5jZSAoaG93IG1hbnkgaW5zdHJ1Y3Rpb25zIGRvZXMgICAgICAqLworLyoJaXQgdGFrZSB0byBpdGVyYXRlIG9uIHRoZSBpbW1lZGlhdGUgcXVldWUpLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgaXJxcmV0dXJuX3QKK2lwMl9pbnRlcnJ1cHQoaW50IGlycSwgdm9pZCAqZGV2X2lkLCBzdHJ1Y3QgcHRfcmVncyAqIHJlZ3MpCit7CisJaW50IGk7CisJaTJlQm9yZFN0clB0ciAgcEI7CisJaW50IGhhbmRsZWQgPSAwOworCisJaXAydHJhY2UgKElUUkNfTk9fUE9SVCwgSVRSQ19JTlRSLCA5OSwgMSwgaXJxICk7CisKKwkvKiBTZXJ2aWNlIGp1c3QgdGhlIGJvYXJkcyBvbiB0aGUgbGlzdCB1c2luZyB0aGlz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luZ01haWwgY291bGQgYWxzbyB0aHJvdyBhIGhhaXJiYWxsLgorCQkJaTJTZXJ2aWNlQm9hcmQoIHBCICk7CisjZW5kaWYgLyogVVNFX0lRSSAqLworCQl9CisJfQorCisJKytpcnFfY291bnRlcjsKKworCWlwMnRyYWNlIChJVFJDX05PX1BPUlQsIElUUkNfSU5UUiwgSVRSQ19SRVRVUk4sIDAgKTsKKwlyZXR1cm4gSVJRX1JFVFZBTChoYW5kbGVkKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGlwMl9wb2xsKHVuc2lnbmVkIGxvbmcgYXJnKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiA/ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhpcyBmdW5jdGlvbiBjYWxscyB0aGUgbGlicmFyeSByb3V0aW5lIGkyU2VydmljZUJvYXJkIGZvciBlYWNoIGJvYXJkIGluICAgKi8KKy8qIHRoZSBib2FyZCB0YWJsZS4gVGhpcyBpcyB1c2VkIGluc3RlYWQgb2YgdGhlIGludGVycnVwdCByb3V0aW5lIHdoZW4gcG9sbGVkICovCisvKiBtb2RlIGlzIHNwZWNpZmllZC4gICAgICAgICAgICAgICAgICAgICAgICAg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KioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIERldmljZSBPcGVuL0Nsb3NlL0lvY3RsIEVudHJ5IFBvaW50IFNlY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgb3Blbl9zYW5pdHlfY2hlY2soKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gdHR5IHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGZpbGUgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgU3VjY2VzcyBvciBmYWlsdXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVmVyaWZpZXMgdGhlIHN0cnVjdHVyZSBtYWdpYyBudW1iZXJzIGFuZCBjcm9zcyBsaW5rcy4gICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaWZkZWYgSVAyREVCVUdfT1BFTgorc3RhdGljIHZvaWQgCitvcGVuX3Nhbml0eV9jaGVjayggaTJDaGFuU3RyUHRyIHBDaCwgaTJlQm9yZFN0clB0ciBwQnJkICkKK3sKKwlpZiAoIHBCcmQtPmkyZVZhbGlkICE9IEkyRV9NQUdJQyApIHsKKwkJcHJpbnRrKEtFUk5fRVJSICJJUDI6IGludmFsaWQgYm9hcmQgc3RydWN0dXJlXG4iICk7CisJfSBlbHNlIGlmICggcEJyZCAhPSBwQ2gtPnBNeUJvcmQgKSB7CisJCXByaW50ayhLRVJOX0VSUiAiSVAyOiBib2FyZCBzdHJ1Y3R1cmUgcG9pbnRlciBtaXNtYXRjaCAoJXApXG4iLAorCQkJIHBDaC0+cE15Qm9yZCApOworCX0gZWxzZSBpZiAoIHBCcmQtPmkyZUNoYW5uZWxDbnQgPCBwQ2gtPnBvcnRfaW5kZXggKSB7CisJCXByaW50ayhLRVJOX0VSUiAiSVAyOiBiYWQgZGV2aWNlIGluZGV4ICglZClcbiIsIHBDaC0+cG9ydF9pbmRleCApOworCX0gZWxzZSBpZiAoJigoaTJDaGFuU3RyUHRyKXBCcmQtPmkyZUNoYW5uZWxQdHIpW3BDaC0+cG9ydF9pbmRleF0gIT0gcENoKSB7CisJfSBlbHNlIHsKKwkJcHJpbnRrKEtFUk5fSU5GTyAiSVAyOiBhbGwgcG9pbnRlcnMgY2hlY2sgb3V0IVxuIiApOworCX0KK30KKyNlbmRpZgorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfb3BlbigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byB0dHkgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIFBvaW50ZXIgdG8gZmlsZSBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBTdWNjZXNzIG9yIGZhaWx1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAoTUFOREFUT1JZKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBBIHN1Y2Nlc3NmdWwgZGV2aWNlIG9wZW4gaGFzIHRvIHJ1biBhIGdhdW50bGV0IG9mIGNoZWNrcyBiZWZvcmUgaXQgICAgICAgICAqLworLyogY29tcGxldGVzLiBBZnRlciBzb21lIHNhbml0eSBjaGVja2luZyBhbmQgcG9pbnRlciBzZXR1cCwgdGhlIGZ1bmN0aW9uICAgICAgKi8KKy8qIGJsb2NrcyB1bnRpbCBhbGwgY29uZGl0aW9ucyBhcmUgc2F0aXNmaWVkLiBJdCB0aGVuIGluaXRpYWxpc2VzIHRoZSBwb3J0IHRvICovCisvKiB0aGUgZGVmYXVsdCBjaGFyYWN0ZXJpc3RpY3MgYW5kIHJldHVybnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQKK2lwMl9vcGVuKCBQVFRZIHR0eSwgc3RydWN0IGZpbGUgKnBGaWxlICkKK3sKKwl3YWl0X3F1ZXVlX3Qgd2FpdDsKKwlpbnQgcmMgPSAwOworCWludCBkb19jbG9jYWwgPSAwOworCWkyQ2hhblN0clB0ciAgcENoID0gRGV2VGFibGVbdHR5LT5pbmRleF07CisKKwlpcDJ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FCKTsKKwkJLyogTm93IHdlIG11c3Qgc2VuZCB0aGUgdGVybWlvcyBzZXR0aW5ncyB0byB0aGUgbG9hZHdhcmUgKi8KKwkJc2V0X3BhcmFtcyggcENoLCBOVUxMICk7CisJfQorCisJLyoKKwkgKiBOb3cgc2V0IGFueSBpMmxpYiBvcHRpb25zLiBUaGVzZSBtYXkgZ28gYXdheSBpZiB0aGUgaTJsaWIgY29kZSBlbmRzCisJICogdXAgcm9sbGVkIGludG8gdGhlIG1haW5saW5lLgorCSAqLworCXBDaC0+Y2hhbm5lbE9wdGlvbnMgfD0gQ09fTkJMT0NLX1dSSVRFOworCisjaWZkZWYgSVAyREVCVUdfT1BFTgorCXByaW50ayAoS0VSTl9ERUJVRyAiSVAyOiBvcGVuIGNvbXBsZXRlZFxuIiApOworI2VuZGlmCisJc2VydmljZU91dGdvaW5nRmlmbyggcENoLT5wTXlCb3JkICk7CisKKwlpcDJ0cmFjZSAoQ0hBTk4sIElUUkNfT1BFTiwgSVRSQ19SRVRVUk4sIDAgKTsKKworCXJldHVybiAwOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX2Nsb3NlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gdHR5IHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGZpbGUgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQKK2lwMl9jbG9zZSggUFRUWSB0dHksIHN0cnVjdCBmaWxlICpwRmlsZSApCit7CisJaTJDaGFuU3RyUHRyICBwQ2ggPSB0dHktPmRyaXZlcl9kYXRhOworCisJaWYgKCAhcENoICkgeworCQlyZXR1cm47CisJfQorCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX0NMT1NFLCBJVFJDX0VOVEVSLCAwICk7CisKKyNpZmRlZiBJUDJERUJVR19PUEVOCisJcHJpbnRrKEtFUk5fREVCVUcgIklQMjpjbG9zZSAlczpcbiIsdHR5LT5uYW1lKTsKKyNlbmRpZgorCisJaWYgKCB0dHlfaHVuZ191cF9wICggcEZpbGUgKSApIHsKKworCQlpcDJ0cmFjZSAoQ0hBTk4sIElUUkNfQ0xPU0UsIDIsIDEsIDIgKTsKKworCQlyZXR1cm47CisJfQorCWlmICggdHR5LT5jb3VudCA+IDEgKSB7IC8qIG5vdCB0aGUgbGFzdCBjbG9zZSAqLworCisJCWlwMnRyYWNlIChDSEFOTiwgSVRSQ19DTE9TRSwgMiwgMSwgMyApOworCisJCXJldHVybjsKKwl9CisJcENoLT5mbGFncyB8PSBBU1lOQ19DTE9TSU5HOwkvLyBsYXN0IGNsb3NlIGFjdH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ICBpcDJfaGFuZ3VwKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byB0dHkgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE5vdGhpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkCitpcDJfaGFuZ3VwICggUFRUWSB0dHkgKQoreworCWkyQ2hhblN0clB0ciAgcENoID0gdHR5LT5kcml2ZXJfZGF0YTsKKworCWlmKCAhcENoICkgeworCQlyZXR1cm47CisJfQorCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX0hBTkdVUCwgSVRSQ19FTlRFUiwgMCApOworCisJaXAyX2ZsdXNoX2J1ZmZlcih0dHkpOworCisJLyogZGlzYWJsZSBEU1MgcmVwb3J0aW5nICovCisKKwlpMlF1ZXVlQ29tbWFuZHMoUFRZUEVfQllQQVNTLCBwQ2gsIDAsIDEsIENNRF9EQ0RfTlJFUCk7CisJaTJRdWV1ZUNvbW1hbmRzKFBUWVBFX0lOTElORSwgcENoLCAwLCAyLCBDTURfQ1RTRkxfRFNBQiwgQ01EX1JUU0ZMX0RTQUIpOworCWlmICggKHR0eS0+dGVybWlvcy0+Y19jZmxhZyAmIEhVUENMKSApIHsKKwkJaTJRdWV1ZUNvbW1hbmRzKFBUWVBFX0JZUEFTUywgcENoLCAwLCAyLCBDTURfUlRTRE4sIENNRF9EVFJETik7CisJCXBDaC0+ZGF0YVNldE91dCAmPSB+KEkyX0RUUiB8IEkyX1JUUyk7CisJCWkyUXVldWVDb21tYW5kcyggUFRZUEVfSU5MSU5FLCBwQ2gsIDEwMCwgMSwgQ01EX1BBVVNFKDI1KSk7CisJfQorCWkyUXVldWVDb21tYW5kcyhQVFlQRV9JTkxJTkUsIHBDaCwgMSwgMywgCisJCQkJQ01EX0NUU19OUkVQLCBDTURfRFNSX05SRVAsIENNRF9SSV9OUkVQKTsKKwlzZXJ2aWNlT3V0Z29pbmdGaWZvICggcENoLT5wTXlCb3JkICk7CisKKwl3YWtlX3VwX2ludGVycnVwdGlibGUgKCAmcENoLT5kZWx0YV9tc3Jfd2FpdCApOworCisJcENoLT5mbGFncyAmPSB+QVNZTkNfTk9STUFMX0FDVElWRTsKKwlwQ2gtPnBUVFkgPSBOVUxMOworCXdha2VfdXBfaW50ZXJydXB0aWJsZSAoICZwQ2gtPm9wZW5fd2FpdCApOworCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX0hBTkdVUCwgSVRSQ19SRVRVUk4sIDAgKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBEZXZpY2UgT3V0cHV0IFNlY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfd3JpdGUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byB0dHkgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIEZsYWcgZGVub3RpbmcgZGF0YSBpcyBpbiB1c2VyICgxKSBvciBrZXJuZWwgKDApIHNwYWNlICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGRhdGEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgTnVtYmVyIG9mIGJ5dGVzIHRvIHdyaXRlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE51bWJlciBvZiBieXRlcyBhY3R1YWxseSB3cml0dGVuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246IChNQU5EQVRPUlkpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQKK2lwMl93cml0ZSggUFRUWSB0dHksIGludCB1c2VyLCBjb25zdCB1bnNpZ25lZCBjaGFyICpwRGF0YSwgaW50IGNvdW50KQoreworCWkyQ2hhblN0clB0ciAgcENoID0gdHR5LT5kcml2ZXJfZGF0YTsKKwlpbnQgYnl0ZXNTZW50ID0gMDsKKwl1bnNpZ25lZCBsb25nIGZsYWdzOworCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX1dSSVRFLCBJVFJDX0VOVEVSLCAyLCBjb3VudCwgLTEgKTsKKworCS8qIEZsdXNoIG91dCBhbnkgYnVmZmVyZWQgZGF0YSBsZWZ0IG92ZXIgZnJvbSBpcDJfcHV0Y2hhcigpIGNhbGxzLiAqLworCWlwMl9mbHVzaF9jaGFycyggdHR5ICk7CisKKwkvKiBUaGlzIGlzIHRoZSBhY3R1YWwgbW92ZSBiaXQuIE1ha2Ugc3VyZSBpdCBkb2VzIHdoYXQgd2UgbmVlZCEhISEhICovCisJV1JJVEVfTE9DS19JUlFTQVZFKCZwQ2gtPlBidWZfc3BpbmxvY2ssZmxhZ3MpOworCWJ5dGVzU2VudCA9IGkyT3V0cHV0KCBwQ2gsIHBEYXRhLCBjb3VudCwgdXNlciApOworCVdSSVRFX1VOTE9DS19JUlFSRVNUT1JFKCZwQ2gtPlBidWZfc3BpbmxvY2ssZmxhZ3MpOworCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX1dSSVRFLCBJVFJDX1JFVFVSTiwgMSwgYnl0ZXNTZW50ICk7CisKKwlyZXR1cm4gYnl0ZXNTZW50ID4gMCA/IGJ5dGVzU2VudCA6IDA7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfcHV0Y2hhcigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byB0dHkgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIENoYXJhY3RlciB0byB3cml0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBOb3RoaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgdm9pZAoraXAyX3B1dGNoYXIoIFBUVFkgdHR5LCB1bnNpZ25lZCBjaGFyIGNoICkKK3sKKwlpMkNoYW5TdHJQdHIgIHBDaCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworLy8JaXAydHJhY2UgKENIQU5OLCBJVFJDX1BVVEMsIElUUkNfRU5URVIsIDEsIGNoICk7CisKKwlXUklURV9MT0NLX0lSUVNBVkUoJnBDaC0+UGJ1Zl9zcGlubG9jayxmbGFncyk7CisJcENoLT5QYnVmW3BDaC0+UGJ1Zl9zdHVmZisrXSA9IGNoOworCWlmICggcENoLT5QYnVmX3N0dWZmID09IHNpemVvZiBwQ2gtPlBidWYgKSB7CisJCVdSSVRFX1VOTE9DS19JUlFSRVNUT1JFKCZwQ2gtPlBidWZfc3BpbmxvY2ssZmxhZ3MpOworCQlpcDJfZmx1c2hfY2hhcnMoIHR0eSApOworCX0gZWxzZQorCQlXUklURV9VTkxPQ0tfSVJRUkVTVE9SRSgmcENoLT5QYnVmX3NwaW5sb2NrLGZsYWdzKTsKKworLy8JaXAydHJhY2UgKENIQU5OLCBJVFJDX1BVVEMsIElUUkNfUkVUVVJOLCAxLCBjaCApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX2ZsdXNoX2NoYXJzKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gdHR5IHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBOb3RoaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkCitpcDJfZmx1c2hfY2hhcnMoIFBUVFkgdHR5ICkKK3sKKwlpbnQgICBzdHJpcDsKKwlpMkNoYW5TdHJQdHIgIHBDaCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworCVdSSVRFX0xPQ0tfSVJRU0FWRSgmcENoLT5QYnVmX3NwaW5sb2NrLGZsYWdzKTsKKwlpZiAoIHBDaC0+UGJ1Zl9zdHVmZiApIHsKKworLy8JCWlwMnRyYWNlIChDSEFOTiwgSVRSQ19QVVRDLCAxMCwgMSwgc3RyaXAgKTsKKworCQkvLworCQkvLyBXZSBtYXkgbmVlZCB0byByZXN0YXJ0IGkyT3V0cHV0IGlmIGl0IGRvZXMgbm90IGZ1bGxmaWxsIHRoaXMgcmVxdWVzdAorCQkvLworCQlzdHJpcCA9IGkyT3V0cHV0KCBwQ2gsIHBDaC0+UGJ1ZiwgcENoLT5QYnVmX3N0dWZmLCAwICk7CisJCWlmICggc3RyaXAgIT0gcENoLT5QYnVmX3N0dWZmICkgeworCQkJbWVtbW92ZSggcENoLT5QYnVmLCAmcENoLT5QYnVmW3N0cmlwXSwgcENoLT5QYnVmX3N0dWZmIC0gc3RyaXAgKTsKKwkJfQorCQlwQ2gtPlBidWZfc3R1ZmYgLT0gc3RyaXA7CisJfQorCVdSSVRFX1VOTE9DS19JUlFSRVNUT1JFKCZwQ2gtPlBidWZfc3BpbmxvY2ssZmxhZ3MpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX3dyaXRlX3Jvb20oKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gdHR5IHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBOdW1iZXIgb2YgYnl0ZXMgdGhhdCB0aGUgZHJpdmVyIGNhbiBhY2NlcHQgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQKK2lwMl93cml0ZV9yb29tICggUFRUWSB0dHkgKQoreworCWludCBieXRlc0ZyZWU7CisJaTJDaGFuU3RyUHRyICBwQ2ggPSB0dHktPmRyaXZlcl9kYXRhOworCXVuc2lnbmVkIGxvbmcgZmxhZ3M7CisKKwlSRUFEX0xPQ0tfSVJRU0FWRSgmcENoLT5QYnVmX3NwaW5sb2NrLGZsYWdzKTsKKwlieXRlc0ZyZWUgPSBpMk91dHB1dEZyZWUoIHBDaCApIC0gcENoLT5QYnVmX3N0dWZmOworCVJFQURfVU5MT0NLX0lSUVJFU1RPUkUoJnBDaC0+UGJ1Zl9zcGlubG9jayxmbGFncyk7CisKKwlpcDJ0cmFjZSAoQ0hBTk4sIElUUkNfV1JJVEUsIDExLCAxLCBieXRlc0ZyZWUgKTsKKworCXJldHVybiAoKGJ5dGVzRnJlZSA+IDApID8gYnl0ZXNGcmVlIDogMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfY2hhcnNfaW5fYnVmKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byB0dHkgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE51bWJlciBvZiBieXRlcyBxdWV1ZWQgZm9yIHRyYW5zbWlzc2lvbiAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQKK2lwMl9jaGFyc19pbl9idWYgKCBQVFRZIHR0eSApCit7CisJaTJDaGFuU3RyUHRyICBwQ2ggPSB0dHktPmRyaXZlcl9kYXRhOworCWludCByYzsKKwl1bnNpZ25lZCBsb25nIGZsYWdzOworCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX1dSSVRFLCAxMiwgMSwgcENoLT5PYnVmX2NoYXJfY291bnQgKyBwQ2gtPlBidWZfc3R1ZmYgKTsKKworI2lmZGVmIElQMkRFQlVHX1dSSVRFCisJcHJpbnRrIChLRVJOX0RFQlVHICJJUDI6IGNoYXJzIGluIGJ1ZmZlciA9ICVkICglZCwlZClcbiIsCisJCQkJIHBDaC0+T2J1Zl9jaGFyX2NvdW50ICsgcENoLT5QYnVmX3N0dWZmLAorCQkJCSBwQ2gtPk9idWZfY2hhcl9jb3VudCwgcENoLT5QYnVmX3N0dWZmICk7CisjZW5kaWYKKwlSRUFEX0xPQ0tfSVJRU0FWRSgmcENoLT5PYnVmX3NwaW5sb2NrLGZsYWdzKTsKKwlyYyA9ICBwQ2gtPk9idWZfY2hhcl9jb3VudDsKKwlSRUFEX1VOTE9DS19JUlFSRVNUT1JFKCZwQ2gtPk9idWZfc3BpbmxvY2ssZmxhZ3MpOworCVJFQURfTE9DS19JUlFTQVZFKCZwQ2gtPlBidWZfc3BpbmxvY2ssZmxhZ3MpOworCXJjICs9ICBwQ2gtPlBidWZfc3R1ZmY7CisJUkVBRF9VTkxPQ0tfSVJRUkVTVE9SRSgmcENoLT5QYnVmX3NwaW5sb2NrLGZsYWdzKTsKKwlyZXR1cm4gcmM7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfZmx1c2hfYnVmZmVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byB0dHkgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE5vdGhpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkCitpcDJfZmx1c2hfYnVmZmVyKCBQVFRZIHR0eSApCit7CisJaTJDaGFuU3RyUHRyICBwQ2ggPSB0dHktPmRyaXZlcl9kYXRhOworCXVuc2lnbmVkIGxvbmcgZmxhZ3M7CisKKwlpcDJ0cmFjZSAoQ0hBTk4sIElUUkNfRkxVU0gsIElUUkNfRU5URVIsIDAgKTsKKworI2lmZGVmIElQMkRFQlVHX1dSSVRFCisJcHJpbnRrIChLRVJOX0RFQlVHICJJUDI6IGZsdXNoIGJ1ZmZlclxuIiApOworI2VuZGlmCisJV1JJVEVfTE9DS19JUlFTQVZFKCZwQ2gtPlBidWZfc3BpbmxvY2ssZmxhZ3MpOworCXBDaC0+UGJ1Zl9zdHVmZiA9IDA7CisJV1JJVEVfVU5MT0NLX0lSUVJFU1RPUkUoJnBDaC0+UGJ1Zl9zcGlubG9jayxmbGFncyk7CisJaTJGbHVzaE91dHB1dCggcENoICk7CisJaXAyX293YWtlKHR0eSk7CisKKwlpcDJ0cmFjZSAoQ0hBTk4sIElUUkNfRkxVU0gsIElUUkNfUkVUVVJOLCAwICk7CisKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGlwMl93YWl0X3VudGlsX3NlbnQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIHR0eSBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgVGltZW91dCBmb3Igd2FpdC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE5vdGhpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBpbiBwbGFjZSBvZiB0aGUgbm9ybWFsIHR0eV93YWl0X3VudGlsX3NlbnQsIHdoaWNoICAgICovCisvKiBvbmx5IHdhaXRzIGZvciB0aGUgZHJpdmVyIGJ1ZmZlcnMgdG8gYmUgZW1wdHkgKG9yIHJhdGhlciwgdGhvc2UgYnVmZmVycyAgICAqLworLyogcmVwb3J0ZWQgYnkgY2hhcnNfaW5fYnVmZmVyKSB3aGljaCBkb2Vzbid0IHdvcmsgZm9yIElQMiBkdWUgdG8gdGhlICAgICAgICAgKi8KKy8qIGluZGV0ZXJtaW5hdGUgbnVtYmVyIG9mIGJ5dGVzIGJ1ZmZlcmVkIG9uIHRoZSBib2FyZC4gICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQKK2lwMl93YWl0X3VudGlsX3NlbnQgKCBQVFRZIHR0eSwgaW50IHRpbWVvdXQgKQoreworCWludCBpID0gamlmZmllczsKKwlpMkNoYW5TdHJQdHIgIHBDaCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisKKwl0dHlfd2FpdF91bnRpbF9zZW50KHR0eSwgdGltZW91dCApOworCWlmICggKGkgPSB0aW1lb3V0IC0gKGppZmZpZXMgLWkpKSA+IDApCisJCWkyRHJhaW5PdXRwdXQoIHBDaCwgaSApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIERldmljZSBJbnB1dCBTZWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGlwMl90aHJvdHRsZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIHR0eSBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQKK2lwMl90aHJvdHRsZSAoIFBUVFkgdHR5ICkKK3sKKwlpMkNoYW5TdHJQdHIgIHBDaCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisKKyNpZmRlZiBJUDJERUJVR19SRUFECisJcHJpbnRrIChLRVJOX0RFQlVHICJJUDI6IHRocm90dGxlXG4iICk7CisjZW5kaWYKKwkvKgorCSAqIFNpZ25hbCB0aGUgcG9sbC9pbnRlcnJ1cHQgaGFuZGxlcnMgbm90IHRvIGZvcndhcmQgaW5jb21pbmcgZGF0YSB0bworCSAqIHRoZSBsaW5lIGRpc2NpcGxpbmUuIFRoaXMgd2lsbCBjYXVzZSB0aGUgYnVmZmVycyB0byBmaWxsIHVwIGluIHRoZQorCSAqIGxpYnJhcnkgYW5kIHRodXMgY2F1c2UgdGhlIGxpYnJhcnkgcm91dGluZXMgdG8gc2VuZCB0aGUgZmxvdyBjb250cm9sCisJICogc3R1ZmYuCisJICovCisJcENoLT50aHJvdHRsZWQgPSAxOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX3VudGhyb3R0bGUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gdHR5IHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBOb3RoaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgdm9pZAoraXAyX3VudGhyb3R0bGUgKCBQVFRZIHR0eSApCit7CisJaTJDaGFuU3RyUHRyICBwQ2ggPSB0dHktPmRyaXZlcl9kYXRhOworCXVuc2lnbmVkIGxvbmcgZmxhZ3M7CisKKyNpZmRlZiBJUDJERUJVR19SRUFECisJcHJpbnRrIChLRVJOX0RFQlVHICJJUDI6IHVudGhyb3R0bGVcbiIgKTsKKyNlbmRpZgorC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cnQgdHhcbiIgKTsKKyNlbmRpZgorfQorCitzdGF0aWMgdm9pZAoraXAyX3N0b3AgKCBQVFRZIHR0eSApCit7CisgCWkyQ2hhblN0clB0ciAgcENoID0gRGV2VGFibGVbdHR5LT5pbmRleF07CisKKyAJaTJRdWV1ZUNvbW1hbmRzKFBUWVBFX0JZUEFTUywgcENoLCAxMDAsIDEsIENNRF9TVVNQRU5EKTsKKyNpZmRlZiBJUDJERUJVR19XUklURQorCXByaW50ayAoS0VSTl9ERUJVRyAiSVAyOiBzdG9wIHR4XG4iICk7CisjZW5kaWYKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIERldmljZSBJb2N0bCBTZWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgaW50IGlwMl90aW9jbWdldChzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5LCBzdHJ1Y3QgZmlsZSAqZmlsZSkKK3sKKwlpMkNoYW5TdHJQdHIgcENoID0gRGV2VGFibGVbdHR5LT5pbmRleF07CisJd2FpdF9xdWV1ZV90IHdhaXQ7CisKKwlpZiAocENoID09IE5VTEwpCisJCXJldHVybiAtRU5PREVWOworCisvKgorCUZJWE1FIC0gdGhlIGZvbGxvd2luZyBjb2RlIGlzIGNhdXNpbmcgYSBOVUxMIHBvaW50ZXIgZGVyZWZlcmVuY2UgaW4KKwkyLjMuNTEgaW4gYW4gaW50ZXJydXB0IGhhbmRsZXIuICBJdCdzIHN1cHBvc2UgdG8gcHJvbXB0IHRoZSBib2FyZAorCXRvIHJldHVybiB0aGUgRFNTIHNpZ25hbCBzdGF0dXMgaW1tZWRpYXRlbHkuICBXaHkg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bmdGaWZvKCBwQ2gtPnBNeUJvcmQgKTsKKwlyZXR1cm4gMDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGlwMl9pb2N0bCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIHR0eSBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgUG9pbnRlciB0byBmaWxlIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIENvbW1hbmQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBBcmd1bWVudCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgU3VjY2VzcyBvciBmYWlsdXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludAoraXAyX2lvY3RsICggUFRUWSB0dHksIHN0cnVjdCBmaWxlICpwRmlsZSwgVUlOVCBjbWQsIFVMT05HIGFyZyApCit7CisJd2FpdF9xdWV1ZV90IHdhaXQ7CisJaTJDaGFuU3RyUHRyIHBDaCA9IERldlRhYmxlW3R0eS0+aW5kZXhdOworCXN0cnVjdCBhc3luY19pY291bnQgY3ByZXYsIGNub3c7CS8qIGtlcm5lbCBjb3VudGVyIHRlbXBzICovCisJc3RydWN0IHNlcmlhbF9pY291bnRlcl9zdHJ1Y3QgX191c2VyICpwX2N1c2VyOworCWludCByYyA9IDA7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKwl2b2lkIF9fdXNlciAqYXJncCA9ICh2b2lkIF9fdXNlciAqKWFyZzsKKworCWlmICggcENoID09IE5VTEwgKSB7CisJCXJldHVybiAtRU5PREVWOworCX0KKworCWlwMnRyYWNlIChDSEFOTiwgSVRSQ19JT0NUTCwgSVRSQ19FTlRFUiwgMiwgY21kLCBhcmcgKTsKKworI2lmZGVmIElQMkRFQlVHX0lPQ1RMCisJcHJpbnRrKEtFUk5fREVCVUcgIklQMjogaW9jdGwgY21kICgleCksIGFyZyAoJWx4KVxuIiwgY21kLCBhcmcgKTsKKyNlbmRpZgorCisJc3dpdGNoKGNtZCkgeworCWNhc2UgVElPQ0dTRVJJQUw6CisKKwkJaXAydHJhY2UgKENIQU5OLCBJVFJDX0lPQ1RMLCAyLCAxLCByYyApOworCisJCXJjID0gZ2V0X3NlcmlhbF9pbmZvKHBDaCwgYXJncCk7CisJCWlmIChyYykKKwkJCXJldHVybiByYzsKKwkJYnJlYWs7CisKKwljYXNlIFRJT0NTU0VSSUFMOgorCisJCWlwMnRyYWNlIChDSEFOTiwgSVRSQ19JT0NUTCwgMywgMSwgcmMgKTsKKworCQlyYyA9IHNldF9zZXJpYWxfaW5mby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ZGVmYXVsdDoKKwkJaXAydHJhY2UgKENIQU5OLCBJVFJDX0lPQ1RMLCAxMiwgMCApOworCisJCXJjID0gIC1FTk9JT0NUTENNRDsKKwkJYnJlYWs7CisJfQorCisJaXAydHJhY2UgKENIQU5OLCBJVFJDX0lPQ1RMLCBJVFJDX1JFVFVSTiwgMCApOworCisJcmV0dXJuIHJjOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgR2V0U2VyaWFsSW5mbygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIG9sZCB0ZXJtaW9zIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhpcyBpcyB0byBzdXBwb3J0IHRoZSBzZXRzZXJpYWwgY29tbWFuZCwgYW5kIHJlcXVpcmVzIHByb2Nlc3Npbmcgb2YgdGhlICAgKi8KKy8qIHN0YW5kYXJkIExpbnV4IHNlcmlhbCBzdHJ1Y3R1cmUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKio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ioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgU2V0U2VyaWFsSW5mbygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIG9sZCB0ZXJtaW9zIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhpcyBmdW5jdGlvbiBwcm92aWRlcyBzdXBwb3J0IGZvciBzZXRzZXJpYWwsIHdoaWNoIHVzZXMgdGhlIFRJT0NTU0VSSUFMICAgKi8KKy8qIGlvY3RsLiBOb3QgYWxsIHNldHNlcmlhbCBwYXJhbWV0ZXJzIGFyZSByZWxldmFudC4gSWYgdGhlIHVzZXIgYXR0ZW1wdHMgdG8gICovCisvKiBjaGFuZ2UgdGhlIElSUSwgYWRkcmVzcyBvciB0eXBlIG9mIHRoZSBwb3J0IHRoZSBpb2N0bCBmYWlscy4gICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQKK3NldF9zZXJpYWxfaW5mbyggaTJDaGFuU3RyUHRyIHBDaCwgc3RydWN0IHNlcmlhbF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eSBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgUG9pbnRlciB0byBvbGQgdGVybWlvcyBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIE5vdGhpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkCitpcDJfc2V0X3Rlcm1pb3MoIFBUVFkgdHR5LCBzdHJ1Y3QgdGVybWlvcyAqb2xkX3Rlcm1pb3MgKQoreworCWkyQ2hhblN0clB0ciBwQ2ggPSAoaTJDaGFuU3RyUHRyKXR0eS0+ZHJpdmVyX2RhdGE7CisKKyNpZmRlZiBJUDJERUJVR19JT0NUTAorCXByaW50ayAoS0VSTl9ERUJVRyAiSVAyOiBzZXQgdGVybWlvcyAlcFxuIiwgb2xkX3Rlcm1pb3MgKTsKKyNlbmRpZgorCisJc2V0X3BhcmFtcyggcENoLCBvbGRfdGVybWlvcyApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX3NldF9saW5lX2Rpc2NpcGxpbmUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gdHR5IHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBOb3RoaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgRG9lcyBub3RoaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgdm9pZAoraXAyX3NldF9saW5lX2Rpc2NpcGxpbmUgKCBQVFRZIHR0eSApCit7CisjaWZkZWYgSVAyREVCVUdfSU9DVEwKKwlwcmludGsgKEtFUk5fREVCVUcgIklQMjogc2V0IGxpbmUgZGlzY2lwbGluZVxuIiApOworI2VuZGlmCisKKwlpcDJ0cmFjZSAoKChpMkNoYW5TdHJQdHIpdHR5LT5kcml2ZXJfZGF0YSktPnBvcnRfaW5kZXgsIElUUkNfSU9DVEwsIDE2LCAwICk7CisKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIFNldExpbmUgQ2hhcmFjdGVyaXN0aWNzKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiBQb2ludGVyIHRvIGNoYW5uZWwgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgTm90aGluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogVGhpcyByb3V0aW5lIGlzIGNhbGxlZCB0byB1cGRhdGUgdGhlIGNoYW5uZWwgc3RydWN0dXJlIHdpdGggdGhlIG5ldyBsaW5lICAgKi8KKy8qIGNoYXJhY3RlcmlzdGljcywgYW5kIHNlbmQgdGhlIGFwcHJvcHJpYXRlIGNvbW1hbmRzIHRvIHRoZSBib2FyZCB3aGVuIHRoZXkgICovCisvKiBjaGFuZ2UuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkCitzZXRfcGFyYW1zKCBpMkNoYW5TdHJQdHIgcENoLCBzdHJ1Y3QgdGVybWlvcyAqb190aW9zICkKK3sKKwl0Y2ZsYWdfdCBjZmxhZywgaWZsYWcsIGx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U1lOQ19DSEVDS19DRDsKKwl9IGVsc2UgeworCQlpMlF1ZXVlQ29tbWFuZHMoUFRZUEVfSU5MSU5FLCBwQ2gsIDEwMCwgMSwgQ01EX0RDRF9SRVApOworCQlwQ2gtPmZsYWdzCXw9IEFTWU5DX0NIRUNLX0NEOworCX0KKworI2lmZGVmIFhYWAorZG9fZmxhZ3NfdGhpbmc6CS8vIFRoaXMgaXMgYSB0ZXN0LCB3ZSBkb24ndCBkbyB0aGUgZmxhZ3MgdGhpbmcKKwkKKwlpZiAoIChjZmxhZyAmIENSVFNDVFMpICkgeworCQljZmxhZyB8PSAwMTQwMDAwMDAwMDA7CisJfQorCWkyUXVldWVDb21tYW5kcyhQVFlQRV9CWVBBU1MsIHBDaCwgMTAwLCAxLCAKKwkJCQlDTURfVU5JWF9GTEFHUyhpZmxhZyxjZmxhZyxsZmxhZykpOworI2VuZGlmCisJCQorc2VydmljZV9pdDoKKwlpMkRyYWluT3V0cHV0KCBwQ2gsIDEwMCApOwkJCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBJUEwgRGV2aWNlIFNlY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGlwMl9pcGxfcmVhZCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUGFyYW1ldGVyczogUG9pbnRlciB0byBkZXZpY2UgaW5vZGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIFBvaW50ZXIgdG8gZmlsZSBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGRhdGEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgTnVtYmVyIG9mIGJ5dGVzIHRvIHJlYWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6ICAgIFN1Y2Nlc3Mgb3IgZmFpbHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgVWdseSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIAorc3NpemVfdAoraXAyX2lwbF9yZWFkKHN0cnVjdCBmaWxlICpwRmlsZSwgY2hhciBfX3VzZXIgKnBEYXRhLCBzaXplX3QgY291bnQsIGxvZmZfdCAqb2ZmICkKK3sKKwl1bnNpZ25lZCBpbnQgbWlub3IgPSBpbWlub3IocEZpbGUtPmZfZGVudHJ5LT5kX2lub2RlKTsKKwlpbnQgcmMgPSAwOworC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JVR19UUkFDRQorCWludCByYzsKKwlpbnQgZHVtcGNvdW50OworCWludCBjaHVuazsKKwlpbnQgKnBJbmRleCA9IChpbnQgX191c2VyICopcERhdGE7CisKKwlpZiAoIGNvdW50IDwgKHNpemVvZihpbnQpICogNikgKSB7CisJCXJldHVybiAtRUlPOworCX0KKwlyYyA9IHB1dF91c2VyKHRyYWNld3JhcCwgcEluZGV4ICk7CisJcmMgPSBwdXRfdXNlcihUUkFDRU1BWCwgKytwSW5kZXggKTsKKwlyYyA9IHB1dF91c2VyKHRyYWNlc3RyaXAsICsrcEluZGV4ICk7CisJcmMgPSBwdXRfdXNlcih0cmFjZXN0dWZmLCArK3BJbmRleCApOworCXBEYXRhICs9IHNpemVvZihpbnQpICogNjsKKwljb3VudCAtPSBzaXplb2YoaW50KSAqIDY7CisKKwlkdW1wY291bnQgPSB0cmFjZXN0dWZmIC0gdHJhY2VzdHJpcDsKKwlpZiAoIGR1bXBjb3VudCA8IDAgKSB7CisJCWR1bXBjb3VudCArPSBUUkFDRU1BWDsKKwl9CisJaWYgKCBkdW1wY291bnQgPiBjb3VudCApIHsKKwkJZHVtcGNvdW50ID0gY291bnQ7CisJfQorCWNodW5rID0gVFJBQ0VNQVggLSB0cmFjZXN0cmlwOworCWlmICggZHVtcGNvdW50ID4gY2h1bmsgKSB7CisJCXJjID0gY29weV90b191c2VyKHBEYXRhLCAmdHJhY2VidWZbdHJhY2VzdHJpcF0sCisJCQkgICAgICBjaHVuayAqIHNpemVvZih0cmFjZWJ1ZlswXSkgKTsKKwkJcERhdGEgKz0gY2h1bmsgKiBzaXplb2YodHJhY2VidWZbMF0pOworCQl0cmFjZXN0cmlwID0gMDsKKwkJY2h1bmsgPSBkdW1wY291bnQgLSBjaHVuazsKKwl9IGVsc2UgeworCQljaHVuayA9IGR1bXBjb3VudDsKKwl9CisJcmMgPSBjb3B5X3RvX3VzZXIocERhdGEsICZ0cmFjZWJ1Zlt0cmFjZXN0cmlwXSwKKwkJICAgICAgY2h1bmsgKiBzaXplb2YodHJhY2VidWZbMF0pICk7CisJdHJhY2VzdHJpcCArPSBjaHVuazsKKwl0cmFjZXdyYXAgPSAwOworCisJcmMgPSBwdXRfdXNlcih0cmFjZXN0cmlwLCArK3BJbmRleCApOworCXJjID0gcHV0X3VzZXIodHJhY2VzdHVmZiwgKytwSW5kZXggKTsKKworCXJldHVybiBkdW1wY291bnQ7CisjZWxzZQorCXJldHVybiAwOworI2VuZGlmCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiBGdW5jdGlvbjogICBpcDJfaXBsX3dyaXRlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGZpbGUgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgUG9pbnRlciB0byBkYXRhICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIE51bWJlciBvZiBieXRlcyB0byB3cml0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBTdWNjZXNzIG9yIGZhaWx1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgc3NpemVfdAoraXAyX2lwbF93cml0ZShzdHJ1Y3QgZmlsZSAqcEZpbGUsIGNvbnN0IGNoYXIgX191c2VyICpwRGF0YSwgc2l6ZV90IGNvdW50LCBsb2ZmX3QgKm9mZikKK3sKKyNpZmRlZiBJUDJERUJVR19JUEwKKwlwcmludGsgKEtFUk5fREVCVUcgIklQMklQTDogd3JpdGUgJXAsICVkIGJ5dGVzXG4iLCBwRGF0YSwgY291bnQgKTsKKyNlbmRpZgorCXJldHVybiAwOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX2lwbF9pb2N0bCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gZGV2aWNlIGlub2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGZpbGUgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgQ29tbWFuZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIEFyZ3VtZW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBTdWNjZXNzIG9yIGZhaWx1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgaW50CitpcDJfaXBsX2lvY3RsICggc3RydWN0IGlub2RlICpwSW5vZGUsIHN0cnVjdCBmaWxlICpwRmlsZSwgVUlOVCBjbWQsIFVMT05HIGFyZyApCit7CisJdW5zaWduZWQgaW50IGlwbG1pbm9yID0gaW1pbm9yKHBJbm9kZSk7CisJaW50IHJjID0gMDsKKwl2b2lkIF9fdXNlciAqYXJncCA9ICh2b2lkIF9fdXNlciAqKWFyZzsKKwlVTE9ORyBfX3VzZXIgKnBJbmRleCA9IGFyZ3A7CisJaTJlQm9yZFN0clB0ciBwQiA9IGkyQm9hcmRQdHJUYWJsZVtpcGxtaW5vciAvIDRdOworCWkyQ2hhblN0clB0ciBwQ2g7CisKKyNpZmRlZiBJUDJERUJVR19JUEwKKwlwcmludGsgKEtFUk5fREVCVUcgIklQMklQTDogaW9jdGwgY21kICVkLCBhcmcgJWxkXG4iLCBjbWQsIGFyZyApOworI2VuZGlmCisKKwlzd2l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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAyX2lwbF9vcGVuKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFBvaW50ZXIgdG8gZGV2aWNlIGlub2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICBQb2ludGVyIHRvIGZpbGUgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUmV0dXJuczogICAgU3VjY2VzcyBvciBmYWlsdXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBEZXNjcmlwdGlvbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludAoraXAyX2lwbF9vcGVuKCBzdHJ1Y3QgaW5vZGUgKnBJbm9kZSwgc3RydWN0IGZpbGUgKnBGaWxlICkKK3sKKwl1bnNpZ25lZCBpbnQgaXBsbWlub3IgPSBpbWlub3IocElub2RlKTsKKwlpMmVCb3JkU3RyUHRyIHBCOworCWkyQ2hhblN0clB0ciAgcENoOworCisjaWZkZWYgSVAyREVCVUdfSVBMCisJcHJpbnRrIChLRVJOX0RFQlVHICJJUDJJUEw6IG9wZW5cbiIgKTsKKyNlbmRpZgorCisJc3dpdGNoKGlwbG1pbm9yKSB7CisJLy8gVGhlc2UgYXJlIHRoZSBJUEwgZGV2aWNlcworCWNhc2UgMDoKKwljYXNlIDQ6CisJY2FzZSA4OgorCWNhc2UgMTI6CisJCWJyZWFrOworCisJLy8gVGhlc2UgYXJlIHRoZSBzdGF0dXMgZGV2aWNlcworCWNhc2UgMToKKwljYXNlIDU6CisJY2FzZSA5OgorCWNhc2UgMTM6CisJCWJyZWFrOworCisJLy8gVGhlc2UgYXJlIHRoZSBkZWJ1ZyBkZXZpY2VzCisJY2FzZSAyOgorCWNhc2UgNjoKKwljYXNlIDEwOgorCWNhc2UgMTQ6CisJCXBCID0gaTJCb2FyZFB0clRhYmxlW2lwbG1pbm9yIC8gNF07CisJCXBDaCA9IChpMkNoYW5TdHJQdHIpIHBCLT5pMmVDaGFubmVsUHRyOworCQlicmVhazsKKworCS8vIFRoaXMgaXMgdGhlIHRyYWNlIGRldmljZQorCWNhc2UgMzoKKwkJYnJlYWs7CisJfQorCXJldHVybiAwOworfQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qIEZ1bmN0aW9uOiAgIGlwMl9yZWFkX3Byb2NtZW0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQYXJhbWV0ZXJzOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJldHVybnM6IExlbmd0aCBvZiBvdXRwdXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRGVzY3JpcHRpb246ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgU3VwcGxpZXMgc29tZSBkcml2ZXIgb3BlcmF0aW5nIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKglOb3QgcmVhbCB1c2VmdWwgdW5sZXNzIHlvdXIgZGVidWdnaW5nIHRoZSBmaWZvCQkJCQkJCSAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjZGVmaW5lIExJTUlUICAoUEFHRV9TSVpFIC0gMTIwKQorCitzdGF0aWMgaW50CitpcDJfcmVhZF9wcm9jbWVtKGNoYXIgKmJ1ZiwgY2hhciAqKnN0YXJ0LCBvZmZfdCBvZmZzZXQsIGludCBsZW4pCit7CisJaTJlQm9yZFN0clB0ciAgcEI7CisJaTJDaGFuU3RyUHRyICBwQ2g7CisJUFRUWSB0dHk7CisJaW50IGk7CisKKwlsZW4gPSAwOworCisjZGVmaW5lIEZNVExJTkUJIiUzZDogMHglMDh4IDB4JTA4eCAwJTAxMW8gMCUwMTFvXG4iCisjZGVmaW5lIEZNVExJTjIJIiAgICAgMHglMDR4IDB4JTA0eCB0eCBmbG93IDB4JXhcbiIKKyNkZWZpbmUgRk1UTElOMwkiICAgICAweCUwNHggMHglMDR4IHJjIGZsb3dcbiIKKworCWxlbiArPSBzcHJpbnRmKGJ1ZitsZW4sIlxuIik7CisKKwlmb3IoIGkgPSAw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8PCBqKSApCisJCQkJCXsKKwkJCQkJCWxlbiArPSBzcHJpbnRmIChwYWdlK2xlbiwiJWQsIiwKKwkJCQkJCQlqICsgQUJTX0JJR0dFU1RfQk9YICoKKwkJCQkJCQkoYm94K2kqQUJTX01BWF9CT1hFUykpOworCQkJCQl9CisJCQkJfQorCQkJfQorCisJCQlwYWdlWyBsZW4gLSAxIF0gPSAnXG4nOwkvKiBPdmVyd3JpdGUgdGhhdCBsYXN0IGNvbW1hICovCisJCX0gZWxzZSB7CisJCQlsZW4gKz0gc3ByaW50ZiAocGFnZStsZW4sIlxuIiApOworCQl9CisKKwkJaWYgKGxlbitiZWdpbiA+IG9mZitjb3VudCkKKwkJCWJyZWFrOworCQlpZiAobGVuK2JlZ2luIDwgb2ZmKSB7CisJCQliZWdpbiArPSBsZW47CisJCQlsZW4gPSAwOworCQl9CisJfQorCisJaWYgKGkgPj0gSVAyX01BWF9CT0FSRFMpCisJCSplb2YgPSAxOworCWlmIChvZmYgPj0gbGVuK2JlZ2luKQorCQlyZXR1cm4gMDsKKworCSpzdGFydCA9IHBhZ2UgKyAob2ZmLWJlZ2luKTsKKwlyZXR1cm4gKChjb3VudCA8IGJlZ2luK2xlbi1vZmYpID8gY291bnQgOiBiZWdpbitsZW4tb2ZmKTsKKyB9CisgCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogRnVuY3Rpb246ICAgaXAydHJhY2UoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBhcmFtZXRlcnM6IFZhbHVlIHRvIGFkZCB0byB0cmFjZSBidWZmZXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSZXR1cm5zOiAgICBOb3RoaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERlc2NyaXB0aW9uOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaWZkZWYgSVAyREVCVUdfVFJBQ0UKK3ZvaWQKK2lwMnRyYWNlICh1bnNpZ25lZCBzaG9ydCBwbiwgdW5zaWduZWQgY2hhciBjYXQsIHVuc2lnbmVkIGNoYXIgbGFiZWwsIHVuc2lnbmVkIGxvbmcgY29kZXMsIC4uLikKK3sKKwlsb25nIGZsYWdzOworCXVuc2lnbmVkIGxvbmcgKnBDb2RlID0gJmNvZGVzOworCXVuaW9uIGlwMmJyZWFkY3J1bWIgYmM7CisJaTJDaGFuU3RyUHRyICBwQ2g7CisKKworCXRyYWNlYnVmW3RyYWNlc3R1ZmYrK10gPSBqaWZmaWVzOworCWlmICggdHJhY2VzdHVmZiA9PSBUUkFDRU1BWCApIHsKKwkJdHJhY2VzdHVmZiA9IDA7CisJfQorCWlmICggdHJhY2VzdHVmZiA9PSB0cmFjZXN0cmlwICkgeworCQlpZiAoICsrdHJhY2VzdHJpcCA9PSBUUkFDRU1BWCApIHsKKwkJCXRyYWNlc3RyaXAgPSAwOworCQl9CisJCSsrdHJhY2V3cmFwOworCX0KKworCWJjLmhkci5wb3J0ICA9IDB4ZmYgJiBwbjsKKwliYy5oZHIuY2F0ICAgPSBjYXQ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orCXsKKwkJcnYgPSAtRUlOVkFMOworCQlnb3RvIG91dF91bmxvY2s7CisJfQorCisJaW50ZiA9IGlwbWlfaW50ZXJmYWNlc1tpZl9udW1dOworCisJbmV3X3VzZXItPmhhbmRsZXIgPSBoYW5kbGVyOworCW5ld191c2VyLT5oYW5kbGVyX2RhdGEgPSBoYW5kbGVyX2RhdGE7CisJbmV3X3VzZXItPmludGYgPSBpbnRmOworCW5ld191c2VyLT5nZXRzX2V2ZW50cyA9IDA7CisKKwlpZiAoIXRyeV9tb2R1bGVfZ2V0KGludGYtPmhhbmRsZXJzLT5vd25lcikpIHsKKwkJcnYgPSAtRU5PREVWOworCQlnb3RvIG91dF91bmxvY2s7CisJfQorCisJaWYgKGludGYtPmhhbmRsZXJzLT5pbmNfdXNlY291bnQpIHsKKwkJcnYgPSBpbnRmLT5oYW5kbGVycy0+aW5jX3VzZWNvdW50KGludGYtPnNlbmRfaW5mbyk7CisJCWlmIChydikgeworCQkJbW9kdWxlX3B1dChpbnRmLT5oYW5kbGVycy0+b3duZXIpOworCQkJZ290byBvdXRfdW5sb2NrOworCQl9CisJfQorCisJd3JpdGVfbG9ja19pcnFzYXZlKCZpbnRmLT51c2Vyc19sb2NrLCBmbGFncyk7CisJbGlzdF9hZGRfdGFpbCgmbmV3X3VzZXItPmxpbmssICZpbnRmLT51c2Vycyk7CisJd3JpdGVfdW5sb2NrX2lycXJlc3RvcmUoJmludGYtPnVzZXJzX2xvY2ssIGZsYWdzKTsKKworIG91dF91bmxvY2s6CQorCWlmIChydikgeworCQlrZnJlZShuZXdfdXNlcik7CisJfSBlbHNlIHsKKwkJKnVzZXIgPSBuZXdfdXNlcjsKKwl9CisKKwl1cF9yZWFkKCZpbnRlcmZhY2VzX3NlbSk7CisJcmV0dXJuIHJ2OworfQorCitzdGF0aWMgaW50IGlwbWlfZGVzdHJveV91c2VyX25vbG9jayhpcG1pX3VzZXJfdCB1c2VyKQoreworCWludCAgICAgICAgICAgICAgcnYgPSAtRU5PRE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kIGNoYXIgKm1ham9yLAorCQkgICAgICB1bnNpZ25lZCBjaGFyICptaW5vcikKK3sKKwkqbWFqb3IgPSB1c2VyLT5pbnRmLT52ZXJzaW9uX21ham9yOworCSptaW5vciA9IHVzZXItPmludGYtPnZlcnNpb25fbWlub3I7Cit9CisKK3ZvaWQgaXBtaV9zZXRfbXlfYWRkcmVzcyhpcG1pX3VzZXJfdCAgIHVzZXIsCisJCQkgdW5zaWduZWQgY2hhciBhZGRyZXNzKQoreworCXVzZXItPmludGYtPm15X2FkZHJlc3MgPSBhZGRyZXNzOworfQorCit1bnNpZ25lZCBjaGFyIGlwbWlfZ2V0X215X2FkZHJlc3MoaXBtaV91c2VyX3QgdXNlcikKK3sKKwlyZXR1cm4gdXNlci0+aW50Zi0+bXlfYWRkcmVzczsKK30KKwordm9pZCBpcG1pX3NldF9teV9MVU4oaXBtaV91c2VyX3QgICB1c2VyLAorCQkgICAgIHVuc2lnbmVkIGNoYXIgTFVOKQoreworCXVzZXItPmludGYtPm15X2x1biA9IExVTiAmIDB4MzsKK30KKwordW5zaWduZWQgY2hhciBpcG1pX2dldF9teV9MVU4oaXBtaV91c2VyX3QgdXNlcikKK3sKKwlyZXR1cm4gdXNlci0+aW50Zi0+bXlfbHVuOworfQorCitpbnQgaXBtaV9zZXRfZ2V0c19ldmVudHMoaXBtaV91c2VyX3QgdXNlciwgaW50IHZhbCkKK3sKKwl1bnNpZ25lZCBsb25nICAgICAgICAgZmxhZ3M7CisJc3RydWN0IGlwbWlfcmVjdl9tc2cgICptc2csICptc2cyOworCisJcmVhZF9sb2NrKCYodXNlci0+aW50Zi0+dXNlcnNfbG9jaykpOworCXNwaW5fbG9ja19pcnFzYXZlKCYodXNlci0+aW50Zi0+ZXZlbnRzX2xvY2spLCBmbGFncyk7CisJdXNlci0+Z2V0c19ldmVudHMgPSB2YWw7CisKKwlpZiAodmFsKSB7CisJCS8qIERlbGl2ZXIgYW55IHF1ZXVlZCBldmVudHMuICovCisJCWxpc3RfZ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wkJCSBzdHJ1Y3Qga2VybmVsX2lwbWlfbXNnICAqbXNnLAorCQkJIHZvaWQgICAgICAgICAgICAgKnVzZXJfbXNnX2RhdGEsCisJCQkgaW50ICAgICAgICAgICAgICBwcmlvcml0eSwKKwkJCSBpbnQgICAgICAgICAgICAgIHJldHJpZXMsCisJCQkgdW5zaWduZWQgaW50ICAgICByZXRyeV90aW1lX21zKQoreworCXJldHVybiBpX2lwbWlfcmVxdWVzdCh1c2VyLAorCQkJICAgICAgdXNlci0+aW50ZiwKKwkJCSAgICAgIGFkZHIsCisJCQkgICAgICBtc2dpZCwKKwkJCSAgICAgIG1zZywKKwkJCSAgICAgIHVzZXJfbXNnX2RhdGEsCisJCQkgICAgICBOVUxMLCBOVUxMLAorCQkJICAgICAgcHJpb3JpdHksCisJCQkgICAgICB1c2VyLT5pbnRmLT5teV9hZGRyZXNzLAorCQkJICAgICAgdXNlci0+aW50Zi0+bXlfbHVuLAorCQkJICAgICAgcmV0cmllcywKKwkJCSAgICAgIHJldHJ5X3RpbWVfbXMpOworfQorCitpbnQgaXBtaV9yZXF1ZXN0X3N1cHBseV9tc2dzKGlwbWlfdXNlcl90ICAgICAgICAgIHVzZXIsCisJCQkgICAgIHN0cnVjdCBpcG1pX2FkZHIgICAgICphZGRyLAorCQkJICAgICBsb25nICAgICAgICAgICAgICAgICBtc2dpZCwKKwkJCSAgICAgc3RydWN0IGtlcm5lbF9pcG1pX21zZyAqbXNnLAorCQkJICAgICB2b2lkICAgICAgICAgICAgICAgICAqdXNlcl9tc2dfZGF0YSwKKwkJCSAgICAgdm9pZCAgICAgICAgICAgICAgICAgKnN1cHBsaWVkX3NtaSwKKwkJCSAgICAgc3RydWN0IGlwbWlfcmVjdl9tc2cgKnN1cHBsaWVkX3JlY3YsCisJCQkgICAgIGludCAgICAgICAgICAgICAgICAgIHByaW9yaXR5KQoreworCXJldHVybiBpX2lwbWlfcmVxdWVzdCh1c2VyLAorCQkJICAgICAgdXNlci0+aW50ZiwKKwk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Cit7CisJY2hhciAgICAgICAqb3V0ID0gKGNoYXIgKikgcGFnZTsKKwlpcG1pX3NtaV90IGludGYgPSBkYXRhOworCisJb3V0ICs9IHNwcmludGYob3V0LCAic2VudF9pbnZhbGlkX2NvbW1hbmRzOiAgICAgICAlZFxuIiwKKwkJICAgICAgIGludGYtPnNlbnRfaW52YWxpZF9jb21tYW5kcyk7CisJb3V0ICs9IHNwcmludGYob3V0LCAic2VudF9sb2NhbF9jb21tYW5kczogICAgICAgICAlZFxuIiwKKwkJICAgICAgIGludGYtPnNlbnRfbG9jYWxfY29tbWFuZHMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImhhbmRsZWRfbG9jYWxfcmVzcG9uc2VzOiAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5oYW5kbGVkX2xvY2FsX3Jlc3BvbnNlcyk7CisJb3V0ICs9IHNwcmludGYob3V0LCAidW5oYW5kbGVkX2xvY2FsX3Jlc3BvbnNlczogICAlZFxuIiwKKwkJICAgICAgIGludGYtPnVuaGFuZGxlZF9sb2NhbF9yZXNwb25zZXMpOworCW91dCArPSBzcHJpbnRmKG91dCwgInNlbnRfaXBtYl9jb21tYW5kczogICAgICAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5zZW50X2lwbWJfY29tbWFuZHMpOworCW91dCArPSBzcHJpbnRmKG91dCwgInNlbnRfaXBtYl9jb21tYW5kX2VycnM6ICAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5zZW50X2lwbWJfY29tbWFuZF9lcnJzKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJyZXRyYW5zbWl0dGVkX2lwbWJfY29tbWFuZHM6ICVkXG4iLAorCQkgICAgICAgaW50Zi0+cmV0cmFuc21pdHRlZF9pcG1iX2NvbW1hbmRzKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJ0aW1lZF9vdXRfaXBtYl9jb21tYW5kczogICAgICVkXG4iLAorCQkgICAgICAgaW50Zi0+dGltZWRfb3V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ltZWRfb3V0X2xhbl9jb21tYW5kczogICAgICAlZFxuIiwKKwkJICAgICAgIGludGYtPnRpbWVkX291dF9sYW5fY29tbWFuZHMpOworCW91dCArPSBzcHJpbnRmKG91dCwgInNlbnRfbGFuX3Jlc3BvbnNlczogICAgICAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5zZW50X2xhbl9yZXNwb25zZXMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImhhbmRsZWRfbGFuX3Jlc3BvbnNlczogICAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5oYW5kbGVkX2xhbl9yZXNwb25zZXMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImludmFsaWRfbGFuX3Jlc3BvbnNlczogICAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5pbnZhbGlkX2xhbl9yZXNwb25zZXMpOworCW91dCArPSBzcHJpbnRmKG91dCwgInVuaGFuZGxlZF9sYW5fcmVzcG9uc2VzOiAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT51bmhhbmRsZWRfbGFuX3Jlc3BvbnNlcyk7CisJb3V0ICs9IHNwcmludGYob3V0LCAiaGFuZGxlZF9jb21tYW5kczogICAgICAgICAgICAlZFxuIiwKKwkJICAgICAgIGludGYtPmhhbmRsZWRfY29tbWFuZHMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImludmFsaWRfY29tbWFuZHM6ICAgICAgICAgICAgJWRcbiIsCisJCSAgICAgICBpbnRmLT5pbnZhbGlkX2NvbW1hbmRzKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJ1bmhhbmRsZWRfY29tbWFuZHM6ICAgICAgICAgICVkXG4iLAorCQkgICAgICAgaW50Zi0+dW5oYW5kbGVkX2NvbW1hbmRzKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJpbnZhbGlkX2V2ZW50czogICAgICAgICAgICAgICVkXG4iLAorCQkgICAgICAgaW50Zi0+aW52YWxpZF9ldmVudHMpOworCW91dCArPSBzcHJpb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nRmID09IE5VTEwpCisJCQljb250aW51ZTsKKworCQkvKiBTZW5kIHRoZSBldmVudCBhbm5vdW5jaW5nIHRoZSBwYW5pYy4gKi8KKwkJaW50Zi0+aGFuZGxlcnMtPnNldF9ydW5fdG9fY29tcGxldGlvbihpbnRmLT5zZW5kX2luZm8sIDEpOworCQlpX2lwbWlfcmVxdWVzdChOVUxMLAorCQkJICAgICAgIGludGYsCisJCQkgICAgICAgJmFkZHIsCisJCQkgICAgICAgMCwKKwkJCSAgICAgICAmbXNnLAorCQkJICAgICAgIE5VTEwsCisJCQkgICAgICAgJnNtaV9tc2csCisJCQkgICAgICAgJnJlY3ZfbXNnLAorCQkJICAgICAgIDAsCisJCQkgICAgICAgaW50Zi0+bXlfYWRkcmVzcywKKwkJCSAgICAgICBpbnRmLT5teV9sdW4sCisJCQkgICAgICAgMCwgMSk7IC8qIERvbid0IHJldHJ5LCBhbmQgZG9uJ3Qgd2FpdC4gKi8KKwl9CisKKyNpZmRlZiBDT05GSUdfSVBNSV9QQU5JQ19TVFJJTkcKKwkvKiBPbiBldmVyeSBpbnRlcmZhY2UsIGR1bXAgYSBidW5jaCBvZiBPRU0gZXZlbnQgaG9sZGluZyB0aGUKKwkgICBzdHJpbmcuICovCisJaWYgKCFzdHIpIAorCQlyZXR1cm47CisKKwlmb3IgKGk9MDsgaTxNQVhfSVBNSV9JTlRFUkZBQ0VTOyBpKyspIHsKKwkJY2hhciAgICAgICAgICAgICAgICAgICpwID0gc3RyOworCQlzdHJ1Y3QgaXBtaV9pcG1iX2FkZHIgKmlwbWI7CisJCWludCAgICAgICAgICAgICAgICAgICBqOworCisJCWludGYgPSBpcG1pX2ludGVyZmFjZXNbaV07CisJCWlmIChpbnRmID09IE5VTEwpCisJCQljb250aW51ZTsKKworCQkvKiBGaXJzdCBqb2IgaGVyZSBpcyB0byBmaWd1cmUgb3V0IHdoZXJlIHRvIHNlbmQgdGhlCisJCSAgIE9FTSBldmVudHMuICBUaGVyZSdzIG5vIHdheS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FVSRVJfSUQpCisJCSYmIChwcm9kX2lkID09IElQTUlfQ1BJMV9QUk9EVUNUX0lEKSk7Cit9CisKK3N0YXRpYyB2b2lkIGlwbWlfcG93ZXJvZmZfY3BpMSAoaXBtaV91c2VyX3QgdXNlcikKK3sKKwlzdHJ1Y3QgaXBtaV9zeXN0ZW1faW50ZXJmYWNlX2FkZHIgc21pX2FkZHI7CisJc3RydWN0IGlwbWlfaXBtYl9hZGRyICAgICAgICAgICAgIGlwbWJfYWRkcjsKKwlzdHJ1Y3Qga2VybmVsX2lwbWlfbXNnICAgICAgICAgICAgc2VuZF9tc2c7CisJaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ2OworCXVuc2lnbmVkIGNoYXIgICAgICAgICAgICAgICAgICAgICBkYXRhWzFdOworCWludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzbG90OworCXVuc2lnbmVkIGNoYXIgICAgICAgICAgICAgICAgICAgICBob3Rzd2FwX2lwbWI7CisJdW5zaWduZWQgY2hhciAgICAgICAgICAgICAgICAgICAgIGFlcl9hZGRyOworCXVuc2lnbmVkIGNoYXIgICAgICAgICAgICAgICAgICAgICBhZXJfbHVuOworCisgICAgICAgIC8qCisgICAgICAgICAqIENvbmZpZ3VyZSBJUE1JIGFkZHJlc3MgZm9yIGxvY2FsIGFjY2VzcworICAgICAgICAgKi8KKyAgICAgICAgc21pX2FkZHIuYWRkcl90eXBlID0gSVBNSV9TWVNURU1fSU5URVJGQUNFX0FERFJfVFlQRTsKKyAgICAgICAgc21pX2FkZHIuY2hhbm5lbCA9IElQTUlfQk1DX0NIQU5ORUw7CisgICAgICAgIHNtaV9hZGRyLmx1biA9IDA7CisKKwlwcmludGsoS0VSTl9JTkZPIFBGWCAiUG93ZXJpbmcgZG93biB2aWEgQ1BJMSBwb3dlciBjb21tYW5kXG4iKTsKKworCS8qCisJICogR2V0IElQTUkgaXBtYiBhZGRyZXNzCisJICovCisJc2VuZF9tc2cubmV0Zm4gPSB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EVSKSB8fCBkZWZpbmVkKENPTkZJR19YODYpIHx8IGRlZmluZWQoQ09ORklHX1BDSSkKK3N0YXRpYyBpbnQgaXNfbmV3X2ludGVyZmFjZShpbnQgaW50ZiwgdTggYWRkcl9zcGFjZSwgdW5zaWduZWQgbG9uZyBiYXNlX2FkZHIpCit7CisJaW50IGk7CisKKwlmb3IgKGkgPSAwOyBpIDwgU0lfTUFYX1BBUk1TOyArK2kpIHsKKwkJLyogRG9uJ3QgY2hlY2sgb3VyIGFkZHJlc3MuICovCisJCWlmIChpID09IGludGYpCisJCQljb250aW51ZTsKKwkJaWYgKHNpX3R5cGVbaV0gIT0gTlVMTCkgeworCQkJaWYgKChhZGRyX3NwYWNlID09IElQTUlfTUVNX0FERFJfU1BBQ0UgJiYKKwkJCSAgICAgYmFzZV9hZGRyID09IGFkZHJzW2ldKSB8fAorCQkJICAgIChhZGRyX3NwYWNlID09IElQTUlfSU9fQUREUl9TUEFDRSAmJgorCQkJICAgICBiYXNlX2FkZHIgPT0gcG9ydHNbaV0pKQorCQkJCXJldHVybiAwOworCQl9CisJCWVsc2UKKwkJCWJyZWFrOworCX0KKworCXJldHVybiAxOworfQorI2VuZGlmCisKK3N0YXRpYyBpbnQgc3RkX2lycV9zZXR1cChzdHJ1Y3Qgc21pX2luZm8gKmluZm8pCit7CisJaW50IHJ2OworCisJaWYgKCFpbmZvLT5pcnEpCisJCXJldHVybiAwOworCisJcnYgPSByZXF1ZXN0X2lycShpbmZvLT5pcnEsCisJCQkgc2lfaXJxX2hhbmRsZXIsCisJCQkgU0FfSU5URVJSVVBULAorCQkJIERFVklDRV9OQU1FLAorCQkJIGluZm8pOworCWlmIChydikgeworCQlwcmludGsoS0VSTl9XQVJOSU5HCisJCSAgICAgICAiaXBtaV9zaTogJXMgdW5hYmxlIHRvIGNsYWltIGludGVycnVwdCAlZCwiCisJCSAgICAgICAiIHJ1bm5pbmcgcG9sbGVkXG4iLAorCQkgICAgICAgREVWSUNFX05BTUUsIGluZm8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pX2luZm8gKnNtaSA9IGRhdGE7CisKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJpbnRlcnJ1cHRzX2VuYWJsZWQ6ICAgICVkXG4iLAorCQkgICAgICAgc21pLT5pcnEgJiYgIXNtaS0+aW50ZXJydXB0X2Rpc2FibGVkKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJzaG9ydF90aW1lb3V0czogICAgICAgICVsZFxuIiwKKwkJICAgICAgIHNtaS0+c2hvcnRfdGltZW91dHMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImxvbmdfdGltZW91dHM6ICAgICAgICAgJWxkXG4iLAorCQkgICAgICAgc21pLT5sb25nX3RpbWVvdXRzKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJ0aW1lb3V0X3Jlc3RhcnRzOiAgICAgICVsZFxuIiwKKwkJICAgICAgIHNtaS0+dGltZW91dF9yZXN0YXJ0cyk7CisJb3V0ICs9IHNwcmludGYob3V0LCAiaWRsZXM6ICAgICAgICAgICAgICAgICAlbGRcbiIsCisJCSAgICAgICBzbWktPmlkbGVzKTsKKwlvdXQgKz0gc3ByaW50ZihvdXQsICJpbnRlcnJ1cHRzOiAgICAgICAgICAgICVsZFxuIiwKKwkJICAgICAgIHNtaS0+aW50ZXJydXB0cyk7CisJb3V0ICs9IHNwcmludGYob3V0LCAiYXR0ZW50aW9uczogICAgICAgICAgICAlbGRcbiIsCisJCSAgICAgICBzbWktPmF0dGVudGlvbnMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImZsYWdfZmV0Y2hlczogICAgICAgICAgJWxkXG4iLAorCQkgICAgICAgc21pLT5mbGFnX2ZldGNoZXMpOworCW91dCArPSBzcHJpbnRmKG91dCwgImhvc2VkX2NvdW50OiAgICAgICAgICAgJWxkXG4iLAorCQkgICAgICAgc21pLT5ob3NlZF9jb3VudCk7CisJb3V0ICs9IHNwcmludGYob3V0LCAiY29tcGxldGVfdHJhbnNhY3Rpb25zOiAlbGRcbiIsCisJCSAgICAg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b2NrX2luaXQoJihuZXdfc21pLT5tc2dfbG9jaykpOworCXNwaW5fbG9ja19pbml0KCYobmV3X3NtaS0+Y291bnRfbG9jaykpOworCisJLyogRG8gbG93LWxldmVsIGRldGVjdGlvbiBmaXJzdC4gKi8KKwlpZiAobmV3X3NtaS0+aGFuZGxlcnMtPmRldGVjdChuZXdfc21pLT5zaV9zbSkpIHsKKwkJcnYgPSAtRU5PREVWOworCQlnb3RvIG91dF9lcnI7CisJfQorCisJLyogQXR0ZW1wdCBhIGdldCBkZXZpY2UgaWQgY29tbWFuZC4gIElmIGl0IGZhaWxzLCB3ZSBwcm9iYWJseQorICAgICAgICAgICBkb24ndCBoYXZlIGEgU01JIGhlcmUuICovCisJcnYgPSB0cnlfZ2V0X2Rldl9pZChuZXdfc21pKTsKKwlpZiAocnYpCisJCWdvdG8gb3V0X2VycjsKKworCS8qIFRyeSB0byBjbGFpbSBhbnkgaW50ZXJydXB0cy4gKi8KKwluZXdfc21pLT5pcnFfc2V0dXAobmV3X3NtaSk7CisKKwlJTklUX0xJU1RfSEVBRCgmKG5ld19zbWktPnhtaXRfbXNncykpOworCUlOSVRfTElTVF9IRUFEKCYobmV3X3NtaS0+aHBfeG1pdF9tc2dzKSk7CisJbmV3X3NtaS0+Y3Vycl9tc2cgPSBOVUxMOworCWF0b21pY19zZXQoJm5ld19zbWktPnJlcV9ldmVudHMsIDApOworCW5ld19zbWktPnJ1bl90b19jb21wbGV0aW9uID0gMDsKKworCW5ld19zbWktPmludGVycnVwdF9kaXNhYmxlZCA9IDA7CisJbmV3X3NtaS0+dGltZXJfc3RvcHBlZCA9IDA7CisJbmV3X3NtaS0+c3RvcF9vcGVyYXRpb24gPSAwOworCisJLyogU3RhcnQgY2xlYXJpbmcgdGhlIGZsYWdzIGJlZm9yZSB3ZSBlbmFibGUgaW50ZXJydXB0cyBvciB0aGUKKwkgICB0aW1lciB0byBhdm9pZCByYWNpbmcgd2l0aCB0aGUgdGltZXIuICovCisJc3RhcnRfY2x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GlhbCBwb3J0IGlzCisgICAgICAgICAgICAgICAgICAgbm90IHNldCwgdGhlbiBzZXQgaXQuICovCisJCXNpX3R5cGVbMF0gPSAia2NzIjsKKwkJcG9ydHNbMF0gPSBERUZBVUxUX0tDU19JT19QT1JUOworCQlydiA9IGluaXRfb25lX3NtaSgwLCAmKHNtaV9pbmZvc1twb3NdKSk7CisJCWlmIChydikgeworCQkJLyogTm8gS0NTIC0gdHJ5IFNNSUMgKi8KKwkJCXNpX3R5cGVbMF0gPSAic21pYyI7CisJCQlwb3J0c1swXSA9IERFRkFVTFRfU01JQ19JT19QT1JUOworCQkJcnYgPSBpbml0X29uZV9zbWkoMCwgJihzbWlfaW5mb3NbcG9zXSkpOworCQl9CisJCWlmIChydikgeworCQkJLyogTm8gU01JQyAtIHRyeSBCVCAqLworCQkJc2lfdHlwZVswXSA9ICJidCI7CisJCQlwb3J0c1swXSA9IERFRkFVTFRfQlRfSU9fUE9SVDsKKwkJCXJ2ID0gaW5pdF9vbmVfc21pKDAsICYoc21pX2luZm9zW3Bvc10pKTsKKwkJfQorCX0KKwlpZiAocnYgPT0gMCkKKwkJcG9zKys7CisKKwlmb3IgKGk9MTsgaSA8IFNJX01BWF9QQVJNUzsgaSsrKSB7CisJCXJ2ID0gaW5pdF9vbmVfc21pKGksICYoc21pX2luZm9zW3Bvc10pKTsKKwkJaWYgKHJ2ID09IDApCisJCQlwb3MrKzsKKwl9CisKKwlpZiAoc21pX2luZm9zWzBdID09IE5VTEwpIHsKKwkJcHJpbnRrKCJpcG1pX3NpOiBVbmFibGUgdG8gZmluZCBhbnkgU3lzdGVtIEludGVyZmFjZShzKVxuIik7CisJCXJldHVybiAtRU5PREVWOworCX0KKworCXJldHVybiAwOworfQorbW9kdWxlX2luaXQoaW5pdF9pcG1pX3NpKTsKKworc3RhdGljIHZvaWQgX19leGl0IGNsZWFudXBfb25lX3NpKHN0cnVjdCBzbWlfaW5mbyAqdG9fY2xlYW4pCit7CisJaW50ICAgICAgICAgICB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87CisgICAgICAgIHVuc2lnbmVkIGNoYXIJIHdyaXRlX2RhdGFbTUFYX1NNSUNfV1JJVEVfU0laRV07CisgICAgICAgIGludAkJIHdyaXRlX3BvczsKKyAgICAgICAgaW50CQkgd3JpdGVfY291bnQ7CisgICAgICAgIGludAkJIG9yaWdfd3JpdGVfY291bnQ7CisgICAgICAgIHVuc2lnbmVkIGNoYXIJIHJlYWRfZGF0YVtNQVhfU01JQ19SRUFEX1NJWkVdOworICAgICAgICBpbnQJCSByZWFkX3BvczsKKyAgICAgICAgaW50CQkgdHJ1bmNhdGVkOworICAgICAgICB1bnNpZ25lZCBpbnQJIGVycm9yX3JldHJpZXM7CisgICAgICAgIGxvbmcJCSBzbWljX3RpbWVvdXQ7Cit9OworCitzdGF0aWMgdW5zaWduZWQgaW50IGluaXRfc21pY19kYXRhIChzdHJ1Y3Qgc2lfc21fZGF0YSAqc21pYywKKwkJCQkgICAgc3RydWN0IHNpX3NtX2lvICppbykKK3sKKwlzbWljLT5zdGF0ZSA9IFNNSUNfSURMRTsKKwlzbWljLT5pbyA9IGlvOworCXNtaWMtPndyaXRlX3BvcyA9IDA7CisJc21pYy0+d3JpdGVfY291bnQgPSAwOworCXNtaWMtPm9yaWdfd3JpdGVfY291bnQgPSAwOworCXNtaWMtPnJlYWRfcG9zID0gMDsKKwlzbWljLT5lcnJvcl9yZXRyaWVzID0gMDsKKwlzbWljLT50cnVuY2F0ZWQgPSAwOworCXNtaWMtPnNtaWNfdGltZW91dCA9IFNNSUNfUkVUUllfVElNRU9VVDsKKworCS8qIFdlIHVzZSAzIGJ5dGVzIG9mIEkvTy4gKi8KKwlyZXR1cm4gMzsKK30KKworc3RhdGljIGludCBzdGFydF9zbWljX3RyYW5zYWN0aW9uKHN0cnVjdCBzaV9zbV9kYXRhICpzbWljLAorCQkJCSAgdW5zaWduZWQgY2hhciAqZGF0YSwgdW5zaWduZWQgaW50IHNpemUpCit7CisJdW5zaWduZWQgaW50IGk7CisKKwlpZiAoKHNp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pbWVvdXQoc3RydWN0IGlwbWlfc21pX21zZyAgKnNtaV9tc2csCisJCQkgICAgICBzdHJ1Y3QgaXBtaV9yZWN2X21zZyAqcmVjdl9tc2csCisJCQkgICAgICBpbnQgICAgICAgICAgICAgICAgICAqc2VuZF9oZWFydGJlYXRfbm93KQoreworCXN0cnVjdCBrZXJuZWxfaXBtaV9tc2cgICAgICAgICAgICBtc2c7CisJdW5zaWduZWQgY2hhciAgICAgICAgICAgICAgICAgICAgIGRhdGFbNl07CisJaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ2OworCXN0cnVjdCBpcG1pX3N5c3RlbV9pbnRlcmZhY2VfYWRkciBhZGRyOworCWludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYm5vdyA9IDA7CisKKworCWRhdGFbMF0gPSAwOworCVdET0dfU0VUX1RJTUVSX1VTRShkYXRhWzBdLCBXRE9HX1RJTUVSX1VTRV9TTVNfT1MpOworCisJaWYgKChpcG1pX3ZlcnNpb25fbWFqb3IgPiAxKQorCSAgICB8fCAoKGlwbWlfdmVyc2lvbl9tYWpvciA9PSAxKSAmJiAoaXBtaV92ZXJzaW9uX21pbm9yID49IDUpKSkKKwl7CisJCS8qIFRoaXMgaXMgYW4gSVBNSSAxLjUtb25seSBmZWF0dXJlLiAqLworCQlkYXRhWzBdIHw9IFdET0dfRE9OVF9TVE9QX09OX1NFVDsKKwl9IGVsc2UgaWYgKGlwbWlfd2F0Y2hkb2dfc3RhdGUgIT0gV0RPR19USU1FT1VUX05PTkUpIHsKKwkJLyogSW4gaXBtaSAxLjAsIHNldHRpbmcgdGhlIHRpbWVyIHN0b3BzIHRoZSB3YXRjaGRvZywgd2UKKwkJICAgbmVlZCB0byBzdGFydCBpdCBiYWNrIHVwIGFnYWluLiAqLworCQloYm5vdyA9IDE7CisJfQorCisJZGF0YVsxXSA9IDA7CisJV0RPR19TRVRfVElNRU9VVF9BQ1QoZGF0YVsxXSwgaXBtaV93YXRjaGRvZ19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G9jayk7CisKKwlpZiAocnYgPT0gMCkgeworCQlpZiAoY29weV90b191c2VyKGJ1ZiwgJmRhdGFfdG9fcmVhZCwgMSkpCisJCQlydiA9IC1FRkFVTFQ7CisJCWVsc2UKKwkJCXJ2ID0gMTsKKwl9CisKKwlyZXR1cm4gcnY7Cit9CisKK3N0YXRpYyBpbnQgaXBtaV9vcGVuKHN0cnVjdCBpbm9kZSAqaW5vLCBzdHJ1Y3QgZmlsZSAqZmlsZXApCit7CisgICAgICAgIHN3aXRjaCAoaW1pbm9yKGlubykpCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlIFdBVENIRE9HX01JTk9SOgorCQkgICAgaWYodGVzdF9hbmRfc2V0X2JpdCgwLCAmaXBtaV93ZG9nX29wZW4pKQorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FQlVTWTsKKworCQkgICAgLyogRG9uJ3Qgc3RhcnQgdGhlIHRpbWVyIG5vdywgbGV0IGl0IHN0YXJ0IG9uIHRoZQorCQkgICAgICAgZmlyc3QgaGVhcnRiZWF0LiAqLworCQkgICAgaXBtaV9zdGFydF90aW1lcl9vbl9oZWFydGJlYXQgPSAxOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbm9uc2Vla2FibGVfb3Blbihpbm8sIGZpbGVwKTsKKworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAoLUVOT0RFVik7CisgICAgICAgIH0KK30KKworc3RhdGljIHVuc2lnbmVkIGludCBpcG1pX3BvbGwoc3RydWN0IGZpbGUgKmZpbGUsIHBvbGxfdGFibGUgKndhaXQpCit7CisJdW5zaWduZWQgaW50IG1hc2sgPSAwOworCQorCXBvbGxfd2FpdChmaWxlLCAmcmVhZF9xLCB3YWl0KTsKKworCXNwaW5fbG9jaygmaXBtaV9yZWFkX2xvY2spOworCWlmIChkYXRhX3RvX3JlYWQpCisJCW1hc2sgfD0gKFBPTExJTiB8IFBPTExSRE5PU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ogLyAxMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJRGVmaW5lIG1hY3JvcyB0byBleHRyYWN0IGEgYnJkIG9yIHBvcnQgbnVtYmVyIGZyb20gYSBtaW5vciBudW1iZXIuCisgKi8KKyNkZWZpbmUJTUlOT1IyQlJEKG1pbikJCSgoKG1pbikgJiAweGMwKSA+PiA2KQorI2RlZmluZQlNSU5PUjJQT1JUKG1pbikJCSgobWluKSAmIDB4M2YpCisKKy8qCisgKglEZWZpbmUgYSBiYXVkIHJhdGUgdGFibGUgdGhhdCBjb252ZXJ0cyB0ZXJtaW9zIGJhdWQgcmF0ZSBzZWxlY3RvcgorICoJaW50byB0aGUgYWN0dWFsIGJhdWQgcmF0ZSB2YWx1ZS4gQWxsIGJhdWQgcmF0ZSBjYWxjdWxhdGlvbnMgYXJlIGJhc2VkCisgKglvbiB0aGUgYWN0dWFsIGJhdWQgcmF0ZSByZXF1aXJlZC4KKyAqLworc3RhdGljIHVuc2lnbmVkIGludAlzdGxpX2JhdWRyYXRlc1tdID0geworCTAsIDUwLCA3NSwgMTEwLCAxMzQsIDE1MCwgMjAwLCAzMDAsIDYwMCwgMTIwMCwgMTgwMCwgMjQwMCwgNDgwMCwKKwk5NjAwLCAxOTIwMCwgMzg0MDAsIDU3NjAwLCAxMTUyMDAsIDIzMDQwMCwgNDYwODAwLCA5MjE2MDAKK307CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCURlZmluZSBzb21lIGhhbmR5IGxvY2FsIG1hY3Jvcy4uLgorICovCisjdW5kZWYgTUlOCisjZGVmaW5lCU1JTihhLGIpCSgoKGEpIDw9IChiKSkgPyAoYSkgOiAoYikpCisKKyN1bmRlZglUT0xPV0VSCisjZGVmaW5lCVRPTE9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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJRGVmaW5lIGEgdGltZXJfbGlzdCBlbnRyeSBmb3Igb3VyIHBvbGwgcm91dGluZS4gVGhlIHNsYXZlIGJvYXJkCisgKglpcyBwb2xsZWQgZXZlcnkgc28gb2Z0ZW4gdG8gc2VlIGlmIGFueXRoaW5nIG5lZWRzIGRvaW5nLiBUaGlzIGlzCisgKgltdWNoIGNoZWFwZXIgb24gaG9zdCBjcHUgdGhhbiB1c2luZyBpbnRlcnJ1cHRzLiBJdCB0dXJucyBvdXQgdG8KKyAqCW5vdCBpbmNyZWFzZSBjaGFyYWN0ZXIgbGF0ZW5jeSBieSBtdWNoIGVpdGhlci4uLgorICovCitzdGF0aWMgc3RydWN0IHRpbWVyX2xpc3Qgc3RsaV90aW1lcmxpc3QgPSBUSU1FUl9JTklUSUFMSVpFUihzdGxpX3BvbGwsIDAsIDApOworCitzdGF0aWMgaW50CXN0bGlfdGltZXJvbjsKKworLyoKKyAqCURlZmluZSB0aGUgY2FsY3VsYXRpb24gZm9yIHRoZSB0aW1lb3V0IHJvdXRpbmUuCisgKi8KKyNkZWZpbmUJU1RMSV9USU1FT1VUCShqaWZmaWVzICsgMSkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgc3RydWN0IGNsYXNzX3NpbXBsZSAqaXN0YWxsaW9uX2NsYXNzOworCisjaWZkZWYgTU9EVUxFCisKKy8qCisgKglMb2FkYWJsZSBtb2R1bGUgaW5pdGlhbGl6YXRpb24gc3R1ZmYuCisgKi8KKworc3RhdGljIGludCBfX2luaXQgaXN0YWxsaW9uX21vZHVsZV9pbml0KHZvaWQpCit7CisJdW5zaWduZWQgbG9uZwlmbGFnczsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJpbml0X21vZHVsZSgpXG4iKTsKKyNlbmRpZgorCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpKCk7CisJc3RsaV9pbml0KCk7CisJcmVzdG9yZV9mbGFncyhmbGFncyk7CisKKwlyZXR1cm4oMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgX19leGl0IGlzdGFsbGlvbl9tb2R1bGVfZXhpdCh2b2lkKQoreworCXN0bGlicmRfdAkqYnJkcDsKKwlzdGxpcG9ydF90CSpwb3J0cDsKKwl1bnNpZ25lZCBsb25nCWZsYWdzOworCWludAkJaSwgajsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJjbGVhbnVwX21vZHVsZSgpXG4iKTsKKyNlbmRpZgorCisJcHJpbnRrKEtFUk5fSU5GTyAiVW5sb2FkaW5nICVzOiB2ZXJzaW9uICVzXG4iLCBzdGxpX2RydnRpdGxlLAorCQlzdGxpX2RydnZlcnNpb24pOworCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpKCk7CisKKy8qCisgKglGcmVlIHVwIGFsbCBhbGxvY2F0ZWQgcmVzb3VyY2VzIHVzZWQgYnkgdGhlIHBvcnRzLiBUaGlzIGluY2x1ZGVzCisgKgltZW1vcnkgYW5kIGludGVycnVwdHMuCisgKi8KKwlpZiAoc3RsaV90aW1lcm9uKSB7CisJCXN0bGlfdGltZXJvbiA9IDA7CisJCWRlbF90aW1lcigmc3RsaV90aW1lcmxpc3QpOworCX0KKworCWkgPSB0dHlfdW5yZWdpc3Rlcl9kcml2ZXIoc3RsaV9zZXJpYWwpOworCWlmIChpKSB7CisJCXByaW50aygiU1RBTExJT046IGZhaWxlZCB0byB1bi1yZWdpc3RlciB0dHkgZHJpdmVyLCAiCisJCQkiZXJybm89JWRcbiIsIC1pKTsKKwkJcmVzdG9yZV9mbGFncyhmbGFncyk7CisJCXJldHVybjsKKwl9CisJcHV0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cnRwKTsKKwkJCX0KKwkJfQorCisJCWlvdW5tYXAoYnJkcC0+bWVtYmFzZSk7CisJCWlmIChicmRwLT5pb3NpemUgPiAwKQorCQkJcmVsZWFzZV9yZWdpb24oYnJkcC0+aW9iYXNlLCBicmRwLT5pb3NpemUpOworCQlrZnJlZShicmRwKTsKKwkJc3RsaV9icmRzW2ldID0gKHN0bGlicmRfdCAqKSBOVUxMOworCX0KKworCXJlc3RvcmVfZmxhZ3MoZmxhZ3MpOworfQorCittb2R1bGVfaW5pdChpc3RhbGxpb25fbW9kdWxlX2luaXQpOworbW9kdWxlX2V4aXQoaXN0YWxsaW9uX21vZHVsZV9leGl0KTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJQ2hlY2sgZm9yIGFueSBhcmd1bWVudHMgcGFzc2VkIGluIG9uIHRoZSBtb2R1bGUgbG9hZCBjb21tYW5kIGxpbmUuCisgKi8KKworc3RhdGljIHZvaWQgc3RsaV9hcmdicmRzKHZvaWQpCit7CisJc3RsY29uZl90CWNvbmY7CisJc3RsaWJyZF90CSpicmRwOworCWludAkJbnJhcmdzLCBpOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bGlfYXJnYnJkcygpXG4iKTsKKyNlbmRpZgorCisJbnJhcmdzID0gc2l6ZW9mKHN0bGlfYnJkc3ApIC8gc2l6ZW9mKGNoYXIgKiopOworCisJZm9yIChpID0gc3RsaV9ucmJyZHM7IChpIDwgbnJhcmdzKTsgaSsrKSB7CisJCW1lbXNldCgmY29uZiwgMCwgc2l6ZW9mKGNvbmYpKTsKKwkJaWYgKHN0bGlfcGFyc2VicmQoJmNvbmYsIHN0bGlfYnJkc3BbaV0pID09IDApCisJCQljb250aW51ZTsKKwkJaWYgKChicmRwID0gc3RsaV9hbGxvY2JyZCgpKSA9PSAoc3RsaWJyZF90ICopIE5VTEwpCisJCQljb250aW51ZTsKKwkJc3RsaV9ucmJyZHMgPSBpICsgMTsKKwkJYnJkcC0+YnJkbnIgPSBpOworCQlicmRwLT5icmR0eXBlID0gY29uZi5icmR0eXBlOworCQlicmRwLT5pb2Jhc2UgPSBjb25mLmlvYWRkcjE7CisJCWJyZHAtPm1lbWFkZHIgPSBjb25mLm1lbWFkZHI7CisJCXN0bGlfYnJkaW5pdChicmRwKTsKKwl9Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUNvbnZlcnQgYW4gYXNjaWkgc3RyaW5nIG51bWJlciBpbnRvIGFuIHVuc2lnbmVkIGxvbmcuCisgKi8KKworc3RhdGljIHVuc2lnbmVkIGxvbmcgc3RsaV9hdG9sKGNoYXIgKnN0cikKK3sKKwl1bnNpZ25lZCBsb25nCXZhbDsKKwlpbnQJCWJhc2UsIGM7CisJY2hhcgkJKnNwOworCisJdmFsID0gMDsKKwlzcCA9IHN0cjsKKwlpZiAoKCpzcCA9PSAnMCcpICYmICgqKHNwKzEpID09ICd4JykpIHsKKwkJYmFzZSA9IDE2OworCQlzcCArPSAyOworCX0gZWxzZSBpZiAoKnNwID09ICcwJykgeworCQliYXNlID0gODsKKwkJc3ArKzsKKwl9IGVsc2UgeworCQliYXNlID0gMTA7CisJfQorCisJZm9yICg7ICgqc3AgIT0gMCk7IHNwKyspIHsKKwkJYyA9ICgqc3AgPiAnOScpID8gKFRPTE9XRVIoKnNwKSAtICdhJyArIDEwKSA6ICgqc3AgLSAnMCcpOworCQlpZiAoKGMgPCAwKSB8fCAoYyA+PSBiYXNlKSkgeworCQkJcHJpbnRrKCJTVEFMTElPTjogaW52YWxpZCBhcmd1bWVudCAlc1xuIiwgc3RyKTsKKwkJCXZhbCA9IDA7CisJCQlicmVhazsKKwkJfQorCQl2YWwgPSAodmFsICogYmFzZSkgKyBjOworCX0KKwlyZXR1cm4odmFsKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJUGFyc2UgdGhlIHN1cHBsaWVkIGFyZ3VtZW50IHN0cmluZywgaW50byB0aGUgYm9hcmQgY29uZiBzdHJ1Y3QuCisgKi8KKworc3RhdGljIGludCBzdGxpX3BhcnNlYnJkKHN0bGNvbmZfdCAqY29uZnAsIGNoYXIgKiphcmdwKQoreworCWNoYXIJKnNwOworCWludAlucmJyZG5hbWVzLCBpOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bGlfcGFyc2VicmQoY29uZnA9JXgsYXJncD0leClcbiIsIChpbnQpIGNvbmZwLCAoaW50KSBhcmdwKTsKKyNlbmRpZgorCisJaWYgKChhcmdwWzBdID09IChjaGFyICopIE5VTEwpIHx8ICgqYXJncFswXSA9PSAwKSkKKwkJcmV0dXJuKDApOworCisJZm9yIChzcCA9IGFyZ3BbMF0sIGkgPSAwOyAoKCpzcCAhPSAwKSAmJiAoaSA8IDI1KSk7IHNwKyssIGkrKykKKwkJKnNwID0gVE9MT1dFUigqc3ApOworCisJbnJicmRuYW1lcyA9IHNpemVvZihzdGxpX2JyZHN0cikgLyBzaXplb2Yoc3RsaWJyZHR5cGVfdCk7CisJZm9yIChpID0gMDsgKGkgPCBucmJyZG5hbWVzKTsgaSsrKSB7CisJCWlmIChzdHJjbXAoc3RsaV9icmRzdHJbaV0ubmFtZSwgYXJncFswXSkgPT0gMCkKKwkJCWJyZWFrOworCX0KKwlpZiAoaSA+PSBucmJyZG5hbWVzKSB7CisJCXByaW50aygiU1RBTExJT046IHVua25vd24gYm9hcmQgbmFtZSwgJXM/XG4iLCBhcmdwWzBdKTsKKwkJcmV0dXJuKDApOworCX0KKworCWNvbmZwLT5icmR0eXBlID0gc3RsaV9icmRzdHJbaV0udHlwZTsKKwlpZiAoKGFyZ3BbMV0gIT0gKGNoYXIgKikgTlVMTCkgJiYgKCphcmdwWzFdICE9IDApKQorCQljb25mcC0+aW9hZGRyMSA9IHN0bGlfYXRvbChhcmdwWzFdKTsKKwlpZiAoKGFyZ3BbMl0gIT0gKGNoYXIgKikgTlVMTCkgJiYgKCphcmdwWzJdICE9IDApKQorCQljb25mcC0+bWVtYWRkciA9IHN0bGlfYXRvbChhcmdwWzJdKTsKKwlyZXR1cm4oMSk7Cit9CisKKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglMb2NhbCBkcml2ZXIga2VybmVsIG1hbGxvYyByb3V0aW5lLgorICovCisKK3N0YXRpYyB2b2lkICpzdGxpX21lbWFsbG9jKGludCBsZW4pCit7CisJcmV0dXJuKCh2b2lkICopIGttYWxsb2MobGVuLCBHRlBfS0VSTkVMKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIGludCBzdGxpX29wZW4oc3RydWN0IHR0eV9zdHJ1Y3QgKnR0eSwgc3RydWN0IGZpbGUgKmZpbHApCit7CisJc3RsaWJyZF90CSpicmRwOworCXN0bGlwb3J0X3QJKnBvcnRwOworCXVuc2lnbmVkIGludAltaW5vcmRldjsKKwlpbnQJCWJyZG5yLCBwb3J0bnIsIHJjOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bGlfb3Blbih0dHk9JXgsZmlscD0leCk6IGRldmljZT0lc1xuIiwgKGludCkgdHR5LAorCQkoaW50KSBmaWxwLCB0dHktPm5hbWUpOworI2VuZGlmCisKKwltaW5vcmRldiA9IHR0eS0+aW5kZXg7CisJYnJkbnIgPSBNSU5PUjJCUkQobWlub3JkZXYpOworCWlmIChicmRuciA+PSBzdGxpX25yYnJkcykKKwkJcmV0dXJuKC1FTk9ERVYpOworCWJyZHAgPSBz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GV4dC4KKyAqLworCitzdGF0aWMgaW50IHN0bGlfc2V0cG9ydChzdGxpcG9ydF90ICpwb3J0cCkKK3sKKwlzdGxpYnJkX3QJKmJyZHA7CisJYXN5cG9ydF90CWFwb3J0OworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bGlfc2V0cG9ydChwb3J0cD0leClcbiIsIChpbnQpIHBvcnRwKTsKKyNlbmRpZgorCisJaWYgKHBvcnRwID09IChzdGxpcG9ydF90ICopIE5VTEwpCisJCXJldHVybigtRU5PREVWKTsKKwlpZiAocG9ydHAtPnR0eSA9PSAoc3RydWN0IHR0eV9zdHJ1Y3QgKikgTlVMTCkKKwkJcmV0dXJuKC1FTk9ERVYpOworCWlmICgocG9ydHAtPmJyZG5yIDwgMCkgJiYgKHBvcnRwLT5icmRuciA+PSBzdGxpX25yYnJkcykpCisJCXJldHVybigtRU5PREVWKTsKKwlicmRwID0gc3RsaV9icmRzW3BvcnRwLT5icmRucl07CisJaWYgKGJyZHAgPT0gKHN0bGlicmRfdCAqKSBOVUxMKQorCQlyZXR1cm4oLUVOT0RFVik7CisKKwlzdGxpX21rYXN5cG9ydChwb3J0cCwgJmFwb3J0LCBwb3J0cC0+dHR5LT50ZXJtaW9zKTsKKwlyZXR1cm4oc3RsaV9jbWR3YWl0KGJyZHAsIHBvcnRwLCBBX1NFVFBPUlQsICZhcG9ydCwgc2l6ZW9mKGFzeXBvcnRfdCksIDApKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJUG9zc2libHkgbmVlZCB0byB3YWl0IGZvciBjYXJyaWVyIChEQ0Qgc2lnbmFsKSB0byBjb21lIGhpZ2guIFNheQorICoJbWF5YmUgYmVjYXVzZSBpZiB3ZSBhcmUgY2xvY2FsIHRoZW4gd2UgZG9uJ3QgbmVlZCB0byB3YWl0Li4uCisgKi8KKworc3RhdGljIGludCBzdGx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HR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxpcG9ydF90ICopIE5VTEwpCisJCXJldHVybigwKTsKKwlpZiAoKHBvcnRwLT5icmRuciA8IDApIHx8IChwb3J0cC0+YnJkbnIgPj0gc3RsaV9ucmJyZHMpKQorCQlyZXR1cm4oMCk7CisJYnJkcCA9IHN0bGlfYnJkc1twb3J0cC0+YnJkbnJdOworCWlmIChicmRwID09IChzdGxpYnJkX3QgKikgTlVMTCkKKwkJcmV0dXJuKDApOworCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpKCk7CisJRUJSREVOQUJMRShicmRwKTsKKwlycCA9ICYoKHZvbGF0aWxlIGNka2FzeV90ICopIEVCUkRHRVRNRU1QVFIoYnJkcCwgcG9ydHAtPmFkZHIpKS0+dHhxOworCWhlYWQgPSAodW5zaWduZWQgaW50KSBycC0+aGVhZDsKKwl0YWlsID0gKHVuc2lnbmVkIGludCkgcnAtPnRhaWw7CisJaWYgKHRhaWwgIT0gKCh1bnNpZ25lZCBpbnQpIHJwLT50YWlsKSkKKwkJdGFpbCA9ICh1bnNpZ25lZCBpbnQpIHJwLT50YWlsOworCWxlbiA9IChoZWFkID49IHRhaWwpID8gKGhlYWQgLSB0YWlsKSA6IChwb3J0cC0+dHhzaXplIC0gKHRhaWwgLSBoZWFkKSk7CisJaWYgKChsZW4gPT0gMCkgJiYgdGVzdF9iaXQoU1RfVFhCVVNZLCAmcG9ydHAtPnN0YXRlKSkKKwkJbGVuID0gMTsKKwlFQlJERElTQUJMRShicmRwKTsKKwlyZXN0b3JlX2ZsYWdzKGZsYWdzKTsKKworCXJldHVybihsZW4pOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglHZW5lcmF0ZSB0aGUgc2VyaWFsIHN0cnVjdCBpbmZvLgorICovCisKK3N0YXRpYyBpbnQgc3RsaV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hdWRfYmFzZSA9IHNpby5iYXVkX2Jhc2U7CisJcG9ydHAtPmNsb3NlX2RlbGF5ID0gc2lvLmNsb3NlX2RlbGF5OworCXBvcnRwLT5jbG9zaW5nX3dhaXQgPSBzaW8uY2xvc2luZ193YWl0OworCXBvcnRwLT5jdXN0b21fZGl2aXNvciA9IHNpby5jdXN0b21fZGl2aXNvcjsKKworCWlmICgocmMgPSBzdGxpX3NldHBvcnQocG9ydHApKSA8IDApCisJCXJldHVybihyYyk7CisJcmV0dXJuKDApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyBpbnQgc3RsaV90aW9jbWdldChzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5LCBzdHJ1Y3QgZmlsZSAqZmlsZSkKK3sKKwlzdGxpcG9ydF90ICpwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJc3RsaWJyZF90ICpicmRwOworCWludCByYzsKKworCWlmIChwb3J0cCA9PSAoc3RsaXBvcnRfdCAqKSBOVUxMKQorCQlyZXR1cm4oLUVOT0RFVik7CisJaWYgKChwb3J0cC0+YnJkbnIgPCAwKSB8fCAocG9ydHAtPmJyZG5yID49IHN0bGlfbnJicmRzKSkKKwkJcmV0dXJuKDApOworCWJyZHAgPSBzdGxpX2JyZHNbcG9ydHAtPmJyZG5yXTsKKwlpZiAoYnJkcCA9PSAoc3RsaWJyZF90ICopIE5VTEwpCisJCXJldHVybigwKTsKKwlpZiAodHR5LT5mbGFncyAmICgxIDw8IFRUWV9JT19FUlJPUikpCisJCXJldHVybigtRUlPKTsKKworCWlmICgocmMgPSBzdGxpX2NtZHdhaXQoYnJkcCwgcG9ydHAsIEFfR0VUU0lHTkFMUywKKwkJCSAgICAgICAmcG9ydHAtPmFzaWcsIHNpemVvZihhc3lzaWdzX3QpLCAxKSkgPCAwKQorCQlyZXR1cm4ocmMpOworCisJ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nN0YXRlKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJVW5mbG93IGNvbnRyb2wgdGhlIGRldmljZSBzZW5kaW5nIHVzIGRhdGEuLi4gVGhhdCBtZWFucyB0aGF0IGFsbAorICoJd2UgaGF2ZSB0byBkbyBpcyBjbGVhciB0aGUgUlhTVE9QIHN0YXRlIGJpdC4gVGhlIG5leHQgcG9sbCBjYWxsCisgKgl3aWxsIHRoZW4gYmUgYWJsZSB0byBwYXNzIHRoZSBSWCBkYXRhIGJhY2sgdXAuCisgKi8KKworc3RhdGljIHZvaWQgc3RsaV91bnRocm90dGxlKHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisJc3RsaXBvcnRfdAkqcG9ydHA7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsaV91bnRocm90dGxlKHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxpcG9ydF90ICopIE5VTEwpCisJCXJldHVybjsKKworCWNsZWFyX2JpdChTVF9SWFNUT1AsICZwb3J0cC0+c3RhdGUpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglTdG9wIHRoZSB0cmFuc21pdHRlci4gQmFzaWNhbGx5IHRvIGRvIHRoaXMgd2Ugd2lsbCBqdXN0IHR1cm4gVFgKKyAqCWludGVycnVwdHMgb2ZmLgorICovCisKK3N0YXRpYyB2b2lkIHN0bGlfc3RvcChzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXN0bGlicmRfdAkqYnJkcDsKKwlzdGxpcG9ydF90CSpwb3J0cDsKKwlhc3ljdHJsX3QJYWN0cmw7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsaV9zdG9wKHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxpcG9ydF90ICopIE5VTEwpCisJCXJldHVybjsKKwlpZiAoKHBvcnRwLT5icmRuciA8IDApIHx8IChwb3J0cC0+YnJkbnIgPj0gc3RsaV9ucmJyZHMpKQorCQlyZXR1cm47CisJYnJkcCA9IHN0bGlfYnJkc1twb3J0cC0+YnJkbnJdOworCWlmIChicmRwID09IChzdGxpYnJkX3QgKikgTlVMTCkKKwkJcmV0dXJuOworCisJbWVtc2V0KCZhY3RybCwgMCwgc2l6ZW9mKGFzeWN0cmxfdCkpOworCWFjdHJsLnR4Y3RybCA9IENUX1NUT1BGTE9XOworI2lmIDAKKwlzdGxpX2NtZHdhaXQoYnJkcCwgcG9ydHAsIEFfUE9SVENUUkwsICZhY3RybCwgc2l6ZW9mKGFzeWN0cmxfdCksIDApOworI2VuZGlmCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVN0YXJ0IHRoZSB0cmFuc21pdHRlciBhZ2Fpbi4gSnVzdCB0dXJuIFRYIGludGVycnVwdHMgYmFjayBvbi4KKyAqLworCitzdGF0aWMgdm9pZCBzdGxpX3N0YXJ0KHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisJc3RsaXBvcnRfdAkqcG9ydHA7CisJc3RsaWJyZF90CSpicmRwOworCWFzeWN0cmxfdAlhY3RybDsKKworI2lmZGVmIERFQlVHCisJcHJpbn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lOworCisJCW1heG9mZiA9IGN1cm9mZiArIChicmRwLT5ucnBvcnRzICogTUFYTElORSk7CisJCWlmIChvZmYgPj0gbWF4b2ZmKSB7CisJCQljdXJvZmYgPSBtYXhvZmY7CisJCQljb250aW51ZTsKKwkJfQorCisJCXRvdGFscG9ydCA9IGJyZG5yICogU1RMX01BWFBPUlRTOworCQlmb3IgKHBvcnRuciA9IDA7IChwb3J0bnIgPCBicmRwLT5ucnBvcnRzKTsgcG9ydG5yKyssCisJCSAgICB0b3RhbHBvcnQrKykgeworCQkJcG9ydHAgPSBicmRwLT5wb3J0c1twb3J0bnJdOworCQkJaWYgKHBvcnRwID09IChzdGxpcG9ydF90ICopIE5VTEwpCisJCQkJY29udGludWU7CisJCQlpZiAob2ZmID49IChjdXJvZmYgKz0gTUFYTElORSkpCisJCQkJY29udGludWU7CisJCQlpZiAoKHBvcyAtIHBhZ2UgKyBNQVhMSU5FKSA+IGNvdW50KQorCQkJCWdvdG8gc3RsaV9yZWFkZG9uZTsKKwkJCXBvcyArPSBzdGxpX3BvcnRpbmZvKGJyZHAsIHBvcnRwLCB0b3RhbHBvcnQsIHBvcyk7CisJCX0KKwl9CisKKwkqZW9mID0gMTsKKworc3RsaV9yZWFkZG9uZToKKwkqc3RhcnQgPSBwYWdlOworCXJldHVybihwb3MgLSBwYWdlKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJR2VuZXJpYyBzZW5kIGNvbW1hbmQgcm91dGluZS4gVGhpcyB3aWxsIHNlbmQgYSBtZXNzYWdlIHRvIHRoZSBzbGF2ZSwKKyAqCW9mIHRoZSBzcGVjaWZpZWQgdHlwZSB3aXRoIHRoZSBzcGVjaWZpZWQgYXJndW1lbnQuIE11c3QgYmUgdmVyeQorICoJY2FyZWZ1bCBvZiBkYXRhIHRoYXQgd2lsbCBiZSBjb3BpZWQgb3V0IGZyb20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JiAweGZmZmYpOworCXBwLT52bWluID0gKHBvcnRwLT5wZmxhZyAmIFBfUlhJTUlOKSA/IDEgOiAwOworCXBwLT52dGltZSA9IChwb3J0cC0+cGZsYWcgJiBQX1JYSVRJTUUpID8gMSA6IDA7CisJcHAtPmNjWzFdID0gKHBvcnRwLT5wZmxhZyAmIFBfUlhUSE9MRCkgPyAxIDogMDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJQ29uc3RydWN0IGEgc2xhdmUgc2lnbmFscyBzdHJ1Y3R1cmUgZm9yIHNldHRpbmcgdGhlIERUUiBhbmQgUlRTCisgKglzaWduYWxzIGFzIHNwZWNpZmllZC4KKyAqLworCitzdGF0aWMgdm9pZCBzdGxpX21rYXN5c2lncyhhc3lzaWdzX3QgKnNwLCBpbnQgZHRyLCBpbnQgcnRzKQoreworI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfbWthc3lzaWdzKHNwPSV4LGR0cj0lZCxydHM9JWQpXG4iLAorCQkJKGludCkgc3AsIGR0ciwgcnRzKTsKKyNlbmRpZgorCisJbWVtc2V0KHNwLCAwLCBzaXplb2YoYXN5c2lnc190KSk7CisJaWYgKGR0ciA+PSAwKSB7CisJCXNwLT5zaWduYWwgfD0gU0dfRFRSOworCQlzcC0+c2lndmFsdWUgfD0gKChkdHIgPiAwKSA/IFNHX0RUUiA6IDApOworCX0KKwlpZiAocnRzID49IDApIHsKKwkJc3AtPnNpZ25hbCB8PSBTR19SVFM7CisJCXNwLT5zaWd2YWx1ZSB8PSAoKHJ0cyA+IDApID8gU0dfUlRTIDogMCk7CisJfQorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglDb252ZXJ0IHRoZSBzaWduYWxzIHJ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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfZWNwZW5hYmxlKHN0bGlicmRfdCAqYnJkcCkKK3sJCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9lY3BlbmFibGUoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisJb3V0YihFQ1BfQVRFTkFCTEUsIChicmRwLT5pb2Jhc2UgKyBFQ1BfQVRDT05GUikpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfZWNwZGlzYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfZWNwZGlzYWJsZShicmRwPSV4KVxuIiwgKGludCkgYnJkcCk7CisjZW5kaWYKKwlvdXRiKEVDUF9BVERJU0FCTEUsIChicmRwLT5pb2Jhc2UgKyBFQ1BfQVRDT05GUikpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyBjaGFyICpzdGxpX2VjcGdldG1lbXB0cihzdGxpYnJkX3QgKmJyZHAsIHVuc2lnbmVkIGxvbmcgb2Zmc2V0LCBpbnQgbGluZSkKK3sJCisJdm9pZAkJKnB0cjsKKwl1bnNpZ25lZCBjaGFyCXZhbDsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfZWNwZ2V0bWVtcHRyKGJyZHA9JXgsb2Zmc2V0PSV4KVxuIiwgKGludCkgYnJkcCwKKwkJKGludCkgb2Zmc2V0KTsKKyNlbmRpZgorCisJaWYgKG9mZnNldCA+IGJyZHAtPm1lbXNpemUpIHsKKwkJcHJpbnRrKEtFUk5fRVJSICJTVEFMTElPTjogc2hhcmVkIG1lbW9yeSBwb2ludGVyPSV4IG91dCBvZiAiCisJCQkJInJhbmdlIGF0IGxpbmU9JWQoJWQpLCBicmQ9JWRcbiIsCisJCQkoaW50KSBvZmZzZXQsIGxpbmUsIF9fTElORV9fLCBicmRwLT5icmRucik7CisJCXB0ciA9IE5VTEw7CisJCXZhbCA9IDA7CisJfSBlbHNlIHsKKwkJcHRyID0gYnJkcC0+bWVtYmFzZSArIChvZmZzZXQgJSBFQ1BfQVRQQUdFU0laRSk7CisJCXZhbCA9ICh1bnNpZ25lZCBjaGFyKSAob2Zmc2V0IC8gRUNQX0FUUEFHRVNJWkUpOworCX0KKwlvdXRiKHZhbCwgKGJyZHAtPmlvYmFzZSArIEVDUF9BVE1FTVBSKSk7CisJcmV0dXJuKHB0cik7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgc3RsaV9lY3ByZXNldChzdGxpYnJkX3QgKmJyZHApCit7CQorI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfZWNwcmVzZXQoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisKKwlvdXRiKEVDUF9BVFNUT1AsIChicmRwLT5pb2Jhc2UgKyBFQ1BfQVRDT05GUikpOworCXVkZWxheSgxMCk7CisJb3V0YihFQ1BfQVRESVNBQkxFLCAoYnJkcC0+aW9iYXNlICsgRUNQX0FUQ09ORlIpKTsKKwl1ZGVsYXkoNTAwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgdm9pZCBzdGxpX2VjcGludHIoc3RsaWJyZF90ICpicmRwKQorewkKKyNpZmRlZiBERUJVRworCXByaW50ayhLRVJOX0RFQlVHICJzdGxpX2VjcGludHIoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisJb3V0YigweDEsIGJyZHAtPmlvYmFzZSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVRoZSBmb2xsb3dpbmcgc2V0IG9mIGZ1bmN0aW9ucyBhY3Qgb24gRUNQIEVJU0EgYm9hcmRzLgorICovCisKK3N0YXRpYyB2b2lkIHN0bGlfZWNwZWlpbml0KHN0bGlicmRfdCAqYnJkcCkKK3sKKwl1bnNpZ25lZCBsb25nCW1lbWNvbmY7CisKKyNpZmRlZiBERUJVRworCXByaW50ayhLRVJOX0RFQlVHICJzdGxpX2VjcGVpaW5pdChicmRwPSV4KVxuIiwgKGludCkgYnJkcCk7CisjZW5kaWYKKworCW91dGIoMHgxLCAoYnJkcC0+aW9iYXNlICsgRUNQX0VJQlJERU5BQikpOworCW91dGIoRUNQX0VJU1RPUCwgKGJyZHAtPmlvYmFzZSArIEVDUF9FSUNPTkZSKSk7CisJdWRlbGF5KDEwKTsKKwlvdXRiKEVDUF9FSURJU0FCTEUsIChicmRwLT5pb2Jhc2UgKyBFQ1BfRUlDT05GUikpOworCXVkZWxheSg1MDApOworCisJbWVtY29uZiA9IChicmRwLT5tZW1hZGRyICYgRUNQX0VJQUREUk1BU0tMKSA+PiBFQ1BfRUlBRERSU0hGVEw7CisJb3V0YihtZW1jb25mLCAoYnJkcC0+aW9iYXNlICsgRUNQX0VJTUVNQVJMKSk7CisJbWVtY29uZiA9IChicmRwLT5tZW1hZGRyICYgRUNQX0VJQUREUk1BU0tIKSA+PiBFQ1BfRUlBRERSU0hGVEg7CisJb3V0YihtZW1jb25mLCAoYnJkcC0+aW9iYXNlICsgRUNQX0VJTUVNQVJIKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgc3RsaV9lY3BlaWVuYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorCW91dGIoRUNQX0VJRU5BQkxFLCAoYnJkcC0+aW9iYXNlICsgRUNQX0VJQ09ORlIpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgdm9pZCBzdGxpX2VjcGVpZGlzYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorCW91dGIoRUNQX0VJRElTQUJMRSwgKGJyZHAtPmlvYmFzZSArIEVDUF9FSUNPTkZSKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIGNoYXIgKnN0bGlfZWNwZWlnZXRtZW1wdHIoc3RsaWJyZF90ICpicmRwLCB1bnNpZ25lZCBsb25nIG9mZnNldCwgaW50IGxpbmUpCit7CQorCXZvaWQJCSpwdHI7CisJdW5zaWduZWQgY2hhcgl2YWw7CisKKyNpZmRlZiBERUJVRworCXByaW50ayhLRVJOX0RFQlVHICJzdGxpX2VjcGVpZ2V0bWVtcHRyKGJyZHA9JXgsb2Zmc2V0PSV4LGxpbmU9JWQpXG4iLAorCQkoaW50KSBicmRwLCAoaW50KSBvZmZzZXQsIGxpbmUpOworI2VuZGlmCisKKwlpZiAob2Zmc2V0ID4gYnJkcC0+bWVtc2l6ZSkgeworCQlwcmludGsoS0VSTl9FUlIgIlNUQUxMSU9OOiBzaGFyZWQgbWVtb3J5IHBvaW50ZXI9JXggb3V0IG9mICIKKwkJCQkicmFuZ2UgYXQgbGluZT0lZCglZCksIGJyZD0lZFxuIiwKKwkJCShpbnQpIG9mZnNldCwgbGluZSwgX19MSU5FX18sIGJyZHAtPmJyZG5yKTsKKwkJcHRyID0gTlVMTDsKKwkJdmFsID0gMDsKKwl9IGVsc2UgeworCQlwdHIgPSBicmRwLT5tZW1iYXNlICsgKG9mZnNldCAlIEVDUF9FSVBBR0VTSVpFKTsKKwkJaWYgKG9mZnNldCA8IEVDUF9FSVBBR0VTSVpFKQorCQkJdmFsID0gRUNQX0VJRU5BQkxFOworCQllbHNlCisJCQl2YWwgPSBFQ1BfRUlFTkFCTEUgfCAweDQwOworCX0KKwlvdXRiKHZhbCwgKGJyZHAtPmlvYmFzZSArIEVDUF9FSUNPTkZSKSk7CisJcmV0dXJuKHB0cik7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgc3RsaV9lY3BlaXJlc2V0KHN0bGlicmRfdCAqYnJkcCkKK3sJCisJb3V0YihFQ1BfRUlTVE9QLCAoYnJkcC0+aW9iYXNlICsgRUNQX0VJQ09ORlIpKTsKKwl1ZGVsYXkoMTApOworCW91dGIoRUNQX0VJRElTQUJMRSwgKGJyZHAtPmlvYmFzZSArIEVDUF9FSUNPTkZSKSk7CisJdWRlbGF5KDUwMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVRoZSBmb2xsb3dpbmcgc2V0IG9mIGZ1bmN0aW9ucyBhY3Qgb24gRUNQIE1DQSBib2FyZHMuCisgKi8KKworc3RhdGljIHZvaWQgc3RsaV9lY3BtY2VuYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorCW91dGIoRUNQX01DRU5BQkxFLCAoYnJkcC0+aW9iYXNlICsgRUNQX01DQ09ORlIpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgdm9pZCBzdGxpX2VjcG1jZGlzYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorCW91dGIoRUNQX01DRElTQUJMRSwgKGJyZHAtPmlvYmFzZSArIEVDUF9NQ0NPTkZSKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIGNoYXIgKnN0bGlfZWNwbWNnZXRtZW1wdHIoc3RsaWJyZF90ICpicmRwLCB1bnNpZ25lZCBsb25nIG9mZnNldCwgaW50IGxpbmUpCit7CQorCXZvaWQJCSpwdHI7CisJdW5zaWduZWQgY2hhcgl2YWw7CisKKwlpZiAob2Zmc2V0ID4gYnJkcC0+bWVtc2l6ZSkgeworCQlwcmludGsoS0VSTl9FUlIgIlNUQUxMSU9OOiBzaGFyZWQgbWVtb3J5IHBvaW50ZXI9JXggb3V0IG9mICIKKwkJCQkicmFuZ2UgYXQgbGluZT0lZCglZCksIGJyZD0lZFxuIiwKKwkJCShpbnQpIG9mZnNldCwgbGluZSwgX19MSU5FX18sIGJyZHAtPmJyZG5yKTsKKwkJcHRyID0gTlVMTDsKKwkJdmFsID0gMDsKKwl9IGVsc2UgeworCQlwdHIgPSBicmRwLT5tZW1iYXNlICsgKG9mZnNldCAlIEVDUF9NQ1BBR0VTSVpFKTsKKwkJdmFsID0gKCh1bnNpZ25lZCBjaGFyKSAob2Zmc2V0IC8gRUNQX01DUEFHRVNJWkUpKSB8IEVDUF9NQ0VOQUJMRTsKKwl9CisJb3V0Yih2YWwsIChicmRwLT5pb2Jhc2UgKyBFQ1BfTUNDT05GUikpOworCXJldHVybihwdHIpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfZWNwbWNyZXNldChzdGxpYnJkX3QgKmJyZHApCit7CQorCW91dGIoRUNQX01DU1RPUCwgKGJyZHAtPmlvYmFzZSArIEVDUF9NQ0NPTkZSKSk7CisJdWRlbGF5KDEwKTsKKwlvdXRiKEVDUF9NQ0RJU0FCTEUsIChicmRwLT5pb2Jhc2UgKyBFQ1BfTUNDT05GUikpOworCXVkZWxheSg1MDApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglUaGUgZm9sbG93aW5nIHNldCBvZiBmdW5jdGlvbnMgYWN0IG9uIEVDUCBQQ0kgYm9hcmRzLgorICovCisKK3N0YXRpYyB2b2lkIHN0bGlfZWNwcGNpaW5pdChzdGxpYnJkX3QgKmJyZHApCit7CisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9lY3BwY2lpbml0KGJyZHA9JXgpXG4iLCAoaW50KSBicmRwKTsKKyNlbmRpZgorCisJb3V0YihFQ1BfUENJU1RPUCwgKGJyZHAtPmlvYmFzZSArIEVDUF9QQ0lDT05GUikpOworCXVkZWxheSgxMCk7CisJb3V0YigwLCAoYnJkcC0+aW9iYXNlICsgRUNQX1BDSUNPTkZSKSk7CisJdWRlbGF5KDUwMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIGNoYXIgKnN0bGlfZWNwcGNpZ2V0bWVtcHRyKHN0bGlicmRfdCAqYnJkcCwgdW5zaWduZWQgbG9uZyBvZmZzZXQsIGludCBsaW5lKQorewkKKwl2b2lkCQkqcHRyOworCXVuc2lnbmVkIGNoYXIJdmFsOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9lY3BwY2lnZXRtZW1wdHIoYnJkcD0leCxvZmZzZXQ9JXgsbGluZT0lZClcbiIsCisJCShpbnQpIGJyZHAsIChpbnQpIG9mZnNldCwgbGluZSk7CisjZW5kaWYKKworCWlmIChvZmZzZXQgPiBicmRwLT5tZW1zaXplKSB7CisJCXByaW50ayhLRVJOX0VSUiAiU1RBTExJT046IHNoYXJlZCBtZW1vcnkgcG9pbnRlcj0leCBvdXQgb2YgIgorCQkJCSJyYW5nZSBhdCBsaW5lPSVkKCVkKSwgYm9hcmQ9JWRcbiIsCisJCQkJKGludCkgb2Zmc2V0LCBsaW5lLCBfX0xJTkVfXywgYnJkcC0+YnJkbnIpOworCQlwdHIgPSBOVUxMOworCQl2YWwgPSAwOworCX0gZWxzZSB7CisJCXB0ciA9IGJyZHAtPm1lbWJhc2UgKyAob2Zmc2V0ICUgRUNQX1BDSVBBR0VTSVpFKTsKKwkJdmFsID0gKG9mZnNldCAvIEVDUF9QQ0lQQUdFU0laRSkgPDwgMTsKKwl9CisJb3V0Yih2YWwsIChicmRwLT5pb2Jhc2UgKyBFQ1BfUENJQ09ORlIpKTsKKwlyZXR1cm4ocHRyKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgdm9pZCBzdGxpX2VjcHBjaXJlc2V0KHN0bGlicmRfdCAqYnJkcCkKK3sJCisJb3V0YihFQ1BfUENJU1RPUCwgKGJyZHAtPmlvYmFzZSArIEVDUF9QQ0lDT05GUikpOworCXVkZWxheSgxMCk7CisJb3V0YigwLCAoYnJkcC0+aW9iYXNlICsgRUNQX1BDSUNPTkZSKSk7CisJdWRlbGF5KDUwMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVRoZSBmb2xsb3dpbmcgcm91dGluZXMgYWN0IG9uIE9OYm9hcmRzLgorICovCisKK3N0YXRpYyB2b2lkIHN0bGlfb25iaW5pdChzdGxpYnJkX3QgKmJyZHApCit7CisJdW5zaWduZWQgbG9uZwltZW1jb25mOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9vbmJpbml0KGJyZHA9JWQpXG4iLCAoaW50KSBicmRwKTsKKyNlbmRpZgorCisJb3V0YihPTkJfQVRTVE9QLCAoYnJkcC0+aW9iYXNlICsgT05CX0FUQ09ORlIpKTsKKwl1ZGVsYXkoMTApOworCW91dGIoT05CX0FURElTQUJMRSwgKGJyZHAtPmlvYmFzZSArIE9OQl9BVENPTkZSKSk7CisJbWRlbGF5KDEwMDApOworCisJbWVtY29uZiA9IChicmRwLT5tZW1hZGRyICYgT05CX0FUQUREUk1BU0spID4+IE9OQl9BVEFERFJTSEZUOworCW91dGIobWVtY29uZiwgKGJyZHAtPmlvYmFzZSArIE9OQl9BVE1FTUFSKSk7CisJb3V0YigweDEsIGJyZHAtPmlvYmFzZSk7CisJbWRlbGF5KDEpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfb25iZW5hYmxlKHN0bGlicmRfdCAqYnJkcCkKK3sJCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9vbmJlbmFibGUoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisJb3V0YigoYnJkcC0+ZW5hYnZhbCB8IE9OQl9BVEVOQUJMRSksIChicmRwLT5pb2Jhc2UgKyBPTkJfQVRDT05GUikpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfb25iZGlzYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfb25iZGlzYWJsZShicmRwPSV4KVxuIiwgKGludCkgYnJkcCk7CisjZW5kaWYKKwlvdXRiKChicmRwLT5lbmFidmFsIHwgT05CX0FURElTQUJMRSksIChicmRwLT5pb2Jhc2UgKyBPTkJfQVRDT05GUikpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyBjaGFyICpzdGxpX29uYmdldG1lbXB0cihzdGxpYnJkX3QgKmJyZHAsIHVuc2lnbmVkIGxvbmcgb2Zmc2V0LCBpbnQgbGluZSkKK3sJCisJdm9pZAkqcHRyOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9vbmJnZXRtZW1wdHIoYnJkcD0leCxvZmZzZXQ9JXgpXG4iLCAoaW50KSBicmRwLAorCQkoaW50KSBvZmZzZXQpOworI2VuZGlmCisKKwlpZiAob2Zmc2V0ID4gYnJkcC0+bWVtc2l6ZSkgeworCQlwcmludGsoS0VSTl9FUlIgIlNUQUxMSU9OOiBzaGFyZWQgbWVtb3J5IHBvaW50ZXI9JXggb3V0IG9mICIKKwkJCQkicmFuZ2UgYXQgbGluZT0lZCglZCksIGJyZD0lZFxuIiwKKwkJCQkoaW50KSBvZmZzZXQsIGxpbmUsIF9fTElORV9fLCBicmRwLT5icmRucik7CisJCXB0ciA9IE5VTEw7CisJfSBlbHNlIHsKKwkJcHRyID0gYnJkcC0+bWVtYmFzZSArIChvZmZzZXQgJSBPTkJfQVRQQUdFU0laRSk7CisJfQorCXJldHVybihwdHIpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfb25icmVzZXQoc3RsaWJyZF90ICpicmRwKQorewkKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfb25icmVzZXQoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisKKwlvdXRiKE9OQl9BVFNUT1AsIChicmRwLT5pb2Jhc2UgKyBPTkJfQVRDT05GUikpOworCXVkZWxheSgxMCk7CisJb3V0YihPTkJfQVRESVNBQkxFLCAoYnJkcC0+aW9iYXNlICsgT05CX0FUQ09ORlIpKTsKKwltZGVsYXkoMTAwMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVRoZSBmb2xsb3dpbmcgcm91dGluZXMgYWN0IG9uIE9OYm9hcmQgRUlTQS4KKyAqLworCitzdGF0aWMgdm9pZCBzdGxpX29uYmVpbml0KHN0bGlicmRfdCAqYnJkcCkKK3sKKwl1bnNpZ25lZCBsb25nCW1lbWNvbmY7CisKKyNpZmRlZiBERUJVRworCXByaW50ayhLRVJOX0RFQlVHICJzdGxpX29uYmVpbml0KGJyZHA9JWQpXG4iLCAoaW50KSBicmRwKTsKKyNlbmRpZgorCisJb3V0YigweDEsIChicmRwLT5pb2Jhc2UgKyBPTkJfRUlCUkRFTkFCKSk7CisJb3V0YihPTkJfRUlTVE9QLCAoYnJkcC0+aW9iYXNlICsgT05CX0VJQ09ORlIpKTsKKwl1ZGVsYXkoMTApOworCW91dGIoT05CX0VJRElTQUJMRSwgKGJyZHAtPmlvYmFzZSArIE9OQl9FSUNPTkZSKSk7CisJbWRlbGF5KDEwMDApOworCisJbWVtY29uZiA9IChicmRwLT5tZW1hZGRyICYgT05CX0VJQUREUk1BU0tMKSA+PiBPTkJfRUlBRERSU0hGVEw7CisJb3V0YihtZW1jb25mLCAoYnJkcC0+aW9iYXNlICsgT05CX0VJTUVNQVJMKSk7CisJbWVtY29uZiA9IChicmRwLT5tZW1hZGRyICYgT05CX0VJQUREUk1BU0tIKSA+PiBPTkJfRUlBRERSU0hGVEg7CisJb3V0YihtZW1jb25mLCAoYnJkcC0+aW9iYXNlICsgT05CX0VJTUVNQVJIKSk7CisJb3V0YigweDEsIGJyZHAtPmlvYmFzZSk7CisJbWRlbGF5KDEpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfb25iZWVuYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfb25iZWVuYWJsZShicmRwPSV4KVxuIiwgKGludCkgYnJkcCk7CisjZW5kaWYKKwlvdXRiKE9OQl9FSUVOQUJMRSwgKGJyZHAtPmlvYmFzZSArIE9OQl9FSUNPTkZSKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgc3RsaV9vbmJlZGlzYWJsZShzdGxpYnJkX3QgKmJyZHApCit7CQorI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfb25iZWRpc2FibGUoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisJb3V0YihPTkJfRUlESVNBQkxFLCAoYnJkcC0+aW9iYXNlICsgT05CX0VJQ09ORlIpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgY2hhciAqc3RsaV9vbmJlZ2V0bWVtcHRyKHN0bGlicmRfdCAqYnJkcCwgdW5zaWduZWQgbG9uZyBvZmZzZXQsIGludCBsaW5lKQorewkKKwl2b2lkCQ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vYmFzZSArIE9OQl9FSUNPTkZSKSk7CisJdWRlbGF5KDEwKTsKKwlvdXRiKE9OQl9FSURJU0FCTEUsIChicmRwLT5pb2Jhc2UgKyBPTkJfRUlDT05GUikpOworCW1kZWxheSgxMDAwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJVGhlIGZvbGxvd2luZyByb3V0aW5lcyBhY3Qgb24gQnJ1bWJ5IGJvYXJkcy4KKyAqLworCitzdGF0aWMgdm9pZCBzdGxpX2JieWluaXQoc3RsaWJyZF90ICpicmRwKQoreworCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9FUlIgInN0bGlfYmJ5aW5pdChicmRwPSVkKVxuIiwgKGludCkgYnJkcCk7CisjZW5kaWYKKworCW91dGIoQkJZX0FUU1RPUCwgKGJyZHAtPmlvYmFzZSArIEJCWV9BVENPTkZSKSk7CisJdWRlbGF5KDEwKTsKKwlvdXRiKDAsIChicmRwLT5pb2Jhc2UgKyBCQllfQVRDT05GUikpOworCW1kZWxheSgxMDAwKTsKKwlvdXRiKDB4MSwgYnJkcC0+aW9iYXNlKTsKKwltZGVsYXkoMSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIGNoYXIgKnN0bGlfYmJ5Z2V0bWVtcHRyKHN0bGlicmRfdCAqYnJkcCwgdW5zaWduZWQgbG9uZyBvZmZzZXQsIGludCBsaW5lKQorewkKKwl2b2lkCQkqcHRyOworCXVuc2lnbmVkIGNoYXIJdmFsOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9FUlIgInN0bGlfYmJ5Z2V0bWVtcHRyKGJyZHA9JXgsb2Zmc2V0PSV4KVxuIiwgKGludCkgYnJkcCwKKwkJKGludCkgb2Zmc2V0KTsKKyNlbmRpZgorCisJaWYgKG9mZnNldCA+IGJyZHAtPm1lbXNpemUpIHsKKwkJcHJpbnRrKEtFUk5fRVJSICJTVEFMTElPTjogc2hhcmVkIG1lbW9yeSBwb2ludGVyPSV4IG91dCBvZiAiCisJCQkJInJhbmdlIGF0IGxpbmU9JWQoJWQpLCBicmQ9JWRcbiIsCisJCQkJKGludCkgb2Zmc2V0LCBsaW5lLCBfX0xJTkVfXywgYnJkcC0+YnJkbnIpOworCQlwdHIgPSBOVUxMOworCQl2YWwgPSAwOworCX0gZWxzZSB7CisJCXB0ciA9IGJyZHAtPm1lbWJhc2UgKyAob2Zmc2V0ICUgQkJZX1BBR0VTSVpFKTsKKwkJdmFsID0gKHVuc2lnbmVkIGNoYXIpIChvZmZzZXQgLyBCQllfUEFHRVNJWkUpOworCX0KKwlvdXRiKHZhbCwgKGJyZHAtPmlvYmFzZSArIEJCWV9BVENPTkZSKSk7CisJcmV0dXJuKHB0cik7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgc3RsaV9iYnlyZXNldChzdGxpYnJkX3QgKmJyZHApCit7CQorCisjaWZkZWYgREVCVUcKKwlwcmludGsoS0VSTl9ERUJVRyAic3RsaV9iYnlyZXNldChicmRwPSV4KVxuIiwgKGludCkgYnJkcCk7CisjZW5kaWYKKworCW91dGIoQkJZX0FUU1RPUCwgKGJyZHAtPmlvYmFzZSArIEJCWV9BVENPTkZSKSk7CisJdWRlbGF5KDEwKTsKKwlvdXRiKDAsIChicmRwLT5pb2Jhc2UgKyBCQllfQVRDT05GUikpOworCW1kZWxheSgxMDAwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJVGhlIGZvbGxvd2luZyByb3V0aW5lcyB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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bGlfc3RhbHJlc2V0KHN0bGlicmRfdCAqYnJkcCkKK3sJCisJdm9sYXRpbGUgdW5zaWduZWQgbG9uZwkqdmVjcDsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKEtFUk5fREVCVUcgInN0bGlfc3RhbHJlc2V0KGJyZHA9JXgpXG4iLCAoaW50KSBicmRwKTsKKyNlbmRpZgorCisJdmVjcCA9ICh2b2xhdGlsZSB1bnNpZ25lZCBsb25nICopIChicmRwLT5tZW1iYXNlICsgMHgzMCk7CisJKnZlY3AgPSAweGZmZmYwMDAwOworCW91dGIoMCwgYnJkcC0+aW9iYXNlKTsKKwltZGVsYXkoMTAwMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVRyeSB0byBmaW5kIGFuIEVDUCBib2FyZCBhbmQgaW5pdGlhbGl6ZSBpdC4gVGhpcyBoYW5kbGVzIG9ubHkgRUNQCisgKglib2FyZCB0eXBlcy4KKyAqLworCitzdGF0aWMgaW50IHN0bGlfaW5pdGVjcChzdGxpYnJkX3QgKmJyZHApCit7CisJY2RrZWNwc2lnX3QJc2lnOworCWNka2VjcHNpZ190CSpzaWdzcDsKKwl1bnNpZ25lZCBpbnQJc3RhdHVzLCBueHRpZDsKKwljaGFyCQkqbmFtZTsKKwlpbnQJCXBhbmVsbnIsIG5ycG9ydHM7CisKKyNpZmRlZiBERUJVRworCXByaW50ayhLRVJOX0RFQlVHICJzdGxpX2luaXRlY3AoYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisKKwlpZiAoIXJlcXVlc3RfcmVnaW9uKGJyZHAtPmlvYmFzZSwgYnJkcC0+aW9zaXplLCAiaXN0YWxsaW9uIikpCisJCXJldHVybiAtR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yzg0KSk7CisJCWlmIChzdGxpX2Vpc2FtZW1wcm9iZShicmRwKSkKKwkJCW91dGIoMCwgKGlvYmFzZSArIDB4Yzg0KSk7CisJCXN0bGlfYnJkaW5pdChicmRwKTsKKwl9CisKKwlyZXR1cm4oMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUZpbmQgdGhlIG5leHQgYXZhaWxhYmxlIGJvYXJkIG51bWJlciB0aGF0IGlzIGZyZWUuCisgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZkZWYJQ09ORklHX1BDSQorCisvKgorICoJV2UgaGF2ZSBhIFN0YWxsaW9uIGJvYXJkLiBBbGxvY2F0ZSBhIGJvYXJkIHN0cnVjdHVyZSBhbmQKKyAqCWluaXRpYWxpemUgaXQuIFJlYWQgaXRzIElPIGFuZCBNRU1PUlkgcmVzb3VyY2VzIGZyb20gUENJCisgKgljb25maWd1cmF0aW9uIHNwYWNlLgorICovCisKK3N0YXRpYyBpbnQgc3RsaV9pbml0cGNpYnJkKGludCBicmR0eXBlLCBzdHJ1Y3QgcGNpX2RldiAqZGV2cCkKK3sKKwlzdGxpYnJkX3QJKmJyZHA7CisKKyNpZmRlZiBERUJVRworCXByaW50ayhLRVJOX0RFQlVHICJzdGxpX2luaXRwY2licmQoYnJkdHlwZT0lZCxidXNucj0leCxkZXZucj0leClcbiIsCisJCWJyZHR5cGUsIGRldi0+YnVzLT5udW1iZXIsIGRldi0+ZGV2Zm4pOworI2VuZGlmCisKKwlpZiAocGNpX2VuYWJsZV9kZXZpY2UoZGV2cCkpCisJCXJldHVybigtRUlPKTsKKwlpZiAoKGJyZHAgPSBzdGxpX2FsbG9jYnJkKCkpID09IChzdGxpYnJkX3QgKikgTlVMTCkKKwk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ZSBhcyBpdCBpcyBmb3VuZC4KKyAqLworCitzdGF0aWMgaW50IHN0bGlfZmluZHBjaWJyZHModm9pZCkKK3sKKwlzdHJ1Y3QgcGNpX2RldgkqZGV2ID0gTlVMTDsKKwlpbnQJCXJjOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bGlfZmluZHBjaWJyZHMoKVxuIik7CisjZW5kaWYKKworCXdoaWxlICgoZGV2ID0gcGNpX2ZpbmRfZGV2aWNlKFBDSV9WRU5ET1JfSURfU1RBTExJT04sCisJICAgIFBDSV9ERVZJQ0VfSURfRUNSQSwgZGV2KSkpIHsKKwkJaWYgKChyYyA9IHN0bGlfaW5pdHBjaWJyZChCUkRfRUNQUENJLCBkZXYpKSkKKwkJCXJldHVybihyYyk7CisJfQorCisJcmV0dXJuKDApOworfQorCisjZW5kaWYKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJQWxsb2NhdGUgYSBuZXcgYm9hcmQgc3RydWN0dXJlLiBGaWxsIG91dCB0aGUgYmFzaWMgaW5mbyBpbiBpdC4KKyAqLworCitzdGF0aWMgc3RsaWJyZF90ICpzdGxpX2FsbG9jYnJkKHZvaWQpCit7CisJc3RsaWJyZF90CSpicmRwOworCisJYnJkcCA9IChzdGxpYnJkX3QgKikgc3RsaV9tZW1hbGxvYyhzaXplb2Yoc3RsaWJyZF90KSk7CisJaWYgKGJyZHAgPT0gKHN0bGlicmRfdCAqKSBOVUxMKSB7CisJCXByaW50ayhLRVJOX0VSUiAiU1RBTExJT046IGZhaWxlZCB0byBhbGxvY2F0ZSBtZW1vcnkgIgorCQkJCSIoc2l6ZT0lZClcbiIsIHNpemVvZihzdGxpYnJkX3QpKTsKKwkJcmV0dXJuKChzdGxpYnJkX3QgKikgTlVMTCk7CisJfQorCisJbWVtc2V0KGJyZHAsIDAsIHNpemVvZihzdGxpYnJkX3QpKTsKKwl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worCQl9CisJCWZwLT5mX3BvcyArPSBuOworCQljaGJ1ZiArPSBuOworCQlzaXplIC09IG47CisJfQorb3V0OgorCUVCUkRESVNBQkxFKGJyZHApOworCXJlc3RvcmVfZmxhZ3MoZmxhZ3MpOworCisJcmV0dXJuKGNvdW50KTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJUmV0dXJuIHRoZSBib2FyZCBzdGF0cyBzdHJ1Y3R1cmUgdG8gdXNlciBhcHAuCisgKi8KKworc3RhdGljIGludCBzdGxpX2dldGJyZHN0YXRzKGNvbWJyZF90IF9fdXNlciAqYnApCit7CisJc3RsaWJyZF90CSpicmRwOworCWludAkJaTsKKworCWlmIChjb3B5X2Zyb21fdXNlcigmc3RsaV9icmRzdGF0cywgYnAsIHNpemVvZihjb21icmRfdCkpKQorCQlyZXR1cm4gLUVGQVVMVDsKKwlpZiAoc3RsaV9icmRzdGF0cy5icmQgPj0gU1RMX01BWEJSRFMpCisJCXJldHVybigtRU5PREVWKTsKKwlicmRwID0gc3RsaV9icmRzW3N0bGlfYnJkc3RhdHMuYnJkXTsKKwlpZiAoYnJkcCA9PSAoc3RsaWJyZF90ICopIE5VTEwpCisJCXJldHVybigtRU5PREVWKTsKKworCW1lbXNldCgmc3RsaV9icmRzdGF0cywgMCwgc2l6ZW9mKGNvbWJyZF90KSk7CisJc3RsaV9icmRzdGF0cy5icmQgPSBicmRwLT5icmRucjsKKwlzdGxpX2JyZHN0YXRzLnR5cGUgPSBicmRwLT5icmR0eXBlOworCXN0bGlfYnJkc3RhdHMuaHdpZCA9IDA7CisJc3RsaV9icmRzdGF0cy5zdGF0ZSA9IGJyZHAtPnN0YXRlOworCXN0bGlfYnJkc3RhdHMuaW9hZGRyID0gYnJkcC0+aW9iYXNlOworCXN0bGlfYnJkc3RhdHMubWVtYWRkciA9IGJyZHAtPm1lbWFkZHI7CisJc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iAoIXBvcnRwKQorCQlyZXR1cm4gLUVOT0RFVjsKKwlpZiAoY29weV90b191c2VyKGFyZywgcG9ydHAsIHNpemVvZihzdGxpcG9ydF90KSkpCisJCXJldHVybiAtRUZBVUxUOworCXJldHVybiAwOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglSZXR1cm4gdGhlIGVudGlyZSBkcml2ZXIgYm9hcmQgc3RydWN0dXJlIHRvIGEgdXNlciBhcHAuCisgKi8KKworc3RhdGljIGludCBzdGxpX2dldGJyZHN0cnVjdChzdGxpYnJkX3QgX191c2VyICphcmcpCit7CisJc3RsaWJyZF90CSpicmRwOworCisJaWYgKGNvcHlfZnJvbV91c2VyKCZzdGxpX2R1bW15YnJkLCBhcmcsIHNpemVvZihzdGxpYnJkX3QpKSkKKwkJcmV0dXJuIC1FRkFVTFQ7CisJaWYgKChzdGxpX2R1bW15YnJkLmJyZG5yIDwgMCkgfHwgKHN0bGlfZHVtbXlicmQuYnJkbnIgPj0gU1RMX01BWEJSRFMpKQorCQlyZXR1cm4gLUVOT0RFVjsKKwlicmRwID0gc3RsaV9icmRzW3N0bGlfZHVtbXlicmQuYnJkbnJdOworCWlmICghYnJkcCkKKwkJcmV0dXJuIC1FTk9ERVY7CisJaWYgKGNvcHlfdG9fdXNlcihhcmcsIGJyZHAsIHNpemVvZihzdGxpYnJkX3QpKSkKKwkJcmV0dXJuIC1FRkFVTFQ7CisJcmV0dXJuIDA7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVRoZSAic3RhbGlvbWVtIiBkZXZpY2UgaXMgYWxzbyByZXF1aXJlZCB0byBkbyBzb21lIHNwZWNpYWwgb3BlcmF0aW9ucyBvbgorICoJdGhlIGJvYXJkLiBXZSBu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WMgREVGSU5FX1NQSU5MT0NLKGxjZF9sb2NrKTsKKworc3RhdGljIGludCBsY2RfaW9jdGwoc3RydWN0IGlub2RlICppbm9kZSwgc3RydWN0IGZpbGUgKmZpbGUsCisJCSAgICAgdW5zaWduZWQgaW50IGNtZCwgdW5zaWduZWQgbG9uZyBhcmcpOworCitzdGF0aWMgdW5zaWduZWQgaW50IGxjZF9wcmVzZW50ID0gMTsKKworLyogdXNlZCBpbiBhcmNoL21pcHMvY29iYWx0L3Jlc2V0LmMgKi8KK2ludCBsZWRfc3RhdGUgPSAwOworCisjaWYgZGVmaW5lZChDT05GSUdfVFVMSVApICYmIDAKKworI2RlZmluZSBNQVhfSU5URVJGQUNFUwk4CitzdGF0aWMgbGlua2NoZWNrX2Z1bmNfdCBsaW5rY2hlY2tfY2FsbGJhY2tzW01BWF9JTlRFUkZBQ0VTXTsKK3N0YXRpYyB2b2lkICpsaW5rY2hlY2tfY29va2llc1tNQVhfSU5URVJGQUNFU107CisKK2ludCBsY2RfcmVnaXN0ZXJfbGlua2NoZWNrX2Z1bmMoaW50IGlmYWNlX251bSwgdm9pZCAqZnVuYywgdm9pZCAqY29va2llKQoreworCWlmIChpZmFjZV9udW0gPCAwIHx8CisJICAgIGlmYWNlX251bSA+PSBNQVhfSU5URVJGQUNFUyB8fAorCSAgICBsaW5rY2hlY2tfY2FsbGJhY2tzW2lmYWNlX251bV0gIT0gTlVMTCkKKwkJcmV0dXJuIC0xOworCWxpbmtjaGVja19jYWxsYmFja3NbaWZhY2VfbnVtXSA9IChsaW5rY2hlY2tfZnVuY190KSBmdW5jOworCWxpbmtjaGVja19jb29raWVzW2lmYWNlX251bV0gPSBjb29raWU7CisJcmV0dXJuIDA7Cit9CisjZW5kaWYKKworc3RhdGljIGludCBsY2RfaW9jdGwoc3RydWN0IGlub2RlICppbm9kZSwgc3RydWN0IGZpbGUgKmZpbGUsCisJCSAgICAgdW5zaWduZWQgaW50IGNtZCwgdW5zaWduZWQgbG9uZyBhcmcp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ZWNrICAgICAgICAgICAgICA5MAorI2RlZmluZSBMSU5LX0NoZWNrXzIJCTkxCisKKy8vICBCdXR0b24gcGF0dGVybnMgIF9CIC0gc2luZ2xlIGxheWVyIGxjZCBib2FyZHMKKworI2RlZmluZSBCVVRUT05fTk9ORSAgICAgICAgICAgICAgIDB4M0YKKyNkZWZpbmUgQlVUVE9OX05PTkVfQiAgICAgICAgICAgICAweEZFCisKKyNkZWZpbmUgQlVUVE9OX0xlZnQgICAgICAgICAgICAgICAweDNCCisjZGVmaW5lIEJVVFRPTl9MZWZ0X0IgICAgICAgICAgICAgMHhGQQorCisjZGVmaW5lIEJVVFRPTl9SaWdodCAgICAgICAgICAgICAgMHgzNworI2RlZmluZSBCVVRUT05fUmlnaHRfQiAgICAgICAgICAgIDB4REUKKworI2RlZmluZSBCVVRUT05fVXAgICAgICAgICAgICAgICAgIDB4MkYKKyNkZWZpbmUgQlVUVE9OX1VwX0IgICAgICAgICAgICAgICAweEY2CisKKyNkZWZpbmUgQlVUVE9OX0Rvd24gICAgICAgICAgICAgICAweDFGCisjZGVmaW5lIEJVVFRPTl9Eb3duX0IgICAgICAgICAgICAgMHhFRQorCisjZGVmaW5lIEJVVFRPTl9OZXh0ICAgICAgICAgICAgICAgMHgzRAorI2RlZmluZSBCVVRUT05fTmV4dF9CICAgICAgICAgICAgIDB4N0UKKworI2RlZmluZSBCVVRUT05fRW50ZXIgICAgICAgICAgICAgIDB4M0UKKyNkZWZpbmUgQlVUVE9OX0VudGVyX0IgICAgICAgICAgICAweEJFCisKKyNkZWZpbmUgQlVUVE9OX1Jlc2V0X0IgICAgICAgICAgICAweEZDCisKKworLy8gZGVib3VuY2UgY29uc3RhbnRzCisKKyNkZWZpbmUgQlVUVE9OX1NFTlNFICAgICAgICAgICAgMTYwMDAwCisjZGVmaW5lIEJVVFRPTl9ERUJPVU5DRQkJNTAwMAorCisKKy8vICBHYWxpbGVvIHJlZ2lzdGVyIHN0dWZmCisKKyNkZWZpbmUga0dhbF9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wkJCX0gZWxzZSBpZiAobm9uYmxvY2spIHsKKwkJCQlpZiAocmV0diA9PSAwKQorCQkJCQlyZXR2ID0gLUVBR0FJTjsKKwkJCQlicmVhazsKKwkJCX0KKworCQkJcGFycG9ydF95aWVsZF9ibG9ja2luZyAobHBfdGFibGVbbWlub3JdLmRldik7CisJCQlscF90YWJsZVttaW5vcl0uY3VycmVudF9tb2RlIAorCQkJICA9IGxwX25lZ290aWF0ZSAocG9ydCwgCisJCQkJCSAgbHBfdGFibGVbbWlub3JdLmJlc3RfbW9kZSk7CisKKwkJfSBlbHNlIGlmIChuZWVkX3Jlc2NoZWQoKSkKKwkJCXNjaGVkdWxlICgpOworCisJCWlmIChjb3VudCkgeworCQkJY29weV9zaXplID0gY291bnQ7CisJCQlpZiAoY29weV9zaXplID4gTFBfQlVGRkVSX1NJWkUpCisJCQkJY29weV9zaXplID0gTFBfQlVGRkVSX1NJWkU7CisKKwkJCWlmIChjb3B5X2Zyb21fdXNlcihrYnVmLCBidWYsIGNvcHlfc2l6ZSkpIHsKKwkJCQlpZiAocmV0diA9PSAwKQorCQkJCQlyZXR2ID0gLUVGQVVMVDsKKwkJCQlicmVhazsKKwkJCX0KKwkJfQkKKwl9IHdoaWxlIChjb3VudCA+IDApOworCisJaWYgKHRlc3RfYW5kX2NsZWFyX2JpdChMUF9QUkVFTVBUX1JFUVVFU1QsIAorCQkJICAgICAgICZscF90YWJsZVttaW5vcl0uYml0cykpIHsKKwkJcHJpbnRrKEtFUk5fSU5GTyAibHAlZCByZWxlYXNpbmcgcGFycG9ydFxuIiwgbWlub3IpOworCQlwYXJwb3J0X25lZ290aWF0ZSAobHBfdGFibGVbbWlub3JdLmRldi0+cG9ydCwgCisJCQkJICAgSUVFRTEyODRfTU9ERV9DT01QQVQpOworCQlscF90YWJsZVttaW5vcl0uY3VycmVudF9tb2RlID0gSUVFRTEyODRfTU9ERV9DT01QQVQ7CisJCWxwX3JlbGVhc2VfcGFycG9ydCAoJmxwX3RhYmxlW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9OT10gPSB7IE5VTEwsICB9Oworc3RhdGljIGludCByZXNldCA9IDA7CisKK21vZHVsZV9wYXJhbV9hcnJheShwYXJwb3J0LCBjaGFycCwgTlVMTCwgMCk7Cittb2R1bGVfcGFyYW0ocmVzZXQsIGJvb2wsIDApOworCisjaWZuZGVmIE1PRFVMRQorc3RhdGljIGludCBfX2luaXQgbHBfc2V0dXAgKGNoYXIgKnN0cikKK3sKKwlzdGF0aWMgaW50IHBhcnBvcnRfcHRyOyAvLyBpbml0aWFsbHkgemVybworCWludCB4OworCisJaWYgKGdldF9vcHRpb24gKCZzdHIsICZ4KSkgeworCQlpZiAoeCA9PSAwKSB7CisJCQkvKiBkaXNhYmxlIGRyaXZlciBvbiAibHA9IiBvciAibHA9MCIgKi8KKwkJCXBhcnBvcnRfbnJbMF0gPSBMUF9QQVJQT1JUX09GRjsKKwkJfSBlbHNlIHsKKwkJCXByaW50ayhLRVJOX1dBUk5JTkcgIndhcm5pbmc6ICdscD0weCV4JyBpcyBkZXByZWNhdGVkLCBpZ25vcmVkXG4iLCB4KTsKKwkJCXJldHVybiAwOworCQl9CisJfSBlbHNlIGlmICghc3RybmNtcChzdHIsICJwYXJwb3J0IiwgNykpIHsKKwkJaW50IG4gPSBzaW1wbGVfc3RydG91bChzdHIrNywgTlVMTCwgMTApOworCQlpZiAocGFycG9ydF9wdHIgPCBMUF9OTykKKwkJCXBhcnBvcnRfbnJbcGFycG9ydF9wdHIrK10gPSBuOworCQllbHNlCisJCQlwcmludGsoS0VSTl9JTkZPICJscDogdG9vIG1hbnkgcG9ydHMsICVzIGlnbm9yZWQuXG4iLAorCQkJICAgICAgIHN0cik7CisJfSBlbHNlIGlmICghc3RyY21wKHN0ciwgImF1dG8iKSkgeworCQlwYXJwb3J0X25yWzBdID0gTFBfUEFSUE9SVF9BVVRPOworCX0gZWxzZSBpZiAoIXN0cmNtcChzdHIsICJub25lIikpIHsKKwkJcGFycG9ydF9ucltwYXJwb3J0X3B0cisrXSA9IExQX1B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BfdGFibGVbaV0ubGFzdF9lcnJvciA9IDA7CisJCWluaXRfd2FpdHF1ZXVlX2hlYWQgKCZscF90YWJsZVtpXS53YWl0cSk7CisJCWluaXRfd2FpdHF1ZXVlX2hlYWQgKCZscF90YWJsZVtpXS5kYXRhcSk7CisJCWluaXRfTVVURVggKCZscF90YWJsZVtpXS5wb3J0X211dGV4KTsKKwkJbHBfdGFibGVbaV0udGltZW91dCA9IDEwICogSFo7CisJfQorCisJaWYgKHJlZ2lzdGVyX2NocmRldiAoTFBfTUFKT1IsICJscCIsICZscF9mb3BzKSkgeworCQlwcmludGsgKEtFUk5fRVJSICJscDogdW5hYmxlIHRvIGdldCBtYWpvciAlZFxuIiwgTFBfTUFKT1IpOworCQlyZXR1cm4gLUVJTzsKKwl9CisKKwlkZXZmc19ta19kaXIoInByaW50ZXJzIik7CisJbHBfY2xhc3MgPSBjbGFzc19zaW1wbGVfY3JlYXRlKFRISVNfTU9EVUxFLCAicHJpbnRlciIpOworCWlmIChJU19FUlIobHBfY2xhc3MpKSB7CisJCWVyciA9IFBUUl9FUlIobHBfY2xhc3MpOworCQlnb3RvIG91dF9kZXZmczsKKwl9CisKKwlpZiAocGFycG9ydF9yZWdpc3Rlcl9kcml2ZXIgKCZscF9kcml2ZXIpKSB7CisJCXByaW50ayAoS0VSTl9FUlIgImxwOiB1bmFibGUgdG8gcmVnaXN0ZXIgd2l0aCBwYXJwb3J0XG4iKTsKKwkJZXJyID0gLUVJTzsKKwkJZ290byBvdXRfY2xhc3M7CisJfQorCisJaWYgKCFscF9jb3VudCkgeworCQlwcmludGsgKEtFUk5fSU5GTyAibHA6IGRyaXZlciBsb2FkZWQgYnV0IG5vIGRldmljZXMgZm91bmRcbiIpOworI2lmbmRlZiBDT05GSUdfUEFSUE9SVF8xMjg0CisJCWlmIChwYXJwb3J0X25yWzBdID09IExQX1BBUlBPUlRfQVVUTykKKwkJCXByaW50ayAoS0VSTl9JTkZPICJscDogKGlzIElFRUUgMTI4NCBzdXB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yZXNvdXJjZV9zdGFydCAocCwgMik7CisJYm9hcmQtPmJvYXJkVHlwZSA9IGJvYXJkX3R5cGU7CisJc3dpdGNoIChib2FyZF90eXBlKSB7CisJY2FzZSBNT1hBX0JPQVJEX0MyMThfSVNBOgorCWNhc2UgTU9YQV9CT0FSRF9DMjE4X1BDSToKKwkJYm9hcmQtPm51bVBvcnRzID0gODsKKwkJYnJlYWs7CisKKwljYXNlIE1PWEFfQk9BUkRfQ1AyMDRKOgorCQlib2FyZC0+bnVtUG9ydHMgPSA0OworCQlicmVhazsKKwlkZWZhdWx0OgorCQlib2FyZC0+bnVtUG9ydHMgPSAwOworCQlicmVhazsKKwl9CisJYm9hcmQtPmJ1c1R5cGUgPSBNT1hBX0JVU19UWVBFX1BDSTsKKwlib2FyZC0+cGNpSW5mby5idXNOdW0gPSBwLT5idXMtPm51bWJlcjsKKwlib2FyZC0+cGNpSW5mby5kZXZOdW0gPSBwLT5kZXZmbiA+PiAzOworCisJcmV0dXJuICgwKTsKK30KKyNlbmRpZiAvKiBDT05GSUdfUENJICovCisKK3N0YXRpYyBpbnQgX19pbml0IG1veGFfaW5pdCh2b2lkKQoreworCWludCBpLCBudW1Cb2FyZHM7CisJc3RydWN0IG1veGFfc3RyICpjaDsKKworCXByaW50ayhLRVJOX0lORk8gIk1PWEEgSW50ZWxsaW8gZmFtaWx5IGRyaXZlciB2ZXJzaW9uICVzXG4iLCBNT1hBX1ZFUlNJT04pOworCW1veGFEcml2ZXIgPSBhbGxvY190dHlfZHJpdmVyKE1BWF9QT1JUUyArIDEpOworCWlmICghbW94YURyaXZlcikKKwkJcmV0dXJuIC1FTk9NRU07CisKKwlpbml0X01VVEVYKCZtb3hhQnVmZlNlbSk7CisJbW94YURyaXZlci0+b3duZXIgPSBUSElTX01PRFVMRTsKKwltb3hhRHJpdmVyLT5uYW1lID0gInR0eWEiOworCW1veGFEcml2ZXItPmRldmZzX25hbWUgPSAidHRzL2EiOworCW1veGFEcml2ZXItPm1ham9yID0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wkvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisJaWYgKCAhKGNoLT5zdGF0dXNmbGFncyAmIExPV1dBSVQpICYmCisJICAgICAoKGxlbiAhPSBjb3VudCkgfHwgKE1veGFQb3J0VHhGcmVlKHBvcnQpIDw9IDEwMCkpICkKKwkqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisJY2gtPnN0YXR1c2ZsYWdzIHw9IExPV1dBSVQ7CisJcmV0dXJuIChsZW4pOworfQorCitzdGF0aWMgaW50IG1veGFfd3JpdGVfcm9vbShzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXN0cnVjdCBtb3hhX3N0ciAqY2g7CisKKwlpZiAodHR5LT5zdG9wcGVkKQorCQlyZXR1cm4gKDApOworCWNoID0gKHN0cnVjdCBtb3hhX3N0ciAqKSB0dHktPmRyaXZlcl9kYXRhOworCWlmIChjaCA9PSBOVUxMKQorCQlyZXR1cm4gKDApOworCXJldHVybiAoTW94YVBvcnRUeEZyZWUoY2gtPnBvcnQpKTsKK30KKworc3RhdGljIHZvaWQgbW94YV9mbHVzaF9idWZmZXIoc3RydWN0IHR0eV9zdHJ1Y3QgKnR0eSkKK3sKKwlzdHJ1Y3QgbW94YV9zdHIgKmNoID0gKHN0cnVjdCBtb3hhX3N0ciAqKSB0dHktPmRyaXZlcl9kYXRhOworCisJaWYgKGNoID09IE5VTEwpCisJCXJldHVybjsKKwlNb3hhUG9ydEZsdXNoRGF0YShjaC0+cG9ydCwgMSk7CisJdHR5X3dha2V1cCh0dHkpOworfQorCitzdGF0aWMgaW50IG1veGFfY2hhcnNfaW5fYnVmZmVyKHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisJaW50IGNoYXJzOworCXN0cnVjdCBtb3hhX3N0ciAqY2ggPSAoc3RydWN0IG1veGFfc3RyICopIHR0eS0+ZHJpdmVyX2RhdGE7CisKKwkvKgorCSAqIFNpZ2gu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UgKyAyNCkKKyNkZWZpbmUgVE1TMzIwX0NMT0NLCShDb25maWdfYmFzZSArIDI2KQorCisvKgorICogICAgREFUQSBCVUZGRVIgaW4gRFJBTQorICovCisjZGVmaW5lIEV4dGVybl90YWJsZQkweDQwMAkvKiBCYXNlIGFkZHJlc3Mgb2YgdGhlIGV4dGVybmFsIHRhYmxlCisJCQkJICAgKDI0IHdvcmRzICogICAgNjQpIHRvdGFsIDNLIGJ5dGVzCisJCQkJICAgKDI0IHdvcmRzICogMTI4KSB0b3RhbCA2SyBieXRlcyAqLworI2RlZmluZSBFeHRlcm5fc2l6ZQkweDYwCS8qIDk2IGJ5dGVzICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSWHJwdHIJCTB4MDAJLyogcmVhZCBwb2ludGVyIGZvciBSWCBidWZmZXIgICAgICovCisjZGVmaW5lIFJYd3B0cgkJMHgwMgkvKiB3cml0ZSBwb2ludGVyIGZvciBSWCBidWZmZXIgICAgKi8KKyNkZWZpbmUgVFhycHRyCQkweDA0CS8qIHJlYWQgcG9pbnRlciBmb3IgVFggYnVmZmVyICAgICAqLworI2RlZmluZSBUWHdwdHIJCTB4MDYJLyogd3JpdGUgcG9pbnRlciBmb3IgVFggYnVmZmVyICAgICovCisjZGVmaW5lIEhvc3RTdGF0CTB4MDgJLyogSVJRIGZsYWcgYW5kIGdlbmVyYWwgZmxhZyAgICAgICovCisjZGVmaW5lIEZsYWdTdGF0CTB4MEEKKyNkZWZpbmUgRmxvd0NvbnRyb2wJMHgwQwkvKiBCNyBCNiBCNSBCNCBCMyBCMiBCMSBCMCAgICAgICAgICAgICAgKi8KKwkJCQkJLyogIHggIHggIHggIHggIHwgIHwgIHwgIHwgICAgICAgICAgICAqLworCQkJCQkvKiAgICAgICAgICAgICAgfCAgfCAgfCAgKyBDVFMgZmxvdyAgICovCisJCQkJCS8qICAgICAgICAgICAgICB8ICB8ICArLS0tIFJUUyBmbG93ICAgKi8KKwkJCQkJLyogICAgICAgICAg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IF9fdXNlciAqLCBpbnQpOworc3RhdGljIGludCBtb3hhZmluZGNhcmQoaW50KTsKK3N0YXRpYyBpbnQgbW94YWxvYWQzMjBiKGludCwgdW5zaWduZWQgY2hhciBfX3VzZXIgKiwgaW50KTsKK3N0YXRpYyBpbnQgbW94YWxvYWRjb2RlKGludCwgdW5zaWduZWQgY2hhciBfX3VzZXIgKiwgaW50KTsKK3N0YXRpYyBpbnQgbW94YWxvYWRjMjE4KGludCwgdm9pZCBfX2lvbWVtICosIGludCk7CitzdGF0aWMgaW50IG1veGFsb2FkYzMyMChpbnQsIHZvaWQgX19pb21lbSAqLCBpbnQsIGludCAqKTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKglEcml2ZXIgbGV2ZWwgZnVuY3Rpb25zOiAJCQkJCSAgICAgKgorICoJMS4gTW94YURyaXZlckluaXQodm9pZCk7CQkJCQkgICAgICoKKyAqCTIuIE1veGFEcml2ZXJJb2N0bCh1bnNpZ25lZCBpbnQgY21kLCB1bnNpZ25lZCBsb25nIGFyZywgaW50IHBvcnQpOyAgICoKKyAqCTMuIE1veGFEcml2ZXJQb2xsKHZvaWQpOwkJCQkJICAgICAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit2b2lkIE1veGFEcml2ZXJJbml0KHZvaWQpCit7CisJaW50IGk7CisKKwltb3hhRnVuY1RvdXQgPSBIWiAvIDI7CS8qIDUwMCBtaW5pLXNlY29uZHMgKi8KKwltb3hhQ2FyZCA9IDA7CisJbW94YUxvZy50aWNrID0gMDsKKwltb3hhTG93V2F0ZXJDaGsgPSAwOworCWZvciAoaSA9IDA7IGkgPCBNQVhfUE9SVFM7IGkrKykgeworCQltb3hhQ2hrUG9ydFtpXSA9IDA7CisJCW1veGFMb3dDaGtGbGFnW2ldID0g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qIE1BWF9QT1JUU19QRVJfQk9BUkQ7CisJCQlmb3IgKHBvcnQgPSAwOyBwb3J0IDwgcG9ydHM7IHBvcnQrKywgcCsrKSB7CisJCQkJaWYgKG1veGFMb3dDaGtGbGFnW3BdKSB7CisJCQkJCW1veGFMb3dDaGtGbGFnW3BdID0gMDsKKwkJCQkJb2ZzQWRkciA9IG1veGFUYWJsZUFkZHJbcF07CisJCQkJCWxvd193YXRlcl9jaGVjayhvZnNBZGRyKTsKKwkJCQl9CisJCQl9CisJCX0KKwl9CisJbW94YUxvd1dhdGVyQ2hrID0gMDsKKwlyZXR1cm4gKDApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqCUNhcmQgbGV2ZWwgZnVuY3Rpb246CQkJCQkJICAgICAqCisgKgkxLiBNb3hhUG9ydHNPZkNhcmQoaW50IGNhcmRubyk7IAkJCQkgICAgICoKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK2ludCBNb3hhUG9ydHNPZkNhcmQoaW50IGNhcmRubykKK3sKKworCWlmIChtb3hhX2JvYXJkc1tjYXJkbm9dLmJvYXJkVHlwZSA9PSAwKQorCQlyZXR1cm4gKDApOworCXJldHVybiAobW94YV9ib2FyZHNbY2FyZG5vXS5udW1Qb3J0cyk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoJUG9ydCBsZXZlbCBmdW5jdGlvbnM6CQkJCQkJICAgICAqCisgKgkxLiAgTW94YVBvcnRJc1ZhbGlkKGludCBwb3J0KTsJCQkJCSAgICAgKgorICoJMi4gIE1veGFQb3J0RW5hYmxlKGludCBwb3J0KTsJCQkJCSAgICAgKgorICoJMy4gIE1veGFQb3J0R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5lIG11c3QgYmUKKyAqICAgICAgICAgICAgICAgICAgICAgIGNhbGxlZCB3aGVuIGluaXRpYWxpemVkIGRyaXZlci4KKyAqICAgICAgU3ludGF4OgorICogICAgICB2b2lkIE1veGFEcml2ZXJJbml0KCk7CisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjogICAgIE1veGEgZHJpdmVyIHByaXZhdGUgSU9DVEwgY29tbWFuZCBwcm9jZXNzaW5nLgorICogICAgICBTeW50YXg6CisgKiAgICAgIGludCAgTW94YURyaXZlcklvY3RsKHVuc2lnbmVkIGludCBjbWQsIHVuc2lnbmVkIGxvbmcgYXJnLCBpbnQgcG9ydCk7CisgKgorICogICAgICAgICAgIHVuc2lnbmVkIGludCBjbWQgICA6IElPQ1RMIGNvbW1hbmQKKyAqICAgICAgICAgICB1bnNpZ25lZCBsb25nIGFyZyAgOiBJT0NUTCBhcmd1bWVudAorICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIDAgIChPSykKKyAqICAgICAgICAgICAgICAgICAgICAgIC1FSU5WQUwKKyAqICAgICAgICAgICAgICAgICAgICAgIC1FTk9JT0NUTENNRAorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDM6ICAgICBNb3hhIGRyaXZlciBwb2xsaW5nIHByb2Nlc3Mgcm91dGluZS4KKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFEcml2ZXJQb2xsKHZvaWQpOworICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIDAgICAgICAgOyBwb2xsaW5nIE8uSy4KKyAqICAgICAgICAgICAgICAgICAgICAgIC0xICAgICAgOiBubyBhbnkgTW94YSBjYXJkLiAgICAgICAgICAgICAKKyAqCisgKgorICogICAgICBGdW5jdGlvbiA0OiAgICAgR2V0IHRoZSBwb3J0cyBvZiB0aGlzIGNhcmQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydHNPZkNhcmQoaW50IGNhcmRubyk7CisgKgorICogICAgICAgICAgIGludCBjYXJkbm8gICAgICAgICA6IGNhcmQgbnVtYmVyICgwIC0gMykKKyAqCisgKiAgICAgICAgICAgcmV0dXJuOiAgICAwICAgICAgIDogdGhpcyBjYXJkIGlzIGludmFsaWQKKyAqICAgICAgICAgICAgICAgICAgICAgIDgvMTYvMjQvMzIKKyAqCisgKgorICogICAgICBGdW5jdGlvbiA1OiAgICAgQ2hlY2sgdGhpcyBwb3J0IGlzIHZhbGlkIG9yIGludmFsaWQKKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0SXNWYWxpZChpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcsIHJlZiBwb3J0IGRlc2NyaXB0aW9uKQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIDAgICAgICAgOiB0aGlzIHBvcnQgaXMgaW52YWxpZAorICogICAgICAgICAgICAgICAgICAgICAgMSAgICAgICA6IHRoaXMgcG9ydCBpcyB2YWxpZAorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDY6ICAgICBFbmFibGUgdGhpcyBwb3J0IHRvIHN0YXJ0IFR4L1J4IGRhdGEuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgdm9pZCBNb3hhUG9ydEVuYWJsZShpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gNzogICAgIERpc2FibGUgdGhpcyBwb3J0CisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgdm9pZCBNb3hhUG9ydERpc2FibGUoaW50IHBvcnQpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDg6ICAgICBHZXQgdGhlIG1heGltdW4gYXZhaWxhYmxlIGJhdWQgcmF0ZSBvZiB0aGlzIHBvcnQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgbG9uZyBNb3hhUG9ydEdldE1heEJhdWQoaW50IHBvcnQpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIDAgICAgICAgOiB0aGlzIHBvcnQgaXMgaW52YWxpZAorICogICAgICAgICAgICAgICAgICAgICAgMzg0MDAvNTc2MDAvMTE1MjAwIGJwcworICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDk6ICAgICBHZXQgdGhlIGN1cnJlbnQgYmF1ZCByYXRlIG9mIHRoaXMgcG9ydC4KKyAqICAgICAgU3ludGF4OgorICogICAgICBsb25nIE1veGFQb3J0R2V0Q3VyQmF1ZChpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgMCAgICAgICA6IHRoaXMgcG9ydCBpcyBpbnZhbGlkCisgKiAgICAgICAgICAgICAgICAgICAgICA1MCAtIDExNTIwMCBicHMKKyAqCisgKgorICogICAgICBGdW5jdGlvbiAxMDogICAgU2V0dGluZyBiYXVkIHJhdGUgb2YgdGhpcyBwb3J0LgorICogICAgICBTeW50YXg6CisgKiAgICAgIGxvbmcgTW94YVBvcnRTZXRCYXVkKGludCBwb3J0LCBsb25nIGJhdWQpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICogICAgICAgICAgIGxvbmcgYmF1ZCAgICAgICAgICA6IGJhdWQgcmF0ZSAoNTAgLSAxMTUyMDApCisgKgorICogICAgICAgICAgIHJldHVybjogICAgMCAgICAgICA6IHRoaXMgcG9ydCBpcyBpbnZhbGlkIG9yIGJhdWQgPCA1MAorICogICAgICAgICAgICAgICAgICAgICAgNTAgLSAxMTUyMDAgOiB0aGUgcmVhbCBiYXVkIHJhdGUgc2V0IHRvIHRoZSBwb3J0LCBpZgorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGUgYXJndW1lbnQgYmF1ZCBpcyBsYXJnZSB0aGFuIG1heGltdW4KKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWxhYmxlIGJhdWQgcmF0ZSwgdGhlIHJlYWwgc2V0dGluZworICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXVkIHJhdGUgd2lsbCBiZSB0aGUgbWF4aW11biBiYXVkIHJhdGUuCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMTE6ICAgIFNldHRpbmcgdGhlIGRhdGEtYml0cy9zdG9wLWJpdHMvcGFyaXR5IG9mIHRoaXMgcG9ydAorICogICAgICBTeW50YXg6CisgKiAgICAgIGludCAgTW94YVBvcnRTZXRNb2RlKGludCBwb3J0LCBpbnQgZGF0YWJpdHMsIGludCBzdG9wYml0cywgaW50IHBhcml0eSk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKiAgICAgICAgICAgaW50IGRhdGFiaXRzICAgICAgIDogZGF0YSBiaXRzICg4LzcvNi81KQorICogICAgICAgICAgIGludCBzdG9wYml0cyAgICAgICA6IHN0b3AgYml0cyAoMi8xLzAsIDAgc2hvdyAxLjUgc3RvcCBiaXRzKQorIGludCBwYXJpdHkgICAgIDogcGFyaXR5ICgwOk5vbmUsMTpPZGQsMjpFdmVuLDM6TWFyayw0OlNwYWNlKQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIC0xICAgICAgOiBpbnZhbGlkIHBhcmFtZXRlcgorICogICAgICAgICAgICAgICAgICAgICAgMCAgICAgICA6IHNldHRpbmcgTy5LLgorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDEyOiAgICBDb25maWd1cmUgdGhlIHBvcnQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydFNldFRlcm1pbyhpbnQgcG9ydCwgc3RydWN0IHRlcm1pb3MgKnRlcm1pbyk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKiAgICAgICAgICAgc3RydWN0IHRlcm1pb3MgKiB0ZXJtaW8gOiB0ZXJtaW8gc3RydWN0dXJlIHBvaW50ZXIKKyAqCisgKiAgICAgICAgICAgcmV0dXJuOiAgICAtMSAgICAgIDogdGhpcyBwb3J0IGlzIGludmFsaWQgb3IgdGVybWlvID09IE5VTEwKKyAqICAgICAgICAgICAgICAgICAgICAgIDAgICAgICAgOiBzZXR0aW5nIE8uSy4KKyAqCisgKgorICogICAgICBGdW5jdGlvbiAxMzogICAgR2V0IHRoZSBEVFIvUlRTIHN0YXRlIG9mIHRoaXMgcG9ydC4KKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0R2V0TGluZU91dChpbnQgcG9ydCwgaW50ICpkdHJTdGF0ZSwgaW50ICpydHNTdGF0ZSk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKiAgICAgICAgICAgaW50ICogZHRyU3RhdGUgICAgIDogcG9pbnRlciB0byBJTlQgdG8gcmVjZWl2ZSB0aGUgY3VycmVudCBEVFIKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS4gKGlmIE5VTEwsIHRoaXMgZnVuY3Rpb24gd2lsbCBub3QKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZSB0byB0aGlzIGFkZHJlc3MpCisgKiAgICAgICAgICAgaW50ICogcnRzU3RhdGUgICAgIDogcG9pbnRlciB0byBJTlQgdG8gcmVjZWl2ZSB0aGUgY3VycmVudCBSVFMKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS4gKGlmIE5VTEwsIHRoaXMgZnVuY3Rpb24gd2lsbCBub3QKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZSB0byB0aGlzIGFkZHJlc3MpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgLTEgICAgICA6IHRoaXMgcG9ydCBpcyBpbnZhbGlkCisgKiAgICAgICAgICAgICAgICAgICAgICAwICAgICAgIDogTy5LLgorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDE0OiAgICBTZXR0aW5nIHRoZSBEVFIvUlRTIG91dHB1dCBzdGF0ZSBvZiB0aGlzIHBvcnQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgdm9pZCBNb3hhUG9ydExpbmVDdHJsKGludCBwb3J0LCBpbnQgZHRyU3RhdGUsIGludCBydHNTdGF0ZSk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKiAgICAgICAgICAgaW50IGR0clN0YXRlICAgICAgIDogRFRSIG91dHB1dCBzdGF0ZSAoMDogb2ZmLCAxOiBvbikKKyAqICAgICAgICAgICBpbnQgcnRzU3RhdGUgICAgICAgOiBSVFMgb3V0cHV0IHN0YXRlICgwOiBvZmYsIDE6IG9uKQorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDE1OiAgICBTZXR0aW5nIHRoZSBmbG93IGNvbnRyb2wgb2YgdGhpcyBwb3J0LgorICogICAgICBTeW50YXg6CisgKiAgICAgIHZvaWQgTW94YVBvcnRGbG93Q3RybChpbnQgcG9ydCwgaW50IHJ0c0Zsb3csIGludCBjdHNGbG93LCBpbnQgcnhGbG93LAorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHR4RmxvdyxpbnQgeGFueSk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKiAgICAgICAgICAgaW50IHJ0c0Zsb3cgICAgICAgIDogSC9XIFJUUyBmbG93IGNvbnRyb2wgKDA6IG5vLCAxOiB5ZXMpCisgKiAgICAgICAgICAgaW50IGN0c0Zsb3cgICAgICAgIDogSC9XIENUUyBmbG93IGNvbnRyb2wgKDA6IG5vLCAxOiB5ZXMpCisgKiAgICAgICAgICAgaW50IHJ4RmxvdyAgICAgICAgIDogUy9XIFJ4IFhPTi9YT0ZGIGZsb3cgY29udHJvbCAoMDogbm8sIDE6IHllcykKKyAqICAgICAgICAgICBpbnQgdHhGbG93ICAgICAgICAgOiBTL1cgVHggWE9OL1hPRkYgZmxvdyBjb250cm9sICgwOiBubywgMTogeWVzKQorICogICAgICAgICAgIGludCB4YW55ICAgICAgICAgICA6IFMvVyBYQU5ZIGZsb3cgY29udHJvbCAoMDogbm8sIDE6IHllcykKKyAqCisgKgorICogICAgICBGdW5jdGlvbiAxNjogICAgR2V0IHRocyBsaW5lIHN0YXR1cyBvZiB0aGlzIHBvcnQKKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0TGluZVN0YXR1cyhpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgQml0IDAgLSBDVFMgc3RhdGUgKDA6IG9mZiwgMTogb24pCisgKiAgICAgICAgICAgICAgICAgICAgICBCaXQgMSAtIERTUiBzdGF0ZSAoMDogb2ZmLCAxOiBvbikKKyAqICAgICAgICAgICAgICAgICAgICAgIEJpdCAyIC0gRENEIHN0YXRlICgwOiBvZmYsIDE6IG9uKQorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDE3OiAgICBDaGVjayB0aGUgRENEIHN0YXRlIGhhcyBjaGFuZ2VkIHNpbmNlIHRoZSBsYXN0IHJlYWQKKyAqICAgICAgICAgICAgICAgICAgICAgIG9mIHRoaXMgZnVuY3Rpb24uCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydERDRENoYW5nZShpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgMCAgICAgICA6IG5vIGNoYW5nZWQKKyAqICAgICAgICAgICAgICAgICAgICAgIDEgICAgICAgOiBEQ0QgaGFzIGNoYW5nZWQKKyAqCisgKgorICogICAgICBGdW5jdGlvbiAxODogICAgQ2hlY2sgdGhzIGN1cnJlbnQgRENEIHN0YXRlIGlzIE9OIG9yIG5vdC4KKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0RENET04oaW50IHBvcnQpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIDAgICAgICAgOiBEQ0Qgb2ZmCisgKiAgICAgICAgICAgICAgICAgICAgICAxICAgICAgIDogRENEIG9uCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMTk6ICAgIEZsdXNoIHRoZSBSeC9UeCBidWZmZXIgZGF0YSBvZiB0aGlzIHBvcnQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgdm9pZCBNb3hhUG9ydEZsdXNoRGF0YShpbnQgcG9ydCwgaW50IG1vZGUpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICogICAgICAgICAgIGludCBtb2RlICAgIAorICogICAgICAgICAgICAgICAgICAgICAgMCAgICAgICA6IGZsdXNoIHRoZSBSeCBidWZmZXIgCisgKiAgICAgICAgICAgICAgICAgICAgICAxICAgICAgIDogZmx1c2ggdGhlIFR4IGJ1ZmZlciAKKyAqICAgICAgICAgICAgICAgICAgICAgIDIgICAgICAgOiBmbHVzaCB0aGUgUnggYW5kIFR4IGJ1ZmZlciAKKyAqCisgKgorICogICAgICBGdW5jdGlvbiAyMDogICAgV3JpdGUgZGF0YS4KKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0V3JpdGVEYXRhKGludCBwb3J0LCB1bnNpZ25lZCBjaGFyICogYnVmZmVyLCBpbnQgbGVuZ3RoKTsKKyAqICAgICAgICAgICBpbnQgcG9ydCAgICAgICAgICAgOiBwb3J0IG51bWJlciAoMCAtIDEyNykKKyAqICAgICAgICAgICB1bnNpZ25lZCBjaGFyICogYnVmZmVyICAgICA6IHBvaW50ZXIgdG8gd3JpdGUgZGF0YSBidWZmZXIuCisgKiAgICAgICAgICAgaW50IGxlbmd0aCAgICAgICAgIDogd3JpdGUgZGF0YSBsZW5ndGgKKyAqCisgKiAgICAgICAgICAgcmV0dXJuOiAgICAwIC0gbGVuZ3RoICAgICAgOiByZWFsIHdyaXRlIGRhdGEgbGVuZ3RoCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjE6ICAgIFJlYWQgZGF0YS4KKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0UmVhZERhdGEoaW50IHBvcnQsIHVuc2lnbmVkIGNoYXIgKiBidWZmZXIsIGludCBsZW5ndGgpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICogICAgICAgICAgIHVuc2lnbmVkIGNoYXIgKiBidWZmZXIgICAgIDogcG9pbnRlciB0byByZWFkIGRhdGEgYnVmZmVyLgorICogICAgICAgICAgIGludCBsZW5ndGggICAgICAgICA6IHJlYWQgZGF0YSBidWZmZXIgbGVuZ3RoCisgKgorICogICAgICAgICAgIHJldHVybjogICAgMCAtIGxlbmd0aCAgICAgIDogcmVhbCByZWFkIGRhdGEgbGVuZ3RoCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjI6ICAgIEdldCB0aGUgVHggYnVmZmVyIHNpemUgb2YgdGhpcyBwb3J0CisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydFR4QnVmU2l6ZShpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgLi4gICAgICA6IFR4IGJ1ZmZlciBzaXplCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjM6ICAgIEdldCB0aGUgUnggYnVmZmVyIHNpemUgb2YgdGhpcyBwb3J0CisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydFJ4QnVmU2l6ZShpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgLi4gICAgICA6IFJ4IGJ1ZmZlciBzaXplCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjQ6ICAgIEdldCB0aGUgVHggYnVmZmVyIGN1cnJlbnQgcXVldWVkIGRhdGEgYnl0ZXMKKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0VHhRdWV1ZShpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgLi4gICAgICA6IFR4IGJ1ZmZlciBjdXJyZW50IHF1ZXVlZCBkYXRhIGJ5dGVzCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjU6ICAgIEdldCB0aGUgVHggYnVmZmVyIGN1cnJlbnQgZnJlZSBzcGFjZQorICogICAgICBTeW50YXg6CisgKiAgICAgIGludCAgTW94YVBvcnRUeEZyZWUoaW50IHBvcnQpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIC4uICAgICAgOiBUeCBidWZmZXIgY3VycmVudCBmcmVlIHNwYWNlCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjY6ICAgIEdldCB0aGUgUnggYnVmZmVyIGN1cnJlbnQgcXVldWVkIGRhdGEgYnl0ZXMKKyAqICAgICAgU3ludGF4OgorICogICAgICBpbnQgIE1veGFQb3J0UnhRdWV1ZShpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgLi4gICAgICA6IFJ4IGJ1ZmZlciBjdXJyZW50IHF1ZXVlZCBkYXRhIGJ5dGVzCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjc6ICAgIEdldCB0aGUgUnggYnVmZmVyIGN1cnJlbnQgZnJlZSBzcGFjZQorICogICAgICBTeW50YXg6CisgKiAgICAgIGludCAgTW94YVBvcnRSeEZyZWUoaW50IHBvcnQpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICoKKyAqICAgICAgICAgICByZXR1cm46ICAgIC4uICAgICAgOiBSeCBidWZmZXIgY3VycmVudCBmcmVlIHNwYWNlCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMjg6ICAgIERpc2FibGUgcG9ydCBkYXRhIHRyYW5zbWlzc2lvbi4KKyAqICAgICAgU3ludGF4OgorICogICAgICB2b2lkIE1veGFQb3J0VHhEaXNhYmxlKGludCBwb3J0KTsKKyAqICAgICAgICAgICBpbnQgcG9ydCAgICAgICAgICAgOiBwb3J0IG51bWJlciAoMCAtIDEyNykKKyAqCisgKgorICogICAgICBGdW5jdGlvbiAyOTogICAgRW5hYmxlIHBvcnQgZGF0YSB0cmFuc21pc3Npb24uCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgdm9pZCBNb3hhUG9ydFR4RW5hYmxlKGludCBwb3J0KTsKKyAqICAgICAgICAgICBpbnQgcG9ydCAgICAgICAgICAgOiBwb3J0IG51bWJlciAoMCAtIDEyNykKKyAqCisgKgorICogICAgICBGdW5jdGlvbiAzMDogICAgR2V0IHRoZSByZWNlaXZlZCBCUkVBSyBzaWduYWwgY291bnQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydEdldEJya0NudChpbnQgcG9ydCk7CisgKiAgICAgICAgICAgaW50IHBvcnQgICAgICAgICAgIDogcG9ydCBudW1iZXIgKDAgLSAxMjcpCisgKgorICogICAgICAgICAgIHJldHVybjogICAgMCAtIC4uICA6IEJSRUFLIHNpZ25hbCBjb3VudAorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDMxOiAgICBHZXQgdGhlIHJlY2VpdmVkIEJSRUFLIHNpZ25hbCBjb3VudCBhbmQgcmVzZXQgaXQuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydFJlc2V0QnJrQ250KGludCBwb3J0KTsKKyAqICAgICAgICAgICBpbnQgcG9ydCAgICAgICAgICAgOiBwb3J0IG51bWJlciAoMCAtIDEyNykKKyAqCisgKiAgICAgICAgICAgcmV0dXJuOiAgICAwIC0gLi4gIDogQlJFQUsgc2lnbmFsIGNvdW50CisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMzI6ICAgIFNldCB0aGUgUy9XIGZsb3cgY29udHJvbCBuZXcgWE9OL1hPRkYgdmFsdWUsIGRlZmF1bHQKKyAqICAgICAgICAgICAgICAgICAgICAgIFhPTiBpcyAweDExICYgWE9GRiBpcyAweDEzLgorICogICAgICBTeW50YXg6CisgKiAgICAgIHZvaWQgTW94YVBvcnRTZXRYb25Yb2ZmKGludCBwb3J0LCBpbnQgeG9uVmFsdWUsIGludCB4b2ZmVmFsdWUpOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICogICAgICAgICAgIGludCB4b25WYWx1ZSAgICAgICA6IG5ldyBYT04gdmFsdWUgKDAgLSAyNTUpCisgKiAgICAgICAgICAgaW50IHhvZmZWYWx1ZSAgICAgIDogbmV3IFhPRkYgdmFsdWUgKDAgLSAyNTUpCisgKgorICoKKyAqICAgICAgRnVuY3Rpb24gMzM6ICAgIENoZWNrIHRoaXMgcG9ydCdzIHRyYW5zbWlzc2lvbiBpcyBob2xkIGJ5IHJlbW90ZSBzaXRlCisgKiAgICAgICAgICAgICAgICAgICAgICBiZWNhdXNlIHRoZSBmbG93IGNvbnRyb2wuCisgKiAgICAgIFN5bnRheDoKKyAqICAgICAgaW50ICBNb3hhUG9ydElzVHhIb2xkKGludCBwb3J0KTsKKyAqICAgICAgICAgICBpbnQgcG9ydCAgICAgICAgICAgOiBwb3J0IG51bWJlciAoMCAtIDEyNykKKyAqCisgKiAgICAgICAgICAgcmV0dXJuOiAgICAwICAgICAgIDogbm9ybWFsCisgKiAgICAgICAgICAgICAgICAgICAgICAxICAgICAgIDogaG9sZCBieSByZW1vdGUgc2l0ZQorICoKKyAqCisgKiAgICAgIEZ1bmN0aW9uIDM0OiAgICBTZW5kIG91dCBhIEJSRUFLIHNpZ25hbC4KKyAqICAgICAgU3ludGF4OgorICogICAgICB2b2lkIE1veGFQb3J0U2VuZEJyZWFrKGludCBwb3J0LCBpbnQgbXMxMDApOworICogICAgICAgICAgIGludCBwb3J0ICAgICAgICAgICA6IHBvcnQgbnVtYmVyICgwIC0gMTI3KQorICogICAgICAgICAgIGludCBtczEwMCAgICAgICAgICA6IGJyZWFrIHNpZ25hbCB0aW1lIGludGVydmFsLgorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuaXQ6IDEwMCBtaW5pLXNlY29uZC4gaWYgbXMxMDAgPT0gMCwgaXQgd2lsbAorICogICAgICA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3X3NlcmlhbC5jbG9zaW5nX3dhaXQgKiBIWiAvIDEwMDsKKwl9CisKKwluZXdfc2VyaWFsLmZsYWdzID0gKG5ld19zZXJpYWwuZmxhZ3MgJiB+QVNZTkNfRkxBR1MpOworCW5ld19zZXJpYWwuZmxhZ3MgfD0gKGluZm8tPmFzeW5jZmxhZ3MgJiBBU1lOQ19GTEFHUyk7CisKKwlpZiAobmV3X3NlcmlhbC50eXBlID09IFBPUlRfMTY1NTBBKSB7CisJCU1veGFTZXRGaWZvKGluZm8tPnBvcnQsIDEpOworCX0gZWxzZSB7CisJCU1veGFTZXRGaWZvKGluZm8tPnBvcnQsIDApOworCX0KKworCWluZm8tPnR5cGUgPSBuZXdfc2VyaWFsLnR5cGU7CisJcmV0dXJuICgwKTsKK30KKworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoJU3RhdGljIGxvY2FsIGZ1bmN0aW9uczogCQkJCQkgICAgICoKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qCisgKiBtb3hhZGVsYXkgLSBkZWxheXMgYSBzcGVjaWZpZWQgbnVtYmVyIHRpY2tzCisgKi8KK3N0YXRpYyB2b2lkIG1veGFkZWxheShpbnQgdGljaykKK3sKKwl1bnNpZ25lZCBsb25nIHN0LCBldDsKKworCXN0ID0gamlmZmllczsKKwlldCA9IHN0ICsgdGljazsKKwl3aGlsZSAodGltZV9iZWZvcmUoamlmZmllcywgZXQpKTsKK30KKworc3RhdGljIHZvaWQgbW94YWZ1bmModm9pZCBfX2lvbWVtICpvZnNBZGRyLCBpbnQgY21kLCB1c2hvcnQgYXJnKQoreworCisJd3JpdGV3KGFyZywgb2ZzQWRkciArIEZ1bmNBcmcpOworCXdyaXRldyhjbWQsIG9mc0FkZHIgKyBGdW5jQ29kZSk7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XNlQWRkciArIEMzMjBfc3RhdHVzKSkgIT0gU1RTX2luaXQpIHsKKwkJCXJldHVybiAoLTIpOworCQl9CisJfQorCXJldHVybiAoMCk7Cit9CisKK3N0YXRpYyBpbnQgbW94YWxvYWQzMjBiKGludCBjYXJkbm8sIHVuc2lnbmVkIGNoYXIgX191c2VyICp0bXAsIGludCBsZW4pCit7CisJdm9pZCBfX2lvbWVtICpiYXNlQWRkcjsKKwlpbnQgaTsKKworCWlmKGxlbiA+IHNpemVvZihtb3hhQnVmZikpCisJCXJldHVybiAtRUlOVkFMOworCWlmKGNvcHlfZnJvbV91c2VyKG1veGFCdWZmLCB0bXAsIGxlbikpCisJCXJldHVybiAtRUZBVUxUOworCWJhc2VBZGRyID0gbW94YUJhc2VBZGRyW2NhcmRub107CisJd3JpdGV3KGxlbiAtIDcxNjggLSAyLCBiYXNlQWRkciArIEMzMjBiYXBpX2xlbik7CisJd3JpdGViKDEsIGJhc2VBZGRyICsgQ29udHJvbF9yZWcpOwkvKiBTZWxlY3QgUGFnZSAxICovCisJZm9yIChpID0gMDsgaSA8IDcxNjg7IGkrKykKKwkJd3JpdGViKG1veGFCdWZmW2ldLCBiYXNlQWRkciArIER5blBhZ2VfYWRkciArIGkpOworCXdyaXRlYigyLCBiYXNlQWRkciArIENvbnRyb2xfcmVnKTsJLyogU2VsZWN0IFBhZ2UgMiAqLworCWZvciAoaSA9IDA7IGkgPCAobGVuIC0gNzE2OCk7IGkrKykKKwkJd3JpdGViKG1veGFCdWZmW2kgKyA3MTY4XSwgYmFzZUFkZHIgKyBEeW5QYWdlX2FkZHIgKyBpKTsKKwlyZXR1cm4gKDApOworfQorCitzdGF0aWMgaW50IG1veGFsb2FkY29kZShpbnQgY2FyZG5vLCB1bnNpZ25lZCBjaGFyIF9fdXNlciAqdG1wLCBpbnQgbGVuKQoreworCXZvaWQgX19pb21lbSAqYmFzZUFkZHIsICpvZnNBZGRyOworCWludCByZXR2YWwsIHBvcnQsIGk7CisKKwlpZihjb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gTWFnaWNfbm8pOworCWZvciAoaSA9IDA7IGkgPCA2MDA7IGkrKykgeworCQlpZiAocmVhZHcoYmFzZUFkZHIgKyBNYWdpY19ubykgPT0gTWFnaWNfY29kZSkKKwkJCWJyZWFrOworCQltb3hhZGVsYXkoMSk7CisJfQorCWlmIChyZWFkdyhiYXNlQWRkciArIE1hZ2ljX25vKSAhPSBNYWdpY19jb2RlKQorCQlyZXR1cm4gKC0xMDIpOworCW1veGFDYXJkID0gMTsKKwltb3hhSW50TmR4W2NhcmRub10gPSBiYXNlQWRkciArIElSUWluZGV4OworCW1veGFJbnRQZW5kW2NhcmRub10gPSBiYXNlQWRkciArIElSUXBlbmRpbmc7CisJbW94YUludFRhYmxlW2NhcmRub10gPSBiYXNlQWRkciArIElSUXRhYmxlOworCXJldHVybiAoMCk7Cit9CisKKyNpZiAwCitsb25nIE1veGFQb3J0R2V0Q3VyQmF1ZChpbnQgcG9ydCkKK3sKKworCWlmIChtb3hhQ2hrUG9ydFtwb3J0XSA9PSAwKQorCQlyZXR1cm4gKDApOworCXJldHVybiAobW94YUN1ckJhdWRbcG9ydF0pOworfQorI2VuZGlmICAvKiAgMCAgKi8KKworc3RhdGljIHZvaWQgTW94YVNldEZpZm8oaW50IHBvcnQsIGludCBlbmFibGUpCit7CisJdm9pZCBfX2lvbWVtICpvZnNBZGRyID0gbW94YVRhYmxlQWRkcltwb3J0XTsKKworCWlmICghZW5hYmxlKSB7CisJCW1veGFmdW5jKG9mc0FkZHIsIEZDX1NldFJ4RklGT1RyaWcsIDApOworCQltb3hhZnVuYyhvZnNBZGRyLCBGQ19TZXRUeEZJRk9DbnQsIDEpOworCX0gZWxzZSB7CisJCW1veGFmdW5jKG9mc0FkZHIsIEZDX1NldFJ4RklGT1RyaWcsIDMpOworCQltb3hhZnVuYyhvZnNBZGRyLCBGQ19TZXRUeEZJRk9DbnQsIDE2KTsKKwl9Cit9CisKKyNpZiAwCitpbnQgTW94YVBvcnRTZXRNb2RlKGludCBwb3J0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4gKDApOworfQorCitpbnQgTW94YVBvcnRUeEJ1ZlNpemUoaW50IHBvcnQpCit7CisJdm9pZCBfX2lvbWVtICpvZnNBZGRyOworCWludCBzaXplOworCisJb2ZzQWRkciA9IG1veGFUYWJsZUFkZHJbcG9ydF07CisJc2l6ZSA9IHJlYWR3KG9mc0FkZHIgKyBUWF9tYXNrKTsKKwlyZXR1cm4gKHNpemUpOworfQorCitpbnQgTW94YVBvcnRSeEJ1ZlNpemUoaW50IHBvcnQpCit7CisJdm9pZCBfX2lvbWVtICpvZnNBZGRyOworCWludCBzaXplOworCisJb2ZzQWRkciA9IG1veGFUYWJsZUFkZHJbcG9ydF07CisJc2l6ZSA9IHJlYWR3KG9mc0FkZHIgKyBSWF9tYXNrKTsKKwlyZXR1cm4gKHNpemUpOworfQorCitpbnQgTW94YVBvcnRSeEZyZWUoaW50IHBvcnQpCit7CisJdm9pZCBfX2lvbWVtICpvZnNBZGRyOworCXVzaG9ydCBycHRyLCB3cHRyLCBtYXNrOworCWludCBsZW47CisKKwlvZnNBZGRyID0gbW94YVRhYmxlQWRkcltwb3J0XTsKKwlycHRyID0gcmVhZHcob2ZzQWRkciArIFJYcnB0cik7CisJd3B0ciA9IHJlYWR3KG9mc0FkZHIgKyBSWHdwdHIpOworCW1hc2sgPSByZWFkdyhvZnNBZGRyICsgUlhfbWFzayk7CisJbGVuID0gbWFzayAtICgod3B0ciAtIHJwdHIpICYgbWFzayk7CisJcmV0dXJuIChsZW4pOworfQoraW50IE1veGFQb3J0R2V0QnJrQ250KGludCBwb3J0KQoreworCXJldHVybiAobW94YUJyZWFrQ250W3BvcnRdKTsKK30KKwordm9pZCBNb3hhUG9ydFNldFhvblhvZmYoaW50IHBvcnQsIGludCB4b25WYWx1ZSwgaW50IHhvZmZWYWx1ZSkKK3sKKwl2b2lkIF9faW9tZW0gKm9mc0FkZHI7CisKKwlvZnNBZGRyID0gbW94YVRhYmxlQWRkcltwb3J0XTsKKwl3cml0ZXcoeG9uVmFsdWU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hhIFJlbGVhc2UKKyoJRmlyc3QgcmVsZWFzZSB0byB0aGUgcHVibGljCisqLworCisjaWZuZGVmIF9MSU5VWF9NV0FWRUREX0gKKyNkZWZpbmUgX0xJTlVYX01XQVZFRERfSAorI2luY2x1ZGUgIjM3ODBpLmgiCisjaW5jbHVkZSAidHAzNzgwaS5oIgorI2luY2x1ZGUgInNtYXBpLmgiCisjaW5jbHVkZSAibXdhdmVwdWIuaCIKKyNpbmNsdWRlIDxsaW51eC9pb2N0bC5oPgorI2luY2x1ZGUgPGFzbS91YWNjZXNzLmg+CisjaW5jbHVkZSA8bGludXgvd2FpdC5oPgorCitleHRlcm4gaW50IG13YXZlX2RlYnVnOworZXh0ZXJuIGludCBtd2F2ZV8zNzgwaV9pcnE7CitleHRlcm4gaW50IG13YXZlXzM3ODBpX2lvOworZXh0ZXJuIGludCBtd2F2ZV91YXJ0X2lycTsKK2V4dGVybiBpbnQgbXdhdmVfdWFydF9pbzsKKworI2RlZmluZSBQUklOVEtfRVJST1IgcHJpbnRrCisjZGVmaW5lIEtFUk5fRVJSX01XQVZFIEtFUk5fRVJSICJtd2F2ZTogIgorCisjZGVmaW5lIFRSQUNFX01XQVZFICAgICAweDAwMDEKKyNkZWZpbmUgVFJBQ0VfU01BUEkgICAgIDB4MDAwMgorI2RlZmluZSBUUkFDRV8zNzgwSSAgICAgMHgwMDA0CisjZGVmaW5lIFRSQUNFX1RQMzc4MEkgICAweDAwMDgKKworI2lmZGVmIE1XX1RSQUNFCisjZGVmaW5lIFBSSU5US18xKGYscykgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgaWYgKGYgJiAobXdhdmVfZGVidWcpKSB7ICAgICAgICAgICAgICAgICAgXAorICAgIHByaW50ayhzKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0KKworI2RlZmluZSBQUklOVEtfMihmLHMsdjEpICAgICAgICAgICAgICAgICAgICBcCisgIGlmIChmICYgKG13YXZlX2RlYnVnKSkgeyAgICAgICAgICAgICAgICAgIFwKKyAgICBwcmludGsocyx2MSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9CisKKyNkZWZpbmUgUFJJTlRLXzMoZixzLHYxLHYyKSAgICAgICAgICAgICAgICAgXAorICBpZiAoZiAmIChtd2F2ZV9kZWJ1ZykpIHsgICAgICAgICAgICAgICAgICBcCisgICAgcHJpbnRrKHMsdjEsdjIpOyAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfQorCisjZGVmaW5lIFBSSU5US180KGYscyx2MSx2Mix2MykgICAgICAgICAgICAgIFwKKyAgaWYgKGYgJiAobXdhdmVfZGVidWcpKSB7ICAgICAgICAgICAgICAgICAgXAorICAgIHByaW50ayhzLHYxLHYyLHYzKTsgICAgICAgICAgICAgICAgICAgICBcCisgIH0KKworI2RlZmluZSBQUklOVEtfNShmLHMsdjEsdjIsdjMsdjQpICAgICAgICAgICBcCisgIGlmIChmICYgKG13YXZlX2RlYnVnKSkgeyAgICAgICAgICAgICAgICAgIFwKKyAgICBwcmludGsocyx2MSx2Mix2Myx2NCk7ICAgICAgICAgICAgICAgICAgXAorICB9CisKKyNkZWZpbmUgUFJJTlRLXzYoZixzLHYxLHYyLHYzLHY0LHY1KSAgICAgICAgXAorICBpZiAoZiAmIChtd2F2ZV9kZWJ1ZykpIHsgICAgICAgICAgICAgICAgICBcCisgICAgcHJpbnRrKHMsdjEsdjIsdjMsdjQsdjUpOyAgICAgICAgICAgICAgIFwKKyAgfQorCisjZGVmaW5lIFBSSU5US183KGYscyx2MSx2Mix2Myx2NCx2NSx2NikgICAgIFwKKyAgaWYgKGYgJiAobXdhdmVfZGVidWcpKSB7ICAgICAgICAgICAgICAgICAgXAorICAgIHByaW50ayhzLHYxLHYyLHYzLHY0LHY1LHY2KTsgICAgICAgICAgICBcCisgIH0KKworI2RlZmluZSBQUklOVEtfOChmLHMsdjEsdjIsdjMsdjQsdjUsdjYsdjcpICBcCisgIGlmIChmICYgKG13YXZlX2RlYnVnKSkgey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25lZCBpbnQgaW5ESVNJID0gKGluREkgPDwgMTYpIHwgaW5TSTsKKwlpbnQgcmV0dmFsID0gMDsKKworCVBSSU5US181KFRSQUNFX1NNQVBJLCAiaW5CWCAleCBpbkNYICV4IGluREkgJXggaW5TSSAleFxuIiwKKwkJaW5CWCwgaW5DWCwgaW5ESSwgaW5TSSk7CisKKwlfX2FzbV9fIF9fdm9sYXRpbGVfXygibW92dyAgJDB4NTM4MCwlJWF4XG5cdCIKKwkJCSAgICAibW92bCAgJTcsJSVlYnhcblx0IgorCQkJICAgICJzaHJsICAkMTYsICUlZWJ4XG5cdCIKKwkJCSAgICAibW92dyAgJTcsJSVjeFxuXHQiCisJCQkgICAgIm1vdmwgICU4LCUlZWRpXG5cdCIKKwkJCSAgICAic2hybCAgJDE2LCUlZWRpXG5cdCIKKwkJCSAgICAibW92dyAgJTgsJSVzaVxuXHQiCisJCQkgICAgIm1vdncgICU5LCUlZHhcblx0IgorCQkJICAgICJvdXQgICAlJWFsLCUlZHhcblx0IgorCQkJICAgICJvdXQgICAlJWFsLCQweDRGXG5cdCIKKwkJCSAgICAiY21wYiAgJDB4NTMsJSVhaFxuXHQiCisJCQkgICAgImplICAgIDJmXG5cdCIKKwkJCSAgICAiMTpcblx0IgorCQkJICAgICJvcmIgICAlJWFoLCUlYWhcblx0IgorCQkJICAgICJqbnogICAyZlxuXHQiCisJCQkgICAgIm1vdncgICUlYXgsJTBcblx0IgorCQkJICAgICJtb3Z3ICAlJWJ4LCUxXG5cdCIKKwkJCSAgICAibW92dyAgJSVjeCwlMlxuXHQiCisJCQkgICAgIm1vdncgICUlZHgsJTNcblx0IgorCQkJICAgICJtb3Z3ICAlJWRpLCU0XG5cdCIKKwkJCSAgICAibW92dyAgJSVzaSwlNVxuXHQiCisJCQkgICAgIm1vdncgICQxLCU2XG5cdCIKKwkJCSAgICAiMjpcblx0IjoiPW0iKCoodW5zaWduZWQgc2hvcnQgKikgcG15b3V0QVgpLAorCQkJICAgICI9bSIoKih1bnNpZ25lZCBzaG9ydCAqKSBwbXlvdXRCWCksCisJCQkgICAgIj1tIigqKHVuc2lnbmVkIHNob3J0ICopIHBteW91dENYKSwKKwkJCSAgICAiPW0iKCoodW5zaWduZWQgc2hvcnQgKikgcG15b3V0RFgpLAorCQkJICAgICI9bSIoKih1bnNpZ25lZCBzaG9ydCAqKSBwbXlvdXRESSksCisJCQkgICAgIj1tIigqKHVuc2lnbmVkIHNob3J0ICopIHBteW91dFNJKSwKKwkJCSAgICAiPW0iKCoodW5zaWduZWQgc2hvcnQgKikgcHVzU21hcGlPSykKKwkJCSAgICA6Im0iKGluQlhDWCksICJtIihpbkRJU0kpLCAibSIoZ191c1NtYXBpUG9ydCkKKwkJCSAgICA6IiVlYXgiLCAiJWVieCIsICIlZWN4IiwgIiVlZHgiLCAiJWVkaSIsCisJCQkgICAgIiVlc2kiKTsKKworCVBSSU5US184KFRSQUNFX1NNQVBJLAorCQkibXlvdXRBWCAleCBteW91dEJYICV4IG15b3V0Q1ggJXggbXlvdXREWCAleCBteW91dERJICV4IG15b3V0U0kgJXggdXNTbWFwaU9LICV4XG4iLAorCQlteW91dEFYLCBteW91dEJYLCBteW91dENYLCBteW91dERYLCBteW91dERJLCBteW91dFNJLAorCQl1c1NtYXBpT0spOworCSpvdXRBWCA9IG15b3V0QVg7CisJKm91dEJYID0gbXlvdXRCWDsKKwkqb3V0Q1ggPSBteW91dENYOworCSpvdXREWCA9IG15b3V0RFg7CisJKm91dERJID0gbXlvdXRESTsKKwkqb3V0U0kgPSBteW91dFNJOworCisJcmV0dmFsID0gKHVzU21hcGlPSyA9PSAxKSA/IDAgOiAtRUlPOworCVBSSU5US18yKFRSQUNFX1NNQVBJLCAic21hcGk6OnNtYXBpX3JlcXVlc3QgZXhpdCByZXR2YWwgJXhcbiIsIHJldHZhbCk7CisJcmV0dXJuIHJldHZhbDsKK30KKworCitpbnQgc21hcGlfcXVlcnlfRFNQX2NmZyhTTUFQSV9EU1BfU0VUVElOR1MgKiBw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ZXNvdXJjZXMoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEpOworaW50IHRwMzc4MElfRW5hYmxlRFNQKFRISU5LUEFEX0JEX0RBVEEgKiBwQkREYXRhKTsKK2ludCB0cDM3ODBJX0Rpc2FibGVEU1AoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEpOworaW50IHRwMzc4MElfUmVzZXREU1AoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEpOworaW50IHRwMzc4MElfU3RhcnREU1AoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEpOworaW50IHRwMzc4MElfUXVlcnlBYmlsaXRpZXMoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEsIE1XX0FCSUxJVElFUyAqIHBBYmlsaXRpZXMpOworaW50IHRwMzc4MElfQ2xlYW51cChUSElOS1BBRF9CRF9EQVRBICogcEJERGF0YSk7CitpbnQgdHAzNzgwSV9SZWFkV3JpdGVEc3BEU3RvcmUoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEsIHVuc2lnbmVkIGludCB1T3Bjb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgX191c2VyICpwdkJ1ZmZlciwgdW5zaWduZWQgaW50IHVDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBsb25nIHVsRFNQQWRkcik7CitpbnQgdHAzNzgwSV9SZWFkV3JpdGVEc3BJU3RvcmUoVEhJTktQQURfQkRfREFUQSAqIHBCRERhdGEsIHVuc2lnbmVkIGludCB1T3Bjb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgX191c2VyICpwdkJ1ZmZlciwgdW5zaWduZWQgaW50IHVDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBsb25nIHVsRFNQQWRkcik7CisKKworI2VuZGlmCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvbXhzZXIuYyBiL2R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maHdjb25mKSA8IDApCisJCQljb250aW51ZTsKKworCQltKys7CisJfQorCisJLyogc3RhcnQgZmluZGluZyBQQ0kgYm9hcmQgaGVyZSAqLworI2lmZGVmIENPTkZJR19QQ0kKKwluID0gKHNpemVvZihteHNlcl9wY2licmRzKSAvIHNpemVvZihteHNlcl9wY2licmRzWzBdKSkgLSAxOworCWluZGV4ID0gMDsKKwliID0gMDsKKwl3aGlsZSAoYiA8IG4pIHsKKwkJcGRldiA9IHBjaV9maW5kX2RldmljZShteHNlcl9wY2licmRzW2JdLnZlbmRvciwgbXhzZXJfcGNpYnJkc1tiXS5kZXZpY2UsIHBkZXYpOworCQkJaWYgKHBkZXYgPT0gTlVMTCkgeworCQkJYisrOworCQkJY29udGludWU7CisJCX0KKwkJaHdjb25mLnBjaUluZm8uYnVzTnVtID0gYnVzbnVtID0gcGRldi0+YnVzLT5udW1iZXI7CisJCWh3Y29uZi5wY2lJbmZvLmRldk51bSA9IGRldm51bSA9IFBDSV9TTE9UKHBkZXYtPmRldmZuKSA8PCAzOworCQlod2NvbmYucGNpSW5mby5wZGV2ID0gcGRldjsKKwkJcHJpbnRrKEtFUk5fSU5GTyAiRm91bmQgTU9YQSAlcyBib2FyZChCdXNObz0lZCxEZXZObz0lZClcbiIsIG14c2VyX2JyZG5hbWVbKGludCkgKG14c2VyX3BjaWJyZHNbYl0uZHJpdmVyX2RhdGEpIC0gMV0sIGJ1c251bSwgZGV2bnVtID4+IDMpOworCQlpbmRleCsrOworCQlpZiAobSA+PSBNWFNFUl9CT0FSRFMpIHsKKwkJCXByaW50ayhLRVJOX0VSUiAiVG9vIG1hbnkgU21hcnRpby9JbmR1c3RpbyBmYW1pbHkgYm9hcmRzIGZpbmQgKG1heGltdW0gJWQpLGJvYXJkIG5vdCBjb25maWd1cmVkXG4iLCBNWFNFUl9CT0FSRFMpOworCQl9IGVsc2UgeworCQkJaWYgKHBjaV9lbmFibGVfZGV2aWNlKHBkZXYpKSB7CisJCQkJcHJpbnRrK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cmdwKQoreworCWludCBpLCByZXN1bHQsIHN0YXR1czsKKworCXN3aXRjaCAoY21kKSB7CisJY2FzZSBNT1hBX0dFVF9DT05GOgorCQlpZiAoY29weV90b191c2VyKGFyZ3AsIG14c2VyY2ZnLCBzaXplb2Yoc3RydWN0IG14c2VyX2h3Y29uZikgKiA0KSkKKwkJCXJldHVybiAtRUZBVUxUOworCQlyZXR1cm4gMDsKKwljYXNlIE1PWEFfR0VUX01BSk9SOgorCQlpZiAoY29weV90b191c2VyKGFyZ3AsICZ0dHltYWpvciwgc2l6ZW9mKGludCkpKQorCQkJcmV0dXJuIC1FRkFVTFQ7CisJCXJldHVybiAwOworCisJY2FzZSBNT1hBX0dFVF9DVU1BSk9SOgorCQlpZiAoY29weV90b191c2VyKGFyZ3AsICZjYWxsb3V0bWFqb3IsIHNpemVvZihpbnQpKSkKKwkJCXJldHVybiAtRUZBVUxUOworCQlyZXR1cm4gMDsKKworCWNhc2UgTU9YQV9DSEtQT1JURU5BQkxFOgorCQlyZXN1bHQgPSAwOworCQlmb3IgKGkgPSAwOyBpIDwgTVhTRVJfUE9SVFM7IGkrKykgeworCQkJaWYgKG14dmFyX3RhYmxlW2ldLmJhc2UpCisJCQkJcmVzdWx0IHw9ICgxIDw8IGkpOworCQl9CisJCXJldHVybiBwdXRfdXNlcihyZXN1bHQsICh1bnNpZ25lZCBsb25nIF9fdXNlciAqKSBhcmdwKTsKKwljYXNlIE1PWEFfR0VUREFUQUNPVU5UOgorCQlpZiAoY29weV90b191c2VyKGFyZ3AsICZteHZhcl9sb2csIHNpemVvZihteHZhcl9sb2cpKSkKKwkJCXJldHVybiAtRUZBVUxUOworCQlyZXR1cm4gKDApOworCWNhc2UgTU9YQV9HRVRNU1RBVFVTOgorCQlmb3IgKGkgPSAwOyBpIDwgTVhTRVJfUE9SVFM7IGkrKykgeworCQkJR01TdGF0dXNbaV0ucmkgPSAwOworCQkJaWYgKCFteHZhcl90YWJsZVtpXS5iYXNlKSB7CisJCQkJR01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DMTY4X0FTSUNfSUQpICYmIChpZCAhPSBDMTA0X0FTSUNfSUQpICYmIChpZCAhPSBDMTAyX0FTSUNfSUQpICYmIChpZCAhPSBDSTEzMl9BU0lDX0lEKSAmJiAoaWQgIT0gQ0kxMzRfQVNJQ19JRCkgJiYgKGlkICE9IENJMTA0Sl9BU0lDX0lEKSkKKwkJcmV0dXJuICgtMSk7CisJZm9yIChpID0gMCwgaiA9IDA7IGkgPCA0OyBpKyspIHsKKwkJbiA9IGluYihwb3J0ICsgMik7CisJCWlmIChuID09ICdNJykgeworCQkJaiA9IDE7CisJCX0gZWxzZSBpZiAoKGogPT0gMSkgJiYgKG4gPT0gMSkpIHsKKwkJCWogPSAyOworCQkJYnJlYWs7CisJCX0gZWxzZQorCQkJaiA9IDA7CisJfQorCWlmIChqICE9IDIpCisJCWlkID0gLTI7CisJcmV0dXJuIChpZCk7Cit9CisKK3N0YXRpYyB2b2lkIG14c2VyX25vcm1hbF9tb2RlKGludCBwb3J0KQoreworCWludCBpLCBuOworCisJb3V0YigweEE1LCBwb3J0ICsgMSk7CisJb3V0YigweDgwLCBwb3J0ICsgMyk7CisJb3V0YigxMiwgcG9ydCArIDApOwkvKiA5NjAwIGJwcyAqLworCW91dGIoMCwgcG9ydCArIDEpOworCW91dGIoMHgwMywgcG9ydCArIDMpOwkvKiA4IGRhdGEgYml0cyAqLworCW91dGIoMHgxMywgcG9ydCArIDQpOwkvKiBsb29wIGJhY2sgbW9kZSAqLworCWZvciAoaSA9IDA7IGkgPCAxNjsgaSsrKSB7CisJCW4gPSBpbmIocG9ydCArIDUpOworCQlpZiAoKG4gJiAweDYxKSA9PSAweDYwKQorCQkJYnJlYWs7CisJCWlmICgobiAmIDEpID09IDEpCisJCQkodm9pZCkgaW5iKHBvcnQpOworCX0KKwlvdXRiKDB4MDAsIHBvcnQgKyA0KTsKK30KKworbW9kdWxlX2luaXQobXhzZXJfbW9kdWxlX2luaXQpOworbW9kdWxlX2V4aXQobXhzZXJfbW9kdW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kaW5nIHRvIHRoZSB0ZXJtcyBvZgorICogdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlLCBpbmNvcnBvcmF0ZWQgaGVyZWluIGJ5IHJlZmVyZW5jZS4KKyAqCisgKiBBdXRob3I6CisgKiBMLiBIYWFnCisgKgorICogJExvZzogbl9yMzk2NC5jLHYgJAorICogUmV2aXNpb24gMS4xMCAgMjAwMS8wMy8xOCAxMzowMjoyNCAgZHdtdzIKKyAqIEZpeCB0aW1lciB1c2FnZSwgdXNlIHNwaW5sb2NrcyBwcm9wZXJseS4KKyAqCisgKiBSZXZpc2lvbiAxLjkgIDIwMDEvMDMvMTggMTI6NTI6MTQgIGR3bXcyCisgKiBNZXJnZSBjaGFuZ2VzIGluIDIuNC4yCisgKgorICogUmV2aXNpb24gMS44ICAyMDAwLzAzLzIzIDE0OjE0OjU0ICBkd213MgorICogRml4IHJhY2UgaW4gc2xlZXBpbmcgaW4gcjM5NjRfcmVhZCgpCisgKgorICogUmV2aXNpb24gMS43ICAxOTk5LzI4LzA4IDExOjQxOjUwICBkd213MgorICogUG9ydCB0byAyLjMga2VybmVsCisgKgorICogUmV2aXNpb24gMS42ICAxOTk4LzA5LzMwIDAwOjQwOjQwICBkd213MgorICogRml4ZWQgY29tcGlsYXRpb24gb24gMi4wLngga2VybmVscworICogVXBkYXRlZCB0byBuZXdseSByZWdpc3RlcmVkIHR0eS1sZGlzYyBudW1iZXIgOQorICoKKyAqIFJldmlzaW9uIDEuNSAgMTk5OC8wOS8wNCAyMTo1NzozNiAgZHdtdzIKKyAqIFNpZ25hbCBoYW5kbGluZyBidWcgZml4ZXMsIHBvcnQgdG8gMi4xLnguCisgKgorICogUmV2aXNpb24gMS40ICAxOTk4LzA0LzAyIDIwOjI2OjU5ICBsaGFhZworICogc2VsZWN0LCBibG9ja2luZywgLi4uCisgKgorICogUmV2aXNpb24gMS4zICAxOTk4LzAyLzEyIDE4OjU4OjQzICByb290CisgKiBmaXhlZCBzb21lIG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wKKwkubWFnaWMJPSBUVFlfTERJU0NfTUFHSUMsIAorCS5uYW1lCT0gIlIzOTY0IiwKKwkub3Blbgk9IHIzOTY0X29wZW4sCisJLmNsb3NlCT0gcjM5NjRfY2xvc2UsCisJLnJlYWQJPSByMzk2NF9yZWFkLAorCS53cml0ZQk9IHIzOTY0X3dyaXRlLAorCS5pb2N0bAk9IHIzOTY0X2lvY3RsLAorCS5zZXRfdGVybWlvcyA9IHIzOTY0X3NldF90ZXJtaW9zLAorCS5wb2xsCT0gcjM5NjRfcG9sbCwgICAgICAgICAgICAKKwkucmVjZWl2ZV9idWYgPSByMzk2NF9yZWNlaXZlX2J1ZiwKKwkucmVjZWl2ZV9yb29tID0gcjM5NjRfcmVjZWl2ZV9yb29tLAorfTsKKworCisKK3N0YXRpYyB2b2lkIGR1bXBfYmxvY2soY29uc3QgdW5zaWduZWQgY2hhciAqYmxvY2ssIHVuc2lnbmVkIGludCBsZW5ndGgpCit7CisgICB1bnNpZ25lZCBpbnQgaSxqOworICAgY2hhciBsaW5lYnVmWzE2KjMrMV07CisgICAKKyAgIGZvcihpPTA7aTxsZW5ndGg7aSs9MTYpCisgICB7CisgICAgICBmb3Ioaj0wOyhqPDE2KSAmJiAoaitpPGxlbmd0aCk7aisrKQorICAgICAgeworICAgICAgICAgc3ByaW50ZihsaW5lYnVmKzMqaiwiJTAyeCAiLGJsb2NrW2kral0pOworICAgICAgfQorICAgICAgbGluZWJ1ZlszKmpdPSdcMCc7CisgICAgICBUUkFDRV9QUygiJXMiLGxpbmVidWYpOworICAgfQorfQorCisgICAgICAgICAKKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogRHJpdmVyIGluaXRpYWxpc2F0aW9uCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogTW9kdWxlIHN1cHBvcnQgcm91dGluZXMKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgdm9pZCBfX2V4aXQgcjM5NjRfZXhpdCh2b2lkKQoreworICAgaW50IHN0YXR1czsKKyAgIAorICAgVFJBQ0VfTSAoImNsZWFudXBfbW9kdWxlKCkiKTsKKworICAgc3RhdHVzPXR0eV9yZWdpc3Rlcl9sZGlzYyhOX1IzOTY0LCBOVUxMKTsKKyAgIAorICAgaWYoc3RhdHVzIT0wKQorICAgeworICAgICAgcHJpbnRrKEtFUk5fRVJSICJyMzk2NDogZXJyb3IgdW5yZWdpc3RlcmluZyBsaW5lZGlzY2lwbGluZTogJWRcbiIsIHN0YXR1cyk7CisgICB9CisgICBlbHNlCisgICB7CisgICAgICBUUkFDRV9MKCJsaW5lZGlzY2lwbGluZSBzdWNjZXNzZnVsbHkgdW5yZWdpc3RlcmVkIik7CisgICB9CisgICAKK30KKworc3RhdGljIGludCBfX2luaXQgcjM5NjRfaW5pdCh2b2lkKQoreworICAgaW50IHN0YXR1czsKKyAgIAorICAgcHJpbnRrICgicjM5NjQ6IFBoaWxpcHMgcjM5NjQgRHJpdmVyICRSZXZpc2lvbjogMS4xMCAkXG4iKTsKKworICAgLyoKKyAgICAqIFJlZ2lzdGVyIHRoZSB0dHkgbGluZSBkaXNjaXBsaW5lCisgICAgKi8KKyAgIAorICAgc3RhdHVzID0gdHR5X3JlZ2lzdGVyX2xkaXNjIChOX1IzOTY0LCAmdHR5X2xkaXNjX05fUjM5NjQpOworICAgaWYgKHN0YXR1cyA9PSAwKQorICAgICB7CisgICAgICAgVFJBQ0VfTCgibGluZSBkaXNjaXBsaW5lICVkIHJlZ2lzdGVyZWQiLCBOX1IzOTY0KTsKKyAgICAgICBUUkFDRV9MKCJmbGFncz0leCBudW09JXgiLCB0dHlfbGRpc2NfTl9SMzk2NC5mbGFncywgCisgICAgICAgICAgICAgICB0dHlfbGRpc2NfTl9SMzk2NC5udW0pOworICAgICAgIFRSQUNFX0woIm9wZW49JXgiLCAoaW50KXR0eV9sZGlzY19OX1IzOTY0Lm9wZW4pOworICAgICAgIFRSQUNFX0woInR0eV9sZGlzY19OX1IzOTY0ID0gJXgiLCAoaW50KSZ0dHlfbGRpc2NfTl9SMzk2NCk7CisgICAgIH0KKyAgIGVsc2UKKyAgICAgeworICAgICAgIHByaW50ayAoS0VSTl9FUlIgInIzOTY0OiBlcnJvciByZWdpc3RlcmluZyBsaW5lIGRpc2NpcGxpbmU6ICVkXG4iLCBzdGF0dXMpOworICAgICB9CisgICByZXR1cm4gc3RhdHVzOworfQorCittb2R1bGVfaW5pdChyMzk2NF9pbml0KTsKK21vZHVsZV9leGl0KHIzOTY0X2V4aXQpOworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBQcm90b2NvbCBpbXBsZW1lbnRhdGlvbiByb3V0aW5lcworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIGFkZF90eF9xdWV1ZShzdHJ1Y3QgcjM5NjRfaW5mbyAqcEluZm8sIHN0cnVjdCByMzk2NF9ibG9ja19oZWFkZXIgKnBIZWFkZXIpCit7CisgICB1bnNpZ25lZCBsb25nIGZsYWdzOworICAgCisgICBzcGluX2xvY2tfaXJxc2F2ZSgmcEluZm8tPmxvY2ssIGZsYWdzKTsKKworICAgcEhlYWRlci0+bmV4dCA9IE5VTEw7CisKKyAgIGlmKHBJbmZvLT50eF9sYXN0ID09IE5VTEwpCisgICB7CisgICAgICBwSW5mby0+dHhfZmlyc3QgPSBwSW5mby0+dHhfbGFzdCA9IHBIZWFkZXI7CisgICB9CisgICBlbHNlCisgICB7CisgICAgICBwSW5mby0+dHhfbGFzdC0+bmV4dCA9IHBIZWFkZXI7CisgICAgICBwSW5mby0+dHhfbGFzdCA9IHBIZWFkZXI7CisgICB9CisgICAKKyAgIHNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJnBJbmZvLT5sb2NrLCBmbGFncyk7CisKKyAgIFRSQUNFX1EoImFkZF90eF9xdWV1ZSAleCwgbGVuZ3RoICVkLCB0eF9maXJzdCA9ICV4IiwgCisgICAgICAgICAgKGludClwSGVhZGVyLCBwSGVhZGVyLT5sZW5ndGgsIChpbnQpcEluZm8tPnR4X2ZpcnN0ICk7Cit9CisKK3N0YXRpYyB2b2lkIHJlbW92ZV9mcm9tX3R4X3F1ZXVlKHN0cnVjdCByMzk2NF9pbmZvICpwSW5mbywgaW50IGVycm9yX2NvZGUpCit7CisgICBzdHJ1Y3QgcjM5NjRfYmxvY2tfaGVhZGVyICpwSGVhZGVyOworICAgdW5zaWduZWQgbG9uZyBmbGFnczsKKyNpZmRlZiBERUJVR19RVUVVRQorICAgc3RydWN0IHIzOTY0X2Jsb2NrX2hlYWRlciAqcER1bXA7CisjZW5kaWYKKyAgIAorICAgcEhlYWRlciA9IHBJbmZvLT50eF9maXJzdDsKKworICAgaWYocEhlYWRlcj09TlVMTCkKKyAgICAgIHJldHVybjsKKworI2lmZGVmIERFQlVHX1FVRVVFCisgICBwcmludGsoInIzOTY0OiByZW1vdmVfZnJvbV90eF9xdWV1ZTogJXgsIGxlbmd0aCAlZCAtICIsCisgICAgICAgICAgKGludClwSGVhZGVyLCAoaW50KXBIZWFkZXItPmxlbmd0aCApOworICAgZm9yKHBEdW1wPXBIZWFkZXI7cER1bXA7cER1bXA9cER1bXAtPm5leHQpCisJIHByaW50aygiJXggIiwgKGludClwRHVtcCk7CisgICBwcmludGsoIlxuIik7CisjZW5kaWYKKworCisgICBpZihwSGVhZGVyLT5vd25lcikKKyAgIHsKKyAgICAgIGlmKGVycm9yX2NvZGUpCisgICAgICB7CisgICAgICAgICAgYWRkX21zZyhwSGVhZGVyLT5vd25lci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5yeF9maXJzdCwgKGludClwSW5mby0+cnhfbGFzdCwgcEluZm8tPmJsb2Nrc19pbl9yeF9xdWV1ZSApOworICAgVFJBQ0VfUSgicmVtb3ZlX2Zyb21fcnhfcXVldWU6ICV4LCBsZW5ndGggJWQiLAorICAgICAgICAgIChpbnQpcEhlYWRlciwgKGludClwSGVhZGVyLT5sZW5ndGggKTsKKworICAgc3Bpbl9sb2NrX2lycXNhdmUoJnBJbmZvLT5sb2NrLCBmbGFncyk7CisKKyAgIGlmKHBJbmZvLT5yeF9maXJzdCA9PSBwSGVhZGVyKQorICAgeworICAgICAgLyogUmVtb3ZlIHRoZSBmaXJzdCBibG9jayBpbiB0aGUgbGlua2VkIGxpc3Q6ICovCisgICAgICBwSW5mby0+cnhfZmlyc3QgPSBwSGVhZGVyLT5uZXh0OworICAgICAgCisgICAgICBpZihwSW5mby0+cnhfZmlyc3Q9PU5VTEwpCisgICAgICB7CisgICAgICAgICBwSW5mby0+cnhfbGFzdCA9IE5VTEw7CisgICAgICB9CisgICAgICBwSW5mby0+YmxvY2tzX2luX3J4X3F1ZXVlLS07CisgICB9CisgICBlbHNlIAorICAgeworICAgICAgLyogRmluZCBibG9jayB0byByZW1vdmU6ICovCisgICAgICBmb3IocEZpbmQ9cEluZm8tPnJ4X2ZpcnN0OyBwRmluZDsgcEZpbmQ9cEZpbmQtPm5leHQpCisgICAgICB7CisgICAgICAgICBpZihwRmluZC0+bmV4dCA9PSBwSGVhZGVyKSAKKyAgICAgICAgIHsKKyAgICAgICAgICAgIC8qIEdvdCBpdC4gKi8KKyAgICAgICAgICAgIHBGaW5kLT5uZXh0ID0gcEhlYWRlci0+bmV4dDsKKyAgICAgICAgICAgIHBJbmZvLT5ibG9ja3NfaW5fcnhfcXVldWUtLTsKKyAgICAgICAgICAgIGlmKHBGaW5kLT5uZXh0PT1OVUxMKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgLyogT2gsIHJlbW92ZWQgdGhlIGxhc3Qgb25lISAqLworICA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0X2Jsb2NrICV4LCByb29tICVkLCBsZW5ndGggJWQiLCAKKyAgICAgICAgICAoaW50KXBCbG9jaywgcm9vbSwgcEJsb2NrLT5sZW5ndGgpOworICAgCisgICB3aGlsZShwSW5mby0+dHhfcG9zaXRpb24gPCBwQmxvY2stPmxlbmd0aCkKKyAgIHsKKyAgICAgIGlmKHJvb208MikKKyAgICAgICAgIGJyZWFrOworIAorICAgICAgaWYocEJsb2NrLT5kYXRhW3BJbmZvLT50eF9wb3NpdGlvbl09PURMRSkKKyAgICAgIHsKKyAgICAgICAgIC8qIHNlbmQgYWRkaXRpb25hbCBETEUgY2hhcjogKi8KKyAgICAgICAgIHB1dF9jaGFyKHBJbmZvLCBETEUpOworICAgICAgfQorICAgICAgcHV0X2NoYXIocEluZm8sIHBCbG9jay0+ZGF0YVtwSW5mby0+dHhfcG9zaXRpb24rK10pOworICAgICAgCisgICAgICByb29tLS07CisgICB9CisKKyAgIGlmKChwSW5mby0+dHhfcG9zaXRpb24gPT0gcEJsb2NrLT5sZW5ndGgpICYmIChyb29tPj0zKSkKKyAgIHsKKyAgICAgIHB1dF9jaGFyKHBJbmZvLCBETEUpOworICAgICAgcHV0X2NoYXIocEluZm8sIEVUWCk7CisgICAgICBpZihwSW5mby0+ZmxhZ3MgJiBSMzk2NF9CQ0MpCisgICAgICB7CisgICAgICAgICBwdXRfY2hhcihwSW5mbywgcEluZm8tPmJjYyk7CisgICAgICB9CisgICAgICBwSW5mby0+c3RhdGUgPSBSMzk2NF9XQUlUX0ZPUl9UWF9BQ0s7CisgICAgICBtb2RfdGltZXIoJnBJbmZvLT50bXIsIGppZmZpZXMgKyBSMzk2NF9UT19RVlopOworICAgfQorICAgZmx1c2gocEluZm8pOworfQorCitzdGF0aWMgdm9pZCBvbl9yZWNlaXZlX2Jsb2NrKHN0cnVjdCByMzk2NF9pbmZvICpwSW5mbykKK3sKKyAgIHVuc2lnbmVkIGludCBsZW5ndGg7CisgICBzdHJ1Y3QgcjM5NjRfY2xpZW50X2luZm8gKnBDbGllbnQ7CisgICBzdHJ1Y3QgcjM5NjRfYmxvY2tfaGVhZGVyICpwQmxvY2s7CisgICAKKyAgIGxlbmd0aD1wSW5mby0+cnhfcG9zaXRpb247CisKKyAgIC8qIGNvbXBhcmUgYnl0ZSBjaGVja3N1bSBjaGFyYWN0ZXJzOiAqLworICAgaWYocEluZm8tPmZsYWdzICYgUjM5NjRfQkNDKQorICAgeworICAgICAgaWYocEluZm8tPmJjYyE9cEluZm8tPmxhc3RfcngpCisgICAgICB7CisgICAgICAgICBUUkFDRV9QRSgiY2hlY2tzdW0gZXJyb3IgLSBnb3QgJXggYnV0IGV4cGVjdGVkICV4IiwKKyAgICAgICAgICAgICAgICBwSW5mby0+bGFzdF9yeCwgcEluZm8tPmJjYyk7CisgICAgICAgICBwSW5mby0+ZmxhZ3MgfD0gUjM5NjRfQ0hFQ0tTVU07CisgICAgICB9CisgICB9CisKKyAgIC8qIGNoZWNrIGZvciBlcnJvcnMgKHBhcml0eSwgb3ZlcnJ1biwuLi4pOiAqLworICAgaWYocEluZm8tPmZsYWdzICYgUjM5NjRfRVJST1IpCisgICB7CisgICAgICBUUkFDRV9QRSgib25fcmVjZWl2ZV9ibG9jayAtIHRyYW5zbWlzc2lvbiBmYWlsZWQgZXJyb3IgJXgiLAorICAgICAgICAgICAgIHBJbmZvLT5mbGFncyAmIFIzOTY0X0VSUk9SKTsKKyAgICAgIAorICAgICAgcHV0X2NoYXIocEluZm8sIE5BSyk7CisgICAgICBmbHVzaChwSW5mbyk7CisgICAgICBpZihwSW5mby0+blJldHJ5PFIzOTY0X01BWF9SRVRSSUVTKQorICAgICAgeworICAgICAgICAgcEluZm8tPnN0YXRlPVIzOTY0X1dBSVRfRk9SX1JYX1JFUEVBVDsKKyAgICAgICAgIHBJbmZvLT5uUmV0cnkrKzsKKwkgbW9kX3RpbWVyKCZwSW5mby0+dG1yLCBqaWZmaWVzICsgUjM5NjRfVE9fUlhfUEFOSUMpOworICAgICAgfQor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ZXVlKHBJbmZvLCBwQmxvY2spOworCisgICAvKiBub3RpZnkgYXR0YWNoZWQgY2xpZW50IHByb2Nlc3NlczogKi8KKyAgIGZvcihwQ2xpZW50PXBJbmZvLT5maXJzdENsaWVudDsgcENsaWVudDsgcENsaWVudD1wQ2xpZW50LT5uZXh0KQorICAgeworICAgICAgaWYocENsaWVudC0+c2lnX2ZsYWdzICYgUjM5NjRfU0lHX0RBVEEpCisgICAgICB7CisgICAgICAgICBhZGRfbXNnKHBDbGllbnQsIFIzOTY0X01TR19EQVRBLCBsZW5ndGgsIFIzOTY0X09LLCBwQmxvY2spOworICAgICAgfQorICAgfQorICAgd2FrZV91cF9pbnRlcnJ1cHRpYmxlICgmcEluZm8tPnJlYWRfd2FpdCk7CisgICAKKyAgIHBJbmZvLT5zdGF0ZSA9IFIzOTY0X0lETEU7CisKKyAgIHRyaWdnZXJfdHJhbnNtaXQocEluZm8pOworfQorCisKK3N0YXRpYyB2b2lkIHJlY2VpdmVfY2hhcihzdHJ1Y3QgcjM5NjRfaW5mbyAqcEluZm8sIGNvbnN0IHVuc2lnbmVkIGNoYXIgYykKK3sKKyAgIHN3aXRjaChwSW5mby0+c3RhdGUpCisgICB7CisgICAgICBjYXNlIFIzOTY0X1RYX1JFUVVFU1Q6CisgICAgICAgICBpZihjPT1ETEUpCisgICAgICAgICB7CisgICAgICAgICAgICBUUkFDRV9QUygiVFhfUkVRVUVTVCAtIGdvdCBETEUiKTsKKworICAgICAgICAgICAgcEluZm8tPnN0YXRlID0gUjM5NjRfVFJBTlNNSVRUSU5HOworICAgICAgICAgICAgcEluZm8tPnR4X3Bvc2l0aW9uID0gMDsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgdHJhbnNtaXRfYmxvY2socEluZm8pOworICAgICAgICAgfQorICAgICAgICAgZWxzZSBpZihjPT1TVFgpCisgICAgICAgICB7CisgICAgICAgICAgICBpZihwSW5mby0+blJldHJ5PT0wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgVFJBQ0VfUEUoIlRYX1JFUVVFU1QgLSBpbml0IGNvbmZsaWN0Iik7CisgICAgICAgICAgICAgICBpZihwSW5mby0+cHJpb3JpdHkgPT0gUjM5NjRfU0xBVkUpCisgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBnb3RvIHN0YXJ0X3JlY2VpdmluZzsKKyAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gCisgICAgICAgICAgICBlbHNlIAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgVFJBQ0VfUEUoIlRYX1JFUVVFU1QgLSBzZWNvbmRhcnkgaW5pdCBjb25mbGljdCE/IgorICAgICAgICAgICAgICAgICAgICAgICAgIiBTd2l0Y2hpbmcgdG8gU0xBVkUgbW9kZSBmb3IgbmV4dCByeC4iKTsKKyAgICAgICAgICAgICAgIGdvdG8gc3RhcnRfcmVjZWl2aW5nOworICAgICAgICAgICAgfQorICAgICAgICAgfQorICAgICAgICAgZWxzZQorICAgICAgICAgeworICAgICAgICAgICAgVFJBQ0VfUEUoIlRYX1JFUVVFU1QgLSBjaGFyICE9IERMRTogJXgiLCBjKTsKKyAgICAgICAgICAgIHJldHJ5X3RyYW5zbWl0KHBJbmZvKTsKKyAgICAgICAgIH0KKyAgICAgICAgIGJyZWFrOworICAgICAgY2FzZSBSMzk2NF9UUkFOU01JVFRJTkc6CisgICAgICAgICBpZihjPT1OQUspCisgICAgICAgICB7CisgICAgICAgICAgICBUUkFDRV9QRSgiVFJBTlNNSVRUSU5HIC0gZ290IE5BSyIpOworICAgICAgICAgICAgcmV0cnlfdHJhbnNtaXQocEluZm8pOworICAgICAgICAgfQorICAgICAgICAgZWxzZQorICAgICAgICAgeworICAgICAgICAgICAgVFJBQ0VfUEUoIlRSQU5TTUlUVElORyAtIGdvdCBpbnZhbGlkIGNoYXIiKTsKKyAKKyAgICAgICAgICAgIHBJbmZvLT5zdGF0ZSA9IFIzOTY0X1dBSVRfWlZaX0JFRk9SRV9UWF9SRVRSWTsKKwkgICAgbW9kX3RpbWVyKCZwSW5mby0+dG1yLCBqaWZmaWVzICsgUjM5NjRfVE9fWlZaKTsKKyAgICAgICAgIH0KKyAgICAgICAgIGJyZWFrOworICAgICAgY2FzZSBSMzk2NF9XQUlUX0ZPUl9UWF9BQ0s6CisgICAgICAgICBpZihjPT1ETEUpCisgICAgICAgICB7CisgICAgICAgICAgICBUUkFDRV9QUygiV0FJVF9GT1JfVFhfQUNLIC0gZ290IERMRSIpOworICAgICAgICAgICAgcmVtb3ZlX2Zyb21fdHhfcXVldWUocEluZm8sIFIzOTY0X09LKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgcEluZm8tPnN0YXRlID0gUjM5NjRfSURMRTsKKyAgICAgICAgICAgIHRyaWdnZXJfdHJhbnNtaXQocEluZm8pOworICAgICAgICAgfQorICAgICAgICAgZWxzZQorICAgICAgICAgeworICAgICAgICAgICAgcmV0cnlfdHJhbnNtaXQocEluZm8pOworICAgICAgICAgfQorICAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIFIzOTY0X1dBSVRfRk9SX1JYX1JFUEVBVDoKKyAgICAgICAgIC8qIEZBTExUUk9VR0ggKi8KKyAgICAgIGNhc2UgUjM5NjRfSURMRToKKyAgICAgICAgIGlmKGM9PVNUWCkKKyAgICAgICAgIHsKKyAgICAgICAgICAgIC8qIFByZXZlbnQgcnhfcXVldWUgZnJvbSBvdmVyZmxvdzogKi8KKyAgICAgICAgICAgIGlmKHBJbmZvLT5ibG9ja3NfaW5fcnhfcXVldWUgPj0gUjM5NjRfTUFYX0JMT0NLU19JTl9SWF9RVUVVRSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgIFRSQUNFX1BFKCJJRExFIC0gZ290IFNUWCBidXQgbm8gc3BhY2UgaW4gcnhfcXVldWUhIik7CisgICAgICAgICAgICAgICBwSW5mby0+c3RhdGU9UjM5NjRfV0FJVF9GT1JfUlhfQlVGOworCSAgICAgICBtb2RfdGltZXIoJnBJbmZvLT50bXIsIFIzOTY0X1RPX05PX0JVRik7CisgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KK3N0YXJ0X3JlY2VpdmluZzoKKyAgICAgICAgICAgIC8qIE9rLCBzdGFydCByZWNlaXZpbmc6ICovCisgICAgICAgICAgICBUUkFDRV9QUygiSURMRSAtIGdvdCBTVFgiKTsKKyAgICAgICAgICAgIHBJbmZvLT5yeF9wb3NpdGlvbiA9IDA7CisgICAgICAgICAgICBwSW5mby0+bGFzdF9yeCA9IDA7CisgICAgICAgICAgICBwSW5mby0+ZmxhZ3MgJj0gflIzOTY0X0VSUk9SOworICAgICAgICAgICAgcEluZm8tPnN0YXRlPVIzOTY0X1JFQ0VJVklORzsKKwkgICAgbW9kX3RpbWVyKCZwSW5mby0+dG1yLCBSMzk2NF9UT19aVlopOworCSAgICBwSW5mby0+blJldHJ5ID0gMDsKKyAgICAgICAgICAgIHB1dF9jaGFyKHBJbmZvLCBETEUpOworICAgICAgICAgICAgZmx1c2gocEluZm8pOworICAgICAgICAgICAgcEluZm8tPmJjYyA9IDA7CisgICAgICAgICB9CisgICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgUjM5NjRfUkVDRUlWSU5HOgorICAgICAgICAgaWYocEluZm8tPnJ4X3Bvc2l0aW9uIDwgUlhfQlVGX1NJWkUpCisgICAgICAgICB7CisgICAgICAgICAgICBwSW5mby0+YmNjIF49IGM7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmKGM9PURMRSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgIGlmKHBJbmZvLT5sYXN0X3J4PT1ETEUpCisgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBwSW5mby0+bGFzdF9yeCA9IDA7CisgICAgICAgICAgICAgICAgICBnb3RvIGNoYXJfdG9fYnVmOworICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgcEluZm8tPmxhc3RfcnggPSBETEU7CisgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0gCisgICAgICAgICAgICBlbHNlIGlmKChjPT1FVFgpICYmIChwSW5mby0+bGFzdF9yeD09RExFKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgIGlmKHBJbmZvLT5mbGFncyAmIFIzOTY0X0JDQykKKyAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIHBJbmZvLT5zdGF0ZSA9IFIzOTY0X1dBSVRfRk9SX0JDQzsKKwkJICBtb2RfdGltZXIoJnBJbmZvLT50bXIsIFIzOTY0X1RPX1pWWik7CisgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICBlbHNlIAorICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgb25fcmVjZWl2ZV9ibG9jayhwSW5mbyk7CisgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICBwSW5mby0+bGFzdF9yeCA9IGM7CitjaGFyX3RvX2J1ZjoKKyAgICAgICAgICAgICAgIHBJbmZvLT5yeF9idWZbcEluZm8tPnJ4X3Bvc2l0aW9uKytdID0gYzsKKwkgICAgICAgbW9kX3RpbWVyKCZwSW5mby0+dG1yLCBSMzk2NF9UT19aVlopOworICAgICAgICAgICAgfQorICAgICAgICAgfQorICAgICAgICAvKiBlbHNlOiBvdmVyZmxvdy1tc2c/IEJVRl9TSVpFPk1UVTsgc2hvdWxkIG5vdCBoYXBwZW4/ICovIAorICAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIFIzOTY0X1dBSVRfRk9SX0JDQzoKKyAgICAgICAgIHBJbmZvLT5sYXN0X3J4ID0gYzsKKyAgICAgICAgIG9uX3JlY2VpdmVfYmxvY2socEluZm8pOworICAgICAgICAgYnJlYWs7CisgICB9Cit9CisKK3N0YXRpYyB2b2lkIHJlY2VpdmVfZXJyb3Ioc3RydWN0IHIzOTY0X2luZm8gKnBJbmZvLCBjb25zdCBjaGFyIGZsYWcpCit7CisgICAgc3dpdGNoIChmbGFnKSAKKyAgICB7CisgICAgY2FzZSBUVFlfTk9STUFMOgorICAgICAgICBicmVhazsKKyAgICBjYXNlIFRUWV9CUkVBSzoKKyAgICAgICAgVFJBQ0VfUEUoInJlY2VpdmVkIGJyZWFrIikKKyAgICAgICAgcEluZm8tPmZsYWdzIHw9IFIzOTY0X0JSRUFLOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFRUWV9QQVJJVFk6CisgICAgICAgIFRSQUNFX1BFKCJwYXJpdHkgZXJyb3IiKQorICAgICAgICBwSW5mby0+ZmxhZ3MgfD0gUjM5NjRfUEFSSVRZOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFRUWV9GUkFNRToKKyAgICAgICAgVFJBQ0VfUEUoImZyYW1lIGVycm9yIikKKyAgICAgICAgcEluZm8tPmZsYWdzIHw9IFIzOTY0X0ZSQU1FOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFRUWV9PVkVSUlVOOgorICAgICAgICBUUkFDRV9QRSgiZnJhbWUgb3ZlcnJ1biIpCisgICAgICAgIHBJbmZvLT5mbGFncyB8PSBSMzk2NF9PVkVSUlVOOworICAgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgICBUUkFDRV9QRSgicmVjZWl2ZV9lcnJvciAtIHVua25vd24gZmxhZyAlZCIsIGZsYWcpOworICAgICAgICBwSW5mby0+ZmxhZ3MgfD0gUjM5NjRfVU5LTk9XTjsKKyAgICAgICAgYnJlYWs7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBvbl90aW1lb3V0KHVuc2lnbmVkIGxvbmcgcHJpdikKK3sKKyAgIHN0cnVjdCByMzk2NF9pbmZvICpwSW5mbyA9ICh2b2lkICopcHJpdjsKKworICAgc3dpdGNoKHBJbmZvLT5zdGF0ZSkKKyAgIHsKKyAgICAgIGNhc2UgUjM5NjRfVFhfUkVRVUVTVDoKKyAgICAgICAgIFRSQUNFX1BFKCJUWF9SRVFVRVNUIC0gdGltZW91dCIpOworICAgICAgICAgcmV0cnlfdHJhbnNtaXQocEluZm8pOworICAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIFIzOTY0X1dBSVRfWlZaX0JFRk9SRV9UWF9SRVRSWToKKyAgICAgICAgIHB1dF9jaGFyKHBJbmZvLCBOQUspOworICAgICAgICAgZmx1c2gocEluZm8pOworICAgICAgICAgcmV0cnlfdHJhbnNtaXQocEluZm8pOworICAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIFIzOTY0X1dBSVRfRk9SX1RYX0FDSzoKKyAgICAgICAgIFRSQUNFX1BFKCJXQUlUX0ZPUl9UWF9BQ0sgLSB0aW1lb3V0Iik7CisgICAgICAgICByZXRyeV90cmFuc21pdChwSW5mbyk7CisgICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgUjM5NjRfV0FJVF9GT1JfUlhfQlVGOgorICAgICAgICAgVFJBQ0VfUEUoIldBSVRfRk9SX1JYX0JVRiAtIHRpbWVvdXQiKTsKKyAgICAgICAgIHB1dF9jaGFyKHBJbmZvLCBOQUspOworICAgICAgICAgZmx1c2gocEluZm8pOworICAgICAgICAgcEluZm8tPnN0YXRlPVIzOTY0X0lETEU7CisgICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgUjM5NjRfUkVDRUlWSU5HOgorICAgICAgICAgVFJBQ0VfUEUoIlJFQ0VJVklORyAtIHRpbWVvdXQgYWZ0ZXIgJWQgY2hhcnMiLCAKKyAgICAgICAgICAgICAgICAgIHBJbmZvLT5yeF9wb3NpdGlvbik7CisgICAgICAgICBwdXRfY2hhcihwSW5mbywgTkFLKTsKKyAgICAgICAgIGZsdXNoKHBJbmZvKTsKKyAgICAgICAgIHBJbmZvLT5zdGF0ZT1SMzk2NF9JRExFOworICAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIFIzOTY0X1dBSVRfRk9SX1JYX1JFUEVBVDoKKyAgICAgICAgIFRSQUNFX1BFKCJXQUlUX0ZPUl9SWF9SRVBFQVQgLSB0aW1lb3V0Iik7CisgICAgICAgICBwSW5mby0+c3RhdGU9UjM5NjRfSURMRTsKKyAgICAgICAgIGJyZWFrOworICAgICAgY2FzZSBSMzk2NF9XQUlUX0ZPUl9CQ0M6CisgICAgICAgICBUUkFDRV9QRSgiV0FJVF9GT1JfQkNDIC0gdGltZW91dCIpOworICAgICAgICAgcHV0X2NoYXIocEluZm8sIE5BSyk7CisgICAgICAgICBmbHVzaChwSW5mbyk7CisgICAgICAgICBwSW5mby0+c3RhdGU9UjM5NjRfSURMRTsKKyAgICAgICAgIGJyZWFrOworICAgfQorfQorCitzdGF0aWMgc3RydWN0IHIzOTY0X2NsaWVudF9pbmZvICpmaW5kQ2xpZW50KAorICBzdHJ1Y3QgcjM5NjRfaW5mbyAqcEluZm8sIHBpZF90IHBpZCkKK3sKKyAgIHN0cnVjdCByMzk2NF9jbGllbnRfaW5mbyAqcENsaWVudDsKKyAgIAorICAgZm9yKHBDbGllbnQ9cEluZm8tPmZpcnN0Q2xpZW50OyBwQ2xpZW50OyBwQ2xpZW50PXBDbGllbnQtPm5leHQpCisgICB7CisgICAgICBpZihwQ2xpZW50LT5waWQgPT0gcGlkKQorICAgICAgeworICAgICAgICAgcmV0dXJuIHBDbGllbnQ7CisgICAgICB9CisgICB9CisgICByZXR1cm4gTlVMTDsKK30KKworc3RhdGljIGludCBlbmFibGVfc2lnbmFscyhzdHJ1Y3QgcjM5NjRfaW5mbyAqcEluZm8sIHBpZF90IHBpZCwgaW50IGFyZykKK3sKKyAgIHN0cnVjdCByMzk2NF9jbGllbnRfaW5mbyAqcENsaWVudDsKKyAgIHN0cnVjdCByMzk2NF9jbGllbnRfaW5mbyAqKnBwQ2xpZW50OworICAgc3RydWN0IHIzOTY0X21lc3NhZ2UgKnBNc2c7CisgICAKKyAgIGlmKChhcmcgJiBSMzk2NF9TSUdfQUxMKT09MCkKKyAgIHsKKyAgICAgIC8qIFJlbW92ZSBjbGllbnQgZnJvbSBjbGllbnQgbGlzdCAqLworICAgICAgZm9yKHBwQ2xpZW50PSZwSW5mby0+Zmlyc3RDbGllbnQ7ICpwcENsaWVudDsgcHBDbGllbnQ9JigqcHBDbGllbnQpLT5uZXh0KQorICAgICAgeworICAgICAgICAgcENsaWVudCA9ICpwcENsaWVudDsKKyAgICAgICAgIAorICAgICAgICAgaWYocENsaWVudC0+cGlkID09IHBpZCkKKyAgICAgICAgIHsKKyAgICAgICAgICAgIFRSQUNFX1BTKCJyZW1vdmluZyBjbGllbnQgJWQgZnJvbSBjbGllbnQgbGlzdCIsIHBpZCk7CisgICAgICAgICAgICAqcHBDbGllbnQgPSBwQ2xpZW50LT5uZXh0OworICAgICAgICAgICAgd2hpbGUocENsaWVudC0+bXNnX2NvdW50KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgcE1zZz1yZW1vdmVfbXNnKHBJbmZvLCBwQ2xpZW50KTsKKyAgICAgICAgICAgICAgIGlmKHBNc2cpCisgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBrZnJlZShwTXNnKTsKKyAgICAgICAgICAgICAgICAgIFRSQUNFX00oImVuYWJsZV9zaWduYWxzIC0gbXNnIGtmcmVlICV4IiwoaW50KXBNc2cpOworICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAga2ZyZWUocENsaWVudCk7CisgICAgICAgICAgICBUUkFDRV9NKCJlbmFibGVfc2lnbmFscyAtIGtmcmVlICV4IiwoaW50KXBDbGllbnQpOworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICB9CisgICAgICB9CisgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgIH0KKyAgIGVsc2UKKyAgIHsKKyAgICAgIHBDbGllbnQ9ZmluZENsaWVudChwSW5mbywgcGlkKTsKKyAgICAgIGlmKHBDbGllbnQpCisgICAgICB7CisgICAgICAgICAvKiB1cGRhdGUgc2lnbmFsIG9wdGlvbnMgKi8KKyAgICAgICAgIHBDbGllbnQtPnNpZ19mbGFncz1hcmc7CisgICAgICB9IAorICAgICAgZWxzZSAKKyAgICAgIHsKKyAgICAgICAgIC8qIGFkZCBjbGllbnQgdG8gY2xpZW50IGxpc3QgKi8KKyAgICAgICAgIHBDbGllbnQ9a21hbGxvYyhzaXplb2Yoc3RydWN0IHIzOTY0X2NsaWVudF9pbmZvKSwgR0ZQX0tFUk5FTCk7CisgICAgICAgICBUUkFDRV9NKCJlbmFibGVfc2lnbmFscyAtIGttYWxsb2MgJXgiLChpbnQpcENsaWVudCk7CisgICAgICAgICBpZihwQ2xpZW50PT1OVUxMKQorICAgICAgICAgICAgcmV0dXJuIC1FTk9NRU07CisKKyAgICAgICAgIFRSQUNFX1BTKCJhZGQgY2xpZW50ICVkIHRvIGNsaWVudCBsaXN0IiwgcGlkKTsKKwkgc3Bpbl9sb2NrX2luaXQoJnBDbGllbnQtPmxvY2spOworICAgICAgICAgcENsaWVudC0+c2lnX2ZsYWdzPWFyZzsKKyAgICAgICAgIHBDbGllbnQtPnBpZCA9IHBpZDsKKyAgICAgICAgIHBDbGllbnQtPm5leHQ9cEluZm8tPmZpcnN0Q2xpZW50OworICAgICAgICAgcENsaWVudC0+Zmlyc3RfbXNnID0gTlVMTDsKKyAgICAgICAgIHBDbGllbnQtPmxhc3RfbXNnID0gTlVMTDsKKyAgICAgICAgIHBDbGllbnQtPm5leHRfYmxvY2tfdG9fcmVhZCA9IE5VTEw7CisgICAgICAgICBwQ2xpZW50LT5tc2dfY291bnQgPSAwOworICAgICAgICAgcEluZm8tPmZpcnN0Q2xpZW50PXBDbGllbnQ7CisgICAgICB9CisgICB9CisKKyAgIHJldHVybiAwOworfQorCitzdGF0aWMgaW50IHJlYWRfdGVsZWdyYW0oc3RydWN0IHIzOTY0X2luZm8gKnBJbmZvLCBwaWRfdCBwaWQsIHVuc2lnbmVkIGNoYXIgX191c2VyICpidWYpCit7CisgICAgc3RydWN0IHIzOTY0X2NsaWVudF9pbmZvICpwQ2xpZW50OworICAgIHN0cnVjdCByMzk2NF9ibG9ja19oZWFkZX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ga21hbGxvYyAleCIsKGludClwTXNnKTsKKyAgICAgIGlmKHBNc2c9PU5VTEwpIHsKKyAgICAgICAgIHJldHVybjsKKyAgICAgIH0KKworICAgICAgc3Bpbl9sb2NrX2lycXNhdmUoJnBDbGllbnQtPmxvY2ssIGZsYWdzKTsKKworICAgICAgcE1zZy0+bXNnX2lkID0gbXNnX2lkOworICAgICAgcE1zZy0+YXJnICAgID0gYXJnOworICAgICAgcE1zZy0+ZXJyb3JfY29kZSA9IGVycm9yX2NvZGU7CisgICAgICBwTXNnLT5ibG9jayAgPSBwQmxvY2s7CisgICAgICBwTXNnLT5uZXh0ICAgPSBOVUxMOworICAgICAgCisgICAgICBpZihwQ2xpZW50LT5sYXN0X21zZz09TlVMTCkKKyAgICAgIHsKKyAgICAgICAgIHBDbGllbnQtPmZpcnN0X21zZz1wQ2xpZW50LT5sYXN0X21zZz1wTXNnOworICAgICAgfQorICAgICAgZWxzZQorICAgICAgeworICAgICAgICAgcENsaWVudC0+bGFzdF9tc2ctPm5leHQgPSBwTXNnOworICAgICAgICAgcENsaWVudC0+bGFzdF9tc2c9cE1zZzsKKyAgICAgIH0KKworICAgICAgcENsaWVudC0+bXNnX2NvdW50Kys7CisKKyAgICAgIGlmKHBCbG9jayE9TlVMTCkKKyAgICAgIHsKKyAgICAgICAgIHBCbG9jay0+bG9ja3MrKzsKKyAgICAgIH0KKyAgICAgIHNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJnBDbGllbnQtPmxvY2ssIGZsYWdzKTsKKyAgIH0KKyAgIGVsc2UKKyAgIHsKKyAgICAgIGlmKChwQ2xpZW50LT5sYXN0X21zZy0+bXNnX2lkID09IFIzOTY0X01TR19BQ0spCisJCSAmJiAocENsaWVudC0+bGFzdF9tc2ctPmVycm9yX2NvZGU9PVIzOTY0X09WRVJGTE9XKSkKKyAgICAgIHsKKyAgICAgICAgIHBDbGllbnQtPmxhc3RfbXNnLT5hcmcrKzsKKwkJIFRSQUNFX1BFKCJhZGRfbXNnIC0gaW5jIHByZXYgT1ZFUkZMT1ctbXNnIik7CisgICAgICB9CisgICAgICBlbHNlCisgICAgICB7CisgICAgICAgICBtc2dfaWQgPSBSMzk2NF9NU0dfQUNLOworICAgICAgICAgYXJnID0gMDsKKwkJIGVycm9yX2NvZGUgPSBSMzk2NF9PVkVSRkxPVzsKKyAgICAgICAgIHBCbG9jayA9IE5VTEw7CisJCSBUUkFDRV9QRSgiYWRkX21zZyAtIHF1ZXVlIE9WRVJGTE9XLW1zZyIpOworICAgICAgICAgZ290byBxdWV1ZV90aGVfbWVzc2FnZTsKKyAgICAgIH0KKyAgIH0KKyAgIC8qIFNlbmQgU0lHSU8gc2lnbmFsIHRvIGNsaWVudCBwcm9jZXNzOiAqLworICAgaWYocENsaWVudC0+c2lnX2ZsYWdzICYgUjM5NjRfVVNFX1NJR0lPKQorICAgeworICAgICAga2lsbF9wcm9jKHBDbGllbnQtPnBpZCwgU0lHSU8sIDEpOworICAgfQorfQorCitzdGF0aWMgc3RydWN0IHIzOTY0X21lc3NhZ2UgKnJlbW92ZV9tc2coc3RydWN0IHIzOTY0X2luZm8gKnBJbmZvLAorICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgcjM5NjRfY2xpZW50X2luZm8gKnBDbGllbnQpCit7CisgICBzdHJ1Y3QgcjM5NjRfbWVzc2FnZSAqcE1zZz1OVUxMOworICAgdW5zaWduZWQgbG9uZyBmbGFnczsKKworICAgaWYocENsaWVudC0+Zmlyc3RfbXNnKQorICAgeworICAgICAgc3Bpbl9sb2NrX2lycXNhdmUoJnBDbGllbnQtPmxvY2ssIGZsYWdzKTsKKworICAgICAgcE1zZyA9IHBDbGllbnQtPmZpcnN0X21zZzsKKyAgICAgIHBDbGllbnQtPmZpcnN0X21zZyA9IHBNc2ctPm5leHQ7CisgICAgICBpZihwQ2xpZW50LT5maXJzdF9tc2c9PU5VTEwpCisgICAgICB7CisgICAgICAgICBwQ2xpZW50LT5sYXN0X21zZyA9IE5VTEw7CisgICAgICB9CisgICAgICAKKyAgICAgIHBDbGllbnQtPm1zZ19jb3VudC0tOworICAgICAgaWYocE1zZy0+YmxvY2spCisgICAgICB7CisgICAgICAgIHJlbW92ZV9jbGllbnRfYmxvY2socEluZm8sIHBDbGllbnQpOworICAgICAgICBwQ2xpZW50LT5uZXh0X2Jsb2NrX3RvX3JlYWQgPSBwTXNnLT5ibG9jazsKKyAgICAgIH0KKyAgICAgIHNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJnBDbGllbnQtPmxvY2ssIGZsYWdzKTsKKyAgIH0KKyAgIHJldHVybiBwTXNnOworfQorCitzdGF0aWMgdm9pZCByZW1vdmVfY2xpZW50X2Jsb2NrKHN0cnVjdCByMzk2NF9pbmZvICpwSW5mbywgCisgICAgICAgICAgICAgICAgc3RydWN0IHIzOTY0X2NsaWVudF9pbmZvICpwQ2xpZW50KQoreworICAgIHN0cnVjdCByMzk2NF9ibG9ja19oZWFkZXIgKmJsb2NrOworCisgICAgVFJBQ0VfUFMoInJlbW92ZV9jbGllbnRfYmxvY2sgUElEICVkIiwgcENsaWVudC0+cGlkKTsKKworICAgIGJsb2NrPXBDbGllbnQtPm5leHRfYmxvY2tfdG9fcmVhZDsKKyAgICBpZihibG9jaykKKyAgICB7CisgICAgICAgIGJsb2NrLT5sb2Nrcy0tOworICAgICAgICBpZihibG9jay0+bG9ja3M9PTApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJlbW92ZV9mcm9tX3J4X3F1ZXVlKHBJbmZvLCBibG9jayk7CisgICAgICAgIH0KKyAgICB9CisgICAgcENsaWVudC0+bmV4dF9ibG9ja190b19yZWFkID0gTlVMTDsKK30KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogTGluZSBkaXNjaXBsaW5lIHJvdXRpbmVzCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3R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GlzY19kYXRhID0gcEluZm87CisKKyAgIGluaXRfdGltZXIoJnBJbmZvLT50bXIpOworICAgcEluZm8tPnRtci5kYXRhID0gKHVuc2lnbmVkIGxvbmcpcEluZm87CisgICBwSW5mby0+dG1yLmZ1bmN0aW9uID0gb25fdGltZW91dDsKKworICAgcmV0dXJuIDA7Cit9CisKK3N0YXRpYyB2b2lkIHIzOTY0X2Nsb3NlKHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisgICBzdHJ1Y3QgcjM5NjRfaW5mbyAqcEluZm89KHN0cnVjdCByMzk2NF9pbmZvKil0dHktPmRpc2NfZGF0YTsKKyAgIHN0cnVjdCByMzk2NF9jbGllbnRfaW5mbyAqcENsaWVudCwgKnBOZXh0OworICAgc3RydWN0IHIzOTY0X21lc3NhZ2UgKnBNc2c7CisgICBzdHJ1Y3QgcjM5NjRfYmxvY2tfaGVhZGVyICpwSGVhZGVyLCAqcE5leHRIZWFkZXI7CisgICB1bnNpZ25lZCBsb25nIGZsYWdzOworCisgICBUUkFDRV9MKCJjbG9zZSIpOworCisgICAgLyoKKyAgICAgKiBNYWtlIHN1cmUgdGhhdCBvdXIgdGFzayBxdWV1ZSBpc24ndCBhY3RpdmF0ZWQuICBJZiBpdAorICAgICAqIGlzLCB0YWtlIGl0IG91dCBvZiB0aGUgbGlua2VkIGxpc3QuCisgICAgICovCisgICAgZGVsX3RpbWVyX3N5bmMoJnBJbmZvLT50bXIpOworCisgICAvKiBSZW1vdmUgY2xpZW50LXN0cnVjdHMgYW5kIG1lc3NhZ2UgcXVldWVzOiAqLworICAgIHBDbGllbnQ9cEluZm8tPmZpcnN0Q2xpZW50OworICAgIHdoaWxlKHBDbGllbnQpCisgICAgeworICAgICAgIHBOZXh0PXBDbGllbnQtPm5leHQ7CisgICAgICAgd2hpbGUocENsaWVudC0+bXNnX2NvdW50KQorICAgICAgIHsKKyAgICAgICAgICBwTXNnPXJlbW92ZV9tc2cocEluZm8sIHBDbGllbnQpOworICAgICAg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8pOworICAgIFRSQUNFX00oInIzOTY0X2Nsb3NlIC0gaW5mbyBrZnJlZSAleCIsKGludClwSW5mbyk7Cit9CisKK3N0YXRpYyBzc2l6ZV90IHIzOTY0X3JlYWQoc3RydWN0IHR0eV9zdHJ1Y3QgKnR0eSwgc3RydWN0IGZpbGUgKmZpbGUsCisJCQkgIHVuc2lnbmVkIGNoYXIgX191c2VyICpidWYsIHNpemVfdCBucikKK3sKKyAgIHN0cnVjdCByMzk2NF9pbmZvICpwSW5mbz0oc3RydWN0IHIzOTY0X2luZm8qKXR0eS0+ZGlzY19kYXRhOworICAgc3RydWN0IHIzOTY0X2NsaWVudF9pbmZvICpwQ2xpZW50OworICAgc3RydWN0IHIzOTY0X21lc3NhZ2UgKnBNc2c7CisgICBzdHJ1Y3QgcjM5NjRfY2xpZW50X21lc3NhZ2UgdGhlTXNnOworICAgREVDTEFSRV9XQUlUUVVFVUUgKHdhaXQsIGN1cnJlbnQpOworICAgCisgICBpbnQgcGlkID0gY3VycmVudC0+cGlkOworICAgaW50IGNvdW50OworICAgCisgICBUUkFDRV9MKCJyZWFkKCkiKTsKKyAKKyAgIHBDbGllbnQ9ZmluZENsaWVudChwSW5mbywgcGlkKTsKKyAgIGlmKHBDbGllbnQpCisgICB7CisgICAgICBwTXNnID0gcmVtb3ZlX21zZyhwSW5mbywgcENsaWVudCk7CisgICAgICBpZihwTXNnPT1OVUxMKQorICAgICAgeworCQkgLyogbm8gbWVzc2FnZXMgYXZhaWxhYmxlLiAqLworICAgICAgICAgaWYgKGZpbGUtPmZfZmxhZ3MgJiBPX05PTkJMT0NLKQorCQkgeworICAgICAgICAgICAgcmV0dXJuIC1FQUdBSU47CisJCSB9CisgICAgICAgICAvKiBibG9jayB1bnRpbCB0aGVyZSBpcyBhIG1lc3NhZ2U6ICovCisgICAgICAgICBhZGRfd2FpdF9xdWV1ZSgmcEluZm8tPnJlYWRfd2FpdCwgJndhaXQpOworcmVwZWF0OgorICAgICAgICAgY3VycmVudC0+c3RhdGUgPSBUQVNLX0lOVEVSUlVQVElCTEU7CisgICAgICAgICBwTXNnID0gcmVtb3ZlX21zZyhwSW5mbywgcENsaWVudCk7CisJIGlmICghcE1zZyAmJiAhc2lnbmFsX3BlbmRpbmcoY3VycmVudCkpCisJCSB7CisgICAgICAgICAgICBzY2hlZHVsZSgpOworICAgICAgICAgICAgZ290byByZXBlYXQ7CisgICAgICAgICB9CisgICAgICAgICBjdXJyZW50LT5zdGF0ZSA9IFRBU0tfUlVOTklORzsKKyAgICAgICAgIHJlbW92ZV93YWl0X3F1ZXVlKCZwSW5mby0+cmVhZF93YWl0LCAmd2FpdCk7CisgICAgICB9CisgICAgICAKKyAgICAgIC8qIElmIHdlIHN0aWxsIGhhdmVuJ3QgZ290IGEgbWVzc2FnZSwgd2UgbXVzdCBoYXZlIGJlZW4gc2lnbmFsbGVkICovCisKKyAgICAgIGlmICghcE1zZykgcmV0dXJuIC1FSU5UUjsKKworICAgICAgLyogZGVsaXZlciBtc2cgdG8gY2xpZW50IHByb2Nlc3M6ICovCisgICAgICB0aGVNc2cubXNnX2lkID0gcE1zZy0+bXNnX2lkOworICAgICAgdGhlTXNnLmFyZyAgICA9IHBNc2ctPmFyZzsKKyAgICAgIHRoZU1zZy5lcnJvcl9jb2RlID0gcE1zZy0+ZXJyb3JfY29kZTsKKyAgICAgIGNvdW50ID0gc2l6ZW9mKHN0cnVjdCByMzk2NF9jbGllbnRfbWVzc2FnZSk7CisKKyAgICAgIGtmcmVlKHBNc2cpOworICAgICAgVFJBQ0VfTSgicjM5NjRfcmVhZCAtIG1zZyBrZnJlZSAleCIsKGludClwTXNnKTsKKworICAgICAgaWYgKGNvcHlfdG9fdXNlcihidWYsJnRoZU1zZywgY291bnQpKQorCXJldHVybiAtRUZBVUxUOworCisgICAgICBUUkFDRV9QUygicmVhZCAtIHJldHVybiAlZCIsIGNvdW50KTsKKyAgICAgIHJldHVybiBjb3VudDsKKyAgIH0KKyAgIHJldHVybiAtRVBFUk07Cit9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SwgY291bnQpOworICAgfQorCisvKgorICogQWRkIGJ1ZmZlciB0byB0cmFuc21pdC1xdWV1ZToKKyAqLworICAgYWRkX3R4X3F1ZXVlKHBJbmZvLCBwSGVhZGVyKTsKKyAgIHRyaWdnZXJfdHJhbnNtaXQocEluZm8pOworICAgCisgICByZXR1cm4gMDsKK30KKworc3RhdGljIGludCByMzk2NF9pb2N0bChzdHJ1Y3QgdHR5X3N0cnVjdCAqIHR0eSwgc3RydWN0IGZpbGUgKiBmaWxlLAorICAgICAgICAgICAgICAgdW5zaWduZWQgaW50IGNtZCwgdW5zaWduZWQgbG9uZyBhcmcpCit7CisgICBzdHJ1Y3QgcjM5NjRfaW5mbyAqcEluZm89KHN0cnVjdCByMzk2NF9pbmZvKil0dHktPmRpc2NfZGF0YTsKKyAgIGlmKHBJbmZvPT1OVUxMKQorICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICBzd2l0Y2goY21kKQorICAgeworICAgICAgY2FzZSBSMzk2NF9FTkFCTEVfU0lHTkFMUzoKKyAgICAgICAgIHJldHVybiBlbmFibGVfc2lnbmFscyhwSW5mbywgY3VycmVudC0+cGlkLCBhcmcpOworICAgICAgY2FzZSBSMzk2NF9TRVRQUklPUklUWToKKyAgICAgICAgIGlmKGFyZzxSMzk2NF9NQVNURVIgfHwgYXJnPlIzOTY0X1NMQVZFKQorICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICBwSW5mby0+cHJpb3JpdHkgPSBhcmcgJiAweGZmOworICAgICAgICAgcmV0dXJuIDA7CisgICAgICBjYXNlIFIzOTY0X1VTRV9CQ0M6CisgICAgICAgICAgICAgaWYoYXJnKQorICAgICAgICAgICAgcEluZm8tPmZsYWdzIHw9IFIzOTY0X0JDQzsKKyAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHBJbmZvLT5mbGFncyAmPSB+UjM5NjRfQkNDOworICAgICAgICAgcmV0dXJuIDA7CisgICAgICBjYXNlIFIzOTY0X1JFQURfVEV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gICBwTXNnPXBDbGllbnQtPmZpcnN0X21zZzsKKyAgICAgICBzcGluX3VubG9ja19pcnFyZXN0b3JlKCZwSW5mby0+bG9jaywgZmxhZ3MpOworICAgICAgIGlmKHBNc2cpCisJICAgcmVzdWx0IHw9IFBPTExJTiB8IFBPTExSRE5PUk07CisgICAgIH0KKyAgIGVsc2UKKyAgICAgeworICAgICAgIHJlc3VsdCA9IC1FSU5WQUw7CisgICAgIH0KKyAgIHJldHVybiByZXN1bHQ7Cit9CisKK3N0YXRpYyB2b2lkIHIzOTY0X3JlY2VpdmVfYnVmKHN0cnVjdCB0dHlfc3RydWN0ICp0dHksIGNvbnN0IHVuc2lnbmVkIGNoYXIgKmNwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqZnAsIGludCBjb3VudCkKK3sKKyAgIHN0cnVjdCByMzk2NF9pbmZvICpwSW5mbz0oc3RydWN0IHIzOTY0X2luZm8qKXR0eS0+ZGlzY19kYXRhOworICAgIGNvbnN0IHVuc2lnbmVkIGNoYXIgKnA7CisgICAgY2hhciAqZiwgZmxhZ3MgPSAwOworICAgIGludCBpOworCisgICAgZm9yIChpPWNvdW50LCBwID0gY3AsIGYgPSBmcDsgaTsgaS0tLCBwKyspIHsKKyAgICAgICAgaWYgKGYpCisgICAgICAgICAgICBmbGFncyA9ICpmKys7CisgICAgICAgIGlmKGZsYWdzPT1UVFlfTk9STUFMKQorICAgICAgICB7CisgICAgICAgICAgICByZWNlaXZlX2NoYXIocEluZm8sICpwKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHJlY2VpdmVfZXJyb3IocEluZm8sIGZsYWdzKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICB9Cit9CisKK3N0YXRpYyBpbnQgcjM5NjRfcmVjZWl2ZV9yb29tKHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisgICBUUkFDRV9MKCJyZWNlaXZlX3Jvb20iKTsKKyAg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ZF9kZXZpY2UoaW5mbyk7CisKKyAgICByZXR1cm4gbGluazsKK30KKworLyogQ2FyZCBoYXMgYmVlbiBpbnNlcnRlZC4KKyAqLworCisjZGVmaW5lIENTX0NIRUNLKGZuLCByZXQpIFwKK2RvIHsgbGFzdF9mbiA9IChmbik7IGlmICgobGFzdF9yZXQgPSAocmV0KSkgIT0gMCkgZ290byBjc19mYWlsZWQ7IH0gd2hpbGUgKDApCisKK3N0YXRpYyB2b2lkIG1nc2xwY19jb25maWcoZGV2X2xpbmtfdCAqbGluaykKK3sKKyAgICBjbGllbnRfaGFuZGxlX3QgaGFuZGxlID0gbGluay0+aGFuZGxlOworICAgIE1HU0xQQ19JTkZPICppbmZvID0gbGluay0+cHJpdjsKKyAgICB0dXBsZV90IHR1cGxlOworICAgIGNpc3BhcnNlX3QgcGFyc2U7CisgICAgaW50IGxhc3RfZm4sIGxhc3RfcmV0OworICAgIHVfY2hhciBidWZbNjRdOworICAgIGNvbmZpZ19pbmZvX3QgY29uZjsKKyAgICBjaXN0cGxfY2Z0YWJsZV9lbnRyeV90IGRmbHQgPSB7IDAgfTsKKyAgICBjaXN0cGxfY2Z0YWJsZV9lbnRyeV90ICpjZmc7CisgICAgCisgICAgaWYgKGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lORk8pCisJICAgIHByaW50aygibWdzbHBjX2NvbmZpZygweCVwKVxuIiwgbGluayk7CisKKyAgICAvKiByZWFkIENPTkZJRyB0dXBsZSB0byBmaW5kIGl0cyBjb25maWd1cmF0aW9uIHJlZ2lzdGVycyAqLworICAgIHR1cGxlLkRlc2lyZWRUdXBsZSA9IENJU1RQTF9DT05GSUc7CisgICAgdHVwbGUuQXR0cmlidXRlcyA9IDA7CisgICAgdHVwbGUuVHVwbGVEYXRhID0gYnVmOworICAgIHR1cGxlLlR1cGxlRGF0YU1heCA9IHNpemVvZihidWYpOworICAgIHR1cGxlLlR1cGxlT2Zmc2V0ID0gMDsKKyAgICBDU19DSEVDSyhHZXR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mstPmhhbmRsZSwgJmxpbmstPmlvKSk7CisgICAgfQorCisgICAgbGluay0+Y29uZi5BdHRyaWJ1dGVzID0gQ09ORl9FTkFCTEVfSVJROworICAgIGxpbmstPmNvbmYuVmNjID0gNTA7CisgICAgbGluay0+Y29uZi5JbnRUeXBlID0gSU5UX01FTU9SWV9BTkRfSU87CisgICAgbGluay0+Y29uZi5Db25maWdJbmRleCA9IDg7CisgICAgbGluay0+Y29uZi5QcmVzZW50ID0gUFJFU0VOVF9PUFRJT047CisgICAgCisgICAgbGluay0+aXJxLkF0dHJpYnV0ZXMgfD0gSVJRX0hBTkRMRV9QUkVTRU5UOworICAgIGxpbmstPmlycS5IYW5kbGVyICAgICA9IG1nc2xwY19pc3I7CisgICAgbGluay0+aXJxLkluc3RhbmNlICAgID0gaW5mbzsKKyAgICBDU19DSEVDSyhSZXF1ZXN0SVJRLCBwY21jaWFfcmVxdWVzdF9pcnEobGluay0+aGFuZGxlLCAmbGluay0+aXJxKSk7CisKKyAgICBDU19DSEVDSyhSZXF1ZXN0Q29uZmlndXJhdGlvbiwgcGNtY2lhX3JlcXVlc3RfY29uZmlndXJhdGlvbihsaW5rLT5oYW5kbGUsICZsaW5rLT5jb25mKSk7CisKKyAgICBpbmZvLT5pb19iYXNlID0gbGluay0+aW8uQmFzZVBvcnQxOworICAgIGluZm8tPmlycV9sZXZlbCA9IGxpbmstPmlycS5Bc3NpZ25lZElSUTsKKworICAgIC8qIGFkZCB0byBsaW5rZWQgbGlzdCBvZiBkZXZpY2VzICovCisgICAgc3ByaW50ZihpbmZvLT5ub2RlLmRldl9uYW1lLCAibWdzbHBjMCIpOworICAgIGluZm8tPm5vZGUubWFqb3IgPSBpbmZvLT5ub2RlLm1pbm9yID0gMDsKKyAgICBsaW5rLT5kZXYgPSAmaW5mby0+bm9kZTsKKworICAgIHByaW50ayhLRVJOX0lORk8gIiVzOiBpbmRleCAweCUwMng6IiwKKwkgICBpbmZvLT5ub2RlLmRldl9uYW1lLCBsaW5rLT5jb25mLkNvbmZpZ0luZGV4KTsKKyAgICBpZiAobGluay0+Y29uZi5BdHRyaWJ1dGVzICYgQ09ORl9FTkFCTEVfSVJRKQorCSAgICBwcmludGsoIiwgaXJxICVkIiwgbGluay0+aXJxLkFzc2lnbmVkSVJRKTsKKyAgICBpZiAobGluay0+aW8uTnVtUG9ydHMxKQorCSAgICBwcmludGsoIiwgaW8gMHglMDR4LTB4JTA0eCIsIGxpbmstPmlvLkJhc2VQb3J0MSwKKwkJICAgbGluay0+aW8uQmFzZVBvcnQxK2xpbmstPmlvLk51bVBvcnRzMS0xKTsKKyAgICBwcmludGsoIlxuIik7CisgICAgCisgICAgbGluay0+c3RhdGUgJj0gfkRFVl9DT05GSUdfUEVORElORzsKKyAgICByZXR1cm47CisKK2NzX2ZhaWxlZDoKKyAgICBjc19lcnJvcihsaW5rLT5oYW5kbGUsIGxhc3RfZm4sIGxhc3RfcmV0KTsKKyAgICBtZ3NscGNfcmVsZWFzZSgodV9sb25nKWxpbmspOworfQorCisvKiBDYXJkIGhhcyBiZWVuIHJlbW92ZWQuCisgKiBVbnJlZ2lzdGVyIGRldmljZSBhbmQgcmVsZWFzZSBQQ01DSUEgY29uZmlndXJhdGlvbi4KKyAqIElmIGRldmljZSBpcyBvcGVuLCBwb3N0cG9uZSB1bnRpbCBpdCBpcyBjbG9zZWQuCisgKi8KK3N0YXRpYyB2b2lkIG1nc2xwY19yZWxlYXNlKHVfbG9uZyBhcmcpCit7CisgICAgZGV2X2xpbmtfdCAqbGluayA9IChkZXZfbGlua190ICopYXJnOworCisgICAgaWYgKGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lORk8pCisJICAgIHByaW50aygibWdzbHBjX3JlbGVhc2UoMHglcClcbiIsIGxpbmspOworCisgICAgLyogVW5saW5rIHRoZSBkZXZpY2UgY2hhaW4gKi8KKyAgICBsaW5rLT5kZXYgPSBOVUxMOworICAgIGxpbmstPnN0YXRlICY9IH5ERVZfQ09ORklHOworCisgICAgcGNtY2lhX3JlbGVhc2VfY29uZmlndXJhdGlvbihsaW5rLT5oYW5kbGUpOworICAgIGlmIChsaW5rLT5pby5OdW1Qb3J0czEpCisJICAgIHBjbWNpYV9yZWxlYXNlX2lvKGxpbmstPmhhbmRsZSwgJmxpbmstPmlvKTsKKyAgICBpZiAobGluay0+aXJxLkFzc2lnbmVkSVJRKQorCSAgICBwY21jaWFfcmVsZWFzZV9pcnEobGluay0+aGFuZGxlLCAmbGluay0+aXJxKTsKKyAgICBpZiAobGluay0+c3RhdGUgJiBERVZfU1RBTEVfTElOSykKKwkgICAgbWdzbHBjX2RldGFjaChsaW5rKTsKK30KKworc3RhdGljIHZvaWQgbWdzbHBjX2RldGFjaChkZXZfbGlua190ICpsaW5rKQoreworICAgIGRldl9saW5rX3QgKipsaW5rcDsKKworICAgIGlmIChkZWJ1Z19sZXZlbCA+PSBERUJVR19MRVZFTF9JTkZPKQorCSAgICBwcmludGsoIm1nc2xwY19kZXRhY2goMHglcClcbiIsIGxpbmspOworICAgIAorICAgIC8qIGZpbmQgZGV2aWNlICovCisgICAgZm9yIChsaW5rcCA9ICZkZXZfbGlzdDsgKmxpbmtwOyBsaW5rcCA9ICYoKmxpbmtwKS0+bmV4dCkKKwkgICAgaWYgKCpsaW5rcCA9PSBsaW5rKSBicmVhazsKKyAgICBpZiAoKmxpbmtwID09IE5VTEwpCisJICAgIHJldHVybjsKKworICAgIGlmIChsaW5rLT5zdGF0ZSAmIERFVl9DT05GSUcpIHsKKwkgICAgLyogZGV2aWNlIGlzIGNvbmZpZ3VyZWQvYWN0aXZlLCBtYXJrIGl0IHNvIHdoZW4KKwkgICAgICogcmVsZWFzZSgpIGlzIGNhbGxlZCBhIHByb3BlciBkZXRhY2goKSBvY2N1cnMuCisJICAgICAqLworCSAgICBpZiAoZGVidWdfbGV2ZWwgPj0gREVCVUdfTEVWRUxfSU5GTykKKwkJICAgIHByaW50ayhLRVJOX0RFQlVHICJzeW5jbGlua3BjOiBkZXRhY2ggc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VwdGlibGUoJmluZm8tPnN0YXR1c19ldmVudF93YWl0X3EpOworCXdha2VfdXBfaW50ZXJydXB0aWJsZSgmaW5mby0+ZXZlbnRfd2FpdF9xKTsKKwlpbmZvLT5wZW5kaW5nX2JoIHw9IEJIX1NUQVRVUzsKK30KKworLyogSW50ZXJydXB0IHNlcnZpY2Ugcm91dGluZSBlbnRyeSBwb2ludC4KKyAqIAkKKyAqIEFyZ3VtZW50czoKKyAqIAorICogaXJxICAgICBpbnRlcnJ1cHQgbnVtYmVyIHRoYXQgY2F1c2VkIGludGVycnVwdAorICogZGV2X2lkICBkZXZpY2UgSUQgc3VwcGxpZWQgZHVyaW5nIGludGVycnVwdCByZWdpc3RyYXRpb24KKyAqIHJlZ3MgICAgaW50ZXJydXB0ZWQgcHJvY2Vzc29yIGNvbnRleHQKKyAqLworc3RhdGljIGlycXJldHVybl90IG1nc2xwY19pc3IoaW50IGlycSwgdm9pZCAqZGV2X2lkLCBzdHJ1Y3QgcHRfcmVncyAqIHJlZ3MpCit7CisJTUdTTFBDX0lORk8gKiBpbmZvID0gKE1HU0xQQ19JTkZPICopZGV2X2lkOworCXVuc2lnbmVkIHNob3J0IGlzcjsKKwl1bnNpZ25lZCBjaGFyIGdpcywgcGlzOworCWludCBjb3VudD0wOworCisJaWYgKGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lTUikJCisJCXByaW50aygibWdzbHBjX2lzciglZCkgZW50cnkuXG4iLCBpcnEpOworCWlmICghaW5mbykKKwkJcmV0dXJuIElSUV9OT05FOworCQkKKwlpZiAoIShpbmZvLT5saW5rLnN0YXRlICYgREVWX0NPTkZJRykpCisJCXJldHVybiBJUlFfSEFORExFRDsKKworCXNwaW5fbG9jaygmaW5mby0+bG9jayk7CisKKwl3aGlsZSAoKGdpcyA9IHJlYWRfcmVnKGluZm8sIENIQSArIEdJUykpKSB7CisJCWlmIChkZWJ1Z19sZXZlbCA+PSBERUJVR19MRVZFTF9JU1IpCQorCQkJcHJpbnRr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GluZm8tPnBlbmRpbmdfYmggJiYgIWluZm8tPmJoX3J1bm5pbmcgJiYgIWluZm8tPmJoX3JlcXVlc3RlZCkgeworCQlpZiAoIGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lTUiApCQorCQkJcHJpbnRrKCIlcyglZCk6JXMgcXVldWVpbmcgYmggdGFzay5cbiIsCisJCQkJX19GSUxFX18sX19MSU5FX18saW5mby0+ZGV2aWNlX25hbWUpOworCQlzY2hlZHVsZV93b3JrKCZpbmZvLT50YXNrKTsKKwkJaW5mby0+YmhfcmVxdWVzdGVkID0gMTsKKwl9CisKKwlzcGluX3VubG9jaygmaW5mby0+bG9jayk7CisJCisJaWYgKGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lTUikJCisJCXByaW50aygiJXMoJWQpOm1nc2xwY19pc3IoJWQpZXhpdC5cbiIsCisJCSAgICAgICBfX0ZJTEVfXyxfX0xJTkVfXyxpcnEpOworCisJcmV0dXJuIElSUV9IQU5ETEVEOworfQorCisvKiBJbml0aWFsaXplIGFuZCBzdGFydCBkZXZpY2UuCisgKi8KK3N0YXRpYyBpbnQgc3RhcnR1cChNR1NMUENfSU5GTyAqIGluZm8pCit7CisJaW50IHJldHZhbCA9IDA7CisJCisJaWYgKGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lORk8pCisJCXByaW50aygiJXMoJWQpOnN0YXJ0dXAoJXMpXG4iLF9fRklMRV9fLF9fTElORV9fLGluZm8tPmRldmljZV9uYW1lKTsKKwkJCisJaWYgKGluZm8tPmZsYWdzICYgQVNZTkNfSU5JVElBTElaRUQpCisJCXJldHVybiAwOworCQorCWlmICghaW5mby0+dHhfYnVmKSB7CisJCS8qIGFsbG9jYXRlIGEgcGFnZSBvZiBtZW1vcnkgZm9yIGEgdHJhbnNtaXQgYnVmZmVyICovCisJCWluZm8tPnR4X2J1ZiA9ICh1bnNpZ25lZCBjaGFyICopZ2V0X3plcm9lZF9wYWdlKEdGUF9LRVJORUwpOwor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GJ1ZityZXQsICIgdHh1bmRlcjolZCIsIGluZm8tPmljb3VudC50eHVuZGVyKTsKKwkJaWYgKGluZm8tPmljb3VudC50eGFib3J0KQorCQkJcmV0ICs9IHNwcmludGYoYnVmK3JldCwgIiB0eGFib3J0OiVkIiwgaW5mby0+aWNvdW50LnR4YWJvcnQpOworCQlpZiAoaW5mby0+aWNvdW50LnJ4c2hvcnQpCisJCQlyZXQgKz0gc3ByaW50ZihidWYrcmV0LCAiIHJ4c2hvcnQ6JWQiLCBpbmZvLT5pY291bnQucnhzaG9ydCk7CQorCQlpZiAoaW5mby0+aWNvdW50LnJ4bG9uZykKKwkJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgcnhsb25nOiVkIiwgaW5mby0+aWNvdW50LnJ4bG9uZyk7CisJCWlmIChpbmZvLT5pY291bnQucnhvdmVyKQorCQkJcmV0ICs9IHNwcmludGYoYnVmK3JldCwgIiByeG92ZXI6JWQiLCBpbmZvLT5pY291bnQucnhvdmVyKTsKKwkJaWYgKGluZm8tPmljb3VudC5yeGNyYykKKwkJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgcnhjcmM6JWQiLCBpbmZvLT5pY291bnQucnhjcmMpOworCX0gZWxzZSB7CisJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgQVNZTkMgdHg6JWQgcng6JWQiLAorCQkJICAgICAgaW5mby0+aWNvdW50LnR4LCBpbmZvLT5pY291bnQucngpOworCQlpZiAoaW5mby0+aWNvdW50LmZyYW1lKQorCQkJcmV0ICs9IHNwcmludGYoYnVmK3JldCwgIiBmZTolZCIsIGluZm8tPmljb3VudC5mcmFtZSk7CisJCWlmIChpbmZvLT5pY291bnQucGFyaXR5KQorCQkJcmV0ICs9IHNwcmludGYoYnVmK3JldCwgIiBwZTolZCIsIGluZm8tPmljb3VudC5wYXJpdHkpOworCQlpZiAoaW5mby0+aWNvdW50LmJyaykKKwkJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgYn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kJaWYgKGRhdGFbaV0+PTA0MCAmJiBkYXRhW2ldPD0wMTc2KQorCQkJCXByaW50aygiJWMiLGRhdGFbaV0pOworCQkJZWxzZQorCQkJCXByaW50aygiLiIpOworCQl9CisJCXByaW50aygiXG4iKTsKKwkJCisJCWRhdGEgICs9IGxpbmVjb3VudDsKKwkJY291bnQgLT0gbGluZWNvdW50OworCX0KK30KKworLyogSERMQyBmcmFtZSB0aW1lIG91dAorICogdXBkYXRlIHN0YXRzIGFuZCBkbyB0eCBjb21wbGV0aW9uIHByb2Nlc3NpbmcKKyAqLwordm9pZCB0eF90aW1lb3V0KHVuc2lnbmVkIGxvbmcgY29udGV4dCkKK3sKKwlNR1NMUENfSU5GTyAqaW5mbyA9IChNR1NMUENfSU5GTyopY29udGV4dDsKKwl1bnNpZ25lZCBsb25nIGZsYWdzOworCQorCWlmICggZGVidWdfbGV2ZWwgPj0gREVCVUdfTEVWRUxfSU5GTyApCisJCXByaW50ayggIiVzKCVkKTp0eF90aW1lb3V0KCVzKVxuIiwKKwkJCV9fRklMRV9fLF9fTElORV9fLGluZm8tPmRldmljZV9uYW1lKTsKKwlpZihpbmZvLT50eF9hY3RpdmUgJiYKKwkgICBpbmZvLT5wYXJhbXMubW9kZSA9PSBNR1NMX01PREVfSERMQykgeworCQlpbmZvLT5pY291bnQudHh0aW1lb3V0Kys7CisJfQorCXNwaW5fbG9ja19pcnFzYXZlKCZpbmZvLT5sb2NrLGZsYWdzKTsKKwlpbmZvLT50eF9hY3RpdmUgPSAwOworCWluZm8tPnR4X2NvdW50ID0gaW5mby0+dHhfcHV0ID0gaW5mby0+dHhfZ2V0ID0gMDsKKworCXNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJmluZm8tPmxvY2ssZmxhZ3MpOworCQorI2lmZGVmIENPTkZJR19IRExDCisJaWYgKGluZm8tPm5ldGNvdW50KQorCQloZGxjZGV2X3R4X2RvbmUoaW5mbyk7CisJZWxzZQorI2VuZGlmCisJCWJoX3RyYW5zbW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V2KTsKK30KKworLyoqCisgKiBjYWxsZWQgYnkgZGV2aWNlIGRyaXZlciB3aGVuIHRyYW5zbWl0IGNvbXBsZXRlcworICogcmVlbmFibGUgbmV0d29yayBsYXllciB0cmFuc21pdCBpZiBzdG9wcGVkCisgKgorICogaW5mbyAgcG9pbnRlciB0byBkZXZpY2UgaW5zdGFuY2UgaW5mb3JtYXRpb24KKyAqLworc3RhdGljIHZvaWQgaGRsY2Rldl90eF9kb25lKE1HU0xQQ19JTkZPICppbmZvKQoreworCWlmIChuZXRpZl9xdWV1ZV9zdG9wcGVkKGluZm8tPm5ldGRldikpCisJCW5ldGlmX3dha2VfcXVldWUoaW5mby0+bmV0ZGV2KTsKK30KKworLyoqCisgKiBjYWxsZWQgYnkgZGV2aWNlIGRyaXZlciB3aGVuIGZyYW1lIHJlY2VpdmVkCisgKiBwYXNzIGZyYW1lIHRvIG5ldHdvcmsgbGF5ZXIKKyAqCisgKiBpbmZvICBwb2ludGVyIHRvIGRldmljZSBpbnN0YW5jZSBpbmZvcm1hdGlvbgorICogYnVmICAgcG9pbnRlciB0byBidWZmZXIgY29udGlhbmluZyBmcmFtZSBkYXRhCisgKiBzaXplICBjb3VudCBvZiBkYXRhIGJ5dGVzIGluIGJ1ZgorICovCitzdGF0aWMgdm9pZCBoZGxjZGV2X3J4KE1HU0xQQ19JTkZPICppbmZvLCBjaGFyICpidWYsIGludCBzaXplKQoreworCXN0cnVjdCBza19idWZmICpza2IgPSBkZXZfYWxsb2Nfc2tiKHNpemUpOworCXN0cnVjdCBuZXRfZGV2aWNlICpkZXYgPSBpbmZvLT5uZXRkZXY7CisJc3RydWN0IG5ldF9kZXZpY2Vfc3RhdHMgKnN0YXRzID0gaGRsY19zdGF0cyhkZXYpOworCisJaWYgKGRlYnVnX2xldmVsID49IERFQlVHX0xFVkVMX0lORk8pCisJCXByaW50aygiaGRsY2Rldl9yeCglcylcbiIsZGV2LT5uYW1lKTsKKworCWlmIChza2IgPT0gTlVMTCkgeworCQl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sZV9tb3VzZV9ldmVudChrYmRieXRlc1syXSk7CisJCWhhbmRsZV9tb3VzZV9ldmVudChrYmRieXRlc1szXSk7CisJfQorCWVsc2UgeworCQlpZiAoa2JkYnl0ZXNbMl0gPT0gMCkgZG93biA9IDE7CisjaWYgMAorCQlpZiAoZG93bikKKwkJCXByaW50aygiZG93biAlZFxuIiwga2JkYnl0ZXNbM10pOworCQllbHNlCisJCQlwcmludGsoInVwICVkXG4iLCBrYmRieXRlc1szXSk7CisjZW5kaWYKKwkJaGFuZGxlX2tleWJvYXJkX2V2ZW50KGtiZGJ5dGVzWzNdLCBkb3duKTsKKwl9CisJcmV0dXJuIDA7Cit9CisKKworREVGSU5FX1NQSU5MT0NLKGtiZF9jb250cm9sbGVyX2xvY2spOworc3RhdGljIHVuc2lnbmVkIGNoYXIgaGFuZGxlX2tiZF9ldmVudCh2b2lkKTsKKworCitpbnQga2JkX3NldGtleWNvZGUodW5zaWduZWQgaW50IHNjYW5jb2RlLCB1bnNpZ25lZCBpbnQga2V5Y29kZSkKK3sKKwlwcmludGsoImtiZF9zZXRrZXljb2RlIHNjYW5jb2RlICV4IGtleWNvZGUgJXhcbiIsIHNjYW5jb2RlLCBrZXljb2RlKTsKKwlyZXR1cm4gMDsKK30KKworaW50IGtiZF9nZXRrZXljb2RlKHVuc2lnbmVkIGludCBzY2FuY29kZSkKK3sKKwlyZXR1cm4gc2NhbmNvZGU7Cit9CisKKworaW50IGtiZF90cmFuc2xhdGUodW5zaWduZWQgY2hhciBzY2FuY29kZSwgdW5zaWduZWQgY2hhciAqa2V5Y29kZSwKKwkJICAgIGNoYXIgcmF3X21vZGUpCit7CisJc3RhdGljIGludCBwcmV2X3NjYW5jb2RlID0gMDsKKworCWlmIChzY2FuY29kZSA9PSAweDAwIHx8IHNjYW5jb2RlID09IDB4ZmYpIHsKKwkJcHJldl9zY2FuY29kZSA9IDA7CisJCXJldHVybiAwOworCX0KKworCS8qIHRvZG8gKi8KKwlpZiAoIXByZXZfc2N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3MsIGJ1dCB0aGV5IHdobyBkbworICogb2Z0ZW4gd2FudCBxdWl0ZSBhIGxvdCBvZiBzdHJpbmcgc3BhY2UuIFNvLCB3ZSBzdGF0aWNhbGx5IGFsbG9jYXRlCisgKiB0aGUgZGVmYXVsdCBhbmQgYWxsb2NhdGUgZHluYW1pY2FsbHkgaW4gY2h1bmtzIG9mIDUxMiBieXRlcy4KKyAqLworCitjaGFyIGZ1bmNfYnVmW10gPSB7CisJJ1wwMzMnLCAnWycsICdbJywgJ0EnLCAwLCAKKwknXDAzMycsICdbJywgJ1snLCAnQicsIDAsIAorCSdcMDMzJywgJ1snLCAnWycsICdDJywgMCwgCisJJ1wwMzMnLCAnWycsICdbJywgJ0QnLCAwLCAKKwknXDAzMycsICdbJywgJ1snLCAnRScsIDAsIAorCSdcMDMzJywgJ1snLCAnMScsICc3JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzEnLCAnOCcsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcxJywgJzknLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMicsICcwJywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzInLCAnMScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcyJywgJzMnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMicsICc0JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzInLCAnNScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcyJywgJzYnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMicsICc4JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzInLCAnOScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICczJywgJzEnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMycsICcyJywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzMnLCAnMycsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICczJywgJzQnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnMScsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICcyJywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzMnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnNCcsICd+JywgMCwgCisJJ1wwMzMnLCAnWycsICc1JywgJ34nLCAwLCAKKwknXDAzMycsICdbJywgJzYnLCAnficsIDAsIAorCSdcMDMzJywgJ1snLCAnTScsIDAsIAorCSdcMDMzJywgJ1snLCAnUCcsIDAsIAorfTsKKworCitjaGFyICpmdW5jYnVmcHRyID0gZnVuY19idWY7CitpbnQgZnVuY2J1ZnNpemUgPSBzaXplb2YoZnVuY19idWYpOworaW50IGZ1bmNidWZsZWZ0ID0gMDsgICAgICAgICAgLyogc3BhY2UgbGVmdCAqLworCitjaGFyICpmdW5jX3RhYmxlW01BWF9OUl9GVU5DXSA9IHsKKwlmdW5jX2J1ZiArIDAsCisJZnVuY19idWYgKyA1LAorCWZ1bmNfYnVmICsgMTAsCisJZnVuY19idWYgKyAxNSwKKwlmdW5jX2J1ZiArIDIwLAorCWZ1bmNfYnVmICsgMjUsCisJZnVuY19idWYgKyAzMSwKKwlmdW5jX2J1ZiArIDM3LAorCWZ1bmNfYnVmICsgNDMsCisJZnVuY19idWYgKyA0OSwKKwlmdW5jX2J1ZiArIDU1LAorCWZ1bmNfYnVmICsgNjEsCisJZnVuY19idWYgKyA2NywKKwlmdW5jX2J1ZiArIDczLAorCWZ1bmNfYnVmICsgNzksCisJZnVuY19idWYgKyA4NSwKKwlmdW5jX2J1ZiArIDkxLAorCWZ1bmNfYnVmICsgOTcsCisJZnVuY19idWYgKyAxMDMsCisJZnVuY19idWYgKyAxMDksCisJZnVuY19idWYgKyAxMTUsCisJZnVuY19idWYgKyAxMjAsCisJZnVuY19idWYgKyAxMjUsCisJZnVuY19idWYgKyAxMzAsCisJZnVuY19idWYgKyAxMzUsCisJZnVuY19idWYgKyAxNDAsCisJZnVuY19idWYgKyAxNDUsCisJMCwKKwkwLAorCWZ1bmNfYnVm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IHlvdSB3YW50IHRoZSBlbnRyaWVzCisjCWFsdGdyICAgY29udHJvbCBrZXljb2RlICA4MyA9IEJvb3QgICAgICAgICAgICAKKyMJYWx0Z3IgICBjb250cm9sIGtleWNvZGUgMTExID0gQm9vdCAgICAgICAgICAgIAorIyBiZWxvdy4KKyMKKyMgSW4gZmFjdCBBbHRHciBpcyB1c2VkIHZlcnkgbGl0dGxlLCBhbmQgb25lIG1vcmUga2V5bWFwIGNhbgorIyBiZSBzYXZlZCBieSBtYXBwaW5nIEFsdEdyIHRvIEFsdCAoYW5kIGFkYXB0aW5nIGEgZmV3IGVudHJpZXMpOgorIyBrZXljb2RlIDEwMCA9IEFsdAorIwora2V5Y29kZSAgIDEgPSBncmF2ZSAgICAgICAgYXNjaWl0aWxkZQorCWFsdCAgICAga2V5Y29kZSAgIDEgPSBNZXRhX0VzY2FwZSAgICAgCitrZXljb2RlICAgMiA9IG9uZSAgICAgICAgICAgICAgZXhjbGFtICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgIDIgPSBNZXRhX29uZSAgICAgICAgCitrZXljb2RlICAgMyA9IHR3byAgICAgICAgICAgICAgYXQgICAgICAgICAgICAgICBhdCAgICAgICAgICAgICAgCisJY29udHJvbAlrZXljb2RlICAgMyA9IG51bCAgICAgICAgICAgICAKKwlzaGlmdAljb250cm9sCWtleWNvZGUgICAzID0gbnVsICAgICAgICAgICAgIAorCWFsdAlrZXljb2RlICAgMyA9IE1ldGFfdHdvICAgICAgICAKK2tleWNvZGUgICA0ID0gdGhyZWUgICAgICAgICAgICBudW1iZXJzaWduICAgICAgCisJY29udHJvbCBrZXljb2RlICAgNCA9IEVzY2FwZSAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgICA0ID0gTWV0YV90aHJlZSAgICAgIAora2V5Y29kZSAgIDUgPSBmb3VyICAgICAgICAgICAgIGRvbGxhciAgICAgICAgICAgZG9sbGFyICAgICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgIDUgPSBDb250cm9sX2JhY2tzbGFzaAorCWFsdCAgICAga2V5Y29kZSAgIDUgPSBNZXRhX2ZvdXIgICAgICAgCitrZXljb2RlICAgNiA9IGZpdmUgICAgICAgICAgICAgcGVyY2VudCAgICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgIDYgPSBDb250cm9sX2JyYWNrZXRyaWdodAorCWFsdCAgICAga2V5Y29kZSAgIDYgPSBNZXRhX2ZpdmUgICAgICAgCitrZXljb2RlICAgNyA9IHNpeCAgICAgICAgICAgICAgYXNjaWljaXJjdW0gICAgIAorCWNvbnRyb2wga2V5Y29kZSAgIDcgPSBDb250cm9sX2FzY2lpY2lyY3VtCisJYWx0ICAgICBrZXljb2RlICAgNyA9IE1ldGFfc2l4ICAgICAgICAKK2tleWNvZGUgICA4ID0gc2V2ZW4gICAgICAgICAgICBhbXBlcnNhbmQgICAgICAgIGJyYWNlbGVmdCAgICAgICAKKwljb250cm9sIGtleWNvZGUgICA4ID0gQ29udHJvbF91bmRlcnNjb3JlCisJYWx0ICAgICBrZXljb2RlICAgOCA9IE1ldGFfc2V2ZW4gICAgICAKK2tleWNvZGUgICA5ID0gZWlnaHQgICAgICAgICAgICBhc3RlcmlzayAgICAgICAgIGJyYWNrZXRsZWZ0ICAgICAKKwljb250cm9sIGtleWNvZGUgICA5ID0gRGVsZXRlICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgIDkgPSBNZXRhX2VpZ2h0ICAgICAgCitrZXljb2RlICAxMCA9IG5pbmUgICAgICAgICAgICAgcGFyZW5sZWZ0ICAgICAgICBicmFja2V0cmlnaHQgICAgCisJYWx0ICAgICBrZXljb2RlICAxMCA9IE1ldGFfbmluZSAgICAgICAKK2tleWNvZGUgIDExID0gemVybyAgICAgICAgICAgICBwYXJlbnJpZ2h0ICAgICAgIGJyYWNlcmlnaHQgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDExID0gTWV0YV96ZXJvICAgICAgIAora2V5Y29kZSAgMTIgPSBtaW51cyAgICAgICAgICAgIHVuZGVyc2NvcmUgICAgICAgYmFja3NsYXNoICAgICAgIAorCWNvbnRyb2wJa2V5Y29kZSAgMTIgPSBDb250cm9sX3VuZGVyc2NvcmUKKwlzaGlmdAljb250cm9sCWtleWNvZGUgIDEyID0gQ29udHJvbF91bmRlcnNjb3JlCisJYWx0CWtleWNvZGUgIDEyID0gTWV0YV9taW51cyAgICAgIAora2V5Y29kZSAgMTMgPSBlcXVhbCAgICAgICAgICAgIHBsdXMgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDEzID0gTWV0YV9lcXVhbCAgICAgIAora2V5Y29kZSAgMTUgPSBEZWxldGUgICAgICAgICAgIERlbGV0ZSAgICAgICAgICAKKwljb250cm9sIGtleWNvZGUgIDE1ID0gQmFja1NwYWNlCisJYWx0ICAgICBrZXljb2RlICAxNSA9IE1ldGFfRGVsZXRlICAgICAKK2tleWNvZGUgIDE2ID0gVGFiICAgICAgICAgICAgICBUYWIgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAxNiA9IE1ldGFfVGFiICAgICAgICAKK2tleWNvZGUgIDE3ID0gcSAgICAgICAgICAgICAgIAora2V5Y29kZSAgMTggPSB3ICAgICAgICAgICAgICAgCitrZXljb2RlICAxOSA9IGUKK2tleWNvZGUgIDIwID0gciAgICAgICAgICAgICAgIAora2V5Y29kZSAgMjEgPSB0ICAgICAgICAgICAgICAgCitrZXljb2RlICAyMiA9IHkgICAgICAgICAgICAgICAKK2tleWNvZGUgIDIzID0gdQkgCitrZXljb2RlICAyNCA9IGkgICAgICAgICAgICAgICAKK2tleWNvZGUgIDI1ID0gbyAgICAgICAgICAgICAgIAora2V5Y29kZSAgMjYgPSBwICAgICAgICAgICAgICAgCitrZXljb2RlICAyNyA9IGJyYWNrZXRsZWZ0ICAgICAgYnJhY2VsZWZ0ICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMjcgPSBFc2NhcGUgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAyNyA9IE1ldGFfYnJhY2tldGxlZnQKK2tleWNvZGUgIDI4ID0gYnJhY2tldHJpZ2h0ICAgICBicmFjZXJpZ2h0CisJY29udHJvbCBrZXljb2RlICAyOCA9IENvbnRyb2xfYnJhY2tldHJpZ2h0CisJYWx0ICAgICBrZXljb2RlICAyOCA9IE1ldGFfYnJhY2tldHJpZ2h0CitrZXljb2RlICAyOSA9IGJhY2tzbGFzaCAgICAgICAgYmFyICAgICAgICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMjkgPSBDb250cm9sX2JhY2tzbGFzaAorCWFsdCAgICAga2V5Y29kZSAgMjkgPSBNZXRhX2JhY2tzbGFzaCAgCitrZXljb2RlICAzMCA9IENhcHNfTG9jawora2V5Y29kZSAgMzEgPSBhICAgICAgICAgICAgICAgCitrZXljb2RlICAzMiA9IHMKK2tleWNvZGUgIDMzID0gZAora2V5Y29kZSAgMzQgPSBmICAgICAgICAgICAgICAgCitrZXljb2RlICAzNSA9IGcgICAgICAgICAgICAgICAKK2tleWNvZGUgIDM2ID0gaCAgICAgICAgICAgICAgIAora2V5Y29kZSAgMzcgPSBqICAgICAgICAgICAgICAgCitrZXljb2RlICAzOCA9IGsgICAgICAgICAgICAgICAKK2tleWNvZGUgIDM5ID0gbCAgICAgICAgICAgICAgIAora2V5Y29kZSAgNDAgPSBzZW1pY29sb24gICAgICAgIGNvbG9uICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDM5ID0gTWV0YV9zZW1pY29sb24gIAora2V5Y29kZSAgNDEgPSBhcG9zdHJvcGhlICAgICAgIHF1b3RlZGJsICAgICAgICAKKwljb250cm9sIGtleWNvZGUgIDQwID0gQ29udHJvbF9nICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNDAgPSBNZXRhX2Fwb3N0cm9waGUgCitrZXljb2RlICA0MiA9IGdyYXZlICAgICAgICAgICAgYXNjaWl0aWxkZSAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgNDEgPSBudWwgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA0MSA9IE1ldGFfZ3JhdmUgICAgICAKK2tleWNvZGUgIDQzID0gUmV0dXJuICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNDMgPSBNZXRhX0NvbnRyb2xfbSAgCitrZXljb2RlICA0NCA9IFNoaWZ0ICAgICAgICAgICAgICAgCitrZXljb2RlICA0NiA9IHoKK2tleWNvZGUgIDQ3ID0geCAgICAgICAgICAgICAgIAora2V5Y29kZSAgNDggPSBjCitrZXljb2RlICA0OSA9IHYgICAgICAgICAgICAgICAKK2tleWNvZGUgIDUwID0gYiAgICAgICAgICAgICAgIAora2V5Y29kZSAgNTEgPSBuCitrZXljb2RlICA1MiA9IG0KK2tleWNvZGUgIDUzID0gY29tbWEgICAgICAgICAgICBsZXNzICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA1MSA9IE1ldGFfY29tbWEgICAgICAKK2tleWNvZGUgIDU0ID0gcGVyaW9kICAgICAgICAgICBncmVhdGVyICAgICAgICAgCisJY29udHJvbCBrZXljb2RlICA1MiA9IENvbXBvc2UgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDUyID0gTWV0YV9wZXJpb2QgICAgIAora2V5Y29kZSAgNTUgPSBzbGFzaCAgICAgICAgICAgIHF1ZXN0aW9uICAgICAgICAKKwljb250cm9sIGtleWNvZGUgIDUzID0gRGVsZXRlICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgNTMgPSBNZXRhX3NsYXNoICAgICAgCitrZXljb2RlICA1NyA9IFNoaWZ0CitrZXljb2RlICA1OCA9IENvbnRyb2wKK2tleWNvZGUgIDYwID0gQWx0CitrZXljb2RlICA2MSA9IHNwYWNlICAgICAgICAgICAgc3BhY2UgICAgICAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgNjEgPSBudWwgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICA2MSA9IE1ldGFfc3BhY2UgICAgICAKK2tleWNvZGUgIDYyID0gQWx0CisKK2tleWNvZGUgNzUgPSBJbnNlcnQgICAgICAgICAgCitrZXljb2RlIDc2ID0gRGVsZXRlICAgICAgICAgIAorCitrZXljb2RlIDgzID0gVXAgICAgICAgICAgICAgIAora2V5Y29kZSA4NCA9IERvd24gICAgICAgICAgICAgIAorCitrZXljb2RlIDg1ID0gUHJpb3IgICAgICAgICAgIAorCXNoaWZ0ICAga2V5Y29kZSA4NSA9IFNjcm9sbF9CYWNrd2FyZCAKK2tleWNvZGUgODYgPSBOZXh0ICAgICAgICAgICAgCisJc2hpZnQgICBrZXljb2RlIDg2ID0gU2Nyb2xsX0ZvcndhcmQgIAora2V5Y29kZSA4OSA9IFJpZ2h0ICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgODkgPSBJbmNyX0NvbnNvbGUKK2tleWNvZGUgNzkgPSBMZWZ0ICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlIDc5ID0gRGVjcl9Db25zb2xlCisKK2tleWNvZGUgIDkwID0gTnVtX0xvY2sKKwlzaGlmdCAgIGtleWNvZGUgIDkwID0gQmFyZV9OdW1fTG9jaworCitrZXljb2RlIDkxID0gbWludXMKK2tleWNvZGUgOTIgPSBwbHVzCitrZXljb2RlIDkzID0gS1BfTXVsdGlwbHkKK2tleWNvZGUgOTQgPSBwZXJpb2QKK2tleWNvZGUgOTUgPSBLUF9EaXZpZGUKKwora2V5Y29kZSAxMDcgPSBTZWxlY3QgICAgICAgICAgCitrZXljb2RlIDEwOCA9IERvd24gICAgICAgICAgICAKKwora2V5Y29kZSAxMTAgPSBFc2NhcGUgICAgICAgICAgIEVzY2FwZSAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgICAxID0gTWV0YV9Fc2NhcGUgICAgIAorCitrZXljb2RlICAxMTIgPSBGMSAgICAgICAgICAgICAgRjExICAgICAgICAgICAgICBDb25zb2xlXzEzICAgICAgCisJY29udHJvbCBrZXljb2RlICAxMTIgPSBGMSAgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAxMTIgPSBDb25zb2xlXzEgICAgICAgCisJY29udHJvbCBhbHQgICAgIGtleWNvZGUgIDExMiA9IENvbnNvbGVfMSAgICAgICAKK2tleWNvZGUgIDExMyA9IEYyICAgICAgICAgICAgICBGMTIgICAgICAgICAgICAgIENvbnNvbGVfMTQgICAgICAKKwljb250cm9sIGtleWNvZGUgIDExMyA9IEYyICAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDExMyA9IENvbnNvbGVfMiAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgMTEzID0gQ29uc29sZV8yICAgICAgIAora2V5Y29kZSAgMTE0ID0gRjMgICAgICAgICAgICAgIEYxMyAgICAgICAgICAgICAgQ29uc29sZV8xNSAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMTE0ID0gRjMgICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgMTE0ID0gQ29uc29sZV8zICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICAxMTQgPSBDb25zb2xlXzMgICAgICAgCitrZXljb2RlICAxMTUgPSBGNCAgICAgICAgICAgICAgRjE0ICAgICAgICAgICAgICBDb25zb2xlXzE2ICAgICAgCisJY29udHJvbCBrZXljb2RlICAxMTUgPSBGNCAgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAxMTUgPSBDb25zb2xlXzQgICAgICAgCisJY29udHJvbCBhbHQgICAgIGtleWNvZGUgIDExNSA9IENvbnNvbGVfNCAgICAgICAKK2tleWNvZGUgIDExNiA9IEY1ICAgICAgICAgICAgICBGMTUgICAgICAgICAgICAgIENvbnNvbGVfMTcgICAgICAKKwljb250cm9sIGtleWNvZGUgIDExNiA9IEY1ICAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDExNiA9IENvbnNvbGVfNSAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgMTE2ID0gQ29uc29sZV81ICAgICAgIAora2V5Y29kZSAgMTE3ID0gRjYgICAgICAgICAgICAgIEYxNiAgICAgICAgICAgICAgQ29uc29sZV8xOCAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMTE3ID0gRjYgICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgMTE3ID0gQ29uc29sZV82ICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICAxMTcgPSBDb25zb2xlXzYgICAgICAgCitrZXljb2RlICAxMTggPSBGNyAgICAgICAgICAgICAgRjE3ICAgICAgICAgICAgICBDb25zb2xlXzE5ICAgICAgCisJY29udHJvbCBrZXljb2RlICAxMTggPSBGNyAgICAgICAgICAgICAgCisJYWx0ICAgICBrZXljb2RlICAxMTggPSBDb25zb2xlXzcgICAgICAgCisJY29udHJvbCBhbHQgICAgIGtleWNvZGUgIDExOCA9IENvbnNvbGVfNyAgICAgICAKK2tleWNvZGUgIDExOSA9IEY4ICAgICAgICAgICAgICBGMTggICAgICAgICAgICAgIENvbnNvbGVfMjAgICAgICAKKwljb250cm9sIGtleWNvZGUgIDExOSA9IEY4ICAgICAgICAgICAgICAKKwlhbHQgICAgIGtleWNvZGUgIDExOSA9IENvbnNvbGVfOCAgICAgICAKKwljb250cm9sIGFsdCAgICAga2V5Y29kZSAgMTE5ID0gQ29uc29sZV84ICAgICAgIAora2V5Y29kZSAgMTIwID0gRjkgICAgICAgICAgICAgIEYxOSAgICAgICAgICAgICAgQ29uc29sZV8yMSAgICAgIAorCWNvbnRyb2wga2V5Y29kZSAgMTIwID0gRjkgICAgICAgICAgICAgIAorCWFsdCAgICAga2V5Y29kZSAgMTIwID0gQ29uc29sZV85ICAgICAgIAorCWNvbnRyb2wgYWx0ICAgICBrZXljb2RlICAxMjAgPSBDb25zb2xlXzkgICAgICAgCitrZXljb2RlICAxMjEgPSBGMTAgICAgICAgICAgICAgRjIwICAgICAgICAgICAgICBDb25zb2xlXzIyICAgICAgCisJY29udHJv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WFjcm8gPSAiXDAzM1tNIgorc3RyaW5nIFBhdXNlID0gIlwwMzNbUCIKK2NvbXBvc2UgJ2AnICdBJyB0byAnwCcKK2NvbXBvc2UgJ2AnICdhJyB0byAn4CcKK2NvbXBvc2UgJ1wnJyAnQScgdG8gJ8EnCitjb21wb3NlICdcJycgJ2EnIHRvICfhJworY29tcG9zZSAnXicgJ0EnIHRvICfCJworY29tcG9zZSAnXicgJ2EnIHRvICfiJworY29tcG9zZSAnficgJ0EnIHRvICfDJworY29tcG9zZSAnficgJ2EnIHRvICfjJworY29tcG9zZSAnIicgJ0EnIHRvICfEJworY29tcG9zZSAnIicgJ2EnIHRvICfkJworY29tcG9zZSAnTycgJ0EnIHRvICfFJworY29tcG9zZSAnbycgJ2EnIHRvICflJworY29tcG9zZSAnMCcgJ0EnIHRvICfFJworY29tcG9zZSAnMCcgJ2EnIHRvICflJworY29tcG9zZSAnQScgJ0EnIHRvICfFJworY29tcG9zZSAnYScgJ2EnIHRvICflJworY29tcG9zZSAnQScgJ0UnIHRvICfGJworY29tcG9zZSAnYScgJ2UnIHRvICfmJworY29tcG9zZSAnLCcgJ0MnIHRvICfHJworY29tcG9zZSAnLCcgJ2MnIHRvICfnJworY29tcG9zZSAnYCcgJ0UnIHRvICfIJworY29tcG9zZSAnYCcgJ2UnIHRvICfoJworY29tcG9zZSAnXCcnICdFJyB0byAnyScKK2NvbXBvc2UgJ1wnJyAnZScgdG8gJ+knCitjb21wb3NlICdeJyAnRScgdG8gJ8onCitjb21wb3NlICdeJyAnZScgdG8gJ+onCitjb21wb3NlICciJyAnRScgdG8gJ8snCitjb21wb3NlICciJyAnZScgdG8gJ+snCitjb21wb3NlICdgJyAnSScgdG8gJ8wnCitjb21wb3NlICdgJyAnaScgdG8gJ+wnCitjb21wb3NlICdcJycgJ0knIHRvICfNJworY29tcG9zZSAnXCcnICdpJyB0byAn7ScKK2NvbXBvc2UgJ14nICdJJyB0byAnzicKK2NvbXBvc2UgJ14nICdpJyB0byAn7icKK2NvbXBvc2UgJyInICdJJyB0byAnzycKK2NvbXBvc2UgJyInICdpJyB0byAn7ycKK2NvbXBvc2UgJy0nICdEJyB0byAn0CcKK2NvbXBvc2UgJy0nICdkJyB0byAn8CcKK2NvbXBvc2UgJ34nICdOJyB0byAn0ScKK2NvbXBvc2UgJ34nICduJyB0byAn8ScKK2NvbXBvc2UgJ2AnICdPJyB0byAn0icKK2NvbXBvc2UgJ2AnICdvJyB0byAn8icKK2NvbXBvc2UgJ1wnJyAnTycgdG8gJ9MnCitjb21wb3NlICdcJycgJ28nIHRvICfzJworY29tcG9zZSAnXicgJ08nIHRvICfUJworY29tcG9zZSAnXicgJ28nIHRvICf0JworY29tcG9zZSAnficgJ08nIHRvICfVJworY29tcG9zZSAnficgJ28nIHRvICf1JworY29tcG9zZSAnIicgJ08nIHRvICfWJworY29tcG9zZSAnIicgJ28nIHRvICf2JworY29tcG9zZSAnLycgJ08nIHRvICfYJworY29tcG9zZSAnLycgJ28nIHRvICf4JworY29tcG9zZSAnYCcgJ1UnIHRvICfZJworY29tcG9zZSAnYCcgJ3UnIHRvICf5JworY29tcG9zZSAnXCcnICdVJyB0byAn2icKK2NvbXBvc2UgJ1wnJyAndScgdG8gJ/onCitjb21wb3NlICdeJyAnVScgdG8gJ9snCitjb21wb3NlICdeJyAndScgdG8gJ/snCitjb21wb3NlICciJyAnVScgdG8gJ9wnCitjb21wb3NlICciJyAndScgdG8gJ/wnCitjb21wb3NlICdcJycgJ1knIHRvICfdJworY29tcG9zZSAnXCcnICd5JyB0byAn/ScKK2NvbXBvc2UgJ1QnICdIJyB0byAn3icKK2NvbXBvc2UgJ3QnICdoJyB0byAn/icKK2NvbXBvc2UgJ3MnICdzJyB0byAn3ycKK2NvbXBvc2UgJyInICd5JyB0byAn/ycKK2NvbXBvc2UgJ3MnICd6JyB0byAn3ycKK2NvbXBvc2UgJ2knICdqJyB0byAn/ycKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yYW5kb20uY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zdGF0aWMgREVDTEFSRV9XQUlUX1FVRVVFX0hFQUQocmFuZG9tX3dyaXRlX3dhaXQpOworCisjaWYgMAorc3RhdGljIGludCBkZWJ1ZyA9IDA7Cittb2R1bGVfcGFyYW0oZGVidWcsIGJvb2wsIDA2NDQpOworI2RlZmluZSBERUJVR19FTlQoZm10LCBhcmcuLi4pIGRvIHsgaWYgKGRlYnVnKSBcCisJcHJpbnRrKEtFUk5fREVCVUcgInJhbmRvbSAlMDRkICUwNGQgJTA0ZDogIiBcCisJZm10LFwKKwlpbnB1dF9wb29sLmVudHJvcHlfY291bnQsXAorCWJsb2NraW5nX3Bvb2wuZW50cm9weV9jb3VudCxcCisJbm9uYmxvY2tpbmdfcG9vbC5lbnRyb3B5X2NvdW50LFwKKwkjIyBhcmcpOyB9IHdoaWxlICgwKQorI2Vsc2UKKyNkZWZpbmUgREVCVUdfRU5UKGZtdCwgYXJnLi4uKSBkbyB7fSB3aGlsZSAoMCkKKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoKKyAqIE9TIGluZGVwZW5kZW50IGVudHJvcHkgc3RvcmUuICAgSGVyZSBhcmUgdGhlIGZ1bmN0aW9ucyB3aGljaCBoYW5kbGUKKyAqIHN0b3JpbmcgZW50cm9weSBpbiBhbiBlbnRyb3B5IHBvb2wuCisgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0cnVjdCBlbnRyb3B5X3N0b3JlOworc3RydWN0IGVudHJvcHlfc3RvcmUgeworCS8qIG1vc3RseS1yZWFkIGRhdGE6ICovCisJc3RydWN0IHBvb2xpbmZvICpwb29saW5mbzsKKwlfX3UzMiAqcG9vbDsKKwljb25zdCBjaGFyICpuYW1lOworCWludCBsaW1pdDsKKwlzdHJ1Y3QgZW50cm9weV9zdG9yZSAqcHVs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b3JkcywgTlVMTCk7Cit9CisKKy8qCisgKiBDcmVkaXQgKG9yIGRlYml0KSB0aGUgZW50cm9weSBzdG9yZSB3aXRoIG4gYml0cyBvZiBlbnRyb3B5CisgKi8KK3N0YXRpYyB2b2lkIGNyZWRpdF9lbnRyb3B5X3N0b3JlKHN0cnVjdCBlbnRyb3B5X3N0b3JlICpyLCBpbnQgbmJpdHMpCit7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworCXNwaW5fbG9ja19pcnFzYXZlKCZyLT5sb2NrLCBmbGFncyk7CisKKwlpZiAoci0+ZW50cm9weV9jb3VudCArIG5iaXRzIDwgMCkgeworCQlERUJVR19FTlQoIm5lZ2F0aXZlIGVudHJvcHkvb3ZlcmZsb3cgKCVkKyVkKVxuIiwKKwkJCSAgci0+ZW50cm9weV9jb3VudCwgbmJpdHMpOworCQlyLT5lbnRyb3B5X2NvdW50ID0gMDsKKwl9IGVsc2UgaWYgKHItPmVudHJvcHlfY291bnQgKyBuYml0cyA+IHItPnBvb2xpbmZvLT5QT09MQklUUykgeworCQlyLT5lbnRyb3B5X2NvdW50ID0gci0+cG9vbGluZm8tPlBPT0xCSVRTOworCX0gZWxzZSB7CisJCXItPmVudHJvcHlfY291bnQgKz0gbmJpdHM7CisJCWlmIChuYml0cykKKwkJCURFQlVHX0VOVCgiYWRkZWQgJWQgZW50cm9weSBjcmVkaXRzIHRvICVzXG4iLAorCQkJCSAgbmJpdHMsIHItPm5hbWUpOworCX0KKworCXNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJnItPmxvY2ssIGZsYWdzKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoKKyAqIEVudHJvcHkgaW5wdXQgbWFuYWdlbWVudAorICoKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIFRoZXJ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RfdmFsdWUpCisJCXJldHVybjsKKworCURFQlVHX0VOVCgiaW5wdXQgZXZlbnRcbiIpOworCWxhc3RfdmFsdWUgPSB2YWx1ZTsKKwlhZGRfdGltZXJfcmFuZG9tbmVzcygmaW5wdXRfdGltZXJfc3RhdGUsCisJCQkgICAgICh0eXBlIDw8IDQpIF4gY29kZSBeIChjb2RlID4+IDQpIF4gdmFsdWUpOworfQorCit2b2lkIGFkZF9pbnRlcnJ1cHRfcmFuZG9tbmVzcyhpbnQgaXJxKQoreworCWlmIChpcnEgPj0gTlJfSVJRUyB8fCBpcnFfdGltZXJfc3RhdGVbaXJxXSA9PSAwKQorCQlyZXR1cm47CisKKwlERUJVR19FTlQoImlycSBldmVudCAlZFxuIiwgaXJxKTsKKwlhZGRfdGltZXJfcmFuZG9tbmVzcyhpcnFfdGltZXJfc3RhdGVbaXJxXSwgMHgxMDAgKyBpcnEpOworfQorCit2b2lkIGFkZF9kaXNrX3JhbmRvbW5lc3Moc3RydWN0IGdlbmRpc2sgKmRpc2spCit7CisJaWYgKCFkaXNrIHx8ICFkaXNrLT5yYW5kb20pCisJCXJldHVybjsKKwkvKiBmaXJzdCBtYWpvciBpcyAxLCBzbyB3ZSBnZXQgPj0gMHgyMDAgaGVyZSAqLworCURFQlVHX0VOVCgiZGlzayBldmVudCAlZDolZFxuIiwgZGlzay0+bWFqb3IsIGRpc2stPmZpcnN0X21pbm9yKTsKKworCWFkZF90aW1lcl9yYW5kb21uZXNzKGRpc2stPnJhbmRvbSwKKwkJCSAgICAgMHgxMDAgKyBNS0RFVihkaXNrLT5tYWpvciwgZGlzay0+Zmlyc3RfbWlub3IpKTsKK30KKworRVhQT1JUX1NZTUJPTChhZGRfZGlza19yYW5kb21uZXNzKTsKKworI2RlZmluZSBFWFRSQUNUX1NJWkUgMTAKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoKKyAqIEVudHJvcHkgZ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pdCwgd2FpdCk7CisJbWFzayA9IDA7CisJaWYgKGlucHV0X3Bvb2wuZW50cm9weV9jb3VudCA+PSByYW5kb21fcmVhZF93YWtldXBfdGhyZXNoKQorCQltYXNrIHw9IFBPTExJTiB8IFBPTExSRE5PUk07CisJaWYgKGlucHV0X3Bvb2wuZW50cm9weV9jb3VudCA8IHJhbmRvbV93cml0ZV93YWtldXBfdGhyZXNoKQorCQltYXNrIHw9IFBPTExPVVQgfCBQT0xMV1JOT1JNOworCXJldHVybiBtYXNrOworfQorCitzdGF0aWMgc3NpemVfdAorcmFuZG9tX3dyaXRlKHN0cnVjdCBmaWxlICogZmlsZSwgY29uc3QgY2hhciBfX3VzZXIgKiBidWZmZXIsCisJICAgICBzaXplX3QgY291bnQsIGxvZmZfdCAqcHBvcykKK3sKKwlpbnQgcmV0ID0gMDsKKwlzaXplX3QgYnl0ZXM7CisJX191MzIgYnVmWzE2XTsKKwljb25zdCBjaGFyIF9fdXNlciAqcCA9IGJ1ZmZlcjsKKwlzaXplX3QgYyA9IGNvdW50OworCisJd2hpbGUgKGMgPiAwKSB7CisJCWJ5dGVzID0gbWluKGMsIHNpemVvZihidWYpKTsKKworCQlieXRlcyAtPSBjb3B5X2Zyb21fdXNlcigmYnVmLCBwLCBieXRlcyk7CisJCWlmICghYnl0ZXMpIHsKKwkJCXJldCA9IC1FRkFVTFQ7CisJCQlicmVhazsKKwkJfQorCQljIC09IGJ5dGVzOworCQlwICs9IGJ5dGVzOworCisJCWFkZF9lbnRyb3B5X3dvcmRzKCZpbnB1dF9wb29sLCBidWYsIChieXRlcyArIDMpIC8gNCk7CisJfQorCWlmIChwID09IGJ1ZmZlcikgeworCQlyZXR1cm4gKHNzaXplX3QpcmV0OworCX0gZWxzZSB7CisJCXN0cnVjdCBpbm9kZSAqaW5vZGUgPSBmaWxlLT5mX2RlbnRyeS0+ZF9pbm9kZTsKKwkgICAgICAgIGlub2RlLT5pX210aW1lID0gY3VycmVudF9mc190aW1lKGlub2RlLT5pX3NiKTsKKwkJbWFya19pbm9kZV9kaXJ0eShpbm9kZSk7CisJCXJldHVybiAoc3NpemVfdCkocCAtIGJ1ZmZlcik7CisJfQorfQorCitzdGF0aWMgaW50CityYW5kb21faW9jdGwoc3RydWN0IGlub2RlICogaW5vZGUsIHN0cnVjdCBmaWxlICogZmlsZSwKKwkgICAgIHVuc2lnbmVkIGludCBjbWQsIHVuc2lnbmVkIGxvbmcgYXJnKQoreworCWludCBzaXplLCBlbnRfY291bnQ7CisJaW50IF9fdXNlciAqcCA9IChpbnQgX191c2VyICopYXJnOworCWludCByZXR2YWw7CisKKwlzd2l0Y2ggKGNtZCkgeworCWNhc2UgUk5ER0VURU5UQ05UOgorCQllbnRfY291bnQgPSBpbnB1dF9wb29sLmVudHJvcHlfY291bnQ7CisJCWlmIChwdXRfdXNlcihlbnRfY291bnQsIHApKQorCQkJcmV0dXJuIC1FRkFVTFQ7CisJCXJldHVybiAwOworCWNhc2UgUk5EQUREVE9FTlRDTlQ6CisJCWlmICghY2FwYWJsZShDQVBfU1lTX0FETUlOKSkKKwkJCXJldHVybiAtRVBFUk07CisJCWlmIChnZXRfdXNlcihlbnRfY291bnQsIHApKQorCQkJcmV0dXJuIC1FRkFVTFQ7CisJCWNyZWRpdF9lbnRyb3B5X3N0b3JlKCZpbnB1dF9wb29sLCBlbnRfY291bnQpOworCQkvKgorCQkgKiBXYWtlIHVwIHdhaXRpbmcgcHJvY2Vzc2VzIGlmIHdlIGhhdmUgZW5vdWdoCisJCSAqIGVudHJvcHkuCisJCSAqLworCQlpZiAoaW5wdXRfcG9vbC5lbnRyb3B5X2NvdW50ID49IHJhbmRvbV9yZWFkX3dha2V1cF90aHJlc2gpCisJCQl3YWtlX3VwX2ludGVycnVwdGlibGUoJnJhbmRvbV9yZWFkX3dhaXQpOworCQlyZXR1cm4gMDsKKwljYXNlIFJOREFEREVOVFJPUFk6CisJCWlmICghY2FwYWJsZShDQVBfU1lTX0FETUlOKSkKKwkJCXJldHVybiAt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X29wZXJhdGlvbnMgcmFuZG9tX2ZvcHMgPSB7CisJLnJlYWQgID0gcmFuZG9tX3JlYWQsCisJLndyaXRlID0gcmFuZG9tX3dyaXRlLAorCS5wb2xsICA9IHJhbmRvbV9wb2xsLAorCS5pb2N0bCA9IHJhbmRvbV9pb2N0bCwKK307CisKK3N0cnVjdCBmaWxlX29wZXJhdGlvbnMgdXJhbmRvbV9mb3BzID0geworCS5yZWFkICA9IHVyYW5kb21fcmVhZCwKKwkud3JpdGUgPSByYW5kb21fd3JpdGUsCisJLmlvY3RsID0gcmFuZG9tX2lvY3RsLAorfTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogUmFuZG9tIFVVSUQgaW50ZXJmYWNlCisgKgorICogVXNlZCBoZXJlIGZvciBhIEJvb3QgSUQsIGJ1dCBjYW4gYmUgdXNlZnVsIGZvciBvdGhlciBrZXJuZWwKKyAqIGRyaXZlcnMuCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICogR2VuZXJhdGUgcmFuZG9tIFVVSUQKKyAqLwordm9pZCBnZW5lcmF0ZV9yYW5kb21fdXVpZCh1bnNpZ25lZCBjaGFyIHV1aWRfb3V0WzE2XSkKK3sKKwlnZXRfcmFuZG9tX2J5dGVzKHV1aWRfb3V0LCAxNik7CisJLyogU2V0IFVVSUQgdmVyc2lvbiB0byA0IC0tLSB0cnVlbHkgcmFuZG9tIGdlbmVyYXRpb24gKi8KKwl1dWlkX291dFs2XSA9ICh1dWlkX291dFs2XSAmIDB4MEYpIHwgMHg0MDsKKwkvKiBTZXQgdGhlIFVVSUQgdmFyaWFudCB0byBEQ0UgKi8KKwl1dWlkX291dFs4XSA9ICh1dWlkX291dFs4XSAmIDB4M0YpIHwgMHg4MDsKK30KKworRVhQT1JUX1NZTUJPTChnZW5lcmF0ZV9yYW5kb21fdXV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rdC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmMzMjlhZWIKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2Jvb3Rwa3QuaApAQCAtMCwwICsxLDYyIEBACisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgQiBPIE8gVCAgICBQIEEgQyBLIEUgVCAgIEggRSBBIEQgRSBSICAgRiBJIEwgRQorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSWFuIE5hbmRocmEKKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4IEludGVybmF0aW9uYWwgTHRkLiwgQnlmbGVldCwgU3VycmV5LCBVSy4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CisgKiAgICAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CisgKiAgICAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yCisgKiAgICAgIChhdCB5b3VyIG9wdGlvbikgY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KioqKioqKioqKi8KKworI2lmbmRlZiBfcGt0X2gKKyNkZWZpbmUgX3BrdF9oIDEKKworI2lmbmRlZiBsaW50CisjaWZkZWYgU0NDUworc3RhdGljIGNoYXIgKl9yaW9fYm9vdHBrdF9oX3NjY3MgPSAiQCgjKWJvb3Rwa3QuaAkxLjEiIDsKKyNlbmRpZgorI2VuZGlmCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAqIE92ZXJsYXllZCBvbnRvIHRoZSBEYXRhIGZpZWxkcyBvZiBhIHJlZ3VsYXIKKyAgICAgKiBQYWNrZXQKKyAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwordHlwZWRlZiBzdHJ1Y3QgQk9PVF9QS1QgQk9PVF9QS1QgOworc3RydWN0IEJPT1RfUEtUIHsKKyAgICAgICAgICAgICAgICAgICAgc2hvcnQgICAgIHNlcV9udW0gOworICAgICAgICAgICAgICAgICAgICBjaGFyICAgICAgZGF0YVsxMF0gOworICAgICAgICAgICAgICAgIH0gOworCisKKyNlbmRpZgorCisvKioqKioqKioqKiogZW5kIG9mIGZpbGUgKioqKioqKioqKiovCisKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vYnJhdGVzLmggYi9kcml2ZXJzL2NoYXIvcmlvL2JyYXRlcy5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmJkNGZjODQKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2JyYXRlcy5oCkBAIC0wLDAgKzEsMTA3IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqCQlCUkFURVMuSAkJCQkgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBKZXJlbXkgUm9sbHMKKyBEYXRlICAgIDogMSBOb3YgMTk5MAorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkKKyAqICAgICAgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24gMiBvZiB0aGUgTGljZW5zZSwgb3IKKyAqICAgICAgKGF0IHlvdXIgb3B0aW9uKSBhbnkgbGF0ZXIgdmVyc2lvbi4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aGUgaG9wZSB0aGF0IGl0IHdpbGwgYmUgdXNlZnVsLAorICogICAgICBidXQgV0lUSE9VVCBBTlkgV0FSUkFOVFk7IHdpdGhvdXQgZXZlbiB0aGUgaW1wbGllZCB3YXJyYW50eSBvZgorICogICAgICBNRVJDSEFOVEFCSUxJVFkgb3IgRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UuICBTZWUgdGhlCisgKiAgICAgIEdOVSBHZW5lcmFsIFB1YmxpYyBMaW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ZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vY2lycnVzLmggYi9kcml2ZXJzL2NoYXIvcmlvL2NpcnJ1cy5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmNmMDU2YTkKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2NpcnJ1cy5oCkBAIC0wLDAgKzEsNDYzIEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqCQlDSVJSVVMuSAkJCQkgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBKZXJlbXkgUm9sbHMKKyBEYXRlICAgIDogMyBBdWcgMTk5MAorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkKKyAqICAgICAgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24gMiBvZiB0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RvIGluZGljYXRlIGN1cnJlbnQgc3RhdGUgYW5kIG1vZGVtIHN0YXR1cyByZXNwZWN0aXZlbHkKKyovIAorCisjZGVmaW5lCUNPTVBMRVRFCSgweDIwIHwgUFJFX0VNUFRJVkUpCisJCQkJLyogQ29tbWFuZCBjb21wbGV0ZSAqLworI2RlZmluZSBCUkVBS19SRUNFSVZFRAkoMHgyMSB8IFBSRV9FTVBUSVZFKQorCQkJCS8qIEJyZWFrIHJlY2VpdmVkICovCisjZGVmaW5lIE1PREVNX1NUQVRVUwkoMHgyMiB8IFBSRV9FTVBUSVZFKQorCQkJCS8qIENoYW5nZSBpbiBtb2RlbSBzdGF0dXMgKi8KKworLyogIkNvbW1hbmQiIHBhY2tldCB0aGF0IGNvdWxkIGdvIGVpdGhlciB3YXkgLSBoYW5kc2hha2Ugd2FrZS11cCAqLworI2RlZmluZSBIQU5EU0hBS0UJKDB4MjMgfCBQUkVfRU1QVElWRSkKKwkJCQkvKiBXYWtlLXVwIHRvIEhPU1QgLyBSVEEgKi8KKworI2VuZGlmCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2NtZC5oIGIvZHJpdmVycy9jaGFyL3Jpby9jbWQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jMzY5ZWRhCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9jbWQuaApAQCAtMCwwICsxLDg0IEBACisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgQyBPIE0gTSBBIE4gRCAgIFAgQSBDIEsgRSBUICAgSCBFIEEgRCBFIFIgUworICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgIC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weSBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UKKyAqICAgICAgYWxvbmcgd2l0aCB0aGlzIHByb2dyYW07IGlmIG5vdCwgd3JpdGUgdG8gdGhlIEZyZWUgU29mdHdhcmUKKyAqICAgICAgRm91bmRhdGlvbiwgSW5jLiwgNjc1IE1hc3MgQXZlLCBDYW1icmlkZ2UsIE1BIDAyMTM5LCBVU0EuCisKKyBWZXJzaW9uIDogMC4wMQorCisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb2RzCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICBEYXRlICAgICBCeSAgICAgICAgICAgICAgICBEZXNjcmlwdGlvbgorIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworCisjaWZuZGVmIF9jbWRfaAorI2RlZmluZSBfY21kX2gKKworI2lmbmRlZiBsaW50CisjaWZkZWYgU0NDUworc3RhdGljIGNoYXIgKl9yaW9fY21kX2hfc2NjcyA9ICJAKCMpY21kLmgJMS4xIiA7CisjZW5kaWYKKyNlbmRpZgorCisKKyNkZWZpbmUgUFJFX0VNUFRJVkVfQ01EICAgICAgICAgMHg4MAorI2RlZmluZSBJTkxJTkVfQ01EICAgICAgICAgICAgICB+UFJFX0VNUFRJVkVfQ01ECisKKyNkZWZpbmUgQ01EX0lHTk9SRV9QS1QgICAgICAgICAgKCAodXNob3J0KSAwKQorI2RlZmluZSBDTURfU1RBVFVTX1JFUSAgICAgICAgICAoICh1c2hvcnQpIDEpCisjZGVmaW5lIENNRF9VTklUX1NUQVRVU19SRVEgICAgICggKHVzaG9ydCkgMikgICAgIC8qIElzIHRoaXMgbmVlZGVkID8/PyAqLworI2RlZmluZSBDTURfQ09ORl9QT1JUICAgICAgICAgICAoICh1c2hvcnQpIDMpCisjZGVmaW5lIENNRF9DT05GX1VOSVQgICAgICAgICAgICggKHVzaG9ydCkgNCkKKyNkZWZpbmUgQ01EX1JPVVRFX01BUF9SRVEgICAgICAgKCAodXNob3J0KSA1KQorI2RlZmluZSBDTURfRkxVU0hfVFggICAgICAgICAgICAoICh1c2hvcnQpIDYpCisjZGVmaW5lIENNRF9GTFVTSF9SWCAgICAgICAgICAgICggKHVzaG9ydCkgNykKKyNkZWZpbmUgQ01EX1BBUlRJT05fUE9SVCAgICAgICAgKCAodXNob3J0KSA4KQorI2RlZmluZSBDTURfUkVTRVRfUE9SVCAgICAgICAgICAoICh1c2hvcnQpIDB4MGEpCisjZGVmaW5lIENNRF9CT09UX1VOSVQgICAgICAgICAgICggKHVzaG9ydCkgMHgwYikKKyNkZWZpbmUgQ01EX0ZPVU5EX1VOSVQgICAgICAgICAgKCAodXNob3J0KSAweDBjKQorI2RlZmluZSBDTURfQVRUQUNIRURfUlRBXzIgICAgICAoICh1c2hvcnQpIDB4MGQpCisjZGVmaW5lIENNRF9QUk9WSURFX0JPT1QgICAgICAgICggKHVzaG9ydCkgMHgwZSkKKyNkZWZpbmUgQ01EX0NJUlJVUyAgICAgICAgICAgICAgKCAodXNob3J0KSAweDBmKQorCisjZGVmaW5lIEZPUk1fU1RBVFVTX1BLVCAgICAgICAgICggKHVzaG9ydCkgMSApCisjZGVmaW5lIEZPUk1fUE9MTF9QS1QgICAgICAgICAgICggKHVzaG9ydCkgMiApCisjZGVmaW5lIEZPUk1fTElOS19TVEFUVVNfUEtUICAgICggKHVzaG9ydCkgMyApCisKKworI2RlZmluZSBDTURfREFUQV9QT1JUICAgICAgICAgICAoICh1c2hvcnQpIDEgKQorI2RlZmluZSBDTURfREFUQSAgICAgICAgICAgICAg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WzIwXTsKKwkgICAgQllURSAgIFBjSUROdW0yOwkJLyogSXQgaGFkIHRvIGdvIHNvbWV3aGVyZSEgKi8KKwl9IFM1OworCXN0cnVjdAorCXsKKwkgICAgc3RydWN0IENtZEhkciBDbWRIZHI7CisJICAgIHN0cnVjdCBTYW1Ub3AgICAgVG9wb2xvZ3lbTElOS1NfUEVSX1VOSVRdOworCX0gUzY7CisgICAgfSBVMTsKK307CisKK3N0cnVjdCBQa3RDbWRfTQoreworICAgIHVuaW9uCisgICAgeworCXN0cnVjdCAKKwl7CisJICAgIHN0cnVjdAorCSAgICB7CisgICAgCQl1Y2hhciBQY0NvbW1hbmQ7CisgICAgCQl1bmlvbgorICAgIAkJeworICAgIAkJICAgIHVjaGFyIFBjUGhiTnVtOworICAgIAkJICAgIHVjaGFyIFBjTGlua051bTsKKyAgICAJCSAgICB1Y2hhciBQY0lETnVtOworICAgIAkJfSBVMDsKKwkgICAgfSBDbWRIZHI7CisJICAgIHN0cnVjdAorCSAgICB7CisgICAgICAgICAgICAgICAgdXNob3J0CU51bVBhY2tldHM7CisgICAgICAgICAgICAgICAgdXNob3J0CUxvYWRCYXNlOworICAgICAgICAgICAgICAgIHVzaG9ydAlDb2RlU2l6ZTsKKyAgICAgICAgICAgIH0gUGNCb290U2VxdWVuY2U7CisJfSBTMTsKKwlzdHJ1Y3QKKwl7CisJICAgIHVzaG9ydCBQY1NlcXVlbmNlOworCSAgICB1Y2hhciBQY0Jvb3REYXRhW1JUQV9CT09UX0RBVEFfU0laRV07CisJfSBTMjsKKwlzdHJ1Y3QKKwl7CisJICAgIHVzaG9ydCAgX19jcnVkX187CisJICAgIHVjaGFyICBQY1VuaXFOdW1bNF07CSAgICAgICAgLyogdGhpcyBpcyByZWFsbHkgYSB1aW50LiAqLworCSAgICB1Y2hhciAgUGNNb2R1bGVUeXBlczsgIAkvKiB3aGF0IG1vZHVsZXMgYXJlIGZpdHRlZCAqLworCX0gUzM7CisJc3RydWN0CisJeworCSAgICB1c2h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VtU3RhdHVzCisjZGVmaW5lIFBvcnRTdGF0dXMJVTEuUzQuUGNQb3J0U3RhdHVzCisjZGVmaW5lIFN1YkNvbW1hbmQJVTEuUzQuUGNTdWJDb21tYW5kCisjZGVmaW5lIFN1YkFkZHIJCVUxLlM0LlBjU3ViQWRkcgorI2RlZmluZSBTdWJEYXRhCQlVMS5TNC5QY1N1YkRhdGEKKyNkZWZpbmUgQ29tbWFuZFRleHQJVTEuUzUuUGNDb21tYW5kVGV4dAorI2RlZmluZSBSb3V0ZVRvcG9sb2d5CVUxLlM2LlRvcG9sb2d5CisjZGVmaW5lIE1vZHVsZVR5cGVzCVUxLlMzLlBjTW9kdWxlVHlwZXMKKworI2VuZGlmCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2NvbnRyb2wuaCBiL2RyaXZlcnMvY2hhci9yaW8vY29udHJvbC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjE3MTJmNjIKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2NvbnRyb2wuaApAQCAtMCwwICsxLDYyIEBACisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgQyBPIE4gVCBSIE8gTCAgIFAgQSBDIEsgRSBUICAgSCBFIEEgRCBFIFIgUworICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSm9uIEJyYXduCisgR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CisgKiAgICAgIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGZvciBtb3JlIGRldGFpbHMuCisgKgorICogICAgICBZb3Ugc2hvdWxkIGhhdmUgcmVjZWl2ZWQgYSBjb3B5IG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZQorICogICAgICBhbG9uZyB3aXRoIHRoaXMgcHJvZ3JhbTsgaWYgbm90LCB3cml0ZSB0byB0aGUgRnJlZSBTb2Z0d2FyZQorICogICAgICBGb3VuZGF0aW9uLCBJbmMuLCA2NzUgTWFzcyBBdmUsIENhbWJyaWRnZSwgTUEgMDIxMzksIFVTQS4KKyovCisKKyNpZm5kZWYgX2RlYnVnX2hfCisjZGVmaW5lIF9kZWJ1Z19oXworCisKKyNpZiBkZWZpbmVkKERDSVJSVVMpCisjZGVmaW5lCURCUEFDS0VUKHBrdCwgb3B0LCBzdHIsIGNobikgCWRlYnVnX3BhY2tldCgocGt0KSwgKG9wdCksIChzdHIpLCAoY2huKSkKKyNlbHNlCisjZGVmaW5lCURCUEFDS0VUKHBrdCwgb3B0LCBzdHIsIGMpCisjZW5kaWYJLyogRENJUlJVUyAqLworCisKKyNlbmRpZgkvKiBfZGVidWdfaF8gKi8KZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vZGVmYXVsdHMuaCBiL2RyaXZlcnMvY2hhci9yaW8vZGVmYXVsdHMuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4yZTczMDllCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9kZWZhdWx0cy5oCkBAIC0wLDAgKzEsNTkgQEAKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgIEQgRSBGIEEgVSBMIFQgUworICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSWFuIE5hbmRocmEKKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4IEludGVybmF0aW9uYWwgTHRkLiwgQnlmbGVldCwgU3VycmV5LCBVSy4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CisgKiAgICAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CisgKiAgICAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yCisgKiAgICAgIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZGlzdHJpYnV0ZWQgaW4gdGhlIGhvcGUgdGhhdCBpdCB3aWxsIGJlIHVzZWZ1bCwKKyAqICAgICAgYnV0IFdJVEhPVVQgQU5ZIFdBUlJBTlRZOyB3aXRob3V0IGV2ZW4gdGhlIGltcGxpZWQgd2FycmFudHkgb2YKKyAqICAgICAgTUVSQ0hBTlRBQklMSVRZIG9yIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUiBQVVJQT1NFLiAgU2VlIHRoZQorICogICAgICBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBmb3IgbW9yZSBkZXRhaWxzLgorICoKKyAqICAgICAgWW91IHNob3VsZCBoYXZlIHJlY2VpdmVkIGEgY29weSBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UKKyAqICAgICAgYWxvbmcgd2l0aCB0aGlzIHByb2dyYW07IGlmIG5vdCwgd3JpdGUgdG8gdGhlIEZyZWUgU29mdHdhcmUKKyAqICAgICAgRm91bmRhdGlvbiwgSW5jLiwgNjc1IE1hc3MgQXZlLCBDYW1icmlkZ2UsIE1BIDAyMTM5LCBVU0EuCisKKyBWZXJzaW9uIDogMC4wMQorCisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb2RzCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICBEYXRlICAgICBCeSAgICAgICAgICAgICAgICBEZXNjcmlwdGlvbgorIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2lmbmRlZiBsaW50CisjaWZkZWYgU0NDUworc3RhdGljIGNoYXIgKl9yaW9fZGVmYXVsdHNfaF9zY2NzID0gIkAoIylkZWZhdWx0cy5oCTEuMSIgOworI2VuZGlmCisjZW5kaWYKKworCisjZGVmaW5lIE1JTExJU0VDT05EICAgICAgICAgICAoaW50KSAoMTAwMC82NCkgICAvKiAxNS42MjUgbG93IHRpY2tzICovCisjZGVmaW5lIFNFQ09ORCAgICAgICAgICAgICAgICAoaW50KSAxNTYyNSAgICAgICAvKiBMb3cgcHJpb3JpdHkgdGlja3MgKi8KKworI2lmZGVmIFJUQQ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KioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICBFIE4gQSBCIEwgRSAgIEggRSBBIEQgRSBSIFMKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yICA6IElhbiBOYW5kaHJhCisgRGF0ZSAgICA6CisKKyAqCisgKiAgKEMpIDE5OTAgLSAyMDAwIFNwZWNpYWxpeCBJbnRlcm5hdGlvbmFsIEx0ZC4sIEJ5ZmxlZXQsIFN1cnJleSwgVUsuCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQorICogICAgICBpdCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hlZCBieQorICogICAgICB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBlaXRoZXIgdmVyc2lvbiAyIG9mIHRoZSBMaWNlbnNlLCBvcgorICogICAgICAoYXQgeW91ciBvcHRpb24pIGFueSBsYXRlciB2ZXJzaW9uLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGRpc3RyaWJ1dGVkIGluIHRoZSBob3BlIHRoYXQgaXQgd2lsbCBiZSB1c2VmdWwsCisgKiAgICAgIGJ1dCBXSVRIT1VUIEFOWSBXQVJSQU5UWTsgd2l0aG91dCBldmVuIHRoZSBpbXBsaWVkIHdhcnJhbnR5IG9mCisgKiAgICAgIE1FUkNIQU5UQ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KioqKioqKiBlbmQgb2YgZmlsZSAqKioqKioqKioqKi8KKworCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2Vycm9yLmggYi9kcml2ZXJzL2NoYXIvcmlvL2Vycm9yLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMjI5NDM4ZQotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9yaW8vZXJyb3IuaApAQCAtMCwwICsxLDg1IEBACisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgIEUgUiBSIE8gUiAgSCBFIEEgRCBFIFIgICBGIEkgTCBFCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBJYW4gTmFuZGhyYQorIERhdGUgICAgOgorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkKKyAqICAgICAgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdG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0tLS0tLS0tLS0tLS0tLQorCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIGxpbnQKKy8qIHN0YXRpYyBjaGFyICpfcmlvX2Vycm9yX2hfc2NjcyA9ICJAKCMpZXJyb3IuaAkxLjMiOyAqLworI2VuZGlmCisKKyNkZWZpbmUgRV9OT19FUlJPUiAgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDApCisjZGVmaW5lIEVfUFJPQ0VTU19OT1RfSU5JVCAgICAgICAgICAgICAgICgodXNob3J0KSAxKQorI2RlZmluZSBFX0xJTktfVElNRU9VVCAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMikKKyNkZWZpbmUgRV9OT19ST1VURSAgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDMpCisjZGVmaW5lIEVfQ09ORlVTRUQgICAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSA0KQorI2RlZmluZSBFX0hPTUUgICAgICAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgNSkKKyNkZWZpbmUgRV9DU1VNX0ZBSUwgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDYpCisjZGVmaW5lIEVfRElTQ09OTkVDVEVEICAgICAgICAgICAgICAgICAgICgodXNob3J0KSA3KQorI2RlZmluZSBFX0JBRF9SVVAgICAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgOCkKKyNkZWZpbmUgRV9OT19WSVJHSU4gICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDkpCisjZGVmaW5lIEVfQk9PVF9SVVBfQlVTWSAgICAgICAgICAgICAgICAgICgodXNob3J0KSAxMCkKKworCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAqIFBhcnNlZCB0byBtZW1faGFsdCgpCisgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgRV9DSEFOQUxMT0MgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4ODApCisjZGVmaW5lIEVfUE9MTF9BTExPQyAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDgxKQorI2RlZmluZSBFX0xUVFdBS0UgICAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg4MikKKyNkZWZpbmUgRV9MVFRfQUxMT0MgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4ODMpCisjZGVmaW5lIEVfTFJUX0FMTE9DICAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDg0KQorI2RlZmluZSBFX0NJUlJVUyAgICAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg4NSkKKyNkZWZpbmUgRV9NT05JVE9SICAgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4ODYpCisjZGVmaW5lIEVfUEhCX0FMTE9DICAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDg3KQorI2RlZmluZSBFX0FSUkFZX0FMTE9DICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg4OCkKKyNkZWZpbmUgRV9RQlVGX0FMTE9DICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4ODkpCisjZGVmaW5lIEVfUEtUX0FMTE9DICAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDhhKQorI2RlZmluZSBFX0dFVF9UWF9RX0JVRiAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg4YikKKyNkZWZpbmUgRV9HRVRfUlhfUV9CVUYgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4OGMpCisjZGVmaW5lIEVfTUVNX09VVCAgICAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDhkKQorI2RlZmluZSBFX01NVV9JTklUICAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg4ZSkKKyNkZWZpbmUgRV9MVFRfSU5JVCAgICAgICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4OGYpCisjZGVmaW5lIEVfTFJUX0lOSVQgICAgICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDkwKQorI2RlZmluZSBFX0xJTktfUlVOICAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg5MSkKKyNkZWZpbmUgRV9NT05JVE9SX0FMTE9DICAgICAgICAgICAgICAgICAgKCh1c2hvcnQpIDB4OTIpCisjZGVmaW5lIEVfTU9OSVRPUl9JTklUICAgICAgICAgICAgICAgICAgICgodXNob3J0KSAweDkzKQorI2RlZmluZSBFX1BPTExfSU5JVCAgICAgICAgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHg5NCkKKworCisvKioqKioqKioqKiogZW5kIG9mIGZpbGUgKioqKioqKioqKiovCisKKworCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2Vycm9ycy5oIGIvZHJpdmVycy9jaGFyL3Jpby9lcnJvcnMuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5mOTIwYjlmCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9lcnJvcnMuaApAQCAtMCwwICsxLDEwNCBAQAorLyoKKyoqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisqKgorKiogIFBlcmxlIFNwZWNpYWxpeCBkcml2ZXIgZm9yIExpbnV4CisqKiAgUG9ydGVkIGZyb20gZXhpc3RpbmcgUklPIERyaXZlciBmb3IgU0NPIHNvdXJjZXMuCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJ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vZm9ybXBrdC5oCkBAIC0wLDAgKzEsMTU0IEBACisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgIEYgTyBSIE0gICBQIEEgQyBLIEUgVCAgIEggRSBBIEQgRSBSICAgRiBJIEwgRQorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSWFuIE5hbmRocmEKKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4IEludGVybmF0aW9uYWwgTHRkLiwgQnlmbGVldCwgU3VycmV5LCBVSy4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CisgKiAgICAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CisgKiAgICAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yCisgKiAgICAgIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZGlzdHJpYnV0ZWQgaW4gdGhlIGhvcGUgdGhhdCBpdCB3aWxsIGJlIHV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F0aWMgY2hhciAqX3Jpb19mb3JtcGt0X2hfc2NjcyA9ICJAKCMpZm9ybXBrdC5oCTEuMSIgOworI2VuZGlmCisjZW5kaWYKKwordHlwZWRlZiBzdHJ1Y3QgRk9STV9CT09UX1BLVF8xIEZPUk1fQk9PVF9QS1RfMSA7CitzdHJ1Y3QgRk9STV9CT09UX1BLVF8xIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzaG9ydCBwa3RfbnVtYmVyIDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzaG9ydCBwa3RfdG90YWwgOworICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNob3J0IGJvb3RfdG9wIDsKKyAgICAgICAgICAgICAgICAgICAgICAgfSA7CisKK3R5cGVkZWYgc3RydWN0IEZPUk1fQk9PVF9QS1RfMiBGT1JNX0JPT1RfUEtUXzIgOworc3RydWN0IEZPUk1fQk9PVF9QS1RfMiB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2hvcnQgcGt0X251bWJlciA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgYm9vdF9kYXRhWzEwXSA7CisgICAgICAgICAgICAgICAgICAgICAgIH0gOworCisKK3R5cGVkZWYgc3RydWN0IEZPUk1fQVRUQUNIX1JUQSAgIEZPUk1fQVRUQUNIX1JUQSA7CitzdHJ1Y3QgRk9STV9BVFRBQ0hfUlRBICB7CisgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgY21kX2NvZGUgOworICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgIGJvb3Rlcl9zZXJpYWxbNF0gOworICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgIGJvb3Rlcl9saW5rIDsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICBib290ZWVfc2VyaWFsWzRdIDsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICBib290ZWVfbGluayA7CisgICAgICAgICAgICAgICAgICAgfSA7CisKKwordHlwZWRlZiBzdHJ1Y3QgRk9STV9CT09UX0lEICAgRk9STV9CT09UX0lEIDsKK3N0cnVjdCBGT1JNX0JPT1RfSUQgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICBjbWRfY29kZSA7CisgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgYm9vdGVlX3NlcmlhbFs0XSA7CisgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgYm9vdGVlX3Byb2RfaWQgOworICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgIGJvb3RlZV9saW5rIDsKKyAgICAgICAgICAgICAgICAgICB9IDsKKworCisKK3R5cGVkZWYgc3RydWN0IEZPUk1fUk9VVEVfMSAgIEZPUk1fUk9VVEVfMSA7CitzdHJ1Y3QgRk9STV9ST1VURV8xIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgIGNtZF9jb2RlIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgIHBrdF9udW1iZXIgOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICAgdG90YWxfaW5fc2VxdWVuY2UgOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICAgdW5pdF9pZCA7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgICBob3N0X3VuaXRfaWQgOworICAgICAgICAgICAgICAgICAgICB9IDsKKwordHlwZWRlZiBzdHJ1Y3QgRk9STV9ST1VURV8yICAgRk9STV9ST1VURV8yIDsKK3N0cnVjdCBGT1JNX1JPVVRFXzIgeworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgIGNtZF9jb2RlIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICBwa3RfbnVtYmVyIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICB0b3RhbF9pbl9zZXF1ZW5jZSA7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgcm91dGVfZGF0YVs5XSA7CisgICAgICAgICAgICAgICAgICAgIH0gOworCit0eXBlZGVmIHN0cnVjdCBGT1JNX1JPVVRFX1JFUSAgIEZPUk1fUk9VVEVfUkVRIDsKK3N0cnVjdCBGT1JNX1JPVVRFX1JFUSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICBjbWRfY29kZSA7CisgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICBwa3RfbnVtYmVyIDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgIHRvdGFsX2luX3NlcXVlbmNlIDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgIHJvdXRlX2RhdGFbMTBdIDsKKyAgICAgICAgICAgICAgICAgICAgICB9IDsKKworCit0eXBlZGVmIHN0cnVjdCBGT1JNX0VSUk9SICAgRk9STV9FUlJPUiA7CitzdHJ1Y3QgRk9STV9FUlJPUiB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgY21kX2NvZGUgOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgIGVycm9yX2NvZGUgOworCisgICAgICAgICAgICAgICAgICAgIH0gOworCit0eXBlZGVmIHN0cnVjdCBGT1JNX1NUQVRVUyAgIEZPUk1fU1RBVFVTIDsKK3N0cnVjdCBGT1JNX1NUQVRVUyB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgY21kX2NvZGUgOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgIHN0YXR1c19jb2RlIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICBsYXN0X3BhY2tldF92YWxpZCA7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgdHhfYnVmZmVyIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICByeF9idWZmZXIgOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgIHBvcnRfc3RhdHVzIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICBwaGJfc3RhdHVzIDsKKyAgICAgICAgICAgICAgICAgICAgfSA7CisKKwordHlwZWRlZiBzdHJ1Y3QgRk9STV9MSU5LX1NUQVRVUyAgIEZPUk1fTElOS19TVEFUVVMgOworc3RydWN0IEZPUk1fTElOS19TVEFUVVMgeworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICBjbWRfY29kZSA7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgIHN0YXR1c19jb2RlIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgbGlua19udW1iZXIgOworICAgICAgICAgICAgICAgICAgICAgICAgdXNob3J0ICByeF9lcnJvcnMgOworICAgICAgICAgICAgICAgICAgICAgICAgdXNob3J0ICB0eF9lcnJvcnMgOworICAgICAgICAgICAgICAgICAgICAgICAgdXNob3J0ICBjc3VtX2Vycm9ycyA7CisgICAgICAgICAgICAgICAgICAgICAgICB1c2hvcnQgIGRpc2Nvbm5lY3RzIDsKKyAgICAgICAgICAgICAgICAgICAgfSA7CisKKworCit0eXBlZGVmIHN0cnVjdCBGT1JNX1BBUlRJVElPTiBGT1JNX1BBUlRJVElPTiA7CitzdHJ1Y3QgRk9STV9QQVJUSVRJT04geworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICBjbWRfY29kZSA7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICAgIHN0YXR1c19jb2RlIDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgICAgcG9ydF9udW1iZXIgOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICB0eF9tYXggOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICByeF9tYXggOworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAgICByeF9saW1pdCA7CisgICAgICAgICAgICAgICAgICAgICAgfSA7CisKKworI2VuZGlmCisKKy8qKioqKioqKioqKiBlbmQgb2YgZmlsZSAqKioqKioqKioqKi8KKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9mdW5jLmggYi9kcml2ZXJzL2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xheSAqLworICAgIHBhZGRyX3QgICAgICAgICAgCSAgICBQYWRkclA7ICAgIC8qIFBoeXMuIGFkZHJlc3Mgb2YgRFBSQU0gKi8KKyAgICBjaGFyICAgICAgICAgICAgICAgICAgICBOYW1lW01BWF9OQU1FX0xFTl07ICAvKiBUaGUgbmFtZSBvZiB0aGUgaG9zdCAqLworICAgIHVpbnQgICAgICAgICAgICAJICAgIFVuaXF1ZU51bTsgLyogaG9zdCB1bmlxdWUgbnVtYmVyICovCisgICAgc3BpbmxvY2tfdAkgICAgICAgICAgICBIb3N0TG9jazsgIC8qIExvY2sgc3RydWN0dXJlIGZvciBNUFggKi8KKyAgICAvKnN0cnVjdCBwY2lfZGV2aW5mbyAgICBQY2lEZXZJbmZvOyAqLy8qIFBDSSBCdXMvRGV2aWNlL0Z1bmN0aW9uIHN0dWZmICovCisgICAgLypzdHJ1Y3QgbG9ja2IJICAgIEhvc3RMb2NrOyAgKi8vKiBMb2NrIHN0cnVjdHVyZSBmb3IgTVBYICovCisgICAgdWludCAgICAgICAgICAgICAgICAgICAgV29ya1RvQmVEb25lOyAvKiBzZXQgdG8gdHJ1ZSBlYWNoIGludGVycnVwdCAqLworICAgIHVpbnQgICAgICAgICAgICAgICAgICAgIEluSW50cjsgICAgLyogQmVpbmcgc2VydmljZWQ/ICovCisgICAgdWludCAgICAgICAgICAgICAgICAgICAgSW50U3J2RG9uZTsvKiBob3N0J3MgaW50ZXJydXB0IGhhcyBiZWVuIHNlcnZpY2VkICovCisgICAgaW50CQkJICAgICgqQ29weSkoIGNhZGRyX3QsIGNhZGRyX3QsIGludCApOyAvKiBjb3B5IGZ1bmMgKi8KKyAgICBzdHJ1Y3QgdGltZXJfbGlzdCB0aW1lcjsKKyAgICAvKgorICAgICoqICAgICAgICAgICAgICAgSSBNIFAgTyBSIFQgQSBOIFQgIQorICAgICoqCisgICAgKiogVGhlIHJlc3Qgb2YgdGhpcyBkYXRhIHN0cnVjdHVyZSBpcyBjbGVhcmVkIHRvIHplcm8gYWZ0ZXIKKyAgICAqKiBhIFJJT19IT1NUX0ZPQUQgY29tbWFuZC4KKyAgICAqLworICAgIAorICAgIHVsb25nICAgICAgICAgICAgICAgICAgIEZsYWdzOyAgICAgLyogV2hhdHMgZ29pbmcgZG93biAqLworI2RlZmluZSBSQ19XQUlUSU5HICAgICAgICAgICAgMAorI2RlZmluZSBSQ19TVEFSVFVQICAgICAgICAgICAgMQorI2RlZmluZSBSQ19SVU5OSU5HICAgICAgICAgICAgMgorI2RlZmluZSBSQ19TVFVGRkVEICAgICAgICAgICAgMworI2RlZmluZSBSQ19TT01FVEhJTkcgICAgICAgICAgNAorI2RlZmluZSBSQ19TT01FVEhJTkdfTkVXICAgICAgNQorI2RlZmluZSBSQ19TT01FVEhJTkdfRUxTRSAgICAgNgorI2RlZmluZSBSQ19SRUFEWSAgICAgICAgICAgICAgNworI2RlZmluZSBSVU5fU1RBVEUgICAgICAgICAgICAgNworLyoKKyoqIEJvb3QgbW9kZSBhcHBsaWVzIHRvIHRoZSB3YXkgaW4gd2hpY2ggaG9zdHMgaW4gdGhpcyBzeXN0ZW0gd2lsbAorKiogYm9vdCBSVEFzCisqLworI2RlZmluZSBSQ19CT09UX0FMTCAgICAgICAgICAgMHg4CS8qIEJvb3QgYWxsIFJUQXMgYXR0YWNoZWQgKi8KKyNkZWZpbmUgUkNfQk9PVF9PV04gICAgICAgICAgIDB4MTAJLyogT25seSBib290IFJUQXMgYm91bmQgdG8gdGhpcyBzeXN0ZW0gKi8KKyNkZWZpbmUgUkNfQk9PVF9OT05FICAgICAgICAgIDB4MjAJLyogRG9uJ3QgYm9vdCBhbnkgUlRBcyAoc2xhdmUgbW9kZSkgKi8KKworICAgIHN0cnVjdCBUb3AJCSAgICBUb3BvbG9neVtMSU5LU19QRVJfVU5JVF07IC8qIG9uZSBwZXIgbGluayAqLworICAgIHN0cnVjdCBNYXAgICAgICAgICAgICAgIE1hcHBpbmdbTUFYX1JVUF07ICAgICAvKiBNYXBwaW5ncyBmb3IgaG9zdCAqLworICAgIHN0cnVjdCBQSEIJCSAgICAqUGhiUDsgICAgICAgICAgICAgICAgLyogUG9pbnRlciB0byB0aGUgUEhCIGFycmF5ICovCisgICAgdXNob3J0ICAgICAgICAgICAJICAgICpQaGJOdW1QOyAgICAgICAgICAgICAvKiBQdHIgdG8gTnVtYmVyIG9mIFBIQidzICovCisgICAgc3RydWN0IExQQiAJICAgICAgICAgICAgKkxpbmtTdHJQIDsgICAgICAgICAgIC8qIExpbmsgU3RydWN0dXJlIEFycmF5ICovCisgICAgc3RydWN0IFJVUCAgICAgICAJICAgICpSdXBQOyAgICAgICAgICAgICAgICAvKiBTaXh0ZWVuIHJlYWwgcnVwcyBoZXJlICovCisgICAgc3RydWN0IFBBUk1fTUFQICAJICAgICpQYXJtTWFwUDsgICAgICAgICAgICAvKiBwb2ludHMgdG8gdGhlIHBhcm1tYXAgKi8KKyAgICB1aW50ICAgICAgICAgICAgICAgICAgICBFeHRyYVVuaXRzW01BWF9FWFRSQV9VTklUU107IC8qIHVua25vd24gdGhpbmdzICovCisgICAgdWludCAgICAgICAgICAgICAgICAgICAgTnVtRXh0cmFCb290ZWQ7ICAgICAgIC8qIGhvdyBtYW55IG9mIHRoZSBhYm92ZSAqLworICAgIC8qCisgICAgKiogVHdlbnR5IGxvZ2ljYWwgcnVwcy4KKyAgICAqKiBUaGUgZmlyc3Qgc2l4dGVlbiBhcmUgdGhlIHJlYWwgUnVwIGVudHJpZXMgKGFib3ZlKSwgdGhlIGxhc3QgZm91cgorICAgICoqIGFyZSB0aGUgbGluayBSVVBzLgorICAgICovCisgICAgc3RydWN0IFVuaXhSdXAJICAgIFVuaXhSdXBzW01BWF9SVVArTElOS1NfUEVSX1VOSVRdOworCWludAkJCQl0aW1lb3V0X2lkOwkvKiBGb3IgY2FsbGluZyAxMDAgbXMgZGVsYXlzICovCisJaW50CQkJCXRpbWVvdXRfc2VtOy8qIEZvciBjYWxsaW5nIDEwMCBtcyBkZWxheXMgKi8K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AwNjQ0CmluZGV4IDAwMDAwMDAuLmY2ZjMxZWMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2hvc3Rody5oCkBAIC0wLDAgKzEsNTcgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgSCBPIFMgVCAgICAgIEggQSBSIEQgVyBBIFIgRQorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSWFuIE5hbmRocmEgLyBKZXJlbXkgUm9sbHMKKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4IEludGVybmF0aW9uYWwgTHRkLiwgQnlmbGVldCwgU3VycmV5LCBVSy4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CisgKiAgICAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CisgKiAgICAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yCisgKiAgICAgIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCisgKg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IGxpbnQKKyNpZmRlZiBTQ0NTX0xBQkVMUworc3RhdGljIGNoYXIgKl9yaW9faG9zdGh3X2hfc2NjcyA9ICJAKCMpaG9zdGh3LmgJMS4yIiA7CisjZW5kaWYKKyNlbmRpZgorCisjZGVmaW5lIFNFVF9PVEhFUl9JTlRFUlJVUFQgICggKHZvbGF0aWxlIHVfc2hvcnQgKikgMHg3YzgwICkKKyNkZWZpbmUgU0VUX0VJU0FfSU5URVJSVVBUICAoICh2b2xhdGlsZSB1X3Nob3J0ICopIDB4N2VmMCApCisKKyNkZWZpbmUgRUlTQV9IT1NUICAgIDB4MzAKKyNkZWZpbmUgQVRfSE9TVCAgICAgIDB4YTAKKyNkZWZpbmUgTUNBX0hPU1QgICAgIDB4YjAKKyNkZWZpbmUgUENJX0hPU1QgICAgIDB4ZDAKKworI2RlZmluZSBQUk9EVUNUX01BU0sgMHhmMAorCisKKy8qKioqKioqKioqKiBlbmQgb2YgZmlsZSAqKioqKioqKioqKi8KKworCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2xpbmsuaCBiL2RyaXZlcnMvY2hhci9yaW8vbGluay5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjk3MjI1MDMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2xpbmsuaApAQCAtMCwwICsxLDE4OCBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICBMIEkgTiBLCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqK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ICAgICBhbG9uZyB3aXRoIHRoaXMgcHJvZ3JhbTsgaWYgbm90LCB3cml0ZSB0byB0aGUgRnJlZSBTb2Z0d2FyZQorICogICAgICBGb3VuZGF0aW9uLCBJbmMuLCA2NzUgTWFzcyBBdmUsIENhbWJyaWRnZSwgTUEgMDIxMzksIFVTQS4KKworIFZlcnNpb24gOiAwLjAxCisKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1vZHMKKyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgIERhdGUgICAgIEJ5ICAgICAgICAgICAgICAgIERlc2NyaXB0aW9uCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIF9saW5rX2gKKyNkZWZpbmUgX2xpbmtfaCAxCisKKyNpZm5kZWYgbGludAorI2lmZGVmIFNDQ1NfTEFCRUxTCisvKiBzdGF0aWMgY2hhciAqX3Jpb19saW5rX2hfc2NjcyA9ICJAKCMpbGluay5oCTEuMTUiOyAqLworI2VuZGlmCisjZW5kaWYKKworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBEZWZpbmUgdGhlIExpbmsgU3RhdHVzIHN0dWZmCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBMUlRfQUNUSVZFICAgICAgICAgKCh1c2hvcnQpIDB4MDEpCisjZGVmaW5lIExSVF9TUEFSRTEgICAgICAgICAoKHVzaG9ydCkgMHgwMikKKyNkZWZpbmUgSU5U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vdCAqLworI2RlZmluZSBCT09UX1NFUVVFTkNFICAgICAgKCh1c2hvcnQpIDIpICAgIC8qIFBhY2tldCB3aXRoIHRoZSBudW1iZXIgb2YgcGFja2V0cworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuZCBsb2FkIGFkZHJlc3MgKi8KKyNkZWZpbmUgQk9PVF9DT01QTEVURUQgICAgICgodXNob3J0KSAzKSAgICAvKiBCb290IGNvbXBsZXRlZCAqLworCisvKiBTdGF0ZXMgdGhhdCBhIGxpbmsgY2FuIGJlIGluICovCisjZGVmaW5lCUxJTktfRElTQ09OTkVDVEVEICAoKHVzaG9ydCkgMCkgICAgLyogRGlzY29ubmVjdGVkICovCisjZGVmaW5lIExJTktfQk9PVDEgICAgICAgICAoKHVzaG9ydCkgMSkgICAgLyogVHJ5aW5nIHRvIHNlbmQgMXN0IHN0YWdlIGJvb3QgKi8KKyNkZWZpbmUgTElOS19CT09UMiAgICAgICAgICgodXNob3J0KSAyKSAgICAvKiBUcnlpbmcgdG8gc2VuZCAybmQgc3RhZ2UgYm9vdCAqLworI2RlZmluZSBMSU5LX0JPT1QyV0FJVCAgICAgKCh1c2hvcnQpIDMpICAgIC8qIFdhaXRpbmcgZm9yIHNlbGZ0ZXN0IHJlc3VsdHMgKi8KKyNkZWZpbmUgTElOS19CT09UMyAgICAgICAgICgodXNob3J0KSA0KSAgICAvKiBUcnlpbmcgdG8gc2VuZCAzcmQgc3RhZ2UgYm9vdHMgKi8KKyNkZWZpbmUgTElOS19TWU5DICAgICAgICAgICgodXNob3J0KSA1KSAgICAvKiBTeW5jaW5nICovCisKKyNkZWZpbmUgTElOS19JTlRSTyAgICAgICAgICgodXNob3J0KSAxMCkgICAgLyogSW50cm9kdWN0b3J5IHBhY2tldCAqLworI2RlZmluZSBMSU5LX1NVUFBMWUlEICAgICAgKCh1c2hvcnQpIDExKSAgICAvKiBUcnlpbmcgdG8gc3VwcGx5IGFuIElEICovCisjZGVmaW5lIExJTktfVE9QT0xPR1kgICAgICAoKHVzaG9ydCkgMTIpICAgIC8qIFNlbmQgYSB0b3BvbG9neSB1cGRhdGUgKi8KKyNkZWZpbmUgTElOS19SRVFVRVNUSUQgICAgICgodXNob3J0KSAxMykgICAgLyogV2FpdGluZyBmb3IgYW4gSUQgKi8KKyNkZWZpbmUgTElOS19DT05ORUNURUQgICAgICgodXNob3J0KSAxNCkgICAgLyogQ29ubmVjdGVkICovCisKKyNkZWZpbmUgTElOS19JTlRFUkNPTk5FQ1QgICgodXNob3J0KSAyMCkgICAvKiBTdWJuZXRzIGludGVyY29ubmVjdGVkICovCisKKyNkZWZpbmUgTElOS19TUEFSRQkgICAoKHVzaG9ydCkgNDApCisKKy8qCisqKiBTZXQgdGhlIGRlZmF1bHQgdGltZW91dCBmb3IgbGluayBjb21tdW5pY2F0aW9ucy4KKyovCisjZGVmaW5lCUxJTktUSU1FT1VUCQkoNDAwICogTUlMTElTRUNPTkQpCisKKy8qCisqKiBMRUQgc3R1ZmYKKyovCisjaWYgZGVmaW5lZChSVEEpCisjZGVmaW5lIExFRF9PRkYgICAgICAgICAgICAoKHVzaG9ydCkgMCkgICAgLyogTEVEIG9mZiAqLworI2RlZmluZSBMRURfUkVEICAgICAgICAgICAgKCh1c2hvcnQpIDEpICAgIC8qIExFRCBSZWQgKi8KKyNkZWZpbmUgTEVEX0dSRUVOICAgICAgICAgICgodXNob3J0KSAyKSAgICAvKiBMRUQgR3JlZW4gKi8KKyNkZWZpbmUgTEVEX09SQU5HRSAgICAgICAgICgodXNob3J0KSA0KSAgICAvKiBMRUQgT3JhbmdlICovCisjZGVmaW5lIExFRF8xVE84X09QRU4gICAgICAoKHVzaG9ydCkgMSkgICAgLyogUG9ydCAxLT44IExFRCBvbiAqLworI2RlZmluZSBMRURfOVRPMTZfT1BFTiAgICAgKCh1c2hvcnQpIDIpICAgIC8qIFBvcnQgOS0+MTYgTEVEIG9uICovCisjZGVmaW5lIExFRF9TRVRfQ09MT1VSKGNvbG91cikJKGxpbmstPmxlZCA9IChjb2xvdXIpKQorI2RlZmluZSBMRURfT1JfQ09MT1VSKGNvbG91cikJKGxpbmstPmxlZCB8PSAoY29sb3VyKSkKKyNkZWZpbmUgTEVEX1RJTUVPVVQodGltZSkgICAgKGxpbmstPmxlZF90aW1lb3V0ID0gUmlvVGltZVBsdXMoUmlvVGltZSgpLCh0aW1lKSkpCisjZWxzZQorI2RlZmluZSBMRURfU0VUX0NPTE9VUihjb2xvdXIpCisjZGVmaW5lIExFRF9PUl9DT0xPVVIoY29sb3VyKQorI2RlZmluZSBMRURfVElNRU9VVCh0aW1lKQorI2VuZGlmIC8qIFJUQSAqLworCitzdHJ1Y3QgTFBCIHsKKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbGlua19udW1iZXIgOyAgICAgICAvKiBMaW5rIE51bWJlciAqLworICAgICAgICAgICAgICAgQ2hhbm5lbF9wdHIgICBpbl9jaCA7ICAgICAgICAgICAgIC8qIExpbmsgSW4gQ2hhbm5lbCAqLworICAgICAgICAgICAgICAgQ2hhbm5lbF9wdHIgICBvdXRfY2ggOyAgICAgICAgICAgIC8qIExpbmsgT3V0IENoYW5uZWwgKi8KKyNpZmRlZiBSVEEKKyAgICAgICAgICAgICAgIHVjaGFyICAgICAgICBzdGF0X2xlZCA7ICAgICAgICAgIC8qIFBvcnQgb3BlbiBsZWRzICovCisgICAgICAgICAgICAgICB1Y2hhciAgICAgICAgbGVkIDsgICAgICAgICAgICAgICAvKiBUcnVlLCBsaWdodCBsZWQhICovCisjZW5kaWYKKyAgICAgICAgICAgICAgIEJZVEUgYXR0YWNoZWRfc2VyaWFsWzRdOyAvKiBBdHRhY2hlZCBzZXJpYWwgbnVtYmVyICovCisgICAgICAgICAgICAgICBCWVRFIGF0dGFjaGVkX2hvc3Rfc2VyaWFsWzRdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNlcmlhbCBudW1iZXIgb2YgSG9zdCB3aG8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib290ZWQgdGhlIG90aGVyIGVuZCAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBkZXNjaGVkdWxlZCA7ICAgICAgIC8qIEN1cnJlbnRseSBEZXNjaGVkdWxlZCAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBzdGF0ZTsgICAgICAgICAgICAgIC8qIEN1cnJlbnQgc3RhdGUgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgc2VuZF9wb2xsIDsgICAgICAgICAvKiBTZW5kIGEgUG9sbCBQYWNrZXQgKi8KKyAgICAgICAgICAgICAgIFByb2Nlc3NfcHRyICAgbHR0X3AgOyAgICAgICAgICAgICAvKiBQcm9jZXNzIERlc2NyaXB0b3IgKi8KKyAgICAgICAgICAgICAgIFByb2Nlc3NfcHRyICAgbHJ0X3AgOyAgICAgICAgICAgICAvKiBQcm9jZXNzIERlc2NyaXB0b3IgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbHJ0X3N0YXR1cyA7ICAgICAgICAvKiBDdXJyZW50IGxydCBzdGF0dXMgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbHR0X3N0YXR1cyA7ICAgICAgICAvKiBDdXJyZW50IGx0dCBzdGF0dXMgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgdGltZW91dCA7ICAgICAgICAgICAvKiBUaW1lb3V0IHZhbHVlICovCisgICAgICAgICAgICAgICBXT1JEICAgICAgICAgIHRvcG9sb2d5OyAgICAgICAgICAgLyogVG9wb2xvZ3kgYml0cyAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBtb25fbHR0IDsKKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbW9uX2xydCA7CisgICAgICAgICAgICAgICBXT1JEICAgICAgICAgIFdhaXROb0Jvb3QgOwkgLyogU2VjcyB0byBob2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ICAgICAgIFBLVF9wdHJfcHRyICAgcmRfcmVtb3ZlX3N0X3FiYiA7ICAvKiBQb2ludGVyIHRvIHRoZSBzdGFydCBvZiB0aGUgUSBidWYgKi8KKyAgICAgICAgICAgICAgIFBLVF9wdHJfcHRyICAgcmRfcmVtb3ZlX2VuZF9xYmIgOyAvKiBQb2ludGVyIHRvIHRoZSBlbmQgb2YgdGhlIFEgYnVmICovCisgICAgICAgICAgICAgICB1c2hvcnQgICAgICAgIHBrdHNfaW5fcSA7ICAgICAgICAgLyogUGFja2V0cyBpbiBxdWV1ZSAqLworI2VuZGlmCisKKyAgICAgICAgICAgICAgIENoYW5uZWxfcHRyICAgbHJ0X2ZhaWxfY2hhbiA7ICAgICAvKiBMcnQncyBmYWlsdXJlIGNoYW5uZWwgKi8KKyAgICAgICAgICAgICAgIENoYW5uZWxfcHRyICAgbHR0X2ZhaWxfY2hhbiA7ICAgICAvKiBMdHQncyBmYWlsdXJlIGNoYW5uZWwgKi8KKworI2lmIGRlZmluZWQgKEhPU1QpIHx8IGRlZmluZWQgKElOS0VSTkVMKQorIC8qIFJVUCBzdHJ1Y3R1cmUgZm9yIEhPU1QgdG8gZHJpdmVyIGNvbW11bmljYXRpb25zICovCisgICAgICAgICAgICAgICBzdHJ1Y3QgUlVQICAgICAgICAgICBydXAgOyAgICAgICAgICAgICAgCisjZW5kaWYKKyAgICAgICAgICAgICAgIHN0cnVjdCBSVVAgICAgICAgICAgIGxpbmtfcnVwOyAgICAgICAgICAgLyogUlVQIGZvciB0aGUgbGluayAoUE9MTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3BvbG9neSBldGMuKSAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBhdHRhY2hlZF9saW5rIDsgICAgIC8qIE51bWJlciBvZiBhdHRhY2hlZCBsaW5rICovCisgICAgICAgICAgICAgICBXT1JEICAgICAgICAgIGNzdW1fZXJyb3JzIDsgICAgICAgLyogY3N1bSBlcnJvcnMgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbnVtX2Rpc2Nvbm5lY3RzIDsgICAvKiBudW1iZXIgb2YgZGlzY29ubmVjdHMgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbnVtX3N5bmNfcmN2ZCA7ICAgICAvKiAjIHN5bmMncyByZWNlaXZlZCAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBudW1fc3luY19ycXN0IDsgICAgIC8qICMgc3luYyByZXF1ZXN0cyAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBudW1fdHggOyAgICAgICAgICAgIC8qIE51bSBwa3RzIHNlbnQgKi8KKyAgICAgICAgICAgICAgIFdPUkQgICAgICAgICAgbnVtX3J4IDsgICAgICAgICAgICAvKiBOdW0gcGt0cyByZWNlaXZlZCAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBtb2R1bGVfYXR0YWNoZWQ7ICAgIC8qIE1vZHVsZSB0cHllcyBvZiBhdHRhY2hlZCAqLworICAgICAgICAgICAgICAgV09SRCAgICAgICAgICBsZWRfdGltZW91dDsgICAgICAgIC8qIExFRCB0aW1lb3V0ICovCisgICAgICAgICAgICAgICBXT1JEICAgICAgICAgIGZpcnN0X3BvcnQ7ICAgICAgICAgLyogRmlyc3QgcG9ydCB0byBzZXJ2aWNlICovCisgICAgICAgICAgICAgICBXT1JEICAgICAgICAgIGxhc3RfcG9ydDsgICAgICAgICAgLyogTGFzdCBwb3J0IHRvIHNlcnZpY2UgKi8KKyAgICAgICAgICAgfSA7CisKKyNlbmRpZgorCisvKioqKioqKioqKiogZW5kIG9mIGZpbGUgKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2xpbnV4X2NvbXBhdC5oIGIvZHJpdmVycy9jaGFyL3Jpby9saW51eF9jb21wYXQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5kNTM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klPX0IxMTUyMDAJCTB4MTMJCQkvKiAxMTUyMDAgYmF1ZCAqLworI2RlZmluZQlSSU9fQjIwMDAJCTB4MTQJCQkvKiAyMDAwIGJhdWQgKi8KKworCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2xpc3QuaCBiL2RyaXZlcnMvY2hhci9yaW8vbGlzdC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmE0ZjdmMWYKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2xpc3QuaApAQCAtMCwwICsxLDE5NiBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICBMIEkgUyBUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSmVyZW15IFJvbGxzLgorIERhdGUgICAgOiAwNC1Ob3YtMTk5MAorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIgdGhlIHRlcm1zI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NkZWZpbmUgY2FuX3JlbW92ZV90cmFuc21pdChwa3QscGhiKSAoKCgoY2hhciopcGt0ID0gKCooY2hhcioqKShwaGItPnR4X3JlbW92ZSkpLTEpIHx8IDEpKSAmJiAoKnBoYi0+dTMuczIudHhfcmVtb3ZlX3B0ciAmIFBLVF9JTl9VU0UpKSAgICovCisjZGVmaW5lIHJlbW92ZV90cmFuc21pdChwaGIpICpwaGItPnUzLnMyLnR4X3JlbW92ZV9wdHIgJj0gfih1c2hvcnQpUEtUX0lOX1VTRTtcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwaGItPnR4X3JlbW92ZSA9PSBwaGItPnR4X2VuZClcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYi0+dHhfcmVtb3ZlID0gcGhiLT50eF9zdGFydDtcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYi0+dHhfcmVtb3ZlKys7CisjZGVmaW5lIGNhbl9hZGRfcmVjZWl2ZShwaGIpICEoKnBoYi0+dTQuczIucnhfYWRkX3B0ciAmIFBLVF9JTl9VU0UpCisjZGVmaW5lIGFkZF9yZWNlaXZlKHBrdCxwaGIpICpwaGItPnJ4X2FkZCA9IHBrdDtcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpwaGItPnU0LnMyLnJ4X2FkZF9wdHIgfD0gUEtUX0lOX1VTRTtcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwaGItPnJ4X2FkZCA9PSBwaGItPnJ4X2VuZClcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYi0+cnhfYWRkID0gcGhiLT5yeF9zdGFydDtcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYi0+cnhfYWRkKys7CisjZW5kaWYKKyNlbmRpZgorCisjaWZkZWYgUlRBCisjZGVmaW5lIHNwbHgob2xkc3BsKSAgICBpZiAoKG9sZHNwbCkgPT0gMCkgc3BsMCgpCisjZW5kaWYKKworI2VuZGlmIC8qIGlmbmRlZiBfbGlzdC5oICovCisvKioqKioqKioqKiogZW5kIG9mIGZpbGUgKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL2xydC5oIGIvZHJpdmVycy9jaGFyL3Jpby9scnQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5iYmFjOGZhCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9scnQuaApAQCAtMCwwICsxLDU1IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgIEwgUiBUCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBJYW4gTmFuZGhyYSAvIEplcmVteSBSb2xscworIERhdGUgICAgOgorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlU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yaXB0aW9uCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIGxpbnQKKyNpZmRlZiBTQ0NTX0xBQkVMUworc3RhdGljIGNoYXIgKl9yaW9fbHJ0X2hfc2NjcyA9ICJAKCMpbHJ0LmgJMS4xIiA7CisjZW5kaWYKKyNlbmRpZgorCisKKyNpZmRlZiBEQ0lSUlVTCisjZGVmaW5lIExSVF9TVEFDSyAgICAgICAodW5zaWduZWQgc2hvcnQpIDYwMAorI2Vsc2UKKyNkZWZpbmUgTFJUX1NUQUNLICAgICAgICAodXNob3J0KSAyMDAKKyNlbmRpZgorCisKKworLyoqKioqKioqKioqIGVuZCBvZiBmaWxlICoqKioqKioqKioqLworCisKKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9sdHQuaCBiL2RyaXZlcnMvY2hhci9yaW8vbHR0LmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZjI3ZGNlYwotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9yaW8vbHR0LmgKQEAgLTAsMCArMSw1NSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICBMIFQgVAorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyA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UgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmZlMTdkMGUKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL2x0dHdha2UuaApAQCAtMCwwICsxLDUzIEBACisKKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgICAgICAgTCBUIFQgICAgVyBBIEsgRSBVIFAgICAgSCBFIEEgRCBFIFIKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yICA6IElhbiBOYW5kaHJhCisgRGF0ZSAgICA6CisKKyAqCisgKiAgKEMpIDE5OTAgLSAyMDAwIFNwZWNpYWxpeCBJbnRlcm5hdGlvbmFsIEx0ZC4sIEJ5ZmxlZXQsIFN1cnJleSwgVUsuCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQorICogICAgICBpdCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hlZCBieQorICogICAgICB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBlaXRoZXIgdmVyc2lvbiAyIG9mIHRoZSBMaWNlbnNlLCBvcgorICogICAgICAoYXQgeW91ciBvcHRpb24pIGFueSBsYXRlciB2ZXJzaW9uLgorICoKKyAqICAgICAgVGh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0ZXJhbC1uZXh0IGNoYXJhY3RlciAqLworICAgIEJZVEUgICAgVHhCYXVkOwkvKiBUcmFuc21pdCBiYXVkcmF0ZSAqLworICAgIEJZVEUgICAgUnhCYXVkOwkvKiBSZWNlaXZlIGJhdWRyYXRlICovCit9OworCisjZW5kaWYKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vcGFybW1hcC5oIGIvZHJpdmVycy9jaGFyL3Jpby9wYXJtbWFwLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNDZmOTlkZgotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9yaW8vcGFybW1hcC5oCkBAIC0wLDAgKzEsOTYgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICBIIE8gUyBUICAgTSBFIE0gTyBSIFkgIE0gQSBQCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBJYW4gTmFuZGhyYSAvIEplcmVteSBSb2xscworIERhdGUgICAgOgorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAq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EVfcHRyICAgICAgICAgIHVuaXRfaWRfcHRyIDsgICAgICAgICAgLyogVW5pdCBJZCAqLworTFBCX3B0ciAgICAgICAgICAgbGlua19zdHJfcHRyIDsgICAgICAgICAvKiBMaW5rIFN0cnVjdHVyZSBBcnJheSAqLworQllURV9wdHIgICAgICAgICAgYm9vdGxvYWRlcl8xIDsgICAgICAgICAvKiAxc3QgU3RhZ2UgQm9vdCBMb2FkZXIgKi8KK0JZVEVfcHRyICAgICAgICAgIGJvb3Rsb2FkZXJfMiA7ICAgICAgICAgLyogMm5kIFN0YWdlIEJvb3QgTG9hZGVyICovCitXT1JEX3B0ciAgICAgICAgICBwb3J0X3JvdXRlX21hcF9wdHIgOyAgIC8qIFBvcnQgUm91dGUgTWFwICovCitST1VURV9TVFJfcHRyICAgICByb3V0ZV9wdHIgOyAgICAgICAgICAgIC8qIFVuaXQgUm91dGUgTWFwICovCitOVU1CRVJfcHRyICAgICAgICBtYXBfcHJlc2VudCA7ICAgICAgICAgIC8qIFJvdXRlIE1hcCBwcmVzZW50ICovCitOVU1CRVIgICAgICAgICAgICBwa3RfbnVtIDsgICAgICAgICAgICAgICAvKiBUb3RhbCBudW1iZXIgb2YgcGFja2V0cyAqLworTlVNQkVSICAgICAgICAgICAgcV9udW0gOyAgICAgICAgICAgICAgICAgLyogVG90YWwgbnVtYmVyIG9mIFEgcGFja2V0cyAqLworV09SRCAgICAgICAgICAgICAgYnVmZmVyc19wZXJfcG9ydCA7ICAgICAgLyogTnVtYmVyIG9mIGJ1ZmZlcnMgcGVyIHBvcnQgKi8KK1dPUkQgICAgICAgICAgICAgIGhlYXBfc2l6ZSA7ICAgICAgICAgICAgIC8qIEluaXRpYWwgc2l6ZSBvZiBoZWFwICovCitXT1JEICAgICAgICAgICAgICBoZWFwX2xlZnQgOyAgICAgICAgICAgICAvKiBDdXJyZW50IEhlYXAgbGVmdCAqLworV09SRCAgICAgICAgICAgICAgZXJyb3IgOyAgICAgICAgICAgICAgICAgLyogRXJyb3IgY29kZSAqLworV09SRCAgICAgICAgICAgICAgdHhfbWF4OyAgICAgICAgICAgICAgICAgLyogTWF4IG51bWJlciBvZiB0eCBwa3RzIHBlciBwaGIgKi8KK1dPUkQgICAgICAgICAgICAgIHJ4X21heDsgICAgICAgICAgICAgICAgIC8qIE1heCBudW1iZXIgb2YgcnggcGt0cyBwZXIgcGhiICovCitXT1JEICAgICAgICAgICAgICByeF9saW1pdDsgICAgICAgICAgICAgICAvKiBGb3IgaGlnaCAvIGxvdyB3YXRlcm1hcmtzICovCitOVU1CRVIgICAgICAgICAgICBsaW5rcyA7ICAgICAgICAgICAgICAgICAvKiBMaW5rcyB0byB1c2UgKi8KK05VTUJFUiAgICAgICAgICAgIHRpbWVyIDsgICAgICAgICAgICAgICAgIC8qIEludGVycnVwdHMgcGVyIHNlY29uZCAqLworUlVQX3B0ciAgICAgICAgICAgcnVwcyA7ICAgICAgICAgICAgICAgICAvKiBQb2ludGVyIHRvIHRoZSBSVVBzICovCitXT1JEICAgICAgICAgICAgICBtYXhfcGhiIDsgICAgICAgICAgICAgIC8qIE1vc3RseSBmb3IgZGVidWdnaW5nICovCitXT1JEICAgICAgICAgICAgICBsaXZpbmcgOyAgICAgICAgICAgICAgIC8qIEp1c3QgaW5jcmVtZW50cyEhICovCitXT1JEICAgICAgICAgICAgICBpbml0X2RvbmUgOyAgICAgICAgICAgIC8qIEluaXRpYWxpc2F0aW9uIG92ZXIgKi8KK1dPUkQgICAgICAgICAgICAgIGJvb3RpbmdfbGluayA7CitXT1JEICAgICAgICAgICAgICBpZGxlX2NvdW50IDsgICAgICAgICAgIC8qIElkbGUgdGltZSBjb3VudGVyICovCitXT1JEICAgICAgICAgICAgICBidXN5X2NvdW50IDsgICAgICAgICAgIC8qIEJ1c3kgY291bnRlciAqLworV09SRCAgICAgICAgICAgICAgaWRsZV9jb250cm9sIDsgICAgICAgICAvKiBDb250cm9sIElkbGUgUHJvY2VzcyAqLworI2lmIGRlZmluZWQoSE9TVCkgfHwg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yNkZWZpbmUgUklPX1BDSV9CQURSMAkJMHgwMDEwCisjZGVmaW5lIFJJT19QQ0lfSU5UTE4JCTB4MDAzQworI2RlZmluZSBSSU9fUENJX0lOVFBJTgkJMHgwMDNECisKKyNkZWZpbmUJUklPX1BDSV9NRU1fU0laRQk2NTUzNgorCisjZGVmaW5lCVJJT19QQ0lfVFVSQk9fVFAJMHg4MAorI2RlZmluZQlSSU9fUENJX0ZBU1RfTElOS1MJMHg0MAorI2RlZmluZQlSSU9fUENJX0lOVF9FTkFCTEUJMHgwNAorI2RlZmluZQlSSU9fUENJX1RQX0JVU19FTkFCTEUJMHgwMgorI2RlZmluZQlSSU9fUENJX0JPT1RfRlJPTV9SQU0JMHgwMQorCisjZGVmaW5lCVJJT19QQ0lfREVGQVVMVF9NT0RFCTB4MDUKKworI2VuZGlmCS8qIF9fcmlvX3BjaV9oX18gKi8KZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vcGhiLmggYi9kcml2ZXJzL2NoYXIvcmlvL3BoYi5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmUxNDgzYTAKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3BoYi5oCkBAIC0wLDAgKzEsMjkzIEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICBQIEggQiAgICAgSCBFIEEgRCBFIFIgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKio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yB3aXRoIHRoaXMgcHJvZ3JhbTsgaWYgbm90LCB3cml0ZSB0byB0aGUgRnJlZSBTb2Z0d2FyZQorICogICAgICBGb3VuZGF0aW9uLCBJbmMuLCA2NzUgTWFzcyBBdmUsIENhbWJyaWRnZSwgTUEgMDIxMzksIFVTQS4KKworIFZlcnNpb24gOiAwLjAxCisKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1vZHMKKyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgIERhdGUgICAgIEJ5ICAgICAgICAgICAgICAgIERlc2NyaXB0aW9uCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIF9waGJfaAorI2RlZmluZSBfcGhiX2ggMQorCisjaWZkZWYgU0NDU19MQUJFTFMKKyNpZm5kZWYgbGludAorLyogc3RhdGljIGNoYXIgKl9yaW9fcGhiX2hfc2NjcyA9ICJAKCMpcGhiLmgJMS4xMiI7ICovCisjZW5kaWYKKyNlbmRpZgorCisKKyAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAqIFNldCB0aGUgTElNSVQgdmFsdWVzLgorICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaWZkZWYgUlRBCisjZGVmaW5lIFJYX0xJTUlUICAgICAgICh1c2hvcnQpIDMKKyNlbmRpZgorI2lmZGVmIEhPU1QKKyNkZWZpbmUgUlhfTElNSVQgICAgICAgKHVzaG9ydCkgMQorI2VuZGlmCisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIEhhbmRzaGFrZSBhc3NlcnRlZC4gRGVhc3NlcnRlZCBieSB0aGUgTFRUKHMpCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBQSEJfSEFORFNIQUtFX1NFVCAgICAgICgodXNob3J0KSAweDAwMSkgLyogU2V0IGJ5IExSVCAqLworCisjZGVmaW5lIFBIQl9IQU5EU0hBS0VfUkVTRVQgICAgICgodXNob3J0KSAweDAwMikgLyogU2V0IGJ5IElTUiAvIGRyaXZlciAqLworCisjZGVmaW5lIFBIQl9IQU5EU0hBS0VfRkxBR1MgICAgIChQSEJfSEFORFNIQUtFX1JFU0VUIHwgUEhCX0hBTkRTSEFLRV9TRVQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBSZXNldCBieSBsdHQgKi8KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogTWF4aW11bSBudW1iZXIgb2YgUEhCJ3MKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaWYgZGVmaW5lZCAoSE9TVCkgfHwgZGVmaW5lZCAoSU5LRVJORUwpCisjZGVmaW5lIE1BWF9QSEIgICAgICAgICAgICAgICAoKHVzaG9ydCkgMTI4KSAgLyogcmFuZ2UgMC0xMjcgKi8KKyNlbHNlCisjZGVmaW5lIE1BWF9QSEIgICAgICAgICAgICAgICAoKHVzaG9ydCkgOCkgICAgLyogcmFuZ2UgMC03ICovCisjZW5kaWYKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIERlZmluZXMgZm9yIHRoZSBtb2RlIGZpZWxkcworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgVFhQS1RfSU5DT01QTEVURSAgICAgICAgMHgwMDAxICAvKiBQcmV2aW91cyB0eCBwYWNrZXQgbm90IGNvbXBsZXRlZCAqLworI2RlZmluZSBUWElOVFJfRU5BQkxFRCAgICAgICAgICAweDAwMDIgIC8qIFR4IGludGVycnVwdCBpcyBlbmFibGVkICovCisjZGVmaW5lIFRYX1RBQjMgICAgICAgICAgICAgICAgIDB4MDAwNCAgLyogVEFCMyBtb2RlICovCisjZGVmaW5lIFRYX09DUk5MICAgICAgICAgICAgICAgIDB4MDAwOCAgLyogT0NSTkwgbW9kZSAqLworI2RlZmluZSBUWF9PTkxDUiAgICAgICAgICAgICAgICAweDAwMTAgIC8qIE9OTENSIG1vZGUgKi8KKyNkZWZpbmUgVFhfU0VORFNQQUNFUyAgICAgICAgICAgMHgwMDIwICAvKiBTZW5kIG4gc3BhY2VzIGNvbW1hbmQgbmVlZHMgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcGxldGluZyAqLworI2RlZmluZSBUWF9TRU5ETlVMTCAgICAgICAgICAgICAweDAwNDAgIC8qIEVzY2FwaW5nIE5VTEwgbmVlZHMgY29tcGxldGluZyAqLworI2RlZmluZSBUWF9TRU5ETEYgICAgICAgICAgICAgICAweDAwODAgIC8qIExGIC0+IENSIExGIG5lZWRzIGNvbXBsZXRpbmcgKi8KKyNkZWZpbmUgVFhfUEFSQUxMRUxCVUcgICAgICAgICAgMHgwMTAwICAvKiBDRDE0MDAgTEYgLT4gQ1IgTEYgYnVnIG9uIHBhcmFsbGVsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9ydCAqLworI2RlZmluZSBUWF9IQU5HT1ZFUiAgICAgICAgICAgICAoVFhfU0VORFNQQUNFUyB8IFRYX1NFTkRMRiB8IFRYX1NFTkROVUxMKQorI2RlZmluZSBUWF9EVFJGTE9XCQkweDAyMDAJLyogRFRSIHR4IGZsb3cgY29udHJvbCAqL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UkVTVFJJQ1RFRCAgICAgICAgIDB4MDYwMCAgLyogUmVzdHJpY3RlZCBjb25uZWN0b3IgLSBubyBSSSAvIERUUiAqLworCisjZGVmaW5lIFBPUlRfTU9ERU1CSVRTICAgICAgICAgIDB4MDYwMCAgLyogTWFzayBmb3IgbW9kZW0gZmllbGRzICovCisKKyNkZWZpbmUgUE9SVF9XQ0xPU0UgICAgICAgICAgICAgMHgwODAwICAvKiBXYWl0aW5nIGZvciBjbG9zZSAqLworI2RlZmluZQlQT1JUX0hBTkRTSEFLRUZJWAkweDEwMDAJLyogUG9ydCBoYXMgSC9XIGZsb3cgY29udHJvbCBmaXggKi8KKyNkZWZpbmUJUE9SVF9XQVNQQ0xPU0VECQkweDIwMDAJLyogUG9ydCBjbG9zZWQgd2l0aCBQQ0xPU0UgKi8KKyNkZWZpbmUJRFVNUE1PREUJCTB4NDAwMAkvKiBEdW1wIFJUQSBtZW0gKi8KKyNkZWZpbmUJUkVBRF9SRUcJCTB4ODAwMAkvKiBSZWFkIENEMTQwMCByZWdpc3RlciAqLworCisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBQSEIgU3RydWN0dXJlCisgKiBBICBmZXcgd29yZHMuCisgKgorICogTm9ybWFsbHkgUGFja2V0cyBhcmUgYWRkZWQgdG8gdGhlIGVuZCBvZiB0aGUgbGlzdCBhbmQgcmVtb3ZlZCBmcm9tCisgKiB0aGUgc3RhcnQuIFRoZSBwb2ludGVyIHR4X2FkZCBwb2ludHMgdG8gYSBTUEFDRSB0byBwdXQgYSBQYWNrZXQuCisgKiBUaGUgcG9pbnRlciB0eF9yZW1vdmUgcG9pbnRzIHRvIHRoZSBuZXh0IFBhY2tldCB0byByZW1vdmUKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2lmbmRlZiBJTktFUk5FTAorI2RlZmluZSBzcmNfdW5pdCAgICAgdTIuczIudW5pdAorI2RlZmluZSBzcmNfcG9ydCAgICAgdTIuczIucG9ydAorI2RlZmluZSBkZXN0X3VuaXQgICAgdTEuczEudW5pdAorI2RlZmluZSBkZXN0X3BvcnQgICAgdTEuczEucG9ydAorI2VuZGlmCisjaWZkZWYgSE9TVAorI2RlZmluZSB0eF9zdGFydCAgICAgdTMuczEudHhfc3RhcnRfcHRyX3B0cgorI2RlZmluZSB0eF9hZGQgICAgICAgdTMuczEudHhfYWRkX3B0cl9wdHIKKyNkZWZpbmUgdHhfZW5kICAgICAgIHUzLnMxLnR4X2VuZF9wdHJfcHRyCisjZGVmaW5lIHR4X3JlbW92ZSAgICB1My5zMS50eF9yZW1vdmVfcHRyX3B0cgorI2RlZmluZSByeF9zdGFydCAgICAgdTQuczEucnhfc3RhcnRfcHRyX3B0cgorI2RlZmluZSByeF9hZGQgICAgICAgdTQuczEucnhfYWRkX3B0cl9wdHIKKyNkZWZpbmUgcnhfZW5kICAgICAgIHU0LnMxLnJ4X2VuZF9wdHJfcHRyCisjZGVmaW5lIHJ4X3JlbW92ZSAgICB1NC5zMS5yeF9yZW1vdmVfcHRyX3B0cgorI2VuZGlmCit0eXBlZGVmIHN0cnVjdCBQSEIgUEhCIDsKK3N0cnVjdCBQSEIgeworI2lmZGVmIFJUQQorICAgICAgICB1c2hvcnQgICAgICBwb3J0OworI2VuZGlmCisjaWZkZWYgSU5LRVJORUwKKyAgICAgICAgV09SRCAgICAgIHNvdXJjZTsKKyNlbHNlCisgICAgICAgIHVuaW9uICAgICAgIAorICAgICAgICB7CisgICAgICAgICAgICB1c2hvcnQgc291cmNlOyAgICAgICAgICAgICAgLyogQ29tcGxldGUgc291cmNlICovCisgICAgICAgICAgICBzdHJ1Y3QKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB1bnNpZ25lZCBjaGFyIHVuaXQ7ICAgICAvKiBTb3VyY2UgdW5pdCAqLworICAgICAgICAgICAgICAgIHVuc2lnbmVkIGNoYXIgcG9ydDsgICAgIC8qIFNvdXJjZSBwb3J0ICovCisgICAgICAgICAgICB9IHMyOworICAgICAgICB9IHUyOworI2VuZGlmCisgICAgICAgIFdPUkQgICAgICBoYW5kc2hha2UgOworICAgICAgICBXT1JEICAgICAgc3RhdHVzIDsKKyAgICAgICAgTlVNQkVSICAgICAgIHRpbWVvdXQgOyAgICAgICAgICAgLyogTWF4aW11bSBvZiAxLjkgc2Vjb25kcyAqLworICAgICAgICBXT1JEICAgICAgbGluayA7ICAgICAgICAgICAgICAvKiBTZW5kIGRvd24gdGhpcyBsaW5rICovCisjaWZkZWYgSU5LRVJORUwKKyAgICAgICAgV09SRCAgICAgIGRlc3RpbmF0aW9uOworI2Vsc2UKKyAgICAgICAgdW5pb24gICAgICAgCisgICAgICAgIHsKKyAgICAgICAgICAgIHVzaG9ydCBkZXN0aW5hdGlvbjsgICAgICAgICAvKiBDb21wbGV0ZSBkZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgc3RydWN0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdW5zaWduZWQgY2hhciB1bml0OyAgICAgLyogRGVzdGluYXRpb24gdW5pdCAqLworICAgICAgICAgICAgICAgIHVuc2lnbmVkIGNoYXIgcG9ydDsgICAgIC8qIERlc3RpbmF0aW9uIHBvcnQgKi8KKyAgICAgICAgICAgIH0gczE7CisgICAgICAgIH0gdTE7CisjZW5kaWYKKyNpZmRlZiBSVEEKKyAgICAgICAgdXNob3J0ICAgICAgdHhfcGt0c19hZGRlZDsKKyAgICAgICAgdXNob3J0ICAgICAgdHhfcGt0c19yZW1vdmVkOworICAgICAgICBRX0JVRl9wdHIgICB0eF9xX3N0YXJ0IDsgICAgICAgIC8qIFN0YXJ0IG9mIHRoZSBRIGxpc3QgY2hhaW4gKi8KKyAgICAgICAgc2hvcnQgICAgICAgbnVtX3R4X3FfYnVmcyA7ICAgICAvKiBOdW1iZXIgb2YgUSBidWZmZ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ICAgICAgeworICAgICAgICAgICAgc3RydWN0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgUEtUX3B0cl9wdHIgdHhfc3RhcnRfcHRyX3B0cjsKKyAgICAgICAgICAgICAgICBQS1RfcHRyX3B0ciB0eF9lbmRfcHRyX3B0cjsKKyAgICAgICAgICAgICAgICBQS1RfcHRyX3B0ciB0eF9hZGRfcHRyX3B0cjsKKyAgICAgICAgICAgICAgICBQS1RfcHRyX3B0ciB0eF9yZW1vdmVfcHRyX3B0cjsKKyAgICAgICAgICAgIH0gczE7CisgICAgICAgICAgICBzdHJ1Y3QKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB1c2hvcnQgKiB0eF9zdGFydF9wdHI7CisgICAgICAgICAgICAgICAgdXNob3J0ICogdHhfZW5kX3B0cjsKKyAgICAgICAgICAgICAgICB1c2hvcnQgKiB0eF9hZGRfcHRyOworICAgICAgICAgICAgICAgIHVzaG9ydCAqIHR4X3JlbW92ZV9wdHI7CisgICAgICAgICAgICB9IHMyOworICAgICAgICB9IHUzOworI2VuZGlmCisKKyNpZmRlZiAgUlRBCisgICAgICAgIHVzaG9ydCAgICAgIHJ4X3BrdHNfYWRkZWQ7CisgICAgICAgIHVzaG9ydCAgICAgIHJ4X3BrdHNfcmVtb3ZlZDsKKyAgICAgICAgUV9CVUZfcHRyICAgcnhfcV9zdGFydCA7ICAgICAgICAvKiBTdGFydCBvZiB0aGUgUSBsaXN0IGNoYWluICovCisgICAgICAgIHNob3J0ICAgICAgIG51bV9yeF9xX2J1ZnMgOyAgICAgLyogTnVtYmVyIG9mIFEgYnVmZmVycyBpbiB0aGUgY2hhaW4gKi8KKyAgICAgICAgUEtUX3B0cl9wdHIgcnhfYWRkIDsgICAgICAgICAgICAvKiBBZGQgYSBuZXcgUGFja2V0IGhlcmUgKi8KKyAgICAgICAgUV9CVUZfcHRyICAgcnhfYWRkX3FiIDsgICAgICAgICAvKiBQb2ludGVyIHRvIHRoZSBhZGQgUSBid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RkX3B0cl9wdHI7CisgICAgICAgICAgICAgICAgUEtUX3B0cl9wdHIgcnhfcmVtb3ZlX3B0cl9wdHI7CisgICAgICAgICAgICB9IHMxOworICAgICAgICAgICAgc3RydWN0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdXNob3J0ICogcnhfc3RhcnRfcHRyOworICAgICAgICAgICAgICAgIHVzaG9ydCAqIHJ4X2VuZF9wdHI7CisgICAgICAgICAgICAgICAgdXNob3J0ICogcnhfYWRkX3B0cjsKKyAgICAgICAgICAgICAgICB1c2hvcnQgKiByeF9yZW1vdmVfcHRyOworICAgICAgICAgICAgfSBzMjsKKyAgICAgICAgfSB1NDsKKyNlbmRpZgorCisjaWZkZWYgUlRBICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogc29tZSBmaWVsZHMgZm9yIHRoZSByZW1vdGVzICovCisgICAgICAgIHVzaG9ydCAgICAgZmx1c2hfY291bnQ7CQkvKiBDb3VudCBvZiB3cml0ZSBmbHVzaGVzICovCisgICAgICAgIHVzaG9ydCAgICAgdHhtb2RlOwkJLyogTW9kZXMgZm9yIHR4ICovCisgICAgICAgIHVzaG9ydCAgICAgcnhtb2RlOwkJLyogTW9kZXMgZm9yIHJ4ICovCisgICAgICAgIHVzaG9ydCAgICAgcG9ydG1vZGU7CQkvKiBHZW5lcmljIG1vZGVzICovCisgICAgICAgIHVzaG9ydCAgICAgY29sdW1uOwkJLyogVEFCMyBjb2x1bW4gY291bnQgKi8KKyAgICAgICAgdXNob3J0ICAgICB0eF9zdWJzY3JpcHQ7CS8qIChUWCkgU3Vic2NyaXB0IGludG8gZGF0YSBmaWVsZCAqLworICAgICAgICB1c2hvcnQgICAgIHJ4X3N1YnNjcmlwdDsJLyogKFJYKSBTdWJzY3JpcHQgaW50byBkYXRhIGZpZWxkICovCisgICAgICAgIFBLVF9wdHIgICAgcnhfaW5jb21wbGV0ZTsJLyogSG9sZCBhbiBpbmNvbXBsZXRlIHBhY2tldCBoZXJlICovCisgICAgICAgIHVzaG9ydCAgICAgbW9kZW1fYml0czsJCS8qIE1vZGVtIGJpdHMgdG8gbWFzayAqLworCXVzaG9ydAkgICBsYXN0TW9kZW07CQkvKiBNb2RlbSBjb250cm9sIGxpbmVzLiAqLworICAgICAgICB1c2hvcnQgICAgIGFkZHI7CQkvKiBBZGRyZXNzIGZvciBzdWIgY29tbWFuZHMgKi8KKyAgICAgICAgdXNob3J0ICAgICBNb25pdG9yVHN0YXRlOwkvKiBUUlVFIGlmIG1vbml0b3JpbmcgdHN0b3AgKi8KKyNlbmRpZgorCisgICAgICAgIH0gOworCisjZW5kaWYKKworLyoqKioqKioqKioqIGVuZCBvZiBmaWxlICoqKioqKioqKioqLworCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL3BrdC5oIGIvZHJpdmVycy9jaGFyL3Jpby9wa3QuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi42NmJiMmZmCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9wa3QuaApAQCAtMCwwICsxLDEyMCBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgIFAgQSBDIEsgRSBUICAgSCBFIEEgRCBFIFIgICBGIEkgTCBFCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBJYW4gTmFuZGhyYSAvIEplcmVteSBSb2xscworIERhdGUgICAgOgorCis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BdmUsIENhbWJyaWRnZSwgTUEgMDIxMzksIFVTQS4KKworIFZlcnNpb24gOiAwLjAxCisKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1vZHMKKyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgIERhdGUgICAgIEJ5ICAgICAgICAgICAgICAgIERlc2NyaXB0aW9uCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIF9wa3RfaAorI2RlZmluZSBfcGt0X2ggMQorCisKKyNpZmRlZiBTQ0NTX0xBQkVMUworI2lmbmRlZiBsaW50CisvKiBzdGF0aWMgY2hhciAqX3Jpb19wa3RfaF9zY2NzID0gIkAoIylwa3QuaAkxLjgiOyAqLworI2VuZGlmCisjZW5kaWYKKworI2RlZmluZSBNQVhfVFRMICAgICAgICAgMHhmCisjZGVmaW5lIFBLVF9DTURfQklUICAgICAoKHVzaG9ydCkgMHgwODApCisjZGVmaW5lIFBLVF9DTURfREFUQSAgICAoKHVzaG9ydCkgMHgwODApCisKKyNkZWZpbmUgUEtUX0FDSyAgICAgICAgICgodXNob3J0KSAweDA0MCkKKworI2RlZmluZSBQS1RfVEdMICAgICAgICAgKCh1c2hvcnQpIDB4MDIwKQorCisjZGVmaW5lIFBLVF9MRU5fTUFTSyAgICAoKHVzaG9ydCkgMHgwN2YpCisKKyNkZWZpbmUgREFUQV9XTkRXICAgICAgICgodXNob3J0KSAweDEwKQorI2RlZmluZSBQS1RfVFRMX01BU0sgICAgKCh1c2hvcnQpIDB4MGYpCisKKyNkZWZpbmUgUEtUX01BWF9EQVRBX0xFTiAgIDcyCisKKyNkZWZpbmUgUEtUX0xFTkdUSCAgICAgICAgIHNpemVvZihzdHJ1Y3QgUEtUKQorI2RlZmluZSBTWU5DX1BLVF9MRU5HVEggICAgKFBLVF9MRU5HVEggKyA0KQorCisjZGVmaW5lIENPTlRST0xfUEtUX0xFTl9NQVNLIFBLVF9MRU5fTUFTSworI2RlZmluZSBDT05UUk9MX1BLVF9DTURfQklUICBQS1RfQ01EX0JJVAorI2RlZmluZSBDT05UUk9MX1BLVF9BQ0sgKFBLVF9BQ0sgPDwgOCkKKyNkZWZpbmUgQ09OVFJPTF9QS1RfVEdMIChQS1RfVEdMIDw8IDgpCisjZGVmaW5lIENPTlRST0xfUEtUX1RUTF9NQVNLIChQS1RfVFRMX01BU0sgPDwgOCkKKyNkZWZpbmUgQ09OVFJPTF9EQVRBX1dORFcgIChEQVRBX1dORFcgPDwgOCkKKworc3RydWN0IFBLVCAgICB7CisjaWZkZWYgSU5LRVJORUwKKyAgICAgICAgICAgICAgICAgICBCWVRFICAgIGRlc3RfdW5pdCA7ICAgIC8qIERlc3RpbmF0aW9uIFVuaXQgSWQgKi8KKyAgICAgICAgICAgICAgICAgICBCWVRFICAgIGRlc3RfcG9ydCA7ICAgIC8qIERlc3RpbmF0aW9uIFBPcnQgKi8KKyAgICAgICAgICAgICAgICAgICBCWVRFICAgIHNyY191bml0IDsgICAgIC8qIFNvdXJjZSBVbml0IElkICovCisgICAgICAgICAgICAgICAgICAgQllURSAgICBzcmNfcG9ydCA7ICAgICAvKiBTb3VyY2UgUE9ydCAqLworI2Vsc2UKKyAgICAgICAgICAgICAgICAgICB1bmlvbiAgICAgICAKKyAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgIHVzaG9ydCBkZXN0aW5hdGlvbjsgICAgICAgICAvKiBDb21wbGV0ZSBkZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QKKyAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgY2hhciB1bml0OyAgICAgLyogRGVzdGluYXRpb24gdW5pdCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgY2hhciBwb3J0OyAgICAgLyogRGVzdGluYXRpb24gcG9ydCAqLworICAgICAgICAgICAgICAgICAgICAgICB9IHMxOworICAgICAgICAgICAgICAgICAgIH0gdTE7CisgICAgICAgICAgICAgICAgICAgdW5pb24gICAgICAgCisgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICB1c2hvcnQgc291cmNlOyAgICAgICAgICAgICAgLyogQ29tcGxldGUgc291cmNlICovCisgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdAorICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBjaGFyIHVuaXQ7ICAgICAvKiBTb3VyY2UgdW5pdCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgY2hhciBwb3J0OyAgICAgLyogU291cmNlIHBvcnQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgfSBzMjsKKyAgICAgICAgICAgICAgICAgICB9IHUyOworI2VuZGlmCisjaWZkZWYgSU5LRVJORUwKKyAgICAgICAgICAgICAgICAgICBCWVRFIGxlbiA7CisgICAgICAgICAgICAgICAgICAgQllURSBjb250cm9sOworI2Vsc2UKKyAgICAgICAgICAgICAgICAgICB1bmlvbgorICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVzaG9ydCAgICAgIGNvbnRyb2w7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBjaGFyIGxlbjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBjaGFyIGNvbnRyb2w7CisgICAgICAgICAgICAgICAgICAgICAgICB9IHMzOworICAgICAgICAgICAgICAgICAgICB9IHUzOworI2VuZGlmCisgICAgICAgICAgICAgICAgICAgQllURSAgICBkYXRhW1BLVF9NQVhfREFUQV9MRU5dIDsgICAgIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQWN0dWFsIGRhdGEgOi0pICovCisgICAgICAgICAgICAgICAgICAgV09SRCAgY3N1bSA7ICAgICAgICAgICAgICAgICAgLyogQy1TVU0gKi8KKyAgICAgICAgICAgICAgIH0gOworI2VuZGlmCisKKy8qKioqKioqKioqKiBlbmQgb2YgZmlsZSAqKioqKioqKioqKi8KKworCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL3BvbGwuaCBiL2RyaXZlcnMvY2hhci9yaW8vcG9sbC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmQ5YjhlOTgKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3BvbGwuaApAQCAtMCwwICsxLDc2IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgIFAgTyBMIEwKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yICA6IElhbiBOYW5kaHJhIC8gSmVyZW15IFJvbGxzCisgRGF0ZSAg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Y3NSBNYXNzIEF2ZSwgQ2FtYnJpZGdlLCBNQSAwMjEzOSwgVVNBLgorCisgVmVyc2lvbiA6IDAuMDEKKworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTW9kcworIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyAgRGF0ZSAgICAgQnkgICAgICAgICAgICAgICAgRGVzY3JpcHRpb24KKyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgX3BvbGxfaAorI2RlZmluZSBfcG9sbF9oCisKKyNpZm5kZWYgbGludAorI2lmZGVmIFNDQ1NfTEFCRUxTCitzdGF0aWMgY2hhciAqX3Jpb19wb2xsX2hfc2NjcyA9ICJAKCMpcG9sbC5oCTEuMiIgOworI2VuZGlmCisjZW5kaWYKKworCisjaWZkZWYgSE9TVAorI2RlZmluZSBQT0xMX1NUQUNLICAgICAgICAgICAgMTAwCisjZW5kaWYKKyNpZmRlZiBSVEEKKyNkZWZpbmUgUE9MTF9TVEFDSyAgICAgICAgICAgIDIwMAorI2VuZGlmCisKKyNkZWZpbmUgUE9MTF9QRVJJT0QgICAgICAgICAgIChpbnQpIFNFQ09ORAorCisvKiBUaGUgdmFyaW91cyBwb2xsIGNvbW1hbmRzICovCisjZGVmaW5lIFBPTExfUE9MTCAgICAgICAgICAgICAwICAgICAgICAgICAgLyogV2UgYXJlIGNvbm5lY3RlZCBhbmQgaGFwcHkuLiAqLworI2RlZmluZSBQT0xMX0lOVFJPICAgICAgICAgICAgMSAgICAgICAgICAgIC8qIEludHJvZH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3Mgb3duIFJUU0ZMT1cgZmxhZyAqLworCisKKyAgICBzdHJ1Y3QgUEhCCQkJKlBoYlA7CSAgLyogcG9pbnRlciB0byBQSEIgZm9yIHBvcnQgKi8KKyAgICBXT1JEICAgICAgICAgICAgICAgICAgICAgICAgKlR4QWRkOyAgIC8qIEFkZCBwYWNrZXRzIGhlcmUgKi8KKyAgICBXT1JEICAgICAgICAgICAgICAgICAgICAgICAgKlR4U3RhcnQ7IC8qIFN0YXJ0IG9mIGFkZCBhcnJheSAqLworICAgIFdPUkQgICAgICAgICAgICAgICAgICAgICAgICAqVHhFbmQ7ICAgICAgICAgLyogRW5kIG9mIGFkZCBhcnJheSAqLworICAgIFdPUkQgICAgICAgICAgICAgICAgICAgICAgICAqUnhSZW1vdmU7ICAgICAgLyogUmVtb3ZlIHBhY2tldHMgaGVyZSAqLworICAgIFdPUkQgICAgICAgICAgICAgICAgICAgICAgICAqUnhTdGFydDsgICAgICAgLyogU3RhcnQgb2YgcmVtb3ZlIGFycmF5ICovCisgICAgV09SRCAgICAgICAgICAgICAgICAgICAgICAgICpSeEVuZDsgICAgICAgICAvKiBFbmQgb2YgcmVtb3ZlIGFycmF5ICovCisgICAgdWludAkJCVJ0YVVuaXF1ZU51bTsJLyogVW5pcXVlIG51bWJlciBvZiBSVEEgKi8KKyAgICB1c2hvcnQJCQlQb3J0U3RhdGU7CS8qIHN0YXR1cyBvZiBwb3J0ICovCisgICAgdXNob3J0CQkJTW9kZW1TdGF0ZTsJLyogc3RhdHVzIG9mIG1vZGVtIGxpbmVzICovCisgICAgdWxvbmcJCQlNb2RlbUxpbmVzOwkvKiBNb2RlbSBiaXRzIHNlbnQgdG8gUlRBICovCisgICAgdWNoYXIJCQlDb29rTW9kZTsJLyogd2hvIGV4cGFuZHMgQ1IvTEY/ICovCisgICAgdWNoYXIJCQlQYXJhbVNlbTsJLyogUHJldmVudCB3cml0ZSBkdXJpbmcgcGFyYW0gKi8KKyAgICB1Y2hhcgkJCU1hcHBlZ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SVVAgKnRoaXNfcnVwLCBMUEIgKmxpbmspOworCisvKgorKiogcnVwc3luYy5jCisqLwordm9pZCBydXBfc3luYyggUEtUICpwa3QpOworCisvKgorKiogcnhwa3QuYworKi8KK0VSUk9SICByeF9wa3QoIFBLVF9wdHJfcHRyIHBrdF9hZGRyZXNzLCBMUEIgKmxpbmspOworCisvKgorKiogc2VuZHN0cy5jCisqLwordm9pZCBzZW5kX3N0YXR1cyggUEtUICpyZXF1ZXN0aW5nX3BrdCwgUlVQICp0aGlzX3J1cCk7CisKKy8qCisqKiBzZXJpYWwuYworKi8KK3ZvaWQgYXNzaWduX3NlcmlhbCAoIGNoYXIgKnNlcl9pbiwgY2hhciAqc2VyX291dCk7CitpbnQgY21wX3NlcmlhbCAoIGNoYXIgKnNlcl8xLCBjaGFyICpzZXJfMik7CisKKy8qCisqKiB0eHBrdC5jCisqLworRVJST1IgIHR4X3BrdCggUEtUICpwa3QsIExQQiAqbGluayk7CitzaG9ydCBzZW5kX3N5bmMoIExQQiAqbGluayk7CisKKyNlbmRpZgkvKiBfcHJvdG90eXBlc19oICovCmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL3Byb3RzdHMuaCBiL2RyaXZlcnMvY2hhci9yaW8vcHJvdHN0cy5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjg0ODExMWEKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3Byb3RzdHMuaApAQCAtMCwwICsxLDExOSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgIFAgUiBPIFQgTyBDIE8gTCAgICBTIFQgQSBUIFUgUyAgIFMgVCBSIFUg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5zZSBmb3IgbW9yZSBkZXRhaWxzLgorICoKKyAqICAgICAgWW91IHNob3VsZCBoYXZlIHJlY2VpdmVkIGEgY29weSBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UKKyAqICAgICAgYWxvbmcgd2l0aCB0aGlzIHByb2dyYW07IGlmIG5vdCwgd3JpdGUgdG8gdGhlIEZyZWUgU29mdHdhcmUKKyAqICAgICAgRm91bmRhdGlvbiwgSW5jLiwgNjc1IE1hc3MgQXZlLCBDYW1icmlkZ2UsIE1BIDAyMTM5LCBVU0EuCisKKyBWZXJzaW9uIDogMC4wMQorCisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb2RzCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICBEYXRlICAgICBCeSAgICAgICAgICAgICAgICBEZXNjcmlwdGlvbgorIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2lmbmRlZiBfcHJvdHN0c19oCisjZGVmaW5lIF9wcm90c3RzX2ggMQorCisKKyNpZmRlZiBTQ0NTX0xBQkVMUworI2lmbmRlZiBsaW50CisvKiBzdGF0aWMgY2hhciAqX3Jpb19wcm90c3RzX2hfc2NjcyA9ICJAKCMpcHJvdHN0cy5oCTEuNCI7ICovCisjZW5kaWYKKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogQUNLIGJpdC4gTGFzdCBQYWNrZXQgcmVjZWl2ZWQgT0suIFNldCBieQorICogcnhwa3QgdG8gaW5kaWNhdGUgdGhhdCB0aGUgUGFja2V0IGhhcyBiZWVuCisgKiByZWNlaXZlZCBPSyBhbmQgdGhhdCB0aGUgTFRUIG11c3Qgc2V0IHRoZSBBQ0sKKyAqIGJpdCBpbiB0aGUgbmV4dCBvdXR3YXJkIGJvdW5kIFBhY2tldAorICogYW5kIHJlLXNldCBieSBMVFQncyBhZnRlciB4bWl0LgorICoKKyAqIEdldHMgc2hvdmVkIGludG8gcnhfc3RhdHVzCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBQSEJfUlhfTEFTVF9QS1RfQUNLRUQgICAgKCh1c2hvcnQpIDB4MDgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogVGhlIFJ4IFRPR0dMRSBiaXQuCisgKiBTdHVmZmVkIGludG8gcnhfc3RhdHVzIGJ5IFJYUEtUCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBQSEJfUlhfREFUQV9XTkRXICAgICAgICAgKCh1c2hvcnQpIDB4MDQwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogVGhlIFJ4IFRPR0dMRSBiaXQuIE1hdGNoZXMgdGhlIHNldHRpbmcgaW4gUEtULkgKKyAqIFN0dWZmZWQgaW50byByeF9zdGF0dXMKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIFBIQl9SWF9UR0wgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHgyMDAwKQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBUaGlzIGJpdCBpcyBzZXQgYnkgdGhlIExSVCB0byBpbmRpY2F0ZSB0aGF0CisgKiBhbiBBQ0sgKHBhY2tldCkgbXVzdCBiZSByZXR1cm5lZC4KKyAqCisgKiBHZXRzIHNob3ZlZCBpbnRvIHR4X3N0YXR1cworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgUEhCX1RYX1NFTkRfUEtUX0FDSyAgICAgICgodXNob3J0KSAweDA4KQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogU2V0IGJ5IExUVCB0byBpbmRpY2F0ZSB0aGF0IGFuIEFDSyBpcyByZXF1aXJlZAorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIFBIQl9UWF9BQ0tfUlFSRCAgICAgICAgICgodXNob3J0KSAweDAxKQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBUaGUgVHggVE9HR0xFIGJpdC4KKyAqIFN0dWZmZWQgaW50byB0eF9zdGF0dXMgYnkgUlhQS1QgZnJvbSB0aGUgUEtUIFduZFcKKyAqIGZpZWxkLiBMb29rZWQgYnkgdGhlIExUVCB3aGVuIHRoZSBORVhUIFBhY2tldAorICogaXMgZ29pbmcgdG8gYmUgc2VudC4KKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIFBIQl9UWF9EQVRBX1dORFcgICAgICAgICAoKHVzaG9ydCkgMHgwNCkKKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogVGhlIFR4IFRPR0dMRSBiaXQuIE1hdGNoZXMgdGhlIHNldHRpbmcgaW4gUEtULkgKKyAqIFN0dWZmZWQgaW50byB0eF9zdGF0dXMKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIFBIQl9UWF9UR0wgICAgICAgICAgICAgICAoKHVzaG9ydCkgMHgwMikKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIFJlcXVlc3QgaW50ciBiaXQuIFNldCB3aGVuIHRoZSBxdWV1ZSBoYXMgZ29uZSBxdWlldAorICogYW5kIHRoZSBQSEIgaGFzIHJlcXVlc3RlZCBhbiBpbnRlcnJ1cHQuCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBQSEJfVFhfSU5UUiAgICAgICAgICAgICAoKHVzaG9ydCkgMHgxMDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBTRVQgaWYgdGhlIFBIQiBjYW5ub3Qgc2VuZCBhbnkgbW9yZSBkYXRhIGRvd24gdGhlCisgKiBMaW5rCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBQSEJfVFhfSEFORFNIQUtFICAgICAgICAgKCh1c2hvcnQpIDB4MDEwKQorCisKKyNkZWZpbmUgUlVQX1NFTkRfV05EVwkJICgodXNob3J0KSAweDA4KSA7CisKKyNlbmRpZgorCisvKioqKioqKioqKiogZW5kIG9mIGZpbGUgKioqKioqKioqKiovCisKKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9xYnVmLmggYi9kcml2ZXJzL2NoYXIvcmlvL3FidWYuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xZmNlMDJmCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9xYnVmLmgKQEAgLTAsMCArMSw2NyBAQAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgIFEgVSBFIFUgRSAgICBCIFUgRiBGIEUgUiAgIFMgVCBSIFUgQyBUIFUgUiBFIFMKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yICA6IElhbiBOYW5kaHJhIC8gSmVyZW15IFJvbGxzCisgRGF0ZSAgICA6CisKKyAqCisgKiAgKEMpIDE5OTAgLSAyMDAwIFNwZWNpYWxpeCBJbnRlcm5hdGlvbmFsIEx0ZC4sIEJ5ZmxlZXQsIFN1cnJleSwgVUsuCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQorICogICAgICBpdCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hlZCBieQorICogICAgICB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBlaXRoZXIgdmVyc2lvbiAyIG9mIHRoZSBMaWNlbnNlLCBvcgorICogICAgICAoYXQgeW91ciBvcHRpb24pIGFueSBsYXRlciB2ZXJzaW9uLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGRpc3RyaWJ1dGVkIGluIHRoZSBob3BlIHRoYXQgaXQgd2lsbCBiZSB1c2VmdWwsCisgKiAgICAgIGJ1dCBXSVRIT1VUIEFOWSBXQVJSQU5UWTsgd2l0aG91dCBldmVuIHRoZSBpbXBsaWVkIHdhcnJh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yAgLyogaW50cnBvbGx0aW1lICovICAgIDEsICAgICAgICAgICAgICAvKiBUaGUgZnJlcXVlbmN5IG9mIE9VUiBwb2xscyAqLworICAvKiBicmVha2ludGVydmFsICovICAgMjUsICAgICAgICAgICAgIC8qIHgxMCBtUyBYWFg6IHVuaXRzIHNlZW0gdG8gYmUgMW1zIG5vdCAxMCEgLS0gUkVXKi8KKyAgLyogdGltZXIgKi8gICAgICAgICAgIDEwLCAgICAgICAgICAgICAvKiBtUyAqLworICAvKiBSdGFMb2FkQmFzZSAqLyAgICAgMHg3MDAwLAorICAvKiBIb3N0TG9hZEJhc2UgKi8gICAgMHg3QzAwLAorICAvKiBYcEh6ICovICAgICAgICAgICAgNSwgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBYcHJpbnQgaGl0cyBwZXIgc2Vjb25kICovCisgIC8qIFhwQ3BzICovICAgICAgICAgICAxMjAsICAgICAgICAgICAgLyogWHByaW50IGNoYXJhY3RlcnMgcGVyIHNlY29uZCAqLworICAvKiBYcE9uICovICAgICAgICAgICAgIlwwMzNkIyIsICAgICAgIC8qIHN0YXJ0IFhwcmludCBmb3IgYSB3eXNlIDYwICovCisgIC8qIFhwT2ZmICovICAgICAgICAgICAiXDAyNCIsICAgICAgICAgLyogZW5kIFhwcmludCBmb3IgYSB3eXNlIDYwICovCisgIC8qIE1heFhwQ3BzICovICAgICAgICAyMDAwLCAgICAgICAgICAgLyogaGlnaGVzdCBYcHJpbnQgc3BlZWQgKi8KKyAgLyogTWluWHBDcHMgKi8gICAgICAgIDEwLCAgICAgICAgICAgICAvKiBzbG93ZXN0IFhwcmludCBzcGVlZCAqLworICAvKiBTcGluQ21kcyAqLyAgICAgICAgMSwgICAgICAgICAgICAgIC8qIG5vbi16ZXJvIGZvciBtZWdhIGZhc3QgYm9vdHMgKi8KKyAgLyogRmlyc3QgQWRkciAqLyAgICAgIDB4MEEwMDAwLCAgICAgICAvKiBGaXJzdCBhZGRyZXNzIHRvIGxvb2sgYXQgKi8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md1cCwKKyAgTlVMTAorfTsKKworLyogCisgKiAgRmlybXdhcmUgbG9hZGVyIGRyaXZlciBzcGVjaWZpYyByb3V0aW5lcworICoKKyAqLworCitzdGF0aWMgc3RydWN0IGZpbGVfb3BlcmF0aW9ucyByaW9fZndfZm9wcyA9IHsKKwkub3duZXIJCT0gVEhJU19NT0RVTEUsCisJLmlvY3RsCQk9IHJpb19md19pb2N0bCwKK307CisKK3N0YXRpYyBzdHJ1Y3QgbWlzY2RldmljZSByaW9fZndfZGV2aWNlID0geworCVJJT0NUTF9NSVNDX01JTk9SLCAicmlvY3RsIiwgJnJpb19md19mb3BzCit9OworCisKKworCisKKyNpZmRlZiBSSU9fUEFSQU5PSUFfQ0hFQ0sKKworLyogVGhpcyBkb2Vzbid0IHdvcmsuIFdobydzIHBhcmFub2lkIGFyb3VuZCBoZXJlPyBOb3QgbWUhICovCisKK3N0YXRpYyBpbmxpbmUgaW50IHJpb19wYXJhbm9pYV9jaGVjayhzdHJ1Y3QgcmlvX3BvcnQgY29uc3QgKiBwb3J0LAorCQkJCSAgICBjaGFyICpuYW1lLCBjb25zdCBjaGFyICpyb3V0aW5lKQoreworCisgIHN0YXRpYyBjb25zdCBjaGFyICpiYWRtYWdpYyA9CisgICAgS0VSTl9FUlIgInJpbzogV2FybmluZzogYmFkIHJpbyBwb3J0IG1hZ2ljIG51bWJlciBmb3IgZGV2aWNlICVzIGluICVzXG4iOworICBzdGF0aWMgY29uc3QgY2hhciAqYmFkaW5mbyA9CisgICAgS0VSTl9FUlIgInJpbzogV2FybmluZzogbnVsbCByaW8gcG9ydCBmb3IgZGV2aWNlICVzIGluICVzXG4iOworIAorICBpZiAoIXBvcnQpIHsKKyAgICBwcmludGsgKGJhZGluZm8sIG5hbWUsIHJvdXRpbmUpOworICAgIHJldHVybiAxOworICB9CisgIGlmIChwb3J0LT5tYWdpYyAhPSBSSU9fTUFHSUMpIHsKKyAgICBwcmludGsgKGJhZG1hZ2ljLCBuYW1lLCByb3V0aW5lKTsKKyAgICByZXR1cm4gMTsKKyAgfQorCisgIHJldHVybiAwOworfQorI2Vsc2UKKyNkZWZpbmUgcmlvX3BhcmFub2lhX2NoZWNrKGEsYixjKSAwCisjZW5kaWYKKworCisjaWZkZWYgREVCVUcKK3N0YXRpYyB2b2lkIG15X2hkICh2b2lkICphZCwgaW50IGxlbikKK3sKKyAgaW50IGksIGosIGNoOworICB1bnNpZ25lZCBjaGFyICphZGRyID0gYWQ7CisgIAorICBmb3IgKGk9MDtpPGxlbjtpKz0xNikgeworICAgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUEFSQU0sICIlMDh4ICIsIChpbnQpIGFkZHIraSk7CisgICAgZm9yIChqPTA7ajwxNjtqKyspIHsKKyAgICAgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUEFSQU0sICIlMDJ4ICVzIiwgYWRkcltqK2ldLCAoaj09Nyk/IiAiOiIiKTsKKyAgICB9CisgICAgZm9yIChqPTA7ajwxNjtqKyspIHsKKyAgICAgIGNoID0gYWRkcltqK2ldOworICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19QQVJBTSwgIiVjIiwgKGNoIDwgMHgyMCk/Jy4nOigoY2ggPiAweDdmKT8nLic6Y2gpKTsKKyAgICB9CisgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19QQVJBTSwgIlxuIik7CisgIH0KK30KKyNlbHNlCisjZGVmaW5lIG15X2hkKGFkLGxlbikgZG97Lyogbm90aGluZyovIH0gd2hpbGUgKDApCisjZW5kaWYKKworCisvKiBEZWxheSBhIG51bWJlciBvZiBqaWZmaWVzLCBhbGxvd2luZyBhIHNpZ25hbCB0byBpbnRlcnJ1cHQgKi8gCitpbnQgUklPRGVsYXkgKHN0cnVjdCBQb3J0ICpQb3J0UCwgaW50IG5qaWZmaWVzKQoreworICBmdW5jX2VudGVyICgpOworCisgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfREVMQVksICJkZWxheWluZyAlZCBqaWZmaWVzXG4iLCBuamlmZmllcyk7ICAKKyAgbXNsZWVwX2ludGVycnVwdGlibGUoamlmZmllc190b19tc2VjcyhuamlmZmllcykpOworICBmdW5jX2V4aXQoKTsKKworICBpZiAoc2lnbmFsX3BlbmRpbmcoY3VycmVudCkpCisgICAgcmV0dXJuIFJJT19GQUlMOworICBlbHNlCisgICAgcmV0dXJuICFSSU9fRkFJTDsKK30KKworCisvKiBEZWxheSBhIG51bWJlciBvZiBqaWZmaWVzLCBkaXNhbGxvd2luZyBhIHNpZ25hbCB0byBpbnRlcnJ1cHQgKi8gCitpbnQgUklPRGVsYXlfbmkgKHN0cnVjdCBQb3J0ICpQb3J0UCwgaW50IG5qaWZmaWVzKQoreworICBmdW5jX2VudGVyICgpOworCisgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfREVMQVksICJkZWxheWluZyAlZCBqaWZmaWVzIChuaSlcbiIsIG5qaWZmaWVzKTsgIAorICBtc2xlZXAoamlmZmllc190b19tc2VjcyhuamlmZmllcykpOworICBmdW5jX2V4aXQoKTsKKyAgcmV0dXJuICFSSU9fRkFJTDsKK30KKworCitpbnQgcmlvX21pbm9yKHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisJcmV0dXJuIHR0eS0+aW5kZXggKyAodHR5LT5kcml2ZXIgPT0gcmlvX2RyaXZlcikgPyAwIDogMjU2OworfQorCisKK2ludCByaW9faXNtb2RlbShzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXJldHVybiAxOworfQorCisKK3ZvaWQgcmlvX3VkZWxheSAoaW50IHVzZWNzKQoreworICB1ZGVsYXkgKHVzZWNzKTsKK30KKworc3RhdGljIGludCByaW9fc2V0X3JlYWxfdGVybWlvcyAodm9pZCAqcHRyKQoreworICBpbnQgcnYsIG1vZGVtOworICBzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5OworICBmdW5jX2VudGVyKCk7CisKKyAgdHR5ID0gKChzdHJ1Y3QgUG9ydCAqKXB0ciktPmdzLnR0eTsKKworIC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N0YXRpYyBpbnQgbGFzdGppZjsKKyAgICBzdGF0aWMgaW50IG5pbnRyPTA7CisKKyAgICBpZiAobGFzdGppZiA9PSBqaWZmaWVzKSB7CisgICAgICBpZiAoKytuaW50ciA+IElSUV9SQVRFX0xJTUlUKSB7CisgICAgICAgIGZyZWVfaXJxIChIb3N0UC0+SXZlYywgcHRyKTsKKyAgICAgICAgcHJpbnRrIChLRVJOX0VSUiAicmlvOiBUb28gbWFueSBpbnRlcnJ1cHRzLiBUdXJuaW5nIG9mZiBpbnRlcnJ1cHQgJWQuXG4iLCAKKyAgICAgICAgICAgICAgICBIb3N0UC0+SXZlYyk7CisgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgIGxhc3RqaWYgPSBqaWZmaWVzOworICAgICAgbmludHIgPSAwOworICAgIH0KKyAgfQorI2VuZGlmCisgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfSUZMT1csICJyaW86IFdlJ3ZlIGhhdmUgbm90aWNlZCB0aGUgaW50ZXJydXB0XG4iKTsgCisgIGlmIChIb3N0UC0+SXZlYyA9PSBpcnEpIHsKKyAgICAvKiBUZWxsIHRoZSBjYXJkIHdlJ3ZlIG5vdGljZWQgdGhlIGludGVycnVwdC4gKi8KKyAgICByaW9fcmVzZXRfaW50ZXJydXB0IChIb3N0UCk7CisgIH0KKworICBpZiAoKEhvc3RQLT5GbGFncyAmIFJVTl9TVEFURSkgIT0gUkNfUlVOTklORykKKyAgCXJldHVybiBJUlFfSEFORExFRDsKKworICBpZiAodGVzdF9hbmRfc2V0X2JpdCAoUklPX0JPQVJEX0lOVFJfTE9DSywgJkhvc3RQLT5sb2NrcykpIHsKKyAgICBwcmludGsgKEtFUk5fRVJSICJSZWN1cnNpdmUgaW50ZXJydXB0ISAoaG9zdCAlZC9pcnElZClcbiIsIAorICAgICAgICAgICAgKGludCkgcHRyLCBIb3N0UC0+SXZlYyk7CisgICAgcmV0dXJuIElSUV9IQU5ETEVEOworICB9CisKKyAgUklPU2VydmljZUhvc3QocCwgSG9zdFAsIGlycSk7CisKKyAgcmlvX2RwcmludGsgKCBSSU9fREVCVUdfSUZMT1csICJyaW9pbnRyKCkgZG9pbmcgaG9zdCAlZCB0eXBlICVkXG4iLCAKKyAgICAgICAgICAgICAgICAoaW50KSBwdHIsIEhvc3RQLT5UeXBlKTsKKworICBjbGVhcl9iaXQgKFJJT19CT0FSRF9JTlRSX0xPQ0ssICZIb3N0UC0+bG9ja3MpOworICByaW9fZHByaW50ayAoUklPX0RFQlVHX0lGTE9XLCAicmlvOiBleGl0IHJpb19pbnRlcnJ1cHQgKCVkLyVkKVxuIiwgCisgICAgICAgICAgICAgICBpcnEsIEhvc3RQLT5JdmVjKTsgCisgIGZ1bmNfZXhpdCAoKTsKKyAgcmV0dXJuIElSUV9IQU5ETEVEOworfQorCisKK3N0YXRpYyB2b2lkIHJpb19wb2xsZnVuYyAodW5zaWduZWQgbG9uZyBkYXRhKQoreworICBmdW5jX2VudGVyICgpOworCisgIHJpb19pbnRlcnJ1cHQgKDAsICZwLT5SSU9Ib3N0c1tkYXRhXSwgTlVMTCk7CisgIHAtPlJJT0hvc3RzW2RhdGFdLnRpbWVyLmV4cGlyZXMgPSBqaWZmaWVzICsgcmlvX3BvbGw7CisgIGFkZF90aW1lciAoJnAtPlJJT0hvc3RzW2RhdGFdLnRpbWVyKTsKKworICBmdW5jX2V4aXQgKCk7Cit9CisKKworLyogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqCisgKiAgICAgICAgICAgICAgICBIZXJlIGFyZSB0aGUgcm91dGluZXMgdGhhdCBhY3R1YWxseSAgICAgICAgICAgICAgICAgICAgICoKKyAqICAgICAgICAgICAgICBpbnRlcmZhY2Ugd2l0aCB0aGUgZ2VuZXJpY19zZXJpYWwgZHJpdmVyICAgICAgICAgICAgICAgICAgKgorICogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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IGludCBjbWQsIHVuc2lnbmVkIGxvbmcgYXJnKQoreworICBpbnQgcmMgPSAwOworICBmdW5jX2VudGVyKCk7CisKKyAgLyogVGhlICJkZXYiIGFyZ3VtZW50IGlzbid0IHVzZWQuICovCisgIHJjID0gcmlvY29udHJvbCAocCwgMCwgY21kLCAodm9pZCAqKWFyZywgY2FwYWJsZShDQVBfU1lTX0FETUlOKSk7CisKKyAgZnVuY19leGl0ICgpOworICByZXR1cm4gcmM7Cit9CisKK2V4dGVybiBpbnQgUklPU2hvcnRDb21tYW5kKHN0cnVjdCByaW9faW5mbyAqcCwgc3RydWN0IFBvcnQgKlBvcnRQLAorICAgICAgICAgICAgICAgaW50IGNvbW1hbmQsIGludCBsZW4sIGludCBhcmcpOworCitzdGF0aWMgaW50IHJpb19pb2N0bCAoc3RydWN0IHR0eV9zdHJ1Y3QgKiB0dHksIHN0cnVjdCBmaWxlICogZmlscCwgCisgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBpbnQgY21kLCB1bnNpZ25lZCBsb25nIGFyZykKK3sKKyAgaW50IHJjOworICBzdHJ1Y3QgUG9ydCAqUG9ydFA7CisgIGludCBpdmFsOworCisgIGZ1bmNfZW50ZXIoKTsKKworICBQb3J0UCA9IChzdHJ1Y3QgUG9ydCAqKXR0eS0+ZHJpdmVyX2RhdGE7CisKKyAgcmMgID0gMDsKKyAgc3dpdGNoIChjbWQpIHsKKyNpZiAwCisgIGNhc2UgVElPQ0dTT0ZUQ0FSOgorICAgIHJjID0gcHV0X3VzZXIoKCh0dHktPnRlcm1pb3MtPmNfY2ZsYWcgJiBDTE9DQUwpID8gMSA6IDApLAorICAgICAgICAgICAgICAgICAgKHVuc2lnbmVkIGludCAqKSBhcmcpOworICAgIGJyZWFrOworI2VuZGlmCisgIGNhc2UgVElPQ1NTT0ZUQ0FSOgorICAgIGlmICgocmMgPSBnZXRfdXNlcihpdmFsLCAodW5zaWduZWQgaW50ICopIGFyZykpID09IDApIHsKKyAgICAgIHR0eS0+dGVybWlvcy0+Y19jZmxhZyA9CisgICAgICAgICh0dHktPnRlcm1pb3MtPmNfY2ZsYWcgJiB+Q0xPQ0FMKSB8CisgICAgICAgIChpdmFsID8gQ0xPQ0FMIDogMCk7CisgICAgfQorICAgIGJyZWFrOworICBjYXNlIFRJT0NHU0VSSUFMOgorICAgIHJjID0gLUVGQVVMVDsKKyAgICBpZiAoYWNjZXNzX29rKFZFUklGWV9XUklURSwgKHZvaWQgKikgYXJnLAorICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2Yoc3RydWN0IHNlcmlhbF9zdHJ1Y3QpKSkKKyAgICAgIHJjID0gZ3NfZ2V0c2VyaWFsKCZQb3J0UC0+Z3MsIChzdHJ1Y3Qgc2VyaWFsX3N0cnVjdCAqKSBhcmcpOworICAgIGJyZWFrOworICBjYXNlIFRDU0JSSzoKKyAgICBpZiAoIFBvcnRQLT5TdGF0ZSAmIFJJT19ERUxFVEVEICkgeworICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19UVFksICJCUkVBSyBvbiBkZWxldGVkIFJUQVxuIik7CisgICAgICByYyA9IC1FSU87ICAgICAgCisgICAgfSBlbHNlIHsKKyAgICAgIGlmIChSSU9TaG9ydENvbW1hbmQocCwgUG9ydFAsIFNCUkVBSywgMiwgMjUwKSA9PSBSSU9fRkFJTCkgeworICAgICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTlRSLCAiU0JSRUFLIFJJT1Nob3J0Q29tbWFuZCBmYWlsZWRcbiIpOworICAgICAgICAgcmMgPSAtRUlPOworICAgICAgfSAgICAgICAgICAKKyAgICB9CisgICAgYnJlYWs7CisgIGNhc2UgVENTQlJLUDoKKyAgICBpZiAoIFBvcnRQLT5TdGF0ZSAmIFJJT19ERUxFVEVEICkgeworICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19UVFksICJCUkVBSyBvbiBkZWxldGVkIFJUQVxuIik7CisgICAgICByYyA9IC1FSU87ICAgICAgCisgICAgfSBlbHNlIHsKKyAgICAgIGludCBsOworICAgICAgbCA9IGFyZz9hcmcqMTAwOjI1MDsKKyAgICAgIGlmIChsID4gMjU1KSBsID0gMjU1OworICAgICAgaWYgKFJJT1Nob3J0Q29tbWFuZChwLCBQb3J0UCwgU0JSRUFLLCAyLCBhcmc/YXJnKjEwMDoyNTApID09IFJJT19GQUlMKSB7CisgICAgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX0lOVFIsICJTQlJFQUsgUklPU2hvcnRDb21tYW5kIGZhaWxlZFxuIik7CisgICAgICAgICByYyA9IC1FSU87CisgICAgICB9ICAgICAgICAgIAorICAgIH0KKyAgICBicmVhazsKKyAgY2FzZSBUSU9DU1NFUklBTDoKKyAgICByYyA9IC1FRkFVTFQ7CisgICAgaWYgKGFjY2Vzc19vayhWRVJJRllfUkVBRCwgKHZvaWQgKikgYXJnLAorICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2Yoc3RydWN0IHNlcmlhbF9zdHJ1Y3QpKSkKKyAgICAgIHJjID0gZ3Nfc2V0c2VyaWFsKCZQb3J0UC0+Z3MsIChzdHJ1Y3Qgc2VyaWFsX3N0cnVjdCAqKSBhcmcpOworICAgIGJyZWFrOworI2lmIDAKKyAgLyoKKyAgICogbm90ZTogdGhlc2UgSU9DVExzIG5vIGxvbmdlciByZWFjaCBoZXJlLiAgVXNlCisgICAqIHRpb2Ntc2V0L3Rpb2NtZ2V0IGRyaXZlciBtZXRob2RzIGluc3RlYWQuICBUaGUKKyAgICogI2lmIDAgZGlzYWJsZW1lbnQgcHJlZGF0ZXMgdGhpcyBjb21tZW50LgorICAgKi8KKyAgY2FzZSBUSU9DTUdFVDoKKyAgICByYyA9IC1FRkFVTFQ7CisgICAgaWYgKGFjY2Vzc19vayhWRVJJRllfV1JJVEUsICh2b2lkICopIGFyZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHVuc2lnbmVkIGludCkpKSB7CisgICAgICByYyA9IDA7CisgICAgICBpdmFsID0gcmlvX2dldHNpZ25hbHMocG9ydCk7CisgICAgICBwdXRfdXNlcihpdmFsLCAodW5zaWduZWQgaW50ICopIGFyZyk7CisgICAgfQorICAgIGJyZWFrOworICBjYXNlIFRJT0NNQklTOgorICAgIGlmICgocmMgPSBnZXRfdXNlcihpdmFsLCAodW5zaWduZWQgaW50ICopIGFyZykpID09IDApIHsKKyAgICAgIHJpb19zZXRzaWduYWxzKHBvcnQsICgoaXZhbCAmIFRJT0NNX0RUUikgPyAxIDogLTEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgKChpdmFsICYgVElPQ01fUlRTKSA/IDEgOiAtMSkpOworICAgIH0KKyAgICBicmVhazsKKyAgY2FzZSBUSU9DTUJJQzoKKyAgICBpZiAoKHJjID0gZ2V0X3VzZXIoaXZhbCwgKHVuc2lnbmVkIGludCAqKSBhcmcpKSA9PSAwKSB7CisgICAgICByaW9fc2V0c2lnbmFscyhwb3J0LCAoKGl2YWwgJiBUSU9DTV9EVFIpID8gMCA6IC0xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICgoaXZhbCAmIFRJT0NNX1JUUykgPyAwIDogLTEpKTsKKyAgICB9CisgICAgYnJlYWs7CisgIGNhc2UgVElPQ01TRVQ6CisgICAgaWYgKChyYyA9IGdldF91c2VyKGl2YWwsICh1bnNpZ25lZCBpbnQgKikgYXJnKSkgPT0gMCkgeworICAgICAgcmlvX3NldHNpZ25hbHMocG9ydCwgKChpdmFsICYgVElPQ01fRFRSKSA/IDEgOiAwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICgoaXZhbCAmIFRJT0NNX1JUUykgPyAxIDogMCkpOworICAgIH0KKyAgICBicmVhazsKKyNlbmRpZgorICBkZWZhdWx0OgorICAgIHJjID0gLUVOT0lPQ1RMQ01EOworICAgIGJyZWFrOworICB9CisgIGZ1bmNfZXhpdCgpOworICByZXR1cm4gcmM7Cit9CisKKworLyogVGhlIHRocm90dGxlL3VudGhyb3R0bGUgc2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XhpdCgpOworICByZXR1cm47Cit9CisKKworCisKKworLyogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqCisgKiAgICAgICAgICAgICAgICAgICAgSGVyZSBhcmUgdGhlIGluaXRpYWxpemF0aW9uIHJvdXRpbmVzLiAgICAgICAgICAgICAgICoKKyAqICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogKi8KKworCitzdGF0aWMgc3RydWN0IHZwZF9wcm9tICpnZXRfVlBEX1BST00gKHN0cnVjdCBIb3N0ICpocCkKK3sKKyAgc3RhdGljIHN0cnVjdCB2cGRfcHJvbSB2cGRwOworICBjaGFyICpwOworICBpbnQgaTsKKworICBmdW5jX2VudGVyKCk7CisgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUFJPQkUsICJHb2luZyB0byB2ZXJpZnkgdnBkIHByb20gYXQgJXAuXG4iLCAKKyAgICAgICAgICAgICAgaHAtPkNhZGRyICsgUklPX1ZQRF9ST00pOworCisgIHAgPSAoY2hhciAqKSAmdnBkcDsKKyAgZm9yIChpPTA7aTwgc2l6ZW9mIChzdHJ1Y3QgdnBkX3Byb20pO2krKykKKyAgICAqcCsrID0gcmVhZGIgKGhwLT5DYWRkcitSSU9fVlBEX1JPTSArIGkqMik7CisgICAgICAvKiByZWFkX3Jpb19ieXRlIChocCwgUklPX1ZQRF9ST00gKyBpKjIpOyAqLworCisgIC8qIFRlcm1pbmF0ZSB0aGUgaWRlbnRpZmllciBzdHJpbmcuIAorICAgICAqKiogcmVxdWlyZXMgb25lIGV4dHJhIGJ5dGUgaW4gc3RydWN0IHZwZF9wcm9tICoqKiAqLworICAqcCsrPTA7IAorCisgIGlmIChyaW9fZGVidWcgJiBSSU9fREVCVUdfUFJPQkUpCisgICAgbXlfaGQgKChjaGFyICopJnZwZHAsIDB4MjApOworICAKKyAgZnVuY19leGl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cml2ZXIgYWxsb3dzIHVzZXJzIHRvIGNvbmZpZ3VyZSB0aGVpciBmaXJzdAorICAgICBSVEEgYXMgdGhlIHBvcnRzIG51bWJlcmVkIDUwNC01MTEuIFdlIHRoZXJlZm9yZSBuZWVkIHRvIGFsbG9jYXRlIAorICAgICB0aGUgd2hvbGUgcmFuZ2UuIDotKCAgIC0tIFJFVyAqLworICAKKyNkZWZpbmUgUklfU1ogICBzaXplb2Yoc3RydWN0IHJpb19pbmZvKQorI2RlZmluZSBIT1NUX1NaIHNpemVvZihzdHJ1Y3QgSG9zdCkKKyNkZWZpbmUgUE9SVF9TWiBzaXplb2Yoc3RydWN0IFBvcnQgKikKKyNkZWZpbmUgVE1JT19TWiBzaXplb2Yoc3RydWN0IHRlcm1pb3MgKikKKyAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiZ2V0dGluZyA6ICVkICVkICVkICVkICVkIGJ5dGVzXG4iLCAKKyAgICAgICAgICAgICAgIFJJX1NaLCAKKyAgICAgICAgICAgICAgIFJJT19IT1NUUyAqIEhPU1RfU1osCisgICAgICAgICAgICAgICBSSU9fUE9SVFMgKiBQT1JUX1NaLAorICAgICAgICAgICAgICAgUklPX1BPUlRTICogVE1JT19TWiwKKyAgICAgICAgICAgICAgIFJJT19QT1JUUyAqIFRNSU9fU1opOworICAKKyAgaWYgKCEocCAgICAgICAgICAgICAgICAgID0gY2ttYWxsb2MgKCAgICAgICAgICAgICAgUklfU1opKSkgZ290byBmcmVlMDsKKyAgaWYgKCEocC0+UklPSG9zdHMgICAgICAgID0gY2ttYWxsb2MgKFJJT19IT1NUUyAqIEhPU1RfU1opKSkgZ290byBmcmVlMTsKKyAgaWYgKCEocC0+UklPUG9ydHAgICAgICAgID0gY2ttYWxsb2MgKFJJT19QT1JUUyAqIFBPUlRfU1opKSkgZ290byBmcmVlMjsKKyAgcC0+UklPQ29uZiA9IFJJT0NvbmY7CisgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfSU5JVCwg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CAmdGludCk7CisKKyAgICAgIGhwID0gJnAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXTsKKyAgICAgIGhwLT5QYWRkclAgPSAgdGludCAmIFBDSV9CQVNFX0FERFJFU1NfTUVNX01BU0s7CisgICAgICBocC0+SXZlYyA9IHBkZXYtPmlycTsKKyAgICAgIGlmICgoKDEgPDwgaHAtPkl2ZWMpICYgcmlvX2lycW1hc2spID09IDApCisgICAgICAgICAgICAgIGhwLT5JdmVjID0gMDsKKyAgICAgIGhwLT5DYWRkciA9IGlvcmVtYXAocC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlBhZGRyUCwgUklPX1dJTkRPV19MRU4pOworICAgICAgaHAtPkNhcmRQCT0gKHN0cnVjdCBEcFJhbSAqKSBocC0+Q2FkZHI7CisgICAgICBocC0+VHlwZSAgPSBSSU9fUENJOworICAgICAgaHAtPkNvcHkgID0gcmlvX3BjaWNvcHk7IAorICAgICAgaHAtPk1vZGUgID0gUklPX1BDSV9CT09UX0ZST01fUkFNOworICAgICAgc3Bpbl9sb2NrX2luaXQoJmhwLT5Ib3N0TG9jayk7CisgICAgICByaW9fcmVzZXRfaW50ZXJydXB0IChocCk7CisgICAgICByaW9fc3RhcnRfY2FyZF9ydW5uaW5nIChocCk7CisKKyAgICAgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUFJPQkUsICJHb2luZyB0byB0ZXN0IGl0ICglcC8lcCkuXG4iLAorICAgICAgICAgICAgICAgICAgICh2b2lkICopcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlBhZGRyUCwKKyAgICAgICAgICAgICAgICAgICBwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uQ2FkZHIpOworICAgICAgaWYgKFJJT0JvYXJkVGVzdCggcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlBhZGRyUCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5DYWRkciwgCisgICAgICAgICAgICAgICAgICAgICAgICBSSU9fUENJLCAwICkgPT0gUklPX1NVQ0NFU1MpIHsKKyAgICAgICAgICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiRG9uZSBSSU9Cb2FyZFRlc3RcbiIpOworICAgICAgICAgICAgICBXQllURShwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uUmVzZXRJbnQsIDB4ZmYpOworICAgICAgICAgICAgICBwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uVW5pcXVlTnVtICA9CisgICAgICAgICAgICAgICAgICAgICAgKChSQllURShwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uVW5pcXVlWzBdKSAmMHhGRik8PCAwKXwKKyAgICAgICAgICAgICAgICAgICAgICAoKFJCWVRFKHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5VbmlxdWVbMV0pICYweEZGKTw8IDgpfAorICAgICAgICAgICAgICAgICAgICAgICgoUkJZVEUocC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlVuaXF1ZVsyXSkgJjB4RkYpPDwxNil8CisgICAgICAgICAgICAgICAgICAgICAgKChSQllURShwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uVW5pcXVlWzNdKSAmMHhGRik8PDI0KTsKKyAgICAgICAgICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19QUk9CRSwgIkhtbSBUZXN0ZWQgb2ssIHVuaXFpZCA9ICV4LlxuIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5VbmlxdWVOdW0pOworICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgZml4X3Jpb19wY2kgKHBkZXYpOworICAgICAgICAgICAgICBwLT5SSU9MYXN0UENJU2VhcmNoID0gUklPX1NVQ0NFU1M7CisgICAgICAgICAgICAgIHAtPlJJT051bUhvc3RzKys7CisgICAgICAgICAgICAgIGZvdW5kKys7CisgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICBpb3VubWFwKChjaGFyKikgKHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5DYWRkcikpOworICAgICAgfQorICAgIH0KKyAgICAKKyAgICAvKiBUaGVuIGxvb2sgZm9yIHRoZSBvbGRlciBQQ0kgY2FyZC4uLi4gOiAqLworCisgIC8qIFRoZXNlIG9sZGVyIFBDSSBjYXJkcyBoYXZlIHByb2JsZW1zIChvbmx5IGJ5dGUtbW9kZSBhY2Nlc3MgaXMKKyAgICAgc3VwcG9ydGVkKSwgd2hpY2ggbWFrZXMgdGhlbSBhIGJpdCBhd2t3YXJkIHRvIHN1cHBvcnQuIAorICAgICBUaGV5IGFsc28gaGF2ZSBwcm9ibGVtcyBzaGFyaW5nIGludGVycnVwdHMuIEJlIGNhcmVmdWwuIAorICAgICAoVGhlIGRyaXZlciBub3cgcmVmdXNlcyB0byBzaGFyZSBpbnRlcnJ1cHRzIGZvciB0aGVzZQorICAgICBjYXJkcy4gVGhpcyBzaG91bGQgYmUgc3VmZmljaWVudCkuCisgICovCisKKyAgICAvKiBUaGVuIGxvb2sgZm9yIHRoZSBvbGRlciBSSU8vUENJIGRldmljZXM6ICovCisgICAgd2hpbGUgKChwZGV2ID0gcGNpX2ZpbmRfZGV2aWNlIChQQ0lfVkVORE9SX0lEX1NQRUNJQUxJWCwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQ0lfREVWSUNFX0lEX1NQRUNJQUxJWF9SSU8sIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGRldikpKSB7CisgICAgICAgaWYgKHBjaV9lbmFibGVfZGV2aWNlKHBkZXYpKSBjb250aW51ZTsKKworI2lmZGVmIENPTkZJR19SSU9fT0xEUENJCisgICAgICBwY2lfcmVhZF9jb25maWdfZHdvcmQocGRldiwgUENJX0JBU0VfQUREUkVTU18wLCAmdGludCk7CisKKyAgICAgIGhwID0gJnAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXTsKKyAgICAgIGhwLT5QYWRkclAgPSAgdGludCAmIFBDSV9CQVNFX0FERFJFU1NfTUVNX01BU0s7CisgICAgICBocC0+SXZlYyA9IHBkZXYtPmlycTsKKyAgICAgIGlmICgoKDEgPDwgaHAtPkl2ZWMpICYgcmlvX2lycW1hc2spID09IDApIAorICAgICAgCWhwLT5JdmVjID0gMDsKKyAgICAgIGhwLT5JdmVjIHw9IDB4ODAwMDsgLyogTWFyayBhcyBub24tc2hhcmFibGUgKi8KKyAgICAgIGhwLT5DYWRkciA9IGlvcmVtYXAocC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlBhZGRyUCwgUklPX1dJTkRPV19MRU4pOworICAgICAgaHAtPkNhcmRQCT0gKHN0cnVjdCBEcFJhbSAqKSBocC0+Q2FkZHI7CisgICAgICBocC0+VHlwZSAgPSBSSU9fUENJOworICAgICAgaHAtPkNvcHkgID0gcmlvX3BjaWNvcHk7CisgICAgICBocC0+TW9kZSAgPSBSSU9fUENJX0JPT1RfRlJPTV9SQU07CisgICAgICBzcGluX2xvY2tfaW5pdCgmaHAtPkhvc3RMb2NrKTsKKworICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19QUk9CRSwgIkl2ZWM6ICV4XG4iLCBocC0+SXZlYyk7CisgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX1BST0JFLCAiTW9kZTogJXhcbiIsIGhwLT5Nb2RlKTsKKworICAgICAgcmlvX3Jlc2V0X2ludGVycnVwdCAoaHApOworICAgICAgcmlvX3N0YXJ0X2NhcmRfcnVubmluZyAoaHApOworICAgICAgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUFJPQkUsICJHb2luZyB0byB0ZXN0IGl0ICglcC8lcCkuXG4iLAorICAgICAgICAgICAgICAgICAgICh2b2lkICopcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlBhZGRyUCwKKyAgICAgICAgICAgICAgICAgICBwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uQ2FkZHIpOworICAgICAgaWYgKFJJT0JvYXJkVGVzdCggcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlBhZGRyUCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5DYWRkciwgCisgICAgICAgICAgICAgICAgICAgICAgICBSSU9fUENJLCAwICkgPT0gUklPX1NVQ0NFU1MpIHsKKyAgICAgICAgV0JZVEUocC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlJlc2V0SW50LCAweGZmKTsKKyAgICAgICAgcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlVuaXF1ZU51bSAgPQorICAgICAgICAgICgoUkJZVEUocC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlVuaXF1ZVswXSkgJjB4RkYpPDwgMCl8CisgICAgICAgICAgKChSQllURShwLT5SSU9Ib3N0c1twLT5SSU9OdW1Ib3N0c10uVW5pcXVlWzFdKSAmMHhGRik8PCA4KXwKKyAgICAgICAgICAoKFJCWVRFKHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5VbmlxdWVbMl0pICYweEZGKTw8MTYpfAorICAgICAgICAgICgoUkJZVEUocC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlVuaXF1ZVszXSkgJjB4RkYpPDwyNCk7CisgICAgICAgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUFJPQkUsICJIbW0gVGVzdGVkIG9rLCB1bmlxaWQgPSAleC5cbiIsCisgICAgICAgICAgICAgICAgICAgcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHNdLlVuaXF1ZU51bSk7CisKKyAgICAgICAgcC0+UklPTGFzdFBDSVNlYXJjaCA9IFJJT19TVUNDRVNTOworICAgICAgICBwLT5SSU9OdW1Ib3N0cysrOworICAgICAgICBmb3VuZCsrOworICAgICAgf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3B5LiAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBNb3Jlb3ZlciwgdGhlIElTQSBjYXJkIHdpbGwgd29yayB3aXRoIHRoZSAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBzcGVjaWFsIFBDSSBjb3B5IGFueXdheS4gLS0gUkVXICovCisgICAgaHAtPk1vZGUgPSAwOworICAgIHNwaW5fbG9ja19pbml0KCZocC0+SG9zdExvY2spOworCisgICAgdnBkcCA9IGdldF9WUERfUFJPTSAoaHApOworICAgIHJpb19kcHJpbnRrIChSSU9fREVCVUdfUFJPQkUsICJHb3QgVlBEIFJPTVxuIik7CisgICAgb2tib2FyZCA9IDA7CisgICAgaWYgKChzdHJuY21wICh2cGRwLT5pZGVudGlmaWVyLCBSSU9fSVNBX0lERU5ULCAxNikgPT0gMCkgfHwKKyAgICAgICAgKHN0cm5jbXAgKHZwZHAtPmlkZW50aWZpZXIsIFJJT19JU0EyX0lERU5ULCAxNikgPT0gMCkgfHwKKyAgICAgICAgKHN0cm5jbXAgKHZwZHAtPmlkZW50aWZpZXIsIFJJT19JU0EzX0lERU5ULCAxNikgPT0gMCkpIHsKKyAgICAgIC8qIEJvYXJkIGlzIHByZXNlbnQuLi4gKi8KKyAgICAgIGlmIChSSU9Cb2FyZFRlc3QgKGhwLT5QYWRkclAsIAorICAgICAgICAgICAgICAgICAgICAgICAgaHAtPkNhZGRyLCBSSU9fQVQsIDApID09IFJJT19TVUNDRVNTKSB7CisgICAgICAgIC8qIC4uLiBhbmQgZmVlbGluZyBmaW5lISEhISAqLworICAgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX1BST0JFLCAiSG1tIFRlc3RlZCBvaywgdW5pcWlkID0gJXguXG4iLAorICAgICAgICAgICAgICAgICAgIHAtPlJJT0hvc3RzW3AtPlJJT051bUhvc3RzXS5VbmlxdWVOdW0pOworICAgICAgICBpZiAoUklPQXNzaWduQVQocCwgaHAtPlBhZGRyUCwgaHAtPkNhZGRyLCAwKSkgeyAgICAgICAgCisgICAgICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19QUk9CRSwgIkhtbSBUZXN0ZWQgb2ssIGhvc3QlZCB1bmlxaWQgPSAleC5cbiIsCisgICAgICAgICAgICAgICAgICAgICAgIHAtPlJJT051bUhvc3RzLCAKKyAgICAgICAgICAgICAgICAgICAgICAgcC0+UklPSG9zdHNbcC0+UklPTnVtSG9zdHMtMV0uVW5pcXVlTnVtKTsKKyAgICAgICAgICBva2JvYXJkKys7CisgICAgICAgICAgZm91bmQrKzsKKyAgICAgICAgfQorICAgICAgfQorCisgICAgaWYgKCFva2JvYXJkKQorICAgICAgaW91bm1hcCAoKGNoYXIqKSAoaHAtPkNhZGRyKSk7CisgICAgfQorICB9CisKKworICBmb3IgKGk9MDtpPHAtPlJJT051bUhvc3RzO2krKykgeworICAgIGhwID0gJnAtPlJJT0hvc3RzW2ldOworICAgIGlmIChocC0+SXZlYykgeworICAgICAgaW50IG1vZGUgPSBTQV9TSElSUTsKKyAgICAgIGlmIChocC0+SXZlYyAmIDB4ODAwMCkge21vZGUgPSAwOyBocC0+SXZlYyAmPSAweDdmZmY7fQorICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiUmVxdWVzdGluZyBpbnRlcnJ1cHQgaHA6ICVwIHJpb19pbnRlcnJ1cHQ6ICVkIE1vZGU6ICV4XG4iLCBocCxocC0+SXZlYywgaHAtPk1vZGUpOworICAgICAgcmV0dmFsID0gcmVxdWVzdF9pcnEgKGhwLT5JdmVjLCByaW9faW50ZXJydXB0LCBtb2RlLCAicmlvIiwgaHApOworICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiUmV0dXJuIHZhbHVlIGZyb20gcmVxdWVzdF9pcnE6ICVkXG4iLCByZXR2YWwpOworICAgICAgaWYgKHJldHZhbCkgeworICAgICAgICAgICAgICBwcmludGsoS0VSTl9FUlIgInJpbzogQ2Fubm90IGFsbG9jYXRlIGlycSAlZC5cbiIsIGhwLT5JdmVjKTsKKyAgICAgICAgICAgICAgaHAtPkl2ZWMgPSAwOworICAgICAgfQorICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiR290IGlycSAlZC5cbiIsIGhwLT5JdmVjKTsKKyAgICAgIGlmIChocC0+SXZlYyAhPSAwKXsKKyAgICAgICAgICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiRW5hYmxpbmcgaW50ZXJydXB0cyBvbiByaW8gY2FyZC5cbiIpOyAKKyAgICAgICAgICAgICAgaHAtPk1vZGUgfD0gUklPX1BDSV9JTlRfRU5BQkxFOworICAgICAgfSBlbHNlCisgICAgICAgICAgICAgIGhwLT5Nb2RlICY9ICFSSU9fUENJX0lOVF9FTkFCTEU7CisgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX0lOSVQsICJOZXcgTW9kZTogJXhcbiIsIGhwLT5Nb2RlKTsKKyAgICAgIHJpb19zdGFydF9jYXJkX3J1bm5pbmcgKGhwKTsKKyAgICB9CisgICAgLyogSW5pdCB0aGUgdGltZXIgImFsd2F5cyIgdG8gbWFrZSBzdXJlIHRoYXQgaXQgY2FuIHNhZmVseSBiZSAKKyAgICAgICBkZWxldGVkIHdoZW4gd2UgdW5sb2FkLi4uICovCisKKyAgICBpbml0X3RpbWVyICgmaHAtPnRpbWVyKTsKKyAgICBpZiAoIWhwLT5JdmVjKSB7CisgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX0lOSVQsICJTdGFydGluZyBwb2xsaW5nIGF0ICVkaiBpbnRlcnZhbHMuXG4iLCAKKyAgICAgICAgICAgICAgICAgICByaW9fcG9sbCk7CisgICAgICBocC0+dGltZXIuZGF0YSA9IGk7CisgICAgICBocC0+dGltZXIuZnVuY3Rpb24gPSByaW9fcG9sbGZ1bmM7CisgICAgICBocC0+dGltZXIuZXhwaXJlcyA9IGppZmZpZXMgKyByaW9fcG9sbDsKKyAgICAgIGFkZF90aW1lciAoJmhwLT50aW1lcik7CisgICAgfQorICB9CisKKyAgaWYgKGZvdW5kKSB7CisgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAicmlvOiB0b3RhbCBvZiAlZCBib2FyZHMgZGV0ZWN0ZWQuXG4iLCBmb3VuZCk7CisgICAgcmlvX2luaXRfZHJpdmVycyAoKTsKKyAgfSBlbHNlIHsKKyAgICAvKiBkZXJlZ2lzdGVyIHRoZSBtaXNjIGRldmljZSB3ZSBjcmVhdGVkIGVhcmxpZXIgKi8KKyAgICBtaXNjX2RlcmVnaXN0ZXIoJnJpb19md19kZXZpY2UpOworICB9CisKKyAgZnVuY19leGl0KCk7CisgIHJldHVybiBmb3VuZD8wOi1FSU87Cit9CisKKworc3RhdGljIHZvaWQgX19leGl0IHJpb19leGl0ICh2b2lkKQoreworICBpbnQgaTsgCisgIHN0cnVjdCBIb3N0ICpocDsKKyAgCisgIGZ1bmNfZW50ZXIoKTsKKworICBmb3IgKGk9MCxocD1wLT5SSU9Ib3N0cztpPHAtPlJJT051bUhvc3RzO2krKywgaHArKykgeworICAgIFJJT0hvc3RSZXNldCAoaHAtPlR5cGUsIGhwLT5DYXJkUCwgaHAtPlNsb3QpOworICAgIGlmIChocC0+SXZlYykgeworICAgICAgZnJlZV9pcnEgKGhwLT5JdmVjLCBocCk7CisgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX0lOSVQsICJmcmVlZCBpcnEgJWQuXG4iLCBocC0+SXZlYyk7CisgICAgfQorICAgIC8qIEl0IGlzIHNhZmUvYWxsb3dlZCB0byBkZWxfdGltZXIgYSBub24tYWN0aXZlIHRpbWVyICovCisgICAgZGVsX3RpbWVyICgmaHAtPnRpbWVyKTsKKyAgfQorCisgIGlmIChtaXNjX2RlcmVnaXN0ZXIoJnJpb19md19kZXZpY2UpIDwgMCkgeworICAgIHByaW50ayAoS0VSTl9JTkZPICJyaW86IGNvdWxkbid0IGRlcmVnaXN0ZXIgY29udHJvbC1kZXZpY2VcbiIpOworICB9CisKK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F0dXJlWzVdOworICBjaGFyIG9lbV9pZDsKKyAgY2hhciBpZGVudGlmaWVyWzE2XTsKK307CisKKworI2RlZmluZSBSSU9fREVCVUdfQUxMICAgICAgICAgICAweGZmZmZmZmZmCisKKyNkZWZpbmUgT19PVEhFUih0dHkpICAgIFwKKyAgICAgICgoT19PTENVQyh0dHkpKSAgfHxcCisgICAgICAoT19PTkxDUih0dHkpKSAgIHx8XAorICAgICAgKE9fT0NSTkwodHR5KSkgICB8fFwKKyAgICAgIChPX09OT0NSKHR0eSkpICAgfHxcCisgICAgICAoT19PTkxSRVQodHR5KSkgIHx8XAorICAgICAgKE9fT0ZJTEwodHR5KSkgICB8fFwKKyAgICAgIChPX09GREVMKHR0eSkpICAgfHxcCisgICAgICAoT19OTERMWSh0dHkpKSAgIHx8XAorICAgICAgKE9fQ1JETFkodHR5KSkgICB8fFwKKyAgICAgIChPX1RBQkRMWSh0dHkpKSAgfHxcCisgICAgICAoT19CU0RMWSh0dHkpKSAgIHx8XAorICAgICAgKE9fVlRETFkodHR5KSkgICB8fFwKKyAgICAgIChPX0ZGRExZKHR0eSkpKQorCisvKiBTYW1lIGZvciBpbnB1dC4gKi8KKyNkZWZpbmUgSV9PVEhFUih0dHkpICAgIFwKKyAgICAgICgoSV9JTkxDUih0dHkpKSAgfHxcCisgICAgICAoSV9JR05DUih0dHkpKSAgIHx8XAorICAgICAgKElfSUNSTkwodHR5KSkgICB8fFwKKyAgICAgIChJX0lVQ0xDKHR0eSkpICAgfHxcCisgICAgICAoTF9JU0lHKHR0eSkpKQorCisKKyNlbmRpZiAvKiBfX0tFUk5FTF9fICovCisKKworI2RlZmluZSBSSU9fQk9BUkRfSU5UUl9MT0NLICAxCisKKworI2lmbmRlZiBSSU9DVExfTUlTQ19NSU5PUiAKKy8qIEFsbG93IG90aGVycyB0byBnYXRoZXIgdGhpcyBpbnRvICJtYWpvci5oIiBvciBzb21ldGhpbmcgbGlrZSB0aGF0ICovCisjZGVmaW5lIFJJT0NUTF9NSVNDX01JTk9SICAgIDE2OQorI2VuZGlmCisKKworLyogQWxsb3cgdXMgdG8gZGVidWcgImluIHRoZSBmaWVsZCIgd2l0aG91dCByZXF1aXJpbmcgY2xpZW50cyB0bworICAgcmVjb21waWxlLi4uLiAqLworI2lmIDEKKyNkZWZpbmUgcmlvX3NwaW5fbG9ja19pcnFzYXZlKHNlbSwgZmxhZ3MpIGRvIHsgXAorCXJpb19kcHJpbnRrIChSSU9fREVCVUdfU1BJTkxPQ0ssICJzcGlubG9ja2lycXNhdmU6ICVwICVzOiVkXG4iLCBcCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW0sIF9fRklMRV9fLCBfX0xJTkVfXyk7XAorCXNwaW5fbG9ja19pcnFzYXZlKHNlbSwgZmxhZ3MpO1wKKwl9IHdoaWxlICgwKQorCisjZGVmaW5lIHJpb19zcGluX3VubG9ja19pcnFyZXN0b3JlKHNlbSwgZmxhZ3MpIGRvIHsgXAorCXJpb19kcHJpbnRrIChSSU9fREVCVUdfU1BJTkxPQ0ssICJzcGludW5sb2NraXJxcmVzdG9yZTogJXAgJXM6JWRcbiIsXAorCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VtLCBfX0ZJTEVfXywgX19MSU5FX18pO1wKKwlzcGluX3VubG9ja19pcnFyZXN0b3JlKHNlbSwgZmxhZ3MpO1wKKwl9IHdoaWxlICgwKQorCisjZGVmaW5lIHJpb19zcGluX2xvY2soc2VtKSBkbyB7IFwKKwlyaW9fZHByaW50ayAoUklPX0RFQlVHX1NQSU5MT0NLLCAic3BpbmxvY2s6ICVwICVzOiVkXG4iLFwKKwkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbSwgX19GSUxFX18sIF9fTElORV9fKTtcCisJc3Bpbl9sb2NrKHNlbSk7XAorCX0gd2hpbGUgKDApCisKKyNkZWZpbmUgcmlvX3NwaW5fdW5sb2NrKHNlbSkgZG8geyBcCisJcmlvX2RwcmludGsgKFJJT19ERUJVR19TUElOTE9DSywgInNwaW51bmxvY2s6ICVwICVzOiVkXG4iLFwKKwkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbSwgX19GSUxFX18sIF9fTElORV9fKTtcCisJc3Bpbl91bmxvY2soc2VtKTtcCisJfSB3aGlsZSAoMCkKKyNlbHNlCisjZGVmaW5lIHJpb19zcGluX2xvY2tfaXJxc2F2ZShzZW0sIGZsYWdzKSBcCisgICAgICAgICAgICBzcGluX2xvY2tfaXJxc2F2ZShzZW0sIGZsYWdzKQorCisjZGVmaW5lIHJpb19zcGluX3VubG9ja19pcnFyZXN0b3JlKHNlbSwgZmxhZ3MpIFwKKyAgICAgICAgICAgIHNwaW5fdW5sb2NrX2lycXJlc3RvcmUoc2VtLCBmbGFncykKKworI2RlZmluZSByaW9fc3Bpbl9sb2NrKHNlbSkgXAorICAgICAgICAgICAgc3Bpbl9sb2NrKHNlbSkgCisKKyNkZWZpbmUgcmlvX3NwaW5fdW5sb2NrKHNlbSkgXAorICAgICAgICAgICAgc3Bpbl91bmxvY2soc2VtKSAKKworI2VuZGlmCisKKworCisjaWZkZWYgQ09ORklHX1JJT19PTERQQ0kKK3N0YXRpYyBpbmxpbmUgdm9pZCAqcmlvX21lbWNweV90b2lvICh2b2lkICpkdW1teSwgdm9pZCAqZGVzdCwgdm9pZCAqc291cmNlLCBpbnQgbikKK3sKKyAgY2hhciAqZHN0ID0gZGVzdDsKKyAgY2hhciAqc3JjID0gc291cmNlOworCisgIHdoaWxlIChuLS0pIHsKKyAgICB3cml0ZWIgKCpzcmMrKywgZHN0KyspOworICAgICh2b2lkKSByZWFkYiAoZHVtbXkpOworICB9CisKKyAgcmV0dXJuIGRlc3Q7Cit9CisKKworc3RhdGljIGlubGluZSB2b2lkICpyaW9fbWVtY3B5X2Zyb21pbyAodm9pZCAqZGVzdCwgdm9pZCAqc291cmNlLCBpbnQgbikKK3sKKyAgY2hhciAqZHN0ID0gZGVzdDsKKyAgY2hhciAqc3JjID0gc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2NyaXB0aW9uCToJUHJvdG90eXBlcywgc3RydWN0dXJlcyBhbmQgZGVmaW5pdGlvbnMJKi8KKy8qCQkJCWRlc2NyaWJpbmcgdGhlIFJJTyBib2FyZCBoYXJkd2FyZQkqLworLyoJCQkJCQkJCQkqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogSGlzdG9yeS4uLgorCisxLjAuMAkyNi8wNC85OSBOUFYJQ3JlYXRpb24uCisKKyovCisKKyNpZm5kZWYJX3Jpb2JvYXJkX2gJCQkJLyogSWYgUklPQk9BUkQuSCBub3QgYWxyZWFkeSBkZWZpbmVkICovCisjZGVmaW5lCV9yaW9ib2FyZF9oICAgIDEKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqICAgSGFyZHdhcmUgQ29udHJvbCBSZWdpc3RlcnMgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogSGFyZHdhcmUgUmVnaXN0ZXJzLi4uICovCisKKyNkZWZpbmUJUklPX1JFR19CQVNFCTB4N0MwMAkJCS8qIEJhc2Ugb2YgY29udHJvbCByZWdpc3RlcnMgKi8KKworI2RlZmluZQlSSU9fQ09ORklHCVJJT19SRUdfQkFTRSArIDB4MDAwMAkvKiBXUklURTogQ29uZmlndXJhdGlvbiBSZWdpc3RlciA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OVF9MRU4JMHgxMAorCisvKiBWUEQgUk9NIERlZmluaXRpb25zLi4uICovCisjZGVmaW5lCVNMWF9JRDEJCTB4NEQKKyNkZWZpbmUJU0xYX0lEMgkJMHg5OAorCisjZGVmaW5lCVBST0RVQ1RfSUQoYSkJKChhPj40KSYweEYpCQkvKiBVc2UgdG8gb2J0YWluIFByb2R1Y3QgSUQgZnJvbSBWUERfVU5JUVVFSUQxICovCisKKyNkZWZpbmUJSURfU1hfSVNBCTB4MgorI2RlZmluZQlJRF9SSU9fRUlTQQkweDMKKyNkZWZpbmUJSURfU1hfUENJCTB4NQorI2RlZmluZQlJRF9TWF9FSVNBCTB4NworI2RlZmluZQlJRF9SSU9fUlRBMTYJMHg5CisjZGVmaW5lCUlEX1JJT19JU0EJMHhBCisjZGVmaW5lCUlEX1JJT19NQ0EJMHhCCisjZGVmaW5lCUlEX1JJT19TQlVTCTB4QworI2RlZmluZQlJRF9SSU9fUENJCTB4RAorI2RlZmluZQlJRF9SSU9fUlRBOAkweEUKKworLyogVHJhbnNwdXRlciBib290c3RyYXAgZGVmaW5pdGlvbnMuLi4gKi8KKworI2RlZmluZQlCT09UTE9BREFERFIJCSgweDgwMDAgLSA2KQorI2RlZmluZQlCT09USU5ESUNBVEUJCSgweDgwMDAgLSAyKQorCisvKiBGaXJtd2FyZSBsb2FkIHBvc2l0aW9uLi4uICovCisKKyNkZWZpbmUJRklSTVdBUkVMT0FEQUREUgkweDdDMDAJCS8qIEZpcm13YXJlIGlzIGxvYWRlZCBfYmVmb3JlXyB0aGlzIGFkZHJlc3MgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUklPIChSZXYxKSBJU0EgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogQ29udHJvbCBSZWdpc3RlciBEZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlSSU9fSVNBX0lERU5UCSJKQkpHUEdHSElOU01KUEpSIgorCisjZGVmaW5lCVJJT19JU0FfQ0ZHX0JPT1RSQU0JMHgwMQkJLyogQm9vdCBmcm9tIFJBTSwgZWxzZSBMaW5rICovCisjZGVmaW5lCVJJT19JU0FfQ0ZHX0JVU0VOQUJMRQkweDAyCQkvKiBFbmFibGUgcHJvY2Vzc29yIGJ1cyAqLworI2RlZmluZQlSSU9fSVNBX0NGR19JUlFNQVNLCTB4MzAJCS8qIEludGVycnVwdCBtYXNrICovCisjZGVmaW5lCSAgUklPX0lTQV9DRkdfSVJRMTIJMHgxMAkJLyogSW50ZXJydXB0IExldmVsIDEyICovCisjZGVmaW5lCSAgUklPX0lTQV9DRkdfSVJRMTEJMHgyMAkJLyogSW50ZXJydXB0IExldmVsIDExICovCisjZGVmaW5lCSAgUklPX0lTQV9DRkdfSVJROQkweDMwCQkvKiBJbnRlcnJ1cHQgTGV2ZWwgOSAqLworI2RlZmluZQlSSU9fSVNBX0NGR19MSU5LMjAJMHg0MAkJLyogMjBNYnBzIGxpbmssIGVsc2UgMTBNYnBzICovCisjZGVmaW5lCVJJT19JU0FfQ0ZHX1dBSVRTVEFURTAJMHg4MAkJLyogMCB3YWl0c3RhdGVzLCBlbHNlIDEgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUklPIChSZXYyKSBJU0EgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogQ29udHJvbCBSZWdpc3RlciBEZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlSSU9fSVNBMl9JREVOVAkiSkJKR1BHR0hJTlNNSlBKUiIKKworI2RlZmluZQlSSU9fSVNBMl9DRkdfQk9PVFJBTQkweDAxCQkvKiBCb290IGZyb20gUkFNLCBlbHNlIExpbmsgKi8KKyNkZWZpbmUJUklPX0lTQTJfQ0ZHX0JVU0VOQUJMRQkweDAyCQkvKiBFbmFibGUgcHJvY2Vzc29yIGJ1cyAqLworI2RlZmluZQlSSU9fSVNBMl9DRkdfSU5URU5BQkxFCTB4MDQJCS8qIEludGVycnVwdCBlbmFibGUsIGVsc2UgZGlzYWJsZSAqLworI2RlZmluZQlSSU9fSVNBMl9DRkdfMTZCSVQJMHgwOAkJLyogMTZiaXQgbW9kZSwgZWxzZSA4Yml0ICovCisjZGVmaW5lCVJJT19JU0EyX0NGR19JUlFNQVNLCTB4MzAJCS8qIEludGVycnVwdCBtYXNrICovCisjZGVmaW5lCSAgUklPX0lTQTJfQ0ZHX0lSUTE1CTB4MDAJCS8qIEludGVycnVwdCBMZXZlbCAxNSAqLworI2RlZmluZQkgIFJJT19JU0EyX0NGR19JUlExMgkweDEwCQkvKiBJbnRlcnJ1cHQgTGV2ZWwgMTIgKi8KKyNkZWZpbmUJICBSSU9fSVNBMl9DRkdfSVJRMTEJMHgyMAkJLyogSW50ZXJydXB0IExldmVsIDExICovCisjZGVmaW5lCSAgUklPX0lTQTJfQ0ZHX0lSUTkJMHgzMAkJLyogSW50ZXJydXB0IExldmVsIDkgKi8KKyNkZWZpbmUJUklPX0lTQTJfQ0ZHX0xJTksyMAkweDQwCQkvKiAyME1icHMgbGluaywgZWxzZSAxME1icHMgKi8KKyNkZWZpbmUJUklPX0lTQTJfQ0ZHX1dBSVRTVEFURTAJMHg4MAkJLyogMCB3YWl0c3RhdGVzLCBlbHNlIDEgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUklPIChKZXQpIElTQSAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogQ29udHJvbCBSZWdpc3RlciBEZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlSSU9fSVNBM19JREVOVAkiSkVUIEhPU1QgQlkgS0VWIyIKKworI2RlZmluZQlSSU9fSVNBM19DRkdfQlVTRU5BQkxFCTB4MDIJCS8qIEVuYWJsZSBwcm9jZXNzb3IgYnVzICovCisjZGVmaW5lCVJJT19JU0EzX0NGR19JTlRFTkFCTEUJMHgwNAkJLyogSW50ZXJydXB0IGVuYWJsZSwgZWxzZSBkaXNhYmxlICovCisjZGVmaW5lCVJJT19JU0EzMl9DRkdfSVJRTUFTSwkweEYzMAkJLyogSW50ZXJydXB0IG1hc2sgKi8KKyNkZWZpbmUJICBSSU9fSVNBM19DRkdfSVJRMTUJMHhGMAkJLyogSW50ZXJydXB0IExldmVsIDE1ICovCisjZGVmaW5lCSAgUklPX0lTQTNfQ0ZHX0lSUTEyCTB4QzAJCS8qIEludGVycnVwdCBMZXZlbCAxMiAqLworI2RlZmluZQkgIFJJT19JU0EzX0NGR19JUlExMQkweEIwCQkvKiBJbnRlcnJ1cHQgTGV2ZWwgMTEgKi8KKyNkZWZpbmUJICBSSU9fSVNBM19DRkdfSVJRMTAJMHhBMAkJLyogSW50ZXJydXB0IExldmVsIDEwICovCisjZGVmaW5lCSAgUklPX0lTQTNfQ0ZHX0lSUTkJMHg5MAkJLyogSW50ZXJydXB0IExldmVsIDkgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFJJTyBNQ0EgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogQ29udHJvbCBSZWdpc3RlciBEZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlSSU9fTUNBX0lERU5UCSJKQkpHUEdHSElOU01KUEpSIgorCisjZGVmaW5lCVJJT19NQ0FfQ0ZHX0JPT1RSQU0JMHgwMQkJLyogQm9vdCBmcm9tIFJBTSwgZWxzZSBMaW5rICovCisjZGVmaW5lCVJJT19NQ0FfQ0ZHX0JVU0VOQUJMRQkweDAyCQkvKiBFbmFibGUgcHJvY2Vzc29yIGJ1cyAqLworI2RlZmluZQlSSU9fTUNBX0NGR19MSU5LMjAJMHg0MAkJLyogMjBNYnBzIGxpbmssIGVsc2UgMTBNYnBzICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFJJTyBFSVNBICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIEVJU0EgQ29uZmlndXJhdGlvbiBTcGFjZSBEZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlFSVNBX1BST0RVQ1RfSUQxCTB4QzgwCisjZGVmaW5lCUVJU0FfUFJPRFVDVF9JRDIJMHhDODEKKyNkZWZpbmUJRUlTQV9QUk9EVUNUX05VTUJFUgkweEM4MgorI2RlZmluZQlFSVNBX1JFVklTSU9OX05VTUJFUgkweEM4MworI2RlZmluZQlFSVNBX0NBUkRfRU5BQkxFCTB4Qzg0CisjZGVmaW5lCUVJU0FfVlBEX1VOSVFVRUlENAkweEM4OAkJLyogUkVBRDogVW5pcXVlIElkZW50aWZpZXIgIzQgKi8KKyNkZWZpbmUJRUlTQV9WUERfVU5JUVVFSUQzCTB4QzhBCQkvKiBSRUFEOiBVbmlxdWUgSWRlbnRpZmllciAjMyAqLworI2RlZmluZQlFSVNBX1ZQRF9VTklRVUVJRDIJMHhDOTAJCS8qIFJFQUQ6IFVuaXF1ZSBJZGVudG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ioqKioqICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBSSU8gU0J1cyAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiBDb250cm9sIFJlZ2lzdGVyIERlZmluaXRpb25zLi4uICovCisjZGVmaW5lCVJJT19TQlVTX0lERU5UCSJKQlBHSyNcMFwwXDBcMFwwXDBcMFwwXDBcMCIKKworI2RlZmluZQlSSU9fU0JVU19DRkdfQk9PVFJBTQkweDAxCQkvKiBCb290IGZyb20gUkFNLCBlbHNlIExpbmsgKi8KKyNkZWZpbmUJUklPX1NCVVNfQ0ZHX0JVU0VOQUJMRQkweDAyCQkvKiBFbmFibGUgcHJvY2Vzc29yIGJ1cyAqLworI2RlZmluZQlSSU9fU0JVU19DRkdfSU5URU5BQkxFCTB4MDQJCS8qIEludGVycnVwdCBlbmFibGUsIGVsc2UgZGlzYWJsZSAqLworI2RlZmluZQlSSU9fU0JVU19DRkdfSVJRTUFTSwkweDM4CQkvKiBJbnRlcnJ1cHQgbWFzayAqLworI2RlZmluZQkgIFJJT19TQlVTX0NGR19JUlFOT05FCTB4MDAJCS8qIE5vIEludGVycnVwdCAqLworI2RlZmluZQkgIFJJT19TQlVTX0NGR19JUlE3CTB4MzgJCS8qIEludGVycnVwdCBMZXZlbCA3ICovCisjZGVmaW5lCSAgUklPX1NCVVNfQ0ZHX0lSUTYJMHgzMAkJLyogSW50ZXJydXB0IExldmVsIDYgKi8KKyNkZWZpbmUJICBSSU9fU0JVU19DRkdfSVJRNQkweDI4CQkvKiBJbnRlcnJ1cHQgTGV2ZWwgNSAqLworI2RlZmluZQkgIFJJT19TQlVTX0NGR19JUlE0CTB4MjAJCS8qIEludGVycnVwdCBMZXZlbCA0ICovCisjZGVmaW5lCSAgUklPX1NCVVNfQ0ZHX0lSUTMJMHgxOAkJLyogSW50ZXJydXB0IExldmVsIDMgKi8KKyNkZWZpbmUJICBSSU9fU0JVU19DRkdfSVJRMgkweDEwCQkvKiBJbnRlcnJ1cHQgTGV2ZWwgMiAqLworI2RlZmluZQkgIFJJT19TQlVTX0NGR19JUlExCTB4MDgJCS8qIEludGVycnVwdCBMZXZlbCAxICovCisjZGVmaW5lCVJJT19TQlVTX0NGR19MSU5LMjAJMHg0MAkJLyogMjBNYnBzIGxpbmssIGVsc2UgMTBNYnBzICovCisjZGVmaW5lCVJJT19TQlVTX0NGR19QUk9DMjUJMHg4MAkJLyogMjVNaHogcHJvY2Vzc29yIGNsb2NrLCBlbHNlIDIwTWh6ICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBSSU8gUENJICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIENvbnRyb2wgUmVnaXN0ZXIgRGVmaW5pdGlvbnMuLi4gKi8KKyNkZWZpbmUJUklPX1BDSV9JREVOVAkiRUNERFBHSkdKSEpSR1NLIyIKKworI2RlZmluZQlSSU9fUENJX0NGR19CT09UUkFNCTB4MDEJCS8qIEJvb3QgZnJvbSBSQU0sIGVsc2UgTGluayAqLworI2RlZmluZQlSSU9fUENJX0NGR19CVVNFTkFCTEUJMHgwMgkJLyogRW5hYmxlIHByb2Nlc3NvciBidXMgKi8KKyNkZWZpbmUJUklPX1BDSV9DRkdfSU5URU5BQkxFCTB4MDQJCS8qIEludGVycnVwdCBlbmFibGUsIGVsc2UgZGlzYWJsZSAqLworI2RlZmluZQlSSU9fUENJX0NGR19MSU5LMjAJMHg0MAkJLyogMjBNYnBzIGxpbmssIGVsc2UgMTBNYnBzICovCisjZGVmaW5lCVJJT19QQ0lfQ0ZHX1BST0MyNQkweDgwCQkvKiAyNU1oeiBwcm9jZXNzb3IgY2xvY2ssIGVsc2UgMjBNaHogKi8KKworLyogUENJIERlZmluaXRpb25zLi4uICovCisjZGVmaW5lCVNQWF9WRU5ET1JfSUQJCTB4MTFDQgkJLyogQXNzaWduZWQgYnkgdGhlIFBDSSBTSUcgKi8KKyNkZWZpbmUJU1BYX0RFVklDRV9JRAkJMHg4MDAwCQkvKiBSSU8gYnJpZGdlIGJvYXJkcyAqLworI2RlZmluZQlTUFhfUExYREVWSUNFX0lECTB4MjAwMAkJLyogUExYIGJyaWRnZSBib2FyZHMgKi8KKyNkZWZpbmUJU1BYX1NVQl9WRU5ET1JfSUQJU1BYX1ZFTkRPUl9JRAkvKiBTYW1lIGFzIHZlbmRvciBpZCAqLworI2RlZmluZQlSSU9fU1VCX1NZU19JRAkJMHgwODAwCQkvKiBSSU8gUENJIGJvYXJkICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFJJTyAoSmV0KSBQQ0kgICAqKioqKioqKioqKioqKioqKio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isKKwkvKgorCSoqIENvcHkgdGhlIGRhdGEgZnJvbSB1c2VyIHNwYWNlLgorCSovCisKKwlpZiAoIGNvcHlpbigoaW50KXJicC0+RGF0YVAsKChjYWRkcl90KShwLT5SSU9Cb290UGFja2V0cykpK29mZnNldCwKKwkJCQlyYnAtPkNvdW50KSA9PUNPUFlGQUlMICkgeworCQlyaW9fZHByaW50ayAoUklPX0RFQlVHX0JPT1QsICJCYWQgZGF0YSBjb3B5IGZyb20gdXNlciBzcGFjZVxuIik7CisJCXAtPlJJT0Vycm9yLkVycm9yID0gQ09QWUlOX0ZBSUxFRDsKKwkJLyogcmVzdG9yZShvbGRzcGwpOyAqLworCQlmdW5jX2V4aXQgKCk7CisJCXJldHVybiAtRUZBVUxUOworCX0KKworCS8qCisJKiogTWFrZSBzdXJlIHRoYXQgb3VyIGNvcHkgb2YgdGhlIHNpemUgaW5jbHVkZXMgdGhhdCBvZmZzZXQgd2UgZGlzY3Vzc2VkCisJKiogZWFybGllci4KKwkqLworCXAtPlJJT051bUJvb3RQa3RzID0gKHJicC0+Q291bnQrb2Zmc2V0KS9SVEFfQk9PVF9EQVRBX1NJWkU7CisJcC0+UklPQm9vdENvdW50ICAgPSByYnAtPkNvdW50OworCisJLyogcmVzdG9yZShvbGRzcGwpOyAqLworCWZ1bmNfZXhpdCgpOworCXJldHVybiAwOworfQorCit2b2lkIHJpb19zdGFydF9jYXJkX3J1bm5pbmcgKHN0cnVjdCBIb3N0ICogSG9zdFApCit7CisJZnVuY19lbnRlciAoKTsKKworCXN3aXRjaCAoIEhvc3RQLT5UeXBlICkgeworCWNhc2UgUklPX0FUOgorCQlyaW9fZHByaW50ayAoUklPX0RFQlVHX0JPT1QsICJTdGFydCBJU0EgY2FyZCBydW5uaW5nXG4iKTsKKwkJV0JZVEUoSG9zdFAtPkNvbnRyb2wsIAorCQkgICAgICBCT09UX0ZST01fUkFNIHwgRVhURVJOQUxfQlVTX09OCisJCSAgICAgIHwgSG9zdFAtPk1vZGUKK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AgICAgcC0+UklPU2F2ZWRUYWJsZVtydGFdLlJ0YVVuaXF1ZU51bSk7CisKKwkJaWYgKCAocC0+UklPU2F2ZWRUYWJsZVtydGFdLkZsYWdzICYgU0xPVF9JTl9VU0UpICYmCisJCSAocC0+UklPU2F2ZWRUYWJsZVtydGFdLlJ0YVVuaXF1ZU51bSA9PSBSdGFVbmlxKSApCisJCXsKKwkJICAgIE1hcFAgPSAmcC0+UklPU2F2ZWRUYWJsZVtydGFdOworCQkgICAgRmxhZyA9IHAtPlJJT1NhdmVkVGFibGVbcnRhXS5GbGFnczsKKwkJICAgIGlmIChSdGFUeXBlID09IFRZUEVfUlRBMTYpCisJCSAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGVudHJ5MiA9IHJ0YSArIDE7IGVudHJ5MiA8IFRPVEFMX01BUF9FTlRSSUVTOworICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5MisrKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwLT5SSU9TYXZlZFRhYmxlW2VudHJ5Ml0uUnRhVW5pcXVlTnVtID09IFJ0YVVuaXEpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgTWFwUDIgPSAmcC0+UklPU2F2ZWRUYWJsZVtlbnRyeTJdOworICAgICAgICAgICAgICAgICAgICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19CT09ULCAiVGhpcyBSVEEgaXMgZnJvbSB0YWJsZSBlbnRyaWVzICVkKyVkXG4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnRhLCBlbnRyeTIpOworCQkgICAgfQorCQkgICAgZWxzZQorCQkJcmlvX2RwcmludGsgKFJJT19ERUJVR19CT09ULCAiVGhpcyBSVEEgaXMgZnJvbSB0YWJsZSBlbnRyeSAlZFxuIiwgcnRhKTs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PREVNX1NVUFBPUlQKKwkJCQlpZiAoIFBvcnRQLT5NYXBwZWQgKSB7CisJCQkJLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXAorCQkJCSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKwkJCQkqKioJCQkJCQkJCQkJCQkJICAgKioqCisJCQkJKioqCQkgIE0gTyBEIEUgTSAgIFMgVCBBIFQgRSAgIEMgSCBBIE4gRyBFCQkgICoqKgorCQkJCSoqKgkJCQkJCQkJCQkJCQkgICAqKioKKwkJCQkqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisJCQkJXCoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCQkJCS8qCisJCQkJKiogSWYgdGhlIGRldmljZSBpcyBhIG1vZGVtLCB0aGVuIGNoZWNrIHRoZSBtb2RlbQorCQkJCSoqIGNhcnJpZXIuCisJCQkJKi8KKwkJCQlpZiAoUG9ydFAtPmdzLnR0eSA9PSBOVUxMKQorCQkJCQlicmVhazsKKwkJCQlpZiAoUG9ydFAtPmdzLnR0eS0+dGVybWlvcyA9PSBOVUxMKQorCQkJCQlicmVhazsKKwkJCSAgCisJCQkJaWYgKCEoUG9ydFAtPmdzLnR0eS0+dGVybWlvcy0+Y19jZmxhZyAmIENMT0NBTCkgJiYKKwkJCQkoKFBvcnRQLT5TdGF0ZSAmIChSSU9fTU9QRU58UklPX1dPUEVOKSkpKSB7CisKKwkJCQkJcmlvX2RwcmludGsgKFJJT19ERUJVR19DTUQsICJJcyB0aGVyZSBhIENhcnJpZXI/XG4iKTsKKwkJCS8qCisJCQkqKiBJcyB0aGVyZSBhIGNhcnJpZXI/CisJCQkqLworCQkJCQlpZiAoIFBvcnRQLT5Nb2RlbVN0YXRlICYgTVNWUjFfQ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tPlJJT0hvc3RzW1JJT051bUhvc3RzXS5VbmlxdWVbMV0pJjB4RkYpPDw4KXwKKwkJCSgoUkJZVEUocC0+UklPSG9zdHNbUklPTnVtSG9zdHNdLlVuaXF1ZVsyXSkmMHhGRik8PDE2KXwKKwkJCSgoUkJZVEUocC0+UklPSG9zdHNbUklPTnVtSG9zdHNdLlVuaXF1ZVszXSkmMHhGRik8PDI0KTsKKwkJSU5CWihFaXNhU2xvdCxFSVNBX0lOVEVSUlVQVF9SRVNFVCk7CisJCQkJUklPTnVtSG9zdHMrKzsKKwkJcmV0Kys7CisJCQl9CisJCWVsc2UKKwkJeworCQkvKgorCQkqKiBJdCBmYWlsZWQgdGhlIHRlc3QsIHNvIGlnbm9yZSBpdC4KKwkJKi8KKwkJcmlvX2RwcmludGsgKFJJT19ERUJVR19JTklULCAiVEVTVCBGQUlMRURcbiIpOworCisJCVJJT01hcG91dChQYWRkciwgUklPX0VJU0FfTUVNX1NJWkUsIENhZGRyICk7CisJCX0KKwl9CisJfQorCWlmIChSSU9NYWNoaW5lVHlwZSAmIFJJT19FSVNBKQorCXJldHVybiByZXQrMTsKKwlyZXR1cm4gcmV0OworfQorI2VuZGlmCisKKworI2lmbmRlZiBsaW51eAorCisjZGVmaW5lIENPTkZJR19BRERSRVNTCTB4Y2Y4CisjZGVmaW5lIENPTkZJR19EQVRBCQkweGNmYworI2RlZmluZSBGT1JXQVJEX1JFRwkJMHhjZmEKKworCitzdGF0aWMgaW50CityZWFkX2NvbmZpZyhpbnQgYnVzX251bWJlciwgaW50IGRldmljZV9udW0sIGludCByX251bWJlcikgCit7CisJdW5zaWduZWQgaW50IGNhdjsKKwl1bnNpZ25lZCBpbnQgdmFsOworCisvKgorICAgQnVpbGQgY29uZmlnX2FkZHJlc3NfdmFsdWU6CisKKyAgICAgIDMxICAgICAgICAyNCAyMyAgICAgICAgMTYgMTUgICAgICAxMSAxMCAgOCA3ICAgICAgICAwIAorICAgICAgLS0tLS0tLS0tLS0tLS0tLS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R5X3N0cnVjdCAqdHR5UDsKKyAgICAgIHN0cnVjdCBQS1QgKlBhY2tldFA7CisJCQorICAgICAgLyoKKyAgICAgICoqIG5vdCBtYXBwZWQgaW4gLSBtb3N0IG9mIHRoZSBSSU9Qb3J0cFtdIGluZm9ybWF0aW9uCisgICAgICAqKiBoYXMgbm90IGJlZW4gc2V0IHVwIQorICAgICAgKiogT3B0aW1pc2U6IHBvcnRzIGNvbWUgaW4gYnVuZGxlcyBvZiBlaWdodC4KKyAgICAgICovCisgICAgICBpZiAoICFQb3J0UC0+TWFwcGVkICkgeworCXBvcnQgKz0gNzsKKwljb250aW51ZTsgLyogd2l0aCB0aGUgbmV4dCBwb3J0ICovCisgICAgICB9CisKKyAgICAgIC8qCisgICAgICAqKiBJZiB0aGUgaG9zdCBib2FyZCBpc24ndCBUSElTIGhvc3QgYm9hcmQsIGNoZWNrIHRoZSBuZXh0IG9uZS4KKyAgICAgICoqIG9wdGltaXNlOiBwb3J0cyBjb21lIGluIGJ1bmRsZXMgb2YgZWlnaHQuCisgICAgICAqLworICAgICAgaWYgKCBQb3J0UC0+SG9zdFAgIT0gSG9zdFAgKSB7CisJcG9ydCArPSA3OworCWNvbnRpbnVlOworICAgICAgfQorCisgICAgICAvKgorICAgICAgKiogTGV0IHVzIHNlZSAtIGlzIHRoZSBwb3J0IG9wZW4/IElmIG5vdCwgdGhlbiBkb24ndCBzZXJ2aWNlIGl0LgorICAgICAgKi8KKyAgICAgIGlmICggISggUG9ydFAtPlBvcnRTdGF0ZSAmIFBPUlRfSVNPUEVOICkgKSB7CisJY29udGludWU7CisgICAgICB9CisKKyAgICAgIC8qCisgICAgICAqKiBmaW5kIGNvcnJlc3BvbmRpbmcgdHR5IHN0cnVjdHVyZS4gVGhlIHByb2Nlc3Mgb2YgbWFwcGluZworICAgICAgKiogdGhlIHBvcnRzIHB1dHMgdGhlc2UgaGVyZS4KKyAgICAgICovCisgICAgICB0dHlQID0gUG9ydFAtPmdzLnR0eTsKKworICAgIC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sKKworCSAgLyoKKwkgICoqIElmIHNlY29uZCBibG9jayBvZiBwb3J0cyBmb3IgMTYgcG9ydCBSVEEsIGFkZCA4CisJICAqKiB0byBpbmRleCA4LTE1LgorCSAgKi8KKwkgIGlmICggUG9ydFAtPlNlY29uZEJsb2NrICkKKwkgICAgcCArPSBQT1JUU19QRVJfUlRBOworCisJICBXQllURSggUGt0Q21kUC0+UGhiTnVtLCBwICk7CisKKwkgIC8qCisJICAqKiB0byBtYWtlIGRlYnVnZ2VyeSBlYXNpZXIKKwkgICovCisJICBXQllURSggUGFja2V0UC0+ZGF0YVsgMl0sICdXJyAgKTsKKwkgIFdCWVRFKCBQYWNrZXRQLT5kYXRhWyAzXSwgJ0YnICApOworCSAgV0JZVEUoIFBhY2tldFAtPmRhdGFbIDRdLCAnTCcgICk7CisJICBXQllURSggUGFja2V0UC0+ZGF0YVsgNV0sICdVJyAgKTsKKwkgIFdCWVRFKCBQYWNrZXRQLT5kYXRhWyA2XSwgJ1MnICApOworCSAgV0JZVEUoIFBhY2tldFAtPmRhdGFbIDddLCAnSCcgICk7CisJICBXQllURSggUGFja2V0UC0+ZGF0YVsgOF0sICcgJyAgKTsKKwkgIFdCWVRFKCBQYWNrZXRQLT5kYXRhWyA5XSwgJzAnK1BvcnRQLT5XZmx1c2hGbGFnICk7CisJICBXQllURSggUGFja2V0UC0+ZGF0YVsxMF0sICcgJyAgKTsKKwkgIFdCWVRFKCBQYWNrZXRQLT5kYXRhWzExXSwgJyAnICApOworCSAgV0JZVEUoIFBhY2tldFAtPmRhdGFbMTJdLCAnXDAnICk7CisKKwkgIC8qCisJICAqKiBpdHMgdHdvIGJ5dGVzIGxvbmchCisJICAqLworCSAgV0JZVEUoIFBhY2tldFAtPmxlbiAsIFBLVF9DTURfQklUIHwgMiApOworCisJICAvKgorCSAgKiogcXVldWUgaXQhCisJICAqLworCSAgaWYgKCAhKCBQb3J0UC0+U3RhdGUgJiBSSU9fREVMRVRFRCApICkgeworCSAgICBhZGRfd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BOZXdMaW5rPVRoaXNMaW5rTWluOyBOZXdMaW5rIDwgVGhpc0xpbms7IE5ld0xpbmsrKyApCisgICAgICB7CisgICAgICAgIGlmICggKFJCWVRFKFBrdENtZFAtPlJvdXRlVG9wb2xvZ3lbVGhpc0xpbmtdLlVuaXQpID09CisgICAgICAgICAgICAgIFJCWVRFKFBrdENtZFAtPlJvdXRlVG9wb2xvZ3lbTmV3TGlua10uVW5pdCkpICYmCisJICAgICAoUkJZVEUoUGt0Q21kUC0+Um91dGVUb3BvbG9neVtUaGlzTGlua10uTGluaykgPT0KKyAgICAgICAgICAgICAgUkJZVEUoUGt0Q21kUC0+Um91dGVUb3BvbG9neVtOZXdMaW5rXS5MaW5rKSkgKQorCXsKKyAgICAgICAgICBMaWVzKys7CisJfQorICAgICAgfQorICAgIH0KKworICAgIGlmICggTGllcyApCisgICAgeworICAgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19ST1VURSwgIkxJRVMhIERBTU4gTElFUyEgJWQgTElFUyFcbiIsTGllcyk7CisgICAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX1JPVVRFLCAiJWQ6JWMgJWQ6JWMgJWQ6JWMgJWQ6JWNcbiIsCisgICAgICAgICAgUkJZVEUoUGt0Q21kUC0+Um91dGVUb3BvbG9neVswXS5Vbml0KSwgCisJICAnQScrUkJZVEUoUGt0Q21kUC0+Um91dGVUb3BvbG9neVswXS5MaW5rKSwKKyAgICAgICAgICBSQllURShQa3RDbWRQLT5Sb3V0ZVRvcG9sb2d5WzFdLlVuaXQpLAorCSAgJ0EnK1JCWVRFKFBrdENtZFAtPlJvdXRlVG9wb2xvZ3lbMV0uTGluayksCisgICAgICAgICAgUkJZVEUoUGt0Q21kUC0+Um91dGVUb3BvbG9neVsyXS5Vbml0KSwKKwkgICdBJytSQllURShQa3RDbWRQLT5Sb3V0ZVRvcG9sb2d5WzJdLkxpbmspLAorICAgICAgICAgIFJCWVRFKFBrdENtZFAtPlJvdXRlVG9wb2xvZ3lbM10uVW5pdCksCisJICAnQScrUkJZVEUoUGt0Q21kUC0+Um91dGVUb3BvbG9neVszXS5MaW5rKSk7CisgICAgICByZXR1cm4gVFJVRTsKKyAgICB9CisKKyAgICAvKgorICAgICoqIG5vdywgcHJvY2VzcyBlYWNoIGxpbmsuCisgICAgKi8KKyAgICBmb3IgKCBUaGlzTGluaz1UaGlzTGlua01pbjsgVGhpc0xpbmsgPD0gVGhpc0xpbmtNYXg7IFRoaXNMaW5rKyspCisgICAgeworICAgICAgLyoKKyAgICAgICoqIHRoaXMgaXMgd2hhdCBpdCB3YXMgY29ubmVjdGVkIHRvCisgICAgICAqLworICAgICAgT2xkVW5pdCA9IFRvcFBbVGhpc0xpbmtdLlVuaXQ7CisgICAgICBPbGRMaW5rID0gVG9wUFtUaGlzTGlua10uTGluazsKKworICAgICAgLyoKKyAgICAgICoqIHRoaXMgaXMgd2hhdCBpdCBpcyBub3cgY29ubmVjdGVkIHRvCisgICAgICAqLworICAgICAgTmV3VW5pdCA9IFJCWVRFKFBrdENtZFAtPlJvdXRlVG9wb2xvZ3lbVGhpc0xpbmtdLlVuaXQpOworICAgICAgTmV3TGluayA9IFJCWVRFKFBrdENtZFAtPlJvdXRlVG9wb2xvZ3lbVGhpc0xpbmtdLkxpbmspOworCisgICAgICBpZiAoIE9sZFVuaXQgIT0gTmV3VW5pdCB8fCBPbGRMaW5rICE9IE5ld0xpbmsgKQorICAgICAgeworCS8qCisJKiogc29tZXRoaW5nIGhhcyBjaGFuZ2VkIQorCSovCisKKyAgICAgICAgaWYgKCBOZXdVbml0ID4gTUFYX1JVUCAmJgorCSAgICAgTmV3VW5pdCAhPSBST1VURV9ESVNDT05ORUNUICYmCisJICAgICBOZXdVbml0ICE9IFJPVVRFX05PX0lEICYmCisJICAgICBOZXdVbml0ICE9IFJPVVRFX0lOVEVSQ09OTkVDVCApCisJeworCSAgICByaW9fZHByaW50ayAoUklPX0RFQlVHX1JPVVRFLCAiSSBoYXZlIGEgbGluayBmcm9tIC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1hcCkpOworCQkJd29ya19kb25lKys7CisJCX0KKwl9CisJaWYgKCB3b3JrX2RvbmUgKQorCQlyZXR1cm4gMDsKKworCXJpb19kcHJpbnRrIChSSU9fREVCVUdfVEFCTEUsICJDb3VsZG4ndCBmaW5kIGVudHJ5IHRvIGJlIGRlbGV0ZWRcbiIpOworCXAtPlJJT0Vycm9yLkVycm9yID0gQ09VTEROVF9GSU5EX0VOVFJZOworCXJldHVybiAtRU5YSU87Cit9CisKK2ludCBSSU9Bc3NpZ25SdGEoIHN0cnVjdCByaW9faW5mbyAqcCwgc3RydWN0IE1hcCAqTWFwUCApCit7CisgICAgaW50IGhvc3Q7CisgICAgc3RydWN0IE1hcCAqSG9zdE1hcFA7CisgICAgY2hhciAqc3B0cjsKKyAgICBpbnQJbGluazsKKworCisgICAgcmlvX2RwcmludGsgKFJJT19ERUJVR19UQUJMRSwgIkFzc2lnbiBlbnRyeSBvbiBob3N0ICV4LCBydGEgJXgsIElEICVkLCBTeXNwb3J0ICVkXG4iLAorCQkJCU1hcFAtPkhvc3RVbmlxdWVOdW0sTWFwUC0+UnRhVW5pcXVlTnVtLAorCQkJCU1hcFAtPklELCAoaW50KU1hcFAtPlN5c1BvcnQpOworCisgICAgaWYgKChNYXBQLT5JRCAhPSAodXNob3J0KS0xKSAmJgorCSgoaW50KU1hcFAtPklEIDwgKGludCkxIHx8IChpbnQpTWFwUC0+SUQgPiBNQVhfUlVQICkpCisgICAgeworCXJpb19kcHJpbnRrIChSSU9fREVCVUdfVEFCTEUsICJCYWQgSUQgaW4gbWFwIGVudHJ5IVxuIik7CisJcC0+UklPRXJyb3IuRXJyb3IgPSBJRF9OVU1CRVJfT1VUX09GX1JBTkdFOworCXJldHVybiAtRUlOVkFMOworICAgIH0KKyAgICBpZiAoTWFwUC0+UnRhVW5pcXVlTnVtID09IDApCisgICAgeworCXJpb19kcHJpbnRrIChSSU9fREVCVUdfVEFCTEUsICJSdGEgVW5pcXVlIG51bWJlciB6ZXJvIVxuIik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FTiApOworCQkJcmV0dXJuIDA7CisJCX0KKwl9CisJcC0+UklPRXJyb3IuRXJyb3IgPSBVTktOT1dOX0hPU1RfTlVNQkVSOworCXJpb19kcHJpbnRrIChSSU9fREVCVUdfVEFCTEUsICJVbmtub3duIGhvc3QgJXhcbiIsIE1hcFAtPkhvc3RVbmlxdWVOdW0pOworCXJldHVybiAtRU5YSU87Cit9CmRpZmYgLS1naXQgYS9kcml2ZXJzL2NoYXIvcmlvL3Jpb3RpbWUuaCBiL2RyaXZlcnMvY2hhci9yaW8vcmlvdGltZS5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjY2ZDUyYmMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3Jpb3RpbWUuaApAQCAtMCwwICsxLDYzIEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgICAgICAgVCBJIE0gRQorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSmVyZW15IFJvbGxzCisgRGF0ZSAgICA6CisKKyAqCisgKiAgKEMpIDE5OTAgLSAyMDAwIFNwZWNpYWxpeCBJbnRlcm5hdGlvbmFsIEx0ZC4sIEJ5ZmxlZXQsIFN1cnJleSwgVUsuCisgKgorCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdC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0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICBEYXRlICAgICBCeSAgICAgICAgICAgICAgICBEZXNjcmlwdGlvbgorIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2lmbmRlZiBfcmlvdGltZV9oCisjZGVmaW5lIF9yaW90aW1lX2ggMQorCisjaWZuZGVmIGxpbnQKKyNpZmRlZiBTQ0NTCitzdGF0aWMgY2hhciAqX3Jpb19yaW90aW1lX2hfc2NjcyA9ICJAKCMpcmlvdGltZS5oCTEuMSIgOworI2VuZGlmCisjZW5kaWYKKworI2RlZmluZSBUV09fUE9XRVJfRklGVEVFTiAodXNob3J0KTMyNzY4CisjZGVmaW5lIFJpb1RpbWUoKSAgICByaW90aW1lCisjZGVmaW5lIFJpb1RpbWVBZnRlcih0aW1lMSx0aW1lMikgKCh1c2hvcnQpdGltZTEgLSAodXNob3J0KXRpbWUyKSA8IFRXT19QT1dFUl9GSUZURUVOCisjZGVmaW5lIFJpb1RpbWVQbHVzKHRpbWUxLHRpbWUyKSAoKHVzaG9ydCl0aW1lMSArICh1c2hvcnQpdGltZTIpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogQ29udmVydCBhIFJJTyB0aWNrICgxLzEwdGggc2Vjb25kKQorICogaW50byB0cmFuc3B1dGVyIGxvdyBwcmlvcml0eSB0aWNrcworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovIAorI2RlZmluZSBSaW9UaW1lVG9Mb3codGltZSkgKHRpbWUqKDEwMDAwMCAvIDY0KSkKKyNkZWZpbmUgUmlvTG93VG9UaW1lKHRpbWUpICgodGltZSo2NCkvMTAwMDAwKQorCisjZG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sKKyAgICB9CisgICAgaWYgKHMtPnNnLnNnX2lzcGVlZCAhPSBzcGVlZCB8fCBzLT5zZy5zZ19vc3BlZWQgIT0gc3BlZWQpIHsKKyAgICAgICAgcy0+c2cuc2dfaXNwZWVkID0gc3BlZWQ7CisgICAgICAgIHMtPnNnLnNnX29zcGVlZCA9IHNwZWVkOworICAgICAgICBzLT50bS5jX2NmbGFnID0gKHMtPnRtLmNfY2ZsYWcgJiB+Vl9DQkFVRCkgfAorICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZfYnZbKGludClzLT5zZy5zZ19pc3BlZWRdOworICAgIH0KK30KKyNlbmRpZgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9yaW90eXBlcy5oIGIvZHJpdmVycy9jaGFyL3Jpby9yaW90eXBlcy5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjFjN2M0MmMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3Jpb3R5cGVzLmgKQEAgLTAsMCArMSwxMzUgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgUiBJIE8gVCBZIFAgRSBTCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBKb24gQnJhd24KKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4I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LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogSGlzdG9yeS4uLgorCisxLjAuMAkwNy8wNi85OSBOUFYJQ3JlYXRpb24uIChiYXNlZCBvbiBQQVJNTUFQLkgpCisKKyovCisKKyNpZm5kZWYJX3Jpb3dpbmlmX2gJCQkJLyogSWYgUklPV0lORElGLkggbm90IGFscmVhZHkgZGVmaW5lZCAqLworI2RlZmluZQlfcmlvd2luaWZfaCAgICAxCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIEdlbmVyYWwgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNkZWZpbmUJVFBOVUxMCQkoKF91MTYpKDB4ODAwMCkpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFBBUk1fTUFQICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICA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TklUCQkweDkwCisjZGVmaW5lCUVfTElOS19SVU4JCTB4OTEKKyNkZWZpbmUJRV9NT05JVE9SX0FMTE9DCQkweDkyCisjZGVmaW5lCUVfTU9OSVRPUl9JTklUCQkweDkzCisjZGVmaW5lCUVfUE9MTF9JTklUCQkweDk0CisKKy8qIFBBUk1fTUFQLmxpbmtzIGRlZmluaXRpb25zLi4uICovCisjZGVmaW5lCVJJT19MSU5LX0VOQUJMRQkweDgwRkYKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBSVVAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogVGhlIFJVUCAoUmVtb3RlIFVuaXQgUG9ydCkgc3RydWN0dXJlIHJlbGF0ZXMgdG8gdGhlIFJlbW90ZSBUZXJtaW5hbCBBZGFwdGVycworICAgYXR0YWNoZWQgdG8gdGhlIHN5c3RlbSBhbmQgdGhlcmUgaXMgbm9ybWFsbHkgYW4gYXJyYXkgb2YgTUFYX1JVUFMgKD0xNikgc3RydWN0dXJlcworICAgaW4gYSBob3N0IGNhcmQsIGRlZmluZWQgYnkgUEFSTV9NQVAtPnJ1cC4gKi8KKwordHlwZWRlZglzdHJ1Y3QJX1JVUAoreworCV91MTYJCXR4cGt0OwkJCS8qIDB4MDAgT3V0Z29pbmcgcGFja2V0ICovCisJX3UxNgkJcnhw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JCTB4MEUJCS8qIDB4MEUgVHJhbnNtaXQgY29udHJvbCAqLworI2RlZmluZQlSVVBfcnhjb250cm9sCQkweDEwCQkvKiAweDEwIFJlY2VpdmUgY29udHJvbCAqLworI2RlZmluZQlzaXplb2ZfUlVQCQkweDEyCQkvKiBzdHJ1Y3R1cmUgc2l6ZSA9IDB4MTIgKi8KKworI2RlZmluZSBNQVhfUlVQCQkJMTYKKworLyogUlVQLnR4Y29udHJvbCBkZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlUWF9SVVBfSU5BQ1RJVkUJCTAJCS8qIE5vdGhpbmcgdG8gdHJhbnNtaXQgKi8KKyNkZWZpbmUJVFhfUEFDS0VUX1JFQURZCQkxCQkvKiBUcmFuc21pdCBwYWNrZXQgcmVhZHkgKi8KKyNkZWZpbmUJVFhfTE9DS19SVVAJCTIJCS8qIFRyYW5zbWl0IHNpZGUgbG9ja2VkICovCisKKy8qIFJVUC50eGNvbnRyb2wgZGVmaW5pdGlvbnMuLi4gKi8KKyNkZWZpbmUJUlhfUlVQX0lOQUNUSVZFCQkwCQkvKiBOb3RoaW5nIHJlY2VpdmVkICovCisjZGVmaW5lCVJYX1BBQ0tFVF9SRUFEWQkJMQkJLyogUGFja2V0IHJlY2VpdmVkICovCisKKyNkZWZpbmUJUlVQX05PX09XTkVSCQkweEZGCQkvKiBSVVAgbm90IG93bmVkIGJ5IGFueSBwcm9jZXNzICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUEhCICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAqKio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LyogMHgxNiBsYXN0IGVudHJ5IGluIHRoZSBwYWNrZXQgYXJyYXkgZm9yIHJlY2VpdmUgcGFja2V0cyAqLworI2RlZmluZQlQSEJfcnhfYWRkCQkweDE4CQkvKiAweDE4IHBvc2l0aW9uIGluIHRoZSBwYWNrZXQgYXJyYXkgZm9yIG5ldyByZWNlaXZlIHBhY2tldHMgKi8KKyNkZWZpbmUJUEhCX3J4X3JlbW92ZQkJMHgxQQkJLyogMHgxQSBjdXJyZW50IHBvc2l0aW9uIGluIHRoZSBwYWNrZXQgcG9pbnRlciBhcnJheSAqLworI2RlZmluZQlzaXplb2ZfUEhCCQkweDFDCQkvKiBzdHJ1Y3R1cmUgc2l6ZSA9IDB4MUMgKi8KKworLyogUEhCLmhhbmRzaGFrZSBkZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlQSEJfSEFORFNIQUtFX1NFVAkweDAwMDEJCS8qIFNldCBieSBMUlQgKi8KKyNkZWZpbmUJUEhCX0hBTkRTSEFLRV9SRVNFVAkweDAwMDIJCS8qIFNldCBieSBJU1IgLyBkcml2ZXIgKi8KKyNkZWZpbmUJUEhCX0hBTkRTSEFLRV9GTEFHUwkoUEhCX0hBTkRTSEFLRV9SRVNFVHxQSEJfSEFORFNIQUtFX1NFVCkKKwkJCQkJCS8qIFJlc2V0IGJ5IGx0dCAqLworCisjZGVmaW5lCU1BWF9QSEIJCQkxMjgJCS8qIHJhbmdlIDAtMTI3ICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgTFBCICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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N0IHBvcnQgdG8gc2VydmljZSAqLworI2RlZmluZQlMUEJfbGFzdF9wb3J0CQkweDY2CQkvKiAweDY2IExhc3QgcG9ydCB0byBzZXJ2aWNlICovCisjZGVmaW5lCXNpemVvZl9MUEIJCTB4NjgJCS8qIHN0cnVjdHVyZSBzaXplID0gMHg2OCAqLworCisjZGVmaW5lCUxJTktTX1BFUl9VTklUCQk0CQkvKiBudW1iZXIgb2YgbGlua3MgZnJvbSBhIGhvc3QgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgRlJFRV9MSVNUICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogVXNlZCB0byBvdmVybGF5IHBhY2tldCBoZWFkZXJzIHdoZW4gYWxsb2NhdGluZy9mcmVlaW5nIHBhY2tldHMgZnJvbSB0aGUgZnJlZSBsaXN0ICovCisKK3R5cGVkZWYJc3RydWN0CV9GUkVFX0xJU1QKK3sKKwlfdTE2CQluZXh0OwkJCS8qIDB4MDAgb2Zmc2V0IG9mIG5leHQgbGlzdCBpdGVtICovCisJX3UxNgkJcHJldjsJCQkvKiAweDAyIG9mZnNldCBvZiBwcmV2aW91cyBsaXN0IGl0ZW0gKi8KKworfSBGUkVFX0xJU1Q7CisKKy8qIFNhbWUgdGhpbmcgYWdhaW4sIGJ1dCBkZWZpbmVkIGFzIG9mZnNldHMuLi4gKi8KKworI2RlZmluZQlGTF9uZXh0CQkJMHgwMAkJLyogMHgwMCBvZmZzZXQgb2YgbmV4dCBsaXN0IGl0ZW0gKi8KKyNkZWZpbmUJRkxfcHJldgkJCTB4MDIJCS8qIDB4MDIgb2Zmc2V0IG9mIHByZXZpb3VzIGxpc3QgaXRlbSAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFBLVCAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiBUaGUgUEtUIGlzIHRoZSBtYWluIHVuaXQgb2YgY29tbXVuaWNhdGlvbiBiZXR3ZWVuIEhvc3QgQ2FyZHMgYW5kIFJUQXMgYWNyb3NzCisgICB0aGUgUklPIG5ldHdvcmsuICAqLworCisjZGVmaW5lIFBLVF9NQVhfREFUQV9MRU4gICA3MgkJCS8qIFNpemUgb2YgcGFja2V0IGRhdGEgKi8KKwordHlwZWRlZglzdHJ1Y3QJX1BLVAoreworCV91OAkJZGVzdF91bml0OwkJLyogMHgwMCBEZXN0aW5hdGlvbiBVbml0IElkICovCisJX3U4CQlkZXN0X3BvcnQ7CQkvKiAweDAxIERlc3RpbmF0aW9uIFBvcnQgKi8KKwlfdTgJCXNyY191bml0OwkJLyogMHgwMiBTb3VyY2UgVW5pdCBJZCAqLworCV91OAkJc3JjX3BvcnQ7CQk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EVOX01BU0sJCTB4N0YKKworLyogUEtULmNvbnRyb2wgZGVmaW5pdGlvbnMuLi4gKi8KKyNkZWZpbmUJUEtUX0FDSwkJCTB4NDAKKyNkZWZpbmUJUEtUX1RHTAkJCTB4MjAKKyNkZWZpbmUJREFUQV9XTkRXCQkweDEwCisjZGVmaW5lCVBLVF9UVExfTUFTSwkJMHgwRgorI2RlZmluZQlNQVhfVFRMCQkJMHgwRgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBDb250cm9sIFBhY2tldHMgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiBUaGUgZm9sbG93aW5nIGRlZmluaXRpb25zIGFuZCBzdHJ1Y3R1cmVzIGRlZmluZSB0aGUgY29udHJvbCBwYWNrZXRzIHNlbnQKKyAgIGJldHdlZW4gdGhlIGRyaXZlciBhbmQgUklPIFBvcnRzLCBSVEFzIGFuZCBIb3N0IENhcmRzLiAqLworCisjZGVmaW5lCVBSRV9FTVBUSVZFCQkweDgwCQkJLyogUHJlLWVtcHRpdmUgY29tbWFuZCAoc2VudCB2aWEgcG9ydCdzIFJVUCkgKi8KKworLyogImluLWJhbmQiIGFuZCAicHJlLWVtcHRpdmUiIHBvcnQgY29tbWFuZHMuLi4gKi8KKyNkZWZpbmUJT1BFTgkJCTB4MDAJCQkvKiBEcml2ZXItPlJJTyBPcGV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JTyBJZGVudGlmeSBSVEEgKi8KKyNkZWZpbmUJWk9NQklFCQkJMHgzMQkJCS8qIERyaXZlci0+UklPIFNodXRkb3duL0ZsYXNoIExFRHMgKi8KKyNkZWZpbmUJVUZPQUQJCQkweDMyCQkJLyogRHJpdmVyLT5SSU8gU2h1dGRvd24vUmVib290IG5laWdoYm91cmluZyBSVEEgKi8KKyNkZWZpbmUgSVdBSVQJCQkweDMzCQkJLyogRHJpdmVyLT5SSU8gUGF1c2UgYm9vdGluZyBwcm9jZXNzICovCisKKy8qIFJPVVRFX1JVUCBkZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlST1VURV9SRVFVRVNUCQkweDAwCQkJLyogUklPLT5Ecml2ZXIgUmVxdWVzdCBhbiBJRCAqLworI2RlZmluZQlST1VURV9GT0FECQkweDAxCQkJLyogRHJpdmVyLT5SSU8gU2h1dGRvd24vcmVib290IFJUQSAqLworI2RlZmluZQlST1VURV9BTFJFQURZCQkweDAyCQkJLyogRHJpdmVyLT5SSU8gTm90IHVzZWQgKi8KKyNkZWZpbmUJUk9VVEVfVVNFRAkJMHgwMwkJCS8qIERyaXZlci0+UklPIE5vdCB1c2VkICovCisjZGVmaW5lCVJPVVRFX0FMTE9DQVRFCQkweDA0CQkJLyogRHJpdmVyLT5SSU8gQWxsb2NhdGUgUlRBIFJVUCBudW1iZXJzICovCisjZGVmaW5lCVJPVVRFX1JFUV9UT1AJCTB4MDUJCQkvKiBEcml2ZXItPlJJTyBOb3QgdXNlZCAqLworI2RlZmluZSBST1VURV9UT1BPTE9HWQkJMHgwNgkJCS8qIFJJTy0+RHJpdmVyIFJvdXRlL1RvcG9sb2d5IHN0YXR1cyAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIE9QRU4gICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8saW4tYmFuZCkKKworICAgU2VudCB0byBvcGVuIGEgcG9ydC4gCisgICBTdHJ1Y3R1cmUgb2YgY29uZmlndXJhdGlvbiBpbmZvIHVzZWQgd2l0aCBPUEVOLCBDT05GSUcgYW5kIE1PUEVOIHBhY2tldHMuLi4gKi8KKworI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNkZWZpbmUJUEtUX0NvcjEJCShQS1RfRGF0YSsxKQkJLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgMSAqLworI2RlZmluZQlQS1RfQ29yMgkJKFBLVF9EYXRhKzIpCQkvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAyICovCisjZGVmaW5lCVBLVF9Db3I0CQkoUEtUX0RhdGErMykJCS8qIENoYW5uZWwgT3B0aW9uIFJlZ2lzdGVyIDQgKi8KKyNkZWZpbmUJUEtUX0NvcjUJCShQS1RfRGF0YSs0KQkJLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgNSAqLworI2RlZmluZQlQS1RfVHhYb24JCShQS1RfRGF0YSs1KQkJLyogVHJhbnNtaXQgWE9OIGNoYXJhY3RlciAqLworI2RlZmluZQlQS1RfVHhYb2ZmCQkoUEtUX0RhdGErNikJCS8qIFRyYW5zbWl0IFhPRkYgY2hhcmFjdGVyICovCisjZGVmaW5lCVBLVF9SeFhvbgkJKFBLVF9EYXRhKzcpCQ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VkICovCisjZGVmaW5lCVJJT19CNTc2MDAJCTB4MTEJCQkvKiA1NzYwMCBiYXVkICovCisjZGVmaW5lCVJJT19CNjQwMDAJCTB4MTIJCQkvKiA2NDAwMCBiYXVkICovCisjZGVmaW5lCVJJT19CMTE1MjAwCQkweDEzCQkJLyogMTE1MjAwIGJhdWQgKi8KKyNkZWZpbmUJUklPX0IyMDAwCQkweDE0CQkJLyogMjAwMCBiYXVkICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBDT05GSUcgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxpbi1iYW5kKQorCisgICBDT05GSUcgaXMgc2VudCBmcm9tIHRoZSBkcml2ZXIgdG8gY29uZmlndXJlIGFuIGFscmVhZHkgb3BlbmVkIHBvcnQuCisgICBQYWNrZXQgc3RydWN0dXJlIGlzIHNhbWUgYXMgT1BFTi4gICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBNT1BFTiAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxpbi1iYW5kKQorCisgICBNT1BFTiBpcyBzZW50IGZyb20gdGhlIGRyaXZlciB0byBvcGVuIGEgcG9ydCBhdHRhY2hlZCB0byBhIG1vZGVtLiAoaW4tYmFuZCkKKyAgIFBhY2tldCBzdHJ1Y3R1cmUgaXMgc2FtZSBhcyBPUEVOLiAgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIENMT1NFICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLGluLWJhbmQpCisKKyAgIENMT1NFIGlzIHNlbnQgZnJvbSB0aGUgZHJpdmVyIHRvIGNsb3NlIGEgcHJldmlvdXNseSBvcGVuZWQgcG9ydC4KKyAgIE5vIHBhcmFtZXRlcnMuCisgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2VuZGlmCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgV0ZMVVNIICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIFdGTFVTSCBpcyBzZW50IHByZS1lbXB0aXZlbHkgZnJvbSB0aGUgZHJpdmVyIHRvIGZsdXNoIHRoZSB3cml0ZSBidWZmZXJzIGFuZAorICAgcGFja2V0cyBvZiBhIHBvcnQuICAocHJlLWVtcHRpdmUpCisgICAKKyAgIFdGTFVTSCBpcyBhbHNvIHNlbnQgaW4tYmFuZCBmcm9tIHRoZSBkcml2ZXIgdG8gYSBwb3J0IGFzIGEgbWFya2VyIHRvIGVuZAorICAgd3JpdGUgZmx1c2hpbmcgcHJldmlvdXNseSBzdGFydGVkIGJ5IGEgcHJlLWVtcHRpdmUgV0ZMVVNIIHBhY2tldC4gKGluLWJhbmQpCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZW5kaWYKKyNkZWZpbmUJUEtUX1BoYk51bQkJKFBLVF9EYXRhKzEpCQkvKiBQb3J0IG51bWJlciB3cnQgUlRBICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBSRkxVU0ggICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxwcmUtZW1wdGl2ZSkKKworICAgUkZMVVNIIGlzIHNlbnQgcHJlLWVtcHRpdmVseSBmcm9tIHRoZSBkcml2ZXIgdG8gZmx1c2ggdGhlIHJlYWQgYnVmZmVycyBhbmQKKyAgIHBhY2tldHMgb2YgYSBwb3J0LgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUkVTVU1FICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIFJFU1VNRSBpcyBzZW50IHByZS1lbXB0aXZlbHkgZnJvbSB0aGUgZHJpdmVyIHRvIGNhdXNlIGEgcG9ydCB0byByZXN1bWUgCisgICB0cmFuc21pc3Npb24gb2YgZGF0YSBpZiBibG9ja2VkIGJ5IFhPRkYuICAoYXMgaWYgWE9OIGhhZCBiZWVuIHJlY2VpdmVkKQorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgU0JSRUFLICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8saW4tYmFuZCkKKworICAgU0JSRUFLIGlzIHNlbnQgaW4tYmFuZCBmcm9tIHRoZSBkcml2ZXIgdG8gYSBwb3J0IHRvIHN1c3BlbmQgZGF0YSBhbmQgc3RhcnQKKyAgIGJyZWFrIHNpZ25hbCB0cmFuc21pc3Npb24uCisKKyAgIElmIHRoZSBicmVhayBkZWxheSBpcyAwLCB0aGUgYnJlYWsgc2lnbmFsIHdpbGwgYmUgYWNrbm93bGVkZ2VkIHdpdGggYQorICAgUlVQX0NPTU1BTkQsIENPTVBMRVRFIHBhY2tldCBhbmQgY29udGludWUgdW50aWwgYW4gRUJSRUFLIHBhY2tldCBpcyByZWNlaXZlZC4KKworICAgT3RoZXJ3aXNlLCB0aGVyZSBpcyBubyBhY2tub3dsZWRnZW1lbnQgYW5kIHRoZSBicmVhayBzaWduYWwgd2lsbCBsYXN0IGZvciB0aGUKKyAgIHNwZWNpZmllZCBudW1iZXIgb2YgbVMuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZW5kaWYKKyNkZWZpbmUJUEtUX0JyZWFrRGVsYXkJCShQS1RfRGF0YSsxKQkJLyogQnJlYWsgZGVsYXkgaW4gbVMgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIEVCUkVBSyAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLGluLWJhbmQpCisKKyAgIEVCUkVBSyBpcyBzZW50IGluLWJhbmQgZnJvbSB0aGUgZHJpdmVyIHRvIGEgcG9ydCB0byBzdG9wIHRyYW5zbWlzc2lvbiBvZiBhCisgICBicmVhayBzaWduYWwuCisKKyAgIE5vIHBhcmFtZXRlcnMuICAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgU1VTUEVORCAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIFNVU1BFTkQgaXMgc2VudCBwcmUtZW1wdGl2ZWx5IGZyb20gdGhlIGRyaXZlciB0byBjYXVzZSBhIHBvcnQgdG8gc3VzcGVuZAorICAgdHJhbnNtaXNzaW9uIG9mIGRhdGEuICAoYXMgaWYgWE9GRiBoYWQgYmVlbiByZWNlaXZlZCkKKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNkZWZpbmUJUEtUX1BoYk51bQkJKFBLVF9EYXRhKzEpCQkvKiBQb3J0IG51bWJlciB3cnQgUlRBICovCisjZW5kaWYKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIEZDTE9TRSAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBGQ0xPU0UgaXMgc2VudCBwcmUtZW1wdGl2ZWx5IGZyb20gdGhlIGRyaXZlciB0byBmb3JjZSBjbG9zZSBhIHBvcnQuCisgICBBIGZvcmNlIGNsb3NlIGZsdXNoZXMgcmVjZWl2ZSBhbmQgdHJhbnNtaXQgcXVldWVzLCBhbmQgYWxzbyBsb3dlcnMgYWxsIG91dHB1dAorICAgbW9kZW0gc2lnbmFscyBpZiB0aGUgQ09SNV9IVVBDTCAoSGFuZyBVcCBPbiBDbG9zZSkgZmxhZyBpcyBzZXQuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZGVmaW5lCVBLVF9QaGJOdW0JCShQS1RfRGF0YSsxKQkJLyogUG9ydCBudW1iZXIgd3J0IFJUQSAqLworI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBYUFJJTlQgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxpbi1iYW5kKQorCisgICBYUFJJTlQgaXMgc2VudCBhcyBhIG5vcm1hbCBJL08gZGF0YSBwYWNrZXQgZXhjZXB0IHRoYXQgdGhlIFBLVF9DTURfQklUIG9mCisgICB0aGUgImxlbiIgZmllbGQgaXMgc2V0LCBhbmQgdGhlIGZpcnN0ICJkYXRhIiBieXRlIGlzIFhQUklOVC4KKworICAgVGhlIEkvTyBkYXRhIGluIHRoZSBYUFJJTlQgcGFja2V0IHdpbGwgY29udGFpbiB0aGUgZm9sbG93aW5nOgorICAgLQlUcmFuc3BhcmVudCBQcmludCBTdGFydCBTZXF1ZW5jZQorICAgLQlUcmFuc3BhcmVudCBQcmludCBEYXRhCisgICAtCVRyYW5zcGFyZW50IFByaW50IFN0b3AgU2VxdWVuY2UuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZGVmaW5lCVBLVF9QaGJOdW0JCShQS1RfRGF0YSsxKQkJLyogUG9ydCBudW1iZXIgd3J0IFJUQSAqLworI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgTUJJUyAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxwcmUtZW1wdGl2ZSkKKworICAgTUJJUyBpcyBzZW50IHByZS1lbXB0aXZlbHkgZnJvbSB0aGUgZHJpdmVyIHRvIHNldCBhIHBvcnQncyBtb2RlbSBzaWduYWxzLgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfTW9kZW1TZXQJCShQS1RfRGF0YSs0KQkJLyogTW9kZW0gc2V0IHNpZ25hbHMgbWFzayAqLworCisvKiBNb2RlbVNldCBkZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQlNQklTX1JUUwkJMHgwMQkJCS8qIFJUUyBtb2RlbSBzaWduYWwgKi8KKyNkZWZpbmUJTUJJU19EVFIJCTB4MDIJCQkvKiBEVFIgbW9kZW0gc2lnbmFsICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgTUJJQyAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxwcmUtZW1wdGl2ZSkKKworICAgTUJJQyBpcyBzZW50IHByZS1lbXB0aXZlbHkgZnJvbSB0aGUgZHJpdmVyIHRvIGNsZWFyIGEgcG9ydCdzIG1vZGVtIHNpZ25hbHMuCisgICAqLworI2lmIDAgICAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZGVmaW5lCVBLVF9QaGJOdW0JCShQS1RfRGF0YSsxKQkJLyogUG9ydCBudW1iZXIgd3J0IFJUQSAqLworI2VuZGlmCisKKyNkZWZpbmUJUEtUX01vZGVtQ2xlYXIJCShQS1RfRGF0YSs0KQkJLyogTW9kZW0gY2xlYXIgc2lnbmFscyBtYXNrICovCisKKy8qIE1vZGVtQ2xlYXIgZGVmaW5pdGlvbnMuLi4gKi8KKyNkZWZpbmUJTUJJQ19SVFMJCTB4MDEJCQkvKiBSVFMgbW9kZW0gc2lnbmFsICovCisjZGVmaW5lCU1CSUNfRFRSCQkweDAyCQkJLyogRFRSIG1vZGVtIHNpZ25hbCAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIE1TRVQgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIE1TRVQgaXMgc2VudCBwcmUtZW1wdGl2ZWx5IGZyb20gdGhlIGRyaXZlciB0byBzZXQvY2xlYXIgYSBwb3J0J3MgbW9kZW0gc2lnbmFscy4gKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNlbmRpZgorCisjZGVmaW5lCVBLVF9Nb2RlbVNldAkJKFBLVF9EYXRhKzQpCQkvKiBNb2RlbSBzZXQgc2lnbmFscyBtYXNrICovCisKKy8qIE1vZGVtU2V0IGRlZmluaXRpb25zLi4uICovCisjZGVmaW5lCU1TRVRfUlRTCQkweDAxCQkJLyogUlRTIG1vZGVtIHNpZ25hbCAqLworI2RlZmluZQlNU0VUX0RUUgkJMHgwMgkJCS8qIERUUiBtb2RlbSBzaWduYWwgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFBDTE9TRSAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLGluLWJhbmQpCisKKyAgIFBDTE9TRSBpcyBzZW50IGZyb20gdGhlIGRyaXZlciB0byBwc2V1ZG8gY2xvc2UgYSBwcmV2aW91c2x5IG9wZW5lZCBwb3J0LgorICAgCisgICBUaGUgcG9ydCB3aWxsIGNsb3NlIHdoZW4gYWxsIGRhdGEgaGFzIGJlZW4gc2VudC9yZWNlaXZlZCwgaG93ZXZlciwgdGhlCisgICBwb3J0J3MgdHJhbnNtaXQgLyByZWNlaXZlIGFuZCBtb2RlbSBzaWduYWxzIHdpbGwgYmUgbGVmdCBlbmFibGVkIGFuZCB0aGUKKyAgIHBvcnQgbWFya2VkIGludGVybmFsbHkgYXMgUHNldWRvIENsb3NlZC4gKi8KKworI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBNR0VUICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBNR0VUIGlzIHNlbnQgcHJlLWVtcHRpdmVseSBmcm9tIHRoZSBkcml2ZXIgdG8gcmVxdWVzdCB0aGUgcG9ydCdzIGN1cnJlbnQgbW9kZW0gc2lnbmFscy4gKi8KKworI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNkZWZpbmUJUEtUX1BoYk51bQkJKFBLVF9EYXRhKzEpCQkvKiBQb3J0IG51bWJlciB3cnQgUlRBICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBNRU1EVU1QICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxwcmUtZW1wdGl2ZSkKKworICAgTUVNRFVNUCBpcyBzZW50IHByZS1lbXB0aXZlbHkgZnJvbSB0aGUgZHJpdmVyIHRvIHJlcXVlc3QgYSBkdW1wIG9mIDMyIGJ5dGVzCisgICBvZiB0aGUgc3BlY2lmaWVkIHBvcnQncyBSVEEgYWRkcmVzcyBzcGFjZS4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNkZWZpbmUJUEtUX1N1YkNtZAkJKFBLVF9EYXRhKzUpCQkvKiBTdWIgQ29tbWFuZCAqLworI2RlZmluZQlQS1RfQWRkcmVzcwkJKFBLVF9EYXRhKzYpCQkvKiBSZXF1ZXN0ZWQgYWRkcmVzcyAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUkVBRF9SRUdJU1RFUiAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIFJFQURfUkVHSVNURVIgaXMgc2VudCBwcmUtZW1wdGl2ZWx5IGZyb20gdGhlIGRyaXZlciB0byByZXF1ZXN0IHRoZSBjb250ZW50cworICAgb2YgdGhlIENEMTQwMCByZWdpc3RlciBzcGVjaWZpZWQgaW4gYWRkcmVzcy4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNkZWZpbmUJUEtUX1N1YkNtZAkJKFBLVF9EYXRhKzUpCQkvKiBTdWIgQ29tbWFuZCAqLworI2RlZmluZQlQS1RfQWRkcmVzcwkJKFBLVF9EYXRhKzYpCQkvKiBSZXF1ZXN0ZWQgYWRkcmVzcyAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgQ09NTUFORF9SVVAgLSBDT01QTEVURSAgICoqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoUklPLT5Ecml2ZXIscHJlLWVtcHRpdmUpCisKKyAgIENPTU1BTkRfUlVQIC0gQ09NUExFVEUgaXMgc2VudCBpbiByZXNwb25zZSB0byBhbGwgcG9ydCBJL08gY29udHJvbCBjb21tYW5kCisgICBwYWNrZXRzLCBleGNlcHQgTUVNRFVNUCBhbmQgUkVBRF9SRUdJU1RFUi4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNkZWZpbmUJUEtUX0NtZDIJCShQS1RfRGF0YSsyKQkJLyogQ29tbWFuZCBjb2RlIGNvcHkgKi8KKyNkZWZpbmUJUEtUX01vZGVtU3RhdHVzCQkoUEtUX0RhdGErMykJCS8qIE1vZGVtIHNpZ25hbCBzdGF0dXMgKi8KKyNkZWZpbmUJUEtUX1BvcnRTdGF0dXMJCShQS1RfRGF0YSs0KQkJLyogUG9ydCBzaWduYWwgc3RhdHVzICovCisjZGVmaW5lCVBLVF9TdWJDbWQJCShQS1RfRGF0YSs1KQkJLyogU3ViIENvbW1hbmQgKi8KKworLyogTW9kZW1TdGF0dXMgZGVm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AyMAkJCS8qIFN0YXR1cyBwYWNrZXQgcGVuZGluZyAqLworI2RlZmluZQlQT1JUX0JSRUFLUEVORAkJMHg0MAkJCS8qIEJyZWFrIHBhY2tldCBwZW5kaW5nICovCisjZGVmaW5lCVBPUlRfTU9ERU1QRU5ECQkweDgwCQkJLyogTW9kZW0gc3RhdHVzIHBhY2tldCBwZW5kaW5nICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICBDT01NQU5EX1JVUCAtIENPTVBMRVRFICAgKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChSSU8tPkRyaXZlcixwcmUtZW1wdGl2ZSkKKworICAgQ09NTUFORF9SVVAgLSBDT01QTEVURSBpcyBzZW50IGluIHJlc3BvbnNlIHRvIGFsbCBwb3J0IEkvTyBjb250cm9sIGNvbW1hbmQKKyAgIHBhY2tldHMsIGV4Y2VwdCBNRU1EVU1QIGFuZCBSRUFEX1JFR0lTVEVSLgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNkZWZpbmUJUEtUX0NtZDIJCShQS1RfRGF0YSsyKQkJLyogQ29tbWFuZCB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BPUlRfSFVQQ0wJCTB4MDIJCQkvKiBIYW5ndXAgb24gY2xvc2U/ICovCisjZGVmaW5lCVBPUlRfTU9QRU5QRU5ECQkweDA0CQkJLyogTW9kZW0gb3BlbiBwZW5kaW5nICovCisjZGVmaW5lCVBPUlRfSVNQQVJBTExFTAkJMHgwOAkJCS8qIFBhcmFsbGVsIHBvcnQgKi8KKyNkZWZpbmUJUE9SVF9CUkVBSwkJMHgxMAkJCS8qIFBvcnQgb24gYnJlYWsgKi8KKyNkZWZpbmUJUE9SVF9TVEFUVVNQRU5ECQkwMDIwCQkJLyogU3RhdHVzIHBhY2tldCBwZW5kaW5nICovCisjZGVmaW5lCVBPUlRfQlJFQUtQRU5ECQkweDQwCQkJLyogQnJlYWsgcGFja2V0IHBlbmRpbmcgKi8KKyNkZWZpbmUJUE9SVF9NT0RFTVBFTkQJCTB4ODAJCQkvKiBNb2RlbSBzdGF0dXMgcGFja2V0IHBlbmRpbmcgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqICAgQ09NTUFORF9SVVAgLSBDT01QTEVURSAtIE1FTURVTVAgICAqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKFJJTy0+RHJpdmVyLHByZS1lbXB0aXZlKQorCisgICBDT01NQU5EX1JVUCAtIENPTVBMRVRFIC0gTUVNRFVNUCBpcyBzZW50IGFzIGFuIGFja25vd2xlZGdlbWVudCBmb3IgYSBNRU1EVU1QCisgICBwb3J0IEkvTyBjb250cm9sIGNvbW1hbmQgcGFja2V0LgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNkZWZpbmUJUEtUX0NtZDIJCShQS1RfRGF0YSsyKQkJLyogQ29tbWFuZCBjb2RlIGNvcHkgKi8KKyNkZWZpbmUJUEtUX01vZGVtU3RhdHVzCQkoUEtUX0RhdGErMykJCS8qIE1vZGVtIHNpZ25hbCBzdGF0dXMgKi8KKyNkZWZpbmUJUEtUX1BvcnRTdGF0dXMJCShQS1RfRGF0YSs0KQkJLyogUG9ydCBzaWduYWwgc3RhdHVzICovCisjZGVmaW5lCVBLVF9TdWJDbWQJCShQS1RfRGF0YSs1KQkJLyogU3ViIENvbW1hbmQgKi8KKyNkZWZpbmUJUEtUX0FkZHJlc3MJCShQS1RfRGF0YSs2KQkJLyogUmVxdWVzdGVkIGFkZHJlc3MgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfRHVtcAkJKFBLVF9EYXRhKzgpCQkvKiAzMmJ5dGVzIG9mIHJlcXVlc3RlZCBkdW1wIGRhdGEgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqICAgQ09NTUFORF9SVVAgLSBDT01QTEVURSAtIFJFQURfUkVHSVNURVIgICAqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKFJJTy0+RHJpdmVyLHByZS1lbXB0aXZlKQorCisgICBDT01NQU5EX1JVUCAtIENPTVBMRVRFIC0gUkVBRF9SRUdJU1RFUiBpcyBzZW50IGFzIGFuIGFja25vd2xlZGdlbWVudCBmb3IgYQorICAgUkVBRF9SRUdJU1RFUiBwb3J0IEkvTyBjb250cm9sIGNvbW1hbmQgcGFja2V0LgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qQ29tbWFuZCBjb2RlICovCisjZGVmaW5lCVBLVF9QaGJOdW0JCShQS1RfRGF0YSsxKQkJLypQb3J0IG51bWJlciB3cnQgUlRBICovCisjZGVmaW5lCVBLVF9DbWQyCQkoUEtUX0RhdGErMikJCS8qIENvbW1hbmQgY29kZSBjb3B5ICovCisjZW5kaWYKKyNkZWZpbmUJUEtUX1JlZ2lzdGVyVmFsdWUJKFBLVF9EYXRhKzMpCQkvKiBNb2RlbSBzaWduYWwgc3RhdHVzICovCisjaWYgMAorI2RlZmluZQlQS1RfUG9ydFN0YXR1cwkJKFBLVF9EYXRhKzQpCQkvKiBQb3J0IHNpZ25hbCBzdGF0dXMgKi8KKyNkZWZpbmUJUEtUX1N1YkNtZAkJKFBLVF9EYXRhKzUpCQkvKiBTdWIgQ29tbWFuZCAqLworI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKiogICBDT01NQU5EX1JVUCAtIEJSRUFLX1JFQ0VJVkVEICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChSSU8tPkRyaXZlcixwcmUtZW1wdGl2ZSkKKworICAgQ09NTUFORF9SVVAgLSBCUkVBS19SRUNFSVZFRCBwYWNrZXRzIGFyZSBzZW50IHdoZW4gdGhlIHBvcnQgZGV0ZWN0cyBhIHJlY2VpdmUgQlJFQUsgc2lnbmFsLgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2RlZmluZQlQS1RfUGhiTnVtCQkoUEtUX0RhdGErMSkJCS8qIFBvcnQgbnVtYmVyIHdydCBSVEEgKi8KKyNkZWZpbmUJUEtUX0NtZDIJCShQS1RfRGF0YSsyKQkJLyogQ29tbWFuZCBjb2RlIGNvcHkgKi8KKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqICAgQ09NTUFORF9SVVAgLSBNT0RFTV9TVEFUVVMgICAqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoUklPLT5Ecml2ZXIscHJlLWVtcHRpdmUpCisKKyAgIENPTU1BTkRfUlVQIC0gTU9ERU1fU1RBVFVTIHBhY2tldHMgYXJlIHNlbnQgd2hlbmV2ZXIgdGhlIHBvcnQgZGV0ZWN0cyBhCisgICBjaGFuZ2UgaW4gdGhlIGlucHV0IG1vZGVtIHNpZ25hbCBzdGF0ZXMuCisKKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNkZWZpbmUJUEtUX1BoYk51bQkJKFBLVF9EYXRhKzEpCQkvKiBQb3J0IG51bWJlciB3cnQgUlRBICovCisjZGVmaW5lCVBLVF9DbWQyCQkoUEtUX0RhdGErMikJCS8qIENvbW1hbmQgY29kZSBjb3B5ICovCisjZGVmaW5lCVBLVF9Nb2RlbVN0YXR1cwkJKFBLVF9EYXRhKzMpCQkvKiBNb2RlbSBzaWduYWwgc3RhdHVzICovCisjZW5kaWYKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgIEJPT1RfUlVQIC0gQk9PVF9SRVFVRVNUICAgKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKFJJTy0+RHJpdmVyLHByZS1lbXB0aXZlKQorCisgICBCT09UX1JVUCAtIEJPT1RfUkVRVUVTVCBwYWNrZXRzIGFyZSBzZW50IHRvIHRoZSBEcml2ZXIgZnJvbSBSSU8gdG8gcmVxdWVzdAorICAgZmlybXdhcmUgY29kZSB0byBsb2FkIG9udG8gYXR0YWNoZWQgUlRBcy4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgQk9PVF9SVVAgLSBCT09UX1NFUVVFTkNFICAgKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIEJPT1RfUlVQIC0gQk9PVF9TRVFVRU5DRSBwYWNrZXRzIGFyZSBzZW50IGZyb20gdGhlIERyaXZlciB0byBSSU8gaW4gcmVzcG9uc2UKKyAgIHRvIGEgQk9PVF9SVVAgLSBCT09UX1JFUVVFU1QgcGFja2V0LgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9OdW1QYWNrZXRzCQkoUEtUX0RhdGErMikJCS8qIFBhY2tldHMgcmVxdWlyZWQgdG8gbG9hZCBmaXJtd2FyZSAqLworI2RlZmluZQlQS1RfTG9hZEJhc2UJCShQS1RfRGF0YSs0KQkJLyogUlRBIGZpcm13YXJlIGxvYWQgYWRkcmVzcyAqLworI2RlZmluZQlQS1RfQ29kZVNpemUJCShQS1RfRGF0YSs2KQkJLyogU2l6ZSBvZiBmaXJtd2FyZSBpbiBieXRlcyAqLworI2RlZmluZQlQS1RfQ21kU3RyaW5nCQkoUEtUX0RhdGErOCkJCS8qIENvbW1hbmQgc3RyaW5nICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICBCT09UX1JVUCAtIEJPT1RfQ09NUExFVEVEICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChSSU8tPkRyaXZlcixwcmUtZW1wdGl2ZSkKKworICAgQk9PVF9SVVAgLSBCT09UX0NPTVBMRVRFIGlzIHNlbnQgdG8gdGhlIERyaXZlciBmcm9tIFJJTyB3aGVuIGRvd25sb2FkaW5nIG9mCisgICBSVEEgZmlybXdhcmUgaGFzIGNvbXBsZXRlZC4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfTGlua051bWJlcgkJKFBLVF9EYXRhKzEpCQkvKiBMaW5rIG51bWJlciBSVEEgYm9vdGVkIG9uICovCisjZGVmaW5lCVBLVF9TZXJpYWxOdW1iZXIJKFBLVF9EYXRhKzIpCQkvKiA0IGJ5dGUgc2VyaWFsIG51bWJlciAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgQk9PVF9SVVAgLSBQYWNrZXQgUmVxdWVzdCAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoUklPLT5Ecml2ZXIscHJlLWVtcHRpdmUpCisKKyAgIEJPT1RfUlVQIHBhY2tldCB3aXRob3V0IHRoZSBQS1RfQ01EX0JJVCBzZXQgaW4gdGhlIFBLVC0+bGVuIGZpZWxkIGlzIHNlbnQKKyAgIGZyb20gUklPIHRvIHRoZSBEcml2ZXIgYXMgYSByZXF1ZXN0IGZvciBhIGZpcm13YXJlIGJvb3QgcGFja2V0LiAqLworCisjZGVmaW5lCVBLVF9TZXF1ZW5jZU51bWJlcgkoUEtUX0RhdGErMCkJCS8qIFBhY2tldCBzZXF1ZW5jZSBudW1iZXIgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqICAgQk9PVF9SVVAgLSBQYWNrZXQgUmVzcG9uc2UgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBJbiByZXNwb25zZSB0byBhIEJPT1RfUlVQIGJvb3QgcGFja2V0IHJlcXVlc3QsIHRoZSBkcml2ZXIgZmlsbHMgb3V0IHRoZSByZXNwb25zZQorICAgcGFja2V0IHdpdGggdGhlIDcwIGJ5dGVzIG9mIHRoZSByZXF1ZXN0ZWQgc2VxdWVuY2UuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX1NlcXVlbmNlTnVtYmVyCShQS1RfRGF0YSswKQkJLyogUGFja2V0IHNlcXVlbmNlIG51bWJlciAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9GaXJtd2FyZVBhY2tldAkoUEtUX0RhdGErMikJCS8qIEZpcm13YXJlIHBhY2tldCAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIEJPT1RfUlVQIC0gSUZPQUQgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIEJPT1RfUlVQIC0gSUZPQUQgcGFja2V0cyBhcmUgc2VudCBmcm9tIHRoZSBEcml2ZXIgdG8gYW4gUlRBIHRvIGNhdXNlIHRoZQorICAgUlRBIHRvIHNodXQgZG93biBhbmQgcmVib290LgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9JZm9hZElkMQkJKFBLVF9EYXRhKzIpCQkvKiBJRk9BRCBJZCAxICovCisjZGVmaW5lCVBLVF9JZm9hZElkMgkJKFBLVF9EYXRhKzMpCQkvKiBJRk9BRCBJZCAyICovCisKKyNkZWZpbmUJSUZPQURJRDEJCTB4QUQKKyNkZWZpbmUJSUZPQURJRDIJCTB4RjAKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqICAgQk9PVF9SVVAgLSBJREVOVElGWSAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBCT09UX1JVUCAtIElERU5USUZZIHBhY2tldHMgYXJlIHNlbnQgZnJvbSB0aGUgRHJpdmVyIHRvIGFuIFJUQSB0byBjYXVzZSB0aGUKKyAgIFJUQSB0byBmbGFzaCBpdHMgTEVEcyBmb3IgYSBwZXJpb2Qgb2YgdGltZS4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfSWRlbnRpZnlJZAkJKFBLVF9EYXRhKzIpCQkvKiBkZWZpbmVzIHBhdHRlcm4gdG8gZmxhc2ggKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBCT09UX1JVUCAtIFpPTUJJRSAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBCT09UX1JVUCAtIFpPTUJJRSBwYWNrZXRzIGFyZSBzZW50IGZyb20gdGhlIERyaXZlciB0byBhbiBSVEEgdG8gY2F1c2UgdGhlCisgICBSVEEgdG8gc2h1dCBkb3duIGFuZCBmbGFzaCBpdCdzIExFRHMuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZW5kaWYKKyNkZWZpbmUJUEtUX1pvbWJpZUlkMQkJKFBLVF9EYXRhKzIpCQkvKiBaT01CSUUgSWQgMSAqLworI2RlZmluZQlQS1RfWm9tYmllSWQyCQkoUEtUX0RhdGErMykJCS8qIFpPTUJJRSBJZCAyICovCisKKyNkZWZpbmUJWk9NQklFSUQxCQkweDUyCisjZGVmaW5lCVpPTUJJRUlEMgkJMHgyMQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIEJPT1RfUlVQIC0gVUZPQUQgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoRHJpdmVyLT5SSU8scHJlLWVtcHRpdmUpCisKKyAgIEJPT1RfUlVQIC0gVUZPQUQgcGFja2V0cyBhcmUgc2VudCBmcm9tIHRoZSBEcml2ZXIgdG8gYW4gUlRBIHRvIGNhdXNlIHRoZSBSVEEKKyAgIHRvIGFzayBpdCdzIG5laWdoYm91cmluZyBSVEEgdG8gc2h1dCBkb3duIGFuZCByZWJvb3QuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZGVmaW5lCVBLVF9MaW5rTnVtYmVyCQkoUEtUX0RhdGErMSkJCS8qIExpbmsgbnVtYmVyIG9mIFJUQSB0byBVRk9BRCAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9VZm9hZElkMQkJKFBLVF9EYXRhKzIpCQkvKiBVRk9BRCBJZCAxICovCisjZGVmaW5lCVBLVF9VZm9hZElkMgkJKFBLVF9EYXRhKzMpCQkvKiBVRk9BRCBJZCAyICovCisKKyNkZWZpbmUJVUZPQURJRDEJCTB4MUUKKyNkZWZpbmUJVUZPQURJRDIJCTB4MEQKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBCT09UX1JVUCAtIElXQUlUICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBCT09UX1JVUCAtIElXQUlUIHBhY2tldHMgYXJlIHNlbnQgZnJvbSB0aGUgRHJpdmVyIHRvIGFuIFJUQSB0byBjYXVzZSB0aGUgUlRBCisgICB0byBwYXVzZSBib290aW5nIG9uIHRoZSBzcGVjaWZpZWQgbGluayBmb3IgMzAgc2Vjb25kcy4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNkZWZpbmUJUEtUX0xpbmtOdW1iZXIJCShQS1RfRGF0YSsxKQkJLyogTGluayBudW1iZXIgb2YgUlRBIHRvIFVGT0FEICovCisjZW5kaWYKKyNkZWZpbmUJUEtUX0l3YWl0SWQxCQkoUEtUX0RhdGErMikJCS8qIElXQUlUIElkIDEgKi8KKyNkZWZpbmUJUEtUX0l3YWl0SWQyCQkoUEtUX0RhdGErMykJCS8qIElXQUlUIElkIDIgKi8KKworI2RlZmluZQlJV0FJVElEMQkJMHhERQorI2RlZmluZQlJV0FJVElEMgkJMHhCMQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqICAgUk9VVEVfUlVQIC0gUk9VVEVfUkVRVUVTVCAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiAoUklPLT5Ecml2ZXIscHJlLWVtcHRpdmUpCisKKyAgIFJPVVRFX1JVUCAtIFJPVVRFX1JFUVVFU1QgcGFja2V0cyBhcmUgc2VudCBmcm9tIGEgbmV3bHkgYm9vdGVkIG9yIGNvbm5lY3RlZAorICAgUlRBIHRvIGEgRHJpdmVyIHRvIHJlcXVlc3QgYW4gSUQgKFJVUCBvciB1bml0IG51bWJlcikuCisgICAqLworI2lmIDAKKyNkZWZpbmUJUEtUX0NtZAkJCShQS1RfRGF0YSswKQkJLyogQ29tbWFuZCBjb2RlICovCisjZW5kaWYKKyNkZWZpbmUJUEtUX1NlcmlhbE51bWJlcgkoUEtUX0RhdGErMikJCS8qIDQgYnl0ZSBzZXJpYWwgbnVtYmVyICovCisjZGVmaW5lCVBLVF9Nb2R1bGVUeXBlcwkJKFBLVF9EYXRhKzYpCQkvKiBSVEEgTW9kdWxlIHR5cGVzICovCisKKy8qIE1vZHVsZVR5cGVzIGRlZmluaXRpb25zLi4uICovCisjZGVmaW5lCU1PRF9CTEFOSwkJMHgwRgkJCS8qIEJsYW5rIHBsYXRlIGF0dGFjaGVkICovCisjZGVmaW5lCU1PRF9SUzIzMkRCMjUJCTB4MDAJCQkvKiBSUzIzMiBEQjI1IGNvbm5lY3RvciAqLworI2RlZmluZQlNT0RfUlMyMzJSSjQ1CQkweDAxCQkJLyogUlMyMzIgUko0NSBjb25uZWN0b3IgKi8KKyNkZWZpbmUJTU9EX1JTNDIyREIyNQkJMHgwMgkJCS8qIFJTNDIyIERCMjUgY29ubmVjdG9yICovCisjZGVmaW5lCU1PRF9SUzQ4NURCMjUJCTB4MDMJCQkvKiBSUzQ4NSBEQjI1IGNvbm5lY3RvciAqLworI2RlZmluZQlNT0RfUEFSQUxMRUwJCTB4MDQJCQkvKiBDZW50cm9uaWNzIHBhcmFsbGVsICovCisKKyNkZWZpbmUJTU9EMgkJCTB4MDgJCQkvKiBTZXQgdG8gaW5kaWNhdGUgUmV2MiBtb2R1bGUgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKiogICBST1VURV9SVVAgLSBST1VURV9GT0FEICAgKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKERyaXZlci0+UklPLHByZS1lbXB0aXZlKQorCisgICBST1VURV9SVVAgLSBST1VURV9GT0FEIHBhY2tldCBpcyBzZW50IGFzIGEgcmVzcG9uc2UgdG8gYSBST1VURV9SVVAgLSBST1VURV9SRVFVRVNUCisgICBwYWNrZXQgdG8gY2F1c2UgdGhlIFJUQSB0byAiRmFsbCBPdmVyIEFuZCBEaWUiLiwgaS5lLiBzaHV0ZG93biBhbmQgcmVib290LgorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9Sb3V0ZUNtZFN0cmluZwkoUEtUX0RhdGErMikJCS8qIENvbW1hbmQgc3RyaW5nICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiAgIFJPVVRFX1JVUCAtIFJPVVRFX0FMTE9DQVRFICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIChEcml2ZXItPlJJTyxwcmUtZW1wdGl2ZSkKKworICAgUk9VVEVfUlVQIC0gUk9VVEVfQUxMT0NBVEUgcGFja2V0IGlzIHNlbnQgYXMgYSByZXNwb25zZSB0byBhIFJPVVRFX1JVUCAtIFJPVVRFX1JFUVVFU1QKKyAgIHBhY2tldCB0byBhbGxvY2F0ZSB0aGUgUlRBJ3MgSWQgbnVtYmVyIChSVVAgbnVtYmVyIDEuLjE2KQorICAgKi8KKyNpZiAwCisjZGVmaW5lCVBLVF9DbWQJCQkoUEtUX0RhdGErMCkJCS8qIENvbW1hbmQgY29kZSAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9JZE51bQkJKFBLVF9EYXRhKzEpCQkvKiBSVVAgbnVtYmVyIGZvciBwb3J0cyAxLi44ICovCisjaWYgMAorI2RlZmluZQlQS1RfUm91dGVDbWRTdHJpbmcJKFBLVF9EYXRhKzIpCQkvKiBDb21tYW5kIHN0cmluZyAqLworI2VuZGlmCisjZGVmaW5lCVBLVF9JZE51bTIJCShQS1RfRGF0YSsweDE3KQkJLyogUlVQIG51bWJlciBmb3IgcG9ydHMgOS4uMTYgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqICAgUk9VVEVfUlVQIC0gUk9VVEVfVE9QT0xPR1kgICAqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyogKFJJTy0+RHJpdmVyLHByZS1lbXB0aXZlKQorCisgICBST1VURV9SVVAgLSBST1VURV9UT1BPTE9HWSBwYWNrZXQgaXMgc2VudCB0byBpbmZvcm0gdGhlIGRyaXZlciBvZiBhbiBSVEEncworICAgY3VycmVudCBsaW5rIHN0YXR1cy4KKyAgICovCisjaWYgMAorI2RlZmluZQlQS1RfQ21kCQkJKFBLVF9EYXRhKzApCQkvKiBDb21tYW5kIGNvZGUgKi8KKyNlbmRpZgorI2RlZmluZQlQS1RfTGluazFSdXAJCShQS1RfRGF0YSsyKQkJLyogTGluayAxIFJVUCBudW1iZXIgKi8KKyNkZWZpbmUJUEtUX0xpbmsxTGluawkJKFBLVF9EYXRhKzMpCQkvKiBMaW5rIDEgbGluayBudW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HJvdWdoIGEgcG9pbnRlci4KKyoqCVJJT1NXQUIgc3dhcHMgdGhlIHR3byBieXRlcyBvZiBhIHdvcmQsIGlmIG5lZWRlZC4KKyovCisKKyNkZWZpbmUJUklPU1dBQihOKSAgICAgIChOKQorI2RlZmluZQlXQllURShBLFYpCShBKT0odWNoYXIpKFYpCisjZGVmaW5lIFdXT1JEKEEsVikJKEEpPSh1c2hvcnQpKFYpCisjZGVmaW5lIFJCWVRFKEEpCSh1Y2hhcikoQSkKKyNkZWZpbmUgUldPUkQoQSkJKHVzaG9ydCkoQSkKKyNkZWZpbmUgUklORFcoQSkJKCoodXNob3J0ICopKEEpKQorI2RlZmluZSBXSU5EVyhBLFYpCSgqKHVzaG9ydCAqKShBKT0odXNob3J0KShWKSkKKworI2VuZGlmIC8qIF9fcmlvX3Jpc2Nvc19oX18gKi8KZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vcm9tLmggYi9kcml2ZXJzL2NoYXIvcmlvL3JvbS5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmVlNzliOGUKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3JvbS5oCkBAIC0wLDAgKzEsNjQgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgUiBPIE0KKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yIC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AgICAgIEZvdW5kYXRpb24sIEluYy4sIDY3NSBNYXNzIEF2ZSwgQ2FtYnJpZGdlLCBNQSAwMjEzOSwgVVNBLgorCisgVmVyc2lvbiA6IDAuMDEKKworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTW9kcworIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyAgRGF0ZSAgICAgQnkgICAgICAgICAgICAgICAgRGVzY3JpcHRpb24KKyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgX3JvbV9oCisjZGVmaW5lIF9yb21faCAxCisKKyNpZm5kZWYgbGludAorI2lmZGVmIFNDQ1MKK3N0YXRpYyBjaGFyICpfcmlvX3JvbV9oX3NjY3MgPSAiQCgjKXJvbS5oCTEuMSIgOworI2VuZGlmCisjZW5kaWYKKwordHlwZWRlZiBzdHJ1Y3QgIFJPTSAgUk9NIDsKK3N0cnVjdCAgUk9NICB7CisgICAgICAgICAgICAgICAgIHVfc2hvcnQgICAgc2x4IDsKKyAgICAgICAgICAgICAgICAgY2hhciAgICAgICBwY2JfbGV0dGVyX3JldiA7CisgICAgICAgICAgICAgICAgIGNoYXIgICAgICAgcGNiX251bWJlcl9yZXYgOworICAgICAgICAgICAgICAgICBjaGFyICAgICAgIHNlcmlhbFs0XSA7CisgICAgICAgICAgICAgICAgIGNoYXIgICAgICAgeWVhciA7CisgICAgICAgICAgICAgICAgIGNoYXIgICAgICAgd2VlayA7CisgICAgICAgICAgICAgfSA7CisKKyNlbmRpZgorCisjZGVmaW5lIEhPU1RfUk9NICAgIChST00gKikgMHg3YzAwCisjZGVmaW5lIFJUQV9ST00JICAgIChST00gKikgMHg3ODAxCisjZGVmaW5lIFJPTV9MRU5HVEggIDB4MjAKKworLyoqKioqKioqKioqIGVuZCBvZiBmaWxlICoqKioqKioqKioqLworCisKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vcm91dGUuaCBiL2RyaXZlcnMvY2hhci9yaW8vcm91dGUuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jNDJkYmI5Ci0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9yb3V0ZS5oCkBAIC0wLDAgKzEsMTA4IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICBSIE8gVSBUIEUgICAgIEggRSBBIEQgRSBSCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBJYW4gTmFuZGhyYSAvIEplcmVteSBSb2xscworIERhdGUgICAgOgorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIg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IEJ5ICAgICAgICAgICAgICAgIERlc2NyaXB0aW9uCisgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZuZGVmIF9yb3V0ZV9oCisjZGVmaW5lIF9yb3V0ZV9oCisKKyNpZmRlZiBTQ0NTX0xBQkVMUworI2lmbmRlZiBsaW50CisvKiBzdGF0aWMgY2hhciAqX3Jpb19yb3V0ZV9oX3NjY3MgPSAiQCgjKXJvdXRlLmgJMS4zIjsgKi8KKyNlbmRpZgorI2VuZGlmCisKKyNkZWZpbmUgTUFYX0xJTktTIDQKKyNkZWZpbmUgTUFYX05PREVTIDE3ICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBNYXhpbXVtIG5vZGVzIGluIGEgc3VibmV0ICovCisjZGVmaW5lIE5PREVfQllURVMgKChNQVhfTk9ERVMgLyA4KSArIDEpICAgICAgLyogTnVtYmVyIG9mIGJ5dGVzIG5lZWRlZCBmb3IKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxIGJpdCBwZXIgbm9kZSAqLworI2RlZmluZSBST1VURV9EQVRBX1NJWkUgIChOT0RFX0JZVEVTICsgMikgICAgIC8qIE51bWJlciBvZiBieXRlcyBmb3IgY29tcGxldGUgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mbyBhYm91dCBjb3N0IGV0Yy4gKi8KKyNkZWZpbmUgUk9VVEVTX1BFUl9QQUNLRVQgKChQS1RfTUFYX0RBVEFfTEVOIC0yKS8gUk9VVEVfREFUQV9TSVpFKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBub2RlcyB3ZSBjYW4gc3F1ZWV6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludG8gb25lIHBhY2tldCAqLworI2RlZmluZSBNQVhfVE9QT0xPR1lfUEFDS0VUUyAoTUFYX05PREVTIC8gUk9VVEVTX1BFUl9QQUNLRVQgKyAxKQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogRGVmaW5lIHRoZSB0eXBlcyBvZiBjb21tYW5kIGZvciB0aGUgUk9VVEUgUlVQLgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgUk9VVEVfUkVRVUVTVCAgICAwICAgICAgICAgICAgICAgICAgICAvKiBSZXF1ZXN0IGFuIElEICovCisjZGVmaW5lIFJPVVRFX0ZPQUQgICAgICAgMSAgICAgICAgICAgICAgICAgICAgLyogS2lsbCB0aGUgUlRBICovCisjZGVmaW5lIFJPVVRFX0FMUkVBRFkgICAgMiAgICAgICAgICAgICAgICAgICAgLyogSUQgZ2l2ZW4gYWxyZWFkeSAqLworI2RlZmluZSBST1VURV9VU0VEICAgICAgIDMgICAgICAgICAgICAgICAgICAgIC8qIEFsbCBJRCdzIHVzZWQgKi8KKyNkZWZpbmUgUk9VVEVfQUxMT0NBVEUgICA0ICAgICAgICAgICAgICAgICAgICAvKiBIZXJlIGl0IGlzICovCisjZGVmaW5lIFJPVVRFX1JFUV9UT1AgICAgNSAgICAgICAgICAgICAgICAgICAgLyogSSBiZXQgeW91IGRpZG4ndCBleHBlY3QuLi4uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIFRvcG9sb2dpY2FsIElucXVpc2l0aW9uICovCisjZGVmaW5lIFJPVVRFX1RPUE9MT0dZICAgNiAgICAgICAgICAgICAgICAgICAgLyogVG9wb2xvZ3kgcmVxdWVzdCBhbnN3ZXJlZCBGRCAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIERlZmluZSB0aGUgUm91dGUgTWFwIFN0cnVjdHVyZQorICoKKyAqIFRoZSByb3V0ZSBtYXAgZ2l2ZXMgYSBwb2ludGVyIHRvIGEgTGluayBTdHJ1Y3R1cmUgdG8gdXNlLgorICogVGhpcyBhbGxvd3MgRGlzY29ubmVjdGVkIExpbmtzIHRvIGJlIGNoZWNrZWQgcXVpY2tseQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3R5cGVkZWYgc3RydWN0IENPU1RfUk9VVEUgQ09TVF9ST1VURTsKK3N0cnVjdCBDT1NUX1JPVVRFIHsKKyAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBjaGFyIGNvc3Q7ICAgICAgICAvKiBDb3N0IGRvd24gdGhpcyBsaW5rICovCisgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgY2hhciByb3V0ZVtOT0RFX0JZVEVTXTsgLyogTm9kZXMgdGhvcm91Z2ggdGhpcyByb3V0ZSAqLworICAgICAgICAgICAgICAgICAgfSA7CisKK3R5cGVkZWYgc3RydWN0IFJPVVRFX1NUUiBST1VURV9TVFIgOworc3RydWN0ICBST1VURV9TVFIgeworICAgICAgICAgICAgICAgICAgICAgIENPU1RfUk9VVEUgY29zdF9yb3V0ZVtNQVhfTElOS1NdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogY29zdCAvIHJvdXRlIGZvciB0aGlzIGxpbmsgKi8KKyAgICAgICAgICAgICAgICAgICAgICB1c2hvcnQgZmF2b3VyZWQ7ICAgICAgICAgIC8qIGZhdm91cmVkIGxpbmsgKi8KKyAgICAgICAgICAgICAgICAgIH0gOworCisKKyNkZWZpbmUgTk9fTElOSyAgICAgICAgICAgIChzaG9yd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CisrKyBiL2RyaXZlcnMvY2hhci9yaW8vcnRhaHcuaApAQCAtMCwwICsxLDc1IEBACisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKiogICAgICAgICAgICAgICAgUiBUIEEgICAgSCBBIFIgRCBXIEEgUiBFCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBJYW4gTmFuZGhyYQorIERhdGUgICAgOgorCisgKgorICogIChDKSAxOTkwIC0gMjAwMCBTcGVjaWFsaXggSW50ZXJuYXRpb25hbCBMdGQuLCBCeWZsZWV0LCBTdXJyZXksIFVLLgorICoKKyAqICAgICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyAqICAgICAgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkKKyAqICAgICAgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24gMiBvZiB0aGUgTGljZW5zZSwgb3IKKyAqICAgICAgKGF0IHlvdXIgb3B0aW9uKSBhbnkgbGF0ZXIgdmVyc2lvbi4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aGUgaG9wZSB0aGF0IGl0IHdpbGwgYmUg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WxsZWwgKi8KK307CisKKyNkZWZpbmUgVFlQRV9IT1NUCTAKKyNkZWZpbmUgVFlQRV9SVEE4CTEKKyNkZWZpbmUgVFlQRV9SVEExNgkyCisKKyNkZWZpbmUJV0FUQ0hfRE9HCVdBVENIRE9HX0FERFIKKworLyoqKioqKioqKioqIGVuZCBvZiBmaWxlICoqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9ydXAuaCBiL2RyaXZlcnMvY2hhci9yaW8vcnVwLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYjlkMmJjMAotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9yaW8vcnVwLmgKQEAgLTAsMCArMSw4MiBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgIFIgVSBQICAgUyBUIFIgVSBDIFQgVSBSIEUKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yICA6IElhbiBOYW5kaHJhCisgRGF0ZSAgICA6CisKKyAqCisgKiAgKEMpIDE5OTAgLSAyMDAwIFNwZWNpYWxpeCBJbnRlcm5hdGlvbmFsIEx0ZC4sIEJ5ZmxlZXQsIFN1cnJleSwgVUsuCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG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S0tLS0tLS0tLS0tLS0KKyAgRGF0ZSAgICAgQnkgICAgICAgICAgICAgICAgRGVzY3JpcHRpb24KKyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgX3J1cF9oCisjZGVmaW5lIF9ydXBfaCAxCisKKyNpZmRlZiBTQ0NTX0xBQkVMUworI2lmbmRlZiBsaW50CisvKiBzdGF0aWMgY2hhciAqX3Jpb19ydXBfaF9zY2NzID0gIkAoIylydXAuaAkxLjUiOyAqLworI2VuZGlmCisjZW5kaWYKKworI2lmIGRlZmluZWQoIEhPU1QgKSB8fCBkZWZpbmVkKCBJTktFUk5FTCApCisjZGVmaW5lIE1BWF9SVVAgICAgICAgICAgKChzaG9ydCkgMTYpIAorI2VuZGlmCisjaWZkZWYgUlRBCisjZGVmaW5lIE1BWF9SVVAgICAgICAgICAgKChzaG9ydCkgMSkKKyNlbmRpZgorCisjZGVmaW5lIFBLVFNfUEVSX1JVUCAgICAgKChzaG9ydCkgMikgICAgIC8qIFRoZXkgYXJlIGFsd2F5cyB1c2VkIGluIHBhaXJzICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBEZWZpbmUgYWxsIHRoZSAgcGFja2V0IHJlcXVlc3Qgc3R1ZmYKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIFRYX1JVUF9JTkFDVElWRSAgICAgICAgICAwICAgICAgICAvKiBOb3RoaW5nIHRvIHRyYW5zbWl0ICovCisjZGVmaW5lIFRYX1BBQ0tFVF9SRUFEWSAgICAgICAgICAxICAgICAgICAvKiBUcmFuc21pdCBwYWNrZXQgcmVhZHkgKi8KKyNkZWZpbmUgVFhfTE9DS19SVVAgICAgICAgICAgICAgIDIgICAgICAgIC8qIFRyYW5zbWl0IHNpZGUgbG9ja2VkICovCisKKyNkZWZpbmUgUlhfUlVQX0lOQUNUSVZFICAgICAgICAgIDAgICAgICAgIC8qIE5vdGhpbmcgcmVjZWl2ZWQgKi8KKyNkZWZpbmUgUlhfUEFDS0VUX1JFQURZICAgICAgICAgIDEgICAgICAgIC8qIFBhY2tldCByZWNlaXZlZCAqLworCisjZGVmaW5lIFJVUF9OT19PV05FUiAgICAgICAgICAgICAweGZmICAgICAvKiBSVVAgbm90IG93bmVkIGJ5IGFueSBwcm9jZXNzICovCisKK3N0cnVjdCBSVVAgeworICAgICAgICAgICAgIFBLVF9wdHIgICAgdHhwa3Q7ICAgICAgICAgICAgLyogT3V0Z29pbmcgcGFja2V0ICovCisgICAgICAgICAgICAgUEtUX3B0ciAgICByeHBrdDsgICAgICAgICAgICAvKiBJbmNvbWluZyBwYWNrZXQgKi8KKyAgICAgICAgICAgICBXT1JEICAgICAgIGxpbms7ICAgICAgICAgICAgIC8qIFdoaWNoIGxpbmsgdG8gc2VuZCBkb3duPyAqLworICAgICAgICAgICAgIEJZVEUgICAgICAgcnVwX2Rlc3RfdW5pdFsyXTsgLyogRGVzdGluYXRpb24gdW5pdCAqLworICAgICAgICAgICAgIFdPUkQgICAgICAgaGFuZHNoYWtlOyAgICAgICAgLyogRm9yIGhhbmRzaGFraW5nICovCisgICAgICAgICAgICAgV09SRCAgICAgICB0aW1lb3V0OyAgICAgICAgICAvKiBUaW1lb3V0ICovCisgICAgICAgICAgICAgV09SRCAgICAgICBzdGF0dXM7ICAgICAgICAgICAvKiBTdGF0dXMgKi8KKyAgICAgICAgICAgICBXT1JEICAgICAgIHR4Y29udHJvbDsgICAgICAgIC8qIFRyYW5zbWl0IGNvbnRyb2wgKi8KKyAgICAgICAgICAgICBXT1JEICAgICAgIHJ4Y29udHJvbDsgICAgICAgIC8qIFJlY2VpdmUgY29udHJvbCAqLworICAgICAgICAgICB9OworIAorI2VuZGlmCisKKy8qKioqKioqKioqKiBlbmQgb2YgZmlsZSAqKioqKioqKioqKi8KKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9ydXBzdGF0LmggYi9kcml2ZXJzL2NoYXIvcmlvL3J1cHN0YXQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5iNGFhZmFmCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby9ydXBzdGF0LmgKQEAgLTAsMCArMSw1MSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICBSVVBTVEFUCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworIEF1dGhvciAgOiBKZXJlbXkgUm9sbHMKKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4IEludGVybmF0aW9uYWwgTHRkLiwgQnlmbGVldCwgU3VycmV5LCBVSy4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CisgKiAgICAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vu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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2lmbmRlZiBfcnVwc3RhdF9oCisjZGVmaW5lIF9ydXBzdGF0X2gKKworI2lmbmRlZiBsaW50CisjaWZkZWYgU0NDU19MQUJFTFMKK3N0YXRpYyBjaGFyICpfcmlvX3J1cHN0YXRfaF9zY2NzID0gIkAoIylydXBzdGF0LmgJMS4xIiA7CisjZW5kaWYKKyNlbmRpZgorCisjZGVmaW5lICAgIFNUQVRVU19TWU5DICAgIDAKKyNkZWZpbmUgICAgU1RBVFVTX1JFUV9UT1AgMQorI2RlZmluZSAgICBTVEFUVVNfVE9QT0xPR1kgICAgMgorCisjZW5kaWYKKwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3Jpby9zYW0uaCBiL2RyaXZlcnMvY2hhci9yaW8vc2FtLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYzFhY2NiOAotLS0gL2Rldi9udWxsCisrKyBiL2RyaXZlcnMvY2hhci9yaW8vc2FtLmgKQEAgLTAsMCArMSw3NCBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgUyBBIE0gLiBICisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKioqKioqKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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cGFjZV9oX18gKi8KZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vc3lzbWFwLmggYi9kcml2ZXJzL2NoYXIvcmlvL3N5c21hcC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmZkYzczMTMKLS0tIC9kZXYvbnVsbAorKysgYi9kcml2ZXJzL2NoYXIvcmlvL3N5c21hcC5oCkBAIC0wLDAgKzEsNjMgQEAKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICBTIFkgUyBUIEUgTSAgIE0gQSBQICAgSCBFIEEgRCBFIFIKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorCisgQXV0aG9yICA6IElhbiBOYW5kaHJhCisgRGF0ZSAgICA6CisKKyAqCisgKiAgKEMpIDE5OTAgLSAyMDAwIFNwZWNpYWxpeCBJbnRlcm5hdGlvbmFsIEx0ZC4sIEJ5ZmxlZXQsIFN1cnJleSwgVUsuCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQorICogICAgICBpdCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hlZCBieQorICogICAgICB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBlaX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LS0tLS0tLS0tLS0tCisKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgbGludAorI2lmZGVmIFNDQ1NfTEFCRUxTCitzdGF0aWMgY2hhciAqX3Jpb19zeXNtYXBfaF9zY2NzID0gIkAoIylzeXNtYXAuaAkxLjEiIDsKKyNlbmRpZgorI2VuZGlmCisKKyNkZWZpbmUgU1lTVEVNX01BUF9MRU4gICAgIDY0ICAgICAgICAgICAvKiBMZW4gb2YgU3lzdGVtIE1hcCBhcnJheSAqLworCisKK3R5cGVkZWYgc3RydWN0IFNZU19NQVAgICAgICAgIFNZU19NQVAgOwordHlwZWRlZiBzdHJ1Y3QgU1lTX01BUF9MSU5LICAgU1lTX01BUF9MSU5LIDsKKworc3RydWN0IFNZU19NQVBfTElOSyB7CisgICAgICAgICAgICAgICAgICAgICAgICBzaG9ydCBpZCA7ICAgICAgICAgIC8qIFVuaXQgSWQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIHNob3J0IGxpbmsgOyAgICAgICAgLyogSWQncyBMaW5rICovCisgICAgICAgICAgICAgICAgICAgICAgICBzaG9ydCBiZWVuX2hlcmUgOyAgIC8qIFVzZWQgYnkgbWFwX2dlbiAqLworICAgICAgICAgICAgICAgICAgICB9IDsKKworc3RydWN0IFNZU19NQVAgeworICAgICAgICAgICAgICAgICAgIGNoYXIgICAgICAgICBzZXJpYWxfbnVtWzRdIDsKKyAgICAgICAgICAgICAgICAgICBTWVNfTUFQX0xJTksgbGlua1s0XSA7CisgICAgICAgICAgICAgICB9IDsKKworCisvKioqKioqKioqKiogZW5kIG9mIGZpbGUgKioqKioqKioqKiovCisKZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2hhci9yaW8vdGltZW91dHMuaCBiL2RyaXZlcnMvY2hhci9yaW8vdGltZW91dHMuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xMWIzMTMzCi0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3Jpby90aW1lb3V0cy5oCkBAIC0wLDAgKzEsNTEgQEAKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqKioqKioqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqCisgKioqKioqKiAgICAgICAgICAgICAgICAgICAgIFQgSSBNIEUgTyBVIFQgUworICoqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisKKyBBdXRob3IgIDogSWFuIE5hbmRocmEKKyBEYXRlICAgIDoKKworICoKKyAqICAoQykgMTk5MCAtIDIwMDAgU3BlY2lhbGl4IEludGVybmF0aW9uYWwgTHRkLiwgQnlmbGVldCwgU3VycmV5LCBVSy4KKyAqCisgKiAgICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CisgKiAgICAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CisgKiAgICAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yCisgKiAgICAgIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCisgKgorICogICAgICBUaGlzIHByb2dyYW0gaXMgZGlzdHJpYnV0ZWQgaW4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X01JTlQpICovIHsKKwkJCWFjayA9IHJjX2luKGJwLCBSQ19BQ0tfTUlOVCk7CisJCQorCQkJaWYgKGFjayA9PSAoUkNfSUQgfCBHSVZSX0lUX01PREVNKSkgCisJCQkJcmNfY2hlY2tfbW9kZW0oYnApOworCQkJZWxzZQorCQkJCXByaW50ayhLRVJOX1dBUk5JTkcgInJjJWQ6IEJhZCBtb2RlbSBhY2sgIgorCQkJCQkJICAgICIweCUwMnguXG4iLAorCQkJCSAgICAgICBib2FyZF9ObyhicCksIGFjayk7CisJCQorCQl9IAorCisJCXJjX291dChicCwgQ0QxODBfRU9JUiwgMCk7ICAgLyogTWFyayBlbmQgb2YgaW50ZXJydXB0ICovCisJCXJjX291dChicCwgUkNfQ1RPVVQsIDApOyAgICAgLyogQ2xlYXIgdGltZW91dCBmbGFnICAgICovCisJfQorCXJldHVybiBJUlFfUkVUVkFMKGhhbmRsZWQpOworfQorCisvKgorICogIFJvdXRpbmVzIGZvciBvcGVuICYgY2xvc2UgcHJvY2Vzc2luZy4KKyAqLworCisvKiBDYWxsZWQgd2l0aCBkaXNhYmxlZCBpbnRlcnJ1cHRzICovCitzdGF0aWMgaW5saW5lIGludCByY19zZXR1cF9ib2FyZChzdHJ1Y3QgcmlzY29tX2JvYXJkICogYnApCit7CisJaW50IGVycm9yOworCisJaWYgKGJwLT5mbGFncyAmIFJDX0JPQVJEX0FDVElWRSkgCisJCXJldHVybiAwOworCQorCWVycm9yID0gcmVxdWVzdF9pcnEoYnAtPmlycSwgcmNfaW50ZXJydXB0LCBTQV9JTlRFUlJVUFQsCisJCQkgICAgIlJJU0NvbS84IiwgTlVMTCk7CisJaWYgKGVycm9yKSAKKwkJcmV0dXJuIGVycm9yOworCQorCXJjX291dChicCwgUkNfQ1RPVVQsIDApOyAgICAgICAJCS8qIEp1c3QgaW4gY2FzZSAgICAgICAgICovCisJYnAtPkRUUiA9IH4wOworCXJjX291dChicCwgUkNfRFRSLCBicC0+RFRSKTsJICAgICAgICAvKi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gbGludXgvZHJpdmVycy9jaGFyL3Jpc2NvbThfcmVnLmggIC0tIFJJU0NvbS84IG11bHRpcG9ydCBzZXJpYWwgZHJpdmVyLgorICovCisKKy8qCisgKiBEZWZpbml0aW9ucyBmb3IgUklTQ29tLzggQXN5bmMgTXV4IGNhcmQgYnkgU0RMIENvbW11bmljYXRpb25zLCBJbmMuCisgKi8KKworLyoKKyAqIEFkZHJlc3MgbWFwcGluZyBiZXR3ZWVuIENpcnJ1cyBMb2dpYyBDRDE4MCBjaGlwIGludGVybmFsIHJlZ2lzdGVycworICogYW5kIElTQSBwb3J0IGFkZHJlc3NlczoKKyAqCisgKiAgICAgIENMLUNEMTgwICAgICAgICAgICAgICAgIEE2ICBBNSAgIEE0ICBBMyAgICAgICAgICAgICAgICAgICAgICBBMiBBMSBBMAorICogICAgICBJU0EgICAgICAgICAgICAgQTE1IEExNCBBMTMgQTEyICBBMTEgQTEwIEE5IEE4ICBBNyBBNiBBNSBBNCAgQTMgQTIgQTEgQTAKKyAqLworI2RlZmluZSBSQ19UT19JU0EocikgICAgKCgoKHIpJjB4MDcpPDwxKSB8ICgoKHIpJn4weDA3KTw8NykpCisKKworLyogUklTQ29tLzggT24tQm9hcmQgUmVnaXN0ZXJzIChhc3N1bWluZyBhZGRyZXNzIHRyYW5zbGF0aW9uKSAqLworCisjZGVmaW5lIFJDX1JJICAgICAgICAgICAweDEwMCAgIC8qIFJpbmcgSW5kaWNhdG9yIFJlZ2lzdGVyIChSL08pICAgICAgICAgICAqLworI2RlZmluZSBSQ19EVFIgICAgICAgICAgMHgxMDAgICAvKiBEVFIgUmVnaXN0ZXIgKFcvTykgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgUkNfQlNSICAgICAgICAgIDB4MTAxICAgLyogQm9hcmQgU3RhdHVzIFJlZ2lzdGVyIChSL08pICAgICAgICAgICAgICovCisjZGVmaW5lIFJDX0NUT1VUICAgICAgICAweDEwMSAgIC8qIENsZWFyIFRpbWVvdXQgKFcvTykgICAgICAgICAgICAgICAgICAgICAqLworCisKKy8qIEJvYXJkIFN0YXR1cyBSZWdpc3RlciAqLworCisjZGVmaW5lIFJDX0JTUl9UT1VUICAgICAweDA4ICAgICAvKiBIYXJkd2FyZSBUaW1lb3V0ICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSQ19CU1JfUklOVCAgICAgMHgwNCAgICAgLyogUmVjZWl2ZXIgSW50ZXJydXB0ICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgUkNfQlNSX1RJTlQgICAgIDB4MDIgICAgIC8qIFRyYW5zbWl0dGVyIEludGVycnVwdCAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIFJDX0JTUl9NSU5UICAgICAweDAxICAgICAvKiBNb2RlbSBDdGwgSW50ZXJydXB0ICAgICAgICAgICAgICAgICAgICAqLworCisKKy8qIE9uLWJvYXJkIG9zY2lsbGF0b3IgZnJlcXVlbmN5IChpbiBIeikgKi8KKyNkZWZpbmUgUkNfT1NDRlJFUSAgICAgIDk4MzA0MDAKKworLyogVmFsdWVzIG9mIGNob2ljZSBmb3IgSW50ZXJydXB0IEFDS3MgKi8KKyNkZWZpbmUgUkNfQUNLX01JTlQgICAgIDB4ODEgICAgLyogZ29lcyB0byBQSUxSMSAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIFJDX0FDS19SSU5UICAgICAweDgyICAgIC8qIGdvZXMgdG8gUElMUjMgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSQ19BQ0tfVElOVCAgICAgMHg4NCAgICAvKiBnb2VzIHRvIFBJTFIyICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworLyogQ2hpcCBJRCAoc29ycnksIG9ubHkgb25lIGNoaXAgbm93KSAqLworI2RlZmluZSBSQ19JRCAgICAgICAgICAgMHgxMAorCisvKiBEZWZpbml0aW9ucyBmb3IgQ2lycnVzIExvZ2ljIENMLUNEMTgwIDgtcG9ydCBhc3luYyBtdXggY2hpcCAqLworIAorI2RlZmluZSBDRDE4MF9OQ0ggICAgICAgOCAgICAgICAvKiBUb3RhbCBudW1iZXIgb2YgY2hhbm5lbHMgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0QxODBfVFBDICAgICAgIDE2ICAgICAgLyogVGlja3MgcGVyIGNoYXJhY3RlciAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX05GSUZPCTgJLyogVFggRklGTyBzaXplICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKworLyogR2xvYmFsIHJlZ2lzdGVycyAqLworCisjZGVmaW5lIENEMTgwX0dJVlIgICAgICAweDQwICAgIC8qIEdsb2JhbCBJbnRlcnJ1cHQgVmVjdG9yIFJlZ2lzdGVyICAgICAgICAqLworI2RlZmluZSBDRDE4MF9HSUNSICAgICAgMHg0MSAgICAvKiBHbG9iYWwgSW50ZXJydXB0aW5nIENoYW5uZWwgUmVnaXN0ZXIgICAgKi8KKyNkZWZpbmUgQ0QxODBfUElMUjEgICAgIDB4NjEgICAgLyogUHJpb3JpdHkgSW50ZXJydXB0IExldmVsIFJlZ2lzdGVyIDEgICAgICovCisjZGVmaW5lIENEMTgwX1BJTFIyICAgICAweDYyICAgIC8qIFByaW9yaXR5IEludGVycnVwdCBMZXZlbCBSZWdpc3RlciAyICAgICAqLworI2RlZmluZSBDRDE4MF9QSUxSMyAgICAgMHg2MyAgICAvKiBQcmlvcml0eSBJbnRlcnJ1cHQgTGV2ZWwgUmVnaXN0ZXIgMyAgICAgKi8KKyNkZWZpbmUgQ0QxODBfQ0FSICAgICAgIDB4NjQgICAgLyogQ2hhbm5lbCBBY2Nlc3MgUmVnaXN0ZXIgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX0dGUkNSICAgICAweDZiICAgIC8qIEdsb2JhbCBGaXJtd2FyZSBSZXZpc2lvbiBDb2RlIFJlZ2lzdGVyICAqLworI2RlZmluZSBDRDE4MF9QUFJIICAgICAgMHg3MCAgICAvKiBQcmVzY2FsZXIgUGVyaW9kIFJlZ2lzdGVyIEhpZ2ggICAgICAgICAgKi8KKyNkZWZpbmUgQ0QxODBfUFBSTCAgICAgIDB4NzEgICAgLyogUHJlc2NhbGVyIFBlcmlvZCBSZWdpc3RlciBMb3cgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX1JEUiAgICAgICAweDc4ICAgIC8qIFJlY2VpdmVyIERhdGEgUmVnaXN0ZXIgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDRDE4MF9SQ1NSICAgICAgMHg3YSAgICAvKiBSZWNlaXZlciBDaGFyYWN0ZXIgU3RhdHVzIFJlZ2lzdGVyICAgICAgKi8KKyNkZWZpbmUgQ0QxODBfVERSICAgICAgIDB4N2IgICAgLyogVHJhbnNtaXQgRGF0YSBSZWdpc3RlciAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX0VPSVIgICAgICAweDdmICAgIC8qIEVuZCBvZiBJbnRlcnJ1cHQgUmVnaXN0ZXIgICAgICAgICAgICAgICAqLworCisKKy8qIENoYW5uZWwgUmVnaXN0ZXJzICovCisKKyNkZWZpbmUgQ0QxODBfQ0NSICAgICAgIDB4MDEgICAgLyogQ2hhbm5lbCBDb21tYW5kIFJlZ2lzdGVyICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX0lFUiAgICAgICAweDAyICAgIC8qIEludGVycnVwdCBFbmFibGUgUmVnaXN0ZXIgICAgICAgICAgICAgICAqLworI2RlZmluZSBDRDE4MF9DT1IxICAgICAgMHgwMyAgICAvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAxICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0QxODBfQ09SMiAgICAgIDB4MDQgICAgLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgMiAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX0NPUjMgICAgICAweDA1ICAgIC8qIENoYW5uZWwgT3B0aW9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vYmFsIEludGVycnVwdCBDaGFubmVsIFJlZ2lzdGVyIChSL1cpICovCisgCisjZGVmaW5lIEdJQ1JfQ0hBTiAgICAgICAweDFjICAgIC8qIENoYW5uZWwgTnVtYmVyIE1hc2sgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBHSUNSX0NIQU5fT0ZGICAgMiAgICAgICAvKiBDaGFubmVsIE51bWJlciBPZmZzZXQgICAgICAgICAgICAgICAgICAgKi8KKworCisvKiBDaGFubmVsIEFkZHJlc3MgUmVnaXN0ZXIgKFIvVykgKi8KKworI2RlZmluZSBDQVJfQ0hBTiAgICAgICAgMHgwNyAgICAvKiBDaGFubmVsIE51bWJlciBNYXNrICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0FSX0E3ICAgICAgICAgIDB4MDggICAgLyogQTcgQWRkcmVzcyBFeHRlbnNpb24gKHVudXNlZCkgICAgICAgICAgICovCisKKworLyogUmVjZWl2ZSBDaGFyYWN0ZXIgU3RhdHVzIFJlZ2lzdGVyIChSL08pICovCisKKyNkZWZpbmUgUkNTUl9UT1VUICAgICAgIDB4ODAgICAgLyogUnggVGltZW91dCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIFJDU1JfU0NERVQgICAgICAweDcwICAgIC8qIFNwZWNpYWwgQ2hhcmFjdGVyIERldGVjdGVkIE1hc2sgICAgICAgICAqLworI2RlZmluZSAgUkNTUl9OT19TQyAgICAgIDB4MDAgICAvKiBObyBTcGVjaWFsIENoYXJhY3RlcnMgRGV0ZWN0ZWQgICAgICAgICAgKi8KKyNkZWZpbmUgIFJDU1JfU0NfMSAgICAgICAweDEwICAgLyogU3BlY2lhbCBDaGFyIDEgKG9yIDEgJiAzKSBEZXRlY3RlZCAgICAgICovCisjZGVmaW5lICBSQ1NSX1NDXzIgICAgICAgMHgyMCAgIC8qIFNwZWNpYWwgQ2hhciAyIChvciAyICYgNCkgRGV0ZWN0ZWQgICAgICAqLworI2RlZmluZSAgUkNTUl9TQ18zICAgICAgIDB4MzAgICAvKiBTcGVjaWFsIENoYXIgMyBEZXRlY3RlZCAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIFJDU1JfU0NfNCAgICAgICAweDQwICAgLyogU3BlY2lhbCBDaGFyIDQgRGV0ZWN0ZWQgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIFJDU1JfQlJFQUsgICAgICAweDA4ICAgIC8qIEJyZWFrIGhhcyBiZWVuIGRldGVjdGVkICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBSQ1NSX1BFICAgICAgICAgMHgwNCAgICAvKiBQYXJpdHkgRXJyb3IgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgUkNTUl9GRSAgICAgICAgIDB4MDIgICAgLyogRnJhbWUgRXJyb3IgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIFJDU1JfT0UgICAgICAgICAweDAxICAgIC8qIE92ZXJydW4gRXJyb3IgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworCisKKy8qIENoYW5uZWwgQ29tbWFuZCBSZWdpc3RlciAoUi9XKSAoY29tbWFuZHMgaW4gZ3JvdXBzIGNhbiBiZSBPUi1lZCkgKi8KKworI2RlZmluZSBDQ1JfSEFSRFJFU0VUICAgMHg4MSAgICAvKiBSZXNldCB0aGUgY2hpcCAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfU09GVFJFU0VUICAgMHg4MCAgICAvKiBTb2Z0IENoYW5uZWwgUmVzZXQgICAgICAgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfQ09SQ0hHMSAgICAgMHg0MiAgICAvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAxIENoYW5nZWQgICAgICAgKi8KKyNkZWZpbmUgQ0NSX0NPUkNIRzIgICAgIDB4NDQgICAgLyogQ2hhbm5lbCBPcHRpb24gUmVnaXN0ZXIgMiBDaGFuZ2VkICAgICAgICovCisjZGVmaW5lIENDUl9DT1JDSEczICAgICAweDQ4ICAgIC8qIENoYW5uZWwgT3B0aW9uIFJlZ2lzdGVyIDMgQ2hhbmdlZCAgICAgICAqLworCisjZGVmaW5lIENDUl9TU0NIMSAgICAgICAweDIxICAgIC8qIFNlbmQgU3BlY2lhbCBDaGFyYWN0ZXIgMSAgICAgICAgICAgICAgICAqLworCisjZGVmaW5lIENDUl9TU0NIMiAgICAgICAweDIyICAgIC8qIFNlbmQgU3BlY2lhbCBDaGFyYWN0ZXIgMiAgICAgICAgICAgICAgICAqLworCisjZGVmaW5lIENDUl9TU0NIMyAgICAgICAweDIzICAgIC8qIFNlbmQgU3BlY2lhbCBDaGFyYWN0ZXIgMyAgICAgICAgICAgICAgICAqLworCisjZGVmaW5lIENDUl9TU0NINCAgICAgICAweDI0ICAgIC8qIFNlbmQgU3BlY2lhbCBDaGFyYWN0ZXIgNCAgICAgICAgICAgICAgICAqLworCisjZGVmaW5lIENDUl9UWEVOICAgICAgICAweDE4ICAgIC8qIEVuYWJsZSBUcmFuc21pdHRlciAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDQ1JfUlhFTiAgICAgICAgMHgxMiAgICAvKiBFbmFibGUgUmVjZWl2ZXIgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworI2RlZmluZSBDQ1JfVFhESVMgICAgICAgMHgxNCAgICAvKiBEaXNhYmxlIFRyYW5zbWl0dGVyICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0NSX1JYRElTICAgICAgIDB4MTEgICAgLyogRGlzYWJsZSBSZWNlaXZlciAgICAgICAgICAgICAgICAgICAgICAgICovCisKKworLyogSW50ZXJydXB0IEVuYWJsZSBSZWdpc3RlciAoUi9XKSAqLworCisjZGVmaW5lIElFUl9EU1IgICAgICAgICAweDgwICAgIC8qIEVuYWJsZSBpbnRlcnJ1cHQgb24gRFNSIGNoYW5nZSAgICAgICAgICAqLworI2RlZmluZSBJRVJfQ0QgICAgICAgICAgMHg0MCAgICAvKiBFbmFibGUgaW50ZXJydXB0IG9uIENEIGNoYW5nZSAgICAgICAgICAgKi8KKyNkZWZpbmUgSUVSX0NUUyAgICAgICAgIDB4MjAgICAgLyogRW5hYmxlIGludGVycnVwdCBvbiBDVFMgY2hhbmdlICAgICAgICAgICovCisjZGVmaW5lIElFUl9SWEQgICAgICAgICAweDEwICAgIC8qIEVuYWJsZSBpbnRlcnJ1cHQgb24gUmVjZWl2ZSBEYXRhICAgICAgICAqLworI2RlZmluZSBJRVJfUlhTQyAgICAgICAgMHgwOCAgICAvKiBFbmFibGUgaW50ZXJydXB0IG9uIFJlY2VpdmUgU3BlYy4gQ2hhciAgKi8KKyNkZWZpbmUgSUVSX1RYUkRZICAgICAgIDB4MDQgICAgLyogRW5hYmxlIGludGVycnVwdCBvbiBUWCBGSUZPIGVtcHR5ICAgICAgICovCisjZGVmaW5lIElFUl9UWEVNUFRZICAgICAweDAyICAgIC8qIEVuYWJsZSBpbnRlcnJ1cHQgb24gVFggY29tcGxldGVseSBlbXB0eSAqLworI2RlZmluZSBJRVJfUkVUICAgICAgICAgMHgwMSAgICAvKiBFbmFibGUgaW50ZXJydXB0IG9uIFJYIEV4Yy4gVGltZW91dCAgICAgKi8KKworCisvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAxIChSL1cpICovCisKKyNkZWZpbmUgQ09SMV9PRERQICAgICAgIDB4ODAgICAgLyogT2RkIFBhcml0eSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjFfUEFSTU9ERSAgICAweDYwICAgIC8qIFBhcml0eSBNb2RlIG1hc2sgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV9OT1BBUiAgICAgIDB4MDAgICAvKiBObyBQYXJpdHkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfRk9SQ0VQQVIgICAweDIwICAgLyogRm9yY2UgUGFyaXR5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBDT1IxX05PUk1QQVIgICAgMHg0MCAgIC8qIE5vcm1hbCBQYXJpdHkgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IxX0lHTk9SRSAgICAgMHgxMCAgICAvKiBJZ25vcmUgUGFyaXR5IG9uIFJYICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ09SMV9TVE9QQklUUyAgIDB4MGMgICAgLyogTnVtYmVyIG9mIFN0b3AgQml0cyAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBDT1IxXzFTQiAgICAgICAgMHgwMCAgIC8qIDEgU3RvcCBCaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV8xNVNCICAgICAgIDB4MDQgICAvKiAxLjUgU3RvcCBCaXRzICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfMlNCICAgICAgICAweDA4ICAgLyogMiBTdG9wIEJpdHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjFfQ0hBUkxFTiAgICAweDAzICAgIC8qIENoYXJhY3RlciBMZW5ndGggICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV81QklUUyAgICAgIDB4MDAgICAvKiA1IGJpdHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgIENPUjFfNkJJVFMgICAgICAweDAxICAgLyogNiBiaXRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lICBDT1IxXzdCSVRTICAgICAgMHgwMiAgIC8qIDcgYml0cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSAgQ09SMV84QklUUyAgICAgIDB4MDMgICAvKiA4IGJpdHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworCisvKiBDaGFubmVsIE9wdGlvbiBSZWdpc3RlciAyIChSL1cpICovCisKKyNkZWZpbmUgQ09SMl9JWE0gICAgICAgIDB4ODAgICAgLyogSW1wbGllZCBYT04gbW9kZSAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjJfVFhJQkUgICAgICAweDQwICAgIC8qIEVuYWJsZSBJbi1CYW5kIChYT04vWE9GRikgRmxvdyBDb250cm9sICAqLworI2RlZmluZSBDT1IyX0VUQyAgICAgICAgMHgyMCAgICAvKiBFbWJlZGRlZCBUeCBDb21tYW5kcyBFbmFibGUgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ09SMl9MTE0gICAgICAgIDB4MTAgICAgLyogTG9jYWwgTG9vcGJhY2sgTW9kZSAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjJfUkxNICAgICAgICAweDA4ICAgIC8qIFJlbW90ZSBMb29wYmFjayBNb2RlICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDT1IyX1JUU0FPICAgICAgMHgwNCAgICAvKiBSVFMgQXV0b21hdGljIE91dHB1dCBFbmFibGUgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ09SMl9DVFNBRSAgICAgIDB4MDIgICAgLyogQ1RTIEF1dG9tYXRpYyBFbmFibGUgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENPUjJfRFNSQUUgICAgICAweDAxICAgIC8qIERTUiBBdXRvbWF0aWMgRW5hYmxlICAgICAgICAgICAgICAgICAgICAqLworCisKKy8qIENoYW5uZWwgT3B0aW9uIFJlZ2lzdGVyIDMgKFIvVykgKi8KKworI2RlZmluZSBDT1IzX1hPTkNIICAgICAgMHg4MCAgICAvKiBYT04gaXMgYSBwYWlyIG9mIGNoYXJhY3RlcnMgKDEgJiAzKSAgICAgKi8KKyNkZWZpbmUgQ09SM19YT0ZGQ0ggICAgIDB4NDAgICAgLyogWE9GRiBpcyBhIHBhaXIgb2YgY2hhcmFjdGVycyAoMiAmIDQpICAgICovCisjZGVmaW5lIENPUjNfRkNUICAgICAgICAweDIwICAgIC8qIEZsb3ctQ29udHJvbCBUcmFuc3BhcmVuY3kgTW9kZSAgICAgICAgICAqLworI2RlZmluZSBDT1IzX1NDREUgICAgICAgMHgxMCAgICAvKiBTcGVjaWFsIENoYXJhY3RlciBEZXRlY3Rpb24gRW5hYmxlICAgICAgKi8KKyNkZWZpbmUgQ09SM19SWFRIICAgICAgIDB4MGYgICAgLyogUlggRklGTyBUaHJlc2hvbGQgdmFsdWUgKDEtOCkgICAgICAgICAgICovCisKKworLyogQ2hhbm5lbCBDb250cm9sIFN0YXR1cyBSZWdpc3RlciAoUi9PKSAqLworCisjZGVmaW5lIENDU1JfUlhFTiAgICAgICAweDgwICAgIC8qIFJlY2VpdmVyIEVuYWJsZWQgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDQ1NSX1JYRkxPRkYgICAgMHg0MCAgICAvKiBSZWNlaXZlIEZsb3cgT2ZmIChYT0ZGIHdhcyBzZW50KSAgICAgICAgKi8KKyNkZWZpbmUgQ0NTUl9SWEZMT04gICAgIDB4MjAgICAgLyogUmVjZWl2ZSBGbG93IE9uIChYT04gd2FzIHNlbnQpICAgICAgICAgICovCisjZGVmaW5lIENDU1JfVFhFTiAgICAgICAweDA4ICAgIC8qIFRyYW5zbWl0dGVyIEVuYWJsZWQgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDQ1NSX1RYRkxPRkYgICAgMHgwNCAgICAvKiBUcmFuc21pdCBGbG93IE9mZiAoZ290IFhPRkYpICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0NTUl9UWEZMT04gICAgIDB4MDIgICAgLyogVHJhbnNtaXQgRmxvdyBPbiAoZ290IFhPTikgICAgICAgICAgICAgICovCisKKworLyogTW9kZW0gQ2hhbmdlIE9wdGlvbiBSZWdpc3RlciAxIChSL1cpICovCisKKyNkZWZpbmUgTUNPUjFfRFNSWkQgICAgIDB4ODAgICAgLyogRGV0ZWN0IDAtPjEgdHJhbnNpdGlvbiBvZiBEU1IgICAgICAgICAgICovCisjZGVmaW5lIE1DT1IxX0NEWkQgICAgICAweDQwICAgIC8qIERldGVjdCAwLT4xIHRyYW5zaXRpb24gb2YgQ0QgICAgICAgICAgICAqLworI2RlZmluZSBNQ09SMV9DVFNaRCAgICAgMHgyMCAgICAvKiBEZXRlY3QgMC0+MSB0cmFuc2l0aW9uIG9mIENUUyAgICAgICAgICAgKi8KKyNkZWZpbmUgTUNPUjFfRFRSVEggICAgIDB4MGYgICAgLyogQXV0byBEVFIgZmxvdyBjb250cm9sIFRocmVzaG9sZCAoMS04KSAgICovCisjZGVmaW5lICBNQ09SMV9OT0RUUkZDICAgMHgwICAgICAvKiBBdXRvbWF0aWMgRFRSIGZsb3cgY29udHJvbCBkaXNhYmxlZCAgICAgKi8KKworCisvKiBNb2RlbSBDaGFuZ2UgT3B0aW9uIFJlZ2lzdGVyIDIgKFIvVykgKi8KKworI2RlZmluZSBNQ09SMl9EU1JPRCAgICAgMHg4MCAgICAvKiBEZXRlY3QgMS0+MCB0cmFuc2l0aW9uIG9mIERTUiAgICAgICAgICAgKi8KKyNkZWZpbmUgTUNPUjJfQ0RPRCAgICAgIDB4NDAgICAgLyogRGV0ZWN0IDEtPjAgdHJhbnNpdGlvbiBvZiBDRCAgICAgICAgICAgICovCisjZGVmaW5lIE1DT1IyX0NUU09EICAgICAweDIwICAgIC8qIERldGVjdCAxLT4wIHRyYW5zaXRpb24gb2YgQ1RTICAgICAgICAgICAqLworCisKKy8qIE1vZGVtIENoYW5nZSBSZWdpc3RlciAoUi9XKSAqLworCisjZGVmaW5lIE1DUl9EU1JDSEcgICAgICAweDgwICAgIC8qIERTUiBDaGFuZ2VkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBNQ1JfQ0RDSEcgICAgICAgMHg0MCAgICAvKiBDRCBDaGFuZ2VkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgTUNSX0NUU0NIRyAgICAgIDB4MjAgICAgLyogQ1RTIENoYW5nZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKworLyogTW9kZW0gU2lnbmFsIFZhbHVlIFJlZ2lzdGVyIChSL1cpICovCisKKyNkZWZpbmUgTVNWUl9EU1IgICAgICAgIDB4ODAgICAgLyogQ3VycmVudCBzdGF0ZSBvZiBEU1IgaW5wdXQgICAgICAgICAgICAgICovCisjZGVmaW5lIE1TVlJfQ0QgICAgICAgICAweDQwICAgIC8qIEN1cnJlbnQgc3RhdGUgb2YgQ0QgaW5wdXQgICAgICAgICAgICAgICAqLworI2RlZmluZSBNU1ZSX0NUUyAgICAgICAgMHgyMCAgICAvKiBDdXJyZW50IHN0YXRlIG9mIENUUyBpbnB1dCAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgTVNWUl9EVFIgICAgICAgIDB4MDIgICAgLyogQ3VycmVudCBzdGF0ZSBvZiBEVFIgb3V0cHV0ICAgICAgICAgICAgICovCisjZGVmaW5lIE1TVlJfUlRTICAgICAgICAweDAxICAgIC8qIEN1cnJlbnQgc3RhdGUgb2YgUlRTIG91dHB1dCAgICAgICAgICAgICAqLworCisKKy8qIEVzY2FwZSBjaGFyYWN0ZXJzICovCisKKyNkZWZpbmUgQ0QxODBfQ19FU0MgICAgIDB4MDAgICAgLyogRXNjYXBlIGNoYXJhY3RlciAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIENEMTgwX0NfU0JSSyAgICAweDgxICAgIC8qIFN0YXJ0IHNlbmRpbmcgQlJFQUsgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBDRDE4MF9DX0RFTEFZICAgMHg4MiAgICAvKiBEZWxheSBvdXRwdXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgQ0QxODBfQ19FQlJLICAgIDB4ODMgICAgLyogU3RvcCBzZW5kaW5nIEJSRUFLICAgICAgICAg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XR1cm4gUmluZ0luZDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogIEhlcmUgYXJlIHRoZSByb3V0aW5lcyB1c2VkIGJ5IHJwX2lvY3RsLiAgVGhlc2UgYXJlIGFsbCBjYWxsZWQgZnJvbSBleGNlcHRpb24gaGFuZGxlcnMuICAqLworCisvKgorICogIFJldHVybnMgdGhlIHN0YXRlIG9mIHRoZSBzZXJpYWwgbW9kZW0gY29udHJvbCBsaW5lcy4gIFRoZXNlIG5leHQgMiBmdW5jdGlvbnMgCisgKiAgYXJlIHRoZSB3YXkga2VybmVsIHZlcnNpb25zID4gMi41IGhhbmRsZSBtb2RlbSBjb250cm9sIGxpbmVzIHJhdGhlciB0aGFuIElPQ1RMcy4KKyAqLworc3RhdGljIGludCBycF90aW9jbWdldChzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5LCBzdHJ1Y3QgZmlsZSAqZmlsZSkKK3sKKwlzdHJ1Y3Qgcl9wb3J0ICppbmZvID0gKHN0cnVjdCByX3BvcnQgKil0dHktPmRyaXZlcl9kYXRhOworCXVuc2lnbmVkIGludCBjb250cm9sLCByZXN1bHQsIENoYW5TdGF0dXM7CisKKwlDaGFuU3RhdHVzID0gc0dldENoYW5TdGF0dXNMbygmaW5mby0+Y2hhbm5lbCk7CisJY29udHJvbCA9IGluZm8tPmNoYW5uZWwuVHhDb250cm9sWzNdOworCXJlc3VsdCA9ICgoY29udHJvbCAmIFNFVF9SVFMpID8gVElPQ01fUlRTIDogMCkgfCAKKwkJKChjb250cm9sICYgU0VUX0RUUikgPyAgVElPQ01fRFRSIDogMCkgfAorCQkoKENoYW5TdGF0dXMgJiBDRF9BQ1QpID8gVElPQ01fQ0FSIDogMCkgfAorCQkoc0dldENoYW5SSSgmaW5mby0+Y2hhbm5lbCkgPyBUSU9DTV9STkcgOiAwKSB8CisJC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uOworCisJY3AgPSAmaW5mby0+Y2hhbm5lbDsKKworCW9yaWdfamlmZmllcyA9IGppZmZpZXM7CisjaWZkZWYgUk9DS0VUX0RFQlVHX1dBSVRfVU5USUxfU0VOVAorCXByaW50ayhLRVJOX0lORk8gIkluIFJQX3dhaXRfdW50aWxfc2VudCglZCkgKGppZmY9JWx1KS4uLiIsIHRpbWVvdXQsCisJICAgICAgIGppZmZpZXMpOworCXByaW50ayhLRVJOX0lORk8gImNwcz0lZC4uLiIsIGluZm8tPmNwcyk7CisjZW5kaWYKKwl3aGlsZSAoMSkgeworCQl0eGNudCA9IHNHZXRUeENudChjcCk7CisJCWlmICghdHhjbnQpIHsKKwkJCWlmIChzR2V0Q2hhblN0YXR1c0xvKGNwKSAmIFRYU0hSTVQpCisJCQkJYnJlYWs7CisJCQljaGVja190aW1lID0gKEhaIC8gaW5mby0+Y3BzKSAvIDU7CisJCX0gZWxzZSB7CisJCQljaGVja190aW1lID0gSFogKiB0eGNudCAvIGluZm8tPmNwczsKKwkJfQorCQlpZiAodGltZW91dCkgeworCQkJZXhpdF90aW1lID0gb3JpZ19qaWZmaWVzICsgdGltZW91dCAtIGppZmZpZXM7CisJCQlpZiAoZXhpdF90aW1lIDw9IDApCisJCQkJYnJlYWs7CisJCQlpZiAoZXhpdF90aW1lIDwgY2hlY2tfdGltZSkKKwkJCQljaGVja190aW1lID0gZXhpdF90aW1lOworCQl9CisJCWlmIChjaGVja190aW1lID09IDApCisJCQljaGVja190aW1lID0gMTsKKyNpZmRlZiBST0NLRVRfREVCVUdfV0FJVF9VTlRJTF9TRU5UCisJCXByaW50ayhLRVJOX0lORk8gInR4Y250ID0gJWQgKGppZmY9JWx1LGNoZWNrPSVkKS4uLiIsIHR4Y250LCBqaWZmaWVzLCBjaGVja190aW1lKTsKKyNlbmRpZgorCQltc2xlZXBfaW50ZXJydXB0aWJsZShqaWZmaWVzX3RvX21zZWNzKGNoZWNrX3RpbWUpKTsKKwkJaWYgKHNpZ25hbF9wZ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gICAgICAgICAgICAgICAgMDogRGlzYWJsZSBnbG9iYWwgaW50ZXJydXB0cworICAgICAgICAgICAgICAgICAgICAgICAgIDM6IElSUSAzCisgICAgICAgICAgICAgICAgICAgICAgICAgNDogSVJRIDQKKyAgICAgICAgICAgICAgICAgICAgICAgICA1OiBJUlEgNQorICAgICAgICAgICAgICAgICAgICAgICAgIDk6IElSUSA5CisgICAgICAgICAgICAgICAgICAgICAgICAgMTA6IElSUSAxMAorICAgICAgICAgICAgICAgICAgICAgICAgIDExOiBJUlEgMTEKKyAgICAgICAgICAgICAgICAgICAgICAgICAxMjogSVJRIDEyCisgICAgICAgICAgICAgICAgICAgICAgICAgMTU6IElSUSAxNQorICAgICAgICAgIEJ5dGVfdCBGcmVxdWVuY3k6IEEgZmxhZyBpZGVudGlmeWluZyB0aGUgZnJlcXVlbmN5CisgICAgICAgICAgICAgICAgICAgb2YgdGhlIHBlcmlvZGljIGludGVycnVwdCwgY2FuIGJlIGFueSBvbmUgb2YgdGhlIGZvbGxvd2luZzoKKyAgICAgICAgICAgICAgICAgICAgICBGUkVRX0RJUyAtIHBlcmlvZGljIGludGVycnVwdCBkaXNhYmxlZAorICAgICAgICAgICAgICAgICAgICAgIEZSRVFfMTM3SFogLSAxMzcgSGVydHoKKyAgICAgICAgICAgICAgICAgICAgICBGUkVRXzY5SFogLSA2OSBIZXJ0egorICAgICAgICAgICAgICAgICAgICAgIEZSRVFfMzRIWiAtIDM0IEhlcnR6CisgICAgICAgICAgICAgICAgICAgICAgRlJFUV8xN0haIC0gMTcgSGVydHoKKyAgICAgICAgICAgICAgICAgICAgICBGUkVRXzlIWiAtIDkgSGVydHoKKyAgICAgICAgICAgICAgICAgICAgICBGUkVRXzRIWiAtIDQgSGVydHoKKyAgICAgICAgICAgICAgICAgICBJZiBJUlFOdW0gaXMgc2V0IHRvIDAgdGhlIEZyZXF1ZW5jeSBwYXJhbWV0ZXIgaXMKKyAgICAgICAgICAgICAgICAgICBvdmVyaWRkZW4sIGl0IGlzIGZvcmNlZCB0byBhIHZhbHVlIG9mIEZSRVFfRElTLgorICAgICAgICAgIGludCBQZXJpb2RpY09ubHk6IFRSVUUgaWYgYWxsIGludGVycnVwdHMgZXhjZXB0IHRoZSBwZXJpb2RpYworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludGVycnVwdCBhcmUgdG8gYmUgYmxvY2tlZC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBGQUxTRSBpcyBib3RoIHRoZSBwZXJpb2RpYyBpbnRlcnJ1cHQgYW5kCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3RoZXIgY2hhbm5lbCBpbnRlcnJ1cHRzIGFyZSBhbGxvd2VkLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIElmIElSUU51bSBpcyBzZXQgdG8gMCB0aGUgUGVyaW9kaWNPbmx5IHBhcmFtZXRlciBpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJpZGRlbiwgaXQgaXMgZm9yY2VkIHRvIGEgdmFsdWUgb2YgRkFMU0UuCitSZXR1cm46ICAgaW50OiBOdW1iZXIgb2YgQUlPUHMgb24gdGhlIGNvbnRyb2xsZXIsIG9yIENUTElEX05VTEwgaWYgY29udHJvbGxlcgorICAgICAgICAgICAgICAgaW5pdGlhbGl6YXRpb24gZmFpbGVkLgorCitDb21tZW50czoKKyAgICAgICAgICBJZiBwZXJpb2RpYyBpbnRlcnJ1cHRzIGFyZSB0byBiZSBkaXNhYmxlZCBidXQgQUlPUCBpbnRlcnJ1cHRzCisgICAgICAgICAgYXJlIGFsbG93ZWQsIHNldCBGcmVxdWVuY3kgdG8gRlJFUV9ESVMgYW5kIFBlcmlvZGljT25seSB0byBGQUxTRS4KKworICAgICAgICAgIElmIGludGVycnVwdHMgYXJlIHRvIGJlIGNvbXBsZXRlbHkgZGlzYWJsZWQgc2V0IElSUU51bSB0byAwLgorCisgICAgICAgICAgU2V0dGluZyBGcmVxdWVuY3kgdG8gRlJFUV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yb2xsZXIgc3RydWN0dXJlCisgICAgICAgICAgaW50IEN0bE51bTsgQ29udHJvbGxlciBudW1iZXIKKyAgICAgICAgICBCeXRlSU9fdCAqQWlvcElPTGlzdDsgTGlzdCBvZiBJL08gYWRkcmVzc2VzIGZvciBlYWNoIEFJT1AuCisgICAgICAgICAgICAgVGhpcyBsaXN0IG11c3QgYmUgaW4gdGhlIG9yZGVyIHRoZSBBSU9QcyB3aWxsIGJlIGZvdW5kIG9uIHRoZQorICAgICAgICAgICAgIGNvbnRyb2xsZXIuICBPbmNlIGFuIEFJT1AgaW4gdGhlIGxpc3QgaXMgbm90IGZvdW5kLCBpdCBpcworICAgICAgICAgICAgIGFzc3VtZWQgdGhhdCB0aGVyZSBhcmUgbm8gbW9yZSBBSU9QcyBvbiB0aGUgY29udHJvbGxlci4KKyAgICAgICAgICBpbnQgQWlvcElPTGlzdFNpemU7IE51bWJlciBvZiBhZGRyZXNzZXMgaW4gQWlvcElPTGlzdAorICAgICAgICAgIGludCBJUlFOdW07IEludGVycnVwdCBSZXF1ZXN0IG51bWJlci4gIENhbiBiZSBhbnkgb2YgdGhlIGZvbGxvd2luZzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAwOiBEaXNhYmxlIGdsb2JhbCBpbnRlcnJ1cHRzCisgICAgICAgICAgICAgICAgICAgICAgICAgMzogSVJRIDMKKyAgICAgICAgICAgICAgICAgICAgICAgICA0OiBJUlEgNAorICAgICAgICAgICAgICAgICAgICAgICAgIDU6IElSUSA1CisgICAgICAgICAgICAgICAgICAgICAgICAgOTogSVJRIDkKKyAgICAgICAgICAgICAgICAgICAgICAgICAxMDogSVJRIDEwCisgICAgICAgICAgICAgICAgICAgICAgICAgMTE6IElSUSAxMQorICAgICAgICAgICAgICAgICAgICAgICAgIDEyOiBJUlEgMTIKKyAgICAgICAgICAgICAgICAgICAgICAgICAxNTogSVJRIDE1CisgICAgICAgICAgQnl0ZV90IEZyZXF1ZW5jeTogQSBmbGFnIGlkZW50aWZ5aW5nIHRoZSBmcmVxdWVuY3kKKyAgICAgICAgICAgICAgICAgICBvZiB0aGUgcGVyaW9kaWMgaW50ZXJydXB0LCBjYW4gYmUgYW55IG9uZSBvZiB0aGUgZm9sbG93aW5nOgorICAgICAgICAgICAgICAgICAgICAgIEZSRVFfRElTIC0gcGVyaW9kaWMgaW50ZXJydXB0IGRpc2FibGVkCisgICAgICAgICAgICAgICAgICAgICAgRlJFUV8xMzdIWiAtIDEzNyBIZXJ0egorICAgICAgICAgICAgICAgICAgICAgIEZSRVFfNjlIWiAtIDY5IEhlcnR6CisgICAgICAgICAgICAgICAgICAgICAgRlJFUV8zNEhaIC0gMzQgSGVydHoKKyAgICAgICAgICAgICAgICAgICAgICBGUkVRXzE3SFogLSAxNyBIZXJ0egorICAgICAgICAgICAgICAgICAgICAgIEZSRVFfOUhaIC0gOSBIZXJ0egorICAgICAgICAgICAgICAgICAgICAgIEZSRVFfNEhaIC0gNCBIZXJ0egorICAgICAgICAgICAgICAgICAgIElmIElSUU51bSBpcyBzZXQgdG8gMCB0aGUgRnJlcXVlbmN5IHBhcmFtZXRlciBpcworICAgICAgICAgICAgICAgICAgIG92ZXJpZGRlbiwgaXQgaXMgZm9yY2VkIHRvIGEgdmFsdWUgb2YgRlJFUV9ESVMuCisgICAgICAgICAgaW50IFBlcmlvZGljT25seTogVFJVRSBpZiBhbGwgaW50ZXJydXB0cyBleGNlcHQgdGhlIHBlcmlvZGljCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ZXJydXB0IGFyZSB0byBiZSBibG9ja2VkLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZBTFNFIGlzIGJvdGggdGhlIHBlcmlvZGljIGludGVycnVwdCBhbmQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdGhlciBjaGFubmVsIGludGVycnVwdHMgYXJlIGFsbG93ZWQuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWYgSVJRTnVtIGlzIHNldCB0byAwIHRo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IFNSQU0gYWRkcmVzcyBzcGFjZXMgZm9yIGNoYW5uZWxzIDAgYW5kIDQuCisgICAgICAgICAgSWYgdGhlIGNoYW5uZWwgNCBzcGFjZSBpcyBtaXJyb3JlZCB0byBjaGFubmVsIDAgaXQgaXMgYSA0IGNoYW5uZWwKKyAgICAgICAgICBBSU9QLCBvdGhlcndpc2UgaXQgaXMgYW4gOCBjaGFubmVsLgorV2FybmluZ3M6IE5vIGNvbnRleHQgc3dpdGNoZXMgYXJlIGFsbG93ZWQgd2hpbGUgZXhlY3V0aW5nIHRoaXMgZnVuY3Rpb24uCisqLworaW50IHNSZWFkQWlvcE51bUNoYW4oV29yZElPX3QgaW8pCit7CisJV29yZF90IHg7CisJc3RhdGljIEJ5dGVfdCBSWzRdID0geyAweDAwLCAweDAwLCAweDM0LCAweDEyIH07CisKKwkvKiB3cml0ZSB0byBjaGFuIDAgU1JBTSAqLworCXNPdXREVygoRFdvcmRJT190KSBpbyArIF9JTkRYX0FERFIsICooKERXb3JkX3QgKikgJiBSWzBdKSk7CisJc091dFcoaW8gKyBfSU5EWF9BRERSLCAwKTsJLyogcmVhZCBmcm9tIFNSQU0sIGNoYW4gMCAqLworCXggPSBzSW5XKGlvICsgX0lORFhfREFUQSk7CisJc091dFcoaW8gKyBfSU5EWF9BRERSLCAweDQwMDApOwkvKiByZWFkIGZyb20gU1JBTSwgY2hhbiA0ICovCisJaWYgKHggIT0gc0luVyhpbyArIF9JTkRYX0RBVEEpKQkvKiBpZiBkaWZmZXJlbnQgbXVzdCBiZSA4IGNoYW4gKi8KKwkJcmV0dXJuICg4KTsKKwllbHNlCisJCXJldHVybiAoNCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzSW5pdENoYW4KK1B1cnBvc2U6ICBJbml0aWFsaXphdGlvbiBvZiBhIGNoYW5uZWwgYW5kIGNoYW5u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FdvcmRfdCAqKSAoJkRXQnVmWzBdKSkpOwkvKiB3cml0ZSBpdCBvdXQgKi8KKwl9IGVsc2UgewkJLyogd3JpdGUgaXQgdG8gVHggRklGTyAqLworCisJCXNXcml0ZVR4Qnl0ZShzR2V0VHhSeERhdGFJTyhDaFApLCBEYXRhKTsKKwl9CisJcmV0dXJuICgxKTsJCS8qIDEgYnl0ZSBzZW50ICovCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzRW5JbnRlcnJ1cHRzCitQdXJwb3NlOiAgRW5hYmxlIG9uZSBvciBtb3JlIGludGVycnVwdHMgZm9yIGEgY2hhbm5lbAorQ2FsbDogICAgIHNFbkludGVycnVwdHMoQ2hQLEZsYWdzKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyAgICAgICAgICBXb3JkX3QgRmxhZ3M6IEludGVycnVwdCBlbmFibGUgZmxhZ3MsIGNhbiBiZSBhbnkgY29tYmluYXRpb24KKyAgICAgICAgICAgICBvZiB0aGUgZm9sbG93aW5nIGZsYWdzOgorICAgICAgICAgICAgICAgIFRYSU5UX0VOOiAgIEludGVycnVwdCBvbiBUeCBGSUZPIGVtcHR5CisgICAgICAgICAgICAgICAgUlhJTlRfRU46ICAgSW50ZXJydXB0IG9uIFJ4IEZJRk8gYXQgdHJpZ2dlciBsZXZlbCAoc2VlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc1NldFJ4VHJpZ2dlcigpKQorICAgICAgICAgICAgICAgIFNSQ0lOVF9FTjogIEludGVycnVwdCBvbiBTUkMgKFNwZWNpYWwgUnggQ29uZGl0aW9uKQorICAgICAgICAgICAgICAgIE1DSU5UX0VOOiAgIEludGVycnVwdCBvbiBtb2RlbSBpbnB1dCBjaGFuZ2UKKyAgICAgICAgICAgICAgICBDSE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ZTogIERpc2FibGUgb25lIG9yIG1vcmUgaW50ZXJydXB0cyBmb3IgYSBjaGFubmVsCitDYWxsOiAgICAgc0Rpc0ludGVycnVwdHMoQ2hQLEZsYWdzKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyAgICAgICAgICBXb3JkX3QgRmxhZ3M6IEludGVycnVwdCBmbGFncywgY2FuIGJlIGFueSBjb21iaW5hdGlvbgorICAgICAgICAgICAgIG9mIHRoZSBmb2xsb3dpbmcgZmxhZ3M6CisgICAgICAgICAgICAgICAgVFhJTlRfRU46ICAgSW50ZXJydXB0IG9uIFR4IEZJRk8gZW1wdHkKKyAgICAgICAgICAgICAgICBSWElOVF9FTjogICBJbnRlcnJ1cHQgb24gUnggRklGTyBhdCB0cmlnZ2VyIGxldmVsIChzZWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzU2V0UnhUcmlnZ2VyKCkpCisgICAgICAgICAgICAgICAgU1JDSU5UX0VOOiAgSW50ZXJydXB0IG9uIFNSQyAoU3BlY2lhbCBSeCBDb25kaXRpb24pCisgICAgICAgICAgICAgICAgTUNJTlRfRU46ICAgSW50ZXJydXB0IG9uIG1vZGVtIGlucHV0IGNoYW5nZQorICAgICAgICAgICAgICAgIENIQU5JTlRfRU46IERpc2FibGUgY2hhbm5lbCBpbnRlcnJ1cHQgc2lnbmFsIHRvIHRoZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFJT1AncyBJbnRlcnJ1cHQgQ2hhbm5lbCBSZWdpc3Rlci4KK1JldHVybjogICB2b2lkCitDb21tZW50czogSWYgYW4gaW50ZXJydXB0IGZsYWcgaXMgc2V0IGluIEZsYWdzLCB0aGF0IGludGVycnVwdCB3aWxsIGJlCisgICAgICAgICAgZGlzYWJsZWQuICBJZiBhbiBpbnRlcnJ1cHQgZmxhZyBpcyBub3Qgc2V0IGluIEZsYWdzLCB0aGF0CisgICAgICAgICAgaW50Z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QIDQgcG9ydCB3L1JKNDUgY29ubmVjdG9ycyAqLworI2RlZmluZSBNT0RFTF9SUDhTTkkgICAgICAgICAgMHgwMDA4CS8qIFJQIDggcG9ydCB3LyBEQjc4IFNOSSBjb25uZWN0b3IgKi8KKyNkZWZpbmUgTU9ERUxfUlAxNlNOSSAgICAgICAgIDB4MDAwOQkvKiBSUCAxNiBwb3J0IHcvIERCNzggU05JIGNvbm5lY3RvciAqLworI2RlZmluZSBNT0RFTF9SUFA0ICAgICAgICAgICAgMHgwMDBBCS8qIFJQIFBsdXMgNCBwb3J0ICAgICAgICAgICAgICAqLworI2RlZmluZSBNT0RFTF9SUFA4ICAgICAgICAgICAgMHgwMDBCCS8qIFJQIFBsdXMgOCBwb3J0ICAgICAgICAgICAgICAqLworI2RlZmluZSBNT0RFTF9SUDJfMjMyICAgICAgICAgMHgwMDBFCS8qIFJQIFBsdXMgMiBwb3J0IFJTMjMyICAgICAgICAqLworI2RlZmluZSBNT0RFTF9SUDJfNDIyICAgICAgICAgMHgwMDBGCS8qIFJQIFBsdXMgMiBwb3J0IFJTMjMyICAgICAgICAqLworCisvKiAgUm9ja2V0bW9kZW0gSUkgTW9kZWxzICovCisjZGVmaW5lIE1PREVMX1JQNk0gICAgICAgICAgICAweDAwMEMJLyogUk0gNiBwb3J0ICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIE1PREVMX1JQNE0gICAgICAgICAgICAweDAwMEQJLyogUk0gNCBwb3J0ICAgICAgICAgICAgICAgICAgICovCisKKy8qIFVuaXZlcnNhbCBQQ0kgYm9hcmRzICovCisjZGVmaW5lIE1PREVMX1VQQ0lfUlAzMklOVEYgICAweDA4MDEJLyogUlAgVVBDSSAzMiBwb3J0IHcvZXh0ZXJuYWwgSS9GICAgICAqLworI2RlZmluZSBNT0RFTF9VUENJX1JQOElOVEYgICAgMHgwODAyCS8qIFJQIFVQQ0kgOCBwb3J0IHcvZXh0ZXJuYWwgSS9GICAgICAgKi8KKyNkZWZpbmUgTU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tZW50aW5nIGNoYW5uZWwgKi8KKyNkZWZpbmUgQUlPUElEX05VTEwgLTEJCS8qIG5vIEFJT1Agb3IgY2hhbm5lbCBleGlzdHMgKi8KKyNkZWZpbmUgQUlPUElEXzAwMDEgMHgwMDAxCS8qIEFJT1AgcmVsZWFzZSAxICovCisKKyNkZWZpbmUgTlVMTERFViAtMQkJLyogaWRlbnRpZmllcyBub24tZXhpc3RhbnQgZGV2aWNlICovCisjZGVmaW5lIE5VTExDVEwgLTEJCS8qIGlkZW50aWZpZXMgbm9uLWV4aXN0YW50IGNvbnRyb2xsZXIgKi8KKyNkZWZpbmUgTlVMTENUTFBUUiAoQ09OVFJPTExFUl9UICopMAkvKiBpZGVudGlmaWVzIG5vbi1leGlzdGFudCBjb250cm9sbGVyICovCisjZGVmaW5lIE5VTExBSU9QIC0xCQkvKiBpZGVudGlmaWVzIG5vbi1leGlzdGFudCBBSU9QICovCisjZGVmaW5lIE5VTExDSEFOIC0xCQkvKiBpZGVudGlmaWVzIG5vbi1leGlzdGFudCBjaGFubmVsICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyBHbG9iYWwgUmVnaXN0ZXIgT2Zmc2V0cyAtIERpcmVjdCBBY2Nlc3MgLSBGaXhlZCB2YWx1ZXMKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2RlZmluZSBfQ01EX1JFRyAgIDB4MzgJCS8qIENvbW1hbmQgUmVnaXN0ZXIgICAgICAgICAgICA4ICAgIFdyaXRlICovCisjZGVmaW5lIF9JTlRfQ0hBTiAgMHgzOQkJLyogSW50ZXJydXB0IENoYW5uZWwgUmVnaXN0ZXIgIDggICAgUmVhZCAqLworI2RlZmluZSBfSU5UX01BU0sgIDB4M0EJCS8qIEludGVycnVwdCBNYXNrIFJlZ2lzdGVyICAgICA4ICAgIFJlYWQgLyBXcml0ZSAqLworI2RlZmluZSBfVU5VU0VEICAgIDB4M0IJCS8qIFVudXNlZCAgICAgICAgICAgICAgICAgICAgICA4ICovCisjZGVmaW5lIF9JTkRYX0FERFIgMHgzQwkJLyogSW5kZXggUmVnaXN0ZXIgQWRkcmVzcyAgICAgIDE2ICAgV3JpdGUgKi8KKyNkZWZpbmUgX0lORFhfREFUQSAweDNFCQkvKiBJbmRleCBSZWdpc3RlciBEYXRhICAgICAgICAgOC8xNiBSZWFkIC8gV3JpdGUgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorIENoYW5uZWwgUmVnaXN0ZXIgT2Zmc2V0cyBmb3IgMXN0IGNoYW5uZWwgaW4gQUlPUCAtIERpcmVjdCBBY2Nlc3MKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgX1REMCAgICAgICAweDAwCQkvKiBUcmFuc21pdCBEYXRhICAgICAgICAgICAgICAgMTYgICBXcml0ZSAqLworI2RlZmluZSBfUkQwICAgICAgIDB4MDAJCS8qIFJlY2VpdmUgRGF0YSAgICAgICAgICAgICAgICAxNiAgIFJlYWQgKi8KKyNkZWZpbmUgX0NITl9TVEFUMCAweDIwCQkvKiBDaGFubmVsIFN0YXR1cyAgICAgICAgICAgICAgOC8xNiBSZWFkIC8gV3JpdGUgKi8KKyNkZWZpbmUgX0ZJRk9fQ05UMCAweDEwCQkvKiBUcmFuc21pdC9SZWNlaXZlIEZJRk8gQ291bnQgMTYgICBSZWFkICovCisjZGVmaW5lIF9JTlRfSUQwICAgMHgzMAkJLyogSW50ZXJydXB0IElkZW50aWZpY2F0aW9uICAgIDggICAgUmVhZCAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgVHggQ29udHJvbCBSZWdpc3RlciBPZmZzZXRzIC0gSW5kZXhlZCAtIEV4dGVybmFsIC0gRml4ZWQKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgX1RYX0VOQkxTICAweDk4MAkvKiBUeCBQcm9jZXNzb3IgRW5hYmxlcyBSZWdpc3RlciA4IFJlYWQgLyBXcml0ZSAqLworI2RlZmluZSBfVFhDTVAxICAgIDB4OTg4CS8qIFRyYW5zbWl0IENvbXBhcmUgVmFsdWUgIzEgICAgIDggUmVhZCAvIFdyaXRlICovCisjZGVmaW5lIF9UWENNUDIgICAgMHg5ODkJLyogVHJhbnNtaXQgQ29tcGFyZSBWYWx1ZSAjMiAgICAgOCBSZWFkIC8gV3JpdGUgKi8KKyNkZWZpbmUgX1RYUkVQMUIxICAweDk4QQkvKiBUeCBSZXBsYWNlIFZhbHVlICMxIC0gQnl0ZSAxICA4IFJlYWQgLyBXcml0ZSAqLworI2RlZmluZSBfVFhSRVAxQjIgIDB4OThCCS8qIFR4IFJlcGxhY2UgVmFsdWUgIzEgLSBCeXRlIDIgIDggUmVhZCAvIFdyaXRlICovCisjZGVmaW5lIF9UWFJFUDIgICAgMHg5OEMJLyogVHJhbnNtaXQgUmVwbGFjZSBWYWx1ZSAjMiAgICAgOCBSZWFkIC8gV3JpdGUgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorTWVtb3J5IENvbnRyb2xsZXIgUmVnaXN0ZXIgT2Zmc2V0cyAtIEluZGV4ZWQgLSBFeHRlcm5hbCAtIEZpeGVkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIF9SWF9GSUZPICAgIDB4MDAwCS8qIFJ4IEZJRk8gKi8KKyNkZWZpbmUgX1RYX0ZJRk8gICAgMHg4MDAJLyogVHggRklGTyAqLworI2RlZmluZSBfUlhGX09VVFAgICAweDk5MAkvKiBSeCBGSUZPIE9VVCBwb2ludGVyICAgICAgICAxNiBSZWFkIC8gV3JpdGUgKi8KKyNkZWZpbmUgX1JYRl9JTlAgICAgMHg5OTIJLyogUnggRklGTyBJTiBwb2ludGVyICAgICAgICAgMTYgUmVhZCAvIFdyaXRlICovCisjZGVmaW5lIF9UWEZfT1VUUCAgIDB4OTk0CS8qIFR4IEZJRk8gT1VUIHBvaW50ZXIgICAgICAgIDggIFJlYWQgLyBXcml0ZSAqLworI2RlZmluZSBfVFhGX0lOUCAgICAweDk5NQkvKiBUeCBGSUZPIElOIHBvaW50ZXIgICAgICAgICA4ICBSZWFkIC8gV3JpdGUgKi8KKyNkZWZpbmUgX1RYUF9DTlQgICAgMHg5OTYJLyogVHggUHJpb3JpdHkgQ291bnQgICAgICAgICAgOCAgUmVhZCAvIFdyaXRlICovCisjZGVmaW5lIF9UWFBfUE5UUiAgIDB4OTk3CS8qIFR4IFByaW9yaXR5IFBvaW50ZXIgICAgICAgIDggIFJlYWQgLyBXcml0ZSAqLworCisjZGVmaW5lIFBSSV9QRU5EICAgIDB4ODAJLyogUHJpb3JpdHkgZGF0YSBwZW5kaW5nIChiaXQ3LCBUeCBwcmkgY250KSAqLworI2RlZmluZSBUWEZJRk9fU0laRSAyNTUJCS8qIHNpemUgb2YgVHggRklGTyAqLworI2RlZmluZSBSWEZJRk9fU0laRSAxMDIzCS8qIHNpemUgb2YgUnggRklGTyAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitUeCBQcmlvcml0eSBCdWZmZXIgLSBJbmRleGVkIC0gRXh0ZXJuYWwgLSBGaXhlZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBfVFhQX0JVRiAgICAweDlDMAkvKiBUeCBQcmlvcml0eSBCdWZmZXIgIDMyICBCeXRlcyAgIFJlYWQgLyBXcml0ZSAqLworI2RlZmluZSBUWFBfU0laRSAgICAweDIwCS8qIDMyIGJ5dGVzICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0NoYW5uZWwgUmVnaXN0ZXIgT2Zmc2V0cyAtIEluZGV4ZWQgLSBJbnRlcm5hbCAtIEZpeGVkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNkZWZpbmUgX1RYX0NUUkwgICAgMHhGRjAJLyogVHJhbnNtaXQgQ29udHJvbCAgICAgICAgICAgICAgIDE2ICBXcml0ZSAqLworI2RlZmluZSBfUlhfQ1RSTCAgICAweEZGMgkvKiBSZWNlaXZlIENvbnRyb2wgICAgICAgICAgICAgICAgIDggIFdyaXRlICovCisjZGVmaW5lIF9CQVVEICAgICAgIDB4RkY0CS8qIEJhdWQgUmF0ZSAgICAgICAgICAgICAgICAgICAgICAxNiAgV3JpdGUgKi8KKyNkZWZpbmUgX0NMS19QUkUgICAgMHhGRjYJLyogQ2xvY2sgUHJlc2NhbGVyICAgICAgICAgICAgICAgICA4ICBXcml0ZSAqLworCisjZGVmaW5lIFNUTUJSRUFLICAgMHgwOAkJLyogQlJFQUsgKi8KKyNkZWZpbmUgU1RNRlJBTUUgICAweDA0CQkvKiBmcmFtaW5nIGVycm9yICovCisjZGVmaW5lIFNUTVJDVlJPVlIgMHgwMgkJLyogcmVjZWl2ZXIgb3ZlciBydW4gZXJyb3IgKi8KKyNkZWZpbmUgU1RNUEFSSVRZICAweDAxCQkvKiBwYXJpdHkgZXJyb3IgKi8KKyNkZWZpbmUgU1RNRVJST1IgIC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ICovCisKKyNkZWZpbmUgSU5UU1RBVDAgIDB4MDEJCS8qIEFJT1AgMCBpbnRlcnJ1cHQgc3RhdHVzICovCisjZGVmaW5lIElOVFNUQVQxICAweDAyCQkvKiBBSU9QIDEgaW50ZXJydXB0IHN0YXR1cyAqLworI2RlZmluZSBJTlRTVEFUMiAgMHgwNAkJLyogQUlPUCAyIGludGVycnVwdCBzdGF0dXMgKi8KKyNkZWZpbmUgSU5UU1RBVDMgIDB4MDgJCS8qIEFJT1AgMyBpbnRlcnJ1cHQgc3RhdHVzICovCisKKyNkZWZpbmUgSU5UUl9FTiAgIDB4MDgJCS8qIGFsbG93IGludGVycnVwdHMgdG8gaG9zdCAqLworI2RlZmluZSBJTlRfU1RST0IgMHgwNAkJLyogc3Ryb2JlIGFuZCBjbGVhciBpbnRlcnJ1cHQgbGluZSAoRU9JKSAqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyBNVURCQUMgcmVtYXBwZWQgZm9yIFBDSQorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNkZWZpbmUgX0NGR19JTlRfUENJICAweDQwCisjZGVmaW5lIF9QQ0lfSU5UX0ZVTkMgMHgzQQorCisjZGVmaW5lIFBDSV9TVFJPQiAweDIwMDAJLyogYml0IDEzIG9mIGludCBhaW9wIHJlZ2lzdGVyICovCisjZGVmaW5lIElOVFJfRU5fUENJICAgMHgwMDEwCS8qIGFsbG93IGludGVycnVwdHMgdG8gaG9zdCAqLworCisvKgorICogRGVmaW5pdGlvbnMgZm9yIFVuaXZlcnNhbCBQQ0kgYm9hcmQgcmVnaXN0ZXJzCisgKi8KKyNkZWZpbmUgX1BDSV85MDMwX0lOVF9DVFJMCTB4NGMgICAgICAgICAgLyogT2Zmc2V0cyBmcm9tIEJBUjEgKi8KKyNkZWZpbmU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s0XTsKKwlCeXRlX3QgVHhSZXBsYWNlMVs0XTsKKwlCeXRlX3QgVHhSZXBsYWNlMls0XTsKK30gQ0hBTk5FTF9UOworCit0eXBlZGVmIENIQU5ORUxfVCBDSEFOTkVMX3Q7Cit0eXBlZGVmIENIQU5ORUxfVCAqQ0hBTlBUUl9UOworCisjZGVmaW5lIEludGVyZmFjZU1vZGVSUzIzMiAgMHgwMAorI2RlZmluZSBJbnRlcmZhY2VNb2RlUlM0MjIgIDB4MDgKKyNkZWZpbmUgSW50ZXJmYWNlTW9kZVJTNDg1ICAweDEwCisjZGVmaW5lIEludGVyZmFjZU1vZGVSUzIzMlQgMHgxOAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0NsckJyZWFrCitQdXJwb3NlOiAgU3RvcCBzZW5kaW5nIGEgdHJhbnNtaXQgQlJFQUsgc2lnbmFsCitDYWxsOiAgICAgc0NsckJyZWFrKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCisqLworI2RlZmluZSBzQ2xyQnJlYWsoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5UeENvbnRyb2xbM10gJj0gflNFVEJSRUFLOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlR4Q29udHJvbFswXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzQ2xyRFRSCitQdXJwb3NlOiAgQ2xyIHRoZSBEVFIgb3V0cHV0CitDYWxsOiAgICAgc0NsckRUUihDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorKi8KKyNkZWZpbmUgc0NsckRUUihDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFszXSAmPSB+U0VUX0RUUjsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0NsclJUUworUHVycG9zZTogIENsciB0aGUgUlRTIG91dHB1dAorQ2FsbDogICAgIHNDbHJSVFMoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNDbHJSVFMoQ2hQKSBcCitkbyB7IFwKKyAgIGlmICgoQ2hQKS0+cnRzVG9nZ2xlKSBicmVhazsgXAorICAgKENoUCktPlR4Q29udHJvbFszXSAmPSB+U0VUX1JUUzsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0NsclR4WE9GRgorUHVycG9zZTogIENsZWFyIGFueSBleGlzdGluZyB0cmFuc21pdCBzb2Z0d2FyZSBmbG93IGNvbnRyb2wgb2ZmIGNvbmRpdGlvbgorQ2FsbDogICAgIHNDbHJUeFhPRkYoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNDbHJUeFhPRkYoQ2hQKSBcCitkbyB7IFwKKyAgIHNPdXRCKChDaFApLT5DbWQsVFhPVkVSSURFIHwgKEJ5dGVfdCkoQ2hQKS0+Q2hhbk51bSk7IFwKKyAgIHNPdXRCKChDaFApLT5DbWQsKEJ5dGVfdCkoQ2hQKS0+Q2hhbk51bSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzQ3RsTnVtVG9DdGxQdHIKK1B1cnBvc2U6ICBDb252ZXJ0IGEgY29udHJvbGxlciBudW1iZXIgdG8gY29udHJvbGxlciBzdHJ1Y3R1cmUgcG9pbnRlcgorQ2FsbDogICAgIHNDdGxOdW1Ub0N0bFB0cihDdGxOdW0pCisgICAgICAgICAgaW50IEN0bE51bTsgQ29udHJvbGxlciBudW1iZXIKK1JldHVybjogICBDT05UUk9MTEVSX1QgKjogUHRyIHRvIGNvbnRyb2xsZXIgc3RydWN0dXJlCisqLworI2RlZmluZSBzQ3RsTnVtVG9DdGxQdHIoQ1RMTlVNKSAmc0NvbnRyb2xsZXJbQ1RMTlVNXQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0NvbnRyb2xsZXJFT0kKK1B1cnBvc2U6ICBTdHJvYmUgdGhlIE1VREJBQydzIEVuZCBPZiBJbnRlcnJ1cHQgYml0LgorQ2FsbDogICAgIHNDb250cm9sbGVyRU9JKEN0bFApCisgICAgICAgICAgQ09OVFJPTExFUl9UICpDdGxQOyBQdHIgdG8gY29udHJvbGxlciBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNDb250cm9sbGVyRU9JKENUTFApIHNPdXRCKChDVExQKS0+TVJlZzJJTywoQ1RMUCktPk1SZWcyIHwgSU5UX1NUUk9CKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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9QIG9uIGNvbnRyb2xsZXIKKyovCisjZGVmaW5lIHNEaXNBaW9wKENUTFAsQUlPUE5VTSkgXAorZG8geyBcCisgICAoQ1RMUCktPk1SZWczICY9IHNCaXRNYXBDbHJUYmxbQUlPUE5VTV07IFwKKyAgIHNPdXRCKChDVExQKS0+TVJlZzNJTywoQ1RMUCktPk1SZWczKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNEaXNDVFNGbG93Q3RsCitQdXJwb3NlOiAgRGlzYWJsZSBvdXRwdXQgZmxvdyBjb250cm9sIHVzaW5nIENUUworQ2FsbDogICAgIHNEaXNDVFNGbG93Q3RsKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCisqLworI2RlZmluZSBzRGlzQ1RTRmxvd0N0bChDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSAmPSB+Q1RTRkNfRU47IFwKKyAgIHNPdXREVygoQ2hQKS0+SW5kZXhBZGRyLCooRFdvcmRfdCAqKSYoQ2hQKS0+VHhDb250cm9sWzBdKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNEaXNJWEFOWQorUHVycG9zZTogIERpc2FibGUgSVhBTlkgU29mdHdhcmUgRmxvdyBDb250cm9sCitDYWxsOiAgICAgc0Rpc0lYQU5ZKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCisqLworI2RlZmluZSBzRGlzSVhBTlkoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5SWzB4MGVdID0gMHg4NjsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5SWzB4MGNdKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IERpc1Bhcml0eQorUHVycG9zZTogIERpc2FibGUgcGFyaXR5CitDYWxsOiAgICAgc0Rpc1Bhcml0eShDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorQ29tbWVudHM6IEZ1bmN0aW9uIHNTZXRQYXJpdHkoKSBjYW4gYmUgdXNlZCBpbiBwbGFjZSBvZiBmdW5jdGlvbnMgc0VuUGFyaXR5KCksCisgICAgICAgICAgc0Rpc1Bhcml0eSgpLCBzU2V0T2RkUGFyaXR5KCksIGFuZCBzU2V0RXZlblBhcml0eSgpLgorKi8KKyNkZWZpbmUgc0Rpc1Bhcml0eShDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSAmPSB+UEFSSVRZX0VOOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlR4Q29udHJvbFswXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzRGlzUlRTVG9nZ2xlCitQdXJwb3NlOiAgRGlzYWJsZSBSVFMgdG9nZ2xlCitDYWxsOiAgICAgc0Rpc1JUU1RvZ2dsZShDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorKi8KKyNkZWZpbmUgc0Rpc1JUU1RvZ2dsZShDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSAmPSB+UlRTVE9HX0VOOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlR4Q29udHJvbFswXSk7IFwKKyAgIChDaFApLT5ydHNUb2dnbGUgPSAwOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0Rpc1J4RklGTworUHVycG9zZTogIERpc2FibGUgUnggRklGTworQ2FsbDogICAgIHNEaXNSeEZJRk8oQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNEaXNSeEZJRk8oQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5SWzB4MzJdID0gMHgwYTsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5SWzB4MzBdKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNEaXNSeFN0YXR1c01vZGUKK1B1cnBvc2U6ICBEaXNhYmxlIHRoZSBSeCBzdGF0dXMgbW9kZQorQ2FsbDogICAgIHNEaXNSeFN0YXR1c01vZGUoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKK0NvbW1lbnRzOiBUaGlzIHRha2VzIHRoZSBjaGFubmVsIG91dCBvZiB0aGUgcmVjZWl2ZSBzdGF0dXMgbW9kZS4gIEFsbAorICAgICAgICAgIHN1YnNlcXVlbnQgcmVhZHMgb2YgcmVjZWl2ZSBkYXRhIHVzaW5nIHNSZWFkUnhXb3JkKCkgd2lsbCByZXR1cm4KKyAgICAgICAgICB0d28gZGF0YSBieXRlcy4KKyovCisjZGVmaW5lIHNEaXNSeFN0YXR1c01vZGUoQ2hQKSBzT3V0VygoQ2hQKS0+Q2hhblN0YXQsMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNEaXNUcmFuc21pdAorUHVycG9zZTogIERpc2FibGUgdHJhbnNtaXQKK0NhbGw6ICAgICBzRGlzVHJhbnNtaXQoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyAgICAgICAgICBUaGlzIGRpc2FibGVzIG1vdmVtZW50IG9mIFR4IGRhdGEgZnJvbSB0aGUgVHggRklGTyBpbnRvIHRoZSAxIGJ5dGUKKyAgICAgICAgICBUeCBidWZmZXIuICBUaGVyZWZvcmUgdGhlcmUgY291bGQgYmUgdXAgdG8gYSAyIGJ5dGUgbGF0ZW5jeQorICAgICAgICAgIGJldHdlZW4gdGhlIHRpbWUgc0Rpc1RyYW5zbWl0KCkgaXMgY2FsbGVkIGFuZCB0aGUgdHJhbnNtaXQgYnVmZmVyCisgICAgICAgICAgYW5kIHRyYW5zbWl0IHNoaWZ0IHJlZ2lzdGVyIGdvaW5nIGNvbXBsZXRlbHkgZW1wdHkuCisqLworI2RlZmluZSBzRGlzVHJhbnNtaXQoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5UeENvbnRyb2xbM10gJj0gflRYX0VOQUJMRTsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0Rpc1R4U29mdEZsb3dDdGwKK1B1cnBvc2U6ICBEaXNhYmxlIFR4IFNvZnR3YXJlIEZsb3cgQ29udHJvbAorQ2FsbDogICAgIHNEaXNUeFNvZnRGbG93Q3RsKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCisqLworI2RlZmluZSBzRGlzVHhTb2Z0Rmxvd0N0bChDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlJbMHgwNl0gPSAweDhhOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlJbMHgwNF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0VuQWlvcAorUHVycG9zZTogIEVuYWJsZSBJL08gYWNjZXNzIHRvIGFuIEFJT1AKK0NhbGw6ICAgICBzRW5BaW9wKENsdFApCisgICAgICAgICAgQ09OVFJPTExFUl9UICpDdGxQOyBQdHIgdG8gY29udHJvbGxlciBzdHJ1Y3R1cmUKKyAgICAgICAgICBpbnQgQWlvcE51bTsgTnVtYmVyIG9mIEFJT1Agb24gY29udHJvbGxlcgorKi8KKyNkZWZpbmUgc0VuQWlvcChDVExQLEFJT1BOVU0pIFwKK2RvIHsgXAorICAgKENUTFApLT5NUmVnMyB8PSBzQml0TWFwU2V0VGJsW0FJT1BOVU1dOyBcCisgICBzT3V0QigoQ1RMUCktPk1SZWczSU8sKENUTFApLT5NUmVnMyk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzRW5DVFNGbG93Q3RsCitQdXJwb3NlOiAgRW5hYmxlIG91dHB1dCBmbG93IGNvbnRyb2wgdXNpbmcgQ1RTCitDYWxsOiAgICAgc0VuQ1RTRmxvd0N0bChDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorKi8KKyNkZWZpbmUgc0VuQ1RTRmxvd0N0bChDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSB8PSBDVFNGQ19FTjsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0VuSVhBTlkKK1B1cnBvc2U6ICBFbmFibGUgSVhBTlkgU29mdHdhcmUgRmxvdyBDb250cm9sCitDYWxsOiAgICAgc0VuSVhBTlkoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNFbklYQU5ZKENoUCkgXAorZG8geyBcCisgICAoQ2hQKS0+UlsweDBlXSA9IDB4MjE7IFwKKyAgIHNPdXREVygoQ2hQKS0+SW5kZXhBZGRyLCooRFdvcmRfdCAqKSYoQ2hQKS0+UlsweDBjXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBFblBhcml0eQorUHVycG9zZTogIEVuYWJsZSBwYXJpdHkKK0NhbGw6ICAgICBzRW5QYXJpdHkoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKK0NvbW1lbnRzOiBGdW5jdGlvbiBzU2V0UGFyaXR5KCkgY2FuIGJlIHVzZWQga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V29yZF90ICopJihDaFApLT5SeENvbnRyb2xbMF0pOyBcCisgICAoQ2hQKS0+VHhDb250cm9sWzJdIHw9IFJUU1RPR19FTjsgXAorICAgKENoUCktPlR4Q29udHJvbFszXSAmPSB+U0VUX1JUUzsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCisgICAoQ2hQKS0+cnRzVG9nZ2xlID0gMTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNFblJ4RklGTworUHVycG9zZTogIEVuYWJsZSBSeCBGSUZPCitDYWxsOiAgICAgc0VuUnhGSUZPKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCisqLworI2RlZmluZSBzRW5SeEZJRk8oQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5SWzB4MzJdID0gMHgwODsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5SWzB4MzBdKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNFblJ4UHJvY2Vzc29yCitQdXJwb3NlOiAgRW5hYmxlIHRoZSByZWNlaXZlIHByb2Nlc3NvcgorQ2FsbDogICAgIHNFblJ4UHJvY2Vzc29yKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCitDb21tZW50czogVGhpcyBmdW5jdGlvbiBpcyB1c2VkIHRvIHN0YXJ0IHRoZSByZWNlaXZlIHByb2Nlc3Nvci4gIFdoZW4KKyAgICAgICAg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UaGlzIHBsYWNlcyB0aGUgY2hhbm5lbCBpbiB0aGUgcmVjZWl2ZSBzdGF0dXMgbW9kZS4gIEFsbCBzdWJzZXF1ZW50CisgICAgICAgICAgcmVhZHMgb2YgcmVjZWl2ZSBkYXRhIHVzaW5nIHNSZWFkUnhXb3JkKCkgd2lsbCByZXR1cm4gYSBkYXRhIGJ5dGUKKyAgICAgICAgICBpbiB0aGUgbG93IHdvcmQgYW5kIGEgc3RhdHVzIGJ5dGUgaW4gdGhlIGhpZ2ggd29yZC4KKworKi8KKyNkZWZpbmUgc0VuUnhTdGF0dXNNb2RlKENoUCkgc091dFcoKENoUCktPkNoYW5TdGF0LFNUQVRNT0RFKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0VuVHJhbnNtaXQKK1B1cnBvc2U6ICBFbmFibGUgdHJhbnNtaXQKK0NhbGw6ICAgICBzRW5UcmFuc21pdChDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorKi8KKyNkZWZpbmUgc0VuVHJhbnNtaXQoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5UeENvbnRyb2xbM10gfD0gVFhfRU5BQkxFOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlR4Q29udHJvbFswXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzRW5UeFNvZnRGbG93Q3RsCitQdXJwb3NlOiAgRW5hYmxlIFR4IFNvZnR3YXJlIEZsb3cgQ29udHJvbAorQ2FsbDogICAgIHNFblR4U29mdEZsb3dDdGwoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNFblR4U29mdEZsb3dDdGwoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5SWzB4MDZdID0gMHhjNTsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5SWzB4MDRdKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNHZXRBaW9wSW50U3RhdHVzCitQdXJwb3NlOiAgR2V0IHRoZSBBSU9QIGludGVycnVwdCBzdGF0dXMKK0NhbGw6ICAgICBzR2V0QWlvcEludFN0YXR1cyhDdGxQLEFpb3BOdW0pCisgICAgICAgICAgQ09OVFJPTExFUl9UICpDdGxQOyBQdHIgdG8gY29udHJvbGxlciBzdHJ1Y3R1cmUKKyAgICAgICAgICBpbnQgQWlvcE51bTsgQUlPUCBudW1iZXIKK1JldHVybjogICBCeXRlX3Q6IFRoZSBBSU9QIGludGVycnVwdCBzdGF0dXMuICBCaXRzIDAgdGhyb3VnaCA3CisgICAgICAgICAgICAgICAgICAgICAgICAgcmVwcmVzZW50IGNoYW5uZWxzIDAgdGhyb3VnaCA3IHJlc3BlY3RpdmVseS4gIElmIGEKKyAgICAgICAgICAgICAgICAgICAgICAgICBiaXQgaXMgc2V0IHRoYXQgY2hhbm5lbCBpcyBpbnRlcnJ1cHRpbmcuCisqLworI2RlZmluZSBzR2V0QWlvcEludFN0YXR1cyhDVExQLEFJT1BOVU0pIHNJbkIoKENUTFApLT5BaW9wSW50Q2hhbklPW0FJT1BOVU1dKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0dldEFpb3BOdW1DaGFuCitQdXJwb3NlOiAgR2V0IHRoZSBudW1iZXIgb2YgY2hhbm5lbHMgc3VwcG9ydGVkIGJ5IGFuIEFJT1AKK0NhbGw6ICAgICBzR2V0QWlvcE51bUNoYW4oQ3RsUCxBaW9wTnVtKQorICAgICAgICAgIENPTlRST0xMRVJfVCAqQ3RsUDsgUHRyIHRvIGNvbnRyb2xsZXIgc3RydWN0dXJlCisgICAgICAgICAgaW50IEFpb3BOdW07IEFJT1AgbnVtYmVyCitSZXR1cm46ICAgaW50OiBUaGUgbnVtYmVyIG9mIGNoYW5uZWxzIHN1cHBvcnRlZCBieSB0aGUgQUlPUAorKi8KKyNkZWZpbmUgc0dldEFpb3BOdW1DaGFuKENUTFAsQUlPUE5VTSkgKENUTFApLT5BaW9wTnVtQ2hhbltBSU9QTlVNXQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0dldENoYW5JbnRJRAorUHVycG9zZTogIEdldCBhIGNoYW5uZWwncyBpbnRlcnJ1cHQgaWRlbnRpZmljYXRpb24gYnl0ZQorQ2FsbDogICAgIHNHZXRDaGFuSW50SUQoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKK1JldHVybjogICBCeXRlX3Q6IFRoZSBjaGFubmVsIGludGVycnVwdCBJRC4gIENhbiBiZSBhbnkKKyAgICAgICAgICAgICBjb21iaW5hdGlvbiBvZiB0aGUgZm9sbG93aW5nIGZsYWdzOgorICAgICAgICAgICAgICAgIFJYRl9UUklHOiAgICAgUnggRklGTyB0cmlnZ2VyIGxldmVsIGludGVycnVwdAorICAgICAgICAgICAgICAgIFRYRklGT19NVDogICAgVHggRklGTyBlbXB0eSBpbnRlcnJ1cHQKKyAgICAgICAgICAgICAgICBTUkNfSU5UOiAgICAgIFNwZWNpYWwgcmVjZWl2ZSBjb25kaXRpb24gaW50ZXJydXB0CisgICAgICAgICAgICAgICAgREVMVEFfQ0Q6ICAgICBDRCBjaGFuZ2UgaW50ZXJydXB0CisgICAgICAgICAgICAgICAgREVMVEFfQ1RTOiAgICBDVFMgY2hhbmdlIGludGVycnVwdAorICAgICAgICAgICAgICAgIERFTFRBX0RTUjogICAgRFNSIGNoYW5nZSBpbnRlcnJ1cHQKKyovCisjZGVmaW5lIHNHZXRDaGFuSW50SUQoQ2hQKSAoc0luQigoQ2hQKS0+SW50SUQpICYgKFJYRl9UUklHIHwgVFhGSUZPX01UIHwgU1JDX0lOVCB8IERFTFRBX0NEIHwgREVMVEFfQ1RTIHwgREVMVEFfRFNSKSkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNHZXRDaGFuTnVtCitQdXJwb3NlOiAgR2V0IHRoZSBudW1iZXIgb2YgYSBjaGFubmVsIHdpdGhpbiBhbiBBSU9QCitDYWxsOiAgICAgc0dldENoYW5OdW0oQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKK1JldHVybjogICBpbnQ6IENoYW5uZWwgbnVtYmVyIHdpdGhpbiBBSU9QLCBvciBOVUxMQ0hBTiBpZiBjaGFubmVsIGRvZXMKKyAgICAgICAgICAgICAgIG5vdCBleGlzdC4KKyovCisjZGVmaW5lIHNHZXRDaGFuTnVtKENoUCkgKENoUCktPkNoYW5OdW0KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNHZXRDaGFuU3RhdHVzCitQdXJwb3NlOiAgR2V0IHRoZSBjaGFubmVsIHN0YXR1cworQ2FsbDogICAgIHNHZXRDaGFuU3RhdHVzKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCitSZXR1cm46ICAgV29yZF90OiBUaGUgY2hhbm5lbCBzdGF0dXMuICBDYW4gYmUgYW55IGNvbWJpbmF0aW9uIG9mCisgICAgICAgICAgICAgdGhlIGZvbGxvd2luZyBmbGFnczoKKyAgICAgICAgICAgICAgICBMT1cgQllURSBGTEFHUworICAgICAgICAgICAgICAgIENUU19BQ1Q6ICAgICAgQ1RTIGlucHV0IGFzc2VydGVkCisgICAgICAgICAgICAgICAgRFNSX0FDVDogICAgICBEU1IgaW5wdXQgYXNzZXJ0ZWQKKyAgICAgICAgICAgICAgICBDRF9BQ1Q6ICAgICAgIENEIGlucHV0IGFzc2VydGVkCisgICAgICAgICAgICAgICAgVFhGSUZPTVQ6ICAgICBUeCBGSUZPIGlzIGVtcHR5CisgICAgICAgICAgICAgICAgVFhTSFJNVDogICAgICBUeCBzaGlmdCByZWdpc3RlciBpcyBlbXB0eQorICAgICAgICAgICAgICAgIFJEQTogICAgICAgICAgUnggZGF0YSBhdmFpbGFibGUKKworICAgICAgICAgICAgICAgIEhJR0ggQllURSBGTEFHUworICAgICAgICAgICAgICAgIFNUQVRNT0RFOiAgICAgc3RhdHVzIG1vZGUgZW5hYmxlIGJpdAorICAgICAgICAgICAgICAgIFJYRk9WRVJGTDogICAgcmVjZWl2ZSBGSUZPIG92ZXJmbG93CisgICAgICAgICAgICAgICAgUlgyTUFUQ0g6ICAgICByZWNlaXZlIGNvbXBhcmUgYnl0ZSAyIG1hdGNoCisgICAgICAgICAgICAgICAgUlgxTUFUQ0g6ICAgICByZWNlaXZlIGNvbXBhcmUgYnl0ZSAxIG1hdGNoCisgICAgICAgICAgICAgICAgUlhCUkVBSzogICAgICByZWNlaXZlZCBCUkVBSworICAgICAgICAgICAgICAgIFJYRlJBTUU6ICAgICAgcmVjZWl2ZWQgZnJhbWluZyBlcnJvcgorICAgICAgICAgICAgICAgIFJYUEFSSVRZOiAgICAgcmVjZWl2ZWQgcGFyaXR5IGVycm9yCitXYXJuaW5nczogVGhpcyBmdW5jdGlvbiB3aWxsIGNsZWFyIHRoZSBoaWdoIGJ5dGUgZmxhZ3MgaW4gdGhlIENoYW5uZWwKKyAgICAgICAgICBTdGF0dXMgUmVnaXN0ZXIuCisqLworI2RlZmluZSBzR2V0Q2hhblN0YXR1cyhDaFApIHNJblcoKENoUCktPkNoYW5TdGF0KQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0dldENoYW5TdGF0dXNMbworUHVycG9zZTogIEdldCB0aGUgbG93IGJ5dGUgb25seSBvZiB0aGUgY2hhbm5lbCBzdGF0dXMKK0NhbGw6ICAgICBzR2V0Q2hhblN0YXR1c0xvKENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCitSZXR1cm46ICAgQnl0ZV90OiBUaGUgY2hhbm5lbCBzdGF0dXMgbG93IGJ5dGUuICBDYW4gYmUgYW55IGNvbWJpbmF0aW9uCisgICAgICAgICAgICAgb2YgdGhlIGZvbGxvd2luZyBmbGFnczoKKyAgICAgICAgICAgICAgICBDVFNfQUNUOiAgICAgIENUUyBpbnB1dCBhc3NlcnRlZAorICAgICAgICAgICAgICAgIERTUl9BQ1Q6ICAgICAgRFNSIGlucHV0IGFzc2VydGVkCisgICAgICAgICAgICAgICAgQ0RfQUNUOiAgICAgICBDRCBpbnB1dCBhc3NlcnRlZAorICAgICAgICAgICAgICAgIFRYRklGT01UOiAgICAgVHggRklGTyBpcyBlbXB0eQorICAgICAgICAgICAgICAgIFRYU0hSTVQ6ICAgICAgVHggc2hpZnQgcmVnaXN0ZXIgaXMgZW1wdHkKKyAgICAgICAgICAgICAgICBSREE6ICAgICAgICAgIFJ4IGRhdGEgYXZhaWxhYmxlCisqLworI2RlZmluZSBzR2V0Q2hhblN0YXR1c0xvKENoUCkgc0luQigoQnl0ZUlPX3QpKENoUCktPkNoYW5TdGF0KQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogR2V0IFJJIHN0YXR1cyBvZiBjaGFubmVsCisgKiBEZWZpbmVkIGFzIGEgZnVuY3Rpb24gaW4gcm9ja2V0LmMgICAtYWVzCisgKi8KKyNpZiAwCisjZGVmaW5lIHNHZXRDaGFuUkkoQ2hQKSAoKENoUCktPkN0bFAtPkFsdENoYW5SaW5nSW5kaWNhdG9yID8gXAorICAgICAgICAgICAgICAgICAgICAgICAgICAoc0luQigoQnl0ZUlPX3QpKChDaFApLT5DaGFuU3RhdCs4KSkgJiBEU1JfQUNUKSA6IFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChDaFApLT5DdGxQLT5ib2FyZFR5cGUgPT0gUk9DS0VUX1RZUEVfUEMxMDQpID8gXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICghKHNJbkIoKENoUCktPkN0bFAtPkFpb3BJT1szXSkgJiBzQml0TWFwU2V0VGJsWyhDaFApLT5DaGFuTnVtXSkpIDogXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwKSkKKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc0dldENvbnRyb2xsZXJJbnRTdGF0dXMKK1B1cnBvc2U6ICBHZXQgdGhlIGNvbnRyb2xsZXIgaW50ZXJydXB0IHN0YXR1cworQ2FsbDogICAgIHNHZXRDb250cm9sbGVySW50U3RhdHVzKEN0bFApCisgICAgICAgICAgQ09OVFJPTExFUl9UICpDdGxQOyBQdHIgdG8gY29udHJvbGxlciBzdHJ1Y3R1cmUKK1JldHVybjogICBCeXRlX3Q6IFRoZSBjb250cm9sbGVyIGludGVycnVwdCBzdGF0dXMgaW4gdGhlIGxvd2VyIDQKKyAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzLiAgQml0cyAwIHRocm91Z2ggMyByZXByZXNlbnQgQUlPUCdzIDAKKyAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdWdoIDMgcmVzcGVjdGl2ZWx5LiAgSWYgYSBiaXQgaXMgc2V0IHRoYXQKKyAgICAgICAgICAgICAgICAgICAgICAgICBBSU9QIGlzIGludGVycnVwdGluZy4gIEJpdHMgNCB0aHJvdWdoIDcgd2lsbAorICAgICAgICAgICAgICAgICAgICAgICAgIGFsd2F5cyBiZSBjbGVhcmVkLgorKi8KKyNkZWZpbmUgc0dldENvbnRyb2xsZXJJbnRTdGF0dXMoQ1RMUCkgKHNJbkIoKENUTFApLT5NUmVnMUlPKSAmIDB4MGYpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzUENJR2V0Q29udHJvbGxlckludFN0YXR1cworUHVycG9zZTogIEdldCB0aGUgY29udHJvbGxlciBpbnRlcnJ1cHQgc3RhdHVzCitDYWxsOiAgICAgc1BDSUdldENvbnRyb2xsZXJJbnRTdGF0dXMoQ3RsUCkKKyAgICAgICAgICBDT05UUk9MTEVSX1QgKkN0bFA7IFB0ciB0byBjb250cm9sbGVyIHN0cnVjdHVyZQorUmV0dXJuOiAgIHVuc2lnbmVkIGNoYXI6IFRoZSBjb250cm9sbGVyIGludGVycnVwdCBzdGF0dXMgaW4gdGhlIGxvd2VyIDQKKyAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzIGFuZCBiaXQgNC4gIEJpdHMgMCB0aHJvdWdoIDMgcmVwcmVzZW50IEFJT1AncyAwCisgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3VnaCAzIHJlc3BlY3RpdmVseS4gQml0IDQgaXMgc2V0IGlmIHRoZSBpbnQgCisJCQkgd2FzIGdlbmVyYXRlZCBmcm9tIHBlcmlvZGljLiBJZiBhIGJpdCBpcyBzZXQgdGhlCisJCQkgQUlPUCBpcyBpbnRlcnJ1cHRpbmcuCisqLworI2RlZmluZSBzUENJR2V0Q29udHJvbGxlckludFN0YXR1cyhDVExQKSBcCisJKChDVExQKS0+aXNVUENJID8gXAorCSAgKHNJblcoKENUTFApLT5QQ0lJTzIpICYgVVBDSV9BSU9QX0lOVFJfQklUUykgOiBcCisJICAoKHNJblcoKENUTFApLT5QQ0lJTykgPj4gOCkgJiBBSU9QX0lOVFJfQklUUykpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKworRnVuY3Rpb246IHNHZXRSeENudAorUHVycG9zZTogIEdldCB0aGUgbnVtYmVyIG9mIGRhdGEgYnl0ZXMgaW4gdGhlIFJ4IEZJRk8KK0NhbGw6ICAgICBzR2V0UnhDbnQoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKK1JldHVybjogICBpbnQ6IFRoZSBudW1iZXIgb2YgZGF0YSBieXRlcyBpbiB0aGUgUnggRklGTy4KK0NvbW1lbnRzOiBCeXRlIHJlYWQgb2YgY291bnQgcmVnaXN0ZXIgaXMgcmVxdWlyZWQgdG8gb2J0YWluIFJ4IGNvdW50LgorCisqLworI2RlZmluZSBzR2V0UnhDbnQoQ2hQKSBzSW5XKChDaFApLT5UeFJ4Q291bnQpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzR2V0VHhDbnQKK1B1cnBvc2U6ICBHZXQgdGhlIG51bWJlciBvZiBkYXRhIGJ5dGVzIGluIHRoZSBUeCBGSUZPCitDYWxsOiAgICAgc0dldFR4Q250KENoUCkKKyAgICAgICAgICB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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNTZW5kQnJlYWsKK1B1cnBvc2U6ICBTZW5kIGEgdHJhbnNtaXQgQlJFQUsgc2lnbmFsCitDYWxsOiAgICAgc1NlbmRCcmVhayhDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorKi8KKyNkZWZpbmUgc1NlbmRCcmVhayhDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFszXSB8PSBTRVRCUkVBSzsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldEJhdWQKK1B1cnBvc2U6ICBTZXQgYmF1ZCByYXRlCitDYWxsOiAgICAgc1NldEJhdWQoQ2hQLERpdmlzb3IpCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorICAgICAgICAgIFdvcmRfdCBEaXZpc29yOyAxNiBiaXQgYmF1ZCByYXRlIGRpdmlzb3IgZm9yIGNoYW5uZWwKKyovCisjZGVmaW5lIHNTZXRCYXVkKENoUCxESVZJU09SKSBcCitkbyB7IFwKKyAgIChDaFApLT5CYXVkRGl2WzJdID0gKEJ5dGVfdCkoRElWSVNPUik7IFwKKyAgIChDaFApLT5CYXVkRGl2WzNdID0gKEJ5dGVfdCkoKERJVklTT1IpID4+IDgpOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPkJhdWREaXZbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldERhdGE3CitQdXJwb3NlOiAgU2V0IGRhdGEgYml0cyB0byA3CitDYWxsOiAgICAgc1NldERhdGE3KENoUCkKKyAgICAgICAgICBDSEFOTkVMX1QgKkNoUDsgUHRyIHRvIGNoYW5uZWwgc3RydWN0dXJlCisqLworI2RlZmluZSBzU2V0RGF0YTcoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5UeENvbnRyb2xbMl0gJj0gfkRBVEE4QklUOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlR4Q29udHJvbFswXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzU2V0RGF0YTgKK1B1cnBvc2U6ICBTZXQgZGF0YSBiaXRzIHRvIDgKK0NhbGw6ICAgICBzU2V0RGF0YTgoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNTZXREYXRhOChDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSB8PSBEQVRBOEJJVDsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldERUUgorUHVycG9zZTogIFNldCB0aGUgRFRSIG91dHB1dAorQ2FsbDogICAgIHNTZXREVFIoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNTZXREVFIoQ2hQKSBcCitkbyB7IFwKKyAgIChDaFApLT5UeENvbnRyb2xbM10gfD0gU0VUX0RUUjsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldEV2ZW5QYXJpdHkKK1B1cnBvc2U6ICBTZXQgZXZlbiBwYXJpdHkKK0NhbGw6ICAgICBzU2V0RXZlblBhcml0eShDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorQ29tbWVudHM6IEZ1bmN0aW9uIHNTZXRQYXJpdHkoKSBjYW4gYmUgdXNlZCBpbiBwbGFjZSBvZiBmdW5jdGlvbnMgc0VuUGFyaXR5KCksCisgICAgICAgICAgc0Rpc1Bhcml0eSgpLCBzU2V0T2RkUGFyaXR5KCksIGFuZCBzU2V0RXZlblBhcml0eSgpLgorCitXYXJuaW5nczogVGhpcyBmdW5jdGlvbiBoYXMgbm8gZWZmZWN0IHVubGVzcyBwYXJpdHkgaXMgZW5hYmxlZCB3aXRoIGZ1bmN0aW9uCisgICAgICAgICAgc0VuUGFyaXR5KCkuCisqLworI2RlZmluZSBzU2V0RXZlblBhcml0eShDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSB8PSBFVkVOX1BBUjsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldE9kZFBhcml0eQorUHVycG9zZTogIFNldCBvZGQgcGFyaXR5CitDYWxsOiAgICAgc1NldE9kZFBhcml0eShDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorQ29tbWVudHM6IEZ1bmN0aW9uIHNTZXRQYXJpdHkoKSBjYW4gYmUgdXNlZCBpbiBwbGFjZSBvZiBmdW5jdGlvbnMgc0VuUGFyaXR5KCksCisgICAgICAgICAgc0Rpc1Bhcml0eSgpLCBzU2V0T2RkUGFyaXR5KCksIGFuZCBzU2V0RXZlblBhcml0eSgpLgorCitXYXJuaW5nczogVGhpcyBmdW5jdGlvbiBoYXMgbm8gZWZmZWN0IHVubGVzcyBwYXJpdHkgaXMgZW5hYmxlZCB3aXRoIGZ1bmN0aW9uCisgICAgICAgICAgc0VuUGFyaXR5KCkuCisqLworI2RlZmluZSBzU2V0T2RkUGFyaXR5KENoUCkgXAorZG8geyBcCisgICAoQ2hQKS0+VHhDb250cm9sWzJdICY9IH5FVkVOX1BBUjsgXAorICAgc091dERXKChDaFApLT5JbmRleEFkZHIsKihEV29yZF90ICopJihDaFApLT5UeENvbnRyb2xbMF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldFJUUworUHVycG9zZTogIFNldCB0aGUgUlRTIG91dHB1dAorQ2FsbDogICAgIHNTZXRSVFMoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNTZXRSVFMoQ2hQKSBcCitkbyB7IFwKKyAgIGlmICgoQ2hQKS0+cnRzVG9nZ2xlKSBicmVhazsgXAorICAgKENoUCktPlR4Q29udHJvbFszXSB8PSBTRVRfUlR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pZmljYXRpb24KKyAgICAgICAgICByZWdpc3RlciB3aWxsIGJlIHNldCB3aGVuZXZlciB0aGUgdHJpZ2dlciBsZXZlbCBpcyByZWFjaGVkCisgICAgICAgICAgcmVnYXJkbGVzcyBvZiB0aGUgc2V0dGluZyBvZiBSWElOVF9FTi4KKworKi8KKyNkZWZpbmUgc1NldFJ4VHJpZ2dlcihDaFAsTEVWRUwpIFwKK2RvIHsgXAorICAgKENoUCktPlJ4Q29udHJvbFsyXSAmPSB+VFJJR19NQVNLOyBcCisgICAoQ2hQKS0+UnhDb250cm9sWzJdIHw9IExFVkVMOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlJ4Q29udHJvbFswXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzU2V0U3RvcDEKK1B1cnBvc2U6ICBTZXQgc3RvcCBiaXRzIHRvIDEKK0NhbGw6ICAgICBzU2V0U3RvcDEoQ2hQKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyovCisjZGVmaW5lIHNTZXRTdG9wMShDaFApIFwKK2RvIHsgXAorICAgKENoUCktPlR4Q29udHJvbFsyXSAmPSB+U1RPUDI7IFwKKyAgIHNPdXREVygoQ2hQKS0+SW5kZXhBZGRyLCooRFdvcmRfdCAqKSYoQ2hQKS0+VHhDb250cm9sWzBdKTsgXAorfSB3aGlsZSAoMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorRnVuY3Rpb246IHNTZXRTdG9wMgorUHVycG9zZTogIFNldCBzdG9wIGJpdHMgdG8gMgorQ2FsbDogICAgIHNTZXRTdG9wMihDaFApCisgICAgICAgICAgQ0hBTk5FTF9UICpDaFA7IFB0ciB0byBjaGFubmVsIHN0cnVjdHVyZQorKi8KKyNkZWZpbmUgc1NldFN0b3AyKENoUCkgXAorZG8geyBcCisgICAoQ2hQKS0+VHhDb250cm9sWzJdIHw9IFNUT1AyOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlR4Q29udHJvbFswXSk7IFwKK30gd2hpbGUgKDApCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK0Z1bmN0aW9uOiBzU2V0VHhYT0ZGQ2hhcgorUHVycG9zZTogIFNldCB0aGUgVHggWE9GRiBmbG93IGNvbnRyb2wgY2hhcmFjdGVyCitDYWxsOiAgICAgc1NldFR4WE9GRkNoYXIoQ2hQLENoKQorICAgICAgICAgIENIQU5ORUxfVCAqQ2hQOyBQdHIgdG8gY2hhbm5lbCBzdHJ1Y3R1cmUKKyAgICAgICAgICBCeXRlX3QgQ2g7IFRoZSB2YWx1ZSB0byBzZXQgdGhlIFR4IFhPRkYgY2hhcmFjdGVyIHRvCisqLworI2RlZmluZSBzU2V0VHhYT0ZGQ2hhcihDaFAsQ0gpIFwKK2RvIHsgXAorICAgKENoUCktPlJbMHgwN10gPSAoQ0gpOyBcCisgICBzT3V0RFcoKENoUCktPkluZGV4QWRkciwqKERXb3JkX3QgKikmKENoUCktPlJbMHgwNF0pOyBcCit9IHdoaWxlICgwKQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCitGdW5jdGlvbjogc1NldFR4WE9OQ2hhcgorUHVycG9zZTogIFNldCB0aGUgVHggWE9OIGZsb3cgY29udHJvbCBjaGFyYWN0ZXIKK0NhbGw6ICAgICBzU2V0VHhYT05DaGFyKENoUCxDaCkKKyAgICAgICAgICBDSEFOTk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gUlRDX0FGIGRlZmluaXRpb25zICovCisjaW5jbHVkZSA8bGludXgvbWMxNDY4MThydGMuaD4KKworI3VuZGVmIFMzQzI0WFhfVkFfUlRDCisjZGVmaW5lIFMzQzI0WFhfVkFfUlRDIHMzYzI0MTBfcnRjX2Jhc2UKKworc3RhdGljIHN0cnVjdCByZXNvdXJjZSAqczNjMjQxMF9ydGNfbWVtOworCitzdGF0aWMgdm9pZCBfX2lvbWVtICpzM2MyNDEwX3J0Y19iYXNlOworc3RhdGljIGludCBzM2MyNDEwX3J0Y19hbGFybW5vID0gTk9fSVJROworc3RhdGljIGludCBzM2MyNDEwX3J0Y190aWNrbm8gID0gTk9fSVJROworc3RhdGljIGludCBzM2MyNDEwX3J0Y19mcmVxICAgID0gMTsKKworc3RhdGljIERFRklORV9TUElOTE9DSyhzM2MyNDEwX3J0Y19waWVfbG9jayk7CisKKy8qIElSUSBIYW5kbGVycyAqLworCitzdGF0aWMgaXJxcmV0dXJuX3QgczNjMjQxMF9ydGNfYWxhcm1pcnEoaW50IGlycSwgdm9pZCAqaWQsIHN0cnVjdCBwdF9yZWdzICpyKQoreworCXJ0Y191cGRhdGUoMSwgUlRDX0FGIHwgUlRDX0lSUUYpOworCXJldHVybiBJUlFfSEFORExFRDsKK30KKworc3RhdGljIGlycXJldHVybl90IHMzYzI0MTBfcnRjX3RpY2tpcnEoaW50IGlycSwgdm9pZCAqaWQsIHN0cnVjdCBwdF9yZWdzICpyKQoreworCXJ0Y191cGRhdGUoMSwgUlRDX1BGIHwgUlRDX0lSUUYpOworCXJldHVybiBJUlFfSEFORExFRDsKK30KKworLyogVXBkYXRlIGNvbnRyb2wgcmVnaXN0ZXJzICovCitzdGF0aWMgdm9pZCBzM2MyNDEwX3J0Y19zZXRhaWUoaW50IHRvKQoreworCXVuc2lnbmVkIGludCB0bXA7CisKKwlwcl9kZWJ1ZygiJXM6IGFpZT0lZFxuIiwgX19GVU5DVElPTl9fLCB0byk7CisKKwl0bXAgPSByZWFkYihT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kaXZpc29ycyBhcmUgdmFsaWQ6CisgKgorICogICAtIENMS19SVHhDOiAxIG9yIGV2ZW4gKDEsIDIgYW5kIDQgYXJlIHRoZSBkaXJlY3QgbW9kZXMsID4gNCB1c2UKKyAqICAgICAgICAgICAgICAgdGhlIEJSRykKKyAqCisgKiAgIC0gQ0xLX1RSeEM6IDEsIDIgb3IgNCAobm8gQlJHLCBvbmx5IGRpcmVjdCBtb2RlcyBwb3NzaWJsZSkKKyAqCisgKiAgIC0gQ0xLX1BDTEs6ID49IDQgYW5kIGV2ZW4gKG5vIGRpcmVjdCBtb2Rlcywgb25seSBCUkcpCisgKgorICovCisKK3N0cnVjdCBzY2NfcG9ydCB7CisJc3RydWN0IGdzX3BvcnQJCWdzOworCXZvbGF0aWxlIHVuc2lnbmVkIGNoYXIJKmN0cmxwOworCXZvbGF0aWxlIHVuc2lnbmVkIGNoYXIJKmRhdGFwOworCWludAkJCXhfY2hhcjsJCS8qIHhvbi94b2ZmIGNoYXJhY3RlciAqLworCWludAkJCWNfZGNkOworCWludAkJCWNoYW5uZWw7CisJc3RydWN0IHNjY19wb3J0CQkqcG9ydF9hOwkvKiBSZWZlcmVuY2UgdG8gcG9ydCBBIGFuZCBCICovCisJc3RydWN0IHNjY19wb3J0CQkqcG9ydF9iOwkvKiAgIHN0cnVjdHMgZm9yIHJlZyBhY2Nlc3MgICovCit9OworCisjZGVmaW5lIFNDQ19NQUdJQwkweDUyNjk2MzY4CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSZWdpc3RlciBOYW1lcyAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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gaXMgV1IxMCwgaWYgYjYoTVI3JykgPT0gMSAqLworLyogUlIxMiBpcyBXUjEyICovCisvKiBSUjEzIGlzIFdSMTMgKi8KKy8qIFJSMTQgbm90IHByZXNlbnQgKi8KKy8qIFJSMTUgaXMgV1IxNSAqLworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSZWdpc3RlciBWYWx1ZXMgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworCisvKiBXUjA6IENPTU1BTkRfUkVHICJDUiIgKi8KKworI2RlZmluZQlDUl9SWF9DUkNfUkVTRVQJCTB4NDAKKyNkZWZpbmUJQ1JfVFhfQ1JDX1JFU0VUCQkweDgwCisjZGVmaW5lCUNSX1RYX1VOREVSUlVOX1JFU0VUCTB4YzAKKworI2RlZmluZQlDUl9FWFRTVEFUX1JFU0VUCTB4MTAKKyNkZWZpbmUJQ1JfU0VORF9BQk9SVAkJMHgxOAorI2RlZmluZQlDUl9FTkFCX0lOVF9ORVhUX1JYCTB4MjAKKyNkZWZpbmUJQ1JfVFhfUEVORElOR19SRVNFVAkweDI4CisjZGVmaW5lCUNSX0VSUk9SX1JFU0VUCQkweDMwCisjZGVmaW5lCUNSX0hJR0hFU1RfSVVTX1JFU0VUCTB4MzgKKworCisvKiBXUjE6IElOVF9BTkRfRE1BX1JFRyAiSURSIiAqLworCisjZGVmaW5lCUlEUl9FWFRTVEFUX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jEwOiBEUExMX1NUQVRVU19SRUcgIkRTUiIgKi8KKworI2RlZmluZQlEU1JfT05fTE9PUAkJMHgwMgorI2RlZmluZQlEU1JfT05fTE9PUF9TRU5ESU5HCTB4MTAKKyNkZWZpbmUJRFNSX1RXT19DTEtfTUlTU0lORwkweDQwCisjZGVmaW5lCURTUl9PTkVfQ0xLX01JU1NJTkcJMHg4MAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVnaXN0ZXIgQWNjZXNzICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKworLyogVGhlIFNDQyBuZWVkcyAzLjUgUENMSyBjeWNsZXMgcmVjb3ZlcnkgdGltZSBiZXR3ZWVuIHRvIHJlZ2lzdGVyCisgKiBhY2Nlc3Nlcy4gUENMSyBydW5zIHdpdGggOCBNSHogb24gYW4gQXRhcmksIHNvIHRoaXMgZGVsYXkgaXMgMy41ICoKKyAqIDEyNSBucyA9IDQzNy41IG5zLiBUaGlzIGlzIHRvbyBzaG9ydCBmb3IgdWRlbGF5KCkuCisgKiAxMC8xNi85NTogQSB0c3RiIG1mcC5wYXJfZHRfcmVnIHRha2VzIDYwMG5zIChzdXJlPykgYW5kIHRodXMgc2hvdWxkIGJlCisgKiBxdWl0ZSByaWdodAorICovCisKKyNkZWZpbmUgc2NjX3JlZ19kZWxheSgpIFwKKyAgICBkbyB7CQkJXAorCWlmIChNQUNIX0lTX01W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ZXZlbG9wZXJzIG9uIHdob3NlIEEyMjMyIGRyaXZlciBJIGhhZCBhCisgKglwcmV0dHkgY2xvc2UgbG9vay4gSG93ZXZlciwgSSBkaWRuJ3QgY29weSBhbnkgY29kZSBzbyBpdAorICoJaXMgb2theSB0byBwdXQgbXkgY29kZSB1bmRlciB0aGUgR1BMIGFuZCBpbmNsdWRlIGl0IGludG8KKyAqCUxpbnV4LgorICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogRW5kIG9mIERvY3VtZW50YXRpb24gKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiBEZWZpbmVzICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qCisgKiBFbmFibGVzIGV4cGVyaW1lbnRhbCAxMTUyMDAgKG5vcm1hbCkgMjMwNDAwICh0dXJibykgYmF1ZCByYXRlLgorICogVGhlIEEyMjMyIHNwZWNpZmljYXRpb24gc3RhdGVzIGl0IGNhbiBvbmx5IG9wZXJhdGUgYXQgc3BlZWRzIHVwIHRvCisgKiAxOTIwMCBiaXRzIHBlciBzZWNvbmQsIGFuZCBJIHdhcyBub3QgYWJsZSB0byBzZW5kIGEgZmlsZSB2aWEKKyAqICJzeiIvInJ6IiBhbmQgYSBudWxsLW1vZGVtIGNhYmxlIGZyb20gb25lIEEyMjMyIHBvcnQgdG8gYW5vdGhlcgorICogYXQgMTE1MjAwIGJpdHMgcGVyIHNlY29uZC4KKyAqIEhvd2V2ZXIsIHRoaXMgbWlnaHQgd29yayBmb3IgeW91LgorICovCisjdW5kZWYgQTIyMzJfU1BFRURIQUNLCisvKgorICogRGVmYXVsdCBpcyBub3QgdG8gdXNlIFJUUy9DVFMgc28geW91IGNvdWxkIGJlIHRhbGtlZCB0byBkZWF0aC4KKyAqLworI2RlZmluZSBBMjIzMl9TVVBQUkVTU19SVFNDVFNfV0FSTklORworLyoqKioqKioqKioqKioqKioqKioqKioqKiogRW5kIG9mIERlZmluZXMgKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogSW5jbHVkZXMgKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaW5jbHVkZSA8bGludXgvbW9kdWxlLmg+CisKKyNpbmNsdWRlIDxsaW51eC90eXBlcy5oPgorI2luY2x1ZGUgPGxpbnV4L3NjaGVkLmg+CisjaW5jbHVkZSA8bGludXgvaW50ZXJydXB0Lmg+CisjaW5jbHVkZSA8bGludXgva2VybmVsLmg+CisjaW5jbHVkZSA8bGludXgvZXJybm8uaD4KKyNpbmNsdWRlIDxsaW51eC90dHkuaD4KKworI2luY2x1ZGUgPGFzbS9zZXR1cC5oPgorI2luY2x1ZGUgPGFzbS9hbWlnYWludHMuaD4KKyNpbmNsdWRlIDxhc20vYW1pZ2Fody5oPgorI2luY2x1ZGUgPGxpbnV4L3pvcnJvLmg+CisjaW5jbHVkZSA8YXNtL2lycS5oPgorI2luY2x1ZGUgPGFzbS9zZW1hcGhvcmUuaD4KKworI2luY2x1ZGUgPGxpbnV4L2RlbGF5Lmg+CisKKyNpbmNsdWRlIDxsaW51eC9zZXJpYWwuaD4KKyNpbmNsdWRlIDxsaW51eC9nZW5lcmljX3NlcmlhbC5oPgorCisjaW5jbHVkZSAic2VyX2EyMjMyLmgiCisjaW5jbHVkZSAic2VyX2EyMjMyZncuaCIKKy8qKioqKioqKioqKioqKioqKioqKioqKioqIEVuZCBvZiBJbmNsdWRlcyAqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqIFByb3RvdHlwZXMgKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogVGhlIGludGVycnVwdCBzZXJ2aWNlIHJvdXRpbmUgKi8KK3N0YXRpYyBpcnFyZXR1cm5fdCBhMjIzMl92YmxfaW50ZXIoaW50IGlycSwgdm9pZCAqZGF0YSwgc3RydWN0IHB0X3JlZ3MgKmZwKTsKKy8qIElu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JpbiB0aGF0IGlzIGV4ZWN1dGVkIGJ5CisgICB0aGUgQTIyMzIncyA2NUVDMDIgcHJvY2Vzc29yIChiYXNlIGFkZHJlc3M6IDB4MzgwMCkKKyAgIFNvdXJjZSBmaWxlOglzZXJfYTIyMzJmdy5heAorICAgVmVyc2lvbjoJMS4zICg5NTEwMjkpCisgICBLbm93biBCdWdzOglDYW5ub3Qgc2VuZCBhIGJyZWFrIHlldAorKi8KK3N0YXRpYyB1bnNpZ25lZCBjaGFyIGEyMjMyXzY1RUMwMmNvZGVbXSA9IHsKKwkweDM4LCAweDAwLCAweEEyLCAweEZGLCAweDlBLCAweEQ4LCAweEEyLCAweDAwLCAKKwkweEE5LCAweDAwLCAweEEwLCAweDU0LCAweDk1LCAweDAwLCAweEU4LCAweDg4LCAKKwkweEQwLCAweEZBLCAweDY0LCAweDVDLCAweDY0LCAweDVFLCAweDY0LCAweDU4LCAKKwkweDY0LCAweDU5LCAweEE5LCAweDAwLCAweDg1LCAweDU1LCAweEE5LCAweEFBLCAKKwkweEM5LCAweDY0LCAweDkwLCAweDAyLCAweEU2LCAweDU1LCAweEE1LCAweDU0LCAKKwkweEYwLCAweDAzLCAweDRDLCAweDkyLCAweDM4LCAweEE5LCAweDk4LCAweDhELCAKKwkweDA2LCAweDQ0LCAweEE5LCAweDBCLCAweDhELCAweDA0LCAweDQ0LCAweEFELCAKKwkweDAyLCAweDQ0LCAweEE5LCAweDgwLCAweDhELCAweDFBLCAweDdDLCAweEE5LCAKKwkweEZGLCAweDhELCAweDA4LCAweDdDLCAweDhELCAweDBBLCAweDdDLCAweEEyLCAKKwkweDAwLCAweDhFLCAweDAwLCAweDQ0LCAweEVBLCAweEVBLCAweEFELCAweDAyLCAKKwkweDQ0LCAweEVBLCAweEVBLCAweDhFLCAweDAwLCAweDQ0LCAweEFELCAweDAyLCAKKwkweDQ0LCAweDI5LCAweDEwLCAweEYwLCAweEY5LCAweEE5LCAweDExLCAweDhFLCAKKwkweDAwLCAweDQ0LCAweDhELCAweDFDLCAweDdDLCAweEFELCAweDAyLCAweDQ0LCAKKwkweDI5LCAweDEwLCAweEYwLCAweEY5LCAweDhFLCAweDFDLCAweDdDLCAweEFELCAKKwkweDA4LCAweDdDLCAweDg1LCAweDU3LCAweEFELCAweDBBLCAweDdDLCAweDg1LCAKKwkweDU2LCAweEM5LCAweEQwLCAweDkwLCAweDA1LCAweEE5LCAweDAyLCAweDRDLCAKKwkweDgyLCAweDM4LCAweEE5LCAweDAxLCAweDg1LCAweDU0LCAweEE5LCAweDAwLCAKKwkweDhELCAweDAyLCAweDQ0LCAweDhELCAweDA2LCAweDQ0LCAweDhELCAweDA0LCAKKwkweDQ0LCAweDRDLCAweDkyLCAweDM4LCAweEFELCAweDAwLCAweDdDLCAweEM1LCAKKwkweDVDLCAweEYwLCAweDFGLCAweEM1LCAweDVFLCAweEYwLCAweDA5LCAweDg1LCAKKwkweDVFLCAweEE5LCAweDQwLCAweDg1LCAweDVELCAweDRDLCAweEI4LCAweDM4LCAKKwkweEM2LCAweDVELCAweDEwLCAweDBFLCAweEE2LCAweDU4LCAweDlELCAweDAwLCAKKwkweDE3LCAweEU4LCAweEU0LCAweDU5LCAweEYwLCAweDA0LCAweDg2LCAweDU4LCAKKwkweDg1LCAweDVDLCAweDIwLCAweDIzLCAweDNBLCAweEE1LCAweDA3LCAweEYwLCAKKwkweDBGLCAweEE1LCAweDBBLCAweDg1LCAweDBCLCAweEE1LCAweDA4LCAweDA5LCAKKwkweDEwLCAweDhELCAweDA2LCAweDQ0LCAweDY0LCAweDAyLCAweDY0LCAweDA3LCAKKwkweEE1LCAweDAwLCAweEU1LCAweDAxLCAweEM5LCAweEM4LCAweEE1LCAweDA5LCAKKwkweDI5LCAweEYzLCAweEIwLCAweDAyLCAweDA5LCAweDA4LCAweDhELCAweDA0LCAKKwkweDQ0LCAweEE1LCAweDA2LCAweEYwLCAweDA4LCAweEE1LCAweDAzLCAweDg1LCAKKwkweDA0LCAweDY0LCAweDAyLCAweDY0LCAweDA2LCAweDIwLCAweDIzLCAweDNBLCAKKwkweEE1LCAweDEzLCAweEYwLCAweDBGLCAweEE1LCAweDE2LCAweDg1LCAweDE3LCAKKwkweEE1LCAweDE0LCAweDA5LCAweDEwLCAweDhELCAweDA2LCAweDRDLCAweDY0LCAKKwkweDBFLCAweDY0LCAweDEzLCAweEE1LCAweDBDLCAweEU1LCAweDBELCAweEM5LCAKKwkweEM4LCAweEE1LCAweDE1LCAweDI5LCAweEYzLCAweEIwLCAweDAyLCAweDA5LCAKKwkweDA4LCAweDhELCAweDA0LCAweDRDLCAweEE1LCAweDEyLCAweEYwLCAweDA4LCAKKwkweEE1LCAweDBGLCAweDg1LCAweDEwLCAweDY0LCAweDBFLCAweDY0LCAweDEyLCAKKwkweDIwLCAweDIzLCAweDNBLCAweEE1LCAweDFGLCAweEYwLCAweDBGLCAweEE1LCAKKwkweDIyLCAweDg1LCAweDIzLCAweEE1LCAweDIwLCAweDA5LCAweDEwLCAweDhELCAKKwkweDA2LCAweDU0LCAweDY0LCAweDFBLCAweDY0LCAweDFGLCAweEE1LCAweDE4LCAKKwkweEU1LCAweDE5LCAweEM5LCAweEM4LCAweEE1LCAweDIxLCAweDI5LCAweEYzLCAKKwkweEIwLCAweDAyLCAweDA5LCAweDA4LCAweDhELCAweDA0LCAweDU0LCAweEE1LCAKKwkweDFFLCAweEYwLCAweDA4LCAweEE1LCAweDFCLCAweDg1LCAweDFDLCAweDY0LCAKKwkweDFBLCAweDY0LCAweDFFLCAweDIwLCAweDIzLCAweDNBLCAweEE1LCAweDJCLCAKKwkweEYwLCAweDBGLCAweEE1LCAweDJFLCAweDg1LCAweDJGLCAweEE1LCAweDJDLCAKKwkweDA5LCAweDEwLCAweDhELCAweDA2LCAweDVDLCAweDY0LCAweDI2LCAweDY0LCAKKwkweDJCLCAweEE1LCAweDI0LCAweEU1LCAweDI1LCAweEM5LCAweEM4LCAweEE1LCAKKwkweDJELCAweDI5LCAweEYzLCAweEIwLCAweDAyLCAweDA5LCAweDA4LCAweDhELCAKKwkweDA0LCAweDVDLCAweEE1LCAweDJBLCAweEYwLCAweDA4LCAweEE1LCAweDI3LCAKKwkweDg1LCAweDI4LCAweDY0LCAweDI2LCAweDY0LCAweDJBLCAweDIwLCAweDIzLCAKKwkweDNBLCAweEE1LCAweDM3LCAweEYwLCAweDBGLCAweEE1LCAweDNBLCAweDg1LCAKKwkweDNCLCAweEE1LCAweDM4LCAweDA5LCAweDEwLCAweDhELCAweDA2LCAweDY0LCAKKwkweDY0LCAweDMyLCAweDY0LCAweDM3LCAweEE1LCAweDMwLCAweEU1LCAweDMxLCAKKwkweEM5LCAweEM4LCAweEE1LCAweDM5LCAweDI5LCAweEYzLCAweEIwLCAweDAyLCAKKwkweDA5LCAweDA4LCAweDhELCAweDA0LCAweDY0LCAweEE1LCAweDM2LCAweEYwLCAKKwkweDA4LCAweEE1LCAweDMzLCAweDg1LCAweDM0LCAweDY0LCAweDMyLCAweDY0LCAKKwkweDM2LCAweDIwLCAweDIzLCAweDNBLCAweEE1LCAweDQzLCAweEYwLCAweDBGLCAKKwkweEE1LCAweDQ2LCAweDg1LCAweDQ3LCAweEE1LCAweDQ0LCAweDA5LCAweDEwLCAKKwkweDhELCAweDA2LCAweDZDLCAweDY0LCAweDNFLCAweDY0LCAweDQzLCAweEE1LCAKKwkweDNDLCAweEU1LCAweDNELCAweEM5LCAweEM4LCAweEE1LCAweDQ1LCAweDI5LCAKKwkweEYzLCAweEIwLCAweDAyLCAweDA5LCAweDA4LCAweDhELCAweDA0LCAweDZDLCAKKwkweEE1LCAweDQyLCAweEYwLCAweDA4LCAweEE1LCAweDNGLCAweDg1LCAweDQwLCAKKwkweDY0LCAweDNFLCAweDY0LCAweDQyLCAweDIwLCAweDIzLCAweDNBLCAweEE1LCAKKwkweDRGLCAweEYwLCAweDBGLCAweEE1LCAweDUyLCAweDg1LCAweDUzLCAweEE1LCAKKwkweDUwLCAweDA5LCAweDEwLCAweDhELCAweDA2LCAweDc0LCAweDY0LCAweDRBLCAKKwkweDY0LCAweDRGLCAweEE1LCAweDQ4LCAweEU1LCAweDQ5LCAweEM5LCAweEM4LCAKKwkweEE1LCAweDUxLCAweDI5LCAweEYzLCAweEIwLCAweDAyLCAweDA5LCAweDA4LCAKKwkweDhELCAweDA0LCAweDc0LCAweEE1LCAweDRFLCAweEYwLCAweDA4LCAweEE1LCAKKwkweDRCLCAweDg1LCAweDRDLCAweDY0LCAweDRBLCAweDY0LCAweDRFLCAweDIwLCAKKwkweDIzLCAweDNBLCAweDRDLCAweDkyLCAweDM4LCAweEFELCAweDAyLCAweDQ0LCAKKwkweDg5LCAweDA4LCAweEYwLCAweDNCLCAweDg5LCAweDAyLCAweEYwLCAweDFCLCAKKwkweEFELCAweDAwLCAweDQ0LCAweEQwLCAweDMyLCAweEE2LCAweDAwLCAweEE5LCAKKwkweDAxLCAweDlELCAweDAwLCAweDEwLCAweEE5LCAweDAxLCAweDlELCAweDAwLCAKKwkweDA5LCAweEU4LCAweEU0LCAweDAxLCAweEYwLCAweDAyLCAweDg2LCAweDAwLCAKKwkweDRDLCAweDY1LCAweDNBLCAweEE2LCAweDAwLCAweEFELCAweDAwLCAweDQ0LCAKKwkweDlELCAweDAwLCAweDA5LCAweDlFLCAweDAwLCAweDEwLCAweEU4LCAweEU0LCAKKwkweDAxLCAweEYwLCAweDAyLCAweDg2LCAweDAwLCAweDI5LCAweDdGLCAweEM5LCAKKwkweDEzLCAweEQwLCAweDA0LCAweEE1LCAweDBCLCAweDg1LCAweDAyLCAweEFELCAKKwkweDAyLCAweDQ0LCAweDI5LCAweDEwLCAweEYwLCAweDJDLCAweEE2LCAweDA1LCAKKwkweEYwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAweDAxLCAweEQwLCAKKwkweDIxLCAweDhFLCAweDAwLCAweDQ0LCAweDY0LCAweDA1LCAweDRDLCAweDk4LCAKKwkweDNBLCAweEE2LCAweDA0LCAweEU0LCAweDAzLCAweEYwLCAweDEzLCAweEE1LCAKKwkweDAyLCAweEQwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAweDAxLCAKKwkweEQwLCAweDA4LCAweEJELCAweDAwLCAweDAyLCAweDhELCAweDAwLCAweDQ0LCAKKwkweEU2LCAweDA0LCAweEFELCAweDAyLCAweDRDLCAweDg5LCAweDA4LCAweEYwLCAKKwkweDNCLCAweDg5LCAweDAyLCAweEYwLCAweDFCLCAweEFELCAweDAwLCAweDRDLCAKKwkweEQwLCAweDMyLCAweEE2LCAweDBDLCAweEE5LCAweDAxLCAweDlELCAweDAwLCAKKwkweDExLCAweEE5LCAweDAxLCAweDlELCAweDAwLCAweDBBLCAweEU4LCAweEU0LCAKKwkweDBELCAweEYwLCAweDAyLCAweDg2LCAweDBDLCAweDRDLCAweERBLCAweDNBLCAKKwkweEE2LCAweDBDLCAweEFELCAweDAwLCAweDRDLCAweDlELCAweDAwLCAweDBBLCAKKwkweDlFLCAweDAwLCAweDExLCAweEU4LCAweEU0LCAweDBELCAweEYwLCAweDAyLCAKKwkweDg2LCAweDBDLCAweDI5LCAweDdGLCAweEM5LCAweDEzLCAweEQwLCAweDA0LCAKKwkweEE1LCAweDE3LCAweDg1LCAweDBFLCAweEFELCAweDAyLCAweDRDLCAweDI5LCAKKwkweDEwLCAweEYwLCAweDJDLCAweEE2LCAweDExLCAweEYwLCAweDBGLCAweEFELCAKKwkweDAyLCAweDdDLCAweDI5LCAweDAyLCAweEQwLCAweDIxLCAweDhFLCAweDAwLCAKKwkweDRDLCAweDY0LCAweDExLCAweDRDLCAweDBELCAweDNCLCAweEE2LCAweDEwLCAKKwkweEU0LCAweDBGLCAweEYwLCAweDEzLCAweEE1LCAweDBFLCAweEQwLCAweDBGLCAKKwkweEFELCAweDAyLCAweDdDLCAweDI5LCAweDAyLCAweEQwLCAweDA4LCAweEJELCAKKwkweDAwLCAweDAzLCAweDhELCAweDAwLCAweDRDLCAweEU2LCAweDEwLCAweEFELCAKKwkweDAyLCAweDU0LCAweDg5LCAweDA4LCAweEYwLCAweDNCLCAweDg5LCAweDAyLCAKKwkweEYwLCAweDFCLCAweEFELCAweDAwLCAweDU0LCAweEQwLCAweDMyLCAweEE2LCAKKwkweDE4LCAweEE5LCAweDAxLCAweDlELCAweDAwLCAweDEyLCAweEE5LCAweDAxLCAKKwkweDlELCAweDAwLCAweDBCLCAweEU4LCAweEU0LCAweDE5LCAweEYwLCAweDAyLCAKKwkweDg2LCAweDE4LCAweDRDLCAweDRGLCAweDNCLCAweEE2LCAweDE4LCAweEFELCAKKwkweDAwLCAweDU0LCAweDlELCAweDAwLCAweDBCLCAweDlFLCAweDAwLCAweDEyLCAKKwkweEU4LCAweEU0LCAweDE5LCAweEYwLCAweDAyLCAweDg2LCAweDE4LCAweDI5LCAKKwkweDdGLCAweEM5LCAweDEzLCAweEQwLCAweDA0LCAweEE1LCAweDIzLCAweDg1LCAKKwkweDFBLCAweEFELCAweDAyLCAweDU0LCAweDI5LCAweDEwLCAweEYwLCAweDJDLCAKKwkweEE2LCAweDFELCAweEYwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAKKwkweDA0LCAweEQwLCAweDIxLCAweDhFLCAweDAwLCAweDU0LCAweDY0LCAweDFELCAKKwkweDRDLCAweDgyLCAweDNCLCAweEE2LCAweDFDLCAweEU0LCAweDFCLCAweEYwLCAKKwkweDEzLCAweEE1LCAweDFBLCAweEQwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAKKwkweDI5LCAweDA0LCAweEQwLCAweDA4LCAweEJELCAweDAwLCAweDA0LCAweDhELCAKKwkweDAwLCAweDU0LCAweEU2LCAweDFDLCAweEFELCAweDAyLCAweDVDLCAweDg5LCAKKwkweDA4LCAweEYwLCAweDNCLCAweDg5LCAweDAyLCAweEYwLCAweDFCLCAweEFELCAKKwkweDAwLCAweDVDLCAweEQwLCAweDMyLCAweEE2LCAweDI0LCAweEE5LCAweDAxLCAKKwkweDlELCAweDAwLCAweDEzLCAweEE5LCAweDAxLCAweDlELCAweDAwLCAweDBDLCAKKwkweEU4LCAweEU0LCAweDI1LCAweEYwLCAweDAyLCAweDg2LCAweDI0LCAweDRDLCAKKwkweEM0LCAweDNCLCAweEE2LCAweDI0LCAweEFELCAweDAwLCAweDVDLCAweDlELCAKKwkweDAwLCAweDBDLCAweDlFLCAweDAwLCAweDEzLCAweEU4LCAweEU0LCAweDI1LCAKKwkweEYwLCAweDAyLCAweDg2LCAweDI0LCAweDI5LCAweDdGLCAweEM5LCAweDEzLCAKKwkweEQwLCAweDA0LCAweEE1LCAweDJGLCAweDg1LCAweDI2LCAweEFELCAweDAyLCAKKwkweDVDLCAweDI5LCAweDEwLCAweEYwLCAweDJDLCAweEE2LCAweDI5LCAweEYwLCAKKwkweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAweDA4LCAweEQwLCAweDIxLCAKKwkweDhFLCAweDAwLCAweDVDLCAweDY0LCAweDI5LCAweDRDLCAweEY3LCAweDNCLCAKKwkweEE2LCAweDI4LCAweEU0LCAweDI3LCAweEYwLCAweDEzLCAweEE1LCAweDI2LCAKKwkweEQwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAweDA4LCAweEQwLCAKKwkweDA4LCAweEJELCAweDAwLCAweDA1LCAweDhELCAweDAwLCAweDVDLCAweEU2LCAKKwkweDI4LCAweEFELCAweDAyLCAweDY0LCAweDg5LCAweDA4LCAweEYwLCAweDNCLCAKKwkweDg5LCAweDAyLCAweEYwLCAweDFCLCAweEFELCAweDAwLCAweDY0LCAweEQwLCAKKwkweDMyLCAweEE2LCAweDMwLCAweEE5LCAweDAxLCAweDlELCAweDAwLCAweDE0LCAKKwkweEE5LCAweDAxLCAweDlELCAweDAwLCAweDBELCAweEU4LCAweEU0LCAweDMxLCAKKwkweEYwLCAweDAyLCAweDg2LCAweDMwLCAweDRDLCAweDM5LCAweDNDLCAweEE2LCAKKwkweDMwLCAweEFELCAweDAwLCAweDY0LCAweDlELCAweDAwLCAweDBELCAweDlFLCAKKwkweDAwLCAweDE0LCAweEU4LCAweEU0LCAweDMxLCAweEYwLCAweDAyLCAweDg2LCAKKwkweDMwLCAweDI5LCAweDdGLCAweEM5LCAweDEzLCAweEQwLCAweDA0LCAweEE1LCAKKwkweDNCLCAweDg1LCAweDMyLCAweEFELCAweDAyLCAweDY0LCAweDI5LCAweDEwLCAKKwkweEYwLCAweDJDLCAweEE2LCAweDM1LCAweEYwLCAweDBGLCAweEFELCAweDAyLCAKKwkweDdDLCAweDI5LCAweDEwLCAweEQwLCAweDIxLCAweDhFLCAweDAwLCAweDY0LCAKKwkweDY0LCAweDM1LCAweDRDLCAweDZDLCAweDNDLCAweEE2LCAweDM0LCAweEU0LCAKKwkweDMzLCAweEYwLCAweDEzLCAweEE1LCAweDMyLCAweEQwLCAweDBGLCAweEFELCAKKwkweDAyLCAweDdDLCAweDI5LCAweDEwLCAweEQwLCAweDA4LCAweEJELCAweDAwLCAKKwkweDA2LCAweDhELCAweDAwLCAweDY0LCAweEU2LCAweDM0LCAweEFELCAweDAyLCAKKwkweDZDLCAweDg5LCAweDA4LCAweEYwLCAweDNCLCAweDg5LCAweDAyLCAweEYwLCAKKwkweDFCLCAweEFELCAweDAwLCAweDZDLCAweEQwLCAweDMyLCAweEE2LCAweDNDLCAKKwkweEE5LCAweDAxLCAweDlELCAweDAwLCAweDE1LCAweEE5LCAweDAxLCAweDlELCAKKwkweDAwLCAweDBFLCAweEU4LCAweEU0LCAweDNELCAweEYwLCAweDAyLCAweDg2LCAKKwkweDNDLCAweDRDLCAweEFFLCAweDNDLCAweEE2LCAweDNDLCAweEFELCAweDAwLCAKKwkweDZDLCAweDlELCAweDAwLCAweDBFLCAweDlFLCAweDAwLCAweDE1LCAweEU4LCAKKwkweEU0LCAweDNELCAweEYwLCAweDAyLCAweDg2LCAweDNDLCAweDI5LCAweDdGLCAKKwkweEM5LCAweDEzLCAweEQwLCAweDA0LCAweEE1LCAweDQ3LCAweDg1LCAweDNFLCAKKwkweEFELCAweDAyLCAweDZDLCAweDI5LCAweDEwLCAweEYwLCAweDJDLCAweEE2LCAKKwkweDQxLCAweEYwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAweDIwLCAKKwkweEQwLCAweDIxLCAweDhFLCAweDAwLCAweDZDLCAweDY0LCAweDQxLCAweDRDLCAKKwkweEUxLCAweDNDLCAweEE2LCAweDQwLCAweEU0LCAweDNGLCAweEYwLCAweDEzLCAKKwkweEE1LCAweDNFLCAweEQwLCAweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAKKwkweDIwLCAweEQwLCAweDA4LCAweEJELCAweDAwLCAweDA3LCAweDhELCAweDAwLCAKKwkweDZDLCAweEU2LCAweDQwLCAweEFELCAweDAyLCAweDc0LCAweDg5LCAweDA4LCAKKwkweEYwLCAweDNCLCAweDg5LCAweDAyLCAweEYwLCAweDFCLCAweEFELCAweDAwLCAKKwkweDc0LCAweEQwLCAweDMyLCAweEE2LCAweDQ4LCAweEE5LCAweDAxLCAweDlELCAKKwkweDAwLCAweDE2LCAweEE5LCAweDAxLCAweDlELCAweDAwLCAweDBGLCAweEU4LCAKKwkweEU0LCAweDQ5LCAweEYwLCAweDAyLCAweDg2LCAweDQ4LCAweDRDLCAweDIzLCAKKwkweDNELCAweEE2LCAweDQ4LCAweEFELCAweDAwLCAweDc0LCAweDlELCAweDAwLCAKKwkweDBGLCAweDlFLCAweDAwLCAweDE2LCAweEU4LCAweEU0LCAweDQ5LCAweEYwLCAKKwkweDAyLCAweDg2LCAweDQ4LCAweDI5LCAweDdGLCAweEM5LCAweDEzLCAweEQwLCAKKwkweDA0LCAweEE1LCAweDUzLCAweDg1LCAweDRBLCAweEFELCAweDAyLCAweDc0LCAKKwkweDI5LCAweDEwLCAweEYwLCAweDJDLCAweEE2LCAweDRELCAweEYwLCAweDBGLCAKKwkweEFELCAweDAyLCAweDdDLCAweDI5LCAweDQwLCAweEQwLCAweDIxLCAweDhFLCAKKwkweDAwLCAweDc0LCAweDY0LCAweDRELCAweDRDLCAweDU2LCAweDNELCAweEE2LCAKKwkweDRDLCAweEU0LCAweDRCLCAweEYwLCAweDEzLCAweEE1LCAweDRBLCAweEQwLCAKKwkweDBGLCAweEFELCAweDAyLCAweDdDLCAweDI5LCAweDQwLCAweEQwLCAweDA4LCAKKwkweEJELCAweDAwLCAweDA4LCAweDhELCAweDAwLCAweDc0LCAweEU2LCAweDRDLCAKKwkweDYwLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAKKwkweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZGLCAweEZG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0IHRoZSBzYW1lIHRpbWUuCisgKiBTaW5jZSB0aGUgbG9jayB3aWxsIG9ubHkgY29tZSB1bmRlciBjb250ZW50aW9uIHdoZW4gdGhlIHN5c3RlbSBpcworICogc3dhcHBpbmcgYW5kIGF2YWlsYWJsZSBtZW1vcnkgaXMgbG93LCBpdCBtYWtlcyBzZW5zZSB0byBzaGFyZSBvbmUKKyAqIGJ1ZmZlciBhY3Jvc3MgYWxsIHRoZSBzZXJpYWwgcG9ydHMsIHNpbmNlIGl0IHNpZ25pZmljYW50bHkgc2F2ZXMKKyAqIG1lbW9yeSBpZiBsYXJnZSBudW1iZXJzIG9mIHNlcmlhbCBwb3J0cyBhcmUgb3Blbi4KKyAqLworc3RhdGljIHVuc2lnbmVkIGNoYXIgKnRtcF9idWYgPSAwOworREVDTEFSRV9NVVRFWCh0bXBfYnVmX3NlbSk7CisKKy8qCisgKiBUaGlzIGlzIHVzZWQgdG8gbG9vayB1cCB0aGUgZGl2aXNvciBzcGVlZHMgYW5kIHRoZSB0aW1lb3V0cworICogV2UncmUgbm9ybWFsbHkgbGltaXRlZCB0byAxNSBkaXN0aW5jdCBiYXVkIHJhdGVzLiAgVGhlIGV4dHJhCisgKiBhcmUgYWNjZXNzZWQgdmlhIHNldHRpbmdzIGluIGluZm8tPmZsYWdzLgorICogICAgICAgICAwLCAgICAgMSwgICAgIDIsICAgICAzLCAgICAgNCwgICAgIDUsICAgICA2LCAgICAgNywgICAgIDgsICAgICA5LAorICogICAgICAgIDEwLCAgICAxMSwgICAgMTIsICAgIDEzLCAgICAxNCwgICAgMTUsICAgIDE2LCAgICAxNywgICAgMTgsICAgIDE5LAorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhJICAgICAgICAgICAgVkhJCisgKi8KK3N0YXRpYyBpbnQgYmF1ZF90YWJsZVtdID0geworICAgICAgICAgICAwLCAgICA1MCwgICAgNzUsICAgMTEwLCAgIDEzNCwgICAxNTAsICAgMjAw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ggb3V0Y2ggKXsKKwkgICAgaW5mby0+eG1pdF9jbnQtLTsKKwkgICAgaW5mby0+eG1pdF90YWlsID0gKGluZm8tPnhtaXRfdGFpbCArIDEpCisJCQkJICAgICAgJiAoUEFHRV9TSVpFIC0gMSk7CisJICAgIGJhc2VfYWRkcltDeVREUl0gPSBvdXRjaDsKKwkgICAgY2hhcl9jb3VudC0tOworCX1lbHNleworCSAgICBpZihjaGFyX2NvdW50ID4gMSl7CisJCWluZm8tPnhtaXRfY250LS07CisJCWluZm8tPnhtaXRfdGFpbCA9IChpbmZvLT54bWl0X3RhaWwgKyAxKQorCQkJCQkgICYgKFBBR0VfU0laRSAtIDEpOworCQliYXNlX2FkZHJbQ3lURFJdID0gb3V0Y2g7CisJCWJhc2VfYWRkcltDeVREUl0gPSAwOworCQljaGFyX2NvdW50LS07CisJCWNoYXJfY291bnQtLTsKKwkgICAgfWVsc2V7CisJCWJyZWFrOworCSAgICB9CisJfQorICAgIH0KKworICAgIGlmIChpbmZvLT54bWl0X2NudCA8IFdBS0VVUF9DSEFSUykgeworCWN5X3NjaGVkX2V2ZW50KGluZm8sIEN5X0VWRU5UX1dSSVRFX1dBS0VVUCk7CisgICAgfQorICAgIGJhc2VfYWRkcltDeVRFT0lSXSA9IChjaGFyX2NvdW50ICE9IHNhdmVkX2NudCkgPyAwIDogQ3lOT1RSQU5TOworICAgIHJldHVybiBJUlFfSEFORExFRDsKK30gLyogY3lfdHhfaW50ZXJydXB0ICovCisKK3N0YXRpYyBpcnFyZXR1cm5fdAorY2QyNDAxX3J4X2ludGVycnVwdChpbnQgaXJxLCB2b2lkICpkZXZfaWQsIHN0cnVjdCBwdF9yZWdzICpmcCkKK3sKKyAgICBzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5OworICAgIHN0cnVjdCBjeWNsYWRlc19wb3J0ICppbmZvOworICAgIHZvbGF0aWxlIHVuc2lnbmVkIGNoYXIgKmJhc2VfYWRkciA9ICh1bnNpZ25lZCBjaGFyICopQkF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V0dXJuIDA7CisgICAgfQorCQorICAgIGlmICghdHR5IHx8ICFpbmZvLT54bWl0X2J1ZiB8fCAhdG1wX2J1Zil7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHdoaWxlICgxKSB7CisJICAgIGxvY2FsX2lycV9zYXZlKGZsYWdzKTsKKwkgICAgYyA9IG1pbl90KGludCwgY291bnQsIG1pbihTRVJJQUxfWE1JVF9TSVpFIC0gaW5mby0+eG1pdF9jbnQgLSAxLAorCQkJCSAgICAgIFNFUklBTF9YTUlUX1NJWkUgLSBpbmZvLT54bWl0X2hlYWQpKTsKKwkgICAgaWYgKGMgPD0gMCkgeworCQkgICAgbG9jYWxfaXJxX3Jlc3RvcmUoZmxhZ3MpOworCQkgICAgYnJlYWs7CisJICAgIH0KKworCSAgICBtZW1jcHkoaW5mby0+eG1pdF9idWYgKyBpbmZvLT54bWl0X2hlYWQsIGJ1ZiwgYyk7CisJICAgIGluZm8tPnhtaXRfaGVhZCA9IChpbmZvLT54bWl0X2hlYWQgKyBjKSAmIChTRVJJQUxfWE1JVF9TSVpFLTEpOworCSAgICBpbmZvLT54bWl0X2NudCArPSBjOworCSAgICBsb2NhbF9pcnFfcmVzdG9yZShmbGFncyk7CisKKwkgICAgYnVmICs9IGM7CisJICAgIGNvdW50IC09IGM7CisJICAgIHRvdGFsICs9IGM7CisgICAgfQorCisgICAgaWYgKGluZm8tPnhtaXRfY250CisgICAgJiYgIXR0eS0+c3RvcHBlZAorICAgICYmICF0dHktPmh3X3N0b3BwZWQgKSB7CisgICAgICAgIHN0YXJ0X3htaXQoaW5mbyk7CisgICAgfQorICAgIHJldHVybiB0b3RhbDsKK30gLyogY3lfd3JpdGUgKi8KKworCitzdGF0aWMgaW50CitjeV93cml0ZV9yb29tKHN0cnVjdCB0dHlfc3RydWN0ICp0dHkpCit7CisgIHN0cnVjdCBjeWNsYWRlc19wb3J0ICppbmZvID0gKHN0cnVjdCBjeWNsYWRlc19wb3J0ICopdHR5LT5kcml2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WwgPSBpbmZvLT5saW5lOworCisgICB0bXAgPSBiYXNlX2FkZHJbQ3lDT1I0XSAmIEN5UkVDX0ZJRk87CisgICByZXR1cm4gcHV0X3VzZXIodG1wLHZhbHVlKTsKK30KKworc3RhdGljIGludAorc2V0X2RlZmF1bHRfdGhyZXNob2xkKHN0cnVjdCBjeWNsYWRlc19wb3J0ICogaW5mbywgdW5zaWduZWQgbG9uZyAqYXJnKQoreworICAgdW5zaWduZWQgbG9uZyB2YWx1ZTsKKworICAgaWYgKGdldF91c2VyKHZhbHVlLCBhcmcpKQorCXJldHVybiAtRUZBVUxUOworCisgICBpbmZvLT5kZWZhdWx0X3RocmVzaG9sZCA9IHZhbHVlICYgMHgwZjsKKyAgIHJldHVybiAwOworfQorCitzdGF0aWMgaW50CitnZXRfZGVmYXVsdF90aHJlc2hvbGQoc3RydWN0IGN5Y2xhZGVzX3BvcnQgKiBpbmZvLCB1bnNpZ25lZCBsb25nICp2YWx1ZSkKK3sKKyAgIHJldHVybiBwdXRfdXNlcihpbmZvLT5kZWZhdWx0X3RocmVzaG9sZCx2YWx1ZSk7Cit9CisKK3N0YXRpYyBpbnQKK3NldF90aW1lb3V0KHN0cnVjdCBjeWNsYWRlc19wb3J0ICogaW5mbywgdW5zaWduZWQgbG9uZyAqYXJnKQoreworICAgdm9sYXRpbGUgdW5zaWduZWQgY2hhciAqYmFzZV9hZGRyID0gKHVfY2hhciAqKUJBU0VfQUREUjsKKyAgIGludCBjaGFubmVsOworICAgdW5zaWduZWQgbG9uZyB2YWx1ZTsKKworICAgaWYgKGdldF91c2VyKHZhbHVlLCBhcmcpKQorCSAgIHJldHVybiAtRUZBVUxUOworICAgCisgICBjaGFubmVsID0gaW5mby0+bGluZTsKKworICAgYmFzZV9hZGRyW0N5UlRQUkxdID0gdmFsdWUgJiAweGZmOworICAgYmFzZV9hZGRyW0N5UlRQUkhdID0gKHZhbHVlID4+IDgpICYgMHhmZjsKKyAgIHJldHVybiAwOworfQorCitzdGF0aWMg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pbnRrKCJjeV9pb2N0bCAlcywgY21kID0gJXggYXJnID0gJWx4XG4iLCB0dHktPm5hbWUsIGNtZCwgYXJnKTsgLyogKi8KKyNlbmRpZgorCisgICAgc3dpdGNoIChjbWQpIHsKKyAgICAgICAgY2FzZSBDWUdFVE1PTjoKKyAgICAgICAgICAgIHJldF92YWwgPSBnZXRfbW9uX2luZm8oaW5mbywgKHN0cnVjdCBjeWNsYWRlc19tb25pdG9yICopYXJnKTsKKwkgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQ1lHRVRUSFJFU0g6CisJICAgIHJldF92YWwgPSBnZXRfdGhyZXNob2xkKGluZm8sICh1bnNpZ25lZCBsb25nICopYXJnKTsKKyAJICAgIGJyZWFrOworICAgICAgICBjYXNlIENZU0VUVEhSRVNIOgorICAgICAgICAgICAgcmV0X3ZhbCA9IHNldF90aHJlc2hvbGQoaW5mbywgKHVuc2lnbmVkIGxvbmcgKilhcmcpOworCSAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWUdFVERFRlRIUkVTSDoKKwkgICAgcmV0X3ZhbCA9IGdldF9kZWZhdWx0X3RocmVzaG9sZChpbmZvLCAodW5zaWduZWQgbG9uZyAqKWFyZyk7CisgCSAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWVNFVERFRlRIUkVTSDoKKyAgICAgICAgICAgIHJldF92YWwgPSBzZXRfZGVmYXVsdF90aHJlc2hvbGQoaW5mbywgKHVuc2lnbmVkIGxvbmcgKilhcmcpOworCSAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWUdFVFRJTUVPVVQ6CisJICAgIHJldF92YWwgPSBnZXRfdGltZW91dChpbmZvLCAodW5zaWduZWQgbG9uZyAqKWFyZyk7CisgCSAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWVNFVFRJTUVPVVQ6CisgICAgICAgICAgICByZXRfdmFsID0gc2V0X3RpbWVvdXQoaW5mbywgKHVuc2lnbmVkIGxvbmcgKilhcmcpOworCSAgICBicmVhazsKKyAgICAgICAgY2FzZSBDWUdFVERFRlRJTUVPVVQ6CisJICAgIHJldF92YWwgPSBnZXRfZGVmYXVsdF90aW1lb3V0KGluZm8sICh1bnNpZ25lZCBsb25nICopYXJnKTsKKyAJICAgIGJyZWFrOworICAgICAgICBjYXNlIENZU0VUREVGVElNRU9VVDoKKyAgICAgICAgICAgIHJldF92YWwgPSBzZXRfZGVmYXVsdF90aW1lb3V0KGluZm8sICh1bnNpZ25lZCBsb25nKWFyZyk7CisJICAgIGJyZWFrOworICAgICAgICBjYXNlIFRDU0JSSzogICAgLyogU1ZJRCB2ZXJzaW9uOiBub24temVybyBhcmcgLS0+IG5vIGJyZWFrICovCisJICAgIHJldF92YWwgPSB0dHlfY2hlY2tfY2hhbmdlKHR0eSk7CisJICAgIGlmIChyZXRfdmFsKQorCQkgICAgYnJlYWs7CisgICAgICAgICAgICB0dHlfd2FpdF91bnRpbF9zZW50KHR0eSwwKTsKKyAgICAgICAgICAgIGlmICghYXJnKQorICAgICAgICAgICAgICAgIHNlbmRfYnJlYWsoaW5mbywgSFovNCk7IC8qIDEvNCBzZWNvbmQgKi8KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIFRDU0JSS1A6ICAgLyogc3VwcG9ydCBmb3IgUE9TSVggdGNzZW5kYnJlYWsoKSAqLworCSAgICByZXRfdmFsID0gdHR5X2NoZWNrX2NoYW5nZSh0dHkpOworCSAgICBpZiAocmV0X3ZhbCkKKwkJYnJlYWs7CisgICAgICAgICAgICB0dHlfd2FpdF91bnRpbF9zZW50KHR0eSwwKTsKKyAgICAgICAgICAgIHNlbmRfYnJlYWsoaW5mbywgYXJnID8gYXJnKihIWi8xMCkgOiBIWi80KTsKKyAgICAgICAgICAgIGJyZWFrOworCisvKiBUaGUgZm9sbG93aW5nIGNvbW1hbmRzIGFyZSBpbmNvbXBsZXRlbHkgaW1wbGVtZW50ZWQhISEgKi8KKyAgICAgICAgY2FzZSBUSU9DR1NPRlRDQVI6CisgICAgICAgICAgICByZXRfdmFsID0gcHV0X3VzZXIoQ19DTE9DQUwodHR5KSA/IDEgOiAwLCAodW5zaWduZWQgbG9uZyAqKSBhcmcpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgVElPQ1NTT0ZUQ0FSOgorICAgICAgICAgICAgcmV0X3ZhbCA9IGdldF91c2VyKHZhbCwgKHVuc2lnbmVkIGxvbmcgKikgYXJnKTsKKwkgICAgaWYgKHJldF92YWwpCisJCSAgICBicmVhazsKKyAgICAgICAgICAgIHR0eS0+dGVybWlvcy0+Y19jZmxhZyA9CisgICAgICAgICAgICAgICAgICAgICgodHR5LT50ZXJtaW9zLT5jX2NmbGFnICYgfkNMT0NBTCkgfCAodmFsID8gQ0xPQ0FMIDogMCkpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgVElPQ0dTRVJJQUw6CisgICAgICAgICAgICByZXRfdmFsID0gZ2V0X3NlcmlhbF9pbmZvKGluZm8sIChzdHJ1Y3Qgc2VyaWFsX3N0cnVjdCAqKSBhcmcpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgVElPQ1NTRVJJQUw6CisgICAgICAgICAgICByZXRfdmFsID0gc2V0X3NlcmlhbF9pbmZvKGluZm8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzdHJ1Y3Qgc2VyaWFsX3N0cnVjdCAqKSBhcmcpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisJICAgIHJldF92YWwgPSAtRU5PSU9DVExDTUQ7CisgICAgfQorCisjaWZkZWYgU0VSSUFMX0RFQlVHX09USEVSCisgICAgcHJpbnRrKCJjeV9pb2N0bCBkb25lXG4iKTsKKyNlbmRpZgorCisgICAgcmV0dXJuIHJldF92YWw7Cit9IC8qIGN5X2lvY3RsICovCisKKworCisKK3N0YXRpYyB2b2lkCitjeV9zZXRfdGVybWlvcyhzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5LCBz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mNyZW1lbnRpbmcgY291bnQgdG8gJWRcbiIsIF9fTElORV9fLCBpbmZvLT5jb3VudCk7CisjZW5kaWYKKyAgICB0dHktPmRyaXZlcl9kYXRhID0gaW5mbzsKKyAgICBpbmZvLT50dHkgPSB0dHk7CisKKyAgICBpZiAoIXRtcF9idWYpIHsKKwl0bXBfYnVmID0gKHVuc2lnbmVkIGNoYXIgKikgZ2V0X3plcm9lZF9wYWdlKEdGUF9LRVJORUwpOworCWlmICghdG1wX2J1Zil7CisJICAgIHJldHVybiAtRU5PTUVNOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBTdGFydCB1cCBzZXJpYWwgcG9ydAorICAgICAqLworICAgIHJldHZhbCA9IHN0YXJ0dXAoaW5mbyk7CisgICAgaWYgKHJldHZhbCl7CisJcmV0dXJuIHJldHZhbDsKKyAgICB9CisKKyAgICByZXR2YWwgPSBibG9ja190aWxfcmVhZHkodHR5LCBmaWxwLCBpbmZvKTsKKyAgICBpZiAocmV0dmFsKSB7CisjaWZkZWYgU0VSSUFMX0RFQlVHX09QRU4KKwlwcmludGsoImN5X29wZW4gcmV0dXJuaW5nIGFmdGVyIGJsb2NrX3RpbF9yZWFkeSB3aXRoICVkXG4iLAorCSAgICAgICByZXR2YWwpOworI2VuZGlmCisJcmV0dXJuIHJldHZhbDsKKyAgICB9CisKKyNpZmRlZiBTRVJJQUxfREVCVUdfT1BFTgorICAgIHByaW50aygiY3lfb3BlbiBkb25lXG4iKTsvKiovCisjZW5kaWYKKyAgICByZXR1cm4gMDsKK30gLyogY3lfb3BlbiAqLworCisKKworLyoKKyAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICogc2VyaWFsMTY3X2luaXQoKSBhbmQgZnJpZW5kcworICoKKyAqIHNlcmlhbDE2N19pbml0KCkgaXMgY2FsbGVkIGF0IGJvb3QtdGltZSB0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YWRkcltDeUNDUl0gIT0gMHgwMCl7CisgICAgICAgICAgICBsb2NhbF9pcnFfcmVzdG9yZShmbGFncyk7CisgICAgICAgICAgICAvKiBwcmludGsoIiBjaGlwIGlzIG5ldmVyIGlkbGUgKENDUiAhPSAwKVxuIik7ICovCisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBiYXNlX2FkZHJbQ3lDQ1JdID0gQ3lDSElQX1JFU0VUOwkvKiBSZXNldCB0aGUgY2hpcCAqLworICAgICAgICBteV91ZGVsYXkoMTAwMEwpOworCisgICAgICAgIGlmKGJhc2VfYWRkcltDeUdGUkNSXSA9PSAweDAwKXsKKyAgICAgICAgICAgIGxvY2FsX2lycV9yZXN0b3JlKGZsYWdzKTsKKyAgICAgICAgICAgIC8qIHByaW50aygiIGNoaXAgaXMgbm90IHJlc3BvbmRpbmcgKEdGUkNSIHN0YXllZCAwKVxuIik7ICovCisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworCS8qCisJICogU3lzdGVtIGNsb2NrIGlzIDIwTWh6LCBkaXZpZGVkIGJ5IDIwNDgsIHNvIGRpdmlkZSBieSAxMCBmb3IgYSAxLjBtcworCSAqIHRpY2sKKwkgKi8KKworCWJhc2VfYWRkcltDeVRQUl0gPSAxMDsKKworCWJhc2VfYWRkcltDeVBJTFIxXSA9IDB4MDE7ICAgIC8qIEludGVycnVwdCBsZXZlbCBmb3IgbW9kZW0gY2hhbmdlICovCisJYmFzZV9hZGRyW0N5UElMUjJdID0gMHgwMjsgICAgLyogSW50ZXJydXB0IGxldmVsIGZvciB0eCBpbnRzICovCisJYmFzZV9hZGRyW0N5UElMUjNdID0gMHgwMzsgICAgLyogSW50ZXJydXB0IGxldmVsIGZvciByeCBpbnRzICovCisKKwkvKgorCSAqIEF0dGVtcHQgdG8gc2V0IHVwIGFsbCBjaGFubmVscyB0byBzb21ldGhpbmcgcmVhc29uYWJsZSwgYW5kCisJICogYmFuZyBvdXQgYSBJTklUX0NI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5jbG9zZV93YWl0KTsKKwkJLyogaW5mby0+c2Vzc2lvbiAqLworCQkvKiBpbmZvLT5wZ3JwICovCisvKioqICEhISEhISEhIHRoaXMgbWF5IGV4cG9zZSBuZXcgYnVncyAhISEhISEhISEgKioqKioqKioqLworCQlpbmZvLT5yZWFkX3N0YXR1c19tYXNrID0gQ3lUSU1FT1VUfCBDeVNQRUNIQVJ8IEN5QlJFQUsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgQ3lQQVJJVFl8IEN5RlJBTUV8IEN5T1ZFUlJVTjsKKwkJLyogaW5mby0+dGltZW91dCAqLworCisJCXByaW50aygidHR5UyVkICIsIGluZm8tPmxpbmUpOworCQlwb3J0X251bSsrO2luZm8rKzsKKwkJaWYoIShwb3J0X251bSAmIDcpKXsKKwkJICAgIHByaW50aygiXG4gICAgICAgICAgICAgICAiKTsKKwkJfQorCSAgICB9CisJfQorCXByaW50aygiXG4iKTsKKyAgICB9CisgICAgd2hpbGUoIHBvcnRfbnVtIDwgTlJfUE9SVFMpeworCWluZm8tPmxpbmUgPSAtMTsKKwlwb3J0X251bSsrO2luZm8rKzsKKyAgICB9CisjaWZkZWYgQ09ORklHX1JFTU9URV9ERUJVRworICAgIGRlYnVnX3NldHVwKCk7CisjZW5kaWYKKyAgICByZXQgPSByZXF1ZXN0X2lycShNVk1FMTY3X0lSUV9TRVJfRVJSLCBjZDI0MDFfcnhlcnJfaW50ZXJydXB0LCAwLAorCQkJCSJjZDI0MDFfZXJyb3JzIiwgY2QyNDAxX3J4ZXJyX2ludGVycnVwdCk7CisgICAgaWYgKHJldCkgeworCSAgICBwcmludGsoS0VSTl9FUlIgIkNvdWxkJ3QgZ2V0IGNkMjQwMV9lcnJvcnMgSVJRIik7CisJICAgIGdvdG8gY2xlYW51cF9zZXJpYWxfZHJpdmVyOworICAgIH0KKworICAgIHJldCA9IHJlcXVlc3RfaXJxKE1WTUUxNjdfSVJRX1NFUl9NT0RFTSwgY2QyND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25nIGZsYWdzOworCisgICAgaW5mbyA9ICZjeV9wb3J0W2xpbmVfbnVtXTsKKyAgICBjaGFubmVsID0gaW5mby0+bGluZTsKKyAgICBwcmludGsoIiAgY2hhbm5lbCAlZFxuIiwgY2hhbm5lbCk7LyoqLworCisgICAgcHJpbnRrKCIgY3lfcG9ydFxuIik7CisgICAgcHJpbnRrKCIgIGNhcmQgbGluZSBmbGFncyA9ICVkICVkICV4XG4iLAorICAgICAgICAgICAgICAgICBpbmZvLT5jYXJkLCBpbmZvLT5saW5lLCBpbmZvLT5mbGFncyk7CisgICAgcHJpbnRrKCIgICp0dHkgcmVhZF9zdGF0dXNfbWFzayB0aW1lb3V0IHhtaXRfZmlmb19zaXplID0gJWx4ICV4ICV4ICV4XG4iLAorICAgICAgICAgICAgICAgICAobG9uZylpbmZvLT50dHksIGluZm8tPnJlYWRfc3RhdHVzX21hc2ssCisgICAgICAgICAgICAgICAgIGluZm8tPnRpbWVvdXQsIGluZm8tPnhtaXRfZmlmb19zaXplKTsKKyAgICBwcmludGsoIiAgY29yMSxjb3IyLGNvcjMsY29yNCxjb3I1LGNvcjYsY29yNyA9ICV4ICV4ICV4ICV4ICV4ICV4ICV4XG4iLAorICAgICAgICAgICAgIGluZm8tPmNvcjEsIGluZm8tPmNvcjIsIGluZm8tPmNvcjMsIGluZm8tPmNvcjQsIGluZm8tPmNvcjUsCisJCQlpbmZvLT5jb3I2LCBpbmZvLT5jb3I3KTsKKyAgICBwcmludGsoIiAgdGJwcix0Y28scmJwcixyY28gPSAlZCAlZCAlZCAlZFxuIiwKKyAgICAgICAgICAgICBpbmZvLT50YnByLCBpbmZvLT50Y28sIGluZm8tPnJicHIsIGluZm8tPnJjbyk7CisgICAgcHJpbnRrKCIgIGNsb3NlX2RlbGF5IGV2ZW50IGNvdW50ID0gJWQgJWQgJWRcbiIsCisgICAgICAgICAgICAgaW5mby0+Y2xvc2VfZGVsYXksIGluZm8tPmV2ZW50LCBpbmZvLT5jb3VudCk7CisgICA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XR1cm4gKGMpOworfQorCit2b2lkIHF1ZXVlRGVidWdDaGFyIChpbnQgYykKK3sKKwlpbnQgaTsKKworCWkgPSBkZWJ1Z2lxLmluOworCWRlYnVnaXEuYnVmW2ldID0gYzsKKwlpZiAoKytpID09IERFQlVHX0xFTikKKwkJaSA9IDA7CisJaWYgKGkgIT0gZGVidWdpcS5vdXQpCisJCWRlYnVnaXEuaW4gPSBpOworfQorCitzdGF0aWMgdm9pZAorZGVidWdfc2V0dXAoKQoreworICB1bnNpZ25lZCBsb25nIGZsYWdzOworICB2b2xhdGlsZSB1bnNpZ25lZCBjaGFyICpiYXNlX2FkZHIgPSAodV9jaGFyICopQkFTRV9BRERSOworICBpbnQgICBpLCBjZmxhZzsKKworICAgIGNmbGFnID0gQjE5MjAwOworCisgICAgbG9jYWxfaXJxX3NhdmUoZmxhZ3MpOworCisgICAgZm9yIChpID0gMDsgaSA8IDQ7IGkrKykKKyAgICB7CisJYmFzZV9hZGRyW0N5Q0FSXSA9IGk7CisJYmFzZV9hZGRyW0N5TElDUl0gPSBpIDw8IDI7CisgICAgfQorCisgICAgZGVidWdpcS5pbiA9IGRlYnVnaXEub3V0ID0gMDsKKworICAgIGJhc2VfYWRkcltDeUNBUl0gPSBERUJVR19QT1JUOworCisgICAgLyogYmF1ZCByYXRlICovCisgICAgaSA9IGNmbGFnICYgQ0JBVUQ7CisKKyAgICBiYXNlX2FkZHJbQ3lJRVJdID0gMDsKKworICAgIGJhc2VfYWRkcltDeUNNUl0gPSBDeUFTWU5DOworICAgIGJhc2VfYWRkcltDeUxJQ1JdID0gREVCVUdfUE9SVCA8PCAyOworICAgIGJhc2VfYWRkcltDeUxJVlJdID0gMHg1YzsKKworICAgIC8qIHR4IGFuZCByeCBiYXVkIHJhdGUgKi8KKworICAgIGJhc2VfYWRkcltDeVRDT1JdID0gYmF1ZF9jb1tpXTsKKyAgICBiYXNlX2FkZHJbQ3lUQlBSXSA9IGJhdWRfYnByW2ldOworICAgIGJhc2VfYWR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AwLCAwIH0KK307CisKKy8qIFRoZSBzZXQgb2YgcG9zc2libGUgaGVscCBidXR0b24gZXZlbnRzICovCitzdGF0aWMgc3RydWN0IHNvbnlwaV9ldmVudCBzb255cGlfaGVscGV2W10gPSB7CisJeyAweDNiLCBTT05ZUElfRVZFTlRfSEVMUF9QUkVTU0VEIH0sCisJeyAwLCAwIH0KK307CisKKworLyogVGhlIHNldCBvZiBwb3NzaWJsZSBsaWQgZXZlbnRzICovCitzdGF0aWMgc3RydWN0IHNvbnlwaV9ldmVudCBzb255cGlfbGlkZXZbXSA9IHsKKwl7IDB4NTEsIFNPTllQSV9FVkVOVF9MSURfQ0xPU0VEIH0sCisJeyAweDUwLCBTT05ZUElfRVZFTlRfTElEX09QRU5FRCB9LAorCXsgMCwgMCB9Cit9OworCisvKiBUaGUgc2V0IG9mIHBvc3NpYmxlIHpvb20gZXZlbnRzICovCitzdGF0aWMgc3RydWN0IHNvbnlwaV9ldmVudCBzb255cGlfem9vbWV2W10gPSB7CisJeyAweDM5LCBTT05ZUElfRVZFTlRfWk9PTV9QUkVTU0VEIH0sCisJeyAwLCAwIH0KK307CisKKy8qIFRoZSBzZXQgb2YgcG9zc2libGUgdGh1bWJwaHJhc2UgZXZlbnRzICovCitzdGF0aWMgc3RydWN0IHNvbnlwaV9ldmVudCBzb255cGlfdGh1bWJwaHJhc2VldltdID0geworCXsgMHgzYSwgU09OWVBJX0VWRU5UX1RIVU1CUEhSQVNFX1BSRVNTRUQgfSwKKwl7IDAsIDAgfQorfTsKKworLyogVGhlIHNldCBvZiBwb3NzaWJsZSBtb3Rpb25leWUgY2FtZXJhIGV2ZW50cyAqLworc3RhdGljIHN0cnVjdCBzb255cGlfZXZlbnQgc29ueXBpX21leWVldltdID0geworCXsgMHgwMCwgU09OWVBJX0VWRU5UX01FWUVfRkFDRSB9LAorCXsgMHgwMSwgU09OWVBJX0VWRU5UX01FWUVfT1BQT1NJVEUgfSwKKwl7IDAsIDAgfQorfTsKKworLyogVGhlI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LCBzb255cGlfZm5rZXlldiB9LAorCXsgU09OWVBJX0RFVklDRV9NT0RFTF9UWVBFMiwgMHgzMSwgU09OWVBJX0JMVUVUT09USF9NQVNLLCBzb255cGlfYmx1ZWV2IH0sCisJeyBTT05ZUElfREVWSUNFX01PREVMX1RZUEUyLCAweDA4LCBTT05ZUElfUEtFWV9NQVNLLCBzb255cGlfcGtleWV2IH0sCisJeyBTT05ZUElfREVWSUNFX01PREVMX1RZUEUyLCAweDExLCBTT05ZUElfQkFDS19NQVNLLCBzb255cGlfYmFja2V2IH0sCisJeyBTT05ZUElfREVWSUNFX01PREVMX1RZUEUyLCAweDA4LCBTT05ZUElfSEVMUF9NQVNLLCBzb255cGlfaGVscGV2IH0sCisJeyBTT05ZUElfREVWSUNFX01PREVMX1RZUEUyLCAweDIxLCBTT05ZUElfSEVMUF9NQVNLLCBzb255cGlfaGVscGV2IH0sCisJeyBTT05ZUElfREVWSUNFX01PREVMX1RZUEUyLCAweDIxLCBTT05ZUElfWk9PTV9NQVNLLCBzb255cGlfem9vbWV2IH0sCisJeyBTT05ZUElfREVWSUNFX01PREVMX1RZUEUyLCAweDIwLCBTT05ZUElfVEhVTUJQSFJBU0VfTUFTSywgc29ueXBpX3RodW1icGhyYXNlZXYgfSwKKwl7IFNPTllQSV9ERVZJQ0VfTU9ERUxfVFlQRTIsIDB4MzEsIFNPTllQSV9NRU1PUllTVElDS19NQVNLLCBzb255cGlfbWVtb3J5c3RpY2tldiB9LAorCXsgU09OWVBJX0RFVklDRV9NT0RFTF9UWVBFMiwgMHg0MSwgU09OWVBJX0JBVFRFUllfTUFTSywgc29ueXBpX2JhdHRlcnlldiB9LAorCXsgU09OWVBJX0RFVklDRV9NT0RFTF9UWVBFMiwgMHgzMSwgU09OWVBJX1BLRVlfTUFTSywgc29ueXBpX3BrZXlldiB9LAorCisJeyAwIH0KK307CisKKyNkZWZpbmUgU09OWVBJX0JVRl9TSVpFCTEyOAorCisvKiBUaGUgbmFtZSBvZiB0aGU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GUgYmx1ZXRvb3RoIHN1YnN5c3RlbSBwb3dlciBzdGF0ZSAqLworc3RhdGljIHZvaWQgc29ueXBpX3NldGJsdWV0b290aHBvd2VyKHU4IHN0YXRlKQoreworCXN0YXRlID0gISFzdGF0ZTsKKworCWlmIChzb255cGlfZGV2aWNlLmJsdWV0b290aF9wb3dlciA9PSBzdGF0ZSkKKwkJcmV0dXJuOworCisJc29ueXBpX2NhbGwyKDB4OTYsIHN0YXRlKTsKKwlzb255cGlfY2FsbDEoMHg4Mik7CisJc29ueXBpX2RldmljZS5ibHVldG9vdGhfcG93ZXIgPSBzdGF0ZTsKK30KKworc3RhdGljIHZvaWQgaW5wdXRfa2V5cmVsZWFzZSh2b2lkICpkYXRhKQoreworCXN0cnVjdCBpbnB1dF9kZXYgKmlucHV0X2RldjsKKwlpbnQga2V5OworCisJd2hpbGUgKDEpIHsKKwkJaWYgKGtmaWZvX2dldChzb255cGlfZGV2aWNlLmlucHV0X2ZpZm8sCisJCQkgICAgICAodW5zaWduZWQgY2hhciAqKSZpbnB1dF9kZXYsCisJCQkgICAgICBzaXplb2YoaW5wdXRfZGV2KSkgIT0gc2l6ZW9mKGlucHV0X2RldikpCisJCQlyZXR1cm47CisJCWlmIChrZmlmb19nZXQoc29ueXBpX2RldmljZS5pbnB1dF9maWZvLAorCQkJICAgICAgKHVuc2lnbmVkIGNoYXIgKikma2V5LAorCQkJICAgICAgc2l6ZW9mKGtleSkpICE9IHNpemVvZihrZXkpKQorCQkJcmV0dXJuOworCisJCW1zbGVlcCgxMCk7CisJCWlucHV0X3JlcG9ydF9rZXkoaW5wdXRfZGV2LCBrZXksIDApOworCQlpbnB1dF9zeW5jKGlucHV0X2Rldik7CisJfQorfQorCisvKiBJbnRlcnJ1cHQgaGFuZGxlcjogc29tZSBldmVudCBpcyBhdmFpbGFibGUgKi8KK3N0YXRpYyBpcnFyZXR1cm5fdCBzb255cGlfaXJxKGludCBpcnEsIHZvaWQgKmRldl9pZCwgc3RydWN0IHB0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Cit7CisJc29ueXBpX21pc2NfZmFzeW5jKC0xLCBmaWxlLCAwKTsKKwlkb3duKCZzb255cGlfZGV2aWNlLmxvY2spOworCXNvbnlwaV9kZXZpY2Uub3Blbl9jb3VudC0tOworCXVwKCZzb255cGlfZGV2aWNlLmxvY2spOworCXJldHVybiAwOworfQorCitzdGF0aWMgaW50IHNvbnlwaV9taXNjX29wZW4oc3RydWN0IGlub2RlICppbm9kZSwgc3RydWN0IGZpbGUgKmZpbGUpCit7CisJZG93bigmc29ueXBpX2RldmljZS5sb2NrKTsKKwkvKiBGbHVzaCBpbnB1dCBxdWV1ZSBvbiBmaXJzdCBvcGVuICovCisJaWYgKCFzb255cGlfZGV2aWNlLm9wZW5fY291bnQpCisJCWtmaWZvX3Jlc2V0KHNvbnlwaV9kZXZpY2UuZmlmbyk7CisJc29ueXBpX2RldmljZS5vcGVuX2NvdW50Kys7CisJdXAoJnNvbnlwaV9kZXZpY2UubG9jayk7CisJcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBzc2l6ZV90IHNvbnlwaV9taXNjX3JlYWQoc3RydWN0IGZpbGUgKmZpbGUsIGNoYXIgX191c2VyICpidWYsCisJCQkJc2l6ZV90IGNvdW50LCBsb2ZmX3QgKnBvcykKK3sKKwlzc2l6ZV90IHJldDsKKwl1bnNpZ25lZCBjaGFyIGM7CisKKwlpZiAoKGtmaWZvX2xlbihzb255cGlfZGV2aWNlLmZpZm8pID09IDApICYmCisJICAgIChmaWxlLT5mX2ZsYWdzICYgT19OT05CTE9DSykpCisJCXJldHVybiAtRUFHQUlOOworCisJcmV0ID0gd2FpdF9ldmVudF9pbnRlcnJ1cHRpYmxlKHNvbnlwaV9kZXZpY2UuZmlmb19wcm9jX2xpc3QsCisJCQkJICAgICAgIGtmaWZvX2xlbihzb255cGlfZGV2aWNlLmZpZm8pICE9IDApOworCWlmIChyZXQpCisJCXJldHVybiByZXQ7CisKKwl3aGlsZSAocmV0IDwgY291bnQgJiYKKwkgICAgICAgKGtma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iAiQ2Fubm90IHNldCBpcnEgdG8gJWQuXG4iLCBicC0+aXJxKTsKKwkJcnYgPSAwOworCX0KKworCWZ1bmNfZXhpdCgpOworCXJldHVybiBydjsKK30KKworCitzdGF0aWMgaW50IHJlYWRfY3Jvc3NfYnl0ZSAoc3RydWN0IHNwZWNpYWxpeF9ib2FyZCAqYnAsIGludCByZWcsIGludCBiaXQpCit7CisJaW50IGk7CisJaW50IHQ7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworCXNwaW5fbG9ja19pcnFzYXZlKCZicC0+bG9jaywgZmxhZ3MpOworCWZvciAoaT0wLCB0PTA7aTw4O2krKykgeworCQlzeF9vdXRfb2ZmIChicCwgQ0QxODZ4X0NBUiwgaSk7CisJCWlmIChzeF9pbl9vZmYgKGJwLCByZWcpICYgYml0KSAKKwkJCXQgfD0gMSA8PCBpOworCX0KKwlzcGluX3VubG9ja19pcnFyZXN0b3JlKCZicC0+bG9jaywgZmxhZ3MpOworCisJcmV0dXJuIHQ7Cit9CisKKworI2lmZGVmIFNQRUNJQUxJWF9USU1FUgordm9pZCBtaXNzZWRfaXJxICh1bnNpZ25lZCBsb25nIGRhdGEpCit7CisJdW5zaWduZWQgY2hhciBpcnE7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKwlzdHJ1Y3Qgc3BlY2lhbGl4X2JvYXJkICAqYnAgPSAoc3RydWN0IHNwZWNpYWxpeF9ib2FyZCAqKWRhdGE7CisKKwlzcGluX2xvY2tfaXJxc2F2ZSgmYnAtPmxvY2ssIGZsYWdzKTsKKwlpcnEgPSBzeF9pbiAoKHN0cnVjdCBzcGVjaWFsaXhfYm9hcmQgKilkYXRhLCBDRDE4NnhfU1JTUikgJgorCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFNSU1JfUlJFUWludCB8CisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU1JTUl9UUkVRaW50IHwKKwkgICAgICAgICAgIC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VzdG9yZSgmYnAtPmxvY2ssIGZsYWdzKTsKKwkJZnVuY19leGl0KCk7CisJCXJldHVybiBJUlFfTk9ORTsKKwl9CisKKwlzYXZlZF9yZWcgPSBicC0+cmVnOworCisJd2hpbGUgKCgrK2xvb3AgPCAxNikgJiYgKHN0YXR1cyA9IChzeF9pbihicCwgQ0QxODZ4X1NSU1IpICYKKwkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChTUlNSX1JSRVFpbnQgfAorCQkgICAgICAgICAgICAgICAgICAgICAgICAgICAgU1JTUl9UUkVRaW50IHwKKwkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTUlNSX01SRVFpbnQpKSkpIHsJCisJCWlmIChzdGF0dXMgJiBTUlNSX1JSRVFpbnQpIHsKKwkJCWFjayA9IHN4X2luKGJwLCBDRDE4NnhfUlJBUik7CisKKwkJCWlmIChhY2sgPT0gKFNYX0lEIHwgR0lWUl9JVF9SQ1YpKQorCQkJCXN4X3JlY2VpdmUoYnApOworCQkJZWxzZSBpZiAoYWNrID09IChTWF9JRCB8IEdJVlJfSVRfUkVYQykpCisJCQkJc3hfcmVjZWl2ZV9leGMoYnApOworCQkJZWxzZQorCQkJCXByaW50ayhLRVJOX0VSUiAic3glZDogc3RhdHVzOiAweCV4IEJhZCByZWNlaXZlIGFjayAweCUwMnguXG4iLAorCQkJCSAgICAgICBib2FyZF9ObyhicCksIHN0YXR1cywgYWNrKTsKKwkJCisJCX0gZWxzZSBpZiAoc3RhdHVzICYgU1JTUl9UUkVRaW50KSB7CisJCQlhY2sgPSBzeF9pbihicCwgQ0QxODZ4X1RSQVIpOworCisJCQlpZiAoYWNrID09IChTWF9JRCB8IEdJVlJfSVRfVFgpKQorCQkJCXN4X3RyYW5zbWl0KGJwKTsKKwkJCWVsc2UKKwkJCQlwcmludGsoS0VSTl9FUlIgInN4JWQ6IHN0YXR1czogMHgleCBCYWQgdHJhbnNtaXQgYWNrIDB4JTAyeC4gcG9ydDogJW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ID0geworCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkiRWFzeUlPIiwKKwkiRUM4LzMyLUFUIiwKKwkiRUM4LzMyLU1DIiwKKwkoY2hhciAqKSBOVUxMLAorCShjaGFyICopIE5VTEwsCisJKGNoYXIgKikgTlVMTCwKKwkiRUM4LzMyLVBDSSIsCisJIkVDOC82NC1QQ0kiLAorCSJFYXN5SU8tUENJIiwKK307CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCURlZmluZSBzb21lIHN0cmluZyBsYWJlbHMgZm9yIGFyZ3VtZW50cyBwYXNzZWQgZnJvbSB0aGUgbW9kdWxlCisgKglsb2FkIGxpbmUuIFRoZXNlIGFsbG93IGZvciBlYXN5IGJvYXJkIGRlZmluaXRpb25zLCBhbmQgZWFzeQorICoJbW9kaWZpY2F0aW9uIG9mIHRoZSBpbywgbWVtb3J5IGFuZCBpcnEgcmVzb3VjcmVzLgorICovCitzdGF0aWMgaW50CXN0bF9uYXJncyA9IDA7CitzdGF0aWMgY2hhcgkqYm9hcmQwWzRdOworc3RhdGljIGNoYXIJKmJvYXJkMVs0XTsKK3N0YXRpYy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5MjAwLCAyODgwMCwgMzg0MDAsIDU3NjAwLCAxMTUyMDAsCisJMjMwNDAwLCA0NjA4MDAsIDkyMTYwMAorfTsKKworI2RlZmluZQlTQzI2MTk4X05SQkFVRFMJCShzaXplb2Yoc2MyNjE5OF9iYXVkdGFibGUpIC8gc2l6ZW9mKHVuc2lnbmVkIGludCkpCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCURlZmluZSB0aGUgZHJpdmVyIGluZm8gZm9yIGEgdXNlciBsZXZlbCBjb250cm9sIGRldmljZS4gVXNlZCBtYWlubHkKKyAqCXRvIGdldCBhdCBwb3J0IHN0YXRzIC0gb25seSBub3QgdXNpbmcgdGhlIHBvcnQgZGV2aWNlIGl0c2VsZi4KKyAqLworc3RhdGljIHN0cnVjdCBmaWxlX29wZXJhdGlvbnMJc3RsX2ZzaW9tZW0gPSB7CisJLm93bmVyCQk9IFRISVNfTU9EVUxFLAorCS5pb2N0bAkJPSBzdGxfbWVtaW9jdGwsCit9OworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyBzdHJ1Y3QgY2xhc3Nfc2ltcGxlICpzdGFsbGlvbl9jbGFzczsKKworLyoKKyAqCUxvYWRhYmxlIG1vZHVsZSBpbml0aWFsaXphdGlvbiBzdHVmZi4KKyAqLworCitzdGF0aWMgaW50IF9faW5pdCBzdGFsbGlvbl9tb2R1bGVfaW5pdCh2b2lkKQoreworCXVuc2lnbmVkIGxvbmcJZmxhZ3M7CisKKyNpZmRlZiBERUJVRworCXByaW50aygiaW5pdF9tb2R1bGUoKVxuIik7CisjZW5kaWYKKworCXNhdmVfZmxhZ3MoZmxhZ3MpOworCWNsaSgpOworCXN0bF9pbml0KCk7CisJcmVzdG9yZV9mbGFncyhmbGFncyk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J0X3QgKikgTlVMTCkKKwkJCQkJY29udGludWU7CisJCQkJaWYgKHBvcnRwLT50dHkgIT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCQkJCXN0bF9oYW5ndXAocG9ydHAtPnR0eSk7CisJCQkJaWYgKHBvcnRwLT50eC5idWYgIT0gKGNoYXIgKikgTlVMTCkKKwkJCQkJa2ZyZWUocG9ydHAtPnR4LmJ1Zik7CisJCQkJa2ZyZWUocG9ydHApOworCQkJfQorCQkJa2ZyZWUocGFuZWxwKTsKKwkJfQorCisJCXJlbGVhc2VfcmVnaW9uKGJyZHAtPmlvYWRkcjEsIGJyZHAtPmlvc2l6ZTEpOworCQlpZiAoYnJkcC0+aW9zaXplMiA+IDApCisJCQlyZWxlYXNlX3JlZ2lvbihicmRwLT5pb2FkZHIyLCBicmRwLT5pb3NpemUyKTsKKworCQlrZnJlZShicmRwKTsKKwkJc3RsX2JyZHNbaV0gPSAoc3RsYnJkX3QgKikgTlVMTDsKKwl9CisKKwlyZXN0b3JlX2ZsYWdzKGZsYWdzKTsKK30KKworbW9kdWxlX2luaXQoc3RhbGxpb25fbW9kdWxlX2luaXQpOworbW9kdWxlX2V4aXQoc3RhbGxpb25fbW9kdWxlX2V4aXQpOworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglDaGVjayBmb3IgYW55IGFyZ3VtZW50cyBwYXNzZWQgaW4gb24gdGhlIG1vZHVsZSBsb2FkIGNvbW1hbmQgbGluZS4KKyAqLworCitzdGF0aWMgdm9pZCBzdGxfYXJnYnJkcyh2b2lkKQoreworCXN0bGNvbmZfdAljb25mOworCXN0bGJyZF90CSpicmRwOworCWludAkJaTsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfYXJnYnJkcygpXG4iKTsKKyNlbmRpZgorCisJZm9yIChpID0gc3RsX25yYnJkczsgKGkgPCBzdGxfbmFyZ3MpOyBpKyspIHsKKwkJbWVtc2V0KCZjb25mLCAwLCBzaXplb2YoY29uZikpOworCQlpZiAoc3RsX3BhcnNlYnJkKCZjb25mLCBzdGxfYnJkc3BbaV0pID09IDApCisJCQljb250aW51ZTsKKwkJaWYgKChicmRwID0gc3RsX2FsbG9jYnJkKCkpID09IChzdGxicmRfdCAqKSBOVUxMKQorCQkJY29udGludWU7CisJCXN0bF9ucmJyZHMgPSBpICsgMTsKKwkJYnJkcC0+YnJkbnIgPSBpOworCQlicmRwLT5icmR0eXBlID0gY29uZi5icmR0eXBlOworCQlicmRwLT5pb2FkZHIxID0gY29uZi5pb2FkZHIxOworCQlicmRwLT5pb2FkZHIyID0gY29uZi5pb2FkZHIyOworCQlicmRwLT5pcnEgPSBjb25mLmlycTsKKwkJYnJkcC0+aXJxdHlwZSA9IGNvbmYuaXJxdHlwZTsKKwkJc3RsX2JyZGluaXQoYnJkcCk7CisJfQorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglDb252ZXJ0IGFuIGFzY2lpIHN0cmluZyBudW1iZXIgaW50byBhbiB1bnNpZ25lZCBsb25nLgorICovCisKK3N0YXRpYyB1bnNpZ25lZCBsb25nIHN0bF9hdG9sKGNoYXIgKnN0cikKK3sKKwl1bnNpZ25lZCBsb25nCXZhbDsKKwlpbnQJCWJhc2UsIGM7CisJY2hhcgkJKnNwOworCisJdmFsID0gMDsKKwlzcCA9IHN0cjsKKwlpZiAoKCpzcCA9PSAnMCcpICYmICgqKHNwKzEpID09ICd4JykpIHsKKwkJYmFzZSA9IDE2OworCQlzcCArPSAyOworCX0gZWxzZSBpZiAoKnNwID09ICcwJykgeworCQliYXNlID0gODsKKwkJc3ArKzsKKwl9IGVsc2UgeworCQliYXNlID0gMTA7CisJfQorCisJZm9yICg7ICgqc3AgIT0gMCk7IHNwKyspIHsKKwkJYyA9ICgqc3AgPiAnOScpID8gKFRPTE9XRVIoKnNwKSAtICdhJyArIDEwKSA6ICgqc3AgLSAnMCcpOworCQlpZiAoKGMgPCAwKSB8fCAoYyA+PSBiYXNlKSkgeworCQkJcHJpbnRrKCJTVEFMTElPTjogaW52YWxpZCBhcmd1bWVudCAlc1xuIiwgc3RyKTsKKwkJCXZhbCA9IDA7CisJCQlicmVhazsKKwkJfQorCQl2YWwgPSAodmFsICogYmFzZSkgKyBjOworCX0KKwlyZXR1cm4odmFsKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJUGFyc2UgdGhlIHN1cHBsaWVkIGFyZ3VtZW50IHN0cmluZywgaW50byB0aGUgYm9hcmQgY29uZiBzdHJ1Y3QuCisgKi8KKworc3RhdGljIGludCBzdGxfcGFyc2VicmQoc3RsY29uZl90ICpjb25mcCwgY2hhciAqKmFyZ3ApCit7CisJY2hhcgkqc3A7CisJaW50CW5yYnJkbmFtZXMsIGk7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX3BhcnNlYnJkKGNvbmZwPSV4LGFyZ3A9JXgpXG4iLCAoaW50KSBjb25mcCwgKGludCkgYXJncCk7CisjZW5kaWYKKworCWlmICgoYXJncFswXSA9PSAoY2hhciAqKSBOVUxMKSB8fCAoKmFyZ3BbMF0gPT0gMCkpCisJCXJldHVybigwKTsKKworCWZvciAoc3AgPSBhcmdwWzBdLCBpID0gMDsgKCgqc3AgIT0gMCkgJiYgKGkgPCAyNSkpOyBzcCsrLCBpKyspCisJCSpzcCA9IFRPTE9XRVIoKnNwKTsKKworCW5yYnJkbmFtZXMgPSBzaXplb2Yoc3RsX2JyZHN0cikgLyBzaXplb2Yoc3RsYnJkdHlwZV90KTsKKwlmb3IgKGkgPSAwOyAoaSA8IG5yYnJkbmFtZXMpOyBpKyspIHsKKwkJaWYgKHN0cmNtcChzdGxfYnJkc3RyW2ldLm5hbWUsIGFyZ3BbMF0pID09IDApCisJCQlicmVhazsKKwl9CisJaWYgKGkgPj0gbnJicmRuYW1lcykgeworCQlwcmludGsoIlNUQUxMSU9OOiB1bmtub3duIGJvYXJkIG5hbWUsICVzP1xuIiwgYXJncFswXSk7CisJCXJldHVybigwKTsKKwl9CisKKwljb25mcC0+YnJkdHlwZSA9IHN0bF9icmRzdHJbaV0udHlwZTsKKworCWkgPSAxOworCWlmICgoYXJncFtpXSAhPSAoY2hhciAqKSBOVUxMKSAmJiAoKmFyZ3BbaV0gIT0gMCkpCisJCWNvbmZwLT5pb2FkZHIxID0gc3RsX2F0b2woYXJncFtpXSk7CisJaSsrOworCWlmIChjb25mcC0+YnJkdHlwZSA9PSBCUkRfRUNIKSB7CisJCWlmICgoYXJncFtpXSAhPSAoY2hhciAqKSBOVUxMKSAmJiAoKmFyZ3BbaV0gIT0gMCkpCisJCQljb25mcC0+aW9hZGRyMiA9IHN0bF9hdG9sKGFyZ3BbaV0pOworCQlpKys7CisJfQorCWlmICgoYXJncFtpXSAhPSAoY2hhciAqKSBOVUxMKSAmJiAoKmFyZ3BbaV0gIT0gMCkpCisJCWNvbmZwLT5pcnEgPSBzdGxfYXRvbChhcmdwW2ldKTsKKwlyZXR1cm4oMSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUxvY2FsIGRyaXZlciBrZXJuZWwgbWVtb3J5IGFsbG9jYXRpb24gcm91dGluZS4KKyAqLworCitzdGF0aWMgdm9pZCAqc3RsX21lbWFsbG9jKGludCBsZW4pCit7CisJcmV0dXJuKCh2b2lkICopIGttYWxsb2MobGVuLCBHRlBfS0VSTkVMKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUFsbG9jYXRlIGEgbmV3IGJvYXJkIHN0cnVjdHVyZS4gRmlsbCBvdXQgdGhlIGJhc2ljIGluZm8gaW4gaXQuCisgKi8KKworc3RhdGljIHN0bGJyZF90ICpzdGxfYWxsb2NicmQodm9pZCkKK3sKKwlzdGxicmRfdAkqYnJkcDsKKworCWJyZHAgPSAoc3RsYnJkX3QgKikgc3RsX21lbWFsbG9jKHNpemVvZihzdGxicmRfdCkpOworCWlmIChicmRwID09IChzdGxicmRfdCAqKSBOVUxMKSB7CisJCXByaW50aygiU1RBTExJT046IGZhaWxlZCB0byBhbGxvY2F0ZSBtZW1vcnkgKHNpemU9JWQpXG4iLAorCQkJc2l6ZW9mKHN0bGJyZF90KSk7CisJCXJldHVybigoc3RsYnJkX3QgKikgTlVMTCk7CisJfQorCisJbWVtc2V0KGJyZHAsIDAsIHNpemVvZihzdGxicmRfdCkpOworCWJyZHAtPm1hZ2ljID0gU1RMX0JPQVJETUFHSUM7CisJcmV0dXJuKGJyZHApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyBpbnQgc3RsX29wZW4oc3RydWN0IHR0eV9zdHJ1Y3QgKnR0eSwgc3RydWN0IGZpbGUgKmZpbHApCit7CisJc3RscG9ydF90CSpwb3J0cDsKKwlzdGxicmRfdAkqYnJkcDsKKwl1bnNpZ25lZCBpbnQJbWlub3JkZXY7CisJaW50CQlicmRuciwgcGFuZWxuciwgcG9ydG5yLCByYzsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfb3Blbih0dHk9JXgsZmlscD0leCk6IGRldmljZT0lc1xuIiwgKGludCkgdHR5LAorCQkoaW50KSBmaWxwLCB0dHktPm5hbWUpOworI2VuZGlmCisKKwltaW5vcmRldiA9IHR0eS0+aW5kZXg7CisJYnJkbnIgPSBNSU5PUjJCUkQobWlub3JkZXYp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iAwCisJaWYgKHR0eS0+c3RvcHBlZCB8fCB0dHktPmh3X3N0b3BwZWQgfHwKKwkgICAgKHBvcnRwLT50eC5oZWFkID09IHBvcnRwLT50eC50YWlsKSkKKwkJcmV0dXJuOworI2VuZGlmCisJc3RsX3N0YXJ0cnh0eChwb3J0cCwgLTEsIDEpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyBpbnQgc3RsX3dyaXRlcm9vbShzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXN0bHBvcnRfdAkqcG9ydHA7CisJY2hhcgkJKmhlYWQsICp0YWlsOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bF93cml0ZXJvb20odHR5PSV4KVxuIiwgKGludCkgdHR5KTsKKyNlbmRpZgorCisJaWYgKHR0eSA9PSAoc3RydWN0IHR0eV9zdHJ1Y3QgKikgTlVMTCkKKwkJcmV0dXJuKDApOworCXBvcnRwID0gdHR5LT5kcml2ZXJfZGF0YTsKKwlpZiAocG9ydHAgPT0gKHN0bHBvcnRfdCAqKSBOVUxMKQorCQlyZXR1cm4oMCk7CisJaWYgKHBvcnRwLT50eC5idWYgPT0gKGNoYXIgKikgTlVMTCkKKwkJcmV0dXJuKDApOworCisJaGVhZCA9IHBvcnRwLT50eC5oZWFkOworCXRhaWwgPSBwb3J0cC0+dHgudGFpbDsKKwlyZXR1cm4oKGhlYWQgPj0gdGFpbCkgPyAoU1RMX1RYQlVGU0laRSAtIChoZWFkIC0gdGFpbCkgLSAxKSA6ICh0YWlsIC0gaGVhZCAtIDEpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJUmV0dXJuIG51bWJlciBvZiBjaGFycyBpbiB0aGUgVFggYnVmZmVyLiBOb3JtYW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c2VkIG9uIHRlcm1pb3MKKyAqCXNldHRpbmdzIHVzZSBzb2Z0d2FyZSBvci9hbmQgaGFyZHdhcmUgZmxvdyBjb250cm9sLgorICovCisKK3N0YXRpYyB2b2lkIHN0bF90aHJvdHRsZShzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXN0bHBvcnRfdAkqcG9ydHA7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX3Rocm90dGxlKHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxwb3J0X3QgKikgTlVMTCkKKwkJcmV0dXJuOworCXN0bF9mbG93Y3RybChwb3J0cCwgMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVVuZmxvdyBjb250cm9sIHRoZSBkZXZpY2Ugc2VuZGluZyB1cyBkYXRhLi4uCisgKi8KKworc3RhdGljIHZvaWQgc3RsX3VudGhyb3R0bGUoc3RydWN0IHR0eV9zdHJ1Y3QgKnR0eSkKK3sKKwlzdGxwb3J0X3QJKnBvcnRwOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bF91bnRocm90dGxlKHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxwb3J0X3QgKikgTlVMTCkKKwkJcmV0dXJuOworCXN0bF9mbG93Y3RybChwb3J0cCwgMSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVN0b3AgdGhlIHRyYW5zbWl0dGVyLiBCYXNpY2FsbHkgdG8gZG8gdGhpcyB3ZSB3aWxsIGp1c3QgdHVybiBUWAorICoJaW50ZXJydXB0cyBvZmYuCisgKi8KKworc3RhdGljIHZvaWQgc3RsX3N0b3Aoc3RydWN0IHR0eV9zdHJ1Y3QgKnR0eSkKK3sKKwlzdGxwb3J0X3QJKnBvcnRwOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bF9zdG9wKHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxwb3J0X3QgKikgTlVMTCkKKwkJcmV0dXJuOworCXN0bF9zdGFydHJ4dHgocG9ydHAsIC0xLCAwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJU3RhcnQgdGhlIHRyYW5zbWl0dGVyIGFnYWluLiBKdXN0IHR1cm4gVFggaW50ZXJydXB0cyBiYWNrIG9uLgorICovCisKK3N0YXRpYyB2b2lkIHN0bF9zdGFydChzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXN0bHBvcnRfdAkqcG9ydHA7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX3N0YXJ0KHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRw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fSU9fRVJST1IsICZ0dHktPmZsYWdzKTsKKwlpZiAocG9ydHAtPnR4LmJ1ZiAhPSAoY2hhciAqKSBOVUxMKSB7CisJCWtmcmVlKHBvcnRwLT50eC5idWYpOworCQlwb3J0cC0+dHguYnVmID0gKGNoYXIgKikgTlVMTDsKKwkJcG9ydHAtPnR4LmhlYWQgPSAoY2hhciAqKSBOVUxMOworCQlwb3J0cC0+dHgudGFpbCA9IChjaGFyICopIE5VTEw7CisJfQorCXBvcnRwLT50dHkgPSAoc3RydWN0IHR0eV9zdHJ1Y3QgKikgTlVMTDsKKwlwb3J0cC0+ZmxhZ3MgJj0gfkFTWU5DX05PUk1BTF9BQ1RJVkU7CisJcG9ydHAtPnJlZmNvdW50ID0gMDsKKwl3YWtlX3VwX2ludGVycnVwdGlibGUoJnBvcnRwLT5vcGVuX3dhaXQpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bF9mbHVzaGJ1ZmZlcihzdHJ1Y3QgdHR5X3N0cnVjdCAqdHR5KQoreworCXN0bHBvcnRfdAkqcG9ydHA7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX2ZsdXNoYnVmZmVyKHR0eT0leClcbiIsIChpbnQpIHR0eSk7CisjZW5kaWYKKworCWlmICh0dHkgPT0gKHN0cnVjdCB0dHlfc3RydWN0ICopIE5VTEwpCisJCXJldHVybjsKKwlwb3J0cCA9IHR0eS0+ZHJpdmVyX2RhdGE7CisJaWYgKHBvcnRwID09IChzdGxwb3J0X3QgKikgTlVMTCkKKwkJcmV0dXJuOworCisJc3RsX2ZsdXNoKHBvcnRwKTsKKwl0dHlfd2FrZXVwKHR0eSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdG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bHMocG9ydHApOworCWNudCA9IHNwcmludGYoc3AsICIlcyVzJXMlcyVzICIsCisJCShzaWdzICYgVElPQ01fUlRTKSA/ICJ8UlRTIiA6ICIiLAorCQkoc2lncyAmIFRJT0NNX0NUUykgPyAifENUUyIgOiAiIiwKKwkJKHNpZ3MgJiBUSU9DTV9EVFIpID8gInxEVFIiIDogIiIsCisJCShzaWdzICYgVElPQ01fQ0QpID8gInxEQ0QiIDogIiIsCisJCShzaWdzICYgVElPQ01fRFNSKSA/ICJ8RFNSIiA6ICIiKTsKKwkqc3AgPSAnICc7CisJc3AgKz0gY250OworCisJZm9yIChjbnQgPSAoc3AgLSBwb3MpOyAoY250IDwgKE1BWExJTkUgLSAxKSk7IGNudCsrKQorCQkqc3ArKyA9ICcgJzsKKwlpZiAoY250ID49IE1BWExJTkUpCisJCXBvc1soTUFYTElORSAtIDIpXSA9ICcrJzsKKwlwb3NbKE1BWExJTkUgLSAxKV0gPSAnXG4nOworCisJcmV0dXJuKE1BWExJTkUpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglQb3J0IGluZm8sIHJlYWQgZnJvbSB0aGUgL3Byb2MgZmlsZSBzeXN0ZW0uCisgKi8KKworc3RhdGljIGludCBzdGxfcmVhZHByb2MoY2hhciAqcGFnZSwgY2hhciAqKnN0YXJ0LCBvZmZfdCBvZmYsIGludCBjb3VudCwgaW50ICplb2YsIHZvaWQgKmRhdGEpCit7CisJc3RsYnJkX3QJKmJyZHA7CisJc3RscGFuZWxfdAkqcGFuZWxwOworCXN0bHBvcnRfdAkqcG9ydHA7CisJaW50CQlicmRuciwgcGFuZWxuciwgcG9ydG5yLCB0b3RhbHBvcnQ7CisJaW50CQljdXJvZmYsIG1heG9mZjsKKwljaGFyCQkqcG9zOworCisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bF9yZWFkcHJvYyhwYWdlP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3IgKHBhbmVsbnIgPSAwOyAocGFuZWxuciA8IGJyZHAtPm5ycGFuZWxzKTsgcGFuZWxucisrKSB7CisJCQlwYW5lbHAgPSBicmRwLT5wYW5lbHNbcGFuZWxucl07CisJCQlpZiAocGFuZWxwID09IChzdGxwYW5lbF90ICopIE5VTEwpCisJCQkJY29udGludWU7CisKKwkJCW1heG9mZiA9IGN1cm9mZiArIChwYW5lbHAtPm5ycG9ydHMgKiBNQVhMSU5FKTsKKwkJCWlmIChvZmYgPj0gbWF4b2ZmKSB7CisJCQkJY3Vyb2ZmID0gbWF4b2ZmOworCQkJCXRvdGFscG9ydCArPSBwYW5lbHAtPm5ycG9ydHM7CisJCQkJY29udGludWU7CisJCQl9CisKKwkJCWZvciAocG9ydG5yID0gMDsgKHBvcnRuciA8IHBhbmVscC0+bnJwb3J0cyk7IHBvcnRucisrLAorCQkJICAgIHRvdGFscG9ydCsrKSB7CisJCQkJcG9ydHAgPSBwYW5lbHAtPnBvcnRzW3BvcnRucl07CisJCQkJaWYgKHBvcnRwID09IChzdGxwb3J0X3QgKikgTlVMTCkKKwkJCQkJY29udGludWU7CisJCQkJaWYgKG9mZiA+PSAoY3Vyb2ZmICs9IE1BWExJTkUpKQorCQkJCQljb250aW51ZTsKKwkJCQlpZiAoKHBvcyAtIHBhZ2UgKyBNQVhMSU5FKSA+IGNvdW50KQorCQkJCQlnb3RvIHN0bF9yZWFkZG9uZTsKKwkJCQlwb3MgKz0gc3RsX3BvcnRpbmZvKHBvcnRwLCB0b3RhbHBvcnQsIHBvcyk7CisJCQl9CisJCX0KKwl9CisKKwkqZW9mID0gMTsKKworc3RsX3JlYWRkb25lOgorCSpzdGFydCA9IHBhZ2U7CisJcmV0dXJuKHBvcyAtIHBhZ2UpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglBbGwgYm9hcmQgaW50ZXJydXB0cyBhcmUgdmVjdG9yZWQgdGhyb3VnaCBoZXJlIGZpcnN0LiBUaGlzIGNvZGUgdGhlbgorICoJY2FsbHMgb2ZmIHRvIHRoZSBhcHByb3JwcmlhdGUgYm9hcmQgaW50ZXJydXB0IGhhbmRsZXJzLgorICovCisKK3N0YXRpYyBpcnFyZXR1cm5fdCBzdGxfaW50cihpbnQgaXJxLCB2b2lkICpkZXZfaWQsIHN0cnVjdCBwdF9yZWdzICpyZWdzKQoreworCXN0bGJyZF90CSpicmRwID0gKHN0bGJyZF90ICopIGRldl9pZDsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfaW50cihicmRwPSV4LGlycT0lZCxyZWdzPSV4KVxuIiwgKGludCkgYnJkcCwgaXJxLAorCSAgICAoaW50KSByZWdzKTsKKyNlbmRpZgorCisJcmV0dXJuIElSUV9SRVRWQUwoKCogYnJkcC0+aXNyKShicmRwKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUludGVycnVwdCBzZXJ2aWNlIHJvdXRpbmUgZm9yIEVhc3lJTyBib2FyZCB0eXBlcy4KKyAqLworCitzdGF0aWMgaW50IHN0bF9laW9pbnRyKHN0bGJyZF90ICpicmRwKQoreworCXN0bHBhbmVsX3QJKnBhbmVscDsKKwl1bnNpZ25lZCBpbnQJaW9iYXNlOworCWludAkJaGFuZGxlZCA9IDA7CisKKwlwYW5lbHAgPSBicmRwLT5wYW5lbHNbMF07CisJaW9iYXNlID0gcGFuZWxwLT5pb2Jhc2U7CisJd2hpbGUgKGluYihicmRwLT5pb3N0YXR1cykgJiBFSU9fSU5UUlBFTkQpIHsKKwkJaGFuZGxlZCA9IDE7CisJCSgqIHBhbmVscC0+aXNyKShwYW5lbHAsIGlvYmFzZSk7CisJfQorCXJldHVybiBoYW5kbGVkOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglJbnRlcnJ1cHQgc2VydmljZSByb3V0aW5lIGZvciBFQ0gtQVQgYm9hcmQgdHlwZXMuCisgKi8KKworc3RhdGljIGludCBzdGxfZWNoYXRpbnRyKHN0bGJyZF90ICpicmRwKQoreworCXN0bHBhbmVsX3QJKnBhbmVscDsKKwl1bnNpZ25lZCBpbnQJaW9hZGRyOworCWludAkJYm5rbnI7CisJaW50CQloYW5kbGVkID0gMDsKKworCW91dGIoKGJyZHAtPmlvY3RybHZhbCB8IEVDSF9CUkRFTkFCTEUpLCBicmRwLT5pb2N0cmwpOworCisJd2hpbGUgKGluYihicmRwLT5pb3N0YXR1cykgJiBFQ0hfSU5UUlBFTkQpIHsKKwkJaGFuZGxlZCA9IDE7CisJCWZvciAoYm5rbnIgPSAwOyAoYm5rbnIgPCBicmRwLT5ucmJua3MpOyBibmtucisrKSB7CisJCQlpb2FkZHIgPSBicmRwLT5ibmtzdGF0YWRkcltibmtucl07CisJCQlpZiAoaW5iKGlvYWRkcikgJiBFQ0hfUE5MSU5UUlBFTkQpIHsKKwkJCQlwYW5lbHAgPSBicmRwLT5ibmsycGFuZWxbYm5rbnJdOworCQkJCSgqIHBhbmVscC0+aXNyKShwYW5lbHAsIChpb2FkZHIgJiAweGZmZmMpKTsKKwkJCX0KKwkJfQorCX0KKworCW91dGIoKGJyZHAtPmlvY3RybHZhbCB8IEVDSF9CUkRESVNBQkxFKSwgYnJkcC0+aW9jdHJsKTsKKworCXJldHVybiBoYW5kbGVkOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglJbnRlcnJ1cHQgc2VydmljZSByb3V0aW5lIGZvciBFQ0gtTUNBIGJvYXJkIHR5cGVzLgorICovCisKK3N0YXRpYyBpbnQgc3RsX2VjaG1jYWludHIoc3RsYnJkX3QgKmJyZHApCit7CisJc3RscGFuZWxfdAkqcGFuZWxwOworCXVuc2lnbmVkIGludAlpb2FkZHI7CisJaW50CQlibmtucjsKKwlpbnQJCWhhbmRsZWQgPSAwOworCisJd2hpbGUgKGluYihicmRwLT5pb3N0YXR1cykgJiBFQ0hfSU5UUlBFTkQpIHsKKwkJaGFuZGxlZCA9IDE7CisJCWZvciAoYm5rbnIgPSAwOyAoYm5rbnIgPCBicmRwLT5ucmJua3MpOyBibmtucisrKSB7CisJCQlpb2FkZHIgPSBicmRwLT5ibmtzdGF0YWRkcltibmtucl07CisJCQlpZiAoaW5iKGlvYWRkcikgJiBFQ0hfUE5MSU5UUlBFTkQpIHsKKwkJCQlwYW5lbHAgPSBicmRwLT5ibmsycGFuZWxbYm5rbnJdOworCQkJCSgqIHBhbmVscC0+aXNyKShwYW5lbHAsIChpb2FkZHIgJiAweGZmZmMpKTsKKwkJCX0KKwkJfQorCX0KKwlyZXR1cm4gaGFuZGxlZDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJSW50ZXJydXB0IHNlcnZpY2Ugcm91dGluZSBmb3IgRUNILVBDSSBib2FyZCB0eXBlcy4KKyAqLworCitzdGF0aWMgaW50IHN0bF9lY2hwY2lpbnRyKHN0bGJyZF90ICpicmRwKQoreworCXN0bHBhbmVsX3QJKnBhbmVscDsKKwl1bnNpZ25lZCBpbnQJaW9hZGRyOworCWludAkJYm5rbnIsIHJlY2hlY2s7CisJaW50CQloYW5kbGVkID0gMDsKKworCXdoaWxlICgxKSB7CisJCXJlY2hlY2sgPSAwOworCQlmb3IgKGJua25yID0gMDsgKGJua25yIDwgYnJkcC0+bnJibmtzKTsgYm5rbnIrKykgeworCQkJb3V0YihicmRwLT5ibmtwYWdlYWRkcltibmtucl0sIGJyZHAtPmlvY3RybCk7CisJCQlpb2FkZHIgPSBicmRwLT5ibmtzdGF0YWRkcltibmtucl07CisJCQlpZiAoaW5iKGlvYWRkcikgJiBFQ0hfUE5MSU5UUlBFTkQpIHsKKwkJCQlwYW5lbHAgPSBicmRwLT5ibmsycGFuZWxbYm5rbnJdOworCQkJCSgqIHBhbmVscC0+aXNyKShwYW5lbHAsIChpb2FkZHIgJiAweGZmZmMpKTsKKwkJCQlyZWNoZWNrKys7CisJCQkJaGFuZGxlZCA9IDE7CisJCQl9CisJCX0KKwkJaWYgKCEgcmVjaGVjaykKKwkJCWJyZWFrOworCX0KKwlyZXR1cm4gaGFuZGxlZDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJSW50ZXJydXB0IHNlcnZpY2Ugcm91dGluZSBmb3IgRUNILTgvNjQtUENJIGJvYXJkIHR5cGVzLgorICovCisKK3N0YXRpYyBpbnQgc3RsX2VjaHBjaTY0aW50cihzdGxicmRfdCAqYnJkcCkKK3sKKwlzdGxwYW5lbF90CSpwYW5lbHA7CisJdW5zaWduZWQgaW50CWlvYWRkcjsKKwlpbnQJCWJua25yOworCWludAkJaGFuZGxlZCA9IDA7CisKKwl3aGlsZSAoaW5iKGJyZHAtPmlvY3RybCkgJiAweDEpIHsKKwkJaGFuZGxlZCA9IDE7CisJCWZvciAoYm5rbnIgPSAwOyAoYm5rbnIgPCBicmRwLT5ucmJua3MpOyBibmtucisrKSB7CisJCQlpb2FkZHIgPSBicmRwLT5ibmtzdGF0YWRkcltibmtucl07CisJCQlpZiAoaW5iKGlvYWRkcikgJiBFQ0hfUE5MSU5UUlBFTkQpIHsKKwkJCQlwYW5lbHAgPSBicmRwLT5ibmsycGFuZWxbYm5rbnJdOworCQkJCSgqIHBhbmVscC0+aXNyKShwYW5lbHAsIChpb2FkZHIgJiAweGZmZmMpKTsKKwkJCX0KKwkJfQorCX0KKworCXJldHVybiBoYW5kbGVkO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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJVHJ5IHRvIGZpbmQgYW5kIGluaXRpYWxpemUgYW4gRWFzeUlPIGJvYXJkLgorICovCisKK3N0YXRpYyBpbmxpbmUgaW50IHN0bF9pbml0ZWlvKHN0bGJyZF90ICpicmRwKQoreworCXN0bHBhbmVsX3QJKnBhbmVscDsKKwl1bnNpZ25lZCBpbnQJc3RhdHVzOworCWNoYXIJCSpuYW1lOworCWludAkJcmM7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX2luaXRlaW8oYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisKKwlicmRwLT5pb2N0cmwgPSBicmRwLT5pb2FkZHIxICsgMTsKKwlicmRwLT5pb3N0YXR1cyA9IGJyZHAtPmlvYWRkcjEgKyAyOworCisJc3RhdHVzID0gaW5iKGJyZHAtPmlvc3RhdHVzKTsKKwlpZiAoKHN0YXR1cyAmIEVJT19JREJJVE1BU0spID09IEVJT19NSzMpCisJCWJyZHAtPmlvY3RybCsrOworCisvKgorICoJSGFuZGxlIGJvYXJkIHNwZWNpZmljIHN0dWZmIG5vdy4gVGhlIHJlYWwgZGlmZmVyZW5jZSBpcyBQQ0kKKyAqCW9yIG5vdCBQQ0kuCisgKi8KKwlpZiAoYnJkcC0+YnJkdHlwZSA9PSBCUkRfRUFTWUlPUENJKSB7CisJCWJyZHAtPmlvc2l6ZTEgPSAweDgwOworCQlicmRwLT5pb3NpemUyID0gMHg4MDsKKwkJbmFtZSA9ICJzZXJpYWwoRUlPLVBDSSkiOworCQlvdXRiKDB4NDEsIChicmRwLT5pb2FkZHIyICsgMHg0YykpOworCX0gZWxzZSB7CisJCWJyZHAtPmlvc2l6ZTEgPSA4OworCQluYW1lID0gInNlcmlhbChFSU8pIjsKKwkJaWYgKChicmRwLT5pcnEgPCAwKSB8fCAoYnJkcC0+aXJxID4gMTUpIHx8Cis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7CisJYnJkcC0+aHdpZCA9IHN0YXR1czsKKwlpZiAocmVxdWVzdF9pcnEoYnJkcC0+aXJxLCBzdGxfaW50ciwgU0FfU0hJUlEsIG5hbWUsIGJyZHApICE9IDApIHsKKwkJcHJpbnRrKCJTVEFMTElPTjogZmFpbGVkIHRvIHJlZ2lzdGVyIGludGVycnVwdCAiCisJCSAgICAicm91dGluZSBmb3IgJXMgaXJxPSVkXG4iLCBuYW1lLCBicmRwLT5pcnEpOworCQlyYyA9IC1FTk9ERVY7CisJfSBlbHNlIHsKKwkJcmMgPSAwOworCX0KKwlyZXR1cm4ocmMpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglUcnkgdG8gZmluZCBhbiBFQ0ggYm9hcmQgYW5kIGluaXRpYWxpemUgaXQuIFRoaXMgY29kZSBpcyBjYXBhYmxlIG9mCisgKglkZWFsaW5nIHdpdGggYWxsIHR5cGVzIG9mIEVDSCBib2FyZC4KKyAqLworCitzdGF0aWMgaW5saW5lIGludCBzdGxfaW5pdGVjaChzdGxicmRfdCAqYnJkcCkKK3sKKwlzdGxwYW5lbF90CSpwYW5lbHA7CisJdW5zaWduZWQgaW50CXN0YXR1cywgbnh0aWQsIGlvYWRkciwgY29uZmxpY3Q7CisJaW50CQlwYW5lbG5yLCBiYW5rbnIsIGk7CisJY2hhcgkJKm5hbWU7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX2luaXRlY2goYnJkcD0leClcbiIsIChpbnQpIGJyZHApOworI2VuZGlmCisKKwlzdGF0dXMgPSAwOworCWNvbmZsaWN0ID0gMDsKKworLyoKKyAqCVNldCB1cCB0aGUgaW5pdGlhbCBib2FyZCByZWdpc3RlciBjb250ZW50cyBmb3IgYm9hcmRzLiBUaGlzIHZhcmllcyBhCisgKgliaXQgYmV0d2VlbiB0aGUgZGlmZmVyZW50IGJvYXJkIHR5c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RwLT5wYW5lbHNbaV0pOworCisJcHJpbnRrKCJTVEFMTElPTjogJXMgZm91bmQsIGJvYXJkPSVkIGlvPSV4IGlycT0lZCAiCisJCSJucnBhbmVscz0lZCBucnBvcnRzPSVkXG4iLCBzdGxfYnJkbmFtZXNbYnJkcC0+YnJkdHlwZV0sCisJCWJyZHAtPmJyZG5yLCBicmRwLT5pb2FkZHIxLCBicmRwLT5pcnEsIGJyZHAtPm5ycGFuZWxzLAorCQlicmRwLT5ucnBvcnRzKTsKKwlyZXR1cm4oMCk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUZpbmQgdGhlIG5leHQgYXZhaWxhYmxlIGJvYXJkIG51bWJlciB0aGF0IGlzIGZyZWUuCisgKi8KKworc3RhdGljIGlubGluZSBpbnQgc3RsX2dldGJyZG5yKHZvaWQpCit7CisJaW50CWk7CisKKwlmb3IgKGkgPSAwOyAoaSA8IFNUTF9NQVhCUkRTKTsgaSsrKSB7CisJCWlmIChzdGxfYnJkc1tpXSA9PSAoc3RsYnJkX3QgKikgTlVMTCkgeworCQkJaWYgKGkgPj0gc3RsX25yYnJkcykKKwkJCQlzdGxfbnJicmRzID0gaSArIDE7CisJCQlyZXR1cm4oaSk7CisJCX0KKwl9CisJcmV0dXJuKC0xKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisjaWZkZWYJQ09ORklHX1BDSQorCisvKgorICoJV2UgaGF2ZSBhIFN0YWxsaW9uIGJvYXJkLiBBbGxvY2F0ZSBhIGJvYXJkIHN0cnVjdHVyZSBhbmQKKyAqCWluaXRpYWxpemUgaXQuIFJlYWQgaXRzIElPIGFuZCBJUlEgcmVzb3VyY2VzIGZyb20gUENJCisgKgljb25maWd1cmF0aW9uIHNwYWNl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iksIHBjaV9yZXNvdXJjZV9zdGFydChkZXZwLCAzKSwgZGV2cC0+aXJxKTsKKyNlbmRpZgorCisvKgorICoJV2UgaGF2ZSBhbGwgcmVzb3VyY2VzIGZyb20gdGhlIGJvYXJkLCBzbyBsZXQncyBzZXR1cCB0aGUgYWN0dWFsCisgKglib2FyZCBzdHJ1Y3R1cmUgbm93LgorICovCisJc3dpdGNoIChicmR0eXBlKSB7CisJY2FzZSBCUkRfRUNIUENJOgorCQlicmRwLT5pb2FkZHIyID0gcGNpX3Jlc291cmNlX3N0YXJ0KGRldnAsIDApOworCQlicmRwLT5pb2FkZHIxID0gcGNpX3Jlc291cmNlX3N0YXJ0KGRldnAsIDEpOworCQlicmVhazsKKwljYXNlIEJSRF9FQ0g2NFBDSToKKwkJYnJkcC0+aW9hZGRyMiA9IHBjaV9yZXNvdXJjZV9zdGFydChkZXZwLCAyKTsKKwkJYnJkcC0+aW9hZGRyMSA9IHBjaV9yZXNvdXJjZV9zdGFydChkZXZwLCAxKTsKKwkJYnJlYWs7CisJY2FzZSBCUkRfRUFTWUlPUENJOgorCQlicmRwLT5pb2FkZHIxID0gcGNpX3Jlc291cmNlX3N0YXJ0KGRldnAsIDIpOworCQlicmRwLT5pb2FkZHIyID0gcGNpX3Jlc291cmNlX3N0YXJ0KGRldnAsIDEpOworCQlicmVhazsKKwlkZWZhdWx0OgorCQlwcmludGsoIlNUQUxMSU9OOiB1bmtub3duIFBDSSBib2FyZCB0eXBlPSVkXG4iLCBicmR0eXBlKTsKKwkJYnJlYWs7CisJfQorCisJYnJkcC0+aXJxID0gZGV2cC0+aXJxOworCXN0bF9icmRpbml0KGJyZHApOworCisJcmV0dXJuKDApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglGaW5kIGFsbCBTdGFsbGlvbiBQQ0kgYm9hcmRzIHRoYXQgbWlnaHQgYmUgaW5zdGFsbGVkLiBJbml0aWFsaXplIGVhY2gKKyAqCW9uZSBhcyBpdCBpcyBmb3VuZC4KKyAqLworCisKK3N0YXRpYyBpbmxpbmUgaW50IHN0bF9maW5kcGNpYnJkcyh2b2lkKQoreworCXN0cnVjdCBwY2lfZGV2CSpkZXYgPSBOVUxMOworCWludAkJaSwgcmM7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX2ZpbmRwY2licmRzKClcbiIpOworI2VuZGlmCisKKwlmb3IgKGkgPSAwOyAoaSA8IHN0bF9ucnBjaWJyZHMpOyBpKyspCisJCXdoaWxlICgoZGV2ID0gcGNpX2ZpbmRfZGV2aWNlKHN0bF9wY2licmRzW2ldLnZlbmRpZCwKKwkJICAgIHN0bF9wY2licmRzW2ldLmRldmlkLCBkZXYpKSkgeworCisvKgorICoJCQlGb3VuZCBhIGRldmljZSBvbiB0aGUgUENJIGJ1cyB0aGF0IGhhcyBvdXIgdmVuZG9yIGFuZAorICoJCQlkZXZpY2UgSUQuIE5lZWQgdG8gY2hlY2sgbm93IHRoYXQgaXQgaXMgcmVhbGx5IHVzLgorICovCisJCQlpZiAoKGRldi0+Y2xhc3MgPj4gOCkgPT0gUENJX0NMQVNTX1NUT1JBR0VfSURFKQorCQkJCWNvbnRpbnVlOworCisJCQlyYyA9IHN0bF9pbml0cGNpYnJkKHN0bF9wY2licmRzW2ldLmJyZHR5cGUsIGRldik7CisJCQlpZiAocmMpCisJCQkJcmV0dXJuKHJjKTsKKwkJfQorCisJcmV0dXJuKDApOworfQorCisjZW5kaWYKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJU2NhbiB0aHJvdWdoIGFsbCB0aGUgYm9hcmRzIGluIHRoZSBjb25maWd1cmF0aW9uIGFuZCBzZWUgd2hhdCB3ZQorICoJY2FuIGZpbmQuIEhhbmRsZSBFSU8gYW5kIHRoZSBFQ0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HIyID0gY29uZnAtPmlvYWRkcjI7CisJCWJyZHAtPmlycSA9IGNvbmZwLT5pcnE7CisJCWJyZHAtPmlycXR5cGUgPSBjb25mcC0+aXJxdHlwZTsKKwkJc3RsX2JyZGluaXQoYnJkcCk7CisJfQorCisvKgorICoJRmluZCBhbnkgZHluYW1pY2FsbHkgc3VwcG9ydGVkIGJvYXJkcy4gVGhhdCBpcyB2aWEgbW9kdWxlIGxvYWQKKyAqCWxpbmUgb3B0aW9ucyBvciBhdXRvLWRldGVjdGVkIG9uIHRoZSBQQ0kgYnVzLgorICovCisJc3RsX2FyZ2JyZHMoKTsKKyNpZmRlZiBDT05GSUdfUENJCisJc3RsX2ZpbmRwY2licmRzKCk7CisjZW5kaWYKKworCXJldHVybigwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJUmV0dXJuIHRoZSBib2FyZCBzdGF0cyBzdHJ1Y3R1cmUgdG8gdXNlciBhcHAuCisgKi8KKworc3RhdGljIGludCBzdGxfZ2V0YnJkc3RhdHMoY29tYnJkX3QgX191c2VyICpicCkKK3sKKwlzdGxicmRfdAkqYnJkcDsKKwlzdGxwYW5lbF90CSpwYW5lbHA7CisJaW50CQlpOworCisJaWYgKGNvcHlfZnJvbV91c2VyKCZzdGxfYnJkc3RhdHMsIGJwLCBzaXplb2YoY29tYnJkX3QpKSkKKwkJcmV0dXJuIC1FRkFVTFQ7CisJaWYgKHN0bF9icmRzdGF0cy5icmQgPj0gU1RMX01BWEJSRFMpCisJCXJldHVybigtRU5PREVWKTsKKwlicmRwID0gc3RsX2JyZHNbc3RsX2JyZHN0YXRzLmJyZF07CisJaWYgKGJyZHAgPT0gKHN0bGJyZF90ICopIE5VTEwpCisJCXJldHVybigtRU5PREVWKTsKKworCW1lbXNldCgmc3RsX2JyZHN0YXRzLCAwLCBzaXplb2YoY29tYnJkX3QpKTsKKwl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bmVsbnIsIGludCBwb3J0bnIpCit7CisJc3RsYnJkX3QJKmJyZHA7CisJc3RscGFuZWxfdAkqcGFuZWxwOworCisJaWYgKChicmRuciA8IDApIHx8IChicmRuciA+PSBTVExfTUFYQlJEUykpCisJCXJldHVybigoc3RscG9ydF90ICopIE5VTEwpOworCWJyZHAgPSBzdGxfYnJkc1ticmRucl07CisJaWYgKGJyZHAgPT0gKHN0bGJyZF90ICopIE5VTEwpCisJCXJldHVybigoc3RscG9ydF90ICopIE5VTEwpOworCWlmICgocGFuZWxuciA8IDApIHx8IChwYW5lbG5yID49IGJyZHAtPm5ycGFuZWxzKSkKKwkJcmV0dXJuKChzdGxwb3J0X3QgKikgTlVMTCk7CisJcGFuZWxwID0gYnJkcC0+cGFuZWxzW3BhbmVsbnJdOworCWlmIChwYW5lbHAgPT0gKHN0bHBhbmVsX3QgKikgTlVMTCkKKwkJcmV0dXJuKChzdGxwb3J0X3QgKikgTlVMTCk7CisJaWYgKChwb3J0bnIgPCAwKSB8fCAocG9ydG5yID49IHBhbmVscC0+bnJwb3J0cykpCisJCXJldHVybigoc3RscG9ydF90ICopIE5VTEwpOworCXJldHVybihwYW5lbHAtPnBvcnRzW3BvcnRucl0pOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglSZXR1cm4gdGhlIHBvcnQgc3RhdHMgc3RydWN0dXJlIHRvIHVzZXIgYXBwLiBBIE5VTEwgcG9ydCBzdHJ1Y3QKKyAqCXBvaW50ZXIgcGFzc2VkIGluIG1lYW5zIHRoYXQgd2UgbmVlZCB0byBmaW5kIG91dCBmcm9tIHRoZSBhcHAKKyAqCXdoYXQgcG9ydCB0byBnZXQgc3RhdHMgZm9yICh1c2VkIHRocm91Z2ggYm9hcmQgY29udHJvbCBkZXZpY2UpLgorICovCisKK3N0YXRpYyBpbnQgc3RsX2dldHBvcnRzdGF0cyhz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bW15cG9ydCwgYXJnLCBzaXplb2Yoc3RscG9ydF90KSkpCisJCXJldHVybiAtRUZBVUxUOworCXBvcnRwID0gc3RsX2dldHBvcnQoc3RsX2R1bW15cG9ydC5icmRuciwgc3RsX2R1bW15cG9ydC5wYW5lbG5yLAorCQkgc3RsX2R1bW15cG9ydC5wb3J0bnIpOworCWlmICghcG9ydHApCisJCXJldHVybiAtRU5PREVWOworCXJldHVybiBjb3B5X3RvX3VzZXIoYXJnLCBwb3J0cCwgc2l6ZW9mKHN0bHBvcnRfdCkpID8gLUVGQVVMVCA6IDA7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVJldHVybiB0aGUgZW50aXJlIGRyaXZlciBib2FyZCBzdHJ1Y3R1cmUgdG8gYSB1c2VyIGFwcC4KKyAqLworCitzdGF0aWMgaW50IHN0bF9nZXRicmRzdHJ1Y3Qoc3RsYnJkX3QgX191c2VyICphcmcpCit7CisJc3RsYnJkX3QJKmJyZHA7CisKKwlpZiAoY29weV9mcm9tX3VzZXIoJnN0bF9kdW1teWJyZCwgYXJnLCBzaXplb2Yoc3RsYnJkX3QpKSkKKwkJcmV0dXJuIC1FRkFVTFQ7CisJaWYgKChzdGxfZHVtbXlicmQuYnJkbnIgPCAwKSB8fCAoc3RsX2R1bW15YnJkLmJyZG5yID49IFNUTF9NQVhCUkRTKSkKKwkJcmV0dXJuIC1FTk9ERVY7CisJYnJkcCA9IHN0bF9icmRzW3N0bF9kdW1teWJyZC5icmRucl07CisJaWYgKCFicmRwKQorCQlyZXR1cm4oLUVOT0RFVik7CisJcmV0dXJuIGNvcHlfdG9fdXNlcihhcmcsIGJyZHAsIHNpemVvZihzdGxicmRfdCkpID8gLUVGQVVMVCA6IDA7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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2ZXJcbiIpOworCQlyZXR1cm4gLTE7CisJfQorCisJcmV0dXJuKDApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgQ0QxNDAwIEhBUkRXQVJFIEZVTkNUSU9OUyAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglUaGVzZSBmdW5jdGlvbnMgZ2V0L3NldC91cGRhdGUgdGhlIHJlZ2lzdGVycyBvZiB0aGUgY2QxNDAwIFVBUlRzLgorICoJQWNjZXNzIHRvIHRoZSBjZDE0MDAgcmVnaXN0ZXJzIGlzIHZpYSBhbiBhZGRyZXNzL2RhdGEgaW8gcG9ydCBwYWlyLgorICoJKE1heWJlIHNob3VsZCBtYWtlIHRoaXMgaW5saW5lLi4uKQorICovCisKK3N0YXRpYyBpbnQgc3RsX2NkMTQwMGdldHJlZyhzdGxwb3J0X3QgKnBvcnRwLCBpbnQgcmVnbnIpCit7CisJb3V0YigocmVnbnIgKyBwb3J0cC0+dWFydGFkZHIpLCBwb3J0cC0+aW9hZGRyKTsKKwlyZXR1cm4oaW5iKHBvcnRwLT5pb2FkZHIgKyBFUkVHX0RBVEEpKTsKK30KKworc3RhdGljIHZvaWQgc3RsX2NkMTQwMHNldHJlZyhzdGxwb3J0X3QgKnBvcnRwLCBpbnQgcmVnbnIsIGludCB2YWx1ZSkKK3sKKwlvdXRiKChyZWduciArIHBvcnRwLT51YXJ0YWRkciksIHBvcnRwLT5pb2FkZHIpOworCW91dGIodmFsdWUsIHBvcnRwLT5pb2FkZHIgKyBFUkVHX0RBVEEpOworfQorCitzdGF0aWMgaW50IHN0bF9jZDE0MDB1cGRhdGVyZWcoc3RscG9ydF90ICpwb3J0c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lbHAtPmJyZG5yLCBwYW5lbHAtPnBhbmVsbnIsIGkpOworCQkJY29udGludWU7CisJCX0KKwkJY2hpcG1hc2sgfD0gKDB4MSA8PCBpKTsKKwkJb3V0YigoUFBSICsgdWFydGFkZHIpLCBpb2FkZHIpOworCQlvdXRiKFBQUl9TQ0FMQVIsIChpb2FkZHIgKyBFUkVHX0RBVEEpKTsKKwl9CisKKwlCUkRESVNBQkxFKHBhbmVscC0+YnJkbnIpOworCXJldHVybihjaGlwbWFzayk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCUluaXRpYWxpemUgaGFyZHdhcmUgc3BlY2lmaWMgcG9ydCByZWdpc3RlcnMuCisgKi8KKworc3RhdGljIHZvaWQgc3RsX2NkMTQwMHBvcnRpbml0KHN0bGJyZF90ICpicmRwLCBzdGxwYW5lbF90ICpwYW5lbHAsIHN0bHBvcnRfdCAqcG9ydHApCit7CisjaWZkZWYgREVCVUcKKwlwcmludGsoInN0bF9jZDE0MDBwb3J0aW5pdChicmRwPSV4LHBhbmVscD0leCxwb3J0cD0leClcbiIsCisJCShpbnQpIGJyZHAsIChpbnQpIHBhbmVscCwgKGludCkgcG9ydHApOworI2VuZGlmCisKKwlpZiAoKGJyZHAgPT0gKHN0bGJyZF90ICopIE5VTEwpIHx8IChwYW5lbHAgPT0gKHN0bHBhbmVsX3QgKikgTlVMTCkgfHwKKwkgICAgKHBvcnRwID09IChzdGxwb3J0X3QgKikgTlVMTCkpCisJCXJldHVybjsKKworCXBvcnRwLT5pb2FkZHIgPSBwYW5lbHAtPmlvYmFzZSArICgoKGJyZHAtPmJyZHR5cGUgPT0gQlJEX0VDSFBDSSkgfHwKKwkJKHBvcnRwLT5wb3J0bnIgPCA4KSkgPyAwIDogRVJFR19CQU5LU0laRSk7CisJcG9ydHAtPnVhcnRhZGRyID0gKHBvcnRwLT5wb3J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KioqKioqLworCisvKgorICoJRGlzYWJsZSBhbGwgaW50ZXJydXB0cyBmcm9tIHRoaXMgcG9ydC4KKyAqLworCitzdGF0aWMgdm9pZCBzdGxfY2QxNDAwZGlzYWJsZWludHJzKHN0bHBvcnRfdCAqcG9ydHApCit7CisJdW5zaWduZWQgbG9uZwlmbGFnczsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfY2QxNDAwZGlzYWJsZWludHJzKHBvcnRwPSV4KVxuIiwgKGludCkgcG9ydHApOworI2VuZGlmCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpKCk7CisJQlJERU5BQkxFKHBvcnRwLT5icmRuciwgcG9ydHAtPnBhZ2Vucik7CisJc3RsX2NkMTQwMHNldHJlZyhwb3J0cCwgQ0FSLCAocG9ydHAtPnBvcnRuciAmIDB4MDMpKTsKKwlzdGxfY2QxNDAwc2V0cmVnKHBvcnRwLCBTUkVSLCAwKTsKKwlCUkRESVNBQkxFKHBvcnRwLT5icmRucik7CisJcmVzdG9yZV9mbGFncyhmbGFncyk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgc3RsX2NkMTQwMHNlbmRicmVhayhzdGxwb3J0X3QgKnBvcnRwLCBpbnQgbGVuKQoreworCXVuc2lnbmVkIGxvbmcJZmxhZ3M7CisKKyNpZmRlZiBERUJVRworCXByaW50aygic3RsX2NkMTQwMHNlbmRicmVhayhwb3J0cD0leCxsZW49JWQpXG4iLCAoaW50KSBwb3J0cCwgbGVuKTsKKyNlbmRpZgorCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpKCk7CisJQlJERU5BQkxFKHBvcnRwLT5icmRuciwgcG9ydHAtPnBhZ2Vucik7CisJc3RsX2NkMTQwMHNldHJlZyhwb3J0cCwgQ0FSLCAocG9ydHAtPnBvcnRuciAmIDB4MDMpKTsKKwl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ZDE0MDBzZXRyZWcocG9ydHAsIENDUiwgQ0NSX1RYRkxVU0hGSUZPKTsKKwlzdGxfY2QxNDAwY2Nyd2FpdChwb3J0cCk7CisJcG9ydHAtPnR4LnRhaWwgPSBwb3J0cC0+dHguaGVhZDsKKwlCUkRESVNBQkxFKHBvcnRwLT5icmRucik7CisJcmVzdG9yZV9mbGFncyhmbGFncyk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVJldHVybiB0aGUgY3VycmVudCBzdGF0ZSBvZiBkYXRhIGZsb3cgb24gdGhpcyBwb3J0LiBUaGlzIGlzIG9ubHkKKyAqCXJlYWxseSBpbnRlcnJlc3Rpbmcgd2hlbiBkZXRlcm1pbmluZyBpZiBkYXRhIGhhcyBmdWxseSBjb21wbGV0ZWQKKyAqCXRyYW5zbWlzc2lvbiBvciBub3QuLi4gVGhpcyBpcyBlYXN5IGZvciB0aGUgY2QxNDAwLCBpdCBhY2N1cmF0ZWx5CisgKgltYWludGFpbnMgdGhlIGJ1c3kgcG9ydCBmbGFnLgorICovCisKK3N0YXRpYyBpbnQgc3RsX2NkMTQwMGRhdGFzdGF0ZShzdGxwb3J0X3QgKnBvcnRwKQoreworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfY2QxNDAwZGF0YXN0YXRlKHBvcnRwPSV4KVxuIiwgKGludCkgcG9ydHApOworI2VuZGlmCisKKwlpZiAocG9ydHAgPT0gKHN0bHBvcnRfdCAqKSBOVUxMKQorCQlyZXR1cm4oMCk7CisKKwlyZXR1cm4odGVzdF9iaXQoQVNZSV9UWEJVU1ksICZwb3J0cC0+aXN0YXRlKSA/IDEgOiAwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJSW50ZXJydXB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dGIoKGluYihpb2FkZHIgKyBFUkVHX0RBVEEpIHwgQ09SMl9FVEMpLAorCQkJKGlvYWRkciArIEVSRUdfREFUQSkpOworCQlvdXRiKChURFIgKyBwb3J0cC0+dWFydGFkZHIpLCBpb2FkZHIpOworCQlvdXRiKEVUQ19DTUQsIChpb2FkZHIgKyBFUkVHX0RBVEEpKTsKKwkJb3V0YihFVENfU1RBUlRCUkVBSywgKGlvYWRkciArIEVSRUdfREFUQSkpOworCQlvdXRiKChTUkVSICsgcG9ydHAtPnVhcnRhZGRyKSwgaW9hZGRyKTsKKwkJb3V0YigoaW5iKGlvYWRkciArIEVSRUdfREFUQSkgJiB+KFNSRVJfVFhEQVRBIHwgU1JFUl9UWEVNUFRZKSksCisJCQkoaW9hZGRyICsgRVJFR19EQVRBKSk7CisJCXJldHVybigxKTsKKwl9IGVsc2UgaWYgKHBvcnRwLT5icmtsZW4gPiAxKSB7CisJCW91dGIoKFREUiArIHBvcnRwLT51YXJ0YWRkciksIGlvYWRkcik7CisJCW91dGIoRVRDX0NNRCwgKGlvYWRkciArIEVSRUdfREFUQSkpOworCQlvdXRiKEVUQ19TVE9QQlJFQUssIChpb2FkZHIgKyBFUkVHX0RBVEEpKTsKKwkJcG9ydHAtPmJya2xlbiA9IC0xOworCQlyZXR1cm4oMSk7CisJfSBlbHNlIHsKKwkJb3V0YigoQ09SMiArIHBvcnRwLT51YXJ0YWRkciksIGlvYWRkcik7CisJCW91dGIoKGluYihpb2FkZHIgKyBFUkVHX0RBVEEpICYgfkNPUjJfRVRDKSwKKwkJCShpb2FkZHIgKyBFUkVHX0RBVEEpKTsKKwkJcG9ydHAtPmJya2xlbiA9IDA7CisJfQorCXJldHVybigwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKgorICoJVHJhbnNtaXQgaW50ZXJydXB0IGhhbmRsZXIuIFRoaXMgaGFzIGdv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KKwlpb2FjayA9IGluYihpb2FkZHIgKyBFUkVHX01EQUNLKTsKKwlpZiAoKChpb2FjayAmIHBhbmVscC0+YWNrbWFzaykgIT0gMCkgfHwKKwkgICAgKChpb2FjayAmIEFDS19UWVBNQVNLKSAhPSBBQ0tfVFlQTURNKSkgeworCQlwcmludGsoIlNUQUxMSU9OOiBiYWQgTU9ERU0gaW50ZXJydXB0IGFjayB2YWx1ZT0leFxuIiwgaW9hY2spOworCQlyZXR1cm47CisJfQorCXBvcnRwID0gcGFuZWxwLT5wb3J0c1soaW9hY2sgPj4gMyldOworCisJb3V0YigoTUlTUiArIHBvcnRwLT51YXJ0YWRkciksIGlvYWRkcik7CisJbWlzciA9IGluYihpb2FkZHIgKyBFUkVHX0RBVEEpOworCWlmIChtaXNyICYgTUlTUl9EQ0QpIHsKKwkJc2V0X2JpdChBU1lJX0RDRENIQU5HRSwgJnBvcnRwLT5pc3RhdGUpOworCQlzY2hlZHVsZV93b3JrKCZwb3J0cC0+dHF1ZXVlKTsKKwkJcG9ydHAtPnN0YXRzLm1vZGVtKys7CisJfQorCisJb3V0YigoRU9TUlIgKyBwb3J0cC0+dWFydGFkZHIpLCBpb2FkZHIpOworCW91dGIoMCwgKGlvYWRkciArIEVSRUdfREFUQSkpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICBTQzI2MTk4IEhBUkRXQVJFIEZVTkNUSU9OUyAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglUaGVzZSBmdW5jdGlvbnMgZ2V0L3NldC91cGRhdGUgdGhlIHJlZ2lzdGVycyBvZiB0aGUgc2MyNjE5OCBVQVJUcy4KKyAqCUFjY2VzcyB0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KKwlCUkRESVNBQkxFKHBvcnRwLT5icmRucik7CisJcG9ydHAtPmNyZW5hYmxlID0gY2NyOworCXJlc3RvcmVfZmxhZ3MoZmxhZ3MpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglTdGFydC9zdG9wIHRoZSBUcmFuc21pdHRlciBhbmQvb3IgUmVjZWl2ZXIuCisgKi8KKworc3RhdGljIHZvaWQgc3RsX3NjMjYxOThzdGFydHJ4dHgoc3RscG9ydF90ICpwb3J0cCwgaW50IHJ4LCBpbnQgdHgpCit7CisJdW5zaWduZWQgY2hhcglpbXI7CisJdW5zaWduZWQgbG9uZwlmbGFnczsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfc2MyNjE5OHN0YXJ0cnh0eChwb3J0cD0leCxyeD0lZCx0eD0lZClcbiIsCisJCShpbnQpIHBvcnRwLCByeCwgdHgpOworI2VuZGlmCisKKwlpbXIgPSBwb3J0cC0+aW1yOworCWlmICh0eCA9PSAwKQorCQlpbXIgJj0gfklSX1RYUkRZOworCWVsc2UgaWYgKHR4ID09IDEpCisJCWltciB8PSBJUl9UWFJEWTsKKwlpZiAocnggPT0gMCkKKwkJaW1yICY9IH4oSVJfUlhSRFkgfCBJUl9SWEJSRUFLIHwgSVJfUlhXQVRDSERPRyk7CisJZWxzZSBpZiAocnggPiAwKQorCQlpbXIgfD0gSVJfUlhSRFkgfCBJUl9SWEJSRUFLIHwgSVJfUlhXQVRDSERPRzsKKworCXNhdmVfZmxhZ3MoZmxhZ3MpOworCWNsaSgpOworCUJSREVOQUJMRShwb3J0cC0+YnJkbnIsIHBvcnRwLT5wYWdlbnIpOworCXN0bF9zYzI2MTk4c2V0cmVnKHBvcnRwLCBJTVIsIGltcik7CisJQlJERElTQUJMRShwb3J0cC0+YnJkbnIpOworCXBvcnRwLT5pbXIgPSBpbXI7CisJaWYgKHR4ID4gMCkKKwkJc2V0X2JpdChBU1lJX1RYQlVTWSwgJnBvcnRwLT5pc3RhdGUpOworCXJlc3RvcmVfZmxhZ3MoZmxhZ3MpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKglEaXNhYmxlIGFsbCBpbnRlcnJ1cHRzIGZyb20gdGhpcyBwb3J0LgorICovCisKK3N0YXRpYyB2b2lkIHN0bF9zYzI2MTk4ZGlzYWJsZWludHJzKHN0bHBvcnRfdCAqcG9ydHApCit7CisJdW5zaWduZWQgbG9uZwlmbGFnczsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfc2MyNjE5OGRpc2FibGVpbnRycyhwb3J0cD0leClcbiIsIChpbnQpIHBvcnRwKTsKKyNlbmRpZgorCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpKCk7CisJQlJERU5BQkxFKHBvcnRwLT5icmRuciwgcG9ydHAtPnBhZ2Vucik7CisJcG9ydHAtPmltciA9IDA7CisJc3RsX3NjMjYxOThzZXRyZWcocG9ydHAsIElNUiwgMCk7CisJQlJERElTQUJMRShwb3J0cC0+YnJkbnIpOworCXJlc3RvcmVfZmxhZ3MoZmxhZ3MpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKK3N0YXRpYyB2b2lkIHN0bF9zYzI2MTk4c2VuZGJyZWFrKHN0bHBvcnRfdCAqcG9ydHAsIGludCBsZW4pCit7CisJdW5zaWduZWQgbG9uZwlmbGFnczsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfc2MyNjE5OHNlbmRicmVhayhwb3J0cD0leCxsZW49JWQpXG4iLCAoaW50KSBwb3J0cCwgbGVuKTsKKyNlbmRpZgorCisJc2F2ZV9mbGFncyhmbGFncyk7CisJY2xpK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RlJYOworCQlwb3J0cC0+c3RhdHMucnh4b2ZmKys7CisJCXN0bF9zYzI2MTk4d2FpdChwb3J0cCk7CisJCXN0bF9zYzI2MTk4c2V0cmVnKHBvcnRwLCBNUjAsIG1yMCk7CisJfQorCUJSRERJU0FCTEUocG9ydHAtPmJyZG5yKTsKKwlyZXN0b3JlX2ZsYWdzKGZsYWdzKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCitzdGF0aWMgdm9pZCBzdGxfc2MyNjE5OGZsdXNoKHN0bHBvcnRfdCAqcG9ydHApCit7CisJdW5zaWduZWQgbG9uZwlmbGFnczsKKworI2lmZGVmIERFQlVHCisJcHJpbnRrKCJzdGxfc2MyNjE5OGZsdXNoKHBvcnRwPSV4KVxuIiwgKGludCkgcG9ydHApOworI2VuZGlmCisKKwlpZiAocG9ydHAgPT0gKHN0bHBvcnRfdCAqKSBOVUxMKQorCQlyZXR1cm47CisKKwlzYXZlX2ZsYWdzKGZsYWdzKTsKKwljbGkoKTsKKwlCUkRFTkFCTEUocG9ydHAtPmJyZG5yLCBwb3J0cC0+cGFnZW5yKTsKKwlzdGxfc2MyNjE5OHNldHJlZyhwb3J0cCwgU0NDUiwgQ1JfVFhSRVNFVCk7CisJc3RsX3NjMjYxOThzZXRyZWcocG9ydHAsIFNDQ1IsIHBvcnRwLT5jcmVuYWJsZSk7CisJQlJERElTQUJMRShwb3J0cC0+YnJkbnIpOworCXBvcnRwLT50eC50YWlsID0gcG9ydHAtPnR4LmhlYWQ7CisJcmVzdG9yZV9mbGFncyhmbGFncyk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoKKyAqCVJldHVybiB0aGUgY3VycmVudCBzdGF0ZSBvZiBkYXRhIGZsb3cgb24gdGhpcyBwb3J0L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cyBpdHMgT1dOIGJ1cy4uLiAqLworCisjZGVmaW5lIFRJTUVPVVRfMSAzMAorI2RlZmluZSBUSU1FT1VUXzIgMTAwMDAwMAorCisKKyNpZmRlZiBERUJVRworc3RhdGljIHZvaWQgbXlfaGRfaW8odm9pZCBfX2lvbWVtICpwLCBpbnQgbGVuKQoreworCWludCBpLCBqLCBjaDsKKwl1bnNpZ25lZCBjaGFyIF9faW9tZW0gKmFkZHIgPSBwOworCisJZm9yIChpPTA7aTxsZW47aSs9MTYpIHsKKwkJcHJpbnRrICgiJXAgIiwgYWRkcitpKTsKKwkJZm9yIChqPTA7ajwxNjtqKyspIHsKKwkJCXByaW50ayAoIiUwMnggJXMiLCByZWFkYihhZGRyK2oraSksIChqPT03KT8iICI6IiIpOworCQl9CisJCWZvciAoaj0wO2o8MTY7aisrKSB7CisJCQljaCA9IHJlYWRiKGFkZHIraitpKTsKKwkJCXByaW50ayAoIiVjIiwgKGNoIDwgMHgyMCk/Jy4nOigoY2ggPiAweDdmKT8nLic6Y2gpKTsKKwkJfQorCQlwcmludGsgKCJcbiIpOworCX0KK30KK3N0YXRpYyB2b2lkIG15X2hkKHZvaWQgKnAsIGludCBsZW4pCit7CisJaW50IGksIGosIGNoOworCXVuc2lnbmVkIGNoYXIgKmFkZHIgPSBwOworCisJZm9yIChpPTA7aTxsZW47aSs9MTYpIHsKKwkJcHJpbnRrICgiJXAgIiwgYWRkcitpKTsKKwkJZm9yIChqPTA7ajwxNjtqKyspIHsKKwkJCXByaW50ayAoIiUwMnggJXMiLCBhZGRyW2oraV0sIChqPT03KT8iICI6IiIpOworCQl9CisJCWZvciAoaj0wO2o8MTY7aisrKSB7CisJCQljaCA9IGFkZHJbaitpXTsKKwkJCXByaW50ayAoIiVjIiwgKGNoIDwgMHgyMCk/Jy4nOigoY2ggPiAweDdmKT8nLic6Y2gpKTsKKwkJfQorCQlwcmludGsgKCJcbiIpOworCX0KK30KKyNlbmRpZgorCisKKworLyogVGhpcyBuZWVkcyBy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SsrKSB7CisJCWlmICgocmVhZF9zeF9ieXRlIChib2FyZCwgb2Zmc2V0KSAmIG1hc2spID09IGNvcnJlY3R2YWwpIHsKKwkJCWZ1bmNfZXhpdCAoKTsKKwkJCXJldHVybiAxOworCQl9CisJCXVkZWxheSAoMSk7CisJfQorCisJZnVuY19leGl0ICgpOworCXJldHVybiAwOworfQorCisKK3N0YXRpYyBpbnQgc3hfYnVzeV93YWl0X25lcSAoc3RydWN0IHN4X2JvYXJkICpib2FyZCwgCisgICAgICAgICAgICAgICAgICAgICAgCSAgICAgaW50IG9mZnNldCwgaW50IG1hc2ssIGludCBiYWR2YWwpCit7CisJaW50IGk7CisKKwlmdW5jX2VudGVyICgpOworCisJZm9yIChpPTA7IGkgPCBUSU1FT1VUXzEgO2krKykKKwkJaWYgKChyZWFkX3N4X2J5dGUgKGJvYXJkLCBvZmZzZXQpICYgbWFzaykgIT0gYmFkdmFsKSB7CisJCQlmdW5jX2V4aXQgKCk7CisJCQlyZXR1cm4gMTsKKwkJfQorCisJZm9yIChpPTA7IGkgPCBUSU1FT1VUXzIgO2krKykgeworCQlpZiAoKHJlYWRfc3hfYnl0ZSAoYm9hcmQsIG9mZnNldCkgJiBtYXNrKSAhPSBiYWR2YWwpIHsKKwkJCWZ1bmNfZXhpdCAoKTsKKwkJCXJldHVybiAxOworCQl9CisJCXVkZWxheSAoMSk7CisJfQorCisJZnVuY19leGl0ICgpOworCXJldHVybiAwOworfQorCisKKworLyogNS42LjQgb2YgNjIxMDAyOCByMi4zICovCitzdGF0aWMgaW50IHN4X3Jlc2V0IChzdHJ1Y3Qgc3hfYm9hcmQgKmJvYXJkKQoreworCWZ1bmNfZW50ZXIgKCk7CisKKwlpZiAoSVNfU1hfQk9BUkQgKGJvYXJkKSkgeworCisJCXdyaXRlX3N4X2J5dGUgKGJvYXJkLCBTWF9DT05GSUcsIDApOworCQl3cml0ZV9zeF9ieXRlIChib2FyZCwgU1hfUkVTRVQsIDEpOyAvKiBWYWx1ZSBk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WJyZWFrOworCX0KKworCXN4X3dyaXRlX2NoYW5uZWxfYnl0ZSAocG9ydCwgaGlfcHJ0Y2wsIAorCSAgICAgICAgICAgICAgICAgICAgICAgKElfSVhPTiAgIChwb3J0LT5ncy50dHkpP1NQX1RYRU46MCkgfAorCSAgICAgICAgICAgICAgICAgICAgICAgKElfSVhPRkYgIChwb3J0LT5ncy50dHkpP1NQX1JYRU46MCkgfAorCSAgICAgICAgICAgICAgICAgICAgICAgKElfSVhBTlkgIChwb3J0LT5ncy50dHkpP1NQX1RBTlk6MCkgfAorCSAgICAgICAgICAgICAgICAgICAgICAgU1BfRENFTik7CisKKwlzeF93cml0ZV9jaGFubmVsX2J5dGUgKHBvcnQsIGhpX2JyZWFrLCAKKwkgICAgICAgICAgICAgICAgICAgICAgIChJX0lHTkJSSyhwb3J0LT5ncy50dHkpP0JSX0lHTjowIHwKKwkgICAgICAgICAgICAgICAgICAgICAgICBJX0JSS0lOVChwb3J0LT5ncy50dHkpP0JSX0lOVDowKSk7CisKKwlzeF93cml0ZV9jaGFubmVsX2J5dGUgKHBvcnQsIGhpX3R4b24sICBTVEFSVF9DSEFSIChwb3J0LT5ncy50dHkpKTsKKwlzeF93cml0ZV9jaGFubmVsX2J5dGUgKHBvcnQsIGhpX3J4b24sICBTVEFSVF9DSEFSIChwb3J0LT5ncy50dHkpKTsKKwlzeF93cml0ZV9jaGFubmVsX2J5dGUgKHBvcnQsIGhpX3R4b2ZmLCBTVE9QX0NIQVIgIChwb3J0LT5ncy50dHkpKTsKKwlzeF93cml0ZV9jaGFubmVsX2J5dGUgKHBvcnQsIGhpX3J4b2ZmLCBTVE9QX0NIQVIgIChwb3J0LT5ncy50dHkpKTsKKworCXN4X3JlY29uZmlndXJlX3BvcnQocG9ydCk7CisKKwkvKiBUZWxsIGxpbmUgZGlzY2lwbGluZSB3aGV0aGVyIHdlIHdpbGwgZG8gaW5wdXQgY29va2luZyAqLworCWlmKElfT1RIRVIocG9ydC0+Z3MudHR5KSkge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+Y19kY2QgPSBzeF9nZXRfQ0QgKHBvcnQpOyAqLworCWZ1bmNfZXhpdCAoKTsKKwlyZXR1cm4gMDsKK30KKworCisKKy8qICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogKgorICogICAgICAgICAgICAgICAgICAgdGhlIGludGVycnVwdCByZWxhdGVkIHJvdXRpbmVzICAgICAgICAgICAgICAgICAgICAgICAqCisgKiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICovCisKKy8qIE5vdGU6CisgICBPdGhlciBkcml2ZXJzIHVzZSB0aGUgbWFjcm8gIk1JTiIgdG8gY2FsY3VsYXRlIGhvdyBtdWNoIHRvIGNvcHkuCisgICBUaGlzIGhhcyB0aGUgZGlzYWR2YW50YWdlIHRoYXQgaXQgd2lsbCBldmFsdWF0ZSBwYXJ0cyB0d2ljZS4gVGhhdCdzCisgICBleHBlbnNpdmUgd2hlbiBpdCdzIElPIChhbmQgdGhlIGNvbXBpbGVyIGNhbm5vdCBvcHRpbWl6ZSB0aG9zZSBhd2F5ISkuCisgICBNb3Jlb3ZlciwgSSdtIG5vdCBzdXJlIHRoYXQgeW91J3JlIHJhY2UtZnJlZS4gCisKKyAgIEkgYXNzaWduIGEgdmFsdWUsIGFuZCB0aGVuIG9ubHkgYWxsb3cgdGhlIHZhbHVlIHRvIGRlY3JlYXNlLiBUaGlzCisgICBpcyBhbHdheXMgc2FmZS4gVGhpcyBtYWtlcyB0aGUgY29kZSBhIGZldyBsaW5lcyBsb25nZXIsIGFuZCB5b3UKKyAgIGtub3cgSSdtIGRlYWQgYWdhaW5zdCB0aGF0LCBidXQgSSB0aGluayBpdCBpcyByZXF1aXJlZCBpbiB0aGlzCisgICBjYXNlLiAgKi8KKworCitzdGF0aWMgdm9pZCBzeF90cmFuc21pdF9jaGFycyAoc3RydWN0IHN4X3BvcnQg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MRSkpIHsKKwkJCQlzeF9yZWNlaXZlX2NoYXJzIChwb3J0KTsKKwkJCX0KKwkJfQorCX0KKworCWNsZWFyX2JpdCAoU1hfQk9BUkRfSU5UUl9MT0NLLCAmYm9hcmQtPmxvY2tzKTsKKworCXN4X2RwcmludGsgKFNYX0RFQlVHX0ZMT1csICJzeDogZXhpdCBzeF9pbnRlcnJ1cHQgKCVkLyVkKVxuIiwgaXJxLCBib2FyZC0+aXJxKTsgCisgICAgICAgIGZ1bmNfZXhpdCAoKTsKKwlyZXR1cm4gSVJRX0hBTkRMRUQ7Cit9CisKKworc3RhdGljIHZvaWQgc3hfcG9sbGZ1bmMgKHVuc2lnbmVkIGxvbmcgZGF0YSkKK3sKKwlzdHJ1Y3Qgc3hfYm9hcmQgKmJvYXJkID0gKHN0cnVjdCBzeF9ib2FyZCAqKSBkYXRhOworCisJZnVuY19lbnRlciAoKTsKKworCXN4X2ludGVycnVwdCAoMCwgYm9hcmQsIE5VTEwpOworCisJaW5pdF90aW1lcigmYm9hcmQtPnRpbWVyKTsKKworCWJvYXJkLT50aW1lci5leHBpcmVzID0gamlmZmllcyArIHN4X3BvbGw7CisJYWRkX3RpbWVyICgmYm9hcmQtPnRpbWVyKTsKKwlmdW5jX2V4aXQgKCk7Cit9CisKKworCisvKiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICoKKyAqICAgICAgICAgICAgICAgIEhlcmUgYXJlIHRoZSByb3V0aW5lcyB0aGF0IGFjdHVhbGx5ICAgICAgICAgICAgICAgICAgICAgKgorICogICAgICAgICAgICAgIGludGVyZmFjZSB3aXRoIHRoZSBnZW5lcmljX3NlcmlhbCBkcml2ZXIgICAgICAgICAgICAgICAgICAqCisgKiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICovCisKKy8qIEVoaG0uIEkgZG9uJ3Qga25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iAweGZmKTsKK30KKworCitzdGF0aWMgdm9pZCBzeF9zaHV0ZG93bl9wb3J0ICh2b2lkICogcHRyKSAKK3sKKwlzdHJ1Y3Qgc3hfcG9ydCAqcG9ydCA9IHB0cjsgCisKKwlmdW5jX2VudGVyKCk7CisKKwlwb3J0LT5ncy5mbGFncyAmPSB+IEdTX0FDVElWRTsKKwlpZiAocG9ydC0+Z3MudHR5ICYmIChwb3J0LT5ncy50dHktPnRlcm1pb3MtPmNfY2ZsYWcgJiBIVVBDTCkpIHsKKwkJc3hfc2V0c2lnbmFscyAocG9ydCwgMCwgMCk7CisJCXN4X3JlY29uZmlndXJlX3BvcnQocG9ydCk7CisJfQorCisJZnVuY19leGl0KCk7Cit9CisKKworCisKKworLyogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqCisgKiAgICAgICAgICAgICAgICBIZXJlIGFyZSB0aGUgcm91dGluZXMgdGhhdCBhY3R1YWxseSAgICAgICAgICAgICAgICAgICAgICoKKyAqICAgICAgICAgICAgICAgaW50ZXJmYWNlIHdpdGggdGhlIHJlc3Qgb2YgdGhlIHN5c3RlbSAgICAgICAgICAgICAgICAgICAgKgorICogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLworCitzdGF0aWMgaW50IHN4X29wZW4gIChzdHJ1Y3QgdHR5X3N0cnVjdCAqIHR0eSwgc3RydWN0IGZpbGUgKiBmaWxwKQoreworCXN0cnVjdCBzeF9wb3J0ICpwb3J0OworCWludCByZXR2YWwsIGxpbmU7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworCWZ1bmNfZW50ZXIoKTsKKworCWlmICghc3hfaW5pdGlhbGl6ZWQpIHsKKwkJcmV0dXJuIC1FSU87CisJfQorCisJbGluZSA9IHR0eS0+aW5kZXg7CisJc3hfZHByaW50ayAoU1hfREVCVUdfT1BF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CAgICBmb3IgKGk9bWluO2k8bWF4O2krPTIpIAorI2RlZmluZSBNQVJDSERPV04gIGZvciAoaT1tYXgtMTtpPj1taW47aS09MikKKyNkZWZpbmUgVzAgICAgICAgICB3cml0ZV9zeF93b3JkIChib2FyZCwgaSwgMHg1NWFhKQorI2RlZmluZSBXMSAgICAgICAgIHdyaXRlX3N4X3dvcmQgKGJvYXJkLCBpLCAweGFhNTUpCisjZGVmaW5lIFIwICAgICAgICAgaWYgKHJlYWRfc3hfd29yZCAoYm9hcmQsIGkpICE9IDB4NTVhYSkgcmV0dXJuIDEKKyNkZWZpbmUgUjEgICAgICAgICBpZiAocmVhZF9zeF93b3JkIChib2FyZCwgaSkgIT0gMHhhYTU1KSByZXR1cm4gMQorCisjaWYgMAorLyogVGhpcyBtZW10ZXN0IHRha2VzIGEgaHVtYW4tbm90aWNhYmxlIHRpbWUuIFlvdSBub3JtYWxseSBvbmx5IGRvIGl0CisgICBvbmNlIGEgYm9vdCwgc28gSSBndWVzcyB0aGF0IGl0IGlzIHdvcnRoIGl0LiAqLworc3RhdGljIGludCBkb19tZW10ZXN0X3cgKHN0cnVjdCBzeF9ib2FyZCAqYm9hcmQsIGludCBtaW4sIGludCBtYXgpCit7CisJaW50IGk7CisKKwlNQVJDSFVQICAge1cwO30KKwlNQVJDSFVQICAge1IwO1cxO1IxO1cwO1IwO1cxO30KKwlNQVJDSFVQICAge1IxO1cwO1cxO30KKwlNQVJDSERPV04ge1IxO1cwO1cxO1cwO30KKwlNQVJDSERPV04ge1IwO1cxO1cwO30KKworCXJldHVybiAwOworfQorI2VuZGlmCisKKworc3RhdGljIGludCBzeF9md19pb2N0bCAoc3RydWN0IGlub2RlICppbm9kZSwgc3RydWN0IGZpbGUgKmZpbHAsCisgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBpbnQgY21kLCB1bnNpZ25lZCBsb25nIGFyZykKK3sKKwlpbnQgcmMgPSAwOworCWludCBfX3VzZXIgKmRlc2NyID0gKGludC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S8qIEFsd2F5cyB1bnRocm90dGxlIGV2ZW4gaWYgZmxvdyBjb250cm9sIGlzIG5vdCBlbmFibGVkIG9uCisJICogdGhpcyBwb3J0IGluIGNhc2Ugd2UgZGlzYWJsZWQgZmxvdyBjb250cm9sIHdoaWxlIHRoZSBwb3J0CisJICogd2FzIHRocm90dGxlZAorCSAqLworCXBvcnQtPmdzLmZsYWdzICY9IH5TWF9SWF9USFJPVFRMRTsKKwlmdW5jX2V4aXQoKTsKKwlyZXR1cm47Cit9CisKKworLyogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqCisgKiAgICAgICAgICAgICAgICAgICAgSGVyZSBhcmUgdGhlIGluaXRpYWxpemF0aW9uIHJvdXRpbmVzLiAgICAgICAgICAgICAgICoKKyAqICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogKi8KKworCisKKworc3RhdGljIGludCBzeF9pbml0X2JvYXJkIChzdHJ1Y3Qgc3hfYm9hcmQgKmJvYXJkKQoreworCWludCBhZGRyOworCWludCBjaGFuczsKKwlpbnQgdHlwZTsKKworCWZ1bmNfZW50ZXIoKTsKKworCS8qIFRoaXMgaXMgcHJlY2VkZWQgYnkgZG93bmxvYWRpbmcgdGhlIGRvd25sb2FkIGNvZGUuICovCisKKwlib2FyZC0+ZmxhZ3MgfD0gU1hfQk9BUkRfSU5JVElBTElaRUQ7CisKKwlpZiAocmVhZF9zeF9ieXRlIChib2FyZCwgMCkpCisJCS8qIENGIGJvYXJkcyBtYXkgbmVlZCB0aGlzLiAqLworCQl3cml0ZV9zeF9ieXRlKGJvYXJkLDAsIDApOworCisJLyogVGhpcyByZXNldHMgdGhlIHByb2Nlc3NvciBhZ2FpbiwgdG8gbWFrZSBzdXJlIGl0IGRpZG4ndCBkbyBhbnkKKwkgICBmb29saXNoIHRoaW5ncyB3aGlsZSB3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Bwb3J0cyBTSSwgWElPIGFuZCBTWCBob3N0IGNhcmRzLiAKKyAqICAtLSBTdXBwb3J0cyBUQXMsIE1UQXMgYW5kIFNYRENzLgorICoKKyAqICBWZXJzaW9uIDEuMyAtLSBNYXJjaCwgMTk5OS4gCisgKiAKKyAqLworCisjZGVmaW5lIFNYX05CT0FSRFMgICAgICAgIDQKKyNkZWZpbmUgU1hfUE9SVFNQRVJCT0FSRCAzMgorI2RlZmluZSBTWF9OUE9SVFMgICAgICAgIChTWF9OQk9BUkRTICogU1hfUE9SVFNQRVJCT0FSRCkKKworI2lmZGVmIF9fS0VSTkVMX18KKworI2RlZmluZSBTWF9NQUdJQyAweDEyMzQ1Njc4CisKK3N0cnVjdCBzeF9wb3J0IHsKKyAgc3RydWN0IGdzX3BvcnQgICAgICAgICAgZ3M7CisgIHN0cnVjdCB3YWl0X3F1ZXVlICAgICAgICpzaHV0ZG93bl93YWl0OworICBpbnQgICAgICAgICAgICAgICAgICAgICBjaF9iYXNlOworICBpbnQgICAgICAgICAgICAgICAgICAgICBjX2RjZDsKKyAgc3RydWN0IHN4X2JvYXJkICAgICAgICAgKmJvYXJkOworICBpbnQgICAgICAgICAgICAgICAgICAgICBsaW5lOworICBsb25nICAgICAgICAgICAgICAgICAgICBsb2NrczsKK307CisKK3N0cnVjdCBzeF9ib2FyZCB7CisgIGludCBtYWdpYzsKKyAgdm9pZCBfX2lvbWVtICpiYXNlOworICB2b2lkIF9faW9tZW0gKmJhc2UyOworICB1bnNpZ25lZCBsb25nIGh3X2Jhc2U7CisgIGludCBlaXNhX2Jhc2U7CisgIGludCBwb3J0X2Jhc2U7IC8qIE51bWJlciBvZiB0aGUgZmlyc3QgcG9ydCAqLworICBzdHJ1Y3Qgc3hfcG9ydCAqcG9ydHM7CisgIGludCBucG9ydHM7CisgIGludCBmbGFnczsKKyAgaW50IGlycTsKKyAgaW50IHBvbGw7CisgIGludCB0YV90eXBlOworICBzdHJ1Y3QgdGltZXJfbGlzdCAgICAgIC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KioqKioqKiovCisKKy8qIEhpc3RvcnkuLi4KKworMy4wLjAJMTYvMDMvOTggTlBWCUNyZWF0aW9uLgorCisqLworCisjaWZuZGVmCV9zeGJvYXJkc19oCQkJCS8qIElmIFNYQk9BUkRTLkggbm90IGFscmVhZHkgZGVmaW5lZCAqLworI2RlZmluZQlfc3hib2FyZHNfaCAgICAxCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgQm9hcmQgVHlwZXMgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIEJVUyB0eXBlcy4uLiAqLworI2RlZmluZQkJQlVTX0lTQQkJMAorI2RlZmluZQkJQlVTX01DQQkJMQorI2RlZmluZQkJQlVTX0VJU0EJMgorI2RlZmluZQkJQlVTX1BDSQkJMworCisvKiBCb2FyZCBwaGFzZXMuLi4gKi8KKyNkZWZpbmUJCVNJMV9aMjgwCTEKKyNkZWZpbmUJCVNJMl9aMjgwCTIKKyNkZWZpbmUJCVNJM19UMjI1CTMKKworLyogQm9hcmQgdHlwZXMuLi4gKi8KKyNkZWZpbmUJCUNBUkRfVFlQRShidXMscGhhc2UpCShidXM8PDR8cGhhc2UpCisjZGVmaW5lCQlDQVJEX0JVUyh0eXBlKQkJKCh0eXBlPj40KSYweEYpCisjZGVmaW5lCQlDQVJEX1BIQVNFKHR5cGUpCSh0eXBlJjB4RikKKworI2RlZmluZQkJVFlQRV9TSTFfSVNBCQlDQVJEX1RZUEUoQlVTX0lTQSxTSTFfWjI4MCkKKyNkZWZpbmUJCVRZUEVfU0kyX0lTQQkJQ0FSRF9UWVBFKEJVU19JU0EsU0kyX1oyODApCisjZGVmaW5lCQlUWVBFX1NJMl9FSVNBCQlDQVJEX1RZUEUoQlVTX0VJU0EsU0kyX1oyODApCisjZGVmaW5lCQlUWVBFX1NJMl9QQ0kJCUNBUkRfVFlQRShCVVNfUENJLFNJMl9aMjgwKQorCisjZGVmaW5lCQlUWVBFX1NYX0lTQQkJQ0FSRF9UWVBFKEJVU19JU0EsU0kzX1QyMjUpCisjZGVmaW5lCQlUWVBFX1NYX1BDSQkJQ0FSRF9UWVBFKEJVU19QQ0ksU0kzX1QyMjUpCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgUGhhc2UgMSBaMjgwICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiBJU0EgYm9hcmQgZGV0YWlscy4uLiAqLworI2RlZmluZQkJU0kxX0lTQV9XSU5ET1dfTEVOCTB4MTAwMDAJCS8qIDY0IEtieXRlIHNoYXJlZCBtZW1vcnkgd2luZG93ICovCisvLyNkZWZpbmUgCVNJMV9JU0FfTUVNT1JZX0xFTgkweDgwMDAJCS8qIFVzYWJsZSBtZW1vcnkgIC0g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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBQaGFzZSAyIFoyODAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIElTQSBib2FyZCBkZXRhaWxzLi4uICovCisjZGVmaW5lCQlTSTJfSVNBX1dJTkRPV19MRU4JMHg4MDAwCQkvKiAzMiBLYnl0ZSBzaGFyZWQgbWVtb3J5IHdpbmRvdyAqLworI2RlZmluZSAJU0kyX0lTQV9NRU1PUllfTEVOCTB4N0ZGOAkJLyogVXNhYmxlIG1lbW9yeSAqLworI2RlZmluZQkJU0kyX0lTQV9BRERSX0xPVwkweDBBMDAwMAkvKiBMb3dlc3QgYWRkcmVzcyA9IDY0MCBLYnl0ZSAqLworI2RlZmluZQkJU0kyX0lTQV9BRERSX0hJR0gJMHhGRjgwMDAJLyogSGlnaGVzdCBhZGRyZXNzID0gMTZNYnl0ZSAtIDMyS2J5dGUgKi8KKyNkZWZpbmUJCVNJMl9JU0FfQUREUl9TVEVQCVNJMl9JU0FfV0lORE9XX0xFTi8qIElTQSBib2FyZCBhZGRyZXNzIHN0ZXAgKi8KKyNkZWZpbmUJCVNJMl9JU0FfSVJRX01BU0sJMHg5ODAwCQkvKiBJUlFzIDE1LDEyLDExICovCisKKy8qIElTQSBib2FyZCwgcmVnaXN0ZXIgZGVmaW5pdGlvbnMuLi4gKi8KKyNkZWZpbmUJCVNJMl9JU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0lSUVNFVF9TRVQJMHgwMAorI2RlZmluZQkJU0kyX0lTQV9SRVNFVF9TRVQJMHgwMAorI2RlZmluZQkJU0kyX0lTQV9SRVNFVF9DTEVBUgkweDEwCisKKy8qIFBDSSBib2FyZCBkZXRhaWxzLi4uICovCisjZGVmaW5lCQlTSTJfUENJX1dJTkRPV19MRU4JMHgxMDAwMDAJLyogMSBNYnl0ZSBtZW1vcnkgd2luZG93ICovCisKKy8qIFBDSSBib2FyZCByZWdpc3RlciBkZWZpbml0aW9ucy4uLiAqLworI2RlZmluZQkJU0kyX1BDSV9TRVRfSVJRCQkweDQwMDAxCQkvKiBTZXQgSG9zdCBJbnRlcnJ1cHQgICovCisjZGVmaW5lCQlTSTJfUENJX1JFU0VUCQkweEMwMDAxCQkvKiBIb3N0IFJlc2V0ICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBQaGFzZSAzIFQyMjUgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qIEdlbmVyYWwgYm9hcmQgZGV0YWlscy4uLiAqLworI2RlZmluZQkJU1hfV0lORE9XX0xFTgkJNjQqMTAyNAkJLyogNjQgS2J5dGUgbWVtb3J5IHdpbmRvdyAqLworCisvKiBJU0EgYm9hcmQgZGV0YWlscy4uLiAqLworI2RlZmluZQkJU1hfSVNBX0FERFJfTE9XCQkweDBBM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9TVElSUQkJMHgwNAkJLyogRW5hYmxlIGJvYXJkIHRvIGhvc3QgaW50ZXJydXB0ICovCisKKy8qIFNYIGJvb3RzdHJhcC4uLiAqLworI2RlZmluZQkJU1hfQk9PVFNUUkFQCQkiXHgyOFx4MjBceDIxXHgwMlx4NjBceDBhIgorI2RlZmluZQkJU1hfQk9PVFNUUkFQX1NJWkUJNgorI2RlZmluZQkJU1hfQk9PVFNUUkFQX0FERFIJKDB4ODAwMC1TWF9CT09UU1RSQVBfU0laRSkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBFSVNBICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2RlZmluZQkJU0kyX0VJU0FfT0ZGCSAJMHg0MgorI2RlZmluZQkJU0kyX0VJU0FfVkFMCSAJMHgwMQorI2RlZmluZQkJU0kyX0VJU0FfV0lORE9XX0xFTiAgICAgMHgxMDAwMAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICBQQ0kgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKiBHZW5lcmFsIGRlZmluaXRpb25zLi4uICovCisKKyNkZWZpbmUJCVNQWF9WRU5ET1JfSUQJCTB4MTFDQgkJLyogQXNzaWduZWQgYnkgdGhlIFBDSSBTSUcgKi8KKyNkZWZpbmUJCVNQWF9ERVZJQ0VfSUQJCTB4NDAwMAkJLyogU0kvWElPIGJvYXJkcyAqLworI2RlZmluZQkJU1BYX1BMWERFVklDRV9JRAkweDIwMDAJCS8qIFNYIGJvYXJkcyAqLworCisjZGVmaW5lCQlTUFhfU1VCX1ZFTkRPUl9JRAlTUFhfVkVORE9SX0lECS8qIFNhbWUgYXMgdmVuZG9yIGlkICovCisjZGVmaW5lCQlTSTJfU1VCX1NZU19JRAkJMHg0MDAJCS8qIFBoYXNlIDIgKFoyODApIGJvYXJkICovCisjZGVmaW5lCQlTWF9TVUJfU1lTX0lECQkweDIwMAkJLyogUGhhc2UgMyAodDIyNSkgYm9hcmQgKi8KKworI2VuZGlmCQkJCQkJLypfc3hib2FyZHNfaCAqLworCisvKiBFbmQgb2YgU1hCT0FSRFMuSCAqLwpkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3N4d2luZG93LmggYi9kcml2ZXJzL2NoYXIvc3h3aW5kb3cuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jZjAxYjY2Ci0tLSAvZGV2L251bGwKKysrIGIvZHJpdmVycy9jaGFyL3N4d2luZG93LmgKQEAgLTAsMCArMSwzOTMgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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KioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgQ29tbW9uIERlZmluaXRpb25zICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCit0eXBlZGVmCXN0cnVjdAlfU1hDQVJECQkqUFNYQ0FSRDsJLyogU1hDQVJEIHN0cnVjdHVyZSBwb2ludGVyICovCit0eXBlZGVmCXN0cnVjdAlfU1hNT0RVTEUJKlBNT0Q7CQkvKiBTWE1PRFVMRSBzdHJ1Y3R1cmUgcG9pbnRlciAqLwordHlwZWRlZglzdHJ1Y3QJX1NYQ0hBTk5FTAkqUENIQU47CQkvKiBTWENIQU5ORUwgc3RydWN0dXJlIHBvaW50ZXIgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFNYQ0FSRCAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKwordHlwZWRlZglz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CisvKiBTWENBUkQuY2NfaW50X2NvdW50IGRlZmluaXRpb25zLi4uICovCisjZGVmaW5lIAlJTlRfQ09VTlRfREVGQVVMVAkxMDAJLyogSHogKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgU1hNT0RVTEUgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2RlZmluZQlUT1BfUE9JTlRFUihhKQkJKChhKXwweDgwMDApCS8qIFNldHMgdG9wIGJpdCBvZiB3b3JkICovCisjZGVmaW5lIFVOVE9QX1BPSU5URVIoYSkJKChhKSZ+MHg4MDAwKQkvKiBDbGVhcnMgdG9wIGJpdCBvZiB3b3JkICovCisKK3R5cGVkZWYJc3RydWN0CV9TWE1PRFVMRQoreworCVdPUkQJbWNfbmV4dDsJCQkvKiAweDAwIE5leHQgbW9kdWxlICJwb2ludGVyIiAoT1JlZCB3aXRoIDB4ODAwMCkgKi8KKwlCWVRFCW1jX3R5cGU7CQkJLyogMHgwMiBUeXBlIG9mIFRBIGluIHRlcm1zIG9mIG51bWJlciBvZiBjaGFubmVscyAqLworCUJZVEUJbWNfbW9kX25vOwkJCS8qIDB4MDMgTW9kdWxlIG51bWJlciBvbiBTSSBidXMgY2FibGUgKDAgY2xvc2VzdCB0byBjYXJkKSAqLworCUJZVEUJbWNfZHRyOwkJCQkvKiAweDA0IFBya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ioqKioqKioqKioqKioqKioqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgIFNYQ0hBTk5FTCAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNkZWZpbmUJCVRYX0JVRkZfT0ZGU0VUCQkweDYwCS8qIFRyYW5zbWl0IGJ1ZmZlciBvZmZzZXQgaW4gY2hhbm5lbCBzdHJ1Y3R1cmUgKi8KKyNkZWZpbmUJCUJVRkZfUE9JTlRFUihhKQkJKCgoYSkrVFhfQlVGRl9PRkZTRVQpfDB4ODAwMCkKKyNkZWZpbmUJCVVOQlVGRl9QT0lOVEVSKGEpCShqZXRfY2hhbm5lbCopKCgoYSkmfjB4ODAwMCktVFhfQlVGRl9PRkZTRVQpIAorI2RlZmluZSAJQlVGRkVSX1NJWkUJCTI1NgorI2RlZmluZSAJSElHSF9XQVRFUgkJKChCVUZGRVJfU0laRSAvIDQpICogMykKKyNkZWZpbmUgCUxPV19XQVRFUgkJKEJVRkZFUl9TSVpFIC8gNCkKKwordHlwZWRlZglzdHJ1Y3QJX1NYQ0hBTk5FTAoreworCVdPUkQJbmV4dF9pdGVtOwkJCS8qIDB4MDAgT2Zmc2V0IGZyb20gd2luZG93IGJhc2Ugb2YgbmV4dCBjaGFubmVscyBoaV90eGJ1ZiAoT1JyZWQgd2l0aCAweDgwMDApICovCisJV09SRCAJYWRkcl91YXJ0OwkJCS8qIDB4MDIgSU5URVJOQUwgcG9pbnRlciB0byB1YXJ0IGFkZHJlc3MuIEluY2x1ZGVzIEZBU1RQQVRIIGJpdCAqLworCVdPUkQJbW9kdWxlOwkJCQkvKiAweDA0IE9mZnNldCBmcm9tIHdpbmRvdy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QyB8fAorCSAgICBpbmZvLT5wYXJhbXMubW9kZSA9PSBNR1NMX01PREVfUkFXICkgeworCQlyZXQgKz0gc3ByaW50ZihidWYrcmV0LCAiIEhETEMgdHhvazolZCByeG9rOiVkIiwKKwkJCSAgICAgIGluZm8tPmljb3VudC50eG9rLCBpbmZvLT5pY291bnQucnhvayk7CisJCWlmIChpbmZvLT5pY291bnQudHh1bmRlcikKKwkJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgdHh1bmRlcjolZCIsIGluZm8tPmljb3VudC50eHVuZGVyKTsKKwkJaWYgKGluZm8tPmljb3VudC50eGFib3J0KQorCQkJcmV0ICs9IHNwcmludGYoYnVmK3JldCwgIiB0eGFib3J0OiVkIiwgaW5mby0+aWNvdW50LnR4YWJvcnQpOworCQlpZiAoaW5mby0+aWNvdW50LnJ4c2hvcnQpCisJCQlyZXQgKz0gc3ByaW50ZihidWYrcmV0LCAiIHJ4c2hvcnQ6JWQiLCBpbmZvLT5pY291bnQucnhzaG9ydCk7CQorCQlpZiAoaW5mby0+aWNvdW50LnJ4bG9uZykKKwkJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgcnhsb25nOiVkIiwgaW5mby0+aWNvdW50LnJ4bG9uZyk7CisJCWlmIChpbmZvLT5pY291bnQucnhvdmVyKQorCQkJcmV0ICs9IHNwcmludGYoYnVmK3JldCwgIiByeG92ZXI6JWQiLCBpbmZvLT5pY291bnQucnhvdmVyKTsKKwkJaWYgKGluZm8tPmljb3VudC5yeGNyYykKKwkJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgcnhjcmM6JWQiLCBpbmZvLT5pY291bnQucnhjcmMpOworCX0gZWxzZSB7CisJCXJldCArPSBzcHJpbnRmKGJ1ZityZXQsICIgQVNZTkMgdHg6JWQgcng6JWQiLAorCQkJICAgICAgaW5mby0+aWNvdW50LnR4LCBpbmZvLT5pY291bnQucngpOworCQlpZiAoaW5mby0+aWNvdW50LmZyYW1lKQorCQkJcmV0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Y19PdXRSZWcoIGluZm8sIFJNUiwgKHVuc2lnbmVkIHNob3J0KSgodXNjX0luUmVnKGluZm8sIFJNUikgJiAweGZmZmMpIHwgMHgwMDAyKSApOworCQorCXNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJmluZm8tPmlycV9zcGlubG9jayxmbGFncyk7CisKKworCS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCS8qIFdBSVQgRk9SIFJFQ0VJVkVSIFRPIERNQSBBTEwgUEFSQU1FVEVSUyBGUk9NIEJVRkZFUiBFTlRSWSAqLworCS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisJLyogV2FpdCAxMDBtcyBmb3IgaW50ZXJydXB0LiAqLworCUVuZFRpbWUgPSBqaWZmaWVzICsgbXNlY3NfdG9famlmZmllcygxMDApOworCisJZm9yKDs7KSB7CisJCWlmICh0aW1lX2FmdGVyKGppZmZpZXMsIEVuZFRpbWUpKSB7CisJCQlyYyA9IEZBTFNFOworCQkJYnJlYWs7CisJCX0KKworCQlzcGluX2xvY2tfaXJxc2F2ZSgmaW5mby0+aXJxX3NwaW5sb2NrLGZsYWdzKTsKKwkJc3RhdHVzID0gdXNjX0luRG1hUmVnKCBpbmZvLCBSRE1SICk7CisJCXNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJmluZm8tPmlycV9zcGlubG9jayxmbGFncyk7CisKKwkJaWYgKCAhKHN0YXR1cyAmIEJJVDQpICYmIChzdGF0dXMgJiBCSVQ1KSApIHsKKwkJCS8qIElOSVRHIChCSVQgNCkgaXMgaW5hY3RpdmUgKG5vIGVudHJ5IHJlYWQgaW4gcHJvZ3Jlc3MpIEFORCAqLworCQkJLyogQlVTWSAgKEJJVCA1KSBpcyBhY3RpdmUgKGNoYW5uZWwgc3RpbGwgYWN0aXZlKS4gKi8KKwkJCS8qIFRoaXMgbWVhbnMgdGhl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GV2aWNlX25hbWUsaW5mby0+dHhfY291bnQpOworCisJaWYgKHNhbml0eV9jaGVjayhpbmZvLCB0dHktPm5hbWUsICJmbHVzaF9jaGFycyIpKQorCQlyZXR1cm47CisKKwlpZiAoaW5mby0+dHhfY291bnQgPD0gMCB8fCB0dHktPnN0b3BwZWQgfHwgdHR5LT5od19zdG9wcGVkIHx8CisJICAgICFpbmZvLT50eF9idWYpCisJCXJldHVybjsKKworCWlmICggZGVidWdfbGV2ZWwgPj0gREVCVUdfTEVWRUxfSU5GTyApCisJCXByaW50ayggIiVzKCVkKTolcyBmbHVzaF9jaGFycygpIGVudHJ5LCBzdGFydGluZyB0cmFuc21pdHRlclxuIiwKKwkJCV9fRklMRV9fLF9fTElORV9fLGluZm8tPmRldmljZV9uYW1lICk7CisKKwlzcGluX2xvY2tfaXJxc2F2ZSgmaW5mby0+bG9jayxmbGFncyk7CisKKwlpZiAoIWluZm8tPnR4X2FjdGl2ZSkgeworCQlpZiAoIChpbmZvLT5wYXJhbXMubW9kZSA9PSBNR1NMX01PREVfSERMQykgJiYKKwkJCWluZm8tPnR4X2NvdW50ICkgeworCQkJLyogb3BlcmF0aW5nIGluIHN5bmNocm9ub3VzIChmcmFtZSBvcmllbnRlZCkgbW9kZSAqLworCQkJLyogY29weSBkYXRhIGZyb20gY2lyY3VsYXIgdHhfYnVmIHRvICovCisJCQkvKiB0cmFuc21pdCBETUEgYnVmZmVyLiAqLworCQkJdHhfbG9hZF9kbWFfYnVmZmVyKGluZm8sCisJCQkJIGluZm8tPnR4X2J1ZixpbmZvLT50eF9jb3VudCk7CisJCX0KKwkgCXR4X3N0YXJ0KGluZm8pOworCX0KKworCXNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJmluZm8tPmxvY2ssZmxhZ3MpOworfQorCisvKiBEaXNjYXJkIGFsbCBkYXRhIGluIHRoZSBzZW5kIGJ1ZmZlcgorICovCitzdGF0aWMgdm9pZCBmbHVzaF9idWZmZXIoc3RydWN0IHR0eV9zd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JeworCQljYXNlIENMT0NLX0VYVDogICAgICBmbGFncyA9IEhETENfRkxBR19SWENfUlhDUElOIHwgSERMQ19GTEFHX1RYQ19UWENQSU47IGJyZWFrOworCQljYXNlIENMT0NLX1RYRlJPTVJYOiBmbGFncyA9IEhETENfRkxBR19SWENfUlhDUElOIHwgSERMQ19GTEFHX1RYQ19SWENQSU47IGJyZWFrOworCQljYXNlIENMT0NLX0lOVDogICAgICBmbGFncyA9IEhETENfRkxBR19SWENfQlJHICAgIHwgSERMQ19GTEFHX1RYQ19CUkc7ICAgIGJyZWFrOworCQljYXNlIENMT0NLX1RYSU5UOiAgICBmbGFncyA9IEhETENfRkxBR19SWENfUlhDUElOIHwgSERMQ19GTEFHX1RYQ19CUkc7ICAgIGJyZWFrOworCQljYXNlIENMT0NLX0RFRkFVTFQ6ICBmbGFncyA9IGluZm8tPnBhcmFtcy5mbGFncyAmCisJCQkJCSAgICAgKEhETENfRkxBR19SWENfUlhDUElOIHwgSERMQ19GTEFHX1JYQ19EUExMIHwKKwkJCQkJICAgICAgSERMQ19GTEFHX1JYQ19CUkcgICAgfCBIRExDX0ZMQUdfUlhDX1RYQ1BJTiB8CisJCQkJCSAgICAgIEhETENfRkxBR19UWENfVFhDUElOIHwgSERMQ19GTEFHX1RYQ19EUExMIHwKKwkJCQkJICAgICAgSERMQ19GTEFHX1RYQ19CUkcgICAgfCBIRExDX0ZMQUdfVFhDX1JYQ1BJTik7IGJyZWFrOworCQlkZWZhdWx0OiByZXR1cm4gLUVJTlZBTDsKKwkJfQorCisJCWlmIChuZXdfbGluZS5sb29wYmFjayAhPSAwICYmIG5ld19saW5lLmxvb3BiYWNrICE9IDEpCisJCQlyZXR1cm4gLUVJTlZBTDsKKworCQlpbmZvLT5wYXJhbXMuZmxhZ3MgJj0gfihIRExDX0ZMQUdfUlhDX1JYQ1BJTiB8IEhETENfRkxBR19SWENfRFBMTCB8CisJCQkJCUhETENfRkxBR19SWENfQlJHICAgIHwgSERMQ19GTEFHX1J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aXQoU0xNUF9JTkZPICppbmZvKQoreworCWludCByYzsKKwlzdHJ1Y3QgbmV0X2RldmljZSAqZGV2OworCWhkbGNfZGV2aWNlICpoZGxjOworCisJLyogYWxsb2NhdGUgYW5kIGluaXRpYWxpemUgbmV0d29yayBhbmQgSERMQyBsYXllciBvYmplY3RzICovCisKKwlpZiAoIShkZXYgPSBhbGxvY19oZGxjZGV2KGluZm8pKSkgeworCQlwcmludGsoS0VSTl9FUlIgIiVzOmhkbGMgZGV2aWNlIGFsbG9jYXRpb24gZmFpbHVyZVxuIixfX0ZJTEVfXyk7CisJCXJldHVybiAtRU5PTUVNOworCX0KKworCS8qIGZvciBuZXR3b3JrIGxheWVyIHJlcG9ydGluZyBwdXJwb3NlcyBvbmx5ICovCisJZGV2LT5tZW1fc3RhcnQgPSBpbmZvLT5waHlzX3NjYV9iYXNlOworCWRldi0+bWVtX2VuZCAgID0gaW5mby0+cGh5c19zY2FfYmFzZSArIFNDQV9CQVNFX1NJWkUgLSAxOworCWRldi0+aXJxICAgICAgID0gaW5mby0+aXJxX2xldmVsOworCisJLyogbmV0d29yayBsYXllciBjYWxsYmFja3MgYW5kIHNldHRpbmdzICovCisJZGV2LT5kb19pb2N0bCAgICAgICA9IGhkbGNkZXZfaW9jdGw7CisJZGV2LT5vcGVuICAgICAgICAgICA9IGhkbGNkZXZfb3BlbjsKKwlkZXYtPnN0b3AgICAgICAgICAgID0gaGRsY2Rldl9jbG9zZTsKKwlkZXYtPnR4X3RpbWVvdXQgICAgID0gaGRsY2Rldl90eF90aW1lb3V0OworCWRldi0+d2F0Y2hkb2dfdGltZW8gPSAxMCpIWjsKKwlkZXYtPnR4X3F1ZXVlX2xlbiAgID0gNTA7CisKKwkvKiBnZW5lcmljIEhETEMgbGF5ZXIgY2FsbGJhY2tzIGFuZCBzZXR0aW5ncyAqLworCWhkbGMgICAgICAgICA9IGRldl90b19oZGxjKGRldik7CisJaGRsYy0+YXR0YWNoID0gaGRsY2Rldl9hdHRhY2g7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G1pbm9yKTsKK30KKworLyogLS0tLS0gZ2xvYmFsIGRlZmluZXMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi8KKworI2RlZmluZSBTVEFSVCh4KSB7IHggPSBqaWZmaWVzICsgKEhaICogdGltZW91dCkgLyAxMDsgfQorI2RlZmluZSBXQUlUKHgpICB7IFwKKyAgaWYgKHRpbWVfYmVmb3JlKCh4KSwgamlmZmllcykpIHJldHVybiAtMTsgXAorICBpZiAobmVlZF9yZXNjaGVkKCkpIHNjaGVkdWxlKCk7IH0KKworLyogLS0tLS0gRC1idXMgYml0LWJhbmdpbmcgZnVuY3Rpb25zIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi8KKworLyogRC1idXMgcHJvdG9jb2wgKDQ1a2JpdC9zIG1heCk6CisgICAgICAgICAgICAgICAgICAgIDEgICAgICAgICAgICAgICAgIDAgICAgICAgICAgICAgICAgICAgICAgMAorICAgICAgIF9fX19fX18gICAgICAgIF9fX19fX3xfX19fX18gICAgX19fX19fX19fX3xfX19fX19fXyAgICBfX19fX19fX19fCitSZWQgIDogICAgICAgIF9fX19fX19fICAgICAgfCAgICAgIF9fX18gICAgICAgICAgfCAgICAgICAgX19fXworICAgICAgIF8gICAgICAgIF9fX19fX19fX19fX3xfX19fX19fXyAgICAgIF9fX19fX3xfX19fX19fX19fICAgICAgIF9fX19fCitXaGl0ZTogIF9fX19fX19fICAgICAgICAgICAgfCAgICAgICAgX19fX19fICAgICAgfCAgICAgICAgICBfX19fX19fCisqLworCisvKiBUcnkgdG8gdHJhbnNtaXQgYSBieXRlIG9uIHRoZSBzcGVjaWZpZWQgcG9ydCAoLTEgaWYgZXJyb3IpLiAqLworc3RhdGljIGludAorcHV0X3RpX3BhcmFsbGVsKGludCBtaW5vciwgdW5zaWduZWQgY2hhciBkYXRhKQoreworCXVuc2lnbmVkIGludCBiaXQ7CisJdW5zaWdu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CWJyZWFrOworCWNhc2UgSU9DVExfVElQQVJfVElNRU9VVDoKKwkJaWYgKGFyZyAhPSAwKQorICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dCA9IChpbnQpYXJnOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHZhbCA9IC1FSU5WQUw7CisJICBicmVhazsKKwlkZWZhdWx0OgorCQlyZXR2YWwgPSAtRU5PVFRZOworCQlicmVhazsKKwl9CisKKwlyZXR1cm4gcmV0dmFsOworfQorCisvKiAtLS0tLSBrZXJuZWwgbW9kdWxlIHJlZ2lzdGVyaW5nIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAqLworCitzdGF0aWMgc3RydWN0IGZpbGVfb3BlcmF0aW9ucyB0aXBhcl9mb3BzID0geworCS5vd25lciA9IFRISVNfTU9EVUxFLAorCS5sbHNlZWsgPSBub19sbHNlZWssCisJLnJlYWQgPSB0aXBhcl9yZWFkLAorCS53cml0ZSA9IHRpcGFyX3dyaXRlLAorCS5pb2N0bCA9IHRpcGFyX2lvY3RsLAorCS5vcGVuID0gdGlwYXJfb3BlbiwKKwkucmVsZWFzZSA9IHRpcGFyX2Nsb3NlLAorfTsKKworLyogLS0tIGluaXRpYWxpc2F0aW9uIGNvZGUgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAqLworCisjaWZuZGVmIE1PRFVMRQorLyogICAgICBZb3UgbXVzdCBzZXQgdGhlc2UgLSB0aGVyZSBpcyBubyBzYW5lIHdheSB0byBwcm9iZSBmb3IgdGhpcyBjYWJsZS4KKyAqICAgICAgWW91IGNhbiB1c2UgJ3RpcGFyPXRpbWVvdXQsZGVsYXknIHRvIHNldCB0aGVzZSBub3cuICovCitzdGF0aWMgaW50IF9faW5pdAordGlwYXJfc2V0dXAoY2hhciAqc3RyKQoreworCWludCBpbnRzWzJdOworCisJc3RyID0gZ2V0X29wdGl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NpdGlvbiB1c2UgdGhlCisgICAgICAgICAgICAgICAgICogZGlyZWN0LXRvLWZvbnQgem9uZSBpbiBVVEYtOCBtb2RlLgorICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgIG9rID0gdGMgJiYgKGMgPj0gMzIgfHwKKwkJCSAgICAoIXZjLT52Y191dGYgJiYgISgoKHZjLT52Y19kaXNwX2N0cmwgPyBDVFJMX0FMV0FZUworCQkJCQkJOiBDVFJMX0FDVElPTikgPj4gYykgJiAxKSkpCisJCQkmJiAoYyAhPSAxMjcgfHwgdmMtPnZjX2Rpc3BfY3RybCkKKwkJCSYmIChjICE9IDEyOCsyNyk7CisKKwkJaWYgKHZjLT52Y19zdGF0ZSA9PSBFU25vcm1hbCAmJiBvaykgeworCQkJLyogTm93IHRyeSB0byBmaW5kIG91dCBob3cgdG8gZGlzcGxheSBpdCAqLworCQkJdGMgPSBjb252X3VuaV90b19wYyh2YywgdGMpOworCQkJaWYgKCB0YyA9PSAtNCApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSWYgd2UgZ290IC00IChub3QgZm91bmQpIHRoZW4gc2VlIGlmIHdlIGhhdmUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmaW5lZCBhIHJlcGxhY2VtZW50IGNoYXJhY3RlciAoVStGRkZEKSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YyA9IGNvbnZfdW5pX3RvX3BjKHZjLCAweGZmZmQpOworCisJCQkJLyogT25lIHJlYXNvbiBmb3IgdGhlIC00IGNhbiBiZSB0aGF0IHdlIGp1c3QKKwkJCQkgICBkaWQgYSBjbGVhcl91bmltYXAoKTsKKwkJCQkgICB0cnkgYXQgbGVhc3QgdG8gc2hvdyBzb21ldGhpbmcuICovCisJCQkJaWYgKHRjID09IC00KQorCQkJCSAgICAgdGMgPSBjOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICggdGMgPT0gLTMgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEJhZCBoYXNoIHRhYmxlIC0tIGhvcGUgZm9yIHRoZSBiZXN0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjID0gYzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKwkJCWlmICh0YyAmIH5jaGFybWFzaykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7IC8qIENvbnZlcnNpb24gZmFpbGVkICovCisKKwkJCWlmICh2Yy0+dmNfbmVlZF93cmFwIHx8IHZjLT52Y19kZWNpbSkKKwkJCQlGTFVTSAorCQkJaWYgKHZjLT52Y19uZWVkX3dyYXApIHsKKwkJCQljcih2Yyk7CisJCQkJbGYodmMpOworCQkJfQorCQkJaWYgKHZjLT52Y19kZWNpbSkKKwkJCQlpbnNlcnRfY2hhcih2YywgMSk7CisJCQlzY3Jfd3JpdGV3KGhpbWFzayA/CisJCQkJICAgICAoKHZjLT52Y19hdHRyIDw8IDgpICYgfmhpbWFzaykgKyAoKHRjICYgMHgxMDApID8gaGltYXNrIDogMCkgKyAodGMgJiAweGZmKSA6CisJCQkJICAgICAodmMtPnZjX2F0dHIgPDwgOCkgKyB0YywKKwkJCQkgICAodTE2ICopIHZjLT52Y19wb3MpOworCQkJaWYgKERPX1VQREFURSh2YykgJiYgZHJhd194IDwgMCkgeworCQkJCWRyYXdfeCA9IHZjLT52Y194OworCQkJCWRyYXdfZnJvbSA9IHZjLT52Y19wb3M7CisJCQl9CisJCQlpZiAodmMtPnZjX3ggPT0gdmMtPnZjX2NvbHMgLSAxKSB7CisJCQkJdmMtPnZjX25lZWRfd3JhcCA9IHZjLT52Y19kZWNhd207CisJCQkJZHJhd190byA9IHZjLT52Y19wb3MgKyAyOworCQkJfSBlbHNlIHsKKwkJCQl2Yy0+dmNfeCsrOworCQkJCWRyYXdfdG8gPSAodmMtPnZjX3BvcyArPSAyKTsKKwkJCX0KKwkJCWNvbnRpbn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X1ZJU0lCTEUodmMpKQorCQkJdXBkYXRlX3NjcmVlbih2Yyk7CisJfQorCXByaW50aygiQ29uc29sZTogc3dpdGNoaW5nICIpOworCWlmICghZGVmbHQpCisJCXByaW50aygiY29uc29sZXMgJWQtJWQgIiwgZmlyc3QrMSwgbGFzdCsxKTsKKwlpZiAoaiA+PSAwKQorCQlwcmludGsoInRvICVzICVzICVkeCVkXG4iLAorCQkgICAgICAgdmNfY29uc1tqXS5kLT52Y19jYW5fZG9fY29sb3IgPyAiY29sb3VyIiA6ICJtb25vIiwKKwkJICAgICAgIGRlc2MsIHZjX2NvbnNbal0uZC0+dmNfY29scywgdmNfY29uc1tqXS5kLT52Y19yb3dzKTsKKwllbHNlCisJCXByaW50aygidG8gJXNcbiIsIGRlc2MpOworCisJcmVsZWFzZV9jb25zb2xlX3NlbSgpOworCisJbW9kdWxlX3B1dChvd25lcik7CisJcmV0dXJuIDA7Cit9CisKK3ZvaWQgZ2l2ZV91cF9jb25zb2xlKGNvbnN0IHN0cnVjdCBjb25zdyAqY3N3KQoreworCWludCBpOworCisJZm9yKGkgPSAwOyBpIDwgTUFYX05SX0NPTlNPTEVTOyBpKyspCisJCWlmIChjb25fZHJpdmVyX21hcFtpXSA9PSBjc3cpIHsKKwkJCW1vZHVsZV9wdXQoY3N3LT5vd25lcik7CisJCQljb25fZHJpdmVyX21hcFtpXSA9IE5VTEw7CisJCX0KK30KKworI2VuZGlmCisKKy8qCisgKglTY3JlZW4gYmxhbmtpbmcKKyAqLworCitzdGF0aWMgdm9pZCBzZXRfdmVzYV9ibGFua2luZyhjaGFyIF9fdXNlciAqcCkKK3sKKyAgICB1bnNpZ25lZCBpbnQgbW9kZTsKKyAgICBnZXRfdXNlcihtb2RlLCBwICsgMSk7CisgICAgdmVzYV9ibGFua19tb2RlID0gKG1vZGUgPCA0KSA/IG1vZGUgOiAwOworfQorCisvKgorICogVGhpcyBpcyBjYWxsZWQgYnkgYSB0aW1lciBoYW5kbGVyCisgKi8KK3N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V0JyBmaWVsZCB0byB0aGUgYGRpc3BsYXknCisgKiAgc3RydWN0dXJlIHNvIHdlIHdvbid0IGhhdmUgdG8gY29udmVydCB0aGUgZm9udGRhdGEgYWxsIHRoZSB0aW1lLgorICogIC9KZXMKKyAqLworCisjZGVmaW5lIG1heF9mb250X3NpemUgNjU1MzYKKworc3RhdGljIGludCBjb25fZm9udF9nZXQoc3RydWN0IHZjX2RhdGEgKnZjLCBzdHJ1Y3QgY29uc29sZV9mb250X29wICpvcCkKK3sKKwlzdHJ1Y3QgY29uc29sZV9mb250IGZvbnQ7CisJaW50IHJjID0gLUVJTlZBTDsKKwlpbnQgYzsKKworCWlmICh2Yy0+dmNfbW9kZSAhPSBLRF9URVhUKQorCQlyZXR1cm4gLUVJTlZBTDsKKworCWlmIChvcC0+ZGF0YSkgeworCQlmb250LmRhdGEgPSBrbWFsbG9jKG1heF9mb250X3NpemUsIEdGUF9LRVJORUwpOworCQlpZiAoIWZvbnQuZGF0YSkKKwkJCXJldHVybiAtRU5PTUVNOworCX0gZWxzZQorCQlmb250LmRhdGEgPSBOVUxMOworCisJYWNxdWlyZV9jb25zb2xlX3NlbSgpOworCWlmICh2Yy0+dmNfc3ctPmNvbl9mb250X2dldCkKKwkJcmMgPSB2Yy0+dmNfc3ctPmNvbl9mb250X2dldCh2YywgJmZvbnQpOworCWVsc2UKKwkJcmMgPSAtRU5PU1lTOworCXJlbGVhc2VfY29uc29sZV9zZW0oKTsKKworCWlmIChyYykKKwkJZ290byBvdXQ7CisKKwljID0gKGZvbnQud2lkdGgrNykvOCAqIDMyICogZm9udC5jaGFyY291bnQ7CisJCisJaWYgKG9wLT5kYXRhICYmIGZvbnQuY2hhcmNvdW50ID4gb3AtPmNoYXJjb3VudCkKKwkJcmMgPSAtRU5PU1BDOworCWlmICghKG9wLT5mbGFncyAmIEtEX0ZPTlRfRkxBR19PTEQpKSB7CisJCWlmIChmb250LndpZHRoID4gb3AtPndpZHRoIHx8IGZvbnQuaGVpZ2h0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CisgKiAgIDggICAgICAgOCAgICAgICAxNCAgICB8ICAgMTYgICAgMCAgICAgIDMwCisgKgorICovCisKK3N0YXRpYyBpbnQgd2RfdGltZXNbXSA9IHsKKwkzMCwJLyogMHgwICovCisJMjgsCS8qIDB4MSAqLworCTI2LAkvKiAweDIgKi8KKwkyNCwJLyogMHgzICovCisJMjIsCS8qIDB4NCAqLworCTIwLAkvKiAweDUgKi8KKwkxOCwJLyogMHg2ICovCisJMTYsCS8qIDB4NyAqLworCTE0LAkvKiAweDggKi8KKwkxMiwJLyogMHg5ICovCisJMTAsCS8qIDB4QSAqLworCTgsCS8qIDB4QiAqLworCTYsCS8qIDB4QyAqLworCTQsCS8qIDB4RCAqLworCTIsCS8qIDB4RSAqLworCTAsCS8qIDB4RiAqLworfTsKKworI2RlZmluZSBXRFRfU1RPUCAweDQ0MQorI2RlZmluZSBXRFRfU1RBUlQgMHg0NDMKKworLyogRGVmYXVsdCB0aW1lb3V0ICovCisjZGVmaW5lIFdEX1RJTU8gMAkJLyogMzAgc2Vjb25kcyArLy0gMjAlLCBmcm9tIHRhYmxlICovCisKK3N0YXRpYyBpbnQgd2RfbWFyZ2luID0gV0RfVElNTzsKKworI2lmZGVmIENPTkZJR19XQVRDSERPR19OT1dBWU9VVAorc3RhdGljIGludCBub3dheW91dCA9IDE7CisjZWxzZQorc3RhdGljIGludCBub3dheW91dCA9IDA7CisjZW5kaWYKKworbW9kdWxlX3BhcmFtKG5vd2F5b3V0LCBpbnQsIDApOworTU9EVUxFX1BBUk1fREVTQyhub3dheW91dCwgIldhdGNoZG9nIGNhbm5vdCBiZSBzdG9wcGVkIG9uY2Ugc3RhcnRlZCAoZGVmYXVsdD1DT05GSUdfV0FUQ0hET0dfTk9XQVlPVVQpIik7CisKKworLyoKKyAqCUtlcm5lbCBtZXRob2RzLgorICovCisKK3N0YXRpYyB2b2lkCitpYndkdF9waW5nKHZvaWQpCit7CisJLyogV3JpdGUgYSB3YXRjaGRvZyB2YWx1ZSAqLwor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wcm92aWRlZCAiQVMtSVMiIGluCisgKgl0aGUgaG9wZSB0aGF0IGl0IG1heSBiZSB1c2VmdWwgZm9yIG90aGVycy4KKyAqCisgKgkoYykgQ29weXJpZ2h0IDIwMDAgICAgSmFrb2IgT2VzdGVyZ2FhcmQgPGpha29iQHVudGhvdWdodC5uZXQ+CisgKgorICogICAgICAgICAgIDEyLzQgLSAyMDAwICAgICAgW0luaXRpYWwgcmV2aXNpb25dCisgKiAgICAgICAgICAgMjUvNCAtIDIwMDAgICAgICBBZGRlZCAvZGV2L3dhdGNoZG9nIHN1cHBvcnQKKyAqICAgICAgICAgICAwOS81IC0gMjAwMSAgICAgIFtzbWpAb3JvLm5ldF0gZml4ZWQgZm9wX3dyaXRlIHRvICJyZXR1cm4gMSIgb24gc3VjY2VzcworICogICAgICAgICAgIDEyLzQgLSAyMDAyICAgICAgW3JvYkBvc2ludmVzdG9yLmNvbV0gZWxpbWluYXRlIGZvcF9yZWFkCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXggcG9zc2libGUgd2R0X2lzX29wZW4gcmFjZQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkIENPTkZJR19XQVRDSERPR19OT1dBWU9VVCBzdXBwb3J0CisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmUgbG9ja19rZXJuZWwvdW5sb2NrX2tlcm5lbCBwYWlycworICogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkZWQgS0VSTl8qIHRvIHByaW50aydzCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb3QgcmlkIG9mIGV4dHJhbmVvdXMgY29tbWVudHMKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgd2F0Y2hkb2dfaW5mbyB0byBjb3JyZWN0bHkgcmVmbGVjdCB3aGF0IHRoZSBkcml2ZXIgb2ZmZXJzCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRlZCBXRElPQ19HRVRTVEFUVVMsIFdESU9DX0dFVEJPT1RTVEFUVVMsIFdESU9DX1NFVFRJTUVPVVQsCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBXRElPQ19HRVRUSU1FT1VULCBhbmQgV0RJT0NfU0VUT1BUSU9OUyBpb2N0bHMKKyAqICAgICAgICAgICAwOS84IC0gMjAwMyAgICAgIFt3aW1AaWd1YW5hLmJlXSBjbGVhbnVwIG9mIHRyYWlsaW5nIHNwYWNlcworICogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlIG1vZHVsZV9wYXJhbQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFkZSB0aW1lb3V0ICh0aGUgZW11bGF0ZWQgaGVhcnRiZWF0KSBhIG1vZHVsZV9wYXJhbQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFkZSB0aGUga2VlcGFsaXZlIHBpbmcgYW4gaW50ZXJuYWwgc3Vicm91dGluZQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFkZSB3ZHRfc3RvcCBhbmQgd2R0X3N0YXJ0IG1vZHVsZSBwYXJhbXMKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZGVkIGV4dHJhIHByaW50aydzIGZvciBzdGFydHVwIHByb2JsZW1zCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRlZCBNT0RVTEVfQVVUSE9SIGFuZCBNT0RVTEVfREVTQ1JJUFRJT04gaW5mbworICoKKyAqCisgKiAgVGhpcyBXRFQgZHJpdmVyIGlzIGRpZmZlcmVudCBmcm9tIHRoZSBvdGhlciBMaW51eCBXRFQKKyAqICBkcml2ZXJzIGluIHRoZSBmb2xsb3dpbmcgd2F5czoKKyAqICAqKSAgVGhlIGRyaXZlciB3aWxsIHBpbmcgdGhlIHdhdGNoZG9nIGJ5IGl0c2VsZiwgYmVjYXVzZSB0aGlzCisgKiAgICAgIHBhcnRpY3VsYXIgV0RUIGhhcyBhIHZlcnkgc2hvcnQgdGltZW91dCAob25lI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zMywgd2R0bXJjdGwpOworCXdyaXRldygweENDQ0MsIHdkdG1yY3RsKTsKKwkvKiB3cml0ZSBXRFQgY29uZmlndXJhdGlvbiByZWdpc3RlciAqLworCXdyaXRldyh3cml0ZXZhbCwgd2R0bXJjdGwpOworCXNwaW5fdW5sb2NrX2lycXJlc3RvcmUoJndkdF9zcGlubG9jaywgZmxhZ3MpOworfQorCitzdGF0aWMgaW50IHdkdF9zdGFydHVwKHZvaWQpCit7CisJbmV4dF9oZWFydGJlYXQgPSBqaWZmaWVzICsgKHRpbWVvdXQgKiBIWik7CisKKwkvKiBTdGFydCB0aGUgdGltZXIgKi8KKwl0aW1lci5leHBpcmVzID0gamlmZmllcyArIFdEVF9JTlRFUlZBTDsKKwlhZGRfdGltZXIoJnRpbWVyKTsKKworCS8qIFN0YXJ0IHRoZSB3YXRjaGRvZyAqLworCXdkdF9jb25maWcoV0RUX0VOQiB8IFdEVF9XUlNUX0VOQiB8IFdEVF9FWFBfU0VMXzA0KTsKKworCXByaW50ayhLRVJOX0lORk8gUEZYICJXYXRjaGRvZyB0aW1lciBpcyBub3cgZW5hYmxlZC5cbiIpOworCXJldHVybiAwOworfQorCitzdGF0aWMgaW50IHdkdF90dXJub2ZmKHZvaWQpCit7CisJLyogU3RvcCB0aGUgdGltZXIgKi8KKwlkZWxfdGltZXIoJnRpbWVyKTsKKworCS8qIFN0b3AgdGhlIHdhdGNoZG9nICovCisJd2R0X2NvbmZpZygwKTsKKworCXByaW50ayhLRVJOX0lORk8gUEZYICJXYXRjaGRvZyB0aW1lciBpcyBub3cgZGlzYWJsZWQuLi5cbiIpOworCXJldHVybiAwOworfQorCitzdGF0aWMgaW50IHdkdF9rZWVwYWxpdmUodm9pZCkKK3sKKwkvKiB1c2VyIGxhbmQgcGluZyAqLworCW5leHRfaGVhcnRiZWF0ID0gamlmZmllcyArICh0aW1lb3V0ICogSFopOworCXJldHVybiAwOworfQorCitzdGF0aWMgaW50IHdkdF9zZXRfaGVhcnRiZWF0K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lIHRoYXQgaXQgbWF5IGJlIHVzZWZ1bCBmb3Igb3RoZXJzLgorICoKKyAqCShjKSBDb3B5cmlnaHQgMjAwMSAgICBTY290dCBKZW5uaW5ncyA8bGludXhkcml2ZXJzQG9yby5uZXQ+CisgKgorICogICAgICAgICAgIDQvMTkgLSAyMDAxICAgICAgW0luaXRpYWwgcmV2aXNpb25dCisgKiAgICAgICAgICAgOS8yNyAtIDIwMDEgICAgICBBZGRlZCBzcGlubG9ja2luZworICogICAgICAgICAgIDQvMTIgLSAyMDAyICAgICAgW3JvYkBvc2ludmVzdG9yLmNvbV0gRWxpbWluYXRlIGV4dHJhIGNvbW1lbnRzCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGltaW5hdGUgZm9wX3JlYWQKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsaW1pbmF0ZSBleHRyYSBzcGluX3VubG9jaworICogICAgICAgICAgICAgICAgICAgICAgICAgICAgQWRkZWQgS0VSTl8qIHRhZ3MgdG8gcHJpbnRrcworICogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkIENPTkZJR19XQVRDSERPR19OT1dBWU9VVCBzdXBwb3J0CisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXggcG9zc2libGUgd2R0X2lzX29wZW4gcmFjZQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCB3YXRjaGRvZ19pbmZvIHRvIGNvcnJlY3RseSByZWZsZWN0IHdoYXQgdGhlIGRyaXZlciBvZmZlcnMKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZGVkIFdESU9DX0dFVFNUQVRVUywgV0RJT0NfR0VUQk9PVFNUQVRVUywgV0RJT0NfU0VUVElNRU9VVCwKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdESU9DX0dFVFRJTUVPVVQsIGFuZCBXRElPQ19TRVRPUFRJT05TIGlvY3RscworICogICAgICAgICAgIDA5LzggLSAyMDAzICAgICAgW3dp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