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2RlIDEwMDc1NQppbmRleCAwMDAwMDAwLi4xYWQ5NzAyCi0tLSAvZGV2L251bGwKKysrIGIvYXAvb3MvbGludXgvbGludXgtMy40LngvbGliL2ZsYWdzX3V0aWxzL2ZsYWdzX3V0aWxzLmMKQEAgLTAsMCArMSw0NzYgQEAKKy8qKg0KKyAqIEBmaWxlIGZsYWdzX3V0aWxzLmMNCisgKiBAYnJpZWYgZmxhZ3O31sf4vdO/2sq1z9YNCisgKg0KKyAqIENvcHlyaWdodCAoQykgMjAyMyBTYW5lY2hpcHMgVGVjaG5vbG9neSBDby4sIEx0ZC4NCisgKiBAYXV0aG9yIA0KKyAqIA0KKyAqIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5DQorICogaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uIDIgYXMNCisgKiBwdWJsaXNoZWQgYnkgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbi4go6ix2NGho7pHUEx2MiBMaWNlbmNlo6kNCisgKg0KKyAqLw0KKw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorICogICAgICAgICAgICAgICAgICAgICAgICAgICBJbmNsdWRlIGhlYWRlciBmaWxlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KKyNpbmNsdWRlIDxsaW51eC9lcnIuaD4NCisjaW5jbHVkZSA8bGludXgvc2xhYi5oPg0KKyNpbmNsdWRlIDxsaW51eC9tdGQvbXRkLmg+DQorDQorI2luY2x1ZGUgInB1Yl9mbGFncy5oIg0KKw0KKyNpbmNsdWRlICJmbGFnc19sb2cuaCINCisNCisNCitleHRlcm4gZ196bG9hZF9yZWFkX29ubHlfZmxhZzsNCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYWNybyBkZWZpbml0aW9ucyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqDQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisjZGVmaW5lIE1BWF9QQVRIX0xFTiAoMjU2KQ0KKw0KKyNkZWZpbmUgTVREX05BTUVfRkxBR1MgImZsYWdzIg0KKw0KKyNkZWZpbmUgRkxBR1NfSU5JVF9WQUxJRF9CTE9DS1NfTlVNCSg4KQ0KKw0KKyNkZWZpbmUgR09PRF9CTE9DSyAoMCkNCisjZGVmaW5lIEJBRF9CTE9DSyAoMSkNCisNCisjZGVmaW5lIEZJTEVfUEFUSF9QUk9DX0NNRExJTkUgIi9wcm9jL2NtZGxpbmUiDQorDQorI2RlZmluZSBQUk9DX0NNRExJTkVfU1lTVEVNX0FfRkxBRyAgICJzeXN0ZW09c3lzdGVtX2EiDQorI2RlZmluZSBQUk9DX0NNRExJTkVfU1lTVEVNX0JfRkxBRyAgICJzeXN0ZW09c3lzdGVtX2IiDQorDQorI2RlZmluZSBTWVNURU1fSU5ERVhfVU5LTk9XTiAoLTEpDQorI2RlZmluZSBTWVNURU1fSU5ERVhfMSAoMSkNCisjZGVmaW5lIFNZU1RFTV9JTkRFWF8yICgyKQ0KKw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFR5cGUgZGVmaW5pdGlvbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KK3R5cGVkZWYgc3RydWN0DQorew0KKyAgICB1bnNpZ25lZCBpbnQgbXRkX3RvdGFsc2l6ZTsJCQkJLy8gbXRkIGRldmljZSB0b3RhbCBzaXplDQorICAgIHVuc2lnbmVkIGludCBtdGRfcGFnZXBlcmJsb2NrOwkJCS8vIG10ZCBkZXZpY2UgcGFnZSBwZXIgYmxvY2sNCisgICAgdW5zaWduZWQgaW50IG10ZF9ibG9ja3NpemU7CQkJCS8vIG10ZCBkZXZpY2UgYmxvY2sgc2l6ZQ0KKyAgICB1bnNpZ25lZCBpbnQgbXRkX3BhZ2VzaXplOwkJCQkvLyBtdGQgZGV2aWNlIHBhZ2Ugc2l6ZQ0KKyAgICB1bnNpZ25lZCBpbnQgbXRkX29vYnNpemU7CQkJCS8vIG10ZCBkZXZpY2Ugb29iIHNpemUNCisgICAgaW50IHBhcnRpX2ZpbGVfZGVzYzsJCQkJCS8vIHBhcnRpdGlvbiB1cGRhdGUgZmlsZSBkZXNjcmlwdGlvbg0KK30gcGFydGl0aW9uX210ZF9pbmZvX3Q7DQorDQorDQordHlwZWRlZiBlbnVtDQorew0KKyAgICBERVZJQ0VfTVREID0gMCwNCisgICAgREVWSUNFX1pGVEwgPSAxLA0KKyAgICBERVZJQ0VfTVREX0JMT0NLLA0KK30gZGV2aWNlX3R5cGVfdDsNCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqCQkJCQkJICAgTG9jYWwgdmFyaWFibGUgZGVmaW5pdGlvbnMJCQkJCQkgICAqDQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqCQkJCQkJICBHbG9iYWwgdmFyaWFibGUgZGVmaW5pdGlvbnMJCQkJCQkgICAqDQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqIAkJCQkJICAgTG9jYWwgZnVuY3Rpb24gZGVjbGFyYXRpb25zCQkJCQkJCSAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KK3N0YXRpYyBpbnQgd3JpdGVfZmxhZ3NfaW5mbyhzdHJ1Y3QgbXRkX2luZm8gKnBfbXRkX2luZm8sIGludCBpbmRleCwgdW5zaWduZWQgY2hhciAqY29udGVudCwgaW50IGxlbik7DQorDQorc3RhdGljIGludCBnZXRfZmxhZ3NfaW5mbyhUX0ZMQUdTX0lORk8gKnBfbWFpbiwgaW50ICpwX21haW5faW5kZXgsIFRfRkxBR1NfSU5GTyAqcF9iYWNrdXAsIGludCAqcF9iYWNrdXBfaW5kZXgpOw0KK3N0YXRpYyBpbnQgc2V0X2ZsYWdzX2luZm8oVF9GTEFHU19JTkZPICpwX2ZsYWdzX2luZm8sIGludCAqcF9tYWluX2luZGV4LCBpbnQgKnBfYmFja3VwX2luZGV4KTsNCisNCitzdGF0aWMgdm9pZCBjb3B5X2ZsYWdzX2luZm8oVF9GTEFHU19JTkZPICpkc3QsIFRfRkxBR1NfSU5GTyAqc3JjKTsNCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqIAkJCQkJIExvY2FsIGZ1bmN0aW9uIGltcGxlbWVudGF0aW9ucyAJCQkJCQkgICAqDQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCitzdGF0aWMgaW50IHdyaXRlX2ZsYWdzX2luZm8oc3RydWN0IG10ZF9pbmZvICpwX210ZF9pbmZvLCBpbnQgaW5kZXgsIHVuc2lnbmVkIGNoYXIgKmNvbnRlbnQsIGludCBsZW4pDQorew0KKwlpbnQgcmV0ID0gLTE7DQorICAgIHNpemVfdCB3cml0ZV9sZW4gPSAwOw0KKwkNCisgICAgc3RydWN0IGVyYXNlX2luZm8gZXJhc2VJbmZvID0gezB9Ow0KKyAgICBsb2ZmX3Qgb2ZmcyA9IDA7DQorCQ0KKyAgICBlcmFzZUluZm8ubXRkICA9IHBfbXRkX2luZm87DQorICAgIGVyYXNlSW5mby5hZGRyID0gaW5kZXggKiBwX210ZF9pbmZvLT5lcmFzZXNpemU7DQorICAgIGVyYXNlSW5mby5sZW4gID0gcF9tdGRfaW5mby0+ZXJhc2VzaXplOw0KKwkNCisgICAgb2ZmcyA9IChsb2ZmX3QpaW5kZXggKiBwX210ZF9pbmZvLT5lcmFzZXNpemU7DQorDQorCWdfemxvYWRfcmVhZF9vbmx5X2ZsYWcgPSAxOw0KKw0KKwlpZiAoMCAhPSBtdGRfYmxvY2tfaXNiYWQocF9tdGRfaW5mbywgb2ZmcykpDQorCXsNCisJCWZsYWdzX2VycigiYmxvY2tbJWRdIGJhZCIsIGluZGV4KTsNCisJCWdfemxvYWRfcmVhZF9vbmx5X2ZsYWcgPSAwOw0KKwkJDQorCQlyZXR1cm4gQkFEX0JMT0NLOw0KKwl9DQorDQorCWlmICgwICE9IG10ZF9lcmFzZShwX210ZF9pbmZv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nBfbWFpbl9pbmRleCA9IGluZGV4Ow0KKwkJCQkNCisJCQkJaWYobXRkX3JlYWQobXRkSW5mbywgb2Zmcywgc2l6ZW9mKFRfRkxBR1NfSU5GTyksICZyZXRsZW4sICh1X2NoYXIgKilwX21haW4pKQ0KKwkJCQl7DQorCSAgICAgICAgICAgICAgICBmbGFnc19lcnIoIm1haW4gbXRkIHJlYWQgZXJyb3IiKTsNCisJCQkJCWdvdG8gZXJyb3JfY2xvc2U7DQorCQkJCX0NCisgICAgICAgIAl9DQorICAgICAgICAgICAgZWxzZSBpZiAoZ29vZF9pbmRleCA9PSAxKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgKnBfYmFja3VwX2luZGV4ID0gaW5kZXg7DQorCQkJCQ0KKwkJCQlpZihtdGRfcmVhZChtdGRJbmZvLCBvZmZzLCBzaXplb2YoVF9GTEFHU19JTkZPKSwgJnJldGxlbiwgKHVfY2hhciAqKXBfYmFja3VwKSkNCisJCQkJew0KKwkgICAgICAgICAgICAgICAgZmxhZ3NfZXJyKCJiYWNrdXAgbXRkIHJlYWQgZXJyb3IiKTsNCisJCQkJCWdvdG8gZXJyb3JfY2xvc2U7DQorCQkJCX0NCisJCQkJDQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgIH0NCisNCisgICAgICAgICAgICBpZiAocmV0bGVuICE9IHNpemVvZihUX0ZMQUdTX0lORk8pKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgZmxhZ3NfZXJyKCJyZWFkIGxlbiAoJWQpICE9IG5lZWQgbGVuICglZCkiLCByZXRsZW4sIHNpemVvZihUX0ZMQUdTX0lORk8pKTsNCisgICAgICAgICAgICAgICAgZ290byBlcnJvcl9jbG9zZTsNCisgICAgICAgICAgICB9DQorDQorICAgICAgICAgICAgZ29vZF9pbmRleCsrOw0KKyAgICAg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pZnNfc3RhdHVzLmZzX3ViaV92b2xfbmFtZSwgc2l6ZW9mKGRzdC0+dWJpZnNfc3RhdHVzLmZzX3ViaV92b2xfbmFtZSkpOw0KKwkNCisJZHN0LT5tYWdpY19lbmQgPSBzcmMtPm1hZ2ljX2VuZDsNCisNCisJcmV0dXJuOw0KK30NCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqIAkJCQkJIEdsb2JhbCBmdW5jdGlvbiBpbXBsZW1lbnRhdGlvbnMJCQkJCQkgICAqDQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCitpbnQgZmxhZ3NfZ2V0KFRfRkxBR1NfSU5GTyAqcF9mbGFnc19pbmZvKQ0KK3sNCisgICAgVF9GTEFHU19JTkZPIG1haW5fZmxhZyA9IHswfTsNCisgICAgVF9GTEFHU19JTkZPIGJhY2t1cF9mbGFnID0gezB9Ow0KKyAgICBpbnQgbWFpbl9pbmRleCA9IDA7DQorICAgIGludCBiYWNrdXBfaW5kZXggPSAxOw0KKw0KKwlpZiAoTlVMTCA9PSBwX2ZsYWdzX2luZm8pDQorCXsNCisJCWZsYWdzX2VycigiaW52YWxpZCBwYXJhbSBOVUxMIik7DQorCQlyZXR1cm4gLTE7DQorCX0NCisNCisgICAgaWYgKGdldF9mbGFnc19pbmZvKCZtYWluX2ZsYWcsICZtYWluX2luZGV4LCAmYmFja3VwX2ZsYWcsICZiYWNrdXBfaW5kZXgpICE9IDApDQorICAgIHsNCisgICAgCWZsYWdzX2VycigiZ2V0IGZsYWdzIGluZm8gZmFpbCIpOw0KKyAgICAgICAgcmV0dXJuIC0xOw0KKyAgICB9DQorDQorICAgIGlmICgoRkxBR1NfTUFHSUMgPT0gbWFpbl9mbGFnLm1hZ2ljX3N0YXJ0KSAmJiAoRk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it7CisgICAgcmV0dXJuIDA7Cit9CitzdGF0aWMgbG9mZl90IGNoYXJkZXZub2RlX2xsc2VlayhzdHJ1Y3QgZmlsZSAqZmlsZXMsIGxvZmZfdCBvZmZzZXQsIGludCBlbmNlKQoreworICAgIHJldHVybiAwOworfQorc3RydWN0IGZpbGVfb3BlcmF0aW9ucyBteV9mb3BzID0geworICAgIC5vd25lciAgID0gVEhJU19NT0RVTEUsCisgICAgLm9wZW4gICAgID0gY2hhcmRldm5vZGVfb3BlbiwKKyAgICAucmVsZWFzZSA9IGNoYXJkZXZub2RlX3JlbGVhc2UsCisgICAgLnVubG9ja2VkX2lvY3RsID0gY2hhcmRldm5vZGVfdW5sb2NrZWRfaW9jdGwsCisgICAgLnJlYWQgICAgID0gY2hhcmRldm5vZGVfcmVhZCwKKyAgICAud3JpdGUgICAgID0gY2hhcmRldm5vZGVfd3JpdGUsCisgICAgLmxsc2VlayAgICAgPSBjaGFyZGV2bm9kZV9sbHNlZWssCit9OworCisKK3N0YXRpYyB2b2lkIHJlZ19pbml0X2NkZXYoc3RydWN0IHJlZ19kZXYgKmRldixpbnQgaW5kZXgpeworICAgIGludCBlcnI7CisgICAgaW50IGRldm5vID0gTUtERVYobnVtZGV2X21ham9yLG51bWRldl9taW5vcitpbmRleCk7CisgICAgCisgICAgY2Rldl9pbml0KCZkZXYtPmNkZXYsJm15X2ZvcHMpOworICAgIGRldi0+Y2Rldi5vd25lciA9IFRISVNfTU9EVUxFOworICAgIGRldi0+Y2Rldi5vcHMgPSAmbXlfZm9wczsKKyAgICAKKyAgICBlcnIgPSBjZGV2X2FkZCgmZGV2LT5jZGV2LGRldm5vLDEpOworICAgIGlmKGVycil7CisgICAgICAgIHByaW50ayhLRVJOX0VNRVJHICJjZGV2X2FkZCAlZCBpcyBmYWlsISAlZFxuIixpbmRleCxlcnIpOworICAgIH0KKyAgICBlbHNleworICAgICAgICBwcmludGsoS0VSTl9FTUVSRyAiY2Rldl9hZGQgJWQgaXMgc3VjY2VzcyFcbiIsbnVtZGV2X21pbm9yK2luZGV4KTsKKyAgICB9Cit9CisKKworc3RhdGljIGludCBzY2Rldl9pbml0KHZvaWQpCit7CisgICAgaW50IHJldCA9IDAsaTsKKyAgICBkZXZfdCBudW1fZGV2OworICAgIAorICAgIHByaW50ayhLRVJOX0VNRVJHICJudW1kZXZfbWFqb3IgaXMgJWRcbiIsIG51bWRldl9tYWpvcik7CisgICAgcHJpbnRrKEtFUk5fRU1FUkcgIm51bWRldl9taW5vciBpcyAlZFxuIiwgbnVtZGV2X21pbm9yKTsKKyAgICAKKyAgICBpZihudW1kZXZfbWFqb3IpeworICAgICAgICBudW1fZGV2ID0gTUtERVYobnVtZGV2X21ham9yLG51bWRldl9taW5vcik7CisgICAgICAgIHJldCA9IHJlZ2lzdGVyX2NocmRldl9yZWdpb24obnVtX2RldiwgREVWSUNFX01JTk9SX05VTSwgREVWSUNFX05BTUUpOworICAgIH0KKyAgICBlbHNleworICAgICAgICByZXQgPSBhbGxvY19jaHJkZXZfcmVnaW9uKCZudW1fZGV2LCBudW1kZXZfbWlub3IsIERFVklDRV9NSU5PUl9OVU0sREVWSUNFX05BTUUpOworICAgICAgICBudW1kZXZfbWFqb3IgPSBNQUpPUihudW1fZGV2KTsKKyAgICAgICAgcHJpbnRrKEtFUk5fRU1FUkcgImFkZXZfcmVnaW9uIHJlcSAlZCAhXG4iLCBudW1kZXZfbWFqb3IpOworICAgIH0KKyAgICBpZihyZXQ8MCl7CisgICAgICAgIHByaW50ayhLRVJOX0VNRVJHICJyZWdpc3Rlcl9jaHJkZXZfcmVnaW9uIHJlcSAlZCBpcyBmYWlsZWQhXG4iLCBudW1kZXZfbWFqb3IpOyAgICAgICAgCisgICAgfQorICAgIG15Y2xhc3MgPSBjbGFzc19jcmVhdGUoVEhJU19NT0RVTEUsIERFVklDRV9OQU1FKTsKKyAgICAKKyAgICBteV9kZXZpY2VzID0ga21hbGxvYyhERVZJQ0VfTUlOT1JfTlVNICogc2l6ZW9mKHN0cnVjdCByZWdfZGV2KSwgR0ZQX0tFUk5FTCk7CisgICAgaWYoIW15X2RldmljZXMpeworICAgICAgICByZXQgPSAtRU5PTUVNOworICAgICAgICBnb3RvIGZhaWw7CisgICAgfQorICAgIG1lbXNldChteV9kZXZpY2VzLCAwLCBERVZJQ0VfTUlOT1JfTlVNICogc2l6ZW9mKHN0cnVjdCByZWdfZGV2KSk7CisgICAgCisgICAgZm9yKGk9MDsgaTxERVZJQ0VfTUlOT1JfTlVNOyBpKyspeworICAgICAgICBteV9kZXZpY2VzW2ldLmRhdGEgPSBrbWFsbG9jKFJFR0RFVl9TSVpFLEdGUF9LRVJORUwpOworICAgICAgICBtZW1zZXQobXlfZGV2aWNlc1tpXS5kYXRhLDAsUkVHREVWX1NJWkUpOworCQorICAgICAgICByZWdfaW5pdF9jZGV2KCZteV9kZXZpY2VzW2ldLGkpOworICAgICAgICBkZXZpY2VfY3JlYXRlKG15Y2xhc3MsTlVMTCxNS0RFVihudW1kZXZfbWFqb3IsbnVtZGV2X21pbm9yK2kpLE5VTEwsREVWSUNFX05BTUUiJWQiLGkpOworICAgIH0KKyAgICAgICAgCisgICAgcHJpbnRrKEtFUk5fRU1FUkcgInNjZGV2X2luaXQhXG4iKTsKKyAgICByZXR1cm4gMDsKKworZmFpbDoKKyAgICB1bnJlZ2lzdGVyX2NocmRldl9yZWdpb24oTUtERVYobnVtZGV2X21ham9yLG51bWRldl9taW5vciksREVWSUNFX01JTk9SX05VTSk7CisgICAgcHJpbnRrKEtFUk5fRU1FUkcgImttYWxsb2MgaXMgZmFpbCFcbiIpOworICAgIAorICAgIHJldHVybiByZXQ7Cit9CisKK3N0YXRpYyB2b2lkIHNjZGV2X2V4aXQodm9pZCkKK3sKKyAgICBpbnQgaTsKKyAgICBwcmludGsoS0VSTl9FTUVSRyAic2NkZXZfZXhpdCFcbiIpOworICAgIAorICAgIGZvcihpPTA7aTxERVZJQ0VfTUlOT1JfTlVNO2krKyl7CisgICAgICAgIGNkZXZfZGVsKCYobXlfZGV2aWNlc1tpXS5jZGV2KSk7CisgICAgICAgIGRldmljZV9kZXN0cm95KG15Y2xhc3MsTUtERVYobnVtZGV2X21ham9yLG51bWRldl9taW5vcitpKSk7CisgICAgfQorICAgIGNsYXNzX2Rlc3Ryb3kobXljbGFzcyk7CisgICAga2ZyZWUobXlfZGV2aWNlcyk7CisKKyAgICB1bnJlZ2lzdGVyX2NocmRldl9yZWdpb24oTUtERVYobnVtZGV2X21ham9yLG51bWRldl9taW5vciksREVWSUNFX01JTk9SX05VTSk7Cit9CisKKworbW9kdWxlX2luaXQoc2NkZXZfaW5pdCk7Cittb2R1bGVfZXhpdChzY2Rldl9leGl0KTsKKwo=