ZGlmZiAtLWdpdCBhL2FwL2FwcC9jY2FwcC9jY19wcm9jLmMgYi9hcC9hcHAvY2NhcHAvY2NfcHJvYy5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjFiYjI5YTMKLS0tIC9kZXYvbnVsbAorKysgYi9hcC9hcHAvY2NhcHAvY2NfcHJvYy5jCkBAIC0wLDAgKzEsMzg4OSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorKg0KKyogICAgICAgICAgICAgICAgICBDb3B5cmlnaHQgKGMpIDIwMTMgWlRFIENvcnBvcmF0aW9uLg0KKyoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqIMSjIL/pIMP7IDogQ2NBcHANCisqIM7EILz+IMP7IDogYXRfcHJvYy5jDQorKiDP4LnYzsS8/iA6DQorKiDKtc/WuabE3CA6IEFUw/zB7reiy826zb3hufu0psDtxKO/6bqvyv22qNLlDQorKiDX9yAgICDV3yA6IHN5eA0KKyogsOYgICAgsb4gOiBWMS4wDQorKiDN6rPJyNXG2iA6IDIwMTMtMDEtMDUNCisqIMbky/zLtcP3IDoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqINDeuMS8x8K8IDoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorKiDQ3rjEseC6xSA6IDAwMDENCisqINDeILjEIMjLIDoNCisqINDeuMTI1cbaIDoNCisqINDeuMTE2sjdIDoNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqICNpbmNsdWRlx/gNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisjaW5jbHVkZSAiY2NfbWFpbi5oIg0KKyNpbmNsdWRlICJjY19wcm9jLmgiDQorI2luY2x1ZGUgImNjX2NvbS5oIg0KKyNpbmNsdWRlICJjY19hdC5oIg0KKyNpbmNsdWRlICJjY190aW1lci5oIg0KKyNpbmNsdWRlICJzdHJpbmcuaCINCisjaWZkZWYgVEVTVF9DQ0FQUA0KKyNpbmNsdWRlICJzb2Z0X3RpbWVyLmgiDQorI2VuZGlmDQorDQorI2luY2x1ZGUgInNsaWNfaW5mLmgiDQorI2luY2x1ZGUgPHN0ZGludC5oPg0KKyNpbmNsdWRlIDxsaW51eC92b2x0ZV9kcnYuaD4NCisjaW5jbHVkZSAidm9pY2VfbGliLmgiDQorDQorI2RlZmluZSBMT0NBTF9URVNUX0NBTExfQ09ERSAiKiM2NiojIg0KKyNkZWZpbmUgVFpfVEVTVF9USU1JTkcgIiojODM3ODEyMzQqIyINCit0eXBlZGVmIGVudW17DQorCUxvY2FsVGVzdENhbGxTVF9Ob25lID0gMCwNCisJTG9jYWxUZXN0Q2FsbFNUX1N0YXJ0LA0KKwlMb2NhbFRlc3RDYWxsU1RfUmluZywNCisJTG9jYWxUZXN0Q2FsbFNUX0VuZA0KK31lTG9jYWxUZXN0Q2FsbFNUOw0KK2ludCBsb2NhbF90ZXN0X2NhbGxfc3QgPSAwOw0KK3R5cGVkZWYgZW51bXsNCisJTG9jYWxUZXN0Q2FsbFR5cGVfTm9uZSA9IDAsDQorCUxvY2FsVGVzdENhbGxUeXBlX0xPT1ANCit9ZUxvY2FsVGVzdENhbGxUeXBlOw0KK2ludCBsb2NhbF90ZXN0X2NhbGxfdHlwZSA9IDA7DQorDQorZXh0ZXJuIFNJTlQzMiBnX3pDY19BdFJzcElkOw0KKw0KK2ludCB6Q2NfZmluZF9oZWxkX2NpZCh2b2lkKTsNCitpbnQgekNjX2ZpbmRfaGVsZF9pbmNvbWluZ19jaWQodm9pZCk7DQoraW50IHpDY19maW5kX2FsbF9jYWxsb3V0KGludCBzbGF2ZVtaQ0NfU0xBVkVTXSk7DQoraW50IHpDY190YWxraW5nX2NvdW50KHZvaWQpOw0KK2NoYXIgKmdldF9sb2NhbF9kYXRlX3RpbWUodm9pZCk7DQorY2hhciAqZ2V0X2xvY2FsX2RhdGV0aW1lKGNoYXIgKmJ1ZmYpOw0KKw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyogs6PBv7ao0uXH+A0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KKw0KKy8qICB7DQorICAgIFpDQ19TX0lETEVfUyAgICAgICAgPSAwLA0KKyAgICBaQ0NfU19EVF9TICAgICAgICAgICAsDQorICAgIFpDQ19TX0RBQ0NNX1MgICAgLA0KKyAgICBaQ0NfU19ESUFMSU5HX1MgICwNCisgICAgWkNDX1NfUklOR0JBQ0tfUyAgICwvLyDW973Quf2zzNbQtcTV8cHlzKwNCisgICAgWkNDX1NfQlNZVF9TICAgICAgICwNCisgICAgWkNDX1NfVEtZVF9TICAgICAgICwNCisgICAgWkNDX1NfU0lMX1MgICAgICAgICwNCisgICAgWkNDX1NfVEFMS0lOR19TICAgICwNCisgICAgWkNDX1NfVFJZSU5HX1MgICAgICwNCisgICAgWkNDX1NfV0FJVF9SRVNPVVJDRV9TICwNCit9ICovDQorY29uc3QgcENjU2xhdmVGc21GdW5jIHpDY1NsYXZlRnNtRnVuY1tdID0ge3pDY19TSWRsZVN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NEdFN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NEYWNjbVN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NEaWFsaW5nU3RhdGUsIA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NfU1JpbmdiYWNrU3RhdGUsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpDY19TQnN5VG9uZVN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NUa3l0U3RhdGUsIA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NfU1NpbFN0YXRlLCANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjX1NUYWxraW5nU3RhdGUsIA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NfU1RyeWluZ1N0YXRlLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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gICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0ud2FpdERTQ0k2ID09IDApDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzbGF2ZTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm4gc2xhdmU7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIHJldHVybiAwOw0KK30NCisNCitVSU5UOCB6Q2NfR2V0RGlzY1NsYXZlKFVJTlQ4IHN0YXRlKQ0KK3sNCisgICAgVUlOVDggICBzbGF2ZSA9IDA7DQorICAgIFVJTlQ4ICAgY250ID0gMDsNCisNCisgICAgZm9yIChzbGF2ZSA9IDE7IHNsYXZlIDwgWkNDX1NMQVZFUzsgc2xhdmUrKykgLy8gc2xhdmVbMF0gsru/ycTcDQorICAgIHsNCisgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2c9PSBaQ0NfU0RJU0NOX00gJiYgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS53YWl0RFNDSTYgPT0gMCkNCisgICAgICAgIHsNCisgICAgICAgICAgICAgY250Kys7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIGNudDsNCit9DQorDQorDQoraW50ICB0el9sb2NrX2NlbGxpZF9pc19saW1pdF9jYWxsaW4oKQ0KK3sNCisJY2hhciBjZWxsaWRfaXNfbG9ja1s0XSA9IHswfTsNCisNCisJY2ZnX2dldF9pdGVtKCJjZWxsaWRfaXNfbG9jayIsY2VsbGlkX2lzX2xvY2ssc2l6ZW9mKGNlbGxpZF9pc19sb2NrKSk7DQorCWlmKHN0cmNtcChjZWxsaWRfaXNfbG9jaywgIjEiKSA9PSAwKQkNCisJCXJldHVybiA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MF0gPD0gJzknKQ0KKyAgICB7DQorICAgIAkvL2NjYXBwX2xvZygiNSIpOw0KKyAgICAgICAgcmV0dXJuIChnX0NjX0NhbGxEZXRhaWwuZGlnaXRzW2dfQ2NfQ2FsbERldGFpbC5kQ291bnQtMV0gPT0gJyMnDQorICAgICAgICAgICAgICAgIHx8IGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbZ19DY19DYWxsRGV0YWlsLmRDb3VudC0xXSA9PSBaQ0NfVElNRU9VVF9TSUdODQorICAgICAgICAgICAgICAgIHx8IGdfQ2NfQ2FsbERldGFpbC5kQ291bnQgPT0gWkRJQUxfTlVNX01BWCkgID8gWkNDX0NBTEwgOiBaQ0NfTk9fUkVTVUxUOw0KKyAgICB9DQorDQorICAgIC8vY2NhcHBfbG9nKCI2Iik7DQorICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdID09IFpDQ19GTEFTSF9TSUdOKSAvL9bBydnT0DLCt7r0vdDByw0KKyAgICB7DQorICAgICAgICBzd2l0Y2ggKGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbMV0pDQorICAgICAgICB7DQorICAgICAgICBjYXNlICcwJzoNCisgICAgICAgICAgICByZXR1cm4gWkNDX0ZMQVNIXzA7DQorICAgICAgICBjYXNlICcxJzoNCisgICAgICAgICAgICByZXR1cm4gWkNDX0ZMQVNIXzE7DQorICAgICAgICBjYXNlICcyJzoNCisgICAgICAgIGNhc2UgWkNDX1RJTUVPVVRfU0lHTjoNCisgICAgICAgICAgICByZXR1cm4gWkNDX0ZMQVNIXzI7DQorICAgICAgICBjYXNlICczJzoNCisgICAgICAgICAgICByZXR1cm4gWkNDX0ZMQVNIXzM7DQorICAgICAgICBjYXNlICc0JzoNCisgICAgICAgICAgICByZXR1cm4gWkNDX0ZMQVNIXzQ7ICAgIA0KKyAgICAgICAgZGVmYXVsdDoNCisgICAgICAgICAgICByZXR1cm4gWkNDX01BVENIRVJSOw0KKyAgICAgICAgfQ0KKyAgICB9DQorDQorICAgIC8qZm9yIChpID0gMDsgaTxzY1N1bTsgaSsrKQ0KKyAgICB7DQorICAgICAgICBpZiAoc3RybmNtcCgoQ0hBUiAqKWdfekNjX1NDVGFiW2ldLnNjLCAoQ0hBUiAqKWdfQ2NfQ2FsbERldGFpbC5kaWdpdHMsIA0KKyAgICAgICAgICAgIChVSU5UMzIpKHN0cmxlbihnX3pDY19TQ1RhYltpXS5zYyk8Z19DY19DYWxsRGV0YWlsLmRDb3VudCk/c3RybGVuKGdfekNjX1NDVGFiW2ldLnNjKTpnX0NjX0NhbGxEZXRhaWwuZENvdW50KSA9PSAwKQ0KKyAgICAgICAgeyANCisgICAgICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1tnX0NjX0NhbGxEZXRhaWwuZENvdW50LTFdID09ICcjJykNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHJldHVybiBnX3pDY19TQ1RhYltpXS5zY05hbWU7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuZENvdW50IDwgZ196Q2NfU0NUYWJbaV0uc2NNYXhMZW4pDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm4gWkNDX05PX1JFU1VMVDsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5kQ291bnQgPT0gZ196Q2NfU0NUYWJbaV0uc2NNYXhMZW4pDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm4gWkNDX01BVENIRVJSOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIH0NCisgICAgfSovDQorCQ0KKyAgICBpZihnX0NjX0NhbGxEZXRhaWwuZENvdW50Pj0yICYmIA0KKyAgICAJZ19DY19DYWxsRGV0YWlsLmRDb3VudDxaRElBTF9OVU1fTUFYICYmDQorICAgIAlnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdPT0nK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AgICAgICAgIHpDY0FwcF9EdG1mVGltZXIsDQorICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7ICAgICAgICAgICAgICAgICAgICANCisgICAgICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19EaWdpdHNNYXRjaFJsdFByb2MgQ3JlYXRlU29mdFRpbWVyIHpDY0FwcF9EdG1mVGltZXJcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICByZXR1cm47DQorICAgICAgICAgICAgDQorICAgICAgICBjYXNlIFpDQ19DQUxMOg0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc01zZyA9IFpDQ19TSU5WX007DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zdGF0ZSA9IFpDQ19TX0RJQUxJTkdfUzsNCisgICAgICAgICAgICBpZihnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdIT0nKicgJiYgKGRpZ2l0X21hcF9jYWxsKGdfQ2NfQ2FsbERldGFpbC5kaWdpdHMpPT0wKSkNCisgICAgICAgICAgICB7DQorCSAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbZ19DY19DYWxsRGV0YWlsLmRDb3VudC0xXSA9IDA7IA0KKwkgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuZENvdW50LS07DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIHN0cmNweShnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLm51bWJlciwgZ19DY19DYWxsRGV0YWlsLmRpZ2l0cyk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5pc19jYWxsb3V0ID0gVFJVRTsNCisgICAgICAgICAgICByZXR1cm47DQorICAgICAgICAgICAgDQorICAgICA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cSgwKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgICAgICANCisgICAgICAgIGNhc2UgWkNDX01BVENIRVJSOg0KKyAgICAgICAgICAgIGlmIChnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdICE9IFpDQ19GTEFTSF9TSUdOKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7DQorICAgICAgICAgICAgICAgIGlmICgxID09IHpDY19CdXN5VG9uZUFsbG93ZWQoKSAmJiBnX0NjX0NhbGxEZXRhaWwuc3RhdGUgPT0gWkNDX01fU0VJWkVfUykvL9PQxuTL+7r0vdDKsbK7t8XDptL0DQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIENyZWF0ZVNvZnRUaW1lcihaQ0NBUFBfVElNRVJfQlVTWVRPTkVfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFpDQ0FQUF9USU1FUl9CVVNZVE9ORV9JTlRFUlZBTCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpDY0FwcF9CdXN5VG9uZVRpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7ICAgICAgICAgICAgICANCisgICAgICAgICAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX0RpZ2l0c01hdGNoUmx0UHJvYyBDcmVhdGVTb2Z0VGltZXIgekNjQXBwX0J1c3lUb25lVGltZXJcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0udG9uZSA9IFpDQ19UT05FX0JTWV9BOw0KKyAgICAgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zdGF0ZSA9IFpDQ19TX0JTWVRfUzsNCisgICAgICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uY29uZmNhbGwgPSAwOw0KKyAgICAgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5oZWxkY2FsbCA9IDA7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgZWxzZQ0KKyAgICAgICAgICAgICAgICB7DQorICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX0luaXRTbGF2ZU9iajogc2xhdmVPYmpbJWRdIGNsZWFyZWRcbiIsX19GVU5DVElPTl9fLCBzbGF2ZSk7DQorICAgICAgICAgICAgICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKHNsYXZlKTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICByZXR1cm47DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgIA0KKyAgICAgICAgZGVmYXVsdDogDQorICAgICAgICAgICAgaWYgKHJldCA+PSBaQ0NfQkFPQ19SRUcgJiYgcmV0IDw9IFpDQ19DRkJfREVSRUcpLy8gU1Mgc2xhdmU9MQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zTXNnID0gWkNDX1NJTlZfTTsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zdGF0ZSA9IFpDQ19TX0lETEVfUzsvL7Hcw+K688PmudK7+rvht6LG8GNodXANCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgcmV0dXJuOw0KKyAgICAgICAgfSAgIA0KKw0KKyAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7DQorICAgICAgICAvL3pDY19Jbml0U2xhdmVPYmooc2xhdmUpOw0KK30NCisjaWYgMA0KK1ZPSUQgekNjX1ByZVByb2NSZXMoQ0hBUiAqcFBhcmFMaW5lKQ0KK3sNCisgICAgU0lOVDMyICBmbGcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSAwOw0KKyAgICBVSU5UMzIgIGkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IDA7DQorICAgIFVJTlQzMiAgbGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMDsNCisgICAgQ0hBUiAgICAqcFNvdXJjZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSBwUGFyYUxpbmU7DQorICAgIENIQVIgICAgKnBEZXN0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gTlVMTDsNCisNCisgICAgQ0hBUiAgICAqcFN0ckRlc3RNYWxsb2MgPSAoQ0hBUiAqKW1hbGxvYyhBVF9DTURfTUFYKTsNCisgICAgaWYgKE5VTEwgPT0gcFN0ckRlc3RNYWxsb2MpDQorICAgIHsNCisgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX1ByZVByb2NSZXM6IE1hbGxvYyBmYWlsZWQgISEhXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICByZXR1cm47DQorICAgIH0NCisgICAgbWVtc2V0KHBTdHJEZXN0TWFsbG9jLCAwLCBBVF9DTURfTUFYKTsgDQorDQorICAgIGFzc2VydChwUGFyYUxpbmUgIT0gTlVMTCk7DQorICAgIHBEZXN0ID0gcFN0ckRlc3RNYWxsb2M7DQorICAgIGxlbmd0aCA9IHN0cmxlbihwUGFyYUxpbmUpOw0KKyAgICBpZiAobGVuZ3RoID09IDAgfHwgbGVuZ3RoID49IFpBVF9NQVhfTEVOKQ0KKyAgICB7DQorICAgICAgICBmcmVlKHBTdHJEZXN0TWFsbG9jKTsNCisgICAgICAgIHJldHVybjsNCisgICAgfQ0KKyAgICBmb3IgKGkgPSAwOyAoaSA8IGxlbmd0aCApJiYgKHBEZXN0IC0gcFN0ckRlc3RNYWxsb2MgPCBBVF9DTURfTUFYKTsgaSsrKQ0KKyAgICB7DQorICAgICAgICBpZiAoJyInID09ICpwU291cmNlKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGZsZyA9ICgwID09IGZsZyk/MTowOyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIMur0v26xSDJvrP9ICAqLw0KKyAgICAgICAgICAgIGlmICgnIicgPT0gKihwU291cmNlICsgMSkpICAgICAgICAgICAgICAgICAgICAgIC8qINDHusW688PmvfS4+tDHusWjrLLlyOu/1bSu1bzOu7f7ICovDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAqcERlc3QrKyA9IChDSEFSKVpBVF9OVUxMX0ZJTEw7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZSBpZiAoKCcsJyA9PSAqcFNvdXJjZSkgJiYgKDAgPT0gZmxnKSkNCisgICAgICAgIHsNCisgICAgICAgICAgICAqcERlc3QrKyA9ICcgJzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiDLq9L9usXN4sPmtcS2urrFo6zM5ru7s8m/1bjxICovDQorICAgICAgICAgICAgaWYgKCcsJyA9PSAqKHBTb3VyY2UgKyAxKSkgICAgICAgICAgICAgICAgICAgICAgIC8qILa6usW688PmvfS4+ra6usWjrLvy1d/S1La6usW94c6yo6yy5cjrv9W0rtW8zru3+yAqLw0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgKnBEZXN0KysgPSAnOSc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL7GjwfSyzsr908M51N3KsbT6zOYNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZiAoJ1wwJyA9PSAqKHBTb3VyY2UgKyAxKSkgICAgICAgICAgICAgICAgIC8qILa6usW688PmvfS4+ra6usWjrLvy1d/S1La6usW94c6yo6yy5cjrv9W0rtW8zru3+yAqLw0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgKnBEZXN0KysgPSAoQ0hBUilaQVRfTlVMTF9GSUxMOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYgKCgnXHInID09ICpwU291cmNlKSB8fCgnXG4nID09ICpwU291cmNlKSkNCisgICAgICAgIHsNCisgICAgICAgICAgICBwU291cmNlKys7DQorICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7DQorICAgICAgICAgICAgKnBEZXN0KysgPSAoKCcgJyA9PSAqcFNvdXJjZSkgJiYgKDEgPT0gZmxnKSk/KENIQVIpWkFUX1NQQUNFX1JFUExBQ0U6KCgoJ1x0JyA9PSAqcFNvdXJjZSkgJiYgKDEgPT0gZmxnKSk/KENIQVIpWkFUX1RBQl9SRVBMQUNFOigqcFNvdXJjZSkpOw0KKyAgICAgICAgfQ0KKyAgICAgICAgcFNvdXJjZSsrOw0KKyAgICB9DQorDQorICAgIG1lbXNldChwUGFyYUxpbmUsIDAsIGxlbmd0aCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogvavUpLSmwO2687XExNrI3b+9sbS72LLOyv3Q0NbQICovDQorICAgIHN0cmNweShwUGFyYUxpbmUsIHBTdHJEZXN0TWFsbG9jKTsNCisgICAgZnJlZShwU3RyRGVzdE1hbGxvYyk7DQorfQ0KKyNlbmRpZg0KK1VJTlQ4IHpDY19DYWxsQ291bnQoVk9JRCkNCit7DQorICAgIFVJTlQ4ICAgc2xhdmUgPSAwLCBjbnQgPSAwOw0KKw0KKyAgICBmb3IgKHNsYXZlID0gMTsgc2xhdmUgPCBaQ0NfU0xBVkVTOyBzbGF2ZSsrKQ0KKyAgICB7DQorICAgIC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ZXEgdGNjZmNyZXEgPSB7MH07DQorDQorICAgIGZvciAoaSA9IDA7IGk8c2NTdW07IGkrKykNCisgICAgew0KKyAgICAgICAgaWYgKHN0cm5jbXAoKENIQVIgKilnX3pDY19TQ1RhYltpXS5zYywgKENIQVIgKilnX0NjX0NhbGxEZXRhaWwuZGlnaXRzLCANCisgICAgICAgICAgICAoVUlOVDMyKShzdHJsZW4oZ196Q2NfU0NUYWJbaV0uc2MpPGdfQ2NfQ2FsbERldGFpbC5kQ291bnQpP3N0cmxlbihnX3pDY19TQ1RhYltpXS5zYyk6Z19DY19DYWxsRGV0YWlsLmRDb3VudCkgPT0gMCkNCisgICAgICAgIHsNCisgICAgICAgICAgICBzY05hbWUgPSBnX3pDY19TQ1RhYltpXS5zY05hbWU7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgIH0NCisgICAgc3dpdGNoKHNjTmFtZSkNCisgICAgew0KKyAgICAgICAgY2FzZSBaQ0NfQkFPQ19SRUc6DQorICAgICAgICAgICAgc3NjYW5mKHBBdENtZFBhcmEsICIlKjVzJTRzIyIsIHB3KTsNCisgICAgICAgICAgICBwd1s0XSA9ICdcMCc7DQorICAgICAgICAgICAgdGNsY2tyZXEudHlwZSA9IDA7Ly9BTw0KKyAgICAgICAgICAgIHRjbGNrcmVxLmFjdCA9IDE7DQorICAgICAgICAgICAgc3RybmNweSh0Y2xja3JlcS5wdyxwdyxzaXplb2YodGNsY2tyZXEucHcpLTEpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgY2FzZSBaQ0NfQkFPQ19ERVJFRzoNCisgICAgICAgICAgICBzc2NhbmYocEF0Q21kUGFyYSwgIiUqNXMlNHMjIiwgcHcpOw0KKyAgICAgICAgICAgIHB3WzRdID0gJ1wwJzsNCisgICAgICAgICAgICB0Y2xja3JlcS50eXBlID0gMDsvL0FPDQorICAgICAgICAgICAgdGNsY2tyZXEuYWN0ID0gMDsNCisgICAgICAgICAgICBzdHJuY3B5KHRjbGNrcmVxLnB3LHB3LHNpemVvZih0Y2xja3JlcS5wdyktMSk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19CT0lDX1JFRzogDQorICAgICAgICAgICAgc3NjYW5mKHBBdENtZFBhcmEsICIlKjVzJTRzIyIsIHB3KTsNCisgICAgICAgICAgICBwd1s0XSA9ICdcMCc7DQorICAgICAgICAgICAgdGNsY2tyZXEudHlwZSA9IDE7Ly9PSQ0KKyAgICAgICAgICAgIHRjbGNrcmVxLmFjdCA9IDE7DQorICAgICAgICAgICAgc3RybmNweSh0Y2xja3JlcS5wdyxwdyxzaXplb2YodGNsY2tyZXEucHcpLTEpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgY2FzZSBaQ0NfQk9JQ19ERVJFRzoNCisgICAgICAgICAgICBzc2NhbmYocEF0Q21kUGFyYSwgIiUqNXMlNHMjIiwgcHcpOw0KKyAgICAgICAgICAgIHB3WzRdID0gJ1wwJzsNCisgICAgICAgICAgICB0Y2xja3JlcS50eXBlID0gMTsvL09JDQorICAgICAgICAgICAgdGNsY2tyZXEuYWN0ID0gMDsNCisgICAgICAgICAgICBzdHJuY3B5KHRjbGNrcmVxLnB3LHB3LHNpemVvZih0Y2xja3JlcS5wdyktMSk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19DRlVfUkVHOg0KKyAgICAgICAgICAgIHNzY2FuZihwQXRDbWRQYXJhLCAiJSo0cyU0N3MjIiwgZG4pOw0KKyAgICAgICAgICAgIGRuW3N0cmxlbihkbiktMV0gPSAnXDAnOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLnR5cGUgPSAwOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLmFjdCA9IDE7DQorICAgICAgICAgICAgc3RybmNweSh0Y2NmY3JlcS5kbiwgZG4sIHN0cmxlbihkbikpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgY2FzZSBaQ0NfQ0ZVX0RFUkVHOg0KKyAgICAgICAgICAgIHRjY2ZjcmVxLnR5cGUgPSAwOw0KKyAgICAgICAgICAgIHRjY2ZjcmVxLmFjdCA9IDA7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19DRk5SWV9SRUc6DQorICAgICAgICAgICAgc3NjYW5mKHBBdENtZFBhcmEsICIlKjRzJTQ3cyMiLCBkbik7DQorICAgICAgICAgICAgZG5bc3RybGVuKGRuKS0xXSA9ICdcMCc7DQorICAgICAgICAgICAgdGNjZmNyZXEudHlwZSA9IDI7DQorICAgICAgICAgICAgdGNjZmNyZXEuYWN0ID0gMTsNCisgICAgICAgICAgICBzdHJuY3B5KHRjY2ZjcmVxLmRuLCBkbiwgc3RybGVuKGRuKSk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICBjYXNlIFpDQ19DRk5SWV9ERVJFRzoNCisgICAgICAgICAgICB0Y2NmY3JlcS50eXBlID0gMjsNCisgICAgICAgICAgICB0Y2NmY3JlcS5hY3QgPSAwOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgY2FzZSBaQ0NfQ0ZCX1JFRzoNCisgICAgICAgICAgICBzc2NhbmYocEF0Q21kUGFyYSwgIiUqNHMlNDdzIyIsIGRuKTsNCisgICAgICAgICAgICBkbltzdHJsZW4oZG4pLTFdID0gJ1wwJzsNCisgICAgICAgICAgICB0Y2NmY3JlcS50eXBlID0gMTsNCisgICAgICAgICAgICB0Y2NmY3JlcS5hY3QgPSAxOw0KKyAgICAgICAgICAgIHN0cm5jcHkodGNjZmNyZXEuZG4sIGRuLCBzdHJsZW4oZG4pKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGNhc2UgWkNDX0NGQl9ERVJFRzoNCisgICAgICAgICAgICB0Y2NmY3JlcS50eXBlID0gMTsNCisgICAgICAgICAgICB0Y2NmY3JlcS5hY3QgPSAwOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICB9DQorICAgICAgICANCisgICAgDQorICAgIGlmIChzY05hbWUgPiBaQ0NfQk9JQ19ERVJFRykNCisgICAgew0KKyAgICAgICAgekNjQXBwX0NjZmMoJnRjY2ZjcmVxKTsNCisgICAgfQ0KKyAgICBlbHNlDQorICAgIHsNCisgICAgICAgIHpDY0FwcF9DbGNrKCZ0Y2xja3JlcSk7DQorICAgIH0NCisgICAgICAgIA0KK30NCisNCitWT0lEIHpDY19TZW5kQXREaWFsUmVxKFBTVFIgcEF0Q21kUGFyYSkNCit7DQorICAgIFVJTlQ4IHNsYXZlID0wOw0KKw0KKyAgICAvL2NjYXBwX2xvZygicEF0Q21kUGFyYT0lcyBsZW49JXMiLCBwQXRDbWRQYXJhLCBzdHJsZW4ocEF0Q21kUGFyYSkpOw0KKw0KKyAgICBpZiAoc3RybGVuKHBBdENtZFBhcmEpKzEgPiBaRElBTF9OVU1fTUFYKQ0KKyAgICB7DQorICAgICAgICByZXR1cm47DQorICAgIH0NCisgICAgZWxzZSBpZiAoc3RybGVuKHBBdENtZFBhcmEpIDw9IDIpDQorICAgIHsNCisgICAgICAgIHNsYXZlID0gekNjX0dldERpYWxpbmdTbGF2ZSgxKTsNCisgICAgICAgIGlmICgxID09IHpDY19CdXN5VG9uZUFsbG93ZWQoKSAmJiBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLndhaXREU0NJNiA9PSAwICYmIGdfQ2NfQ2FsbERldGFpbC5zdGF0ZSA9PSBaQ0NfTV9TRUlaRV9TKS8v09DG5Mv7uvS90MfS0tG50rv6yrGyu7fFw6bS9A0KKyAgICAgICAgew0KKyAgICAgICAgICAgIENyZWF0ZVNvZnRUaW1lcihaQ0NBUFBfVElNRVJfQlVTWVRPTkVfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgICAgIDAsDQorICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0JVU1lUT05FX0lOVEVSVkFMLA0KKyAgICAgICAgIC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XNnQnVmLT51c01zZ0NtZCA9IFpDQ19TQU5TX0U7DQorICAgICAgICB9DQorICAgICAgICAJDQorI2lmbmRlZiBURVNUX0NDQVBQDQorCQljZmdfZ2V0X2l0ZW0oInZvaXBfc3RhdHVzIix2b2lwX3N0YXR1cyxzaXplb2Yodm9pcF9zdGF0dXMpKTsNCisJCWlmICgwICE9IHN0cmNtcCgibGVkb24iICwgdm9pcF9zdGF0dXMpKQ0KKyNlbmRpZg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHpDY19TZXRMZWRTdGF0dXMoImxlZG9uIik7DQorICAgICAgICB9DQorICAgICAgICBicmVhazsNCisgICAgY2FzZSAxOi8vWl9NTUlBQ0NfQ0FMTF9TVEFURV9IRUxEDQorICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW2NpZF0uc3RhdGUgPT0gWkNDX1NfVEFMS0lOR19TKS8vYWN0aXZlLT5oZWxkDQorICAgICAgICB7DQorICAgICAgICAgICAgaWYgKDEgPT0gekNjX0NhbGxDb3VudCgpKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgLy9TTElDX1N0b3BfUENNKCk7DQorICAgICAgICAgICAgfSANCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbY2lkXS5oZWxkY2FsbCA9IDE7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW2NpZF0uY29uZmNhbGwgPSBpbk1wdHk7DQorDQorICAgICAgICB9DQorICAgICAgICBicmVhazsNCisgICAgY2FzZSAzOi8vWl9NTUlBQ0NfQ0FMTF9TVEFURV9NT19BTEVSVElORw0KKyAgICAgICAgcHRNc2dCdWYtPnVzTXNnQ21kID0gWkNDX1NSSU5HX0U7DQorICAgICAgICBicmVhazsNCisgICAgY2FzZSA0Oi8vWl9NTUlBQ0NfQ0FMTF9TVEFURV9NVF9JTkNPTUlORw0KKwkJIGlmKHR6X2xvY2tfY2VsbG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NfU0lMX1MpKQkJLy8gZmFzdCBkdWR1ZHUgaXMgZW5kIC4uLi4NCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHpDY19TZW5kQXRDaGxkUmVxKDEwK2NpZCk7DQorICAgICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIH0NCisJCWVsc2UgaWYoZ19DY19DYWxsRGV0YWlsLnN0YXRlPT1aQ0NfTV9SRUxFQVNFX1MpIA0KKyAgICAgICAgew0KKyAgICAgICAgCWludCBkc2NpNl9jaWQgPSB6Q2NfRmluZF93YWl0RFNDSTZfY2lkKCk7DQorCQkJaWYoZHNjaTZfY2lkIT0wICYmIGRzY2k2X2NpZD09Y2lkKQ0KKwkJCXsNCisgICAgICAgICAgICAgICAgekNjX1NlbmRBdENobGRSZXEoMTArY2lkKTsNCisgICAgICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaihjaWQpOw0KKyAgICAgICAgICAgICAgICBjY2FwcF9sb2coInpDY19GaW5kX3dhaXREU0NJNl9jaWQgYW5kIHNraXAgdGhpcyBjYWxsICVzIiwgbnVtKTsNCisNCisgICAgICAgICAgICAgICAgY2hhciB0ZW1wWzIwMF07DQorICAgICAgICAgICAgICAgIHNwcmludGYodGVtcCwgImVjaG8gXCIlcyBnZXQgZXJyb3IgaW5jb21pbmcgY2FsbCBjaWQ9JWQgbnVtPSVzXCIgPiAvdG1wL2xvZy5jY2FwcC5jYWxsaW4uZXJyIiwNCisgICAgICAgICAgICAgICAgCWdldF9sb2NhbF9kYXRlX3RpbWUoKSwgY2lkLCBudW0pOw0KKyAgICAgICAgICAgICAgICBzb2Z0X3N5c3RlbSh0ZW1wKTsNCisgICAgICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgDQorICAgICAgICBwdE1zZ0J1Zi0+dXNNc2dDbWQgPSBaQ0NfU0lOVklURV9FOw0KKyAgICAgICAgbWVtc2V0KGdfQ2NfQ2FsbERldGFpbC5udW1iZXIsIDAsIHNpemVvZihnX0NjX0NhbGxEZXRhaWwubnVtYmVyKSk7DQorICAgICAgICBtZW1jcHkoZ19DY19DYWxsRGV0YWlsLm51bWJlciwgbnVtLCBaRElBTF9OVU1fTUFYKTsNCisgICAgICAgIGJyZWFrOw0KKyAgICBjYXNlIDU6Ly9aX01NSUFDQ19DQUxMX1NUQVRFX01UX1dBSVRJTkcNCisgICAgICAgIGlmKGdfQ2NfQ2FsbERldGFpbC5zdGF0ZT09WkNDX01fUklOR0lOR19TICYmIHpDY19maW5kX2hlbGRfY2lkKCkpDQorICAgICAgICB7DQorICAgICAgICAgICAgekNjX1NlbmRBdENobGRSZXEoMTArY2lkKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYoaXNfb25lY2FsbF9pbl9oZWxwX2FuZF9yZWFkeV90b19pbnB1dF9uZXdfY2FsbCgpKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHpDY19TZW5kQXRDaGxkUmVxKDEwK2NpZCk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgICAgICANCisgICAgICAgIGlmKHpDY19DYWxsQ291bnQoKT49MikNCisgICAgICAgIHsNCisgICAgICAgICAgICB6Q2NfU2VuZEF0Q2hsZFJlcSgxMCtjaWQpOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgfQ0KKyAgICAgICAgDQorICAgICAgICBwdE1zZ0J1Zi0+dXNNc2dDbWQgPSBaQ0NfQ0lEQ1dfRTsNCisgICAgICAgIG1lbXNldChnX0NjX0NhbGxEZXRhaWwubnVtYmVyLCAwLCBzaXplb2YoZ19DY19DYWxsRGV0YWlsLm51bWJlcikpOw0KKyAgICAgICAgbWVtY3B5KGdfQ2NfQ2FsbERldGFpbC5udW1iZXIsIG51bSwgWkRJQUxfTlVNX01BWCk7DQorICAgICAgICBicmVhazsNCisgICAgY2FzZSA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kdfUykNCisgICAgICAgIHsNCisgICAgICAgICAgICBnX3pDY19wY21fYmFrID0gIHJhdGU7DQorICAgICAgICAgICAgcmV0dXJuIDA7DQorICAgICAgICB9DQorICAgICAgICAvKiAgbmV3IGFkZCBlbmQgKi8NCisNCisgICAgICAgIGlmIChyYXRlID09IDgwMDApDQorICAgICAgICB7DQorICAgICAgICAgICAgU0xJQ19QQ01fU2V0X05CKCk7DQorICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX1ppbXNwbHVzUHJvYzogU0xJQ19QQ01fU2V0X05CIDwtLS1cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICBTTElDX1N0YXJ0X1BDTSgpOw0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19aaW1zcGx1c1Byb2M6IFNMSUNfU3RhcnRfUENNIDwtLS1cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYgKHJhdGUgPT0gMTYwMDApDQorICAgICAgICB7DQorICAgICAgICAgICAgU0xJQ19QQ01fU2V0X1dCKCk7DQorICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX1ppbXNwbHVzUHJvYzogU0xJQ19QQ01fU2V0X1dCIDwtLS1cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICBTTElDX1N0YXJ0X1BDTSgpOw0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19aaW1zcGx1c1Byb2M6IFNMSUNfU3RhcnRfUENNIDwtLS1cbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIH0NCisgICAgfQ0KKyA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Db3VudD0yIEhlbGQ9MSBBY3RpdmU9MCBnZXRTbGF2ZShEQUNDTSk9MCBnZXRTbGF2ZShSSU5HQkFDSyk9MiByaW5nQ2lkPTAgZGlnWzBdPUYNCisgICAgICAgICovCQkJDQorICAgICAgICBpZiAoKGdfQ2NfQ2FsbERldGFpbC5sYXN0VG9uZSA9PSBaQ0NfVE9ORV9CU1lfQSkgfHwgKGdfQ2NfQ2FsbERldGFpbC5sYXN0VG9uZSA9PSBaQ0NfVE9ORV9US1lfQSkpLy/DptL0us3D+bq/0vSjrLK7tKbA7bC0vPzP+8+iDQorICAgICAgICB7DQorICAgICAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgICAgICBjYWxsQ250ID0gekNjX0NhbGxDb3VudCgpOw0KKyAgICAgICAgaWYgKCAoZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSB8fCBjYWxsQ250ID09IHpDY19IZWxkQ2FsbCgpKSAvL9a709Cxo7PWuvS90KOssqa6xbeixvDQwrr0vdANCisgICAgICAgICAgICAmJiBnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdICE9IFpDQ19GTEFTSF9TSUdODQorICAgICAgICAgICAgJiYgMCA9PSB6Q2NfQWN0aXZlQ2FsbCgpKS8vt8WyprrF0vS78tLR09Cxo7PWuvS90Mqx08O7p7KmusUstdrSu7j219a3+6OsxcWz/WFjdGl2ZStoZWxkyrHPwreiRjINCisgICAgICAgIHsgICAgICAgICAgICANCisgICAgICAgICAgICBzbGF2ZSA9IHpDY19HZXRTcGVjU2xhdmUoWkNDX1NfSURMRV9TKTsNCisgICAgICAgICAgICBpZiAoMCA9PSBzbGF2ZSApDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm47DQorICAgICAgICAgICAgfSAgICAgICAgDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT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yAgICAgICAgZWxzZSANCisgICAgICAgIHsNCisgICAgICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLnJpbmdDaWQgJiYgKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtnX0NjX0NhbGxEZXRhaWwucmluZ0NpZF0udG9uZSA9PSBaQ0NfVE9ORV9DSURDV19BKSkvL2FjdGl2ZSt3YWl0aW5nK2ZsYXNob3JkdG1mDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBEZWxldGVTb2Z0VGltZXIoWkNDQVBQX1RJTUVSX1NTRElBTFRPTkVfREVURUNUKTsgICAgIA0KKyAgICAgICAgICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1swXSAhPSBaQ0NfRkxBU0hfU0lHTikNCisgICAgICAgICAgICAgICAgeyAgICAgICAgICAgICANCisgICAgICAgICAgICAgICAgICAgIHNsYXZlID0gekNjX0dldFNwZWNTbGF2ZShaQ0NfU19UQUxLSU5HX1MpOw0KKyAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gc2xhdmUgKQ0KKyAgICAgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsNCisgICAgICAgICAgICAgICAgICAgIH0gICAgICAgIA0KKyAgICAgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmV2dFtzbGF2ZV0gPSBaQ0NfRFRNRl9FOw0KKyAgICAgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGUgWkNDX0RUTUZfRSBcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgICAgICB9ICAgICAgICANCisgICAgICAgICAgICB9ICANCisNCisgICAgICAgICAgICBEZWxldGVTb2Z0VGltZXIoWkNDQVBQX1RJTUVSX0RUTUZfREVURUNUKTsNCisgICAgICAgICAgICByZXQgPSB6Q2NfRGlnaXRzTWF0Y2goKTsNCisgICAgICAgICAgICBpZiAoKFpDQ19OT19SRVNVTFQgIT0gcmV0ICYmIFpDQ19NQVRDSEVSUiAhPSByZXQgJiYgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSkNCisgICAgICAgICAgICAgIHx8KFpDQ19NQVRDSEVSUiA9PSByZXQgJiYgZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSAmJiAyIDw9IHpDY19DYWxsQ291bnQoKSkpDQorICAgICAgICAgICAgey8vY2FsbCB3YWl0aW5nytW1vWZsYXNoNKOszaPWubKmusXS9LvWuLS69L3Qtci0/dL0DQorICAgICAgICAgICAgICAgIFNMSUNfU3RvcF9TaWduYWwoMCwgVE9ORV9TSUdOQUwpOw0KKyAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6IFNMSUNfU3RvcF9TaWduYWwgPC0tLVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwubGFzdFRvbmUgPSBaQ0NfVE9ORV9PRkZfQTsNCisgICAgICAgICAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialswXS50b25lICE9IFpDQ19UT05FX09GRl9BKQ0KKyAgICAgICAgICAgICAgICB7ICAgICAgICAgICAgICAgICAgIA0KKyAgICAgICAgICAgICAgICAgICAgekNjX0luaXRTbGF2ZU9iaigwKTsNCisgICAgICAgICAgICAgICAgfSAgDQorICAgICAgICAgICAgICAgIGlmICgwICE9IHpDY19BY3RpdmVDYWxsKCkpDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIFNMSUNfU3RhcnRfUENNKCk7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgaWYgKChaQ0NfRkxBU0hfMSA9PSByZXQgfHwgWkNDX0ZMQVNIXzIgPT0gcmV0KSAmJiAoZ19DY19DYWxsRGV0YWlsLnJpbmdDaWQgIT0gMCkpLy+908z9d2FpdGluZyBjYWxso6y69L3Qtci0/dL006bH5b/VDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtnX0NjX0NhbGxEZXRhaWwucmluZ0NpZF0udG9uZSA9IFpDQ19UT05FX09GRl9BOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgfSANCisgICAgICAgICAgICB6Q2NfRGlnaXRzTWF0Y2hSbHRQcm9jKHJldCk7DQorICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGUgWkNDX0RUTUZfRSBcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgYnJlYWs7DQorDQorICAgIGNhc2UgWkNDX1NESUFMTElOR19FOiAvLyC3orP2wctTSVAgSU5WSVRFILvyIENDIFNFVFVQICwgzai5/dXiuPbP+8+iyc+xqCBjaWQNCisgICAgICAgIGlmICgwICE9IHpDY19HZXREaWFsaW5nU2xhdmUoMCkpDQorICAgICAgICB7DQorICAgICAgICAgICAgdG1wc2xhdmUgPSB6Q2NfR2V0RGlhbGluZ1NsYXZlKDApOw0KKyAgICAgICAgICAgIGlmICh0bXBzbGF2ZSAhPSBzbGF2ZSkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0gPSAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3RtcHNsYXZlXTsNCisgICAgICAgICAgICAgICAgekNjX0luaX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FX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6IFNMSUNfU3RvcF9QQ00gPC0tLVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgDQorI2lmbmRlZiBURVNUX0NDQVBQDQorDQorDQorCQljZmdfZ2V0X2l0ZW0oInZvaXBfc3RhdHVzIix2b2lwX3N0YXR1cyxzaXplb2Yodm9pcF9zdGF0dXMpKTsNCisNCisgICAgICAgIGlmICgwICE9IHN0cmNtcCgibGVkb2ZmIiAsIHZvaXBfc3RhdHVzICkpDQorI2VuZGlmDQorICAgICAgICB7DQorICAgICAgICAgICAgekNjX1NldExlZFN0YXR1cygibGVkb2ZmIik7DQorICAgICAgICB9DQorICAgICAgICBnX0NjX0NhbGxEZXRhaWwuc3RhdGUgPSBaQ0NfTV9SRUxFQVNFX1M7DQorICAgICAgICBpZiAoISgwICE9IHpDY19HZXRTcGVjU2xhdmUoWkNDX1NfVFJZSU5HX1MpICYmICgxID09IHpDY19DYWxsQ291bnQoKSkpKS8v1aq7+sqxtcTAtLXno6yyu8flDQorICAgICAgICB7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnJlc291cmNlUmVhZHkgPSAwOw0KKyAgICAgICAgfQ0KKyAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7DQorICAgICAgICBnX0NjX0NhbGxEZXRhaWwuaG9va29mZmZnID0gRkFMU0U7DQorICAgICAgICBEZWxldGVTb2Z0VGltZXIoWkNDQVBQX1RJTUVSX0hPT0tPRkZfREVURUNUKTsvL8rVtb3JwbbPo6y1scewtqjKscb3trzQ6NKqzaPWuaOsuvPQ+NTZxvS2rw0KKyAgICAgICAgRGVsZXRlU29mdFRpbWVyKFpDQ0FQUF9USU1FUl9EVE1GX0RFVEVDVCk7DQorICAgICAgICBEZWxldGVTb2Z0VGltZXIoWkNDQVBQX1RJTUVSX0JVU1lUT05FX0RFVEVDVCk7DQorICAgICAgICBEZWxld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Y19CdXN5VG9uZUFsbG93ZWQoKSAmJiBnX0NjX0NhbGxEZXRhaWwuc3RhdGUgPT0gWkNDX01fU0VJWkVfUykvL9PQxuTL+7r0vdDKsbK7t8XDptL0DQorICAgICAgICB7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS50b25lID0gWkNDX1RPTkVfQlNZX0E7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zdGF0ZSA9IFpDQ19TX0JTWVRfUzsgDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5jb25mY2FsbCA9IDA7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5oZWxkY2FsbCA9IDA7IA0KKyAgICAgICAgICAgIENyZWF0ZVNvZnRUaW1lcihaQ0NBUFBfVElNRVJfQlVTWVRPTkVfREVURUNULA0KKyAgICAgICAgICAgICAgICAgICAgMCwNCisgICAgICAgICAgICAgICAgICAgIFpDQ0FQUF9USU1FUl9CVVNZVE9ORV9JTlRFUlZBTCwNCisgICAgICAgICAgICAgICAgICAgIHpDY0FwcF9CdXN5VG9uZVRpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgTlVMTCk7ICAgDQorICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGUgQ3JlYXRlU29mdFRpbWVyIHpDY0FwcF9CdXN5VG9uZVRpbWVyMjIyMjJcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UNCisgICAgICAgIHsNCisgICAgICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKHNsYXZlKTsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwL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HVybjsNCisgICAgY2FzZSBaQ0NfU1NESUFMVE9ORVRJTUVSX0U6DQorICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKDApOy8vt8WyprrF0vS1xHNsYXZlMCDH5b/VDQorICAgICAgICB6Q2NfQ2xlYXJEaWdpdHMoKTsgICAgICANCisgICAgICAgIGlmICgxID09IHpDY19DYWxsQ291bnQoKSANCisgICAgICAgICAgICAmJiAoZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSkpLy+1scew1rvT0NK7wrejrM2j1rmyprrF0vQNCisgICAgICAgIHsgICAgICAgICAgICAgICAgDQorICAgICAgICAgICAgU0xJQ19TdG9wX1NpZ25hbCgwLDApOw0KKyAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6IFNMSUNfU3RvcF9TaWduYWwgPC0tLVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5sYXN0VG9uZSA9IFpDQ19UT05FX09GRl9BOw0KKyAgICAgICAgICAgIGlmICgxID09IHpDY19IZWxkQ2FsbCgpKS8v0tGxo7PWo6y71ri0DQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjaGxkcmV0ID0gekNjX1NlbmRBdENobGRSZXEoMik7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UgaWYgKDAgIT0gekNjX0FjdGl2ZUNhbGwoKSkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIFNMSUNfU3RhcnRfUENNKCk7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZSBpZiAoMSA8IHpDY19DYWxsQ291bnQoKSAmJiAoZ19DY19DYWxsRGV0YWlsLmxhc3RUb25lID09IFpDQ19UT05FX0RJQUxfQSkpLy9hY3RpdmUvaGV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AgICAgICAgaWYoZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1swXSA9PSBaQ0NfRkxBU0hfU0lHTikNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHpDY19Jbml0U2xhdmVPYmooMCk7DQorICAgICAgICAgICAgICAgIHpDY19DbGVhckRpZ2l0cygpOyAgICAgIA0KKyAgICAgICAgICAgICAgICBTTElDX1N0b3BfU2lnbmFsKDAsMCk7DQorICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTogU0xJQ19TdG9wX1NpZ25hbCA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5sYXN0VG9uZSA9IFpDQ19UT05FX09GRl9BOw0KKyAgICAgICAgICAgICAgICBpZiAoMCAhPSB6Q2NfQWN0aXZlQ2FsbCgpKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBTTElDX1N0YXJ0X1BDTSgpOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuZGlnaXRzW2dfQ2NfQ2FsbERldGFpbC5kQ291bnQrK10gPSBaQ0NfRkxBU0hfU0lHTjsNCisgICAgICAgICAgICAvLyBzbGF2ZVswXSB0byBwbGF5IGRpYWwgdG9uZQ0KKyAgICAgICAgICAgICBDcmVhdGVTb2Z0VGltZXIoWkNDQVBQX1RJTUVSX1NTRElBTFRPTkVfREVURUNULA0KKyAgICAgICAgICAgICAgICAgMCwNCisgICAgICAgICAgICAgICAgIFpDQ0FQUF9USU1FUl9IT09LT0ZGX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgekNjQXBwX1NzRGlhbFRvbmVUaW1lciwNCisgICAgICAg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23xaOssqK3xbKmusXS9A0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHpDY19Jbml0U2xhdmVPYmooMCk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmV2dFswXSA9IFpDQ19ESUFMX0U7DQorICAgICAgICAgICAgU0xJQ19TdG9wX1BDTSgpOw0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTpTTElDX1N0b3BfUENNXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmhvb2tvZmZmZyA9IFRSVUU7ICANCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6WkNDX0ZMQVNIX0VcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgaWYgKHpDY19BY3RpdmVDYWxsKCkgPT0gY2FsbENudCkgLy/Wu9PQYWN0aXZlIGNhbGyjrLGjs9bL/KOssqK3xbKmusXS9A0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGlmIChjYWxsQ250ID4gMSkgLy8gY29uZiBjYWxsLCC3xbKmusXS9A0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1tnX0NjX0NhbGxEZXRhaWwuZENvdW50KytdID0gWkNDX0ZMQVNIX1NJR047DQorICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5kaWdpdHNbWkRJQUxfTlVNX01BWC0xXSA9IDE7Ly8gvMfCvLG+tM6y2df3zqrV67bUY29uZiC1xA0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTpaQ0NfRkxBU0hfRVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjaGxkcmV0ID0gekNjX1NlbmRBdENobGRSZXEoMik7DQorICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX01TZWl6ZVN0YXRlOlpDQ19GTEFTSF9FXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLndhaXRjaGxkcmVzdWx0ID0gMTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgICAgICANCisgICAgICAgIGlmICh6Q2NfSGVsZENhbGwoKSA9PSBjYWxsQ250KSAvL9a709BoZWxkIGNhbGyjrLvWuLQNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZiAoY2FsbENudCA9PSAxICkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNobGRyZXQgPSB6Q2NfU2VuZEF0Q2hsZFJlcSgyKTsNCisgICAgICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6WkNDX0ZMQVNIX0VcbiIsX19GVU5DVElPTl9fKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1tnX0NjX0NhbGxEZXRhaWwuZENvdW50KytdID0gWkNDX0ZMQVNIX1NJR047DQorICAgICAgICAgICAgICAgIENyZWF0ZVNvZnRUaW1lcihaQ0NBUFBfVElNRVJfU1NESUFMVE9ORV9ERVRFQ1QsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaQ0NBUFBfVElNRVJfSE9PS09GRl9JTlRFUlZBTCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NBcHBfU3NEaWFsVG9uZVRpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOyAgIA0KKyAgICAgICAgICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19NU2VpemVTdGF0ZTpDcmVhdGVTb2Z0VGltZXIgekNjQXBwX1NzRGlhbFRvbmVUaW1lclxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgICAgICBnX0NjX0NhbGxEZXRhaWwuZXZ0WzBdID0gWkNDX0RJQUxfRTsNCisgICAgICAgICAgICAgICAgDQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgfQ0KKyAgICAgICAgLy9hY3RpdmUgKyBoZWxkDQorDQorICAgICAgICBpZihnX0NjX0NhbGxEZXRhaWwuZGlnaXRzWzBdID09IFpDQ19GTEFTSF9TSUdOKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHpDY19Jbml0U2xhdmVPYmooMCk7DQorICAgICAgICAgICAgekNjX0NsZWFyRGlnaXRzKCk7ICAgICAgDQorICAgICAgICAgICAgU0xJQ19TdG9wX1NpZ25hbCgwLDApOw0KKyAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfTVNlaXplU3RhdGU6IFNMSUNfU3RvcF9TaWduYWwgPC0tLVxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5sYXN0VG9uZSA9IF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ICAgIAl7DQorCQkJCXpDY19Jbml0U2xhdmVPYmooMCk7DQorICAgICAgICAgICAgCXpDY19DbGVhckRpZ2l0cygpOyAgICANCisgICAgICAgICAgICAJekNjX1NlbmRBdENobGRSZXEoMik7DQorICAgICAgICAgICAgCWNjYXBwX2xvZygiZ2V0IFpDQ19GTEFTSF9TSUdOIGFuZCByZXR1cm4gdG8gb2xkIHRhbGsiKTsNCisgICAgICAgIAl9Ki8NCisNCisgICAgICAgIAlpbnQgY2lkID0gekNjX0dldE1vQmVmb3JEaWFsaW5nQ2FsbENJRCgpOw0KKyAgICAgICAgCWlmKGNpZD49MCAmJiB6Q2NfSGVsZENhbGwoKSE9MCkJLy8gZHJvcCB0aGUgYmVmb3JlRGlhbGluZyBjYWxsDQorICAgICAgICAJew0KKwkJCQl6Q2NfSW5pdFNsYXZlT2JqKGNpZCk7DQorICAgICAgICAgICAgCXpDY19DbGVhckRpZ2l0cygpOyAgICANCisgICAgICAgICAgICAJekNjX1NlbmRBdENobGRSZXEoMSk7DQorICAgICAgICAgICAgCWNjYXBwX2xvZygiZHJvcCB0aGUgYmVmb3JlRGlhbGluZyBjYWxsIGNpZD0lZCIsIGNpZCk7DQorICAgICAgICAJfQ0KKyAgICAgICAgCQ0KKyAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX01TZWl6ZVN0YXRlOlpDQ19GTEFTSF9FIHJldHVyblxuIixfX0ZVTkNUSU9OX18pOw0KKyAgICAgICAgICAgIHJldHVybjsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgZ19DY19DYWxsRGV0YWlsLmRpZ2l0c1tnX0NjX0NhbGxEZXRhaWwuZENvdW50KytdID0gWkNDX0ZMQVNIX1NJR047DQorICAgICAgICBnX0NjX0NhbGxEZXRhaWwuZXZ0WzBdID0gWkNDX0RJQUxfRTsNCisgICAgICAgIENyZWF0ZVNvZn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gKHNsYXZlID0gMTsgc2xhdmUgPCBaQ0NfU0xBVkVTOyBzbGF2ZSsrKQ0KKyAgICB7DQorICAgICAgICBpZihnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2chPVpDQ19TTk9fTSkNCisgICAgICAgIHsNCisgICAgICAgICAgICB6Q2NfQ2hlY2tTbGF2ZVN0YXRlKCJpbiBzbGF2ZU9ialtzbGF2ZV0uc01zZyIpOw0KKyAgICAgICAgICAgIGNjYXBwX2xvZygiZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqWyVkXS5zTXNnPSVkIiwgDQorICAgICAgICAgICAgICAgIHNsYXZlLCANCisgICAgICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zTXNnKTsNCisgICAgICAgIH0NCisgICAgICAgIA0KKyAgICAgICAgc3dpdGNoIChnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLnNNc2cpDQorICAgICAgICB7DQorICAgICAgICBjYXNlIFpDQ19TSU5WX006DQorICAgICAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc3RhdGUgPT0gWkNDX1NfSURMRV9TKS8vc3MNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHpDY19TZW5kU3NSZXEoZ19DY19DYWxsRGV0YWlsLmRpZ2l0cyk7DQorICAgICAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0udG9uZSA9IFpDQ19UT05FX09GRl9BOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICB6Q2NfU2VuZEF0RGlhbFJlcShnX0NjX0NhbGxEZXRhaWwuZGlnaXRzKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYX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sNCisgICAgICAgICAgICAgICAgLy9tZW1jcHkodFNpZy5jaWQsIGdfQ2NfQ2FsbERldGFpbC5udW1iZXIsIHN0cmxlbihnX0NjX0NhbGxEZXRhaWwubnVtYmVyKSk7DQorCQkJCXN0cm5jcHkodFNpZy5jaWQsIGdfQ2NfQ2FsbERldGFpbC5udW1iZXIsIHNpemVvZih0U2lnLmNpZCktMSk7DQorICAgICAgICAgICAgICAgIGdldF9sb2NhbF9kYXRldGltZSh0U2lnLmRhdGVfdGltZSk7DQorICAgICAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCIlcyAgekNjX1J1bk1hc3RlciBSSU5HX1NJR05BTCxudW1iZXIgPSAlc1xuIixfX0ZVTkNUSU9OX18sZ19DY19DYWxsRGV0YWlsLm51bWJlcik7DQorICAgICAgICAgICAgICAgIFNMSUNfUGxheV9TaWduYWwoMCwgMCwgJnRTaWcpOyAgDQorICAgICAgICAgICAgICAgIHpDY19TZXRMZWRTdGF0dXMoImxlZGJsaW5rIik7DQorICAgICAgICAgICAgfSAgICAgICAgDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zTXNnID0gWkNDX1NOT19NOw0KKyAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgY2FzZSBaQ0NfU0FOU19NOi8vyrLDtLOhvrA/DQorICAgICAgICAgICAgaWYgKHpDY19DYWxsQ291bnQoKSA9PSAxKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgU0xJQ19TdG9wX1NpZ25hbCgwLCBUT05FX1NJR05BTCk7DQorICAgICAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIDogU0xJQ19TdG9wX1NpZ25hbCA8LS0tXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgICAgICAgICAgICAg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FpDQ19NX1JJTkdJTkdfUzsNCisNCisJICAgICAgICAgICAgICAgIC8qTVNHX0JVRiAgIG1zZ0J1ZmYgICAgICA9IHswfTsJCQkJLy8gbGV0IHdoaWxlKDEpIHJ1biBvbmUgbW9yZSB0aW1lDQorCSAgICAgICAgICAgICAgICBtc2dCdWZmLnVzTXNnQ21kICAgPSBaQ0NfQVNTSVNUX01TR19FOw0KKwkgICAgICAgICAgICAgICAgbXNnQnVmZi5zcmNfaWQgPSBNT0RVTEVfSURfU0xJQzsNCisJICAgICAgICAgICAgICAgIHpDY19TZW5kTXNnVG9TdWIoJm1zZ0J1ZmYpOw0KKw0KKwkgICAgICAgICAgICAgICAgY2NhcHBfbG9nKCJzZW5kTXNnIFpDQ19BU1NJU1RfTVNHX0UiKTsgKi8NCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgICAgIHsNCisJCQkJCXpDY19odW5ndXBfYWxsKHNsYXZlKTsNCisgICAgICAgICAgICAgICAgfQ0KKwkJCX0NCisJCQllbHNlDQorICAgICAgICAJew0KKwkgICAgICAgICAgICB6Q2NfaHVuZ3VwX2FsbChzbGF2ZSk7IA0KKwkgICAgICAgCX0gICAgIA0KKw0KKwkgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc01zZyA9IFpDQ19TTk9fTTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGRlZmF1bHQ6DQorICAgICAgICAgICAgYnJlYWs7DQorICAgICAgICB9DQorICAgIH0NCisNCisgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5zdGF0ZSA9PSBaQ0NfTV9SSU5HSU5HX1MgDQorICAgICAgICAmJiBnX0NjX0NhbGxEZXRhaWwucmluZ0NpZCA9PSAwDQorICAgICAgICAmJiB6Q2NfZmluZF9oZWxkX2NpZCgpPT0wIA0KKyAgICAgICAgJiYgekNjX2ZpbmRfaGVsZF9pbmNvbWluZ19j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AgZ19DY19DYWxsRGV0YWlsLmhvb2tvZmZmZyA9IEZBTFNFOw0KKyAgICAgICAgICAgIENyZWF0ZVNvZnRUaW1lcihaQ0NBUFBfVElNRVJfSE9PS09GRl9ERVRFQ1QsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFpDQ0FQUF9USU1FUl9IT09LT0ZGX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB6Q2NBcHBfSG9va09mZlRpbWVyLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgIA0KKyAgICB6dGVfbG9nX2FwcGVuZChfX0ZJTEVfXywgX19MSU5FX18sICJ6dGVfY2NhcHAubG9nIiwiJXMgIHpDY19TSWRsZVN0YXRlIENyZWF0ZVNvZnRUaW1lciB6Q2NBcHBfSG9va09mZlRpbWVyXG4iLF9fRlVOQ1RJT05fXyk7DQorDQorCQkJZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5pZGxlX3NlY29uZCA9IDA7DQorICAgICAgICAgICAgQ3JlYXRlU29mdFRpbWVyKFpDQ0FQUF9USU1FUl9IT09LT0ZGX0lETEUsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRJTUVSX0ZMQUdfUkVTVEFSVCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgWkNDQVBQX1RJTUVSX0hPT0tPRkZfSURMRV9JTlRFUlZBTCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgekNjQXBwX0hvb2tPZmZfSWRsZV9UaW1lciwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7ICANCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfU0lkbGVTdGF0ZSBDcmVhdGVTb2Z0VGltZXIgekNjQXBwX0hvb2tPZmZfSWRsZV9UaW1l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dfQ2NfQ2FsbERldGFpbC5yaW5nQ2lkID0gc2xhdmU7DQorICAgICAgICBpZihnX0NjX0NhbGxEZXRhaWwuZXZ0W3NsYXZlXT09WkNDX0NJRENXX0UpDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5pc19jaWRjdyA9IFRSVUU7DQorICAgICAgICBlbHNlDQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5pc19jaWRjdyA9IEZBTFNFOw0KKyAgICAgICAgc3RyY3B5KGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0ubnVtYmVyLCBnX0NjX0NhbGxEZXRhaWwubnVtYmVyKTsNCisgICAgICAgIA0KKyAgICAgICAgaWYgKGdfQ2NfQ2FsbERldGFpbC5yZXNvdXJjZVJlYWR5ID09IDEpDQorICAgICAgICB7DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zTXNnID0gWkNDX1NSSU5HX007DQorICAgICAgICAgICAgZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqW3NsYXZlXS5zdGF0ZSA9IFpDQ19TX1RSWUlOR19TOw0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGdfQ2NfQ2FsbERldGFpbC5zbGF2ZU9ialtzbGF2ZV0uc3RhdGUgPSBaQ0NfU19XQUlUX1JFU09VUkNFX1M7DQorICAgICAgICB9DQorICAgICAgICBicmVhazsNCisgICAgDQorICAgIGNhc2UgWkNDX1NSSU5HX0U6Ly9jaWSyu8alxeS1xLOhvrANCisgICAgICAgIHRtcHNsYXZlID0gekNjX0dldERpYWxpbmdTbGF2ZSgwKTsNCisgICAgICAgIGlmICgwID09IHRtcHNsYXZlICkNCisgICAgICAgIHsNCisgICAgICAgICAgICByZXR1cm47DQorICAgICAgICB9ICAgICAgICANCisgICAg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pID49IDIgfHwgZ19DY19DYWxsRGV0YWlsLnN0YXRlID09IFpDQ19NX1JFTEVBU0VfUykvL7u5yqO24NPa0rvCt7r0vdANCisgICAgICAgIHsNCisgICAgICAgICAgICB6Q2NfSW5pdFNsYXZlT2JqKHNsYXZlKTsNCisgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzICB6Q2NfSW5pdFNsYXZlT2JqOiBzbGF2ZU9ialslZF0gY2xlYXJlZFxuIixfX0ZVTkNUSU9OX18sIHNsYXZlKTsNCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0gICAgICAgICAgICAgDQorICAgICAgICBpZiAoZ19DY19DYWxsRGV0YWlsLnNsYXZlT2JqWzBdLnRvbmUgIT0gWkNDX1RPTkVfT0ZGX0EpDQorICAgICAgICB7ICAgICAgICAgICAgICAgICAgIA0KKyAgICAgICAgICAgIHpDY19Jbml0U2xhdmVPYmooMCk7DQorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICANCisgICAgICAgIGlmICgxID09IHpDY19CdXN5VG9uZUFsbG93ZWQoKSAmJiBnX0NjX0NhbGxEZXRhaWwuc2xhdmVPYmpbc2xhdmVdLndhaXREU0NJNiA9PSAwKS8v09DG5Mv7uvS90Mqxsru3xcOm0vQNCisgICAgICAgIHsNCisgICAgICAgICAgICBDcmVhdGVTb2Z0VGltZXIoWkNDQVBQX1RJTUVSX0JVU1lUT05FX0RFVEVDVCwNCisgICAgICAgICAgICAgICAgICAgICAgICAwLA0KKyAgICAgICAgICAgICAgICAgICAgICAgIFpDQ0FQUF9USU1FUl9CVVNZVE9ORV9JTlRFUlZBTCwNCisgICAgICAgICAgICAgICAgICAgICAgICB6Q2NBcHBfQnVzeVRvbmVUaW1lciwNCisgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgIA0KKyAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0x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