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LCB0ZW1wID0gMDsKKworCQorCS8qIEdldCBjaGlwc2V0IGJvb3QgRlNCIGZyb20gc3ViZGV2aWNlIDUgKEZTQiBhdCBib290LXRpbWUpICovCisJbmZvcmNlMl9zdWI1ID0gcGNpX2dldF9zdWJzeXMoUENJX1ZFTkRPUl9JRF9OVklESUEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MDFFRiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUENJX0FOWV9JRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUENJX0FOWV9JRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisJCisJaWYgKCFuZm9yY2UyX3N1YjUpCisJCXJldHVybiAwOworCisJcGNpX3JlYWRfY29uZmlnX2R3b3JkKG5mb3JjZTJfc3ViNSwgTkZPUkNFMl9CT09URlNCLCAmZnNiKTsKKwlmc2IgLz0gMTAwMDAwMDsKKwkKKwkvKiBDaGVjayBpZiBQTEwgcmVnaXN0ZXIgaXMgYWxyZWFkeSBzZXQgKi8KKwlwY2lfcmVhZF9jb25maWdfYnl0ZShuZm9yY2UyX2NoaXBzZXRfZGV2LCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTkZPUkNFMl9QTExFTkFCTEUsICh1OCAqKSZ0ZW1wKTsKKwkKKwlpZihib290ZnNiIHx8ICF0ZW1wKQorCQlyZXR1cm4gZnNiOworCQkKKwkvKiBVc2UgUExMIHJlZ2lzdGVyIEZTQiB2YWx1ZSAqLworCXBjaV9yZWFkX2NvbmZpZ19kd29yZChuZm9yY2UyX2NoaXBzZXRfZGV2LCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5GT1JDRTJfUExMUkVHLCAmdGVtcCk7CisJZnNiID0gbmZvcmNlMl9jYWxjX2ZzYih0ZW1wKTsKKworCXJldHVybiBmc2I7Cit9CisKKy8qCisgKiBuZm9y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AgICAgICAgICBwb2xpY3ktPmNwdWluZm8ubWluX2ZyZXEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9saWN5LT5jcHVpbmZvLm1heF9mcmVxKTsKKwlyZXR1cm4gMDsKK30KKworc3RhdGljIGludCBuZm9yY2UyX2NwdV9pbml0KHN0cnVjdCBjcHVmcmVxX3BvbGljeSAqcG9saWN5KQoreworCXVuc2lnbmVkIGludCBmc2I7CisJdW5zaWduZWQgaW50IHJmaWQ7CisKKwkvKiBjYXBhYmlsaXR5IGNoZWNrICovCisJaWYgKHBvbGljeS0+Y3B1ICE9IDApCisJCXJldHVybiAtRU5PREVWOworCisJLyogR2V0IGN1cnJlbnQgRlNCICovCisJZnNiID0gbmZvcmNlMl9mc2JfcmVhZCgwKTsKKworCWlmICghZnNiKQorCQlyZXR1cm4gLUVJTzsKKworCS8qIEZJWDogR2V0IEZJRCBmcm9tIENQVSAqLworCWlmICghZmlkKSB7CisJCWlmICghY3B1X2toeikgeworCQkJcHJpbnRrKEtFUk5fV0FSTklORworCQkJICAgICAgICJjcHVmcmVxOiBjcHVfa2h6IG5vdCBzZXQsIGNhbid0IGNhbGN1bGF0ZSBtdWx0aXBsaWVyIVxuIik7CisJCQlyZXR1cm4gLUVOT0RFVjsKKwkJfQorCisJCWZpZCA9IGNwdV9raHogLyAoZnNiICogMTAwKTsKKwkJcmZpZCA9IGZpZCAlIDU7CisKKwkJaWYgKHJmaWQpIHsKKwkJCWlmIChyZmlkID4gMikKKwkJCQlmaWQgKz0gNSAtIHJmaWQ7CisJCQllbHNlCisJCQkJZmlkIC09IHJmaWQ7CisJCX0KKwl9CisKKwlwcmludGsoS0VSTl9JTkZPICJjcHVmcmVxOiBGU0IgY3VycmVudGx5IGF0ICVpIE1IeiwgRklEICVkLiVkXG4iLCBmc2IsCisJICAgICAgIGZpZCAvIDEwLCBmaWQgJSAxMCk7CisJCisJLyogU2V0IG1heGltdW0gRlNCIHRvIEZTQiBhdCBib290IHR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AorCS5nZXQgPSBuZm9yY2UyX2dldCwKKwkuaW5pdCA9IG5mb3JjZTJfY3B1X2luaXQsCisJLmV4aXQgPSBuZm9yY2UyX2NwdV9leGl0LAorCS5vd25lciA9IFRISVNfTU9EVUxFLAorfTsKKworLyoqCisgKiBuZm9yY2UyX2RldGVjdF9jaGlwc2V0IC0gZGV0ZWN0IHRoZSBTb3V0aGJyaWRnZSB3aGljaCBjb250YWlucyBGU0IgUExMIGxvZ2ljCisgKgorICogRGV0ZWN0cyBuRm9yY2UyIEEyIGFuZCBDMSBzdGVwcGluZworICogCisgKi8KK3N0YXRpYyB1bnNpZ25lZCBpbnQgbmZvcmNlMl9kZXRlY3RfY2hpcHNldCh2b2lkKQoreworCXU4IHJldmlzaW9uOworCisJbmZvcmNlMl9jaGlwc2V0X2RldiA9IHBjaV9nZXRfc3Vic3lzKFBDSV9WRU5ET1JfSURfTlZJRElBLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUENJX0RFVklDRV9JRF9OVklESUFfTkZPUkNFMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBDSV9BTllfSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQ0lfQU5ZX0lELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKwlpZiAobmZvcmNlMl9jaGlwc2V0X2RldiA9PSBOVUxMKQorCQlyZXR1cm4gLUVOT0RFVjsKKworCXBjaV9yZWFkX2NvbmZpZ19ieXRlKG5mb3JjZTJfY2hpcHNldF9kZXYsIFBDSV9SRVZJU0lPTl9JRCwgJnJldmlzaW9uKTsKKworCXByaW50ayhLRVJOX0lORk8gImNwdWZyZXE6IERldGVjdGVkIG5Gb3JjZTIgY2hpcHNldCByZXZpc2lvbiAlWFxuIiwKKwkgICAgICAgcmV2aXNpb24pOworCXByaW50ayhLRVJOX0lOR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ICogMzIpOworCWRwcmludGsoInN1c3BlbmQgbW9kdWxhdGlvbiB3LyBjbG9jayBzcGVlZDogJWQga0h6LlxuIiwgZnJlcXMubmV3KTsgCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICBIaWdoIGxldmVsIGZ1bmN0aW9ucyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qCisgKgljcHVmcmVxX2d4X3ZlcmlmeTogdGVzdCBpZiBmcmVxdWVuY3kgcmFuZ2UgaXMgdmFsaWQgCisgKgorICoJVGhpcyBmdW5jdGlvbiBjaGVja3MgaWYgYSBnaXZlbiBmcmVxdWVuY3kgcmFuZ2UgaW4ga0h6IGlzIHZhbGlkIAorICogICAgICBmb3IgdGhlIGhhcmR3YXJlIHN1cHBvcnRlZCBieSB0aGUgZHJpdmVyLiAKKyAqLworCitzdGF0aWMgaW50IGNwdWZyZXFfZ3hfdmVyaWZ5KHN0cnVjdCBjcHVmcmVxX3BvbGljeSAqcG9saWN5KQoreworCXVuc2lnbmVkIGludCB0bXBfZnJlcSA9IDA7CisJdTggdG1wMSwgdG1wMjsKKworICAgICAgICBpZiAoIXN0b2NrX2ZyZXEgfHwgIXBvbGljeSkKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKworCXBvbGljeS0+Y3B1ID0gMDsKKwljcHVmcmVxX3ZlcmlmeV93aXRoaW5fbGltaXRzKHBvbGljeSwgKHN0b2NrX2ZyZXEgLyBtYXhfZHVyYXRpb24pLCBzdG9ja19mcmVxKTsKKworCS8qIGl0IG5lZWRzIHRvIGJlIGFzc3VyZWQgdGhhdCBhdCBsZWFzdCBvbmUgc3VwcG9ydGVkIGZyZXF1ZW5jeSBpcworCSAqIHdpdGhpbiBwb2xpY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JMTMwLCAvKiAxMTEwIC0+IDEzLjB4ICovCisJNjUsICAvKiAxMTExIC0+ICA2LjV4ICovCit9OworCisvKgorICogVklBIEMzIEV6cmEKKyAqLworc3RhdGljIGludCBfX2luaXRkYXRhIGV6cmFfY2xvY2tfcmF0aW9bMTZdID0geworCTEwMCwgLyogMDAwMCAtPiAxMC4weCAqLworCTMwLCAgLyogMDAwMSAtPiAgMy4weCAqLworCTQwLCAgLyogMDAxMCAtPiAgNC4weCAqLworCTkwLCAgLyogMDAxMSAtPiAgOS4weCAqLworCTk1LCAgLyogMDEwMCAtPiAgOS41eCAqLworCTM1LCAgLyogMDEwMSAtPiAgMy41eCAqLworCTQ1LCAgLyogMDExMCAtPiAgNC41eCAqLworCTU1LCAgLyogMDExMSAtPiAgNS41eCAqLworCTYwLCAgLyogMTAwMCAtPiAgNi4weCAqLworCTcwLCAgLyogMTAwMSAtPiAgNy4weCAqLworCTgwLCAgLyogMTAxMCAtPiAgOC4weCAqLworCTUwLCAgLyogMTAxMSAtPiAgNS4weCAqLworCTY1LCAgLyogMTEwMCAtPiAgNi41eCAqLworCTc1LCAgLyogMTEwMSAtPiAgNy41eCAqLworCTg1LCAgLyogMTExMCAtPiAgOC41eCAqLworCTEyMCwgLyogMTExMSAtPiAxMi4weCAqLworfTsKKworc3RhdGljIGludCBfX2luaXRkYXRhIGV6cmFfZWJsY3JbMTZdID0geworCTUwLCAgLyogMDAwMCAtPiAgNS4weCAqLworCTMwLCAgLyogMDAwMSAtPiAgMy4weCAqLworCTQwLCAgLyogMDAxMCAtPiAgNC4weCAqLworCTEwMCwgLyogMDAxMSAtPiAxMC4weCAqLworCTU1LCAgLyogMDEwMCAtPiAgNS41eCAqLworCTM1LCAgLyogMDEwMSAtPiAgMy41eCAqLworCTQ1LCAgLyogMDExMCAtPiAgNC41eCAqLworCTk1LCAgLyogMDExMSAtPiAgOS41eCAqLworCTkwLCAgLyogMTAwMCAtPiAgOS4weCAqLworCTcwLCAgLyogMTAwMSAtP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kqLworCTEwNSwgLyogMDEwMCAtPiAxMC41eCAqLworCTExNSwgLyogMDEwMSAtPiAxMS41eCAqLworCTEyNSwgLyogMDExMCAtPiAxMi41eCAqLworCTEzNSwgLyogMDExMSAtPiAxMy41eCAqLworCTE0MCwgLyogMTAwMCAtPiAxNC4weCAqLworCTE1MCwgLyogMTAwMSAtPiAxNS4weCAqLworCTE2MCwgLyogMTAxMCAtPiAxNi4weCAqLworCTEzMCwgLyogMTAxMSAtPiAxMy4weCAqLworCTE0NSwgLyogMTEwMCAtPiAxNC41eCAqLworCTE1NSwgLyogMTEwMSAtPiAxNS41eCAqLworCS0xLCAgLyogMTExMCAtPiBSRVNFUlZFRCAoMTMuMHgpICovCisJLTEsICAvKiAxMTExIC0+IFJFU0VSVkVEICgxMi4weCkgKi8KK307CisKK3N0YXRpYyBpbnQgX19pbml0ZGF0YSBlenJhdF9lYmxjclszMl0gPSB7CisJNTAsICAvKiAwMDAwIC0+ICA1LjB4ICovCisJMzAsICAvKiAwMDAxIC0+ICAzLjB4ICovCisJNDAsICAvKiAwMDEwIC0+ICA0LjB4ICovCisJMTAwLCAvKiAwMDExIC0+IDEwLjB4ICovCisJNTUsICAvKiAwMTAwIC0+ICA1LjV4ICovCisJMzUsICAvKiAwMTAxIC0+ICAzLjV4ICovCisJNDUsICAvKiAwMTEwIC0+ICA0LjV4ICovCisJOTUsICAvKiAwMTExIC0+ICA5LjV4ICovCisJOTAsICAvKiAxMDAwIC0+ICA5LjB4ICovCisJNzAsICAvKiAxMDAxIC0+ICA3LjB4ICovCisJODAsICAvKiAxMDEwIC0+ICA4LjB4ICovCisJNjAsICAvKiAxMDExIC0+ICA2LjB4ICovCisJMTIwLCAvKiAxMTAwIC0+IDEyLjB4ICovCisJNzUsICAvKiAxMTAxIC0+ICA3LjV4ICovCisJODUsICAvKiAxMTEwIC0+ICA4LjV4ICovCisJNjUsICAvKiAxMTExIC0+ICA2LjV4ICovCisKKwktMSwgIC8qIDAwMDAgLT4gUkVTR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LT4gMTUuNXggKi8KKwktMSwgIC8qIDExMTAgLT4gUkVTRVJWRUQgKDEzLjB4KSAqLworCTEyMCwgLyogMTExMSAtPiAxMi4weCAqLworfTsKKworc3RhdGljIGludCBfX2luaXRkYXRhIG5laGVtaWFoX2FfZWJsY3JbMzJdID0geworCTUwLCAgLyogMDAwMCAtPiAgNS4weCAqLworCTE2MCwgLyogMDAwMSAtPiAxNi4weCAqLworCS0xLCAgLyogMDAxMCAtPiAgUkVTRVJWRUQgKi8KKwkxMDAsIC8qIDAwMTEgLT4gMTAuMHggKi8KKwk1NSwgIC8qIDAxMDAgLT4gIDUuNXggKi8KKwktMSwgIC8qIDAxMDEgLT4gIFJFU0VSVkVEICovCisJLTEsICAvKiAwMTEwIC0+ICBSRVNFUlZFRCAqLworCTk1LCAgLyogMDExMSAtPiAgOS41eCAqLworCTkwLCAgLyogMTAwMCAtPiAgOS4weCAqLworCTcwLCAgLyogMTAwMSAtPiAgNy4weCAqLworCTgwLCAgLyogMTAxMCAtPiAgOC4weCAqLworCTYwLCAgLyogMTAxMSAtPiAgNi4weCAqLworCTEyMCwgLyogMTEwMCAtPiAxMi4weCAqLworCTc1LCAgLyogMTEwMSAtPiAgNy41eCAqLworCTg1LCAgLyogMTExMCAtPiAgOC41eCAqLworCTY1LCAgLyogMTExMSAtPiAgNi41eCAqLworCTkwLCAgLyogMDAwMCAtPiAgOS4weCAqLworCS0xLCAgLyogMDAwMSAtPiBSRVNFUlZFRCAqLworCTEyMCwgLyogMDAxMCAtPiAxMi4weCAqLworCTEwMCwgLyogMDAxMSAtPiAxMC4weCAqLworCTEzNSwgLyogMDEwMCAtPiAxMy41eCAqLworCTExNSwgLyogMDEwMSAtPiAxMS41eCAqLworCTEyNSwgLyogMDExMCAtPiAxMi41eCAqLworCTEwNSwgLyogMDExMSAtPiAxMC41eCAqLworCTEzMCwgLyogMTAwMCAtPiAxMy4weCAqLworCTE1MCwgLyogMTAwMSAtPiAxNS4weCAqLworCTE2MCwgLyogM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lmIHRoZXNlIGJpdHMgYXJlIHNldCAqLworCisjZGVmaW5lIFNUT1BfR1JBTlRfNU5TIDEgLyogbWluIHBvc3MgbWVtb3J5IGFjY2VzcyBsYXRlbmN5IGZvciB2b2x0YWdlIGNoYW5nZSAqLworCisjZGVmaW5lIFBMTF9MT0NLX0NPTlZFUlNJT04gKDEwMDAvNSkgLyogbXMgdG8gbnMsIHRoZW4gZGl2aWRlIGJ5IGNsb2NrIHBlcmlvZCAqLworCisjZGVmaW5lIE1BWElNVU1fVklEX1NURVBTIDEgIC8qIEN1cnJlbnQgY3B1cyBvbmx5IGFsbG93IGEgc2luZ2xlIHN0ZXAgb2YgMjVtViAqLworI2RlZmluZSBWU1RfVU5JVFNfMjBVUyAyMCAgIC8qIFZvbHRhZ2UgU3RhYmFsaXphdGlvbiBUaW1lIGlzIGluIHVuaXRzIG9mIDIwdXMgKi8KKworLyoKKyAqIE1vc3QgdmFsdWVzIG9mIGludGVyZXN0IGFyZSBlbm9jb2RlZCBpbiBhIHNpbmdsZSBmaWVsZCBvZiB0aGUgX1BTUworICogZW50cmllczogdGhlICJjb250cm9sIiB2YWx1ZS4KKyAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAorI2RlZmluZSBJUlRfU0hJRlQgICAgICAzMAorI2RlZmluZSBSVk9fU0hJRlQgICAgICAyOAorI2RlZmluZSBQTExfTF9TSElGVCAgICAyMAorI2RlZmluZSBNVlNfU0hJRlQgICAgICAxOAorI2RlZmluZSBWU1RfU0hJRlQgICAgICAxMQorI2RlZmluZSBWSURfU0hJRlQgICAgICAgNgorI2RlZmluZSBJUlRfTUFTSyAgICAgICAgMworI2RlZmluZSBSVk9fTUFTSyAgICAgICAgMworI2RlZmluZSBQTExfTF9NQVNLICAgMHg3ZgorI2RlZmluZSBNVlNfTUFTSyAgICAgICAgMworI2RlZmluZSB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ZWVkc3RlcC1pY2guYwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi41YjdkMThhCi0tLSAvZGV2L251bGwKKysrIGIvYXJjaC9pMzg2L2tlcm5lbC9jcHUvY3B1ZnJlcS9zcGVlZHN0ZXAtaWNoLmMKQEAgLTAsMCArMSw0MjQgQEAKKy8qCisgKiAoQykgMjAwMSAgRGF2ZSBKb25lcywgQXJqYW4gdmFuIGRlIHZlbi4KKyAqIChDKSAyMDAyIC0gMjAwMyAgRG9taW5payBCcm9kb3dza2kgPGxpbnV4QGJyb2RvLmRlPgorICoKKyAqICBMaWNlbnNlZCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHUEwgTGljZW5zZSB2ZXJzaW9uIDIuCisgKiAgQmFzZWQgdXBvbiByZXZlcnNlIGVuZ2luZWVyZWQgaW5mb3JtYXRpb24sIGFuZCBvbiBJbnRlbCBkb2N1bWVudGF0aW9uCisgKiAgZm9yIGNoaXBzZXRzIElDSDItTSBhbmQgSUNIMy1NLgorICoKKyAqICBNYW55IHRoYW5rcyB0byBEdWNyb3QgQnJ1bm8gZm9yIGZpbmRpbmcgYW5kIGZpeGluZyB0aGUgbGFzdAorICogICJtaXNzaW5nIGxpbmsiIGZvciBJQ0gyLU0vSUNIMy1NIHN1cHBvcnQsIGFuZCB0byBUaG9tYXMgV2lua2xlcgorICogIGZvciBleHRlbnNpdmUgdGVzdGluZy4KKyAqCisgKiAgQklHIEZBVCBESVNDTEFJTUVSOiBXb3JrIGluIHByb2dyZXNzIGNvZGUuIFBvc3NpYmx5ICpkYW5nZXJvdXMqCisgKi8KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICAgICAgICAgICAgIFNQRUVEU1RFUCAtIERFRklOSVRJT05TICAgICAgICAgICAgICAgICAgICAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioq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worLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogICAgICAgICAgICAgICAgIERFVEVDVCBTUEVFRFNURVAtQ0FQQUJMRSBQUk9DRVNTT1IgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKwordW5zaWduZWQgaW50IHNwZWVkc3RlcF9kZXRlY3RfcHJvY2Vzc29yICh2b2lkKQoreworCXN0cnVjdCBjcHVpbmZvX3g4NiAqYyA9IGNwdV9kYXRhOworCXUzMgkJCWVieCwgbXNyX2xvLCBtc3JfaGk7CisKKwlkcHJpbnRrKCJ4ODY6ICV4LCBtb2RlbDogJXhcbiIsIGMtPng4NiwgYy0+eDg2X21vZGVsKTsKKworCWlmICgoYy0+eDg2X3ZlbmRvciAhPSBYODZfVkVORE9SX0lOVEVMKSB8fCAKKwkgICAgKChjLT54ODYgIT0gNikgJiYgKGMtPng4NiAhPSAweEYpKSkKKwkJcmV0dXJuIDA7CisKKwlpZiAoYy0+eDg2ID09IDB4RikgeworCQkvKiBJbnRlbCBNb2JpbGUgUGVudGl1bSA0LU0KKwkJICogb3IgSW50ZWwgTW9iaWxlIFBlbnRpdW0gNCB3aXRoIDUzMyBNSHogRlNCICovCisJCWlmIChjLT54ODZfbW9kZWwgIT0gMikKKwkJCXJldHVybiAwOworCisJCWVieCA9IGNwdWlkX2VieCgweDAwMDAwMDAxKTsKKwkJZWJ4ICY9IDB4MDAwMDAwRkY7CisKKwkJZHByaW50aygiZWJ4IHZhbHVlIGlzICV4LCB4ODZfbWFzayBpcyAleFxuIiwgZWJ4LCBjLT54ODZfbWFzayk7CisKKwkJc3dpdGNoIChjLT54ODZfbWFzaykgeworCQljYXNlIDQ6IAorCQkJLyoKKwkJCSAqIEItc3RlcHBpbmcgW00tUDQtTV0gCisJCQkgKiBzYW1wbGUgaGF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IFBJSUkgdmVyc2lvblxuIik7CisJCQkJcmV0dXJuIFNQRUVEU1RFUF9QUk9DRVNTT1JfUElJSV9DX0VBUkxZOworCQkJfSBlbHNlCisJCQkJcmV0dXJuIFNQRUVEU1RFUF9QUk9DRVNTT1JfUElJSV9DOworCQl9CisKKwlkZWZhdWx0OgorCQlyZXR1cm4gMDsKKwl9Cit9CitFWFBPUlRfU1lNQk9MX0dQTChzcGVlZHN0ZXBfZGV0ZWN0X3Byb2Nlc3Nvcik7CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogICAgICAgICAgICAgICAgICAgICBERVRFQ1QgU1BFRURTVEVQIFNQRUVEUyAgICAgICAgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKwordW5zaWduZWQgaW50IHNwZWVkc3RlcF9nZXRfZnJlcXModW5zaWduZWQgaW50IHByb2Nlc3NvciwKKwkJCQkgIHVuc2lnbmVkIGludCAqbG93X3NwZWVkLAorCQkJCSAgdW5zaWduZWQgaW50ICpoaWdoX3NwZWVkLAorCQkJCSAgdm9pZCAoKnNldF9zdGF0ZSkgKHVuc2lnbmVkIGludCBzdGF0ZSkpCit7CisJdW5zaWduZWQgaW50IHByZXZfc3BlZWQ7CisJdW5zaWduZWQgaW50IHJldCA9IDA7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKworCWlmICgoIXByb2Nlc3NvcikgfHwgKCFsb3dfc3BlZWQpIHx8ICghaGlnaF9zcGVlZCkgfHwgKCFzZXRfc3RhdGUpKQorCQlyZXR1cm4gLUVJTlZBTDsKKworCWRwcmludGsoInRyeWluZyB0byBkZXRlcm1pbmUgYm90aCBzcGVlZHNcbiIpOworCisJLyogZ2V0IGN1cnJlbnQgc3BlZWQgKi8KKwlwcmV2X3NwZWVkID0gc3BlZWRz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JvdGVjdGVkIEFSUjMuIEl0IHNpbGVudGx5IHNraXBzIEFSUjMKKyAgICAgICAgICAgICAgIGluIGN5cml4X2dldF9mcmVlX3JlZ2lvbigpIG9yIHJldHVybnMgd2l0aCBhbiBlcnJvciBjb2RlIGZyb20KKyAgICAgICAgICAgICAgIG10cnJfZGVsKCkuCisgICAgMTk5OTA3MTEgICBab2x04W4gQvZzevZybelueWkgPHpib3N6b3JAbWFpbC5leHRlcm5ldC5odT4KKyAgICAgICAgICAgICAgIFJlc2V0IHNvbWUgYml0cyBpbiB0aGUgQ0NScyBpbiBjeXJpeF9hcnJfaW5pdCgpIHRvIGRpc2FibGUgU01NCisgICAgICAgICAgICAgICBpZiBBUlIzIGlzbid0IHByb3RlY3RlZC4gVGhpcyBpcyBuZWVkZWQgYmVjYXVzZSBpZiBTTU0gaXMgYWN0aXZlCisgICAgICAgICAgICAgICBhbmQgQVJSMyBpc24ndCBwcm90ZWN0ZWQgdGhlbiBkZWxldGluZyBhbmQgc2V0dGluZyBBUlIzIGFnYWluCisgICAgICAgICAgICAgICBtYXkgbG9jayB1cCB0aGUgcHJvY2Vzc29yLiBXaXRoIFNNTSBlbnRpcmVseSBkaXNhYmxlZCwgaXQgZG9lcworICAgICAgICAgICAgICAgbm90IGhhcHBlbi4KKyAgICAxOTk5MDgxMiAgIFpvbHThbiBC9nN69nJt6W55aSA8emJvc3pvckBtYWlsLmV4dGVybmV0Lmh1PgorICAgICAgICAgICAgICAgUmVhcnJhbmdlIHN3aXRjaCgpIHN0YXRlbWVudHMgc28gdGhlIGRyaXZlciBhY2NvbW9kYXRlcyB0bworICAgICAgICAgICAgICAgdGhlIGZhY3QgdGhhdCB0aGUgQU1EIEF0aGxvbiBoYW5kbGVzIGl0cyBNVFJScyB0aGUgc2FtZSB3YXkKKyAgICAgICAgICAgICAgIGFzIEludGVsIGRvZXMuCisgICAgMTk5OTA4MTQgICBab2x04W4gQvZzevZybelueWkgPHpib3N6b3JAbWFpbC5leHRlcm5ld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sMCArMSwzNzQgQEAKKyNpbmNsdWRlIDxsaW51eC9pbml0Lmg+CisjaW5jbHVkZSA8bGludXgvcHJvY19mcy5oPgorI2luY2x1ZGUgPGxpbnV4L2N0eXBlLmg+CisjaW5jbHVkZSA8bGludXgvbW9kdWxlLmg+CisjaW5jbHVkZSA8bGludXgvc2VxX2ZpbGUuaD4KKyNpbmNsdWRlIDxhc20vdWFjY2Vzcy5oPgorCisjZGVmaW5lIExJTkVfU0laRSA4MAorCisjaW5jbHVkZSA8YXNtL210cnIuaD4KKyNpbmNsdWRlICJtdHJyLmgiCisKKy8qIFJFRC1QRU46IHRoaXMgaXMgYWNjZXNzZWQgd2l0aG91dCBhbnkgbG9ja2luZyAqLworZXh0ZXJuIHVuc2lnbmVkIGludCAqdXNhZ2VfdGFibGU7CisKKworI2RlZmluZSBGSUxFX0ZDT1VOVChmKSAoKChzdHJ1Y3Qgc2VxX2ZpbGUgKikoKGYpLT5wcml2YXRlX2RhdGEpKS0+cHJpdmF0ZSkKKworc3RhdGljIGNoYXIgKm10cnJfc3RyaW5nc1tNVFJSX05VTV9UWVBFU10gPQoreworICAgICJ1bmNhY2hhYmxlIiwgICAgICAgICAgICAgICAvKiAwICovCisgICAgIndyaXRlLWNvbWJpbmluZyIsICAgICAgICAgIC8qIDEgKi8KKyAgICAiPyIsICAgICAgICAgICAgICAgICAgICAgICAgLyogMiAqLworICAgICI/IiwgICAgICAgICAgICAgICAgICAgICAgICAvKiAzICovCisgICAgIndyaXRlLXRocm91Z2giLCAgICAgICAgICAgIC8qIDQgKi8KKyAgICAid3JpdGUtcHJvdGVjdCIsICAgICAgICAgICAgLyogNSAqLworICAgICJ3cml0ZS1iYWNrIiwgICAgICAgICAgICAgICAvKiA2ICovCit9OworCitjaGFyICptdHJyX2F0dHJpYl90b19zdHIoaW50IHgpCit7CisJcmV0dXJuICh4IDw9IDYpID8gbXRycl9zdHJpbmdzW3hdIDogIj8iOworfQorCisjaWZkZWYgQ09ORklHX1BST0NfRl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