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ICAgICBpZiAoY29tcGFyZSA8IDApCisJeworCSAgLyogSXQgaXMgbm90IGluIHRoZSBsaXN0LiAgKi8KKwkgIGJpbmRpbmcgPSBOVUxMOworCSAgYnJlYWs7CisJfQorICAgIH0KKworICBpZiAoYmluZGluZyAhPSBOVUxMKQorICAgIHsKKyAgICAgIGlmIChkaXJuYW1lcCkKKwl7CisJICBjb25zdCBjaGFyICpkaXJuYW1lID0gKmRpcm5hbWVwOworCisJICBpZiAoZGlybmFtZSA9PSBOVUxMKQorCSAgICAvKiBUaGUgY3VycmVudCBiaW5kaW5nIGhhcyBiZSB0byByZXR1cm5lZC4gICovCisJICAgICpkaXJuYW1lcCA9IGJpbmRpbmctPmRpcm5hbWU7CisJICBlbHNlCisJICAgIHsKKwkgICAgICAvKiBUaGUgZG9tYWluIGlzIGFscmVhZHkgYm91bmQuICBJZiB0aGUgbmV3IHZhbHVlIGFuZCB0aGUgb2xkCisJCSBvbmUgYXJlIGVxdWFsIHdlIHNpbXBseSBkbyBub3RoaW5nLiAgT3RoZXJ3aXNlIHJlcGxhY2UgdGhlCisJCSBvbGQgYmluZGluZy4gICovCisJICAgICAgY2hhciAqcmVzdWx0ID0gYmluZGluZy0+ZGlybmFtZTsKKwkgICAgICBpZiAoc3RyY21wIChkaXJuYW1lLCByZXN1bHQpICE9IDApCisJCXsKKwkJICBpZiAoc3RyY21wIChkaXJuYW1lLCBfbmxfZGVmYXVsdF9kaXJuYW1lKSA9PSAwKQorCQkgICAgcmVzdWx0ID0gKGNoYXIgKikgX25sX2RlZmF1bHRfZGlybmFtZTsKKwkJICBlbHNlCisJCSAgICB7CisjaWYgZGVmaW5lZCBfTElCQyB8fCBkZWZpbmVkIEhBVkVfU1RSRFVQCisJCSAgICAgIHJlc3VsdCA9IHN0cmR1cCAoZGlybmFtZSk7CisjZWxzZQorCQkgICAgICBzaXplX3QgbGVuID0gc3RybGVuIChkaXJuYW1lKSArIDE7CisJCSAgICAgIHJlc3VsdCA9IChjaGFyICopIG1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fb3V0cHV0X2NoYXJzZXQgKGRvbWFpbmJpbmRpbmcpOworIyBlbmRpZgorICAgICAgc2l6ZV90IG5jb252ZXJzaW9uczsKKyAgICAgIHN0cnVjdCBjb252ZXJ0ZWRfZG9tYWluICpjb252ZDsKKyAgICAgIHNpemVfdCBpOworCisgICAgICAvKiBQcm90ZWN0IGFnYWluc3QgcmVhbGxvY2F0aW9uIG9mIHRoZSB0YWJsZS4gICovCisgICAgICBnbF9yd2xvY2tfcmRsb2NrIChkb21haW4tPmNvbnZlcnNpb25zX2xvY2spOworCisgICAgICAvKiBTZWFyY2ggd2hldGhlciBhIHRhYmxlIHdpdGggY29udmVydGVkIHRyYW5zbGF0aW9ucyBmb3IgdGhpcworCSBlbmNvZGluZyBoYXMgYWxyZWFkeSBiZWVuIGFsbG9jYXRlZC4gICovCisgICAgICBuY29udmVyc2lvbnMgPSBkb21haW4tPm5jb252ZXJzaW9uczsKKyAgICAgIGNvbnZkID0gTlVMTDsKKworICAgICAgZm9yIChpID0gbmNvbnZlcnNpb25zOyBpID4gMDsgKQorCXsKKwkgIGktLTsKKwkgIGlmIChzdHJjbXAgKGRvbWFpbi0+Y29udmVyc2lvbnNbaV0uZW5jb2RpbmcsIGVuY29kaW5nKSA9PSAwKQorCSAgICB7CisJICAgICAgY29udmQgPSAmZG9tYWluLT5jb252ZXJzaW9uc1tpXTsKKwkgICAgICBicmVhazsKKwkgICAgfQorCX0KKworICAgICAgZ2xfcndsb2NrX3VubG9jayAoZG9tYWluLT5jb252ZXJzaW9uc19sb2NrKTsKKworICAgICAgaWYgKGNvbnZkID09IE5VTEwpCisJeworCSAgLyogV2UgaGF2ZSB0byBhbGxvY2F0ZSBhIG5ldyBjb252ZXJzaW9ucyB0YWJsZS4gICovCisJICBnbF9yd2xvY2tfd3Jsb2NrIChkb21haW4tPmNvbnZlcnNpb25zX2xvY2spOworCSAgbmNvbnZlcnNpb25zID0gZG9tYWluLT5uY29udmVyc2lvbnM7CisKKwkgIC8qIE1heW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pCisJCQl7CisJCQkgIGNoYXIgKnRtcDsKKworCQkJICBsZW4gPSBzdHJsZW4gKG91dGNoYXJzZXQpOworCQkJICB0bXAgPSAoY2hhciAqKSBhbGxvY2EgKGxlbiArIDEwICsgMSk7CisJCQkgIG1lbWNweSAodG1wLCBvdXRjaGFyc2V0LCBsZW4pOworCQkJICBtZW1jcHkgKHRtcCArIGxlbiwgIi8vVFJBTlNMSVQiLCAxMCArIDEpOworCQkJICBvdXRjaGFyc2V0ID0gdG1wOworCisJCQkgIGNvbnZkLT5jb252ID0gaWNvbnZfb3BlbiAob3V0Y2hhcnNldCwgY2hhcnNldCk7CisKKwkJCSAgZnJlZWEgKG91dGNoYXJzZXQpOworCQkJfQorCQkgICAgICBlbHNlCisjICAgZW5kaWYKKwkJCWNvbnZkLT5jb252ID0gaWNvbnZfb3BlbiAob3V0Y2hhcnNldCwgY2hhcnNldCk7CisjICBlbmRpZgorIyBlbmRpZgorCisJCSAgICAgIGZyZWVhIChjaGFyc2V0KTsKKwkJICAgIH0KKwkJfQorCSAgICB9CisJICAgIGNvbnZkLT5jb252X3RhYiA9IE5VTEw7CisJICAgIC8qIEhlcmUgZG9tYWluLT5jb252ZXJzaW9ucyBpcyBzdGlsbCA9PSBuZXdfY29udmVyc2lvbnMuICAqLworCSAgICBkb21haW4tPm5jb252ZXJzaW9ucysrOworCSAgfQorCisJZm91bmRfY29udmQ6CisJICBnbF9yd2xvY2tfdW5sb2NrIChkb21haW4tPmNvbnZlcnNpb25zX2xvY2spOworCX0KKworICAgICAgaWYgKAorIyBpZmRlZiBfTElCQworCSAgY29udmQtPmNvbnYgIT0gKF9fZ2NvbnZfdCkgLTEKKyMgZWxzZQorIyAgaWYgSEFWRV9JQ09OVgorCSAgY29udmQtPmNvbnYgIT0gKGljb252X3QpIC0xCisjICBlbmRpZgorIyBlbmRpZgorCSAgKQorCXsKKwkgIC8qIFdlIGFyZSBzdXBwb3NlZCB0byBkbyBhIGNvbnZlcnNpb24uICBGaXJzd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QgY2hhciAqKikgJmlucHRyLCAmaW5sZWZ0LAorCQkJICAgICAmb3V0cHRyLCAmb3V0bGVmdCkKKwkJICAgICAgIT0gKHNpemVfdCkgKC0xKSkKKwkJICAgIHsKKwkJICAgICAgb3V0YnVmID0gKHVuc2lnbmVkIGNoYXIgKikgb3V0cHRyOworCQkgICAgICBicmVhazsKKwkJICAgIH0KKwkJICBpZiAoZXJybm8gIT0gRTJCSUcpCisJCSAgICB7CisJCSAgICAgIF9fbGliY19sb2NrX3VubG9jayAobG9jayk7CisJCSAgICAgIHJldHVybiBOVUxMOworCQkgICAgfQorIyAgZW5kaWYKKyMgZW5kaWYKKworCQlyZXNpemVfZnJlZW1lbToKKwkJICAvKiBXZSBtdXN0IGFsbG9jYXRlIGEgbmV3IGJ1ZmZlciBvciByZXNpemUgdGhlIG9sZCBvbmUuICAqLworCQkgIGlmIChtYWxsb2NfY291bnQgPiAwKQorCQkgICAgeworCQkgICAgICArK21hbGxvY19jb3VudDsKKwkJICAgICAgZnJlZW1lbV9zaXplID0gbWFsbG9jX2NvdW50ICogSU5JVElBTF9CTE9DS19TSVpFOworCQkgICAgICBuZXdtZW0gPSAodHJhbnNtZW1fYmxvY2tfdCAqKSByZWFsbG9jICh0cmFuc21lbV9saXN0LAorCQkJCQkJCSAgICAgZnJlZW1lbV9zaXplKTsKKyMgaWZkZWYgX0xJQkMKKwkJICAgICAgaWYgKG5ld21lbSAhPSBOVUxMKQorCQkJdHJhbnNtZW1fbGlzdCA9IG5ld21lbTsKKwkJICAgICAgZWxzZQorCQkJeworCQkJICBzdHJ1Y3QgdHJhbnNtZW1fbGlzdCAqb2xkID0gdHJhbnNtZW1fbGlzdDsKKworCQkJICB0cmFuc21lbV9saXN0ID0gdHJhbnNtZW1fbGlzdC0+bmV4dDsKKwkJCSAgZnJlZSAob2xkKTsKKwkJCX0KKyMgZW5kaWYKKwkJICAgIH0KKwkJICBlbHNlCisJCSAgICB7CisJCSAgICAgIG1hbGxvY19jb3VudCA9I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lbHNlCisgICAgeworICAgICAgaWYgKGNwWzBdID09ICdfJykKKwl7CisJICAvKiBOZXh0IGlzIHRoZSB0ZXJyaXRvcnkuICAqLworCSAgY3BbMF0gPSAnXDAnOworCSAgKnRlcnJpdG9yeSA9ICsrY3A7CisKKwkgIHdoaWxlIChjcFswXSAhPSAnXDAnICYmIGNwWzBdICE9ICcuJyAmJiBjcFswXSAhPSAnQCcpCisJICAgICsrY3A7CisKKwkgIG1hc2sgfD0gWFBHX1RFUlJJVE9SWTsKKwl9CisKKyAgICAgIGlmIChjcFswXSA9PSAnLicpCisJeworCSAgLyogTmV4dCBpcyB0aGUgY29kZXNldC4gICovCisJICBjcFswXSA9ICdcMCc7CisJICAqY29kZXNldCA9ICsrY3A7CisKKwkgIHdoaWxlIChjcFswXSAhPSAnXDAnICYmIGNwWzBdICE9ICdAJykKKwkgICAgKytjcDsKKworCSAgbWFzayB8PSBYUEdfQ09ERVNFVDsKKworCSAgaWYgKCpjb2Rlc2V0ICE9IGNwICYmICgqY29kZXNldClbMF0gIT0gJ1wwJykKKwkgICAgeworCSAgICAgICpub3JtYWxpemVkX2NvZGVzZXQgPSBfbmxfbm9ybWFsaXplX2NvZGVzZXQgKCpjb2Rlc2V0LAorCQkJCQkJCSAgIGNwIC0gKmNvZGVzZXQpOworCSAgICAgIGlmICgqbm9ybWFsaXplZF9jb2Rlc2V0ID09IE5VTEwpCisJCXJldHVybiAtMTsKKwkgICAgICBlbHNlIGlmIChzdHJjbXAgKCpjb2Rlc2V0LCAqbm9ybWFsaXplZF9jb2Rlc2V0KSA9PSAwKQorCQlmcmVlICgoY2hhciAqKSAqbm9ybWFsaXplZF9jb2Rlc2V0KTsKKwkgICAgICBlbHNlCisJCW1hc2sgfD0gWFBHX05PUk1fQ09ERVNFVDsKKwkgICAgfQorCX0KKyAgICB9CisKKyAgaWYgKGNwWzBdID09ICdAJykKKyAgICB7CisgICAgICAvKiBOZXh0IGlzIHRoZSBtb2RpZmllci4gICovCisgICAgICBj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KKyAgICB7CisgICAgICBzaXplX3QgcGFydF9sZW4gPSBzdHJsZW4gKGFyZ3opOworICAgICAgYXJneiArPSBwYXJ0X2xlbjsKKyAgICAgIGxlbiAtPSBwYXJ0X2xlbiArIDE7CisgICAgICBpZiAobGVuID4gMCkKKwkqYXJneisrID0gc2VwOworICAgIH0KK30KKyMgdW5kZWYgX19hcmd6X3N0cmluZ2lmeQorIyBkZWZpbmUgX19hcmd6X3N0cmluZ2lmeShhcmd6LCBsZW4sIHNlcCkgYXJnel9zdHJpbmdpZnlfXyAoYXJneiwgbGVuLCBzZXApCisjZW5kaWYJLyogIV9MSUJDICYmICFIQVZFX0FSR1pfU1RSSU5HSUZZICovCisKKyNpZmRlZiBfTElCQworI2VsaWYgZGVmaW5lZCBIQVZFX0FSR1pfTkVYVAorIyB1bmRlZiBfX2FyZ3pfbmV4dAorIyBkZWZpbmUgX19hcmd6X25leHQgYXJnel9uZXh0CisjZWxzZQorc3RhdGljIGNoYXIgKgorYXJnel9uZXh0X18gKGNoYXIgKmFyZ3osIHNpemVfdCBhcmd6X2xlbiwgY29uc3QgY2hhciAqZW50cnkpCit7CisgIGlmIChlbnRyeSkKKyAgICB7CisgICAgICBpZiAoZW50cnkgPCBhcmd6ICsgYXJnel9sZW4pCisgICAgICAgIGVudHJ5ID0gc3RyY2hyIChlbnRyeSwgJ1wwJykgKyAxOworCisgICAgICByZXR1cm4gZW50cnkgPj0gYXJneiArIGFyZ3pfbGVuID8gTlVMTCA6IChjaGFyICopIGVudHJ5OworICAgIH0KKyAgZWxzZQorICAgIGlmIChhcmd6X2xlbiA+IDApCisgICAgICByZXR1cm4gYXJnejsKKyAgICBlbHNlCisgICAgICByZXR1cm4gMDsKK30KKyMgdW5kZWYgX19hcmd6X25leHQKKyMgZGVmaW5lIF9fYXJnel9uZXh0KGFyZ3osIGxlbiwgZW50cnkpIGFyZ3pfbmV4dF9fIChhcmd6LCBsZW4sIGVudHJ5KQorI2VuZGlmCS8qICFfTElCQyAmJi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CisgICAgICAqbDEwbmZpbGVfbGlzdCA9IHJldHZhbDsKKyAgICB9CisgIGVsc2UKKyAgICB7CisgICAgICByZXR2YWwtPm5leHQgPSBsYXN0LT5uZXh0OworICAgICAgbGFzdC0+bmV4dCA9IHJldHZhbDsKKyAgICB9CisKKyAgZW50cmllcyA9IDA7CisgIC8qIElmIHRoZSBESVJMSVNUIGlzIGEgcmVhbCBsaXN0IHRoZSBSRVRWQUwgZW50cnkgY29ycmVzcG9uZHMgbm90IHRvCisgICAgIGEgcmVhbCBmaWxlLiAgU28gd2UgaGF2ZSB0byB1c2UgdGhlIERJUkxJU1Qgc2VwYXJhdGlvbiBtZWNoYW5pc20KKyAgICAgb2YgdGhlIGlubmVyIGxvb3AuICAqLworICBjbnQgPSBfX2FyZ3pfY291bnQgKGRpcmxpc3QsIGRpcmxpc3RfbGVuKSA9PSAxID8gbWFzayAtIDEgOiBtYXNrOworICBmb3IgKDsgY250ID49IDA7IC0tY250KQorICAgIGlmICgoY250ICYgfm1hc2spID09IDApCisgICAgICB7CisJLyogSXRlcmF0ZSBvdmVyIGFsbCBlbGVtZW50cyBvZiB0aGUgRElSTElTVC4gICovCisJY2hhciAqZGlyID0gTlVMTDsKKworCXdoaWxlICgoZGlyID0gX19hcmd6X25leHQgKChjaGFyICopIGRpcmxpc3QsIGRpcmxpc3RfbGVuLCBkaXIpKQorCSAgICAgICAhPSBOVUxMKQorCSAgcmV0dmFsLT5zdWNjZXNzb3JbZW50cmllcysrXQorCSAgICA9IF9ubF9tYWtlX2wxMG5mbGlzdCAobDEwbmZpbGVfbGlzdCwgZGlyLCBzdHJsZW4gKGRpcikgKyAxLCBjbnQsCisJCQkJICBsYW5ndWFnZSwgdGVycml0b3J5LCBjb2Rlc2V0LAorCQkJCSAgbm9ybWFsaXplZF9jb2Rlc2V0LCBtb2RpZmllciwgZmlsZW5hbWUsIDEpOworICAgICAgfQorICByZXR2YWwtPnN1Y2Nlc3NvcltlbnRyaWVzXSA9IE5VTEw7Cis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SA9PSAndScpCisJCXJldHVybiBQUkl1MTY7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ3gnKQorCQlyZXR1cm4gUFJJeDE2OworCSAgICAgIGlmIChuYW1lWzNdID09ICdYJykKKwkJcmV0dXJuIFBSSVgxNjsKKwkgICAgICBhYm9ydCAoKTsKKwkgICAgfQorCSAgaWYgKG5hbWVbNF0gPT0gJzMnICYmIG5hbWVbNV0gPT0gJzInICYmIG5hbWVbNl0gPT0gJ1wwJykKKwkgICAgeworCSAgICAgIGlmIChuYW1lWzNdID09ICdkJykKKwkJcmV0dXJuIFBSSWQzMjsKKwkgICAgICBpZiAobmFtZVszXSA9PSAnaScpCisJCXJldHVybiBQUklpMzI7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ28nKQorCQlyZXR1cm4gUFJJbzMyOworCSAgICAgIGlmIChuYW1lWzNdID09ICd1JykKKwkJcmV0dXJuIFBSSXUzMjsKKwkgICAgICBpZiAobmFtZVszXSA9PSAneCcpCisJCXJldHVybiBQUkl4MzI7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ1gnKQorCQlyZXR1cm4gUFJJWDMyOworCSAgICAgIGFib3J0ICgpOworCSAgICB9CisJICBpZiAobmFtZVs0XSA9PSAnNicgJiYgbmFtZVs1XSA9PSAnNCcgJiYgbmFtZVs2XSA9PSAnXDAnKQorCSAgICB7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ2QnKQorCQlyZXR1cm4gUFJJZDY0OworCSAgICAgIGlmIChuYW1lWzNdID09ICdpJykKKwkJcmV0dXJuIFBSSWk2NDsKKwkgICAgICBpZiAobmFtZVszXSA9PSAnbycpCisJCXJldHVybiBQUklvNjQ7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ3UnKQorCQlyZXR1cm4gUFJJdTY0OworCSAgICAgIGlmIChuYW1lWzNdID09ICd4JykKKwkJcmV0dXJuIFBSSXg2NDsKKwkgICAgICBpZiAobmFtZVszXSA9PSAnWCcpCisJCXJldHVybiBQUklYNjQ7CisJICAgICAgYWJvcnQgKCk7CisJICAgIH0KKwkgIGlmIChuYW1lWzRdID09ICdMJyAmJiBuYW1lWzVdID09ICdFJyAmJiBuYW1lWzZdID09ICdBJworCSAgICAgICYmIG5hbWVbN10gPT0gJ1MnICYmIG5hbWVbOF0gPT0gJ1QnKQorCSAgICB7CisJICAgICAgaWYgKG5hbWVbOV0gPT0gJzgnICYmIG5hbWVbMTBdID09ICdcMCcpCisJCXsKKwkJICBpZiAobmFtZVszXSA9PSAnZCcpCisJCSAgICByZXR1cm4gUFJJZExFQVNUODsKKwkJICBpZiAobmFtZVszXSA9PSAnaScpCisJCSAgICByZXR1cm4gUFJJaUxFQVNUODsKKwkJICBpZiAobmFtZVszXSA9PSAnbycpCisJCSAgICByZXR1cm4gUFJJb0xFQVNUODsKKwkJICBpZiAobmFtZVszXSA9PSAndScpCisJCSAgICByZXR1cm4gUFJJdUxFQVNUODsKKwkJICBpZiAobmFtZVszXSA9PSAneCcpCisJCSAgICByZXR1cm4gUFJJeExFQVNUODsKKwkJICBpZiAobmFtZVszXSA9PSAnWCcpCisJCSAgICByZXR1cm4gUFJJWExFQVNUODsKKwkJICBhYm9ydCAoKTsKKwkJfQorCSAgICAgIGlmIChuYW1lWzldID09ICcxJyAmJiBuYW1lWzEwXSA9PSAnNicgJiYgbmFtZVsxMV0gPT0gJ1wwJykKKwkJeworCQkgIGlmIChuYW1lWzNdID09ICdkJykKKwkJICAgIHJldHVybiBQUklkTEVBU1QxNjsKKwkJICBpZiAobmFtZVszXSA9PSAnaScpCisJCSAgICByZXR1cm4gUFJJaUxFQVNUMTY7CisJCSAgaWYgKG5hbWVbM10gPT0gJ28nKQorCQkgICAgcmV0dXJuIFBSSW9MRUFTVDE2OworCQkgIGlmIChuYW1lWzNdID09ICd1JykKKwkJICAgIHJldHVybiBQUkl1TEVBU1QxNjsKKwkJICBpZiAobmFtZVszXSA9PSAneCcpCisJCSAgICByZXR1cm4gUFJJeExFQVNUMTY7CisJC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WYgKG5hbWVbM10gPT0gJ1gnKQorCQkgICAgcmV0dXJuIFBSSVhGQVNUMTY7CisJCSAgYWJvcnQgKCk7CisJCX0KKwkgICAgICBpZiAobmFtZVs4XSA9PSAnMycgJiYgbmFtZVs5XSA9PSAnMicgJiYgbmFtZVsxMF0gPT0gJ1wwJykKKwkJeworCQkgIGlmIChuYW1lWzNdID09ICdkJykKKwkJICAgIHJldHVybiBQUklkRkFTVDMyOworCQkgIGlmIChuYW1lWzNdID09ICdpJykKKwkJICAgIHJldHVybiBQUklpRkFTVDMyOworCQkgIGlmIChuYW1lWzNdID09ICdvJykKKwkJICAgIHJldHVybiBQUklvRkFTVDMyOworCQkgIGlmIChuYW1lWzNdID09ICd1JykKKwkJICAgIHJldHVybiBQUkl1RkFTVDMyOworCQkgIGlmIChuYW1lWzNdID09ICd4JykKKwkJICAgIHJldHVybiBQUkl4RkFTVDMyOworCQkgIGlmIChuYW1lWzNdID09ICdYJykKKwkJICAgIHJldHVybiBQUklYRkFTVDMyOworCQkgIGFib3J0ICgpOworCQl9CisJICAgICAgaWYgKG5hbWVbOF0gPT0gJzYnICYmIG5hbWVbOV0gPT0gJzQnICYmIG5hbWVbMTBdID09ICdcMCcpCisJCXsKKwkJICBpZiAobmFtZVszXSA9PSAnZCcpCisJCSAgICByZXR1cm4gUFJJZEZBU1Q2NDsKKwkJICBpZiAobmFtZVszXSA9PSAnaScpCisJCSAgICByZXR1cm4gUFJJaUZBU1Q2NDsKKwkJICBpZiAobmFtZVszXSA9PSAnbycpCisJCSAgICByZXR1cm4gUFJJb0ZBU1Q2NDsKKwkJICBpZiAobmFtZVszXSA9PSAndScpCisJCSAgICByZXR1cm4gUFJJdUZBU1Q2NDsKKwkJICBpZiAobmFtZVszXSA9PSAneCcpCisJCSAgICByZXR1cm4gUFJJeEZBU1Q2NDsKKwkJICBpZiAobmFtZVszXSA9PSAnWCcpCisJCSAgICByZXR1cm4gUFJJWEZBU1Q2NDsKKwkJICBhYm9ydCAoKTsKKwkJfQorCSAgICB9CisJICBpZiAobmFtZVs0XSA9PSAnTScgJiYgbmFtZVs1XSA9PSAnQScgJiYgbmFtZVs2XSA9PSAnWCcKKwkgICAgICAmJiBuYW1lWzddID09ICdcMCcpCisJICAgIHsKKwkgICAgICBpZiAobmFtZVszXSA9PSAnZCcpCisJCXJldHVybiBQUklkTUFYOworCSAgICAgIGlmIChuYW1lWzNdID09ICdpJykKKwkJcmV0dXJuIFBSSWlNQVg7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ28nKQorCQlyZXR1cm4gUFJJb01BWDsKKwkgICAgICBpZiAobmFtZVszXSA9PSAndScpCisJCXJldHVybiBQUkl1TUFYOworCSAgICAgIGlmIChuYW1lWzNdID09ICd4JykKKwkJcmV0dXJuIFBSSXhNQVg7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ1gnKQorCQlyZXR1cm4gUFJJWE1BWDsKKwkgICAgICBhYm9ydCAoKTsKKwkgICAgfQorCSAgaWYgKG5hbWVbNF0gPT0gJ1AnICYmIG5hbWVbNV0gPT0gJ1QnICYmIG5hbWVbNl0gPT0gJ1InCisJICAgICAgJiYgbmFtZVs3XSA9PSAnXDAnKQorCSAgICB7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ2QnKQorCQlyZXR1cm4gUFJJZFBUUjsKKwkgICAgICBpZiAobmFtZVszXSA9PSAnaScpCisJCXJldHVybiBQUklpUFRSOworCSAgICAgIGlmIChuYW1lWzNdID09ICdvJykKKwkJcmV0dXJuIFBSSW9QVFI7CisJICAgICAgaWYgKG5hbWVbM10gPT0gJ3UnKQorCQlyZXR1cm4gUFJJdVBUUjsKKwkgICAgICBpZiAobmFtZVszXSA9PSAneCcpCisJCXJldHVybiBQUkl4UFRSOworCSAgICAgIGlmIChuYW1lWzNdID09ICdYJykKKwkJcmV0dXJuIFBSSVhQVFI7CisJICAgICAgYWJvcnQgKCk7CisJICAgIH0KKwl9CisgICAgfQorICAvKiBUZXN0IGZvciBhIGdsaWJjI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0gMiwKKyAgLm9wZXJhdGlvbiA9IG5vdF9lcXVhbCwKKyAgLnZhbCA9CisgIHsKKyAgICAuYXJncyA9CisgICAgeworICAgICAgWzBdID0gKHN0cnVjdCBleHByZXNzaW9uICopICZwbHZhciwKKyAgICAgIFsxXSA9IChzdHJ1Y3QgZXhwcmVzc2lvbiAqKSAmcGxvbmUKKyAgICB9CisgIH0KK307CisKKyMgZGVmaW5lIElOSVRfR0VSTUFOSUNfUExVUkFMKCkKKworI2Vsc2UKKworLyogRm9yIGNvbXBpbGVycyB3aXRob3V0IHN1cHBvcnQgZm9yIElTTyBDIDk5IHN0cnVjdC91bmlvbiBpbml0aWFsaXplcnM6CisgICBJbml0aWFsaXphdGlvbiBhdCBydW4tdGltZS4gICovCisKK3N0YXRpYyBzdHJ1Y3QgZXhwcmVzc2lvbiBwbHZhcjsKK3N0YXRpYyBzdHJ1Y3QgZXhwcmVzc2lvbiBwbG9uZTsKK3N0cnVjdCBleHByZXNzaW9uIEdFUk1BTklDX1BMVVJBTDsKKworc3RhdGljIHZvaWQKK2luaXRfZ2VybWFuaWNfcGx1cmFsICh2b2lkKQoreworICBpZiAocGxvbmUudmFsLm51bSA9PSAwKQorICAgIHsKKyAgICAgIHBsdmFyLm5hcmdzID0gMDsKKyAgICAgIHBsdmFyLm9wZXJhdGlvbiA9IHZhcjsKKworICAgICAgcGxvbmUubmFyZ3MgPSAwOworICAgICAgcGxvbmUub3BlcmF0aW9uID0gbnVtOworICAgICAgcGxvbmUudmFsLm51bSA9IDE7CisKKyAgICAgIEdFUk1BTklDX1BMVVJBTC5uYXJncyA9IDI7CisgICAgICBHRVJNQU5JQ19QTFVSQUwub3BlcmF0aW9uID0gbm90X2VxdWFsOworICAgICAgR0VSTUFOSUNfUExVUkFMLnZhbC5hcmdzWzBdID0gJnBsdmFyOworICAgICAgR0VSTUFOSUNfUExVUkFMLnZhbC5hcmdzWzFdID0gJnBsb25lOworICAgIH0KK30KKworIyBkZWZpbmUgSU5JVF9HR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2YgKCooU3JjKSkpCisjICBlbHNlCisjICAgZGVmaW5lIFlZQ09QWShEc3QsIFNyYywgQ291bnQpICAgICAgICAgICAgICBcCisgICAgICBkbyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgWVlTSVpFX1QgeXlpOyAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgZm9yICh5eWkgPSAwOyB5eWkgPCAoQ291bnQpOyB5eWkrKykgICBcCisgICAgICAgICAgICAoRHN0KVt5eWldID0gKFNyYylbeXlpXTsgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB3aGlsZSAoWVlJRCAoMCkpCisjICBlbmRpZgorIyBlbmRpZgorI2VuZGlmIC8qICFZWUNPUFlfTkVFREVEICovCisKKy8qIFlZRklOQUwgLS0gU3RhdGUgbnVtYmVyIG9mIHRoZSB0ZXJtaW5hdGlvbiBzdGF0ZS4gICovCisjZGVmaW5lIFlZRklOQUwgIDkKKy8qIFlZTEFTVCAtLSBMYXN0IGluZGV4IGluIFlZVEFCTEUuICAqLworI2RlZmluZSBZWUxBU1QgICA1NAorCisvKiBZWU5UT0tFTlMgLS0gTnVtYmVyIG9mIHRlcm1pbmFscy4gICovCisjZGVmaW5lIFlZTlRPS0VOUyAgMTYKKy8qIFlZTk5UUyAtLSBOdW1iZXIgb2Ygbm9udGVybWluYWxzLiAgKi8KKyNkZWZpbmUgWVlOTlRTICAzCisvKiBZWU5SVUxFUyAtLSBOdW1iZXIgb2YgcnVsZXMuICAqLworI2RlZmluZSBZWU5SVUxFUyAgMTMKKy8qIFlZTlJVTEVTIC0tIE51bWJlciBvZiBzdGF0ZXMuICAqLworI2RlZmluZSBZWU5TVEFURVMgIDI3CisKKy8qIFlZVFJBTlNMQVRFKFlZTEVYKSAtLSBCaXNvbiBzeW1ib2wgbnVtYmVyIGNvcnJlc3BvbmRpbmcgdG8gWVlMRVguICAqLworI2RlZmluZSBZWVVOREVGVE9LICAyCisjZGVmaW5lIFlZTUFYVVRPSyAgIDI2MgorCisjZGVmaW5lIFlZVFJBTlNMQVRFKFlZWCkJCQkJCQlcCisgICgodW5zaWduZWQgaW50KSAoWVlYKSA8PSBZWU1BWFVUT0sgPyB5eXRyYW5zbGF0ZVtZWVhdIDogWVlVTkRFRlRPSykKKworLyogWVlUUkFOU0xBVEVbWVlMRVhdIC0tIEJpc29uIHN5bWJvbCBudW1iZXIgY29ycmVzcG9uZGluZyB0byBZWUxFWC4gICovCitzdGF0aWMgY29uc3QgeXl0eXBlX3VpbnQ4IHl5dHJhbnNsYXRlW10gPQoreworICAgICAgIDAsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgMTAsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgNSwgICAgIDIsCisgICAgICAxNCwgICAgMTUsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgMTIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDMsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgIDEzLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICA0LCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwKKyAgICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLAorICAgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsCisgICAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMiwgICAgIDIsICAgICAyLCAgICAgMSwgICAgIDIsICAgICA2LCAgICAgNywKKyAgICAgICA4LCAgICAgOSwgICAgMTEKK307CisKKyNpZiBZWURFQlVHCisvKiBZWVBSSFNbWVlOXSAtLSBJbmRleCBvZiB0aGUgZmlyc3QgUkhTIHN5bWJvbCBvZiBydWxlIG51bWJlciBZWU4gaW4KKyAgIFlZUkhTLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfdWludDggeXlwcmhzW10gPQoreworICAgICAgIDAsICAgICAwLCAgICAgMywgICAgIDUsICAgIDExLCAgICAxNSwgICAgMTksICAgIDIzLCAgICAyNywgICAgMzEsCisgICAgICAzNSwgICAgMzgsICAgIDQwLCAgICA0MgorfTsKKworLyogWVlSSFMgLS0gQSBgLTEnLXNlcGFyYXRlZCBsaXN0IG9mIHRoZSBydWxlcycgUkhTLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfaW50OCB5eXJoc1tdID0KK3sKKyAgICAgIDE3LCAgICAgMCwgICAgLTEsICAgIDE4L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yAgIkFERE9QMiIsICJNVUxPUDIiLCAiJyEnIiwgIk5VTUJFUiIsICInOiciLCAiJ24nIiwgIicoJyIsICInKSciLAorICAiJGFjY2VwdCIsICJzdGFydCIsICJleHAiLCBZWV9OVUxMCit9OworI2VuZGlmCisKKyMgaWZkZWYgWVlQUklOVAorLyogWVlUT0tOVU1bWVlMRVgtTlVNXSAtLSBJbnRlcm5hbCB0b2tlbiBudW1iZXIgY29ycmVzcG9uZGluZyB0bworICAgdG9rZW4gWVlMRVgtTlVNLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfdWludDE2IHl5dG9rbnVtW10gPQoreworICAgICAgIDAsICAgMjU2LCAgIDI1NywgICAgNjMsICAgMTI0LCAgICAzOCwgICAyNTgsICAgMjU5LCAgIDI2MCwgICAyNjEsCisgICAgICAzMywgICAyNjIsICAgIDU4LCAgIDExMCwgICAgNDAsICAgIDQxCit9OworIyBlbmRpZgorCisvKiBZWVIxW1lZTl0gLS0gU3ltYm9sIG51bWJlciBvZiBzeW1ib2wgdGhhdCBydWxlIFlZTiBkZXJpdmVzLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfdWludDggeXlyMVtdID0KK3sKKyAgICAgICAwLCAgICAxNiwgICAgMTcsICAgIDE4LCAgICAxOCwgICAgMTgsICAgIDE4LCAgICAxOCwgICAgMTgsICAgIDE4LAorICAgICAgMTgsICAgIDE4LCAgICAxOCwgICAgMTgKK307CisKKy8qIFlZUjJbWVlOXSAtLSBOdW1iZXIgb2Ygc3ltYm9scyBjb21wb3NpbmcgcmlnaHQgaGFuZCBzaWRlIG9mIHJ1bGUgWVlOLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfdWludDggeXlyMltdID0KK3sKKyAgICAgICAwLCAgICAgMiwgICAgIDEsICAgICA1LCAgICAgMywgICAgIDMsICAgICAzLCAgICAgMywgICAgIDMsICAgICAzLAorICAgICAgIDIsICAgICAxLCAgICAgMSwgICAgIDMKK307CisKKy8qIFlZREVGQUNUW1NUQVRFLU5BTUVdIC0tIERlZmF1bHQgcmVkdWN0aW9uIG51bWJlciBpbiBzdGF0ZSBTVEFURS1OVU0uCisgICBQZXJmb3JtZWQgd2hlbiBZWVRBQkxFIGRvZXNuJ3Qgc3BlY2lmeSBzb21ldGhpbmcgZWxzZSB0byBkby4gIFplcm8KKyAgIG1lYW5zIHRoZSBkZWZhdWx0IGlzIGFuIGVycm9yLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfdWludDggeXlkZWZhY3RbXSA9Cit7CisgICAgICAgMCwgICAgIDAsICAgIDEyLCAgICAxMSwgICAgIDAsICAgICAwLCAgICAgMiwgICAgMTAsICAgICAwLCAgICAgMSwKKyAgICAgICAwLCAgICAgMCwgICAgIDAsICAgICAwLCAgICAgMCwgICAgIDAsICAgICAwLCAgICAxMywgICAgIDAsICAgICA0LAorICAgICAgIDUsICAgICA2LCAgICAgNywgICAgIDgsICAgICA5LCAgICAgMCwgICAgIDMKK307CisKKy8qIFlZREVGR09UT1tOVEVSTS1OVU1dLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfaW50OCB5eWRlZmdvdG9bXSA9Cit7CisgICAgICAtMSwgICAgIDUsICAgICA2Cit9OworCisvKiBZWVBBQ1RbU1RBVEUtTlVNXSAtLSBJbmRleCBpbiBZWVRBQkxFIG9mIHRoZSBwb3J0aW9uIGRlc2NyaWJpbmcKKyAgIFNUQVRFLU5VTS4gICovCisjZGVmaW5lIFlZUEFDVF9OSU5GIC0xMAorc3RhdGljIGNvbnN0IHl5dHlwZV9pbnQ4IHl5cGFjdFtdID0KK3sKKyAgICAgIC05LCAgICAtOSwgICAtMTAsICAgLTEwLCAgICAtOSwgICAgIDgsICAgIDM2LCAgIC0xMCwgICAgMTMsICAgLTEwLAorICAgICAgLTksICAgIC05LCAgICAtOSwgICAgLTksICAgIC05LCAgICAtOSwgICAgLTksICAgLTEwLCAgICAyNiwgICAgNDEsCisgICAgICA0NSwgICAgMTgsICAgIC0yLCAgICAxNCwgICAtMTAsICAgIC05LCAgICAzNgorfTsKKworLyogWVlQR09UT1tOVEVSTS1OVU1dLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfaW50OCB5eXBnb3RvW10gPQoreworICAgICAtMTAsICAgLTEwLCAgICAtMQorfTsKKworLyogWVlUQUJMRVtZWVBBQ1RbU1RBVEUtTlVNXV0uICBXaGF0IHRvIGRvIGluIHN0YXRlIFNUQVRFLU5VTS4gIElmCisgICBwb3NpdGl2ZSwgc2hpZnQgdGhhdCB0b2tlbi4gIElmIG5lZ2F0aXZlLCByZWR1Y2UgdGhlIHJ1bGUgd2hpY2gKKyAgIG51bWJlciBpcyB0aGUgb3Bwb3NpdGUuICBJZiBZWVRBQkxFX05JTkYsIHN5bnRheCBlcnJvci4gICovCisjZGVmaW5lIFlZVEFCTEVfTklORiAtMQorc3RhdGljIGNvbnN0IHl5dHlwZV91aW50OCB5eXRhYmxlW10gPQoreworICAgICAgIDcsICAgICAxLCAgICAgMiwgICAgIDgsICAgICAzLCAgICAgNCwgICAgMTUsICAgIDE2LCAgICAgOSwgICAgMTgsCisgICAgICAxOSwgICAgMjAsICAgIDIxLCAgICAyMiwgICAgMjMsICAgIDI0LCAgICAxMCwgICAgMTEsICAgIDEyLCAgICAxMywKKyAgICAgIDE0LCAgICAxNSwgICAgMTYsICAgIDE2LCAgICAyNiwgICAgMTQsICAgIDE1LCAgICAxNiwgICAgMTcsICAgIDEwLAorICAgICAgMTEsICAgIDEyLCAgICAxMywgICAgMTQsICAgIDE1LCAgICAxNiwgICAgIDAsICAgICAwLCAgICAyNSwgICAgMTAsCisgICAgICAxMSwgICAgMTIsICAgIDEzLCAgICAxNCwgICAgMTUsICAgIDE2LCAgICAxMiwgICAgMTMsICAgIDE0LCAgICAxNSwKKyAgICAgIDE2LCAgICAxMywgICAgMTQsICAgIDE1LCAgICAxNgorfTsKKworI2RlZmluZSB5eXBhY3RfdmFsdWVfaXNfZGVmYXVsdChZeXN0YXRlKSBcCisgICghISgoWXlzdGF0ZSkgPT0gKC0xMCkpKQorCisjZGVmaW5lIHl5dGFibGVfdmFsdWVfaXNfZXJyb3IoWXl0YWJsZV92YWx1ZSkgXAorICBZWUlEICgwKQorCitzdGF0aWMgY29uc3QgeXl0eXBlX2ludDggeXljaGVja1tdID0KK3sKKyAgICAgICAxLCAgICAxMCwgICAgMTEsICAgICA0LCAgICAxMywgICAgMTQsICAgICA4LCAgICAgOSwgICAgIDAsICAgIDEwLAorICAgICAgMTEsICAgIDEyLCAgICAxMywgICAgMTQsICAgIDE1LCAgICAxNiwgICAgIDMsICAgICA0LCAgICAgNSwgICAgIDYsCisgICAgICAgNywgICAgIDgsICAgICA5LCAgICAgOSwgICAgMjUsICAgICA3LCAgICAgOCwgICAgIDksICAgIDE1LCAgICAgMywKKyAgICAgICA0LCAgICAgNSwgICAgIDYsICAgICA3LCAgICAgOCwgICAgIDksICAgIC0xLCAgICAtMSwgICAgMTIsICAgICAzLAorICAgICAgIDQsICAgICA1LCAgICAgNiwgICAgIDcsICAgICA4LCAgICAgOSwgICAgIDUsICAgICA2LCAgICAgNywgICAgIDgsCisgICAgICAgOSwgICAgIDYsICAgICA3LCAgICAgOCwgICAgIDkKK307CisKKy8qIFlZU1RPU1tTVEFURS1OVU1dIC0tIFRoZSAoaW50ZXJuYWwgbnVtYmVyIG9mIHRoZSkgYWNjZXNzaW5nCisgICBzeW1ib2wgb2Ygc3RhdGUgU1RBVEUtTlVNLiAgKi8KK3N0YXRpYyBjb25zdCB5eXR5cGVfdWludDggeXlzdG9zW10gPQoreworICAgICAgIDAsICAgIDEwLCAgICAxMSwgICAgMTMsICAgIDE0LCAgICAxNywgICAgMTgsICAgIDE4LCAgICAxOCwgICAgIDAsCisgICAgICAgMywgICAgIDQsICAgICA1LCAgICAgNiwgICAgIDcsICAgICA4LCAgICAgOSwgICAgMTUsICAgIDE4LCAgICAxOCwKKyAgICAgIDE4LCAgICAxOCwgICAgMTgsICAgIDE4LCAg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NvbWUgdXNlcnMgZG8sIGFuZCB3ZSB3YW50IHRvIG1ha2UgaXQgZWFzeSBmb3IgdXNlcnMgdG8gcmVtb3ZlCisgICAgIFlZRkFJTCB1c2VzLCB3aGljaCB3aWxsIHByb2R1Y2Ugd2FybmluZ3MgZnJvbSBCaXNvbiAyLjUuICAqLworI2VuZGlmCisKKyNkZWZpbmUgWVlSRUNPVkVSSU5HKCkgICghIXl5ZXJyc3RhdHVzKQorCisjZGVmaW5lIFlZQkFDS1VQKFRva2VuLCBWYWx1ZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorZG8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgaWYgKHl5Y2hhciA9PSBZWUVNUFRZKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgeXljaGFyID0gKFRva2VuKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHl5bHZhbCA9IChWYWx1ZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICBZWVBPUFNUQUNLICh5eWxlbik7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgeXlzdGF0ZSA9ICp5eXNzcDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGdvdG8geXliYWNrdXA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBlbHNlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI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HsKKyAgICAgICAgICAvKiBTdGFydCBZWVggYXQgLVlZTiBpZiBuZWdhdGl2ZSB0byBhdm9pZCBuZWdhdGl2ZSBpbmRleGVzIGluCisgICAgICAgICAgICAgWVlDSEVDSy4gIEluIG90aGVyIHdvcmRzLCBza2lwIHRoZSBmaXJzdCAtWVlOIGFjdGlvbnMgZm9yCisgICAgICAgICAgICAgdGhpcyBzdGF0ZSBiZWNhdXNlIHRoZXkgYXJlIGRlZmF1bHQgYWN0aW9ucy4gICovCisgICAgICAgICAgaW50IHl5eGJlZ2luID0geXluIDwgMCA/IC15eW4gOiAwOworICAgICAgICAgIC8qIFN0YXkgd2l0aGluIGJvdW5kcyBvZiBib3RoIHl5Y2hlY2sgYW5kIHl5dG5hbWUuICAqLworICAgICAgICAgIGludCB5eWNoZWNrbGltID0gWVlMQVNUIC0geXluICsgMTsKKyAgICAgICAgICBpbnQgeXl4ZW5kID0geXljaGVja2xpbSA8IFlZTlRPS0VOUyA/IHl5Y2hlY2tsaW0gOiBZWU5UT0tFTlM7CisgICAgICAgICAgaW50IHl5eDsKKworICAgICAgICAgIGZvciAoeXl4ID0geXl4YmVnaW47IHl5eCA8IHl5eGVuZDsgKyt5eXgpCisgICAgICAgICAgICBpZiAoeXljaGVja1t5eXggKyB5eW5dID09IHl5eCAmJiB5eXggIT0gWVlURVJST1IKKyAgICAgICAgICAgICAgICAmJiAheXl0YWJsZV92YWx1ZV9pc19lcnJvciAoeXl0YWJsZVt5eXggKyB5eW5dKSkKKyAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh5eWNvdW50ID09IFlZRVJST1JfVkVSQk9TRV9BUkdTX01BWElNVU0pCisgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHl5Y291bnQgPSAxOworICAgICAgICAgICAgICAgICAgICB5eXNpemUgPSB5eXNpemUwOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB5eWFyZ1t5eWNvdW50KytdID0geXl0bmFtZVt5eXhdOworICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIFlZU0laRV9UIHl5c2l6ZTEgPSB5eXNpemUgKyB5eXRuYW1lcnIgKFlZX05VTEwsIHl5dG5hbWVbeXl4XSk7CisgICAgICAgICAgICAgICAgICBpZiAoISAoeXlzaXplIDw9IHl5c2l6ZTEKKyAgICAgICAgICAgICAgICAgICAgICAgICAmJiB5eXNpemUxIDw9IFlZU1RBQ0tfQUxMT0NfTUFYSU1VTSkpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiAyOworICAgICAgICAgICAgICAgICAgeXlzaXplID0geXlzaXplMTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICBzd2l0Y2ggKHl5Y291bnQpCisgICAgeworIyBkZWZpbmUgWVlDQVNFXyhOLCBTKSAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICBjYXNlIE46ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgeXlmb3JtYXQgPSBTOyAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgYnJlYWsKKyAgICAgIFlZQ0FTRV8oMCwgWVlfKCJzeW50YXggZXJyb3IiKSk7CisgICAgICBZWUNBU0VfKDEsIFlZXygic3ludGF4IGVycm9yLCB1bmV4cGVjdGVkICVzIikpOworICAgICAgWVlDQVNFXygyLCBZWV8oInN5bnRheCBlcnJvciwgdW5leHBlY3RlZCAlcywgZXhwZWN0aW5nICVzIikpOworICAgICAgWVlDQVNFXygzLCBZWV8oInN5bnRheCBlcnJvciwgdW5leHBlY3RlZCAlcywgZXhwZWN0aW5nICVzIG9yICVzIikpOworICAgICAgWVlDQVNFXyg0LCBZWV8oInN5bnRheCBlcnJvciwgdW5leHBlY3RlZCAlcywgZXhwZWN0aW5nICVzIG9yICVzIG9yICVzIikpOworICAgICAgWVlDQVNFXyg1LCBZW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hbCBZWV9JTklUSUFMX1ZBTFVFKHl5dmFsX2RlZmF1bHQpOworCisgICAgLyogTnVtYmVyIG9mIHN5bnRheCBlcnJvcnMgc28gZmFyLiAgKi8KKyAgICBpbnQgeXluZXJyczsKKworICAgIGludCB5eXN0YXRlOworICAgIC8qIE51bWJlciBvZiB0b2tlbnMgdG8gc2hpZnQgYmVmb3JlIGVycm9yIG1lc3NhZ2VzIGVuYWJsZWQuICAqLworICAgIGludCB5eWVycnN0YXR1czsKKworICAgIC8qIFRoZSBzdGFja3MgYW5kIHRoZWlyIHRvb2xzOgorICAgICAgIGB5eXNzJzogcmVsYXRlZCB0byBzdGF0ZXMuCisgICAgICAgYHl5dnMnOiByZWxhdGVkIHRvIHNlbWFudGljIHZhbHVlcy4KKworICAgICAgIFJlZmVyIHRvIHRoZSBzdGFja3MgdGhyb3VnaCBzZXBhcmF0ZSBwb2ludGVycywgdG8gYWxsb3cgeXlvdmVyZmxvdworICAgICAgIHRvIHJlYWxsb2NhdGUgdGhlbSBlbHNld2hlcmUuICAqLworCisgICAgLyogVGhlIHN0YXRlIHN0YWNrLiAgKi8KKyAgICB5eXR5cGVfaW50MTYgeXlzc2FbWVlJTklUREVQVEhdOworICAgIHl5dHlwZV9pbnQxNiAqeXlzczsKKyAgICB5eXR5cGVfaW50MTYgKnl5c3NwOworCisgICAgLyogVGhlIHNlbWFudGljIHZhbHVlIHN0YWNrLiAgKi8KKyAgICBZWVNUWVBFIHl5dnNhW1lZSU5JVERFUFRIXTsKKyAgICBZWVNUWVBFICp5eXZzOworICAgIFlZU1RZUEUgKnl5dnNwOworCisgICAgWVlTSVpFX1QgeXlzdGFja3NpemU7CisKKyAgaW50IHl5bjsKKyAgaW50IHl5cmVzdWx0OworICAvKiBMb29rYWhlYWQgdG9rZW4gYXMgYW4gaW50ZXJuYWwgKHRyYW5zbGF0ZWQpIHRva2VuIG51bWJlci4gICovCisgIGludCB5eXRva2VuID0gMDsKKyAgLyogVGhlIHZhcmlhYmxlcy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sKKworICBjYXNlIDM6CisvKiBMaW5lIDE3OTIgb2YgeWFjYy5jICAqLworI2xpbmUgMTYxICJwbHVyYWwueSIKKyAgICB7CisJICAgICh5eXZhbC5leHApID0gbmV3X2V4cF8zIChxbW9wLCAoeXl2c3BbKDEpIC0gKDUpXS5leHApLCAoeXl2c3BbKDMpIC0gKDUpXS5leHApLCAoeXl2c3BbKDUpIC0gKDUpXS5leHApKTsKKwkgIH0KKyAgICBicmVhazsKKworICBjYXNlIDQ6CisvKiBMaW5lIDE3OTIgb2YgeWFjYy5jICAqLworI2xpbmUgMTY1ICJwbHVyYWwueSIKKyAgICB7CisJICAgICh5eXZhbC5leHApID0gbmV3X2V4cF8yIChsb3IsICh5eXZzcFsoMSkgLSAoMyldLmV4cCksICh5eXZzcFsoMykgLSAoMyldLmV4cCkpOworCSAgfQorICAgIGJyZWFrOworCisgIGNhc2UgNToKKy8qIExpbmUgMTc5MiBvZiB5YWNjLmMgICovCisjbGluZSAxNjkgInBsdXJhbC55IgorICAgIHsKKwkgICAgKHl5dmFsLmV4cCkgPSBuZXdfZXhwXzIgKGxhbmQsICh5eXZzcFsoMSkgLSAoMyldLmV4cCksICh5eXZzcFsoMykgLSAoMyldLmV4cCkpOworCSAgfQorICAgIGJyZWFrOworCisgIGNhc2UgNjoKKy8qIExpbmUgMTc5MiBvZiB5YWNjLmMgICovCisjbGluZSAxNzMgInBsdXJhbC55IgorICAgIHsKKwkgICAgKHl5dmFsLmV4cCkgPSBuZXdfZXhwXzIgKCh5eXZzcFsoMikgLSAoMyldLm9wKSwgKHl5dnNwWygxKSAtICgzKV0uZXhwKSwgKHl5dnNwWygzKSAtICgzKV0uZXhwKSk7CisJICB9CisgICAgYnJlYWs7CisKKyAgY2FzZSA3OgorLyogTGluZSAxNzkyIG9mIHlhY2MuYyAgKi8KKyNsaW5lIDE3NyAicGx1cmFsLnkiCisgICAgeworCSAgICAoeXl2YWwuZXhwKSA9IG5ld19leHBfMiAoKHl5dnNwWygyKSAtICgzKV0ub3ApLCAoeXl2c3BbKDEpIC0gKDMpXS5leHApLCAoeXl2c3BbKDMpIC0gKDMpXS5leHApKTsKKwkgIH0KKyAgICBicmVhazsKKworICBjYXNlIDg6CisvKiBMaW5lIDE3OTIgb2YgeWFjYy5jICAqLworI2xpbmUgMTgxICJwbHVyYWwueSIKKyAgICB7CisJICAgICh5eXZhbC5leHApID0gbmV3X2V4cF8yICgoeXl2c3BbKDIpIC0gKDMpXS5vcCksICh5eXZzcFsoMSkgLSAoMyldLmV4cCksICh5eXZzcFsoMykgLSAoMyldLmV4cCkpOworCSAgfQorICAgIGJyZWFrOworCisgIGNhc2UgOToKKy8qIExpbmUgMTc5MiBvZiB5YWNjLmMgICovCisjbGluZSAxODUgInBsdXJhbC55IgorICAgIHsKKwkgICAgKHl5dmFsLmV4cCkgPSBuZXdfZXhwXzIgKCh5eXZzcFsoMikgLSAoMyldLm9wKSwgKHl5dnNwWygxKSAtICgzKV0uZXhwKSwgKHl5dnNwWygzKSAtICgzKV0uZXhwKSk7CisJICB9CisgICAgYnJlYWs7CisKKyAgY2FzZSAxMDoKKy8qIExpbmUgMTc5MiBvZiB5YWNjLmMgICovCisjbGluZSAxODkgInBsdXJhbC55IgorICAgIHsKKwkgICAgKHl5dmFsLmV4cCkgPSBuZXdfZXhwXzEgKGxub3QsICh5eXZzcFsoMikgLSAoMildLmV4cCkpOworCSAgfQorICAgIGJyZWFrOworCisgIGNhc2UgMTE6CisvKiBMaW5lIDE3OTIgb2YgeWFjYy5jICAqLworI2xpbmUgMTkzICJwbHVyYWwueSIKKyAgICB7CisJICAgICh5eXZhbC5leHApID0gbmV3X2V4cF8wICh2YXIpOworCSAgfQorICAgIGJyZWFrOworCisgIGNhc2UgMTI6CisvKiBMaW5lIDE3OTIgb2YgeWFjYy5jICAqLworI2xpbmUgMTk3ICJwbHVyYWwueSIKKyAgICB7CisJICAgIGlmICgoKHl5dmFsLmV4cCkgPSBuZXdfZXhwXzAgKG51bSkpICE9IE5VTE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zZzsKKyAgICAgICAgZWxzZSBpZiAoeXlzeW50YXhfZXJyb3Jfc3RhdHVzID09IDEpCisgICAgICAgICAgeworICAgICAgICAgICAgaWYgKHl5bXNnICE9IHl5bXNnYnVmKQorICAgICAgICAgICAgICBZWVNUQUNLX0ZSRUUgKHl5bXNnKTsKKyAgICAgICAgICAgIHl5bXNnID0gKGNoYXIgKikgWVlTVEFDS19BTExPQyAoeXltc2dfYWxsb2MpOworICAgICAgICAgICAgaWYgKCF5eW1zZykKKyAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHl5bXNnID0geXltc2didWY7CisgICAgICAgICAgICAgICAgeXltc2dfYWxsb2MgPSBzaXplb2YgeXltc2didWY7CisgICAgICAgICAgICAgICAgeXlzeW50YXhfZXJyb3Jfc3RhdHVzID0gMjsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgeXlzeW50YXhfZXJyb3Jfc3RhdHVzID0gWVlTWU5UQVhfRVJST1I7CisgICAgICAgICAgICAgICAgeXltc2dwID0geXltc2c7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgIHl5ZXJyb3IgKGFyZywgeXltc2dwKTsKKyAgICAgICAgaWYgKHl5c3ludGF4X2Vycm9yX3N0YXR1cyA9PSAyKQorICAgICAgICAgIGdvdG8geXlleGhhdXN0ZWRsYWI7CisgICAgICB9CisjIHVuZGVmIFlZU1lOVEFYX0VSUk9SCisjZW5kaWYKKyAgICB9CisKKworCisgIGlmICh5eWVycnN0YXR1cyA9PSAzKQorICAgIHsKKyAgICAgIC8qIElmIGp1c3QgdHJpZWQgYW5kIGZhaWxlZCB0byByZXVzZSBsb29rYWhlYWQgdG9rZW4gYWZ0ZXIgYW4KKwkgZXJyb3IsIGRpc2NhcmQgaXQuICAqLworCisgICAgICBpZiAoeXljaGFyIDw9IFlZRU9GKQorCXsKKwkgIC8qIFJldHVybiBmYWlsdXJlIGlm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7CisgICAgICBpZiAoZXhwWzBdID09ICdcMCcpCisJeworCSAgYXJnLT5jcCA9IGV4cDsKKwkgIHJldHVybiBZWUVPRjsKKwl9CisKKyAgICAgIGlmIChleHBbMF0gIT0gJyAnICYmIGV4cFswXSAhPSAnXHQnKQorCWJyZWFrOworCisgICAgICArK2V4cDsKKyAgICB9CisKKyAgcmVzdWx0ID0gKmV4cCsrOworICBzd2l0Y2ggKHJlc3VsdCkKKyAgICB7CisgICAgY2FzZSAnMCc6IGNhc2UgJzEnOiBjYXNlICcyJzogY2FzZSAnMyc6IGNhc2UgJzQnOgorICAgIGNhc2UgJzUnOiBjYXNlICc2JzogY2FzZSAnNyc6IGNhc2UgJzgnOiBjYXNlICc5JzoKKyAgICAgIHsKKwl1bnNpZ25lZCBsb25nIGludCBuID0gcmVzdWx0IC0gJzAnOworCXdoaWxlIChleHBbMF0gPj0gJzAnICYmIGV4cFswXSA8PSAnOScpCisJICB7CisJICAgIG4gKj0gMTA7CisJICAgIG4gKz0gZXhwWzBdIC0gJzAnOworCSAgICArK2V4cDsKKwkgIH0KKwlsdmFsLT5udW0gPSBuOworCXJlc3VsdCA9IE5VTUJFUjsKKyAgICAgIH0KKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAnPSc6CisgICAgICBpZiAoZXhwWzBdID09ICc9JykKKwl7CisJICArK2V4cDsKKwkgIGx2YWwtPm9wID0gZXF1YWw7CisJICByZXN1bHQgPSBFUVVPUDI7CisJfQorICAgICAgZWxzZQorCXJlc3VsdCA9IFlZRVJSQ09ERTsKKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAnISc6CisgICAgICBpZiAoZXhwWzBdID09ICc9JykKKwl7CisJICArK2V4cDsKKwkgIGx2YWwtPm9wID0gbm90X2VxdWFsOworCSAgcmVzdWx0ID0gRVFVT1AyOworCX0KKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAnJic6CisgICAgY2FzZSAnfCc6CisgICAgICBpZiAoZXhwWzBdID09IHJlc3VsdCkKKwkrK2V4cDsKKyAgICAgIGVsc2UKKwlyZXN1bHQgPSBZWUVSUkNPREU7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJzwnOgorICAgICAgaWYgKGV4cFswXSA9PSAnPScpCisJeworCSAgKytleHA7CisJICBsdmFsLT5vcCA9IGxlc3Nfb3JfZXF1YWw7CisJfQorICAgICAgZWxzZQorCWx2YWwtPm9wID0gbGVzc190aGFuOworICAgICAgcmVzdWx0ID0gQ01QT1AyOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICc+JzoKKyAgICAgIGlmIChleHBbMF0gPT0gJz0nKQorCXsKKwkgICsrZXhwOworCSAgbHZhbC0+b3AgPSBncmVhdGVyX29yX2VxdWFsOworCX0KKyAgICAgIGVsc2UKKwlsdmFsLT5vcCA9IGdyZWF0ZXJfdGhhbjsKKyAgICAgIHJlc3VsdCA9IENNUE9QMjsKKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAnKic6CisgICAgICBsdmFsLT5vcCA9IG11bHQ7CisgICAgICByZXN1bHQgPSBNVUxPUDI7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJy8nOgorICAgICAgbHZhbC0+b3AgPSBkaXZpZGU7CisgICAgICByZXN1bHQgPSBNVUxPUDI7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJyUnOgorICAgICAgbHZhbC0+b3AgPSBtb2R1bGU7CisgICAgICByZXN1bHQgPSBNVUxPUDI7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJysnOgorICAgICAgbHZhbC0+b3AgPSBwbHVzOworICAgICAgcmVzdWx0ID0gQURET1AyOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICctJzoKKyAgICAgIGx2YWwtPm9wID0gbWludXM7CisgICAgICByZXN1bHQgPSBBRERPUDI7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJ24nOgorICAgIGNhc2UgJz8nOgorICAgIGNhc2UgJzonOgorICAgIGNhc2UgJygnOgorICAgIGNhc2UgJyknOgorICAgICAgLyogT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VIKKyV0eXBlIDxleHA+IGV4cAorCislJQorCitzdGFydDoJICBleHAKKwkgIHsKKwkgICAgaWYgKCQxID09IE5VTEwpCisJICAgICAgWVlBQk9SVDsKKwkgICAgYXJnLT5yZXMgPSAkMTsKKwkgIH0KKwk7CisKK2V4cDoJICBleHAgJz8nIGV4cCAnOicgZXhwCisJICB7CisJICAgICQkID0gbmV3X2V4cF8zIChxbW9wLCAkMSwgJDMsICQ1KTsKKwkgIH0KKwl8IGV4cCAnfCcgZXhwCisJICB7CisJICAgICQkID0gbmV3X2V4cF8yIChsb3IsICQxLCAkMyk7CisJICB9CisJfCBleHAgJyYnIGV4cAorCSAgeworCSAgICAkJCA9IG5ld19leHBfMiAobGFuZCwgJDEsICQzKTsKKwkgIH0KKwl8IGV4cCBFUVVPUDIgZXhwCisJICB7CisJICAgICQkID0gbmV3X2V4cF8yICgkMiwgJDEsICQzKTsKKwkgIH0KKwl8IGV4cCBDTVBPUDIgZXhwCisJICB7CisJICAgICQkID0gbmV3X2V4cF8yICgkMiwgJDEsICQzKTsKKwkgIH0KKwl8IGV4cCBBRERPUDIgZXhwCisJICB7CisJICAgICQkID0gbmV3X2V4cF8yICgkMiwgJDEsICQzKTsKKwkgIH0KKwl8IGV4cCBNVUxPUDIgZXhwCisJICB7CisJICAgICQkID0gbmV3X2V4cF8yICgkMiwgJDEsICQzKTsKKwkgIH0KKwl8ICchJyBleHAKKwkgIHsKKwkgICAgJCQgPSBuZXdfZXhwXzEgKGxub3QsICQyKTsKKwkgIH0KKwl8ICduJworCSAgeworCSAgICAkJCA9IG5ld19leHBfMCAodmFyKTsKKwkgIH0KKwl8IE5VTUJFUgorCSAgeworCSAgICBpZiAoKCQkID0gbmV3X2V4cF8wIChudW0pKSAhPSBOVUxMKQorCSAgICAgICQkLT52YWwubnVtID0gJDE7CisJICB9CisJfCAnKCcgZXhwICcpJworCSAgeworCSAgICAkJCA9ICQyOworCSAgfQorCTsKKworJSUKKwordm9pZAoraW50ZXJuYWxfZ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jYXNlICc1JzogY2FzZSAnNic6IGNhc2UgJzcnOiBjYXNlICc4JzogY2FzZSAnOSc6CisgICAgICB7CisJdW5zaWduZWQgbG9uZyBpbnQgbiA9IHJlc3VsdCAtICcwJzsKKwl3aGlsZSAoZXhwWzBdID49ICcwJyAmJiBleHBbMF0gPD0gJzknKQorCSAgeworCSAgICBuICo9IDEwOworCSAgICBuICs9IGV4cFswXSAtICcwJzsKKwkgICAgKytleHA7CisJICB9CisJbHZhbC0+bnVtID0gbjsKKwlyZXN1bHQgPSBOVU1CRVI7CisgICAgICB9CisgICAgICBicmVhazsKKworICAgIGNhc2UgJz0nOgorICAgICAgaWYgKGV4cFswXSA9PSAnPScpCisJeworCSAgKytleHA7CisJICBsdmFsLT5vcCA9IGVxdWFsOworCSAgcmVzdWx0ID0gRVFVT1AyOworCX0KKyAgICAgIGVsc2UKKwlyZXN1bHQgPSBZWUVSUkNPREU7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJyEnOgorICAgICAgaWYgKGV4cFswXSA9PSAnPScpCisJeworCSAgKytleHA7CisJICBsdmFsLT5vcCA9IG5vdF9lcXVhbDsKKwkgIHJlc3VsdCA9IEVRVU9QMjsKKwl9CisgICAgICBicmVhazsKKworICAgIGNhc2UgJyYnOgorICAgIGNhc2UgJ3wnOgorICAgICAgaWYgKGV4cFswXSA9PSByZXN1bHQpCisJKytleHA7CisgICAgICBlbHNlCisJcmVzdWx0ID0gWVlFUlJDT0RFOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICc8JzoKKyAgICAgIGlmIChleHBbMF0gPT0gJz0nKQorCXsKKwkgICsrZXhwOworCSAgbHZhbC0+b3AgPSBsZXNzX29yX2VxdWFsOworCX0KKyAgICAgIGVsc2UKKwlsdmFsLT5vcCA9IGxlc3NfdGhhbjsKKyAgICAgIHJlc3VsdCA9IENNUE9QMjsKKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAnPic6CisgICAgICBpZiAoZXhwWzBdID09ICc9JykKKwl7CisJICArK2V4cDsKKwkgIGx2YWwtPm9wID0gZ3JlYXRlcl9vcl9lcXVhbDsKKwl9CisgICAgICBlbHNlCisJbHZhbC0+b3AgPSBncmVhdGVyX3RoYW47CisgICAgICByZXN1bHQgPSBDTVBPUDI7CisgICAgICBicmVhazsKKworICAgIGNhc2UgJyonOgorICAgICAgbHZhbC0+b3AgPSBtdWx0OworICAgICAgcmVzdWx0ID0gTVVMT1AyOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICcvJzoKKyAgICAgIGx2YWwtPm9wID0gZGl2aWRlOworICAgICAgcmVzdWx0ID0gTVVMT1AyOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICclJzoKKyAgICAgIGx2YWwtPm9wID0gbW9kdWxlOworICAgICAgcmVzdWx0ID0gTVVMT1AyOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICcrJzoKKyAgICAgIGx2YWwtPm9wID0gcGx1czsKKyAgICAgIHJlc3VsdCA9IEFERE9QMjsKKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAnLSc6CisgICAgICBsdmFsLT5vcCA9IG1pbnVzOworICAgICAgcmVzdWx0ID0gQURET1AyOworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICduJzoKKyAgICBjYXNlICc/JzoKKyAgICBjYXNlICc6JzoKKyAgICBjYXNlICcoJzoKKyAgICBjYXNlICcpJzoKKyAgICAgIC8qIE5vdGhpbmcsIGp1c3QgcmV0dXJuIHRoZSBjaGFyYWN0ZXIuICAqLworICAgICAgYnJlYWs7CisKKyAgICBjYXNlICc7JzoKKyAgICBjYXNlICdcbic6CisgICAgY2FzZSAnXDAnOgorICAgICAgLyogQmUgc2FmZSBhbmQgbGV0IHRoZSB1c2VyIGNhbGwgdGhpcyBmdW5jdGlvbiBhZ2Fpbi4gICovCisgICAgICAtLWV4cDsKKyAgICAgIHJlc3VsdCA9IFlZRU9GOworICAgICAgYnJlYWs7CisKKyAgICBkZWZhdWx0OgorICAgICAgcmVzdWx0ID0gWV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udCBkZWZhdWx0IG1lc3NhZ2UgY2F0YWxvZyB0byBET01BSU5OQU1FLgorICAgSWYgRE9NQUlOTkFNRSBpcyBudWxsLCByZXR1cm4gdGhlIGN1cnJlbnQgZGVmYXVsdC4KKyAgIElmIERPTUFJTk5BTUUgaXMgIiIsIHJlc2V0IHRvIHRoZSBkZWZhdWx0IG9mICJtZXNzYWdlcyIuICAqLworY2hhciAqCitURVhURE9NQUlOIChjb25zdCBjaGFyICpkb21haW5uYW1lKQoreworICBjaGFyICpuZXdfZG9tYWluOworICBjaGFyICpvbGRfZG9tYWluOworCisgIC8qIEEgTlVMTCBwb2ludGVyIHJlcXVlc3RzIHRoZSBjdXJyZW50IHNldHRpbmcuICAqLworICBpZiAoZG9tYWlubmFtZSA9PSBOVUxMKQorICAgIHJldHVybiAoY2hhciAqKSBfbmxfY3VycmVudF9kZWZhdWx0X2RvbWFpbjsKKworICBnbF9yd2xvY2tfd3Jsb2NrIChfbmxfc3RhdGVfbG9jayk7CisKKyAgb2xkX2RvbWFpbiA9IChjaGFyICopIF9ubF9jdXJyZW50X2RlZmF1bHRfZG9tYWluOworCisgIC8qIElmIGRvbWFpbiBuYW1lIGlzIHRoZSBudWxsIHN0cmluZyBzZXQgdG8gZGVmYXVsdCBkb21haW4gIm1lc3NhZ2VzIi4gICovCisgIGlmIChkb21haW5uYW1lWzBdID09ICdcMCcKKyAgICAgIHx8IHN0cmNtcCAoZG9tYWlubmFtZSwgX25sX2RlZmF1bHRfZGVmYXVsdF9kb21haW4pID09IDApCisgICAgeworICAgICAgX25sX2N1cnJlbnRfZGVmYXVsdF9kb21haW4gPSBfbmxfZGVmYXVsdF9kZWZhdWx0X2RvbWFpbjsKKyAgICAgIG5ld19kb21haW4gPSAoY2hhciAqKSBfbmxfY3VycmVudF9kZWZhdWx0X2RvbWFpbjsKKyAgICB9CisgIGVsc2UgaWYgKHN0cmNtcCAoZG9tYWlubmFtZSwgb2xkX2RvbWFpbikgPT0gMCkKKyAgICAvKiBU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reworI2RlZmluZSBJTlBVVChTdHIpIHsgU3RyLAorI2RlZmluZSBPVVRQVVQoU3RyKSBTdHIgfSwKKyNpbmNsdWRlIFRFU1RTVFJTX0gKK307CisKK2NvbnN0IGNoYXIgKmNhdG5hbWVbXSA9Cit7CisgIFtMQ19NRVNTQUdFU10gPSAiTENfTUVTU0FHRVMiLAorICBbTENfVElNRV0gPSAiTENfVElNRSIsCisgIFtMQ19OVU1FUklDXSA9ICJMQ19OVU1FUklDIgorfTsKKworCitzdGF0aWMgaW50IHBvc2l0aXZlX2dldHRleHRfdGVzdCAodm9pZCk7CitzdGF0aWMgaW50IG5lZ2F0aXZlX2dldHRleHRfdGVzdCAodm9pZCk7CitzdGF0aWMgaW50IHBvc2l0aXZlX2RnZXR0ZXh0X3Rlc3QgKGNvbnN0IGNoYXIgKmRvbWFpbik7CitzdGF0aWMgaW50IHBvc2l0aXZlX2RjZ2V0dGV4dF90ZXN0IChjb25zdCBjaGFyICpkb21haW4sIGludCBjYXRlZ29yeSk7CitzdGF0aWMgaW50IG5lZ2F0aXZlX2RjZ2V0dGV4dF90ZXN0IChjb25zdCBjaGFyICpkb21haW4sIGludCBjYXRlZ29yeSk7CisKKworI2RlZmluZSBjaGVja19zZXRsb2NhbGUoY2F0LCBuYW1lKSBkbyB7CQkJCQkgICAgICBcCisgICAgaWYgKHNldGxvY2FsZSAoY2F0LCBuYW1lKSA9PSBOVUxMKQkJCQkJICAgICAgXAorICAgICAgewkJCQkJCQkJCSAgICAgIFwKKwlwcmludGYgKCIlczoldTogc2V0bG9jYWxlICglcywgXCIlc1wiKTogJW1cbiIsCQkJICAgICAgXAorCQlfX0ZJTEVfXywgX19MSU5FX18sICNjYXQsIG5hbWUpOwkJCSAgICAgIFwKKwlyZXN1bHQgPSAxOwkJCQkJCQkgICAgICBcCisgICAgICB9CQkJCQkJCQkJICAgICAgXAorICB9IHdoaWxlICgwKQorCitpbnQKK21haW4gKGludCBhcmdjLCBjaGFyICphcmd2W10pCit7Cisg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c1xuIiwgcyk7CisgICAgICByZXN1bHQgPSAxOworICAgIH0KKyAgc2V0dG8gKDIpOworCisgIHJldHVybiBOVUxMOworfQorCit2b2lkICoKK3RocmVhZDJfZXhlY3V0aW9uICh2b2lkICphcmcpCit7CisgIGNoYXIgKnM7CisKKyAgd2FpdGZvciAoMik7CisgIHVzZWxvY2FsZSAobmV3bG9jYWxlIChMQ19BTExfTUFTSywgImZyX0ZSLklTTy04ODU5LTEiLCBOVUxMKSk7CisgIHNldHRvICgxKTsKKworICB3YWl0Zm9yICgyKTsKKyAgcyA9IGdldHRleHQgKCJiZWF1dHkiKTsKKyAgcHV0cyAocyk7CisgIGlmIChzdHJjbXAgKHMsICJiZWF1dFwzNTEiKSkKKyAgICB7CisgICAgICBmcHJpbnRmIChzdGRlcnIsICJ0aHJlYWQgMiBjYWxsIDEgcmV0dXJuZWQ6ICVzXG4iLCBzKTsKKyAgICAgIHJlc3VsdCA9IDE7CisgICAgfQorICBzZXR0byAoMSk7CisKKyAgd2FpdGZvciAoMik7CisgIHMgPSBnZXR0ZXh0ICgiYmVhdXR5Iik7CisgIHB1dHMgKHMpOworICBpZiAoc3RyY21wIChzLCAiYmVhdXRcMzUxIikpCisgICAgeworICAgICAgZnByaW50ZiAoc3RkZXJyLCAidGhyZWFkIDIgY2FsbCAyIHJldHVybmVkOiAlc1xuIiwgcyk7CisgICAgICByZXN1bHQgPSAxOworICAgIH0KKyAgc2V0dG8gKDEpOworCisgIHJldHVybiBOVUxMOworfQorCitpbnQKK21haW4gKHZvaWQpCit7CisgIHB0aHJlYWRfdCB0aHJlYWQxOworICBwdGhyZWFkX3QgdGhyZWFkMjsKKworICB1bnNldGVudiAoIkxBTkdVQUdFIik7CisgIHVuc2V0ZW52ICgiT1VUUFVUX0NIQVJTRVQiKTsKKyAgdGV4dGRvbWFpbiAoIm11bHRpdGhyZWFkIik7CisgIGJpbmR0ZXh0ZG9tYWluICgibXVsdGl0aHJlYWQiLCBPQkpQRlggImRvbWFpbmR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c2V0dG8gKDIpOworCisgIHJldHVybiBOVUxMOworfQorCit2b2lkICoKK3RocmVhZDJfZXhlY3V0aW9uICh2b2lkICphcmcpCit7CisgIGNoYXIgKnM7CisKKyAgd2FpdGZvciAoMik7CisgIHVzZWxvY2FsZSAobmV3bG9jYWxlIChMQ19BTExfTUFTSywgImRlX0RFLlVURi04IiwgTlVMTCkpOworICBzZXR0byAoMSk7CisKKyAgLyogSGVyZSB3ZSBleHBlY3Qgb3V0cHV0IGluIFVURi04LiAgKi8KKworICB3YWl0Zm9yICgyKTsKKyAgcyA9IGdldHRleHQgKCJjaGVlc2UiKTsKKyAgcHV0cyAocyk7CisgIGlmIChzdHJjbXAgKHMsICJLXDMwM1wyNDRzZSIpKQorICAgIHsKKyAgICAgIGZwcmludGYgKHN0ZGVyciwgInRocmVhZCAyIGNhbGwgMSByZXR1cm5lZDogJXNcbiIsIHMpOworICAgICAgcmVzdWx0ID0gMTsKKyAgICB9CisgIHNldHRvICgxKTsKKworICB3YWl0Zm9yICgyKTsKKyAgcyA9IGdldHRleHQgKCJjaGVlc2UiKTsKKyAgcHV0cyAocyk7CisgIGlmIChzdHJjbXAgKHMsICJLXDMwM1wyNDRzZSIpKQorICAgIHsKKyAgICAgIGZwcmludGYgKHN0ZGVyciwgInRocmVhZCAyIGNhbGwgMiByZXR1cm5lZDogJXNcbiIsIHMpOworICAgICAgcmVzdWx0ID0gMTsKKyAgICB9CisgIHNldHRvICgxKTsKKworICByZXR1cm4gTlVMTDsKK30KKworaW50CittYWluICh2b2lkKQoreworICBwdGhyZWFkX3QgdGhyZWFkMTsKKyAgcHRocmVhZF90IHRocmVhZDI7CisKKyAgdW5zZXRlbnYgKCJMQU5HVUFHRSIpOworICB1bnNldGVudiAoIk9VVFBVVF9DSEFSU0VUIik7CisgIHRleHRkb21haW4gKCJjb2Rlc2V0Iik7CisgIGJpbmR0ZXh0ZG9tYWluICgiY29kZXNldCIsIE9CSlBGWCAiZG9tYWluZGlyIik7CisgIHJlc3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