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JCSAiYm91bmRhcmllcyIsIGFyZWF0YWcsIHR5cGUsIGxlbmd0aCk7CiAgICAgIHJldHZhbCA9IElTSVNfV0FSTklORzsKICAgICAgYnJlYWs7CiAgICB9CiAgICBzd2l0Y2ggKHR5cGUpIHsKICAgIGNhc2UgQVJFQV9BRERSRVNTRVM6CiAgICAgIC8qICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBBZGRyZXNzIExlbmd0aCAgICAgICAgICAgICAgICAgICAgICAgICB8IAogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgIEFyZWEgQWRkcmVzcyAgICAgICAgICAgICAgICAgICAgICAgICAgfCAKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKICAgICAgICovCiAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0FSRUFfQUREUlM7CiNpZmRlZiBFWFRSRU1FX1RMVl9ERUJVRwogICAgICB6bG9nX2luZm8gKCJUTFYgQXJlYSBBZHJlc3NlcyBsZW4gJWQiLCBsZW5ndGgpOwojZW5kaWYgLyogRVhUUkVNRV9UTFZfREVCVUcgKi8KICAgICAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfQVJFQV9BRERSUykgewogICAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pIHsKICAgICAgICAgIGFyZWFfYWRkciA9IChzdHJ1Y3QgYXJlY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gICAgIHBudCsrOwogICAgICAgIHZhbHVlX2xlbiArKzsKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgIDAgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgIHwgCiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVsYXkgTWV0cmljICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXhwZW5zZSBNZXRyaWMgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXJyb3IgTWV0cmljICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBOZWlnaGJvdXIgSUQgICAgICAgICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6CiAgICAgICAqLwogICAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pIHsKICAgICAgICAgIGlzX25laSA9IChzdHJ1Y3QgaXNfbmVpZ2gqKXBudDsKICAgICAgICAgIHZhbHVlX2xlbiArPSA0ICsgSVNJU19TWVNfSURfTEVOICsgMTsKICAgICAgICAgIHBudCArPSA0ICsgSVNJU19TWVNfSURfTEVOICsgMTsKICAgICAgICAgIGlmICghdGx2cy0+aXNfbmVpZ2hzKSB0bHZzLT5pc19uZWlnaHMgPSBsaXN0X25ldyAoKTsKICAgICAgICAgIGxpc3Rub2RlX2FkZCAodGx2cy0+aXNfbmVpZ2hzLCBpc19uZWkpOwogICAgICAgIH0KICAgICAgfSBlbHNlIHsKICAgICAgICBwbnQgKz0gbGVuZ3RoOwogICAgICB9CiAgICAgIGJyZWFrOwoKICAgIGNhc2UgVEVfSVNfTkVJR0hCT1VSUzoKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIE5laWdoYm91ciBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNwogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgVEUgTWV0cmljICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAzCiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBTdWJUTFZzIExlbmd0aCAgICAgICAgICAgICAgICAgICAgICAgICB8IDEKICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKICAgICAgICovCiAgICAgICpmb3VuZCB8PSBUTFZGTEFHX1RFX0lTX05FSUdIUzsKI2lmZGVmIEVYVFJFTUVfVExWX0RFQlVHCiAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IEV4dGVuZGVkIElTIE5laWdoYm91cnMgbGVuZ3RoICVkIiwKCQkgYXJlYXRhZywKCQkgbGVuZ3RoKTsKI2VuZGlmIC8qIEVYVFJFTUVfVExWX0RFQlVHICovCiAgICAgIGlmIChUTFZGTEFHX1RFX0lTX05FSUdIUyAmICpleHBlY3RlZCkgewogICAgICAgIHdoaWxlIChsZW5ndGggPiB2YWx1ZV9sZW4pIHsKICAgICAgICAgIHRlX2lzX25laSA9IChzdHJ1Y3QgdGVfaXNfbmVpZ2gqKXBudDsKICAgICAgICAgIHZhbHVlX2xlbiArPSAxMTsKICAgICAgICAgIHBudCArPSAxMTsKICAgICAgICAgIC8qIEZJWE1FIC0gc3VidGx2cyBhcmUgaGFuZGxlZCBoZXJlLCBmb3Igbm93IHdlIHNraXAgKi8KICAgICAgICAgIHZhbHVlX2xlbiArPSB0ZV9pc19uZWktPnN1Yl90bHZzX2xlbmd0aDsKICAgICAgICAgIHBudCArPSB0ZV9pc19uZWktPnN1Yl90bHZzX2xlbmd0aDsKCgogICAgICAgICAgaWYgKCF0bHZzLT50ZV9pc19uZWlnaHMpIHRsdnMtPnRlX2lzX25laWdocyA9IGxpc3RfbmV3ICgpOwogICAgICAgICAgbGlzdG5vZGVfYWRkICh0bHZzLT50ZV9pc19uZWlnaHMsIHRlX2lzX25laSk7CiAgICAgICAgfQogICAgICB9IGVsc2UgewogICAgICAgIHBudCArPSBsZW5ndGg7CiAgICAgIH0KICAgICAgYnJlYWs7CgogICAgY2FzZSBFU19ORUlHSEJPVVJTOiAKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgIDAgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgIHwgCiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVsYXkgTWV0cmljICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXhwZW5zZSBNZXRyaWMgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXJyb3IgTWV0cmljICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBOZWlnaGJvdXIgSUQgICAgICAgICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBOZWlnaGJvdXIgSUQgICAgICAgICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6CiAgICAgICAqLwojaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKICAgICAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogRVMgTmVpZ2hib3VycyBsZW5ndGggJWQiLAoJCSBhcmVhdGFnLAoJCSBsZW5ndGgpOwojZW5kaWYgLyogRVhUUkVNRV9UTFZfREVCVUcgKi8KICAgICAgKmZvdW5kIHw9IFRMVkZMQUdfRVNfTkVJR0hTOwogICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19FU19ORUlHSFMpIHsKICAgICAgICBlc19uZWkgPSAoc3RydWN0IGVzX25laWdoKilwbnQ7CiAgICAgICAgdmFsdWVfbGVuICs9IDQ7CiAgICAgICAgcG50ICs9IDQ7CiAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewogICAgICAgIC8qIEZJWE1FIEZJWE1FIEZJWE1FIC0gYWRkIHRvIHRoZSBsaXN0ICovCgkvKiAgICAgICAgICBzeXNfaWQtPmlkID0gcG50OyovCiAgICAgICAgICB2YWx1ZV9sZW4gKz0gSVNJU19TWVNfSURfTEVOOwogICAgICAgICAgcG50ICs9IElTSVNfU1lTX0lEX0xFTjsKICAgICAgICAvKiAgaWYgKCFlc19uZWktPm5laWdoX2lkcykgZXNfbmVpLT5uZWlnaF9pZHMgPSBzeXNpZDsqLwogICAgICAgIH0KICAgICAgICBpZiAoIXRsdnMtPmVzX25laWdocykgdGx2cy0+ZXNfbmVpZ2hzID0gbGlzdF9uZXcgKCk7CiAgICAgICAgbGlzdG5vZGVfYWRkICh0bHZzLT5lc19uZWlnaHMsIGVzX25laSk7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgcG50ICs9IGxlbmd0aDsKICAgICAgfQogICAgICBicmVhazsKCiAgICBjYXNlIExBTl9ORUlHSEJPVVJTOgogICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgTEFOIEFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKICAgICAgICovCiAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0xBTl9ORUlHSFM7CiAgICAgICNpZmRlZiBFWFRSRU1FX1RMVl9ERUJVRwogICAgICB6bG9nX2luZm8gKCJJU0lTLVRMViAoJXMpOiBMQU4gTmVpZ2JvdXJzIGxlbmd0aCAlZCIsCgkJIGFyZWF0YWcsCgkJIGxlbmd0aCk7CiAgICAgICNlbmRpZiAvKiBFWFRSRU1FX1RMVl9ERUJVRyAqLwogICAgICBpZiAoVExWRkxBR19MQU5fTkVJR0hTICYgKmV4cGVjdGVkKSB7CiAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewogICAgICAgICAgbGFuX25laSA9IChzdHJ1Y3QgbGFuX25laWdoKilwbnQ7CiAgICAgICAgICBpZiAoIXRsdnMtPmxhbl9uZWlnaHMpIHRsdnMtPmxhbl9uZWlnaHMgPSBsaXN0X25ldyAoKTsKICAgICAgICAgIGxpc3Rub2RlX2FkZCAodGx2cy0+bGFuX25laWdocywgbGFuX25laSk7CiAgICAgICAgICB2YWx1ZV9sZW4gKz0gRVRIX0FMRU47CiAgICAgICAgICBwbnQgKz0gRVRIX0FMRU47CiAgICAgICAgfQogICAgICB9IGVsc2UgewogICAgICAgIHBudCArPSBsZW5ndGg7CiAgICAgIH0KICAgICAgYnJlYWs7CgogICAgY2FzZSBQQURESU5HOgojaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKICAgICAgemxvZ19pbmZvICgiVExWIHBhZGRpbmcgJWQiLCBsZW5ndGgpOwojZW5kaWYgLyogRVhUUkVNRV9UTFZfREVCVUcgKi8KICAgICAgcG50ICs9IGxlbmd0aDsKICAgICAgYnJlYWs7CgogICAgY2FzZSBMU1BfRU5UUklFUzoKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgIFJlbWFpbmluZyBMaWZldGltZSAgICAgICAgICAgICAgICAgICAgICAgIHwgMgogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgIExTUCBJRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBpZCsyCiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgTFNQIFNlcXVlbmNlIE51bWJlciAgICAgICAgICAgICAgICAgICAgICAgICB8oDQKICAgICAgICogKy0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0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgMTYgYml0IGZsZXRjaGVyIENIRUNLU1VNICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6CiAgICAgICAqLwogICAgICAqZm91bmQgfD0gVExWRkxBR19DSEVDS1NVTTsKI2lmZGVmIEVYVFJFTUVfVExWX0RFQlVHCiAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IENoZWNrc3VtIGxlbmd0aCAlZCIsCgkJIGFyZWF0YWcsCgkJIGxlbmd0aCk7CiNlbmRpZiAvKiBFWFRSRU1FX1RMVl9ERUJVRyAqLwogICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19DSEVDS1NVTSkgewogICAgICAgIHRsdnMtPmNoZWNrc3VtID0gKHN0cnVjdCBjaGVja3N1bSopcG50OwogICAgICB9CiAgICAgIHBudCArPSBsZW5ndGg7CiAgICAgIGJyZWFrOwoKICAgIGNhc2UgUFJPVE9DT0xTX1NVUFBPUlRFRDoKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgTkxQSUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKICAgICAgICovCiAgICAgICpmb3VuZCB8PSBUTFZGTEFHX05MUElEOwojaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKICAgICAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogUHJvdG9jb2xzIFN1cHBvcnRlZCBsZW5ndGggJWQiLAoJCSBhcmVhdGFnLAoJCSBsZW5ndGgpOwojZW5kaWYgLyogRVhUUkVNRV9UTFZfREVCVUcgKi8KICAgICAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfTkxQSUQpIHsKICAgICAgICB0bHZzLT5ubHBpZHMgPSAoc3RydWN0IG5scGlkcyopKHBudC0xKTsKICAgICAgfQogICAgICBwbnQgKz0gbGVuZ3RoOwogICAgICBicmVhazsKCiAgICBjYXNlIElQVjRfQUREUjoKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogKyAgICAgICAgICAgICAgICAgSVAgdmVyc2lvbiA0IGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICsgNAogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOgogICAgICAgKi8KICAgICAgKmZvdW5kIHw9IFRMVkZMQUdfSVBWNF9BRERSOwojaWZkZWYgRVhUUkVNRV9UTFZfREVCVUcKICAgICAgemxvZ19pbmZvICgiSVNJUy1UTFYgKCVzKTogSVB2NCBBZGRyZXNzIGxlbmd0aCAlZCIsCgkJIGFyZWF0YWcsCgkJIGxlbmd0aCk7CiNlbmRpZiAvKiBFWFRSRU1FX1RMVl9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VfVExWX0RFQlVHICovCiAgICAgIGlmICgqZXhwZWN0ZWQgJiBUTFZGTEFHX1RFX1JPVVRFUl9JRCkgewogICAgICAgIHRsdnMtPnJvdXRlcl9pZCA9IChzdHJ1Y3QgdGVfcm91dGVyX2lkKikocG50KTsKICAgICAgfQogICAgICBwbnQgKz0gbGVuZ3RoOwogICAgICBicmVhazsKCiAgICBjYXNlIElQVjRfSU5UX1JFQUNIQUJJTElUWToKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgIDAgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgIHwgMQogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIERlbGF5IE1ldHJpYyAgICAgICAgICAgICAgICAgICAgfCAxCiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXhwZW5zZSBNZXRyaWMgICAgICAgICAgICAgICAgICB8IDEKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBFcnJvciBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwgMQogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgaXAgYWRkcmVzcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA0CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICBhZGRyZXNzIG1hc2sgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDQKICAgICAgICogKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKICAgICAgICovCiAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0lQVjRfSU5UX1JFQUNIQUJJTElUWTsKI2lmZGVmIEVYVFJFTUVfVExWX0RFQlVHCiAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IElQdjQgaW50ZXJuYWwgUmVhY2hhYmlsaXR5IGxlbmd0aCAlZCIsCgkJIGFyZWF0YWcsCgkJIGxlbmd0aCk7CiNlbmRpZiAvKiBFWFRSRU1FX1RMVl9ERUJVRyAqLwogICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR19JUFY0X0lOVF9SRUFDSEFCSUxJVFkpIHsKICAgICAgICB3aGlsZSAobGVuZ3RoID4gdmFsdWVfbGVuKSB7CiAgICAgICAgICBpcHY0X3JlYWNoID0gKHN0cnVjdCBpcHY0X3JlYWNoYWJpbGl0eSopcG50OwogICAgICAgICAgaWYgKCF0bHZzLT5pcHY0X2ludF9yZWFjaHMpIHRsdnMtPmlwdjRfaW50X3JlYWNocyA9IGxpc3RfbmV3KCk7CiAgICAgICAgICBsaXN0bm9kZV9hZGQgKHRsdnMtPmlwdjRfaW50X3JlYWNocywgaXB2NF9yZWFjaCk7CiAgICAgICAgICB2YWx1ZV9sZW4gKz0gMTI7CiAgICAgICAgICBwbnQgKz0gMTI7CiAgICAgICAgfQogICAgICB9CiAgICAgIGVsc2UgewogICAgICAgIHBudCArPSBsZW5ndGg7CiAgICAgIH0KICAgICAgYnJlYWs7CgogICAgY2FzZSBJUFY0X0VYVF9SRUFDSEFCSUxJVFk6CiAgICAgIC8qICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICAwICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRGVmYXVsdCBNZXRyaWMgICAgICAgICAgICAgICAgICB8IDEKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgIFMgICB8ICBJL0UgIHwgICAgICAgICAgICAgICBEZWxheSBNZXRyaWMgICAgICAgICAgICAgICAgICAgIHwgMQogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgUyAgIHwgIEkvRSAgfCAgICAgICAgICAgICAgIEV4cGVuc2UgTWV0cmljICAgICAgICAgICAgICAgICAgfCAxCiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgICBTICAgfCAgSS9FICB8ICAgICAgICAgICAgICAgRXJyb3IgTWV0cmljICAgICAgICAgICAgICAgICAgICB8IDEKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgIGlwIGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNAogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgYWRkcmVzcyBtYXNrICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA0CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6CiAgICAgICAqLwogICAgICAqZm91bmQgfD0gVExWRkxBR19JUFY0X0VYVF9SRUFDSEFCSUxJVFk7CiNpZmRlZiBFWFRSRU1FX1RMVl9ERUJVRwogICAgICB6bG9nX2luZm8gKCJJU0lTLVRMViAoJXMpOiBJUHY0IGV4dGVybmFsIFJlYWNoYWJpbGl0eSBsZW5ndGggJWQiLAoJCSBhcmVhdGFnLAoJCSBsZW5ndGgpOwojZW5kaWYgLyogRVhUUkVNRV9UTFZfREVCVUcgKi8KICAgICAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfSVBWNF9FWFRfUkVBQ0hBQklMSVRZKSB7CiAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewogICAgICAgICAgaXB2NF9yZWFjaCA9IChzdHJ1Y3QgaXB2NF9yZWFjaGFiaWxpdHkqKXBudDsKICAgICAgICAgIGlmICghdGx2cy0+aXB2NF9leHRfcmVhY2hzKSAKICAgICAgICAgICAgdGx2cy0+aXB2NF9leHRfcmVhY2hzID0gbGlzdF9uZXcoKTsKICAgICAgICAgIGxpc3Rub2RlX2FkZCAodGx2cy0+aXB2NF9leHRfcmVhY2hzLCBpcHY0X3JlYWNoKTsKICAgICAgICAgIHZhbHVlX2xlbiArPSAxMjsKICAgICAgICAgIHBudCArPSAxMjsKICAgICAgICB9CiAgICAgIH0KICAgICAgZWxzZSB7CiAgICAgICAgcG50ICs9IGxlbmd0aDsKICAgICAgfQogICAgICBicmVhazsKCiAgICBjYXNlIFRFX0lQVjRfUkVBQ0hBQklMSVRZOgogICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgVEUgTWV0cmljICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA0CiAgICAgICAqICstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rCiAgICAgICAqIHwgIFUvRCAgfCBzVExWPyB8ICAgICAgICAgICAgICAgUHJlZml4IE1hc2sgTGVuICAgICAgICAgICAgICAgICB8IDEKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgIFByZWZpeCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMC00CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgc3ViIHRsdnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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gtPmNvbnRyb2wgJiAweDNGKSA/IAogICAgICAgICAgICAgICAgICAgICAgKCgoKHRlX2lwdjRfcmVhY2gtPmNvbnRyb2wgJiAweDNGKS0xKT4+MykrMSkgOiAwKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZWxzZSB7CiAgICAgICAgcG50ICs9IGxlbmd0aDsKICAgICAgfQogICAgICBicmVhazsKCiNpZmRlZiAgSEFWRV9JUFY2CiAgICBjYXNlIElQVjZfQUREUjoKICAgICAgLyogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogKyAgICAgICAgICAgICAgICAgSVAgdmVyc2lvbiA2IGFkZHJlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICsgMTYKICAgICAgICogKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSsKICAgICAgICogOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoKICAgICAgICovCiAgICAgICpmb3VuZCB8PSBUTFZGTEFHX0lQVjZfQUREUjsKI2lmZGVmIEVYVFJFTUVfVExWX0RFQlVHCiAgICAgIHpsb2dfaW5mbyAoIklTSVMtVExWICglcyk6IElQdjYgQWRkcmVzcyBsZW5ndGggJWQiLAoJCSBhcmVhdGFnLAoJCSBsZW5ndGgpOwojZW5kaWYgLyogRVhUUkVNRV9UTFZfREVCVUcgKi8KICAgICAgaWYgKCpleHBlY3RlZCAmIFRMVkZMQUdfSVBWNl9BRERSKSB7CiAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewogICAgICAgICAgaXB2Nl9hZGRyID0gKHN0cnVjdCBpbjZfYWRkciopcG50OwogICAgICAgICAgaWYgKCF0bHZzLT5pcHY2X2FkZHJzKSB0bHZzLT5pcHY2X2FkZHJzID0gbGlzdF9uZXcoKTsKICAgICAgICAgIGxpc3Rub2RlX2FkZCAodGx2cy0+aXB2Nl9hZGRycywgaXB2Nl9hZGRyKTsKICAgICAgICAgIHZhbHVlX2xlbiArPSAxNjsKICAgICAgICAgIHBudCArPSAxNjsKICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgcG50ICs9IGxlbmd0aDsKICAgICAgfQogICAgICBicmVhazsKCiAgICBjYXNlIElQVjZfUkVBQ0hBQklMSVRZOgogICAgICAvKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICBEZWZhdWx0IE1ldHJpYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA0IAogICAgICAgKiArLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKy0tLS0tLS0rLS0tLS0tLSstLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgQ29udHJvbCBJbmZvcm1hbnRpb24gICAgICAgICAgICAgICAgICAgfAogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgSVB2NiBQcmVmaXggTGVuZ3RoICAgICAgICAgICAgICAgICAgICAgfC0tKwogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKyAgfAogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgICAgICAgSVB2NiBQcmVmaXggICAgICAgICAgICAgICAgICAgICAgICAgICAgfDwtKwogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0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LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgICAgICogfCAgICAgICAgICAgICAgICAgIEV4dGVuZGVkIExvY2FsIENpcmN1aXQgSUQgICAgICAgICAgICAgICAgICAgIHwgNAogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgTmVpZ2hib3IgU3lzdGVtIElEIChJZiBrbm93bikgICAgICAgICAgICAgICAgfCAwLTgKICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwcm9iYWJseSA2KQogICAgICAgKiArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgICAgKiB8ICAgICAgICAgICAgICAgICAgTmVpZ2hib3IgTG9jYWwgQ2lyY3VpdCBJRCAoSWYga25vd24pICAgICAgICAgfCA0CiAgICAgICAqICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICAgICAqLwogICAgICAqZm91bmQgfD0gVExWRkxBR18zV0FZX0hFTExPOwogICAgICBpZiAoKmV4cGVjdGVkICYgVExWRkxBR18zV0FZX0hFTExPKSB7CiAgICAgICAgd2hpbGUgKGxlbmd0aCA+IHZhbHVlX2xlbikgewogICAgICAgIC8qIEZJWE1FOiBtYWtlIHRoaXMgd29yayAqLwovKiAgICAgICAgICAgQWRqYWNlbmN5IFN0YXRlIChvbmUgb2N0ZXQpOgogICAgICAgICAgICAgIDAgPSBVcAogICAgICAgICAgICAgIDEgPSBJbml0aWFsaXppbmcKICAgICAgICAgICAgICAyID0gRG93bgogICAgICAgICAgICBFeHRlbmRlZCBMb2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