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GFuX2VuYWJsZV8xMWQod2xhbl9wcml2YXRlICogcHJpdiwgdTggZmxhZykKK3sKKwlpbnQgcmV0OworCisJcHJpdi0+YWRhcHRlci0+ZW5hYmxlMTFkID0gZmxhZzsKKworCS8qIHNlbmQgY21kIHRvIEZXIHRvIGVuYWJsZS9kaXNhYmxlIDExRCBmdW5jdGlvbiBpbiBGVyAqLworCXJldCA9IGxpYmVydGFzX3ByZXBhcmVfYW5kX3NlbmRfY29tbWFuZChwcml2LAorCQkJCSAgICBjbWRfODAyXzExX3NubXBfbWliLAorCQkJCSAgICBjbWRfYWN0X3NldCwKKwkJCQkgICAgY21kX29wdGlvbl93YWl0Zm9ycnNwLAorCQkJCSAgICBPSURfODAyXzExRF9FTkFCTEUsCisJCQkJICAgICZwcml2LT5hZGFwdGVyLT5lbmFibGUxMWQpOworCWlmIChyZXQpCisJCWxic19wcl9kZWJ1ZygxLCAiMTFEOiBGYWlsIHRvIGVuYWJsZSAxMUQgXG4iKTsKKworCXJldHVybiAwOworfQorCisvKioKKyAqICBAYnJpZWYgVGhpcyBmdW5jdGlvbiBzZXRzIERPTUFJTiBJTkZPIHRvIEZXCisgKiAgQHBhcmFtIHByaXYgICAgICAgcG9pbnRlciB0byB3bGFuX3ByaXZhdGUKKyAqICBAcmV0dXJuIAkgICAgICAwOyAtMQorKi8KK3N0YXRpYyBpbnQgc2V0X2RvbWFpbl9pbmZvXzExZCh3bGFuX3ByaXZhdGUgKiBwcml2KQoreworCWludCByZXQ7CisKKwlpZiAoIXByaXYtPmFkYXB0ZXItPmVuYWJsZTExZCkgeworCQlsYnNfcHJfZGVidWcoMSwgIjExRDogZG5sZCBkb21haW4gSW5mbyB3aXRoIDExZCBkaXNhYmxlZFxuIik7CisJCXJldHVybiAwOworCX0KKworCXJldCA9IGxpYmVydGFzX3ByZXBhcmVfYW5kX3NlbmRfY29tbWFuZChwcml2LCBjbWRfODAyXzExZF9kb21haW5faW5mbywKKwkJCQkgICAgY21kX2FjdF9zZXQsC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ZXQgPSBsaWJlcnRhc19zZXRfbWFjX3BhY2tldF9maWx0ZXIocHJpdik7CisKKwlMRUFWRSgpOworCXJldHVybiByZXQ7Cit9CisKKworc3RhdGljIGludCBhc3NvY19oZWxwZXJfd3BhX2tleXMod2xhbl9wcml2YXRlICpwcml2LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGFzc29jX3JlcXVlc3QgKiBhc3NvY19yZXEpCit7CisJaW50IHJldCA9IDA7CisKKwlFTlRFUigpOworCisJLyogZW5hYmxlL0Rpc2FibGUgUlNOICovCisJcmV0ID0gbGliZXJ0YXNfcHJlcGFyZV9hbmRfc2VuZF9jb21tYW5kKHByaXYsCisJCQkJICAgIGNtZF84MDJfMTFfZW5hYmxlX3JzbiwKKwkJCQkgICAgY21kX2FjdF9zZXQsCisJCQkJICAgIGNtZF9vcHRpb25fd2FpdGZvcnJzcCwKKwkJCQkgICAgMCwgYXNzb2NfcmVxKTsKKwlpZiAocmV0KQorCQlnb3RvIG91dDsKKworCXJldCA9IGxpYmVydGFzX3ByZXBhcmVfYW5kX3NlbmRfY29tbWFuZChwcml2LAorCQkJCSAgICBjbWRfODAyXzExX2tleV9tYXRlcmlhbCwKKwkJCQkgICAgY21kX2FjdF9zZXQsCisJCQkJICAgIGNtZF9vcHRpb25fd2FpdGZvcnJzcCwKKwkJCQkgICAgMCwgYXNzb2NfcmVxKTsKKworb3V0OgorCUxFQVZFKCk7CisJcmV0dXJuIHJldDsKK30KKworCitzdGF0aWMgaW50IGFzc29jX2hlbHBlcl93cGFfaWUod2xhbl9wcml2YXRlICpwcml2LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCBhc3NvY19yZXF1ZXN0ICogYXNzb2NfcmVxKQoreworCXdsYW5fYWRhcHRlciAqYWRhcHRlciA9IHByaXYtPmFkYXB0ZXI7CisJaW50IHJldCA9IDA7CisKKwlFTlRFUigpOworCisJaWYgKGFzc29jX3JlcS0+c2VjaW5mby5X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AgICAgICAgICAgICAgICAgICAgIHUzMiBjbWRfYWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICogcGRhdGFfYnVmKQoreworCXN0cnVjdCBjbWRfZHNfODAyXzExX3NldF93ZXAgKndlcCA9ICZjbWQtPnBhcmFtcy53ZXA7CisJd2xhbl9hZGFwdGVyICphZGFwdGVyID0gcHJpdi0+YWRhcHRlcjsKKwlpbnQgcmV0ID0gMDsKKwlzdHJ1Y3QgYXNzb2NfcmVxdWVzdCAqIGFzc29jX3JlcSA9IHBkYXRhX2J1ZjsKKworCUVOVEVSKCk7CisKKwljbWQtPmNvbW1hbmQgPSBjcHVfdG9fbGUxNihjbWRfODAyXzExX3NldF93ZXApOworCWNtZC0+c2l6ZSA9IGNwdV90b19sZTE2KChzaXplb2Yoc3RydWN0IGNtZF9kc184MDJfMTFfc2V0X3dlcCkpCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIFNfRFNfR0VOKTsKKworCWlmIChjbWRfYWN0ID09IGNtZF9hY3RfYWRkKSB7CisJCWludCBpOworCisJCWlmICghYXNzb2NfcmVxKSB7CisJCQlsYnNfcHJfZGVidWcoMSwgIkludmFsaWQgYXNzb2NpYXRpb24gcmVxdWVzdCEiKTsKKwkJCXJldCA9IC0xOworCQkJZ290byBkb25lOworCQl9CisKKwkJd2VwLT5hY3Rpb24gPSBjcHVfdG9fbGUxNihjbWRfYWN0X2FkZCk7CisKKwkJLyogZGVmYXVsdCB0eCBrZXkgaW5kZXggKi8KKwkJd2VwLT5rZXlpbmRleCA9IGNwdV90b19sZTE2KCh1MTYpCisJCQkJICAgICAgICAgICAgICAgICAoYXNzb2NfcmVxLT53ZXBfdHhfa2V5aWR4ICYKKwkJCQkgICAgICAgICAgICAgICAgICh1MzIpY21kX1dFUF9LRVlfSU5ERVhfTUFTSykpOworCisJCWxic19wcl9kZWJ1ZygxLCAiVHgga2V5IEluZGV4OiAldVxuIiwgd2VwLT5rZXlpbmRleCk7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gc2l6ZW9mKHBrZXlwYXJhbXNldC0+a2V5dHlwZWlkKQorCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHNpemVvZihwa2V5cGFyYW1zZXQtPmtleWluZm8pCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgc2l6ZW9mKHBrZXlwYXJhbXNldC0+a2V5bGVuKQorCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHNpemVvZihwa2V5cGFyYW1zZXQtPmtleSkpOworfQorCitzdGF0aWMgaW50IHdsYW5fY21kXzgwMl8xMV9rZXlfbWF0ZXJpYWwod2xhbl9wcml2YXRlICogcHJpdiwKKwkJCQkJc3RydWN0IGNtZF9kc19jb21tYW5kICpjbWQsCisJCQkJCXUxNiBjbWRfYWN0aW9uLAorCQkJCQl1MzIgY21kX29pZCwgdm9pZCAqcGRhdGFfYnVmKQoreworCXdsYW5fYWRhcHRlciAqYWRhcHRlciA9IHByaXYtPmFkYXB0ZXI7CisJc3RydWN0IGNtZF9kc184MDJfMTFfa2V5X21hdGVyaWFsICpwa2V5bWF0ZXJpYWwgPQorCSAgICAmY21kLT5wYXJhbXMua2V5bWF0ZXJpYWw7CisJaW50IHJldCA9IDA7CisJaW50IGluZGV4ID0gMDsKKworCUVOVEVSKCk7CisKKwljbWQtPmNvbW1hbmQgPSBjcHVfdG9fbGUxNihjbWRfODAyXzExX2tleV9tYXRlcmlhbCk7CisJcGtleW1hdGVyaWFsLT5hY3Rpb24gPSBjcHVfdG9fbGUxNihjbWRfYWN0aW9uKTsKKworCWlmIChjbWRfYWN0aW9uID09IGNtZF9hY3RfZ2V0KSB7CisJCWNtZC0+c2l6ZSA9IGNwdV90b19sZTE2KCAgU19EU19HRU4KKwkJICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHNpemVvZiAocGtleW1hdGVyaWFsLT5hY3Rpb24pKTsKKwkJcmV0ID0gMDsKKwkJZ290byBkb25lOworCX0KKworCW1lbXNldCgmcGtleW1hdGVyaWFsLT5rZXlQYXJhbVNldCwgMCwgc2l6ZW9mKHBrZXltYXRlcmlhbC0+a2V5UGFyYW1TZXQpKTsKKworCWlmIChhZGFwdGVyLT53cGFfdW5pY2FzdF9rZXkubGVuKSB7CisJCXNldF9vbmVfd3BhX2tleSgmcGtleW1hdGVyaWFsLT5rZXlQYXJhbVNldFtpbmRleF0sCisJCSAgICAgICAgICAgICAgICAmYWRhcHRlci0+d3BhX3VuaWNhc3Rfa2V5KTsKKwkJaW5kZXgrKzsKKwl9CisKKwlpZiAoYWRhcHRlci0+d3BhX21jYXN0X2tleS5sZW4pIHsKKwkJc2V0X29uZV93cGFfa2V5KCZwa2V5bWF0ZXJpYWwtPmtleVBhcmFtU2V0W2luZGV4XSwKKwkJICAgICAgICAgICAgICAgICZhZGFwdGVyLT53cGFfbWNhc3Rfa2V5KTsKKwkJaW5kZXgrKzsKKwl9CisKKwljbWQtPnNpemUgPSBjcHVfdG9fbGUxNiggIFNfRFNfR0VOCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHNpemVvZiAocGtleW1hdGVyaWFsLT5hY3Rpb24pCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGluZGV4ICogc2l6ZW9mKHN0cnVjdCBNcnZsSUV0eXBlX2tleVBhcmFtU2V0KSk7CisKKwlyZXQgPSAwOworCitkb25lOgorCUxFQVZFKCk7CisJcmV0dXJuIHJldDsKK30KKworc3RhdGljIGludCB3bGFuX2NtZF84MDJfMTFfcmVzZXQod2xhbl9wcml2YXRlICogcHJpdiwKKwkJCQkgc3RydWN0IGNtZF9kc19jb21tYW5kICpjbWQsIGludCBjbWRfYWN0aW9uKQoreworCXN0cnVjdCBjbWRfZHNfODAyXzExX3Jlc2V0ICpyZXNldCA9ICZjbWQtPnBhcmFtcy5yZXNldDsKKworCWNtZC0+Y29tbWFuZCA9IGNwdV90b19sZTE2KGNtZF84MDJfMTFfcmVzZXQpOworCWNtZC0+c2l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9mIFdMQU4gY29tbWFuZHMuCisgICovCisKKyNpZm5kZWYgX0hPU1RfSF8KKyNkZWZpbmUgX0hPU1RfSF8KKworLyoqIFBVQkxJQyBERUZJTklUSU9OUyAqLworI2RlZmluZSBERUZBVUxUX0FEX0hPQ19DSEFOTkVMICAgICAgIDYKKyNkZWZpbmUgREVGQVVMVF9BRF9IT0NfQ0hBTk5FTF9BICAgIDM2CisKKy8qKiBJRUVFIDgwMi4xMSBvaWRzICovCisjZGVmaW5lIE9JRF84MDJfMTFfU1NJRCAgICAgICAgICAgICAgICAgICAgICAgMHgwMDAwODAwMgorI2RlZmluZSBPSURfODAyXzExX0lORlJBU1RSVUNUVVJFX01PREUgICAgICAgIDB4MDAwMDgwMDgKKyNkZWZpbmUgT0lEXzgwMl8xMV9GUkFHTUVOVEFUSU9OX1RIUkVTSE9MRCAgICAweDAwMDA4MDA5CisjZGVmaW5lIE9JRF84MDJfMTFfUlRTX1RIUkVTSE9MRCAgICAgICAgICAgICAgMHgwMDAwODAwQQorI2RlZmluZSBPSURfODAyXzExX1RYX0FOVEVOTkFfU0VMRUNURUQgICAgICAgIDB4MDAwMDgwMEQKKyNkZWZpbmUgT0lEXzgwMl8xMV9TVVBQT1JURURfUkFURVMgICAgICAgICAgICAweDAwMDA4MDBFCisjZGVmaW5lIE9JRF84MDJfMTFfU1RBVElTVElDUyAgICAgICAgICAgICAgICAgMHgwMDAwODAxMgorI2RlZmluZSBPSURfODAyXzExX1RYX1JFVFJZQ09VTlQgICAgICAgICAgICAgIDB4MDAwMDgwMUQKKyNkZWZpbmUgT0lEXzgwMl8xMURfRU5BQkxFICAgICAgICAgICAgICAgICAgICAweDAwMDA4MDIwCisKKyNkZWZpbmUgY21kX29wdGlvbl93YWl0Zm9ycnNwICAgICAgICAgICAgIDB4MDAwMgorCisvKiogSG9zdCBjb21tYW5kIElEICovCisjZGVmaW5lIGNtZF9jb2RlX2RubGQgICAgICAgICAgICAgICAgIDB4MDAwMgorI2RlZmluZSBjbWRfZ2V0X2h3X3NwZWMgICAgICAgICAgICAgICAweDAwMDMKKyNkZWZpbmUgY21kX2VlcHJvbV91cGRhdGUgICAgICAgICAgICAgMHgwMDA0CisjZGVmaW5lIGNtZF84MDJfMTFfcmVzZXQgICAgICAgICAgICAgIDB4MDAwNQorI2RlZmluZSBjbWRfODAyXzExX3NjYW4gICAgICAgICAgICAgICAweDAwMDYKKyNkZWZpbmUgY21kXzgwMl8xMV9nZXRfbG9nICAgICAgICAgICAgMHgwMDBiCisjZGVmaW5lIGNtZF9tYWNfbXVsdGljYXN0X2FkciAgICAgICAgIDB4MDAxMAorI2RlZmluZSBjbWRfODAyXzExX2F1dGhlbnRpY2F0ZSAgICAgICAweDAwMTEKKyNkZWZpbmUgY21kXzgwMl8xMV9lZXByb21fYWNjZXNzICAgICAgMHgwMDU5CisjZGVmaW5lIGNtZF84MDJfMTFfYXNzb2NpYXRlICAgICAgICAgIDB4MDA1MAorI2RlZmluZSBjbWRfODAyXzExX3NldF93ZXAgICAgICAgICAgICAweDAwMTMKKyNkZWZpbmUgY21kXzgwMl8xMV9nZXRfc3RhdCAgICAgICAgICAgMHgwMDE0CisjZGVmaW5lIGNtZF84MDJfM19nZXRfc3RhdCAgICAgICAgICAgIDB4MDAxNQorI2RlZmluZSBjbWRfODAyXzExX3NubXBfbWliICAgICAgICAgICAweDAwMTYKKyNkZWZpbmUgY21kX21hY19yZWdfbWFwICAgICAgICAgICAgICAgMHgwMDE3CisjZGVmaW5lIGNtZF9iYnBfcmVnX21hcCAgICAgICAgICAgICAgIDB4MDAxOAorI2RlZmluZSBjbWRfbWFjX3JlZ19hY2Nlc3MgICAgICAgICAgICAweDAwMTkKKyNkZWZpbmUgY21kX2JicF9yZWdfYWNjZXNzICAgICAgICAgICAgMHgwMDFhCisjZGVmaW5lIGNtZF9yZl9yZWdfYWNjZXNzICAgICAgICAgICAgIDB4MDAxYgorI2RlZmluZSBjbWRfODAyXzExX3JhZGlvX2NvbnRyb2wgICAgICAweDAwMWMKKyNkZWZpbmUgY21kXzgwMl8xMV9yZl9jaGFubmVsICAgICAgICAgMHgwMDFkCisjZGVmaW5lIGNtZF84MDJfMTFfcmZfdHhfcG93ZXIgICAgICAgIDB4MDAxZQorI2RlZmluZSBjbWRfODAyXzExX3Jzc2kgICAgICAgICAgICAgICAweDAwMWYKKyNkZWZpbmUgY21kXzgwMl8xMV9yZl9hbnRlbm5hICAgICAgICAgMHgwMDIwCisKKyNkZWZpbmUgY21kXzgwMl8xMV9wc19tb2RlCSAgICAgIDB4MDAyMQorCisjZGVmaW5lIGNtZF84MDJfMTFfZGF0YV9yYXRlICAgICAgICAgIDB4MDAyMgorI2RlZmluZSBjbWRfcmZfcmVnX21hcCAgICAgICAgICAgICAgICAweDAwMjMKKyNkZWZpbmUgY21kXzgwMl8xMV9kZWF1dGhlbnRpY2F0ZSAgICAgMHgwMDI0CisjZGVmaW5lIGNtZF84MDJfMTFfcmVhc3NvY2lhdGUgICAgICAgIDB4MDAyNQorI2RlZmluZSBjbWRfODAyXzExX2Rpc2Fzc29jaWF0ZSAgICAgICAweDAwMjYKKyNkZWZpbmUgY21kX21hY19jb250cm9sICAgICAgICAgICAgICAgMHgwMDI4CisjZGVmaW5lIGNtZF84MDJfMTFfYWRfaG9jX3N0YXJ0ICAgICAgIDB4MDAyYgorI2RlZmluZSBjbWRfODAyXzExX2FkX2hvY19qb2luICAgICAgICAweDAwMmMKKworI2RlZmluZSBjbWRfODAyXzExX3F1ZXJ5X3RraXBfcmVwbHlfY250cnMgIDB4MDAyZQorI2RlZmluZSBjbWRfODAyXzExX2VuYWJsZV9yc24gICAgICAgICAgICAgIDB4MDAyZgorI2RlZmluZSBjbWRfODAyXzExX3BhaXJ3aXNlX3RzYyAgICAgICAweDAwMzYKKyNkZWZpbmUgY21kXzgwMl8xMV9ncm91cF90c2MgICAgICAgICAgMHgwMDM3CisjZGVmaW5lIGNtZF84MDJfMTFfa2V5X21hdGVyaWFsICAgICAgIDB4MDA1ZQorCisjZGVmaW5lIGNtZF84MDJfMTFfc2V0X2FmYyAgICAgICAgICAgIDB4MDAzYworI2RlZmluZSBjbWRfODAyXzExX2dldF9hZmMgICAgICAgICAgICAweDAwM2QKKworI2RlZmluZSBjbWRfODAyXzExX2FkX2hvY19zdG9wICAgICAgICAweDAwNDAKKworI2RlZmluZSBjbWRfODAyXzExX2JlYWNvbl9zdG9wICAgICAgICAweDAwNDkKKworI2RlZmluZSBjbWRfODAyXzExX21hY19hZGRyZXNzICAgICAgICAweDAwNEQKKyNkZWZpbmUgY21kXzgwMl8xMV9lZXByb21fYWNjZXNzICAgICAgMHgwMDU5CisKKyNkZWZpbmUgY21kXzgwMl8xMV9iYW5kX2NvbmZpZyAgICAgICAgMHgwMDU4CisKKyNkZWZpbmUgY21kXzgwMl8xMWRfZG9tYWluX2luZm8gICAgICAgMHgwMDViCisKKyNkZWZpbmUgY21kXzgwMl8xMV9zbGVlcF9wYXJhbXMgICAgICAgICAgMHgwMDY2CisKKyNkZWZpbmUgY21kXzgwMl8xMV9pbmFjdGl2aXR5X3RpbWVvdXQgICAgMHgwMDY3CisKKyNkZWZpbmUgY21kXzgwMl8xMV90cGNfY2ZnICAgICAgICAgICAgICAgMHgwMDcyCisjZGVmaW5lIGNtZF84MDJfMTFfcHdyX2NmZyAgICAgICAgICAgICAgIDB4MDA3MworCisjZGVmaW5lIGNtZF84MDJfMTFfbGVkX2dwaW9fY3RybCAgICAgICAgIDB4MDA0ZQorCisjZGVmaW5lIGNtZF84MDJfMTFfc3Vic2NyaWJlX2V2ZW50ICAgICAgIDB4MDA3NQorCisjZGVmaW5lIGNtZF84MDJfMTFfcmF0ZV9hZGFwdF9yYXRlc2V0ICAgIDB4MDA3NgorCisjZGVmaW5lIGNtZF84MDJfMTFfdHhfcmF0ZV9xdWVyeQkweDAwN2YKKworI2RlZmluZSBjbWRfZ2V0X3RzZiAgICAgICAgICAgICAgICAgICAgICAweDAwODAKKworI2RlZmluZSBjbWRfYnRfYWNjZXNzICAgICAgICAgICAgICAgICAweDAwODcKKyNkZWZpbmUgY21kX3JldF9idF9hY2Nlc3MgICAgICAgICAgICAgICAgIDB4ODA4NworCisjZGVmaW5lIGNtZF9md3RfYWNjZXNzICAgICAgICAgICAgICAgIDB4MDA4OAorI2RlZmluZSBjbWRfcmV0X2Z3dF9hY2Nlc3MgICAgICAgICAgICAgICAgMHg4MDg4CisKKyNkZWZpbmUgY21kX21lc2hfYWNjZXNzICAgICAgICAgICAgICAgMHgwMDkwCisjZGVmaW5lIGNtZF9yZXRfbWVzaF9hY2Nlc3MgICAgICAgICAgICAgICAweDgwOTAKKworLyogRm9yIHRoZSBJRUVFIFBvd2VyIFNhdmUgKi8KKyNkZWZpbmUgY21kX3N1YmNtZF9lbnRlcl9wcyAgICAgICAgICAgICAgIDB4MDAzMAorI2RlZmluZSBjbWRfc3ViY21kX2V4aXRfcHMgICAgICAgICAgICAgICAgMHgwMDMxCisjZGVmaW5lIGNtZF9zdWJjbWRfc2xlZXBfY29uZmlybWVkICAgICAgICAweDAwMzQKKyNkZWZpbmUgY21kX3N1YmNtZF9mdWxsX3Bvd2VyZG93biAgICAgICAgIDB4MDAzNQorI2RlZmluZSBjbWRfc3ViY21kX2Z1bGxfcG93ZXJ1cCAgICAgICAgICAgMHgwMDM2CisKKy8qIGNvbW1hbmQgUkVUIGNvZGUsIE1TQiBpcyBzZXQgdG8gMSAqLworI2RlZmluZSBjbWRfcmV0X2h3X3NwZWNfaW5mbyAgICAgICAgICAgICAgMHg4MDAzCisjZGVmaW5lIGNtZF9yZXRfZWVwcm9tX3VwZGF0ZSAgICAgICAgICAgICAweDgwMDQKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfcmVzZXQgICAgICAgICAgICAgIDB4ODAwNQorI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9zY2FuICAgICAgICAgICAgICAgMHg4MDA2CisjZGVmaW5lIGNtZF9yZXRfODAyXzExX2dldF9sb2cgICAgICAgICAgICAweDgwMGIKKyNkZWZpbmUgY21kX3JldF9tYWNfY29udHJvbCAgICAgICAgICAgICAgIDB4ODAyOAorI2RlZmluZSBjbWRfcmV0X21hY19tdWx0aWNhc3RfYWRyICAgICAgICAgMHg4MDEwCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX2F1dGhlbnRpY2F0ZSAgICAgICAweDgwMTEKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfZGVhdXRoZW50aWNhdGUgICAgIDB4ODAyNAorI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9hc3NvY2lhdGUgICAgICAgICAgMHg4MDEyCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX3JlYXNzb2NpYXRlICAgICAgICAweDgwMjUKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfZGlzYXNzb2NpYXRlICAgICAgIDB4ODAyNgorI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9zZXRfd2VwICAgICAgICAgICAgMHg4MDEzCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX3N0YXQgICAgICAgICAgICAgICAweDgwMTQKKyNkZWZpbmUgY21kX3JldF84MDJfM19zdGF0ICAgICAgICAgICAgICAgIDB4ODAxNQorI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9zbm1wX21pYiAgICAgICAgICAgMHg4MDE2CisjZGVmaW5lIGNtZF9yZXRfbWFjX3JlZ19tYXAgICAgICAgICAgICAgICAweDgwMTcKKyNkZWZpbmUgY21kX3JldF9iYnBfcmVnX21hcCAgICAgICAgICAgICAgIDB4ODAxOAorI2RlZmluZSBjbWRfcmV0X3JmX3JlZ19tYXAgICAgICAgICAgICAgICAgMHg4MDIzCisjZGVmaW5lIGNtZF9yZXRfbWFjX3JlZ19hY2Nlc3MgICAgICAgICAgICAweDgwMTkKKyNkZWZpbmUgY21kX3JldF9iYnBfcmVnX2FjY2VzcyAgICAgICAgICAgIDB4ODAxYQorI2RlZmluZSBjbWRfcmV0X3JmX3JlZ19hY2Nlc3MgICAgICAgICAgICAgMHg4MDFiCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX3JhZGlvX2NvbnRyb2wgICAgICAweDgwMWMKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfcmZfY2hhbm5lbCAgICAgICAgIDB4ODAxZAorI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9yc3NpICAgICAgICAgICAgICAgMHg4MDFmCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX3JmX3R4X3Bvd2VyICAgICAgICAweDgwMWUKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfcmZfYW50ZW5uYSAgICAgICAgIDB4ODAyMAorI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9wc19tb2RlICAgICAgICAgICAgMHg4MDIxCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX2RhdGFfcmF0ZSAgICAgICAgICAweDgwMjIKKworI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9hZF9ob2Nfc3RhcnQgICAgICAgMHg4MDJCCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX2FkX2hvY19qb2luICAgICAgICAweDgwMkMKKworI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9xdWVyeV90a2lwX3JlcGx5X2NudHJzICAweDgwMmUKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfZW5hYmxlX3JzbiAgICAgICAgICAgICAgMHg4MDJmCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX3BhaXJ3aXNlX3RzYyAgICAgICAweDgwMzYKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfZ3JvdXBfdHNjICAgICAgICAgIDB4ODAzNworI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9rZXlfbWF0ZXJpYWwgICAgICAgMHg4MDVlCisKKyNkZWZpbmUgY21kX2VuYWJsZV9yc24gICAgICAgICAgICAgICAgICAgIDB4MDAwMQorI2RlZmluZSBjbWRfZGlzYWJsZV9yc24gICAgICAgICAgICAgICAgICAgMHgwMDAwCisKKyNkZWZpbmUgY21kX2FjdF9zZXQgICAgICAgICAgICAgICAgICAgICAgIDB4MDAwMQorI2RlZmluZSBjbWRfYWN0X2dldCAgICAgICAgICAgICAgICAgICAgICAgMHgwMDAwCisKKyNkZWZpbmUgY21kX2FjdF9nZXRfQUVTICAgICAgICAgICAgICAgICAgIChjbWRfYWN0X2dldCArIDIpCisjZGVmaW5lIGNtZF9hY3Rfc2V0X0FFUyAgICAgICAgICAgICAgICAgICAoY21kX2FjdF9zZXQgKyAyKQorI2RlZmluZSBjbWRfYWN0X3JlbW92ZV9hZXMgICAgICAgICAgICAgICAgKGNtZF9hY3Rfc2V0ICsgMykKKworI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9zZXRfYWZjICAgICAgICAgICAgMHg4MDNjCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX2dldF9hZmMgICAgICAgICAgICAweDgwM2QKKworI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9hZF9ob2Nfc3RvcCAgICAgICAgMHg4MDQwCisKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfYmVhY29uX3N0b3AgICAgICAgIDB4ODA0OQorCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX21hY19hZGRyZXNzICAgICAgICAweDgwNEQKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfZWVwcm9tX2FjY2VzcyAgICAgIDB4ODA1OQorCisjZGVmaW5lIGNtZF9yZXRfODAyXzExX2JhbmRfY29uZmlnICAgICAgICAweDgwNTgKKworI2RlZmluZSBjbWRfcmV0XzgwMl8xMV9zbGVlcF9wYXJhbXMgICAgICAgICAgMHg4MDY2CisKKyNkZWZpbmUgY21kX3JldF84MDJfMTFfaW5hY3Rpdml0eV90aW1lb3V0ICAgIDB4ODA2NworCisjZGVmaW5lIGNtZF9yZXRfODAyXzExZF9kb21haW5faW5mbyAgICAgICgweDgwMDAgfCAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbWRfODAyXzExZF9kb21haW5faW5mbykKKworI2RlZm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KKyNkZWZpbmUgY21kX1dFUF9LRVlfSU5ERVhfTUFTSyAgICAgICAgICAgICAgMHgzZmZmCisKKy8qIERlZmluZSBhY3Rpb24gb3Igb3B0aW9uIGZvciBjbWRfODAyXzExX3Jlc2V0ICovCisjZGVmaW5lIGNtZF9hY3RfaGFsdCAgICAgICAgICAgICAgICAgICAgICAgIDB4MDAwMworCisvKiBEZWZpbmUgYWN0aW9uIG9yIG9wdGlvbiBmb3IgY21kXzgwMl8xMV9zY2FuICovCisjZGVmaW5lIGNtZF9ic3NfdHlwZV9ic3MgICAgICAgICAgICAgICAgICAgIDB4MDAwMQorI2RlZmluZSBjbWRfYnNzX3R5cGVfaWJzcyAgICAgICAgICAgICAgICAgICAweDAwMDIKKyNkZWZpbmUgY21kX2Jzc190eXBlX2FueSAgICAgICAgICAgICAgICAgICAgMHgwMDAzCisKKy8qIERlZmluZSBhY3Rpb24gb3Igb3B0aW9uIGZvciBjbWRfODAyXzExX3NjYW4gKi8KKyNkZWZpbmUgY21kX3NjYW5fdHlwZV9hY3RpdmUgICAgICAgICAgICAgICAgMHgwMDAwCisjZGVmaW5lIGNtZF9zY2FuX3R5cGVfcGFzc2l2ZSAgICAgICAgICAgICAgIDB4MDAwMQorCisjZGVmaW5lIGNtZF9zY2FuX3JhZGlvX3R5cGVfYmcJCTAKKworI2RlZmluZSBjbWRfc2Nhbl9wcm9iZV9kZWxheV90aW1lICAgICAgICAgICAwCisKKy8qIERlZmluZSBhY3Rpb24gb3Igb3B0aW9uIGZvciBjbWRfbWFjX2NvbnRyb2wgKi8KKyNkZWZpbmUgY21kX2FjdF9tYWNfcnhfb24gICAgICAgICAgICAgICAgICAgMHgwMDAxCisjZGVmaW5lIGNtZF9hY3RfbWFjX3R4X29uICAgICAgICAgICAgICAgICAgIDB4MDAwMgorI2RlZmluZSBjbWRfYWN0X21hY19sb29wYmFja19vbiAgICAgICAgICAgICAweDAwMDQKKyNkZWZpbmUgY21kX2FjdF9tYWNfd2VwX2VuYWJsZSAgICAgICAgICAgICAgMHgwMDA4CisjZGVmaW5lIGNtZF9hY3RfbWFjX2ludF9lbmFibGUgICAgICAgICAgICAgIDB4MDAxMAorI2RlZmluZSBjbWRfYWN0X21hY19tdWx0aWNhc3RfZW5hYmxlICAgICAgICAweDAwMjAKKyNkZWZpbmUgY21kX2FjdF9tYWNfYnJvYWRjYXN0X2VuYWJsZSAgICAgICAgMHgwMDQwCisjZGVmaW5lIGNtZF9hY3RfbWFjX3Byb21pc2N1b3VzX2VuYWJsZSAgICAgIDB4MDA4MAorI2RlZmluZSBjbWRfYWN0X21hY19hbGxfbXVsdGljYXN0X2VuYWJsZSAgICAweDAxMDAKKyNkZWZpbmUgY21kX2FjdF9tYWNfc3RyaWN0X3Byb3RlY3Rpb25fZW5hYmxlICAweDA0MDAKKworLyogRGVmaW5lIGFjdGlvbiBvciBvcHRpb24gZm9yIGNtZF84MDJfMTFfcmFkaW9fY29udHJvbCAqLworI2RlZmluZSBjbWRfdHlwZV9hdXRvX3ByZWFtYmxlICAgICAgICAgICAgICAweDAwMDEKKyNkZWZpbmUgY21kX3R5cGVfc2hvcnRfcHJlYW1ibGUgICAgICAgICAgICAgMHgwMDAyCisjZGVmaW5lIGNtZF90eXBlX2xvbmdfcHJlYW1ibGUgICAgICAgICAgICAgIDB4MDAwMworCisjZGVmaW5lIFRVUk5fT05fUkYgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDAxCisjZGVmaW5lIFJBRElPX09OICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDAxCisjZGVmaW5lIFJBRElPX09GRiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDAwCisKKyNkZWZpbmUgU0VUX0FVVE9fUFJFQU1CTEUgICAgICAgICAgICAgICAgICAgICAgIDB4MDUKKyNkZWZpbmUgU0VUX1NIT1JUX1BSRUFNQkxFICAgICAgICAgICAgICAgICAgICAgIDB4MDMKKyNkZWZpbmUgU0VUX0xPTkdfUFJFQU1CTEUgICAgICAg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9zZXRfcnggICAgICAgICAgICAgICAgICAgICAgMHgwMDAxCisjZGVmaW5lIGNtZF9hY3Rfc2V0X3R4ICAgICAgICAgICAgICAgICAgICAgIDB4MDAwMgorI2RlZmluZSBjbWRfYWN0X3NldF9ib3RoICAgICAgICAgICAgICAgICAgICAweDAwMDMKKyNkZWZpbmUgY21kX2FjdF9nZXRfcnggICAgICAgICAgICAgICAgICAgICAgMHgwMDA0CisjZGVmaW5lIGNtZF9hY3RfZ2V0X3R4ICAgICAgICAgICAgICAgICAgICAgIDB4MDAwOAorI2RlZmluZSBjbWRfYWN0X2dldF9ib3RoICAgICAgICAgICAgICAgICAgICAweDAwMGMKKworLyogRGVmaW5lIGFjdGlvbiBvciBvcHRpb24gZm9yIGNtZF84MDJfMTFfcHNfbW9kZSAqLworI2RlZmluZSBjbWRfdHlwZV9jYW0gICAgICAgICAgICAgICAgICAgICAgICAweDAwMDAKKyNkZWZpbmUgY21kX3R5cGVfbWF4X3BzcCAgICAgICAgICAgICAgICAgICAgMHgwMDAxCisjZGVmaW5lIGNtZF90eXBlX2Zhc3RfcHNwICAgICAgICAgICAgICAgICAgIDB4MDAwMgorCisvKiBEZWZpbmUgYWN0aW9uIG9yIG9wdGlvbiBmb3IgY21kX2J0X2FjY2VzcyAqLworZW51bSBjbWRfYnRfYWNjZXNzX29wdHMgeworCS8qIFRoZSBidCBjb21tYW5kcyBzdGFydCBhdCA1IGluc3RlYWQgb2YgMSBiZWNhdXNlIHRoZSBvbGQgZGZ0IGNvbW1hbmRzCisJICogYXJlIG1hcHBlZCB0byAxLTQuICBUaGVzZSBvbGQgY29tbWFuZHMgYXJlIG5vIGxvbmdlciBtYWludGFpbmVkIGFuZAorCSAqIHNob3VsZCBub3QgYmUgY2FsbGVkLgorCSAqLworCWNtZF9hY3RfYnRfYWNjZXNzX2FkZCA9IDUsCisJY21kX2FjdF9idF9hY2Nlc3NfZGVsLAorCWNtZF9hY3RfYnRfYWNjZXNzX2xpc3QsCisJY21kX2Fjd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2ItPmxlbik7CisJaWYgKGxpYmVydGFzX3VwbG9hZF9yeF9wYWNrZXQocHJpdiwgc2tiKSkgeworCQlsYnNfcHJfZGVidWcoMSwgIlJYIGVycm9yOiBsaWJlcnRhc191cGxvYWRfcnhfcGFja2V0IgorCQkgICAgICAgIiByZXR1cm5zIGZhaWx1cmVcbiIpOworCQlyZXQgPSAtMTsKKwkJZ290byBkb25lOworCX0KKwlwcml2LT5zdGF0cy5yeF9ieXRlcyArPSBza2ItPmxlbjsKKwlwcml2LT5zdGF0cy5yeF9wYWNrZXRzKys7CisKKwlyZXQgPSAwOworZG9uZToKKwlMRUFWRSgpOworCisJcmV0dXJuIHJldDsKK30KKworLyoqCisgKiAgQGJyaWVmIFRoaXMgZnVuY3Rpb24gY29udmVydHMgVHgvUnggcmF0ZXMgZnJvbSB0aGUgTWFydmVsbCBXTEFOIGZvcm1hdAorICogIChzZWUgVGFibGUgMiBpbiBTZWN0aW9uIDMuMSkgdG8gSUVFRTgwMjExX1JBRElPVEFQX1JBVEUgdW5pdHMgKDUwMCBLYi9zKQorICoKKyAqICBAcGFyYW0gcmF0ZSAgICBJbnB1dCByYXRlCisgKiAgQHJldHVybiAJICAgT3V0cHV0IFJhdGUgKDAgaWYgaW52YWxpZCkKKyAqLworc3RhdGljIHU4IGNvbnZlcnRfbXZfcmF0ZV90b19yYWRpb3RhcCh1OCByYXRlKQoreworCXN3aXRjaCAocmF0ZSkgeworCWNhc2UgMDoJCS8qICAgMSBNYnBzICovCisJCXJldHVybiAyOworCWNhc2UgMToJCS8qICAgMiBNYnBzICovCisJCXJldHVybiA0OworCWNhc2UgMjoJCS8qIDUuNSBNYnBzICovCisJCXJldHVybiAxMTsKKwljYXNlIDM6CQkvKiAgMTEgTWJwcyAqLworCQlyZXR1cm4gMjI7CisJY2FzZSA0OgkJLyogICA2IE1icHMgKi8KKwkJcmV0dXJuIDEyOworCWNhc2UgNToJCS8qICAgOSBNYnBzICovCisJCXJldHVybiAxODsKKwljYXNlID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yoqCisgICogRnVuY3Rpb25zIGltcGxlbWVudGluZyB3bGFuIHNjYW4gSU9DVEwgYW5kIGZpcm13YXJlIGNvbW1hbmQgQVBJcworICAqCisgICogSU9DVEwgaGFuZGxlcnMgYXMgd2VsbCBhcyBjb21tYW5kIHByZXBlcmF0aW9uIGFuZCByZXNwb25zZSByb3V0aW5lcworICAqICBmb3Igc2VuZGluZyBzY2FuIGNvbW1hbmRzIHRvIHRoZSBmaXJtd2FyZS4KKyAgKi8KKyNpbmNsdWRlIDxsaW51eC9jdHlwZS5oPgorI2luY2x1ZGUgPGxpbnV4L2lmLmg+CisjaW5jbHVkZSA8bGludXgvbmV0ZGV2aWNlLmg+CisjaW5jbHVkZSA8bGludXgvd2lyZWxlc3MuaD4KKworI2luY2x1ZGUgPG5ldC9pZWVlODAyMTEuaD4KKyNpbmNsdWRlIDxuZXQvaXdfaGFuZGxlci5oPgorCisjaW5jbHVkZSAiaG9zdC5oIgorI2luY2x1ZGUgImRlY2wuaCIKKyNpbmNsdWRlICJkZXYuaCIKKyNpbmNsdWRlICJzY2FuLmgiCisKKy8vISBBcHByb3hpbWF0ZSBhbW91bnQgb2YgZGF0YSBuZWVkZWQgdG8gcGFzcyBhIHNjYW4gcmVzdWx0IGJhY2sgdG8gaXdsaXN0CisjZGVmaW5lIE1BWF9TQ0FOX0NFTExfU0laRSAgKElXX0VWX0FERFJfTEVOICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBJV19FU1NJRF9NQVhfU0laRSAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIElXX0VWX1VJTlRfTEVOICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgSVdfRVZfRlJFUV9MRU4gICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBJV19FVl9RVUFMX0xFTiAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIElXX0VTU0lEX01BWF9TSVpFICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgSVdfRVZfUEFSQU1fTEVOICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyA0MCkJLyogNDAgZm9yIFdQQUlFICovCisKKy8vISBNZW1vcnkgbmVlZGVkIHRvIHN0b3JlIGEgbWF4IHNpemVkIGNoYW5uZWwgTGlzdCBUTFYgZm9yIGEgZmlybXdhcmUgc2NhbgorI2RlZmluZSBDSEFOX1RMVl9NQVhfU0laRSAgKHNpemVvZihzdHJ1Y3QgbXJ2bGlldHlwZXNoZWFkZXIpICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArIChNUlZEUlZfTUFYX0NIQU5ORUxTX1BFUl9TQ0FOICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBzaXplb2Yoc3RydWN0IGNoYW5zY2FucGFyYW1zZXQpKSkKKworLy8hIE1lbW9yeSBuZWVkZWQgdG8gc3RvcmUgYSBtYXggbnVtYmVyL3NpemUgU1NJRCBUTFYgZm9yIGEgZmlybXdhcmUgc2NhbgorI2RlZmluZSBTU0lEX1RMVl9NQVhfU0laRSAgKDEgKiBzaXplb2Yoc3RydWN0IG1ydmxpZXR5cGVzX3NzaWRwYXJhbXNldCkpCisKKy8vISBNYXhpbXVtIG1lbW9yeSBuZWVkZWQgZm9yIGEgd2xhbl9zY2FuX2NtZF9jb25maWcgd2l0aCBhbGwgVExWcyBhdCBtYXgKKyNkZWZpbmUgTUFYX1NDQU5fQ0ZHX0FMTE9DIChzaXplb2Yoc3RydWN0IHdsYW5fc2Nhbl9jbWRfY29uZmlnKSAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgc2l6ZW9mKHN0cnVjdCBtcnZsaWV0eXBlc19udW1wcm9iZXMpICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgQ0hBTl9UTFZfTUFYX1NJWkUgICAgICAgICAgICA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WxpZCgmYnNzaWRFbnRyeS5zc2lkKQorI2Vsc2UKKyNkZWZpbmUgQ0hFQ0tfU1NJRF9JU19WQUxJRCh4KSAxCisjZW5kaWYKKworLyoqCisgKiAgQGJyaWVmIENoZWNrIGlmIGEgc2Nhbm5lZCBuZXR3b3JrIGNvbXBhdGlibGUgd2l0aCB0aGUgZHJpdmVyIHNldHRpbmdzCisgKgorICogICBXRVAgICAgIFdQQSAgICAgV1BBMiAgICBhZC1ob2MgIGVuY3J5cHQgICAgICAgICAgICAgICAgICAgICAgTmV0d29yaworICogZW5hYmxlZCBlbmFibGVkICBlbmFibGVkICAgQUVTICAgICBtb2RlICAgcHJpdmFjeSAgV1BBICBXUEEyICBDb21wYXRpYmxlCisgKiAgICAwICAgICAgIDAgICAgICAgIDAgICAgICAgMCAgICAgIE5PTkUgICAgICAwICAgICAgMCAgICAwICAgeWVzIE5vIHNlY3VyaXR5CisgKiAgICAxICAgICAgIDAgICAgICAgIDAgICAgICAgMCAgICAgIE5PTkUgICAgICAxICAgICAgMCAgICAwICAgeWVzIFN0YXRpYyBXRVAKKyAqICAgIDAgICAgICAgMSAgICAgICAgMCAgICAgICAwICAgICAgIHggICAgICAgIDF4ICAgICAxICAgIHggICB5ZXMgV1BBCisgKiAgICAwICAgICAgIDAgICAgICAgIDEgICAgICAgMCAgICAgICB4ICAgICAgICAxeCAgICAgeCAgICAxICAgeWVzIFdQQTIKKyAqICAgIDAgICAgICAgMCAgICAgICAgMCAgICAgICAxICAgICAgTk9ORSAgICAgIDEgICAgICAwICAgIDAgICB5ZXMgQWQtaG9jIEFFUworICogICAgMCAgICAgICAwICAgICAgICAwICAgICAgIDAgICAgICE9Tk9ORSAgICAgMSAgICAgIDAgICAgMCAgIHllcyBEeW5hbWljIFdFUAorICoKKyAqCisgKiAgQHBhcmFtIGFkYXB0ZXIgQSBwb2ludGVyIHRvIHdsYW5fYWRhcHRlcgorICogIEBwYXJhbSBpbmRleCAgIEluZGV4IGluIHNjYW50YWJsZ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LT5zY2FudGFibGVbaV0ucnNzaSk7CisJCQkJYmVzdG5ldCA9IGk7CisJCQl9CisJCQlicmVhazsKKwkJfQorCX0KKworCUxFQVZFKCk7CisJcmV0dXJuIGJlc3RuZXQ7Cit9CisKKy8qKgorICogIEBicmllZiBGaW5kIHRoZSBBUCB3aXRoIHNwZWNpZmljIHNzaWQgaW4gdGhlIHNjYW4gbGlzdAorICoKKyAqICBAcGFyYW0gcHJpdiAgICAgICAgIEEgcG9pbnRlciB0byB3bGFuX3ByaXZhdGUgc3RydWN0dXJlCisgKiAgQHBhcmFtIHBTU0lEICAgICAgICBBIHBvaW50ZXIgdG8gQVAncyBzc2lkCisgKgorICogIEByZXR1cm4gICAgICAgICAgICAgMC0tc3VjY2Vzcywgb3RoZXJ3aXNlLS1mYWlsCisgKi8KK2ludCBsaWJlcnRhc19maW5kX2Jlc3RfbmV0d29ya19TU0lEKHdsYW5fcHJpdmF0ZSAqIHByaXYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgV0xBTl84MDJfMTFfU1NJRCAqcFNTSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtIFdMQU5fODAyXzExX05FVFdPUktfSU5GUkFTVFJVQ1RVUkUgcHJlZmVycmVkX21vZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtIFdMQU5fODAyXzExX05FVFdPUktfSU5GUkFTVFJVQ1RVUkUgKm91dF9tb2RlKQoreworCXdsYW5fYWRhcHRlciAqYWRhcHRlciA9IHByaXYtPmFkYXB0ZXI7CisJaW50IHJldCA9IDA7CisJc3RydWN0IGJzc19kZXNjcmlwdG9yICpwcmVxYnNzaWQ7CisJaW50IGk7CisKKwlFTlRFUigpOworCisJbWVtc2V0KHBTU0lELCAwLCBzaXplb2Yoc3RydWN0IFdMQU5fODAyXzExX1NTSUQpKTsKKworCXdsYW5fc2Nhbl9uZXR3b3Jrcyhwcml2LCBOV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iaG9zdC5oIgorI2luY2x1ZGUgInJhZGlvdGFwLmgiCisjaW5jbHVkZSAiZGVjbC5oIgorI2luY2x1ZGUgImRlZnMuaCIKKyNpbmNsdWRlICJkZXYuaCIKKyNpbmNsdWRlICJqb2luLmgiCisjaW5jbHVkZSAidmVyc2lvbi5oIgorI2luY2x1ZGUgIndleHQuaCIKKyNpbmNsdWRlICJhc3NvYy5oIgorCisKKy8qKgorICogIEBicmllZiBDb252ZXJ0IG13IHZhbHVlIHRvIGRibSB2YWx1ZQorICoKKyAqICBAcGFyYW0gbXcJICAgdGhlIHZhbHVlIG9mIG13CisgKiAgQHJldHVybiAJICAgdGhlIHZhbHVlIG9mIGRibQorICovCitzdGF0aWMgaW50IG13X3RvX2RibShpbnQgbXcpCit7CisJaWYgKG13IDwgMikKKwkJcmV0dXJuIDA7CisJZWxzZSBpZiAobXcgPCAzKQorCQlyZXR1cm4gMzsKKwllbHNlIGlmIChtdyA8IDQpCisJCXJldHVybiA1OworCWVsc2UgaWYgKG13IDwgNikKKwkJcmV0dXJuIDc7CisJZWxzZSBpZiAobXcgPCA3KQorCQlyZXR1cm4gODsKKwllbHNlIGlmIChtdyA8IDgpCisJCXJldHVybiA5OworCWVsc2UgaWYgKG13IDwgMTApCisJCXJldHVybiAxMDsKKwllbHNlIGlmIChtdyA8IDEzKQorCQlyZXR1cm4gMTE7CisJZWxzZSBpZiAobXcgPCAxNikKKwkJcmV0dXJuIDEyOworCWVsc2UgaWYgKG13IDwgMjApCisJCXJldHVybiAxMzsKKwllbHNlIGlmIChtdyA8IDI1KQorCQlyZXR1cm4gMTQ7CisJZWxzZSBpZiAobXcgPCAzMikKKwkJcmV0dXJuIDE1OworCWVsc2UgaWYgKG13IDwgNDApCisJCXJldHVybiAxNjsKKwllbHNlIGlmIChtdyA8IDUwKQorCQlyZXR1cm4gMTc7CisJZWxzZSBpZiAobXcgPCA2MykKKwkJcmV0dXJuIDE4OworCWVsc2UgaWYgKG13IDwgNzkpCisJCXJldHV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fY29udHJvbCwKKwkJCQkJICAgIGNtZF9hY3Rfc2V0LAorCQkJCQkgICAgY21kX29wdGlvbl93YWl0Zm9ycnNwLCAwLCBOVUxMKTsKKwl9CisKKwlMRUFWRSgpOworCXJldHVybiByZXQ7Cit9CisKKy8qKgorICogIEBicmllZiBDb3B5IHJhdGVzCisgKgorICogIEBwYXJhbSBkZXN0ICAgICAgICAgICAgICAgICBBIHBvaW50ZXIgdG8gRGVzdCBCdWYKKyAqICBAcGFyYW0gc3JjCQkgICAgICAgIEEgcG9pbnRlciB0byBTcmMgQnVmCisgKiAgQHBhcmFtIGxlbiAgICAgICAgICAgICAgICAgIFRoZSBsZW4gb2YgU3JjIEJ1ZgorICogIEByZXR1cm4gCSAgIAkgICAgICAgIE51bWJlciBvZiByYXRlcyBjb3B5ZWQKKyAqLworc3RhdGljIGlubGluZSBpbnQgY29weXJhdGVzKHU4ICogZGVzdCwgaW50IHBvcywgdTggKiBzcmMsIGludCBsZW4pCit7CisJaW50IGk7CisKKwlmb3IgKGkgPSAwOyBpIDwgbGVuICYmIHNyY1tpXTsgaSsrLCBwb3MrKykgeworCQlpZiAocG9zID49IHNpemVvZih1OCkgKiBXTEFOX1NVUFBPUlRFRF9SQVRFUykKKwkJCWJyZWFrOworCQlkZXN0W3Bvc10gPSBzcmNbaV07CisJfQorCisJcmV0dXJuIHBvczsKK30KKworLyoqCisgKiAgQGJyaWVmIEdldCBhY3RpdmUgZGF0YSByYXRlcworICoKKyAqICBAcGFyYW0gYWRhcHRlciAgICAgICAgICAgICAgQSBwb2ludGVyIHRvIHdsYW5fYWRhcHRlciBzdHJ1Y3R1cmUKKyAqICBAcGFyYW0gcmF0ZQkJICAgICAgICBUaGUgYnVmIHRvIHJldHVybiB0aGUgYWN0aXZlIHJhdGVzCisgKiAgQHJldHVybiAJICAgCSAgICAgICAgVGhlIG51bWJlciBvZiByYXRlcworICovCitzdGF0aWMgaW50IGdldF9hY3RpdmVfZGF0YV9yYXRlcyh3bGFuX2Fk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isJCWlmIChhZGFwdGVyLT5zZWNpbmZvLldQQWVuYWJsZWQgJiYgYWRhcHRlci0+c2VjaW5mby5XUEEyZW5hYmxlZCkKKwkJCWR3cnEtPnZhbHVlID0gMTsKKwkJYnJlYWs7CisKKwlkZWZhdWx0OgorCQlMRUFWRSgpOworCQlyZXR1cm4gLUVPUE5PVFNVUFA7CisJfQorCisJTEVBVkUoKTsKKwlyZXR1cm4gMDsKK30KKworCitzdGF0aWMgaW50IHdsYW5fc2V0X3R4cG93KHN0cnVjdCBuZXRfZGV2aWNlICpkZXYsIHN0cnVjdCBpd19yZXF1ZXN0X2luZm8gKmluZm8sCisJCSAgIHN0cnVjdCBpd19wYXJhbSAqdndycSwgY2hhciAqZXh0cmEpCit7CisJaW50IHJldCA9IDA7CisJd2xhbl9wcml2YXRlICpwcml2ID0gZGV2LT5wcml2OworCXdsYW5fYWRhcHRlciAqYWRhcHRlciA9IHByaXYtPmFkYXB0ZXI7CisKKwl1MTYgZGJtOworCisJRU5URVIoKTsKKworCWlmICh2d3JxLT5kaXNhYmxlZCkgeworCQl3bGFuX3JhZGlvX2lvY3RsKHByaXYsIFJBRElPX09GRik7CisJCXJldHVybiAwOworCX0KKworCWFkYXB0ZXItPnByZWFtYmxlID0gY21kX3R5cGVfYXV0b19wcmVhbWJsZTsKKworCXdsYW5fcmFkaW9faW9jdGwocHJpdiwgUkFESU9fT04pOworCisJaWYgKCh2d3JxLT5mbGFncyAmIElXX1RYUE9XX1RZUEUpID09IElXX1RYUE9XX01XQVRUKSB7CisJCWRibSA9ICh1MTYpIG13X3RvX2RibSh2d3JxLT52YWx1ZSk7CisJfSBlbHNlCisJCWRibSA9ICh1MTYpIHZ3cnEtPnZhbHVlOworCisJLyogYXV0byB0eCBwb3dlciBjb250cm9sICovCisKKwlpZiAodndycS0+Zml4ZWQgPT0gMCkKKwkJZGJtID0gMHhmZmZmOworCisJbGJzX3ByX2RlYnVnKDEsICI8MT5UWFBPV0VSIFNFVCAlZCBkYm0uX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