Return-Path: From: "Gix, Brian" To: Luiz Augusto von Dentz CC: "linux-bluetooth@vger.kernel.org" , Marcel Holtmann Subject: RE: [PATCH 4/5] mesh: Baseline Mesh implementation Date: Tue, 15 Aug 2017 15:36:58 +0000 Message-ID: References: <20170814190119.8684-1-brian.gix@intel.com> <20170814190119.8684-5-brian.gix@intel.com> In-Reply-To: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 List-ID: SGkgTHVpeiwNCg0KV2UgYWN0dWFsbHkgdXNlIHRoZSBhZ2VudC5jIGNvZGUgZm9yIE91dC1PZi1C YW5kIGRhdGEgaW5wdXQgZHVyaW5nIFByb3Zpc2lvbmluZy4NCg0KPiAtLS0tLU9yaWdpbmFsIE1l c3NhZ2UtLS0tLQ0KPiBGcm9tOiBMdWl6IEF1Z3VzdG8gdm9uIERlbnR6IFttYWlsdG86bHVpei5k ZW50ekBnbWFpbC5jb21dDQo+IFNlbnQ6IFR1ZXNkYXksIEF1Z3VzdCAxNSwgMjAxNyAyOjA3IEFN DQo+IFRvOiBHaXgsIEJyaWFuIDxicmlhbi5naXhAaW50ZWwuY29tPg0KPiBDYzogbGludXgtYmx1 ZXRvb3RoQHZnZXIua2VybmVsLm9yZzsgTWFyY2VsIEhvbHRtYW5uDQo+IDxtYXJjZWxAaG9sdG1h bm4ub3JnPg0KPiBTdWJqZWN0OiBSZTogW1BBVENIIDQvNV0gbWVzaDogQmFzZWxpbmUgTWVzaCBp bXBsZW1lbnRhdGlvbg0KPiANCj4gSGkgQnJpYW4sDQo+IA0KPiBPbiBNb24sIEF1ZyAxNCwgMjAx NyBhdCAxMDowMSBQTSwgQnJpYW4gR2l4IDxicmlhbi5naXhAaW50ZWwuY29tPiB3cm90ZToNCj4g PiAtLS0NCj4gPiAgbWVzaC9hZ2VudC5jICAgICAgICAgfCAgMjc2ICsrKysrKw0KPiA+ICBtZXNo L2NvbmZpZy1jbGllbnQuYyB8ICA2NjcgKysrKysrKysrKysrKysrDQo+ID4gIG1lc2gvY29uZmln LXNlcnZlci5jIHwgIDE2NSArKysrDQo+ID4gIG1lc2gvY3J5cHRvLmMgICAgICAgIHwgMTE2OCAr KysrKysrKysrKysrKysrKysrKysrKysrKw0KPiA+ICBtZXNoL2dhdHQuYyAgICAgICAgICB8ICA2 MDkgKysrKysrKysrKysrKysNCj4gPiAgbWVzaC9tYWluLmMgICAgICAgICAgfCAyMjY5DQo+ICsr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQo+ID4gIG1l c2gvbmV0LmMgICAgICAgICAgIHwgMjE4NA0KPiArKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysNCj4gPiAgbWVzaC9ub2RlLmMgICAgICAgICAgfCAgODc5ICsr KysrKysrKysrKysrKysrKysNCj4gPiAgbWVzaC9vbm9mZi1tb2RlbC5jICAgfCAgMzA2ICsrKysr KysNCj4gPiAgbWVzaC9wcm92LWRiLmMgICAgICAgfCAxNTk5ICsrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrDQo+ID4gIG1lc2gvcHJvdi5jICAgICAgICAgIHwgIDY2NCArKysrKysr KysrKysrKysNCj4gPiAgbWVzaC91dGlsLmMgICAgICAgICAgfCAgMzY5ICsrKysrKysrDQo+ID4g IDEyIGZpbGVzIGNoYW5nZWQsIDExMTU1IGluc2VydGlvbnMoKykNCj4gPiAgY3JlYXRlIG1vZGUg MTAwNjQ0IG1lc2gvYWdlbnQuYw0KPiA+ICBjcmVhdGUgbW9kZSAxMDA2NDQgbWVzaC9jb25maWct Y2xpZW50LmMNCj4gPiAgY3JlYXRlIG1vZGUgMTAwNjQ0IG1lc2gvY29uZmlnLXNlcnZlci5jDQo+ ID4gIGNyZWF0ZSBtb2RlIDEwMDY0NCBtZXNoL2NyeXB0by5jDQo+ID4gIGNyZWF0ZSBtb2RlIDEw MDY0NCBtZXNoL2dhdHQuYw0KPiA+ICBjcmVhdGUgbW9kZSAxMDA2NDQgbWVzaC9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dC5jYikNCj4gPiArICAgICAgICAg ICAgICAgcGVuZGluZ19yZXF1ZXN0LmNiKEFTQ0lJLCAodWludDhfdCAqKSBpbnB1dCwgc3RybGVu KGlucHV0KSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVu ZGluZ19yZXF1ZXN0LnVzZXJfZGF0YSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wgYWdlbnRf aW5wdXQoY29uc3QgY2hhciAqaW5wdXQpDQo+ID4gK3sNCj4gPiArICAgICAgIGJvb2wgcmVwZWF0 ID0gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKHBlbmRpbmdfcmVxdWVzdC50eXBlID09 IE5PTkUpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAg ICAgICBzd2l0Y2ggKHBlbmRpbmdfcmVxdWVzdC50eXBlKSB7DQo+ID4gKyAgICAgICBjYXNlIEhF WEFERUNJTUFMOg0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlX2hleGFkZWNpbWFs KGlucHV0KSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXBlYXQgPSB0cnVlOw0KPiA+ ICsgICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAgIGNhc2UgREVDSU1BTDoNCj4gPiAr ICAgICAgICAgICAgICAgaWYgKCFyZXNwb25zZV9kZWNpbWFsKGlucHV0KSkNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICByZXBlYXQgPSB0cnVlOw0KPiA+ICsgICAgICAgICAgICAgICBicmVh azsNCj4gPiArICAgICAgIGNhc2UgQVNDSUk6DQo+ID4gKyAgICAgICAgICAgICAgIHJlc3BvbnNl X2FzY2lpKGlucHV0KTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICBj YXNlIE9VVFBVVDoNCj4gPiArICAgICAgICAgICAgICAgcm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RfaW5wdXRfcmVxdWVzdChvb2JfdHlwZV90IHR5cGUsIHVpbnQxNl90 IG1heF9sZW4sDQo+IGFnZW50X2lucHV0X2NiIGNiLA0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgdm9pZCAqdXNlcl9kYXRhKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBib29sIHJl c3VsdDsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAocGVuZGluZ19yZXF1ZXN0LnR5cGUgIT0gTk9O RSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIEZBTFNFOw0KPiA+ICsNCj4gPiArICAgICAg IHN3aXRjaCAodHlwZSkgew0KPiA+ICsgICAgICAgY2FzZSBIRVhBREVDSU1BTDoNCj4gPiArICAg ICAgICAgICAgICAgcmVzdWx0ID0gcmVxdWVzdF9oZXhhZGVjaW1hbChtYXhfbGVuKTsNCj4gPiAr ICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICBjYXNlIERFQ0lNQUw6DQo+ID4gKyAg ICAgICAgICAgICAgIHJlc3VsdCA9IHJlcXVlc3RfZGVjaW1hbChtYXhfbGVuKTsNCj4gPiArICAg ICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICBjYXNlIEFTQ0lJOg0KPiA+ICsgICAgICAg ICAgICAgICByZXN1bHQgPSByZXF1ZXN0X2FzY2lpKG1heF9sZW4pOw0KPiA+ICsgICAgICAgICAg ICAgICBicmVhazsNCj4gPiArICAgICAgIGNhc2UgTk9ORToNCj4gPiArICAgICAgIGNhc2UgT1VU UFVUOg0KPiA+ICsgICAgICAgZGVmYXVsdDoNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZh bHNlOw0KPiA+ICsgICAgICAgfTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAocmVzdWx0KSB7DQo+ ID4gKyAgICAgICAgICAgICAgIHBlbmRpbmdfcmVxdWVzdC50eXBlID0gdHlwZTsNCj4gPiArICAg ICA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sNCj4gPiArICAgICAgICAgICAgICAgbGVu IC09IG47DQo+ID4gKyAgICAgICAgICAgICAgIGRhdGEgKz0gbjsNCj4gPiArICAgICAgIH0gZWxz ZQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKElTX1VOSUNBU1Qoc3JjKSkgew0KPiA+ICsgICAgICAgICAgICAgICBub2RlID0gbm9kZV9m aW5kX2J5X2FkZHIoc3JjKTsNCj4gPiArICAgICAgIH0gZWxzZQ0KPiA+ICsgICAgICAgICAgICAg ICBub2RlID0gTlVMTDsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIW5vZGUpDQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBwcmltYXJ5ID0gbm9k ZV9nZXRfcHJpbWFyeShub2RlKTsNCj4gPiArICAgICAgIGlmIChwcmltYXJ5ICE9IHNyYykNCj4g PiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHN3aXRj aCAob3Bjb2RlICYgfk9QX1VOUkVMSUFCTEUpIHsNCj4gPiArICAgICAgIGRlZmF1bHQ6DQo+ID4g KyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBjYXNlIE9Q X0RFVl9DT01QX1NUQVRVUzoNCj4gPiArICAgICAgICAgICAgICAgaWYgKGxlbiA8IE1JTl9DT01Q T1NJVElPTl9MRU4gfHwgIW5vZGUpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7 DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChub2RlX3BhcnNlX2NvbXBvc2l0aW9uKG5vZGUsIGRh dGEsIGxlbikpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXByb3ZfZGJfYWRk X25vZGVfY29tcG9zaXRpb24obm9kZSwgZGF0YSwgbGVuKSkNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgICAgICBpZiAobm9kZV9nZXRfY29tcG9zaXRpb24obm9kZSkpDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgcHJvdl9kYl9wcmludF9ub2RlX2NvbXBvc2l0aW9uKG5vZGUp Ow0KPiA+ICsgICAgICAgICAgICAgICBicmVhazsNCj4gPiArDQo+ID4gKyAgICAgICBjYXNlIE9Q X0FQUEtFWV9TVEFUVVM6DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChsZW4gIT0gNCkNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg IHJsX3ByaW50ZigiTm9kZSAlNC40eCBBcHBLZXkgU3RhdHVzICVzXG4iLCBzcmMsDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzaF9zdGF0dXNf c3RyKGRhdGFbMF0pKTsNCj4gPiArICAgICAgICAgICAgICAgbmV0X2lkeCA9IGdldF9sZTE2KGRh dGEgKyAxKSAmIDB4ZmZmOw0KPiA+ICsgICAgICAgICAgICAgICBhcHBfaWR4ID0gZ2V0X2xlMTYo ZGF0YSArIDIpID4+IDQ7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIlx0 TmV0S2V5ICUzLjN4LCBBcHBLZXkgJTMuM3hcbiIsIG5ldF9pZHgsIGFwcF9pZHgpOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgaWYgKGRhdGFbMF0gIT0gTUVTSF9TVEFUVVNfU1VDQ0VTUyAm Jg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YVswXSAhPSBNRVNIX1NU QVRVU19JRFhfQUxSRUFEWV9TVE9SRUQgJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIG5vZGVfYXBwX2tleV9kZWxldGUobm9kZSwgbmV0X2lkeCwgYXBwX2lkeCkpDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgcHJvdl9kYl9ub2RlX2tleXMobm9kZSwgbm9kZV9nZXRf YXBwX2tleXMobm9kZSksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhcHBLZXlzIik7DQo+ID4gKyAgICAgICAgICAg ICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgIGNhc2UgT1BfTkVUS0VZX1NUQVRVUzoNCj4g PiArICAgICAgICAgICAgICAgaWYgKGxlbiAhPSAzKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJOb2RlICU0 LjR4IE5ldEtleSBTdGF0dXMgJXNcbiIsIHNyYywNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNoX3N0YXR1c19zdHIoZGF0YVswXSkpOw0KPiA+ ICsgICAgICAgICAgICAgICBuZXRfaWR4ID0gZ2V0X2xlMTYoZGF0YSArIDEpICYgMHhmZmY7DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIlx0TmV0S2V5ICUzLjN4XG4iLCBu ZXRfaWR4KTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChkYXRhWzBdICE9IE1FU0hf U1RBVFVTX1NVQ0NFU1MgJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRh dGFbMF0gIT0gTUVTSF9TVEFUVVNfSURYX0FMUkVBRFlfU1RPUkVEICYmDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVfbmV0X2tleV9kZWxldGUobm9kZSwg bmV0X2lkeCkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHJvdl9kYl9ub2RlX2tleXMo bm9kZSwgbm9kZV9nZXRfbmV0X2tleXMobm9kZSksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJuZXRLZXlzIik7DQo+ ID4gKyAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgIGNhc2UgT1BfTU9E RUxfQVBQX1NUQVRVUzoNCj4gPiArICAgICAgICAgICAgICAgaWYgKGxlbiAhPSA3ICYmIGxlbiAh PSA5KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAg ICAgICAgICAgICAgcmxfcHJpbnRmKCJOb2RlICU0LjR4IE1vZGVsIEFwcCBTdGF0dXMgJXNcbiIs IHNyYywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBtZXNoX3N0YXR1c19zdHIoZGF0YVswXSkpOw0KPiA+ICsgICAgICAgICAgICAgICBhZGRyID0g Z2V0X2xlMTYoZGF0YSArIDEpOw0KPiA+ICsgICAgICAgICAgICAgICBhcHBfaWR4ID0gZ2V0X2xl MTYoZGF0YSArIDMpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJcdEVs ZW1lbnQgJTQuNHggQXBwSWR4ICUzLjN4XG4gIiwgYWRkciwgYXBwX2lkeCk7DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgICAgICBpZiAobGVuID09IDcpIHsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICBtb2RfaWQgPSBnZXRfbGUxNihkYXRhICsgNSk7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgcmxfcHJpbnRmKCJNb2RlbElkICU0LjR4XG4iLCBtb2RfaWQpOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIG1vZF9pZCA9IDB4ZmZmZjAwMDAgfCBtb2RfaWQ7DQo+ID4gKyAgICAg ICAgICAgICAgIH0gZWxzZSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbW9kX2lkID0g Z2V0X2xlMTYoZGF0YSArIDcpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50 ZigiTW9kZWxJZCAlNC40eCAlNC40eFxuIiwgZ2V0X2xlMTYoZGF0YSArIDUpLA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIG1vZF9pZCk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbW9kX2lkID0g Z2V0X2xlMTYoZGF0YSArIDUpIDw8IDE2IHwgbW9kX2lkOw0KPiA+ICsgICAgICAgICAgICAgICB9 DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZGF0YVswXSA9PSBNRVNIX1NUQVRVU19T VUNDRVNTICYmDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbm9kZV9hZGRfYmluZGluZyhu b2RlLCBhZGRyIC0gc3JjLCBtb2RfaWQsIGFwcF9pZHgpKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHByb3ZfZGJfYWRkX2JpbmRpbmcobm9kZSwgYWRkciAtIHNyYywgbW9kX2lkLCBhcHBf aWR4KTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKw0KPiA+ICsgICAgICAgY2Fz ZSBPUF9DT05GSUdfREVGQVVMVF9UVExfU1RBVFVTOg0KPiA+ICsgICAgICAgICAgICAgICBpZiAo bGVuICE9IDEpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7DQo+ID4g KyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiTm9kZSAlNC40eCBEZWZhdWx0IFRUTCAlZFxuIiwg c3JjLCBkYXRhWzBdKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKG5vZGVfc2V0X2RlZmF1bHRf dHRsIChub2RlLCBkYXRhWzBdKSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcm92X2Ri X25vZGVfc2V0X3R0bChub2RlLCBkYXRhWzBdKTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7 DQo+ID4gKw0KPiA+ICsgICAgICAgY2FzZSBPUF9DT05GSUdfTU9ERUxfUFVCX1NUQVRVUzoNCj4g PiArICAgICAgICAgICAgICAgaWYgKGxlbiAhPSAxMiAmJiBsZW4gIT0gMTQpDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAg ICBybF9wcmludGYoIlxuU2V0IHB1YmxpY2F0aW9uIGZvciBub2RlICU0LjR4IHN0YXR1czogJXNc biIsIHNyYywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFbMF0gPT0g TUVTSF9TVEFUVVNfU1VDQ0VTUyA/ICJTdWNjZXNzIiA6DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzaF9zdGF0dXNfc3RyKGRhdGFbMF0pKTsN Cj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChkYXRhWzBdICE9IE1FU0hfU1RBVFVTX1NV Q0NFU1MpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gKw0K PiA+ICsgICAgICAgICAgICAgICBlbGVfYWRkciA9IGdldF9sZTE2KGRhdGEgKyAxKTsNCj4gPiAr ICAgICAgICAgICAgICAgbW9kX2lkID0gZ2V0X2xlMTYoZGF0YSArIDEwKTsNCj4gPiArICAgICAg ICAgICAgICAgaWYgKGxlbiA9PSAxNCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBtb2Rf aWQgPSAobW9kX2lkIDw8IDE2KSAgfCBnZXRfbGUxNihkYXRhICsgMTIpOw0KPiA+ICsgICAgICAg ICAgICAgICBlbHNlDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbW9kX2lkIHw9IDB4ZmZm ZjAwMDA7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBwdWIudS5hZGRyMTYgPSBnZXRfbGUx NihkYXRhICsgMyk7DQo+ID4gKyAgICAgICAgICAgICAgIHB1Yi5hcHBfaWR4ID0gZ2V0X2xlMTYo ZGF0YSArIDUpOw0KPiA+ICsgICAgICAgICAgICAgICBwdWIudHRsID0gZGF0YVs3XTsNCj4gPiAr ICAgICAgICAgICAgICAgcHViLnBlcmlvZCA9IGRhdGFbOF07DQo+ID4gKyAgICAgICAgICAgICAg IG4gPSAoZGF0YVs4XSAmIDB4M2YpOw0KPiA+ICsgICAgICAgICAgICAgICBzd2l0Y2ggKGRhdGFb OF0gPj4gNikgew0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIDA6DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgcmxfcHJpbnRmKCJQZXJpb2Q6ICVkIG1zXG4iLCBuICogMTAwKTsNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAgICAgICAgICAgY2FzZSAy Og0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG4gKj0gMTA7DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgLyogZmFsbCB0aHJvdWdoICovDQo+ID4gKyAgICAgICAgICAgICAgIGNhc2Ug MToNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIlBlcmlvZDogJWQgc2Vj XG4iLCBuKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAg ICAgICAgICAgY2FzZSAzOg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50Zigi UGVyaW9kOiAlZCBtaW5cbiIsIG4gKiAxMCk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg YnJlYWs7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg IHB1Yi5yZXRyYW5zbWl0ID0gZGF0YVs5XTsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRm KCJSZXRyYW5zbWl0IGNvdW50OiAlZFxuIiwgZGF0YVs5XSA+PiA1KTsNCj4gPiArICAgICAgICAg ICAgICAgcmxfcHJpbnRmKCJSZXRyYW5zbWl0IEludGVydmFsIFN0ZXBzOiAlZFxuIiwgZGF0YVs5 XSAmIDB4MWYpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgZWxlX2lkeCA9IGVsZV9hZGRy IC0gbm9kZV9nZXRfcHJpbWFyeShub2RlKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIC8q IExvY2FsIGNvbmZpZ3VyYXRpb24gaXMgc2F2ZWQgYnkgc2VydmVyICovDQo+ID4gKyAgICAgICAg ICAgICAgIGlmIChub2RlID09IG5vZGVfZ2V0X2xvY2FsX25vZGUoKSkNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBicmVhazsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChub2Rl X21vZGVsX3B1Yl9zZXQobm9kZSwgZWxlX2lkeCwgbW9kX2lkLCAmcHViKSkNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBwcm92X2RiX25vZGVfc2V0X21vZGVsX3B1Yihub2RlLCBlbGVfaWR4 LCBtb2RfaWQsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVf bW9kZWxfcHViX2dldChub2RlLCBlbGVfaWR4LCBtb2RfaWQpKTsNCj4gPiArICAgICAgICAgICAg ICAgYnJlYWs7DQo+ID4gKyAgICAgICB9DQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiAr fQ0KPiA+ICsNCj4gPiArc3RhdGljIHVpbnQzMl90IHRhcmdldDsNCj4gPiArc3RhdGljIHVpbnQz Ml90IHBhcm1zWzhdOw0KPiA+ICsNCj4gPiArc3RhdGljIHVpbnQzMl90IHJlYWRfaW5wdXRfcGFy YW1ldGVycyhjb25zdCBjaGFyICphcmdzKQ0KPiA+ICt7DQo+ID4gKyAgICAgICB1aW50MzJfdCBp Ow0KPiA+ICsNCj4gPiArICAgICAgIGlmICghYXJncykNCj4gPiArICAgICAgICAgICAgICAgcmV0 dXJuIDA7DQo+ID4gKw0KPiA+ICsgICAgICAgbWVtc2V0KHBhcm1zLCAweGZmLCBzaXplb2YocGFy bXMpKTsNCj4gPiArDQo+ID4gKyAgICAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZW9mKHBhcm1zKS9z aXplb2YocGFybXNbMF0pOyBpKyspIHsNCj4gPiArICAgICAgICAgICAgICAgaW50IG47DQo+ID4g Kw0KPiA+ICsgICAgICAgICAgICAgICBzc2NhbmYoYXJncywgIiV4IiwgJnBhcm1zW2ldKTsNCj4g PiArICAgICAgICAgICAgICAgaWYgKHBhcm1zW2ldID09IDB4ZmZmZmZmZmYpDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBuID0g c3RyY3NwbihhcmdzLCAiIFx0Iik7DQo+ID4gKyAgICAgICAgICAgICAgIGFyZ3MgPSBhcmdzICsg biArIHN0cnNwbihhcmdzICsgbiwgIiBcdCIpOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiAr ICAgICAgIHJldHVybiBpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBjbWRfc2V0 X25vZGUoY29uc3QgY2hhciAqYXJncykNCj4gPiArew0KPiA+ICsgICAgICAgdWludDMyX3QgZHN0 Ow0KPiA+ICsgICAgICAgY2hhciAqZW5kOw0KPiA+ICsNCj4gPiArICAgICAgIGRzdCA9IHN0cnRv bChhcmdzLCAmZW5kLCAxNik7DQo+ID4gKyAgICAgICBpZiAoZW5kICE9IChhcmdzICsgNCkpIHsN Cj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJCYWQgdW5pY2FzdCBhZGRyZXNzICVzOiAi DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJleHBlY3RlZCBm b3JtYXQgNCBkaWdpdCBoZXhcbiIsIGFyZ3MpOw0KPiA+ICsgICAgICAgICAgICAgICB0YXJnZXQg PSBVTkFTU0lHTkVEX0FERFJFU1M7DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAg ICAgICAgICBybF9wcmludGYoIkNvbmZpZ3VyaW5nIG5vZGUgJTQuNHhcbiIsIGRzdCk7DQo+ID4g KyAgICAgICAgICAgICAgIHRhcmdldCA9IGRzdDsNCj4gPiArICAgICAgICAgICAgICAgc2V0X21l bnVfcHJvbXB0KCJjb25maWciLCBhcmdzKTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gK30N Cj4gPiArDQo+ID4gK3N0YXRpYyBib29sIGNvbmZpZ19zZW5kKHVpbnQ4X3QgKmJ1ZiwgdWludDE2 X3QgbGVuKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBzdHJ1Y3QgbWVzaF9ub2RlICpub2RlID0gbm9k ZV9nZXRfbG9jYWxfbm9kZSgpOw0KPiA+ICsgICAgICAgdWludDE2X3QgcHJpbWFyeTsNCj4gPiAr DQo+ID4gKyAgICAgICBpZighbm9kZSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNl Ow0KPiA+ICsNCj4gPiArICAgICAgIHByaW1hcnkgPSBub2RlX2dldF9wcmltYXJ5KG5vZGUpOw0K PiA+ICsgICAgICAgaWYgKHRhcmdldCAhPSBwcmltYXJ5KQ0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm4gbmV0X2FjY2Vzc19sYXllcl9zZW5kKERFRkFVTFRfVFRMLCBwcmltYXJ5LA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldCwgQVBQ X0lEWF9ERVYsIGJ1ZiwgbGVuKTsNCj4gPiArDQo+ID4gKyAgICAgICBub2RlX2xvY2FsX2RhdGFf aGFuZGxlcihwcmltYXJ5LCB0YXJnZXQsIG5vZGVfZ2V0X2l2X2luZGV4KG5vZGUpLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZV9nZXRfc2VxdWVuY2VfbnVtYmVyKG5v ZGUpLCBBUFBfSURYX0RFViwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1 ZiwgbGVuKTsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICsNCj4gPiArfQ0KPiA+ICsN Cj4gPiArc3RhdGljIHZvaWQgY21kX2dldF9jb21wb3NpdGlvbihjb25zdCBjaGFyICphcmdzKQ0K PiA+ICt7DQo+ID4gKyAgICAgICB1aW50MTZfdCBuOw0KPiA+ICsgICAgICAgdWludDhfdCBtc2db MzJdOw0KPiA+ICsgICAgICAgc3RydWN0IG1lc2hfbm9kZSAqbm9kZTsNCj4gPiArDQo+ID4gKyAg ICAgICBpZiAoSVNfVU5BU1NJR05FRCh0YXJnZXQpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJs X3ByaW50ZigiRGVzdGluYXRpb24gbm90IHNldFxuIik7DQo+ID4gKyAgICAgICAgICAgICAgIHJl dHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBub2RlID0gbm9kZV9maW5k X2J5X2FkZHIodGFyZ2V0KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIW5vZGUpDQo+ID4gKyAg ICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICBuID0gbWVzaF9vcGNvZGVf c2V0KE9QX0RFVl9DT01QX0dFVCwgbXNnKTsNCj4gPiArDQo+ID4gKyAgICAgICAvKiBCeSBkZWZh dWx0LCB1c2UgcGFnZSAwICovDQo+ID4gKyAgICAgICBtc2dbbisrXSA9IChyZWFkX2lucHV0X3Bh cmFtZXRlcnMoYXJncykgPT0gMSkgPyBwYXJtc1swXSA6IDA7DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKCFjb25maWdfc2VuZChtc2csIG4pKQ0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYo IkZhaWxlZCB0byBzZW5kIFwiR0VUIE5PREUgQ09NUE9TSVRJT05cIlxuIik7DQo+ID4gK30NCj4g PiArDQo+ID4gK3N0YXRpYyB2b2lkIGNtZF9uZXRfa2V5KGNvbnN0IGNoYXIgKmFyZ3MsIHVpbnQz Ml90IG9wY29kZSkNCj4gPiArew0KPiA+ICsgICAgICAgdWludDE2X3QgbjsNCj4gPiArICAgICAg IHVpbnQ4X3QgbXNnWzMyXTsNCj4gPiArICAgICAgIHVpbnQxNl90IG5ldF9pZHg7DQo+ID4gKyAg ICAgICB1aW50OF90ICprZXk7DQo+ID4gKyAgICAgICBzdHJ1Y3QgbWVzaF9ub2RlICpub2RlOw0K PiA+ICsNCj4gPiArICAgICAgIGlmIChJU19VTkFTU0lHTkVEKHRhcmdldCkpIHsNCj4gPiArICAg ICAgICAgICAgICAgcmxfcHJpbnRmKCJEZXN0aW5hdGlvbiBub3Qgc2V0XG4iKTsNCj4gPiArICAg ICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIG4g PSBtZXNoX29wY29kZV9zZXQob3Bjb2RlLCBtc2cpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChy ZWFkX2lucHV0X3BhcmFtZXRlcnMoYXJncykgIT0gMSkgew0KPiA+ICsgICAgICAgICAgICAgICBy bF9wcmludGYoIkJhZCBhcmd1bWVudHMgJXNcbiIsIGFyZ3MpOw0KPiA+ICsgICAgICAgICAgICAg ICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgbm9kZSA9IG5vZGVf ZmluZF9ieV9hZGRyKHRhcmdldCk7DQo+ID4gKyAgICAgICBpZiAoIW5vZGUpIHsNCj4gPiArICAg ICAgICAgICAgICAgcmxfcHJpbnRmKCJOb2RlICU0LjR4XG4gbm90IGZvdW5kIiwgdGFyZ2V0KTsN Cj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiAr ICAgICAgIG5ldF9pZHggPSBwYXJtc1swXTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAob3Bjb2Rl ICE9IE9QX05FVEtFWV9ERUxFVEUpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGtleSA9 IGtleXNfbmV0X2tleV9nZXQobmV0X2lkeCwgdHJ1ZSk7DQo+ID4gKyAgICAgICAgICAgICAgIGlm ICgha2V5KSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJOZXR3b3Jr IGtleSB3aXRoIGluZGV4ICU0LjR4IG5vdCBmb3VuZFxuIiwNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0X2lkeCk7 DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAgICAgICAgICAg ICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBwdXRfbGUxNihuZXRfaWR4LCAmbXNnW25d KTsNCj4gPiArICAgICAgICAgICAgICAgbiArPSAyOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAgbWVtY3B5KG1zZyArIG4sIGtleSwgMTYpOw0KPiA+ICsgICAgICAgICAgICAgICBuICs9IDE2 Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmICghY29uZmlnX3NlbmQobXNn LCBuKSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkZhaWxlZCB0byBzZW5kIFwi JXMgTkVUIEtFWVwiXG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3Bj b2RlID09IE9QX05FVEtFWV9BREQgPyAiQUREIiA6ICJERUwiKTsNCj4gPiArICAgICAgICAgICAg ICAgcmV0dXJuOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmIChvcGNvZGUg IT0gT1BfTkVUS0VZX0RFTEVURSkgew0KPiA+ICsgICAgICAgICAgICAgICBpZiAobm9kZV9uZXRf a2V5X2FkZChub2RlLCBuZXRfaWR4KSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcm92 X2RiX25vZGVfa2V5cyhub2RlLCBub2RlX2dldF9uZXRfa2V5cyhub2RlKSwNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg Im5ldEtleXMiKTsNCj4gPiArICAgICAgIH0gZWxzZSB7DQo+ID4gKyAgICAgICAgICAgICAgIGlm IChub2RlX25ldF9rZXlfZGVsZXRlKG5vZGUsIG5ldF9pZHgpKQ0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgIHByb3ZfZGJfbm9kZV9rZXlzKG5vZGUsIG5vZGVfZ2V0X25ldF9rZXlzKG5vZGUp LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAibmV0S2V5cyIpOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArfQ0K PiA+ICsNCj4gPiArc3RhdGljIHZvaWQgY21kX2FkZF9uZXRfa2V5KGNvbnN0IGNoYXIgKmFyZ3Mp DQo+ID4gK3sNCj4gPiAr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7DQo+ID4gKyAgICAg ICAgICAgICAgIHJsX3ByaW50ZigiTm9kZSAlNC40eFxuIG5vdCBmb3VuZCIsIHRhcmdldCk7DQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICBuID0gbWVzaF9vcGNvZGVfc2V0KG9wY29kZSwgbXNnKTsNCj4gPiArDQo+ID4gKyAgICAg ICBhcHBfaWR4ID0gcGFybXNbMF07DQo+ID4gKyAgICAgICBuZXRfaWR4ID0ga2V5c19hcHBfa2V5 X2dldF9ib3VuZChhcHBfaWR4KTsNCj4gPiArICAgICAgIGlmIChuZXRfaWR4ID09IE5FVF9JRFhf SU5WQUxJRCkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkFwcCBrZXkgd2l0aCBp bmRleCAlNC40eCBub3QgZm91bmRcbiIsIGFwcF9pZHgpOw0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgbXNnW24rK10gPSBuZXRf aWR4ICYgMHhmOw0KPiA+ICsgICAgICAgbXNnW24rK10gPSAoKG5ldF9pZHggPj4gOCkgJiAweGYp IHwNCj4gPiArICAgICAgICAgICAgICAgKChhcHBfaWR4IDw8IDQpICYgMHhmMCk7DQo+ID4gKyAg ICAgICBtc2dbbisrXSA9IGFwcF9pZHggPj4gNDsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAob3Bj b2RlICE9IE9QX0FQUEtFWV9ERUxFVEUpIHsNCj4gPiArICAgICAgICAgICAgICAga2V5ID0ga2V5 c19hcHBfa2V5X2dldChhcHBfaWR4LCB0cnVlKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFr ZXkpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIkFwcCBrZXkgJTQu NHggbm90IGZvdW5kXG4iLCBuZXRfaWR4KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBy ZXR1cm47DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg IG1lbWNweShtc2cgKyBuLCBrZXksIDE2KTsNCj4gPiArICAgICAgICAgICAgICAgbiArPSAxNjsN Cj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIWNvbmZpZ19zZW5kKG1zZywg bikpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJGYWlsZWQgdG8gc2VuZCBcIkFE RCAlcyBLRVlcIlxuIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wY29k ZSA9PSBPUF9BUFBLRVlfQUREID8gIkFERCIgOiAiREVMIik7DQo+ID4gKyAgICAgICAgICAgICAg IHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAob3Bjb2RlICE9 IE9QX0FQUEtFWV9ERUxFVEUpIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKG5vZGVfYXBwX2tl eV9hZGQobm9kZSwgYXBwX2lkeCkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHJvdl9k Yl9ub2RlX2tleXMobm9kZSwgbm9kZV9nZXRfYXBwX2tleXMobm9kZSksDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJh cHBLZXlzIik7DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBpZiAo bm9kZV9hcHBfa2V5X2RlbGV0ZShub2RlLCBuZXRfaWR4LCBhcHBfaWR4KSkNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBwcm92X2RiX25vZGVfa2V5cyhub2RlLCBub2RlX2dldF9hcHBfa2V5 cyhub2RlKSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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ICBuID0gbWVzaF9vcGNvZGVfc2V0KE9QX01P REVMX0FQUF9CSU5ELCBtc2cpOw0KPiA+ICsNCj4gPiArICAgICAgIHB1dF9sZTE2KHRhcmdldCAr IHBhcm1zWzBdLCBtc2cgKyBuKTsNCj4gPiArICAgICAgIG4gKz0gMjsNCj4gPiArICAgICAgIHB1 dF9sZTE2KHBhcm1zWzFdLCBtc2cgKyBuKTsNCj4gPiArICAgICAgIG4gKz0gMjsNCj4gPiArICAg ICAgIGlmIChwYXJtX2NudCA9PSA0KSB7DQo+ID4gKyAgICAgICAgICAgICAgIHB1dF9sZTE2KHBh cm1zWzNdLCBtc2cgKyBuKTsNCj4gPiArICAgICAgICAgICAgICAgcHV0X2xlMTYocGFybXNbMl0s IG1zZyArIG4gKyAyKTsNCj4gPiArICAgICAgICAgICAgICAgbiArPSA0Ow0KPiA+ICsgICAgICAg fSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAgcHV0X2xlMTYocGFybXNbMl0sIG1zZyArIG4p Ow0KPiA+ICsgICAgICAgICAgICAgICBuICs9IDI7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ ICsgICAgICAgaWYgKCFjb25maWdfc2VuZChtc2csIG4pKQ0KPiA+ICsgICAgICAgICAgICAgICBy bF9wcmludGYoIkZhaWxlZCB0byBzZW5kIFwiTU9ERUwgQVBQIEJJTkRcIlxuIik7DQo+ID4gK30N Cj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIGNtZF9zZXRfdHRsKGNvbnN0IGNoYXIgKmFyZ3MpDQo+ ID4gK3sNCj4gPiArICAgICAgIHVpbnQxNl90IG47DQo+ID4gKyAgICAgICB1aW50OF90IG1zZ1sz Ml07DQo+ID4gKyAgICAgICBpbnQgcGFybV9jbnQ7DQo+ID4gKyAgICAgICB1aW50OF90IHR0bDsN Cj4gPiArDQo+ID4gKyAgICAgICBpZiAoSVNfVU5BU1NJR05FRCh0YXJnZXQpKSB7DQo+ID4gKyAg ICAgICAgICAgICAgIHJsX3ByaW50ZigiRGVzdGluYXRpb24gbm90IHNldFxuIik7DQo+ID4gKyAg ICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBu ID0gbWVzaF9vcGNvZGVfc2V0KE9QX0NPTkZJR19ERUZBVUxUX1RUTF9TRVQsIG1zZyk7DQo+ID4g Kw0KPiA+ICsgICAgICAgcGFybV9jbnQgPSByZWFkX2lucHV0X3BhcmFtZXRlcnMoYXJncyk7DQo+ ID4gKyAgICAgICBpZiAocGFybV9jbnQpIHsNCj4gPiArICAgICAgICAgICAgICAgdHRsID0gcGFy bXNbMF0gJiBUVExfTUFTSzsNCj4gPiArICAgICAgIH0gZWxzZQ0KPiA+ICsgICAgICAgICAgICAg ICB0dGwgPSBub2RlX2dldF9kZWZhdWx0X3R0bChub2RlX2dldF9sb2NhbF9ub2RlKCkpOw0KPiA+ ICsNCj4gPiArICAgICAgIG1zZ1tuKytdID0gdHRsOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICgh Y29uZmlnX3NlbmQobXNnLCBuKSkNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJGYWls ZWQgdG8gc2VuZCBcIlNFVF9ERUZBVUxUIFRUTFwiXG4iKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiAr c3RhdGljIHZvaWQgY21kX3NldF9wdWIoY29uc3QgY2hhciAqYXJncykNCj4gPiArew0KPiA+ICsg ICAgICAgdWludDE2X3QgbjsNCj4gPiArICAgICAgIHVpbnQ4X3QgbXNnWzMyXTsNCj4gPiArICAg ICAgIGludCBwYXJtX2NudDsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoSVNfVU5BU1NJR05FRCh0 YXJnZXQpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRGVzdGluYXRpb24gbm90 IHNldFxuIik7DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4g PiArDQo+ID4gKyAgICAgICBuID0gbWVzaF9vcGNvZGVfc2V0KE9QX0NPTkZJR19NT0RFTF9QVUJf U0VULCBtc2cpOw0KPiA+ICsNCj4gPiArICAgICAgIHBhcm1fY250ID0gcmVhZF9pbnB1dF9wYXJh bWV0ZXJzKGFyZ3MpOw0KPiA+ICsgICAgICAgaWYgKHBhcm1fY250ICE9IDUpIHsNCj4gPiArICAg ICAgICAgICAgICAgcmxfcHJpbnRmKCJCYWQgYXJndW1lbnRzOiAlc1xuIiwgYXJncyk7DQo+ID4g KyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAg ICBwdXRfbGUxNihwYXJtc1swXSwgbXNnICsgbik7DQo+ID4gKyAgICAgICBuICs9IDI7DQo+ID4g KyAgICAgICAvKiBQdWJsaXNoIGFkZHJlc3MgKi8NCj4gPiArICAgICAgIHB1dF9sZTE2KHBhcm1z WzFdLCBtc2cgKyBuKTsNCj4gPiArICAgICAgIG4gKz0gMjsNCj4gPiArICAgICAgIC8qIEFwcCBr ZXkgaW5kZXggKyBjcmVkZW50aWFsIChzZXQgdG8gMCkgKi8NCj4gPiArICAgICAgIHB1dF9sZTE2 KHBhcm1zWzJdLCBtc2cgKyBuKTsNCj4gPiArICAgICAgIG4gKz0gMjsNCj4gPiArICAgICAgIC8q IFRUTCAqLw0KPiA+ICsgICAgICAgbXNnW24rK10gPSBERUZBVUxUX1RUTDsNCj4gPiArICAgICAg IC8qIFB1Ymxpc2ggcGVyaW9kICBzdGVwIGNvdW50IGFuZCBzdGVwIHJlc29sdXRpb24gKi8NCj4g PiArICAgICAgIG1zZ1tuKytdID0gcGFybXNbM107DQo+ID4gKyAgICAgICAvKiBQdWJsaXNoIHJl dHJhbnNtaXQgY291bnQgJiBpbnRlcnZhbCBzdGVwcyAqLw0KPiA+ICsgICAgICAgbXNnW24rK10g PSAoMSA8PCA1KSArIDI7DQo+ID4gKyAgICAgICAvKiBNb2RlbCBJZCAqLw0KPiA+ICsgICAgICAg aWYgKHBhcm1zWzRdID4gMHhmZmZmKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHB1dF9sZTE2KHBh cm1zWzRdID4+IDE2LCBtc2cgKyBuKTsNCj4gPiArICAgICAgICAgICAgICAgcHV0X2xlMTYocGFy bXNbNF0sIG1zZyArIG4gKyAyKTsNCj4gPiArICAgICAgICAgICAgICAgbiArPSA0Ow0KPiA+ICsg ICAgICAgfSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAgcHV0X2xlMTYocGFybXNbNF0sIG1z ZyArIG4pOw0KPiA+ICsgICAgICAgICAgICAgICBuICs9IDI7DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgaWYgKCFjb25maWdfc2VuZChtc2csIG4pKQ0KPiA+ICsgICAgICAgICAg ICAgICBybF9wcmludGYoIkZhaWxlZCB0byBzZW5kIFwiU0VUIE1PREVMIFBVQkxJQ0FUSU9OXCJc biIpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBjbWRfZGVmYXVsdCh1aW50MzJf dCBvcGNvZGUpDQo+ID4gK3sNCj4gPiArICAgICAgIHVpbnQxNl90IG47DQo+ID4gKyAgICAgICB1 aW50OF90IG1zZ1szMl07DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKElTX1VOQVNTSUdORUQodGFy Z2V0KSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkRlc3RpbmF0aW9uIG5vdCBz ZXRcbiIpOw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgbiA9IG1lc2hfb3Bjb2RlX3NldChvcGNvZGUsIG1zZyk7DQo+ID4gKw0K PiA+ICsgICAgICAgaWYgKCFjb25maWdfc2VuZChtc2csIG4pKQ0KPiA+ICsgICAgICAgICAgICAg ICBybF9wcmludGYoIkZhaWxlZCB0byBzZW5kIGNvbW1hbmQgKG9wY29kZSAweCV4KVxuIiwgb3Bj b2RlKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgY21kX2dldF90dGwoY29uc3Qg Y2hhciAqYXJncykNCj4gPiArew0KPiA+ICsgICAgICAgY21kX2RlZmF1bHQoT1BfQ09ORklHX0RF RkFVTFRfVFRMX0dFVCk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIGNtZF9iYWNr KGNvbnN0IGNoYXIgKmFyZ3MpDQo+ID4gK3sNCj4gPiArICAgICAgIGNtZF9tZW51X21haW4oZmFs c2UpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBjbWRfaGVscChjb25zdCBjaGFy ICphcmdzKTsNCj4gPiArDQo+ID4gK3N0YXRpYyBjb25zdCBzdHJ1Y3QgbWVudV9lbnRyeSBjZmdf bWVudVtdID0gew0KPiA+ICsgICAgICAgeyJ0YXJnZXQiLCAgICAgICAgICAgICAgIjx1bmljYXN0 PiIsICAgICAgICAgICAgICAgICAgICBjbWRfc2V0X25vZGUsDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlNldCB0YXJnZXQgbm9kZSB0byBjb25m aWd1cmUifSwNCj4gPiArICAgICAgIHsiZ2V0LWNvbXBvc2l0aW9uIiwgICAgICJbPHBhZ2VfbnVt Pl0iLCAgICAgICAgIGNtZF9nZXRfY29tcG9zaXRpb24sDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkdldCBDb21wb3NpdGlvbiBEYXRhIn0sDQo+ ID4gKyAgICAgICB7ImFkZC1uZXRrZXkiLCAgICAgICAgICAiPG5ldF9pZHg+IiwgICAgICAgICAg ICAgICAgICAgIGNtZF9hZGRfbmV0X2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAiQWRkIG5ldHdvcmsga2V5In0sDQo+ID4gKyAgICAgICB7 ImRlbC1uZXRrZXkiLCAgICAgICAgICAiPG5ldF9pZHg+IiwgICAgICAgICAgICAgICAgICAgIGNt ZF9kZWxfbmV0X2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAiRGVsZXRlIG5ldHdvcmsga2V5In0sDQo+ID4gKyAgICAgICB7ImFkZC1hcHBr ZXkiLCAgICAgICAgICAiPGFwcF9pZHg+IiwgICAgICAgICAgICAgICAgICAgIGNtZF9hZGRfYXBw X2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAiQWRkIGFwcGxpY2F0aW9uIGtleSJ9LA0KPiA+ICsgICAgICAgeyJkZWwtYXBwa2V5IiwgICAg ICAgICAgIjxhcHBfaWR4PiIsICAgICAgICAgICAgICAgICAgICBjbWRfZGVsX2FwcF9rZXksDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkRlbGV0 ZSBhcHBsaWNhdGlvbiBrZXkifSwNCj4gPiArICAgICAgIHsiYmluZCIsICAgICAgICAgICAgICAg ICI8ZWxlX2lkeD4gPGFwcF9pZHg+IDxtb2RfaWQ+IFtjaWRdIiwNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGNtZF9iaW5kLCAgICAgICAiQmluZCBhcHAga2V5IHRvIGEgbW9k ZWwifSwNCj4gPiArICAgICAgIHsic2V0LXR0bCIsICAgICAgICAgICAgICI8dHRsPiIsICAgICAg ICAgICAgICAgICAgICAgICAgY21kX3NldF90dGwsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIlNldCBkZWZhdWx0IFRUTCJ9LA0KPiA+ICsgICAg ICAgeyJnZXQtdHRsIiwgICAgICAgICAgICAgTlVMTCwgICAgICAgICAgICAgICAgICAgY21kX2dl dF90dGwsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIkdldCBkZWZhdWx0IFRUTCJ9LA0KPiA+ICsgICAgICAgeyJzZXQtcHViIiwgIjxlbGVfYWRk cj4gPHB1Yl9hZGRyPiA8YXBwX2lkeD4gIg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICI8cGVyaW9kIChzdGVwfHJlcyk+IDxtb2RlbD4iLA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21kX3NldF9wdWIsICAgICJTZXQgcHVi bGljYXRpb24ifSwNCj4gPiArICAgICAgIHsiYmFjayIsICAgICAgICAgICAgICAgIE5VTEwsICAg ICAgICAgICAgICAgICAgICAgICAgICAgY21kX2JhY2ssDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkJhY2sgdG8gbWFpbiBtZW51In0sDQo+ID4g KyAgICAgICB7ImhlbHAiLCAgICAgICAgICAgICAgICBOVUxMLCAgICAgICAgICAgICAgICAgICAg ICAgICAgIGNtZF9oZWxwLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICJDb25maWcgQ29tbWFuZHMifSwNCj4gPiArICAgICAgIHt9DQo+ID4gK307 DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBjbWRfaGVscChjb25zdCBjaGFyICphcmdzKQ0KPiA+ ICt7DQo+ID4gKyAgICAgICBybF9wcmludGYoIkNsaWVudCBDb25maWd1cmF0aW9uIE1lbnVcbiIp Ow0KPiA+ICsgICAgICAgcHJpbnRfY21kX21lbnUoY2ZnX21lbnUpOw0KPiA+ICt9DQo+ID4gKw0K PiA+ICt2b2lkIGNvbmZpZ19zZXRfbm9kZShjb25zdCBjaGFyICphcmdzKQ0KPiA+ICt7DQo+ID4g KyAgICAgICBjbWRfc2V0X25vZGUoYXJncyk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3ZvaWQgY29u ZmlnX2NsaWVudF9nZXRfY29tcG9zaXRpb24odWludDMyX3QgZHN0KQ0KPiA+ICt7DQo+ID4gKyAg ICAgICB1aW50MzJfdCB0bXAgPSB0YXJnZXQ7DQo+ID4gKw0KPiA+ICsgICAgICAgdGFyZ2V0ID0g ZHN0Ow0KPiA+ICsgICAgICAgY21kX2dldF9jb21wb3NpdGlvbigiIik7DQo+ID4gKyAgICAgICB0 YXJnZXQgPSB0bXA7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBzdHJ1Y3QgbWVzaF9tb2Rl bF9vcHMgY2xpZW50X2NicyA9IHsNCj4gPiArICAgICAgIGNsaWVudF9tc2dfcmVjdmQsDQo+ID4g KyAgICAgICAgICAgICAgIE5VTEwsDQo+ID4gKyAgICAgICAgICAgICAgIE5VTEwsDQo+ID4gKyAg ICAgICAgICAgICAgIE5VTEwNCj4gPiArfTsNCj4gPiArDQo+ID4gK2Jvb2wgY29uZmlnX2NsaWVu dF9pbml0KHZvaWQpDQo+ID4gK3sNCj4gPiArICAgICAgIGlmICghbm9kZV9sb2NhbF9tb2RlbF9y ZWdpc3RlcihQUklNQVJZX0VMRU1FTlRfSURYLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIENPTkZJR19DTElFTlRfTU9ERUxfSUQsDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmNsaWVudF9jYnMs IE5VTEwpKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsg ICAgICAgYWRkX2NtZF9tZW51KCJjb25maWd1cmUiLCBjZmdfbWVudSk7DQo+ID4gKw0KPiA+ICsg ICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4gPi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gICBsZW4gLT0gbjsNCj4gPiArICAg ICAgICAgICAgICAgZGF0YSArPSBuOw0KPiA+ICsgICAgICAgfSBlbHNlDQo+ID4gKyAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBub2RlID0gbm9kZV9nZXRf bG9jYWxfbm9kZSgpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICghbm9kZSkNCj4gPiArICAgICAg ICAgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gKw0KPiA+ICsgICAgICAgc3dpdGNoIChvcGNvZGUg JiB+T1BfVU5SRUxJQUJMRSkgew0KPiA+ICsgICAgICAgZGVmYXVsdDoNCj4gPiArICAgICAgICAg ICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGNhc2UgT1BfQ09ORklHX0RF RkFVTFRfVFRMX1NFVDoNCj4gPiArICAgICAgICAgICAgICAgaWYgKGxlbiAhPSAxIHx8IGRhdGFb MF0gPiBUVExfTUFTSyB8fCBkYXRhWzBdID09IDEpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgcmV0dXJuIHRydWU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZGF0YVswXSA8 PSBUVExfTUFTSykgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG5vZGVfc2V0X2RlZmF1 bHRfdHRsKG5vZGUsIGRhdGFbMF0pOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHByb3Zf ZGJfbm9kZV9zZXRfdHRsKG5vZGUsIGRhdGFbMF0pOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAvKiBGYWxsIFRocm91Z2ggKi8NCj4gPiArDQo+ID4g KyAgICAgICBjYXNlIE9QX0NPTkZJR19ERUZBVUxUX1RUTF9HRVQ6DQo+ID4gKyAgICAgICAgICAg ICAgIG4gPSBtZXNoX29wY29kZV9zZXQoT1BfQ09ORklHX0RFRkFVTFRfVFRMX1NUQVRVUywgbXNn KTsNCj4gPiArICAgICAgICAgICAgICAgbXNnW24rK10gPSBub2RlX2dldF9kZWZhdWx0X3R0bChu b2RlKTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKw0KPiA+ICsgICAgICAgY2Fz ZSBPUF9DT05GSUdfTU9ERUxfUFVCX1NFVDoNCj4gPiArICAgICAgICAgICAgICAgaWYgKGxlbiAh PSAxMSAmJiBsZW4gIT0gMTMpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRy dWU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIlNldCBwdWJsaWNhdGlv blxuIik7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBlbGVfYWRkciA9IGdldF9sZTE2KGRh dGEpOw0KPiA+ICsgICAgICAgICAgICAgICBtb2RfaWQgPSBnZXRfbGUxNihkYXRhICsgOSk7DQo+ ID4gKyAgICAgICAgICAgICAgIGlmIChsZW4gPT0gMTQpDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgbW9kX2lkID0gKG1vZF9pZCA8PCAxNikgIHwgZ2V0X2xlMTYoZGF0YSArIDExKTsNCj4g PiArICAgICAgICAgICAgICAgZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1vZF9p ZCB8PSAweGZmZmYwMDAwOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcHViLnUuYWRkcjE2 ID0gZ2V0X2xlMTYoZGF0YSArIDIpOw0KPiA+ICsgICAgICAgICAgICAgICBwdWIuYXBwX2lkeCA9 IGdldF9sZTE2KGRhdGEgKyA0KTsNCj4gPiArICAgICAgICAgICAgICAgcHViLnR0bCA9IGRhdGFb Nl07DQo+ID4gKyAgICAgICAgICAgICAgIHB1Yi5wZXJpb2QgPSBkYXRhWzddOw0KPiA+ICsgICAg ICAgICAgICAgICBuID0gKGRhdGFbN10gJiAweDNmKTsNCj4gPiArICAgICAgICAgICAgICAgc3dp dGNoIChkYXRhWzddID4+IDYpIHsNCj4gPiArICAgICAgICAgICAgICAgY2FzZSAwOg0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50ZigiUGVyaW9kOiAlZCBtc1xuIiwgbiAqIDEw MCk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICAgICAg ICAgIGNhc2UgMjoNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBuICo9IDEwOw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIC8qIGZhbGwgdGhyb3VnaCAqLw0KPiA+ICsgICAgICAgICAg ICAgICBjYXNlIDE6DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJQZXJp b2Q6ICVkIHNlY1xuIiwgbik7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ ID4gKyAgICAgICAgICAgICAgIGNhc2UgMzoNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBy bF9wcmludGYoIlBlcmlvZDogJWQgbWluXG4iLCBuICogMTApOw0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgIGJyZWFrOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICBwdWIucmV0cmFuc21pdCA9IGRhdGFbOF07DQo+ID4gKyAgICAgICAgICAgICAg IHJsX3ByaW50ZigiUmV0cmFuc21pdCBjb3VudDogJWRcbiIsIGRhdGFbOF0gPj4gNSk7DQo+ID4g KyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiUmV0cmFuc21pdCBJbnRlcnZhbCBTdGVwczogJWRc biIsIGRhdGFbOF0gJiAweDFmKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGVsZV9pZHgg PSBlbGVfYWRkciAtIG5vZGVfZ2V0X3ByaW1hcnkobm9kZSk7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBpZiAobm9kZV9tb2RlbF9wdWJfc2V0KG5vZGUsIGVsZV9pZHgsIG1vZF9pZCwgJnB1 YikpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcm92X2RiX25vZGVfc2V0X21vZGVs X3B1Yihub2RlLCBlbGVfaWR4LCBtb2RfaWQsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIG5vZGVfbW9kZWxfcHViX2dldChub2RlLCBlbGVfaWR4LCBtb2RfaWQpKTsN Cj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgICAgICAgICBicmVhazsNCj4gPiAr ICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBwcmltYXJ5ID0gbm9kZV9nZXRfcHJpbWFyeShu b2RlKTsNCj4gPiArICAgICAgIGlmIChzcmMgIT0gcHJpbWFyeSkNCj4gPiArICAgICAgICAgICAg ICAgbmV0X2FjY2Vzc19sYXllcl9zZW5kKG5vZGVfZ2V0X2RlZmF1bHRfdHRsKG5vZGUpLCBwcmlt YXJ5LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMsIEFQ UF9JRFhfREVWLCBtc2csIGxlbik7DQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiArfQ0K PiA+ICsNCj4gPiArDQo+ID4gK3N0YXRpYyBzdHJ1Y3QgbWVzaF9tb2RlbF9vcHMgc2VydmVyX2Ni cyA9IHsNCj4gPiArICAgICAgIHNlcnZlcl9tc2dfcmVjdmQsDQo+ID4gKyAgICAgICAgICAgICAg IE5VTEwsDQo+ID4gKyAgICAgICAgICAgICAgIE5VTEwsDQo+ID4gKyAgICAgICAgICAgICAgIE5V TEwNCj4gPiArfTsNCj4gPiArDQo+ID4gK2Jvb2wgY29uZmlnX3NlcnZlcl9pbml0KHZvaWQpDQo+ ID4gK3sNC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gMCk7DQo+ID4gKyAgICAgICBpZiAoZmQgPCAwKQ0KPiA+ICsgICAg ICAgICAgICAgICByZXR1cm4gLTE7DQo+ID4gKw0KPiA+ICsgICAgICAgbWVtc2V0KCZzYWxnLCAw LCBzaXplb2Yoc2FsZykpOw0KPiA+ICsgICAgICAgc2FsZy5zYWxnX2ZhbWlseSA9IEFGX0FMRzsN Cj4gPiArICAgICAgIHN0cmNweSgoY2hhciAqKSBzYWxnLnNhbGdfdHlwZSwgImhhc2giKTsNCj4g PiArICAgICAgIHN0cmNweSgoY2hhciAqKSBzYWxnLnNhbGdfbmFtZSwgImNtYWMoYWVzKSIpOw0K PiA+ICsNCj4gPiArICAgICAgIGlmIChiaW5kKGZkLCAoc3RydWN0IHNvY2thZGRyICopICZzYWxn LCBzaXplb2Yoc2FsZykpIDwgMCkgew0KPiA+ICsgICAgICAgICAgICAgICBjbG9zZShmZCk7DQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybiAtMTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4g KyAgICAgICBuZmQgPSBhbGdfbmV3KGZkLCBrZXksIDE2LCAwKTsNCj4gPiArDQo+ID4gKyAgICAg ICBjbG9zZShmZCk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIG5mZDsNCj4gPiArfQ0KPiA+ ICsNCj4gPiArc3RhdGljIGJvb2wgYWVzX2NtYWMoaW50IGZkLCBjb25zdCB1aW50OF90ICptc2cs DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBtc2df bGVuLCB1aW50OF90IHJlc1sxNl0pDQo+ID4gK3sNCj4gPiArICAgICAgIHNzaXplX3QgbGVuOw0K PiA+ICsNCj4gPiArICAgICAgIGlmIChtc2dfbGVuID4gQ01BQ19NU0dfTUFYKQ0KPiA+ICsgICAg ICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgbGVuID0gc2VuZChm ZCwgbXNnLCBtc2dfbGVuLCAwKTsNCj4gPiArICAgICAgIGlmIChsZW4gPCAwKQ0KPiA+ICsgICAg ICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgbGVuID0gcmVhZChm ZCwgcmVzLCAxNik7DQo+ID4gKyAgICAgICBpZiAobGVuIDwgMCkNCj4gPiArICAgICAgICAgICAg ICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9 DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBhZXNfY21hY19kZXN0cm95KGludCBmZCkNCj4gPiAr ew0KPiA+ICsgICAgICAgY2xvc2UoZmQpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgaW50 IGFlc19jbWFjX05fc3RhcnQoY29uc3QgdWludDhfdCBOWzE2XSkNCj4gPiArew0KPiA+ICsgICAg ICAgaW50IGZkOw0KPiA+ICsNCj4gPiArICAgICAgIGZkID0gYWVzX2NtYWNfc2V0dXAoTik7DQo+ ID4gKyAgICAgICByZXR1cm4gZmQ7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBib29sIGFl c19jbWFjX29uZShjb25zdCB1aW50OF90IGtleVsxNl0sIGNvbnN0IHZvaWQgKm1zZywNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG1zZ19sZW4sIHVp bnQ4X3QgcmVzWzE2XSkNCj4gPiArew0KPiA+ICsgICAgICAgYm9vbCByZXN1bHQ7DQo+ID4gKyAg ICAgICBpbnQgZmQ7DQo+ID4gKw0KPiA+ICsgICAgICAgZmQgPSBhZXNfY21hY19zZXR1cChrZXkp Ow0KPiA+ICsgICAgICAgaWYgKGZkIDwgMCkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZh bHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHJlc3VsdCA9IGFlc19jbWFjKGZkLCBtc2csIG1zZ19s ZW4sIHJlcyk7DQo+ID4gKw0KPiA+ICsgICAgICAgYWVzX2NtYWNfZGVzdHJveShmZCk7DQo+ID4g Kw0KPiA+ICsgICAgICAgcmV0dXJuIHJlc3VsdDsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBt ZXNoX2NyeXB0b19hZXNfY21hYyhjb25zdCB1aW50OF90IGtleVsxNl0sIGNvbnN0IHVpbnQ4X3Qg Km1zZywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90 IG1zZ19sZW4sIHVpbnQ4X3QgcmVzWzE2XSkNCj4gPiArew0KPiA+ICsgICAgICAgcmV0dXJuIGFl c19jbWFjX29uZShrZXksIG1zZywgbXNnX2xlbiwgcmVzKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiAr Ym9vbCBtZXNoX2NyeXB0b19hZXNfY2NtX2VuY3J5cHQoY29uc3QgdWludDhfdCBub25jZVsxM10s IGNvbnN0DQo+IHVpbnQ4X3Qga2V5WzE2XSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqYWFkLCB1aW50MTZfdCBhYWRfbGVuLA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90ICpt c2csIHVpbnQxNl90IG1zZ19sZW4sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHVpbnQ4X3QgKm91dF9tc2csIHZvaWQgKm91dF9taWMsDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBtaWNfc2l6ZSkNCj4gPiArew0K PiA+ICsgICAgICAgdWludDhfdCBwbXNnWzE2XSwgY21pY1sxNl0sIGNtc2dbMTZdOw0KPiA+ICsg ICAgICAgdWludDhfdCBtaWNbMTZdLCBYblsxNl07DQ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DAgOiAweDAwKTsNCj4gPiArICAgICAgIGVsc2UNCj4gPiArICAgICAgICAgICAgICAg cG1zZ1swXSA9IDB4MDkgfCAoYWFkX2xlbiA/IDB4NDAgOiAweDAwKTsNCj4gPiArDQo+ID4gKyAg ICAgICBtZW1jcHkocG1zZyArIDEsIG5vbmNlLCAxMyk7DQo+ID4gKyAgICAgICBwdXRfYmUxNiht c2dfbGVuLCBwbXNnICsgMTQpOw0KPiA+ICsNCj4gPiArICAgICAgIHJlc3VsdCA9IGFlc19lY2Io ZmQsIHBtc2csIFhuKTsNCj4gPiArICAgICAgIGlmICghcmVzdWx0KQ0KPiA+ICsgICAgICAgICAg ICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogSWYgQUFEIGlzIGJlaW5nIHVz ZWQgdG8gYXV0aGVudGljYXRlLCBpbmNsdWRlIGl0IGhlcmUgKi8NCj4gPiArICAgICAgIGlmIChh YWRfbGVuKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHB1dF9iZTE2KGFhZF9sZW4sIHBtc2cpOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHNpemVvZih1aW50MTZf dCk7IGkrKykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwbXNnW2ldID0gWG5baV0gXiBw bXNnW2ldOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaiA9IDA7DQo+ID4gKyAgICAgICAg ICAgICAgIGFhZF9sZW4gKz0gc2l6ZW9mKHVpbnQxNl90KTsNCj4gPiArICAgICAgICAgICAgICAg d2hpbGUgKGFhZF9sZW4gPiAxNikgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGRvIHsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBtc2dbaV0gPSBYbltpXSBeIGFh ZFtqXTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkrKywgaisrOw0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGkgPCAxNik7DQo+ID4gKw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIGFhZF9sZW4gLT0gMTY7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgaSA9IDA7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJlc3Vs dCA9IGFlc19lY2IoZmQsIHBtc2csIFhuKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBp ZiAoIXJlc3VsdCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9u ZTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgZm9y IChpID0gMDsgaSA8IGFhZF9sZW47IGkrKywgaisrKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIHBtc2dbaV0gPSBYbltpXSBeIGFhZFtqXTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg IGZvciAoaSA9IGFhZF9sZW47IGkgPCAxNjsgaSsrKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIHBtc2dbaV0gPSBYbltpXTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHJlc3VsdCA9 IGFlc19lY2IoZmQsIHBtc2csIFhuKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQp DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgfQ0K PiA+ICsNCj4gPiArICAgICAgIGxhc3RfYmxrID0gbXNnX2xlbiAlIDE2Ow0KPiA+ICsgICAgICAg YmxrX2NudCA9IChtc2dfbGVuICsgMTUpIC8gMTY7DQo+ID4gKyAgICAgICBpZiAoIWxhc3RfYmxr KQ0KPiA+ICsgICAgICAgICAgICAgICBsYXN0X2JsayA9IDE2Ow0KPiA+ICsNCj4gPiArICAgICAg IGZvciAoaiA9IDA7IGogPCBibGtfY250OyBqKyspIHsNCj4gPiArICAgICAgICAgICAgICAgaWYg KGogKyAxID09IGJsa19jbnQpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAvKiBYXzEg PSBlKEFwcEtleSwgWF8wIF4gUGF5bG9hZFswLTE1XSkgKi8NCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGFzdF9ibGs7IGkrKykNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHBtc2dbaV0gPSBYbltpXSBeIG1zZ1soaiAqIDE2KSArIGldOw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IGxhc3RfYmxrOyBpIDwgMTY7IGkr KykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBtc2dbaV0gPSBYbltpXSBe IDB4MDA7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IGFlc19l Y2IoZmQsIHBtc2csIFhuKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3Vs dCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiAr DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgLyogTUlDID0gQ19taWMgXiBYXzEgKi8NCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZW9mKG1pYyk7IGkr KykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pY1tpXSA9IGNtaWNbaV0g XiBYbltpXTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgLyogQ18xID0gZShB cHBLZXksIDB4MDEgfHwgbm9uY2UgfHwgMHgwMDAxKSAqLw0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHBtc2dbMF0gPSAweDAxOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1lbWNw eShwbXNnICsgMSwgbm9uY2UsIDEzKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwdXRf YmUxNihqICsgMSwgcG1zZyArIDE0KTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgcmVzdWx0ID0gYWVzX2VjYihmZCwgcG1zZywgY21zZyk7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgaWYgKCFyZXN1bHQpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChvdXRf bXNnKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBFbmNyeXB0ZWQg PSBQYXlsb2FkWzAtMTVdIF4gQ18xICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBmb3IgKGkgPSAwOyBpIDwgbGFzdF9ibGs7IGkrKykNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgb3V0X21zZ1soaiAqIDE2KSArIGldID0NCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2dbKGogKiAxNikg KyBpXSBeIGNtc2dbaV07DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIH0NCj4g PiArICAgICAgICAgICAgICAgfSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAv KiBYXzEgPSBlKEFwcEtleSwgWF8wIF4gUGF5bG9hZFswLTE1XSkgKi8NCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgMTY7IGkrKykNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHBtc2dbaV0gPSBYbltpXSBeIG1zZ1soaiAqIDE2KSArIGldOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBhZXNfZWNiKGZkLCBw bXNnLCBYbik7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQpDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIC8qIENfMSA9IGUoQXBwS2V5LCAweDAxIHx8IG5vbmNlIHx8 IDB4MDAwMSkgKi8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwbXNnWzBdID0gMHgwMTsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBtZW1jcHkocG1zZyArIDEsIG5vbmNlLCAxMyk7 DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHV0X2JlMTYoaiArIDEsIHBtc2cgKyAxNCk7 DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IGFlc19lY2IoZmQs IHBtc2csIGNtc2cpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVzdWx0KQ0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBpZiAob3V0X21zZykgew0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgLyogRW5jcnlwdGVkID0gUGF5bG9hZFswLTE1XSBeIENfTiAq Lw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IDE2 OyBpKyspDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dF9t c2dbKGogKiAxNikgKyBpXSA9DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgbXNnWyhqICogMTYpICsgaV0gXiBjbXNnW2ldOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAg ICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAob3V0X21zZykNCj4gPiArICAgICAgICAgICAg ICAgbWVtY3B5KG91dF9tc2cgKyBtc2dfbGVuLCBtaWMsIG1pY19zaXplKTsNCj4gPiArDQo+ID4g KyAgICAgICBpZiAob3V0X21pYykgew0KPiA+ICsgICAgICAgICAgICAgICBzd2l0Y2ggKG1pY19z aXplKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGNhc2Ugc2l6ZW9mKHVpbnQzMl90KToNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAqKHVpbnQzMl90ICopb3V0X21pYyA9IGdldF9iZTMyKG1p Yyk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICAgICAg ICAgIGNhc2Ugc2l6ZW9mKHVpbnQ2NF90KToNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAq KHVpbnQ2NF90ICopb3V0X21pYyA9IGdldF9iZTY0KG1pYyk7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICAgICAgICAgIGRlZmF1bHQ6DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgZ19wcmludGVycigiVW5zdXBwb3J0ZWQgTUlDIHNpemUiKTsNCj4g PiArICAgICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArZG9uZToNCj4g PiArICAgICAgIGFlc19lY2JfZGVzdHJveShmZCk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJu IHJlc3VsdDsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBtZXNoX2NyeXB0b19hZXNfY2NtX2Rl Y3J5cHQoY29uc3QgdWludDhfdCBub25jZVsxM10sIGNvbnN0DQo+IHVpbnQ4X3Qga2V5WzE2XSwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmFhZCwg dWludDE2X3QgYWFkX2xlbiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNv bnN0IHVpbnQ4X3QgKmVuY19tc2csIHVpbnQxNl90IGVuY19tc2dfbGVuLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgdWludDhfdCAqb3V0X21zZywgdm9pZCAqb3V0X21pYywN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBtaWNfc2l6ZSkNCj4g PiArew0KPiA+ICsgICAgICAgdWludDhfdCBtc2dbMTZdLCBwbXNnWzE2XSwgY21pY1sxNl0sIGNt c2dbMTZdLCBYblsxNl07DQo+ID4gKyAgICAgICB1aW50OF90IG1pY1sxNl07DQo+ID4gKyAgICAg ICB1aW50MTZfdCBtc2dfbGVuID0gZW5jX21zZ19sZW4gLSBtaWNfc2l6ZTsNCj4gPiArICAgICAg IHVpbnQxNl90IGxhc3RfYmxrLCBibGtfY250Ow0KPiA+ICsgICAgICAgYm9vbCByZXN1bHQ7DQo+ ID4gKyAgICAgICBzaXplX3QgaSwgajsNCj4gPiArICAgICAgIGludCBmZDsNCj4gPiArDQo+ID4g KyAgICAgICBpZiAoZW5jX21zZ19sZW4gPCA1IHx8IGFhZF9sZW4gPj0gMHhmZjAwKQ0KPiA+ICsg ICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgZmQgPSBhZXNf ZWNiX3NldHVwKGtleSk7DQo+ID4gKyAgICAgICBpZiAoZmQgPCAwKQ0KPiA+ICsgICAgICAgICAg ICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogQ19taWMgPSBlKEFwcEtl eSwgMHgwMSB8fCBub25jZSB8fCAweDAwMDApICovDQo+ID4gKyAgICAgICBwbXNnWzBdID0gMHgw MTsNCj4gPiArICAgICAgIG1lbWNweShwbXNnICsgMSwgbm9uY2UsIDEzKTsNCj4gPiArICAgICAg IHB1dF9iZTE2KDB4MDAwMCwgcG1zZyArIDE0KTsNCj4gPiArDQo+ID4gKyAgICAgICByZXN1bHQg PSBhZXNfZWNiKGZkLCBwbXNnLCBjbWljKTsNCj4gPiArICAgICAgIGlmICghcmVzdWx0KQ0KPiA+ ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogWF8wID0g ZShBcHBLZXksIDB4MDkgfHwgbm9uY2UgfHwgbGVuZ3RoKSAqLw0KPiA+ICsgICAgICAgaWYgKG1p Y19zaXplID09IHNpemVvZih1aW50NjRfdCkpDQo+ID4gKyAgICAgICAgICAgICAgIHBtc2dbMF0g PSAweDE5IHwgKGFhZF9sZW4gPyAweDQwIDogMHgwMCk7DQo+ID4gKyAgICAgICBlbHNlDQo+ID4g KyAgICAgICAgICAgICAgIHBtc2dbMF0gPSAweDA5IHwgKGFhZF9sZW4gPyAweDQwIDogMHgwMCk7 DQo+ID4gKw0KPiA+ICsgICAgICAgbWVtY3B5KHBtc2cgKyAxLCBub25jZSwgMTMpOw0KPiA+ICsg ICAgICAgcHV0X2JlMTYobXNnX2xlbiwgcG1zZyArIDE0KTsNCj4gPiArDQo+ID4gKyAgICAgICBy ZXN1bHQgPSBhZXNfZWNiKGZkLCBwbXNnLCBYbik7DQo+ID4gKyAgICAgICBpZiAoIXJlc3VsdCkN Cj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsNCj4gPiArICAgICAgIC8qIElm IEFBRCBpcyBiZWluZyB1c2VkIHRvIGF1dGhlbnRpY2F0ZSwgaW5jbHVkZSBpdCBoZXJlICovDQo+ ID4gKyAgICAgICBpZiAoYWFkX2xlbikgew0KPiA+ICsgICAgICAgICAgICAgICBwdXRfYmUxNihh YWRfbGVuLCBwbXNnKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkg PCBzaXplb2YodWludDE2X3QpOyBpKyspDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcG1z Z1tpXSA9IFhuW2ldIF4gcG1zZ1tpXTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGogPSAw Ow0KPiA+ICsgICAgICAgICAgICAgICBhYWRfbGVuICs9IHNpemVvZih1aW50MTZfdCk7DQo+ID4g KyAgICAgICAgICAgICAgIHdoaWxlIChhYWRfbGVuID4gMTYpIHsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICBkbyB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbXNn W2ldID0gWG5baV0gXiBhYWRbal07DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBpKyssIGorKzsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChpIDwgMTYp Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBhYWRfbGVuIC09IDE2Ow0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIGkgPSAwOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICByZXN1bHQgPSBhZXNfZWNiKGZkLCBwbXNnLCBYbik7DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBhYWRfbGVuOyBpKyssIGorKykNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICBwbXNnW2ldID0gWG5baV0gXiBhYWRbal07DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgICAgICBmb3IgKGkgPSBhYWRfbGVuOyBpIDwgMTY7IGkrKykNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICBwbXNnW2ldID0gWG5baV07DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICByZXN1bHQgPSBhZXNfZWNiKGZkLCBwbXNnLCBYbik7DQo+ID4gKyAgICAgICAgICAg ICAgIGlmICghcmVzdWx0KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsN Cj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBsYXN0X2JsayA9IG1zZ19sZW4gJSAx NjsNCj4gPiArICAgICAgIGJsa19jbnQgPSAobXNnX2xlbiArIDE1KSAvIDE2Ow0KPiA+ICsgICAg ICAgaWYgKCFsYXN0X2JsaykNCj4gPiArICAgICAgICAgICAgICAgbGFzdF9ibGsgPSAxNjsNCj4g PiArDQo+ID4gKyAgICAgICBmb3IgKGogPSAwOyBqIDwgYmxrX2NudDsgaisrKSB7DQo+ID4gKyAg ICAgICAgICAgICAgIGlmIChqICsgMSA9PSBibGtfY250KSB7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgLyogQ18xID0gZShBcHBLZXksIDB4MDEgfHwgbm9uY2UgfHwgMHgwMDAxKSAqLw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHBtc2dbMF0gPSAweDAxOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIG1lbWNweShwbXNnICsgMSwgbm9uY2UsIDEzKTsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBwdXRfYmUxNihqICsgMSwgcG1zZyArIDE0KTsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gYWVzX2VjYihmZCwgcG1zZywgY21zZyk7 DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQpDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIC8qIEVuY3J5cHRlZCA9IFBheWxvYWRbMC0xNV0gXiBDXzEgKi8NCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGFzdF9ibGs7IGkrKykNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZ1tpXSA9IGVuY19tc2dbKGogKiAx NikgKyBpXSBeIGNtc2dbaV07DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlm IChvdXRfbXNnKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVtY3B5KG91 dF9tc2cgKyAoaiAqIDE2KSwgbXNnLCBsYXN0X2Jsayk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIC8qIFhfMSA9IGUoQXBwS2V5LCBYXzAgXiBQYXlsb2FkWzAtMTVdKSAqLw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsYXN0X2JsazsgaSsr KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG1zZ1tpXSA9IFhuW2ldIF4g bXNnW2ldOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IGxhc3RfYmxrOyBp IDwgMTY7IGkrKykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBtc2dbaV0g PSBYbltpXSBeIDB4MDA7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJlc3Vs dCA9IGFlc19lY2IoZmQsIHBtc2csIFhuKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBp ZiAoIXJlc3VsdCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9u ZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgLyogTUlDID0gQ19taWMgXiBY XzEgKi8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZW9m KG1pYyk7IGkrKykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pY1tpXSA9 IGNtaWNbaV0gXiBYbltpXTsNCj4gPiArICAgICAgICAgICAgICAgfSBlbHNlIHsNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAvKiBDXzEgPSBlKEFwcEtleSwgMHgwMSB8fCBub25jZSB8fCAw eDAwMDEpICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcG1zZ1swXSA9IDB4MDE7DQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbWVtY3B5KHBtc2cgKyAxLCBub25jZSwgMTMpOw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHB1dF9iZTE2KGogKyAxLCBwbXNnICsgMTQpOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBhZXNfZWNiKGZkLCBw bXNnLCBjbXNnKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgLyogRW5jcnlwdGVkID0gUGF5bG9hZFswLTE1XSBeIENf MSAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCAxNjsgaSsr KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXNnW2ldID0gZW5jX21zZ1so aiAqIDE2KSArIGldIF4gY21zZ1tpXTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgaWYgKG91dF9tc2cpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZW1j cHkob3V0X21zZyArIChqICogMTYpLCBtc2csIDE2KTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgLyogWF8xID0gZShBcHBLZXksIFhfMCBeIFBheWxvYWRbMC0xNV0pICovDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IDE2OyBpKyspDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbXNnW2ldID0gWG5baV0gXiBtc2dbaV07 DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IGFlc19lY2IoZmQs IHBtc2csIFhuKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArICAgICAg ICAgICAgICAgfQ0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHN3aXRjaCAobWlj X3NpemUpIHsNCj4gPiArICAgICAgICAgICAgICAgY2FzZSBzaXplb2YodWludDMyX3QpOg0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChvdXRfbWljKQ0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKih1aW50MzJfdCAqKW91dF9taWMgPSBnZXRfYmUzMihtaWMpOw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGdldF9iZTMyKGVuY19tc2cgKyBl bmNfbXNnX2xlbiAtIG1pY19zaXplKSAhPQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBnZXRfYmUzMihtaWMpKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgcmVzdWx0ID0gZmFsc2U7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJl YWs7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIHNpemVvZih1aW50NjRfdCk6DQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKG91dF9taWMpDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAqKHVpbnQ2NF90ICopb3V0X21pYyA9IGdldF9iZTY0KG1pYyk7 DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZ2V0X2JlNjQoZW5jX21zZyAr IGVuY19tc2dfbGVuIC0gbWljX3NpemUpICE9DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGdldF9iZTY0KG1pYykpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICByZXN1bHQgPSBmYWxzZTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBi cmVhazsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGRlZmF1bHQ6DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgZ19wcmludGVycigiVW5zdXBwb3J0ZWQgTUlDIHNpemUiKTsNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBmYWxzZTsNCj4gPiArICAgICAgIH0NCj4g PiArDQo+ID4gK2RvbmU6DQo+ID4gKyAgICAgICBhZXNfZWNiX2Rlc3Ryb3koZmQpOw0KPiA+ICsN Cj4gPiArICAgICAgIHJldHVybiByZXN1bHQ7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wgbWVz aF9jcnlwdG9fazEoY29uc3QgdWludDhfdCBpa21bMTZdLCBjb25zdCB1aW50OF90IHNhbHRbMTZd LA0KPiA+ICsgICAgICAgICAgICAgICBjb25zdCB2b2lkICppbmZvLCBzaXplX3QgaW5mb19sZW4s IHVpbnQ4X3Qgb2ttWzE2XSkNCj4gPiArew0KPiA+ICsgICAgICAgdWludDhfdCByZXNbMTZdOw0K PiA+ICsNCj4gPiArICAgICAgIGlmICghYWVzX2NtYWNfb25lKHNhbHQsIGlrbSwgMTYsIHJlcykp DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBy ZXR1cm4gYWVzX2NtYWNfb25lKHJlcywgaW5mbywgaW5mb19sZW4sIG9rbSk7DQo+ID4gK30NCj4g PiArDQo+ID4gK2Jvb2wgbWVzaF9jcnlwdG9fazIoY29uc3QgdWludDhfdCBuWzE2XSwgY29uc3Qg dWludDhfdCAqcCwgc2l6ZV90IHBfbGVuLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDhfdCBuZXRfaWRbMV0sDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50 OF90IGVuY19rZXlbMTZdLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgdWludDhfdCBwcml2X2tleVsxNl0pDQo+ID4gK3sNCj4gPiAr ICAgICAgIGludCBmZDsNCj4gPiArICAgICAgIHVpbnQ4X3Qgb3V0cHV0WzE2XTsNCj4gPiArICAg ICAgIHVpbnQ4X3QgdFsxNl07DQo+ID4gKyAgICAgICB1aW50OF90ICpzdGFnZTsNCj4gPiArICAg ICAgIGJvb2wgc3VjY2VzcyA9IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHN0YWdlID0gZ19t YWxsb2Moc2l6ZW9mKG91dHB1dCkgKyBwX2xlbiArIDEpOw0KPiA+ICsgICAgICAgaWYgKHN0YWdl ID09IE5VTEwpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4g KyAgICAgICBpZiAoIW1lc2hfY3J5cHRvX3MxKCJzbWsyIiwgNCwgc3RhZ2UpKQ0KPiA+ICsgICAg ICAgICAgICAgICBnb3RvIGZhaWw7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFh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ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBi b29sIGlkZW50aXR5X2NhbGMoY29uc3QgdWludDhfdCBuZXRfa2V5WzE2XSwgdWludDE2X3QgYWRk ciwNCj4gPiArICAgICAgICAgICAgICAgYm9vbCBjaGVjaywgdWludDhfdCBpZFsxNl0pDQo+ID4g K3sNCj4gPiArICAgICAgIHVpbnQ4X3QgaWRfa2V5WzE2XTsNCj4gPiArICAgICAgIHVpbnQ4X3Qg dG1wWzE2XTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIW1lc2hfY3J5cHRvX25raWsobmV0X2tl eSwgaWRfa2V5KSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4g PiArICAgICAgIG1lbXNldCh0bXAsIDAsIHNpemVvZih0bXApKTsNCj4gPiArICAgICAgIHB1dF9i ZTE2KGFkZHIsIHRtcCArIDE0KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoY2hlY2spIHsNCj4g PiArICAgICAgICAgICAgICAgbWVtY3B5KHRtcCArIDYsIGlkICsgOCwgOCk7DQo+ID4gKyAgICAg ICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBtZXNoX2dldF9yYW5kb21fYnl0ZXModG1w ICsgNiwgOCk7DQo+ID4gKyAgICAgICAgICAgICAgIG1lbWNweShpZCArIDgsIHRtcCArIDYsIDgp Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmICghYWVzX2VjYl9vbmUoaWRf a2V5LCB0bXAsIHRtcCkpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiAr DQo+ID4gKyAgICAgICBpZiAoY2hlY2spDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiAobWVt Y21wKGlkLCB0bXAgKyA4LCA4KSA9PSAwKTsNCj4gPiArDQo+ID4gKyAgICAgICBtZW1jcHkoaWQs IHRtcCArIDgsIDgpOw0KPi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KSwgdG1wKSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJu IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIG91dDZbMF0gPSB0bXBbMTVdICYgMHgzZjsNCj4g PiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29sIG1lc2hfY3J5 cHRvX2JlYWNvbl9jbWFjKGNvbnN0IHVpbnQ4X3QgZW5jcnlwdGlvbl9rZXlbMTZdLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCBuZXR3b3JrX2lkWzhd LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgaXZfaW5kZXgs IGJvb2wga3IsIGJvb2wgaXUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1 aW50NjRfdCAqY21hYykNCj4gPiArew0KPiA+ICsgICAgICAgdWludDhfdCBtc2dbMTNdLCB0bXBb MTZdOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICghY21hYykNCj4gPiArICAgICAgICAgICAgICAg cmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIG1zZ1swXSA9IGtyID8gMHgwMSA6IDB4 MDA7DQo+ID4gKyAgICAgICBtc2dbMF0gfD0gaXUgPyAweDAyIDogMHgwMDsNCj4gPiArICAgICAg IG1lbWNweShtc2cgKyAxLCBuZXR3b3JrX2lkLCA4KTsNCj4gPiArICAgICAgIHB1dF9iZTMyKGl2 X2luZGV4LCBtc2cgKyA5KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIWFlc19jbWFjX29uZShl bmNyeXB0aW9uX2tleSwgbXNnLCAxMywgdG1wKSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJu IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgICpjbWFjID0gZ2V0X2JlNjQodG1wKTsNCj4gPiAr DQo+ID4gKyAgICAgICByZ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gICAgICAgICAg ICAgICAgICAgICAgdWludDMyX3QgaXZfaW5kZXgsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBjb25zdCB1aW50OF90IG5ldF9rZXlbMTZdLA0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqZW5jX21zZywgdWludDhfdCBlbmNfbXNn X2xlbiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ4X3QgKm91dCwg dm9pZCAqbmV0X21pYykNCj4gPiArew0KPiA+ICsgICAgICAgdWludDhfdCBub25jZVsxM107DQo+ ID4gKw0KPiA+ICsgICAgICAgaWYgKCFtZXNoX2NyeXB0b19uZXR3b3JrX25vbmNlKGN0bCwgdHRs LCBzZXEsIHNyYywgaXZfaW5kZXgsIG5vbmNlKSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJu IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBtZXNoX2NyeXB0b19hZXNfY2NtX2Vu Y3J5cHQobm9uY2UsIG5ldF9rZXksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBOVUxMLCAwLCBlbmNfbXNnLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ZW5jX21zZ19sZW4sIG91dCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5l dF9taWMsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdGwgPyBzaXplb2Yo dWludDY0X3QpIDogc2l6ZW9mKHVpbnQzMl90KSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wg bWVzaF9jcnlwdG9fbmV0d29ya19kZWNyeXB0KGJvb2wgY3RsLCB1aW50OF90IHR0bCwNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHNlcSwgdWludDE2X3Qgc3Jj LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgaXZfaW5kZXgs DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90IG5ldF9r ZXlbMTZdLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhf dCAqZW5jX21zZywgdWludDhfdCBlbmNfbXNnX2xlbiwNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHVpbnQ4X3QgKm91dCwgdm9pZCAqbmV0X21pYywgc2l6ZV90IG1pY19zaXpl KQ0KPiA+ICt7DQo+ID4gKyAgICAgICB1aW50OF90IG5vbmNlWzEzXTsNCj4gPiArDQo+ID4gKyAg ICAgICBpZiAoIW1lc2hfY3J5cHRvX25ldHdvcmtfbm9uY2UoY3RsLCB0dGwsIHNlcSwgc3JjLCBp dl9pbmRleCwgbm9uY2UpKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4g Kw0KPiA+ICsgICAgICAgcmV0dXJuIG1lc2hfY3J5cHRvX2Flc19jY21fZGVjcnlwdChub25jZSwg bmV0X2tleSwgTlVMTCwgMCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBlbmNfbXNnLCBlbmNfbXNnX2xlbiwgb3V0LA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldF9taWMsIG1pY19zaXplKTsN Cj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBtZXNoX2NyeXB0b19hcHBsaWNhdGlvbl9ub25jZSh1 aW50MzJfdCBzZXEsIHVpbnQxNl90IHNyYywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgdWludDE2X3QgZHN0LCB1aW50MzJfdCBpdl9pbmRleCwNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBhc3ptaWMsIHVpbnQ4X3Qg bm9uY2VbMTNdKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBub25jZVswXSA9IDB4MDE7DQo+ID4gKyAg ICAgICBub25jZVsxXSA9IGFzem1pYyA/IDB4ODAgOiAweDAwOw0KPiA+ICsgICAgICAgbm9uY2Vb Ml0gPSAoc2VxICYgMHgwMGZmMDAwMCkgPj4gMTY7DQo+ID4gKyAgICAgICBub25jZVszXSA9IChz ZXEgJiAweDAwMDBmZjAwKSA+PiA4Ow0KPiA+ICsgICAgICAgbm9uY2VbNF0gPSAoc2VxICYgMHgw MDAwMDBmZik7DQo+ID4gKyAgICAgICBub25jZVs1XSA9IChzcmMgJiAweGZmMDApID4+IDg7DQo+ ID4gKyAgICAgICBub25jZVs2XSA9IChzcmMgJiAweDAwZmYpOw0KPiA+ICsgICAgICAgbm9uY2Vb N10gPSAoZHN0ICYgMHhmZjAwKSA+PiA4Ow0KPiA+ICsgICAgICAgbm9uY2VbOF0gPSAoZHN0ICYg MHgwMGZmKTsNCj4gPiArICAgICAgIHB1dF9iZTMyKGl2X2luZGV4LCBub25jZSArIDkpOw0KPiA+ ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29sIG1l c2hfY3J5cHRvX2RldmljZV9ub25jZSh1aW50MzJfdCBzZXEsIHVpbnQxNl90IHNyYywNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDE2X3QgZHN0LCB1aW50 MzJfdCBpdl9pbmRleCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgYm9vbCBhc3ptaWMsIHVpbnQ4X3Qgbm9uY2VbMTNdKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBu b25jZVswXSA9IDB4MDI7DQo+ID4gKyAgICAgICBub25jZVsxXSA9IGFzem1pYyA/IDB4ODAgOiAw eDAwOw0KPiA+ICsgICAgICAgbm9uY2VbMl0gPSAoc2VxICYgMHgwMGZmMDAwMCkgPj4gMTY7DQo+ ID4gKyAgICAgICBub25jZVszXSA9IChzZXEgJiAweDAwMDBmZjAwKSA+PiA4Ow0KPiA+ICsgICAg ICAgbm9uY2VbNF0gPSAoc2VxICYgMHgwMDAwMDBmZik7DQo+ID4gKyAgICAgICBub25jZVs1XSA9 IChzcmMgJiAweGZmMDApID4+IDg7DQo+ID4gKyAgICAgICBub25jZVs2XSA9IChzcmMgJiAweDAw ZmYpOw0KPiA+ICsgICAgICAgbm9uY2VbN10gPSAoZHN0ICYgMHhmZjAwKSA+PiA4Ow0KPiA+ICsg ICAgICAgbm9uY2VbOF0gPSAoZHN0ICYgMHgwMGZmKTsNCj4gPiArICAgICAgIHB1dF9iZTMyKGl2 X2luZGV4LCBub25jZSArIDkpOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ ICt9DQo+ID4gKw0KPiA+ICtib29sIG1lc2hfY3J5cHRvX2FwcGxpY2F0aW9uX2VuY3J5cHQodWlu dDhfdCBrZXlfaWQsIHVpbnQzMl90IHNlcSwNCj4gdWludDE2X3Qgc3JjLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MTZfdCBkc3QsIHVpbnQzMl90IGl2 X2luZGV4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25z dCB1aW50OF90IGFwcF9rZXlbMTZdLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBjb25zdCB1aW50OF90ICphYWQsIHVpbnQ4X3QgYWFkX2xlbiwNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqbXNnLCB1 aW50OF90IG1zZ19sZW4sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHVpbnQ4X3QgKm91dCwgdm9pZCAqYXBwX21pYywNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG1pY19zaXplKQ0KPiA+ICt7DQo+ID4gKyAgICAg ICB1aW50OF90IG5vbmNlWzEzXTsNCj4gPiArICAgICAgIGJvb2wgYXN6bWljID0gKG1pY19zaXpl ID09IHNpemVvZih1aW50NjRfdCkpID8gdHJ1ZSA6IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAg IGlmICgha2V5X2lkICYmICFtZXNoX2NyeXB0b19kZXZpY2Vfbm9uY2Uoc2VxLCBzcmMsIGRzdCwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl2X2luZGV4LCBhc3ptaWMsIG5v bmNlKSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAg ICAgIGlmIChrZXlfaWQgJiYgIW1lc2hfY3J5cHRvX2FwcGxpY2F0aW9uX25vbmNlKHNlcSwgc3Jj LCBkc3QsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdl9pbmRleCwgYXN6 bWljLCBub25jZSkpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ ID4gKyAgICAgICByZXR1cm4gbWVzaF9jcnlwdG9fYWVzX2NjbV9lbmNyeXB0KG5vbmNlLCBhcHBf a2V5LCBhYWQsDQo+IGFhZF9sZW4sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgbXNnLCBtc2dfbGVuLA0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dCwgYXBwX21pYywgbWljX3NpemUpOw0KPiA+ ICt9DQo+ID4gKw0KPiA+ICtib29sIG1lc2hfY3J5cHRvX2FwcGxpY2F0aW9uX2RlY3J5cHQodWlu dDhfdCBrZXlfaWQsIHVpbnQzMl90IHNlcSwNCj4gdWludDE2X3Qgc3JjLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgdWludDE2X3QgZHN0LCB1aW50MzJfdCBpdl9pbmRleCwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgYXBwX2tl eVsxNl0sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90 ICphYWQsIHVpbnQ4X3QgYWFkX2xlbiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGNvbnN0IHVpbnQ4X3QgKmVuY19tc2csIHVpbnQ4X3QgZW5jX21zZ19sZW4sDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OF90ICpvdXQsIHZvaWQgKmFwcF9taWMs IHNpemVfdCBtaWNfc2l6ZSkNCj4gPiArew0KPiA+ICsgICAgICAgdWludDhfdCBub25jZVsxM107 DQo+ID4gKyAgICAgICBib29sIGFzem1pYyA9IChtaWNfc2l6ZSA9PSBzaXplb2YodWludDY0X3Qp KSA/IHRydWUgOiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIWtleV9pZCAmJiAhbWVz aF9jcnlwdG9fZGV2aWNlX25vbmNlKHNlcSwgc3JjLCBkc3QsDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBpdl9pbmRleCwgYXN6bWljLCBub25jZSkpDQo+ID4gKyAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoa2V5X2lkICYmICFt ZXNoX2NyeXB0b19hcHBsaWNhdGlvbl9ub25jZShzZXEsIHNyYywgZHN0LA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgaXZfaW5kZXgsIGFzem1pYywgbm9uY2UpKQ0KPiA+ICsg ICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIG1l c2hfY3J5cHRvX2Flc19jY21fZGVjcnlwdChub25jZSwgYXBwX2tleSwNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYWQsIGFhZF9sZW4sIGVuY19t c2csDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ZW5jX21zZ19sZW4sIG91dCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBhcHBfbWljLCBtaWNfc2l6ZSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jv b2wgbWVzaF9jcnlwdG9fc2Vzc2lvbl9rZXkoY29uc3QgdWludDhfdCBzZWNyZXRbMzJdLA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90IHNh bHRbMTZdLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50 OF90IHNlc3Npb25fa2V5WzE2XSkNCj4gPiArew0KPiA+ICsgICAgICAgY29uc3QgdWludDhfdCBw cnNrWzRdID0gInByc2siOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICghYWVzX2NtYWNfb25lKHNh bHQsIHNlY3JldCwgMzIsIHNlc3Npb25fa2V5KSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJu IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBhZXNfY21hY19vbmUoc2Vzc2lvbl9r ZXksIHByc2ssIDQsIHNlc3Npb25fa2V5KTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBtZXNo X2NyeXB0b19ub25jZShjb25zdCB1aW50OF90IHNlY3JldFszMl0sDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3Qgc2FsdFsxNl0sDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ4X3Qgbm9uY2VbMTNd KQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjb25zdCB1aW50OF90IHByc25bNF0gPSAicHJzbiI7DQo+ ID4gKyAgICAgICB1aW50OF90IHRtcFsxNl07DQo+ID4gKyAgICAgICBib29sIHJlc3VsdDsNCj4g PiArDQo+ID4gKyAgICAgICBpZiAoIWFlc19jbWFjX29uZShzYWx0LCBzZWNyZXQsIDMyLCB0bXAp KQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAg cmVzdWx0ID0gIGFlc19jbWFjX29uZSh0bXAsIHByc24sIDQsIHRtcCk7DQo+ID4gKw0KPiA+ICsg ICAgICAgaWYgKHJlc3VsdCkNCj4gPiArICAgICAgICAgICAgICAgbWVtY3B5KG5vbmNlLCB0bXAg KyAzLCAxMyk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIHJlc3VsdDsNCj4gPiArfQ0KPiA+ ICsNCj4gPiArYm9vbCBtZXNoX2NyeXB0b19zMShjb25zdCB2b2lkICppbmZvLCBzaXplX3QgbGVu LCB1aW50OF90IHNhbHRbMTZdKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjb25zdCB1aW50OF90IHpl cm9bMTZdID0gezB9Ow0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBhZXNfY21hY19vbmUoemVy bywgaW5mbywgbGVuLCBzYWx0KTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBtZXNoX2NyeXB0 b19wcm92X3Byb3Zfc2FsdChjb25zdCB1aW50OF90IGNvbmZfc2FsdFsxNl0sDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgcHJvdl9yYW5k WzE2XSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qg dWludDhfdCBkZXZfcmFuZFsxNl0sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHVpbnQ4X3QgcHJvdl9zYWx0WzE2XSkNCj4gPiArew0KPiA+ICsgICAgICAgY29u c3QgdWludDhfdCB6ZXJvWzE2XSA9IHswfTsNCj4gPiArICAgICAgIHVpbnQ4X3QgdG1wWzE2ICog M107DQo+ID4gKw0KPiA+ICsgICAgICAgbWVtY3B5KHRtcCwgY29uZl9zYWx0LCAxNik7DQo+ID4g KyAgICAgICBtZW1jcHkodG1wICsgMTYsIHByb3ZfcmFuZCwgMTYpOw0KPiA+ICsgICAgICAgbWVt Y3B5KHRtcCArIDMyLCBkZXZfcmFuZCwgMTYpOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBh ZXNfY21hY19vbmUoemVybywgdG1wLCBzaXplb2YodG1wKSwgcHJvdl9zYWx0KTsNCj4gPiArfQ0K PiA+ICsNCj4gPiArYm9vbCBtZXNoX2NyeXB0b19wcm92X2NvbmZfa2V5KGNvbnN0IHVpbnQ4X3Qg c2VjcmV0WzMyXSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg Y29uc3QgdWludDhfdCBzYWx0WzE2XSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgdWludDhfdCBjb25mX2tleVsxNl0pDQo+ID4gK3sNCj4gPiArICAgICAgIGNv bnN0IHVpbnQ4X3QgcHJja1s0XSA9ICJwcmNrIjsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIWFl c19jbWFjX29uZShzYWx0LCBzZWNyZXQsIDMyLCBjb25mX2tleSkpDQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gYWVzX2NtYWNfb25l KGNvbmZfa2V5LCBwcmNrLCA0LCBjb25mX2tleSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wg bWVzaF9jcnlwdG9fZGV2aWNlX2tleShjb25zdCB1aW50OF90IHNlY3JldFszMl0sDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhf dCBzYWx0WzE2XSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICB1aW50OF90IGRldmljZV9rZXlbMTZdKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjb25z dCB1aW50OF90IHByZGtbNF0gPSAicHJkayI7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFhZXNf Y21hY19vbmUoc2FsdCwgc2VjcmV0LCAzMiwgZGV2aWNlX2tleSkpDQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gYWVzX2NtYWNfb25l KGRldmljZV9rZXksIHByZGssIDQsIGRldmljZV9rZXkpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICti b29sIG1lc2hfY3J5cHRvX3ZpcnR1YWxfYWRkcihjb25zdCB1aW50OF90IHZpcnR1YWxfbGFiZWxb MTZdLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHVpbnQxNl90ICphZGRyKQ0KPiA+ICt7DQo+ID4gKyAgICAgICB1aW50OF90IHRtcFsxNl07DQo+ ID4gKw0KPiA+ICsgICAgICAgaWYgKCFtZXNoX2NyeXB0b19zMSgidnRhZCIsIDQsIHRtcCkpDQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAo IWFkZHIgfHwgIWFlc19jbWFjX29uZSh0bXAsIHZpcnR1YWxfbGFiZWwsIDE2LCB0bXApKQ0KPiA+ ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgKmFkZHIg PSAoZ2V0X2JlMTYodG1wICsgMTQpICYgMHgzZmZmKSB8IDB4ODAwMDsNCj4gPiArDQo+ID4gKyAg ICAgICByZXR1cm4gdHJ1ZTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBtZXNoX2NyeXB0b19w YWNrZXRfZW5jb2RlKHVpbnQ4X3QgKnBhY2tldCwgdWludDhfdCBwYWNrZXRfbGVuLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCBuZXR3b3JrX2tleVsx Nl0sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBpdl9pbmRl eCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgcHJp dmFjeV9rZXlbMTZdKQ0KPiA+ICt7DQo+ID4gKyAgICAgICB1aW50OF90IG5ldHdvcmtfbm9uY2Vb MTNdID0geyAweDAwLCAweDAwIH07DQo+ID4gKyAgICAgICB1aW50OF90IHByaXZhY3lfY291bnRl clsxNl0gPSB7IDB4MDAsIDB4MDAsIDB4MDAsIDB4MDAsIDB4MDAsIH07DQo+ID4gKyAgICAgICB1 aW50OF90IHRtcFsxNl07DQo+ID4gKyAgICAgICBpbnQgaTsNCj4gPiArDQo+ID4gKyAgICAgICAv KiBEZXRlY3QgUHJveHkgcGFja2V0IGJ5IENUTCA9PSB0cnVlICYmIERTVCA9PSAweDAwMDAgKi8N Cj4gPiArICAgICAgIGlmICgocGFja2V0WzFdICYgQ1RMKSAmJiBnZXRfYmUxNihwYWNrZXQgKyA3 KSA9PSAwKQ0KPiA+ICsgICAgICAgICAgICAgICBuZXR3b3JrX25vbmNlWzBdID0gMHgwMzsNCj4g PiArICAgICAgIGVsc2UNCj4gPiArICAgICAgICAgICAgICAgLyogQ1RMICsgVFRMICovDQo+ID4g KyAgICAgICAgICAgICAgIG5ldHdvcmtfbm9uY2VbMV0gPSBwYWNrZXRbMV07DQo+ID4gKw0KPiA+ ICsgICAgICAgLyogU2VxIE51bSAqLw0KPiA+ICsgICAgICAgbmV0d29ya19ub25jZVsyXSA9IHBh Y2tldFsyXTsNCj4gPiArICAgICAgIG5ldHdvcmtfbm9uY2VbM10gPSBwYWNrZXRbM107DQo+ID4g KyAgICAgICBuZXR3b3JrX25vbmNlWzRdID0gcGFja2V0WzRdOw0KPiA+ICsNCj4gPiArICAgICAg IC8qIFNSQyAqLw0KPiA+ICsgICAgICAgbmV0d29ya19ub25jZVs1XSA9IHBhY2tldFs1XTsNCj4g PiArICAgICAgIG5ldHdvcmtfbm9uY2VbNl0gPSBwYWNrZXRbNl07DQo+ID4gKw0KPiA+ICsgICAg ICAgLyogRFNUIG5vdCBhdmFpbGFibGUgKi8NCj4gPiArICAgICAgIG5ldHdvcmtfbm9uY2VbN10g PSAwOw0KPiA+ICsgICAgICAgbmV0d29ya19ub25jZVs4XSA9IDA7DQo+ID4gKw0KPiA+ICsgICAg ICAgLyogSVYgSW5kZXggKi8NCj4gPiArICAgICAgIHB1dF9iZTMyKGl2X2luZGV4LCBuZXR3b3Jr X25vbmNlICsgOSk7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogQ2hlY2sgZm9yIExvbmcgbmV0LU1J QyAqLw0KPiA+ICsgICAgICAgaWYgKHBhY2tldFsxXSAmIENUTCkgew0KPiA+ICsgICAgICAgICAg ICAgICBpZiAoIW1lc2hfY3J5cHRvX2Flc19jY21fZW5jcnlwdChuZXR3b3JrX25vbmNlLA0KPiBu ZXR3b3JrX2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg TlVMTCwgMCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFj a2V0ICsgNywgcGFja2V0X2xlbiAtIDcgLSA4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBwYWNrZXQgKyA3LCBOVUxMLCBzaXplb2YodWludDY0X3QpKSkNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAgICB9IGVs c2Ugew0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIW1lc2hfY3J5cHRvX2Flc19jY21fZW5jcnlw dChuZXR3b3JrX25vbmNlLA0KPiBuZXR3b3JrX2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgTlVMTCwgMCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgcGFja2V0ICsgNywgcGFja2V0X2xlbiAtIDcgLSA0LA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWNrZXQgKyA3LCBOVUxMLCBz aXplb2YodWludDMyX3QpKSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFs c2U7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcHV0X2JlMzIoaXZfaW5kZXgs IHByaXZhY3lfY291bnRlciArIDUpOw0KPiA+ICsgICAgICAgbWVtY3B5KHByaXZhY3lfY291bnRl ciArIDksIHBhY2tldCArIDcsIDcpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICghYWVzX2VjYl9v bmUocHJpdmFjeV9rZXksIHByaXZhY3lfY291bnRlciwgdG1wKSkNCj4gPiArICAgICAgICAgICAg ICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCA2OyBp KyspDQo+ID4gKyAgICAgICAgICAgICAgIHBhY2tldFsxICsgaV0gXj0gdG1wW2ldOw0KPiA+ICsN Cj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29sIG1lc2hf Y3J5cHRvX3BhY2tldF9kZWNvZGUoY29uc3QgdWludDhfdCAqcGFja2V0LCB1aW50OF90DQo+IHBh Y2tldF9sZW4sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHByb3h5 LCB1aW50OF90ICpvdXQsIHVpbnQzMl90IGl2X2luZGV4LA0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCBuZXR3b3JrX2tleVsxNl0sDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90IHByaXZhY3lfa2V5WzE2XSkN Cj4gPiArew0KPiA+ICsgICAgICAgdWludDhfdCBwcml2YWN5X2NvdW50ZXJbMTZdID0geyAweDAw LCAweDAwLCAweDAwLCAweDAwLCAweDAwLCB9Ow0KPiA+ICsgICAgICAgdWludDhfdCBuZXR3b3Jr X25vbmNlWzEzXSA9IHsgMHgwMCwgMHgwMCwgfTsNCj4gPiArICAgICAgIHVpbnQ4X3QgdG1wWzE2 XTsNCj4gPiArICAgICAgIHVpbnQxNl90IHNyYzsNCj4gPiArICAgICAgIGludCBpOw0KPiA+ICsN Cj4gPiArICAgICAgIGlmIChwYWNrZXRfbGVuIDwgMTQpDQo+ID4gKyAgICAgICAgICAgICAgIHJl dHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBwdXRfYmUzMihpdl9pbmRleCwgcHJpdmFj eV9jb3VudGVyICsgNSk7DQo+ID4gKyAgICAgICBtZW1jcHkocHJpdmFjeV9jb3VudGVyICsgOSwg cGFja2V0ICsgNywgNyk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFhZXNfZWNiX29uZShwcml2 YWN5X2tleSwgcHJpdmFjeV9jb3VudGVyLCB0bXApKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1 cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgbWVtY3B5KG91dCwgcGFja2V0L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AgICAvKiBEU1Qgbm90IGF2YWlsYWJsZSAqLw0KPiA+ ICsgICAgICAgbmV0d29ya19ub25jZVs3XSA9IDA7DQo+ID4gKyAgICAgICBuZXR3b3JrX25vbmNl WzhdID0gMDsNCj4gPiArDQo+ID4gKyAgICAgICAvKiBJViBJbmRleCAqLw0KPiA+ICsgICAgICAg cHV0X2JlMzIoaXZfaW5kZXgsIG5ldHdvcmtfbm9uY2UgKyA5KTsNCj4gPiArDQo+ID4gKyAgICAg ICAvKiBDaGVjayBmb3IgTG9uZyBNSUMgKi8NCj4gPiArICAgICAgIGlmIChvdXRbMV0gJiBDVEwp IHsNCj4gPiArICAgICAgICAgICAgICAgdWludDY0X3QgbWljOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgaWYgKCFtZXNoX2NyeXB0b19hZXNfY2NtX2RlY3J5cHQobmV0d29ya19ub25jZSwN Cj4gbmV0d29ya19rZXksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIE5VTEwsIDAsIHBhY2tldCArIDcsIHBhY2tldF9sZW4gLSA3LA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQgKyA3LCAmbWljLCBzaXplb2YobWljKSkp DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiAr ICAgICAgICAgICAgICAgbWljIF49IGdldF9iZTY0KG91dCArIHBhY2tldF9sZW4gLSA4KTsNCj4g PiArICAgICAgICAgICAgICAgcHV0X2JlNjQobWljLCBvdXQgKyBwYWNrZXRfbGVuIC0gOCk7DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAobWljKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAgIH0gZWxzZSB7DQo+ID4gKyAgICAgICAg ICAgICAgIHVpbnQzMl90IG1pYzsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmICghbWVz aF9jcnlwdG9fYWVzX2NjbV9kZWNyeXB0KG5ldHdvcmtfbm9uY2UsDQo+IG5ldHdvcmtfa2V5LA0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLCAwLCBwYWNr ZXQgKyA3LCBwYWNrZXRfbGVuIC0gNywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgb3V0ICsgNywgJm1pYywgc2l6ZW9mKG1pYykpKQ0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIG1p YyBePSBnZXRfYmUzMihvdXQgKyBwYWNrZXRfbGVuIC0gNCk7DQo+ID4gKyAgICAgICAgICAgICAg IHB1dF9iZTMyKG1pYywgb3V0ICsgcGFja2V0X2xlbiAtIDQpOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgaWYgKG1pYykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFs c2U7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIHRydWU7DQo+ID4g K30NCj4gPiArDQo+ID4gK2Jvb2wgbWVzaF9nZXRfcmFuZG9tX2J5dGVzKHZvaWQgKmJ1Ziwgc2l6 ZV90IG51bV9ieXRlcykNCj4gPiArew0KPiA+ICsgICAgICAgc3NpemVfdCBsZW47DQo+ID4gKyAg ICAgICBpbnQgZmQ7DQo+ID4gKw0KPiA+ICsgICAgICAgZmQgPSBvcGVuKCIvZGV2L3VyYW5kb20i LCBPX1JET05MWSk7DQo+ID4gKyAgICAgICBpZiAoZmQgPCAwKQ0KPiA+ICsgICAgICAgICAgICAg ICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgbGVuID0gcmVhZChmZCwgYnVmLCBu dW1fYnl0ZXMpOw0KP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VBFX0JZVEUsDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmlvdi0+aW92X2Jhc2UsIGlvdi0+aW92 X2xlbik7DQo+ID4gKyAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9jbG9zZV9jb250YWluZXIoaXRl ciwgJmFycmF5KTsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9vcGVuX2Nv bnRhaW5lcihpdGVyLCBEQlVTX1RZUEVfQVJSQVksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIERCVVNfRElDVF9FTlRSWV9CRUdJTl9DSEFSX0FTX1NUUklORw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfU1RS SU5HX0FTX1NUUklORw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBEQlVTX1RZUEVfVkFSSUFOVF9BU19TVFJJTkcNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgREJVU19ESUNUX0VOVFJZX0VORF9DSEFSX0FTX1NUUklORywNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmRpY3QpOw0KPiA+ICsN Cj4gPiArICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2Nsb3NlX2NvbnRhaW5lcihpdGVyLCAmZGlj dCk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3VpbnQxNl90IG1lc2hfZ2F0dF9zYXIodWludDhfdCAq KnBrdCwgdWludDE2X3Qgc2l6ZSkNCj4gPiArew0KPiA+ICsgICAgICAgY29uc3QgdWludDhfdCAq ZGF0YSA9ICpwa3Q7DQo+ID4gKyAgICAgICB1aW50OF90IGdhdHRfaGRyID0gKmRhdGErKzsNCj4g PiArICAgICAgIHVpbnQ4X3QgdHlwZSA9IGdhdHRfaGR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ID4gKyAgICAgICAgICAgICAgICAgICAgICAgLyogSW52YWxpZGF0ZSBwYWNrZXQg YW5kIHJldHVybiBmYWlsdXJlICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ2F0dF9w a3RbMF0gPSBHQVRUX1RZUEVfSU5WQUxJRDsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAv KiBUT0RPOiBEaXNjb25uZWN0IEdBVFQgcGVyIGxhc3QgcGFyYWdyYXBoIHNlYyA2LjYgKi8NCj4g PiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsNCj4gPiArICAgICAgICAgICAgICAg fQ0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgbWVtY3B5KGdhdHRfcGt0ICsgZ2F0dF9zaXpl LCBkYXRhLCBzaXplKTsNCj4gPiArICAgICAgICAgICAgICAgZ2F0dF9zaXplICs9IHNpemU7DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAvKiBXZSBhcmUgZ29vZCB0byB0aGlzIHBvaW50LCBi dXQgaW5jb21wbGV0ZSAqLw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gMDsNCj4gPiArDQo+ ID4gKyAgICAgICBkZWZhdWx0Og0KPiA+ICsgICAgICAgY2FzZSBHQVRUX1NBUl9DT01QTEVURToN Cj4gPiArICAgICAgICAgICAgICAgZ2F0dF9zaXplID0gMTsNCj4gPiArICAgICAgICAgICAgICAg Z2F0dF9wa3RbMF0gPSB0eXBlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgLyogZmFsbCB0 aHJvdWdoICovDQo+ID4gKw0KPiA+ICsgICAgICAgY2FzZSBHQVRUX1NBUl9MQVNUOg0KPiA+ICsg ICAgICAgICAgICAgICBpZiAoZ2F0dF9wa3RbMF0gIT0gdHlwZSB8fA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZ2F0dF9zaXplICsgc2l6ZSA+IE1BWF9HQVRUX1NJWkUpIHsN Cj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgLyogSW52YWxpZGF0ZSBwYWNrZXQg YW5kIHJldHVybiBmYWlsdXJlICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ2F0dF9w a3RbMF0gPSBHQVRUX1RZUEVfSU5WQUxJRDsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAv KiBEaXNjb25uZWN0IEdBVFQgcGVyIGxhc3QgcGFyYWdyYXBoIHNlYyA2LjYgKi8NCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ ICsNCj4gPiArICAgICAgICAgICAgICAgbWVtY3B5KGdhdHRfcGt0ICsgZ2F0dF9zaXplLCBkYXRh LCBzaXplKTsNCj4gPiArICAgICAgICAgICAgICAgZ2F0dF9zaXplICs9IHNpemU7DQo+ID4gKyAg ICAgICAgICAgICAgICpwa3QgPSBnYXR0X3BrdDsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJu IGdhdHRfc2l6ZTsNCj4gPiArICAgICAgIH0NCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIGJv b2wgcGlwZV93cml0ZShzdHJ1Y3QgaW8gKmlvLCB2b2lkICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4g PiArICAgICAgIHN0cnVjdCB3cml0ZV9kYXRhICpkYXRhID0gdXNlcl9kYXRhOw0KPiA+ICsgICAg ICAgc3RydWN0IGlvdmVjIGlvdlsyXTsNCj4gPiArICAgICAgIHVpbnQ4X3Qgc2FyOw0KPiA+ICsg ICAgICAgdWludDhfdCBtYXhfbGVuID0gd3JpdGVfbXR1IC0gNDsNCj4gPiArDQo+ID4gKyAgICAg ICBpZiAoZGF0YSA9PSBOVUxMKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsNCj4g PiArDQo+ID4gKyAgICAgICBwcmludF9ieXRlX2FycmF5KCJHQVRULVRYOlx0IiwgZGF0YS0+Z2F0 dF9kYXRhLCBkYXRhLT5nYXR0X2xlbik7DQo+ID4gKw0KPiA+ICsgICAgICAgc2FyID0gZGF0YS0+ Z2F0dF9kYXRhWzBdOw0KPiA+ICsNCj4gPiArICAgICAgIGRhdGEtPmlvdi5pb3ZfYmFzZSA9IGRh dGEtPmdhdHRfZGF0YSArIDE7DQo+ID4gKyAgICAgICBkYXRhLT5pb3YuaW92X2xlbi0tOw0KPiA+ ICsNCj4gPiArICAgICAgIGlvdlswXS5pb3ZfYmFzZSA9ICZzYXI7DQo+ID4gKyAgICAgICBpb3Zb MF0uaW92X2xlbiA9IHNpemVvZihzYXIpOw0KPiA+ICsNCj4gPiArICAgICAgIHdoaWxlICgxKSB7 DQo+ID4gKyAgICAgICAgICAgICAgIGludCBlcnI7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAg ICBpb3ZbMV0gPSBkYXRhLT5pb3Y7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBlcnIgPSBp b19zZW5kKGlvLCBpb3YsIDIpOw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZXJyIDwgMCkgew0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRmFpbGVkIHRvIHdyaXRlOiAl c1xuIiwgc3RyZXJyb3IoLWVycikpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHdyaXRl X2RhdGFfZnJlZShkYXRhKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFs c2U7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHN3 aXRjaCAoc2FyICYgR0FUVF9TQVJfTUFTSykgew0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIEdB VFRfU0FSX0ZJUlNUOg0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIEdBVFRfU0FSX0NPTlRJTlVF Og0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGRhdGEtPmdhdHRfbGVuIC09IG1heF9sZW47 DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZGF0YS0+aW92Lmlvdl9iYXNlID0gZGF0YS0+ aW92Lmlvdl9iYXNlICsgbWF4X2xlbjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgc2FyICY9IEdBVFRfVFlQRV9NQVNLOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlm IChtYXhfbGVuIDwgZGF0YS0+Z2F0dF9sZW4pIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIGRhdGEtPmlvdi5pb3ZfbGVuID0gbWF4X2xlbjsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHNhciB8PSBHQVRUX1NBUl9DT05USU5VRTsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgZGF0YS0+aW92Lmlvdl9sZW4gPSBkYXRhLT5nYXR0X2xlbjsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHNhciB8PSBHQVRUX1NBUl9MQVNUOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJl YWs7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBkZWZhdWx0Og0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIGlmKGRhdGEtPmNiKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgZGF0YS0+Y2IoTlVMTCwgZGF0YS0+dXNlcl9kYXRhKTsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICB3cml0ZV9kYXRhX2ZyZWUoZGF0YSk7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgcmV0dXJuIHRydWU7DQo+ID4gKyAgICAgICA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l9G SVJTVDoNCj4gPiArICAgICAgICAgICAgICAgY2FzZSBHQVRUX1NBUl9DT05USU5VRToNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICB0bXAgPSBnX25ldzAoc3RydWN0IHdyaXRlX2RhdGEsIDEp Ow0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICghZGF0YSkNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgKnRtcCA9ICpkYXRhOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHRtcC0+ Z2F0dF9kYXRhID0gZ19tYWxsb2MoZGF0YS0+Z2F0dF9sZW4pOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBpZiAoIXRtcC0+Z2F0dF9kYXRhKSB7DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBnX2ZyZWUodG1wKTsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHRtcC0+Z2F0dF9kYXRhWzBdID0gZHB0clsw XTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gdG1wOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIG1lbWNweShkYXRhLT5nYXR0X2RhdGEgKyAxLCBkcHRyICsgbWF4X2xl biwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS0+Z2F0 dF9sZW4gLSBtYXhfc2VnKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBkYXRhLT5nYXR0 X2xlbiAtPSBtYXhfc2VnOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGRhdGEtPmdhdHRf ZGF0YVswXSAmPSBHQVRUX1RZUEVfTUFTSzsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBk YXRhLT5pb3YuaW92X2Jhc2UgPSBkYXRhLT5nYXR0X2RhdGE7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgaWYgKG1heF9sZW4gPCBkYXRhLT5nYXR0X2xlbikgew0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZGF0YS0+aW92Lmlvdl9sZW4gPSBtYXhfbGVuOw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS0+Z2F0dF9kYXRhWzBdIHw9IEdBVFRf U0FSX0NPTlRJTlVFOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLT5pb3YuaW92X2xlbiA9IGRhdGEt PmdhdHRfbGVuOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS0+Z2F0 dF9kYXRhWzBdIHw9IEdBVFRfU0FSX0xBU1Q7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg fQ0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgIGRlZmF1bHQ6DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYo ZGF0YS0+Y2IpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLT5jYiht ZXNzYWdlLCBkYXRhLT51c2VyX2RhdGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJl dHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVzX3Byb3h5 X21ldGhvZF9jYWxsKGRhdGEtPnByb3h5LCAiV3JpdGVWYWx1ZSIsDQo+IHdyaXRlX3NldHVwLA0K PiA+ICsgICAgICAgICAgIC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Ag ICAgICAgICAgICAgd3JpdGVfc2V0dXAsIHdyaXRlX3JlcGx5LCBkYXRhLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVfZGF0YV9mcmVlKSA9PSBGQUxTRSkgew0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRmFpbGVkIHRvIHdyaXRlXG4iKTsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICB3cml0ZV9kYXRhX2ZyZWUoZGF0YSk7DQo+ID4g KyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAg ICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmICgoZGJ1c19tZXNzYWdlX2dldF9hcmdzKG1lc3Nh Z2UsIE5VTEwsIERCVVNfVFlQRV9VTklYX0ZELA0KPiAmZmQsDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9VSU5UMTYsICZ3cml0ZV9tdHUsDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9JTlZB TElEKSA9PSBmYWxzZSkpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJJbnZhbGlk IEFjcXVpcmVXcml0ZSByZXNwb25zZVxuIik7DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsN Cj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBybF9wcmludGYoIkFjcXVpcmVXcml0 ZSBzdWNjZXNzOiBmZCAlZCBNVFUgJXVcbiIsIGZkLCB3cml0ZV9tdHUpOw0KPiA+ICsNCj4gPiAr ICAgICAgIHdyaXRlX2lvID0gcGlwZV9pb19uZXcoZmQpOw0KPiA+ICsNCj4gPiArICAgICAgIHBp cGVfd3JpdGUod3JpdGVfaW8sIGRhdGEpOw0KPiA+ICt9DQo+ID4gKw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ICsgICAgICAgICAgICAg ICB9DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZ19kYnVz X3Byb3h5X21ldGhvZF9jYWxsKGRhdGEtPnByb3h5LCAiV3JpdGVWYWx1ZSIsDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZV9zZXR1cCwgd3JpdGVfcmVwbHksIGRhdGEs DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZV9kYXRhX2ZyZWUpID09 IEZBTFNFKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJGYWlsZWQg dG8gd3JpdGVcbiIpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlX2RhdGFfZnJl ZShkYXRhKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4g KyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgICAgICAgICAgcHJpbnRfYnl0ZV9hcnJheSgi R0FUVC1UWDogIiwgYnVmLCBsZW4pOw0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkF0 dGVtcHRpbmcgdG8gd3JpdGUgJXNcbiIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZ19kYnVzX3Byb3h5X2dldF9wYXRoKHByb3h5KSk7DQo+ID4g KyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4gPiAr DQo+ID4gK3N0YXRpYyB2b2lkIG5vdGlmeV9yZXBseShEQnVzTWVzc2FnZSAqbWVzc2FnZSwgdm9p ZCAqdXNlcl9kYXRhKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBzdHJ1Y3Qgbm90aWZ5X2RhdGEgKmRh dGEgPSB1c2VyX2RhdGE7DQo+ID4gKyAgICAgIC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ZXRfZmQoaW8pOw0KPiA+ICsgICAgICAgc3NpemVfdCBsZW47DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKGlvICE9IG5vdGlmeV9pbykNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7DQo+ ID4gKw0KPiA+ICsgICAgICAgd2hpbGUgKChsZW4gPSByZWFkKGZkLCBidWYsIHNpemVvZihidWYp KSkpIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGxlbiA8PSAwKQ0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmVzID0gYnVm Ow0KPiA+ICsgICAgICAgICAgICAgICBtZXNoX2dhdHRfc2FyKCZyZXMsIGxlbik7DQo+ID4gKw0K PiA+ICsgICAgICAgICAgICAgICBpZiAocHJvdikNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICBwcm92X2RhdGFfcmVhZHkobm9kZSwgcmVzLCBsZW4pOw0KPiA+ICsgICAgICAgICAgICAgICBl bHNlDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbmV0X2RhdGFfcmVhZHkocmVzLCBsZW4p Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9 DQo+ID4gKw0KPiA+ICtzdGF0aWMgYm9vbCBwaXBlX3JlYWRfcHJvdihzdHJ1Y3QgaW8gKmlvLCB2 b2lkICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4gPiArICAgICAgIHJldHVybiBwaXBlX3JlYWQoaW8s IHRydWUsIHVzZXJfZGF0YSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBib29sIHBpcGVf cmVhZF9wcm94eShzdHJ1Y3QgaW8gKmlvLCB2b2lkICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4gPiAr ICAgICAgIHJldHVybiBwaXBlX3JlYWQoaW8sIGZhbHNlLCB1c2Vy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B7DQo+ID4gKyAgICAgICAgICAgICAgIGlvX2Rlc3Ryb3kobm90aWZ5X2lv KTsNCj4gPiArICAgICAgICAgICAgICAgbm90aWZ5X2lvID0gTlVMTDsNCj4gPiArICAgICAgIH0N Cj4gPiArDQo+ID4gKyAgICAgICBub3RpZnlfbXR1ID0gMDsNCj4gPiArDQo+ID4gKyAgICAgICBp ZiAoKGRidXNfbWVzc2FnZV9nZXRfYXJncyhtZXNzYWdlLCBOVUxMLCBEQlVTX1RZUEVfVU5JWF9G RCwNCj4gJmZkLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBE QlVTX1RZUEVfVUlOVDE2LCAmbm90aWZ5X210dSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0lOVkFMSUQpID09IGZhbHNlKSkgew0KPiA+ICsg ICAgICAgICAgICAgICBpZiAoZ19kYnVzX3Byb3h5X21ldGhvZF9jYWxsKGRhdGEtPnByb3h5LCAi U3RhcnROb3RpZnkiLCBOVUxMLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBub3RpZnlfcmVwbHksIGRhdGEsIE5VTEwpID09IEZBTFNFKSB7DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJGYWlsZWQgdG8gU3RhcnROb3RpZnlcbiIpOw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZShkYXRhKTsNCj4gPiArICAgICAgICAg ICAgICAgfQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgcmxfcHJpbnRmKCJBY3F1aXJlTm90aWZ5IHN1Y2Nlc3M6IGZkICVkIE1U VSAldVxuIiwgZmQsIG5vdGlmeV9tdHUpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChnX2RidXNf cHJveHlfZ2V0X3Byb3BlcnR5KGRhdGEtPnByb3h5LCAiVVVJRCIsICZpdGVyKSA9PQ0KPiBGQUxT RSkNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsNCj4gPiArICAgICAgIG5v dGlmeV9pbyA9IHBpcGVfaW9fbmV3KGZkKTsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVzX21lc3Nh Z2VfaXRlcl9nZXRfYmFzaWMoJml0ZXIsICZ1dWlkKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAo IWJ0X3V1aWRfc3RyY21wKHV1aWQsIE1FU0hfUFJPVl9EQVRBX09VVF9VVUlEX1NUUikpDQo+ID4g KyAgICAgICAgICAgICAgIGlvX3NldF9yZWFkX2hhbmRsZXIobm90aWZ5X2lvLCBwaXBlX3JlYWRf cHJvdiwgZGF0YS0NCj4gPnVzZXJfZGF0YSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsNCj4g PiArICAgICAgIGVsc2UgaWYgKCFidF91dWlkX3N0cmNtcCh1dWlkLCBNRVNIX1BST1hZX0RBVEFf T1VUX1VVSURfU1RSKSkNCj4gPiArICAgICAgICAgICAgICAgaW9fc2V0X3JlYWRfaGFuZGxlcihu b3RpZnlfaW8sIHBpcGVfcmVhZF9wcm94eSwgZGF0YS0NCj4gPnVzZXJfZGF0YSwNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBOVUxMKTsNCj4gPiArDQo+ID4gK2RvbmU6DQo+ID4gKyAgICAgICBpZiAoZGF0 YS0+Y2IpDQo+ID4gKyAgICAgICAgICAgICAgIGRhdGEtPmNiKG1lc3NhZ2UsIGRhdGEtPnVzZXJf ZGF0YSk7DQo+ID4gKw0KPiA+ICsgICAgICAgZ19mcmVlKGRhdGEpOw0KPiA+ICt9D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ICAgICAgICAgICAgICB9DQo+ID4gKyAgICAgICB9IGVs c2Ugew0KPiA+ICsgICAgICAgICAgICAgICBpZiAobm90aWZ5X2lvKSB7DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgbm90aWZ5X2lvX2Rlc3Ryb3koKTsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBpZiAoY2IpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYihO VUxMLCB1c2VyX2RhdGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVl Ow0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIG1ldGhvZCA9ICJTdG9wTm90aWZ5IjsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBj YiA9IG5vdGlmeV9yZXBseTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgfQ0K PiA+ICsNCj4gPiArICAgICAgIGlmIChnX2RidXNfcHJveHlfbWV0aG9kX2NhbGwocHJveHksIG1l dGhvZCwgTlVMTCwgY2IsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGRhdGEsIE5VTEwpID09IEZBTFNFKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50 ZigiRmFpbGVkIHRvICVzXG4iLCBtZXRob2QpOw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4g ZmFsc2U7DQo+ID4gKyAgICAgICB9DQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiArfQ0K PiA+IGRpZmYgLS1naXQgYS9tZXNoL21haW4uYyBiL21lc2gvbWFpbi5jDQo+ID4gbmV3IGZpbGUg bW9kZSAxMDA2NDQNCj4gPiBpbmRleCAwMDAwMDAwLi5hMzQ3NDg0DQo+ID4gLS0tIC9kZXYvbnVs bA0KPiA+ICsrKyBiL21lc2gvbWFpb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gICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9n ZXRfYmFzaWMoJml0ZXIsICZhZGRyZXNzKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVz X3Byb3h5X2dldF9wcm9wZXJ0eShwcm94eSwgIkFsaWFzIiwgJml0ZXIpID09IFRSVUUpDQo+ID4g KyAgICAgICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2dldF9iYXNpYygmaXRlciwgJm5hbWUp Ow0KPiA+ICsgICAgICAgZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICBuYW1lID0gIjx1bmtub3du PiI7DQo+ID4gKw0KPiA+ICsgICAgICAgcmxfcHJpbnRmKCIlcyVzJXNDb250cm9sbGVyICVzICVz ICVzXG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24g PyAiWyIgOiAiIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0 aW9uID8gOiAiIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0 aW9uID8gIl0gIiA6ICIiLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRk cmVzcywgbmFtZSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRf Y3RybCAmJg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdF9jdHJs LT5wcm94eSA9PSBwcm94eSA/DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAi W2RlZmF1bHRdIiA6ICIiKTsNCj4gPiArDQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lk IHByaW50X2RldmljZShHREJ1c1Byb3h5ICpwcm94eSwgY29uc3QgY2hhciAqZGVzY3JpcHRpb24p DQo+ID4gK3sNCj4gPiArICAgICAgIERCdXNNZXNzYWdlSXRlciBpdGVyOw0KPiA+ICsgICAgICAg Y29uc3QgY2hhciAqYWRkcmVzcywgKm5hbWU7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGdfZGJ1 c19wcm94eV9nZXRfcHJvcGVydHkocHJveHksICJBZGRyZXNzIiwgJml0ZXIpID09IEZBTFNFKQ0K PiA+ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKw0KPiA+ICsgICAgICAgZGJ1c19tZXNz YWdlX2l0ZXJfZ2V0X2Jhc2ljKCZpdGVyLCAmYWRkcmVzcyk7DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKGdfZGJ1c19wcm94eV9nZXRfcHJvcGVydHkocHJveHksICJBbGlhcyIsICZpdGVyKSA9PSBU UlVFKQ0KPiA+ICsgICAgICAgICAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9nZXRfYmFzaWMoJml0 ZXIsICZuYW1lKTsNCj4gPiArICAgICAgIGVsc2UNCj4gPiArICAgICAgICAgICAgICAgbmFtZSA9 ICI8dW5rbm93bj4iOw0KPiA+ICsNCj4gPiArICAgICAgIHJsX3ByaW50ZigiJXMlcyVzRGV2aWNl ICVzICVzXG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRp b24gPyAiWyIgOiAiIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2Ny aXB0aW9uID8gOiAiIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2Ny aXB0aW9uID8gIl0gIiA6ICIiLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg YWRkcmVzcywgbmFtZSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIHByaW50X2l0 ZXIoY29uc3QgY2hhciAqbGFiZWwsIGNvbnN0IGNoYXIgKm5hbWUsDQo+ID4gKyAgICAgICAg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Rlcl9nZXRfYmFzaWMoaXRlciwgJnZhbHMxNik7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3By aW50ZigiJXMlczogJWRcbiIsIGxhYmVsLCBuYW1lLCB2YWxzMTYpOw0KPiA+ICsgICAgICAgICAg ICAgICBicmVhazsNCj4gPiArICAgICAgIGNhc2UgREJVU19UWVBFX0JZVEU6DQo+ID4gKyAgICAg ICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2dldF9iYXNpYyhpdGVyLCAmYnl0ZSk7DQo+ID4g KyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiJXMlczogMHglMDJ4XG4iLCBsYWJlbCwgbmFtZSwg Ynl0ZSk7DQo+ID4gKyAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsgICAgICAgY2FzZSBEQlVT X1RZUEVfVkFSSUFOVDoNCj4gPiArICAgICAgICAgICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJfcmVj dXJzZShpdGVyLCAmc3ViaXRlcik7DQo+ID4gKyAgICAgICAgICAgICAgIHByaW50X2l0ZXIobGFi ZWwsIG5hbWUsICZzdWJpdGVyKTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAg ICAgICBjYXNlIERCVVNfVFlQRV9BUlJBWToNCj4gPiArICAgICAgICAgICAgICAgZGJ1c19tZXNz YWdlX2l0ZXJfcmVjdXJzZShpdGVyLCAmc3ViaXRlcik7DQo+ID4gKyAgICAgICAgICAgICAgIHdo aWxlIChkYnVzX21lc3NhZ2VfaXRlcl9nZXRfYXJnX3R5cGUoJnN1Yml0ZXIpICE9DQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVT X1RZUEVfSU5WQUxJRCkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHByaW50X2l0ZXIo bGFiZWwsIG5hbWUsICZzdWJpdGVyKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBkYnVz X21lc3NhZ2VfaXRlcl9uZXh0KCZzdWJpdGVyKTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ ICsgICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAgIGNhc2UgREJVU19UWVBFX0RJQ1Rf RU5UUlk6DQo+ID4gKyAgICAgICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX3JlY3Vyc2UoaXRl ciwgJnN1Yml0ZXIpOw0KPiA+ICsgICAgICAgICAgICAgICBlbnRyeSA9IGdfc3RyY29uY2F0KG5h bWUsICJLZXkiLCBOVUxMKTsNCj4gPiArICAgICAgICAgICAgICAgcHJpbnRfaXRlcihsYWJlbCwg ZW50cnksICZzdWJpdGVyKTsNCj4gPiArICAgICAgICAgICAgICAgZ19mcmVlKGVudHJ5KTsNCj4g PiArDQo+ID4gKyAgICAgICAgICAgICAgIGVudHJ5ID0gZ19zdHJjb25jYXQobmFtZSwgIiBWYWx1 ZSIsIE5VTEwpOw0KPiA+ICsgICAgICAgICAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9uZXh0KCZz dWJpdGVyKTsNCj4gPiArICAgICAgICAgICAgICAgcHJpbnRfaXRlcihsYWJlbCwgZW50cnksICZz dWJpdGVyKTsNCj4gPiArICAgICAgICAgICAgICAgZ19mcmVlKGVudHJ5KTsNCj4gPiArICAgICAg ICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICBkZWZhdWx0Og0KPiA+ICsgICAgICAgICAgICAg ICBybF9wcmludGYoIiVzJXMgaGFzIHVuc3VwcG9ydGVkIHR5cGVcbiIsIGxhYmVsLCBuYW1lKTsN Cj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICB9DQo+ID4gK30NCj4gPiAr DQo+ID4gK3N0YXRpYyB2b2lkIHByaW50X3Byb3BlcnR5KEdEQnVzUHJveHkgKnByb3h5LCBjb25z dCBjaGFyICpuYW1lKQ0KPiA+ICt7DQo+ID4gKyAgICAgIC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ArDQo+ID4g K3N0YXRpYyB2b2lkIHByaW50X3Byb3Zfc2VydmljZShzdHJ1Y3QgcHJvdl9zdmNfZGF0YSAqcHJv dl9kYXRhKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjb25zdCBjaGFyICpwcmVmaXggPSAiXHRcdCI7 DQo+ID4gKyAgICAgICBjaGFyIHR4dF91dWlkWzE2ICogMiArIDFdOw0KPiA+ICsgICAgICAgaW50 IGk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmxfcHJpbnRmKCIlc01lc2ggUHJvdmlzaW9uaW5nIFNl cnZpY2UgKCVzKVxuIiwgcHJlZml4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgTUVTSF9QUk9WX1NWQ19VVUlEKTsNCj4gPiArICAg ICAgIGZvciAoaSA9IDA7IGkgPCAxNjsgKytpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHNwcmlu dGYodHh0X3V1aWQgKyAoaSAqIDIpLCAiJTIuMngiLCBwcm92X2RhdGEtPmRldl91dWlkW2ldKTsN Cj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBybF9wcmludGYoIiVzXHREZXZpY2Ug VVVJRDogJXNcbiIsIHByZWZpeCwgdHh0X3V1aWQpOw0KPiA+ICsgICAgICAgcmxfcHJpbnRmKCIl c1x0T09COiAlNC40eFxuIiwgcHJlZml4LCBwcm92X2RhdGEtPm9vYik7DQo+ID4gKw0KPiA+ICt9 DQo+ID4gKw0KPiA+ICtzdGF0aWMgYm9vbCBwYXJzZV9wcm92X3NlcnZpY2VfZGF0YShjb25zdCBj aGFyICp1dWlkLCB1aW50OF90ICpkYXRhLCBpbnQNCj4gbGVuLA0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpk YXRhX291dCkNCj4gPiArew0KPiA+ICsgICAgICAgc3RydWN0IHByb3Zfc3ZjX2RhdGEgKnByb3Zf ZGF0YSA9IGRhdGFfb3V0Ow0KPiA+ICsgICAgICAgaW50IGk7DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKGxlbiA8IDE4KQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0K PiA+ICsgICAgICAgZm9yIChpID0gMDsgaSA8IDE2OyArK2kpIHsNCj4gPiArICAgICAgICAgICAg ICAgcHJvdl9kYXRhLT5kZXZfdXVpZFtpXSA9IGRhdGFbaV07DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgcHJvdl9kYXRhLT5vb2IgPSBnZXRfYmUxNigmZGF0YVsxNl0pOw0KPiA+ ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMg Ym9vbCBwYXJzZV9tZXNoX3NlcnZpY2VfZGF0YShjb25zdCBjaGFyICp1dWlkLCB1aW50OF90ICpk YXRhLCBpbnQNCj4gbGVuLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpkYXRhX291dCkNCj4gPiArew0KPiA+ ICsgICAgICAgY29uc3QgY2hhciAqcHJlZml4ID0gIlx0XHQiOw0KPiA+ICsNCj4gPiArICAgICAg IGlmICghKGxlbiA9PSA5ICYmIGRhdGFbMF0gPT0gMHgwMCkgJiYgIShsZW4gPT0gMTcgJiYgZGF0 YVswXSA9PSAweDAxKSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIlVuZXhwZWN0 ZWQgbWVzaCBwcm94eSBzZXJ2aWNlIGRhdGEgbGVuZ3RoICVkXG4iLA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGxlbik7DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAg IH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZGF0YVswXSAhPSBjb25uZWN0aW9uLnR5cGUpDQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAo ZGF0YVswXSA9PSBDT05OX1RZUEVfSURFTlRJVFkpIHsNCj4gPiArICAgICAgICAgICAgICAgdWlu dDhfdCAqa2V5Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKElTX1VOQVNTSUdORUQo Y29ubmVjdGlvbi51bmljYXN0KSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIC8qIFRo aXMgd291bGQgYmUgYSBidWcgKi8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmlu dGYoIkVycm9yOiBTZWFyY2hpbmcgaWRlbnRpdHkgd2l0aCAiDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidW5pY2FzdCAwMDAwXG4i KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAg ICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGtleSA9IGtleXNfbmV0X2tl eV9nZXQocHJvdl9uZXRfa2V5X2luZGV4LCB0cnVlKTsNCj4gPiArICAgICAgICAgICAgICAgaWYg KCFrZXkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgaWYgKCFtZXNoX2NyeXB0b19pZGVudGl0eV9jaGVjayhrZXks IGNvbm5lY3Rpb24udW5pY2FzdCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICZkYXRhWzFdKSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBy ZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZGlzY292ZXJpbmcp IHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIlxuJXNNZXNoIFByb3h5 IFNlcnZpY2UgKCVzKVxuIiwgcHJlZml4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV1aWQpOw0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50ZigiJXNJZGVudGl0eSBmb3Igbm9kZSAl NC40eFxuIiwgcHJlZml4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbi51bmljYXN0KTsNCj4gPiArICAgICAgICAg ICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIH0gZWxzZSBpZiAoZGF0YVswXSA9PSBDT05OX1RZ UEVfTkVUV09SSykgew0KPiA+ICsgICAgICAgICAgICAgICB1aW50MTZfdCBuZXRfaWR4ID0gbmV0 X3ZhbGlkYXRlX3Byb3h5X2JlYWNvbihkYXRhICsgMSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICBpZiAobmV0X2lkeCA9PSBORVRfSURYX0lOVkFMSUQgfHwgbmV0X2lkeCAhPQ0KPiBjb25u ZWN0aW9uLm5ldF9pZHgpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNl Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGRpc2NvdmVyaW5nKSB7DQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJcbiVzTWVzaCBQcm94eSBTZXJ2aWNlICgl cylcbiIsIHByZWZpeCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dWlkKTsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBybF9wcmludGYoIiVzTmV0d29yayBCZWFjb24gZm9yIG5ldCBpbmRleCAl NC40eFxuIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHByZWZpeCwgbmV0X2lkeCk7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4g PiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiArfQ0KPiA+ ICsNCj4gPiArc3RhdGljIGJvb2wgcGFyc2Vfc2VydmljZV9kYXRhKEdEQnVzUHJveHkgKnByb3h5 LCBjb25zdCBjaGFyDQo+ICp0YXJnZXRfdXVpZCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgdm9pZCAqZGF0YV9vdXQpDQo+ID4gK3sNCj4gPiArICAgICAgIERC dXNNZXNzYWdlSXRlciBpdGVyLCBlbnRyaWVzOw0KPiA+ICsgICAgICAgYm9vbCBtZXNoX3Byb3Yg PSBmYWxzZTsNCj4gPiArICAgICAgIGJvb2wgbWVzaF9wcm94eSA9IGZhbHNlOw0KPiA+ICsNCj4g PiArICAgICAgIGlmICh0YXJnZXRfdXVpZCkgew0KPiA+ICsgICAgICAgICAgICAgICBtZXNoX3By b3YgPSAhc3RyY21wKHRhcmdldF91dWlkLCBNRVNIX1BST1ZfU1ZDX1VVSUQpOw0KPiA+ICsgICAg ICAgICAgICAgICBtZXNoX3Byb3h5ID0gIXN0cmNtcCh0YXJnZXRfdXVpZCwgTUVTSF9QUk9YWV9T VkNfVVVJRCk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFnX2RidXNf cHJveHlfZ2V0X3Byb3BlcnR5KHByb3h5LCAiU2VydmljZURhdGEiLCAmaXRlcikpDQo+ID4gKyAg ICAgICAgICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChkYnVzX21l c3NhZ2VfaXRlcl9nZXRfYXJnX3R5cGUoJml0ZXIpICE9IERCVVNfVFlQRV9BUlJBWSkNCj4gPiAr ICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGRidXNfbWVz c2FnZV9pdGVyX3JlY3Vyc2UoJml0ZXIsICZlbnRyaWVzKTsNCj4gPiArDQo+ID4gKyAgICAgICB3 aGlsZSAoZGJ1c19tZXNzYWdlX2l0ZXJfZ2V0X2FyZ190eXBlKCZlbnRyaWVzKQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID09IERCVVNfVFlQRV9E SUNUX0VOVFJZKSB7DQo+ID4gKyAgICAgICAgICAgICAgIERCdXNNZXNzYWdlSXRlciB2YWx1ZSwg ZW50cnksIGFycmF5Ow0KPiA+ICsgICAgICAgICAgICAgICBjb25zdCBjaGFyICp1dWlkX3N0cjsN Cj4gPiArICAgICAgICAgICAgICAgYnRfdXVpZF90IHV1aWQ7DQo+ID4gKyAgICAgICAgICAgICAg IHVpbnQ4X3QgKnNlcnZpY2VfZGF0YTsNCj4gPiArICAgICAgICAgICAgICAgaW50IGxlbjsNCj4g PiArDQo+ID4gKyAgICAgICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX3JlY3Vyc2UoJmVudHJp ZXMsICZlbnRyeSk7DQo+ID4gKyAgICAgICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2dldF9i YXNpYygmZW50cnksICZ1dWlkX3N0cik7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAo YnRfc3RyaW5nX3RvX3V1aWQoJnV1aWQsIHV1aWRfc3RyKSA8IDApDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgZ290byBmYWlsOw0KPiA+ICsNCj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fZGF0YSh1dWlkX3N0ciwgc2VydmljZV9kYXRhLA0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4sIGRh dGFfb3V0KTsNCj4gPiArICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtZXNoX3Byb3h5ICYmDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhc3RyY21wKHV1aWRfc3RyLCBNRVNI X1BST1hZX1NWQ19VVUlEKSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBw YXJzZV9tZXNoX3NlcnZpY2VfZGF0YSh1dWlkX3N0ciwgc2VydmljZV9kYXRhLA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBsZW4sIGRhdGFfb3V0KTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4gPiArICAg ICAgICAgICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJfbmV4dCgmZW50cmllcyk7DQo+ID4gKyAgICAg ICB9DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCF0YXJnZXRfdXVpZCkNCj4gPiArICAgICAgICAg ICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK2ZhaWw6DQo+ID4gKyAgICAgICByZXR1cm4gZmFsc2U7 DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIHByaW50X3V1aWRzKEdEQnVzUHJveHkg KnByb3h5KQ0KPiA+ICt7DQo+ID4gKyAgICAgICBEQnVzTWVzc2FnZUl0ZXIgaXRlciwgdmFsdWU7 DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGdfZGJ1c19wcm94eV9nZXRfcHJvcGVydHkocHJveHks ICJVVUlEcyIsICZpdGVyKSA9PSBGQUxTRSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0K PiA+ICsNCj4gPiArICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX3JlY3Vyc2UoJml0ZXIsICZ2YWx1 ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgd2hpbGUgKGRidXNfbWVzc2FnZV9pdGVyX2dldF9hcmdf dHlwZSgmdmFsdWUpID09DQo+IERCVVNfVFlQRV9TVFJJTkcpIHsNCj4gPiArICAgICAgICAgICAg ICAgY29uc3QgY2hhciAqdXVpZCwgKnRleHQ7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBk YnVzX21lc3NhZ2VfaXRlcl9nZXRfYmFzaWMoJnZhbHVlLCAmdXVpZCk7DQo+ID4gKw0KPiA+ICsg ICAgICAgICAgICAgICB0ZXh0ID0gdXVpZHN0cl90b19zdHIodXVpZCk7DQo+ID4gKyAgICAgICAg ICAgICAgIGlmICh0ZXh0KSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciBzdHJb MjZdOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGludCBuOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBzdHJbc2l6ZW9mKHN0cikgLSAxXSA9ICdcMCc7 DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG4gPSBzbnByaW50ZihzdHIsIHNp emVvZihzdHIpLCAiJXMiLCB0ZXh0KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAo biA+IHNpemVvZihzdHIpIC0gMSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgc3RyW3NpemVvZihzdHIpIC0gMl0gPSAnLic7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBzdHJbc2l6ZW9mKHN0cikgLSAzXSA9ICcuJzsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGlmIChzdHJbc2l6ZW9mKHN0cikgLSA0XSA9PSAnICcpDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cltzaXplb2Yoc3RyKSAt IDRdID0gJy4nOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4g PSBzaXplb2Yoc3RyKSAtIDE7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgfQ0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIlx0VVVJRDogJXMlKmMoJXMp XG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHN0ciwgMjYgLSBuLCAnICcsIHV1aWQpOw0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2UNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIlx0VVVJRDogJSpjKCVzKVxuIiwg MjYsICcgJywgdXVpZCk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBkYnVzX21lc3NhZ2Vf aXRlcl9uZXh0KCZ2YWx1ZSk7DQo+ID4gKyAgICAgICB9DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0 YXRpYyBnYm9vbGVhbiBkZXZpY2VfaXNfY2hpbGQoR0RCdXNQcm94eSAqZGV2aWNlLCBHREJ1c1By b3h5DQo+ICptYXN0ZXIpDQo+ID4gK3sNCj4gPiArICAgICAgIERCdXNNZXNzYWdlSXRlciBpdGVy Ow0KPiA+ICsgICAgICAgY29uc3QgY2hhciAqYWRhcHRlciwgKnBhdGg7DQo+ID4gKw0KPiA+ICsg ICAgICAgaWYgKCFtYXN0ZXIpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBGQUxTRTsNCj4g PiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVzX3Byb3h5X2dldF9wcm9wZXJ0eShkZXZpY2UsICJB ZGFwdGVyIiwgJml0ZXIpID09IEZBTFNFKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4g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ICAgICAgY2hhciBidWZbMTBdOw0KPiA+ICsgICAgICAgYm9v bCBtZXNoOw0KPiA+ICsNCj4gPiArICAgICAgIGNvbm5lY3Rpb24uZGV2aWNlID0gcHJveHk7DQo+ ID4gKw0KPiA+ICsgICAgICAgaWYgKHByb3h5ID09IE5VTEwpIHsNCj4gPiArICAgICAgICAgICAg ICAgbWVtc2V0KCZjb25uZWN0aW9uLCAwLCBzaXplb2YoY29ubmVjdGlvbikpOw0KPiA+ICsgICAg ICAgICAgICAgICBjb25uZWN0aW9uLnR5cGUgPSBDT05OX1RZUEVfSU5WQUxJRDsNCj4gPiArICAg ICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAg IGlmIChjb25uZWN0aW9uLnR5cGUgPT0gQ09OTl9UWVBFX0lERU5USVRZKSB7DQo+ID4gKyAgICAg ICAgICAgICAgIG1lc2ggPSB0cnVlOw0KPiA+ICsgICAgICAgICAgICAgICBzbnByaW50ZihidWYs IDEwLCAiTm9kZS0lNC40eCIsIGNvbm5lY3Rpb24udW5pY2FzdCk7DQo+ID4gKyAgICAgICB9IGVs c2UgaWYgKGNvbm5lY3Rpb24udHlwZSA9PSBDT05OX1RZUEVfTkVUV09SSykgew0KPiA+ICsgICAg ICAgICAgICAgICBtZXNoID0gdHJ1ZTsNCj4gPiArICAgICAgICAgICAgICAgc25wcmludGYoYnVm LCA5LCAiTmV0LSU0LjR4IiwgY29ubmVjdGlvbi5uZXRfaWR4KTsNCj4gPiArICAgICAgIH0gZWxz ZSB7DQo+ID4gKyAgICAgICAgICAgICAgIG1lc2ggPSBmYWxzZTsNCj4gPiArICAgICAgIH0NCj4g PiArDQo+ID4gKyAgICAgICBpZiAoIWdfZGJ1c19wcm94eV9nZXRfcHJvcGVydHkocHJveHksICJB bGlhcyIsICZpdGVyKSAmJiAhbWVzaCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBnb3Rv IGRvbmU7DQo+ID4gK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ml0ZXIpKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKw0KPiA+ ICsgICAgICAgaWYgKHBhcnNlX3NlcnZpY2VfZGF0YShwcm94eSwgTUVTSF9QUk9WX1NWQ19VVUlE LCAmcHJvdl9kYXRhKSkNCj4gew0KPiA+ICsgICAgICAgICAgICAgICBzdHJ1Y3QgbWVzaF9kZXZp Y2UgKmRldjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGRldiA9IGZpbmRfZGV2aWNlX2J5 X3V1aWQoYWRhcHRlci0+bWVzaF9kZXZpY2VzLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdl9kYXRhLmRldl91dWlkKTsNCj4g PiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIERpc3BsYXkgcHJvdmlzaW9uaW5nIHNlcnZpY2Ug b25jZSBwZXIgc2ljb3Zlcnkgc2Vzc2lvbiAqLw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZGlz Y292ZXJpbmcgJiYgKCFkZXYgfHwgIWRldi0+aGlkZSkpDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRfcHJvdl9zZXJ2aWNlKCZwcm92X2Rh dGEpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGRldikgew0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIGRldi0+cHJveHkgPSBwcm94eTsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBkZXYtPmhpZGUgPSBkaXNjb3ZlcmluZzsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICByZXR1cm47DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAg ICAgICAgIGRldiA9IGdfbWFsbG9jMChzaXplb2Yoc3RydWN0IG1lc2hfZGV2aWNlKSk7DQo+ID4g KyAgICAgICAgICAgICAgIGlmICghZGV2KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJl dHVybjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGRldi0+cHJveHkgPSBwcm94eTsNCj4g PiArICAgICAgICAgICAgICAgZGV2LT5oaWRlID0gZGlzY292ZXJpbmc7DQo+ID4gKw0KPiA+ICsg ICAgICAgICAgICAgICBtZW1jcHkoZGV2LT5kZXZfdXVpZCwgcHJvdl9kYXRhLmRldl91dWlkLCAx Nik7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBhZGFwdGVyLT5tZXNoX2RldmljZXMgPSBn X2xpc3RfYXBwZW5kKGFkYXB0ZXItDQo+ID5tZXNoX2RldmljZXMsDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXYpOw0KPiA+ICsg ICAgICAgICAgICAgICBwcmludF9kZXZpY2UocHJveHksIENPTE9SRURfTkVXKTsNCj4gPiArDQo+ ID4gKyAgICAgICAgICAgICAgIG5vZGVfY3JlYXRlX25ldygmcHJvdl9kYXRhKTsNCj4gPiArDQo+ ID4gKyAgICAgICB9IGVsc2UgaWYgKHBhcnNlX3NlcnZpY2VfZGF0YShwcm94eSwgTUVTSF9QUk9Y WV9TVkNfVVVJRCwgTlVMTCkNCj4gJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzY292ZXJfbWVzaCkgew0KPiA+ ICsgICAgICAgICAgICAgICBib29sIHJlczsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGdf ZGJ1c19wcm94eV9tZXRob2RfY2FsbChkZWZhdWx0X2N0cmwtPnByb3h5LCAiU3RvcERpc2NvdmVy eSIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg TlVMTCwgTlVMTCwgTlVMTCwg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o+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBkaXNjb25u ZWN0KEdEQnVzUmV0dXJuRnVuY3Rpb24gY2IsIHZvaWQgKnVzZXJfZGF0YSkNCj4gPiArew0KPiA+ ICsgICAgICAgR0RCdXNQcm94eSAqcHJveHk7DQo+ID4gKyAgICAgICBEQnVzTWVzc2FnZUl0ZXIg aXRlcjsNCj4gPiArICAgICAgIGNvbnN0IGNoYXIgKmFkZHI7DQo+ID4gKw0KPiA+ICsgICAgICAg cHJveHkgPSBjb25uZWN0aW9uLmRldmljZTsNCj4gPiArICAgICAgIGlmICghcHJveHkpDQo+ID4g KyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVzX3By b3h5X21ldGhvZF9jYWxsKHByb3h5LCAiRGlzY29ubmVjdCIsIE5VTEwsIGNiLA0KPiB1c2VyX2Rh dGEsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBOVUxMKSA9PSBGQUxTRSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYo IkZhaWxlZCB0byBkaXNjb25uZWN0XG4iKTsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0K PiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmIChnX2RidXNfcHJveHlfZ2V0X3By b3BlcnR5KHByb3h5LCAiQWRkcmVzcyIsICZpdGVyKSA9PSBUUlVFKQ0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2dldF9iYXNpYygmaXRlciwgJmFkZHIpOw0K PiA+ICsNCj4gPiArICAgICAgIHJsX3ByaW50ZigiQXR0ZW1wdGluZyB0byBkaXNjb25uZWN0IGZy b20gJXNcbiIsIGFkZHIpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBkaXNjX25v dGlmeV9jYihE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BkaXNjb25uZWN0X2RhdGEpKTsNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBkaXNjX2RhdGEtPmNiID0gY2I7DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgZGlzY19kYXRhLT5kYXRhID0gdXNlcl9kYXRhOw0KPiA+ICsNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBpZiAobWVzaF9nYXR0X25vdGlmeShjb25uZWN0aW9uLmRh dGFfb3V0LCBmYWxzZSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBkaXNjX25vdGlmeV9jYiwgZGlzY19kYXRhKSkNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsg ICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGRpc2Nvbm5lY3QoY2IsIHVzZXJfZGF0YSk7DQo+ ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIG1lc2hfcHJvdl9kb25lKHZvaWQgKnVzZXJf ZGF0YSwgaW50IHN0YXR1cyk7DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBub3RpZnlfcHJvdl9v dXRfY2IoREJ1c01lc3NhZ2UgKm1lc3NhZ2UsIHZvaWQNCj4gKnVzZXJfZGF0YSkNCj4gPiArew0K PiA+ICsgICAgICAgc3RydWN0IG1lc2hfbm9kZSAqbm9kZSA9IHVzZXJfZGF0YTsNCj4gPiArICAg ICAgIERCdXNFcnJvciBlcnJvcjsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVzX2Vycm9yX2luaXQo JmVycm9yKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZGJ1c19zZXRfZXJyb3JfZnJvbV9tZXNz YWdlKCZlcnJvciwgbWVzc2FnZSkgPT0gVFJVRSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9w cmludGYoIkZhaWxlZCB0byBzdGFydCBub3RpZnk6ICVzXG4iLCBlcnJvci5uYW1lKTsNCj4gPiAr ICAgICAgICAgICAgICAgZGJ1c19lcnJvcl9mcmVlKCZlcnJvcik7DQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBybF9wcmludGYo Ik5vdGlmeSBmb3IgTWVzaCBQcm92aXNpb25pbmcgT3V0IERhdGEgc3RhcnRlZFxuIik7DQo+ID4g Kw0KPiA+ICsgICAgICAgaWYgKGNvbm5lY3Rpb24udHlwZSAhPSBDT05OX1RZUEVfUFJPVklTSU9O KSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRXJyb3I6IHdyb25nIGNvbm5lY3Rp b24gdHlwZSAlZCAoZXhwZWN0ZWQgJWQpXG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IGNvbm5lY3Rpb24udHlwZSwgQ09OTl9UWVBFX1BST1ZJU0lPTik7DQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIWNvbm5l Y3Rpb24uZGF0YV9pbikgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkVycm9yOiBk b24ndCBoYXZlIG1lc2ggcHJvdmlzaW9uaW5nIGRhdGEgaW5cbiIpOw0KPiA+ICsgICAgICAgICAg ICAgICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFub2Rl KSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRXJyb3I6IHByb3Zpc2lvbmluZyBu b2RlIG5vdCBwcmVzZW50XG4iKTsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsg ICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmKCFwcm92X29wZW4obm9kZSwgY29ubmVjdGlv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pdGlvbihjb25uZWN0aW9uLnVuaWNh c3QpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBub3RpZnlfcHJveHlfb3V0X2Ni KERCdXNNZXNzYWdlICptZXNzYWdlLCB2b2lkDQo+ICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4gPiAr ICAgICAgIERCdXNFcnJvciBlcnJvcjsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVzX2Vycm9yX2lu aXQoJmVycm9yKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZGJ1c19zZXRfZXJyb3JfZnJvbV9t ZXNzYWdlKCZlcnJvciwgbWVzc2FnZSkgPT0gVFJVRSkgew0KPiA+ICsgICAgICAgICAgICAgICBy bF9wcmludGYoIkZhaWxlZCB0byBzdGFydCBub3RpZnk6ICVzXG4iLCBlcnJvci5uYW1lKTsNCj4g PiArICAgICAgICAgICAgICAgZGJ1c19lcnJvcl9mcmVlKCZlcnJvcik7DQo+ID4gKyAgICAgICAg ICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBybF9wcmlu dGYoIk5vdGlmeSBmb3IgTWVzaCBQcm94eSBPdXQgRGF0YSBzdGFydGVkXG4iKTsNCj4gPiArDQo+ ID4gKyAgICAgICBpZiAoY29ubmVjdGlvbi50eXBlICE9IENPTk5fVFlQRV9JREVOVElUWSAmJg0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb24udHlwZSAhPSBDT05OX1RZUEVf TkVUV09SSykgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkVycm9yOiB3cm9uZyBj b25uZWN0aW9uIHR5cGUgJWQgIg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IihleHBlY3RlZCAlZCBvciAlZClcbiIsIGNvbm5lY3Rpb24udHlwZSwNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIENPTk5f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j4g PiArICAgICAgIH0NCj4gPiArICAgICAgIGZvciAobCA9IHNlcnZpY2VfbGlzdDsgbDsgbCA9IGwt Pm5leHQpIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKG1lc2hfZ2F0dF9pc19jaGlsZChsLT5k YXRhLCBkZXZpY2UsICJEZXZpY2UiKSAmJg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBzZXJ2aWNlX2lzX21lc2gobC0+ZGF0YSwgc3ZjX3V1aWQpKQ0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiAr ICAgICAgIGlmIChsKQ0KPiA+ICsgICAgICAgICAgICAgICBzZXJ2aWNlID0gbC0+ZGF0YTsNCj4g PiArICAgICAgIGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIk1lc2ggc2Vy dmljZSBub3QgZm91bmRcbiIpOw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gIE5VTEw7DQo+ ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgZm9yIChsID0gY2hhcl9saXN0OyBsOyBs ID0gbC0+bmV4dCkgew0KPiA+ICsgICAgICAgICAgICAgICBpZiAobWVzaF9nYXR0X2lzX2NoaWxk KGwtPmRhdGEsIHNlcnZpY2UsICJTZXJ2aWNlIikgJiYNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgY2hhcl9pc19tZXNoKGwtPmRhdGEsIGNoYXJfdXVpZCkpIHsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIkZvdW5kIG1hdGNoaW5nIGNo YXI6IHBhdGggJXMsIHV1aWQgJXNcbiIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBnX2RidXNfcHJveHlfZ2V0X3BhdGgobC0+ZGF0YSksIGNoYXJfdXVpZCk7DQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwtPmRhdGE7DQo+ID4gKyAgICAgICAgICAgICAg IH0NCj4gPiArICAgICAgIH0NCj4gPiArICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICt9DQo+ID4g Kw0KPiA+ICtzdGF0aWMgdm9pZCBtZXNoX3Nlc3Npb25fc2V0dXAoR0RCdXNQcm94eSAqcHJveHkp DQo+ID4gK3sNCj4gPiArICAgICAgIGlmIChjb25uZWN0aW9uLnR5cGUgPT0gQ09OTl9UWVBFX1BS T1ZJU0lPTikgew0KPiA+ICsgICAgICAgICAgICAgICBjb25uZWN0aW9uLmRhdGFfaW4gPSBnZXRf Y2hhcmFjdGVyaXN0aWMocHJveHksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgTUVTSF9QUk9WX0RBVEFfSU5fVVVJRF9TVFIpOw0KPiA+ICsgICAg ICAgICAgICAgICBpZiAoIWNvbm5lY3Rpb24uZGF0YV9pbikNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBnb3RvIGZhaWw7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBjb25uZWN0aW9u LmRhdGFfb3V0ID0gZ2V0X2NoYXJhY3RlcmlzdGljKHByb3h5LA0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1FU0hfUFJPVl9EQVRBX09VVF9VVUlE X1NUUik7DQo+ID4gKyAgICAgICAgICAgICAgIGlmICghY29ubmVjdGlvbi5kYXRhX291dCkNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBkYXRhX291dF9ub3RpZnkoY29ubmVjdGlvbi5kYXRhX291dCwgdHJ1ZSwgbm90aWZ5 X3Byb3Zfb3V0X2NiKTsNCj4gPiArDQo+ID4gKyAgICAgICB9IGVsc2UgaWYgKGNvbm5lY3Rpb24u dHlwZSAhPSBDT05OX1RZUEVfSU5WQUxJRCl7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBj b25uZWN0aW9uLmRhdGFfaW4gPSBnZXRfY2hhcmFjdGVyaXN0aWMocHJveHksDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUVTSF9QUk9YWV9EQVRB X0lOX1VVSURfU1RSKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFjb25uZWN0aW9uLmRhdGFf aW4pDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOw0KPiA+ICsNCj4gPiAr ICAgICAgICAgICAgICAgY29ubmVjdGlvbi5kYXRhX291dCA9IGdldF9jaGFyYWN0ZXJpc3RpYyhw cm94eSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBNRVNIX1BST1hZX0RBVEFfT1VUX1VVSURfU1RSKTsNCj4gPiArICAgICAgICAgICAgICAgaWYg KCFjb25uZWN0aW9uLmRhdGFfb3V0KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdvdG8g ZmFpbDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGRhdGFfb3V0X25vdGlmeShjb25uZWN0 aW9uLmRhdGFfb3V0LCB0cnVlLA0KPiBub3RpZnlfcHJveHlfb3V0X2NiKTsNCj4gPiArICAgICAg IH0NCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm47DQo+ID4gKw0KPiA+ICtmYWlsOg0KPiA+ICsN Cj4gPiArICAgICAgIHJsX3ByaW50ZigiU2VydmljZXMgcmVzb2x2ZWQsIG1lc2ggY2hhcmFjdGVy aXN0aWNzIG5vdCBmb3VuZFxuIik7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIHBy b3h5X2FkZGVkKEdEQnVzUHJveHkgKnByb3h5LCB2b2lkICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4g PiArICAgICAgIGNvbnN0IGNoYXIgKmludGVyZmFjZTsNCj4gPiArDQo+ID4gKyAgICAgICBpbnRl cmZhY2UgPSBnX2RidXNfcHJveHlfZ2V0X2ludGVyZmFjZShwcm94eSk7DQo+ID4gKw0KPiA+ICsg ICAgICAgaWYgKCFzdHJjbXAoaW50ZXJmYWNlLCAib3JnLmJsdWV6LkRldmljZTEiKSkgew0KPiA+ ICsgICAgICAgICAgICAgICB1cGRhdGVfZGV2aWNlX2luZm8ocHJveHkpOw0KPiA+ICsNCj4gPiAr ICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChpbnRlcmZhY2UsICJvcmcuYmx1ZXouQWRhcHRlcjEi KSkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgYWRhcHRlcl9hZGRlZChwcm94eSk7DQo+ ID4gKw0KPiA+ICsgICAgICAgfSBlbHNlIGlmICghc3RyY21wKGludGVyZmFjZSwgIm9yZy5ibHVl ei5HYXR0U2VydmljZTEiKSAmJg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIHNlcnZpY2VfaXNfbWVzaChwcm94eSwgTlVMTCkpIHsNCj4gPiArDQo+ ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiU2VydmljZSBhZGRlZCAlc1xuIiwgZ19kYnVz X3Byb3h5X2dldF9wYXRoKHByb3h5KSk7DQo+ID4gKyAgICAgICAgICAgICAgIHNlcnZpY2VfbGlz dCA9IGdfbGlzdF9hcHBlbmQoc2VydmljZV9saXN0LCBwcm94eSk7DQo+ID4gKw0KPiA+ICsgICAg ICAgfSBlbHNlIGlmICghc3RyY21wKGludGVyZmFjZSwgIm9yZy5ibHVlei5HYXR0Q2hhcmFjdGVy aXN0aWMxIikgJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBjaGFyX2lzX21lc2gocHJveH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N0YXJ0ZWQiIDogInN0 b3BwZWQiKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIHN0cnVjdCBtZXNoX2RldmljZSAq ZmluZF9kZXZpY2VfYnlfcHJveHkoR0xpc3QgKnNvdXJjZSwNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdEQnVzUHJveHkgKnByb3h5 KQ0KPiA+ICt7DQo+ID4gKyAgICAgICBHTGlzdCAqbGlzdDsNCj4gPiArDQo+ID4gKyAgICAgICBm b3IgKGxpc3QgPSBnX2xpc3RfZmlyc3Qoc291cmNlKTsgbGlzdDsgbGlzdCA9IGdfbGlzdF9uZXh0 KGxpc3QpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHN0cnVjdCBtZXNoX2RldmljZSAqZGV2ID0g bGlzdC0+ZGF0YTsNCj4gPiArICAgICAgICAgICAgICAgR0RCdXNQcm94eSAqcHJveHkgPSBkZXYt PnByb3h5Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGRldi0+cHJveHkgPT0gcHJv eHkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRldjsNCj4gPiArICAgICAg IH0NCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gTlVMTDsNCj4gPiArfQ0KPiA+ICsNCj4gPiAr c3RhdGljIHZvaWQgZGV2aWNlX3JlbW92ZWQoR0RCdXNQcm94eSAqcHJveHkpDQo+ID4gK3sNCj4g PiArICAgICAgIHN0cnVjdCBhZGFwdGVyICphZGFwdGVyID0gZmluZF9wYXJlbnQocHJveHkpOw0K PiA+ICsgICAgICAgc3RydWN0IG1lc2hfZGV2aWNlICpkZXY7DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKCFhZGFwdGVyKSB7DQo+ID4gKyAgICAgICAgICAgICAgIC8qIFRPRE86IEVycm9yICovDQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICBkZXYgPSBmaW5kX2RldmljZV9ieV9wcm94eShhZGFwdGVyLT5tZXNoX2RldmljZXMsIHBy b3h5KTsNCj4gPiArICAgICAgIGlmIChkZXYpDQo+ID4gKyAgICAgICAgICAgICAgIGFkYXB0ZXIt Pm1lc2hfZGV2aWNlcyA9IGdfbGlzdF9yZW1vdmUoYWRhcHRlci0NCj4gPm1lc2hfZGV2aWNlcywN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBkZXYpOw0KPiA+ICsNCj4gPiArICAgICAgIHByaW50X2Rldmlj ZShwcm94eSwgQ09MT1JFRF9ERUwpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChjb25uZWN0aW9u LmRldmljZSA9PSBwcm94eSkNCj4gPiArICAgICAgICAgICAgICAgc2V0X2Nvbm5lY3RlZF9kZXZp Y2UoTlVMTCk7DQo+ID4gKw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBhZGFwdGVy X3JlbW92ZWQoR0RCdXNQcm94eSAqcHJveHkpDQo+ID4gK3sNCj4gPiArICAgICAgIEdMaXN0ICps bDsNCj4gPiArICAgICAgIGZvciAobGwgPSBnX2xpc3RfZmlyc3QoY3RybF9saXN0KTsgbGw7IGxs ID0gZ19saXN0X25leHQobGwpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHN0cnVjdCBhZGFwdGVy ICphZGFwdGVyID0gbGwtPmRhdGE7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoYWRh cHRlci0+cHJveHkgPT0gcHJveHkpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcmlu dF9hZGFwdGVyKHByb3h5LCBDT0xPUkVEX0RFTCk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgIGlmIChkZWZhdWx0X2N0cmwgJiYgZGVmYXVsdF9jdHJsLT5wcm94eSA9PSBwcm94 eSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdF9jdHJsID0g TlVMTDsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldF9jb25uZWN0ZWRf ZGV2aWNlKE5VTEwpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgY3RybF9saXN0ID0gZ19saXN0X3JlbW92ZV9saW5rKGN0 cmxfbGlzdCwgbGwpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBnX2xpc3Rf ZnJlZV9mdWxsKGFkYXB0ZXItPm1lc2hfZGV2aWNlcywgZ19mcmVlKTsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBnX2ZyZWUoYWRhcHRlcik7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgZ19saXN0X2ZyZWUobGwpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsN Cj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgfQ0KPiA+ICt9DQo+ID4gKw0KPiA+ ICtzdGF0aWMgdm9pZCBwcm94eV9yZW1vdmVkKEdEQnVzUHJveHkgKnByb3h5LCB2b2lkICp1c2Vy X2RhdGEpDQo+ID4gK3sNCj4gPiArICAgICAgIGNvbnN0IGNoYXIgKmludGVyZmFjZTsNCj4gPiAr DQo+ID4gKyAgICAgICBpbnRlcmZhY2UgPSBnX2RidXNfcHJveHlfZ2V0X2ludGVyZmFjZShwcm94 eSk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFzdHJjbXAoaW50ZXJmYWNlLCAib3JnLmJsdWV6 LkRldmljZTEiKSkgew0KPiA+ICsgICAgICAgICAgICAgICBkZXZpY2VfcmVtb3ZlZChwcm94eSk7 DQo+ID4gKyAgICAgICB9IGVsc2UgaWYgKCFzdHJjbXAoaW50ZXJmYWNlLCAib3JnLmJsdWV6LkFk YXB0ZXIxIikpIHsNCj4gPiArICAgICAgICAgICAgICAgYWRhcHRlcl9yZW1vdmVkKHByb3h5KTsN Cj4gPiArICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChpbnRlcmZhY2UsICJvcmcuYmx1ZXouR2F0 dFNlcnZpY2UxIikpIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKHByb3h5ID09IGNvbm5lY3Rp b24uc2VydmljZSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZXJ2aWNlX2lz X21lc2gocHJveHksIE1FU0hfUFJPWFlfU1ZDX1VVSUQpKSB7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBkYXRhX291dF9ub3RpZnkoY29ubmVjdGlvbi5kYXRhX291dCwNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgZmFsc2UsIE5VTEwpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgbmV0X3Nlc3Npb25fY2xvc2UoY29ubmVjdGlvbi5kYXRhX2luKTsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICB9DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbi5z ZXJ2aWNlID0gTlVMTDsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0aW9uLmRh dGFfaW4gPSBOVUxMOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb24uZGF0 YV9vdXQgPSBOVUxMOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBzZXJ2aWNlX2xpc3QgPSBnX2xpc3RfcmVtb3ZlKHNlcnZpY2VfbGlzdCwgcHJveHkp Ow0KPiA+ICsNCj4g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WN0ZXJpc3RpY192 YWx1ZSgmaXRlciwgYnVmKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmICghbGVuIHx8 IGxlbiA+IDY5KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4g PiArDQo+ID4gKyAgICAgICAgICAgICAgIHJlcyA9IGJ1ZjsNCj4gPiArICAgICAgICAgICAgICAg bGVuID0gbWVzaF9nYXR0X3NhcigmcmVzLCBsZW4pOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAgaWYgKCFsZW4pDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGlzX3Byb3YpIHsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBub2RlID0gbm9kZV9maW5kX2J5X3V1aWQoY29ubmVjdGlvbi5kZXZfdXVp ZCk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICghbm9kZSkgew0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJOb2RlIG5vdCBmb3Vu ZD9cbiIpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNl Ow0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgcmV0dXJuIHByb3ZfZGF0YV9yZWFkeShub2RlLCByZXMsIGxlbik7DQo+ID4g KyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBuZXRf ZGF0YV9yZWFkeShyZXMsIGxlbik7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAg cmV0dXJuIGZhbHNlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgcHJv cGVydHlfY2hhbmdlZChHREJ1c1Byb3h5ICpwcm94eSwgY29uc3QgY2hhciAqbmFtZSwNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJ1c01lc3NhZ2VJdGVyICpp dGVyLCB2b2lkICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4gPiArICAgICAgIGNvbnN0IGNoYXIgKmlu dGVyZmFjZTsNCj4gPiArDQo+ID4gKyAgICAgICBpbnRlcmZhY2UgPSBnX2RidXNfcHJveHlfZ2V0 X2ludGVyZmFjZShwcm94eSk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFzdHJjbXAoaW50ZXJm YWNlLCAib3JnLmJsdWV6LkRldmljZTEiKSkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAg aWYgKGRlZmF1bHRfY3RybCAmJiBkZXZpY2VfaXNfY2hpbGQocHJveHksDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRfY3RybC0+cHJveHkpID09IFRS VUUpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0cmNtcChuYW1l LCAiQ29ubmVjdGVkIikgPT0gMCkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgZGJ1c19ib29sX3QgY29ubmVjdGVkOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJfZ2V0X2Jhc2ljKGl0ZXIsICZjb25uZWN0ZWQpOw0KPiA+ ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb25uZWN0ZWQgJiYg Y29ubmVjdGlvbi5kZXZpY2UgPT0gTlVMTCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgc2V0X2Nvbm5lY3RlZF9kZXZpY2UocHJveHkpOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoIWNvbm5lY3RlZCAmJg0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb24uZGV2 aWNlID09IHByb3h5KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBzZXRfY29ubmVjdGVkX2RldmljZShOVUxMKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICB9IGVsc2UgaWYgKChzdHJjbXAobmFtZSwgIkFsaWFzIikgPT0gMCkgJiYNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0aW9uLmRldmlj ZSA9PSBwcm94eSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogUmUt Z2VuZXJhdGUgcHJvbXB0ICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz ZXRfY29ubmVjdGVkX2RldmljZShwcm94eSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg fSBlbHNlIGlmICghc3RyY21wKG5hbWUsICJTZXJ2aWNlRGF0YSIpKSB7DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVfZGV2aWNlX2luZm8ocHJveHkpOw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChuYW1lLCAiU2VydmljZXNS ZXNvbHZlZCIpKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnYm9vbGVh biByZXNvbHZlZDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBk YnVzX21lc3NhZ2VfaXRlcl9nZXRfYmFzaWMoaXRlciwgJnJlc29sdmVkKTsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIlNlcnZpY2VzIHJlc29s dmVkICVzXG4iLCByZXNvbHZlZCA/DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ5ZXMiIDogIm5vIik7DQo+ID4gKw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc29sdmVkKQ0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNoX3Nlc3Npb25fc2V0dXAo Y29ubmVjdGlvbi5kZXZpY2UpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIH0NCj4gPiAr DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChp bnRlcmZhY2UsICJvcmcuYmx1ZXouQWRhcHRlcjEiKSkgew0KPiA+ICsgICAgICAgICAgICAgICBE QnVzTWVzc2FnZUl0ZXIgYWRkcl9pdGVyOw0KPiA+ICsgICAgICAgICAgICAgICBjaGFyICpzdHI7 DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkFkYXB0ZXIgcHJvcGVydHkg Y2hhbmdlZCBcbiIpOw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZ19kYnVzX3Byb3h5X2dldF9w cm9wZXJ0eShwcm94eSwgIkFkZHJlc3MiLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICZhZGRyX2l0ZXIpID09IFRSVUUpIHsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICphZGRyZXNzOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9nZXRfYmFzaWMoJmFkZHJfaXRlciwg JmFkZHJlc3MpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9IGdfc3RyZHVwX3By aW50ZigiWyIgQ09MT1JFRF9DSEcNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAiXSBDb250cm9sbGVyICVzICIsIGFkZHJlc3MpOw0KPiA+ICsgICAg ICAgICAgICAgICB9IGVsc2UNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBzdHIgPSBnX3N0 cmR1cCgiIik7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoc3RyY21wKG5hbWUsICJE aXNjb3ZlcmluZyIpID09IDApIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpbnQgdGVt cDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJf Z2V0X2Jhc2ljKGl0ZXIsICZ0ZW1wKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBkaXNj b3ZlcmluZyA9ICEhdGVtcDsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4gPiArICAg ICAgICAgICAgICAgcHJpbnRfaXRlcihzdHIsIG5hbWUsIGl0ZXIpOw0KPiA+ICsgICAgICAgICAg ICAgICBnX2ZyZWUoc3RyKTsNCj4gPiArICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChpbnRlcmZh Y2UsICJvcmcuYmx1ZXouR2F0dFNlcnZpY2UxIikpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxf cHJpbnRmKCJTZXJ2aWNlIHByb3BlcnR5IGNoYW5nZWQgJXNcbiIsDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19kYnVzX3Byb3h5X2dldF9wYXRo KHByb3h5KSk7DQo+ID4gKyAgICAgICB9IGVsc2UgaWYgKCFzdHJjbXAoaW50ZXJmYWNlLCAib3Jn LmJsdWV6LkdhdHRDaGFyYWN0ZXJpc3RpYzEiKSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9w cmludGYoIkNoYXJhY3RlcmlzdGljIHByb3BlcnR5IGNoYW5nZWQgJXNcbiIsDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19kYnVzX3Byb3h5X2dl dF9wYXRoKHByb3h5KSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoKGNvbm5lY3Rp b24udHlwZSA9PSBDT05OX1RZUEVfUFJPVklTSU9OKSB8fA0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbi5zZXNzaW9u X29wZW4pDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc19tZXNoX2NoYXJhY3Rl cmlzdGljKHByb3h5KTsNCj4gPiArICAgICAgIH0NCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGlj IHZvaWQgbWVzc2FnZV9oYW5kbGVyKERCdXNDb25uZWN0aW9uICpjb25uZWN0aW9uLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQnVzTWVzc2FnZSAqbWVzc2Fn ZSwgdm9pZCAqdXNlcl9kYXRhKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBybF9wcmludGYoIltTSUdO QUxdICVzLiVzXG4iLA0KPiBkYnVzX21lc3NhZ2VfZ2V0X2ludGVyZmFjZShtZXNzYWdlKSwNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGJ1c19tZXNzYWdlX2dl dF9tZW1iZXIobWVzc2FnZSkpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgc3RydWN0IGFk YXB0ZXIgKmZpbmRfY3RybF9ieV9hZGRyZXNzKEdMaXN0ICpzb3VyY2UsIGNvbnN0IGNoYXINCj4g KmFkZHJlc3MpDQo+ID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2lkIGNtZF9zaG93KGNvbnN0IGNoYXIgKmFyZykNCj4g PiArew0KPiA+ICsgICAgICAgc3RydWN0IGFkYXB0ZXIgKmFkYXB0ZXI7DQo+ID4gKyAgICAgICBH REJ1c1Byb3h5ICpwcm94eTsNCj4gPiArICAgICAgIERCdXNNZXNzYWdlSXRlciBpdGVyOw0KPiA+ ICsgICAgICAgY29uc3QgY2hhciAqYWRkcmVzczsNCj4gPiArDQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKCFhcmcgfHwgIXN0cmxlbihhcmcpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChjaGVj a19kZWZhdWx0X2N0cmwoKSA9PSBGQUxTRSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBy ZXR1cm47DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBwcm94eSA9IGRlZmF1bHRfY3RybC0+ cHJveHk7DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBhZGFwdGVy ID0gZmluZF9jdHJsX2J5X2FkZHJlc3MoY3RybF9saXN0LCBhcmcpOw0KPiA+ICsgICAgICAgICAg ICAgICBpZiAoIWFkYXB0ZXIpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmlu dGYoIkNvbnRyb2xsZXIgJXMgbm90IGF2YWlsYWJsZVxuIiwgYXJnKTsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAg ICAgICAgICAgcHJveHkgPSBhZGFwdGVyLT5wcm94eTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ ID4gKyAgICAgICBpZiAoZ19kYnVzX3Byb3h5X2dldF9wcm9wZXJ0eShwcm94eSwgIkFkZHJlc3Mi LCAmaXRlcikgPT0gRkFMU0UpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ ID4gKyAgICAgICBkYnVz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FyICpzdHI7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKHBhcnNlX2Fy Z3VtZW50X29uX29mZihhcmcsICZwb3dlcmVkKSA9PSBGQUxTRSkNCj4gPiArICAgICAgICAgICAg ICAgcmV0dXJuOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChjaGVja19kZWZhdWx0X2N0cmwoKSA9 PSBGQUxTRSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsNCj4gPiArICAgICAg IHN0ciA9IGdfc3RyZHVwX3ByaW50ZigicG93ZXIgJXMiLCBwb3dlcmVkID09IFRSVUUgPyAib24i IDogIm9mZiIpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChnX2RidXNfcHJveHlfc2V0X3Byb3Bl cnR5X2Jhc2ljKGRlZmF1bHRfY3RybC0+cHJveHksDQo+ICJQb3dlcmVkIiwNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0JPT0xFQU4sICZwb3dl cmVkLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZW5lcmlj X2NhbGxiYWNrLCBzdHIsIGdfZnJlZSkgPT0gVFJVRSkNCj4gPiArICAgICAgICAgICAgICAgcmV0 dXJuOw0KPiA+ICsNCj4gPiArICAgICAgIGdfZnJlZShzdHIpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ ICtzdGF0aWMgdm9pZCBjbWRfc2Nhbihjb25zdCBjaGFyICphcmcpDQo+ID4gK3sNCj4gPiArICAg ICAgIGRidXNfYm9vbF90IGVuYWJsZTsNCj4gPiArICAgICAgIGNvbnN0IGNoYXIgKm1ldGhvZDsN Cj4gPiArDQo+ID4gKyAgICAgICBpZiAocGFyc2VfYXJndW1lbnRfb25fb2ZmKGFyZywgJmVuYWJs ZSkgPT0gRkFMU0UpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAg ICAgICBpZiAoY2hlY2tfZGVmYXVsdF9jdHJsKCkgPT0gRkFMU0UpDQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZW5hYmxlID09IFRSVUUpIHsNCj4g PiArICAgICAgICAgICAgICAgbWV0aG9kID0gIlN0YXJ0RGlzY292ZXJ5IjsNCj4gPiArICAgICAg IH0gZWxzZSB7DQo+ID4gKyAgICAgICAgICAgICAgIG1ldGhvZCA9ICJTdG9wRGlzY292ZXJ5IjsN Cj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVzX3Byb3h5X21ldGhv ZF9jYWxsKGRlZmF1bHRfY3RybC0+cHJveHksIG1ldGhvZCwNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIE5VTEwsIHN0YXJ0X2Rpc2NvdmVyeV9yZXBseSwNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIEdVSU5UX1RPX1BPSU5URVIoZW5hYmxlKSwgTlVMTCkg PT0gRkFMU0UpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJGYWlsZWQgdG8gJXMg ZGlzY292ZXJ5XG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBlbmFibGUgPT0gVFJVRSA/ICJzdGFydCIgOiAic3RvcCIpOw0KPiA+ICsgICAgICAgICAgICAg ICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lk IGFwcGVuZF92YXJpYW50KERCdXNNZXNzYWdlSXRlciAqaXRlciwgaW50IHR5cGUsIHZvaWQgKnZh bCkNCj4gPiArew0KPiA+ICsgICAgICAgREJ1c01lc3NhZ2VJdGVyIHZhbHVlOw0KPiA+ICsgICAg ICAgY2hhciBzaWdbMl0gPSB7IHR5cGUsICdcMCcgfTsNCj4gPiArDQo+ID4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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlX3NpZywgJmFy cmF5KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZGJ1c190eXBlX2lzX2ZpeGVkKHR5cGUpID09 IFRSVUUpIHsNCj4gPiArICAgICAgICAgICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJfYXBwZW5kX2Zp eGVkX2FycmF5KCZhcnJheSwgdHlwZSwgdmFsLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbl9lbGVtZW50cyk7DQo+ID4gKyAgICAg ICB9IGVsc2UgaWYgKHR5cGUgPT0gREJVU19UWVBFX1NUUklORyB8fCB0eXBlID09DQo+IERCVVNf VFlQRV9PQkpFQ1RfUEFUSCkgew0KPiA+ICsgICAgICAgICAgICAgICBjb25zdCBjaGFyICoqKnN0 cl9hcnJheSA9IHZhbDsNCj4gPiArICAgICAgICAgICAgICAgaW50IGk7DQo+ID4gKw0KPiA+ICsg ICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbl9lbGVtZW50czsgaSsrKQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2FwcGVuZF9iYXNpYygmYXJyYXks IHR5cGUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAmKCgqc3RyX2FycmF5KVtpXSkpOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4g PiArICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX2Nsb3NlX2NvbnRhaW5lcigmdmFyaWFudCwgJmFy cmF5KTsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9jbG9zZV9jb250YWlu ZXIoaXRlciwgJnZhcmlhbnQpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBkaWN0 X2FwcGVuZF9lbnRyeShEQnVzTWVzc2FnZUl0ZXIgKmRpY3QsIGNvbnN0IGNoYXIgKmtleSwNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGludCB0eXBlLCB2b2lkICp2YWwpDQo+ID4gK3sNCj4gPiArICAgICAgIERCdXNNZXNzYWdlSXRl ciBlbnRyeTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAodHlwZSA9PSBEQlVTX1RZUEVfU1RSSU5H KSB7DQo+ID4gKyAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKnN0ciA9ICooKGNvbnN0IGNoYXIg KiopIHZhbCk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoc3RyID09IE5VTEwpDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsN Cj4gPiArICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX29wZW5fY29udGFpbmVyKGRpY3QsIERCVVNf VFlQRV9ESUNUX0VOVFJZLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgTlVMTCwgJmVudHJ5KTsNCj4gPiArDQo+ID4gKyAgICAgICBk YnVzX21lc3NhZ2VfaXRlcl9hcHBlbmRfYmFzaWMoJmVudHJ5LCBEQlVTX1RZUEVfU1RSSU5HLA0K PiAma2V5KTsNCj4gPiArDQo+ID4gKyAgICAgICBhcHBlbmRfdmFyaWFudCgmZW50cnksIHR5cGUs IHZhbCk7DQo+ID4gKw0KPiA+ICsgICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJfY2xvc2VfY29udGFp bmVyKGRpY3QsICZlbnRyeSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIGRpY3Rf YXBwZW5kX2Jhc2ljX2FycmF5KERCdXNNZXNzYWdlSXRlciAqZGljdCwgaW50DQo+IGtleV90eXBl LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB2b2lk ICprZXksIGludCB0eXBlLCB2b2lkICp2YWwsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGludCBuX2VsZW1lbnRzKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBEQnVz TWVzc2FnZUl0ZXIgZW50cnk7DQo+ID4gKw0KPiA+ICsgICAgICAgZGJ1c19tZXNzYWdlX2l0ZXJf b3Blbl9jb250YWluZXIoZGljdCwgREJVU19UWVBFX0RJQ1RfRU5UUlksDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCwgJmVudHJ5KTsNCj4g PiArDQo+ID4gKyAgICAgICBkYnVzX21lc3NhZ2VfaXRlcl9hcHBlbmRfYmFzaWMoJmVudHJ5LCBr ZXlfdHlwZSwga2V5KTsNCj4gPiArDQo+ID4gKyAgICAgICBhcHBlbmRfYXJyYXlfdmFyaWFudCgm ZW50cnksIHR5cGUsIHZhbCwgbl9lbGVtZW50cyk7DQo+ID4gKw0KPiA+ICsgICAgICAgZGJ1c19t ZXNzYWdlX2l0ZXJfY2xvc2VfY29udGFpbmVyKGRpY3QsICZlbnRyeSk7DQo+ID4gK30NCj4gPiAr DQo+ID4gK3N0YXRpYyB2b2lkIGRpY3RfYXBwZW5kX2FycmF5KERCdXNNZXNzYWdlSXRlciAqZGlj dCwgY29uc3QgY2hhciAqa2V5LCBpbnQNCj4gdHlwZSwNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICp2YWwsIGludCBuX2VsZW1lbnRzKQ0K PiA+ICt7DQo+ID4gKyAgICAgICBkaWN0X2FwcGVuZF9iYXNpY19hcnJheShkaWN0LCBEQlVTX1RZ UEVfU1RSSU5HLCAma2V5LCB0eXBlLCB2YWwsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5fZWxlbWVudHMpOw0KPiA+ ICt9DQo+ID4gKw0KPiA+ICsjZGVmaW5lICAgICAgICBESVNUQU5DRV9WQUxfSU5WQUxJRCAgICAw eDdGRkYNCj4gPiArDQo+ID4gK3N0cnVjdCBzZXRfZGlzY292ZXJ5X2ZpbHRlcl9hcmdzIHsNCj4g PiArICAgICAgIGNoYXIgKnRyYW5zcG9ydDsNCj4gPiArICAgICAgIGRidXNfdWludDE2X3QgcnNz aTsNCj4gPiArICAgICAgIGRidXNfaW50MTZfdCBwYXRobG9zczsNCj4gPiArICAgICAgIGNoYXIg Kip1dWlkczsNCj4gPiArICAgICAgIHNpemVfdCB1dWlkc19sZW47DQo+ID4gKyAgICAgICBkYnVz X2Jvb2xfdCByZXNldDsNCj4gPiArfTsNCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIHNldF9kaXNj b3ZlcnlfZmlsdGVyX3NldHVwKERCdXNNZXNzYWdlSXRlciAqaXRlciwgdm9pZA0KPiAqdXNlcl9k YXRhKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBzdHJ1Y3Qgc2V0X2Rpc2NvdmVyeV9maWx0ZXJfYXJn cyAqYXJncyA9IHVzZXJfZGF0YTsNCj4gPiArICAgICAgIERCdXNNZXNzYWdlSXRlciBkaWN0Ow0K PiA+ICsNCj4gPiArICAgICAgIGRidXNfbWVzc2FnZV9pdGVyX29wZW5fY29udGFpbmVyKGl0ZXIs IERCVVNfVFlQRV9BUlJBWSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERC VVNfRElDVF9FTlRSWV9CRUdJTl9DSEFSX0FTX1NUUklORw0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklOR19BU19TVFJJTkcNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9WQVJJQU5UX0FTX1NUUklORw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19ESUNUX0VOVFJZX0VORF9DSEFSX0FT X1NUUklORywgJmRpY3QpOw0KPiA+ICsNCj4gPiArICAgICAgIGRpY3RfYXBwZW5kX2FycmF5KCZk aWN0LCAiVVVJRHMiLCBEQlVTX1RZUEVfU1RSSU5HLCAmYXJncy0NCj4gPnV1aWRzLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJn cy0+dXVpZHNfbGVuKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoYXJncy0+cGF0aGxvc3MgIT0g RElTVEFOQ0VfVkFMX0lOVkFMSUQpDQo+ID4gKyAgICAgICAgICAgICAgIGRpY3RfYXBwZW5kX2Vu dHJ5KCZkaWN0LCAiUGF0aGxvc3MiLCBEQlVTX1RZUEVfVUlOVDE2LA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZhcmdzLT5wYXRobG9zcyk7DQo+ ID4gKw0KPiA+ICsgICAgICAgaWYgKGFyZ3MtPnJzc2kgIT0gRElTVEFOQ0VfVkFMX0lOVkFMSUQp DQo+ID4gKyAgICAgICAgICAgICAgIGRpY3RfYXBwZW5kX2VudHJ5KCZkaWN0LCAiUlNTSSIsIERC VVNfVFlQRV9JTlQxNiwgJmFyZ3MtPnJzc2kpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChhcmdz LT50cmFuc3BvcnQgIT0gTlVMTCkNCj4gPiArICAgICAgICAgICAgICAgZGljdF9hcHBlbmRfZW50 cnkoJmRpY3QsICJUcmFuc3BvcnQiLCBEQlVTX1RZUEVfU1RSSU5HLA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZhcmdzLT50cmFuc3BvcnQpOw0K PiA+ICsgICAgIC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5X2dldF9wcm9wZXJ0eShwcm94eSwgIkFkZHJlc3MiLCAmaXRlcikgPT0gRkFM U0UpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICBkYnVz X21lc3NhZ2VfaXRlcl9nZXRfYmFzaWMoJml0ZXIsICZhZGRyZXNzKTsNCj4gPiArICAgICAgIHJs X3ByaW50ZigiRGV2aWNlICVzXG4iLCBhZGRyZXNzKTsNCj4gPiArDQo+ID4gKyAgICAgICBwcmlu dF9wcm9wZXJ0eShwcm94eSwgIk5hbWUiKTsNCj4gPiArICAgICAgIHByaW50X3Byb3BlcnR5KHBy b3h5LCAiQWxpYXMiKTsNCj4gPiArICAgICAgIHByaW50X3Byb3BlcnR5KHByb3h5LCAiQ2xhc3Mi KTsNCj4gPiArICAgICAgIHByaW50X3Byb3BlcnR5KHByb3h5LCAiQXBwZWFyYW5jZSIpOw0KPiA+ ICsgICAgICAgcHJpbnRfcHJvcGVydHkocHJveHksICJJY29uIik7DQo+ID4gKyAgICAgICBwcmlu dF9wcm9wZXJ0eShwcm94eSwgIlRydXN0ZWQiKTsNCj4gPiArICAgICAgIHByaW50X3Byb3BlcnR5 KHByb3h5LCAiQmxvY2tlZCIpOw0KPiA+ICsgICAgICAgcHJpbnRfcHJvcGVydHkocHJveHksICJD b25uZWN0ZWQiKTsNCj4gPiArICAgICAgIHByaW50X3V1aWRzKHByb3h5KTsNCj4gPiArICAgICAg IHByaW50X3Byb3BlcnR5KHByb3h5LCAiTW9kYWxpYXMiKTsNCj4gPiArICAgICAgIHByaW50X3By b3BlcnR5KHByb3h5LCAiTWFudWZhY3R1cmVyRGF0YSIpOw0KPiA+ICsgICAgICAgcHJpbnRfcHJv cGVydHkocHJveHksICJTZXJ2aWNlRGF0YSIpOw0KPiA+ICsgICAgICAgcHJpbnRfcHJvcGVydHko cHJveHksICJSU1NJIik7DQo+ID4gKyAgICAgICBwcmludF9wcm9wZXJ0eShwcm94eSwgIlR4UG93 ZXIiKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgY21kX2Nvbm5lY3QoY29uc3Qg Y2hhciAqYXJnKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBpZiAoY2hlY2tfZGVmYXVsdF9jdHJsKCkg PT0gRkFMU0UpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAg ICBtZW1zZXQoJmNvbm5lY3Rpb24sIDAsIHNpemVvZihjb25uZWN0aW9uKSk7DQo+ID4gKw0KPiA+ ICsgICAgICAgaWYgKCFhcmcgfHwgIXN0cmxlbihhcmcpKSB7DQo+ID4gKyAgICAgICAgICAgICAg IGNvbm5lY3Rpb24ubmV0X2lkeCA9IE5FVF9JRFhfUFJJTUFSWTsNCj4gPiArICAgICAgIH0gZWxz ZSB7DQo+ID4gKyAgICAgICAgICAgICAgIGNoYXIgKmVuZDsNCj4gPiArICAgICAgICAgICAgICAg Y29ubmVjdGlvbi5uZXRfaWR4ID0gc3RydG9sKGFyZywgJmVuZCwgMTYpOw0KPiA+ICsgICAgICAg ICAgICAgICBpZiAoZW5kID09IGFyZykgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGNv bm5lY3Rpb24ubmV0X2lkeCA9IE5FVF9JRFhfSU5WQUxJRDsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBybF9wcmludGYoIkludmFsaWQgbmV0d29yayBpbmRleCAlc1xuIiwgYXJnKTsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICAgICAgICAgIH0N Cj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZGlzY292ZXJpbmcpDQo+ID4g KyAgICAgICAgICAgICAgIGdfZGJ1c19wcm94eV9tZXRob2RfY2FsbChkZWZhdWx0X2N0cmwtPnBy b3h5LCAiU3RvcERpc2NvdmVyeSIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgTlVMTCwgTlVMTCwgTlVMTCwgTlVMTCk7DQo+ID4gKw0KPiA+ICsg ICAgICAgc2V0X3NjYW5fZmlsdGVyX3V1aWRzKE1FU0hfUFJPWFlfU1ZDX1VVSUQpOw0KPiA+ICsg ICAgICAgZGlzY292ZXJfbWVzaCA9IHRydWU7DQo+ID4gKw0KPiA+ICsgICAgICAgY29ubmVjdGlv bi50eXBlID0gQ09OTl9UWVBFX05FVFdPUks7DQo+ID4gKw0KPiA+ICsNCj4gPiArICAgICAgIHJs X3ByaW50ZigiTG9va2luZyBmb3IgbWVzaCBuZXR3b3JrIHdpdGggbmV0IGluZGV4ICU0LjR4XG4i LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgY29ubmVjdGlvbi5uZXRfaWR4KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVz X3Byb3h5X21ldGhvZF9jYWxsKGRlZmF1bHRfY3RybC0+cHJveHksDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgIlN0YXJ0RGlzY292ZXJ5IiwgTlVMTCwgc3RhcnRfZGlzY292ZXJ5X3JlcGx5 LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR1VJTlRfVE9fUE9JTlRFUihU UlVFKSwgTlVMTCkgPT0gRkFMU0UpDQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRmFp bGVkIHRvIHN0YXJ0IG1lc2ggcHJveHkgZGlzY292ZXJ5XG4iKTsNCj4gPiArDQo+ID4gKyAgICAg ICBnX2RidXNfcHJveHlfbWV0aG9kX2NhbGwoZGVmYXVsdF9jdHJsLT5wcm94eSwgIlN0YXJ0RGlz Y292ZXJ5IiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBOVUxMLCBOVUxMLCBOVUxMLCB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HsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJJbmNvcnJl Y3QgVVVJRCBzaXplICVkXG4iLCBsZW4pOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAg ICAgIGRpc2Nvbm5lY3RfZGV2aWNlKE5VTEwsIE5VTEwpOw0KPiA+ICsNCj4gPiArICAgICAgIG1l bXNldChjb25uZWN0aW9uLmRldl91dWlkLCAwLCAxNik7DQo+ID4gKyAgICAgICBzdHIyaGV4KGFy ZywgbGVuLCBjb25uZWN0aW9uLmRldl91dWlkLCBsZW4vMik7DQo+ID4gKw0KPiA+ICsgICAgICAg bm9kZSA9IG5vZGVfZmluZF9ieV91dWlkKGNvbm5lY3Rpb24uZGV2X3V1aWQpOw0KPiA+ICsgICAg ICAgaWYgKCFub2RlKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRGV2aWNlIHdp dGggVVVJRCAlcyBub3QgZm91bmQuXG4iLCBhcmcpOw0KPiA+ICsgICAgICAgICAgICAgICBybF9w cmludGYoIlN0YWxlIHNlcnZpY2VzPyBSZW1vdmUgZGV2aWNlIGFuZCByZS1kaXNjb3ZlclxuIik7 DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4g KyAgICAgICAvKiBUT0RPOiBhZGQgY29tbWFuZCB0byByZW1vdmUgYSBub2RlIGZyb20gbWVzaCwg aS5lLiwNCj4gInVucHJvdmlzaW9uIiAqLw0KPiA+ICsgICAgICAgaWYgKG5vZGVfaXNfcHJvdmlz aW9uZWQobm9kZSkpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJBbHJlYWR5IHBy b3Zpc2lvbmVkIHdpdGggdW5pY2FzdCAlNC40eFxuIiwNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIG5vZGVfZ2V0X3ByaW1hcnkobm9kZSkpOw0KPiA+ICsgICAgICAgICAgICAg ICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgZGV2ID0gZmluZF9k ZXZpY2VfYnlfdXVpZChkZWZhdWx0X2N0cmwtPm1lc2hfZGV2aWNlcywNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbi5kZXZfdXVpZCk7DQo+ID4gKyAgICAg ICBpZiAoIWRldiB8fCAhZGV2LT5wcm94eSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmlu dGYoIkNvdWxkIG5vdCBmaW5kIGRldmljZSBwcm94eVxuIik7DQo+ID4gKyAgICAgICAgICAgICAg IG1lbXNldChjb25uZWN0aW9uLmRldl91dWlkLCAwLCAxNik7DQo+ID4gKyAgICAgICAgICAgICAg IHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBwcm94eSA9IGRldi0+ cHJveHk7DQo+ID4gKyAgICAgICBpZiAoZGlzY292ZXJpbmcpDQo+ID4gKyAgICAgICAgICAgICAg IGdfZGJ1c19wcm94eV9tZXRob2RfY2FsbChkZWZhdWx0X2N0cmwtPnByb3h5LCAiU3RvcERpc2Nv dmVyeSIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgTlVMTCwgTlVMTCwgTlVMTCwgTlVMTCk7DQo+ID4gKyAgICAgICBmb3JnZXRfbWVzaF9kZXZp Y2VzKCk7DQo+ID4gKw0KPiA+ICsgICAgICAgY29ubmVjdGlvbi50eXBlID0gQ09OTl9UWVBFX1BS T1ZJU0lPTjsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoZ19kYnVzX3Byb3h5X21ldGhvZF9jYWxs KHByb3h5LCAiQ29ubmVjdCIsIE5VTEwsDQo+IGNvbm5lY3RfcmVwbHksDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm94eSwgTlVM TCkgPT0gRkFMU0UpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJGYWlsZWQgdG8g Y29ubmVjdCAiKTsNCj4gPiArICAgICAgICAgICAgICAgcHJpbnRfZGV2aWNlKHByb3h5LCBOVUxM KTsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAgICAgfSBlbHNlIHsNCj4g PiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJUcnlpbmcgdG8gY29ubmVjdCAiKTsNCj4gPiAr ICAgICAgICAgICAgICAgcHJpbnRfZGV2aWNlKHByb3h5LCBOVUxMKTsNCj4gPiArICAgICAgIH0N Cj4gPiArDQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIGNtZF9jb25maWcoY29uc3Qg Y2hhciAqYXJnKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBybF9wcmludGYoIlN3aXRjaGluZyB0byBN ZXNoIENsaWVudCBjb25maWd1cmF0aW9uIG1lbnVcbiIpOw0KPiA+ICsNCj4gPiArICAgICAgIGlm ICghc3dpdGNoX2NtZF9tZW51KCJjb25maWd1cmUiKSkNCj4gPiArICAgICAgICAgICAgICAgcmV0 dXJuOw0KPiA+ICsNCj4gPiArICAgICAgIHNldF9tZW51X3Byb21wdCgiY29uZmlnIiwgTlVMTCk7 DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGFyZyAmJiBzdHJsZW4oYXJnKSkNCj4gPiArICAgICAg ICAgICAgICAgY29uZmlnX3NldF9ub2RlKGFyZyk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRp YyB2b2lkIGNtZF9vbm9mZl9jbGkoY29uc3QgY2hhciAqYXJnKQ0KPiA+ICt7DQo+ID4gKyAgICAg ICBybF9wcmludGYoIlN3aXRjaGluZyB0byBNZXNoIEdlbmVyaWMgT04gT0ZGIENsaWVudCBtZW51 XG4iKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoI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ICBk aXNjb25uZWN0X2RldmljZShkaXNjX3F1aXRfY2IsIE5VTEwpOw0KPiA+ICsgICAgICAgICAgICAg ICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgZ19tYWluX2xvb3Bf cXVpdChtYWluX2xvb3ApOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgY29uc3Qgc3RydWN0 IG1lbnVfZW50cnkgbWVzaGN0bF9jbWRfdGFibGVbXSA9IHsNCj4gPiArICAgICAgIHsgImxpc3Qi LCAgICAgICAgIE5VTEwsICAgICAgIGNtZF9saXN0LCAiTGlzdCBhdmFpbGFibGUgY29udHJvbGxl cnMifSwNCj4gPiArICAgICAgIHsgInNob3ciLCAgICAgICAgICJbY3RybF0iLCAgIGNtZF9zaG93 LCAiQ29udHJvbGxlciBpbmZvcm1hdGlvbiJ9LA0KPiA+ICsgICAgICAgeyAic2VsZWN0IiwgICAg ICAgIjxjdHJsPiIsICAgY21kX3NlbGVjdCwgIlNlbGVjdCBkZWZhdWx0IGNvbnRyb2xsZXIifSwN Cj4gPiArICAgICAgIHsgImluZm8iLCAgICAgICAgICJbZGV2XSIsICAgIGNtZF9pbmZvLCAiRGV2 aWNlIGluZm9ybWF0aW9uIn0sDQo+ID4gKyAgICAgICB7ICJjb25uZWN0IiwgICAgICAiW25ldF9p ZHhdIixjbWRfY29ubmVjdCwgIkNvbm5lY3QgdG8gbWVzaA0KPiBuZXR3b3JrIn0sDQo+ID4gKyAg ICAgICB7ICJkaXNjb3Zlci11bnByb3Zpc2lvbmVkIiwgIjxvbi9vZmY+IiwNCj4gY21kX3NjYW5f dW5wcm92aXNpb25lZF9kZXZpY2VzLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAiTG9vayBmb3IgZGV2aWNlcyB0byBwcm92aXNpb24iIH0sDQo+ID4gKyAgICAg ICB7ICJwcm92aXNpb24iLCAgICAiPHV1aWQ+IiwgICBjbWRfc3RhcnRfcHJvdiwgIkluaXRpYXRl IHByb3Zpc2lvbmluZyJ9LA0KPiA+ICsgICAgICAgeyAicG93ZXIiLCAgICAgICAgIjxvbi9vZmY+ IiwgY21kX3Bvd2VyLCAiU2V0IGNvbnRyb2xsZXIgcG93ZXIiIH0sDQo+ID4gKyAgICAgICB7ICJk aXNjb25uZWN0IiwgICAiW2Rldl0iLCAgICBjbWRfZGlzY29ubiwgIkRpc2Nvbm5lY3QgZGV2aWNl In0sDQo+ID4gKyAgICAgICB7ICJtZXNoLWluZm8iLCAgICBOVUxMLCAgICAgICBjbWRfcHJpbnRf bWVzaCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1lc2gg bmV0d29ya2luZm8gKHByb3Zpc2lvbmVyKSIgfSwNCj4gPiArICAgICAgIHsgImxvY2FsLWluZm8i LCAgICBOVUxMLCAgICAgIGNtZF9wcmludF9sb2NhbCwgIkxvY2FsIG1lc2ggbm9kZSBpbmZvIiB9 LA0KPiA+ICsgICAgICAgeyAiY29uZmlndXJlIiwgICAgIltkc3RdIiwgICAgY21kX2NvbmZpZywg IkNvbmZpZyBjbGllbnQgbW9kZWwgbWVudSJ9LA0KPiA+ICsgICAgICAgeyAib25vZmYiLCAgICAg ICAgIltkc3RdIiwgICAgY21kX29ub2ZmX2NsaSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAiR2VuZXJpYyBPbi9PZmYgbW9kZWwgbWVudSJ9LA0K PiA+ICsgICAgICAgeyAicXVpdCIsICAgICAgICAgTlVMTCwgICAgICAgY21kX3F1aXQsICJRdWl0 IHByb2dyYW0iIH0sDQo+ID4gKyAgICAgICB7ICJleGl0IiwgICAgICAgICBOVUxMLCAgICAgICBj bWRfcXVpdCB9LA0KPiA+ICsgICAgICAgeyAiaGVscCIgfSwNCj4gPiArICAgICAgIHsgfQ0KPiA+ ICt9Ow0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgcmxfaGFuZGxlcihjaGFyICppbnB1dCkNCj4g PiArew0KPiA+ICsgICAgICAgY2hhciAqY21kLCAqYXJnOw0KPiA+ICsNCj4gPiArICAgICAgIGlm ICghaW5wdXQpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfaW5zZXJ0X3RleHQoInF1aXQiKTsN Cj4gPiArICAgICAgICAgICAgICAgcmxfcmVkaXNwbGF5KCk7DQo+ID4gKyAgICAgICAgICAgICAg IHJsX2NybGYoKTsNCj4gPiArICAgICAgICAgICAgICAgZ19tYWluX2xvb3BfcXVpdChtYWluX2xv b3ApOw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0K PiA+ICsgICAgICAgaWYgKCFzdHJsZW4oaW5wdXQpKQ0KPiA+ICsgICAgICAgICAgICAgICBnb3Rv IGRvbmU7DQo+ID4gKyAgICAgICBlbHNlIGlmICghc3RyY21wKGlucHV0LCAicSIpIHx8ICFzdHJj bXAoaW5wdXQsICJxdWl0IikNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICB8fCAhc3RyY21wKGlucHV0LCAiZXhpdCIpKSB7DQo+ID4gKyAgICAgICAg ICAgICAgIGNtZF9xdWl0KE5VTEwpOw0KPiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGFnZW50X2lucHV0KGlucHV0KSA9 PSBUUlVFKQ0KPiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAg ICAgYWRkX2hpc3RvcnkoaW5wdXQpOw0KPiA+ICsNCj4gPiArICAgICAgIGNtZCA9IHN0cnRva19y KGlucHV0LCAiIFx0XHJcbiIsICZhcmcpOw0KPiA+ICsgICAgICAgaWYgKCFjbWQpDQo+ID4gKyAg ICAgICAgICAgICAgIGdv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IHsNCj4gPiAr ICAgICAgIGNhc2UgU0lHSU5UOg0KPiA+ICsgICAgICAgICAgICAgICBpZiAoaW5wdXQpIHsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBybF9yZXBsYWNlX2xpbmUoIiIsIDApOw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIHJsX2NybGYoKTsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICBybF9vbl9uZXdfbGluZSgpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3Jl ZGlzcGxheSgpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsgICAg ICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAvKg0KPiA+ICsgICAgICAg ICAgICAgICAgKiBJZiBpbnB1dCB3YXMgbm90IHlldCBzZXR1cCB1cCB0aGF0IG1lYW5zIHNpZ25h bCB3YXMgcmVjZWl2ZWQNCj4gPiArICAgICAgICAgICAgICAgICogd2hpbGUgZGFlbW9uIHdhcyBu b3QgeWV0IHJ1bm5pbmcuIFNpbmNlIHVzZXIgaXMgbm90IGFibGUNCj4gPiArICAgICAgICAgICAg ICAgICogdG8gdGVybWluYXRlIGNsaWVudCBieSBDVFJMLUQgb3IgdHlwaW5nIGV4aXQgdHJlYXQg dGhpcyBhcw0KPiA+ICsgICAgICAgICAgICAgICAgKiBleGl0IGFuZCBmYWxsIHRocm91Z2guDQo+ ID4gKyAgICAgICAgICAgICAgICAqLw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgLyogZmFs bCB0aHJvdWdoICovDQo+ID4gKyAgICAgICBjYXNlIFNJR1RFUk06DQo+ID4gKyAgICAgICAgICAg ICAgIGlmICghdGVybWluYXRlZCkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3Jl cGxhY2VfbGluZSgiIiwgMCk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmxfY3JsZigp Ow0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdfbWFpbl9sb29wX3F1aXQobWFpbl9sb29w KTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgdGVy bWluYXRlZCA9IHRydWU7DQo+ID4gKyAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsgICAgICAg fQ0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBUUlVFOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtz dGF0aWMgZ3VpbnQgc2V0dXBfc2lnbmFsZmQodm9pZCkNCj4gPiArew0KPiA+ICsgICAgICAgR0lP Q2hhbm5lbCAqY2hhbm5lbDsNCj4gPiArICAgICAgIGd1aW50IHNvdXJjZTsNCj4gPiArICAgICAg IHNpZ3NldF90IG1hc2s7DQo+ID4gKyAgICAgICBpbnQgZmQ7DQo+ID4gKw0KPiA+ICsgICAgICAg c2lnZW1wdHlzZXQoJm1hc2spOw0KPiA+ICsgICAgICAgc2lnYWRkc2V0KCZtYXNrLCBTSUdJTlQp Ow0KPiA+ICsgICAgICAgc2lnYWRkc2V0KCZtYXNrLCBTSUdURVJNKTsNCj4gPiArDQo+ID4gKyAg ICAgICBpZiAoc2lncHJvY21hc2soU0lHX0JMT0NLLCAmbWFzaywgTlVMTCkgPCAwKSB7DQo+ID4g KyAgICAgICAgICAgICAgIHBlcnJvcigiRmFpbGVkIHRvIHNldCBzaWduYWwgbWFzayIpOw0KPiA+ ICsgICAgICAgICAgICAgICByZXR1cm4gMDsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICBmZCA9IHNpZ25hbGZkKC0xLCAmbWFzaywgMCk7DQo+ID4gKyAgICAgICBpZiAoZmQgPCAw KSB7DQo+ID4gKyAgICAgICAgICAgICAgIHBlcnJvcigiRmFpbGVkIHRvIGNyZWF0ZSBzaWduYWwg ZGVzY3JpcHRvciIpOw0KPiA+ICsgICAgICAgICAgICAgICByZ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0KPiA+ICsgICAgICAgICAgICAgICBp ZiAoZXJyb3IgIT0gTlVMTCkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdfcHJpbnRl cnIoIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg Z19lcnJvcl9mcmVlKGVycm9yKTsNCj4gPiArICAgICAgICAgICAgICAgfSBlbHNlDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgZ19wcmludGVycigiQW4gdW5rbm93biBlcnJvciBvY2N1cnJl ZFxuIik7DQo+ID4gKyAgICAgICAgICAgICAgIGV4aXQoMSk7DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgZ19vcHRpb25fY29udGV4dF9mcmVlKGNvbnRleHQpOw0KPiA+ICsNCj4g PiArICAgICAgIGlmIChvcHRpb25fdmVyc2lvbiA9PSBUUlVFKSB7DQo+ID4gKyAgICAgICAgICAg ICAgIHJsX3ByaW50ZigiJXNcbiIsIFZFUlNJT04pOw0KPiA+ICsgICAgICAgICAgICAgICBleGl0 KDApOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmICghbWVzaF9jb25maWdf ZGlyKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiTG9jYWwgY29uZmlnIGRpcmVj dG9yeSBub3QgcHJvdmlkZWQuXG4iKTsNCj4gPiArICAgICAgICAgICAgICAgbWVzaF9jb25maWdf ZGlyID0gIiI7DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBybF9w cmludGYoIlJlYWRpbmcgcHJvdl9kYi5qc29uIGFuZCBsb2NhbF9ub2RlLmpzb24gZnJvbSAlc1xu IiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIG1lc2hfY29uZmlnX2Rpcik7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAg ICAgbGVuID0gc3RybGVuKG1lc2hfY29uZmlnX2Rpcik7DQo+ID4gKyAgICAgICBpZiAobGVuICYm IG1lc2hfY29uZmlnX2RpcltsZW4gLSAxXSAhPSAnLycpIHsNCj4gPiArICAgICAgICAgICAgICAg ZXh0cmEgPSAxOw0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIm1lc2hfY29uZmlnX2Rp clslZF0gJXNcbiIsIGxlbiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAmbWVzaF9jb25maWdfZGlyW2xlbiAtIDFdKTsNCj4gPiArICAgICAgIH0g ZWxzZSB7DQo+ID4gKyAgICAgICAgICAgICAgIGV4dHJhID0gMDsNCj4gPiArICAgICAgIH0NCj4g PiArICAgICAgIG1lc2hfbG9jYWxfY29uZmlnX2ZpbGVuYW1lID0gZ19tYWxsb2MobGVuICsNCj4g c3RybGVuKCJsb2NhbF9ub2RlLmpzb24iKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgMik7DQo+ID4g KyAgICAgICBpZiAoIW1lc2hfbG9jYWxfY29uZmlnX2ZpbGVuYW1lKQ0KPiA+ICsgICAgICAgICAg ICAgICBleGl0KDEpOw0KPiA+ICsNCj4gPiArICAgICAgIG1lc2hfcHJvdl9kYl9maWxlbmFtZSA9 IGdfbWFsbG9jKGxlbiArIHN0cmxlbigicHJvdl9kYi5qc29uIikgKw0KPiAyKTsNCj4gPiArICAg ICAgIGlmICghbWVzaF9wcm92X2RiX2ZpbGVuYW1lKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGV4 aXQoMSk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgc3ByaW50ZihtZXNoX2xv Y2FsX2NvbmZpZ19maWxlbmFtZSwgIiVzIiwgbWVzaF9jb25maWdfZGlyKTsNCj4gPiArDQo+ID4g KyAgICAgICBpZiAoZXh0cmEpDQo+ID4gKyAgICAgICAgICAgICAgIHNwcmludGYobWVzaF9sb2Nh bF9jb25maWdfZmlsZW5hbWUgKyBsZW4gLCAiJWMiLCAnLycpOw0KPiA+ICsNCj4gPiArICAgICAg IHNwcmludGYobWVzaF9sb2NhbF9jb25maWdfZmlsZW5hbWUgKyBsZW4gKyBleHRyYSwgIiVzIiwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICJsb2NhbF9ub2RlLmpzb24iKTsNCj4gPiArICAgICAgIGxlbiA9IGxlbiArIGV4dHJhICsg c3RybGVuKCJsb2NhbF9ub2RlLmpzb24iKTsNCj4gPiArICAgICAgIHNwcmludGYobWVzaF9sb2Nh bF9jb25maWdfZmlsZW5hbWUgKyBsZW4sICIlYyIsICdcMCcpOw0KPiA+ICsNCj4gPiArICAgICAg IGlmICghcHJvdl9kYl9yZWFkX2xvY2FsX25vZGUobWVzaF9sb2NhbF9jb25maWdfZmlsZW5hbWUs IHRydWUpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGdfcHJpbnRlcnIoIkZhaWxlZCB0byBwYXJz ZSBsb2NhbCBub2RlIGNvbmZpZ3VyYXRpb24gZmlsZSAlc1xuIiwNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICBtZXNoX2xvY2FsX2NvbmZpZ19maWxlbmFtZSk7DQo+ID4gKyAgICAgICAgICAg ICAgIGV4aXQoMSk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgc3ByaW50Ziht ZXNoX3Byb3ZfZGJfZmlsZW5hbWUsICIlcyIsIG1lc2hfY29uZmlnX2Rpcik7DQo+ID4gKyAgICAg ICBsZW4gPSBzdHJsZW4obWVzaF9jb25maWdfZGlyKTsNCj4gPiArICAgICAgIGlmIChleHRyYSkN Cj4gPiArICAgICAgICAgICAgICAgc3ByaW50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pbnQgICAgICAgICAgIG1zZ190 bzsNCj4gPiArICAgICAgIHVpbnQzMl90ICAgICAgICBpdl9pbmRleDsNCj4gPiArICAgICAgIHVp bnQzMl90ICAgICAgICBzZXFBdXRoOw0KPiA+ICsgICAgICAgdWludDMyX3QgICAgICAgIGFjazsN Cj4gPiArICAgICAgIHVpbnQzMl90ICAgICAgICBkc3Q7DQo+ID4gKyAgICAgICB1aW50MTZfdCAg ICAgICAgc3JjOw0KPiA+ICsgICAgICAgdWludDE2X3QgICAgICAgIG5ldF9pZHg7DQo+ID4gKyAg ICAgICB1aW50MTZfdCAgICAgICAgbGVuOw0KPiA+ICsgICAgICAgdWludDhfdCAgICAgICAgIGFr Zl9haWQ7DQo+ID4gKyAgICAgICB1aW50OF90ICAgICAgICAgdHRsOw0KPiA+ICsgICAgICAgdWlu dDhfdCAgICAgICAgIHNlZ047DQo+ID4gKyAgICAgICB1aW50OF90ICAgICAgICAgYWN0aXZpdHlf Y250Ow0KPiA+ICsgICAgICAgYm9vbCAgICAgICAgICAgIGN0bDsNCj4gPiArICAgICAgIGJvb2wg ICAgICAgICAgICBzZWdtZW50ZWQ7DQo+ID4gKyAgICAgICBib29sICAgICAgICAgICAgc3ptaWM7 DQo+ID4gKyAgICAgICBib29sICAgICAgICAgICAgcHJveHk7DQo+ID4gKyAgICAgICB1aW50OF90 ICAgICAgICAgZGF0YVsyMF07IC8qIE9wZW4gZW5kZWQsIG1pbiAyMCAqLw0KPiA+ICt9Ow0KPiA+ ICsNCj4gPiArc3RydWN0IG1lc2hfZGVzdGluYXRpb24gew0KPiA+ICsgICAgICAgdWludDE2X3Qg ICAgICAgIGNudDsNCj4gPiArICAgICAgIHVpbnQxNl90ICAgICAgICBkc3Q7DQo+ID4gK307DQo+ ID4gKw0KPiA+ICsvKiBOZXR3b3JrIFBhY2tldCBMYXllciBiYXNlZCBPZmZzZXRzICovDQo+ID4g KyNkZWZpbmUgQUtGX0JJVCAgICAgICAgICAgICAgICAgICAgICAgIDB4NDANCj4gPiArDQo+ID4g KyNkZWZpbmUgUEtUX0lWSShwKSAgICAgICAgICAgICAhISgocClbMF0gJiAweDgwKQ0KPiA+ICsj ZGVmaW5lIFNFVF9QS1RfSVZJKHAsdikgICAgICAgZG8geyhwKVswXSAmPSAweDdmOyBcDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwKVswXSB8PSAoKHYpID8g MHg4MCA6IDApO30gd2hpbGUoMCkNCj4gPiArI2RlZmluZSBQS1RfTklEKHApICAgICAgICAgICAg ICgocClbMF0gJiAweDdmKQ0KPiA+ICsjZGVmaW5lIFNFVF9QS1RfTklEKHAsdikgICAgICAgZG8g eyhwKVswXSAmPSAweDgwOyAocClbMF0gfD0gKHYpO30gd2hpbGUoMCkNCj4gPiArI2RlZmluZSBQ S1RfQ1RMKHApICAgICAgICAgICAgICghISgocClbMV0gJiAweDgwKSkNCj4gPiArI2RlZmluZSBT RVRfUEtUX0NUTChwLHYpICAgICAgIGRvIHsocClbMV0gJj0gMHg3ZjsgXA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocClbMV0gfD0gKCh2KSA/IDB4ODAgOiAw KTt9IHdoaWxlKDApDQo+ID4gKyNkZWZpbmUgUEtUX1RUTChwKSAgICAgICAgICAgICAoKHApWzFd ICYgMHg3ZikNCj4gPiArI2RlZmluZSBTRVRfUEtUX1RUTChwLHYpICAgICAgIGRvIHsocClbMV0g Jj0gMHg4MDsgKHApWzFdIHw9ICh2KTt9IHdoaWxlKDApDQo+ID4gKyNkZWZpbmUgUEtUX1NFUShw KSAgICAgICAgICAgICAoZ2V0X2JlMzIoKHApICsgMSkgJiAweGZmZmZmZikNCj4gPiArI2RlZmlu ZSBTRVRfUEtUX1NFUShwLHYpICAgICAgIHB1dF9iZTMyKCgocClbMV0gPDwgMjQpICsgKCh2KSAm IDB4ZmZmZmZmKSwgXA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwKSArIDEpDQo+ID4gKyNkZWZpbmUg UEtUX1NSQyhwKSAgICAgICAgICAgICBnZXRfYmUxNigocCkgKyA1KQ0KPiA+ICsjZGVmaW5lIFNF VF9QS1RfU1JDKHAsdikgICAgICAgcHV0X2JlMTYodiwgKHApICsgNSkNCj4gPiArI2RlZmluZSBQ S1RfRFNUKHApICAgICAgICAgICAgIGdldF9iZTE2KChwKSArIDcpDQo+ID4gKyNkZWZpbmUgU0VU X1BLVF9EU1QocCx2KSAgICAgICBwdXRfYmUxNih2LCAocCkgKyA3KQ0KPiA+ICsjZGVmaW5lIFBL VF9UUkFOUyhwKSAgICAgICAgICAgKChwKSArIDkpDQo+ID4gKyNkZWZpbmUgUEtUX1RSQU5TX0xF TihsKSAgICAgICAoKGwpIC0gOSkNCj4gPiArDQo+ID4gKyNkZWZpbmUgUEtUX1NFR01FTlRFRChw KSAgICAgICAoISEoKHApWzldICYgMHg4MCkpDQo+ID4gKyNkZWZpbmUgU0VUX1BLVF9TRUdNRU5U RUQocCx2KSBkbyB7KHApWzldICY9IDB4N2Y7IFwNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKHApWzldIHw9ICgodikgPyAweDgwIDogMCk7fSB3aGlsZSgwKQ0K PiA+ICsjZGVmaW5lIFBLVF9BS0ZfQUlEKHApICAgICAgICAgKChwKVs5XSAmIDB4N2YpDQo+ID4g KyNkZWZpbmUgU0VUX1BLVF9BS0ZfQUlEKHAsdikgICBkbyB7KHApWzldICY9IDB4ODA7IChwKVs5 XSB8PSAodik7fQ0KPiB3aGlsZSgwKQ0KPiA+ICsjZGVmaW5lIFBLVF9PUENPREUocCkgICAgICAg ICAgKChwKVs5XSAmIDB4N2YpDQo+ID4gKyNkZWZpbmUgU0VUX1BLVF9PUENPREUocCx2KSAgICBk byB7KHApWzldICY9IDB4ODA7IChwKVs5XSB8PSAodik7fQ0KPiB3aGlsZSgwKQ0KPiA+ICsjZGVm aW5lIFBLVF9PQk8ocCkgICAgICAgICAgICAgKCEhKChwKVsxMF0gJiAweDgwKSkNCj4gPiArI2Rl ZmluZSBQS1RfU1pNSUMocCkgICAgICAgICAgICghIShQS1RfU0VHTUVOVEVEKHApID8gKChwKVsx MF0gJiAweDQwKSA6DQo+IDApKQ0KPiA+ICsjZGVmaW5lIFNFVF9QS1RfU1pNSUMocCx2KSAgICAg ZG8geyhwKVsxMF0gJj0gMHg3ZjsgXA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAocClbMTBdIHw9ICgodikgPyAweDgwIDogMCk7fSB3aGlsZSgwKQ0KPiA+ICsj ZGVmaW5lIFBLVF9TRVEwKHApICAgICAgICAgICAgKChnZXRfYmUxNigocCkgKyAxMCkgPj4gMikg JiAweDFmZmYpDQo+ID4gKyNkZWZpbmUgU0VUX1BLVF9TRVEwKHAsdikgICAgICBkbyB7cHV0X2Jl MTYoKGdldF9iZTE2KChwKSArIDEwKSAmDQo+IDB4ODAwMykgXA0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICB8ICgoKHYpICYgMHgxZmZmKSA8PCAyKSwgXA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocCkgKyAxMCk7fSB3aGls ZSgwKQ0KPiA+ICsjZGVmaW5lIFNFVF9QS1RfU0VHTyhwLHYpICAgICAgZG8ge3B1dF9iZTE2KChn ZXRfYmUxNiggXA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo cCkgKyAxMSkgJiAweGZjMWYpIHwgKCh2KSA8PCA1KSwgXA0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAocCkgKyAxMSk7fSB3aGlsZSgwKQ0KPiA+ICsjZGVmaW5l IFNFVF9QS1RfU0VHTihwLHYpICAgICAgZG8geyhwKVsxMl0gPSAoKHApWzEyXSAmIDB4ZTApIHwg KHYpO30NCj4gd2hpbGUoMCkNCj4gPiArI2RlZmluZSBQS1RfQUNLKHApICAgICAgICAgICAgIChn ZXRfYmUzMigocCkgKyAxMikpDQo+ID4gKyNkZWZpbmUgU0VUX1BLVF9BQ0socCx2KSAgICAgICAo cHV0X2JlMzIoKHYpKHApICsgMTIpKQ0KPiA+ICsNCj4gPiArLyogVHJhbnNwb3J0IExheWVyIGJh c2VkIG9mZnNldHMgKi8NCj4gPiArI2RlZmluZSBUUkFOU19TRUdNRU5URUQodCkgICAgICghISgo dClbMF0gJiAweDgwKSkNCj4gPiArI2RlZmluZSBTRVRfVFJBTlNfU0VHTUVOVEQodCx2KSAgICAg ICAgZG8geyh0KVswXSAmPSAweDdmOyBcDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICh0KVswXSB8PSAoKHYpID8gMHg4MCA6IDApO30gd2hpbGUoMCkNCj4gPiAr I2RlZmluZSBUUkFOU19PUENPREUodCkgICAgICAgICAgICAgICAgKCh0KVswXSAmIDB4N2YpDQo+ ID4gKyNkZWZpbmUgU0VUX1RSQU5TX09QQ09ERSh0LHYpICBkbyB7KHQpWzBdICY9IDB4ODA7ICh0 KVswXSB8PSAodik7fQ0KPiB3aGlsZSgwKQ0KPiA+ICsjZGVmaW5lIFRSQU5TX0FLRl9BSUQodCkg ICAgICAgICAgICAgICAoKHQpWzBdICYgMHg3ZikNCj4gPiArI2RlZmluZSBTRVRfVFJBTlNfQUtG X0FJRCh0LHYpIGRvIHsodClbMF0gJj0gMHhjMDsgKHQpWzBdIHw9ICh2KTt9DQo+IHdoaWxlKDAp DQo+ID4gKyNkZWZpbmUgVFJBTlNfQUtGKHQpICAgICAgICAgICAoISEoKHQpWzBdICYgQUtGX0JJ VCkpDQo+ID4gKyNkZWZpbmUgVFJBTlNfU1pNSUModCkgICAgICAgICAoISEoVFJBTlNfU0VHTUVO VEVEKHQpID8gKCh0KVsxXSAmIDB4ODApIDoNCj4gMCkpDQo+ID4gKyNkZWZpbmUgVFJBTlNfU0VR MCh0KSAgICAgICAgICAoKGdldF9iZTE2KCh0KSArIDEpID4+IDIpICYgMHgxZmZmKQ0KPiA+ICsj ZGVmaW5lIFNFVF9UUkFOU19TRVEwKHQsdikgICAgZG8ge3B1dF9iZTE2KChnZXRfYmUxNigodCkg KyAxKSAmDQo+IDB4ODAwMykgXA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICB8ICgoKHYpICYgMHgxZmZmKSA8PCAyKSwgXA0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAodCkgKyAxKTt9IHdoaWxlKDApDQo+ID4gKyNkZWZpbmUg U0VUX1RSQU5TX0FDSyh0LHYpICAgICBwdXRfYmUzMigodiksICh0KSArIDMpDQo+ID4gKyNkZWZp bmUgVFJBTlNfU0VHTyh0KSAgICAgICAgICAoKGdldF9iZTE2KCh0KSArIDIpID4+IDUpICYgMHgx ZikNCj4gPiArI2RlZmluZSBUUkFOU19TRUdOKHQpICAgICAgICAgICgodClbM10gJiAweDFmKQ0K PiA+ICsNCj4gPiArI2RlZmluZSBUUkFOU19QQVlMT0FEKHQpICAgICAgICgodCkgKyAoVFJBTlNf U0VHTUVOVEVEKHQpID8gNCA6IDEpKQ0KPiA+ICsjZGVmaW5lIFRSQU5TX0xFTih0LGwpICAgICAg ICAgKChsKSAtKFRSQU5TX1NFR01FTlRFRCh0KSA/IDQgOiAxKSkNCj4gPiArDQo+ID4gKy8qIFBy b3h5IENvbmZpZyBPcGNvZGVzICovDQo+ID4gKyNkZWZpbmUgRklMVEVSX1NFVFVQICAgICAgICAg ICAweDAwDQo+ID4gKyNkZWZpbmUgRklMVEVSX0FERCAgICAgICAgICAgICAweDAxDQo+ID4gKyNk ZWZpbmUgRklMVEVSX0RFTCAgICAgICAgICAgICAweDAyDQo+ID4gKyNkZWZpbmUgRkl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ZpbmRf Y3VzdG9tKG5ldF9rZXlzLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR1VJ TlRfVE9fUE9JTlRFUihhcHBfa2V5LT5uZXRfaWR4KSwNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIG1hdGNoX2tleV9pbmRleCk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAg ICBpZiAoIWwpIHJldHVybiBOVUxMOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgbmV0X2tl eSA9IGwtPmRhdGE7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAobmV0X2tleS0+cGhh c2UgPT0gMiAmJiBhcHBfa2V5LT5uZXcuYWtmX2FpZCAhPSAweGZmKQ0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIHJldHVybiBhcHBfa2V5LT5uZXcua2V5Ow0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgaWYgKGFwcF9rZXktPmN1cnJlbnQuYWtmX2FpZCAhPSAweGZmKQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIHJldHVybiBhcHBfa2V5LT5jdXJyZW50LmtleTsNCj4gPiArDQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4g PiArICAgICAgIG5ldF9rZXkgPSBsLT5kYXRhOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChuZXRf a2V5LT5waGFzZSA9PSAyICYmIG5ldF9rZXktPm5ldy5uaWQgIT0gMHhmZikNCj4gPiArICAgICAg ICAgICAgICAgcmV0dXJuIG5ldF9rZXktPm5ldy5uZXRfa2V5Ow0KPiA+ICsNCj4gPiArICAgICAg IGlmIChuZXRfa2V5LT5jdXJyZW50Lm5pZCAhPSAweGZmKQ0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm4gbmV0X2tleS0+Y3VycmVudC5uZXRfa2V5Ow0KPiA+ICsNCj4gPiArICAgICAgIHJldHVy biBOVUxMOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29sIGtleXNfYXBwX2tleV9hZGQodWludDE2 X3QgbmV0X2lkeCwgdWludDE2X3QgYXBwX2lkeCwgdWludDhfdA0KPiAqa2V5LA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIGJvb2wgdXBkYXRlKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBzdHJ1 Y3QgbWVzaF9hcHBfa2V5ICphcHBfa2V5ID0gTlVMTDsNCj4gPiArICAgICAgIHVpbnQ4X3QgYWtm X2FpZDsNCj4gPiArICAgICAgIEdMaXN0ICpsID0gZ19saXN0X2ZpbmRfY3VzdG9tKGFwcF9rZXlz LA0KPiBHVUlOVF9UT19QT0lOVEVSKGFwcF9pZHgpLA0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgbWF0Y2hfa2V5X2luZGV4KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIW1l c2hfY3J5cHRvX2s0KGtleSwgJmFrZl9haWQpKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4g ZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgYWtmX2FpZCB8PSBBS0ZfQklUOw0KPiA+ICsNCj4g PiArICAgICAgIGlmIChsICYmIHVwZGF0ZSkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAg YXBwX2tleSA9IGwtPmRhdGE7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoYXBwX2tl eS0+bmV0X2lkeCAhPSBuZXRfaWR4KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVy biBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIG1lbWNweShhcHBfa2V5LT5uZXcu a2V5LCBrZXksIDE2KTsNCj4gPiArICAgICAgICAgICAgICAgYXBwX2tleS0+bmV3LmFrZl9haWQg PSBha2ZfYWlkOw0KPiA+ICsNCj4gPiArICAgICAgIH0gZWxzZSBpZiAobCkgew0KPiA+ICsNCj4g PiArICAgICAgICAgICAgICAgYXBwX2tleSA9IGwtPmRhdGE7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBpZiAobWVtY21wKGFwcF9rZXktPmN1cnJlbnQua2V5LCBrZXksIDE2KSB8fA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwX2tleS0+bmV0X2lkeCAhPSBuZXRf aWR4KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgYXBwX2tleSA9 IGdfbmV3KHN0cnVjdCBtZXNoX2FwcF9rZXksIDEpOw0KPiA+ICsgICAgICAgICAgICAgICBtZW1j cHkoYXBwX2tleS0+Y3VycmVudC5rZXksIGtleSwgMTYpOw0KPiA+ICsgICAgICAgICAgICAgICBh cHBfa2V5LT5uZXRfaWR4ID0gbmV0X2lkeDsNCj4gPiArICAgICAgICAgICAgICAgYXBwX2tleS0+ Z2VuZXJpYy5pZHggPSBhcHBfaWR4Ow0KPiA+ICsgICAgICAgICAgICAgICBhcHBfa2V5LT5jdXJy ZW50LmFrZl9haWQgPSBha2ZfYWlkOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgLyogSW52 YWxpZGF0ZSAiTmV3IiB2ZXJzaW9uICovDQo+ID4gKyAgICAgICAgICAgICAgIGFwcF9rZXktPm5l dy5ha2ZfYWlkID0gMHhmZjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGFwcF9rZXlzID0g Z19saXN0X2FwcGVuZChhcHBfa2V5cywgYXBwX2tleSk7DQo+ID4gKw0KPiA+ICsgICAgICAgfQ0K PiA+ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29s IGtleXNfbmV0X2tleV9hZGQodWludDE2X3QgbmV0X2lkeCwgdWludDhfdCAqa2V5LCBib29sIHVw ZGF0ZSkNCj4gPiArew0KPiA+ICsgICAgICAgc3RydWN0IG1lc2hfbmV0X2tleSAqbmV0X2tleSA9 IE5VTEw7DQo+ID4gKyAgICAgICB1aW50OF90IHAgPSAwOw0KPiA+ICsgICAgICAgR0xpc3QgKmwg PSBnX2xpc3RfZmluZF9jdXN0b20obmV0X2tleXMsDQo+IEdVSU5UX1RPX1BPSU5URVIobmV0X2lk eCksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaF9rZXlfaW5kZXgp Ow0KPiA+ICsNCj4gPiArICAgICAgIGlmIChsICYmIHVwZGF0ZSkgew0KPiA+ICsgICAgICAgICAg ICAgICBib29sIHJlc3VsdDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIG5ldF9rZXkgPSBs LT5kYXRhOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgbWVtY3B5KG5ldF9rZXktPm5ldy5u ZXRfa2V5LCBrZXksIDE2KTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIENhbGN1bGF0 ZSB0aGUgbWFueSBjb21wb25lbnQgcGFydHMgKi8NCj4gPiArICAgICAgICAgICAgICAgcmVzdWx0 ID0gbWVzaF9jcnlwdG9fbmtiayhrZXksIG5ldF9rZXktPm5ldy5iZWFjb25fa2V5KTsNCj4gPiAr ICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg cmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmVzdWx0ID0gbWVzaF9j cnlwdG9fazMoa2V5LCBuZXRfa2V5LT5uZXcubmV0X2lkKTsNCj4gPiArICAgICAgICAgICAgICAg aWYgKCFyZXN1bHQpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmVzdWx0ID0gbWVzaF9jcnlwdG9fazIoa2V5LCAm cCwgMSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZuZXRfa2V5LT5uZXcu bmlkLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0X2tleS0+bmV3LmVu Y19rZXksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRfa2V5LT5uZXcu cHJpdmFjeV9rZXkpOw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICBuZXRfa2V5LT5uZXcubmlkID0gMHhmZjsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7DQo+ID4gKw0KPiA+ICsgICAgICAgfSBlbHNl IGlmIChsKSB7DQo+ID4gKyAgICAgICAgICAgICAgIG5ldF9rZXkgPSBsLT5kYXRhOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgaWYgKG1lbWNtcChuZXRfa2V5LT5jdXJyZW50Lm5ldF9rZXks IGtleSwgMTYpKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4g PiArICAgICAgIH0gZWxzZSB7DQo+ID4gKyAgICAgICAgICAgICAgIGJvb2wgcmVzdWx0Ow0KPiA+ ICsNCj4gPiArICAgICAgICAgICAgICAgbmV0X2tleSA9IGdfbmV3KHN0cnVjdCBtZXNoX25ldF9r ZXksIDEpOw0KPiA+ICsgICAgICAgICAgICAgICBtZW1jcHkobmV0X2tleS0+Y3VycmVudC5uZXRf a2V5LCBrZXksIDE2KTsNCj4gPiArICAgICAgICAgICAgICAgbmV0X2tleS0+Z2VuZXJpYy5pZHgg PSBuZXRfaWR4Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgLyogSW52YWxpZGF0ZSAiTmV3 IiB2ZXJzaW9uICovDQo+ID4gKyAgICAgICAgICAgICAgIG5ldF9rZXktPm5ldy5uaWQgPSAweGZm Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgLyogQ2FsY3VsYXRlIHRoZSBtYW55IGNvbXBv bmVudCBwYXJ0cyAqLw0KPiA+ICsgICAgICAgICAgICAgICByZXN1bHQgPSBtZXNoX2NyeXB0b19u a2JrKGtleSwgbmV0X2tleS0+Y3VycmVudC5iZWFjb25fa2V5KTsNCj4gPiArICAgICAgICAgICAg ICAgaWYgKCFyZXN1bHQpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUobmV0 X2tleSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsg ICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICByZXN1bHQgPSBtZXNo X2NyeXB0b19rMyhrZXksIG5ldF9rZXktPmN1cnJlbnQubmV0X2lkKTsNCj4gPiArICAgICAgICAg ICAgICAgaWYgKCFyZXN1bHQpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUo bmV0X2tleSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ ICsgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICByZXN1bHQgPSBt ZXNoX2NyeXB0b19rMihrZXksICZwLCAxLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgJm5ldF9rZXktPmN1cnJlbnQubmlkLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgbmV0X2tleS0+Y3VycmVudC5lbmNfa2V5LA0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgbmV0X2tleS0+Y3VycmVudC5wcml2YWN5X2tleSk7DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgIC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5c19uZXRfa2V5X2dldCh1aW50MTZfdCBuZXRfaWR4LCBib29sIGN1cnJlbnQpDQo+ ID4gK3sNCj4gPiArICAgICAgIEdMaXN0ICpsOw0KPiA+ICsNCj4gPiArDQo+ID4gKyAgICAgICBs ID0gZ19saXN0X2ZpbmRfY3VzdG9tKG5ldF9rZXlzLCBHVUlOVF9UT19QT0lOVEVSKG5ldF9pZHgp LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF0Y2hfa2V5X2luZGV4KTsN Cj4gPiArICAgICAgIGlmICghbCkgew0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gTlVMTDsN Cj4gPiArICAgICAgIH0gZWxzZSB7DQo+ID4gKyAgICAgICAgICAgICAgIHN0cnVjdCBtZXNoX25l dF9rZXkgKmtleSA9IGwtPmRhdGE7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChjdXJyZW50KQ0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrZXktPmN1cnJlbnQubmV0X2tleTsN Cj4gPiArICAgICAgICAgICAgICAgZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJl dHVybiBrZXktPm5ldy5uZXRfa2V5Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICt9DQo+ID4gKw0KPiA+ ICtib29sIGtleXNfYXBwX2tleV9kZWxldGUodWludDE2X3QgYXBwX2lkeCkNCj4gPiArew0KPiA+ ICsgICAgICAgLyogVE9ETzogcmVtb3ZlIGFsbCBhc3NvY2lhdGVkIGJpbmRpbmdzICovDQo+ID4g KyAgICAgICByZXR1cm4gZGVsZXRlX2tleSgmYXBwX2tleXMsIGFwcF9pZHgpOw0KPiA+ICt9DQo+ ID4gKw0KPiA+ICtib29sIGtleXNfbmV0X2tleV9kZWxldGUodWludDE2X3QgbmV0X2lkeCkNCj4g PiArew0KPiA+ICsgICAgICAgLyogVE9ETzogcmVtb3ZlIGFsbCBhc3NvY2lhdGVkIGFwcCB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B1cGRhdGU7DQo+ID4g K30NCj4gPiArDQo+ID4gK3ZvaWQgc2V0X3NlcXVlbmNlX251bWJlcih1aW50MzJfdCBzZXFfbnVt KQ0KPiA+ICt7DQo+ID4gKyAgICAgICBuZXQuc2VxX251bSA9IHNlcV9udW07DQo+ID4gK30NCj4g PiArDQo+ID4gK3VpbnQzMl90IGdldF9zZXF1ZW5jZV9udW1iZXIodm9pZCkNCj4gPiArew0KPiA+ ICsgICAgICAgcmV0dXJuIG5ldC5zZXFfbnVtOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29sIG5l dF9hZGRfYWRkcmVzc19wb29sKHVpbnQxNl90IG1pbiwgdWludDE2X3QgbWF4KQ0KPiA+ICt7DQo+ ID4gKyAgICAgICB1aW50MzJfdCByYW5nZTsNCj4gPiArICAgICAgIGlmIChtYXggPCBtaW4pDQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAgIHJhbmdlID0gbWlu ICsgKG1heCA8PCAxNik7DQo+ID4gKyAgICAgICBuZXQuYWRkcmVzc19wb29sID0gZ19saXN0X2Fw cGVuZChuZXQuYWRkcmVzc19wb29sLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIEdVSU5UX1RPX1BPSU5URVIocmFuZ2UpKTsNCj4gPiArICAgICAg IHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgaW50IG1hdGNoX2FkZHJl c3NfcmFuZ2UoY29uc3Qgdm9pZCAqYSwgY29uc3Qgdm9pZCAqYikNCj4gPiArew0KPiA+ICsgICAg ICAgdWludDMyX3QgcmFuZ2UgPSBHUE9JTlRFUl9UT19VSU5UKGEpOw0KPiA+ICsgICAgICAgdWlu dDhfdCBudW1fZWxlbWVudHMgPSAodWludDhfdCkgKEdQT0lOVEVSX1RPX1VJTlQoYikpOw0KPiA+ ICsgICAgICAgdWludDE2X3QgbWF4ID0gcmFuZ2UgPj4gMTY7DQo+ID4gKyAgICAgICB1aW50MTZf dCBtaW4gPSByYW5nZSAmIDB4ZmZmZjsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gKChtYXgg LSBtaW4pID49IChudW1fZWxlbWVudHMgLSAxKSkgPyAwIDogLTE7DQo+ID4gKw0KPiA+ICt9DQo+ ID4gKw0KPiA+ICt1aW50MTZfdCBuZXRfb2J0YWluX2FkZHJlc3ModWludDhfdCBudW1fZWxlcykN Cj4gPiArew0KPiA+ICsgICAgICAgdWludDE2X3QgYWRkcjsNCj4gPiArICAgICAgIEdMaXN0ICps Ow0KPiA+ICsNCj4gPiArICAgICAgIGwgPSBnX2xpc3RfZmluZF9jdXN0b20obmV0LmFkZHJlc3Nf cG9vbCwNCj4gR1VJTlRfVE9fUE9JTlRFUihudW1fZWxlcyksDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBtYXRjaF9hZGRyZXNzX3JhbmdlKTsNCj4gPiArICAgICAgIGlmIChs KSB7DQo+ID4gKyAgICAgICAgICAgICAgIHVpbnQzMl90IHJhbmdlID0gR1BPSU5URVJfVE9fVUlO VChsLT5kYXRhKTsNCj4gPiArICAgICAgICAgICAgICAgdWludDE2X3QgbWF4ID0gcmFuZ2UgPj4g MTY7DQo+ID4gKyAgICAgICAgICAgICAgIHVpbnQxNl90IG1pbiA9IHJhbmdlICYgMHhmZmZmOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgYWRkciA9IG1pbjsNCj4gPiArICAgICAgICAgICAg ICAgbWluICs9IG51bV9lbGVzOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKG1pbiA+ IG1heCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBuZXQuYWRkcmVzc19wb29sID0gZ19s aXN0X2RlbGV0ZV9saW5rKG5ldC5hZGRyZXNzX3Bvb2wsDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwpOw0KPiA+ICsg ICAgICAgICAgICAgICBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByYW5nZSA9 IG1pbiArIChtYXggPDwgMTYpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGwtPmRhdGEg PSBHVUlOVF9UT19QT0lOVEVSKHJhbmdlKTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsg ICAgICAgICAgICAgICByZXR1cm4gYWRkcjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICByZXR1cm4gVU5BU1NJR05FRF9BRERSRVNTOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0 aWMgaW50IHJhbmdlX2NtcChjb25zdCB2b2lkICphLCBjb25zdCB2b2lkICpiKQ0KPiA+ICt7DQo+ ID4gKyAgICAgICB1aW50MzJfdCByYW5nZTEgPSBHUE9JTlRFUl9UT19VSU5UKGEpOw0KPiA+ICsg ICAgICAgdWludDMyX3QgcmFuZ2UyID0gR1BPSU5URVJfVE9fVUlOVChiKTsNCj4gPiArDQo+ID4g KyAgICAgICByZXR1cm4gcmFuZ2UyIC0gcmFuZ2UxOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICt2b2lk IG5ldF9yZWxlYXNlX2FkZHJlc3ModWludDE2X3QgYWRkciwgdWludDhfdCBudW1fZWxlbWVudHMp DQo+ID4gK3sNCj4gPiArICAgICAgIEdMaXN0ICpsOw0KPiA+ICsgICAgICAgdWludDMyX3QgcmFu Z2U7DQo+ID4gKw0KPiA+ICsgICAgICAgZm9yIChsID0gbmV0LmFkZHJlc3NfcG9vbDsgbCAhPSBO VUxMOyBsID0gbC0+bmV4dCkNCj4gPiArICAgICAgIHsNCj4gPiArICAgICAgICAgICAgICAgdWlu dDE2X3QgbWF4Ow0KPiA+ICsgICAgICAgICAgICAgICB1aW50MTZfdCBtaW47DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgICAgICByYW5nZSA9IEdQT0lOVEVSX1RPX1VJTlQobC0+ZGF0YSk7DQo+ID4g Kw0KPiA+ICsgICAgICAgICAgICAgICBtYXggPSByYW5nZSA+PiAxNjsNCj4gPiArICAgICAgICAg ICAgICAgbWluID0gcmFuZ2UgJiAweGZmZmY7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBp ZiAobWluID09IChhZGRyICsgbnVtX2VsZW1lbnRzICsgMSkpDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgbWluICA9IGFkZHI7DQo+ID4gKyAgICAgICAgICAgICAgIGVsc2UgaWYgKGFkZHIg JiYgbWF4ID09IChhZGRyIC0gMSkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbWF4ID0g YWRkciArIG51bV9lbGVtZW50cyArIDE7DQo+ID4gKyAgICAgICAgICAgICAgIGVsc2UNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgIHJhbmdlID0gbWluICsgKG1heCA8PCAxNik7DQo+ID4gKyAgICAgICAgICAgICAgIGwtPmRh dGEgPSBHVUlOVF9UT19QT0lOVEVSKHJhbmdlKTsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJu Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHJhbmdlID0gYWRkciArICgoYWRk ciArIG51bV9lbGVtZW50cyAtIDEpIDw8IDE2KTsNCj4gPiArICAgICAgIG5ldC5hZGRyZXNzX3Bv b2wgPSBnX2xpc3RfaW5zZXJ0X3NvcnRlZChuZXQuYWRkcmVzc19wb29sLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdVSU5UX1RPX1BPSU5URVIo cmFuZ2UpLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHJhbmdlX2NtcCk7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wgbmV0X3Jlc2VydmVfYWRk cmVzc19yYW5nZSh1aW50MTZfdCBiYXNlLCB1aW50OF90IG51bV9lbGVtZW50cykNCj4gPiArew0K PiA+ICsgICAgICAgR0xpc3QgKmw7DQo+ID4gKyAgICAgICB1aW50MzJfdCByYW5nZTsNCj4gPiAr ICAgICAgIHVpbnQxNl90IG1heDsNCj4gPiArICAgICAgIHVpbnQxNl90IG1pbjsNCj4gPiArICAg ICAgIGJvb2wgc2hyaW5rOw0KPiA+ICsNCj4gPiArICAgICAgIGZvciAobCA9IG5ldC5hZGRyZXNz X3Bvb2w7IGwgIT0gTlVMTDsgbCA9IGwtPm5leHQpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgIHJhbmdlID0gR1BPSU5URVJfVE9fVUlOVChsLT5kYXRhKTsNCj4gPiArDQo+ID4gKyAgICAg ICAgICAgICAgIG1heCA9IHJhbmdlID4+IDE2Ow0KPiA+ICsgICAgICAgICAgICAgICBtaW4gPSBy YW5nZSAmIDB4ZmZmZjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChiYXNlID49IG1p biAmJiAoYmFzZSArIG51bV9lbGVtZW50cyAtIDEpIDw9IG1heCkNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAo IWwpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAg ICBuZXQuYWRkcmVzc19wb29sID0gZ19saXN0X2RlbGV0ZV9saW5rKG5ldC5hZGRyZXNzX3Bvb2ws IGwpOw0KPiA+ICsNCj4gPiArICAgICAgIHNocmluayA9IGZhbHNlOw0KPiA+ICsNCj4gPiArICAg ICAgIGlmIChiYXNlID09IG1pbikgew0KPiA+ICsgICAgICAgICAgICAgICBzaHJpbmsgPSB0cnVl Ow0KPiA+ICsgICAgICAgICAgICAgICBtaW4gPSBiYXNlICsgbnVtX2VsZW1lbnRzOw0KPiA+ICsg ICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmIChtYXggPT0gYmFzZSArIG51bV9lbGVtZW50 cyAtIDEpIHsNCj4gPiArICAgICAgICAgICAgICAgc2hyaW5rID0gdHJ1ZTsNCj4gPiArICAgICAg ICAgICAgICAgbWF4IC09IG51bV9lbGVtZW50czsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4g KyAgICAgICBpZiAobWluID4gbWF4KQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsN Cj4gPiArDQo+ID4gKyAgICAgICBpZiAoc2hyaW5rKQ0KPiA+ICsgICAgICAgICAgICAgICByYW5n ZSA9IG1pbiArIChtYXggPDwgMTYpOw0KPiA+ICsgICAgICAgZWxzZQ0KPiA+ICsgICAgICAgICAg ICAgICByYW5nZSA9IG1pbiArICgoYmFzZSAtIDEpIDw8IDE2KTsNCj4gPiArDQo+ID4gKyAgICAg ICBuZXQuYWRkcmVzc19wb29sID0gZ19saXN0X2luc2VydF9zb3J0ZWQobmV0LmFkZHJlc3NfcG9v bCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBH VUlOVF9UT19QT0lOVEVSKHJhbmdlKSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICByYW5nZV9jbXApOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChz aHJpbmspDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICsNCj4gPiArICAg ICAgIHJhbmdlID0gKGJhc2UgKyBudW1fZWxlbWVudHMpICsgKG1heCA8PCAxNik7DQo+ID4gKyAg ICAgICBuZXQuYWRkcmVzc19wb29sID0gZ19saXN0X2luc2VydF9zb3J0ZWQobmV0LmFkZHJlc3Nf cG9vbCwNCj4gPiArICAgICA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zICovDQo+ID4gKyAgICAgICB9IGVs c2UgaWYgKGZpcnN0KSB7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChpdl91cGRhdGUpDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgbmV0Lml2X3VwZF9zdGF0ZSA9IElWX1VQRF9VUERBVElO RzsNCj4gPiArICAgICAgICAgICAgICAgZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IG5ldC5pdl91cGRfc3RhdGUgPSBJVl9VUERfTk9STUFMOw0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgcmxfcHJpbnRmKCJpdl91cGRfc3RhdGUgPSBJVl9VUERfJXNcbiIsDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBpdl91cGRhdGUgPyAiVVBEQVRJTkciIDogIk5PUk1B TCIpOw0KPiA+ICsNCj4gPiArICAgICAgIH0gZWxzZSBpZiAoaXZfdXBkYXRlICYmIGl2X2luZGV4 ICE9IG5ldC5pdl9pbmRleCkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIklWIFVw ZGF0ZSB0b28gc29vbiAtLSBSZWplY3RpbmdcbiIpOw0KPiA+ICsgICAgICAgICAgICAgICByZXR1 cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGl2X2luZGV4ID4gbmV0 Lml2X2luZGV4IHx8DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaXZfdXBkYXRlICE9IG5l dC5pdl91cGRhdGUpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIERvbid0IHJlc2V0 IG91ciBzZXFfbnVtIHVubGVzcw0KPiA+ICsgICAgICAgICAgICAgICAgKiB3ZSBzdGFydCB1c2lu ZyBuZXcgaXZfaW5kZXggKi8NCj4gPiArICAgICAgICAgICAgICAgaWYgKCEoaXZfdXBkYXRlICYm IChuZXQuaXZfaW5kZXggKyAxID09IGl2X2luZGV4KSkpIHsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBuZXQuc2VxX251bSA9IDA7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbmV0 LnNlcV9udW1fcmVzZXJ2ZWQgPSAxMDA7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAg ICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIW5ldC5zZXFfbnVtIHx8IG5ldC5pdl9pbmRl eCAhPSBpdl9pbmRleCB8fA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG5ldC5pdl91cGRh dGUgIT0gaXZfdXBkYXRlKSB7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAobmV0LnNl cV9udW1fcmVzZXJ2ZWQgPD0gbmV0LnNlcV9udW0pDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgbmV0LnNlcV9udW1fcmVzZXJ2ZWQgPSBuZXQuc2VxX251bSArIDEwMDsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgIHByb3ZfZGJfbG9jYWxfc2V0X2l2X2luZGV4KGl2X2luZGV4LCBpdl91 cGRhdGUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXQucHJvdmlzaW9u ZXIpOw0KPiA+ICsgICAgICAgICAgICAgICBwcm92X2RiX2xvY2FsX3NldF9zZXFfbnVtKG5ldC5z ZXFfbnVtX3Jlc2VydmVkKTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBuZXQu aXZfaW5kZXggPSBpdl9pbmRleDsNCj4gPiArICAgICAgIG5ldC5pdl91cGRhdGUgPSBpdl91cGRh dGU7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGZpcnN0KSB7DQo+ID4gKyAgICAgICAgICAgICAg IC8qIE11c3QgYmUgZG9uZSBvbmNlIHBlciBQcm94eSBDb25uZWN0aW9uIGFmdGVyIEJlYWNvbiBS WGVkICovDQo+ID4gKyAgICAgIC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uZXRfa2V5LT5waGFzZSAhPSAyKSB7DQo+ID4gKyAgICAgICAgICAg ICAgIG15X2tyZiA9IGZhbHNlOw0KPiA+ICsgICAgICAgICAgICAgICBrZXlfcGFydCA9ICZuZXRf a2V5LT5jdXJyZW50Ow0KPiA+ICsgICAgICAgfSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAg bXlfa3JmID0gdHJ1ZTsNCj4gPiArICAgICAgICAgICAgICAga2V5X3BhcnQgPSAmbmV0X2tleS0+ bmV3Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIC8qIElnbm9yZSBmb3IgaW5j b3JyZWN0IEtSIHN0YXRlICovDQo+ID4gKyAgICAgICBpZiAobWVtY21wKGtleV9wYXJ0LT5uZXRf aWQsIGRhdGEgKyAyLCA4KSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ ICsNCj4gPiArICAgICAgIGlmICgobmV0Lml2X2luZGV4ICsgSVZfSURYX0RJRkZfUkFOR0UgPCBp dl9pbmRleCkgfHwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAoaXZfaW5kZXggPCBuZXQu aXZfaW5kZXgpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiaXYgaW5kZXggb3V0 c2lkZSByYW5nZVxuIik7DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiAr ICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAvKiBBbnkgYmVoYXZpb3JhbCBjaGFuZ2VzIG11 c3QgcGFzcyBDTUFDIHRlc3QgKi8NCj4gPiArICAgICAgIGlmICghbWVzaF9jcnlwdG9fYmVhY29u X2NtYWMoa2V5X3BhcnQtPmJlYWNvbl9rZXksIGtleV9wYXJ0LQ0KPiA+bmV0X2lkLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnhlZF9pdl9pbmRleCwgbXlfa3JmLA0KP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9pbmRleDsNCj4gPiArICAgICAgIHVpbnQ4 X3QgICAgICAgICAgICAgICAgIHNpemU7DQo+ID4gKyAgICAgICBib29sICAgICAgICAgICAgICAg ICAgICBwcm94eTsNCj4gPiArfTsNCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIHRyeV9kZWNvZGUo Z3BvaW50ZXIgZGF0YSwgZ3BvaW50ZXIgdXNlcl9kYXRhKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBz dHJ1Y3QgbWVzaF9uZXRfa2V5ICpuZXRfa2V5ID0gZGF0YTsNCj4gPiArICAgICAgIHN0cnVjdCBk ZWNvZGVfcGFyYW1zICpkZWNvZGUgPSB1c2VyX2RhdGE7DQo+ID4gKyAgICAgICB1aW50OF90IG5p ZCA9IGRlY29kZS0+cGFja2V0WzBdICYgMHg3ZjsNCj4gPiArICAgICAgIHVpbnQ4X3QgdG1wWzI5 XTsNCj4gPiArICAgICAgIGJvb2wgc3RhdHVzID0gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKGRlY29kZS0+bmV0X2tleSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsN Cj4gPiArICAgICAgIGlmIChuZXRfa2V5LT5jdXJyZW50Lm5pZCA9PSBuaWQpDQo+ID4gKyAgICAg ICAgICAgICAgIHN0YXR1cyA9IG1lc2hfY3J5cHRvX3BhY2tldF9kZWNvZGUoZGVjb2RlLT5wYWNr ZXQsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWNvZGUtPnNpemUsIGRl Y29kZS0+cHJveHksIHRtcCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRl Y29kZS0+aXZfaW5kZXgsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRf a2V5LT5jdXJyZW50LmVuY19rZXksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBuZXRfa2V5LT5jdXJyZW50LnByaXZhY3lfa2V5KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAo IXN0YXR1cyAmJiBuZXRfa2V5LT5uZXcubmlkID09IG5pZCkNCj4gPiArICAgICAgICAgICAgICAg c3RhdHVzID0gbWVzaF9jcnlwdG9fcGFja2V0X2RlY29kZShkZWNvZGUtPnBhY2tldCwNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29kZS0+c2l6ZSwgZGVjb2RlLT5wcm94 eSwgdG1wLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVjb2RlLT5pdl9p bmRleCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldF9rZXktPm5ldy5l bmNfa2V5LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0X2tleS0+bmV3 LnByaXZhY3lfa2V5KTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoc3RhdHVzKSB7DQo+ID4gKyAg ICAgICAgICAgICAgIGRlY29kZS0+bmV0X2tleSA9IG5ldF9rZXk7DQo+ID4gKyAgICAgICAgICAg ICAgIG1lbWNweShkZWNvZGUtPnBhY2tldCwgdG1wLCBkZWNvZGUtPnNpemUpOw0KPiA+ICsgICAg ICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0 YXRpYyBzdHJ1Y3QgbWVzaF9uZXRfa2V5ICpuZXRfcGFja2V0X2RlY29kZShib29sIHByb3h5LCB1 aW50MzJfdA0KPiBpdl9pbmRleCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHVpbnQ4X3QgKnBhY2tldCwgdWludDhfdCBzaXplKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBzdHJ1 Y3QgZGVjb2RlX3BhcmFtcyBkZWNvZGUgPSB7DQo+ID4gKyAgICAgICAgICAgICAgIC5wcm94eSA9 IHByb3h5LA0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NlZ04pOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgbWVt Y3B5KFBLVF9UUkFOUyhkYXRhKSArIDQsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBzYXItPmRhdGEgKyBzYXItPmN0bCArIChzZWcgKiAxMiksIDEyKTsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgIHBrdC0+bGVuID0gOSArIDQ7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICBpZiAoc2FyLT5zZWdOID09IHNlZykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBw a3QtPmxlbiArPSAoc2FyLT5sZW4gLSBzYXItPmN0bCkgJSAxMjsNCj4gPiArDQo+ID4gKyAgICAg ICAgICAgICAgIGlmIChwa3QtPmxlbiA9PSAoOSArIDQpKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHBrdC0+bGVuICs9IDEyOw0KPiA+ICsNCj4gPiArICAgICAgIH0gZWxzZSB7DQo+ID4g KyAgICAgICAgICAgICAgIG1lbWNweShQS1RfVFJBTlMoZGF0YSkgKyAxLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgc2FyLT5kYXRhICsgc2FyLT5jdGwsIDE1KTsNCj4gPiAr DQo+ID4gKyAgICAgICAgICAgICAgIHBrdC0+bGVuID0gOSArIDEgKyBzYXItPmxlbiAtIHNhci0+ Y3RsOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHBrdC0+bGVuICs9IChzYXIt PmN0bCA/IDggOiA0KTsNCj4gPiArICAgICAgIG1lc2hfY3J5cHRvX3BhY2tldF9lbmNvZGUoZGF0 YSwgcGt0LT5sZW4sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcGFydC0+ZW5jX2tleSwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBzYXItPml2X2luZGV4LA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIHBhcn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TsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4g PiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIGJvb2wgcHJveHlfY3RsX3J4ZWQodWludDE2X3QgbmV0 X2lkeCwgdWludDMyX3QgaXZfaW5kZXgsDQo+ID4gKyAgICAgICAgICAgICAgIHVpbnQ4X3QgdHRs LCB1aW50MzJfdCBzZXFfbnVtLCB1aW50MTZfdCBzcmMsIHVpbnQxNl90IGRzdCwNCj4gPiArICAg ICAgICAgICAgICAgdWludDhfdCAqdHJhbnMsIHVpbnQxNl90IGxlbikNCj4gPiArew0KPiA+ICsg ICAgICAgaWYgKGxlbiA8IDEpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4g PiArDQo+ID4gKyAgICAgICBzd2l0Y2godHJhbnNbMF0pIHsNCj4gPiArICAgICAgICAgICAgICAg Y2FzZSBGSUxURVJfU1RBVFVTOg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4g IT0gNCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsN Cj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbmV0LmJsYWNrbGlzdCA9ICEhKHRy YW5zWzFdID09IEJMQUNLTElTVF9GSUxURVIpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IHJsX3ByaW50ZigiUHJveHkgJXNsaXN0IGZpbHRlciBsZW5ndGg6ICVkXG4iLA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXQuYmxhY2tsaXN0ID8gIkJsYWNr IiA6ICJXaGl0ZSIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGdldF9iZTE2KHRyYW5zICsgMikpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICByZXR1cm4gdHJ1ZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGRlZmF1bHQ6DQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsgICAgICAgfQ0KPiA+ ICsNCj4gPiArICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGlj IGJvb2wgY3RsX3J4ZWQodWludDE2X3QgbmV0X2lkeCwgdWludDMyX3QgaXZfaW5kZXgsDQo+ID4g KyAgICAgICAgICAgICAgIHVpbnQ4X3QgdHRsLCB1aW50MzJfdCBzZXFfbnVtLCB1aW50MTZfdCBz cmMsIHVpbnQxNl90IGRzdCwNCj4gPiArICAgICAgICAgICAgICAgdWludDhfdCAqdHJhbnMsIHVp bnQxNl90IGxlbikNCj4gPiArew0KPiA+ICsgICAgICAgLyogVE9ETzogSGFuZGxlIGNvbnRyb2wg bWVzc2FnZXMgKi8NCj4gPiArICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArfQ0KPiA+ICsNCj4g PiArc3RydWN0IGRlY3J5cHRfcGFyYW1zIHsNCj4gPiArICAgICAgIHVpbnQ4X3QgICAgICAgICAq bm9uY2U7DQo+ID4gKyAgICAgICB1aW50OF90ICAgICAgICAgKmFhZDsNCj4gPiArICAgICAgIHVp bnQ4X3QgICAgICAgICAqb3V0X21zZzsNCj4gPiArICAgICAgIHVpbnQ4X3QgICAgICAgICAqdHJh bnM7DQo+ID4gKyAgICAgICB1aW50MzJfdCAgICAgICAgaXZfaW5kZXg7DQo+ID4gKyAgICAgICB1 aW50MzJfdCAgICAgICAgc2VxX251bTsNCj4gPiArICAgICAgIHVpbnQxNl90ICAgICAgICBzcmM7 DQo+ID4gKyAgICAgICB1aW50MTZfdCAgICAgICAgZHN0Ow0KPiA+ICsgICAgICAgdWludDE2X3Qg ICAgICAgIGxlbjsNCj4gPiArICAgICAgIHVpbnQxNl90ICAgICAgICBuZXRfaWR4Ow0KPiA+ICsg ICAgICAgdWludD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A9PSBkZWNyeXB0LT5ha2ZfYWlk KQ0KPiA+ICsgICAgICAgICAgICAgICBzdGF0dXMgPSBtZXNoX2NyeXB0b19hZXNfY2NtX2RlY3J5 cHQoZGVjcnlwdC0+bm9uY2UsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBh cHBfa2V5LT5jdXJyZW50LmtleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGRlY3J5cHQtPmFhZCwgZGVjcnlwdC0+YWFkID8gMTYgOiAwLA0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgZGVjcnlwdC0+dHJhbnMsIGRlY3J5cHQtPmxlbiwNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY3J5cHQtPm91dF9tc2csIE5VTEwsIG1pY19z aXplKTsNCj4gPiArDQo+ID4gKyAgICAgICAvKiBUZXN0IGFuZCBkZWNyeXB0IGFnYWluc3QgbmV3 IGtleSBjb3B5ICovDQo+ID4gKyAgICAgICBpZiAoIXN0YXR1cyAmJiBhcHBfa2V5LT5uZXcuYWtm X2FpZCA9PSBkZWNyeXB0LT5ha2ZfYWlkKQ0KPiA+ICsgICAgICAgICAgICAgICBzdGF0dXMgPSBt ZXNoX2NyeXB0b19hZXNfY2NtX2RlY3J5cHQoZGVjcnlwdC0+bm9uY2UsDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBhcHBfa2V5LT5uZXcua2V5LA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZGVjcnlwdC0+YWFkLCBkZWNyeXB0LT5hYWQgPyAxNiA6IDAs DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWNyeXB0LT50cmFucywgZGVj cnlwdC0+bGVuLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVjcnlwdC0+ b3V0X21zZywgTlVMTCwgbWljX3NpemUpOw0KPiA+ICsNCj4gPiArICAgICAgIC8qIElmIHN1Y2Nl c3NmdWwsIHRlcm1pbmF0ZSB3aXRoIHN1Y2Nlc3NmdWwgQXBwIElEWCAqLw0KPiA+ICsgICAgICAg aWYgKHN0YXR1cykNCj4gPiArICAgICAgICAgICAgICAgZGVjcnlwdC0+YXBwX2lkeCA9IGFwcF9r ZXktPmdlbmVyaWMuaWR4Ow0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdWludDE2X3QgYWNj ZXNzX3BrdF9kZWNyeXB0KHVpbnQ4X3QgKm5vbmNlLCB1aW50OF90ICphYWQsDQo+ID4gKyAgICAg ICAgICAgICAgIHVpbnQxNl90IG5ldF9pZHgsIHVpbnQ4X3QgYWtmX2FpZCwgYm9vbCBzem1pYywN Cj4gPiArICAgICAgICAgICAgICAgdWludDhfdCAqdHJhbnMsIHVpbnQxNl90IGxlbikNCj4gPiAr ew0KPiA+ICsgICAgICAgdWludDhfdCAqb3V0X21zZzsNCj4gPiArICAgICAgIHN0cnVjdCBkZWNy eXB0X3BhcmFtcyBkZWNyeXB0ID0gew0KPiA+ICsgICAgICAgICAgICAgICAubm9uY2UgPSBub25j ZSwNCj4gPiArICAgICAgICAgICAgICAgLmFhZCA9IGFhZCwNCj4gPiArICAgICAgICAgICAgICAg Lm5ldF9pZHggPSBuZXRfaWR4LA0KPiA+ICsgICAgICAgICAgICAgICAuYWtmX2FpZCA9IGFrZl9h aWQsDQo+ID4gKyAgICAgICAgICAgICAgIC5zem1pYyA9IHN6bWljLA0KPiA+ICsgICAgICAgICAg ICAgICAudHJhbnMgPSB0cmFucywNCj4gPiArICAgICAgICAgICAgICAgLmxlbiA9IGxlbiwNCj4g PiArICAgICAgICAgICAgICAgLmFwcF9pZHggPSBBUFBfSURYX0lOVkFMSUQsDQo+ID4gKyAgICAg ICB9Ow0KPiA+ICsNCj4gPiArICAgICAgIG91dF9tc2cgPSBnX21hbGxvYyhsZW4pOw0KPiA+ICsN Cj4gPiArICAgICA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jZSA9 IG5vbmNlLA0KPiA+ICsgICAgICAgICAgICAgICAubmV0X2lkeCA9IG5ldF9pZHgsDQo+ID4gKyAg ICAgICAgICAgICAgIC5pdl9pbmRleCA9IGl2X2luZGV4LA0KPiA+ICsgICAgICAgICAgICAgICAu c2VxX251bSA9IHNlcV9udW0sDQo+ID4gKyAgICAgICAgICAgICAgIC5zcmMgPSBkc3QsDQo+ID4g KyAgICAgICAgICAgICAgIC5kc3QgPSBkc3QsDQo+ID4gKyAgICAgICAgICAgICAgIC5ha2ZfYWlk ID0gYWtmX2FpZCwNCj4gPiArICAgICAgICAgICAgICAgLnN6bWljID0gc3ptaWMsDQo+ID4gKyAg ICAgICAgICAgICAgIC50cmFucyA9IHRyYW5zLA0KPiA+ICsgICAgICAgICAgICAgICAubGVuID0g bGVuLA0KPiA+ICsgICAgICAgICAgICAgICAuYXBwX2lkeCA9IEFQUF9JRFhfSU5WQUxJRCwNCj4g PiArICAgICAgIH07DQo+ID4gKw0KPiA+ICsgICAgICAgLyogQ3ljbGUgdGhyb3VnaCBrbm93biB2 aXJ0dWFsIGFkZHJlc3NlcyAqLw0KPiA+ICsgICAgICAgZ19saXN0X2ZvcmVhY2godmlydF9hZGRy cywgdHJ5X3ZpcnRfZGVjcnlwdCwgJmRlY3J5cHQpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChk ZWNyeXB0LmFwcF9pZHggIT0gQVBQX0lEWF9JTlZBTElEKQ0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm4gdHJ1ZTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gK30NCj4g PiArDQo+ID4gK3N0YXRpYyBib29sIG1zZ19yeGVkKHVpbnQxNl90IG5ldF9pZHgsIHVpbnQzMl90 IGl2X2luZGV4LCBib29sIHN6bWljLA0KPiA+ICsgICAgICAgICAgICAgICB1aW50OF90IHR0bCwg dWludDMyX3Qgc2VxX251bSwgdWludDMyX3Qgc2VxX2F1dGgsDQo+ID4gKyAgICAgICAgICAgICAg IHVpbnQxNl90IHNyYywgdWludDE2X3QgZHN0LA0KPiA+ICsgICAgICAgICAgICAgICB1aW50OF90 ICp0cmFucywgdWludDE2X3QgbGVuKQ0KPiA+ICt7DQo+ID4gKyAgICAgICB1aW50OF90IGFrZl9h aWQgPSBUUkFOU19BS0ZfQUlEKHRyYW5zKTsNCj4gPiArICAgICAgIGJvb2wgcmVzdWx0Ow0KPiA+ ICsgICAgICAgc2l6ZV90IG1pY19zaXplID0gc3ptaWMgPyBzaXplb2YodWludDY0X3QpIDogc2l6 ZW9mKHVpbnQzMl90KTsNCj4gPiArICAgICAgIHVpbnQ4X3Qgbm9uY2VbMTNdOw0KPiA+ICsgICAg ICAgdWludDhfdCAqZGV2X2tleTsNCj4gPiArICAgICAgIHVpbnQ4X3QgKm91dCA9IE5VTEw7DQo+ ID4gKw0KPiA+ICsgICAgICAgaWYgKCFUUkFOU19BS0YodHJhbnMpKSB7DQo+ID4gKyAgICAgICAg ICAgICAgIC8qIENvbXBvc2UgTm9uY2UgKi8NCj4gPiArICAgICAgICAgICAgICAgcmVzdWx0ID0g bWVzaF9jcnlwdG9fZGV2aWNlX25vbmNlKHNlcV9hdXRoLCBzcmMsIGRzdCwNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGl2X2luZGV4LCBzem1pYywgbm9uY2UpOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQpIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ ID4gKyAgICAgICAgICAgICAgIG91dCA9IGdfbWFsbG9jMChUUkFOU19MRU4odHJhbnMsIGxlbikp Ow0KPiA+ICsgICAgICAgICAgICAgICBpZiAob3V0ID09IE5VTEwpIHJldHVybiBmYWxzZTsNCj4g PiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIElmIHdlIGFyZSBwcm92aXNpb25lciwgd2UgcHJv YmFibHkgUlhlZCBvbiByZW1vdGUgRGV2IEtleSAqLw0KPiA+ICsgICAgICAgICAgICAgICBpZiAo bmV0LnByb3Zpc2lvbmVyKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZGV2X2tleSA9 IG5vZGVfZ2V0X2RldmljZV9rZXkobm9kZV9maW5kX2J5X2FkZHIoc3JjKSk7DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZXZfa2V5ID09IE5VTEwpDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGxvY2FsX2Rldl9rZXk7DQo+ID4gKyAgICAg ICAgICAgICAgIH0gZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gbG9jYWxf ZGV2X2tleTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHJlc3VsdCA9IG1lc2hfY3J5cHRv X2Flc19jY21fZGVjcnlwdChub25jZSwgZGV2X2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIE5VTEwsIDAsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBUUkFOU19QQVlMT0FEKHRyYW5zKSwgVFJBTlNfTEVOKHRyYW5zLCBsZW4pLA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0LCBOVUxMLCBtaWNfc2l6ZSk7DQo+ID4gKw0K PiA+ICsgICAgICAgICAgICAgICBpZiAocmVzdWx0KSB7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgbm9kZV9sb2NhbF9kYXRhX2hhbmRsZXIoc3JjLCBkc3QsDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl2X2luZGV4LCBzZXFfbnVtLCBBUFBfSURYX0RF ViwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0LCBUUkFO U19MRU4odHJhbnMsIGxlbikgLSBtaWNfc2l6ZSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICtsb2NhbF9k ZXZfa2V5Og0KPiA+ICsgICAgICAgICAgICAgICAvKiBBbHdheXMgZmFsbGJhY2sgdG8gdGhlIGxv Y2FsIERldiBLZXkgKi8NCj4gPiArICAgICAgICAgICAgICAgZGV2X2tleSA9IG5vZGVfZ2V0X2Rl dmljZV9rZXkobm9kZV9nZXRfbG9jYWxfbm9kZSgpKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgIGlmIChkZXZfa2V5ID09IE5VTEwpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ290 byBkb25lOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmVzdWx0ID0gbWVzaF9jcnlwdG9f YWVzX2NjbV9kZWNyeXB0KG5vbmNlLCBkZXZfa2V5LA0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgTlVMTCwgMCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IFRSQU5TX1BBWUxPQUQodHJhbnMpLCBUUkFOU19MRU4odHJhbnMsIGxlbiksDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQsIE5VTEwsIG1pY19zaXplKTsNCj4gPiArDQo+ ID4gKyAgICAgICAgICAgICAgIGlmIChyZXN1bHQpIHsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICBub2RlX2xvY2FsX2RhdGFfaGFuZGxlcihzcmMsIGRzdCwNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgaXZfaW5kZXgsIHNlcV9udW0sIEFQUF9JRFhfREVW LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQsIFRSQU5T X0xFTih0cmFucywgbGVuKSAtIG1pY19zaXplKTsNCj4gPiArICAgICAgICA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gMzIgfA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgIHNhci0+c2VxQXV0aDsNCj4gPiArICAgICAgICAgICAgICAgaWYgKG9sZF9p dl9zZXFBdXRoIDwgaXZfc2VxQXV0aCkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICBmbHVzaF9zYXIoJm5ldC5zYXJfaW4sIHNhcik7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgc2FyID0gTlVMTDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIH0gZWxzZSBpZiAo b2xkX2l2X3NlcUF1dGggPiBpdl9zZXFBdXRoKSB7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgIC8qIE5ldyBzZWdtZW50IGlzIFN0YWxlLiBTaWxlbnRseSBpZ25vcmUgKi8NCj4g PiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICB9IGVsc2UgaWYgKHNlZ04gIT0gc2FyLT5zZWdOKSB7DQo+ID4gKw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIC8qIFJlbW90ZSBzaWRlIHNlbnQgY29uZmxpY3RpbmcgZGF0 YTogYWJhbmRvbiAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGZsdXNoX3NhcigmbmV0 LnNhcl9pbiwgc2FyKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBzYXIgPSBOVUxMOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiAr ICAgICAgIGlmIChzYXIgPT0gTlVMTCkgew0KPiA+ICsgICAgICAgICAgICAgICBzYXIgPSBnX21h bGxvYzAoc2l6ZW9mKCpzYXIpICsgKDEyICogc2VnTikpOw0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgaWYgKHNhciA9PSBOVUxMKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVy biBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHNhci0+bmV0X2lkeCA9IG5ldF9p ZHg7DQo+ID4gKyAgICAgICAgICAgICAgIHNhci0+aXZfaW5kZXggPSBpdl9pbmRleDsNCj4gPiAr ICAgICAgICAgICAgICAgc2FyLT5jdGwgPSBjdGw7DQo+ID4gKyAgICAgICAgICAgICAgIHNhci0+ dHRsID0gdHRsOw0KPiA+ICsgICAgICAgICAgICAgICBzYXItPnNlcUF1dGggPSBzZXFBdXRoOw0K PiA+ICsgICAgICAgICAgICAgICBzYXItPnNyYyA9IHNyYzsNCj4gPiArICAgICAgICAgICAgICAg c2FyLT5kc3QgPSBkc3Q7DQo+ID4gKyAgICAgICAgICAgICAgIHNhci0+c2VnbWVudGVkID0gdHJ1 ZTsNCj4gPiArICAgICAgICAgICAgICAgc2FyLT5zem1pYyA9IFRSQU5TX1NaTUlDKHRyYW5zKTsN Cj4gPiArICAgICAgICAgICAgICAgc2FyLT5zZWdOID0gc2VnTjsNCj4gPiArDQo+ID4gKyAgICAg ICAgICAgICAgIC8qIEluIGFsbCBjYXNlcywgdGhlIHJlYXNzZW1ibGVkIHBhY2tldCBzaG91bGQg YmVnaW4gd2l0aCB0aGUNCj4gPiArICAgICAgICAgICAgICAgICogc2FtZSBmaXJzdCBvY3RldCBv ZiBhbGwgc2VnbWVudHMsIG1pbnVzIHRoZSBTRUdNRU5URUQgZmxhZyAqLw0KPiA+ICsgICAgICAg ICAgICAgICBzYXItPmRhdGFbMF0gPSB0cmFuc1swXSAmIDB4N2Y7DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICBuZXQuc2FyX2luID0gZ19saXN0X2FwcGVuZChuZXQuc2FyX2luLCBzYXIpOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgLyogU2V0dXAgZXhwaXJhdGlvbiB0aW1lcnMgKi8N Cj4gPiArICAgICAgICAgICAgICAg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Fj ayAmJiBvbGRfYWNrICE9IGZ1bGxfYWNrKSB7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAv KiBGaXJzdCB0aW1lIHdlIGhhdmUgc2VlbiB0aGlzIGNvbXBsZXRlIG1lc3NhZ2UgKi8NCj4gPiAr ICAgICAgICAgICAgICAgc2VuZF9hY2sgPSB0cnVlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAgaWYgKGN0bCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBjdGxfcnhl ZChzYXItPm5ldF9pZHgsIHNhci0+aXZfaW5kZXgsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHNhci0+dHRsLCBzYXItPnNlcUF1dGgsIHNhci0+c3JjLA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXItPmRzdCwgc2FyLT5k YXRhLCBzYXItPmxlbik7DQo+ID4gKyAgICAgICAgICAgICAgIGVsc2UNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICByZXN1bHQgPSBtc2dfcnhlZChzYXItPm5ldF9pZHgsIHNhci0+aXZfaW5k ZXgsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhci0+c3pt aWMsIHNhci0+dHRsLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBzZXFfbnVtLCBzYXItPnNlcUF1dGgsIHNhci0+c3JjLA0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBzYXItPmRzdCwgc2FyLT5kYXRhLCBzYXItPmxlbik7DQo+ ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgLyogTmV2ZXIgQWNrIEdyb3VwIGFkZHJl c3NlZCBTQVIgbWVzc2FnZXMgKi8NCj4gPiArICAgICAgIGlmICghSVNfVU5JQ0FTVChkc3QpKQ0K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mRleDsNCj4gPiArICAgICAgIHN0cnVjdCBtZXNoX25ldF9r ZXkgKm5ldF9rZXk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGxlbi0tIDwgMTApIHJldHVybiBm YWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAodHlwZSA9PSBQUk9YWV9NRVNIX0JFQUNPTikN Cj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIHByb2Nlc3NfYmVhY29uKG1zZywgbGVuKTsNCj4g PiArICAgICAgIGVsc2UgaWYgKHR5cGUgPiBQUk9YWV9DT05GSUdfUERVKQ0KPiA+ICsgICAgICAg ICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogUlhlZCBpdl9pbmRl eCBtdXN0IGJlIGVxdWFsIG9yIDEgbGVzcyB0aGFuIGxvY2FsIGl2X2luZGV4ICovDQo+ID4gKyAg ICAgICAvKiBXaXRoIHRoZSBjbHVlIGJlaW5nIGhpZ2gtb3JkZXIgYml0IG9mIGZpcnN0IG9jdGV0 ICovDQo+ID4gKyAgICAgICBpZiAoISEoaXZfaW5kZXggJiAweDAxKSAhPSAhIShtc2dbMF0gJiAw eDgwKSkgew0KPiA+ICsgICAgICAgICAgICAgICBpZiAoaXZfaW5kZXgpDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgaXZfaW5kZXgtLTsNCj4gPiArICAgICAgICAgICAgICAgZWxzZQ0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAgIH0NCj4g PiArDQo+ID4gKyAgICAgICBuZXRfa2V5ID0gbmV0X3BhY2tldF9kZWNvZGUodHlwZSA9PSBQUk9Y WV9DT05GSUdfUERVLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGl2X2luZGV4LCBtc2cs IGxlbik7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKG5ldF9rZXkgPT0gTlVMTCkNCj4gPiArICAg ICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIC8qIENUTCBwYWNr ZXRzIGhhdmUgNjQgYml0IG5ldHdvcmsgTUlDLCBvdGhlcndpc2UgMzIgYml0IE1JQyAqLw0KPiA+ ICsgICAgICAgbGVuIC09IFBLVF9DVEwobXNnKSA/IHNpemVvZih1aW50NjRfdCkgOiBzaXplb2Yo dWludDMyX3QpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICh0eXBlID09IFBST1hZX0NPTkZJR19Q RFUpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIFByb3h5IENvbmZpZ3VyYXRpb24g RFNUIG1lc3NhZ2VzIG11c3QgYmUgMHgwMDAwICovDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChQ S1RfRFNUKG1zZykpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIHByb3h5X2N0bF9yeGVkKG5ldF9rZXkt PmdlbmVyaWMuaWR4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXZfaW5k ZXgsIFBLVF9UVEwobXNnKSwgUEtUX1NFUShtc2cpLA0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgUEtUX1NSQyhtc2cpLCBQS1RfRFNUKG1zZyksDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBQS1RfVFJBTlMobXNnKSwgUEtUX1RSQU5TX0xFTihsZW4pKTsN Cj4gPiArDQo+ID4gKyAgICAgICB9IGlmIChQS1RfQ1RMKG1zZykgJiYgUEtUX09QQ09ERShtc2cp ID09DQo+IE5FVF9PUF9TRUdfQUNLTk9XTEVER0UpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybiBhY2tfcnhlZChmYWxzZSwgUEtUX1NSQyhtc2cpLCBQS1RfRFNUKG1zZyksDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQS1RfT0JPKG1zZyksIFBLVF9TRVEw KG1zZyksIFBLVF9BQ0sobXNnKSk7DQo+ID4gKw0KPiA+ICsgICAgICAgfSBlbHNlIGlmIChQS1Rf U0VHTUVOVEVEKG1zZykpIHsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBzZWdf cnhlZChuZXRfa2V5LT5nZW5lcmljLmlkeCwgaXZfaW5kZXgsIFBLVF9DVEwobXNnKSwNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBLVF9UVEwobXNnKSwgUEtUX1NFUShtc2cp LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEtUX1NSQyhtc2cpLCBQS1Rf RFNUKG1zZyksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQS1RfVFJBTlMo bXNnKSwgUEtUX1RSQU5TX0xFTihsZW4pKTsNCj4gPiArDQo+ID4gKyAgICAgICB9IGVsc2UgaWYg KCFQS1RfQ1RMKG1zZykpew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIG1zZ19y eGVkKG5ldF9rZXktPmdlbmVyaWMuaWR4LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgaXZfaW5kZXgsIGZhbHNlLCBQS1RfVFRMKG1zZyksIFBLVF9TRVEobXNnKSwNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBLVF9TRVEobXNnKSwgUEtUX1NSQyhtc2cp LCBQS1RfRFNUKG1zZyksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQS1Rf VFJBTlMobXNnKSwgUEtUX1RSQU5TX0xFTihsZW4pKTsNCj4gPiArICAgICAgIH0gZWxzZSB7DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gY3RsX3J4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Km5ldF9pZHgpDQo+ID4gK3sNCj4gPiAr ICAgICAgIGlmIChhcHBfaWR4ID09IEFQUF9JRFhfREVWKSB7DQo+ID4gKyAgICAgICAgICAgICAg IHN0cnVjdCBtZXNoX25vZGUgKm5vZGU7DQo+ID4gKyAgICAgICAgICAgICAgIHVpbnQ4X3QgKmVu Y19rZXkgPSBOVUxMOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKG5ldC5wcm92aXNp b25lcikgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIC8qIERlZmF1bHQgdG8gUmVtb3Rl IERldmljZSBLZXkgd2hlbiBQcm92aXNpb25lciAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIG5vZGUgPSBub2RlX2ZpbmRfYnlfYWRkcihkc3QpOw0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIGVuY19rZXkgPSBub2RlX2dldF9kZXZpY2Vfa2V5KG5vZGUpOw0KPiA+ICsgICAgICAg ICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoZW5jX2tleSA9PSBOVUxM KSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgLyogVXNlIExvY2FsIG5vZGUgRGV2aWNl IEtleSAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG5vZGUgPSBub2RlX2dldF9sb2Nh bF9ub2RlKCk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZW5jX2tleSA9IG5vZGVfZ2V0 X2RldmljZV9rZXkobm9kZSk7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICAgICAgICAgIGlmIChlbmNfa2V5ID09IE5VTEwgfHwgbm9kZSA9PSBOVUxMKQ0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAg ICAgICAgIGlmIChha2ZfYWlkKSAqYWtmX2FpZ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GljYXRpb25fZW5jcnlwdChha2ZfYWlkLA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgIHNhci0+c2VxQXV0aCwgc3JjLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIGRzdCwgc2FyLT5pdl9pbmRleCwNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBhcHBfZW5jX2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBhYWQsIGFh ZF9sZW4sDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnVmLCBsZW4sDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgc2FyLT5kYXRhLCAmbWljMzIsDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgc2l6ZW9mKHVpbnQzMl90KSk7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogSWYgc2Vu ZGluZyBhcyBhIHNlZ21lbnRlZCBtZXNzYWdlIHRvIGEgbm9uLVVuaWNhc3QgKHRodXMgbm9uLQ0K PiBBQ0tpbmcpDQo+ID4gKyAgICAgICAgKiBkZXN0aW5hdGlvbiwgc2VuZCBlYWNoIHNlZ21lbnRz IG11bHRpcGxlIHRpbWVzLiAqLw0KPiA+ICsgICAgICAgaWYgKCFJU19VTklDQVNUKGRzdCkgJiYg c2VnTikNCj4gPiArICAgICAgICAgICAgICAgYWNrbGVzc19yZXRyaWVzID0gNDsNCj4gPiArDQo+ ID4gKyAgICAgICBmb3IgKGogPSAwOyBqIDw9IGFja2xlc3NfcmV0cmllczsgaisrKSB7DQo+ID4g KyAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPD0gc2VnTjsgaSsrKQ0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIHNlbmRfc2VnKHNhciwgaSk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0K PiA+ICsgICAgICAgaWYgKElTX1VOSUNBU1QoZHN0KSAmJiBzZWdOKSB7DQo+ID4gKyAgICAgICAg ICAgICAgIG5ldC5tc2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IHVpbnQxNl90IHZlbmRvcl9pZDsNCj4gPiArICAgICAgICAgICAgICAgc3RydWN0IG1l c2hfZWxlbWVudCAqZWxlOw0KPiA+ICsgICAgICAgICAgICAgICBlbGUgPSBnX21hbGxvYzAoc2l6 ZW9mKHN0cnVjdCBtZXNoX2VsZW1lbnQpKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFlbGUp DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiAr ICAgICAgICAgICAgICAgZWxlLT5pbmRleCA9IGk7DQo+ID4gKyAgICAgICAgICAgICAgIGVsZS0+ bG9jID0gZ2V0X2xlMTYoZGF0YSk7DQo+ID4gKyAgICAgICAgICAgICAgIGRhdGEgKz0gMjsNCj4g PiArICAgICAgICAgICAgICAgbm9kZS0+ZWxlbWVudHMgPSBnX2xpc3RfYXBwZW5kKG5vZGUtPmVs ZW1lbnRzLCBlbGUpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgbSA9ICpkYXRhKys7DQo+ ID4gKyAgICAgICAgICAgICAgIHYgPSAqZGF0YSsrOw0KPiA+ICsgICAgICAgICAgICAgICBsZW4g LT0gNDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHdoaWxlIChsZW4gPj0gMiAmJiBtLS0p IHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBtb2RfaWQgPSBnZXRfbGUxNihkYXRhKTsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAvKiBpbml0aWFsaXplIHVwcHBlciAxNiBiaXRz IHRvIDB4ZmZmZiBmb3IgU0lHIG1vZGVscyAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IG1vZF9pZCB8PSAweGZmZmYwMDAwOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICgh bm9kZV9zZXRfbW9kZWwobm9kZSwgZWxlLT5pbmRleCwgbW9kX2lkKSkNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBkYXRhICs9IDI7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDI7 DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgICAgICAgICAgd2hpbGUgKGxlbiA+ PSA0ICYmIHYtLSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1vZF9pZCA9IGdldF9s ZTE2KGRhdGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcl9pZCA9IGdldF9s ZTE2KGRhdGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1vZF9pZCB8PSAodmVuZG9y X2lkIDw8IDE2KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW5vZGVfc2V0X21v ZGVsKG5vZGUsIGVsZS0+aW5kZXgsIG1vZF9pZCkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZGF0 YSArPSA0Ow0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSA0Ow0KPiA+ICsgICAg ICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIG5v ZGUtPmNvbXAgPSBjb21wOw0KPiA+ICsgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4gPiAr DQo+ID4gK2Jvb2wgbm9kZV9zZXRfbG9jYWxfbm9kZShzdHJ1Y3QgbWVzaF9ub2RlICpub2RlKQ0K PiA+ICt7DQo+ID4gKyAgICAgICBpZiAobG9jYWxfbm9kZSkgew0KPiA+ICsgICAgICAgICAgICAg ICBybF9wcmludGYoIkxvY2FsIG5vZGUgYWxyZWFkeSByZWdpc3RlcmVkXG4iKTsNCj4gP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h0KSB7DQo+ID4gKyAgICAgICAgICAgICAgIHN0cnVjdCBtZXNoX21vZGVsICpt b2RlbCA9IGwtPmRhdGE7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIWdfbGlzdF9m aW5kKG1vZGVsLT5iaW5kaW5ncywgR1VJTlRfVE9fUE9JTlRFUihhcHBfaWR4KSkpDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgY29udGludWU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAg ICBpZiAobW9kZWwtPmNicy5yZWN2ICYmDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbW9k ZWwtPmNicy5yZWN2KHNyYywgZGF0YSwgbGVuLCBtb2RlbC0+dXNlcl9kYXRhKSkNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ ID4gKyAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gK30NCj4gPiArDQo+ID4gK3ZvaWQgbm9kZV9s b2NhbF9kYXRhX2hhbmRsZXIodWludDE2X3Qgc3JjLCB1aW50MzJfdCBkc3QsDQo+ID4gKyAgICAg ICAgICAgICAgIHVpbnQzMl90IGl2X2luZGV4LCB1aW50MzJfdCBzZXFfbnVtLA0KPiA+ICsgICAg ICAgICAgICAgICB1aW50MTZfdCBhcHBfaWR4LCB1aW50OF90ICpkYXRhLCB1aW50MTZfdCBsZW4p DQo+ID4gK3sNCj4gPiArICAgICAgIEdMaXN0ICpsOw0KPiA+ICsgICAgICAgYm9vbCByZXM7DQo+ ID4gKyAgICAgICB1aW50NjRfdCBpdl9zZXE7DQo+ID4gKyAgICAgICB1aW50NjRfdCBpdl9zZXFf cmVtb3RlOw0KPiA+ICsgICAgICAgdWludDhfdCBlbGVfaWR4Ow0KPiA+ICsgICAgICAgc3RydWN0 IG1lc2hfZWxlbWVudCAqZWxlbWVudDsNCj4gPiArICAgICAgIHN0cnVjdCBtZXNoX25vZGUgKnJl bW90ZTsNCj4gPiArICAgICAgIGJvb2wgbG9vcGJhY2s7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYg KCFsb2NhbF9ub2RlIHx8IHNlcV9udW0gPiAweGZmZmZmZikNCj4gPiArICAgICAgICAgICAgICAg cmV0dXJuOw0KPiA+ICsNCj4gPiArICAgICAgIGl2X3NlcSA9IGl2X2luZGV4IDw8IDI0Ow0KPiA+ ICsgICAgICAgaXZfc2VxIHw9IHNlcV9udW07DQo+ID4gKw0KPiA+ICsgICAgICAgcmVtb3RlID0g bm9kZV9maW5kX2J5X2FkZHIoc3JjKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIXJlbW90ZSkg ew0KPiA+ICsgICAgICAgICAgICAgICBpZiAobG9jYWxfbm9kZS0+cHJvdmlzaW9uZXIpIHsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIlJlbW90ZSBub2RlIHVua25vd24g KCU0LjR4KVxuIiwgc3JjKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47DQo+ ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHJlbW90ZSA9 IGdfbmV3MChzdHJ1Y3QgbWVzaF9ub2RlLCAxKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFy ZW1vdGUpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsNCj4gPiAr ICAgICAgICAgICAgICAgLyogTm90IFByb3Zpc2lvbmVyOyBBc3N1bWUgYWxsIFNSQyBlbGVtZW50 cyBzdGFuZCBhbG9uZSAqLw0KPiA+ICsgICAgICAgICAgICAgICByZW1vdGUtPnByaW1hcnkgPSBz cmM7DQo+ID4gKyAgICAgICAgICAgICAgIHJlbW90ZS0+bnVtX2VsZSA9IDE7DQo+ID4gKyAgICAg ICAgICAgICAgIG5vZGVzID0gZ19saXN0X2FwcGVuZChub2RlcywgcmVtb3RlKTsNCj4gPiArICAg ICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBsb29wYmFjayA9IChzcmMgPCAobG9jYWxfbm9kZS0+ cHJpbWFyeSArIGxvY2FsX25vZGUtPm51bV9lbGUpICYmDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjID49IGxvY2FsX25vZGUtPnByaW1hcnkp Ow0KPiA+ICsNCj4gPiArICAgICAgIGlmICghbG9vcGJhY2spIHsNCj4gPiArICAgICAgICAgICAg ICAgaXZfc2VxX3JlbW90ZSA9IHJlbW90ZS0+aXZfaW5kZXggPDwgMjQ7DQo+ID4gKyAgICAgICAg ICAgICAgIGl2X3NlcSB8PSByZW1vdGUtPnNlcV9udW1iZXI7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBpZiAoaXZfc2VxX3JlbW90ZSA+PSBpdl9zZXEpIHsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICBybF9wcmludGYoIlJlcGxheWVkIG1lc3NhZ2UgZGV0ZWN0ZWQgIg0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIigl MTRseCA+PSAlMTRseClcbiIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBpdl9zZXFfcmVtb3RlLCBpdl9zZXEpOw0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsg ICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIGlmIChJU19HUk9VUChkc3QpIHx8IElTX1ZJUlRV QUwoZHN0KSkgew0KPiA+ICsgICAgICAgICAgICAgICAvKiBUT0RPOiBpZiBzdWJzY3JpcHRpb24g YWRkcmVzcywgZGVsaXZlciB0byBzdWJzY3JpYmVycyAqLw0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKElTX0FMTF9OT0RF Uyhkc3QpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGVsZV9pZHggPSAwOw0KPiA+ICsgICAgICAg fSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGRzdCA+PSAobG9jYWxfbm9kZS0+cHJp bWFyeSArIGxvY2FsX25vZGUtPm51bV9lbGUpIHx8DQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgZHN0IDwgbG9jYWxfbm9kZS0+cHJpbWFyeSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGVsZV9pZHggPSBk c3QgLSBsb2NhbF9ub2RlLT5wcmltYXJ5Ow0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAg ICAgIGwgPSBnX2xpc3RfZmluZF9jdXN0b20obG9jYWxfbm9kZS0+ZWxlbWVudHMsDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHVUlOVF9UT19QT0lOVEVSKGVsZV9pZHgpLCBt YXRjaF9lbGVtZW50X2lkeCk7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogVGhpcyBzaG91bGQgbm90 IGhhcHBlbiAqLw0KPiA+ICsgICAgICAgaWYgKCFsKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1 cm47DQo+ID4gKw0KPiA+ICsgICAgICAgZWxlbWVudCA9IGwtPmRhdGE7DQo+ID4gKyAgICAgICBy ZXMgPSBkZWxpdmVyX21vZGVsX2RhdGEoZWxlbWVudCwgc3JjLCBhcHBfaWR4LCBkYXRhLCBsZW4p Ow0KPiA+ICsNCj4gPiArICAgICAgIGlmIChyZXMgJiYgIWxvb3BiYWNrKSB7DQo+ID4gKyAgICAg ICAgICAgICAgIC8qIFRPRE86IFNhdmUgcmVtb3RlIGluIFJlcGxheSBQcm90ZWN0aW9uIGRiICov DQo+ID4gKyAgICAgICAgICAgICAgIHJlbW90ZS0+aXZfaW5kZXggPSBpdl9pbmRleDsNCj4gPiAr ICAgICAgICAgICAgICAgcmVtb3RlLT5zZXFfbnVtYmVyID0gc2VxX251bTsNCj4gPiArICAgICAg ICAgICAgICAgcHJvdl9kYl9ub2RlX3NldF9pdl9zZXEocmVtb3RlLCBpdl9pbmRleCwgc2VxX251 bSk7DQo+ID4gKyAgICAgICB9DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBnYm9vbGVhbiBy ZXN0b3JlX21vZGVsX3N0YXRlKGdwb2ludGVyIGRhdGEpDQo+ID4gK3sNCj4gPiArICAgICAgIHN0 cnVjdCBtZXNoX21vZGVsICptb2RlbCA9IGRhdGE7DQo+ID4gKyAgICAgICBHTGlzdCAqbDsNCj4g PiArICAgICAgIHN0cnVjdCBtZXNoX21vZGVsX29wcyAqb3BzOw0KPiA+ICsNCj4gPiArICAgICAg IG9wcyA9ICZtb2RlbC0+Y2JzOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChtb2RlbC0+YmluZGlu Z3MgJiYgb3BzLT5iaW5kKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGZvciAobCA9IG1vZGVsLT5i aW5kaW5nczsgbDsgbCA9IGwtPm5leHQpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBp ZiAob3BzLT5iaW5kKEdQT0lOVEVSX1RPX1VJTlQobC0+ZGF0YSksIEFDVElPTl9BREQpICE9DQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNRVNIX1NUQVRVU19TVUNDRVNTKQ0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICAg ICAgICAgIH0NCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBpZiAobW9kZWwtPnB1 YiAmJiBvcHMtPnB1Y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sc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgbCA9IGdf bGlzdF9maW5kX2N1c3RvbShsb2NhbF9ub2RlLT5lbGVtZW50cywNCj4gR1VJTlRfVE9fUE9JTlRF UihlbGVfaWR4KSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoX2Vs ZW1lbnRfaWR4KTsNCj4gPiArICAgICAgIGlmICghbCkNCj4gPiArICAgICAgICAgICAgICAgcmV0 dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGVsZSA9IGwtPmRhdGE7DQo+ID4gKw0KPiA+ ICsgICAgICAgbCA9IGdfbGlzdF9maW5kX2N1c3RvbShlbGUtPm1vZGVscywgR1VJTlRfVE9fUE9J TlRFUihtb2RlbF9pZCksDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRj aF9tb2RlbF9pZCk7DQo+ID4gKyAgICAgICBpZiAoIWwpDQo+ID4gKyAgICAgICAgICAgICAgIHJl dHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBtb2RlbCA9IGwtPmRhdGE7DQo+ID4gKyAg ICAgICBtb2RlbC0+Y2JzID0gKm9wczsNCj4gPiArICAgICAgIG1vZGVsLT51c2VyX2RhdGEgPSB1 c2VyX2RhdGE7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKG1vZGVsX2lkID49IDB4ZmZmZjAwMDAp DQo+ID4gKyAgICAgICAgICAgICAgIG1vZGVsX2lkID0gbW9kZWxfaWQgJiAweGZmZmY7DQo+ID4g Kw0KPiA+ICsgICAgICAgLyogU2lsZW50bHkgYXNzaWduIGRldmljZSBrZXkgYmluZGluZyB0byBj b25maWd1cmF0aW9uIG1vZGVscyAqLw0KPiA+ICsgICAgICAgaWYgKG1vZGVsX2lkID09IENPTkZJ R19TRVJWRVJfTU9ERUxfSUQgfHwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgbW9kZWx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4gbWVz aF9ub2RlICpub2RlKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBpZiAoIW5vZGUpDQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBub2RlLT5j b21wOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgc3RydWN0IG1lc2hfbW9kZWwgKmdldF9t b2RlbChzdHJ1Y3QgbWVzaF9ub2RlICpub2RlLCB1aW50OF90DQo+IGVsZV9pZHgsDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50 MzJfdCBtb2RlbF9pZCkNCj4gPiArew0KPiA+ICsgICAgICAgc3RydWN0IG1lc2hfZWxlbWVudCAq ZWxlOw0KPiA+ICsgICAgICAgR0xpc3QgKmw7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFub2Rl KQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gTlVMTDsNCj4gPiArDQo+ID4gKyAgICAgICBs ID0gZ19saXN0X2ZpbmRfY3VzdG9tKG5vZGUtPmVsZW1lbnRzLA0KPiBHVUlOVF9UT19QT0lOVEVS KGVsZV9pZHgpLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF0Y2hfZWxl bWVudF9pZHgpOw0KPiA+ICsgICAgICAgaWYgKCFsKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1 cm4gTlVMTDsNCj4gPiArDQo+ID4gKyAgICAgICBlbGUgPSBsLT5kYXRhOw0KPiA+ICsNCj4gPiAr ICAgICAgIGwgPSBnX2xpc3RfZmluZF9jdXN0b20oZWxlLT5tb2RlbHMsIEdVSU5UX1RPX1BPSU5U RVIobW9kZWxfaWQpLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF0Y2hf bW9kZWxfaWQpOw0KPiA+ICsgICAgICAgaWYgKCFsKQ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PiA+ICsjaW5jbHVkZSAicHJvdi1kYi5oIg0KPiA+ICsjaW5jbHVkZSAidXRp bC5oIg0KPiA+ICsjaW5jbHVkZSAib25vZmYtbW9kZWwuaCINCj4gPiArDQo+ID4gK3N0YXRpYyB1 aW50OF90IHRyYW5zX2lkOw0KPiA+ICtzdGF0aWMgdWludDE2X3Qgb25vZmZfYXBwX2lkeCA9IEFQ UF9JRFhfSU5WQUxJRDsNCj4gPiArDQo+ID4gK3N0YXRpYyBpbnQgY2xpZW50X2JpbmQodWludDE2 X3QgYXBwX2lkeCwgaW50IGFjdGlvbikNCj4gPiArew0KPiA+ICsgICAgICAgaWYgKGFjdGlvbiA9 PSBBQ1RJT05fQUREKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChvbm9mZl9hcHBfaWR4ICE9 IEFQUF9JRFhfSU5WQUxJRCkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBN RVNIX1NUQVRVU19JTlNVRkZfUkVTT1VSQ0VTOw0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2Ug ew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG9ub2ZmX2FwcF9pZHggPSBhcHBfaWR4Ow0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50ZigiT24vT2ZmIGNsaWVudCBtb2Rl bDogbmV3IGJpbmRpbmcgJTQuNHhcbiIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcF9pZHgpOw0KPiA+ICsgICAg ICAgICAgICAgICB9DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICBp ZiAob25vZmZfYXBwX2lkeCA9PSBhcHBfaWR4KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IG9ub2ZmX2FwcF9pZHggPSBBUFBfSURYX0lOVkFMSUQ7DQo+ID4gKyAgICAgICB9DQo+ID4gKyAg ICAgICByZXR1cm4gTUVTSF9TVEFUVVNfU1VDQ0VTUzsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3Rh dGljIHZvaWQgcHJpbnRfcmVtYWluaW5nX3RpbWUodWludDhfdCByZW1haW5pbmdfdGltZSkNCj4g PiArew0KPiA+ICsgICAgICAgdWludDhfdCBzdGVwID0gKHJlbWFpbmluZ190aW1lICYgMHhjMCkg Pj4gNjsNCj4gPiArICAgICAgIHVpbnQ4X3QgY291bnQgPSByZW1haW5pbmdfdGltZSAmIDB4M2Y7 DQo+ID4gKyAgICAgICBpbnQgc2VjcyA9IDAsIG1zZWNzID0gMCwgbWludXRlcyA9IDAsIGhvdXJz ID0gMDsNCj4gPiArDQo+ID4gKyAgICAgICBzd2l0Y2ggKHN0ZXApIHsNCj4gPiArICAgICAgIGNh c2UgMDoNCj4gPiArICAgICAgICAgICAgICAgbXNlY3MgPSAxMDAgKiBjb3VudDsNCj4gPiArICAg ICAgICAgICAgICAgc2VjcyA9IG1zZWNzIC8gNjA7DQo+ID4gKyAgICAgICAgICAgICAgIG1zZWNz IC09IChzZWNzICogNjApOw0KPiA+ICsgICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAg IGNhc2UgMToNCj4gPiArICAgICAgICAgICAgICAgc2VjcyA9IDEgKiBjb3VudDsNCj4gPiArICAg ICAgICAgICAgICAgbWludXRlcyA9IHNlY3MgLyA2MDsNCj4gPiArICAgICAgICAgICAgICAgc2Vj cyAtPSAobWludXRlcyAqIDYwKTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKw0K PiA+ICsgICAgICAgY2FzZSAyOg0KPiA+ICsgICAgICAgICAgICAgICBzZWNzID0gMTAgKiBjb3Vu dDsNCj4gPiArICAgICAgICAgICAgICAgbWludXRlcyA9IHNlY3MgLyA2MDsNCj4gPiArICAgICAg ICAgICAgICAgc2VjcyAtPSAobWludXRlcyAqIDYwKTsNCj4gPiArICAgICAgICAgICAgICAgYnJl YWs7DQo+ID4gKyAgICAgICBjYXNlIDM6DQo+ID4gKyAgICAgICAgICAgICAgIG1pbnV0ZXMgPSAx MCAqIGNvdW50Ow0KPiA+ICsgICAgICAgICAgICAgICBob3VycyA9IG1pbnV0ZXMgLyA2MDsNCj4g PiArICAgICAgICAgICAgICAgbWludXRlcyAtPSAoaG91cnMgKiA2MCk7DQo+ID4gKyAgICAgICAg ICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgIGRlZmF1bHQ6DQo+ID4gKyAgICAgICAg ICAgICAgIGJyZWFrOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHJsX3ByaW50 ZigiXG5cdFx0UmVtYWluaW5nIHRpbWU6ICVkIGhycyAlZCBtaW5zICVkIHNlY3MgJWQNCj4gbXNl Y3NcbiIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgaG91cnMsIG1pbnV0ZXMsIHNlY3MsIG1zZWNzKTsNCj4gPiArDQo+ID4gK30NCj4gPiArDQo+ ID4gK3N0YXRpYyBib29sIGNsaWVudF9tc2dfcmVjdmQodWludDE2X3Qgc3JjLCB1aW50OF90ICpk YXRhLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDE2X3QgbGVuLCB2 b2lkICp1c2VyX2RhdGEpDQo+ID4gK3sNCj4gPiArICAgICAgIHVpbnQzMl90IG9wY29kZTsNCj4g PiArICAgICAgIGludCBuOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChtZXNoX29wY29kZV9nZXQo ZGF0YSwgbGVuLCAmb3Bjb2RlLCAmbikpIHsNCj4gPiArICAgICAgICAgICAgICAgbGVuIC09IG47 DQo+ID4gKyAgICAgICAgICAgICAgIGRhdGEgKz0gbjsNCj4gPiArICAgICAgIH0gZWxzZQ0KPiA+ ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgcmxfcHJp bnRmKCJPbiBPZmYgTW9kZWwgTWVzc2FnZSByZWNlaXZlZCAoJWQpIG9wY29kZSAleFxuIiwNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgbGVuLCBvcGNvZGUpOw0KPiA+ICsgICAgICAgcHJpbnRfYnl0ZV9hcnJheSgiXHQi LGRhdGEsIGxlbik7DQo+ID4gKw0KPiA+ICsgICAgICAgc3dpdGNoIChvcGNvZGUgJiB+T1BfVU5S RUxJQUJMRSkgew0KPiA+ICsgICAgICAgZGVmYXVsdDoNCj4gPiArICAgICAgICAgICAgICAgcmV0 dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGNhc2UgT1BfR0VORVJJQ19PTk9GRl9TVEFU VVM6DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChsZW4gIT0gMSAmJiBsZW4gIT0gMykNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg IHJsX3ByaW50ZigiTm9kZSAlNC40eDogT2ZmIFN0YXR1cyBwcmVzZW50ID0gJXMiLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYywgZGF0YVsw XSA/ICJPTiIgOiAiT0ZGIik7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAobGVuID09 IDMpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIiwgdGFyZ2V0ID0g JXMiLCBkYXRhWzFdID8gIk9OIiA6ICJPRkYiKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICBwcmludF9yZW1haW5pbmdfdGltZShkYXRhWzJdKTsNCj4gPiArICAgICAgICAgICAgICAgfSBl bHNlDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJcbiIpOw0KPiA+ICsg ICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBy ZXR1cm4gdHJ1ZTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArDQo+ID4gK3N0YXRpYyB1aW50MzJfdCB0 YXJnZXQ7DQo+ID4gK3N0YXRpYyB1aW50MzJfdCBwYXJtc1s4XTsNCj4gPiArDQo+ID4gK3N0YXRp YyB1aW50MzJfdCByZWFkX2lucHV0X3BhcmFtZXRlcnMoY29uc3QgY2hhciAqYXJncykNCj4gPiAr ew0KPiA+ICsgICAgICAgdWludDMyX3QgaTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIWFyZ3Mp DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiAwOw0KPiA+ICsNCj4gPiArICAgICAgIG1lbXNl dChwYXJtcywgMHhmZiwgc2l6ZW9mKHBhcm1zKSk7DQo+ID4gKw0KPiA+ICsgICAgICAgZm9yIChp ID0gMDsgaSA8IHNpemVvZihwYXJtcykvc2l6ZW9mKHBhcm1zWzBdKTsgaSsrKSB7DQo+ID4gKyAg ICAgICAgICAgICAgIGludCBuOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgc3NjYW5mKGFy Z3MsICIleCIsICZwYXJtc1tpXSk7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChwYXJtc1tpXSA9 PSAweGZmZmZmZmZmKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgbiA9IHN0cmNzcG4oYXJncywgIiBcdCIpOw0KPiA+ICsgICAg ICAgICAgICAgICBhcmdzID0gYXJncyArIG4gKyBzdHJzcG4oYXJncyArIG4sICIgXHQiKTsNCj4g PiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gaTsNCj4gPiArfQ0KPiA+ICsN Cj4gPiArc3RhdGljIHZvaWQgY21kX3NldF9ub2RlKGNvbnN0IGNoYXIgKmFyZ3MpDQo+ID4gK3sN Cj4gPiArICAgICAgIHVpbnQzMl90IGRzdDsNCj4gPiArICAgICAgIGNoYXIgKmVuZDsNCj4gPiAr DQo+ID4gKyAgICAgICBkc3QgPSBzdHJ0b2woYXJncywgJmVuZCwgMTYpOw0KPiA+ICsgICAgICAg aWYgKGVuZCAhPSAoYXJncyArIDQpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50Zigi QmFkIHVuaWNhc3QgYWRkcmVzcyAlczogIg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICJleHBlY3RlZCBmb3JtYXQgNCBkaWdpdCBoZXhcbiIsDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYXJncyk7DQo+ID4gKyAgICAgICAgICAgICAgIHRh cmdldCA9IFVOQVNTSUdORURfQUREUkVTUzsNCj4gPiArICAgICAgIH0gZWxzZSB7DQo+ID4gKyAg ICAgICAgICAgICAgIHJsX3ByaW50ZigiQ29udHJvbGxpbmcgT04vT0ZGIGZvciBub2RlICU0LjR4 XG4iLCBkc3QpOw0KPiA+ICsgICAgICAgICAgICAgICB0YXJnZXQgPSBkc3Q7DQo+ID4gKyAgICAg ICAgICAgICAgIHNldF9tZW51X3Byb21wdCgib24vb2ZmIiwgYXJncyk7DQo+ID4gKyAgICAgICB9 DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBib29sIHNlbmRfY21kKHVpbnQ4X3QgKmJ1Ziwg dWludDE2X3QgbGVuKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBzdHJ1Y3QgbWVzaF9ub2RlICpub2Rl ID0gbm9kZV9nZXRfbG9jYWxfbm9kZSgpOw0KPiA+ICsgICAgICAgdWludDhfdCB0dGw7DQo+ID4g Kw0KPiA+ICsgICAgICAgaWYoIW5vZGUpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxz ZTsNCj4gPiArDQo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w0KPiA+ICtzdGF0 aWMgdm9pZCBjbWRfc2V0KGNvbnN0IGNoYXIgKmFyZ3MpDQo+ID4gK3sNCj4gPiArICAgICAgIHVp bnQxNl90IG47DQo+ID4gKyAgICAgICB1aW50OF90IG1zZ1szMl07DQo+ID4gKyAgICAgICBzdHJ1 Y3QgbWVzaF9ub2RlICpub2RlOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChJU19VTkFTU0lHTkVE KHRhcmdldCkpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJEZXN0aW5hdGlvbiBu b3Qgc2V0XG4iKTsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsgICAgICAgfQ0K PiA+ICsNCj4gPiArICAgICAgIG5vZGUgPSBub2RlX2ZpbmRfYnlfYWRkcih0YXJnZXQpOw0KPiA+ ICsNCj4gPiArICAgICAgIGlmICghbm9kZSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0K PiA+ICsNCj4gPiArICAgICAgIGlmICgocmVhZF9pbnB1dF9wYXJhbWV0ZXJzKGFyZ3MpICE9IDEp ICYmDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcm1zWzBd ICE9IDAgJiYgcGFybXNbMF0gIT0gMSkgew0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYo IkJhZCBhcmd1bWVudHMgJXMuIEV4cGVjdGluZyBcIjBcIiBvciBcIjFcIlxuIiwgYXJncyk7DQo+ ID4gKyAgICAgICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAg ICAgICBuID0gbWVzaF9vcGNvZGVfc2V0KE9QX0dFTkVSSUNfT05PRkZfU0VULCBtc2cpOw0KPiA+ ICsgICAgICAgbXNnW24rK10gPSBwYXJtc1swXTsNCj4gPiArICAgICAgIG1zZ1tuKytdID0gdHJh bnNfaWQrKzsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoIXNlbmRfY21kKG1zZywgbikpDQo+ID4g KyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiRmFpbGVkIHRvIHNlbmQgXCJHRU5FUklDIE9OL09G RiBTRVRcIlxuIik7DQo+ID4gKw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBjbWRf YmFjayhjb25zdCBjaGFyICphcmdzKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjbWRfbWVudV9tYWlu KGZhbHNlKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgY21kX2hlbHAoY29uc3Qg Y2hhciAqYXJncyk7DQo+ID4gKw0KPiA+ICtzdGF0aWMgY29uc3Qgc3RydWN0IG1lbnVfZW50cnkg Y2ZnX21lbnVbXSA9IHsNCj4gPiArICAgICAgIHsidGFyZ2V0IiwgICAgICAgICAgICAgICI8dW5p Y2FzdD4iLCAgICAgICAgICAgICAgICAgICAgY21kX3NldF9ub2RlLA0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTZXQgbm9kZSB0byBjb25maWd1 cmUifSwNCj4gPiArICAgICAgIHsiZ2V0IiwgICAgICAgICAgICAgICAgIE5VTEwsICAgICAgICAg ICAgICAgICAgICAgICAgICAgY21kX2dldF9zdGF0dXMsDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkdldCBPTi9PRkYgc3RhdHVzIn0sDQo+ID4g KyAgICAgICB7Im9ub2ZmIiwgICAgICAgICAgICAgICAiPDAvMT4iLCAgICAgICAgICAgICAgICAg ICAgICAgIGNtZF9zZXQsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIlNlbmQgXCJTRVQgT04vT0ZGXCIgY29tbWFuZCJ9LA0KPiA+ICsgICAgICAg eyJiYWNrIiwgICAgICAgICAgICAgICAgTlVMTCwgICAgICAgICAgICAgICAgICAgICAgICAgICBj bWRfYmFjaywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAiQmFjayB0byBtYWluIG1lbnUifSwNCj4gPiArICAgICAgIHsiaGVscCIsICAgICAgICAg ICAgICAgIE5VTEwsICAgICAgICAgICAgICAgICAgICAgICAgICAgY21kX2hlbHAsDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvbmZpZyBDb21t YW5kcyJ9LA0KPiA+ICsgICAgICAge30NCj4gPiArfTsNCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lk IGNtZF9oZWxwKGNvbnN0IGNoYXIgKmFyZ3MpDQo+ID4gK3sNCj4gPiArICAgICAgIHJsX3ByaW50 ZigiQ2xpZW50IENvbmZpZ3VyYXRpb24gTWVudVxuIik7DQo+ID4gKyAgICAgICBwcmludF9jbWRf bWVudShjZmdfbWVudSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3ZvaWQgb25vZmZfc2V0X25vZGUo Y29uc3QgY2hhciAqYXJncykgew0KPiA+ICsgICAgICAgY21kX3NldF9ub2RlKGFyZ3MpOw0KPiA+ ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgc3RydWN0IG1lc2hfbW9kZWxfb3BzIGNsaWVudF9jYnMg PSB7DQo+ID4gKyAgICAgICBjbGllbnRfbXNnX3JlY3ZkLA0KPiA+ICsgICAgICAgY2xpZW50X2Jp bmQsDQo+ID4gKyAgICAgICBOVUxMLA0KPiA+ICsgICAgICAgTlVMTA0KPiA+ICt9Ow0KPiA+ICsN Cj4gPiArYm9vbCBvbm9mZl9jbGllbnRfaW5pdCh1aW50OF90IGVsZSkNCj4gPiArew0KPiA+ICsg ICAgICAgaWYgKCFub2RlX2xvY2FsX21vZGVsX3JlZ2lzdGVyKGVsZSwNCj4gR0VORVJJQ19PTk9G Rl9DTElFTlRfTU9ERUxfSUQsDQo+ID4gKy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o7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFmaWxlbmFtZSkNCj4g PiArICAgICAgICAgICAgICAgcmV0dXJuIE5VTEw7DQo+ID4gKw0KPiA+ICsgICAgICAgZmQgPSBv cGVuKGZpbGVuYW1lLE9fUkRPTkxZKTsNCj4gPiArICAgICAgIGlmICghZmQpDQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChmc3RhdChmZCwg JnN0KSA9PSAtMSkgew0KPiA+ICsgICAgICAgICAgICAgICBjbG9zZShmZCk7DQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAg IHN0ciA9IChjaGFyICopIGdfbWFsbG9jMChzdC5zdF9zaXplICsgMSk7DQo+ID4gKyAgICAgICBp ZiAoIXN0cikgew0KPiA+ICsgICAgICAgICAgICAgICBjbG9zZShmZCk7DQo+ID4gKyAgICAgICAg ICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHN6 ID0gcmVhZChmZCwgc3RyLCBzdC5zdF9zaXplKTsNCj4gPiArICAgICAgIGlmIChzeiAhPSBzdC5z dF9zaXplKQ0KPiA+ICsgICAgICAgICAgICAgICBybF9wcmludGYoIkluY29tcGxldGUgcmVhZDog JWQgdnMgJWRcbiIsIChpbnQpc3osDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KShzdC5zdF9zaXplKSk7DQo+ID4gKw0KPiA+ ICsgICAgICAgY2xvc2UoZmQpOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiBzdHI7DQo+ID4g K30NCj4gPiArDQo+ID4gK3N0YXRpYyB2b2lkIHByb3ZfZmlsZV93cml0ZShqc29uX29iamVjdCAq am1haW4sIGJvb2wgbG9jYWwpDQo+ID4gK3sNCj4gPiArICAgICAgIEZJTEUgKm91dGZpbGU7DQo+ ID4gKyAgICAgICBjb25zdCBjaGFyICpvdXRfc3RyOw0KPiA+ICsgICAgICAgY29uc3QgY2hhciAq b3V0X2ZpbGVuYW1lOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChsb2NhbCkNCj4gPiArICAgICAg ICAgICAgICAgb3V0X2ZpbGVuYW1lID0gbG9jYWxfZmlsZW5hbWU7DQo+ID4gKyAgICAgICBlbHNl DQo+ID4gKyAgICAgICAgICAgICAgIG91dF9maWxlbmFtZSA9IHByb3ZfZmlsZW5hbWU7DQo+ID4g Kw0KPiA+ICsgICAgICAgb3V0ZmlsZSA9IGZvcGVuKG91dF9maWxlbmFtZSwgIndyIik7DQo+ID4g KyAgICAgICBpZiAoIW91dGZpbGUpIHsNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJG YWlsZWQgdG8gb3BlbiBmaWxlICVzIGZvciB3cml0aW5nXG4iLCBvdXRfZmlsZW5hbWUpOw0KPiA+ ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAg ICAgb3V0X3N0ciA9IGpzb25fb2JqZWN0X3RvX2pzb25fc3RyaW5nX2V4dChqbWFpbiwNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKU09OX0NfVE9f U1RSSU5HX1BSRVRUWSk7DQo+ID4gKw0KPiA+ICsgICAgICAgZndyaXRlKG91dF9zdHIsIHNpemVv ZihjaGFyKSwgc3RybGVuKG91dF9zdHIpLCBvdXRmaWxlKTsNCj4gPiArICAgICAgIGZjbG9zZShv dXRmaWxlKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgcHV0X3VpbnQxNihqc29u X29iamVjdCAqam9iamVjdCwgY29uc3QgY2hhciAqZGVzYywgdWludDE2X3QNCj4gdmFsdWUpDQo+ ID4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DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHTGlz dCAqaWR4cykNCj4gPiArew0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmphcnJheTsNCj4gPiAr DQo+ID4gKyAgICAgICBqYXJyYXkgPSBqc29uX29iamVjdF9uZXdfYXJyYXkoKTsNCj4gPiArDQo+ ID4gKyAgICAgICBwdXRfdWludDE2X2xpc3QoamFycmF5LCBpZHhzKTsNCj4gPiArDQo+ID4gKyAg ICAgICBqc29uX29iamVjdF9vYmplY3RfYWRkKGpub2RlLCBkZXNjLCBqYXJyYXkpOw0KPiA+ICt9 DQo+ID4gKw0KPiA+ICtzdGF0aWMgYm9vbCBwYXJzZV91bmljYXN0X3JhbmdlKGpzb25fb2JqZWN0 ICpqb2JqZWN0KQ0KPiA+ICt7DQo+ID4gKyAgICAgICBpbnQgY250Ow0KPiA+ICsgICAgICAgaW50 IGk7DQo+ID4gKw0KPiA+ICsgICAgICAgY250ID0ganNvbl9vYmplY3RfYXJyYXlfbGVuZ3RoKGpv YmplY3QpOw0KPiA+ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBjbnQ7ICsraSkgew0K PiA+ICsgICAgICAgICAgICAgICBqc29uX29iamVjdCAqanJhbmdlOw0KPiA+ICsgICAgICAgICAg ICAgICBqc29uX29iamVjdCAqanZhbHVlOw0KPiA+ICsgICAgICAgICAgICAgICB1aW50MTZfdCBs b3csIGhpZ2g7DQo+ID4gKyAgICAgICAgICAgICAgIGNoYXIgKnN0cjsNCj4gPiArDQo+ID4gKyAg ICAgICAgICAgICAgIGpyYW5nZSA9IGpzb25fb2JqZWN0X2FycmF5X2dldF9pZHgoam9iamVjdCwg aSk7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoanJhbmdl LCAibG93QWRkcmVzcyIsICZqdmFsdWUpOw0KPiA+ICsgICAgICAgICAgICAgICBzdHIgPSAoY2hh ciAqKWpzb25fb2JqZWN0X2dldF9zdHJpbmcoanZhbHVlKTsNCj4gPiArICAgICAgICAgICAgICAg aWYgKHNzY2FuZihzdHIsICIlMDRoeCIsICZsb3cpICE9IDEpDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAganNvbl9v YmplY3Rfb2JqZWN0X2dldF9leChqcmFuZ2UsICJoaWdoQWRkcmVzcyIsICZqdmFsdWUpOw0KPiA+ ICsgICAgICAgICAgICAgICBzdHIgPSAoY2hhciAqKWpzb25fb2JqZWN0X2dldF9zdHJpbmcoanZh bHVlKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKHNzY2FuZihzdHIsICIlMDRoeCIsICZoaWdo KSAhPSAxKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiAr DQo+ID4gKyAgICAgICAgICAgICAgIGlmKGhpZ2ggPCBsb3cpDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgbmV0X2Fk ZF9hZGRyZXNzX3Bvb2wobG93LCBoaWdoKTsNCj4gPiArICAgICAgIH0NCj4gPiArICAgICAgIHJl dHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgaW50IHBhcnNlX25vZGVfa2V5 cyhzdHJ1Y3QgbWVzaF9ub2RlICpub2RlLCBqc29uX29iamVjdCAqamlkeHMsDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2FwcF9rZXkpDQo+ID4gK3sNCj4gPiAr ICAgICAgIGludCBpZHhfY250Ow0KPiA+ICsgICAgICAgaW50IGk7DQo+ID4gKw0KPiA+ICsgICAg ICAgaWR4X2NudCA9IGpzb25fb2JqZWN0X2FycmF5X2xlbmd0aChqaWR4cyk7DQo+ID4gKyAgICAg ICBmb3IgKGkgPSAwOyBpIDwgaWR4X2NudDsgKytpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGlu dCBpZHg7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0ICpqdmFsdWU7DQo+ID4gKw0K PiA+ICsgICAgICAgICAgICAgICBqdmFsdWUgPSBqc29uX29iamVjdF9hcnJheV9nZXRfaWR4KGpp ZHhzLCBpKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFqdmFsdWUpDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICAgICAgICAgIGlkeCA9IGpzb25fb2Jq ZWN0X2dldF9pbnQoanZhbHVlKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFDSEVDS19LRVlf SURYX1JBTkdFKGlkeCkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4g Kw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoaXNfYXBwX2tleSkNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICBub2RlX2FwcF9rZXlfYWRkKG5vZGUsIGlkeCk7DQo+ID4gKyAgICAgICAgICAg ICAgIGVsc2UNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBub2RlX25ldF9rZXlfYWRkKG5v ZGUsIGlkeCk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIGk7DQo+ ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBib29sIHBhcnNlX2NvbXBvc2l0aW9uX21vZGVscyhz dHJ1Y3QgbWVzaF9ub2RlICpub2RlLCBpbnQNCj4gaW5kZXgsDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25fb2JqZWN0ICpqbW9kZWxzKQ0KPiA+ICt7DQo+ ID4gKyAgICAgICBpbnQgbW9kZWxfY250Ow0KPiA+ICsgICAgICAgaW50IGk7DQo+ID4gKw0KPiA+ ICsgICAgICAgbW9kZWxfY250ID0ganNvbl9vYmplY3RfYXJyYXlfbGVuZ3RoKGptb2RlbHMpOw0K PiA+ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBtb2RlbF9jbnQ7ICsraSkgew0KPiA+ ICsgICAgICAgICAgICAgICBqc29uX29iamVjdCAqam1vZGVsOw0KPiA+ICsgICAgICAgICAgICAg ICBjaGFyICpzdHI7DQo+ID4gKyAgICAgICAgICAgICAgIHVpbnQzMl90IG1vZGVsX2lkOw0KPiA+ ICsgICAgICAgICAgICAgICBpbnQgbGVuOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgam1v ZGVsID0ganNvbl9vYmplY3RfYXJyYXlfZ2V0X2lkeChqbW9kZWxzLCBpKTsNCj4gPiArICAgICAg ICAgICAgICAgc3RyID0gKGNoYXIgKilqc29uX29iamVjdF9nZXRfc3RyaW5nKGptb2RlbCk7DQo+ ID4gKyAgICAgICAgICAgICAgIGxlbiA9IHN0cmxlbihzdHIpOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgaWYgKGxlbiAhPSA0ICYmIGxlbiAhPSA4KQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChzc2Nh bmYoc3RyLCAiJTA4eCIsICZtb2RlbF9pZCkgIT0gMSkNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChsZW4gPT0gNCkNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBtb2RlbF9pZCArPSAweGZmZmYwMDAwOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgbm9kZV9zZXRfbW9kZWwobm9kZSwgaW5kZXgsIG1vZGVsX2lk KTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiAr fQ0KPiA+ICsNCj4gPiArc3RhdGljIGJvb2wgcGFyc2VfY29tcG9zaXRpb25fZWxlbWVudHMoc3Ry dWN0IG1lc2hfbm9kZSAqbm9kZSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAganNvbl9vYmplY3QgKmplbGVtZW50cykNCj4gPiArew0KPiA+ICsgICAgICAgaW50 IGVsX2NudDsNCj4gPiArICAgICAgIGludCBpOw0KPiA+ICsNCj4gPiArICAgICAgIGVsX2NudCA9 IGpzb25fb2JqZWN0X2FycmF5X2xlbmd0aChqZWxlbWVudHMpOw0KPiA+ICsgICAgICAgbm9kZV9z ZXRfbnVtX2VsZW1lbnRzKG5vZGUsIGVsX2NudCk7DQo+ID4gKw0KPiA+ICsgICAgICAgZm9yIChp ID0gMDsgaSA8IGVsX2NudDsgKytpKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0 ICpqZWxlbWVudDsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmptb2RlbHM7DQo+ ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0ICpqdmFsdWU7DQo+ID4gKyAgICAgICAgICAg ICAgIGludCBpbmRleDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGplbGVtZW50ID0ganNv bl9vYmplY3RfYXJyYXlfZ2V0X2lkeChqZWxlbWVudHMsIGkpOw0KPiA+ICsgICAgICAgICAgICAg ICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGplbGVtZW50LCAiZWxlbWVudEluZGV4IiwgJmp2 YWx1ZSk7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChqdmFsdWUpIHsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBpbmRleCA9IGpzb25fb2JqZWN0X2dldF9pbnQoanZhbHVlKTsNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggPj0gZWxfY250KSB7DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2UNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBp ZiAoIW5vZGVfc2V0X2VsZW1lbnQobm9kZSwgaW5kZXgpKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2Jq ZWN0X29iamVjdF9nZXRfZXgoamVsZW1lbnQsICJtb2RlbHMiLCAmam1vZGVscyk7DQo+ID4gKyAg ICAgICAgICAgICAgIGlmICgham1vZGVscykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBj b250aW51ZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmKCFwYXJzZV9jb21wb3NpdGlv bl9tb2RlbHMobm9kZSwgaW5kZXgsIGptb2RlbHMpKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAgIH0NCj4gPiArICAgICAgIHJldHVybiB0cnVl Ow0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgYm9vbCBwYXJzZV9tb2RlbF9wdWIoc3RydWN0 IG1lc2hfbm9kZSAqbm9kZSwgaW50IGVsZV9pZHgsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICB1aW50MzJfdCBtb2RlbF9pZCwganNvbl9vYmplY3QgKmpwdWIpDQo+ID4gK3sN Cj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqdmFsdWU7DQo+ID4gKyAgICAgICBzdHJ1Y3QgbWVz aF9wdWJsaWNhdGlvbiBwdWI7DQo+ID4gKyAgICAgICBjaGFyICpzdH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Sk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFub2RlX21vZGVsX3B1Yl9z ZXQobm9kZSwgZWxlX2lkeCwgbW9kZWxfaWQsICZwdWIpKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsNCj4g PiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIGJvb2wgcGFyc2VfYmluZGluZ3Moc3RydWN0IG1lc2hf bm9kZSAqbm9kZSwgaW50IGVsZV9pZHgsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICB1aW50MzJfdCBtb2RlbF9pZCwganNvbl9vYmplY3QgKmpiaW5kaW5ncykNCj4gPiArew0K PiA+ICsgICAgICAgaW50IGNudDsNCj4gPiArICAgICAgIGludCBpOw0KPiA+ICsNCj4gPiArICAg ICAgIGNudCA9IGpzb25fb2JqZWN0X2FycmF5X2xlbmd0aChqYmluZGluZ3MpOw0KPiA+ICsNCj4g PiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBjbnQ7ICsraSkgew0KPiA+ICsgICAgICAgICAgICAg ICBpbnQga2V5X2lkeDsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmp2YWx1ZTsN Cj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGp2YWx1ZSA9IGpzb25fb2JqZWN0X2FycmF5X2dl dF9pZHgoamJpbmRpbmdzLCBpKTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFqdmFsdWUpDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICBrZXlfaWR4ID0ganNvbl9vYmplY3RfZ2V0X2ludChqdmFsdWUpOw0KPiA+ICsg ICAgICAgICAgICAgICBpZiAoIUNIRUNLX0tFWV9JRFhfUkFOR0Uoa2V5X2lkeCkpDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgaWYgKCFub2RlX2FkZF9iaW5kaW5nKG5vZGUsIGVsZV9pZHgsIG1vZGVsX2lkLCBrZXlf aWR4KSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAg ICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4gPiArDQo+ ID4gK3N0YXRpYyBib29sIHBhcnNlX2NvbmZpZ3VyYXRpb25fbW9kZWxzKHN0cnVjdCBtZXNoX25v ZGUgKm5vZGUsIGludA0KPiBlbGVfaWR4LA0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29iamVj dCAqam1vZGVscywgdWludDMyX3QgdGFyZ2V0X2lkLCBqc29uX29iamVjdCAqKmp0YXJnZXQpDQo+ ID4gK3sNCj4gPiArICAgICAgIGludCBtb2RlbF9jbnQ7DQo+ID4gKyAgICAgICBpbnQgaTsNCj4g PiArDQo+ID4gKyAgICAgICBpZiAoanRhcmdldCkNCj4gPiArICAgICAgICAgICAgICAgKmp0YXJn ZXQgPSBOVUxMOw0KPiA+ICsNCj4gPiArICAgICAgIG1vZGVsX2NudCA9IGpzb25fb2JqZWN0X2Fy cmF5X2xlbmd0aChqbW9kZWxzKTsNCj4gPiArDQo+ID4gKyAgICAgICBmb3IgKGkgPSAwOyBpIDwg bW9kZWxfY250OyArK2kpIHsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmptb2Rl bDsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmp2YWx1ZTsNCj4gPiArICAgICAg ICAgICAgICAganNvbl9vYmplY3QgKmphcnJheTsNCj4gPiArICAgICAgICAgICAgICAgY2hhciAq c3RyOw0KPiA+ICsgICAgICAgICAgICAgICBpbnQgbGVuOw0KPiA+ICsgICAgICAgICAgICAgICB1 aW50MzJfdCBtb2RlbF9pZDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGptb2RlbCA9IGpz b25fb2JqZWN0X2FycmF5X2dldF9pZHgoam1vZGVscywgaSk7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGptb2RlbCwgIm1vZGVsSWQiLCAmanZh bHVlKTsNCj4gPiArICAgICAgICAgICAgICAgc3RyID0gKGNoYXIgKilqc29uX29iamVjdF9nZXRf c3RyaW5nKGp2YWx1ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBsZW4gPSBzdHJsZW4o c3RyKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChsZW4gIT0gNCAmJiBsZW4gIT0g OCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ ICsgICAgICAgICAgICAgICBpZiAoc3NjYW5mKHN0ciwgIiUwOHgiLCAmbW9kZWxfaWQpICE9IDEp DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsgICAgICAg ICAgICAgICBpZiAobGVuID09IDQpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgbW9kZWxf aWQgKz0gMHhmZmZmMDAwMDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChqdGFyZ2V0 ICYmIG1vZGVsX2lkID09IHRhcmdldF9pZCkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICpqdGFyZ2V0ID0gam1vZGVsOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0 cnVlOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBq c29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGptb2RlbCwgImJpbmQiLCAmamFycmF5KTsNCj4gPiAr ICAgICAgICAgICAgICAgaWYgKGphcnJheSAmJiAhcGFyc2VfYmluZGluZ3Mobm9kZSwgZWxlX2lk eCwgbW9kZWxfaWQsIGphcnJheSkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJu IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dl dF9leChqbW9kZWwsICJwdWJsaXNoIiwgJmp2YWx1ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICBpZiAoanZhbHVlICYmICFwYXJzZV9tb2RlbF9wdWIobm9kZSwgZWxlX2lkeCwgbW9kZWxf aWQsIGp2YWx1ZSkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0K PiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ ID4gKw0KPiA+ICtzdGF0aWMgYm9vbCBwYXJzZV9jb25maWd1cmF0aW9uX2VsZW1lbnRzKHN0cnVj dCBtZXNoX25vZGUgKm5vZGUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBq c29uX29iamVjdCAqamVsZW1lbnRzLCBib29sIGxvY2FsKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBp bnQgZWxfY250Ow0KPiA+ICsgICAgICAgaW50IGk7DQo+ID4gKw0KPiA+ICsgICAgICAgZWxfY250 ID0ganNvbl9vYmplY3RfYXJyYXlfbGVuZ3RoKGplbGVtZW50cyk7DQo+ID4gKyAgICAgICBub2Rl X3NldF9udW1fZWxlbWVudHMobm9kZSwgZWxfY250KTsNCj4gPiArDQo+ID4gKyAgICAgICBmb3Ig KGkgPSAwOyBpIDwgZWxfY250OyArK2kpIHsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmpl Y3QgKmplbGVtZW50Ow0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29iamVjdCAqam1vZGVsczsN Cj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmp2YWx1ZTsNCj4gPiArICAgICAgICAg ICAgICAgaW50IGluZGV4Ow0KPiA+ICsgICAgICAgICAgICAgICB1aW50MTZfdCBhZGRyOw0KPiA+ ICsNCj4gPiArICAgICAgICAgICAgICAgamVsZW1lbnQgPSBqc29uX29iamVjdF9hcnJheV9nZXRf aWR4KGplbGVtZW50cywgaSk7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVj dF9nZXRfZXgoamVsZW1lbnQsICJlbGVtZW50SW5kZXgiLCAmanZhbHVlKTsNCj4gPiArICAgICAg ICAgICAgICAgaWYgKGp2YWx1ZSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGluZGV4 ID0ganNvbl9vYmplY3RfZ2V0X2ludChqdmFsdWUpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIGlmIChpbmRleCA+PSBlbF9jbnQpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9DQo+ID4g KyAgICAgICAgICAgICAgIH0gZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVy biBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmIChpbmRleCA9PSAwKSB7DQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqc3RyOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGplbGVtZW50LCAidW5p Y2FzdEFkZHJlc3MiLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgJmp2YWx1ZSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg c3RyID0gKGNoYXIgKilqc29uX29iamVjdF9nZXRfc3RyaW5nKGp2YWx1ZSk7DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgaWYgKHNzY2FuZihzdHIsICIlMDRoeCIsICZhZGRyKSAhPSAxKQ0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWxvY2FsICYmICFuZXRfcmVzZXJ2ZV9h ZGRyZXNzX3JhbmdlKGFkZHIsIGVsX2NudCkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IG5vZGVfc2V0X3ByaW1hcnkobm9kZSwgYWRkcik7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4g PiArDQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoamVsZW1l bnQsICJtb2RlbHMiLCAmam1vZGVscyk7DQo+ID4gKyAgICAgICAgICAgICAgIGlmICgham1vZGVs cykNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsNCj4gPiArDQo+ID4gKyAg ICAgICAgICAgICAgIGlmKCFwYXJzZV9jb25maWd1cmF0aW9uX21vZGVscyhub2RlLCBpbmRleCwg am1vZGVscywgMCwgTlVMTCkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZh bHNlOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4g PiArDQo+ID4gK3N0YXRpYyB2b2lkIGFkZF9rZXkoanNvbl9vYmplY3QgKmpvYmplY3QsIGNvbnN0 IGNoYXIgKmRlc2MsIHVpbnQ4X3QqIGtleSkNCj4gPiArew0KPiA+ICsgICAgICAganNvbl9vYmpl Y3QgKmpzdHJpbmc7DQo+ID4gKyAgICAgICBjaGFyIGhleHN0clszM107DQo+ID4gKw0KPiA+ICsg ICAgICAgaGV4MnN0cihrZXksIDE2LCBoZXhzdHIsIDMzKTsNCj4gPiArICAgICAgIGpzdHJpbmcg PSBqc29uX29iamVjdF9uZXdfc3RyaW5nKGhleHN0cik7DQo+ID4gKyAgICAgICBqc29uX29iamVj dF9vYmplY3RfYWRkKGpvYmplY3QsIGRlc2MsIGpzdHJpbmcpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ ICtzdGF0aWMganNvbl9vYmplY3QgKmZpbmRfbm9kZV9ieV9wcmltYXJ5KGpzb25fb2JqZWN0ICpq bWFpbiwgdWludDE2X3QNCj4gcHJpbWFyeSkNCj4gPiArew0KPiA+ICsgICAgICAganNvbl9vYmpl Y3QgKmphcnJheTsNCj4gPiArICAgICAgIGludCBpLCBsZW47DQo+ID4gKw0KPiA+ICsgICAgICAg anNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqbWFpbiwgIm5vZGVzIiwgJmphcnJheSk7DQo+ID4g Kw0KPiA+ICsgICAgICAgaWYgKCFqYXJyYXkpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBO VUxMOw0KPiA+ICsgICAgICAgbGVuID0ganNvbl9vYmplY3RfYXJyYXlfbGVuZ3RoKGphcnJheSk7 DQo+ID4gKw0KPiA+ICsgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgKytpKSB7DQo+ID4gKyAg ICAgICAgICAgICAgIGpzb25fb2JqZWN0ICpqbm9kZTsNCj4gPiArICAgICAgICAgICAgICAganNv bl9vYmplY3QgKmpjb25maWc7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0ICpqZWxl bWVudHM7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0ICpqZWxlbWVudDsNCj4gPiAr ICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmp2YWx1ZTsNCj4gPiArICAgICAgICAgICAgICAg Y2hhciAqc3RyOw0KPiA+ICsgICAgICAgICAgICAgICB1aW50MTZfdCBhZGRyOw0KPiA+ICsNCj4g PiArICAgICAgICAgICAgICAgam5vZGUgPSBqc29uX29iamVjdF9hcnJheV9nZXRfaWR4KGphcnJh eSwgaSk7DQo+ID4gKyAgICAgICAgICAgICAgIGlmICgham5vZGUpDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgcmV0dXJuIE5VTEw7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBqc29u X29iamVjdF9vYmplY3RfZ2V0X2V4KGpub2RlLCAiY29uZmlndXJhdGlvbiIsICZqY29uZmlnKTsN Cj4gPiArICAgICAgICAgICAgICAgaWYgKCFqY29uZmlnKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiBOVUxMOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmpl Y3Rfb2JqZWN0X2dldF9leChqY29uZmlnLCAiZWxlbWVudHMiLCAmamVsZW1lbnRzKTsNCj4gPiAr ICAgICAgICAgICAgICAgaWYgKCFqZWxlbWVudHMpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgcmV0dXJuIE5VTEw7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBqZWxlbWVudCA9IGpz b25fb2JqZWN0X2FycmF5X2dldF9pZHgoamVsZW1lbnRzLCAwKTsNCj4gPiArICAgICAgICAgICAg ICAgaWYgKCFqZWxlbWVudCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTlVM TDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgo amVsZW1lbnQsICJ1bmljYXN0QWRkcmVzcyIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZqdmFsdWUpOw0KPiA+ICsg ICAgICAgICAgICAgICBzdHIgPSAoY2hhciAqKWpzb25fb2JqZWN0X2dldF9zdHJpbmcoanZhbHVl KTsNCj4gPiArICAgICAgICAgICAgICAgaWYgKHNzY2FuZihzdHIsICIlMDRoeCIsICZhZGRyKSAh PSAxKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5VTEw7DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoYWRkciA9PSBwcmltYXJ5KQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIHJldHVybiBqbm9kZTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ ID4gKyAgICAgICByZXR1cm4gTlVMTDsNCj4gPiArDQo+ID4gK30NCj4gPiArDQo+ID4gK3ZvaWQg cHJvdl9kYl9wcmludF9ub2RlX2NvbXBvc2l0aW9uKHN0cnVjdCBtZXNoX25vZGUgKm5vZGUpDQo+ ID4gK3sNCj4gPiArICAgICAgIGNoYXIgKmluX3N0cjsNCj4gPiArICAgICAgIGNvbnN0IGNoYXIg KmNvbXBfc3RyOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmptYWluOw0KPiA+ICsgICAgICAg anNvbl9vYmplY3QgKmpub2RlOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmpjb21wOw0KPiA+ ICsgICAgICAgdWludDE2X3QgcHJpbWFyeSA9IG5vZGVfZ2V0X3ByaW1hcnkobm9kZSk7DQo+ID4g KyAgICAgICBjb25zdCBjaGFyICpmaWxlbmFtZTsNCj4gPiArICAgICAgIGJvb2wgcmVzID0gZmFs c2U7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFub2RlIHx8ICFub2RlX2dldF9jb21wb3NpdGlv bihub2RlKSkNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuOw0KPiA+ICsNCj4gPiArICAgICAg IGlmIChub2RlID09IG5vZGVfZ2V0X2xvY2FsX25vZGUoKSkNCj4gPiArICAgICAgICAgICAgICAg ZmlsZW5hbWUgPSBsb2NhbF9maWxlbmFtZTsNCj4gPiArICAgICAgIGVsc2UNCj4gPiArICAgICAg ICAgICAgICAgZmlsZW5hbWUgPSBwcm92X2ZpbGVuYW1lOw0KPiA+ICsNCj4gPiArICAgICAgIGlu X3N0ciA9IHByb3ZfZmlsZV9yZWFkKGZpbGVuYW1lKTsNCj4gPiArICAgICAgIGlmICghaW5fc3Ry KQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm47DQo+ID4gKw0KPiA+ICsgICAgICAgam1haW4g PSBqc29uX3Rva2VuZXJfcGFyc2UoaW5fc3RyKTsNCj4gPiArICAgICAgIGlmICgham1haW4pDQo+ ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBqbm9kZSA9 IGZpbmRfbm9kZV9ieV9wcmltYXJ5KGptYWluLCBwcmltYXJ5KTsNCj4gPiArICAgICAgIGlmICgh am5vZGUpDQo+ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAg ICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGpub2RlLCAiY29tcG9zaXRpb24iLCAmamNvbXAp Ow0KPiA+ICsgICAgICAgaWYgKCFqY29tcCkNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25l Ow0KPiA+ICsNCj4gPiArICAgICAgIGNvbXBfc3RyID0ganNvbl9vYmplY3RfdG9fanNvbl9zdHJp bmdfZXh0KGpjb21wLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIEpTT05fQ19UT19TVFJJTkdfUFJFVFRZKTsNCj4gPiArDQo+ID4gKyAgICAgICBy ZXMgPSB0cnVlOw0KPiA+ICsNCj4gPiArZG9uZToNCj4gPiArICAgICAgIGlmIChyZXMpDQo+ID4g KyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiXHRDb21wb3NpdGlvbiBkYXRhIGZvciBub2RlICU0 LjR4ICVzXG4iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgcHJpbWFyeSwgY29tcF9zdHIpOw0KPiA+ICsgICAgICAgZWxzZQ0KPiA+ ICsgICAgICAgICAgICAgICBybF9wcmludGYoIlx0Q29tcG9zaXRpb24gZGF0YSBmb3Igbm9kZSAl NC40eCBub3QgcHJlc2VudFxuIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbWFyeSk7DQo+ID4gKyAgICAgICBn X2ZyZWUoaW5fc3RyKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoam1haW4pDQo+ID4gKyAgICAg ICAgICAgICAgIGpzb25fb2JqZWN0X3B1dChqbWFpbik7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jv b2wgcHJvdl9kYl9hZGRfbm9kZV9jb21wb3NpdGlvbihzdHJ1Y3QgbWVzaF9ub2RlICpub2RlLCB1 aW50OF90DQo+ICpkYXRhLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MTZfdCBsZW4pDQo+ID4gK3sNCj4gPiAr ICAgICAgIGNoYXIgKmluX3N0cjsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqbWFpbjsNCj4g PiArICAgICAgIGpzb25fb2JqZWN0ICpqbm9kZTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpq Y29tcDsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqYm9vbDsNCj4gPiArICAgICAgIGpzb25f b2JqZWN0ICpqZmVhdHVyZXM7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqamVsZW1lbnRzOw0K PiA+ICsgICAgICAgc3RydWN0IG1lc2hfbm9kZV9jb21wb3NpdGlvbiAqY29tcDsNCj4gPiArICAg ICAgIHVpbnQ4X3QgbnVtX2VsZTsNCj4gPiArICAgICAgIGludCBpOw0KPiA+ICsgICAgICAgdWlu dDE2X3QgcHJpbWFyeSA9IG5vZGVfZ2V0X3ByaW1hcnkobm9kZSk7DQo+ID4gKyAgICAgICBib29s IHJlcyA9IE5VTEw7DQo+ID4gKw0KPiA+ICsgICAgICAgY29tcCA9IG5vZGVfZ2V0X2NvbXBvc2l0 aW9uKG5vZGUpOw0KPiA+ICsgICAgICAgaWYgKCFjb21wKQ0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgaW5fc3RyID0gcHJvdl9maWxlX3JlYWQo cHJvdl9maWxlbmFtZSk7DQo+ID4gKyAgICAgICBpZiAoIWluX3N0cikNCj4gPiArICAgICAgICAg ICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGptYWluID0ganNvbl90b2tl bmVyX3BhcnNlKGluX3N0cik7DQo+ID4gKyAgICAgICBpZiAoIWptYWluKQ0KPiA+ICsgICAgICAg ICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgam5vZGUgPSBmaW5kX25vZGVf YnlfcHJpbWFyeShqbWFpbiwgcHJpbWFyeSk7DQo+ID4gKyAgICAgICBpZiAoIWpub2RlKQ0KPiA+ ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgamNvbXAgPSBq c29uX29iamVjdF9uZXdfb2JqZWN0KCk7DQo+ID4gKw0KPiA+ICsgICAgICAgcHV0X3VpbnQxNihq Y29tcCwgImNpZCIsIGNvbXAtPmNpZCk7DQo+ID4gKyAgICAgICBwdXRfdWludDE2KGpjb21wLCAi cGlkIiwgY29tcC0+cGlkKTsNCj4gPiArICAgICAgIHB1dF91aW50MTYoamNvbXAsICJ2aWQiLCBj b21wLT5waWQpOw0KPiA+ICsgICAgICAgcHV0X3VpbnQxNihqY29tcCwgImNycGwiLCBjb21wLT5j cnBsKTsNCj4gPiArDQo+ID4gKyAgICAgICBqZmVhdHVyZXMgPSBqc29uX29iamVjdF9uZXdfb2Jq ZWN0KCk7DQo+ID4gKyAgICAgICBqYm9vbCA9IGpzb25fb2JqZWN0X25ld19ib29sZWFuKGNvbXAt PnJlbGF5KTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9hZGQoamZlYXR1cmVzLCAi cmVsYXkiLCBqYm9vbCk7DQo+ID4gKyAgICAgICBqYm9vbCA9IGpzb25fb2JqZWN0X25ld19ib29s ZWFuKGNvbXAtPnByb3h5KTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9hZGQoamZl YXR1cmVzLCAicHJveHkiLCBqYm9vbCk7DQo+ID4gKyAgICAgICBqYm9vbCA9IGpzb25fb2JqZWN0 X25ld19ib29sZWFuKGNvbXAtPmZyaWVuZCk7DQo+ID4gKyAgICAgICBqc29uX29iamVjdF9vYmpl Y3RfYWRkKGpmZWF0dXJlcywgImZyaWVuZCIsIGpib29sKTsNCj4gPiArICAgICAgIGpib29sID0g anNvbl9vYmplY3RfbmV3X2Jvb2xlYW4oY29tcC0+bHBuKTsNCj4gPiArICAgICAgIGpzb25fb2Jq ZWN0X29iamVjdF9hZGQoamZlYXR1cmVzLCAibHBuIiwgamJvb2wpOw0KPiA+ICsgICAgICAganNv bl9vYmplY3Rfb2JqZWN0X2FkZChqY29tcCwgImZlYXR1cmVzIiwgamZlYXR1cmVzKTsNCj4gPiAr DQo+ID4gKyAgICAgICBkYXRhICs9IDExOw0KPiA+ICsgICAgICAgbGVuIC09IDExOw0KPiA+ICsN Cj4gPiArICAgICAgIG51bV9lbGUgPSAgbm9kZV9nZXRfbnVtX2VsZW1lbnRzKG5vZGUpOw0KPiA+ ICsNCj4gPiArICAgICAgIGplbGVtZW50cyA9IGpzb25fb2JqZWN0X25ld19hcnJheSgpOw0KPiA+ ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBudW1fZWxlOyArK2kpIHsNCj4gPiArICAg ICAgICAgICAgICAganNvbl9vYmplY3QgKmplbGVtZW50Ow0KPiA+ICsgICAgICAgICAgICAgICBq c29uX29iamVjdCAqam1vZGVsczsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmpp bnQ7DQo+ID4gKyAgICAgICAgICAgICAgIHVpbnQzMl90IG1vZF9pZDsNCj4gPiArICAgICAgICAg ICAgICAgdWludDE2X3QgdmVuZG9yX2lkOw0KPiA+ICsgICAgICAgICAgICAgICB1aW50OF90IG0s IHY7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBqZWxlbWVudCA9IGpzb25fb2JqZWN0X25l d19vYmplY3QoKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIEVsZW1lbnQgSW5kZXgg Ki8NCj4gPiArICAgICAgICAgICAgICAgamludCA9IGpzb25fb2JqZWN0X25ld19pbnQoaSk7DQo+ ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9hZGQoamVsZW1lbnQsICJlbGVt ZW50SW5kZXgiLCBqaW50KTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIC8qIExvY2F0aW9u ICovDQo+ID4gKyAgICAgICAgICAgICAgIHB1dF91aW50MTYoamVsZW1lbnQsICJsb2NhdGlvbiIs IGdldF9sZTE2KGRhdGEpKTsNCj4gPiArICAgICAgICAgICAgICAgZGF0YSArPSAyOw0KPiA+ICsg ICAgICAgICAgICAgICBtID0gKmRhdGErKzsNCj4gPiArICAgICAgICAgICAgICAgdiA9ICpkYXRh Kys7DQo+ID4gKyAgICAgICAgICAgICAgIGxlbiAtPSA0Ow0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgLyogTW9kZWxzICovDQo+ID4gKyAgICAgICAgICAgICAgIGptb2RlbHMgPSBqc29uX29i amVjdF9uZXdfYXJyYXkoKTsNCj4gPiArICAgICAgICAgICAgICAgd2hpbGUgKGxlbiA+PSAyICYm IG0tLSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1vZF9pZCA9IGdldF9sZTE2KGRh dGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgKz0gMjsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICBsZW4gLT0gMjsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBw dXRfdWludDE2X2FycmF5X2VudHJ5KGptb2RlbHMsICh1aW50MTZfdCkgbW9kX2lkKTsNCj4gPiAr ICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgd2hpbGUgKGxlbiA+ PSA0ICYmIHYtLSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1vZF9pZCA9IGdldF9s ZTE2KGRhdGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcl9pZCA9IGdldF9s ZTE2KGRhdGEpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1vZF9pZCB8PSAodmVuZG9y X2lkIDw8IDE2KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBkYXRhICs9IDQ7DQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDQ7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgcHV0X3VpbnQzMl9hcnJheV9lbnRyeShqbW9kZWxzLCBtb2RfaWQpOw0KPiA+ICsgICAg ICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29iamVjdF9vYmpl Y3RfYWRkKGplbGVtZW50LCAibW9kZWxzIiwgam1vZGVscyk7DQo+ID4gKyAgICAgICAgICAgICAg IGpzb25fb2JqZWN0X2FycmF5X2FkZChqZWxlbWVudHMsIGplbGVtZW50KTsNCj4gPiArICAgICAg IH0NCj4gPiArDQo+ID4gKyAgICAgICBqc29uX29iamVjdF9vYmplY3RfYWRkKGpjb21wLCAiZWxl bWVudHMiLCBqZWxlbWVudH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gKyAgICAg ICBlbHNlDQo+ID4gKyAgICAgICAgICAgICAgIGZpbGVuYW1lID0gcHJvdl9maWxlbmFtZTsNCj4g PiArDQo+ID4gKyAgICAgICBpbl9zdHIgPSBwcm92X2ZpbGVfcmVhZChmaWxlbmFtZSk7DQo+ID4g KyAgICAgICBpZiAoIWluX3N0cikNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0K PiA+ICsNCj4gPiArICAgICAgIGptYWluID0ganNvbl90b2tlbmVyX3BhcnNlKGluX3N0cik7DQo+ ID4gKyAgICAgICBpZiAoIWptYWluKQ0KPiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ ID4gKw0KPiA+ICsgICAgICAgaWYgKGxvY2FsKQ0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29i amVjdF9vYmplY3RfZ2V0X2V4KGptYWluLCAibm9kZSIsICZqbm9kZSk7DQo+ID4gKyAgICAgICBl bHNlDQo+ID4gKyAgICAgICAgICAgICAgIGpub2RlID0gZmluZF9ub2RlX2J5X3ByaW1hcnkoam1h aW4sIHByaW1hcnkpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICgham5vZGUpDQo+ID4gKyAgICAg ICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBqc29uX29iamVjdF9vYmpl Y3RfZ2V0X2V4KGpub2RlLCAiY29uZmlndXJhdGlvbiIsICZqY29uZmlnKTsNCj4gPiArICAgICAg IGlmICghamNvbmZpZykNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsNCj4g PiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9kZWwoamNvbmZpZywgImRlZmF1bHRUVEwiKTsN Cj4gPiArDQo+ID4gKyAgICAgICBqdmFsdWUgPSBqc29uX29iamVjdF9uZXdfaW50KHR0bCk7DQo+ ID4gKyAgICAgICBqc29uX29iamVjdF9vYmplY3RfYWRkKGpjb25maWcsICJkZWZhdWx0V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nQzMl90IGl2X2luZGV4LCBib29sIHVwZGF0ZSwgYm9vbA0KPiBw cm92KQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjaGFyICppbl9zdHI7DQo+ID4gKyAgICAgICBqc29u X29iamVjdCAqam1haW47DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqam5vZGU7DQo+ID4gKyAg ICAgICBib29sIHJlcyA9IGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGluX3N0ciA9IHByb3Zf ZmlsZV9yZWFkKGxvY2FsX2ZpbGVuYW1lKTsNCj4gPiArICAgICAgIGlmICghaW5fc3RyKQ0KPiA+ ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgam1haW4g PSBqc29uX3Rva2VuZXJfcGFyc2UoaW5fc3RyKTsNCj4gPiArICAgICAgIGlmICgham1haW4pDQo+ ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBqc29uX29i amVjdF9vYmplY3RfZ2V0X2V4KGptYWluLCAibm9kZSIsICZqbm9kZSk7DQo+ID4gKyAgICAgICBz ZXRfbG9jYWxfaXZfaW5kZXgoam5vZGUsIGl2X2luZGV4LCB1cGRhdGUpOw0KPiA+ICsgICAgICAg cHJvdl9maWxlX3dyaXRlKGptYWluLCB0cnVlKTsNCj4gPiArDQo+ID4gKyAgICAgICBnX2ZyZWUo aW5fc3RyKTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X3B1dChqbWFpbik7DQo+ID4gKw0KPiA+ ICsgICAgICAgLyogSWYgcHJvdmlzaW9uZXIsIHNhdmUgdG8gZ2xvYmFsIERCIGFzIHdlbGwgKi8N Cj4gPiArICAgICAgIGlmIChwcm92KSB7DQo+ID4gKyAgICAgICAgICAgICAgIGluX3N0ciA9IHBy b3ZfZmlsZV9yZWFkKHByb3ZfZmlsZW5hbWUpOw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIWlu X3N0cikNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0K PiA+ICsgICAgICAgICAgICAgICBqbWFpbiA9IGpzb25fdG9rZW5lcl9wYXJzZShpbl9zdHIpOw0K PiA+ICsgICAgICAgICAgICAgICBpZiAoIWptYWluKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIHNldF9sb2NhbF9pdl9p bmRleChqbWFpbiwgaXZfaW5kZXgsIHVwZGF0ZSk7DQo+ID4gKyAgICAgICAgICAgICAgIHByb3Zf ZmlsZV93cml0ZShqbWFpbiwgZmFsc2UpOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiArICAg ICAgIHJlcyA9IHRydWU7DQo+ID4gK2RvbmU6DQo+ID4gKw0KPiA+ICsgICAgICAgZ19mcmVlKGlu X3N0cik7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYoam1haW4pDQo+ID4gKyAgICAgICAgICAgICAg IGpzb25fb2JqZWN0X3B1dChqbWFpbik7DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIHJlczsN Cj4gPiArDQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wgcHJvdl9kYl9sb2NhbF9zZXRfc2VxX251 bSh1aW50MzJfdCBzZXFfbnVtKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjaGFyICppbl9zdHI7DQo+ ID4gKyAgICAgICBqc29uX29iamVjdCAqam1haW47DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAq am5vZGU7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqanZhbHVlOw0KPiA+ICsgICAgICAgYm9v bCByZXMgPSBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpbl9zdHIgPSBwcm92X2ZpbGVfcmVh ZChsb2NhbF9maWxlbmFtZSk7DQo+ID4gKyAgICAgICBpZiAoIWluX3N0cikNCj4gPiArICAgICAg ICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIGptYWluID0ganNvbl90 b2tlbmVyX3BhcnNlKGluX3N0cik7DQo+ID4gKyAgICAgICBpZiAoIWptYWluKQ0KPiA+ICsgICAg ICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2Jq ZWN0X2dldF9leChqbWFpbiwgIm5vZGUiLCAmam5vZGUpOw0KPiA+ICsNCj4gPiArICAgICAgIGpz b25fb2JqZWN0X29iamVjdF9kZWwoam5vZGUsICJzZXF1ZW5jZU51bWJlciIpOw0KPiA+ICsgICAg ICAganZhbHVlID0ganNvbl9vYmplY3RfbmV3X2ludChzZXFfbnVtKTsNCj4gPiArICAgICAgIGpz b25fb2JqZWN0X29iamVjdF9hZGQoam5vZGUsICJzZXF1ZW5jZU51bWJlciIsIGp2YWx1ZSk7DQo+ ID4gKw0KPiA+ICsgICAgICAgcHJvdl9maWxlX3dyaXRlKGptYWluLCB0cnVlKTsNCj4gPiArDQo+ ID4gKyAgICAgICByZXMgPSB0cnVlOw0KPiA+ICtkb25lOg0KPiA+ICsNCj4gPiArICAgICAgIGdf ZnJlZShpbl9zdHIpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmKGptYWluKQ0KPiA+ICsgICAgICAg ICAgICAgICBqc29uX29iamVjdF9wdXQoam1haW4pOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVy biByZXM7DQo+ID4gK30NCj4gPiArDQo+ID4gK2Jvb2wgcHJvdl9kYl9ub2RlX3NldF9pdl9zZXEo c3RydWN0IG1lc2hfbm9kZSAqbm9kZSwgdWludDMyX3QgaXYsDQo+IHVpbnQzMl90IHNlcSkNCj4g PiArew0KPiA+ICsgICAgICAgY2hhciAqaW5fc3RyOw0KPiA+ICsgICAgICAganNvbl9vYmplY3Qg KmptYWluOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmpub2RlOw0KPiA+ICsgICAgICAganNv bl9vYmplY3QgKmp2YWx1ZTsNCj4gPiArICAgICAgIHVpbnQxNl90IHByaW1hcnkgPSBub2RlX2dl dF9wcmltYXJ5KG5vZGUpOw0KPiA+ICsgICAgICAgYm9vbCByZXMgPSBmYWxzZTsNCj4gPiArDQo+ ID4gKyAgICAgICBpbl9zdHIgPSBwcm92X2ZpbGVfcmVhZChwcm92X2ZpbGVuYW1lKTsNCj4gPiAr ICAgICAgIGlmICghaW5fc3RyKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ ID4gKw0KPiA+ICsgICAgICAgam1haW4gPSBqc29uX3Rva2VuZXJfcGFyc2UoaW5fc3RyKTsNCj4g PiArICAgICAgIGlmICgham1haW4pDQo+ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4g PiArDQo+ID4gKyAgICAgICBqbm9kZSA9IGZpbmRfbm9kZV9ieV9wcmltYXJ5KGptYWluLCBwcmlt YXJ5KTsNCj4gPiArICAgICAgIGlmICgham5vZGUpDQo+ID4gKyAgICAgICAgICAgICAgIGdvdG8g ZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBqc29uX29iamVjdF9vYmplY3RfZGVsKGpub2RlLCAi SVZpbmRleCIpOw0KPiA+ICsNCj4gPiArICAgICAgIGp2YWx1ZSA9IGpzb25fb2JqZWN0X25ld19p bnQoaXYpOw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2FkZChqbm9kZSwgIklWaW5k ZXgiLCBqdmFsdWUpOw0KPiA+ICsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9kZWwo am5vZGUsICJzZXF1ZW5jZU51bWJlciIpOw0KPiA+ICsNCj4gPiArICAgICAgIGp2YWx1ZSA9IGpz b25fb2JqZWN0X25ld19pbnQoc2VxKTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9h ZGQoam5vZGUsICJzZXF1ZW5jZU51bWJlciIsIGp2YWx1ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAg cHJvdl9maWxlX3dyaXRlKGptYWluLCBmYWxzZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmVzID0g dHJ1ZTsNCj4gPiArZG9uZToNCj4gPiArDQo+ID4gKyAgICAgICBnX2ZyZWUoaW5fc3RyKTsNCj4g PiArDQo+ID4gKyAgICAgICBpZihqbWFpbikNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmpl Y3RfcHV0KGptYWluKTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gcmVzOw0KPiA+ICsNCj4g PiArfQ0KPiA+ICsNCj4gPiArYm9vbCBwcm92X2RiX25vZGVfa2V5cyhzdHJ1Y3QgbWVzaF9ub2Rl ICpub2RlLCBHTGlzdCAqaWR4cywgY29uc3QNCj4gY2hhciAqZGVzYykNCj4gPiArew0KPiA+ICsg ICAgICAgY2hhciAqaW5fc3RyOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmptYWluOw0KPiA+ ICsgICAgICAganNvbl9vYmplY3QgKmpub2RlOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmpj b25maWc7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqamlkeHM7DQo+ID4gKyAgICAgICB1aW50 MTZfdCBwcmltYXJ5ID0gbm9kZV9nZXRfcHJpbWFyeShub2RlKTsNCj4gPiArICAgICAgIGNvbnN0 IGNoYXIgKmZpbGVuYW1lOw0KPiA+ICsgICAgICAgYm9vbCBsb2NhbCA9IChub2RlID09IG5vZGVf Z2V0X2xvY2FsX25vZGUoKSk7DQo+ID4gKyAgICAgICBib29sIHJlcyA9IGZhbHNlOw0KPiA+ICsN Cj4gPiArICAgICAgIGlmIChsb2NhbCkNCj4gPiArICAgICAgICAgICAgICAgZmlsZW5hbWUgPSBs b2NhbF9maWxlbmFtZTsNCj4gPiArICAgICAgIGVsc2UNCj4gPiArICAgICAgICAgICAgICAgZmls ZW5hbWUgPSBwcm92X2ZpbGVuYW1lOw0KPiA+ICsNCj4gPiArICAgICAgIGluX3N0ciA9IHByb3Zf ZmlsZV9yZWFkKGZpbGVuYW1lKTsNCj4gPiArICAgICAgIGlmICghaW5fc3RyKQ0KPiA+ICsgICAg ICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgam1haW4gPSBqc29u X3Rva2VuZXJfcGFyc2UoaW5fc3RyKTsNCj4gPiArICAgICAgIGlmICgham1haW4pDQo+ID4gKyAg ICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBqbm9kZSA9IGZpbmRf bm9kZV9ieV9wcmltYXJ5KGptYWluLCBwcmltYXJ5KTsNCj4gPiArICAgICAgIGlmICgham5vZGUp DQo+ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBqc29u X29iamVjdF9vYmplY3RfZ2V0X2V4KGpub2RlLCAiY29uZmlndXJhdGlvbiIsICZqY29uZmlnKTsN Cj4gPiArICAgICAgIGlmICghamNvbmZpZykNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25l Ow0KPiA+ICsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9kZWwoamNvbmZpZywgZGVz Yyk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGlkeHMpIHsNCj4gPiArICAgICAgICAgICAgICAg amlkeHMgPSBqc29uX29iamVjdF9uZXdfYXJyYXkoKTsNCj4gPiArICAgICAgICAgICAgICAgcHV0 X3VpbnQxNl9saXN0KGppZHhzLCBpZHhzKTsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmpl Y3Rfb2JqZWN0X2FkZChqY29uZmlnLCBkZXNjLCBqaWR4cyk7DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAgcHJvdl9maWxlX3dyaXRlKGptYWluLCBsb2NhbCk7DQo+ID4gKw0KPiA+ ICsgICAgICAgcmVzID0gdHJ1ZTsNCj4gPiArZG9uZToNCj4gPiArDQo+ID4gKyAgICAgICBnX2Zy ZWUoaW5fc3RyKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZihqbWFpbikNCj4gPiArICAgICAgICAg ICAgICAganNvbl9vYmplY3RfcHV0KGptYWluKTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4g cmVzOw0KPiA+ICsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIGpzb25fb2JqZWN0ICpnZXRf am1vZGVsX29iaihzdHJ1Y3QgbWVzaF9ub2RlICpub2RlLCB1aW50OF90DQo+IGVsZV9pZHgsDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IG1vZGVs X2lkLCBqc29uX29iamVjdCAqKmptYWluKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjaGFyICppbl9z dHI7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqam5vZGU7DQo+ID4gKyAgICAgICBqc29uX29i amVjdCAqamNvbmZpZzsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqZWxlbWVudHMsICpqZWxl bWVudDsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqbW9kZWxzLCAqam1vZGVsID0gTlVMTDsN Cj4gPiArICAgICAgIHVpbnQxNl90IHByaW1hcnkgPSBub2RlX2dldF9wcmltYXJ5KG5vZGUpOw0K PiA+ICsgICAgICAgY29uc3QgY2hhciAqZmlsZW5hbWU7DQo+ID4gKyAgICAgICBib29sIGxvY2Fs ID0gKG5vZGUgPT0gbm9kZV9nZXRfbG9jYWxfbm9kZSgpKTsNCj4gPiArDQo+ID4gKyAgICAgICBp ZiAobG9jYWwpDQo+ID4gKyAgICAgICAgICAgICAgIGZpbGVuYW1lID0gbG9jYWxfZmlsZW5hbWU7 DQo+ID4gKyAgICAgICBlbHNlDQo+ID4gKyAgICAgICAgICAgICAgIGZpbGVuYW1lID0gcHJvdl9m aWxlbmFtZTsNCj4gPiArDQo+ID4gKyAgICAgICBpbl9zdHIgPSBwcm92X2ZpbGVfcmVhZChmaWxl bmFtZSk7DQo+ID4gKyAgICAgICBpZiAoIWluX3N0cikNCj4gPiArICAgICAgICAgICAgICAgcmV0 dXJuIE5VTEw7DQo+ID4gKw0KPiA+ICsgICAgICAgKmptYWluID0ganNvbl90b2tlbmVyX3BhcnNl KGluX3N0cik7DQo+ID4gKyAgICAgICBpZiAoISgqam1haW4pKQ0KPiA+ICsgICAgICAgICAgICAg ICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGxvY2FsKQ0KPiA+ICsgICAgICAg ICAgICAgICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KCpqbWFpbiwgIm5vZGUiLCAmam5vZGUp Ow0KPiA+ICsgICAgICAgZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICBqbm9kZSA9IGZpbmRfbm9k ZV9ieV9wcmltYXJ5KCpqbWFpbiwgcHJpbWFyeSk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFq bm9kZSkNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsNCj4gPiArICAgICAg IC8qIENvbmZpZ3VyYXRpb24gaXMgbWFuZGF0b3J5IGZvciBub2RlcyBpbiBwcm92aXNpb25pbmcg ZGF0YWJhc2UgKi8NCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoam5vZGUs ICJjb25maWd1cmF0aW9uIiwgJmpjb25maWcpOw0KPiA+ICsgICAgICAgaWYgKCFqY29uZmlnKQ0K PiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9v YmplY3Rfb2JqZWN0X2dldF9leChqY29uZmlnLCAiZWxlbWVudHMiLCAmamVsZW1lbnRzKTsNCj4g PiArICAgICAgIGlmICghamVsZW1lbnRzKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9u ZTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBqZWxlbWVudCA9IGpzb25fb2Jq ZWN0X2FycmF5X2dldF9pZHgoamVsZW1lbnRzLCBlbGVfaWR4KTsNCj4gPiArICAgICAgIGlmICgh amVsZW1lbnQpIHsNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAg fQ0KPiA+ICsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoamVsZW1lbnQs ICJtb2RlbHMiLCAmam1vZGVscyk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFqbW9kZWxzKSAg ew0KPiA+ICsgICAgICAgICAgICAgICBqbW9kZWxzID0ganNvbl9vYmplY3RfbmV3X2FycmF5KCk7 DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9hZGQoamVsZW1lbnQsICJt b2RlbHMiLCBqbW9kZWxzKTsNCj4gPiArICAgICAgIH0gZWxzZSB7DQo+ID4gKyAgICAgICAgICAg ICAgIHBhcnNlX2NvbmZpZ3VyYXRpb25fbW9kZWxzKG5vZGUsIGVsZV9pZHgsIGptb2RlbHMsDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBtb2RlbF9pZCwgJmptb2RlbCk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKCFqbW9kZWwpIHsNCj4gPiArICAgICAgICAgICAgICAgam1vZGVsID0ganNvbl9vYmplY3Rf bmV3X29iamVjdCgpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYgKChtb2RlbF9pZCAm IDB4ZmZmZjAwMDApID09IDB4ZmZmZjAwMDApDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg cHV0X3VpbnQxNihqbW9kZWwsICJtb2RlbElkIiwgbW9kZWxfaWQgJiAweGZmZmYpOw0KPiA+ICsg ICAgICAgICAgICAgICBlbHNlDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHV0X3VpbnQz MihqbW9kZWwsICJtb2RlbElkIiwgbW9kZWxfaWQpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAganNvbl9vYmplY3RfYXJyYXlfYWRkKGptb2RlbHMsIGptb2RlbCk7DQo+ID4gKyAgICAgICB9 DQo+ID4gKw0KPiA+ICtkb25lOg0KPiA+ICsNCj4gPiArICAgICAgIGdfZnJlZShpbl9zdHIpOw0K PiA+ICsNCj4gPiArICAgICAgIGlmKCFqbW9kZWwgJiYgKmptYWluKQ0KPiA+ICsgICAgICAgICAg ICAgICBqc29uX29iamVjdF9wdXQoKmptYWluKTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4g am1vZGVsOw0KPiA+ICsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBwcm92X2RiX2FkZF9iaW5k aW5nKHN0cnVjdCBtZXNoX25vZGUgKm5vZGUsIHVpbnQ4X3QgZWxlX2lkeCwNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICB1aW50MzJfdCBtb2RlbF9pZCwgdWludDE2X3QgYXBwX2lkeCkNCj4g PiArew0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmptYWluOw0KPiA+ICsgICAgICAganNvbl9v YmplY3QgKmptb2RlbDsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqdmFsdWU7DQo+ID4gKyAg ICAgICBqc29uX29iamVjdCAqamJpbmRpbmdzID0gTlVMTDsNCj4gPiArICAgICAgIGJvb2wgbG9j YWwgPSAobm9kZSA9PSBub2RlX2dldF9sb2NhbF9ub2RlKCkpOw0KPiA+ICsNCj4gPiArICAgICAg IGptb2RlbCA9IGdldF9qbW9kZWxfb2JqKG5vZGUsIGVsZV9pZHgsIG1vZGVsX2lkLCAmam1haW4p Ow0KPiA+ICsNCj4gPiArICAgICAgIGlmICgham1vZGVsKQ0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9l eChqbW9kZWwsICJiaW5kIiwgJmpiaW5kaW5ncyk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFq YmluZGluZ3MpIHsNCj4gPiArICAgICAgICAgICAgICAgamJpbmRpbmdzID0ganNvbl9vYmplY3Rf bmV3X2FycmF5KCk7DQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9hZGQo am1vZGVsLCAiYmluZCIsIGpiaW5kaW5ncyk7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsg ICAgICAganZhbHVlID0ganNvbl9vYmplY3RfbmV3X2ludChhcHBfaWR4KTsNCj4gPiArICAgICAg IGpzb25fb2JqZWN0X2FycmF5X2FkZChqYmluZGluZ3MsIGp2YWx1ZSk7DQo+ID4gKw0KPiA+ICsg ICAgICAgcHJvdl9maWxlX3dyaXRlKGptYWluLCBsb2NhbCk7DQo+ID4gKw0KPiA+ICsgICAgICAg anNvbl9vYmplY3RfcHV0KGptYWluKTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4gdHJ1ZTsN Cj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBwcm92X2RiX25vZGVfc2V0X21vZGVsX3B1YihzdHJ1 Y3QgbWVzaF9ub2RlICpub2RlLCB1aW50OF90DQo+IGVsZV9pZHgsDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBtb2Rl bF9pZCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBzdHJ1Y3QgbWVzaF9wdWJsaWNhdGlvbiAqcHViKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBqc29u X29iamVjdCAqam1haW47DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqam1vZGVsOw0KPiA+ICsg ICAgICAganNvbl9vYmplY3QgKmpwdWI7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqanZhbHVl Ow0KPiA+ICsgICAgICAgYm9vbCBsb2NhbCA9IChub2RlID09IG5vZGVfZ2V0X2xvY2FsX25vZGUo KSk7DQo+ID4gKw0KPiA+ICsgICAgICAgam1vZGVsID0gZ2V0X2ptb2RlbF9vYmoobm9kZSwgZWxl X2lkeCwgbW9kZWxfaWQsICZqbWFpbik7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFqbW9kZWwp DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBq c29uX29iamVjdF9vYmplY3RfZGVsKGptb2RlbCwgInB1Ymxpc2giKTsNCj4gPiArICAgICAgIGlm ICghcHViKQ0KPiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAg ICAganB1YiA9IGpzb25fb2JqZWN0X25ld19vYmplY3QoKTsNCj4gPiArDQo+ID4gKyAgICAgICAv KiBTYXZlIG9ubHkgcmVxdWlyZWQgZmllbGRzICovDQo+ID4gKyAgICAgICBwdXRfdWludDE2KGpw dWIsICJhZGRyZXNzIiwgcHViLT51LmFkZHIxNik7DQo+ID4gKyAgICAgICBwdXRfdWludDE2KGpw dWIsICJpbmRleCIsIHB1Yi0+YXBwX2lkeCk7DQo+ID4gKyAgICAgICBqdmFsdWUgPSBqc29uX29i amVjdF9uZXdfaW50KHB1Yi0+dHRsKTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9h ZGQoanB1YiwgInR0bCIsIGp2YWx1ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rf b2JqZWN0X2FkZChqbW9kZWwsICJwdWJsaXNoIiwganB1Yik7DQo+ID4gKw0KPiA+ICtkb25lOg0K PiA+ICsgICAgICAgcHJvdl9maWxlX3dyaXRlKGptYWluLCBsb2NhbCk7DQo+ID4gKw0KPiA+ICsg ICAgICAganNvbl9vYmplY3RfcHV0KGptYWluKTsNCj4gPiArDQo+ID4gKyAgICAgICByZXR1cm4g dHJ1ZTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArYm9vbCBwcm92X2RiX2FkZF9uZXdfbm9kZShzdHJ1 Y3QgbWVzaF9ub2RlICpub2RlKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBjaGFyICppbl9zdHI7DQo+ ID4gKyAgICAgICBqc29uX29iamVjdCAqam1haW47DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAq amFycmF5Ow0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmpub2RlOw0KPiA+ICsgICAgICAganNv bl9vYmplY3QgKmpjb25maWc7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqamVsZW1lbnRzOw0K PiA+ICsgICAgICAgdWludDhfdCBudW1fZWxlOw0KPiA+ICsgICAgICAgdWludDE2X3QgcHJpbWFy eTsNCj4gPiArICAgICAgIGludCBpOw0KPiA+ICsgICAgICAgYm9vbCBmaXJzdF9ub2RlOw0KPiA+ ICsgICAgICAgYm9vbCByZXMgPSBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBpbl9zdHIgPSBw cm92X2ZpbGVfcmVhZChwcm92X2ZpbGVuYW1lKTsNCj4gPiArICAgICAgIGlmICghaW5fc3RyKQ0K PiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgam1h aW4gPSBqc29uX3Rva2VuZXJfcGFyc2UoaW5fc3RyKTsNCj4gPiArICAgICAgIGlmICgham1haW4p DQo+ID4gKyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0 X29iamVjdF9nZXRfZXgoam1haW4sICJub2RlcyIsICZqYXJyYXkpOw0KPiA+ICsNCj4gPiArICAg ICAgIGlmICghamFycmF5KSB7DQo+ID4gKyAgICAgICAgICAgICAgIGphcnJheSA9IGpzb25fb2Jq ZWN0X25ld19hcnJheSgpOw0KPiA+ICsgICAgICAgICAgICAgICBmaXJzdF9ub2RlID0gdHJ1ZTsN Cj4gPiArICAgICAgIH0gZWxzZQ0KPiA+ICsgICAgICAgICAgICAgICBmaXJzdF9ub2RlID0gZmFs c2U7DQo+ID4gKw0KPiA+ICsgICAgICAgam5vZGUgPSBqc29uX29iamVjdF9uZXdfb2JqZWN0KCk7 DQo+ID4gKw0KPiA+ICsgICAgICAgLyogRGV2aWNlIGtleSAqLw0KPiA+ICsgICAgICAgYWRkX2tl eShqbm9kZSwgImRldmljZUtleSIsIG5vZGVfZ2V0X2RldmljZV9rZXkobm9kZSkpOw0KPiA+ICsN Cj4gPiArICAgICAgIC8qIE5ldCBrZXkgKi8NCj4gPiArICAgICAgIGpjb25maWcgPSBqc29uX29i amVjdF9uZXdfb2JqZWN0KCk7DQo+ID4gKyAgICAgICBhZGRfbm9kZV9pZHhzKGpjb25maWcsICJu ZXRLZXlzIiwgbm9kZV9nZXRfbmV0X2tleXMobm9kZSkpOw0KPiA+ICsNCj4gPiArICAgICAgIG51 bV9lbGUgPSBub2RlX2dldF9udW1fZWxlbWVudHMobm9kZSk7DQo+ID4gKyAgICAgICBpZiAobnVt X2VsZSA9PSAwKQ0KPiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsg ICAgICAgamVsZW1lbnRzID0ganNvbl9vYmplY3RfbmV3X2FycmF5KCk7DQo+ID4gKw0KPiA+ICsg ICAgICAgcHJpbWFyeSA9IG5vZGVfZ2V0X3ByaW1hcnkobm9kZSk7DQo+ID4gKyAgICAgICBpZiAo SVNfVU5BU1NJR05FRChwcmltYXJ5KSkNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0K PiA+ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBudW1fZWxlOyArK2kpIHsNCj4gPiAr ICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmplbGVtZW50Ow0KPiA+ICsgICAgICAgICAgICAg ICBqc29uX29iamVjdCAqamludDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGplbGVtZW50 ID0ganNvbl9vYmplY3RfbmV3X29iamVjdCgpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAg LyogRWxlbWVudCBJbmRleCAqLw0KPiA+ICsgICAgICAgICAgICAgICBqaW50ID0ganNvbl9vYmpl Y3RfbmV3X2ludChpKTsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2Fk ZChqZWxlbWVudCwgImVsZW1lbnRJbmRleCIsIGppbnQpOw0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgLyogVW5pY2FzdCAqLw0KPiA+ICsgICAgICAgICAgICAgICBwdXRfdWludDE2KGplbGVt ZW50LCAidW5pY2FzdEFkZHJlc3MiLCBwcmltYXJ5ICsgaSk7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICBqc29uX29iamVjdF9hcnJheV9hZGQoamVsZW1lbnRzLCBqZWxlbWVudCk7DQo+ID4g KyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2FkZChqY29u ZmlnLCAiZWxlbWVudHMiLCBqZWxlbWVudHMpOw0KPiA+ICsNCj4gPiArICAgICAgIGpzb25fb2Jq ZWN0X29iamVjdF9hZGQoam5vZGUsICJjb25maWd1cmF0aW9uIiwgamNvbmZpZyk7DQo+ID4gKw0K PiA+ICsgICAgICAganNvbl9vYmplY3RfYXJyYXlfYWRkKGphcnJheSwgam5vZGUpOw0KPiA+ICsN Cj4gPiArICAgICAgIGlmIChmaXJzdF9ub2RlKQ0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29i amVjdF9vYmplY3RfYWRkKGptYWluLCAibm9kZXMiLCBqYXJyYXkpOw0KPiA+ICsNCj4gPiArICAg ICAgIHByb3ZfZmlsZV93cml0ZShqbWFpbiwgZmFsc2UpOw0KPiA+ICsNCj4gPiArICAgICAgIHJl cyA9IHRydWU7DQo+ID4gK2RvbmU6DQo+ID4gKw0KPiA+ICsgICAgICAgZ19mcmVlKGluX3N0cik7 DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKGptYWluKQ0KPiA+ICsgICAgICAgICAgICAgICBqc29u X29iamVjdF9wdXQoam1haW4pOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVybiByZXM7DQo+ID4g K30NCj4gPiArDQo+ID4gK3N0YXRpYyBib29sIHBhcnNlX25vZGVfY29tcG9zaXRpb24oc3RydWN0 IG1lc2hfbm9kZSAqbm9kZSwNCj4ganNvbl9vYmplY3QgKmpjb21wKQ0KPiA+ICt7DQo+ID4gKyAg ICAgICBqc29uX29iamVjdCAqanZhbHVlOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmplbGVt ZW50czsNCj4gPiArICAgICAgIGpzb25fYm9vbCBlbmFibGU7DQo+ID4gKyAgICAgICBjaGFyICpz dHI7DQo+ID4gKyAgICAgICBzdHJ1Y3QgbWVzaF9ub2RlX2NvbXBvc2l0aW9uIGNvbXA7DQo+ID4g Kw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqY29tcCwgImNpZCIsICZq dmFsdWUpOw0KPiA+ICsgICAgICAgaWYgKCFqdmFsdWUpDQo+ID4gKyAgICAgICAgICAgICAgIHJl dHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBzdHIgPSAoY2hhciAqKWpzb25fb2JqZWN0 X2dldF9zdHJpbmcoanZhbHVlKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoc3NjYW5mKHN0ciwg IiUwNGh4IiwgJmNvbXAuY2lkKSAhPSAxKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFs c2U7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqY29tcCwg InBpZCIsICZqdmFsdWUpOw0KPiA+ICsgICAgICAgaWYgKCFqdmFsdWUpDQo+ID4gKyAgICAgICAg ICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBzdHIgPSAoY2hhciAqKWpz b25fb2JqZWN0X2dldF9zdHJpbmcoanZhbHVlKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAoc3Nj YW5mKHN0ciwgIiUwNGh4IiwgJmNvbXAudmlkKSAhPSAxKQ0KPiA+ICsgICAgICAgICAgICAgICBy ZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9l eChqY29tcCwgInZpZCIsICZqdmFsdWUpOw0KPiA+ICsgICAgICAgaWYgKCFqdmFsdWUpDQo+ID4g KyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBzdHIgPSAo Y2hhciAqKWpzb25fb2JqZWN0X2dldF9zdHJpbmcoanZhbHVlKTsNCj4gPiArDQo+ID4gKyAgICAg ICBpZiAoc3NjYW5mKHN0ciwgIiUwNGh4IiwgJmNvbXAudmlkKSAhPSAxKQ0KPiA+ICsgICAgICAg ICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2Jq ZWN0X2dldF9leChqY29tcCwgImNycGwiLCAmanZhbHVlKTsNCj4gPiArICAgICAgIGlmICghanZh bHVlKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAg ICAgc3RyID0gKGNoYXIgKilqc29uX29iamVjdF9nZXRfc3RyaW5nKGp2YWx1ZSk7DQo+ID4gKw0K PiA+ICsgICAgICAgaWYgKHNzY2FuZihzdHIsICIlMDRoeCIsICZjb21wLmNycGwpICE9IDEpDQo+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ihub2RlLCAmY29tcCkpDQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBqc29uX29iamVjdF9v YmplY3RfZ2V0X2V4KGpjb21wLCAiZWxlbWVudHMiLCAmamVsZW1lbnRzKTsNCj4gPiArICAgICAg IGlmICghamVsZW1lbnRzKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4g Kw0KPiA+ICsgICAgICAgcmV0dXJuIHBhcnNlX2NvbXBvc2l0aW9uX2VsZW1lbnRzKG5vZGUsIGpl bGVtZW50cyk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyBib29sIHBhcnNlX25vZGUoanNv bl9vYmplY3QgKmpub2RlLCBib29sIGxvY2FsKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBqc29uX29i amVjdCAqamNvbmZpZzsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0ICpqZWxlbWVudHM7DQo+ID4g KyAgICAgICBqc29uX29iamVjdCAqamlkeHM7DQo+ID4gKyAgICAgICBqc29uX29iamVjdCAqanZh bHVlOw0KPiA+ICsgICAgICAganNvbl9vYmplY3QgKmppbnQ7DQo+ID4gKyAgICAgICB1aW50OF90 IGtleVsxNl07DQo+ID4gKyAgICAgICBjaGFyICp2YWx1ZV9zdHI7DQo+ID4gKyAgICAgICB1aW50 MzJfdCBpZHg7DQo+ID4gKyAgICAgICBzdHJ1Y3QgbWVzaF9ub2RlICpub2RlOw0KPiA+ICsNCj4g PiArICAgICAgIC8qIERldmljZSBrZXkgKi8NCj4gPiArICAgICAgIGlmICghanNvbl9vYmplY3Rf b2JqZWN0X2dldF9leChqbm9kZSwgImRldmljZUtleSIsICZqdmFsdWUpIHx8DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICFqdmFsdWUpIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKCFtZXNoX2dldF9yYW5kb21fYnl0 ZXMoa2V5LCAxNikpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgYWRkX2tleShqbm9kZSwgImRldmljZUtleSIsIGtl eSk7DQo+ID4gKyAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICB2YWx1ZV9zdHIg PSAoY2hhciAqKWpzb25fb2JqZWN0X2dldF9zdHJpbmcoanZhbHVlKTsNCj4gPiArICAgICAgICAg ICAgICAgaWYgKCFzdHIyaGV4KHZhbHVlX3N0ciwgc3RybGVuKHZhbHVlX3N0ciksIGtleSwgMTYp KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTs7DQo+ID4gKyAgICAg ICB9DQo+ID4gKw0KPiA+ICsgICAgICAgbm9kZSA9IG5vZGVfbmV3KCk7DQo+ID4gKw0KPiA+ICsg ICAgICAgaWYgKCFub2RlKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4g Kw0KPiA+ICsgICAgICAgbm9kZV9zZXRfZGV2aWNlX2tleShub2RlLCBrZXkpOw0KPiA+ICsNCj4g PiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoam5vZGUsICJJVmluZGV4IiwgJmpp bnQpOw0KPiA+ICsgICAgICAgaWYgKGppbnQpDQo+ID4gKyAgICAgICAgICAgICAgIGlkeCA9IGpz b25fb2JqZWN0X2dldF9pbnQoamludCk7DQo+ID4gKyAgICAgICBlbHNlDQo+ID4gKyAgICAgICAg ICAgICAgIGlkeCA9IDA7DQo+ID4gKw0KPiA+ICsgICAgICAgbm9kZV9zZXRfaXZfaW5kZXgobm9k ZSwgaWR4KTsNCj4gPiArICAgICAgIGlmIChsb2NhbCkgew0KPiA+ICsgICAgICAgICAgICAgICBi b29sIHVwZGF0ZSA9IGZhbHNlOw0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29iamVjdF9vYmpl Y3RfZ2V0X2V4KGpub2RlLCAiSVZ1cGRhdGUiLCAmamludCk7DQo+ID4gKyAgICAgICAgICAgICAg IGlmIChqaW50KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZSA9IGpzb25fb2Jq ZWN0X2dldF9pbnQoamludCkgPyB0cnVlIDogZmFsc2U7DQo+ID4gKyAgICAgICAgICAgICAgIG5l dF9zZXRfaXZfaW5kZXgoaWR4LCB1cGRhdGUpOw0KPiA+ICsgICAgICAgfQ0KPiA+ICsNCj4gPiAr ICAgICAgIGlmIChqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGpub2RlLCAic2VxdWVuY2VOdW1i ZXIiLCAmamludCkgJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50KSB7DQo+ID4gKyAgICAgICAg ICAgICAgIGludCBzZXEgPSBqc29uX29iamVjdF9nZXRfaW50KGppbnQpOw0KPiA+ICsgICAgICAg ICAgICAgICBub2RlX3NldF9zZXF1ZW5jZV9udW1iZXIobm9kZSwgc2VxKTsNCj4gPiArICAgICAg IH0NCj4gPiArDQo+ID4gKyAgICAgICAvKiBDb21wb3NpdGlvbiBpcyBtYW5kYXRvcnkgZm9yIGxv Y2FsIG5vZGUgKi8NCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoam5vZGUs ICJjb21wb3NpdGlvbiIsICZqY29uZmlnKTsNCj4gPiArICAgICAgIGlmICgoamNvbmZpZyAmJiAh cGFyc2Vfbm9kZV9jb21wb3NpdGlvbihub2RlLCBqY29uZmlnKSkgfHwNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICghamNvbmZpZyAm JiBsb2NhbCkpIHsNCj4gPiArICAgICAgICAgICAgICAgbm9kZV9mcmVlKG5vZGUpOw0KPiA+ICsg ICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsg ICAgICAgLyogQ29uZmlndXJhdGlvbiBpcyBtYW5kYXRvcnkgZm9yIG5vZGVzIGluIHByb3Zpc2lv bmluZyBkYXRhYmFzZSAqLw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChq bm9kZSwgImNvbmZpZ3VyYXRpb24iLCAmamNvbmZpZyk7DQo+ID4gKyAgICAgICBpZiAoIWpjb25m aWcpIHsNCj4gPiArICAgICAgICAgICAgICAgaWYgKGxvY2FsKSB7DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgLyogVGhpcyBpcyBhbiB1bnByb3Zpc2lvbmVkIGxvY2FsIGRldmljZSAqLw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArICAgICAgICAgICAg ICAgfSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBub2RlX2ZyZWUobm9kZSk7 DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsgICAgICAg ICAgICAgICB9DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rf b2JqZWN0X2dldF9leChqY29uZmlnLCAiZWxlbWVudHMiLCAmamVsZW1lbnRzKTsNCj4gPiArICAg ICAgIGlmICghamVsZW1lbnRzKSB7DQo+ID4gKyAgICAgICAgICAgICAgIG5vZGVfZnJlZShub2Rl KTsNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsgICAgICAgfQ0KPiA+ ICsNCj4gPiArICAgICAgIGlmICghcGFyc2VfY29uZmlndXJhdGlvbl9lbGVtZW50cyhub2RlLCBq ZWxlbWVudHMsIGxvY2FsKSkgew0KPiA+ICsgICAgICAgICAgICAgICBub2RlX2ZyZWUobm9kZSk7 DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTs7DQo+ID4gKyAgICAgICB9DQo+ID4g Kw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqY29uZmlnLCAibmV0S2V5 cyIsICZqaWR4cyk7DQo+ID4gKyAgICAgICBpZiAoIWppZHhzIHx8IChwYXJzZV9ub2RlX2tleXMo bm9kZSwgamlkeHMsIGZhbHNlKSA9PSAwKSkgew0KPiA+ICsgICAgICAgICAgICAgICBub2RlX2Zy ZWUobm9kZSk7DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArICAgICAg IH0NCj4gPiArDQo+ID4gKyAgICAgICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGpjb25maWcs ICJhcHBLZXlzIiwgJmppZHhzKTsNCj4gPiArICAgICAgIGlmIChqaWR4cykNCj4gPiArICAgICAg ICAgICAgICAgcGFyc2Vfbm9kZV9rZXlzKG5vZGUsIGppZHhzLCB0cnVlKTsNCj4gPiArDQo+ID4g KyAgICAgICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGpjb25maWcsICJkZWZhdWx0VFRMIiwg Jmp2YWx1ZSk7DQo+ID4gKyAgICAgICBpZiAoanZhbHVlKSB7DQo+ID4gKyAgICAgICAgICAgICAg IGludCB0dGwgPSBqc29uX29iamVjdF9nZXRfaW50KGp2YWx1ZSk7DQo+ID4gKyAgICAgICAgICAg ICAgIG5vZGVfc2V0X2RlZmF1bHRfdHRsKG5vZGUsIHR0bCAmVFRMX01BU0spOw0KPiA+ICsgICAg ICAgfQ0KPiA+ICsNCj4gPiArZG9uZToNCj4gPiArICAgICAgIGlmIChsb2NhbCAmJiAhbm9kZV9z ZXRfbG9jYWxfbm9kZShub2RlKSkgew0KPiA+ICsgICAgICAgICAgICAgICBub2RlX2ZyZWUobm9k ZSk7DQo+ID4gKyAgICAgIC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sgICAg ICAgYm9vbCByZWZyZXNoID0gZmFsc2U7DQo+ID4gKyAgICAgICBib29sIHJlcyA9IGZhbHNlOw0K PiA+ICsNCj4gPiArICAgICAgIHN0ciA9IHByb3ZfZmlsZV9yZWFkKGZpbGVuYW1lKTsNCj4gPiAr ICAgICAgIGlmICghc3RyKSByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgam1haW4g PSBqc29uX3Rva2VuZXJfcGFyc2Uoc3RyKTsNCj4gPiArICAgICAgIGlmICgham1haW4pDQo+ID4g KyAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAobG9jYWwp IHsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmpub2RlOw0KPiA+ICsgICAgICAg ICAgICAgICBib29sIHJlc3VsdDsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGpzb25fb2Jq ZWN0X29iamVjdF9nZXRfZXgoam1haW4sICJub2RlIiwgJmpub2RlKTsNCj4gPiArICAgICAgICAg ICAgICAgaWYgKCFqbm9kZSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50 ZigiQ2Fubm90IGZpbmQgXCJub2RlXCIgb2JqZWN0Iik7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2UNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICByZXN1bHQgPSBwYXJzZV9ub2RlKGpub2RlLCB0cnVlKTsNCj4gPiAr DQo+ID4gKyAgICAgICAgICAgICAgIC8qDQo+ID4gKyAgICAgICAgICAgICAgICogSWYgbG9jYWwg bm9kZSBpcyBwcm92aXNpb25lciwgdGhlIHJlc3Qgb2YgbWVzaCBzZXR0aW5ncw0KPiA+ICsgICAg ICAgICAgICAgICAqIGFyZSByZWFkIGZyb20gcHJvdmlzaW9uaW5nIGRhdGFiYXNlLg0KPiA+ICsg ICAgICAgICAgICAgICAqLw0KPiA+ICsgICAgICAgICAgICAgICBpZiAocHJvdmlzaW9uZXIpIHsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICByZXMgPSByZXN1bHQ7DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKyAg ICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgLyogSVYgaW5kZXggKi8NCj4gPiArICAgICAgIGpz b25fb2JqZWN0X29iamVjdF9nZXRfZXgoam1haW4sICJJVmluZGV4IiwgJmp2YWx1ZSk7DQo+ID4g KyAgICAgICBpZiAoIWp2YWx1ZSkNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ ICsNCj4gPiArICAgICAgIGluZGV4ID0ganNvbl9vYmplY3RfZ2V0X2ludChqdmFsdWUpOw0KPiA+ ICsNCj4gPiArICAgICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoam1haW4sICJJVnVwZGF0 ZSIsICZqdmFsdWUpOw0KPiA+ICsgICAgICAgaWYgKCFqdmFsdWUpDQo+ID4gKyAgICAgICAgICAg ICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICB2YWx1ZV9pbnQgPSBqc29uX29iamVj dF9nZXRfaW50KGp2YWx1ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgbmV0X3NldF9pdl9pbmRleChp bmRleCwgdmFsdWVfaW50KTsNCj4gPiArDQo+ID4gKyAgICAgICAvKiBOZXR3b3JrIGtleShzKSAq Lw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqbWFpbiwgIm5ldEtleXMi LCAmamFycmF5KTsNCj4gPiArICAgICAgIGlmICghamFycmF5KQ0KPiA+ICsgICAgICAgICAgICAg ICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgbGVuID0ganNvbl9vYmplY3RfYXJyYXlf bGVuZ3RoKGphcnJheSk7DQo+ID4gKyAgICAgICBybF9wcmludGYoIiMgbmV0a2V5cyA9ICVkXG4i LCBsZW4pOw0KPiA+ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47ICsraSkgew0K PiA+ICsgICAgICAgICAgICAgICB1aW50MzJfdCBpZHg7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICBqdGVtcCA9IGpzb25fb2JqZWN0X2FycmF5X2dldF9pZHgoamFycmF5LCBpKTsNCj4gPiAr ICAgICAgICAgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqdGVtcCwgImluZGV4Iiwg Jmp2YWx1ZSk7DQo+ID4gKyAgICAgICAgICAgICAgIGlmICghanZhbHVlKQ0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArICAgICAgICAgICAgICAgaWR4ID0ganNv bl9vYmplY3RfZ2V0X2ludChqdmFsdWUpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAganNv bl9vYmplY3Rfb2JqZWN0X2dldF9leChqdGVtcCwgImtleSIsICZqdmFsdWUpOw0KPiA+ICsgICAg ICAgICAgICAgICBpZiAoIWp2YWx1ZSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlm ICghbWVzaF9nZXRfcmFuZG9tX2J5dGVzKGtleSwgMTYpKQ0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGFk ZF9rZXkoanRlbXAsICJrZXkiLCBrZXkpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJl ZnJlc2ggPSB0cnVlOw0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIHZhbHVlX3N0ciA9IChjaGFyICopanNvbl9vYmplY3RfZ2V0X3N0cmlu ZyhqdmFsdWUpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICghc3RyMmhleCh2YWx1 ZV9zdHIsIHN0cmxlbih2YWx1ZV9zdHIpLCBrZXksIDE2KSkgew0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg IH0NCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgaWYg KCFrZXlzX25ldF9rZXlfYWRkKGlkeCwga2V5LCBmYWxzZSkpDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgZ290byBkb25lOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmpl Y3Rfb2JqZWN0X2dldF9leChqdGVtcCwgImtleVJlZnJlc2giLCAmanZhbHVlKTsNCj4gPiArICAg ICAgICAgICAgICAgaWYgKCFqdmFsdWUpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ290 byBkb25lOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAga2V5c19zZXRfa3JfcGhhc2UoaWR4 LCAodWludDhfdCkganNvbl9vYmplY3RfZ2V0X2ludChqdmFsdWUpKTsNCj4gPiArICAgICAgIH0N Cj4gPiArDQo+ID4gKyAgICAgICAvKiBBcHAga2V5cyAqLw0KPiA+ICsgICAgICAganNvbl9vYmpl Y3Rfb2JqZWN0X2dldF9leChqbWFpbiwgImFwcEtleXMiLCAmamFycmF5KTsNCj4gPiArICAgICAg IGlmIChqYXJyYXkpIHsNCj4gPiArICAgICAgICAgICAgICAgbGVuID0ganNvbl9vYmplY3RfYXJy YXlfbGVuZ3RoKGphcnJheSk7DQo+ID4gKyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiIyBhcHBr ZXlzID0gJWRcbiIsIGxlbik7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBmb3IgKGkgPSAw OyBpIDwgbGVuOyArK2kpIHsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpbnQgYXBwX2lk eDsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpbnQgbmV0X2lkeDsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAganRlbXAgPSBqc29uX29iamVjdF9hcnJheV9nZXRfaWR4 KGphcnJheSwgaSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAganNvbl9vYmplY3Rfb2Jq ZWN0X2dldF9leChqdGVtcCwgImluZGV4IiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAmanZhbHVlKTsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICBpZiAoIWp2YWx1ZSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdv dG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYXBwX2lkeCA9IGpz b25fb2JqZWN0X2dldF9pbnQoanZhbHVlKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBp ZiAoIUNIRUNLX0tFWV9JRFhfUkFOR0UoYXBwX2lkeCkpDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIGpzb25fb2JqZWN0X29iamVjdF9nZXRfZXgoanRlbXAsICJrZXkiLCAmanZhbHVlKTsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWp2YWx1ZSkgew0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgaWYgKCFtZXNoX2dldF9yYW5kb21fYnl0ZXMoa2V5LCAxNikp DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZF9rZXkoanRlbXAsICJrZXki LCBrZXkpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaCA9IHRy dWU7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX3N0ciA9DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIChjaGFyICopanNvbl9vYmplY3RfZ2V0X3N0cmluZyhqdmFs dWUpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyMmhleCh2YWx1ZV9z dHIsIHN0cmxlbih2YWx1ZV9zdHIpLCBrZXksIDE2KTsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGpzb25fb2JqZWN0X29i amVjdF9nZXRfZXgoanRlbXAsICJib3VuZE5ldEtleSIsDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmanZhbHVlKTsNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICBpZiAoIWp2YWx1ZSkNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIGdvdG8gZG9uZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgbmV0X2lkeCA9IGpzb25fb2JqZWN0X2dldF9pbnQoanZhbHVlKTsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBpZiAoIUNIRUNLX0tFWV9JRFhfUkFOR0UobmV0X2lkeCkpDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIGtleXNfYXBwX2tleV9hZGQobmV0X2lkeCwgYXBwX2lkeCwga2V5 LCBmYWxzZSk7DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgIH0NCj4gPiArDQo+ ID4gKyAgICAgICAvKiBQcm92aXNpb25lciBpbmZvICovDQo+ID4gKyAgICAgICBqc29uX29iamVj dF9vYmplY3RfZ2V0X2V4KGptYWluLCAicHJvdmlzaW9uZXJzIiwgJmphcnJheSk7DQo+ID4gKyAg ICAgICBpZiAoIWphcnJheSkNCj4gPiArICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsN Cj4gPiArICAgICAgIGxlbiA9IGpzb25fb2JqZWN0X2FycmF5X2xlbmd0aChqYXJyYXkpOw0KPiA+ ICsgICAgICAgcmxfcHJpbnRmKCIjIHByb3Zpc2lvbmVycyA9ICVkXG4iLCBsZW4pOw0KPiA+ICsN Cj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47ICsraSkgew0KPiA+ICsNCj4gPiArICAg ICAgICAgICAgICAganByb3YgPSBqc29uX29iamVjdF9hcnJheV9nZXRfaWR4KGphcnJheSwgaSk7 DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAvKiBBbGxvY2F0ZWQgdW5pY2FzdCByYW5nZSAq Lw0KPiA+ICsgICAgICAgICAgICAgICBqc29uX29iamVjdF9vYmplY3RfZ2V0X2V4KGpwcm92LCAi YWxsb2NhdGVkVW5pY2FzdFJhbmdlIiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAmanRlbXApOw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIWp0 ZW1wKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAg ICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBpZiAoIXBhcnNlX3VuaWNh c3RfcmFuZ2UoanRlbXApKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcmxfcHJpbnRm KCJEb25lZWQgdG8gcGFyc2UgdW5pY2FzdCByYW5nZVxuIik7DQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgZ290byBkb25lOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKyAgICAgICB9 DQo+ID4gKw0KPiA+ICsgICAgICAganNvbl9vYmplY3Rfb2JqZWN0X2dldF9leChqbWFpbiwgIm5v ZGVzIiwgJmphcnJheSk7DQo+ID4gKyAgICAgICBpZiAoIWphcnJheSkgew0KPiA+ICsgICAgICAg ICAgICAgICByZXMgPSB0cnVlOw0KPiA+ICsgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4g KyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgbGVuID0ganNvbl9vYmplY3RfYXJyYXlfbGVu Z3RoKGphcnJheSk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmxfcHJpbnRmKCIjIHByb3Zpc2lvbmVk IG5vZGVzID0gJWRcbiIsIGxlbik7DQo+ID4gKyAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyAr K2kpIHsNCj4gPiArICAgICAgICAgICAgICAganNvbl9vYmplY3QgKmpub2RlOw0KPiA+ICsgICAg ICAgICAgICAgICBqbm9kZSA9IGpzb25fb2JqZWN0X2FycmF5X2dldF9pZHgoamFycmF5LCBpKTsN Cj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGlmICgham5vZGUgfHwgIXBhcnNlX25vZGUoam5v ZGUsIGZhbHNlKSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGRvbmU7DQo+ID4g KyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcmVzID0gdHJ1ZTsNCj4gPiArZG9uZToNCj4g PiArDQo+ID4gKyAgICAgICBnX2ZyZWUoc3RyKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAocmVz ICYmIHJlZnJlc2gpDQo+ID4gKyAgICAgICAgICAgICAgIHByb3ZfZmlsZV93cml0ZShqbWFpbiwg ZmFsc2UpOw0KPiA+ICsNC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VUX09PQiAzDQo+ID4gKw0KPiA+ICsjZGVmaW5lIFBST1ZfRVJSX0lOVkFM SURfUERVICAgICAgICAgICAweDAxDQo+ID4gKyNkZWZpbmUgUFJPVl9FUlJfSU5WQUxJRF9GT1JN QVQgICAgICAgICAgICAgICAgMHgwMg0KPiA+ICsjZGVmaW5lIFBST1ZfRVJSX1VORVhQRUNURURf UERVICAgICAgICAgICAgICAgIDB4MDMNCj4gPiArI2RlZmluZSBQUk9WX0VSUl9DT05GSVJNX0ZB SUxFRCAgICAgICAgICAgICAgICAweDA0DQo+ID4gKyNkZWZpbmUgUFJPVl9FUlJfSU5TVUZfUkVT T1VSQ0UgICAgICAgICAgICAgICAgMHgwNQ0KPiA+ICsjZGVmaW5lIFBST1ZfRVJSX0RFQ1JZUFRf RkFJTEVEICAgICAgICAgICAgICAgIDB4MDYNCj4gPiArI2RlZmluZSBQUk9WX0VSUl9VTkVYUEVD VEVEX0VSUiAgICAgICAgICAgICAgICAweDA3DQo+ID4gKyNkZWZpbmUgUFJPVl9FUlJfQ0FOVF9B U1NJR05fQUREUiAgICAgIDB4MDgNCj4gPiArDQo+ID4gKy8qIEV4cGVjdGVkIFByb3Zpc2lvbmlu ZyBQRFUgc2l6ZXMgKi8NCj4gPiArc3RhdGljIGNvbnN0IHVpbnQxNl90IGV4cGVjdGVkX3BkdV9z aXplW10gPSB7DQo+ID4gKyAgICAgICAxICsgMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgLyogUFJPVl9JTlZJVEUgKi8NCj4gPiArICAgICAgIDEgKyAxICsgMiArIDEgKyAxICsg MSArIDIgKyAxICsgMiwgICAgICAvKiBQUk9WX0NBUFMgKi8NCj4gPiArICAgICAgIDEgKyAxICsg MSArIDEgKyAxICsgMSwgICAgICAgICAgICAgICAgICAvKiBQUk9WX1NUQVJUICovDQo+ID4gKyAg ICAgICAxICsgNjQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogUFJPVl9QVUJf S0VZICovDQo+ID4gKyAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgLyogUFJPVl9JTlBfQ01QTFQgKi8NCj4gPiArICAgICAgIDEgKyAxNiwgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAvKiBQUk9WX0NPTkZJUk0gKi8NCj4gPiArICAgICAgIDEgKyAx NiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBQUk9WX1JBTkRPTSAqLw0KPiA+ ICsgICAgICAgMSArIDE2ICsgMiArIDEgKyA0ICsgMiArIDgsICAgICAgICAgICAgIC8qIFBST1Zf REFUQSAqLw0KPiA+ICsgICAgICAgMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIC8qIFBST1ZfQ09NUExFVEUgKi8NCj4gPiArICAgICAgIDEgKyAxLCAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAvKiBQUk9WX0ZBSUxFRCAqLw0KPiA+ICt9Ow0KPiA+ICsNCj4g PiArdHlwZWRlZiBzdHJ1Y3QgX19wYWNrZWQgew0KPiA+ICsgICAgICAgdWludDhfdCBhdHRlbnRp b247DQo+ID4gK30gX19hdHRyaWJ1dGVfXyAoKHBhY2tlZCkpICAgICBwcm92X2ludml0ZTsNCj4g PiArDQo+ID4gK3R5cGVkZWYgc3RydWN0IHsNCj4gPiArICAgICAgIHVpbnQ4X3QgIG51bV9lbGU7 DQo+ID4gKyAgICAgICB1aW50MTZfdCBhbGdvcml0aG1zOw0KPiA+ICsgICAgICAgdWludDhfdCAg cHViX3R5cGU7DQo+ID4gKyAgICAgICB1aW50OF90ICBzdGF0aWNfdHlwZTsNCj4gPiArICAgICAg IHVpbnQ4X3QgIG91dHB1dF9zaXplOw0KPiA+ICsgICAgICAgdWludDE2X3Qgb3V0cHV0X2FjdGlv bjsNCj4gPiArICAgICAgIHVpbnQ4X3QgIGlucHV0X3NpemU7DQo+ID4gKyAgICAgICB1aW50MTZf dCBpbnB1d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jsNCj4gPiArICAgICAgIHVpbnQ4 X3QgICAgICAgICAgICAgICAgIHN0YXRlOw0KPiA+ICsgICAgICAgdWludDhfdCAgICAgICAgICAg ICAgICAgZXBoX3ByaXZfa2V5WzMyXTsNCj4gPiArICAgICAgIHVpbnQ4X3QgICAgICAgICAgICAg ICAgIGVjZGhfc2VjcmV0WzMyXTsNCj4gPiArICAgICAgIGNvbmZfaW5wdXQgICAgICAgICAgICAg IGNvbmZfaW47DQo+ID4gKyAgICAgICB1aW50OF90ICAgICAgICAgICAgICAgICByYW5kX2F1dGhb MzJdOw0KPiA+ICsgICAgICAgdWludDhfdCAgICAgICAgICAgICAgICAgc2FsdFsxNl07DQo+ID4g KyAgICAgICB1aW50OF90ICAgICAgICAgICAgICAgICBjb25mX2tleVsxNl07DQo+ID4gKyAgICAg ICB1aW50OF90ICAgICAgICAgICAgICAgICBtZXNoX2NvbmZbMTZdOw0KPiA+ICsgICAgICAgdWlu dDhfdCAgICAgICAgICAgICAgICAgZGV2X2tleVsxNl07DQo+ID4gK307DQo+ID4gKw0KPiA+ICtz dGF0aWMgdWludDhfdCB1MTZfaGlnaGVzdF9iaXQodWludDE2X3QgbWFzaykNCj4gPiArew0KPiA+ ICsgICAgICAgdWludDhfdCBjbnQgPSAwOw0KPiA+ICsNCj4gPiArICAgICAgIGlmICghbWFzaykg cmV0dXJuIDB4ZmY7DQo+ID4gKw0KPiA+ICsgICAgICAgd2hpbGUgKG1hc2sgJiAweGZmZmUpIHsN Cj4gPiArICAgICAgICAgICAgICAgY250Kys7DQo+ID4gKyAgICAgICAgICAgICAgIG1hc2sgPj49 IDE7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIGNudDsNCj4gPiAr fQ0KPiA+ICsNCj4gPiArYm9vbCBwcm92X29wZW4oc3RydWN0IG1lc2hfbm9kZSAqbm9kZSwgR0RC dXNQcm94eSAqcHJvdl9pbiwNCj4gdWludDE2X3QgbmV0X2lkeCwNC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ldl9rZXkpKTsNCj4gPiArDQo+ID4gKyAgICAgICBpZiAo IW5ldF9nZXRfa2V5KHByb3YtPm5ldF9pZHgsIG91dCArIDIpKQ0KPiA+ICsgICAgICAgICAgICAg ICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgcHV0X2JlMTYocHJvdi0+bmV0X2lk eCwgb3V0ICsgMiArIDE2KTsNCj4gPiArICAgICAgIG5ldF9nZXRfZmxhZ3MocHJvdi0+bmV0X2lk eCwgb3V0ICsgMiArIDE2ICsgMik7DQo+ID4gKyAgICAgICBwdXRfYmUzMihuZXRfZ2V0X2l2X2lu ZGV4KE5VTEwpLCBvdXQgKyAyICsgMTYgKyAyICsgMSk7DQo+ID4gKyAgICAgICBwdXRfYmUxNihw cm92LT5uZXdfYWRkciwgb3V0ICsgMiArIDE2ICsgMiArIDEgKyA0KTsNCj4gPiArDQo+ID4gKyAg ICAgICBwcmludF9ieXRlX2FycmF5KCJEYXRhXHQiLCBvdXQgKyAyLCAxNiArIDIgKyAxICsgNCAr IDIpOw0KPiA+ICsNCj4gPiArICAgICAgIG1lc2hfY3J5cHRvX2Flc19jY21fZW5jcnlwdChub25j ZSwga2V5LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxM LCAwLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQgKyAy LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2Yob3V0 KSAtIDIgLSBzaXplb2YobWljKSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgb3V0ICsgMiwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgJm1pYywgc2l6ZW9mKG1pYykpOw0KPiA+ICsNCj4gPiArICAgICAgIHByaW50X2J5dGVf YXJyYXkoIkRhdGFFbmNyeXB0ZWQgKyBta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fdCB0eXBlLCB2b2lkICpi dWYsIHVpbnQxNl90IGxlbiwNCj4gPiArICAgICAgICAgICAgICAgdm9pZCAqbm9kZSkNCj4gPiAr ew0KPiA+ICsgICAgICAgc3RydWN0IHByb3ZfZGF0YSAqcHJvdiA9IG5vZGVfZ2V0X3Byb3Yobm9k ZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKHByb3YgPT0gTlVMTCkgcmV0dXJuOw0KPiA+ICsN Cj4gPiArICAgICAgIHN3aXRjaCAodHlwZSkgew0KPiA+ICsgICAgICAgICAgICAgICBkZWZhdWx0 Og0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIE5PTkU6DQo+ID4gKyAgICAgICAgICAgICAgIGNh c2UgT1VUUFVUOg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHByb3ZfY29tcGxldGUobm9k ZSwgUFJPVl9FUlJfSU5WQUxJRF9QRFUpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJl dHVybjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGNhc2UgQVNDSUk6DQo+ID4gKyAgICAg ICAgICAgICAgIGNhc2UgSEVYQURFQ0lNQUw6DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg aWYgKGxlbiA+IDE2KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdl9j b21wbGV0ZShub2RlLCBQUk9WX0VSUl9JTlZBTElEX1BEVSk7DQo+ID4gKw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIG1lbWNweShwcm92LT5yYW5kX2F1dGggKyAxNiwgYnVmLCBsZW4pOw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgY2FzZSBERUNJTUFMOg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4g IT0gNCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3ZfY29tcGxldGUo bm9kZSwgUFJPVl9FUlJfSU5WQUxJRF9QRFUpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBtZW1jcHkocHJvdi0+cmFuZF9hdXRoICsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHByb3YtPnJhbmRfYXV0aCkgLQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YodWludDMyX3QpLA0KPiA+ ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWYsIGxlbik7DQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ ICsgICAgICAgcHJvdl9zZW5kX2NvbmZpcm0obm9kZSk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0 YXRpYyB1aW50MzJfdCBwb3dlcl90ZW4odWludDhfdCBwb3dlcikNCj4gPiArew0KPiA+ICsgICAg ICAgdWludDMyX3QgcmV0ID0gMTsNCj4gPiArDQo+ID4gKyAgICAgICB3aGlsZSAocG93ZXItLSkN Cj4gPiArICAgICAgICAgICAgICAgcmV0ICo9IDEwOw0KPiA+ICsNCj4gPiArICAgICAgIHJldHVy biByZXQ7DQo+ID4gK30NCj4gPiArDQo+ID4gK2NoYXIgKmluX2FjdGlvblszXSA9IHsNCj4gPiAr ICAgICAgICJQdXNoIiwNCj4gPiArICAgICAgICJUd2lzdCIsDQo+ID4gKyAgICAgICAiRW50ZXIi DQo+ID4gK307DQo+ID4gKw0KPiA+ICtzdGF0aWMgdm9pZCBwcm92X2NhbGNfZWNkaChEQnVzTWVz c2FnZSAqbWVzc2FnZSwgdm9pZCAqbm9kZSkNCj4gPiArew0KPiA+ICsgICAgICAgc3RydWN0IHBy b3ZfZGF0YSAqcHJvdiA9IG5vZGVfZ2V0X3Byb3Yobm9kZSk7D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wcm92LT5lY2RoX3NlY3JldCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcm92 LT5zYWx0LCBwcm92LT5jb25mX2tleSk7DQo+ID4gKw0KPiA+ICsgICAgICAgc3dpdGNoIChwcm92 LT5jb25mX2luLnN0YXJ0LmF1dGhfbWV0aG9kKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGRlZmF1 bHQ6DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHJvdl9jb21wbGV0ZShub2RlLCBQUk9W X0VSUl9JTlZBTElEX1BEVSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQo+ ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIDA6IC8qIE5vIE9PQiAqLw0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIHByb3Zfc2VuZF9jb25maXJtKG5vZGUpOw0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgY2FzZSAx OiAvKiBTdGF0aWMgT09CICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYWdlbnRfaW5w dXRfcmVxdWVzdChIRVhBREVDSU1BTCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgMTYsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHByb3Zfb3V0X29vYl9kb25lLCBub2RlKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICBicmVhazsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGNhc2UgMjogLyogT3V0cHV0IE9P QiAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChhY3Rpb24gPD0gMykNCj4gPiAr ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFnZW50X2lucHV0X3JlcXVlc3QoREVDSU1B TCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz aXplLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHByb3Zfb3V0X29vYl9kb25lLCBub2RlKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBl bHNlDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZ2VudF9pbnB1dF9yZXF1 ZXN0KEFTQ0lJLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHNpemUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgcHJvdl9vdXRfb29iX2RvbmUsIG5vZGUpOw0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgY2FzZSAzOiAvKiBJbnB1 dCBPT0IgKi8NCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFjdGlvbiA8 PSAyKSB7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNoX2dldF9yYW5k b21fYnl0ZXMoJmluX29vYiwgc2l6ZW9mKGluX29vYikpOw0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgaW5fb29iICU9IHBvd2VyX3RlbihzaXplKTsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHNwcmludGYoaW5fb29iX2Rpc3BsYXksICIlcyAlZCBvbiBk ZXZpY2VcbiIsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlu X2FjdGlvblthY3Rpb25dLCBpbl9vb2IpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgcHV0X2JlMzIoaW5fb29iLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHByb3YtPnJhbmRfYXV0aCArDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHByb3YtPnJhbmRfYXV0aCkg LQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNp emVvZih1aW50MzJfdCkpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OF90IGluX2FzY2lpWzldOw0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGkgPSBzaXplOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc2hfZ2V0X3JhbmRvbV9ieXRl cyhpbl9hc2NpaSwgaSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgd2hpbGUgKGktLSkgew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBpbl9hc2NpaVtpXSA9DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgaW5fYXNjaWlbaV0gJSAoKDI2ICogMikgKyAxMCk7DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbl9hc2NpaVtpXSA+PSAxMCAr IDI2KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGluX2FzY2lpW2ldICs9ICdhJyAtICgxMCArIDI2KTsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoaW5fYXNjaWlbaV0gPj0gMTApDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5fYXNjaWlbaV0g Kz0gJ0EnIC0gMTA7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGVsc2UNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBpbl9hc2NpaVtpXSArPSAnMCc7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICB9DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbl9hc2NpaVtzaXplXSA9 ICdcMCc7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZW1jcHkocHJvdi0+ cmFuZF9hdXRoICsgMTYsIGluX2FzY2lpLCBzaXplKTsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHNwcmludGYoaW5fb29iX2Rpc3BsYXksDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkVudGVyICVzIG9uIGRldmljZVxuIiwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbl9h c2NpaSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgfQ0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgIHJsX3ByaW50ZigiQWdlbnQgU3RyaW5nOiAlc1xuIiwgaW5fb29iX2Rpc3BsYXkp Ow0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGFnZW50X291dHB1dF9yZXF1ZXN0KGluX29v Yl9kaXNwbGF5KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCj4gPiArICAg ICAgIH0NCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgcHJvdl9zZW5kX3B1Yl9rZXko c3RydWN0IG1lc2hfbm9kZSAqbm9kZSkNCj4gPiArew0KPiA+ICsgICAgICAgc3RydWN0IHByb3Zf ZGF0YSAqcHJvdiA9IG5vZGVfZ2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YSAoJWQgYnl0ZXMp XG4iLCBsZW4pOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChidWZbMF0gPiBQUk9WX0ZBSUxFRCB8 fCBleHBlY3RlZF9wZHVfc2l6ZVtidWZbMF1dICE9IGxlbikNCj4gPiArICAgICAgICAgICAgICAg cmV0dXJuIHByb3ZfY29tcGxldGUobm9kZSwgUFJPVl9FUlJfSU5WQUxJRF9QRFUpOw0KPiA+ICsN Cj4gPiArICAgICAgIHByaW50X2J5dGVfYXJyYXkoIlx0IiwgYnVmLCBsZW4pOw0KPiA+ICsNCj4g PiArICAgICAgIGlmIChidWZbMF0gPT0gUFJPVl9GQUlMRUQpDQo+ID4gKyAgICAgICAgICAgICAg IHJldHVybiBwcm92X2NvbXBsZXRlKG5vZGUsIGJ1ZlsxXSk7DQo+ID4gKw0KPiA+ICsgICAgICAg LyogQ2hlY2sgcHJvdmlzaW9uaW5nIHN0YXRlICovDQo+ID4gKyAgICAgICBzd2l0Y2ggKHByb3Yt PnN0YXRlKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGRlZmF1bHQ6DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgcmV0dXJuIHByb3ZfY29tcGxldGUobm9kZSwgUFJPVl9FUlJfSU5WQUxJRF9Q RFUpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgY2FzZSBQUk9WX0lOVklURToNCj4gPiAr DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJ1ZlswXSAhPSBQUk9WX0NBUFMpDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdl9jb21wbGV0ZShu b2RlLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IFBST1ZfRVJSX0lOVkFMSURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAg ICAgLyogTm9ybWFsaXplIHRvIGJlZ2lubmluZyBvZiBwYWNrZWQgUGFyYW0gc3RydWN0ICovDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgYnVmKys7DQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgbGVuLS07DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIC8qIFNhdmUg Q2FwYWJpbGl0eSB2YWx1ZXMgKi8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBtZW1jcHko JnByb3YtPmNvbmZfaW4uY2FwcywgYnVmLCBsZW4pOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICBzZWNfbGV2ZWwgPSBtZXNoX2dhdHRfcHJvdl9zZWN1cml0eSgpOw0KPiA+ICsN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VjX2xldmVsID09IE1FU0hfUFJPVl9T RUNfSElHSCkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8q IEVuZm9yY2UgSGlnaCBTZWN1cml0eSAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgaWYgKHByb3YtPmNvbmZfaW4uY2Fwcy5wdWJfdHlwZSAhPSAxICYmDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3YtPmNvbmZfaW4uY2Fwcy5zdGF0 aWNfdHlwZSAhPSAxKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICByZXR1cm4gcHJvdl9jb21wbGV0ZShub2RlLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPVl9FUlJfSU5WQUxJRF9QRFUpOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNlY19sZXZlbCA9 PSBNRVNIX1BST1ZfU0VDX01FRCkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIC8qIEVuZm9yY2UgTWVkaXVtIFNlY3VyaXR5ICovDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBpZiAocHJvdi0+Y29uZl9pbi5jYXBzLnB1Yl90eXBlICE9IDEg JiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdi0+Y29u Zl9pbi5jYXBzLnN0YXRpY190eXBlICE9IDEgJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgcHJvdi0+Y29uZl9pbi5jYXBzLmlucHV0X3NpemUgPT0gMCAmJg0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm92LT5jb25mX2lu LmNhcHMub3V0cHV0X3NpemUgPT0gMCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgcmV0dXJuIHByb3ZfY29tcGxldGUobm9kZSwNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1ZfRVJSX0lOVkFM SURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgfQ0KPiA+ICsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAvKiBOdW0gRWxlbWVudHMgY2Fubm90IGJlIFplcm8g Ki8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJvdi0+Y29uZl9pbi5jYXBzLm51 bV9lbGUgPT0gMCkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBw cm92X2NvbXBsZXRlKG5vZGUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgUFJPVl9FUlJfSU5WQUxJRF9QRFUpOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICAvKiBBbGwgbm9kZXMgbXVzdCBzdXBwb3J0IEFsZ29yaXRobSAweDAw MDEgKi8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShnZXRfYmUxNihidWYgKyAx KSAmIDB4MDAwMSkpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4g cHJvdl9jb21wbGV0ZShub2RlLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFBST1ZfRVJSX0lOVkFMSURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgLyogUHViIEtleSBhbmQgU3RhdGljIHR5cGUgbWF5IG5vdCBiZSA+ IDEgKi8NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJvdi0+Y29uZl9pbi5jYXBz LnB1Yl90eXBlID4gMHgwMSB8fA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBwcm92LT5jb25mX2luLmNhcHMuc3RhdGljX3R5cGUgPiAweDAxKQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb3ZfY29tcGxldGUobm9kZSwNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9WX0VS Ul9JTlZBTElEX1BEVSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHByb3Yt Pm5ld19hZGRyID0NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldF9vYnRh aW5fYWRkcmVzcyhwcm92LT5jb25mX2luLmNhcHMubnVtX2VsZSk7DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIGlmICghcHJvdi0+bmV3X2FkZHIpDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdl9jb21wbGV0ZShub2RlLA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1ZfRVJSX0lOVkFM SURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgb3V0WzFdID0gUFJP Vl9TVEFSVDsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcm92LT5jb25mX2luLnN0YXJ0 LmFsZ29yaXRobSA9IDA7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgcHJvdi0+Y29uZl9p bi5zdGFydC5wdWJfa2V5ID0NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBy b3YtPmNvbmZfaW4uY2Fwcy5wdWJfdHlwZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgLyogQ29tcG9zZSBTVEFSVCBiYXNlZCBvbiBtb3N0IHNlY3VyZSB2YWx1ZXMgKi8NCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJvdi0+Y29uZl9pbi5jYXBzLnN0YXRpY190 eXBlKSB7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdi0+ Y29uZl9pbi5zdGFydC5hdXRoX21ldGhvZCA9DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFBST1ZfU1RBVElDX09PQjsNCj4gPiArDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgfSBlbHNlIGlmIChwcm92LT5jb25mX2luLmNhcHMub3V0cHV0X3NpemUgPg0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm92LT5jb25mX2lu LmNhcHMuaW5wdXRfc2l6ZSkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHByb3YtPmNvbmZfaW4uc3RhcnQuYXV0aF9tZXRob2QgPQ0KPiA+ICsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9WX09VVFBVVF9PT0I7DQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBwcm92LT5jb25mX2luLnN0YXJ0LmF1dGhfYWN0aW9u ID0NCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdTE2X2hpZ2hl c3RfYml0KGdldF9iZTE2KGJ1ZiArIDYpKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHByb3YtPmNvbmZfaW4uc3RhcnQuYXV0aF9zaXplID0NCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdi0+Y29uZl9pbi5jYXBzLm91dHB1dF9zaXpl Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByb3YtPmNv bmZfaW4uY2Fwcy5pbnB1dF9zaXplID4gMCkgew0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIHByb3YtPmNvbmZfaW4uc3RhcnQuYXV0aF9tZXRob2QgPQ0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9WX0lOUFVUX09PQjsNCj4g PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3YtPmNvbmZfaW4uc3RhcnQuYXV0 aF9hY3Rpb24gPQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1 MTZfaGlnaGVzdF9iaXQoZ2V0X2JlMTYoYnVmICsgOSkpOw0KPiA+ICsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgcHJvdi0+Y29uZl9pbi5zdGFydC5hdXRoX3NpemUgPQ0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm92LT5jb25mX2luLmNhcHMuaW5w dXRfc2l6ZTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgIC8qIFJhbmdlIENoZWNrIFNUQVJUIHZhbHVlcyAqLw0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIGlmIChwcm92LT5jb25mX2luLnN0YXJ0LmF1dGhfc2l6ZSA+ IDgpDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdl9jb21w bGV0ZShub2RlLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIFBST1ZfRVJSX0lOVkFMSURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAg ICAgICAgICAgcHJvdi0+c3RhdGUgPSBQUk9WX1NUQVJUOw0KPiA+ICsNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICBtZW1jcHkob3V0ICsgMiwgJnByb3YtPmNvbmZfaW4uc3RhcnQsIDUpOw0K PiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBlY2NfbWFrZV9rZXkocHJvdi0+Y29u Zl9pbi5wcnZfcHViX2tleSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgcHJvdi0+ZXBoX3ByaXZfa2V5KTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICAg ICAgICAgLyogU3dhcCBwdWJsaWMga2V5IHRvIHNoYXJlIGludG8gTWVzaCBieXRlIG9yZGVyaW5n ICovDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgc3dhcF91MjU2X2J5dGVzKHByb3YtPmNv bmZfaW4ucHJ2X3B1Yl9rZXkpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHN3YXBfdTI1 Nl9ieXRlcyhwcm92LT5jb25mX2luLnBydl9wdWJfa2V5ICsgMzIpOw0KPiA+ICsNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWVzaF9nYXR0X3dyaXRlKHByb3YtPnByb3ZfaW4s IG91dCwgNywNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJv dl9zdGFydF9jbXBsdCwgbm9kZSk7DQo+ID4gKw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAg Y2FzZSBQUk9WX1BVQl9LRVk6DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJ1Zlsw XSA9PSBQUk9WX1BVQl9LRVkgJiYNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIXByb3YtPmNvbmZfaW4uc3RhcnQucHViX2tleSkgew0KPiA+ICsNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lbWNweShwcm92LT5jb25mX2luLmRldl9wdWJf a2V5LCBidWYgKyAxLCA2NCk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBw cm92X2NhbGNfZWNkaChOVUxMLCBub2RlKTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICB9 IGVsc2UgaWYgKGJ1ZlswXSA9PSBQUk9WX0lOUF9DTVBMVCkgew0KPiA+ICsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgYWdlbnRfb3V0cHV0X3JlcXVlc3RfY2FuY2VsKCk7DQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdl9zZW5kX2NvbmZpcm0obm9k ZSk7DQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlDQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdl9jb21wbGV0ZShub2RlLA0KPiA+ICsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1ZfRVJSX0lOVkFM SURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGNhc2UgUFJPVl9DT05GSVJNOg0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChidWZbMF0gIT0gUFJPVl9DT05GSVJNKQ0K PiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb3ZfY29tcGxldGUo bm9kZSwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBQUk9WX0VSUl9JTlZBTElEX1BEVSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICAgICAg ICAgIG1lbWNweShwcm92LT5tZXNoX2NvbmYsIGJ1ZiArIDEsIDE2KTsNCj4gPiArDQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgb3V0WzFdID0gUFJPVl9SQU5ET007DQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgbWVtY3B5KG91dCArIDIsIHByb3YtPnJhbmRfYXV0aCwgMTYpOw0KPiA+ ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBwcm92LT5zdGF0ZSA9IFBST1ZfUkFORE9N Ow0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtZXNoX2dhdHRfd3JpdGUocHJv di0+cHJvdl9pbiwgb3V0LCAxOCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgTlVMTCwgbm9kZSk7DQo+ID4gKw0KPiA+ICsgICAgICAgICAgICAgICBjYXNlIFBS T1ZfUkFORE9NOg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChidWZbMF0gIT0gUFJP Vl9SQU5ET00pDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJv dl9jb21wbGV0ZShub2RlLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIFBST1ZfRVJSX0lOVkFMSURfUERVKTsNCj4gPiArDQo+ID4gKyAgICAgICAg ICAgICAgICAgICAgICAgLyogQ2FsY3VsYXRlIE5ldyBTYWx0IHdoaWxlIHdlIHN0aWxsIGhhdmUN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgKiBib3RoIHJhbmRvbSB2YWx1ZXMgKi8NCj4g PiArICAgICAgICAgICAgICAgICAgICAgICBtZXNoX2NyeXB0b19wcm92X3Byb3Zfc2FsdChwcm92 LT5zYWx0LA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgcHJvdi0+cmFuZF9hdXRoLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmICsgMSwNCj4gPiArICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3YtPnNhbHQp Ow0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAvKiBDYWxjdWxhdGUgbWVzaHMg Q29uZiBWYWx1ZSAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIG1lbWNweShwcm92LT5y YW5kX2F1dGgsIGJ1ZiArIDEsIDE2KTsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBtZXNo X2NyeXB0b19hZXNfY21hYyhwcm92LT5jb25mX2tleSwgcHJvdi0+cmFuZF9hdXRoLA0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHByb3YtPnJhbmRfYXV0aCksIG91 dCArIDEpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAvKiBWYWxpZGF0ZSBN ZXNoIGNvbmZpcm1hdGlvbiAqLw0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChtZW1j bXAob3V0ICsgMSwgcHJvdi0+bWVzaF9jb25mLCAxNikgIT0gMCkNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHJldHVybiBwcm92X2NvbXBsZXRlKG5vZGUsDQo+ID4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPVl9FUlJfSU5WQUxJ RF9QRFUpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIkNv bmZpcm1hdGlvbiBWYWxpZGF0ZWRcbiIpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAgICAgICAg ICAgICBwcm92X3NlbmRfcHJvdl9kYXRhKG5vZGUpOw0KPiA+ICsNCj4gPiArICAgICAgICAgICAg ICAgICAgICAgICByZXR1cm4gdHJ1ZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgIGNhc2Ug UFJPVl9EQVRBOg0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChidWZbMF0gIT0gUFJP Vl9DT01QTEVURSkNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBw cm92X2NvbXBsZXRlKG5vZGUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgUFJPVl9FUlJfSU5WQUxJRF9QRFUpOw0KPiA+ICsNCj4gPiArICAgICAg ICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdl9jb21wbGV0ZShub2RlLCAwKTsNCj4gPiArICAg ICAgIH0NCj4gPiArDQo+ID4gKw0KPiA+ICsNCj4gPiArICAgICAgIC8qIENvbXBvc2UgYXBwcm9w cmlhdGUgcmVwbHkgZm9yIHRoZSBwcm92IHN0YXRlIG1lc3NhZ2UgKi8NCj4gPiArICAgICAgIC8q IFNlbmQgcmVwbHkgdmlhIG1lc2hfZ2F0dF93cml0ZSgpICovDQo+ID4gKyAgICAgICAvKiBJZiBk b25lLCBjYWxsIHByb3ZfZG9uZSBjYWxsbGJhY2sgYW5kIGZyZWUgcHJvdiBob3VzZWtlZX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ID4g KyAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICBtZW51ID0g bC0+ZGF0YTsNCj4gPiArICAgICAgIGN1cnJlbnRfY21kX3RhYmxlID0gKHN0cnVjdCBtZW51X2Vu dHJ5ICopIG1lbnUtPnRhYmxlOw0KPiA+ICsNCj4gPiArICAgICAgIG1haW5fbWVudV9wb2ludCA9 IHJsX3BvaW50Ow0KPiA+ICsgICAgICAgbWFpbl9tZW51X3Byb21wdCA9IGdfc3RyZHVwKHJsX3By b21wdCk7DQo+ID4gKw0KPiA+ICsgICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4gPiArDQo+ ID4gK3ZvaWQgcHJvY2Vzc19tZW51X2NtZChjb25zdCBjaGFyICpjbWQsIGNvbnN0IGNoYXIgKmFy ZykNCj4gPiArew0KPiA+ICsgICAgICAgaW50IGk7DQo+ID4gKyAgICAgICBpbnQgbGVuOw0KPiA+ ICsgICAgICAgc3RydWN0IG1lbnVfZW50cnkgKmNtZF90YWJsZSA9IGN1cnJlbnRfY21kX3RhYmxl Ow0KPiA+ICsNCj4gPiArICAgICAgIGlmICghY3VycmVudF9jbWRfdGFibGUpDQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybjsNCj4gPiArDQo+ID4gKyAgICAgICBsZW4gPSBzdHJsZW4oY21kKTsN Cj4gPiArDQo+ID4gKyAgICAgICBmb3IgKGkgPSAwOyBjbWRfdGFibGVbaV0uY21kOyBpKyspIHsN Cj4gPiArICAgICAgICAgICAgICAgaWYgKHN0cm5jbXAoY21kLCBjbWRfdGFibGVbaV0uY21kLCBs ZW4pKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOw0KPiA+ICsNCj4gPiAr ICAgICAgICAgICAgICAgaWYgKGNtZF90YWJsZVtpXS5mdW5jKSB7DQo+ID4gKyAgICAgICAgICAg ICAgICAgICAgICAgY21kX3RhYmxlW2ldLmZ1bmMoYXJnKTsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICByZXR1cm47DQo+ID4gKyAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgIH0NCj4g PiArDQo+ID4gKyAgICAgICBpZiAoc3RybmNtcChjbWQsICJoZWxwIiwgbGVuKSkgew0KPiA+ICsg ICAgICAgICAgICAgICBybF9wcmludGYoIkludmFsaWQgY29tbWFuZFxuIik7DQo+ID4gKyAgICAg ICAgICAgICAgIHJldHVybjsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gKyAgICAgICBwcmlu dF9jbWRfbWVudShjbWRfdGFibGUpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICt2b2lkIHByaW50X2Nt ZF9tZW51KGNvbnN0IHN0cnVjdCBtZW51X2VudHJ5ICpjbWRfdGFibGUpDQo+ID4gK3sNCj4gPiAr ICAgICAgIGludCBpOw0KPiA+ICsNCj4gPiArICAgICAgIHJsX3ByaW50ZigiQXZhaWxhYmxlIGNv bW1hbmRzOlxuIik7DQo+ID4gKw0KPiA+ICsgICAgICAgZm9yIChpID0gMDsgY21kX3RhYmxlW2ld LmNtZDsgaSsrKSB7DQo+ID4gKyAgICAgICAgICAgICAgIGlmIChjbWRfdGFibGVbaV0uZGVzYykN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICBybF9wcmludGYoIiAgJXMgJS0qcyAlc1xuIiwg Y21kX3RhYmxlW2ldLmNtZCwNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGludCkoNDAgLSBzdHJsZW4oY21kX3RhYmxlW2ldLmNtZCkpLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbWRfdGFibGVbaV0uYXJnID8gOiAiIiwN Cj4gPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21kX3RhYmxlW2ld LmRlc2MgPyA6ICIiKTsNCj4gPiArICAgICAgIH0NCj4gPiArDQo+ID4gK30NCj4gPiArDQo+ID4g K3ZvaWQgY21kX21lbnVfY2xlYW51cCh2b2lkKQ0KPiA+ICt7DQo+ID4gKyAgICAgICBtYWluX2Nt ZF90YWJsZSA9IE5VTEw7DQo+ID4gKyAgICAgICBjdXJyZW50X2NtZF90YWJsZSA9IE5VTEw7DQo+ ID4gKw0KPiA+ICsgICAgICAgZ19saXN0X2ZyZWVfZnVsbChtZW51X2xpc3QsIGdfZnJlZSk7DQo+ ID4gK30NCj4gPiArDQo+ID4gK3ZvaWQgcHJpbnRfYnl0ZV9hcnJheShjb25zdCBjaGFyICpwcmVm aXgsIGNvbnN0IHZvaWQgKnB0ciwgaW50IGxlbikNCj4gPiArew0KPiA+ICsgICAgICAgY29uc3Qg dWludDhfdCAqZGF0YSA9IHB0cjsNCj4gPiArICAgICAgIGNoYXIgKmxpbmUsICpieXRlczsNCj4g PiArICAgICAgIGludCBpOw0KPiA+ICsNCj4gPiArICAgICAgIGxpbmUgPSBnX21hbGxvYyhzdHJs ZW4ocHJlZml4KSArICgxNiAqIDMpICsgMik7DQo+ID4gKyAgICAgICBzcHJpbnRmKGxpbmUsICIl cyAiLCBwcmVmaXgpOw0KPiA+ICsgICAgICAgYnl0ZXMgPSBsaW5lICsgc3RybGVuKHByZWZpeCkg KyAxOw0KPiA+ICsNCj4gPiArICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47ICsraSkgew0KPiA+ ICsgICAgICAgICAgICAgICBzcHJpbnRmKGJ5dGVzLCAiJTIuMnggIiwgZGF0YVtpXSk7DQo+ID4g KyAgICAgICAgICAgICAgIGlmICgoaSArIDEpICUgMTYpIHsNCj4gPiArICAgICAgICAgICAgICAg ICAgICAgICBieXRlcyArPSAzOw0KPiA+ICsgICAgICAgICAgICAgICB9IGVsc2Ugew0KPiA+ICsg ICAgICAgICAgICAgICAgICAgICAgIHJsX3ByaW50ZigiXHIlc1xuIiwgbGluZSk7DQo+ID4gKyAg ICAgICAgICAgICAgICAgICAgICAgYnl0ZXMgPSBsaW5lICsgc3RybGVuKHByZWZpeCkgKyAxOw0K PiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsgICAgICAg aWYgKGkgJSAxNikNCj4gPiArICAgICAgICAgICAgICAgcmxfcHJpbnRmKCJcciVzXG4iLCBsaW5l KTsNCj4gPiArDQo+ID4gKyAgICAgICBnX2ZyZWUobGluZSk7DQo+ID4gK30NCj4gPiArDQo+ID4g K2Jvb2wgc3RyMmhleChjb25zdCBjaGFyICpzdHIsIHVpbnQxNl90IGluX2xlbiwgdWludDhfdCAq b3V0LA0KPiA+ICsgICAgICAgICAgICAgICB1aW50MTZfdCBvdXRfbGVuKQ0KPiA+ICt7DQo+ID4g KyAgICAgICB1aW50MTZfdCBpOw0KPiA+ICsNCj4gPiArICAgICAgIGlmIChpbl9sZW4gPCBvdXRf bGVuICogMikNCj4gPiArICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiAr ICAgICAgIGZvciAoaSA9IDA7IGkgPCBvdXRfbGVuOyBpKyspIHsNCj4gPiArICAgICAgICAgICAg ICAgaWYgKHNzY2FuZigmc3RyW2kgKiAyXSwgIiUwMmhoeCIsICZvdXRbaV0pICE9IDEpDQo+ID4g KyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KPiA+ICsgICAgICAgfQ0KPiA+ ICsNCj4gPiArICAgICAgIHJldHVybiB0cnVlOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzaXplX3Qg aGV4MnN0cih1aW50OF90ICppbiwgc2l6ZV90IGluX2xlbiwgY2hhciAqb3V0LA0KPiA+ICsgICAg ICAgICAgICAgICBzaXplX3Qgb3V0X2xlbikNCj4gPiArew0KPiA+ICsgICAgICAgc3RhdGljIGNv bnN0IGNoYXIgaGV4ZGlnaXRzW10gPSAiMDEyMzQ1Njc4OWFiY2RlZiI7DQo+ID4gKyAgICAgICBz aXplX3QgaTsNCj4gPiArDQo+ID4gKyAgICAgICBpZihpbl9sZW4gKiAyID4gb3V0X2xlbiAtIDEp DQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiAwOw0KPiA+ICsNCj4gPiArICAgICAgIGZvciAo aSA9IDA7IGkgPCBpbl9sZW47IGkrKykgew0KPiA+ICsgICAgICAgICAgICAgICBvdXRbaSAqIDJd ID0gaGV4ZGlnaXRzW2luW2ldID4+IDRdOw0KPiA+ICsgICAgICAgICAgICAgICBvdXRbaSAqIDIg KyAxXSA9IGhleGRpZ2l0c1tpbltpXSAmIDB4Zl07DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ ICsgICAgICAgb3V0W2luX2xlbiAqIDJdID0gJ1wwJzsNCj4gPiArICAgICAgIHJldHVybiBpOw0K PiA+ICt9DQo+ID4gKw0KPiA+ICt1aW50MTZfdCBtZXNoX29wY29kZV9zZXQodWludDMyX3Qgb3Bj b2RlLCB1aW50OF90ICpidWYpDQo+ID4gK3sNCj4gPiArICAgICAgIGlmIChvcGNvZGUgPD0gMHg3 ZSkgew0KPiA+ICsgICAgICAgICAgICAgICBidWZbMF0gPSBvcGNvZGU7DQo+ID4gKyAgICAgICAg ICAgICAgIHJldHVybiAxOw0KPiA+ICsgICAgICAgfSBlbHNlIGlmIChvcGNvZGUgPj0gMHg4MDAw ICYmIG9wY29kZSA8PSAweGJmZmYpIHsNCj4gPiArICAgICAgICAgICAgICAgcHV0X2JlMTYob3Bj b2RlLCBidWYpOw0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gMjsNCj4gPiArICAgICAgIH0g ZWxzZSBpZiAob3Bjb2RlID49IDB4YzAwMDAwICYmIG9wY29kZSA8PSAweGZmZmZmZikgew0KPiA+ ICsgICAgICAgICAgICAgICBidWZbMF0gPSAob3Bjb2RlID4+IDE2KSAmIDB4ZmY7DQo+ID4gKyAg ICAgICAgICAgICAgIHB1dF9iZTE2KG9wY29kZSwgYnVmICsgMSk7DQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybiAzOw0KPiA+ICsgICAgICAgfSBlbHNlIHsNCj4gPiArICAgICAgICAgICAgICAg cmxfcHJpbnRmKCJJbGxlZ2FsIE9wY29kZSAleCIsIG9wY29kZSk7DQo+ID4gKyAgICAgICAgICAg ICAgIHJldHVybiAwOw0KPiA+ICsgICAgICAgfQ0KPiA+ICt9DQo+ID4gKw0KPiA+ICtib29sIG1l c2hfb3Bjb2RlX2dldChjb25zdCB1aW50OF90ICpidWYsIHVpbnQxNl90IHN6LCB1aW50MzJfdA0K PiAqb3Bjb2RlLCBpbnQgKm4pDQo+ID4gK3sNCj4gPiArICAgICAgIGlmICghbiB8fCAhb3Bjb2Rl IHx8IHN6IDwgMSkgcmV0dXJuIGZhbHNlOw0KPiA+ICsNCj4gPiArICAgICAgIHN3aXRjaCAoYnVm WzBdICYgMHhjMCkgew0KPiA+ICsgICAgICAgY2FzZSAweDAwOg0KPiA+ICsgICAgICAgY2FzZSAw eDQwOg0KPiA+ICsgICAgICAgICAgICAgICAvKiBSRlUgKi8NCj4gPiArICAgICAgICAgICAgICAg aWYgKGJ1ZlswXSA9PSAweDdmKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBm YWxzZTsNCj4gPiArDQo+ID4gKyAgICAgICAgICAgICAgICpuID0gMTsNCj4gPiArICAgICAgICAg ICAgICAgKm9wY29kZSA9IGJ1ZlswXTsNCj4gPiArICAgICAgICAgICAgICAgYnJlYWs7DQo+ID4g Kw0KPiA+ICsgICAgICAgY2FzZSAweDgwOg0KPiA+ICsgICAgICAgICAgICAgICBpZiAoc3ogPCAy KQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsNCj4gPiArDQo+ID4g KyAgICAgICAgICAgICAgICpuID0gMjsNCj4gPiArICAgICAgICAgICAgICAgKm9wY29kZSA9IGdl dF9iZTE2KGJ1Zik7DQo+ID4gKyAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAg ICAgIGNhc2UgMHhjMDoNCj4gPiArICAgICAgICAgICAgICAgaWYgKHN6IDwgMykNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKw0KPiA+ICsgICAgICAgICAg ICAgICAqbiA9IDM7DQo+ID4gKyAgICAgICAgICAgICAgICpvcGNvZGUgPSBnZXRfYmUxNihidWYg KyAxKTsNCj4gPiArICAgICAgICAgICAgICAgKm9wY29kZSB8PSBidWZbMF0gPDwgMTY7DQo+ID4g KyAgICAgICAgICAgICAgIGJyZWFrOw0KPiA+ICsNCj4gPiArICAgICAgIGRlZmF1bHQ6DQo+ID4g KyAgICAgICAgICAgICAgIHJsX3ByaW50ZigiQmFkIFBhY2tldDpcbiIpOw0KPiA+ICsgICAgICAg ICAgICAgICBwcmludF9ieXRlX2FycmF5KCJcdCIsICh2b2lkICopIGJ1Ziwgc3opOw0KPiA+ICsg ICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsg ICAgICAgcmV0dXJuIHRydWU7DQo+ID4gK30NCj4gPiArDQo+ID4gK2NvbnN0IGNoYXIgKm1lc2hf c3RhdHVzX3N0cih1aW50OF90IHN0YXR1cykNCj4gPiArew0KPiA+ICsgICAgICAgc3dpdGNoIChz dGF0dXMpIHsNCj4gPiArICAgICAgIGNhc2UgTUVTSF9TVEFUVVNfU1VDQ0VTUzogcmV0dXJuICJT dWNjZXNzIjsNCj4gPiArICAgICAgIGNhc2UgTUVTSF9TVEFUVVNfSU5WQUxJRF9BRERSRVNTOiBy ZXR1cm4gIkludmFsaWQgQWRkcmVzcyI7DQo+ID4gKyAgICAgICBjYXNlIE1FU0hfU1RBVFVTX0lO VkFMSURfTU9ERUw6IHJldHVybiAiSW52YWxpZCBNb2RlbCI7DQo+ID4gKyAgICAgICBjYXNlIE1F U0hfU1RBVFVTX0lOVkFMSURfQVBQS0VZOiByZXR1cm4gIkludmFsa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