ZGlmZiAtLWdpdCBhL2x5bnEvUjMwNkJSL2FwL2FwcC96dGVfY29tbS96dGVfbW1pL21taV93aWZpLmMgYi9seW5xL1IzMDZCUi9hcC9hcHAvenRlX2NvbW0venRlX21taS9tbWlfd2lmaS5jCm5ldyBmaWxlIG1vZGUgMTAwNzU1CmluZGV4IDAwMDAwMDAuLjdmMjZjMzAKLS0tIC9kZXYvbnVsbAorKysgYi9seW5xL1IzMDZCUi9hcC9hcHAvenRlX2NvbW0venRlX21taS9tbWlfd2lmaS5jCkBAIC0wLDAgKzEsODU3IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogILDmsb7L+dPQIChDKdbQ0MvNqNG2ucm33dPQz965q8u+CisqICDEo7/pw/sgICAgo7pNTUkKKyogIM7EvP7D+yAgICCjum1taV93aWZpLmMKKyogIM7EvP6x6sq2ICCjugorKiAgz+C52M7EvP4gIKO6CisqICDKtc/WuabE3CAgo7pNTUkgd2lmabXGstnX9worKiAg1/fV3yAgICAgIKO6CisqICCw5rG+ICAgICAgo7pWMS4wCisqICDN6rPJyNXG2iAgo7oyMDE0LTYtMjAKKyogIMbky/zLtcP3ICCjugorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNpbmNsdWRlIDxzeXMvaW5vdGlmeS5oPgorI2luY2x1ZGUgPGxpbWl0cy5oPgorI2luY2x1ZGUgIm1taV9jb21tb24uaCIKKyNpbmNsdWRlICJtbWlfbGNkLmgiCisjaW5jbHVkZSAid2xhbl9pbnRlcmZhY2UuaCIKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgyKu+1rHkwb+2qNLlCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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V9zdGF0ZSA9IHNfbW1pX3dpZmlkYXRhX3N0YXRlOworCQlwV2lmaUluZm8tPndwc19zdGF0ZSA9IHNfbW1pX3dwc1N0YXRlOworCQlwV2lmaUluZm8tPklzY29ubmVjdGVkX3VzZXIgPSBzX21taV9Jc2Nvbm5lY3RlZF91c2VyOworCQlwV2lmaUluZm8tPmNvbm5lY3RlZF91c2VyTnVtID0gc19tbWlfd2lmaV9jb25uZWN0X251bTsKKwl9CisJcmV0dXJuIE1NSV9TVUNDRVNTOworfQorCitTSU5UMzIgbW1pX2dldF93aWZpY29kZWluZm8oVUlOVDMyIHdpZmljb2RlaW5mbykKK3sKKwlpZiAod2lmaWNvZGVpbmZvICE9IDApIHsKKwkJVF96TU1JV2lmaUNvZGVJbmZvICogcFdpZmlDb2RlSW5mbyA9IChUX3pNTUlXaWZpQ29kZUluZm8gKil3aWZpY29kZWluZm87CisJCXBXaWZpQ29kZUluZm8tPm11bHRpX3NzaWRfc3dpdGNoID0gbW1pX2dldF9tdWx0aV9zc2lkX3N3aXRjaF9mbGFnKCk7CisJCXBXaWZpQ29kZUluZm8tPmlzX3dpZmljb2RlX2V4aXN0ID0gc19tbWlfcXJjb2RlX2V4aXN0OworCX0KKwlyZXR1cm4gTU1JX1NVQ0NFU1M7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzq78cihd2lmaVN0YXRpb27BrL3T17TMrAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitCT09MIG1taV9nZXRfd2lmaVN0YXRpb25Db25uZWN0X3N0YXRlKCkKK3sKKwlyZXR1cm4gc19tbWlfd2lmaVN0YXRpb25Db25uZWN0ZWQ7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzq78cihd2lmaVN0YXRpb27BrL3TuvPQxbrFx7+2yNDFz6IKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworU0lOVDMyIG1taV9nZXRfd2lmaVN0YXRpb25fc2lnbmFsTnVtKCkKK3sKKwlyZXR1cm4gc19tbWlfd2lmaXN0YXRpb25fc2lnbmFsX251bTsKK30KKworc3RhdGljIFZPSUQgbW1pX2dldF93aWZpU3RhdGlvbl9zc2lkX2Zyb21fbnYoKQoreworCWNmZ19nZXRfaXRlbShOVl9XSUZJU1RBX1NTSUQsIHNfbW1pX3dpZmlzdGF0aW9uX3NzaWQsIHNpemVvZihzX21taV93aWZpc3RhdGlvbl9zc2lkKSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzq78cihV2lmaVN0YXRpb27Qxc+ixKO/6QorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitTSU5UMzIgbW1pX2dldF93aWZpc3RhdGlvbmluZm8oVUlOVDMyIHdpZmlzdGF0aW9uaW5mbykKK3sKKwlpZiAod2lmaXN0YXRpb25pbmZvICE9IDApIHsKKwkJVF96TU1JV2lmaVN0YXRpb25JbmZvICogcFdpZmlTdGF0aW9uSW5mbyA9IChUX3pNTUlXaWZpU3RhdGlvbkluZm8gKil3aWZpc3RhdGlvbmluZm87CisJCXBXaWZpU3RhdGlvbkluZm8tPndpZmlzdGF0aW9uX2Nvbm5lY3Rfc3RhdGUgPSBtbWlfZ2V0X3dpZmlTdGF0aW9uQ29ubmVjdF9zdGF0ZSgpOworCQlwV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m4gTU1JX1NVQ0NFU1M7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzrXorLhV1BTzOHKvsSjv+kKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworU0lOVDMyIG1taV9SZWdpc3RlclRpcFdwc1Rhc2tJbmZvSXRlbSgpCit7CisJVF96TU1JVGFza0luZm9JdGVtIHdwc0luZm9JdGVtID0gezB9OworCXdwc0luZm9JdGVtLnRhc2sgPSBNTUlfVEFTS19USVBfV1BTOworCXdwc0luZm9JdGVtLnRhc2tpbmZvID0gKFZPSUQgKiltYWxsb2Moc2l6ZW9mKFRfek1NSVdpZmlJbmZvKSk7CisJd3BzSW5mb0l0ZW0uZ2V0X3Rhc2tpbmZvX2Z1biA9IG1taV9nZXRfd2lmaWluZm87CisjaWZuZGVmIERJU0FCTEVfTENECisJd3BzSW5mb0l0ZW0uZ2V0X2xjZGluZm9fZnVuID0gbW1pX2dldExjZFRpcFdwc0luZm87CisjZW5kaWYKKwkvL3dwc0luZm9JdGVtLnNob3dfbW9kZSA9IDI7CisJbW1pX3JlZ2lzdGVyX3Rhc2tpbmZvX2l0ZW0oJndwc0luZm9JdGVtKTsKKwlyZXR1cm4gTU1JX1NVQ0NFU1M7Cit9CisKK3N0YXRpYyBWT0lEIG1taV9zZXRfd2lmaV91cGRhdGUoKQoreworCWlmIChnX3Nob3dNb2RlID09IE1NSV9NT0RFX0xDRCB8fCBnX3Nob3dNb2RlID09IE1NSV9NT0RFX0FMTCkgeworCQltbWlfc2V0X3VwZGF0ZV9mbGFnKE1NSV9UQVNLX1dJRkkpOworCX0KKwlpZiAoZ19zaG93TW9kZSA9PSBNTUlfTU9ERV9MRUQgfHwgZ19zaG93TW9kZSA9PSBNTUlfTU9ERV9BTEwpIHsKKwkJRV96TW1pX1dvcmtfTW9kZSBtb2RlID0gbW1pX2dldF9sZWRfbW9kZSgpOworCQlpZiAobW9kZSAhPSBNTUlfSURMRV9MRURPRkZfTU9ERSAmJiBtb2RlICE9IE1NSV9JRExFX0NIR19MRURPRkZfTU9ERQorCQkgICAgJiYgbW9kZSAhPSBNTUlfRkFLRV9QT1dFUk9GRl9NT0RFICYmIG1vZGUgIT0gTU1JX0ZBS0VfUE9XRVJPRkZfQ0hBUkdFX01PREUgJiYgbW9kZSAhPSBNTUlfSURMRV9TVEFOREJZX0xFRE9GRl9NT0RFKSB7CisJCQltbWlfc2V0X3VwZGF0ZV9mbGFnKE1NSV9UQVNLX1dJRkkpOworCQl9CisJfQorfQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAguq/K/df308M6yse38c/Uyr53aWZpILb+zqzC6worKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitWT0lEIG1taV9zZXRfd2lmaWNvZGVfc2hvd19mbGFnKEJPT0wgZmxhZykKK3sKKwlnX3dpZmlfY29kZV9zaG93X2ZsYWcgPSBmbGFnOworfQorCitCT09MIG1taV9nZXRfd2lmaWNvZGVfc2hvd19mbGFnKFZPSUQpCit7CisJcmV0dXJuIGdfd2lmaV9jb2RlX3Nob3dfZmxhZzsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrvxyKF3aWZpL3dwc9e0zKwKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworQk9PTCBtbWlfZ2V0X3dpZmlfc3RhdGUoKQoreworCXJldHVybiBzX21taV93aWZpU3RhdGU7Cit9CisKK0Vfek1taV9XcHNBY3RfVGlwIG1taV9nZXRfd3BzX3N0YXRlKCkKK3sKKwlyZXR1cm4gc19tbWlfd3BzU3RhdGU7Cit9CisKK3ZvaWQgbW1pX21zX3NsZWVwKHVuc2lnbmVkIGxvbmcgbVNlYykKK3sKKworCXN0cnVjdCB0aW1ldmFsIHR2OworCXR2LnR2X3NlYyA9IG1TZWMgLyAxMDAwOworCXR2LnR2X3VzZWMgPSAobVNlYyAlIDEwMDApICogMTAwMDsKKwlpbnQgZXJyOworCWRvIHsKKwkJZXJyID0gc2VsZWN0KDAsIE5VTEwsIE5VTEwsIE5VTEwsICZ0dik7CisJfSB3aGlsZSAoZXJyIDwgMCAmJiBlcnJubyA9PSBFSU5UUik7CisKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgICC6r8r91/fTwzpXSUZJv6q52AorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitWT0lEIG1taV93aWZpX29wZXJhdGUoY2hhciogbW9kZSkKK3sKKwljaGFyIHdpZmlfbW9kZVsyXSA9IHswfTsKKwljZmdfZ2V0X2l0ZW0oV0xBTl9OVl9DVVJfU1RBVEUsIHdpZmlfbW9kZSwgMik7CisJc2xvZyhNTUlfUFJJTlQsIFNMT0dfTk9STUFMLCAiWlRFX01NSSBoYW5kbGVfd2lmaV9vcHQgbW9kZSA9ICVzIFJhZGlvT2ZmPSVzXG4iLCBtb2RlLCB3aWZpX21vZGUpOworCWlmICghc3RyY21wKG1vZGUsIFdJRklfVFVSTl9PRkZfRkFLRV9QT1dFUk9GRikpIHsKKwkJaWYgKGdfbW1pX2tleV9sb25ncHJlc3NfZmxhZykgeworCQkJZ19tbWlf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GVsc2UgeworCQlpZiAoc3RyY21wKHdpZmlfbW9kZSwgbW9kZSkpIHsKKwkJCWlmIChzdHJjbXAod2lmaV9tb2RlLCBXSUZJX09QRU5FRCkgPT0gMCkgeworCQkJCXNsb2coTU1JX1BSSU5ULCBTTE9HX05PUk1BTCwgIlpURV9NTUkgaGFuZGxlX3dpZmlfb3B0IG1vZGUgY2xvc2Ugd2lmaVxuIik7CisJCQkJaXBjX3NlbmRfbWVzc2FnZShNT0RVTEVfSURfTU1JLCBNT0RVTEVfSURfV0lGSSwgKFVTSE9SVClNU0dfQ01EX1dJRklfQ0xPU0UsIE5VTEwsIE5VTEwsIDApOyAvL8/yV0lGSbeiy8252LHVz/vPogorCQkJfSBlbHNlIGlmIChzdHJjbXAod2lmaV9tb2RlLCBXSUZJX0NMT1NFRCkgPT0gMCkgeworCQkJCXNsb2coTU1JX1BSSU5ULCBTTE9HX05PUk1BTCwgIlpURV9NTUkgaGFuZGxlX3dpZmlfb3B0IG1vZGUgb3BlbiB3aWZpXG4iKTsKKwkJCQlpcGNfc2VuZF9tZXNzYWdlKE1PRFVMRV9JRF9NTUksIE1PRFVMRV9JRF9XSUZJLCAoVVNIT1JUKU1TR19DTURfV0lGSV9PUEVOLCBOVUxMLCBOVUxMLCAwKTsgLy/P8ldJRkm3osvNu73Q0c/7z6IKKwkJCX0KKwkJfQorCX0KK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOndwc7yku+678silvKS77rPJuaa688/Uyr4yw+u2qMqxxvcKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIFZPSUQgKiBtbWlfd3BzX3RpcF9jaGVja190aW1lcl9jYihWT0lEICphcmcpCit7CisJc19tbWlfd3BzU3RhdGUgPSBXUFNf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pZiAoMCA9PSBsUmV0KSB7CisJCQlzbG9nKE1NSV9QUklOVCwgU0xPR19OT1JNQUwsICJaVEVfTU1JIG1taV93cHNfb3BlcmF0ZSBzZW5kIHRvIHdpZmkgb2sgXG4iKTsKKwkJCS8vc2VuZF9yc3Bfc3RyX3RvX2ZhcnBzKE1PRFVMRV9JRF9NTUksICJcclxuK1RLRVlFVkVOVDogd3BzIGFjdGl2ZWRcclxuIiwgc3RybGVuKCJcclxuK1RLRVlFVkVOVDogd3BzIGFjdGl2ZWRcclxuIikpOworCQkJaXBjX3NlbmRfbWVzc2FnZShNT0RVTEVfSURfTU1JLCBNT0RVTEVfSURfQVRfQ1RMLCBNU0dfQ01EX1NFTkRfUlNQX1RPX09VVFNJREUsIHN0cmxlbigiXHJcbitUS0VZRVZFTlQ6IHdwcyBhY3RpdmVkXHJcbiIpLCAiXHJcbitUS0VZRVZFTlQ6IHdwcyBhY3RpdmVkXHJcbiIsIDApOworCQl9CisJfQorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6zai5/W52u/HIodb3oaK4sVNTSUS1xHdpZmnTw7unway908r9CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBWT0lEIG1taV9nZXRfd2lmaV9zdGFudW0oVk9JRCkKK3sKKwljaGFyIHZhMF93aWZpX251bVs4XSA9IHswfTsKKwljaGFyIHZhMV93aWZpX251bVs4XSA9IHswfTsKKwlTSU5UMzIgd2lmaV9udW0gPSAwOworCVNJTlQzMiBtX3dpZmlfbnVtID0gMDsKKwljZmdfZ2V0X2l0ZW0oV0xBTl9OVl9WQTBfV0lJRl9OVU0sIHZhMF93aWZpX251bSwgc2l6ZW9mKHZhMF93aWZpX251bSkpOworCWNmZ19nZXRfaXRlbShXTEFOX05WX1ZBMV9XSUlGX05VTSwgdmExX3dpZmlfbnVtLCBzaXplb2YodmExX3dpZmlfbnVtKSk7CisJd2lmaV9udW0gPSBhdG9pKHZhMF93aWZpX251bSk7CisJbV93aWZpX251bSA9IGF0b2kodmExX3dpZmlfbnVtKTsKKwlpZiAoKHdpZmlfbnVtIDwgMCB8fCB3aWZpX251bSA+IElOVF9NQVgtMSkgfHwKKwkJKG1fd2lmaV9udW0gPCAwIHx8IG1fd2lmaV9udW0gPiBJTlRfTUFYLTEpKXsvL2t3IDMsIDB+MzI/CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX2dldF93aWZpX3N0YW51bSB3aWZpX251bSA9ICVkLCBtX3dpZmlfbnVtID0gJWRcbiIsIHdpZmlfbnVtLCBtX3dpZmlfbnVtKTsKKwkJcmV0dXJuOworCX0KKwlzX21taV93aWZpX2Nvbm5lY3RfbnVtID0gd2lmaV9udW0gKyBtX3dpZmlfbnVtOworCXNsb2coTU1JX1BSSU5ULCBTTE9HX0RFQlVHLCAiWlRFX01NSSBtbWlfZ2V0X3dpZmlfc3RhbnVtIHdpZmlfbnVtID0gJWQsbV93aWZpX251bSA9ICVkLCBzX21taV93aWZpX2Nvbm5lY3RfbnVtID0gJWQgXG4iLCB3aWZpX251bSwgbV93aWZpX251bSwgc19tbWlfd2lmaV9jb25uZWN0X251bSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzqy6dGvd2lmaSDBrL3Tyv22qMqxxve72LX3CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK1NJTlQzMiB6TU1JX0hhbmRsZV9Nc2dfR2V0X1dpZmlfU3RhTnVtKFZPSUQgKmRhdGEpCit7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93aWZpX3VwZGF0ZSgpOworI2VuZGlmCisJfQorCS8vI2VuZGlmCisJcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBWT0lEICogbW1pX3dpZmlfc3RhbnVtX3RpbWVyX2NiKFZPSUQgKmFyZykKK3sKKwlpZiAoc19tbWlfd2lmaVN0YXRlKSB7CisJCWlwY19zZW5kX21lc3NhZ2UoTU9EVUxFX0lEX01NSSwgTU9EVUxFX0lEX01NSSwgKFVTSE9SVClNU0dfQ01EX01NSUdFVF9XSUZJX1NUQU5VTSwgMCwgTlVMTCwgMCk7CisJfQorCXJldHVybiBOVUxMOworfQorCisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrLp0a93aWZpIMGsvdPK/baoyrHG9yAzUworKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgVk9JRCBtbWlfd2lmaV9zdGFudW1fdGltZXJfY3JlYXRlKFZPSUQpCit7CisJaW50IHJldCA9IC0xOworCXJldCA9IENyZWF0ZVNvZnRUaW1lcihTRVRfV0lGSV9TVEFOVU1fQ0hFQ0tfVElNRVIsIFRJTUVSX0ZMQUdfUkVTVEFSVCwgU0VUX1dJRklfU1RBTlVNX0NIRUNLX1RJTUUsICZtbWlfd2lmaV9zdGFudW1fdGltZXJfY2IsIE5VTEwpOworCWlmIChyZXQgIT0gMCkgeworCQlzbG9nKE1NSV9QUklOVCwgU0xPR19FUlIsICJaVEVfTU1JIG1taV93aWZpX3N0YW51bV90aW1lcl9jcmVhdGUgRkFJTEVEXG4iKTsKKwl9Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzqy6d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l9CisJcmV0dXJuIE5VTEw7Cit9CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrLp0a93aWZpIMrHt/HT0Mr9vt20q8rktqjKscb3IDNTCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBWT0lEIG1taV93aWZpX2RhdGFfdGltZXJfY3JlYXRlKFZPSUQpCit7CisJaW50IHJldCA9IC0xOworCXJldCA9IENyZWF0ZVNvZnRUaW1lcihTRVRfV0lGSV9EQVRBX0NIRUNLX1RJTUVSLCBUSU1FUl9GTEFHX1JFU1RBUlQsIFNFVF9XSUZJX0RBVEFfQ0hFQ0tfVElNRSwgJm1taV93aWZpX2RhdGFfdGltZXJfY2IsIE5VTEwpOworCWlmIChyZXQgIT0gMCkgeworCQlzbG9nKE1NSV9QUklOVCwgU0xPR19FUlIsICJaVEVfTU1JIG1taV93aWZpX2RhdGFfdGltZXJfY3JlYXRlIEZBSUxFRFxuIik7CisJfQorfQorCitzdGF0aWMgVk9JRCBtbWlfd2lmaV9kYXRhX3RpbWVyX3N0b3AoVk9JRCkKK3sKKwlEZWxldGVTb2Z0VGltZXIoU0VUX1dJRklfREFUQV9DSEVDS19USU1FUik7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzq2/s6swuvKx7fxtObU2te0zKzJ6NbDCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK1NJTlQzMiBtbWlfc2V0X3FyY29kZV9zdGF0ZSgpCit7CisJY2hhciBidWZfcXJjb2R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wkJbW1pX3NldF91cGRhdGVfZmxhZyhNTUlfVEFTS19XSUZJQ09ERSk7CisJfQorCisJc19tbWlfcXJjb2RlX2V4aXN0UHJlID0gc19tbWlfcXJjb2RlX2V4aXN0OworCXJldHVybiAwOworfQorCitCT09MIG1taV9nZXRfcXJjb2RlX3N0YXRlKCkKK3sKKwlyZXR1cm4gc19tbWlfcXJjb2RlX2V4aXN0IDsKK30KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzp3aWZpv6rG9Fy52LHV17TMrMno1sMKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworVk9JRCBtbWlfc2V0X3dpZmlfc3RhdGUoVk9JRCkKK3sKKwljaGFyIGJ1Zl93aWZpWzhdID0gezB9OworCUZJTEUqIGZkX3dpZmkgPSBOVUxMOworCWludCBsZW4gPSAwOworCisJZmRfd2lmaSA9IGZvcGVuKFdJRklfU1RBVEVfUEFUSCwgInIiKTsKKwlpZiAoZmRfd2lmaSA9PSBOVUxMKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX3NldF93aWZpX3N0YXRlIG9wZW4gd2lmaSBmaWxlIGZhaWwhXG4iKTsKKwkJcGVycm9yKFdJRklfU1RBVEVfUEFUSCk7CisJCXJldHVybjsKKwl9CisJbGVuID0gZnJlYWQoYnVmX3dpZmksIDEsIDEsIGZkX3dpZmkpOworCWlmIChsZW4gPiAwKSB7IC8va3cgMworCQlidWZfd2lmaVtsZW5dID0gJ1wwJzsKKwkJaWYgKHN0cmNtcChidWZfd2lmaSwgIjEiKSA9PSAwKSB7CisJCQlzX21taV93aWZpU3RhdGUgPSBUUlVFOworCQkJaXBjX3NlbmRfbWVzc2FnZShNT0RVTEVfSURfTU1JLCBNT0RVTEVfSURfTU1JLCAoVVNIT1JUKU1TR19DTURfU1RBX0NPVU5UX0NIQU5HRSwgMCwgTlVMTCwgMCk7CisJCX0gZWxzZSBpZiAoc3RyY21wKGJ1Zl93aWZpLCAiMCIpID09IDApIHsKKwkJCXNfbW1pX3dpZmlTdGF0ZSA9IEZBTFNFOworCQkJc19tbWlfd3BzU3RhdGUgPSBXUFNfQUNUSVZFX01BWDsKKwkJCXNfbW1pX0lzY29ubmVjdGVkX3VzZXIgPSAwOworCQkJc19tbWlfd2lmaV9jb25uZWN0X251bSA9IDA7CisJCQkvLyNpZiBNTUlfTEVEX1NUQU5EQllfTU9ERQorCQkJaWYgKGdfbGVkX3N0YW5kYnlfbW9kZSAmJiBtbWlfZ2V0X2xlZF9tb2RlKCkgPT0gTU1JX0lETEVfTEVET0ZGX01PREUpIHsKKwkJCQltbWlfc2V0X2xlZF9tb2RlKE1NSV9JRExFX1NUQU5EQllfTEVET0ZGX01PREUpOworCQkJCW1taV9zZXRfdXBkYXRlX2ZsYWcoTU1JX1RBU0tfQ1RSTCk7CisJCQl9CisJCQkvLyNlbmRpZgorCQl9IGVsc2UgeworCQkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSB3aWZpIGZpbGUgc3RhdGUgZXJyb3IhXG4iKTsKKwkJfQorCX0gZWxzZSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgcmVhZCB3aWZpIGZpbGUgZmFpbCFcbiIpOworCX0KKworCWZjbG9zZShmZF93aWZpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOndwc7+qxvRcudix1de0zKzJ6NbDCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi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Rfd3BzID0gTlVMTDsKKwlpbnQgbGVuID0gMDsKKworCWZkX3dwcyA9IGZvcGVuKFdQU19TVEFURUVYX1BBVEgsICJyIik7CisJaWYgKGZkX3dwcyA9PSBOVUxMKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX3NldF93aWZpX3N0YXRlIG9wZW4gd3BzRVggZmlsZSBmYWlsIVxuIik7CisJCXBlcnJvcihXUFNfU1RBVEVFWF9QQVRIKTsKKwkJcmV0dXJuOworCX0KKwlsZW4gPSBmcmVhZChidWZfd3BzLCAxLCAxLCBmZF93cHMpOworCWlmIChsZW4gPiAwKSB7IC8va3cgMworCQlidWZfd3BzW2xlbl0gPSAnXDAnOworCQlpZiAoc3RyY21wKGJ1Zl93cHMsICIxIikgPT0gMCkgeworCQkJc19tbWlfd3BzU3RhdGUgPSBXUFNfQUNUSVZFRDsKKwkJCW1taV93cHNfdGlwX3RpbWVyX3N0YXJ0KCk7CisJCX0gZWxzZSBpZiAoc3RyY21wKGJ1Zl93cHMsICIyIikgPT0gMCkgeworCQkJc19tbWlfd3BzU3RhdGUgPSBXUFNfREVBQ1RJVklORzsKKwkJfSBlbHNlIHsKKwkJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgIHdwcyBmaWxlIHN0YXRlIGVycm9yIVxuIik7CisJCX0KKwl9IGVsc2UgeworCQlzbG9nKE1NSV9QUklOVCwgU0xPR19FUlIsICJaVEVfTU1JIHJlYWQgd3BzIGZpbGUgZmFpbCFcbiIpOworCX0KKworCWZjbG9zZShmZF93cHMpOworfQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOndpZmlTdGF0aW9uv6rG9Fy52LHV17TMrMno1sMKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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gMzsKKwkJCX0gZWxzZSBpZiAoc3RyY21wKGJ1Zl93aWZpU3RhdGlvbiwgIjIiKSA9PSAwKSB7CisJCQkJc19tbWlfd2lmaXN0YXRpb25fc2lnbmFsX251bSA9IDI7CisJCQl9IGVsc2UgaWYgKHN0cmNtcChidWZfd2lmaVN0YXRpb24sICIxIikgPT0gMCkgeyAvL2NvdiBtCisJCQkJc19tbWlfd2lmaXN0YXRpb25fc2lnbmFsX251bSA9IDE7CisJCQl9IGVsc2UgaWYgKHN0cmNtcChidWZfd2lmaVN0YXRpb24sICIwIikgPT0gMCkgeworCQkJCXNfbW1pX3dpZmlzdGF0aW9uX3NpZ25hbF9udW0gPSAwOworCQkJfSBlbHNlIHsKKwkJCQlzbG9nKE1NSV9QUklOVCwgU0xPR19FUlIsICJaVEVfTU1JICB3aWZpU3RhdGlvbiBmaWxlIHN0YXRlIGVycm9yIVxuIik7CisJCQl9CisJCX0KKwl9IGVsc2UgeworCQlzbG9nKE1NSV9QUklOVCwgU0xPR19FUlIsICJaVEVfTU1JIHJlYWQgd2lmaVN0YXRpb24gZmlsZSBmYWlsIVxuIik7CisJfQorCWZjbG9zZShmZF93aWZpU3RhdGlvbik7Cit9CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOndpZmnWuMq+tcbP37PMyOu/2rqvyv0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgbW1pX3dpZml3cHNfZmlsZV9vcGVyYXRlKGNoYXIgKmZpbGVuYW1lKQoreworCWlmIChmaWxlbmFtZSA9PSBOVUxMKSB7CisJCXJldHVybjsKKwl9CisJaWYgKHN0cmNtcChmaWxlbmFtZSwgV0lGSV9TVEFURV9QQVRIKSA9PSAwKSB7CisJCW1taV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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6Y3JlYXRlIM/fs8y87LLid2lmac7EvP6x5LuvCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBWT0lEIG1taV9jcmVhdGVfd2lmaV9pbm90aWZ5X3RocmVhZChWT0lEKQoreworCXB0aHJlYWRfdCBtbWlfd2lmaV90aHJlYWQ7CisJaWYgKHB0aHJlYWRfY3JlYXRlKCZtbWlfd2lmaV90aHJlYWQsIE5VTEwsICZtbWlfd2lmaV90aHJlYWRfZnVuY3Rpb24sIE5VTEwpID09IC0xKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgY3JlYXRlIHdpZmkgdGhyZWFkIGVycm9yIVxuIik7CisJCU1NSV9BU1NFUlQoMCk7CisJfQorCXNsb2coTU1JX1BSSU5ULCBTTE9HX0RFQlVHLCAiWlRFX01NSSBjcmVhdGUgd2lmaV90aHJlYWQgc3VjY2VzcyEhIVxuIik7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzpNTUkgd2lmacr9vt20q8rk0a27t7zssuK2qMqxxvdLSUxMo6wgILnYu/q6zdbYxvTKsbX308MKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworVk9JRCBtbWlfa2lsbF93aWZpX2RhdGFfdGltZXIoVk9JRCkKK3sKKwlpZiAoZ19zaG93TW9kZSA9PSBNTUlfTU9ERV9MRUQgfHwgZ19zaG93TW9kZSA9PSBNTUlfTU9ERV9BTEwpIHsKKwkJbW1pX3dpZmlfZGF0YV90aW1lcl9zdG9wKCk7CisJfQorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6d2lmada4yr61xrP1yry7r6OsIMno1sO72LX3uq/K/QorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitWT0lEIG1taV93aWZpX2luaXQoVk9JRCkKK3sKKwltbWlfc2V0X3dpZmlfc3RhdGUoKTsKKwltbWlfc2V0X3dpZmlfdXBkYXRlKCk7CisJbW1pX3NldF9xcmNvZGVfc3RhdGUoKTsKKwltbWlfY3JlYXRlX3dpZmlfaW5vdGlmeV90aHJlYWQoKTsKKwltbWlfd2lmaV9kYXRhX3RpbWVyX2NyZWF0ZSgpOworCWlmIChnX3VzZV93aWZpX3VzZXJudW0pIHsKKwkJbW1pX2dldF93aWZpX3N0YW51bSgpOworCX0KK30KKwpkaWZmIC0tZ2l0IGEvbHlucS9SMzA2X01UTi9hcC9hcHAvenRlX2NvbW0venRlX21taS9tbWlfd2lmaS5jIGIvbHlucS9SMzA2X01UTi9hcC9hcHAvenRlX2NvbW0venRlX21taS9tbWlfd2lmaS5jCm5ldyBmaWxlIG1vZGUgMTAwNzU1CmluZGV4IDAwMDAwMDAuLjdmMjZjMzAKLS0tIC9kZXYvbnVsbAorKysgYi9seW5xL1IzMDZfTVROL2FwL2FwcC96dGVfY29tbS96dGVfbW1pL21taV93aWZpLmMKQEAgLTAsMCArMSw4NTcgQEAKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgsOaxvsv509AgKEMp1tDQy82o0ba5ybfd09DP3rmry74KKyogIMSjv+nD+yAgICCjuk1NSQorKiAgzsS8/sP7ICAgIKO6bW1pX3dpZmkuYworKiAgzsS8/rHqyrYgIKO6CisqICDP4LnYzsS8/iAgo7oKKyogIMq1z9a5psTcICCjuk1NSSB3aWZptcay2df3CisqICDX99XfICAgICAgo7oKKyogILDmsb4gICAgICCjulYxLjAKKyogIM3qs8nI1cbaICCjujIwMTQtNi0yMAorKiAgxuTL/Mu1w/cgIKO6CisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2luY2x1ZGUgPHN5cy9pbm90aWZ5Lmg+CisjaW5jbHVkZSA8bGltaXRzLmg+CisjaW5jbHVkZSAibW1pX2NvbW1vbi5oIgorI2luY2x1ZGUgIm1taV9sY2QuaCIKKyNpbmNsdWRlICJ3bGFuX2ludGVyZmFjZS5oIgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyDIq77WseTBv7ao0uUKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBCT09MIHNfbW1pX3dpZmlTdGF0ZSA9IEZBTFNFOy8vtNO84L/YzsS8/tbQu/HIobXEd2lmade0zKwKK3N0YXRpYyBCT09MIHNfbW1pX3dpZmlkYXRhX3N0YXRlID0gRkFMU0U7Ly/F0LbPbGFuv9rKx7fx09DK/b7dtKvK5Aorc3RhdGljIEVfek1taV9XcHNBY3RfVGlwIHNfbW1pX3dwc1N0YXRlID0gV1BTX0FDVElWRV9NQVg7Ly+007zgv9jOxLz+1tC78cihtcR3cHPXtMysCitzdGF0aWMgQk9PTCBnX3dwc19zd2l0Y2hfc3NpZF9zaG93ID0gVFJVRTsKK3N0YXRpYyBCT09MIGdfd2lmaV9jb2RlX3Nob3dfZmxhZyA9IEZBTFNFOy8vseq8x3dpZmm2/s6swuvKx7fxtObU2gorc3RhdGljIFNJTlQzMiBzX21ta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9zd2l0Y2ggPSBtbWlfZ2V0X211bHRpX3NzaWRfc3dpdGNoX2ZsYWcoKTsKKwkJcFdpZmlDb2RlSW5mby0+aXNfd2lmaWNvZGVfZXhpc3QgPSBzX21taV9xcmNvZGVfZXhpc3Q7CisJfQorCXJldHVybiBNTUlfU1VDQ0VTUzsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrvxyKF3aWZpU3RhdGlvbsGsvdPXtMysCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK0JPT0wgbW1pX2dldF93aWZpU3RhdGlvbkNvbm5lY3Rfc3RhdGUoKQoreworCXJldHVybiBzX21taV93aWZpU3RhdGlvbkNvbm5lY3RlZDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrvxyKF3aWZpU3RhdGlvbsGsvdO689DFusXHv7bI0MXPogorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitTSU5UMzIgbW1pX2dldF93aWZpU3RhdGlvbl9zaWduYWxOdW0oKQoreworCXJldHVybiBzX21taV93aWZpc3RhdGlvbl9zaWduYWxfbnVtOworfQorCitzdGF0aWMgVk9JRCBtbWlfZ2V0X3dpZmlTdGF0aW9uX3NzaWRfZnJvbV9udigpCit7CisJY2ZnX2dldF9pdGVtKE5WX1dJRklTVEFfU1NJRCwgc19tbWlfd2lmaXN0YXRpb25fc3NpZCwgc2l6ZW9mKHNfbW1pX3dpZmlzdGF0aW9uX3NzaWQpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrvxyKFXaWZpU3RhdGlvbtDFz6LEo7/pCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK1NJTlQzMiBtbWlfZ2V0X3dpZmlzdGF0aW9uaW5mbyhVSU5UMzIgd2lmaXN0YXRpb25pbmZvKQoreworCWlmICh3aWZpc3RhdGlvbmluZm8gIT0gMCkgeworCQlUX3pNTUlXaWZpU3RhdGlvbkluZm8gKiBwV2lmaVN0YXRpb25JbmZvID0gKFRfek1NSVdpZmlTdGF0aW9uSW5mbyAqKXdpZmlzdGF0aW9uaW5mbzsKKwkJcFdpZmlTdGF0aW9uSW5mby0+d2lmaXN0YXRpb25fY29ubmVjdF9zdGF0ZSA9IG1taV9nZXRfd2lmaVN0YXRpb25Db25uZWN0X3N0YXRlKCk7CisJCXBXaWZpU3RhdGlvbkluZm8tPnNpZ25hbF9udW0gPSBtbWlfZ2V0X3dpZmlTdGF0aW9uX3NpZ25hbE51bSgpOworCQlwV2lmaVN0YXRpb25JbmZvLT53aWZpc3RhX3NzaWQgPSBzX21taV93aWZpc3RhdGlvbl9zc2lkOworCX0KKwlyZXR1cm4gTU1JX1NVQ0NFU1M7Cit9CisKKworU0lOVDMyIG1taV9SZWdpc3RlcldpZmlUYXNrSW5mb0l0ZW0oKQoreworCVRfek1NSVRhc2tJbmZvSXRlbSB3aWZpSW5mb0l0ZW0gPSB7MH07CisJd2lmaUluZm9JdGVtLnRhc2sgPSBNTUlfVEFTS19XSUZJOworCXdpZmlJbmZvSXRlbS50YXNraW5mbyA9IChWT0lEICopbWFsbG9jKHNpemVvZihUX3pNTUlXaWZpSW5mbykpOworCXdpZmlJbmZvSXRlbS5nZXRfdGFza2luZm9fZnVuID0gbW1pX2dldF93aWZpaW5mbzsKKyNpZm5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uSW5mb0l0ZW0gPSB7MH07CisJd2lmaVN0YXRpb25JbmZvSXRlbS50YXNrID0gTU1JX1RBU0tfVElQX1dJRklTVEFUSU9OOworCXdpZmlTdGF0aW9uSW5mb0l0ZW0udGFza2luZm8gPSAoVk9JRCAqKW1hbGxvYyhzaXplb2YoVF96TU1JV2lmaVN0YXRpb25JbmZvKSk7CisJd2lmaVN0YXRpb25JbmZvSXRlbS5nZXRfdGFza2luZm9fZnVuID0gbW1pX2dldF93aWZpc3RhdGlvbmluZm87CisjaWZuZGVmIERJU0FCTEVfTENECisJd2lmaVN0YXRpb25JbmZvSXRlbS5nZXRfbGNkaW5mb19mdW4gPSBtbWlfZ2V0TGNkV2lmaVN0YXRpb25JbmZvOworI2VuZGlmCisJLy93aWZpU3RhdGlvbkluZm9JdGVtLnNob3dfbW9kZSA9IDI7CisJbW1pX3JlZ2lzdGVyX3Rhc2tpbmZvX2l0ZW0oJndpZmlTdGF0aW9uSW5mb0l0ZW0pOworCXJldHVybiBNTUlfU1VDQ0VTUzsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOteisuFXUFPM4cq+xKO/6QorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitTSU5UMzIgbW1pX1JlZ2lzdGVyVGlwV3BzVGFza0luZm9JdGVtKCkKK3sKKwlUX3pNTUlUYXNrSW5mb0l0ZW0gd3BzSW5mb0l0ZW0gPSB7MH07CisJd3BzSW5mb0l0ZW0udGFzayA9IE1NSV9UQVNLX1RJUF9XUFM7CisJd3BzSW5mb0l0ZW0udGFza2luZm8gPSAoVk9JRCAqKW1hbGxvYyhzaXplb2YoVF96TU1JV2lmaUluZm8pKTsKKwl3cHNJbmZvSXRlbS5nZXRfdGFza2luZm9fZnVuID0gb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rMLrCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK1ZPSUQgbW1pX3NldF93aWZpY29kZV9zaG93X2ZsYWcoQk9PTCBmbGFnKQoreworCWdfd2lmaV9jb2RlX3Nob3dfZmxhZyA9IGZsYWc7Cit9CisKK0JPT0wgbW1pX2dldF93aWZpY29kZV9zaG93X2ZsYWcoVk9JRCkKK3sKKwlyZXR1cm4gZ193aWZpX2NvZGVfc2hvd19mbGFnOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6u/HIoXdpZmkvd3Bz17TMrAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitCT09MIG1taV9nZXRfd2lmaV9zdGF0ZSgpCit7CisJcmV0dXJuIHNfbW1pX3dpZmlTdGF0ZTsKK30KKworRV96TW1pX1dwc0FjdF9UaXAgbW1pX2dldF93cHNfc3RhdGUoKQoreworCXJldHVybiBzX21taV93cHNTdGF0ZTsKK30KKwordm9pZCBtbWlfbXNfc2xlZXAodW5zaWduZWQgbG9uZyBtU2VjKQoreworCisJc3RydWN0IHRpbWV2YWwgdHY7CisJdHYudHZfc2VjID0gbVNlYyAvIDEwMDA7CisJdHYudHZfdXNlYyA9IChtU2VjICUgMTAwMCkgKiAxMDAwOworCWludCBlcnI7CisJZG8geworCQllcnIgPSBzZWxlY3QoMCwgTlVMTCwgTlVMTCwgTlVMTCwgJnR2KTsKKwl9IHdoaWxlIChlcnIgPCAwICYmIGVycm5vID09IEVJTlRSKTsKKworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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lcbiIpOworCQkJCWlwY19zZW5kX21lc3NhZ2UoTU9EVUxFX0lEX01NSSwgTU9EVUxFX0lEX1dJRkksIChVU0hPUlQpTVNHX0NNRF9XSUZJX09QRU4sIE5VTEwsIE5VTEwsIDApOyAvL8/yV0lGSbeiy827vdDRz/vPogorCQkJfQorCQl9CisJfQorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6d3BzvKS77rvyyKW8pLvus8m5prrzz9TKvjLD67aoyrHG9worKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgVk9JRCAqIG1taV93cHNfdGlwX2NoZWNrX3RpbWVyX2NiKFZPSUQgKmFyZykKK3sKKwlzX21taV93cHNTdGF0ZSA9IFdQU19BQ1RJVkVfTUFYOworCW1taV9zZXRfdXBkYXRlX2ZsYWcoTU1JX1RBU0tfVElQKTsKKwlyZXR1cm4gTlVMTDsKK30KKworc3RhdGljIFZPSUQgbW1pX3dwc190aXBfdGltZXJfc3RhcnQoVk9JRCkKK3sKKwlpbnQgcmV0ID0gLTE7CisJcmV0ID0gQ3JlYXRlU29mdFRpbWVyKFNFVF9XUFNfVElQX0NIRUNLX1RJTUVSLCBUSU1FUl9GTEFHX09OQ0UsIFNFVF9XUFNfVElQX0NIRUNLX1RJTUUsICZtbWlfd3BzX3RpcF9jaGVja190aW1lcl9jYiwgTlVMTCk7CisJaWYgKHJldCAhPSAwKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX3dwc190aXBfdGltZXJfc3RhcnQgRkFJTEVEXG4iKTsKKwl9Cit9CisKK3N0YXRpYyBWT0lEIG1taV93cHNfdGlwX3RpbWVyX3N0b3AoVk9JRCkKK3sKKwlEZWxldGVTb2Z0VG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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzrNqLn9bna78cih1vehorixU1NJRLXEd2lmadPDu6fBrL3Tyv0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIFZPSUQgbW1pX2dldF93aWZpX3N0YW51bShWT0lEKQoreworCWNoYXIgdmEwX3dpZmlfbnVtWzhdID0gezB9OworCWNoYXIgdmExX3dpZmlfbnVtWzhdID0gezB9OworCVNJTlQzMiB3aWZpX251bSA9IDA7CisJU0lOVDMyIG1fd2lmaV9udW0gPSAwOworCWNmZ19nZXRfaXRlbShXTEFOX05WX1ZBMF9XSUlGX05VTSwgdmEwX3dpZmlfbnVtLCBzaXplb2YodmEwX3dpZmlfbnVtKSk7CisJY2ZnX2dldF9pdGVtKFdMQU5fTlZfVkExX1dJSUZfTlVNLCB2YTFfd2lmaV9udW0sIHNpemVvZih2YTFfd2lmaV9udW0pKTsKKwl3aWZpX251bSA9IGF0b2kodmEwX3dpZmlfbnVtKTsKKwltX3dpZmlfbnVtID0gYXRvaSh2YTFfd2lmaV9udW0pOworCWlmICgod2lmaV9udW0gPCAwIHx8IHdpZmlfbnVtID4gSU5UX01BWC0xKSB8fAorCQkobV93aWZpX251bSA8IDAgfHwgbV93aWZpX251bSA+IElOVF9NQVgtMSkpey8va3cgMywgMH4zMj8KKwkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSBtbWlfZ2V0X3dpZmlfc3RhbnVtIHdpZmlfbnVtID0gJWQsIG1fd2lmaV9udW0gPSAlZFxuIiwgd2lmaV9udW0sIG1fd2lmaV9udW0pOworCQlyZXR1cm47CisJfQorCXNfbW1pX3dpZmlfY29ubmVjdF9udW0gPSB3aWZpX251bSArIG1fd2lmaV9udW07CisJc2xvZyhNTUlfUFJJTlQsIFNMT0dfREVCVUcsICJaVEVfTU1JIG1taV9nZXRfd2lmaV9zdGFudW0gd2lmaV9udW0gPSAlZCxtX3dpZmlfbnVtID0gJWQsIHNfbW1pX3dpZmlfY29ubmVjdF9udW0gPSAlZCBcbiIsIHdpZmlfbnVtLCBtX3dpZmlfbnVtLCBzX21taV93aWZpX2Nvbm5lY3RfbnVtKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrLp0a93aWZpIMGsvdPK/baoyrHG97vYtfcKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworU0lOVDMyIHpNTUlfSGFuZGxlX01zZ19HZXRfV2lmaV9TdGFOdW0oVk9JRCAqZGF0YSkKK3sKKwkvLyNpZiBNTUlfVVNFX1dJRklfVVNFUk5VTQorCWlmIChnX3VzZV93aWZpX3VzZXJudW0pIHsKKyNpZiAwCisJCXNfbW1pX3dpZmlfY29ubmVjdF9udW0gPSB6dGVfd2xhbl9jYXB0dXJlX3N0YV9udW0oKTsKKwkJaWYgKHNfbW1pX3dpZmlfY29ubmVjdF9udW0gIT0gMCAmJiBzX21taV93aWZpX2Nvbm5lY3RfbnVtRXggPT0gMCkgeworCQkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfREVCVUcsICJaVEVfTU1JIHpNTUlfR2V0X3dpZmlfU3RhbnVtX0NhbGxiYWNrIHNfbW1pX2Nvbm5lY3RlZF91c2VyID0gMSEhIVxuIik7CisJCQlzX21taV9Jc2Nvbm5lY3RlZF91c2VyID0gMTsKKwkJfSBlbHNlIGlmIChzX21taV93aWZpX2Nvbm5lY3RfbnVtID09IDAgJiYgc19tbWlfd2lmaV9jb25uZWN0X251bUV4ICE9IDApIHsKKwkJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0RFQlVHLCAiWlRFX01NSSB6TU1JX0dldF93aWZpX1N0YW51bV9DYWxsYmFjayBzX21taV9jb25uZWN0ZWRfdXNlciA9IDAhISFcbiIpOworCQkJc19tbWlfSXNjb25uZWN0ZWRfdXNlciA9IDA7CisJCX0KKwkJc19tbWlfd2lmaV9jb25uZWN0X251bUV4ID0gc19tbWlfd2lmaV9jb25uZWN0X251bTsKKwkJbW1pX3NldF93aWZpX3VwZGF0ZSgpOworI2Vsc2UKKwkJU0lOVDMyIHZhX3N0YXRlID0gLTE7CisJCXZhX3N0YXRlID0gKihTSU5UMzIqKWRhdGE7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0RFQlVHLCAiWlRFX01NSSB6TU1JX0hhbmRsZV9Nc2dfR2V0X1dpZmlfU3RhTnVtIHZhX3N0YXRlID0gJWRcbiIsIHZhX3N0YXRlKTsKKwkJbW1pX2dldF93aWZpX3N0YW51bSgpOworCQltbWlfc2V0X3dpZmlfdXBkYXRlKCk7CisjZW5kaWYKKwl9CisJLy8jZW5kaWYKKwlyZXR1cm4gMDsKK30KKworc3RhdGljIFZPSUQgKiBtbWlfd2lmaV9zdGFudW1fdGltZXJfY2IoVk9JRCAqYXJnKQoreworCWlmIChzX21taV93aWZpU3RhdGUpIHsKKwkJaXBjX3NlbmRfbWVzc2FnZShNT0RVTEVfSURfTU1JLCBNT0RVTEVfSURfTU1JLCAoVVNIT1JUKU1TR19DTURfTU1JR0VUX1dJRklfU1RBTlVNLCAwLCBOVUxMLCAwKTsKKwl9CisJcmV0dXJuIE5VTEw7Cit9CisKKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6sunRr3dpZmkgway908r9tqjKscb3IDNTCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBWT0lEIG1taV93aWZpX3N0YW51bV90aW1lcl9jcmVhdGUoVk9JRCkKK3sKKwlpbnQgcmV0ID0gLTE7CisJcmV0ID0gQ3JlYXRlU29mdFRpbWVyKFNFVF9XSUZJX1NUQU5VTV9DSEVDS19USU1FUiwgVElNRVJfRkxBR19SRVNUQVJULCBTRVRfV0lGSV9TVEFOVU1fQ0hFQ0tfVElNRSwgJm1taV93aWZpX3N0YW51bV90aW1lcl9jYiwgTlVMTCk7CisJaWYgKHJldCAhPSAwKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX3dpZmlfc3RhbnVtX3RpbWVyX2NyZWF0ZSBGQUlMRURcbiIpOworCX0KK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrLp0a93aWZpIMr9vt20q8rktqjKscb3u9i19worKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitTSU5UMzIgek1NSV9IYW5kbGVfTXNnX0dldF9XaWZpX0RhdGEoVk9JRCAqZGF0YSkKK3sKKwl1bnNpZ25lZCBsb25nIGxvbmcgc19tbWlfd2lmaWRhdGEwX3NlbmQgPSAwLCBzX21taV93aWZpZGF0YTBfcmVjdiA9IDA7CisJdW5zaWduZWQgbG9uZyBsb25nIHNfbW1pX3dpZmlkYXRhMV9zZW5kID0gMCwgc19tbWlfd2lmaWRhdGExX3JlY3YgPSAwOworCWdldElmU3RhdGlzdGljKFdJRklfREFUQV9WQTAsIFdJRklfVFhCWVRFLCAmc19tbWlfd2lmaWRhdGEwX3NlbmQpOyAvL7bByKF3aWa2y7/admEwtcS3osvNyv2+3QorCWdldElmU3RhdGlzdGljKFdJRklfREFUQV9WQTAsIFdJRklfUlhCWVRFLCAmc19tbWlfd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lpURV9NTUkgbW1pX3dpZmlfZGF0YV90aW1lcl9jcmVhdGUgRkFJTEVEXG4iKTsKKwl9Cit9CisKK3N0YXRpYyBWT0lEIG1taV93aWZpX2RhdGFfdGltZXJfc3RvcChWT0lEKQoreworCURlbGV0ZVNvZnRUaW1lcihTRVRfV0lGSV9EQVRBX0NIRUNLX1RJTUVSKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOrb+zqzC68rHt/G05tTa17TMrMno1sMKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworU0lOVDMyIG1taV9zZXRfcXJjb2RlX3N0YXRlKCkKK3sKKwljaGFyIGJ1Zl9xcmNvZGVbOF0gPSB7MH07CisJRklMRSogZmRfcXJjb2RlID0gTlVMTDsKKwlpbnQgbGVuID0gMDsKKworCisJZmRfcXJjb2RlID0gZm9wZW4oUVJDT0RFX1NUQVRFX1BBVEgsICJyIik7CisJaWYgKGZkX3FyY29kZSA9PSBOVUxMKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX3NldF9xcmNvZGVfc3RhdGUgb3BlbiBxcmNvZGUgZmlsZSBmYWlsIVxuIik7CisJCXBlcnJvcihRUkNPREVfU1RBVEVfUEFUSCk7CisJCXJldHVybiAwOworCX0KKwlsZW4gPSBmcmVhZChidWZfcXJjb2RlLCAxLCAxLCBmZF9xcmNvZGUpOworCWlmIChsZW4gPiAwKSB7IC8va3cgMywgaGF2ZSAweDBhCisJCWJ1Zl9xcmNvZGVbbGVuXSA9ICdcMCc7CisJCWlmIChzdHJjbXAoYnVmX3FyY29kZSwgIjEiKSA9PSAwKSB7CisJCQlzX21taV9xcmNvZGVfZXhpc3QgPSBUUlVFOworCQl9IGVsc2UgaWYgKHN0cmNtcChidWZfcXJjb2RlLCAiMCIpID09IDApIHsKKwkJCXNfbW1pX3FyY29kZV9leGlzdCA9IEZBTFNFOworCQl9IGVsc2UgeworCQkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSAgcXJjb2RlIGZpbGUgc3RhdGUgZXJyb3IhXG4iKTsKKwkJfQorCX0gZWxzZSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgcmVhZCBxcmNvZGUgZmlsZSBmYWlsIVxuIik7CisJfQorCisJZmNsb3NlKGZkX3FyY29kZSk7CisKKwlpZiAobW1pX2dldF93aWZpY29kZV9zaG93X2ZsYWcoKSA9PSBUUlVFICYmIHNfbW1pX3FyY29kZV9leGlzdFByZSA9PSBGQUxTRSAmJiBzX21taV9xcmNvZGVfZXhpc3QgPT0gVFJVRSkgeworCQltbWlfc2V0X3VwZGF0ZV9mbGFnKE1NSV9UQVNLX1dJRklDT0RFKTsKKwl9CisKKwlzX21taV9xcmNvZGVfZXhpc3RQcmUgPSBzX21taV9xcmNvZGVfZXhpc3Q7CisJcmV0dXJuIDA7Cit9CisKK0JPT0wgbW1pX2dldF9xcmNvZGVfc3RhdGUoKQoreworCXJldHVybiBzX21taV9xcmNvZGVfZXhpc3QgOworfQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOndpZmm/qsb0XLnYsdXXtMysyejWwworKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitWT0lEIG1taV9zZXRfd2lmaV9zdGF0ZShWT0lEKQoreworCWNoYXIgYnVmX3dpZmlbOF0gPSB7MH07CisJRklMRSogZmRfd2lmaSA9IE5VTEw7CisJaW50IGxlbiA9IDA7CisKKwlmZF93aWZ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KKwkJCS8vI2VuZGlmCisJCX0gZWxzZSB7CisJCQlzbG9nKE1NSV9QUklOVCwgU0xPR19FUlIsICJaVEVfTU1JIHdpZmkgZmlsZSBzdGF0ZSBlcnJvciFcbiIpOworCQl9CisJfSBlbHNlIHsKKwkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSByZWFkIHdpZmkgZmlsZSBmYWlsIVxuIik7CisJfQorCisJZmNsb3NlKGZkX3dpZmkpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6d3Bzv6rG9Fy52LHV17TMrMno1sMKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIFZPSUQgbW1pX3NldF93cHNfc3RhdGUoVk9JRCkKK3sKKwljaGFyIGJ1Zl93cHNbOF0gPSB7MH07CisJRklMRSogZmRfd3BzID0gTlVMTDsKKwlpbnQgbGVuID0gMDsKKworCisJZmRfd3BzID0gZm9wZW4oV1BTX1NUQVRFX1BBVEgsICJyIik7CisJaWYgKGZkX3dwcyA9PSBOVUxMKSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgbW1pX3NldF93aWZpX3N0YXRlIG9wZW4gd3BzIGZpbGUgZmFpbCFcbiIpOworCQlwZXJyb3IoV1BTX1NUQVRFX1BBVEgpOworCQlyZXR1cm47CisJfQorCWxlbiA9IGZyZWFkKGJ1Zl93cHMsIDEsIDEsIGZkX3dwcyk7CisJaWYgKGxlbiA+IDApIHsgLy9rdyAzCisJCWJ1Zl93cHNbbGVuXSA9ICdcMCc7CisJCWlmIChzdHJjbXAoYnVmX3dwcywgIjEiKSA9PSAwKSB7CisJCQlzX21taV93cHNTdGF0ZSA9IFdQU19BQ1RJVklORzs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SA9PSAwKSB7CisJCQlzX21taV93cHNTdGF0ZSA9IFdQU19ERUFDVElWSU5HOworCQl9IGVsc2UgeworCQkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSAgd3BzIGZpbGUgc3RhdGUgZXJyb3IhXG4iKTsKKwkJfQorCX0gZWxzZSB7CisJCXNsb2coTU1JX1BSSU5ULCBTTE9HX0VSUiwgIlpURV9NTUkgcmVhZCB3cHMgZmlsZSBmYWlsIVxuIik7CisJfQorCisJZmNsb3NlKGZkX3dwcyk7Cit9CisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6d2lmaVN0YXRpb26/qsb0XLnYsdXXtMysyejWwworKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitWT0lEIG1taV9zZXRfd2lmaVN0YXRpb25fc3RhdGUoVk9JRCkKK3sKKwljaGFyIGJ1Zl93aWZpU3RhdGlvbls4XSA9IHswfTsKKwlGSUxFKiBmZF93aWZpU3RhdGlvbiA9IE5VTEw7CisJaW50IGxlbiA9IDA7CisKKworCWZkX3dpZmlTdGF0aW9uID0gZm9wZW4oV0lGSV9TVEFUSU9OX1BBVEgsICJyIik7CisJaWYgKGZkX3dpZmlTdGF0aW9uID09IE5VTEwpIHsKKwkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSBtbWlfc2V0X3dpZmlTdGF0aW9uX3N0YXRlIG9wZW4gd2lmaVN0YXRpb24gZmlsZSBmYWlsIVxuIik7CisJCXBlcnJvcihXSUZJX1NUQVRJT05fUEFUSCk7CisJCXJldHVybjsKKwl9CisJbGVuID0gZnJlYWQoYnVmX3dpZmlTdGF0aW9uLCAxLCAxLCBmZF93aWZpU3RhdGlvbik7CisJaWYgKGxlbiA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UiwgIlpURV9NTUkgcmVhZCB3aWZpU3RhdGlvbiBmaWxlIGZhaWwhXG4iKTsKKwl9CisJZmNsb3NlKGZkX3dpZmlTdGF0aW9uKTsKK30KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoruq/K/df308M6d2lmada4yr61xs/fs8zI67/auq/K/QorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgdm9pZCBtbWlfd2lmaXdwc19maWxlX29wZXJhdGUoY2hhciAqZmlsZW5hbWUpCit7CisJaWYgKGZpbGVuYW1lID09IE5VTEwpIHsKKwkJcmV0dXJuOworCX0KKwlpZiAoc3RyY21wKGZpbGVuYW1lLCBXSUZJX1NUQVRFX1BBVEgpID09IDApIHsKKwkJbW1pX3NldF93aWZpX3N0YXRlKCk7CisJCW1taV9zZXRfd2lmaV91cGRhdGUoKTsKKwkJbW1pX3NldF91cGRhdGVfZmxhZyhNTUlfVEFTS19MRURfV1BTKTsKKwl9IGVsc2UgaWYgKHN0cmNtcChmaWxlbmFtZSwgV1BTX1NUQVRFX1BBVEgpID09IDApIHsKKwkJbW1pX3NldF93cHNfc3RhdGUoKTsKKwkJbW1pX3NldF93aWZpX3VwZGF0ZSgpOworCQltbWlfc2V0X3VwZGF0ZV9mbGFnKE1NSV9UQVNLX1RJUF9XUFMpOworCQltbWlfc2V0X3VwZGF0ZV9mbGFnKE1NSV9UQVNLX0xFRF9XUFMpOworCX0gZWxzZSBpZiAoc3RyY21wKGZpbGVuYW1lLCBXUFNfU1RBVEVFWF9QQVRIKSA9PSAwKSB7CisJCW1taV9zZXRfd3BzRXhfc3RhdGUoKTsKKwkJbW1pX3NldF93aWZpX3VwZGF0ZSgpOworCQltbWlfc2V0X3VwZGF0ZV9mbGFnKE1NSV9UQVNLX1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+d2QgIT0gZmlsZV93ZFtpXS53ZCkgeworCQkJCQkJY29udGludWU7CisJCQkJCX0KKwkJCQkJbW1pX3dpZml3cHNfZmlsZV9vcGVyYXRlKGZpbGVfd2RbaV0uZmlsZW5hbWUpOworCQkJCQlicmVhazsKKwkJCQl9CisJCQkJdG1wX2xlbiA9IHNpemVvZihzdHJ1Y3QgaW5vdGlmeV9ldmVudCAqKSArIGV2ZW50X2xlbjsKKwkJCQlvZmZzX2xlbiArPSB0bXBfbGVuOworCQkJCWlmIChvZmZzX2xlbiA+IGxlbikvL2t3CisJCQkJCWJyZWFrOworCQkJCWV2ZW50ID0gKHN0cnVjdCBpbm90aWZ5X2V2ZW50ICopKG9mZnNldCArIHRtcF9sZW4pOworCQkJCW9mZnNldCArPSB0bXBfbGVuOworCQkJfQorCQl9CisJfQorCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzpjcmVhdGUgz9+zzLzssuJ3aWZpzsS8/rHku68KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIFZPSUQgbW1pX2NyZWF0ZV93aWZpX2lub3RpZnlfdGhyZWFkKFZPSUQpCit7CisJcHRocmVhZF90IG1taV93aWZpX3RocmVhZDsKKwlpZiAocHRocmVhZF9jcmVhdGUoJm1taV93aWZpX3RocmVhZCwgTlVMTCwgJm1taV93aWZpX3RocmVhZF9mdW5jdGlvbiwgTlVMTCkgPT0gLTEpIHsKKwkJc2xvZyhNTUlfUFJJTlQsIFNMT0dfRVJSLCAiWlRFX01NSSBjcmVhdGUgd2lmaSB0aHJlYWQgZXJyb3IhXG4iKTsKKwkJTU1JX0FTU0VSVCgwKTsKKwl9CisJc2xvZyhNTUlfUFJJTlQsIFNMT0dfREVCVUcsICJaVEVfTU1JIGNyZWF0ZSB3aWZpX3RocmVhZCBzdWNjZXNzISEhXG4iKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKK7qvyv3X99PDOk1NSSB3aWZpyv2+3bSryuTRrbu3vOyy4raoyrHG90tJTEyjrCAgudi7+rrN1tjG9MqxtffTwworKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitWT0lEIG1taV9raWxsX3dpZmlfZGF0YV90aW1lcihWT0lEKQoreworCWlmIChnX3Nob3dNb2RlID09IE1NSV9NT0RFX0xFRCB8fCBnX3Nob3dNb2RlID09IE1NSV9NT0RFX0FMTCkgeworCQltbWlfd2lmaV9kYXRhX3RpbWVyX3N0b3AoKTsKKwl9Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiu6r8r91/fTwzp3aWZp1rjKvrXGs/XKvLuvo6wgyejWw7vYtfe6r8r9CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK1ZPSUQgbW1pX3dpZmlfaW5pdChWT0lEKQoreworCW1taV9zZXRfd2lmaV9zdGF0ZSgpOworCW1taV9zZXRfd2lmaV91cGRhdGUoKTsKKwltbWlfc2V0X3FyY29kZV9zdGF0ZSgpOworCW1taV9jcmVhdGVfd2lmaV9pbm90aWZ5X3RocmVhZCgpOworCW1taV93aWZpX2RhdGFfdGltZXJfY3JlYXRlKCk7CisJaWYgKGdfdXNlX3dpZmlfdXNlcm51bSkgeworCQltbWlfZ2V0X3dpZmlfc3RhbnVtKCk7CisJfQorfQorCg==