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dHJlYW07CisgIHVfY2hhciB2aXJ0dWFsOworICBpbnQgdmFsdWVfbGVuLCByZXR2YWwgPSBJU0lTX09LOworICB1X2NoYXIgKnBudCA9IHN0cmVhbTsKIAogICAqZm91bmQgPSAwOwogICBtZW1zZXQgKHRsdnMsIDAsIHNpemVvZiAoc3RydWN0IHRsdnMpKTsKLSAgCi0gIHdoaWxlIChwbnQgPCBzdHJlYW0gKyBzaXplIC0gMikgewotICAgIHR5cGUgPSAqcG50OwotICAgIGxlbmd0aCA9ICoocG50KzEpOwotICAgIHBudCArPSAyOwotICAgIHZhbHVlX2xlbiA9IDA7Ci0gICAgaWYgKCBwbnQgKyBsZW5ndGggPiBzdHJlYW0gKyBzaXplICkgewotICAgICAgemxvZ193YXJuICgiSVNJUy1UTFYgKCVzKTogVExWICh0eXBlICVkLCBsZW5ndGggJWQpIGV4Y2VlZHMgcGFja2V0ICIKLQkJICJib3VuZGFyaWVzIiwgYXJlYXRhZywgdHlwZSwgbGVuZ3RoKTsKLSAgICAgIHJldHZhbCA9IElTSVNfV0FSTklORzsKLSAgICAgIGJyZWFrOwotICAgIH0KLSAgICBzd2l0Y2ggKHR5cGUpIHsKLSAgICBjYXNlIEFSRUFfQUREUkVTU0VTOgotICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBBZGRyZXNzIExlbmd0aCAgICAgICAgICAgICAgICAgICAgICAgICB8IAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgQXJlYSBBZGRyZXNzICAgICAgICAgICAgICAgICAgICAgICAgICB8IAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6Ci0gICAgICAgKi8KLSAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0FSRUFfQUREUlM7CisKKyAgd2hpbGUgKHBudCA8IHN0cmVhbSArIHNpemUgLSAyKQorICAgIHsKKyAgICAgIHR5cGUgPSAqcG50OworICAgICAgbGVuZ3RoID0gKihwbnQgKyAxKTsKKyAgICAgIHBudCArPSAyOworICAgICAgdmFsdWVfbGVuID0gMDsKKyAgICAgIGlmIChwbnQgKyBsZW5ndGggPiBzdHJlYW0gKyBzaXplKQorCXsKKwkgIHpsb2dfd2FybiAoIklTSVMtVExWICglcyk6IFRMViAodHlwZSAlZCwgbGVuZ3RoICVkKSBleGNlZWRzIHBhY2tldCAiCisJCSAgICAgImJvdW5kYXJpZXMiLCBhcmVhdGFnLCB0eXBlLCBsZW5ndGgpOworCSAgcmV0dmFsID0gSVNJU19XQVJOSU5HOworCSAgYnJlYWs7CisJfQorICAgICAgc3dpdGNoICh0eXBlKQorCXsKKwljYXNlIEFSRUFfQUREUkVTU0VTOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBBZGRyZXNzIExlbmd0aCAgICAgICAgICAgICAgICAgICAgICAgICB8IAorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgQXJlYSBBZGRyZXNzICAgICAgICAgICAgICAgICAgICAgICAgICB8IAorCSAgICogKy0tLS0t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ICAgICAgICAgICAgICAgICAgICAgICAgIHwgCi0gICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICovCi0gICAgICAgIHZpcnR1YWwgPSAqcG50OyAvKiBGSVhNRTogd2hhdCBpcyB0aGUgdXNlIGZvciB0aGlzPyAqLwotICAgICAgICBwbnQrKzsKLSAgICAgICAgdmFsdWVfbGVuICsrOwotICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAwICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVmYXVsdCBNZXRyaWMgICAgICAgICAgICAgICAgICB8IAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVsYXkgTWV0cmljICAgICAgICAgICAgICAgICAgICB8Ci0gICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBFeHBlbnNlIE1ldHJpYyAgICAgICAgICAgICAgICAgIHwKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEVycm9yIE1ldHJpYyAgICAgICAgICAgICAgICAgICAgfAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBOZWlnaGJvdXIgSUQgICAgICAgICAgICAgICAgICAgICAgICAgICB8Ci0gICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwotICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKLSAgICAgICAqLwotICAgICAgICB3aGlsZSAobGVuZ3RoID4gdmFsdWVfbGVuKSB7Ci0gICAgICAgICAgaXNfbmVpID0gKHN0cnVjdCBpc19uZWlnaCopcG50OwotICAgICAgICAgIHZhbHVlX2xlbiArPSA0ICsgSVNJU19TWVNfSURfTEVOICsgMTsKLSAgICAgICAgICBwbnQgKz0gNCArIElTSVNfU1lTX0lEX0xFTiArIDE7Ci0gICAgICAgICAgaWYgKCF0bHZzLT5pc19uZWlnaHMpIHRsdnMtPmlzX25laWdocyA9IGxpc3RfbmV3ICgpOwotICAgICAgICAgIGxpc3Rub2RlX2FkZCAodGx2cy0+aXNfbmVpZ2hzLCBpc19uZWkpOwotICAgICAgICB9Ci0gICAgICB9IGVsc2UgewotICAgICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgfQotICAgICAgYnJlYWs7CisJICBpZiAoVExWRkxBR19JU19ORUlHSFMgJiAqZXhwZWN0ZWQpCisJICAgIHsKKwkgICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBWaXJ0dWFsIEZsYWcgICAgICAgICAgICAgICAgICAgICAgICAgICB8IAorCSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgICAgICovCisJICAgICAgdmlydHVhbCA9ICpwbnQ7CS8qIEZJWE1FOiB3aGF0IGlzIHRoZSB1c2UgZm9yIHRoaXM/ICovCisJICAgICAgcG50Kys7CisJICAgICAgdmFsdWVfbGVuKys7CisJICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAgICAgKiB8ICAgMCAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIERlZmF1bHQgTWV0cmljICAgICAgICAgICAgICAgICAgfCAKKwkgICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVsYXkgTWV0cmljICAgICAgICAgICAgICAgICAgICB8CisJICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAgICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEV4cGVuc2UgTWV0cmljICAgICAgICAgICAgICAgICAgfAorCSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgICAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBFcnJvciBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwKKwkgICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBOZWlnaGJvdXIgSUQgICAgICAgICAgICAgICAgICAgICAgICAgICB8CisJICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKKwkgICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgorCSAgICAgICAqLworCSAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pCisJCXsKKwkJICBpc19uZWkgPSAoc3RydWN0IGlzX25laWdoICopIHBudDsKKwkJICB2YWx1ZV9sZW4gKz0gNCArIElTSVNfU1lTX0lEX0xFTiArIDE7CisJCSAgcG50ICs9IDQgKyBJU0lTX1NZU19JRF9MRU4gKyAxOworCQkgIGlmICghdGx2cy0+aXNfbmVpZ2hzKQorCQkgICAgdGx2cy0+aXNfbmVpZ2hzID0gbGlzdF9uZXcgKCk7CisJCSAgbGlzdG5vZGVfYWRkICh0bHZzLT5pc19uZWlnaHMsIGlzX25laSk7CisJCX0KKwkgICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgcG50ICs9IGxlbmd0aDsKKwkgICAgfQorCSAgYnJlYWs7CiAKLSAgICBjYXNlIFRFX0lTX05FSUdIQk9VUlM6Ci0gICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIE5laWdoYm91ciBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNwotICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBURSBNZXRyaWMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDMKLSAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCi0gICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgU3ViVExWcyBMZW5ndGggICAgICAgICAgICAgICAgICAgICAgICAgfCAxCi0gICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwotICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKLSAgICAgICAqLwotICAgICAgKmZvdW5kIHw9IFRMVkZMQUdfVEVfSVNfTkVJR0hTOworCWNhc2UgVEVfSVNfTkVJR0hCT1VSUzoKKwkgIC8qICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgTmVpZ2hib3VyIElEICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA3CisJICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIFRFIE1ldHJpYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMworCSAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBTdWJUTFZzIExlbmd0aCAgICAgICAgICAgICAgICA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AgICAgICAgICAgICAgICAgIHwgCi0gICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWxheSBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEV4cGVuc2UgTWV0cmljICAgICAgICAgICAgICAgICAgfAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXJyb3IgTWV0cmljICAgICAgICAgICAgICAgICAgICB8Ci0gICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIE5laWdoYm91ciBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKLSAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCi0gICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgTmVpZ2hib3VyIElEICAgICAgICAgICAgICAgICAgICAgICAgICAgfAotICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKLSAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6Ci0gICAgICAgKi8KKwljYXNlIEVTX05FSUdIQk9VUlM6CisJICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgIDAgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgIHwgCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWxheSBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEV4cGVuc2UgTWV0cmljICAgICAgICAgICAgICAgICAgfAorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXJyb3IgTWV0cmljICAgICAgICAgICAgICAgICAgICB8CisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIE5laWdoYm91ciBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKKwkgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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Ci0gICAgICAgICAgcG50ICs9IEVUSF9BTEVOOwotICAgICAgICB9Ci0gICAgICB9IGVsc2UgewotICAgICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgfQotICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlIFBBRERJTkc6CisJY2FzZSBMQU5fTkVJR0hCT1VSUzoKKwkgIC8qICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgTEFOIEFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgorCSAgICovCisJICAqZm91bmQgfD0gVExWRkxBR19MQU5fTkVJR0hTOwogI2lmZGVmIEVYVFJFTUVfVExWX0RFQlVHCi0gICAgICB6bG9nX2luZm8gKCJUTFYgcGFkZGluZyAlZCIsIGxlbmd0aCk7CisJICB6bG9nX2luZm8gKCJJU0lTLVRMViAoJXMpOiBMQU4gTmVpZ2JvdXJzIGxlbmd0aCAlZCIsCisJCSAgICAgYXJlYXRhZywgbGVuZ3RoKTsKICNlbmRpZiAvKiBFWFRSRU1FX1RMVl9ERUJVRyAqLwotICAgICAgcG50ICs9IGxlbmd0aDsKLSAgICAgIGJyZWFrOworCSAgaWYgKFRMVkZMQUdfTEFOX05FSUdIUyAmICpleHBlY3RlZCkKKwkgICAgeworCSAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pCisJCXsKKwkJICBsYW5fbmVpID0gKHN0cnVjdCBsYW5fbmVpZ2ggKikgcG50OworCQkgIGlmICghdGx2cy0+bGFuX25laWdocykKKwkJICAgIHRsdnMtPmxhbl9uZWlnaHMgPSBsaXN0X25ldyAoKTsKKwkJICBsaXN0bm9kZV9hZGQgKHRsdnMtPmxhbl9uZWlnaHMsIGxhbl9uZWkpOworCQkgIHZhbHVlX2xlbiArPSBFVEhfQUxFTjsKKwkJICBwbnQgKz0gRVRIX0FMRU47CisJCX0KKwkgICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgcG50ICs9IGxlbmd0aDsKKwkgICAgfQorCSAgYnJlYWs7CiAKLSAgICBjYXNlIExTUF9FTlRSSUVTOgotICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICBSZW1haW5pbmcgTGlmZXRpbWUgICAgICAgICAgICAgICAgICAgICAgICB8IDIKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgIExTUCBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBpZCsyCi0gICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICBMU1AgU2VxdWVuY2UgTnVtYmVyICAgICAgICAgICAgICAgICAgICAgICAgIHygNAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBDaGVja3N1bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDIKLSAgIC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0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAxNiBiaXQgZmxldGNoZXIgQ0hFQ0tTVU0gICAgICAgICAgICAgICAgICAgIHwKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgotICAgICAgICovCi0gICAgICAqZm91bmQgfD0gVExWRkxBR19DSEVDS1NVTTsKKwljYXNlIExTUF9FTlRSSUVTOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICBSZW1haW5pbmcgTGlmZXRpbWUgICAgICAgICAgICAgICAgICAgICAgICB8IDIKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgIExTUCBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBpZCsyCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICBMU1AgU2VxdWVuY2UgTnVtYmVyICAgICAgICAgICAgICAgICAgICAgICAgIHygNAorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBD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ICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgcG50ICs9IGxlbmd0aDsKKwkgICAgfQorCSAgYnJlYWs7CiAKLSAgICBjYXNlIFBST1RPQ09MU19TVVBQT1JURUQ6Ci0gICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgTkxQSUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgotICAgICAgICovCi0gICAgICAqZm91bmQgfD0gVExWRkxBR19OTFBJRDsKKwljYXNlIENIRUNLU1VNOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgMTYgYml0IGZsZXRjaGVyIENIRUNLU1VNICAgICAgICAgICAgICAgICAgICB8CisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKKwkgICAqLworCSAgKmZvdW5kIHw9IFRMVkZMQUdfQ0hFQ0tTVU07CiAjaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKLSAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IFByb3RvY29scyBTdXBwb3J0ZWQgbGVuZ3RoICVkIiwKLQkJIGFyZWF0YWcsCi0JCSBsZW5ndGgpOworCSAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogQ2hlY2tzdW0gbGVuZ3RoICVkIiwgYXJlYXRhZywgbGVuZ3RoKTsKICNlbmRpZiAvKiBFWFRSRU1FX1RMVl9ERUJVRyAqLwotICAgICAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfTkxQSUQpIHsKLSAgICAgICAgdGx2cy0+bmxwaWRzID0gKHN0cnVjdCBubHBpZHMqKShwbnQtMSk7Ci0gICAgICB9Ci0gICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgYnJlYWs7CisJICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19DSEVDS1NVTSkKKwkgICAgeworCSAgICAgIHRsdnMtPmNoZWNrc3VtID0gKHN0cnVjdCBjaGVja3N1bSAqKSBwbnQ7CisJICAgIH0KKwkgIHBudCArPSBsZW5ndGg7CisJICBicmVhazsKIAotICAgIGNhc2UgSVBWNF9BRERSOgotICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqICsgICAgICAgICAgICAgICAgIElQIHZlcnNpb24gNCBhZGRyZXNzICAgICAgICAgICAgICAgICAgICAgICAgICArIDQKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgotICAgICAgICovCi0gICAgICAqZm91bmQgfD0gVExWRkxBR19JUFY0X0FERFI7CisJY2FzZSBQUk9UT0NPTFNfU1VQUE9SVEVEOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgIE5MUElEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8CisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKKwkgICAqLworCSAgKmZvdW5kIHw9IFRMVkZMQUdfTkxQSUQ7CiAjaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKLSAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IElQdjQgQWRkcmVzcyBsZW5ndGggJWQiLAotCQkgYXJlYXRhZywKLQkJIGxlbmd0aCk7CisJICB6bG9nX2luZm8gKCJJU0lTLVRMViAoJXMpOiBQcm90b2NvbHMgU3VwcG9ydGVkIGxlbmd0aCAlZCIsCisJCSAgICAgYXJlYXRhZywgbGVuZ3RoKTsKICNlbmRpZiAvKiBFWFRSRU1FX1RMVl9ERUJVRyAqLwotICAgICAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfSVBWNF9BRERSKSB7Ci0gICAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pIHsKLSAgICAgICAgICBpcHY0X2FkZHIgPSAoc3RydWN0IGluX2FkZHIqKXBudDsKLQkgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcykgOiBJUCBBRERSICVzLCBwbnQgJXAiLCBhcmVhdGFnLCAKLQkJICAgICBpbmV0X250b2EgKCppcHY0X2FkZHIpLCBwbnQpOwotICAgICAgICAgIGlmICghdGx2cy0+aXB2NF9hZGRycykgdGx2cy0+aXB2NF9hZGRycyA9IGxpc3RfbmV3KCk7Ci0gICAgICAgICAgbGlzdG5vZGVfYWRkICh0bHZzLT5pcHY0X2FkZHJzLCBpcHY0X2FkZHIpOwotICAgICAgICAgIHZhbHVlX2xlbiArPSA0OwotICAgICAgICAgIHBudCArPSA0OwotICAgICAgICB9Ci0gICAgICB9IGVsc2UgewotICAgICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgfQotICAgICAgYnJlYWs7CisJICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19OTFBJRCkKKwkgICAgeworCSAgICAgIHRsdnMtPm5scGlkcyA9IChzdHJ1Y3QgbmxwaWRzICopIChwbnQgLSAxKTsKKwkgICAgfQorCSAgcG50ICs9IGxlbmd0aDsKKwkgIGJyZWFrOwogCi0gICAgY2FzZSBBVVRIX0lORk86Ci0gICAgICAqZm91bmQgfD0gVExWRkxBR19BVVRIX0lORk87CisJY2FzZSBJUFY0X0FERFI6CisJICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogKyAgICAgICAgICAgICAgICAgSVAgdmVyc2lvbiA0IGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICsgNAorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6CisJICAgKi8KKwkgICpmb3VuZCB8PSBUTFZGTEFHX0lQVjRfQUREUjsKICNpZmRlZiBFWFRSRU1FX1RMVl9ERUJVRwotICAgICAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogSVMtSVMgQXV0aGVudGljYXRpb24gSW5mb3JtYXRpb24iLAotCQkgYXJlYXRhZyk7CisJICB6bG9nX2luZm8gKCJJU0lTLVRMViAoJXMpOiBJUHY0IEFkZHJlc3MgbGVuZ3RoICVkIiwKKwkJICAgICBhc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gICAgICAgICAgIHwgMQotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXhwZW5zZSBNZXRyaWMgICAgICAgICAgICAgICAgICB8IDEKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEVycm9yIE1ldHJpYyAgICAgICAgICAgICAgICAgICAgfCAxCi0gICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIGlwIGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNAotICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBhZGRyZXNzIG1hc2sgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDQKLSAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCi0gICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgotICAgICAgICovCi0gICAgICAqZm91bmQgfD0gVExWRkxBR19JUFY0X0lOVF9SRUFDSEFCSUxJVFk7CisJY2FzZSBJUFY0X0lOVF9SRUFDSEFCSUxJVFk6CisJICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgIDAgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgIHwgMQorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVsYXkgTWV0cmljICAgICAgICAgICAgICAgICAgICB8IDEKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEV4cGVuc2UgTWV0cmljICAgICAgICAgICAgICAgICAgfCAxCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBFcnJvciBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwgMQorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBpcCBhZGRyZXNzICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDQKKwkgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgYWRkcmVzcy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LSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBFeHBlbnNlIE1ldHJpYyAgICAgICAgICAgICAgICAgIHwgMQotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXJyb3IgTWV0cmljICAgICAgICAgICAgICAgICAgICB8IDEKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgaXAgYWRkcmVzcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA0Ci0gICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIGFkZHJlc3MgbWFzayAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNAotICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKLSAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6Ci0gICAgICAgKi8KLSAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0lQVjRfRVhUX1JFQUNIQUJJTElUWTsKKwljYXNlIElQVjRfRVhUX1JFQUNIQUJJTElUWToKKwkgIC8qICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgMCAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIERlZmF1bHQgTWV0cmljICAgICAgICAgICAgICAgICAgfCAxCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWxheSBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwgMQorCSAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXhwZW5zZSBNZXRyaWMgICAgICAgICAgICAgICAgICB8IDEKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEVycm9yIE1ldHJpYyAgICAgICAgICAgICAgICAgICAgfCAxCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIGlwIGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNAorCSAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBhZGRyZXNzIG1hc2sgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDQKKwkgICAqICstLS0tLS0tLS0tLS0tLS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AgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgIFByZWZpeCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMC00Ci0gICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgICBzdWIgdGx2cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKLSAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCi0gICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgotICAgICAgICovCi0gICAgICAqZm91bmQgfD0gVExWRkxBR19URV9JUFY0X1JFQUNIQUJJTElUWTsKKwljYXNlIFRFX0lQVjRfUkVBQ0hBQklMSVRZOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBURSBNZXRyaWMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDQKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICBVL0QgIHwgc1RMVj8gfCAgICAgICAgICAgICAgIFByZWZpeCBNYXNrIExlbiAgICAgICAgICAgICAgICAgfCAxCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgIFByZWZpeCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMC00CisJICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICAgICAgICBzdWIgdGx2cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKKwkgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCisJICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgorCSAgICovCisJICAqZm91bmQgfD0gVExWRkxBR19URV9JUFY0X1JFQUNIQUJJTElUWTsKICNpZmRlZiBFWFRSRU1FX1RMVl9ERUJVRwotICAgICAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogSVB2NCBleHRlbmRlZCBSZWFjaGFiaWxpdHkgbGVuZ3RoICVkIiwKLQkJIGFyZWF0YWcsCi0JCSBsZW5ndGgpOworCSAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogSVB2NCBleHRlbmRlZCBSZWFjaGFiaWxpdHkgbGVuZ3RoICVkIiwKKwkJICAgICBhcmVhdGFnLCBsZW5ndGgpOwogI2VuZGlmIC8qIEVYVFJFTUVfVExWX0RFQlVHICovCi0gICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19URV9JUFY0X1JFQUNIQUJJTElUWSkgewotICAgICAgICB3aGlsZSAobGVuZ3RoID4gdmFsdWVfbGVuKSB7Ci0gICAgICAgICAgdGVfaXB2NF9yZWFjaCA9IChzdHJ1Y3QgdGVfaXB2NF9yZWFjaGFiaWxpdHkqKXBudDsKLSAgICAgICAgICBpZiAoIXRsdnMtPnRlX2lwdjRfcmVhY2hzKSB0bHZzLT50ZV9pcHY0X3JlYWNocyA9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ibGUgc2luY2Ugbm8gc3VidGx2cyBhcmUgZGVmaW5lZCAqLworCQkgIHZhbHVlX2xlbiArPSA1ICsgKCh0ZV9pcHY0X3JlYWNoLT5jb250cm9sICYgMHgzRikgPworCQkJCSAgICAoKCgodGVfaXB2NF9yZWFjaC0+Y29udHJvbCAmIDB4M0YpIC0KKwkJCQkgICAgICAgMSkgPj4gMykgKyAxKSA6IDApOworCQkgIHBudCArPSA1ICsgKCh0ZV9pcHY0X3JlYWNoLT5jb250cm9sICYgMHgzRikgPworCQkgICAgICAgICAgICAgICgoKCh0ZV9pcHY0X3JlYWNoLT5jb250cm9sICYgMHgzRikgLSAxKSA+PiAzKSArIDEpIDogMCk7CisJCX0KKwkgICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgcG50ICs9IGxlbmd0aDsKKwkgICAgfQorCSAgYnJlYWs7CiAKICNpZmRlZiAgSEFWRV9JUFY2Ci0gICAgY2FzZSBJUFY2X0FERFI6Ci0gICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogKyAgICAgICAgICAgICAgICAgSVAgdmVyc2lvbiA2IGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICsgMTYKLSAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgotICAgICAgICovCi0gICAgICAqZm91bmQgfD0gVExWRkxBR19JUFY2X0FERFI7CisJY2FzZSBJUFY2X0FERFI6CisJICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogKyAgICAgICAgICAgICAgICAgSVAgdmVyc2lvbiA2IGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICsgMTYKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgorCSAgICovCisJICAqZm91bmQgfD0gVExWRkxBR19JUFY2X0FERFI7CiAjaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKLSAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IElQdjYgQWRkcmVzcyBsZW5ndGggJWQiLAotCQkgYXJlYXRhZywKLQkJIGxlbmd0aCk7CisJICB6bG9nX2luZm8gKCJJU0lTLVRMViAoJXMpOiBJUHY2IEFkZHJlc3MgbGVuZ3RoICVkIiwKKwkJICAgICBhcmVhdGFnLCBsZW5ndGgpOwogI2VuZGlmIC8qIEVYVFJFTUVfVExWX0RFQlVHICovCi0gICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19JUFY2X0FERFIpIHsKLSAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewotICAgICAgICAgIGlwdjZfYWRkciA9IChzdHJ1Y3QgaW42X2FkZHIqKXBudDsKLSAgICAgICAgICBpZiAoIXRsdnMtPmlwdjZfYWRkcnMpIHRsdnMtPmlwdjZfYWRkcnMgPSBsaXN0X25ldygpOwotICAgICAgICAgIGxpc3Rub2RlX2FkZCAodGx2cy0+aXB2Nl9hZGRycywgaXB2Nl9hZGRyKTsKLSAgICAgICAgICB2YWx1ZV9sZW4gKz0gMTY7Ci0gICAgICAgICAgcG50ICs9IDE2OwotICAgICAgICB9Ci0gICAgICB9IGVsc2UgewotICAgICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgfQotICAgICAgYnJlYWs7CisJICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19JUFY2X0FERFIpCisJICAgIHsKKwkgICAgICB3aGlsZSAobGVuZ3RoID4gdmFsdWVfbGVuKQorCQl7CisJCSAgaXB2Nl9hZGRyID0gKHN0cnVjdCBpbjZfYWRkciAqKSBwbnQ7CisJCSAgaWYgKCF0bHZzLT5pcHY2X2FkZHJzKQorCQkgICAgdGx2cy0+aXB2Nl9hZGRycyA9IGxpc3RfbmV3ICgpOworCQkgIGxpc3Rub2RlX2FkZCAodGx2cy0+aXB2Nl9hZGRycywgaXB2Nl9hZGRyKTsKKwkJICB2YWx1ZV9sZW4gKz0gMTY7CisJCSAgcG50ICs9IDE2OworCQl9CisJICAgIH0KKwkgIGVsc2UKKwkgICAgeworCSAgICAgIHBudCArPSBsZW5ndGg7CisJICAgIH0KKwkgIGJyZWFrOwogCi0gICAgY2FzZSBJUFY2X1JFQUNIQUJJTElUWToKLSAgICAgIC8qICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCi0gICAgICAgKiB8ICAgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA0IAotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBDb250cm9sIEluZm9ybWFudGlvbiAgICAgICAgICAgICAgICAgICB8Ci0gICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIElQdjYgUHJlZml4IExlbmd0aCAgICAgICAgICAgICAgICAgICAgIHwtLSsKLSAg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VRZOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgIERlZmF1bHQgTWV0cmljICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDQgCisJICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIENvbnRyb2wgSW5mb3JtYW50aW9uICAgICAgICAgICAgICAgICAgIHwKKwkgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgSVB2NiBQcmVmaXggTGVuZ3RoICAgICAgICAgICAgICAgICAgICAgfC0tKworCSAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsgIHwKKwkgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBJUHY2IFByZWZpeCAgICAgICAgICAgICAgICAgICAgICAgICAgICB8PC0rCisJICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICovCisJICAqZm91bmQgfD0gVExWRkxBR19JUFY2X1JFQUNIQUJJTElUWTsKKwkgIGlmICgqZXhwZWN0ZWQgJiBUTFZGTEFHX0lQVjZfUkVBQ0hBQklMSVRZKQorCSAgICB7CisJICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikKKwkJeworCQkgIGlwdjZfcmVhY2ggPSAoc3RydWN0IGlwdjZfcmVhY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bSBJRCAoSWYga25vd24pICAgICAgICAgICAgICAgIHwgMC04Ci0gICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHByb2JhYmx5IDYpCi0gICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwotICAgICAgICogfCAgICAgICAgICAgICAgICAgIE5laWdoYm9yIExvY2FsIENpcmN1aXQgSUQgKElmIGtub3duKSAgICAgICAgIHwgNAotICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKLSAgICAgICAqLwotICAgICAgKmZvdW5kIHw9IFRMVkZMQUdfM1dBWV9IRUxMTzsKLSAgICAgIGlmICgqZXhwZWN0ZWQgJiBUTFZGTEFHXzNXQVlfSEVMTE8pIHsKLSAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewotICAgICAgICAvKiBGSVhNRTogbWFrZSB0aGlzIHdvcmsgKi8KKwljYXNlIFdBWTNfSEVMTE86CisJICAvKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICAgIEFkamFjZW5jeSBzdGF0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMQorCSAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICAgICAgICAgICBFeHRlbmRlZCBMb2NhbCBDaXJjdWl0IElEICAgICAgICAgICAgICAgICAgICB8IDQKKwkgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgTmVpZ2hib3IgU3lzdGVtIElEIChJZiBrbm93bikgICAgICAgICAgICAgICAgfCAwLTgKKwkgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHJvYmFibHkgNikKKwkgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgTmVpZ2hib3IgTG9jYWwgQ2lyY3VpdCBJRCAoSWYga25vd24pICAgICAgICAgfCA0CisJICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICovCisJICAqZm91bmQgfD0gVExWRkxBR18zV0FZX0hFTExPOworCSAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfM1dBWV9IRUxMTykKKwkgICAgeworCSAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pCisJCXsKKwkJICAvKiBGSVhNRTogbWFrZSB0aGlzIHdvcmsgKi8KIC8qICAgICAgICAgICBBZGphY2VuY3kgU3RhdGUgKG9uZSBvY3RldCk6CiAgICAgICAgICAgICAgIDAgPSBVcAogICAgICAgICAgICAgICAxID0gSW5pdGlhbGl6aW5nCkBAIC02NDQsNTYgKzcwNyw1OCBAQAogICAgICAgICAgICAgTmVpZ2hib3IgU3lzdGVtIElEIGlmIGtub3duICh6ZXJvIHRvIGVpZ2h0IG9jdGV0cykKICAgICAgICAgICAgIE5laWdoYm9yIEV4dGVuZGVkIExvY2FsIENpcmN1aXQgSUQgKGZvdXIgb2N0ZXRzLCBpZiBOZWlnaGJvcgogICAgICAgICAgICAgICBTeXN0ZW0gSUQgaXMgcHJlc2VudCkgKi8KLSAgICAgICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgICB9Ci0gICAgICB9IGVsc2UgewotICAgICAgICBwbnQgKz0gbGVuZ3RoOwotICAgICAgfQorCQkgIHBudCArPSBsZW5ndGg7CisJCX0KKwkgICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgcG50ICs9IGxlbmd0aDsKKwkgICAgfQogCi0gICAgICBicmVhazsKLSAgICBjYXNlIEdSQUNFRlVMX1JFU1RBUlQ6Ci0gICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwotICAgICAgICogfCAgICAgICAgIFJlc2VydmVkICAgICAgICAgICAgICAgICAgICAgIHwgIFNBICAgfCAgUkEgICB8ICBSUiAgIHwgMQotICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKLSAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgIFJlbWFpbmluZyBUaW1lICAgICAgICAgICAgICAgICAgICAgICB8IDIKLSAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCi0gICAgICAgKiB8ICAgICAgICAgICAgICAgIFJlc3RhcnRpbmcgTmVpZ2hib3IgSUQgKElmIGtub3duKSAgICAgICAgICAgICAgfCAwLTgKLSAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCi0gICAgICAgKi8KLSAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0dSQUNFRlVMX1JFU1RBUlQ7Ci0gICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19HUkFDRUZVTF9SRVNUQVJUKSB7Ci0gICAgICAgIC8qIEZJWE1FOiBtYWtlIHRoaXMgd29yayAqLwotICAgICAgfQotICAgICAgcG50ICs9IGxlbmd0aDsKLSAgICAgIGJyZWFrOworCSAgYnJlYWs7CisJY2FzZSBHUkFDRUZVTF9SRVNUQVJUOgorCSAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKKwkgICAqIHwgICAgICAgICBSZXNlcnZlZCAgICAgICAgICAgICAgICAgICAgICB8ICBTQSAgIHwgIFJBICAgfCAgUlIgICB8IDEKKwkgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCisJICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICBSZW1haW5pbmcgVGltZSAgICAgICAgICAgICAgICAgICAgICAgfCAyCisJICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICogfCAgICAgICAgICAgICAgICBSZXN0YXJ0aW5nIE5laWdoYm9yIElEIChJZiBrbm93bikgICAgICAgICAgICAgIHwgMC04CisJICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCSAgICovCisJICAqZm91bmQgfD0gVExWRkxBR19HUkFDRUZVTF9SRVNUQVJUOworCSAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfR1JBQ0VGVUxfUkVTVEFSVCkKKwkgICAgeworCSAgICAgIC8qIEZJWE1FOiBtYWtlIHRoaXMgd29yayAqLworCSAgICB9CisJICBwbnQgKz0gbGVuZ3RoOworCSAgYnJlYWs7CiAKLSAgICBkZWZhdWx0OgotICAgICAgemxvZ193YXJ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0aGVhZCAoaXB2NF9yZWFjaHMpOyBub2RlOyBuZXh0bm9kZSAobm9kZSkpCisgICAgeworICAgICAgcmVhY2ggPSBnZXRkYXRhIChub2RlKTsKKyAgICAgIGlmIChwb3MgLSB2YWx1ZSArIElQVjRfUkVBQ0hfTEVOID4gMjU1KQorCXsKKwkgIHJldHZhbCA9CisJICAgIGFkZF90bHYgKElQVjRfSU5UX1JFQUNIQUJJTElUWSwgcG9zIC0gdmFsdWUsIHZhbHVlLCBzdHJlYW0pOworCSAgaWYgKHJldHZhbCAhPSBJU0lTX09LKQorCSAgICByZXR1cm4gcmV0dmFsOworCSAgcG9zID0gdmFsdWU7CisJfQorICAgICAgKnBvcyA9IHJlYWNoLT5tZXRyaWNzLm1ldHJpY19kZWZhdWx0OworICAgICAgcG9zKys7CisgICAgICAqcG9zID0gcmVhY2gtPm1ldHJpY3MubWV0cmljX2RlbGF5OworICAgICAgcG9zKys7CisgICAgICAqcG9zID0gcmVhY2gtPm1ldHJpY3MubWV0cmljX2V4cGVuc2U7CisgICAgICBwb3MrKzsKKyAgICAgICpwb3MgPSByZWFjaC0+bWV0cmljcy5tZXRyaWNfZXJyb3I7CisgICAgICBwb3MrKzsKKyAgICAgICoodV9pbnQzMl90ICopIHBvcyA9IHJlYWNoLT5wcmVmaXguc19hZGRyOworICAgICAgcG9zICs9IElQVjRfTUFYX0JZVEVMRU47CisgICAgICAqKHVfaW50MzJfdCAqKSBwb3MgPSByZWFjaC0+bWFzay5zX2FkZHI7CisgICAgICBwb3MgKz0gSVBWNF9NQVhfQllURUxFTjsKICAgICB9Ci0gICAgKnBvcyA9IHJlYWNoLT5tZXRyaWNzLm1ldHJpY19kZWZhdWx0OwotICAgIHBvcyArKzsgICAgCi0gICAgKnBvcyA9IHJlYWNoLT5tZXRyaWNzLm1ldHJpY19kZWxheTsKLSAgICBwb3MgKys7ICAgIAotICAgICpwb3MgPSByZWFjaC0+bWV0cmljcy5tZXRyaWNfZXhwZW5zZTsKLSAgICBwb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