ZGlmZiAtLWdpdCBhL2FwL2FwcC9jY2FwcC9jY19wcm9jLmMgYi9hcC9hcHAvY2NhcHAvY2NfcHJvYy5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjg3MzQ5N2UKLS0tIC9kZXYvbnVsbAorKysgYi9hcC9hcHAvY2NhcHAvY2NfcHJvYy5jCkBAIC0wLDAgKzEsMzg4OSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorKg0KKyogICAgICAgICAgICAgICAgICBDb3B5cmlnaHQgKGMpIDIwMTMgWlRFIENvcnBvcmF0aW9uLg0KKyoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqIMSjIL/pIMP7IDogQ2NBcHANCisqIM7EILz+IMP7IDogYXRfcHJvYy5jDQorKiDP4LnYzsS8/iA6DQorKiDKtc/WuabE3CA6IEFUw/zB7reiy826zb3hufu0psDtxKO/6bqvyv22qNLlDQorKiDX9yAgICDV3yA6IHN5eA0KKyogsOYgICAgsb4gOiBWMS4wDQorKiDN6rPJyNXG2iA6IDIwMTMtMDEtMDUNCisqIMbky/zLtcP3IDoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqINDeuMS8x8K8IDoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorKiDQ3rjEseC6xSA6IDAwMDENCisqINDeILjEIMjLIDoNCisqINDeuMTI1cbaIDoNCisqINDeuMTE2sjdIDoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqICNpbmNsdWRlx/gNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisjaW5jbHVkZSAiY2NfbWFpbi5oIg0KKyNpbmNsdWRlICJjY19wcm9jLmgiDQorI2luY2x1ZGUgImNjX2NvbS5oIg0KKyNpbmNsdWRlICJjY19hdC5oIg0KKyNpbmNsdWRlICJjY190aW1lci5oIg0KKyNpbmNsdWRlICJzdHJpbmcuaCINCisjaWZkZWYgVEVTVF9DQ0FQUA0KKyNpbmNsdWRlICJzb2Z0X3RpbWVyLmgiDQorI2VuZGlmDQorDQorI2luY2x1ZGUgInNsaWNfaW5mLmgiDQorI2luY2x1ZGUgPHN0ZGludC5oPg0KKyNpbmNsdWRlIDxsaW51eC92b2x0ZV9kcnYuaD4NCisjaW5jbHVkZSAidm9pY2VfbGliLmgiDQorDQorI2RlZmluZSBMT0NBTF9URVNUX0NBTExfQ09ERSAiKiM2NiojIg0KKyNkZWZpbmUgVFpfVEVTVF9USU1JTkcgIiojODM3ODEyMzQqIyINCit0eXBlZGVmIGVudW17DQorCUxvY2FsVGVzdENhbGxTVF9Ob25lID0gMCwNCisJTG9jYWxUZXN0Q2FsbFNUX1N0YXJ0LA0KKwlMb2NhbFRlc3RDYWxsU1RfUmluZywNCisJTG9jYWxUZXN0Q2FsbFNUX0VuZA0KK31lTG9jYWxUZXN0Q2FsbFNUOw0KK2ludCBsb2NhbF90ZXN0X2NhbGxfc3QgPSAwOw0KK3R5cGVkZWYgZW51bXsNCisJTG9jYWxUZXN0Q2FsbFR5cGVfTm9uZSA9IDAsDQorCUxvY2FsVGVzdENhbGxUeXBlX0xPT1ANCit9ZUxvY2FsVGVzdENhbGxUeXBlOw0KK2ludCBsb2NhbF90ZXN0X2NhbGxfdHlwZSA9IDA7DQorDQorZXh0ZXJuIFNJTlQzMiBnX3pDY19BdFJzcElkOw0KKw0KK2ludCB6Q2NfZmluZF9oZWxkX2NpZCh2b2lkKTsNCitpbnQgekNjX2ZpbmRfaGVsZF9pbmNvbWluZ19jaWQodm9pZCk7DQoraW50IHpDY19maW5kX2FsbF9jYWxsb3V0KGludCBzbGF2ZVtaQ0NfU0xBVkVTXSk7DQoraW50IHpDY190YWxraW5nX2NvdW50KHZvaWQpOw0KK2NoYXIgKmdldF9sb2NhbF9kYXRlX3RpbWUodm9pZCk7DQorY2hhciAqZ2V0X2xvY2FsX2RhdGV0aW1lKGNoYXIgKmJ1ZmYpOw0KKw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyogs6PBv7ao0uXH+A0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KKw0KKy8qICB7DQorICAgIFpDQ19TX0lETEVfUyAgICAgICAgPSAwLA0KKyAgICBaQ0NfU19EVF9TICAgICAgICAgICAsDQorICAgIFpDQ19TX0RBQ0NNX1MgICAgLA0KKyAgICBaQ0NfU19ESUFMSU5HX1MgICwNCisgICAgWkNDX1NfUklOR0JBQ0tfUyAgICwvLyDW973Quf2zzNbQtcTV8cHlzKwNCisgICAgWkNDX1NfQlNZVF9TICAgICAgICwNCisgICAgWkNDX1NfVEtZVF9TICAgICAgICwNCisgICAgWkNDX1NfU0lMX1MgICAgICAgICwNCisgICAgWkNDX1NfVEFMS0lOR19TICAgICwNCisgICAgWkNDX1NfVFJZSU5HX1MgICAgICwNCisgICAgWkNDX1NfV0FJVF9SRVNPVVJDRV9TICwNCit9ICovDQorY29uc3QgcENjU2xhdmVGc21GdW5jIHpDY1NsYXZlRnNtRnVuY1tdID0ge3pDY19TSWRsZVN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NEdFN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NEYWNjbVN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NEaWFsaW5nU3RhdGUsIA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NfU1JpbmdiYWNrU3RhdGUsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpDY19TQnN5VG9uZVN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NUa3l0U3RhdGUsIA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NfU1NpbFN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NUYWxraW5nU3RhdGUsIA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NfU1RyeWluZ1N0YXRlLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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AgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0ud2FpdERTQ0k2ID09IDApDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzbGF2ZTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm4gc2xhdmU7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIHJldHVybiAwOw0KK30NCisNCitVSU5UOCB6Q2NfR2V0RGlzY1NsYXZlKFVJTlQ4IHN0YXRlKQ0KK3sNCisgICAgVUlOVDggICBzbGF2ZSA9IDA7DQorICAgIFVJTlQ4ICAgY250ID0gMDsNCisNCisgICAgZm9yIChzbGF2ZSA9IDE7IHNsYXZlIDwgWkNDX1NMQVZFUzsgc2xhdmUrKykgLy8gc2xhdmVbMF0gsru/ycTcDQorICAgIHsNCisgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2c9PSBaQ0NfU0RJU0NOX00gJiYgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS53YWl0RFNDSTYgPT0gMCkNCisgICAgICAgIHsNCisgICAgICAgICAgICAgY250Kys7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIGNudDsNCit9DQorDQorDQoraW50ICB0el9sb2NrX2NlbGxpZF9pc19saW1pdF9jYWxsaW4oKQ0KK3sNCisJY2hhciBjZWxsaWRfaXNfbG9ja1s0XSA9IHswfTsNCisNCisJc2NfY2ZnX2dldCgiY2VsbGlkX2lzX2xvY2siLGNlbGxpZF9pc19sb2NrLHNpemVvZihjZWxsaWRfaXNfbG9jaykpOw0KKwlpZihzdHJjbXAoY2VsbGlkX2lzX2xvY2ssICIxIikgPT0gMCkJDQorCQlyZXR1cm4gMTsN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CisNCisgICAgLypmb3IgKGkgPSAwOyBpPHNjU3VtOyBpKyspDQorICAgIHsNCisgICAgICAgIGlmIChzdHJuY21wKChDSEFSICopZ196Q2NfU0NUYWJbaV0uc2MsIChDSEFSICopZ19DY19DYWxsRGV0YWlsLmRpZ2l0cywgDQorICAgICAgICAgICAgKFVJTlQzMikoc3RybGVuKGdfekNjX1NDVGFiW2ldLnNjKTxnX0NjX0NhbGxEZXRhaWwuZENvdW50KT9zdHJsZW4oZ196Q2NfU0NUYWJbaV0uc2MpOmdfQ2NfQ2FsbERldGFpbC5kQ291bnQpID09IDApDQorICAgICAgICB7IA0KKyAgICAgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuZGlnaXRzW2dfQ2NfQ2FsbERldGFpbC5kQ291bnQtMV0gPT0gJyMnKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgcmV0dXJuIGdfekNjX1NDVGFiW2ldLnNjTmFtZTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5kQ291bnQgPCBnX3pDY19TQ1RhYltpXS5zY01heExlbikNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHJldHVybiBaQ0NfTk9fUkVTVUxUOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLmRDb3VudCA9PSBnX3pDY19TQ1RhYltpXS5zY01heExlbikNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHJldHVybiBaQ0NfTUFUQ0hFUlI7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICB9Ki8NCisJDQorICAgIGlmKGdfQ2NfQ2FsbERldGFpbC5kQ291bnQ+PTIgJiYgDQorICAgIAlnX0NjX0NhbGxEZXRhaWwuZENvdW50PFpESUFMX05VTV9NQVggJiYNCisgICAgCWdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbMF09PScqJykNCisgICAgew0KKwkJaWYoZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1tnX0NjX0NhbGxEZXRhaWwuZENvdW50LTFdID09ICcjJw0KKyAgICAgICAgICAgICAgICB8fCBnX0NjX0NhbGxEZXRhaWwuZGlnaXRzW2dfQ2NfQ2FsbERldGFpbC5kQ291bnQtMV0gPT0gWkNDX1RJTUVPVVRfU0lHTikNCisgICAgICAgIHsNCisgICAgICAgIAljY2FwcF9sb2coIm1hdGNoIHNwZWNpYWwgY29kZTogJXMiLCBnX0NjX0NhbGxEZXRhaWwuZGlnaXRzKTsNCisJCQlyZXR1cm4gWkNDX0NBTEw7DQorCQl9DQorCQllbHNlDQorCQl7DQorCQkJLy9jY2FwcF9sb2coIjgiKTsNCisJCQlyZXR1cm4gWkNDX05PX1JFU1VMVDsNCisJCX0NCisgICAgfQ0KKw0KKyAgICAvL2NjYXBwX2xvZygiOSIpOw0KKyAgICByZXR1cm4gWkNDX01BVENIRVJSOw0KK30NCisNCitWT0lEIHpDY19EaWdpdHNNYXRjaFJsdFByb2MoVUlOVDggICByZXQpDQorew0KKyAgICBVSU5UOCAgIGNhbGxDbnQgPSAwLCBzbGF2ZSA9IDA7DQorICAgIFNJTlQzMiAgY2hsZHJldCA9IC0xOw0KKw0KKyAgICBjY2FwcF9sb2coInJldD0lZCIsIHJldCk7DQorDQorICAgIHNsYXZlID0gekNjX0dldFNwZWNTbGF2ZShaQ0NfU19EQUNDTV9TKTsNCisgICAgc3dpdGNoIChyZXQpDQorICAgIHsNCisgICAgICAgIGNhc2UgWkNDX05PX1JFU1VMVDoNCisgICAgICAgICAgICBzY190aW1lcl9jcmVhdGUoWkNDQVBQX1RJTUVSX0RUTUZfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgICAgIDAsDQorICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0RUTUZfSU5URVJWQUwsDQorICAgICAgICAgICAgICAgICAgICAgICAgekNjQXBwX0R0bWZUaW1lciwNCisgICAgICAg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oMTArc2xhdmUpOw0KKwkJCQkJU0xJQ19TdG9wX1NpZ25hbCgwLFRPTkVfU0lHTkFMKTsNCisJCQkJCWdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0udG9uZSA9IFpDQ19UT05FX09GRl9BOw0KKwkJCQkJZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID0gWkNDX1RPTkVfT0ZGX0E7DQorCQkJCQlicmVhazsNCisgICAgCQkJfQ0KKw0KKyAgICAJCQljY2FwcF9sb2coInpDY19TZW5kQXRDaGxkUmVxKDEpLSIpOw0KKyAgICAgICAgICAgICAgICBjaGxkcmV0ID0gekNjX1NlbmRBdENobGRSZXEoMSk7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgIA0KKyAgICAgICAgY2FzZSBaQ0NfRkxBU0hfMjoNCisgICAgICAgICAgICBjaGxkcmV0ID0gekNjX1NlbmRBdENobGRSZXEoMik7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICAgICAgDQorICAgICAgICBjYXNlIFpDQ19GTEFTSF8zOg0KKyAgICAgICAgCWlmKHpDY190YWxraW5nX2NvdW50KCk9PTEgJiYgekNjX0dldFNwZWNTbGF2ZShaQ0NfU19UUllJTkdfUykpICANCisJCQl7DQorCQkJCS8vIHRhbGtpbmcgKyBpbmNvbWluZywgc2tpcCBob29rZmxhc2grMywgZG8gbm90aGluZw0KKwkJCX0NCisJCQllbHNlDQorICAgICAgICAgICAgCWNobGRyZXQgPSB6Q2NfU2VuZEF0Q2hsZFJlcSgzKTsNCisgICAgICAgICAgICBicmVhazsNCisNCisgICAgICAgIGNhc2UgWkNDX0ZMQVNIXzQ6DQorICAgICAgICAJaWYoIHpDY19DYWxsQ291bnQoKT4gMSkNCisgICAgICAgIAl7DQorCSAgICAgICAgCS8vc3lzdGVtKCJhdF9jbWQgQVQrWlRPUj0yIik7DQorCSAgICAgICAgCS8vekNjQXBwX3NlbmRfbW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ICAgICAgIA0KKyAgICAgICAgY2FzZSBaQ0NfTUFUQ0hFUlI6DQorICAgICAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbMF0gIT0gWkNDX0ZMQVNIX1NJR04pDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICB6Q2NfQ2xlYXJEaWdpdHMoKTsNCisgICAgICAgICAgICAgICAgaWYgKDEgPT0gekNjX0J1c3lUb25lQWxsb3dlZCgpICYmIGdfQ2NfQ2FsbERldGFpbC5zdGF0ZSA9PSBaQ0NfTV9TRUlaRV9TKS8v09DG5Mv7uvS90Mqxsru3xcOm0vQNCisgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgc2NfdGltZXJfY3JlYXRlKFpDQ0FQUF9USU1FUl9CVVNZVE9ORV9ERVRFQ1QsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0JVU1lUT05FX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjQXBwX0J1c3lUb25lVGltZXIsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgICAgICAgICAgICAgIA0KKyAgICAgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfRGlnaXRzTWF0Y2hSbHRQcm9jIHNjX3RpbWVyX2NyZWF0ZSB6Q2NBcHBfQnVzeVRvbmVUaW1lclxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS50b25lID0gWkNDX1RPTkVfQlNZX0E7DQorICAgICAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnN0YXRlID0gWkNDX1NfQlNZVF9TOw0KKyAgICAgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5jb25mY2FsbCA9IDA7DQorICAgICAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLmhlbGRjYWxsID0gMDsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgICAgIHsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfSW5pdFNsYXZlT2JqOiBzbGF2ZU9ialslZF0gY2xlYXJlZFxuIixfX0ZVTkNUSU9OX18sIHNsYXZlKTsNCisgICAgICAgICAgICAgICAgICAgIHpDY19Jbml0U2xhdmVPYmooc2xhdmUpOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIHJldHVybjsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICAgICAgDQorICAgICAgICBkZWZhdWx0OiANCisgICAgICAgICAgICBpZiAocmV0ID49IFpDQ19CQU9DX1JFRyAmJiByZXQgPD0gWkNDX0NGQl9ERVJFRykvLyBTUyBzbGF2ZT0xDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2cgPSBaQ0NfU0lOVl9NOw0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnN0YXRlID0gWkNDX1NfSURMRV9TOy8vsdzD4rrzw+a50rv6u+G3osbwY2h1cA0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICByZXR1cm47DQorICAgICAgICB9ICAgDQorDQorICAgICAgICB6Q2NfQ2xlYXJEaWdpdHMoKTsNCisgICAgICAgIC8vekNjX0luaXRTbGF2ZU9iaihzbGF2ZSk7DQorfQ0KKyNpZiAwDQorVk9JRCB6Q2NfUHJlUHJvY1JlcyhDSEFSICpwUGFyYUxpbmUpDQorew0KKyAgICBTSU5UMzIgIGZsZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IDA7DQorICAgIFVJTlQzMiAgaSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMDsNCisgICAgVUlOVDMyICBsZW5ndGggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSAwOw0KKyAgICBDSEFSICAgICpwU291cmNlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IHBQYXJhTGluZTsNCisgICAgQ0hBUiAgICAqcERlc3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSBOVUxMOw0KKw0KKyAgICBDSEFSICAgICpwU3RyRGVzdE1hbGxvYyA9IChDSEFSICopbWFsbG9jKEFUX0NNRF9NQVgpOw0KKyAgICBpZiAoTlVMTCA9PSBwU3RyRGVzdE1hbGxvYykNCisgICAgew0KKyAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfUHJlUHJvY1JlczogTWFsbG9jIGZhaWxlZCAhISFcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIHJldHVybjsNCisgICAgfQ0KKyAgICBtZW1zZXQocFN0ckRlc3RNYWxsb2MsIDAsIEFUX0NNRF9NQVgpOyANCisNCisgICAgYXNzZXJ0KHBQYXJhTGluZSAhPSBOVUxMKTsNCisgICAgcERlc3QgPSBwU3RyRGVzdE1hbGxvYzsNCisgICAgbGVuZ3RoID0gc3RybGVuKHBQYXJhTGluZSk7DQorICAgIGlmIChsZW5ndGggPT0gMCB8fCBsZW5ndGggPj0gWkFUX01BWF9MRU4pDQorICAgIHsNCisgICAgICAgIGZyZWUocFN0ckRlc3RNYWxsb2MpOw0KKyAgICAgICAgcmV0dXJuOw0KKyAgICB9DQorICAgIGZvciAoaSA9IDA7IChpIDwgbGVuZ3RoICkmJiAocERlc3QgLSBwU3RyRGVzdE1hbGxvYyA8IEFUX0NNRF9NQVgpOyBpKyspDQorICAgIHsNCisgICAgICAgIGlmICgnIicgPT0gKnBTb3VyY2UpDQorICAgICAgICB7DQorICAgICAgICAgICAgZmxnID0gKDAgPT0gZmxnKT8xOjA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogy6vS/brFIMm+s/0gICovDQorICAgICAgICAgICAgaWYgKCciJyA9PSAqKHBTb3VyY2UgKyAxKSkgICAgICAgICAgICAgICAgICAgICAgLyog0Me6xbrzw+a99Lj60Me6xaOssuXI67/VtK7VvM67t/sgKi8NCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICpwRGVzdCsrID0gKENIQVIpWkFUX05VTExfRklMTDsNCisgICAgICAgICAgICB9DQorICAgICAgICB9DQorICAgICAgICBlbHNlIGlmICgoJywnID09ICpwU291cmNlKSAmJiAoMCA9PSBmbGcpKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgICpwRGVzdCsrID0gJyAnOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIMur0v26xc3iw+a1xLa6usWjrMzmu7uzyb/VuPEgKi8NCisgICAgICAgICAgICBpZiAoJywnID09ICoocFNvdXJjZSArIDEpKSAgICAgICAgICAgICAgICAgICAgICAgLyogtrq6xbrzw+a99Lj6trq6xaOsu/LV39LUtrq6xb3hzrKjrLLlyOu/1bSu1bzOu7f7ICovDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAqcERlc3QrKyA9ICc5JzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vsaPB9LLOyv3TwznU3cqxtPrM5g0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlIGlmICgnXDAnID09ICoocFNvdXJjZSArIDEpKSAgICAgICAgICAgICAgICAgLyogtrq6xbrzw+a99Lj6trq6xaOsu/LV39LUtrq6xb3hzrKjrLLlyOu/1bSu1bzOu7f7ICovDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAqcERlc3QrKyA9IChDSEFSKVpBVF9OVUxMX0ZJTEw7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZSBpZiAoKCdccicgPT0gKnBTb3VyY2UpIHx8KCdcbicgPT0gKnBTb3VyY2UpKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHBTb3VyY2UrKzsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UNCisgICAgICAgIHsNCisgICAgICAgICAgICAqcERlc3QrKyA9ICgoJyAnID09ICpwU291cmNlKSAmJiAoMSA9PSBmbGcpKT8oQ0hBUilaQVRfU1BBQ0VfUkVQTEFDRTooKCgnXHQnID09ICpwU291cmNlKSAmJiAoMSA9PSBmbGcpKT8oQ0hBUilaQVRfVEFCX1JFUExBQ0U6KCpwU291cmNlKSk7DQorICAgICAgICB9DQorICAgICAgICBwU291cmNlKys7DQorICAgIH0NCisNCisgICAgbWVtc2V0KHBQYXJhTGluZSwgMCwgbGVuZ3RoKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiC9q9SktKbA7brztcTE2sjdv72xtLvYss7K/dDQ1tAgKi8NCisgICAgc3RyY3B5KHBQYXJhTGluZSwgcFN0ckRlc3RNYWxsb2MpOw0KKyAgICBmcmVlKHBTdHJEZXN0TWFsbG9jKTsNCit9DQorI2VuZGlmDQorVUlOVDggekNjX0NhbGxDb3VudChWT0lEKQ0KK3sNCisgICAgVUlOVDggICBzbGF2ZSA9IDAsIGNudCA9IDA7DQorDQorICAgIGZvciAoc2xhdmUgPSAxOyBzbGF2ZSA8IFpDQ19TTEFWRVM7IHNsYXZlKyspDQorICAgIHsNCisgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnN0YXRlICE9IFpDQ19TX0lETEVfUyANCisgICA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Q0VfUykNCisgICAgICAgICAgICAvLyYmIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0ud2FpdERTQ0k2ID09IDApDQorICAgICAgICB7DQorICAgICAgICAgICAgY250Kys7DQorICAgICAgICB9DQorICAgIH0NCisNCisgICAgcmV0dXJuIGNudDsNCit9DQorVUlOVDggekNjX0dldENhbGxTbGF2ZShVSU5UOCBoZWxkY2FsbCkvL7C01+624MG9wrfKtc/WDQorew0KKyAgICBVSU5UOCAgIHNsYXZlID0gMDsNCisNCisgICAgZm9yIChzbGF2ZSA9IDE7IHNsYXZlIDwgWkNDX1NMQVZFUzsgc2xhdmUrKykgLy8gc2xhdmVbMF0gsru/ycTcDQorICAgIHsNCisgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnN0YXRlID09IFpDQ19TX1RBTEtJTkdfUyANCisgICAgICAgICAgICAmJiBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLmhlbGRjYWxsID09IGhlbGRjYWxsDQorICAgICAgICAgICAgJiYgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS53YWl0RFNDSTYgPT0gMCkNCisgICAgICAgIHsNCisJCQlyZXR1cm4gc2xhdmU7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIDA7DQorfQ0KKw0KK1ZPSUQgekNjX0NvbnRyb2xUb25lKFZPSUQpDQorew0KKyAgICBUX3pDY19Ub25lICAgICAgICAgICAgdG9uZSA9IFpDQ19UT05FX09GRl9BOyAgIC8qIFdoYXQgdG9uZSB0byBwbGF5ICovDQorICAgIFNJR05BTF9EQVRBICB0U2lnOw0KKyAgICBtZW1zZXQodFNpZy5jaWQsIDAsIDMyKTsNCisgICAgVUlOVDggICBzbGF2ZSA9IDA7DQorDQorICAgIGZvciAoc2xhdmUgPSAwOyBzbGF2ZSA8IFpDQ19TTEFWRVM7IHNsYXZlKyspDQorICAg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sc2l6ZW9mKHRjbGNrcmVxLnB3KS0xKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGNhc2UgWkNDX0JPSUNfUkVHOiANCisgICAgICAgICAgICBzc2NhbmYocEF0Q21kUGFyYSwgIiUqNXMlNHMjIiwgcHcpOw0KKyAgICAgICAgICAgIHB3WzRdID0gJ1wwJzsNCisgICAgICAgICAgICB0Y2xja3JlcS50eXBlID0gMTsvL09JDQorICAgICAgICAgICAgdGNsY2tyZXEuYWN0ID0gMTsNCisgICAgICAgICAgICBzdHJuY3B5KHRjbGNrcmVxLnB3LHB3LHNpemVvZih0Y2xja3JlcS5wdyktMSk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19CT0lDX0RFUkVHOg0KKyAgICAgICAgICAgIHNzY2FuZihwQXRDbWRQYXJhLCAiJSo1cyU0cyMiLCBwdyk7DQorICAgICAgICAgICAgcHdbNF0gPSAnXDAnOw0KKyAgICAgICAgICAgIHRjbGNrcmVxLnR5cGUgPSAxOy8vT0kNCisgICAgICAgICAgICB0Y2xja3JlcS5hY3QgPSAwOw0KKyAgICAgICAgICAgIHN0cm5jcHkodGNsY2tyZXEucHcscHcsc2l6ZW9mKHRjbGNrcmVxLnB3KS0xKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGNhc2UgWkNDX0NGVV9SRUc6DQorICAgICAgICAgICAgc3NjYW5mKHBBdENtZFBhcmEsICIlKjRzJTQ3cyMiLCBkbik7DQorICAgICAgICAgICAgZG5bc3RybGVuKGRuKS0xXSA9ICdcMCc7DQorICAgICAgICAgICAgdGNjZmNyZXEudHlwZSA9IDA7DQorICAgICAgICAgICAgdGNjZmNyZXEuYWN0ID0gMTsNCisgICAgICAgICAgICBzdHJuY3B5KHRjY2ZjcmVxLmRuLCBkbiwgc3RybGVuKGRuKSk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19DRlVfREVSRUc6DQorICAgICAgICAgICAgdGNjZmNyZXEudHlwZSA9IDA7DQorICAgICAgICAgICAgdGNjZmNyZXEuYWN0ID0gMDsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGNhc2UgWkNDX0NGTlJZX1JFRzoNCisgICAgICAgICAgICBzc2NhbmYocEF0Q21kUGFyYSwgIiUqNHMlNDdzIyIsIGRuKTsNCisgICAgICAgICAgICBkbltzdHJsZW4oZG4pLTFdID0gJ1wwJzsNCisgICAgICAgICAgICB0Y2NmY3JlcS50eXBlID0gMjsNCisgICAgICAgICAgICB0Y2NmY3JlcS5hY3QgPSAxOw0KKyAgICAgICAgICAgIHN0cm5jcHkodGNjZmNyZXEuZG4sIGRuLCBzdHJsZW4oZG4pKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGNhc2UgWkNDX0NGTlJZX0RFUkVHOg0KKyAgICAgICAgICAgIHRjY2ZjcmVxLnR5cGUgPSAyOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLmFjdCA9IDA7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19DRkJfUkVHOg0KKyAgICAgICAgICAgIHNzY2FuZihwQXRDbWRQYXJhLCAiJSo0cyU0N3MjIiwgZG4pOw0KKyAgICAgICAgICAgIGRuW3N0cmxlbihkbiktMV0gPSAnXDAnOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLnR5cGUgPSAxOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLmFjdCA9IDE7DQorICAgICAgICAgICAgc3RybmNweSh0Y2NmY3JlcS5kbiwgZG4sIHN0cmxlbihkbikpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgY2FzZSBaQ0NfQ0ZCX0RFUkVHOg0KKyAgICAgICAgICAgIHRjY2ZjcmVxLnR5cGUgPSAxOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLmFjdCA9IDA7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgIH0NCisgICAgICAgIA0KKy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X18pOw0KKw0KKyAgICAgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwubGFzdFRvbmUgPT0gWkNDX1RPTkVfRElBTF9BDQorICAgICAgICAgICAmJiBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbMF0udG9uZSA9PSBaQ0NfVE9ORV9ESUFMX0EpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBTTElDX1N0b3BfU2lnbmFsKDAsIFRPTkVfU0lHTkFMKTsNCisgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfRHNjaUluZFByb2M6IFNMSUNfU3RvcF9TaWduYWwgPC0tLVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwubGFzdFRvbmUgPSBaQ0NfVE9ORV9PRkZfQTsgICAgICANCisgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfRHNjaUluZFByb2MgaGFuZGxpbmcgekNjX0luaXRTbGF2ZU9iaigwKVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKDApOyAgICAgICAgICAgICAgICANCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW2NpZF0uaGVsZGNhbGwgPSAwOw0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtjaWRdLmNvbmZjYWxsID0gaW5NcHR5Ow0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHB0TXNnQnVmLT51c01zZ0NtZCA9IFpDQ19TQU5TX0U7DQorICAgICAgICB9DQorICAgICAgICAJDQorI2lmbm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AgICAgICAgICAgICAgICB6Q2NfU2VuZEF0Q2hsZFJlcSgxMCtjaWQpOw0KKyAgICAgICAgICAgICAgICBicmVhazsNCisgICAgICAgICAgICB9DQorICAgICAgICB9DQorCQllbHNlIGlmKGdfQ2NfQ2FsbERldGFpbC5zdGF0ZT09WkNDX01fUkVMRUFTRV9TKSANCisgICAgICAgIHsNCisgICAgICAgIAlpbnQgZHNjaTZfY2lkID0gekNjX0ZpbmRfd2FpdERTQ0k2X2NpZCgpOw0KKwkJCWlmKGRzY2k2X2NpZCE9MCAmJiBkc2NpNl9jaWQ9PWNpZCkNCisJCQl7DQorICAgICAgICAgICAgICAgIHpDY19TZW5kQXRDaGxkUmVxKDEwK2NpZCk7DQorICAgICAgICAgICAgICAgIHpDY19Jbml0U2xhdmVPYmooY2lkKTsNCisgICAgICAgICAgICAgICAgY2NhcHBfbG9nKCJ6Q2NfRmluZF93YWl0RFNDSTZfY2lkIGFuZCBza2lwIHRoaXMgY2FsbCAlcyIsIG51bSk7DQorDQorICAgICAgICAgICAgICAgIGNoYXIgdGVtcFsyMDBdOw0KKyAgICAgICAgICAgICAgICBzcHJpbnRmKHRlbXAsICJlY2hvIFwiJXMgZ2V0IGVycm9yIGluY29taW5nIGNhbGwgY2lkPSVkIG51bT0lc1wiID4gL3RtcC9sb2cuY2NhcHAuY2FsbGluLmVyciIsDQorICAgICAgICAgICAgICAgIAlnZXRfbG9jYWxfZGF0ZV90aW1lKCksIGNpZCwgbnVtKTsNCisgICAgICAgICAgICAgICAgc29mdF9zeXN0ZW0odGVtcCk7DQorICAgICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgcHRNc2dCdWYtPnVzTXNnQ21kID0gWkNDX1NJTlZJVEVfRTsNCisgICAgICAgIG1lbXNldChnX0NjX0NhbGxEZXRhaWwubnVtYmVyLCAwLCBzaXplb2YoZ19DY19DYWxsRGV0YWlsLm51bWJlcikpOw0KKyAgICAgICAgbWVtY3B5KGdfQ2NfQ2FsbERldGFpbC5udW1iZXIsIG51bSwgWkRJQUxfTlVNX01BWCk7DQorICAgICAgICBicmVhazsNCisgICAgY2FzZSA1Oi8vWl9NTUlBQ0NfQ0FMTF9TVEFURV9NVF9XQUlUSU5HDQorICAgICAgICBpZihnX0NjX0NhbGxEZXRhaWwuc3RhdGU9PVpDQ19NX1JJTkdJTkdfUyAmJiB6Q2NfZmluZF9oZWxkX2NpZCgpKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHpDY19TZW5kQXRDaGxkUmVxKDEwK2NpZCk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgICAgICBlbHNlIGlmKGlzX29uZWNhbGxfaW5faGVscF9hbmRfcmVhZHlfdG9faW5wdXRfbmV3X2NhbGwoKSkNCisgICAgICAgIHsNCisgICAgICAgICAgICB6Q2NfU2VuZEF0Q2hsZFJlcSgxMCtjaWQpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgfQ0KKyAgICAgICAgDQorICAgICAgICBpZih6Q2NfQ2FsbENvdW50KCk+PTIpDQorICAgICAgICB7DQorICAgICAgICAgICAgekNjX1NlbmRBdENobGRSZXEoMTArY2lkKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgcHRNc2dCdWYtPnVzTXNnQ21kID0gWkNDX0NJRENXX0U7DQorICAgICAgICBtZW1zZXQoZ19DY19DYWxsRGV0YWlsLm51bWJlciwgMCwgc2l6ZW9mKGdfQ2NfQ2FsbERldGFpbC5udW1iZXIpKTsNCisgICAgICAgIG1lbWNweShnX0NjX0NhbGxEZXRhaWwubnVtYmVyLCBudW0sIFpESUFMX05VTV9NQVgpOw0KKyAgICAgICAgYnJlYWs7DQorICAgIGNhc2UgNjovL1pfTU1JQUNDX0NBTExfU1RBVEVfRU5EDQorICAgIAl6Q2NBcHBfVnRzX0NsZWFuUmVxKC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gZ196Q2NfcGNtX2JhayA9ICByYXRlOw0KKyAgICAgICAgICAgIHJldHVybiAwOw0KKyAgICAgICAgfQ0KKyAgICAgICAgLyogIG5ldyBhZGQgZW5kICovDQorDQorICAgICAgICBpZiAocmF0ZSA9PSA4MDAwKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIFNMSUNfUENNX1NldF9OQigpOw0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19aaW1zcGx1c1Byb2M6IFNMSUNfUENNX1NldF9OQiA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgU0xJQ19TdGFydF9QQ00oKTsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfWmltc3BsdXNQcm9jOiBTTElDX1N0YXJ0X1BDTSA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICB9DQorICAgICAgICBlbHNlIGlmIChyYXRlID09IDE2MDAwKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIFNMSUNfUENNX1NldF9XQigpOw0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19aaW1zcGx1c1Byb2M6IFNMSUNfUENNX1NldF9XQiA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgU0xJQ19TdGFydF9QQ00oKTsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfWmltc3BsdXNQcm9jOiBTTElDX1N0YXJ0X1BDTSA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICB9DQorICAgIH0NCisgICAgZWxzZSBpZiAoYWN0ID09IDIpLy+52LHVcG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UUkxfTE9DQUwsDQorCSAgICAgICAgICAgIE1PRFVMRV9JRF9BVF9DVEwsDQorCSAgICAgICAgICAgIE1TR19DTURfU0VUX1ZQTE9PUF9SRVEsDQorCSAgICAgICAgICAgIDAsDQorCSAgICAgICAgICAgIE5VTEwsDQorCSAgICAgICAgICAgIDApOw0KKw0KKwkgICAgICAgIHpDY19TaG93QWxsU2xhdmVXaXRoVGlwcygidGVzdENhbGwtZW5kIik7DQorCQkJYnJlYWs7DQorICAgICAgICB9DQorDQorICAgICAgICBpbmNvbWluZ19jYWxsX2NpZCA9IHpDY19maW5kX2hlbGRfaW5jb21pbmdfY2lkKCk7DQorICAgICAgICBjY2FwcF9sb2coImluY29taW5nX2NhbGxfY2lkPSVkIGlzX2NpZGN3PSVkIiwNCisgICAgICAgICAgICBpbmNvbWluZ19jYWxsX2NpZCwgDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW2luY29taW5nX2NhbGxfY2lkXS5pc19jaWRjdyk7DQorICAgICAgICAgICAgDQorICAgICAgICBpZih6Q2NfZmluZF9oZWxkX2NpZCgpKQ0KKyAgICAgICAgew0KKwkJCXpDY19TZW5kQXRDaGxkUmVxKDEpOw0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZSBpZihpbmNvbWluZ19jYWxsX2NpZCkNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbaW5jb21pbmdfY2FsbF9jaWRdLmlzX2NpZGN3ID09IFRSVUUpDQorICAgICAgICAgICAgICAgIHpDY19TZW5kQXRDaGxkUmVxKDEpOw0KKyAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwucmluZ0NpZCkNCisgICAgCSAgICAgICAgew0KKyAgICAJICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmV2dFtnX0NjX0NhbGxEZXRhaWwucmluZ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FsbERldGFpbC5sYXN0VG9uZSA9PSBaQ0NfVE9ORV9CU1lfQSkgfHwgKGdfQ2NfQ2FsbERldGFpbC5sYXN0VG9uZSA9PSBaQ0NfVE9ORV9US1lfQSkpLy/DptL0us3D+bq/0vSjrLK7tKbA7bC0vPzP+8+iDQorICAgICAgICB7DQorICAgICAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgICAgICBjYWxsQ250ID0gekNjX0NhbGxDb3VudCgpOw0KKyAgICAgICAgaWYgKCAoZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSB8fCBjYWxsQ250ID09IHpDY19IZWxkQ2FsbCgpKSAvL9a709Cxo7PWuvS90KOssqa6xbeixvDQwrr0vdANCisgICAgICAgICAgICAmJiBnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdICE9IFpDQ19GTEFTSF9TSUdODQorICAgICAgICAgICAgJiYgMCA9PSB6Q2NfQWN0aXZlQ2FsbCgpKS8vt8WyprrF0vS78tLR09Cxo7PWuvS90Mqx08O7p7KmusUstdrSu7j219a3+6OsxcWz/WFjdGl2ZStoZWxkyrHPwreiRjINCisgICAgICAgIHsgICAgICAgICAgICANCisgICAgICAgICAgICBzbGF2ZSA9IHpDY19HZXRTcGVjU2xhdmUoWkNDX1NfSURMRV9TKTsNCisgICAgICAgICAgICBpZiAoMCA9PSBzbGF2ZSApDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm47DQorICAgICAgICAgICAgfSAgICAgICAgDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXSA9IGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialswXTsNCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuZXZ0W3NsYXZlXSA9IFpDQ19EVE1GX0U7DQorICAgICAgICAgICAgc2NfdGltZXJfZGVs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uZSA9PSBaQ0NfVE9ORV9DSURDV19BKSkvL2FjdGl2ZSt3YWl0aW5nK2ZsYXNob3JkdG1mDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBzY190aW1lcl9kZWxldGUoWkNDQVBQX1RJTUVSX1NTRElBTFRPTkVfREVURUNUKTsgICAgIA0KKyAgICAgICAgICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1swXSAhPSBaQ0NfRkxBU0hfU0lHTikNCisgICAgICAgICAgICAgICAgeyAgICAgICAgICAgICANCisgICAgICAgICAgICAgICAgICAgIHNsYXZlID0gekNjX0dldFNwZWNTbGF2ZShaQ0NfU19UQUxLSU5HX1MpOw0KKyAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gc2xhdmUgKQ0KKyAgICAgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsNCisgICAgICAgICAgICAgICAgICAgIH0gICAgICAgIA0KKyAgICAgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmV2dFtzbGF2ZV0gPSBaQ0NfRFRNRl9FOw0KKyAgICAgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGUgWkNDX0RUTUZfRSBcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgICAgICB9ICAgICAgICANCisgICAgICAgICAgICB9ICANCisNCisgICAgICAgICAgICBzY190aW1lcl9kZWxldGUoWkNDQVBQX1RJTUVSX0RUTUZfREVURUNUKTsNCisgICAgICAgICAgICByZXQgPSB6Q2NfRGlnaXRzTWF0Y2goKTsNCisgICAgICAgICAgICBpZiAoKFpDQ19OT19SRVNVTFQgIT0gcmV0ICYmIFpDQ19NQVRDSEVSUiAhPSByZXQgJiYgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSkNCisgICAgICAgICAgICAgIHx8KFpDQ19NQVRDSEVSUiA9PSByZXQgJiYgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSAmJiAyIDw9IHpDY19DYWxsQ291bnQoKSkpDQorICAgICAgICAgICAgey8vY2FsbCB3YWl0aW5nytW1vWZsYXNoNKOszaPWubKmusXS9LvWuLS69L3Qtci0/dL0DQorICAgICAgICAgICAgICAgIFNMSUNfU3RvcF9TaWduYWwoMCwgVE9ORV9TSUdOQUwpOw0KKyAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6IFNMSUNfU3RvcF9TaWduYWwgPC0tLVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwubGFzdFRvbmUgPSBaQ0NfVE9ORV9PRkZfQTsNCisgICAgICAgICAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialswXS50b25lICE9IFpDQ19UT05FX09GRl9BKQ0KKyAgICAgICAgICAgICAgICB7ICAgICAgICAgICAgICAgICAgIA0KKyAgICAgICAgICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaigwKTsNCisgICAgICAgICAgICAgICAgfSAgDQorICAgICAgICAgICAgICAgIGlmICgwICE9IHpDY19BY3RpdmVDYWxsKCkpDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIFNMSUNfU3RhcnRfUENNKCk7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgaWYgKChaQ0NfRkxBU0hfMSA9PSByZXQgfHwgWkNDX0ZMQVNIXzIgPT0gcmV0KSAmJiAoZ19DY19DYWxsRGV0YWlsLnJpbmdDaWQgIT0gMCkpLy+908z9d2FpdGluZyBjYWxso6y69L3Qtci0/dL006bH5b/VDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtnX0NjX0NhbGxEZXRhaWwucmluZ0NpZF0udG9uZSA9IFpDQ19UT05FX09GRl9BOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgfSANCisgICAgICAgICAgICB6Q2NfRGlnaXRzTWF0Y2hSbHRQcm9jKHJldCk7DQorICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGUgWkNDX0RUTUZfRSBcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgYnJlYWs7DQorDQorICAgIGNhc2UgWkNDX1NESUFMTElOR19FOiAvLyC3orP2wctTSVAgSU5WSVRFILvyIENDIFNFVFVQICwgzai5/dXiuPbP+8+iyc+xqCBjaWQNCisgICAgICAgIGlmICgwICE9IHpDY19HZXREaWFsaW5nU2xhdmUoMCkpDQorICAgICAgICB7DQorICAgICAgICAgICAgdG1wc2xhdmUgPSB6Q2NfR2V0RGlhbGluZ1NsYXZlKDApOw0KKyAgICAgICAgICAgIGlmICh0bXBzbGF2ZSAhPSBzbGF2ZSkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0gPSAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3RtcHNsYXZlXTsNCisgICAgICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaih0bXBzbGF2ZSk7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgYnJlYWs7DQorDQorICAgIGNhc2UgWkNDX1NSSU5HX0U6DQorICAgIGNhc2UgWkNDX1NBTlNfRToNCisgICAgY2FzZSBa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musXS9LXEc2xhdmUwIMflv9UNCisgICAgICAgIHpDY19DbGVhckRpZ2l0cygpOyAgICAgIA0KKyAgICAgICAgaWYgKDEgPT0gekNjX0NhbGxDb3VudCgpIA0KKyAgICAgICAgICAgICYmIChnX0NjX0NhbGxEZXRhaWwubGFzdFRvbmUgPT0gWkNDX1RPTkVfRElBTF9BKSkvL7Wxx7DWu9PQ0rvCt6OszaPWubKmusXS9A0KKyAgICAgICAgeyAgICAgICAgICAgICAgICANCisgICAgICAgICAgICBTTElDX1N0b3BfU2lnbmFsKDAsMCk7DQorICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTogU0xJQ19TdG9wX1NpZ25hbCA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID0gWkNDX1RPTkVfT0ZGX0E7DQorICAgICAgICAgICAgaWYgKDEgPT0gekNjX0hlbGRDYWxsKCkpLy/S0bGjs9ajrLvWuLQNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNobGRyZXQgPSB6Q2NfU2VuZEF0Q2hsZFJlcSgyKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZiAoMCAhPSB6Q2NfQWN0aXZlQ2FsbCgpKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgU0xJQ19TdGFydF9QQ00oKTsNCisgICAgICAgICAgICB9DQorICAgICAgICB9DQorICAgICAgICBlbHNlIGlmICgxIDwgekNjX0NhbGxDb3VudCgpICYmIChnX0NjX0NhbGxEZXRhaWwubGFzdFRvbmUgPT0gWkNDX1RPTkVfRElBTF9BKSkvL2FjdGl2ZS9oZWxkIG1wdHkgYW5kIGhlbGQrd2FpdGluZw0KKyAgICAgICAgeyAgICAgICAgICAgIA0KKyAgICAgICAgICAgIFNMSUN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TSUdOKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaigwKTsNCisgICAgICAgICAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7ICAgICAgDQorICAgICAgICAgICAgICAgIFNMSUNfU3RvcF9TaWduYWwoMCwwKTsNCisgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX01TZWl6ZVN0YXRlOiBTTElDX1N0b3BfU2lnbmFsIDwtLS1cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID0gWkNDX1RPTkVfT0ZGX0E7DQorICAgICAgICAgICAgICAgIGlmICgwICE9IHpDY19BY3RpdmVDYWxsKCkpDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIFNMSUNfU3RhcnRfUENNKCk7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbZ19DY19DYWxsRGV0YWlsLmRDb3VudCsrXSA9IFpDQ19GTEFTSF9TSUdOOw0KKyAgICAgICAgICAgIC8vIHNsYXZlWzBdIHRvIHBsYXkgZGlhbCB0b25lDQorICAgICAgICAgICAgIHNjX3RpbWVyX2NyZWF0ZShaQ0NBUFBfVElNRVJfU1NESUFMVE9ORV9ERVRFQ1QsDQorICAgICAgICAgICAgICAgICAwLA0KKyAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0hPT0tPRkZfSU5URVJWQUwsDQorICAgICAgICAgICAgICAgICB6Q2NBcHBfU3NEaWFsVG9uZVRpbWVyLA0KKyAgICAgICAgICAgICAgICAgTlVMTCk7ICANCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElOR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RJT05fXyk7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNobGRyZXQgPSB6Q2NfU2VuZEF0Q2hsZFJlcSgyKTsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6WkNDX0ZMQVNIX0VcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwud2FpdGNobGRyZXN1bHQgPSAxOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgaWYgKHpDY19IZWxkQ2FsbCgpID09IGNhbGxDbnQpIC8v1rvT0GhlbGQgY2FsbKOsu9a4tA0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGlmIChjYWxsQ250ID09IDEgKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2hsZHJldCA9IHpDY19TZW5kQXRDaGxkUmVxKDIpOw0KKyAgICAgICAgICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTpaQ0NfRkxBU0hfRVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuZGlnaXRzW2dfQ2NfQ2FsbERldGFpbC5kQ291bnQrK10gPSBaQ0NfRkxBU0hfU0lHTjsNCisgICAgICAgICAgICAgICAgc2NfdGltZXJfY3JlYXRlKFpDQ0FQUF9USU1FUl9TU0RJQUxUT05FX0RFVEVDVCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFpDQ0FQUF9USU1FUl9IT09LT0ZGX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpDY0FwcF9Tc0RpYWxUb25lVGltZXIsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7ICAgDQorICAgICAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX01TZWl6ZVN0YXRlOnNjX3RpbWVyX2NyZWF0ZSB6Q2NBcHBfU3NEaWFsVG9uZVRpbWVyXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5ldnRbMF0gPSBaQ0NfRElBTF9FOw0KKyAgICAgICAgICAgICAgICANCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgICAgICAvL2FjdGl2ZSArIGhlbGQNCisNCisgICAgICAgIGlmKGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbMF0gPT0gWkNDX0ZMQVNIX1NJR04pDQorICAgICAgICB7DQorICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaigwKTsNCisgICAgICAgICAgICB6Q2NfQ2xlYXJEaWdpdHMoKTsgICAgICANCisgICAgICAgICAgICBTTElDX1N0b3BfU2lnbmFsKDAsMCk7DQorICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTogU0xJQ19TdG9wX1NpZ25hbCA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID0gWkNDX1RPTkVfT0ZGX0E7DQorICAgICAgICAgICAgaWYgKDAgIT0gekNjX0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nVmLT5hdWNEYXRhQnVmKS0+cmVzdWx0ID09IDApDQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBzbGF2ZSA9IHpDY19HZXREaWFsaW5nU2xhdmUoMSk7DQorICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19TZW5kQXREaWFsUmVxOlJFQ1YgRVJST1JcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIHNsYXZlID0gekNjX0dldERpYWxpbmdTbGF2ZSgxKTsNCisgICAgICAgIGlmICgxID09IHpDY19CdXN5VG9uZUFsbG93ZWQoKSAmJiBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLndhaXREU0NJNiA9PSAwICYmIGdfQ2NfQ2FsbERldGFpbC5zdGF0ZSA9PSBaQ0NfTV9TRUlaRV9TKS8v09DG5Mv7uvS90MfS0tG50rv6yrGyu7fFw6bS9A0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHNjX3RpbWVyX2NyZWF0ZShaQ0NBUFBfVElNRVJfQlVTWVRPTkVfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgICAgIDAsDQorICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0JVU1lUT05FX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgIHpDY0FwcF9CdXN5VG9uZVRpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOyAgDQorICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfU2VuZEF0RGlhbFJlcSBzY190aW1lcl9jcmVhdGUgekNjQXBwX0J1c3lUb25lVGltZXJcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnRvb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kZfSU5URVJWQUwsDQorICAgICAgICAgICAgICAgICAgICAgekNjQXBwX1NzRGlhbFRvbmVUaW1lciwNCisgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgICANCisgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6c2NfdGltZXJfY3JlYXRlIHpDY0FwcF9Tc0RpYWxUb25lVGltZXJcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmV2dFswXSA9IFpDQ19ESUFMX0U7DQorICAgICAgICAgICAgICAgIFNMSUNfU3RvcF9QQ00oKTsgDQorICAgICAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX01TZWl6ZVN0YXRlOlNMSUNfU3RvcF9QQ01cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgYnJlYWs7DQorDQorICAgIGNhc2UgWkNDX1NFSVpFX0U6IC8vINWqu/oNCisgICAgZGVmYXVsdDoNCisgICAgICAgIC8vIGRvIG5vdGhpbmcNCisgICAgICAgIGJyZWFrOw0KKyAgICB9DQorfQ0KKw0KKw0KKy8vZ2V0IGxvY2FsIHRpbWUgc3RyaW5nICwgZm9ybWF0IllZWVktTU0tREQgSEg6TU06U1MiDQorY2hhciAqZ2V0X2xvY2FsX2RhdGVfdGltZSh2b2lkKQ0KK3sNCisJdGltZV90IG5vdzsNCisJc3RydWN0IHRtICp0aW1lbm93Ow0KKwlzdGF0aWMgY2hhciBsb2NhbHRpbWVzdHJbMzJdOw0KKwkNCisJdGltZSgmbm93KTsNCisJdGltZW5vdyA9IGxvY2FsdGltZSgmbm93KTsNCisJbWVtc2V0KGxvY2FsdGltZXN0ci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2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc01zZyE9WkNDX1NOT19NKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHpDY19DaGVja1NsYXZlU3RhdGUoImluIHNsYXZlT2JqW3NsYXZlXS5zTXNnIik7DQorICAgICAgICAgICAgY2NhcHBfbG9nKCJnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbJWRdLnNNc2c9JWQiLCANCisgICAgICAgICAgICAgICAgc2xhdmUsIA0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2cpOw0KKyAgICAgICAgfQ0KKyAgICAgICAgDQorICAgICAgICBzd2l0Y2ggKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc01zZykNCisgICAgICAgIHsNCisgICAgICAgIGNhc2UgWkNDX1NJTlZfTToNCisgICAgICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zdGF0ZSA9PSBaQ0NfU19JRExFX1MpLy9zcw0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgekNjX1NlbmRTc1JlcShnX0NjX0NhbGxEZXRhaWwuZGlnaXRzKTsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS50b25lID0gWkNDX1RPTkVfT0ZGX0E7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHpDY19TZW5kQXREaWFsUmVxKGdfQ2NfQ2FsbERldGFpbC5kaWdpdHMpOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2cgPSBaQ0NfU05PX007DQorICAgICAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7DQorICAgICAgICAgICAgYnJlYWs7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fQ2FsbERldGFpbC5udW1iZXIpKTsNCisJCQkJc3RybmNweSh0U2lnLmNpZCwgZ19DY19DYWxsRGV0YWlsLm51bWJlciwgc2l6ZW9mKHRTaWcuY2lkKS0xKTsNCisgICAgICAgICAgICAgICAgZ2V0X2xvY2FsX2RhdGV0aW1lKHRTaWcuZGF0ZV90aW1lKTsNCisgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfUnVuTWFzdGVyIFJJTkdfU0lHTkFMLG51bWJlciA9ICVzXG4iLF9fRlVOQ1RJT05fXyxnX0NjX0NhbGxEZXRhaWwubnVtYmVyKTsNCisgICAgICAgICAgICAgICAgU0xJQ19QbGF5X1NpZ25hbCgwLCAwLCAmdFNpZyk7ICANCisgICAgICAgICAgICAgICAgekNjX1NldExlZFN0YXR1cygibGVkYmxpbmsiKTsNCisgICAgICAgICAgICB9ICAgICAgICANCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2cgPSBaQ0NfU05PX007DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19TQU5TX006Ly/KssO0s6G+sD8NCisgICAgICAgICAgICBpZiAoekNjX0NhbGxDb3VudCgpID09IDEpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBTTElDX1N0b3BfU2lnbmFsKDAsIFRPTkVfU0lHTkFMKTsNCisgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgOiBTTElDX1N0b3BfU2lnbmFsIDwtLS1cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID0gWkNDX1RPTkVfT0ZGX0E7DQorICAgICAgICAgICAgfSAgICAgICAgICAgIA0KKyAgICAg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kvLyBsZXQgd2hpbGUoMSkgcnVuIG9uZSBtb3JlIHRpbWUNCisJICAgICAgICAgICAgICAgIG1zZ0J1ZmYudXNNc2dDbWQgICA9IFpDQ19BU1NJU1RfTVNHX0U7DQorCSAgICAgICAgICAgICAgICBtc2dCdWZmLnNyY19pZCA9IE1PRFVMRV9JRF9TTElDOw0KKwkgICAgICAgICAgICAgICAgekNjX1NlbmRNc2dUb1N1YigmbXNnQnVmZik7DQorDQorCSAgICAgICAgICAgICAgICBjY2FwcF9sb2coInNlbmRNc2cgWkNDX0FTU0lTVF9NU0dfRSIpOyAqLw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICAgICAgew0KKwkJCQkJekNjX2h1bmd1cF9hbGwoc2xhdmUpOw0KKyAgICAgICAgICAgICAgICB9DQorCQkJfQ0KKwkJCWVsc2UNCisgICAgICAgIAl7DQorCSAgICAgICAgICAgIHpDY19odW5ndXBfYWxsKHNsYXZlKTsgDQorCSAgICAgICAJfSAgICAgDQorDQorCSAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zTXNnID0gWkNDX1NOT19NOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgZGVmYXVsdDoNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgfQ0KKw0KKyAgICBpZiAoZ19DY19DYWxsRGV0YWlsLnN0YXRlID09IFpDQ19NX1JJTkdJTkdfUyANCisgICAgICAgICYmIGdfQ2NfQ2FsbERldGFpbC5yaW5nQ2lkID09IDANCisgICAgICAgICYmIHpDY19maW5kX2hlbGRfY2lkKCk9PTAgDQorICAgICAgICAmJiB6Q2NfZmluZF9oZWxkX2luY29taW5nX2NpZCgpPT0wDQorICAgICAgICAmJiBsb2NhbF90ZXN0X2NhbGxfc3Q9PTApDQorICAgIHsNCisgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zdGF0ZSA9IFpDQ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gICAgICAgICAgICAgICAgICAgICAgICAgMCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0hPT0tPRkZfSU5URVJWQUwsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpDY0FwcF9Ib29rT2ZmVGltZXIsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOyAgDQorICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX1NJZGxlU3RhdGUgc2NfdGltZXJfY3JlYXRlIHpDY0FwcF9Ib29rT2ZmVGltZXJcbiIsX19GVU5DVElPTl9fKTsNCisNCisJCQlnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLmlkbGVfc2Vjb25kID0gMDsNCisgICAgICAgICAgICBzY190aW1lcl9jcmVhdGUoWkNDQVBQX1RJTUVSX0hPT0tPRkZfSURMRSwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVElNRVJfRkxBR19SRVNUQVJULA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBaQ0NBUFBfVElNRVJfSE9PS09GRl9JRExFX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NBcHBfSG9va09mZl9JZGxlX1RpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgIA0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19TSWRsZVN0YXRlIHNjX3RpbWVyX2NyZWF0ZSB6Q2NBcHBfSG9va09mZl9JZGxlX1RpbWVyXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICB9DQorICAgICAgICBicmVhazsNCisgICAgY2FzZSBaQ0NfRFRNRl9FOi8vaGVsZCtkYWlsaW5nDQorICAgICAgICBpZiAoIDAgIT0gekNjX0hlbGRDYWxsKCkgJiYgMCA9PSB6Q2NfQWN0aXZlQ2FsbCgpKQ0KKyAgICAgICAgeyAgICANCisgICAgICAgICAgICBzY190aW1lcl9kZWxldGUoWkNDQVBQX1RJTUVSX1NTRElBTFRPTkVfREVURUNUKTsgICAgICAgICAgICANCisgICAgICAgICAgICBzY190aW1lcl9jcmVhdGUoWkNDQVBQX1RJTUVSX0RUTUZfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgICAgIDAsDQorICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0RUTUZfSU5URVJWQUwsDQorICAgICAgICAgICAgICAgICAgICAgICAgekNjQXBwX0R0bWZUaW1lciwNCisgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgIA0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19TSWRsZVN0YXRlIHNjX3RpbWVyX2NyZWF0ZSB6Q2NBcHBfRHRtZlRpbWVyXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS50b25lID0gWkNDX1RPTkVfU0lMX0E7ICAgICAgICAgIA0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc3RhdGUgPSBaQ0NfU19EQUNDTV9TOw0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19TSWRsZVN0YXRlIGhhbmRsaW5nIFpDQ19EVE1GX0VcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIH0NCisgICAgICAgIGJyZWFrOw0KKyAgICBjYXNlIFpDQ19DSURDV19FOg0KKyAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS50b25lID0gWkNDX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MCwNCisgICAgICAgICAgICAgICAgICAgICAgICBaQ0NBUFBfVElNRVJfQlVTWVRPTkVfSU5URVJWQUwsDQorICAgICAgICAgICAgICAgICAgICAgICAgekNjQXBwX0J1c3lUb25lVGltZXIsDQorICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7ICANCisgICAgICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19TRGlhbGluZ1N0YXRlIHNjX3RpbWVyX2NyZWF0ZSB6Q2NBcHBfQnVzeVRvbmVUaW1lclxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0udG9uZSA9IFpDQ19UT05FX0JTWV9BOw0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc3RhdGUgPSBaQ0NfU19CU1lUX1M7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5jb25mY2FsbCA9IDA7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5oZWxkY2FsbCA9IDA7DQorICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7ICAgICAgICAgICANCisgICAgICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKHNsYXZlKTsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfSW5pdFNsYXZlT2JqOiBzbGF2ZU9ialslZF0gY2xlYXJlZFxuIixfX0ZVTkNUSU9OX18sIHNsYXZlKTsNCisgICAgICAgIH0NCisgICAgICAgIHJldHVybjsNCisgICAgY2FzZSBaQ0NfU0RJU0NOX01UX0U6DQorICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKHNsY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ZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19Jbml0U2xhdmVPYmo6IHNsYXZlT2JqWyVkXSBjbGVhcmVkXG4iLF9fRlVOQ1RJT05fXywgc2xhdmUpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgfSAgICAgICAgICAgICANCisgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbMF0udG9uZSAhPSBaQ0NfVE9ORV9PRkZfQSkNCisgICAgICAgIHsgICAgICAgICAgICAgICAgICAgDQorICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaigwKTsNCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KKyAgICAgICAgaWYgKDEgPT0gekNjX0J1c3lUb25lQWxsb3dlZCgpICYmIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0ud2FpdERTQ0k2ID09IDApLy/T0Mbky/u69L3QyrGyu7fFw6bS9A0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHNjX3RpbWVyX2NyZWF0ZShaQ0NBUFBfVElNRVJfQlVTWVRPTkVfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgICAgIDAsDQorICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0JVU1lUT05FX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgIHpDY0FwcF9CdXN5VG9uZVRpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOyAgDQorICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfU1RhbGtpbmdTdGF0ZSBzY190aW1lcl9jcmVhdGUgekNjQXBwX0J1c3lUb25lVGltZXJcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2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