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kKKyAgICAgICAgcmV0dXJuOworICAgIHAgKz0gNDsKKyAgICB3aGlsZSAocCA8IHBfZW5kKSB7CisgICAgICAgIHRhZyA9IHBbMF07CisgICAgICAgIGlmICh0YWcgPT0gUkZDMTUzM19QQUQpIHsKKyAgICAgICAgICAgIHArKzsgCisgICAgICAgIH0gZWxzZSBpZiAodGFnID09IFJGQzE1MzNfRU5EKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHArKzsKKyAgICAgICAgICAgIGlmIChwID49IHBfZW5kKQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgbGVuID0gKnArKzsKKyAgICAgICAgICAgIGRwcmludGYoImRoY3A6IHRhZz0weCUwMnggbGVuPSVkXG4iLCB0YWcsIGxlbik7CisKKyAgICAgICAgICAgIHN3aXRjaCh0YWcpIHsKKyAgICAgICAgICAgIGNhc2UgUkZDMjEzMl9NU0dfVFlQRToKKyAgICAgICAgICAgICAgICBpZiAobGVuID49IDEpCisgICAgICAgICAgICAgICAgICAgICpwbXNnX3R5cGUgPSBwWzBdOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHAgKz0gbGVuOworICAgICAgICB9CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBib290cF9yZXBseShzdHJ1Y3QgYm9vdHBfdCAqYnApCit7CisgICAgQk9PVFBDbGllbnQgKmJjOworICAgIHN0cnVjdCBtYnVmICptOworICAgIHN0cnVjdCBib290cF90ICpyYnA7CisgICAgc3RydWN0IHNvY2thZGRyX2luIHNhZGRyLCBkYWRkcjsKKyAgICBzdHJ1Y3QgaW5fYWRkciBkbnNfYWRkcjsKKyAgICBpbnQgZGhjcF9tc2dfdHlwZSwgdmFsOworICAgIHVpbnQ4X3QgKnE7CisKKyAgICAvKiBleHRyYWN0IGV4Y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F9BTElBUyk7CisgICAgc2FkZHIuc2luX3BvcnQgPSBodG9ucyhCT09UUF9TRVJWRVIpOworCisgICAgZGFkZHIuc2luX3BvcnQgPSBodG9ucyhCT09UUF9DTElFTlQpOworCisgICAgcmJwLT5icF9vcCA9IEJPT1RQX1JFUExZOworICAgIHJicC0+YnBfeGlkID0gYnAtPmJwX3hpZDsKKyAgICByYnAtPmJwX2h0eXBlID0gMTsKKyAgICByYnAtPmJwX2hsZW4gPSA2OworICAgIG1lbWNweShyYnAtPmJwX2h3YWRkciwgYnAtPmJwX2h3YWRkciwgNik7CisKKyAgICByYnAtPmJwX3lpYWRkciA9IGRhZGRyLnNpbl9hZGRyOyAvKiBJUCBhZGRyZXNzICovCisKKyAgICBxID0gcmJwLT5icF92ZW5kOworICAgIG1lbWNweShxLCByZmMxNTMzX2Nvb2tpZSwgNCk7CisgICAgcSArPSA0OworCisgICAgaWYgKGRoY3BfbXNnX3R5cGUgPT0gREhDUERJU0NPVkVSKSB7CisgICAgICAgICpxKysgPSBSRkMyMTMyX01TR19UWVBFOworICAgICAgICAqcSsrID0gMTsKKyAgICAgICAgKnErKyA9IERIQ1BPRkZFUjsKKyAgICB9IGVsc2UgaWYgKGRoY3BfbXNnX3R5cGUgPT0gREhDUFJFUVVFU1QpIHsKKyAgICAgICAgKnErKyA9IFJGQzIxMzJfTVNHX1RZUEU7CisgICAgICAgICpxKysgPSAxOworICAgICAgICAqcSsrID0gREhDUEFDSzsKKyAgICB9CisgICAgICAgIAorICAgIGlmIChkaGNwX21zZ190eXBlID09IERIQ1BESVNDT1ZFUiB8fAorICAgICAgICBkaGNwX21zZ190eXBlID09IERIQ1BSRVFVRVNUKSB7CisgICAgICAgICpxKysgPSBSRkMyMTMyX1NSVl9JRDsKKyAgICAgICAgKnErKyA9IDQ7CisgICAgICAgIG1lbWNweShxLCAmc2FkZHIuc2luX2FkZHIsIDQpOworICAgICAgICBxICs9IDQ7CisKKyAgICAgICAgKnErKyA9IFJGQzE1MzNfTkVUTUFTSzsKKyAgICAgICAgKnErKyA9IDQ7CisgICAgICAgICpxKysgPSAweGZmOworICAgICAgICAqcSsrID0gMHhmZjsKKyAgICAgICAgKnErKyA9IDB4ZmY7CisgICAgICAgICpxKysgPSAweDAwOworICAgICAgICAKKyAgICAgICAgKnErKyA9IFJGQzE1MzNfR0FURVdBWTsKKyAgICAgICAgKnErKyA9IDQ7CisgICAgICAgIG1lbWNweShxLCAmc2FkZHIuc2luX2FkZHIsIDQpOworICAgICAgICBxICs9IDQ7CisgICAgICAgIAorICAgICAgICAqcSsrID0gUkZDMTUzM19ETlM7CisgICAgICAgICpxKysgPSA0OworICAgICAgICBkbnNfYWRkci5zX2FkZHIgPSBodG9ubChudG9obChzcGVjaWFsX2FkZHIuc19hZGRyKSB8IENUTF9ETlMpOworICAgICAgICBtZW1jcHkocSwgJmRuc19hZGRyLCA0KTsKKyAgICAgICAgcSArPSA0OworCisgICAgICAgICpxKysgPSBSRkMyMTMyX0xFQVNFX1RJTUU7CisgICAgICAgICpxKysgPSA0OworICAgICAgICB2YWwgPSBodG9ubChMRUFTRV9USU1FKTsKKyAgICAgICAgbWVtY3B5KHEsICZ2YWwsIDQpOworICAgICAgICBxICs9IDQ7CisgICAgfQorICAgICpxKysgPSBSRkMxNTMzX0VORDsKKyAgICAKKyAgICBtLT5tX2xlbiA9IHNpemVvZihzdHJ1Y3QgYm9vdHBfdCk7CisgICAgdWRwX291dHB1dDIoTlVMTCwgbSwgJnNhZGRyLCAmZGFkZHIsIElQVE9TX0xPV0RFTEFZKTsKK30KKwordm9pZCBib290cF9pbnB1dChzdHJ1Y3QgbWJ1ZiAqbSkKK3sKKyAgICBzdHJ1Y3QgYm9vdHBfdCAqYnAgPSAoc3RydWN0IGJvb3RwX3QgKiltLT5tX2RhdGE7CisKKyAgICBpZiAoYnAtPmJwX29wID09IEJPT1RQX1JFUVVFU1QpIHsKKyAgICAgICAgYm9vdHBfcmVwbHkoYnApOworICAgIH0KK30KZGlmZiAtLWd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Cp0dHlwLT5pZl9pbnB1dCkKKyAqIAorICogWFhYWFggQW55IHplcm9zIGFycml2aW5nIGJ5IHRoZW1zZWx2ZXMgYXJlIE5PVCBwbGFjZWQgaW50byB0aGUgYXJyaXZpbmcgcGFja2V0LgorICovCisjZGVmaW5lIElOQlVGRl9TSVpFIDIwNDggLyogWFhYICovCit2b2lkCitpZl9pbnB1dCh0dHlwKQorCXN0cnVjdCB0dHlzICp0dHlwOworeworCXVfY2hhciBpZl9pbmJ1ZmZbSU5CVUZGX1NJWkVdOworCWludCBpZl9uOworCQorCURFQlVHX0NBTEwoImlmX2lucHV0Iik7CisJREVCVUdfQVJHKCJ0dHlwID0gJWx4IiwgKGxvbmcpdHR5cCk7CisJCisJaWZfbiA9IHJlYWQodHR5cC0+ZmQsIChjaGFyICopaWZfaW5idWZmLCBJTkJVRkZfU0laRSk7CisJCisJREVCVUdfTUlTQygoZGZkLCAiIHJlYWQgJWQgYnl0ZXNcbiIsIGlmX24pKTsKKwkKKwlpZiAoaWZfbiA8PSAwKSB7CisJCWlmIChpZl9uID09IDAgfHwgKGVycm5vICE9IEVJTlRSICYmIGVycm5vICE9IEVBR0FJTikpIHsKKwkJCWlmICh0dHlwLT51cCkKKwkJCSAgIGxpbmtfdXAtLTsKKwkJCXR0eV9kZXRhY2hlZCh0dHlwLCAwKTsKKwkJfQorCQlyZXR1cm47CisJfQorCWlmIChpZl9uID09IDEpIHsKKwkJaWYgKCppZl9pbmJ1ZmYgPT0gJzAnKSB7CisJCQl0dHlwLT5vbmVzID0gMDsKKwkJCWlmICgrK3R0eXAtPnplcm9zID49IDUpCisJCQkgICBzbGlycF9leGl0KDApOworCQkJcmV0dXJuOworCQl9CisJCWlmICgqaWZfaW5idWZmID09ICcxJykgeworCQkJdHR5cC0+emVyb3MgPSAwOworCQkJaWYgKCsrdHR5cC0+b25lcyA+PSA1KQorCQkJICAgdHR5X2RldGFjaGVkKHR0eXAsIDApOworCQkJcmV0dXJuOworCQl9CisJfQorCXR0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Kys7ICovCisgIC8qIGNvZGUgPSBpY3AtPmljbXBfY29kZTsgKi8KKworICBERUJVR19BUkcoImljbXBfdHlwZSA9ICVkIiwgaWNwLT5pY21wX3R5cGUpOworICBzd2l0Y2ggKGljcC0+aWNtcF90eXBlKSB7CisgIGNhc2UgSUNNUF9FQ0hPOgorICAgIGljcC0+aWNtcF90eXBlID0gSUNNUF9FQ0hPUkVQTFk7CisgICAgaXAtPmlwX2xlbiArPSBobGVuOwkgICAgICAgICAgICAgLyogc2luY2UgaXBfaW5wdXQgc3VidHJhY3RzIHRoaXMgKi8KKyAgICBpZiAoaXAtPmlwX2RzdC5zX2FkZHIgPT0gb3VyX2FkZHIuc19hZGRyIHx8IAorCShpcC0+aXBfZHN0LnNfYWRkciA9PSAoc3BlY2lhbF9hZGRyLnNfYWRkcnxodG9ubChDVExfQUxJQVMpKSkgKSB7CisgICAgICBpY21wX3JlZmxlY3QobSk7CisgICAgfSBlbHNlIHsKKyAgICAgIHN0cnVjdCBzb2NrZXQgKnNvOworICAgICAgc3RydWN0IHNvY2thZGRyX2luIGFkZHI7CisgICAgICBpZiAoKHNvID0gc29jcmVhdGUoKSkgPT0gTlVMTCkgZ290byBmcmVlaXQ7CisgICAgICBpZih1ZHBfYXR0YWNoKHNvKSA9PSAtMSkgeworCURFQlVHX01JU0MoKGRmZCwiaWNtcF9pbnB1dCB1ZHBfYXR0YWNoIGVycm5vID0gJWQtJXNcbiIsIAorCQkgICAgZXJybm8sc3RyZXJyb3IoZXJybm8pKSk7CisJc29mcmVlKHNvKTsKKwltX2ZyZWUobSk7CisJZ290byBlbmRfZXJyb3I7CisgICAgICB9CisgICAgICBzby0+c29fbSA9IG07CisgICAgICBzby0+c29fZmFkZHIgPSBpcC0+aXBfZHN0OworICAgICAgc28tPnNvX2Zwb3J0ID0gaHRvbnMoNyk7CisgICAgICBzby0+c29fbGFkZHIgPSBpcC0+aXBfc3JjOworICAgICAgc28tPnNvX2xwb3J0ID0gaHRvbnMoOSk7Cisg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19BUkcoIm1zcmMgPSAlbHgiLCAobG9uZyApbXNyYyk7CisgIERFQlVHX0FSRygibXNyY19sZW4gPSAlZCIsIG1zcmMtPm1fbGVuKTsKKworICBpZih0eXBlIT1JQ01QX1VOUkVBQ0ggJiYgdHlwZSE9SUNNUF9USU1YQ0VFRCkgZ290byBlbmRfZXJyb3I7CisKKyAgLyogY2hlY2sgbXNyYyAqLworICBpZighbXNyYykgZ290byBlbmRfZXJyb3I7CisgIGlwID0gbXRvZChtc3JjLCBzdHJ1Y3QgaXAgKik7CisjaWYgREVCVUcgIAorICB7IGNoYXIgYnVmYVsyMF0sIGJ1ZmJbMjBdOworICAgIHN0cmNweShidWZhLCBpbmV0X250b2EoaXAtPmlwX3NyYykpOworICAgIHN0cmNweShidWZiLCBpbmV0X250b2EoaXAtPmlwX2RzdCkpOworICAgIERFQlVHX01JU0MoKGRmZCwgIiAlLjE2cyB0byAlLjE2c1xuIiwgYnVmYSwgYnVmYikpOworICB9CisjZW5kaWYKKyAgaWYoaXAtPmlwX29mZiAmIElQX09GRk1BU0spIGdvdG8gZW5kX2Vycm9yOyAgICAvKiBPbmx5IHJlcGx5IHRvIGZyYWdtZW50IDAgKi8KKworICBzaGxlbj1pcC0+aXBfaGwgPDwgMjsKKyAgc19pcF9sZW49aXAtPmlwX2xlbjsKKyAgaWYoaXAtPmlwX3AgPT0gSVBQUk9UT19JQ01QKSB7CisgICAgaWNwID0gKHN0cnVjdCBpY21wICopKChjaGFyICopaXAgKyBzaGxlbik7CisgICAgLyoKKyAgICAgKglBc3N1bWUgYW55IHVua25vd24gSUNNUCB0eXBlIGlzIGFuIGVycm9yLiBUaGlzIGlzbid0CisgICAgICoJc3BlY2lmaWVkIGJ5IHRoZSBSRkMsIGJ1dCB0aGluayBhYm91dCBpdC4uCisgICAgICovCisgICAgaWYoaWNwLT5pY21wX3R5cGU+MTggfHwgaWNtcF9mbHVzaFtpY3AtPmljbXBfdHlwZV0pIGdvdG8gZW5kX2Vycm9yOworICB9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jcHkoZGF0LCBtLT5tX2RhdCwgbS0+bV9zaXplKTsKKwkgIAorCSAgbS0+bV9leHQgPSBkYXQ7CisJICBtLT5tX2RhdGEgPSBtLT5tX2V4dCArIGRhdGFzaXplOworCSAgbS0+bV9mbGFncyB8PSBNX0VYVDsKKyAgICAgICAgfQorIAorICAgICAgICBtLT5tX3NpemUgPSBzaXplOworCit9CisKKworCit2b2lkCittX2FkaihtLCBsZW4pCisJc3RydWN0IG1idWYgKm07CisJaW50IGxlbjsKK3sKKwlpZiAobSA9PSBOVUxMKQorCQlyZXR1cm47CisJaWYgKGxlbiA+PSAwKSB7CisJCS8qIFRyaW0gZnJvbSBoZWFkICovCisJCW0tPm1fZGF0YSArPSBsZW47CisJCW0tPm1fbGVuIC09IGxlbjsKKwl9IGVsc2UgeworCQkvKiBUcmltIGZyb20gdGFpbCAqLworCQlsZW4gPSAtbGVuOworCQltLT5tX2xlbiAtPSBsZW47CisJfQorfQorCisKKy8qCisgKiBDb3B5IGxlbiBieXRlcyBmcm9tIG0sIHN0YXJ0aW5nIG9mZiBieXRlcyBpbnRvIG4KKyAqLworaW50CittX2NvcHkobiwgbSwgb2ZmLCBsZW4pCisJc3RydWN0IG1idWYgKm4sICptOworCWludCBvZmYsIGxlbjsKK3sKKwlpZiAobGVuID4gTV9GUkVFUk9PTShuKSkKKwkJcmV0dXJuIC0xOworCisJbWVtY3B5KChuLT5tX2RhdGEgKyBuLT5tX2xlbiksIChtLT5tX2RhdGEgKyBvZmYpLCBsZW4pOworCW4tPm1fbGVuICs9IGxlbjsKKwlyZXR1cm4gMDsKK30KKworCisvKgorICogR2l2ZW4gYSBwb2ludGVyIGludG8gYW4gbWJ1ZiwgcmV0dXJuIHRoZSBtYnVmCisgKiBYWFggVGhpcyBpcyBhIGtsdWRnZSwgSSBzaG91bGQgZWxpbWluYXRlIHRoZSBuZWVkIGZvciBpdAorICogRm9ydHVuYXRlbHksIGl0J3Mgbm90IHVzZWQgb2Z0ZW4KKyAqLworc3R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wgKikwKTsKKwkJCisJCWlmIChuIDw9IDApCisJCSAgIHNsaXJwX2V4aXQoMCk7CisJCQorCQlpZiAoRkRfSVNTRVQoMCwgJnJlYWRmZHMpKSB7CisJCQluID0gcmVhZCgwLCBidWYsIDgxOTIpOworCQkJaWYgKG4gPD0gMCkKKwkJCSAgIHNsaXJwX2V4aXQoMCk7CisJCQluID0gd3JpdGVuKHMsIGJ1Ziwgbik7CisJCQlpZiAobiA8PSAwKQorCQkJICAgc2xpcnBfZXhpdCgwKTsKKwkJfQorCQkKKwkJaWYgKEZEX0lTU0VUKHMsICZyZWFkZmRzKSkgeworCQkJbiA9IHJlYWQocywgYnVmLCA4MTkyKTsKKwkJCWlmIChuIDw9IDApCisJCQkgICBzbGlycF9leGl0KDApOworCQkJbiA9IHdyaXRlbigwLCBidWYsIG4pOworCQkJaWYgKG4gPD0gMCkKKwkJCSAgIHNsaXJwX2V4aXQoMCk7CisJCX0KKwl9CisJCisJLyogSnVzdCBpbiBjYXNlLi4uLiAqLworCWV4aXQoMSk7Cit9CisjZW5kaWYKKworaW50ICgqbHByaW50X3ByaW50KSBfUCgodm9pZCAqLCBjb25zdCBjaGFyICosIHZhX2xpc3QpKTsKK2NoYXIgKmxwcmludF9wdHIsICpscHJpbnRfcHRyMiwgKipscHJpbnRfYXJnOworCit2b2lkCisjaWZkZWYgX19TVERDX18KK2xwcmludChjb25zdCBjaGFyICpmb3JtYXQsIC4uLikKKyNlbHNlCitscHJpbnQodmFfYWxpc3QpIHZhX2RjbAorI2VuZGlmCit7CisJdmFfbGlzdCBhcmdzOworICAgICAgICAKKyNpZmRlZiBfX1NURENfXworICAgICAgICB2YV9zdGFydChhcmdzLCBmb3JtYXQpOworI2Vsc2UKKyAgICAgICAgY2hhciAqZm9ybWF0OworICAgICAgICB2YV9zdGFydChhcmdzKTsKKyAgICAgICAgZm9ybWF0ID0gdmFfYXJnKGFyZ3MsIGNoYXIgKik7CisjZW5kaWYKKyNpZiAwCisJLyogSWYgd2Unc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KKwl0LnR2X3VzZWMgPSB1c2VjICogMTAwMDsKKwkKKwlzZWxlY3QoMCwgJmZkc2V0LCAmZmRzZXQsICZmZHNldCwgJnQpOworfQorCisvKgorICogU2V0IGZkIGJsb2NraW5nIGFuZCBub24tYmxvY2tpbmcKKyAqLworCit2b2lkCitmZF9ub25ibG9jayhmZCkKKwlpbnQgZmQ7Cit7CisjaWZkZWYgRklPTkJJTworCWludCBvcHQgPSAxOworCQorCWlvY3RsKGZkLCBGSU9OQklPLCAmb3B0KTsKKyNlbHNlCisJaW50IG9wdDsKKwkKKwlvcHQgPSBmY250bChmZCwgRl9HRVRGTCwgMCk7CisJb3B0IHw9IE9fTk9OQkxPQ0s7CisJZmNudGwoZmQsIEZfU0VURkwsIG9wdCk7CisjZW5kaWYKK30KKwordm9pZAorZmRfYmxvY2soZmQpCisJaW50IGZkOworeworI2lmZGVmIEZJT05CSU8KKwlpbnQgb3B0ID0gMDsKKwkKKwlpb2N0bChmZCwgRklPTkJJTywgJm9wdCk7CisjZWxzZQorCWludCBvcHQ7CisJCisJb3B0ID0gZmNudGwoZmQsIEZfR0VURkwsIDApOworCW9wdCAmPSB+T19OT05CTE9DSzsKKwlmY250bChmZCwgRl9TRVRGTCwgb3B0KTsKKyNlbmRpZgorfQorCisKKyNpZiAwCisvKgorICogaW52b2tlIFJTSAorICovCitpbnQKK3JzaF9leGVjKHNvLG5zLCB1c2VyLCBob3N0LCBhcmdzKQorCXN0cnVjdCBzb2NrZXQgKnNvOworCXN0cnVjdCBzb2NrZXQgKm5zOworCWNoYXIgKnVzZXI7CisJY2hhciAqaG9zdDsKKwljaGFyICphcmdzOworeworCWludCBmZFsyXTsKKwlpbnQgZmQwWzJdOworCWludCBzOworCWNoYXIgYnVmZlsyNTZdOworCQorCURFQlVHX0NBTEwoInJzaF9leGVjIik7CisJREVCVUdfQVJHKCJzbyA9ICVseCIsIChsb25nKXNvKTsKKwkKKwlpZiAocGlwZShmZCk8MCkgeworICAgICAgICAgIGxwcmludCgiRXJyb3I6IHBpcGUgZmFpbGVkOiAlc1xuIiwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICByZXR1cm4gMDsKKwl9CisvKiAjaWZkZWYgSEFWRV9TT0NLRVRQQUlSICovCisjaWYgMQorICAgICAgICBpZiAoc29ja2V0cGFpcihQRl9VTklYLFNPQ0tfU1RSRUFNLDAsIGZkMCkgPT0gLTEpIHsKKyAgICAgICAgICBjbG9zZShmZFswXSk7CisgICAgICAgICAgY2xvc2UoZmRbMV0pOworICAgICAgICAgIGxwcmludCgiRXJyb3I6IG9wZW5wdHkgZmFpbGVkOiAlc1xuIiwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgaWYgKG9wZW5wdHkoJmZkMFswXSwgJmZkMFsxXSkgPT0gLTEpIHsKKyAgICAgICAgICBjbG9zZShmZFswXSk7CisgICAgICAgICAgY2xvc2UoZmRbMV0pOworICAgICAgICAgIGxwcmludCgiRXJyb3I6IG9wZW5wdHkgZmFpbGVkOiAlc1xuIiwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorI2VuZGlmCisJCisJc3dpdGNoKGZvcmsoKSkgeworCSBjYXNlIC0xOgorICAgICAgICAgICBscHJpbnQoIkVycm9yOiBmb3JrIGZhaWxlZDogJXNcbiIsIHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgICAgIGNsb3NlKGZkWzBdKTsKKyAgICAgICAgICAgY2xvc2UoZmRbMV0pOworICAgICAgICAgICBjbG9zZShmZDBbMF0pOworICAgICAgICAgICBjbG9zZShmZDBbMV0pOworICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgCisJIGNhc2UgMDoKKyAgICAgICAgICAgY2xvc2UoZmRbMF0pOworICAgICAgICAgICBjbG9zZShmZDBbMF0pOworICAgICAgICAgICAKKwkJLyogU2V0IHRoZSBESVNQTEFZICovCisgICAgICAgICAgIGlmICh4X3BvcnQgPj0gMCkgeworI2lmZGVmIEhBVkVfU0VURU5WCisgICAgICAgICAgICAgc3ByaW50ZihidWZmLCAiJXM6JWQuJWQiLCBpbmV0X250b2Eob3VyX2FkZHIpLCB4X3BvcnQsIHhfc2NyZWVuKTsKKyAgICAgICAgICAgICBzZXRlbnYoIkRJU1BMQVkiLCBidWZmLCAxKTsKKyNlbHNlCisgICAgICAgICAgICAgc3ByaW50ZihidWZmLCAiRElTUExBWT0lczolZC4lZCIsIGluZXRfbnRvYShvdXJfYWRkciksIHhfcG9ydCwgeF9zY3JlZW4pOworICAgICAgICAgICAgIHB1dGVudihidWZmKTsKKyNlbmRpZgorICAgICAgICAgICB9CisgICAgICAgICAgIAorICAgICAgICAgICBkdXAyKGZkMFsxXSwgMCk7CisgICAgICAgICAgIGR1cDIoZmQwWzFdLCAxKTsKKyAgICAgICAgICAgZHVwMihmZFsxXSwgMik7CisgICAgICAgICAgIGZvciAocyA9IDM7IHMgPD0gMjU1OyBzKyspCisgICAgICAgICAgICAgY2xvc2Uocyk7CisgICAgICAgICAgIAorICAgICAgICAgICBleGVjbHAoInJzaCIsInJzaCIsIi1sIiwgdXNlciwgaG9zdCwgYXJncywgTlVMTCk7CisgICAgICAgICAgIAorICAgICAgICAgICAvKiBPb29wcywgZmFpbGVkLCBsZXQncyB0ZWxsIHRoZSB1c2VyIHdoeSAqLworICAgICAgICAgICAKKyAgICAgICAgICAgc3ByaW50ZihidWZmLCAiRXJyb3I6IGV4ZWNscCBvZiAlcyBmYWlsZWQ6ICVzXG4iLCAKKyAgICAgICAgICAgICAgICAgICAicnNoIiwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICAgd3JpdGUoMiwgYnVmZiwgc3RybGVuKGJ1ZmYpKzEpOworICAgICAgICAgICBjbG9zZSgwKTsgY2xvc2UoMSk7IGNsb3NlKDIpOyAvKiBYWFggKi8KKyAgICAgICAgICAgZXhpdCgxKTsK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U2cyIsIGJ1ZmYyKSA9PSAxKSB7CisgICAgICAgICAgICBpZiAoIWluZXRfYXRvbihidWZmMiwgJnRtcF9hZGRyKSkKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIGlmICh0bXBfYWRkci5zX2FkZHIgPT0gbG9vcGJhY2tfYWRkci5zX2FkZHIpCisgICAgICAgICAgICAgICAgdG1wX2FkZHIgPSBvdXJfYWRkcjsKKyAgICAgICAgICAgIC8qIElmIGl0J3MgdGhlIGZpcnN0IG9uZSwgc2V0IGl0IHRvIGRuc19hZGRyICovCisgICAgICAgICAgICBpZiAoIWZvdW5kKQorICAgICAgICAgICAgICAgICpwZG5zX2FkZHIgPSB0bXBfYWRkcjsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICBscHJpbnQoIiwgIik7CisgICAgICAgICAgICBpZiAoKytmb3VuZCA+IDMpIHsKKyAgICAgICAgICAgICAgICBscHJpbnQoIihtb3JlKSIpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfSBlbHNlCisgICAgICAgICAgICAgICAgbHByaW50KCIlcyIsIGluZXRfbnRvYSh0bXBfYWRkcikpOworICAgICAgICB9CisgICAgfQorICAgIGlmICghZm91bmQpCisgICAgICAgIHJldHVybiAtMTsKKyAgICByZXR1cm4gMDsKK30KKworI2VuZGlmCisKK3ZvaWQgc2xpcnBfaW5pdCh2b2lkKQoreworICAgIGRlYnVnX2luaXQoIi90bXAvc2xpcnAubG9nIiwgREVCVUdfREVGQVVMVCk7CisKKyAgICBsaW5rX3VwID0gMTsKKworICAgIGlmX2luaXQoKTsKKyAgICBpcF9pbml0KCk7CisKKyAgICAvKiBJbml0aWFsaXNlIG1idWZzICphZnRlciogc2V0dGluZyB0aGUgTVRVICovCisgICAgbV9pbml0KCk7CisKKyAgICAvKiBzZXQgZGVmYXVsdCBhZGRyZXNzZXMgKi8KKyAgICBnZXRvdXJhZGRyKCk7CisgICAgaW5ldF9hdG9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9JU1NFVChzby0+cywgcmVhZGZkcykpIHsKKwkJCQkvKgorCQkJCSAqIENoZWNrIGZvciBpbmNvbWluZyBjb25uZWN0aW9ucworCQkJCSAqLworCQkJCWlmIChzby0+c29fc3RhdGUgJiBTU19GQUNDRVBUQ09OTikgeworCQkJCQl0Y3BfY29ubmVjdChzbyk7CisJCQkJCWNvbnRpbnVlOworCQkJCX0gLyogZWxzZSAqLworCQkJCXJldCA9IHNvcmVhZChzbyk7CisJCQkJCisJCQkJLyogT3V0cHV0IGl0IGlmIHdlIHJlYWQgc29tZXRoaW5nICovCisJCQkJaWYgKHJldCA+IDApCisJCQkJICAgdGNwX291dHB1dChzb3RvdGNwY2Ioc28pKTsKKwkJCX0KKwkJCQorCQkJLyoKKwkJCSAqIENoZWNrIHNvY2tldHMgZm9yIHdyaXRpbmcKKwkJCSAqLworCQkJaWYgKEZEX0lTU0VUKHNvLT5zLCB3cml0ZWZkcykpIHsKKwkJCSAgLyoKKwkJCSAgICogQ2hlY2sgZm9yIG5vbi1ibG9ja2luZywgc3RpbGwtY29ubmVjdGluZyBzb2NrZXRzCisJCQkgICAqLworCQkJICBpZiAoc28tPnNvX3N0YXRlICYgU1NfSVNGQ09OTkVDVElORykgeworCQkJICAgIC8qIENvbm5lY3RlZCAqLworCQkJICAgIHNvLT5zb19zdGF0ZSAmPSB+U1NfSVNGQ09OTkVDVElORzsKKwkJCSAgICAKKwkJCSAgICByZXQgPSB3cml0ZShzby0+cywgJnJldCwgMCk7CisJCQkgICAgaWYgKHJldCA8IDApIHsKKwkJCSAgICAgIC8qIFhYWFhYIE11c3QgZml4LCB6ZXJvIGJ5dGVzIGlzIGEgTk9QICovCisJCQkgICAgICBpZiAoZXJybm8gPT0gRUFHQUlOIHx8IGVycm5vID09IEVXT1VMREJMT0NLIHx8CisJCQkJICBlcnJubyA9PSBFSU5QUk9HUkVTUyB8fCBlcnJubyA9PSBFTk9UQ09OTikKKwkJCQljb250aW51ZTsKKwkJCSAgICAgIAorCQk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jdCBldGhoZHIgKnJlaCA9IChzdHJ1Y3QgZXRoaGRyICopYXJwX3JlcGx5OworICAgIHN0cnVjdCBhcnBoZHIgKnJhaCA9IChzdHJ1Y3QgYXJwaGRyICopKGFycF9yZXBseSArIEVUSF9ITEVOKTsKKyAgICBpbnQgYXJfb3A7CisKKyAgICBhcl9vcCA9IG50b2hzKGFoLT5hcl9vcCk7CisgICAgc3dpdGNoKGFyX29wKSB7CisgICAgY2FzZSBBUlBPUF9SRVFVRVNUOgorICAgICAgICBpZiAoIW1lbWNtcChhaC0+YXJfdGlwLCAmc3BlY2lhbF9hZGRyLCAzKSAmJgorICAgICAgICAgICAgKGFoLT5hcl90aXBbM10gPT0gQ1RMX0ROUyB8fCBhaC0+YXJfdGlwWzNdID09IENUTF9BTElBUykpIHsKKworICAgICAgICAgICAgLyogWFhYOiBtYWtlIGFuIEFSUCByZXF1ZXN0IHRvIGhhdmUgdGhlIGNsaWVudCBhZGRyZXNzICovCisgICAgICAgICAgICBtZW1jcHkoY2xpZW50X2V0aGFkZHIsIGVoLT5oX3NvdXJjZSwgRVRIX0FMRU4pOworCisgICAgICAgICAgICAvKiBBUlAgcmVxdWVzdCBmb3IgYWxpYXMvZG5zIG1hYyBhZGRyZXNzICovCisgICAgICAgICAgICBtZW1jcHkocmVoLT5oX2Rlc3QsIHBrdCArIEVUSF9BTEVOLCBFVEhfQUxFTik7CisgICAgICAgICAgICBtZW1jcHkocmVoLT5oX3NvdXJjZSwgc3BlY2lhbF9ldGhhZGRyLCBFVEhfQUxFTiAtIDEpOworICAgICAgICAgICAgcmVoLT5oX3NvdXJjZVs1XSA9IGFoLT5hcl90aXBbM107CisgICAgICAgICAgICByZWgtPmhfcHJvdG8gPSBodG9ucyhFVEhfUF9BUlApOworCisgICAgICAgICAgICByYWgtPmFyX2hyZCA9IGh0b25zKDEpOworICAgICAgICAgICAgcmFoLT5hcl9wcm8gPSBodG9ucyhFVEhfUF9JUCk7CisgICAgICAgICAgICByYWgtPmFyX2hsbiA9IEVUSF9BTEVOOworICAgICAgICAgICAgcmFoLT5hcl9wbG4gPSA0OworICAgICAgICAgICAgcmFoLT5hcl9vcCA9IGh0b25zKEFSUE9QX1JFUExZKTsKKyAgICAgICAgICAgIG1lbWNweShyYWgtPmFyX3NoYSwgcmVoLT5oX3NvdXJjZSwgRVRIX0FMRU4pOworICAgICAgICAgICAgbWVtY3B5KHJhaC0+YXJfc2lwLCBhaC0+YXJfdGlwLCA0KTsKKyAgICAgICAgICAgIG1lbWNweShyYWgtPmFyX3RoYSwgYWgtPmFyX3NoYSwgRVRIX0FMRU4pOworICAgICAgICAgICAgbWVtY3B5KHJhaC0+YXJfdGlwLCBhaC0+YXJfc2lwLCA0KTsKKyAgICAgICAgICAgIHNsaXJwX291dHB1dChhcnBfcmVwbHksIHNpemVvZihhcnBfcmVwbHkpKTsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgICBicmVhazsKKyAgICB9Cit9CisKK3ZvaWQgc2xpcnBfaW5wdXQoY29uc3QgdWludDhfdCAqcGt0LCBpbnQgcGt0X2xlbikKK3sKKyAgICBzdHJ1Y3QgbWJ1ZiAqbTsKKyAgICBpbnQgcHJvdG87CisKKyAgICBpZiAocGt0X2xlbiA8IEVUSF9ITEVOKQorICAgICAgICByZXR1cm47CisgICAgCisgICAgcHJvdG8gPSBudG9ocygqKHVpbnQxNl90ICopKHBrdCArIDEyKSk7CisgICAgc3dpdGNoKHByb3RvKSB7CisgICAgY2FzZSBFVEhfUF9BUlA6CisgICAgICAgIGFycF9pbnB1dChwa3QsIHBrdF9sZW4pOworICAgICAgICBicmVhazsKKyAgICBjYXNlIEVUSF9QX0lQOgorICAgICAgICBtID0gbV9nZXQoKTsKKyAgICAgICAgaWYgKCFtKQorICAgICAgICAgICAgcmV0dXJuOworICAgICAgICBtLT5tX2xlbiA9IHBrdF9sZW47CisgICAgICAgIG1lbWNweShtLT5tX2RhdGEsIHBrdCwgcGt0X2xlb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mZCwiIHVkcCBpY21wIHJ4IGVycm5vID0gJWQtJXNcbiIsCisJCQllcnJubyxzdHJlcnJvcihlcnJubykpKTsKKwkgICAgaWNtcF9lcnJvcihzby0+c29fbSwgSUNNUF9VTlJFQUNILGNvZGUsIDAsc3RyZXJyb3IoZXJybm8pKTsKKwkgIH0gZWxzZSB7CisJICAgIGljbXBfcmVmbGVjdChzby0+c29fbSk7CisJICAgIHNvLT5zb19tID0gMDsgLyogRG9uJ3QgbV9mcmVlKCkgaXQgYWdhaW4hICovCisJICB9CisJICAvKiBObyBuZWVkIGZvciB0aGlzIHNvY2tldCBhbnltb3JlLCB1ZHBfZGV0YWNoIGl0ICovCisJICB1ZHBfZGV0YWNoKHNvKTsKKwl9IGVsc2UgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAJLyogQSAibm9ybWFsIiBVRFAgcGFja2V0ICovCisJICBzdHJ1Y3QgbWJ1ZiAqbTsKKwkgIGludCBsZW4sIG47CisKKwkgIGlmICghKG0gPSBtX2dldCgpKSkgcmV0dXJuOworCSAgbS0+bV9kYXRhICs9IGlmX21heGxpbmtoZHI7CisJCQorCSAgLyogCisJICAgKiBYWFggU2hvdWxkbid0IEZJT05SRUFEIHBhY2tldHMgZGVzdGluZWQgZm9yIHBvcnQgNTMsCisJICAgKiBidXQgSSBkb24ndCBrbm93IHRoZSBtYXggcGFja2V0IHNpemUgZm9yIEROUyBsb29rdXBzCisJICAgKi8KKwkgIGxlbiA9IE1fRlJFRVJPT00obSk7CisJICAvKiBpZiAoc28tPnNvX2Zwb3J0ICE9IGh0b25zKDUzKSkgeyAqLworCSAgaW9jdGwoc28tPnMsIEZJT05SRUFELCAmbik7CisJICAKKwkgIGlmIChuID4gbGVuKSB7CisJICAgIG4gPSAobS0+bV9kYXRhIC0gbS0+bV9kYXQpICsgbS0+bV9sZW4gKyBuICsgMTsKKwkgICAgbV9pbmMobSwgbik7CisJICAgIGxlbiA9IE1fRlJFRVJPT00obSk7CisJICB9CisJICAvKi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ICAgICBpZiAoc28tPnNvX2Zwb3J0ID09IGh0b25zKDUzKSkKKwkJc28tPnNvX2V4cGlyZSA9IGN1cnRpbWUgKyBTT19FWFBJUkVGQVNUOworCSAgICAgIGVsc2UKKwkJc28tPnNvX2V4cGlyZSA9IGN1cnRpbWUgKyBTT19FWFBJUkU7CisJICAgIH0KKworCSAgICAvKgkJaWYgKG0tPm1fbGVuID09IGxlbikgeworCSAgICAgKgkJCW1faW5jKG0sIE1JTkNTSVpFKTsKKwkgICAgICoJCQltLT5tX2xlbiA9IDA7CisJICAgICAqCQl9CisJICAgICAqLworCSAgICAKKwkgICAgLyogCisJICAgICAqIElmIHRoaXMgcGFja2V0IHdhcyBkZXN0aW5lZCBmb3IgQ1RMX0FERFIsCisJICAgICAqIG1ha2UgaXQgbG9vayBsaWtlIHRoYXQncyB3aGVyZSBpdCBjYW1lIGZyb20sIGRvbmUgYnkgdWRwX291dHB1dAorCSAgICAgKi8KKwkgICAgdWRwX291dHB1dChzbywgbSwgJmFkZHIpOworCSAgfSAvKiByeCBlcnJvciAqLworCX0gLyogaWYgcGluZyBwYWNrZXQgKi8KK30KKworLyoKKyAqIHNlbmR0bygpIGEgc29ja2V0CisgKi8KK2ludAorc29zZW5kdG8oc28sIG0pCisJc3RydWN0IHNvY2tldCAqc287CisJc3RydWN0IG1idWYgKm07Cit7CisJaW50IHJldDsKKwlzdHJ1Y3Qgc29ja2FkZHJfaW4gYWRkcjsKKworCURFQlVHX0NBTEwoInNvc2VuZHRvIik7CisJREVCVUdfQVJHKCJzbyA9ICVseCIsIChsb25nKXNvKTsKKwlERUJVR19BUkcoIm0gPSAlbHgiLCAobG9uZyltKTsKKwkKKyAgICAgICAgYWRkci5zaW5fZmFtaWx5ID0gQUZfSU5FVDsKKwlpZiAoKHNvLT5zb19mYWRkci5zX2FkZHIgJiBodG9ubCgweGZmZmZmZjAwKSkgPT0gc3BlY2lhbF9hZGRyLnNfYWRkcikgeworCSAgLyogSXQncyBhbiBhbGlhcyA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dG9zOworCQkKKwkgIHRwID0gc290b3RjcGNiKHNvKTsKKwkgIHRwLT50X3N0YXRlID0gVENQU19MSVNURU47CisJfQorICAgICAgICAgICAKKyAgICAgICAgLyoKKyAgICAgICAgICogSWYgdGhpcyBpcyBhIHN0aWxsLWNvbm5lY3Rpbmcgc29ja2V0LCB0aGlzIHByb2JhYmx5CisgICAgICAgICAqIGEgcmV0cmFuc21pdCBvZiB0aGUgU1lOLiAgV2hldGhlciBpdCdzIGEgcmV0cmFuc21pdCBTWU4KKwkgKiBvciBzb21ldGhpbmcgZWxzZSwgd2UgbnVrZSBpdC4KKyAgICAgICAgICovCisgICAgICAgIGlmIChzby0+c29fc3RhdGUgJiBTU19JU0ZDT05ORUNUSU5HKQorICAgICAgICAgICAgICAgIGdvdG8gZHJvcDsKKworCXRwID0gc290b3RjcGNiKHNvKTsKKwkKKwkvKiBYWFggU2hvdWxkIG5ldmVyIGZhaWwgKi8KKwlpZiAodHAgPT0gMCkKKwkJZ290byBkcm9wd2l0aHJlc2V0OworCWlmICh0cC0+dF9zdGF0ZSA9PSBUQ1BTX0NMT1NFRCkKKwkJZ290byBkcm9wOworCQorCS8qIFVuc2NhbGUgdGhlIHdpbmRvdyBpbnRvIGEgMzItYml0IHZhbHVlLiAqLworLyoJaWYgKCh0aWZsYWdzICYgVEhfU1lOKSA9PSAwKQorICoJCXRpd2luID0gdGktPnRpX3dpbiA8PCB0cC0+c25kX3NjYWxlOworICoJZWxzZQorICovCisJCXRpd2luID0gdGktPnRpX3dpbjsKKworCS8qCisJICogU2VnbWVudCByZWNlaXZlZCBvbiBjb25uZWN0aW9uLgorCSAqIFJlc2V0IGlkbGUgdGltZSBhbmQga2VlcC1hbGl2ZSB0aW1lci4KKwkgKi8KKwl0cC0+dF9pZGxlID0gMDsKKwlpZiAoc29fb3B0aW9ucykKKwkgICB0cC0+dF90aW1lcltUQ1BUX0tFRVBdID0gdGNwX2tlZXBpbnR2bDsKKwllbHNlCisJICAgdHAtPnRfdGlt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OTkVDVDsKKwkgICAgZ290byBjb250X2lucHV0OworCSAgfQorCSAgCisJICBpZih0Y3BfZmNvbm5lY3Qoc28pID09IC0xICYmIGVycm5vICE9IEVJTlBST0dSRVNTKSB7CisJICAgIHVfY2hhciBjb2RlPUlDTVBfVU5SRUFDSF9ORVQ7CisJICAgIERFQlVHX01JU0MoKGRmZCwiIHRjcCBmY29ubmVjdCBlcnJubyA9ICVkLSVzXG4iLAorCQkJZXJybm8sc3RyZXJyb3IoZXJybm8pKSk7CisJICAgIGlmKGVycm5vID09IEVDT05OUkVGVVNFRCkgeworCSAgICAgIC8qIEFDSyB0aGUgU1lOLCBzZW5kIFJTVCB0byByZWZ1c2UgdGhlIGNvbm5lY3Rpb24gKi8KKwkgICAgICB0Y3BfcmVzcG9uZCh0cCwgdGksIG0sIHRpLT50aV9zZXErMSwgKHRjcF9zZXEpMCwKKwkJCSAgVEhfUlNUfFRIX0FDSyk7IAorCSAgICB9IGVsc2UgeworCSAgICAgIGlmKGVycm5vID09IEVIT1NUVU5SRUFDSCkgY29kZT1JQ01QX1VOUkVBQ0hfSE9TVDsKKwkgICAgICBIVE9OTCh0aS0+dGlfc2VxKTsgICAgICAgICAgICAgLyogcmVzdG9yZSB0Y3AgaGVhZGVyICovCisJICAgICAgSFRPTkwodGktPnRpX2Fjayk7CisJICAgICAgSFRPTlModGktPnRpX3dpbik7CisJICAgICAgSFRPTlModGktPnRpX3VycCk7CisJICAgICAgbS0+bV9kYXRhIC09IHNpemVvZihzdHJ1Y3QgdGNwaXBoZHIpK29mZi1zaXplb2Yoc3RydWN0IHRjcGhkcik7CisJICAgICAgbS0+bV9sZW4gICs9IHNpemVvZihzdHJ1Y3QgdGNwaXBoZHIpK29mZi1zaXplb2Yoc3RydWN0IHRjcGhkcik7CisJICAgICAgKmlwPXNhdmVfaXA7CisJICAgICAgaWNtcF9lcnJvcihtLCBJQ01QX1VOUkVBQ0gsY29kZSwgMCxzdHJlcnJvcihlcnJubykpOworCSAgICB9CisJ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bGFncyAmIFRIX1NZTikgdGktPnRpX2xlbisrOworCQl0Y3BfcmVzcG9uZCh0cCwgdGksIG0sIHRpLT50aV9zZXErdGktPnRpX2xlbiwgKHRjcF9zZXEpMCwKKwkJICAgIFRIX1JTVHxUSF9BQ0spOworCX0KKworCXJldHVybjsKKworZHJvcDoKKwkvKgorCSAqIERyb3Agc3BhY2UgaGVsZCBieSBpbmNvbWluZyBzZWdtZW50IGFuZCByZXR1cm4uCisJICovCisJbV9mcmVlKG0pOworCisJcmV0dXJuOworfQorCisgLyogLCB0c19wcmVzZW50LCB0c192YWwsIHRzX2VjcikgKi8KKy8qCWludCAqdHNfcHJlc2VudDsKKyAqCXVfaW50MzJfdCAqdHNfdmFsLCAqdHNfZWNyOworICovCit2b2lkCit0Y3BfZG9vcHRpb25zKHRwLCBjcCwgY250LCB0aSkKKwlzdHJ1Y3QgdGNwY2IgKnRwOworCXVfY2hhciAqY3A7CisJaW50IGNudDsKKwlzdHJ1Y3QgdGNwaXBoZHIgKnRpOworeworCXVfaW50MTZfdCBtc3M7CisJaW50IG9wdCwgb3B0bGVuOworCisJREVCVUdfQ0FMTCgidGNwX2Rvb3B0aW9ucyIpOworCURFQlVHX0FSR1MoKGRmZCwiIHRwID0gJWx4ICBjbnQ9JWkgXG4iLCAobG9uZyApdHAsIGNudCkpOworCisJZm9yICg7IGNudCA+IDA7IGNudCAtPSBvcHRsZW4sIGNwICs9IG9wdGxlbikgeworCQlvcHQgPSBjcFswXTsKKwkJaWYgKG9wdCA9PSBUQ1BPUFRfRU9MKQorCQkJYnJlYWs7CisJCWlmIChvcHQgPT0gVENQT1BUX05PUCkKKwkJCW9wdGxlbiA9IDE7CisJCWVsc2UgeworCQkJb3B0bGVuID0gY3BbMV07CisJCQlpZiAob3B0bGVuIDw9IDApCisJCQkJYnJlYWs7CisJCX0KKwkJc3dpdGNoIChvcHQpIHsKKworCQlkZWZhdWx0OgorCQkJY29udGludWU7CisKKwkJY2FzZSBUQ1BPUFRfTUFY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VuID0gbS0+bV9sZW47CisKKwkoKHN0cnVjdCBpcCAqKXRpKS0+aXBfdHRsID0gaXBfZGVmdHRsOworCSgoc3RydWN0IGlwICopdGkpLT5pcF90b3MgPSBzby0+c29faXB0b3M7CisJICAgIAorLyogI2lmIEJTRCA+PSA0MyAqLworCS8qIERvbid0IGRvIElQIG9wdGlvbnMuLi4gKi8KKy8qCWVycm9yID0gaXBfb3V0cHV0KG0sIHRwLT50X2lucGNiLT5pbnBfb3B0aW9ucywgJnRwLT50X2lucGNiLT5pbnBfcm91dGUsCisgKgkgICAgc28tPnNvX29wdGlvbnMgJiBTT19ET05UUk9VVEUsIDApOworICovCisJZXJyb3IgPSBpcF9vdXRwdXQoc28sIG0pOworCisvKiAjZWxzZQorICoJZXJyb3IgPSBpcF9vdXRwdXQobSwgKHN0cnVjdCBtYnVmICopMCwgJnRwLT50X2lucGNiLT5pbnBfcm91dGUsIAorICoJICAgIHNvLT5zb19vcHRpb25zICYgU09fRE9OVFJPVVRFKTsKKyAqICNlbmRpZgorICovCisgICAgfQorCWlmIChlcnJvcikgeworb3V0OgorLyoJCWlmIChlcnJvciA9PSBFTk9CVUZTKSB7CisgKgkJCXRjcF9xdWVuY2godHAtPnRfaW5wY2IsIDApOworICoJCQlyZXR1cm4gKDApOworICoJCX0KKyAqLworLyoJCWlmICgoZXJyb3IgPT0gRUhPU1RVTlJFQUNIIHx8IGVycm9yID09IEVORVRET1dOKQorICoJCSAgICAmJiBUQ1BTX0hBVkVSQ1ZEU1lOKHRwLT50X3N0YXRlKSkgeworICoJCQl0cC0+dF9zb2Z0ZXJyb3IgPSBlcnJvcjsKKyAqCQkJcmV0dXJuICgwKTsKKyAqCQl9CisgKi8KKwkJcmV0dXJuIChlcnJvcik7CisJfQorCXRjcHN0YXQudGNwc19zbmR0b3RhbCsrOworCisJLyoKKwkgKiBEYXRhIHNlbnQgKGFzIGZhciBhcyB3ZSBjYW4gdGVsbCkuCisJICogSWYgdGhpcyBhZHZlcnRpc2Vz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VlKG0pOworCQkJCisJCQkvKgorCQkJICogQ2hlY2sgaWYgd2UgaGF2ZSBhbGwgdGhlIGluaXRpYWwgb3B0aW9ucywKKwkJCSAqIGFuZCBidWlsZCBhcmd1bWVudCBsaXN0IHRvIHJsb2dpbiB3aGlsZSB3ZSdyZSBoZXJlCisJCQkgKi8KKwkJCW4gPSAwOworCQkJcHRyID0gc29fcmN2LT5zYl9kYXRhOworCQkJdXNlcj0iIjsKKwkJCWFyZ3M9IiI7CisJCQlpZiAoc28tPmV4dHJhPT1OVUxMKSB7CisJCQkJc3RydWN0IHNvY2tldCAqbnM7CisJCQkJc3RydWN0IHRjcGNiKiB0cDsKKwkJCQlpbnQgcG9ydD1hdG9pKHB0cik7CisJCQkJaWYgKHBvcnQgPD0gMCkgcmV0dXJuIDA7CisgICAgICAgICAgICAgICAgaWYgKHBvcnQgPiAxMDIzIHx8IHBvcnQgPCA1MTIpIHsKKyAgICAgICAgICAgICAgICAgIG1lbWNweShzb19zbmQtPnNiX3dwdHIsICJQZXJtaXNzaW9uIGRlbmllZFxuIiwgMTgpOworICAgICAgICAgICAgICAgICAgc29fc25kLT5zYl93cHRyICs9IDE4OworICAgICAgICAgICAgICAgICAgc29fc25kLT5zYl9jYyArPSAxODsKKyAgICAgICAgICAgICAgICAgIHRjcF9zb2NrY2xvc2VkKHNvdG90Y3BjYihzbykpOworICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICAgICAgfQorCQkJCWlmICgobnM9c29jcmVhdGUoKSkgPT0gTlVMTCkKKyAgICAgICAgICAgICAgICAgIHJldHVybiAwOworCQkJCWlmICh0Y3BfYXR0YWNoKG5zKTwwKSB7CisgICAgICAgICAgICAgICAgICBmcmVlKG5zKTsKKyAgICAgICAgICAgICAgICAgIHJldHVybiAwOworCQkJCX0KKworCQkJCW5zLT5zb19sYWRkcj1zby0+c29fbGFkZHI7CisJCQkJbnMtPnNvX2xwb3J0PWh0b25zKHBvcnQpOworCisJCQkJKHZv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CQl0Y3Bfc2VuZHNlcWluaXQodHApOworCQkJCXRjcF9vdXRwdXQodHApOworCQkJCXNvLT5leHRyYT1uczsKKwkJCX0KKwkJCXdoaWxlIChwdHIgPCBzb19yY3YtPnNiX3dwdHIpIHsKKyAgICAgICAgICAgICAgaWYgKCpwdHIrKyA9PSAwKSB7CisgICAgICAgICAgICAgICAgbisrOworICAgICAgICAgICAgICAgIGlmIChuID09IDIpIHsKKyAgICAgICAgICAgICAgICAgIHVzZXI9cHRyOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobiA9PSAzKSB7CisgICAgICAgICAgICAgICAgICBhcmdzPXB0cjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIH0KKwkJCX0KKwkJCQorCQkJaWYgKG4gIT0gNCkKKyAgICAgICAgICAgICAgcmV0dXJuIDA7CisJCQkKKwkJCXJzaF9leGVjKHNvLHNvLT5leHRyYSwgdXNlciwgaW5ldF9udG9hKHNvLT5zb19mYWRkciksIGFyZ3MpOworCQkJc28tPnNvX2VtdSA9IDA7CisJCQlzby0+ZXh0cmE9TlVMTDsKKwkJCQorCQkJLyogQW5kIGZpbmFsbHksIHNlbmQgdGhlIGNsaWVudCBhIDAgY2hhcmFjdGVyICovCisJCQlzb19zbmQtPnNiX3dwdHJbMF0gPSAwOworCQkJc29fc25kLT5zYl93cHRyKys7CisJCQlzb19zbmQtPnNiX2NjKys7CisJCQkKKwkJCXJldHVybiAwOworCQl9CisKKwkgY2FzZSBFTVVfQ1RMOgorCQl7CisJCQlpbnQgbnVtOworCQkJc3RydWN0IHNidWYgKnNvX3NuZCA9ICZzby0+c29fc25kOworCQkJc3RydWN0IHNidWYgKnNvX3JjdiA9ICZzby0+c29fcmN2OworCQkJCisJCQkvKgorCQkJICogSWYgdGhlcmUgaXMgYmluYXJ5IGRhdGEgaGVyZSwgd2Ugc2F2ZSBpdCBpbiBzby0+c29fbQorCQkJICovCisJCQlpZiAoIXNvLT5zb19tKSB7CisJCQkgIGlud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wkJCQlzbyA9IHRtcDsKKwkJCQlicmVhazsKKwkJCX0KKwkJfQorCQlpZiAodG1wID09ICZ1ZGIpIHsKKwkJICBzbyA9IE5VTEw7CisJCX0gZWxzZSB7CisJCSAgdWRwc3RhdC51ZHBwc19wY2JjYWNoZW1pc3MrKzsKKwkJICB1ZHBfbGFzdF9zbyA9IHNvOworCQl9CisJfQorCQorCWlmIChzbyA9PSBOVUxMKSB7CisJICAvKgorCSAgICogSWYgdGhlcmUncyBubyBzb2NrZXQgZm9yIHRoaXMgcGFja2V0LAorCSAgICogY3JlYXRlIG9uZQorCSAgICovCisJICBpZiAoKHNvID0gc29jcmVhdGUoKSkgPT0gTlVMTCkgZ290byBiYWQ7CisJICBpZih1ZHBfYXR0YWNoKHNvKSA9PSAtMSkgeworCSAgICBERUJVR19NSVNDKChkZmQsIiB1ZHBfYXR0YWNoIGVycm5vID0gJWQtJXNcbiIsIAorCQkJZXJybm8sc3RyZXJyb3IoZXJybm8pKSk7CisJICAgIHNvZnJlZShzbyk7CisJICAgIGdvdG8gYmFkOworCSAgfQorCSAgCisJICAvKgorCSAgICogU2V0dXAgZmllbGRzCisJICAgKi8KKwkgIC8qIHVkcF9sYXN0X3NvID0gc287ICovCisJICBzby0+c29fbGFkZHIgPSBpcC0+aXBfc3JjOworCSAgc28tPnNvX2xwb3J0ID0gdWgtPnVoX3Nwb3J0OworCSAgc28tPnNvX2ZhZGRyID0gaXAtPmlwX2RzdDsgLyogWFhYICovCisJICBzby0+c29fZnBvcnQgPSB1aC0+dWhfZHBvcnQ7IC8qIFhYWCAqLworCSAgCisJICBpZiAoKHNvLT5zb19pcHRvcyA9IHVkcF90b3Moc28pKSA9PSAwKQorCSAgICBzby0+c29faXB0b3MgPSBpcC0+aXBfdG9zOworCSAgCisJICAvKgorCSAgICogWFhYWFggSGVyZSwgY2hlY2sgaWYgaXQncyBpbiB1ZHBleGVjX2xpc3QsCisJICAgKiBhbmQgaWYgaXQgaXMsIGRvIHRoZSBmb3Jr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2NrYWRkcl9pbiAqZGFkZHIsCisgICAgICAgICAgICAgICAgaW50IGlwdG9zKQoreworCXJlZ2lzdGVyIHN0cnVjdCB1ZHBpcGhkciAqdWk7CisJaW50IGVycm9yID0gMDsKKworCURFQlVHX0NBTEwoInVkcF9vdXRwdXQiKTsKKwlERUJVR19BUkcoInNvID0gJWx4IiwgKGxvbmcpc28pOworCURFQlVHX0FSRygibSA9ICVseCIsIChsb25nKW0pOworCURFQlVHX0FSRygic2FkZHIgPSAlbHgiLCAobG9uZylzYWRkci0+c2luX2FkZHIuc19hZGRyKTsKKwlERUJVR19BUkcoImRhZGRyID0gJWx4IiwgKGxvbmcpZGFkZHItPnNpbl9hZGRyLnNfYWRkcik7CisKKwkvKgorCSAqIEFkanVzdCBmb3IgaGVhZGVyCisJICovCisJbS0+bV9kYXRhIC09IHNpemVvZihzdHJ1Y3QgdWRwaXBoZHIpOworCW0tPm1fbGVuICs9IHNpemVvZihzdHJ1Y3QgdWRwaXBoZHIpOworCQorCS8qCisJICogRmlsbCBpbiBtYnVmIHdpdGggZXh0ZW5kZWQgVURQIGhlYWRlcgorCSAqIGFuZCBhZGRyZXNzZXMgYW5kIGxlbmd0aCBwdXQgaW50byBuZXR3b3JrIGZvcm1hdC4KKwkgKi8KKwl1aSA9IG10b2QobSwgc3RydWN0IHVkcGlwaGRyICopOworCXVpLT51aV9uZXh0ID0gdWktPnVpX3ByZXYgPSAwOworCXVpLT51aV94MSA9IDA7CisJdWktPnVpX3ByID0gSVBQUk9UT19VRFA7CisJdWktPnVpX2xlbiA9IGh0b25zKG0tPm1fbGVuIC0gc2l6ZW9mKHN0cnVjdCBpcCkpOyAvKiArIHNpemVvZiAoc3RydWN0IHVkcGhkcikpOyAqLworCS8qIFhYWFhYIENoZWNrIGZvciBmcm9tLW9uZS1sb2NhdGlvbiBzb2NrZXRzLCBvciBmcm9tLWFueS1sb2NhdGlvbiBzb2NrZXRzICovCisgICAgICAgIHVpLT51aV9zcmMgPSBzYWRkci0+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1X2xvbmcgIHVkcHNfaXBhY2tldHM7ICAgICAgICAgIC8qIHRvdGFsIGlucHV0IHBhY2tldHMgKi8KKwkgICAgICAgIHVfbG9uZyAgdWRwc19oZHJvcHM7ICAgICAgICAgICAgLyogcGFja2V0IHNob3J0ZXIgdGhhbiBoZWFkZXIgKi8KKwkgICAgICAgIHVfbG9uZyAgdWRwc19iYWRzdW07ICAgICAgICAgICAgLyogY2hlY2tzdW0gZXJyb3IgKi8KKwkgICAgICAgIHVfbG9uZyAgdWRwc19iYWRsZW47ICAgICAgICAgICAgLyogZGF0YSBsZW5ndGggbGFyZ2VyIHRoYW4gcGFja2V0ICovCisJICAgICAgICB1X2xvbmcgIHVkcHNfbm9wb3J0OyAgICAgICAgICAgIC8qIG5vIHNvY2tldCBvbiBwb3J0ICovCisJICAgICAgICB1X2xvbmcgIHVkcHNfbm9wb3J0YmNhc3Q7ICAgICAgIC8qIG9mIGFib3ZlLCBhcnJpdmVkIGFzIGJyb2FkY2FzdCAqLworCSAgICAgICAgdV9sb25nICB1ZHBzX2Z1bGxzb2NrOyAgICAgICAgICAvKiBub3QgZGVsaXZlcmVkLCBpbnB1dCBzb2NrZXQgZnVsbCAqLworCSAgICAgICAgdV9sb25nICB1ZHBwc19wY2JjYWNoZW1pc3M7ICAgICAvKiBpbnB1dCBwYWNrZXRzIG1pc3NpbmcgcGNiIGNhY2hlICovCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBvdXRwdXQgc3RhdGlzdGljczogKi8KKwkgICAgICAgIHVfbG9uZyAgdWRwc19vcGFja2V0czsgICAgICAgICAgLyogdG90YWwgb3V0cHV0IHBhY2tldHMgKi8KK307CisKKy8qCisgKiBOYW1lcyBmb3IgVURQIHN5c2N0bCBvYmplY3RzCisgKi8KKyNkZWZpbmUgVURQQ1RMX0NIRUNLU1VNICAgICAgICAgMSAgICAgICAvKiBjaGVja3N1bSBVRFAgcGFja2V0cyAqLworI2RlZmluZSBVRFBDVExfTUFYSUQg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