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VRZLCBXSEVUSEVSIElOIEFOIEFDVElPTiBPRiBDT05UUkFDVCwgVE9SVCBPUiBPVEhFUldJU0UsIEFSSVNJTkcKKyAqIEZST00sIE9VVCBPRiBPUiBJTiBDT05ORUNUSU9OIFdJVEggVEhFIFNPRlRXQVJFIE9SIFRIRSBVU0UgT1IgT1RIRVIKKyAqIERFQUxJTkdTIElOIFRIRSBTT0ZUV0FSRS4KKyAqCisgKiBBdXRob3JzOgorICoJRXJpYyBBbmhvbHQgPGVyaWNAYW5ob2x0Lm5ldD4KKyAqLworCisjaW5jbHVkZSA8bGludXgvaTJjLmg+CisjaW5jbHVkZSAiZHJtUC5oIgorI2luY2x1ZGUgImludGVsX2Rydi5oIgorI2luY2x1ZGUgImk5MTVfZHJtLmgiCisjaW5jbHVkZSAiaTkxNV9kcnYuaCIKKworI2luY2x1ZGUgImRybV9jcnRjX2hlbHBlci5oIgorCitib29sIGludGVsX3BpcGVfaGFzX3R5cGUgKHN0cnVjdCBkcm1fY3J0YyAqY3J0YywgaW50IHR5cGUpOworCit0eXBlZGVmIHN0cnVjdCB7CisgICAgLyogZ2l2ZW4gdmFsdWVzICovCisgICAgaW50IG47CisgICAgaW50IG0xLCBtMjsKKyAgICBpbnQgcDEsIHAyOworICAgIC8qIGRlcml2ZWQgdmFsdWVzICovCisgICAgaW50CWRvdDsKKyAgICBpbnQJdmNvOworICAgIGludAltOworICAgIGludAlwOworfSBpbnRlbF9jbG9ja190OworCit0eXBlZGVmIHN0cnVjdCB7CisgICAgaW50CW1pbiwgbWF4OworfSBpbnRlbF9yYW5nZV90OworCit0eXBlZGVmIHN0cnVjdCB7CisgICAgaW50CWRvdF9saW1pdDsKKyAgICBpbnQJcDJfc2xvdywgcDJfZmFzdDsKK30gaW50ZWxfcDJfdDsKKworI2RlZmluZSBJTlRFTF9QMl9OVU0JCSAgICAgIDIKKwordHlwZWRlZiBzdHJ1Y3QgeworICAgIGludGVsX3JhbmdlX3QgICBkb3QsIHZjbywgbiwgbSw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gLmRvdCA9IHsgLm1pbiA9IEk4WFhfRE9UX01JTiwJCS5tYXggPSBJOFhYX0RPVF9NQVggfSwKKyAgICAgICAgLnZjbyA9IHsgLm1pbiA9IEk4WFhfVkNPX01JTiwJCS5tYXggPSBJOFhYX1ZDT19NQVggfSwKKyAgICAgICAgLm4gICA9IHsgLm1pbiA9IEk4WFhfTl9NSU4sCQkubWF4ID0gSThYWF9OX01BWCB9LAorICAgICAgICAubSAgID0geyAubWluID0gSThYWF9NX01JTiwJCS5tYXggPSBJOFhYX01fTUFYIH0sCisgICAgICAgIC5tMSAgPSB7IC5taW4gPSBJOFhYX00xX01JTiwJCS5tYXggPSBJOFhYX00xX01BWCB9LAorICAgICAgICAubTIgID0geyAubWluID0gSThYWF9NMl9NSU4sCQkubWF4ID0gSThYWF9NMl9NQVggfSwKKyAgICAgICAgLnAgICA9IHsgLm1pbiA9IEk4WFhfUF9NSU4sCQkubWF4ID0gSThYWF9QX01BWCB9LAorICAgICAgICAucDEgID0geyAubWluID0gSThYWF9QMV9MVkRTX01JTiwJLm1heCA9IEk4WFhfUDFfTFZEU19NQVggfSwKKwkucDIgID0geyAuZG90X2xpbWl0ID0gSThYWF9QMl9TTE9XX0xJTUlULAorCQkgLnAyX3Nsb3cgPSBJOFhYX1AyX0xWRFNfU0xPVywJLnAyX2Zhc3QgPSBJOFhYX1AyX0xWRFNfRkFTVCB9LAorICAgIH0sCisgICAgeyAvKiBJTlRFTF9MSU1JVF9JOVhYX1NEVk9fREFDICovCisgICAgICAgIC5kb3QgPSB7IC5taW4gPSBJOVhYX0RPVF9NSU4sCQkubWF4ID0gSTlYWF9ET1RfTUFYIH0sCisgICAgICAgIC52Y28gPSB7IC5taW4gPSBJOVhYX1ZDT19NSU4sCQkubWF4ID0gSTlYWF9WQ09fTUFYIH0sCisgICAgICAgIC5uICAgPSB7IC5taW4gPSBJOVhYX05fTUlOLAkJLm1heCA9IEk5WFhfTl9NQVggfSwKKyAgICAgICAgLm0gICA9IHsgLm1pbiA9IEk5WFhfTV9NSU4sCQkubWF4ID0gSTlYWF9NX01BWCB9LAorICAgICAgICAubTEgID0geyAubWluID0gSTlYWF9NMV9NSU4sCQkubWF4ID0gSTlYWF9NMV9NQVggfSwKKyAgICAgICAgLm0yICA9IHsgLm1pbiA9IEk5WFhfTTJfTUlOLAkJLm1heCA9IEk5WFhfTTJfTUFYIH0sCisgICAgICAgIC5wICAgPSB7IC5taW4gPSBJOVhYX1BfU0RWT19EQUNfTUlOLAkubWF4ID0gSTlYWF9QX1NEVk9fREFDX01BWCB9LAorICAgICAgICAucDEgID0geyAubWluID0gSTlYWF9QMV9NSU4sCQkubWF4ID0gSTlYWF9QMV9NQVggfSwKKwkucDIgID0geyAuZG90X2xpbWl0ID0gSTlYWF9QMl9TRFZPX0RBQ19TTE9XX0xJTUlULAorCQkgLnAyX3Nsb3cgPSBJOVhYX1AyX1NEVk9fREFDX1NMT1csCS5wMl9mYXN0ID0gSTlYWF9QMl9TRFZPX0RBQ19GQVNUIH0sCisgICAgfSwKKyAgICB7IC8qIElOVEVMX0xJTUlUX0k5WFhfTFZEUyAqLworICAgICAgICAuZG90ID0geyAubWluID0gSTlYWF9ET1RfTUlOLAkJLm1heCA9IEk5WFhfRE9UX01BWCB9LAorICAgICAgICAudmNvID0geyAubWluID0gSTlYWF9WQ09fTUlOLAkJLm1heCA9IEk5WFhfVkNPX01BWCB9LAorICAgICAgICAubiAgID0geyAubWluID0gSTlYWF9OX01JTiwJCS5tYXggPSBJOVhYX05fTUFYIH0sCisgICAgICAgIC5tICAgPSB7IC5taW4gPSBJOVhYX01fTUlOLAkJLm1heCA9IEk5WFhfTV9NQVggfSwKKyAgICAgICAgLm0xICA9IHsgLm1pbiA9IEk5WFhfTTFfTUlOLAkJLm1heCA9IEk5WFhfTTFfTUFYIH0sCisgICAgICAgIC5tMiAgPSB7IC5taW4gPSBJOVhYX00yX01JTiwJCS5tYXggPSBJOVhYX00yX01BWCB9LAorICAgICAgICAucCAgID0geyAubW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GVsX291dHB1dCA9IHRvX2ludGVsX291dHB1dChjb25uZWN0b3IpOworCQlpZiAodHlwZV9tYXNrICYgKDEgPDwgaW50ZWxfb3V0cHV0LT50eXBlKSkKKwkJCWluZGV4X21hc2sgfD0gKDEgPDwgZW50cnkpOworCQllbnRyeSsrOworCX0KKwlyZXR1cm4gaW5kZXhfbWFzazsKK30KKworCitzdGF0aWMgdm9pZCBpbnRlbF9zZXR1cF9vdXRwdXRzKHN0cnVjdCBkcm1fZGV2aWNlICpkZXYpCit7CisJc3RydWN0IGRybV9jb25uZWN0b3IgKmNvbm5lY3RvcjsKKworCWludGVsX2NydF9pbml0KGRldik7CisKKwkvKiBTZXQgdXAgaW50ZWdyYXRlZCBMVkRTICovCisJaWYgKElTX01PQklMRShkZXYpICYmICFJU19JODMwKGRldikpCisJCWludGVsX2x2ZHNfaW5pdChkZXYpOworCisJaWYgKElTX0k5WFgoZGV2KSkgeworCQlpbnRlbF9zZHZvX2luaXQoZGV2LCBTRFZPQik7CisJCWludGVsX3Nkdm9faW5pdChkZXYsIFNEVk9DKTsKKwl9IGVsc2UKKwkJaW50ZWxfZHZvX2luaXQoZGV2KTsKKworCWlmIChJU19JOVhYKGRldikgJiYgIUlTX0k5MTVHKGRldikpCisJCWludGVsX3R2X2luaXQoZGV2KTsKKworCWxpc3RfZm9yX2VhY2hfZW50cnkoY29ubmVjdG9yLCAmZGV2LT5tb2RlX2NvbmZpZy5jb25uZWN0b3JfbGlzdCwgaGVhZCkgeworCQlzdHJ1Y3QgaW50ZWxfb3V0cHV0ICppbnRlbF9vdXRwdXQgPSB0b19pbnRlbF9vdXRwdXQoY29ubmVjdG9yKTsKKwkJc3RydWN0IGRybV9lbmNvZGVyICplbmNvZGVyID0gJmludGVsX291dHB1dC0+ZW5jOworCQlpbnQgY3J0Y19tYXNrID0gMCwgY2xvbmVfbWFzayA9IDA7CisKKwkJLyogdmFsaWQgY3J0Y3MgKi8KKwkJc3dpdGNoKGludGVsX291dHB1dC0+dHl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JyZWFrOworCWNhc2UgMjoKKwkJaW50ZWxfc2R2b19zZXRfY2xvY2tfcmF0ZV9tdWx0KGludGVsX291dHB1dCwKKwkJCQkJICAgICAgIFNEVk9fQ0xPQ0tfUkFURV9NVUxUXzJYKTsKKwkJYnJlYWs7CisJY2FzZSA0OgorCQlpbnRlbF9zZHZvX3NldF9jbG9ja19yYXRlX211bHQoaW50ZWxfb3V0cHV0LAorCQkJCQkgICAgICAgU0RWT19DTE9DS19SQVRFX01VTFRfNFgpOworCQlicmVhazsKKwl9CisKKwkvKiBTZXQgdGhlIFNEVk8gY29udHJvbCByZWdzLiAqLworICAgICAgICBpZiAoMC8qSVNfSTk2NUdNKGRldikqLykgeworICAgICAgICAgICAgICAgIHNkdm94ID0gU0RWT19CT1JERVJfRU5BQkxFOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNkdm94ID0gSTkxNV9SRUFEKHNkdm9fcHJpdi0+b3V0cHV0X2RldmljZSk7CisgICAgICAgICAgICAgICAgc3dpdGNoIChzZHZvX3ByaXYtPm91dHB1dF9kZXZpY2UpIHsKKyAgICAgICAgICAgICAgICBjYXNlIFNEVk9COgorICAgICAgICAgICAgICAgICAgICAgICAgc2R2b3ggJj0gU0RWT0JfUFJFU0VSVkVfTUFTSzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgU0RWT0M6CisgICAgICAgICAgICAgICAgICAgICAgICBzZHZveCAmPSBTRFZPQ19QUkVTRVJWRV9NQVNLOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNkdm94IHw9ICg5IDw8IDE5KSB8IFNEVk9fQk9SREVSX0VOQUJMRTsKKyAgICAgICAgfQorCWlmIChpbnRlbF9jcnRjLT5waXBlID09IDEpCisJCXNkdm94IHw9IFNEVk9fUElQRV9CX1NFTEVDVDsKKworCXNkdm9fcGl4ZWxfbXVs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cDsKKyAqICAgICB1MzIgbWFudDsKKyAqICAgICB1MzIgcmV0OworICoKKyAqICAgICBpZiAoZiA8IDApCisgKiAgICAgICAgIGYgPSAtZjsKKyAqCisgKiAgICAgaWYgKGYgPj0gMSkgeworICogICAgICAgICBleHAgPSAweDc7CisgKiAJICAgbWFudCA9IDEgPDwgODsKKyAqICAgICB9IGVsc2UgeworICogICAgICAgICBmb3IgKGV4cCA9IDA7IGV4cCA8IDMgJiYgZiA8IDAuNTsgZXhwKyspCisgKiAJICAgICAgIGYgKj0gMi4wOworICogICAgICAgICBtYW50ID0gKGYgKiAoMSA8PCA5KSArIDAuNSk7CisgKiAgICAgICAgIGlmIChtYW50ID49ICgxIDw8IDkpKQorICogICAgICAgICAgICAgbWFudCA9ICgxIDw8IDkpIC0gMTsKKyAqICAgICB9CisgKiAgICAgcmV0ID0gKGV4cCA8PCA5KSB8IG1hbnQ7CisgKiAgICAgcmV0dXJuIHJldDsKKyAqIH0KKyAqLworCisvKgorICogQmVob2xkLCBtYWdpYyBudW1iZXJzISAgSWYgd2UgcGxhbnQgdGhlbSB0aGV5IG1pZ2h0IGdyb3cgYSBiaWcKKyAqIHMtdmlkZW8gY2FibGUgdG8gdGhlIHNreS4uLiBvciBzb21ldGhpbmcuCisgKgorICogUHJlLWNvbnZlcnRlZCB0byBhcHByb3ByaWF0ZSBoZXggdmFsdWUuCisgKi8KKworLyoKKyAqIFBBTCAmIE5UU0MgdmFsdWVzIGZvciBjb21wb3NpdGUgJiBzLXZpZGVvIGNvbm5lY3Rpb25zCisgKi8KK3N0YXRpYyBjb25zdCBzdHJ1Y3QgY29sb3JfY29udmVyc2lvbiBudHNjX21fY3NjX2NvbXBvc2l0ZSA9IHsKKwkucnkgPSAweDAzMzIsIC5neSA9IDB4MDEyZCwgLmJ5ID0gMHgwN2QzLCAuYXkgPSAweDAxMDQsCisJLnJ1ID0gMHgwNzMzLCAuZ3UgPSAweDA1MmQsIC5idSA9IDB4MDVjNywgLmF1ID0gMHg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TJfc2l6ZSAgICAgID0gIDIwNjI1LAorCQkuZGRhM19pbmMgICAgICAgPSAgICAgIDAsICAgICAgIC5kZGEzX3NpemUgICAgICA9ICAgICAgMCwKKwkJLnNjX3Jlc2V0ICAgPSBUVl9TQ19SRVNFVF9FVkVSWV84LAorCQkucGFsX2J1cnN0ICA9IHRydWUsCisKKwkJLmNvbXBvc2l0ZV9sZXZlbHMgPSAmcGFsX2xldmVsc19jb21wb3NpdGUsCisJCS5jb21wb3NpdGVfY29sb3IgPSAmcGFsX2NzY19jb21wb3NpdGUsCisJCS5zdmlkZW9fbGV2ZWxzICA9ICZwYWxfbGV2ZWxzX3N2aWRlbywKKwkJLnN2aWRlb19jb2xvciA9ICZwYWxfY3NjX3N2aWRlbywKKworCQkuZmlsdGVyX3RhYmxlID0gZmlsdGVyX3RhYmxlLAorCX0sCisJeworCQkubmFtZSAgICAgICA9ICI0ODBwQDU5Ljk0SHoiLAorCQkuY2xvY2sgCT0gMTA3NTIwLAorCQkucmVmcmVzaAk9IDU5OTQwLAorCQkub3ZlcnNhbXBsZSAgICAgPSBUVl9PVkVSU0FNUExFXzRYLAorCQkuY29tcG9uZW50X29ubHkgPSAxLAorCisJCS5oc3luY19lbmQgICAgICA9IDY0LCAgICAgICAgICAgICAgIC5oYmxhbmtfZW5kICAgICAgICAgPSAxMjIsCisJCS5oYmxhbmtfc3RhcnQgICA9IDg0MiwgICAgICAgICAgICAgIC5odG90YWwgICAgICAgICAgICAgPSA4NTcsCisKKwkJLnByb2dyZXNzaXZlICAgID0gdHJ1ZSwudHJpbGV2ZWxfc3luYyA9IGZhbHNlLAorCisJCS52c3luY19zdGFydF9mMSA9IDEyLCAgICAgICAgICAgICAgIC52c3luY19zdGFydF9mMiAgICAgPSAxMiwKKwkJLnZzeW5jX2xlbiAgICAgID0gMTIsCisKKwkJLnZlcV9lbmEgICAgICAgID0gZmFsc2UsCisKKwkJLnZpX2VuZF9mMSAgICAgID0gNDQsICAgICAgICAgICAgICAgLnZpX2VuZF9mMiAgICAgICAgICA9IDQ0LAorCQkubmJyX2VuZCAgICAgICAgPSA0OTYsCisKKwkJLmJ1cnN0X2VuYSAgICAgID0gZmFsc2UsCisKKwkJLmZpbHRlcl90YWJsZSA9IGZpbHRlcl90YWJsZSwKKwl9LAorCXsKKwkJLm5hbWUgICAgICAgPSAiNDgwcEA2MEh6IiwKKwkJLmNsb2NrIAk9IDEwNzUyMCwKKwkJLnJlZnJlc2gJPSA2MDAwMCwKKwkJLm92ZXJzYW1wbGUgICAgID0gVFZfT1ZFUlNBTVBMRV80WCwKKwkJLmNvbXBvbmVudF9vbmx5ID0gMSwKKworCQkuaHN5bmNfZW5kICAgICAgPSA2NCwgICAgICAgICAgICAgICAuaGJsYW5rX2VuZCAgICAgICAgID0gMTIyLAorCQkuaGJsYW5rX3N0YXJ0ICAgPSA4NDIsICAgICAgICAgICAgICAuaHRvdGFsICAgICAgICAgICAgID0gODU2LAorCisJCS5wcm9ncmVzc2l2ZSAgICA9IHRydWUsLnRyaWxldmVsX3N5bmMgPSBmYWxzZSwKKworCQkudnN5bmNfc3RhcnRfZjEgPSAxMiwgICAgICAgICAgICAgICAudnN5bmNfc3RhcnRfZjIgICAgID0gMTIsCisJCS52c3luY19sZW4gICAgICA9IDEyLAorCisJCS52ZXFfZW5hICAgICAgICA9IGZhbHNlLAorCisJCS52aV9lbmRfZjEgICAgICA9IDQ0LCAgICAgICAgICAgICAgIC52aV9lbmRfZjIgICAgICAgICAgPSA0NCwKKwkJLm5icl9lbmQgICAgICAgID0gNDk2LAorCisJCS5idXJzdF9lbmEgICAgICA9IGZhbHNlLAorCisJCS5maWx0ZXJfdGFibGUgPSBmaWx0ZXJfdGFibGUsCisJfSwKKwl7CisJCS5uYW1lICAgICAgID0gIjU3NnAiLAorCQkuY2xvY2sgCT0gMTA3NTIwLAorCQkucmVmcmVzaAk9IDUwMDAwLAorCQkub3ZlcnNhbXBsZSAgICAgPSBUVl9PVkVSU0FNUExFXzRYLAorCQkuY29tcG9uZW50X29ubHkgPSAxLAorCisJCS5oc3luY19lbmQgICAgICA9IDY0LCAgICAgICAgICAgICAgIC5oYmxhbmtfZW5kICAgICAgICAgPSAxMzksCisJCS5oYmxhbmtfc3RhcnQgICA9IDg1OSwgICAgICAgICAgICAgIC5odG90YWwgICAgICAgICAgICAgPSA4NjMsCisKKwkJLnByb2dyZXNzaXZlICAgID0gdHJ1ZSwJCS50cmlsZXZlbF9zeW5jID0gZmFsc2UsCisKKwkJLnZzeW5jX3N0YXJ0X2YxID0gMTAsICAgICAgICAgICAgICAgLnZzeW5jX3N0YXJ0X2YyICAgICA9IDEwLAorCQkudnN5bmNfbGVuICAgICAgPSAxMCwKKworCQkudmVxX2VuYSAgICAgICAgPSBmYWxzZSwKKworCQkudmlfZW5kX2YxICAgICAgPSA0OCwgICAgICAgICAgICAgICAudmlfZW5kX2YyICAgICAgICAgID0gNDgsCisJCS5uYnJfZW5kICAgICAgICA9IDU3NSwKKworCQkuYnVyc3RfZW5hICAgICAgPSBmYWxzZSwKKworCQkuZmlsdGVyX3RhYmxlID0gZmlsdGVyX3RhYmxlLAorCX0sCisJeworCQkubmFtZSAgICAgICA9ICI3MjBwQDYwSHoiLAorCQkuY2xvY2sJCT0gMTQ4ODAwLAorCQkucmVmcmVzaAk9IDYwMDAwLAorCQkub3ZlcnNhbXBsZSAgICAgPSBUVl9PVkVSU0FNUExFXzJYLAorCQkuY29tcG9uZW50X29ubHkgPSAxLAorCisJCS5oc3luY19lbmQgICAgICA9IDgwLCAgICAgICAgICAgICAgIC5oYmxhbmtfZW5kICAgICAgICAgPSAzMDAsCisJCS5oYmxhbmtfc3RhcnQgICA9IDE1ODAsICAgICAgICAgICAgIC5odG90YWwgICAgICAgICAgICAgPSAxNjQ5LAorCisJCS5wcm9ncmVzc2l2ZSAgICA9IHRydWUsIAkgICAgLnRyaWxldmVsX3N5bmMgPSB0cnVlLAorCisJCS52c3luY19zdGFydF9mMSA9IDEwLCAgICAgICAgICAgICAgIC52c3luY19zdGFydF9mMiAgICAgPSAxMCwKKwkJLnZzeW5jX2xlbiAgICAgID0gMTAsCisKKwkJLnZlcV9lbmEgICAgICAgID0gZmFsc2UsCisKKwkJLnZpX2VuZF9mMSAgICAgID0gMjksICAgICAgICAgICAgICAgLnZpX2VuZF9mMiAgICAgICAgICA9IDI5LAorCQkubmJyX2VuZCAgICAgICAgPSA3MTksCisKKwkJLmJ1cnN0X2VuYSAgICAgID0gZmFsc2UsCisKKwkJLmZpbHRlcl90YWJsZSA9IGZpbHRlcl90YWJsZSwKKwl9LAorCXsKKwkJLm5hbWUgICAgICAgPSAiNzIwcEA1OS45NEh6IiwKKwkJLmNsb2NrCQk9IDE0ODgwMCwKKwkJLnJlZnJlc2gJPSA1OTk0MCwKKwkJLm92ZXJzYW1wbGUgICAgID0gVFZfT1ZFUlNBTVBMRV8yWCwKKwkJLmNvbXBvbmVudF9vbmx5ID0gMSwKKworCQkuaHN5bmNfZW5kICAgICAgPSA4MCwgICAgICAgICAgICAgICAuaGJsYW5rX2VuZCAgICAgICAgID0gMzAwLAorCQkuaGJsYW5rX3N0YXJ0ICAgPSAxNTgwLCAgICAgICAgICAgICAuaHRvdGFsICAgICAgICAgICAgID0gMTY1MSwKKworCQkucHJvZ3Jlc3NpdmUgICAgPSB0cnVlLCAJICAgIC50cmlsZXZlbF9zeW5jID0gdHJ1ZSwKKworCQkudnN5bmNfc3RhcnRfZjEgPSAxMCwgICAgICAgICAgICAgICAudnN5bmNfc3RhcnRfZjIgICAgID0gMTAsCisJCS52c3luY19sZW4gICAgICA9IDEwLAorCisJCS52ZXFfZW5hICAgICAgICA9IGZhbHNlLAorCisJCS52aV9lbmRfZjEgICAgICA9IDI5LCAgICAgICAgICAgICAgIC52aV9lbmRfZjIgICAgICAgICAgPSAyOSwKKwkJLm5icl9lbmQgICAgICAgID0gNzE5LAorCisJCS5idXJzdF9lbmEgICAgICA9IGZhbHNlLAorCisJCS5maWx0ZXJfdGFibGUgPSBmaWx0ZXJfdGFibGUsCisJfSwKKwl7CisJCS5uYW1lICAgICAgID0gIjcyMHBANTBIeiIsCisJCS5jbG9jawkJPSAxNDg4MDAsCisJCS5yZWZyZXNoCT0gNTAwMDAsCisJCS5vdmVyc2FtcGxlICAgICA9IFRWX09WRVJTQU1QTEVfMlgsCisJCS5jb21wb25lbnRfb25seSA9IDEsCisKKwkJLmhzeW5jX2VuZCAgICAgID0gODAsICAgICAgICAgICAgICAgLmhibGFua19lbmQgICAgICAgICA9IDMwMCwKKwkJLmhibGFua19zdGFydCAgID0gMTU4MCwgICAgICAgICAgICAgLmh0b3RhbCAgICAgICAgICAgICA9IDE5NzksCisKKwkJLnByb2dyZXNzaXZlICAgID0gdHJ1ZSwgCSAgICAgICAgLnRyaWxldmVsX3N5bmMgPSB0cnVlLAorCisJCS52c3luY19zdGFydF9mMSA9IDEwLCAgICAgICAgICAgICAgIC52c3luY19zdGFydF9mMiAgICAgPSAxMCwKKwkJLnZzeW5jX2xlbiAgICAgID0gMTAsCisKKwkJLnZlcV9lbmEgICAgICAgID0gZmFsc2UsCisKKwkJLnZpX2VuZF9mMSAgICAgID0gMjksICAgICAgICAgICAgICAgLnZpX2VuZF9mMiAgICAgICAgICA9IDI5LAorCQkubmJyX2VuZCAgICAgICAgPSA3MTksCisKKwkJLmJ1cnN0X2VuYSAgICAgID0gZmFsc2UsCisKKwkJLmZpbHRlcl90YWJsZSA9IGZpbHRlcl90YWJsZSwKKwkJLm1heF9zcmN3ID0gODAwCisJfSwKKwl7CisJCS5uYW1lICAgICAgID0gIjEwODBpQDUwSHoiLAorCQkuY2xvY2sJCT0gMTQ4ODAwLAorCQkucmVmcmVzaAk9IDI1MDAwLAorCQkub3ZlcnNhbXBsZSAgICAgPSBUVl9PVkVSU0FNUExFXzJYLAorCQkuY29tcG9uZW50X29ubHkgPSAxLAorCisJCS5oc3luY19lbmQgICAgICA9IDg4LCAgICAgICAgICAgICAgIC5oYmxhbmtfZW5kICAgICAgICAgPSAyMzUsCisJCS5oYmxhbmtfc3RhcnQgICA9IDIxNTUsICAgICAgICAgICAgIC5odG90YWwgICAgICAgICAgICAgPSAyNjM5LAorCisJCS5wcm9ncmVzc2l2ZSAgICA9IGZhbHNlLCAJICAgIC50cmlsZXZlbF9zeW5jID0gdHJ1ZSwKKworCQkudnN5bmNfc3RhcnRfZjEgPSA0LCAgICAgICAgICAgICAgLnZzeW5jX3N0YXJ0X2YyICAgICA9IDUsCisJCS52c3luY19sZW4gICAgICA9IDEwLAorCisJCS52ZXFfZW5hCT0gdHJ1ZSwJCSAgICAudmVxX3N0YXJ0X2YxICAgIAk9IDQsCisJCS52ZXFfc3RhcnRfZjIgICA9IDQsCSAgICAudmVxX2xlbgkJPSAxMCwKKworCisJCS52aV9lbmRfZjEgICAgICA9IDIxLCAgICAgICAgICAgLnZpX2VuZF9mMiAgICAgICAgICA9IDIyLAorCQkubmJyX2VuZCAgICAgICAgPSA1MzksCisKKwkJLmJ1cnN0X2VuYSAgICAgID0gZmFsc2UsCisKKwkJLmZpbHRlcl90YWJsZSA9IGZpbHRlcl90YWJsZSwKKwl9LAorCXsKKwkJLm5hbWUgICAgICAgPSAiMTA4MGlANjBIeiIsCisJCS5jbG9jawkJPSAxNDg4MDAsCisJCS5yZWZyZXNoCT0gMzAwMDAsCisJCS5vdmVyc2FtcGxlICAgICA9IFRWX09WRVJTQU1QTEVfMlgsCisJCS5jb21wb25lbnRfb25seSA9IDEsCisKKwkJLmhzeW5jX2VuZCAgICAgID0gODgsICAgICAgICAgICAgICAgLmhibGFua19lbmQgICAgICAgICA9IDIzNSwKKwkJLmhibGFua19zdGFydCAgID0gMjE1NSwgICAgICAgICAgICAgLmh0b3RhbCAgICAgICAgICAgICA9IDIxOTksCisKKwkJLnByb2dyZXNzaXZlICAgID0gZmFsc2UsIAkgICAgLnRyaWxldmVsX3N5bmMgPSB0cnVlLAorCisJCS52c3luY19zdGFydF9mMSA9IDQsICAgICAgICAgICAgICAgLnZzeW5jX3N0YXJ0X2YyICAgICA9IDUsCisJCS52c3luY19sZW4gICAgICA9IDEwLAorCisJCS52ZXFfZW5hCT0gdHJ1ZSwJCSAgICAudmVxX3N0YXJ0X2YxICAgIAk9IDQsCisJCS52ZXFfc3RhcnRfZjIJPSA0LAkJICAgIC52ZXFfbGVuCQk9IDEwLAorCisKKwkJLnZpX2VuZF9mMSAgICAgID0gMjEsICAgICAgICAgICAgICAgLnZpX2VuZF9mMiAgICAgICAgICA9IDIyLAorCQkubmJyX2VuZCAgICAgICAgPSA1MzksCisKKwkJLmJ1cnN0X2VuYSAgICAgID0gZmFsc2UsCisKKwkJLmZpbHRlcl90YWJsZSA9IGZpbHRlcl90YWJsZSwKKwl9LAorCXsKKwkJLm5hbWUgICAgICAgPSAiMTA4MGlANTkuOTRIeiIsCisJCS5jbG9jawkJPSAxNDg4MDAsCisJCS5yZWZyZXNoCT0gMjk5NzAsCisJCS5vdmVyc2FtcGxlICAgICA9IFRWX09WRVJTQU1QTEVfMlgsCisJCS5jb21wb25lbnRfb25seSA9IDEsCisKKwkJLmhzeW5jX2VuZCAgICAgID0gODgsICAgICAgICAgICAgICAgLmhibGFua19lbmQgICAgICAgICA9IDIzNSwKKwkJLmhibGFua19zdGFydCAgID0gMjE1NSwgICAgICAgICAgICAgLmh0b3RhbCAgICAgICAgICAgICA9IDIyMDAsCisKKwkJLnByb2dyZXNzaXZlICAgID0gZmFsc2UsIAkgICAgLnRyaWxldmVsX3N5bmMgPSB0cnVlLAorCisJCS52c3luY19zdGFydF9mMSA9IDQsICAgICAgICAgICAgLnZzeW5jX3N0YXJ0X2YyICAgID0gNSwKKwkJLnZzeW5jX2xlbiAgICAgID0gMTAsCisKKwkJLnZlcV9lbmEJPSB0cnVlLAkJICAgIC52ZXFfc3RhcnRfZjEJPSA0LAorCQkudmVxX3N0YXJ0X2YyID0gNCwJICAgIAkgICAgLnZlcV9sZW4gPSAxMCwKKworCisJCS52aV9lbmRfZjEgICAgICA9IDIxLCAgICAgICAgICAgLnZpX2VuZF9mM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