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iBYUkNCID0gICAgICAgICAgICAgICAgIDB4MzQKICoKICogTWVtb3J5IENsayBmb3IgbW9zdCBtb2RlcyA+NTBNSHo6CiAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICogRnZjbyA9IDE0LjMxOCAqIDU4IC8gNSA9IDE2Nk1IegogKiBGb3V0ID0gMTY2TUh6IC8gMiAgICAgID0gODNNSHoKICogUG9zdCBEaXZpc29yID0gMgogKiBYUkNDID0gKE0gLSAyKSA9IDU3ICA9IDB4MzgKICogWFJDRCA9IChOIC0gMikgPSAzICAgPSAweDAzCiAqIFhSQ0UgPSAgICAgICAgICAgICAgICAgMHg5MAogKgogKiBOb3RlIEJpdDcgZW5hYmxlcyB0aGUgY2xvY2sgc291cmNlIGZyb20gdGhlIFZDTwogKgogKi8KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqIENoaXBzIHN0cnVjdAogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8Kc3RydWN0IGN0ZmJfY2hpcHNfcHJvcGVydGllcyB7CglpbnQgZGV2aWNlX2lkOwkJLyogUENJIERldmljZSBJRCAqLwoJdW5zaWduZWQgbG9uZyBtYXhfbWVtOwkvKiBtZW1vcnkgZm9yIGZyYW1lIGJ1ZmZlciAqLwoJaW50IHZsZF9zZXQ7CQkvKiB2YWx1ZSBvZiBWTEQgaWYgYml0MiBpbiBjbG9jayBjb250cm9sIGlzIHNldCAqLwoJaW50IHZsZF9ub3Rfc2V0OwkvKiB2YWx1ZSBvZiBWTEQgaWYgYml0MiBpbiBjbG9jayBjb250cm9sIGlzIHNldCAqLwoJaW50IG1uX2RpZmY7CQkvKiBkaWZmZXJlbmNlIGJldHdlZW4gTS9OIFZhbHVlICsgbW5fZGlmZiA9IE0vTiBSZWdpc3RlciAqLwoJaW50IG1uX21p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44IChwR0QtPmlzYUJhc2UgKyBDVF9TVEFUVVNfUkVHMV9PKTsKCglyZXR1cm4gKGluOCAocEdELT5pc2FCYXNlICsgaW5kZXgpKTsKfQojZW5kaWYKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKgoqIFdyaXRlIENUIElTQSByZWdpc3RlcgoqLwpzdGF0aWMgdm9pZApjdFdyaXRlICh1bnNpZ25lZCBzaG9ydCBpbmRleCwgdW5zaWduZWQgY2hhciB2YWwpCnsKCUdyYXBoaWNEZXZpY2UgKnBHRCA9IChHcmFwaGljRGV2aWNlICopICYgY3RmYjsKCglvdXQ4ICgocEdELT5pc2FCYXNlICsgaW5kZXgpLCB2YWwpOwp9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqCiogUmVhZCBDVCBJU0EgcmVnaXN0ZXIgaW5kZXhlZAoqLwpzdGF0aWMgdW5zaWduZWQgY2hhcgpjdFJlYWRfaSAodW5zaWduZWQgc2hvcnQgaW5kZXgsIGNoYXIgcmVnKQp7CglHcmFwaGljRGV2aWNlICpwR0QgPSAoR3JhcGhpY0RldmljZSAqKSAmIGN0ZmI7CglpZiAoaW5kZXggPT0gQ1RfQVJfTykKCQkvKiBzeW5jaCB0aGUgRmxpcCBGbG9wICovCgkJaW44IChwR0QtPmlzYUJhc2UgKyBDVF9TVEFUVVNfUkVHMV9PKTsKCW91dDggKChwR0QtPmlzYUJhc2UgKyBpbmRleCksIHJlZyk7CglyZXR1cm4gKGluOCAocEdELT5pc2FCYXNlICsgaW5kZXggKyAxKSk7Cn0KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCioKKiBXcml0ZSBDVCBJU0EgcmVnaXN0ZXIgaW5k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tLS0tLSsgICstLS0tLS0tLS0tLS0tLS0tLS0tKyAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rICArLS0rCiB8IFJFRkNMSyAgfF9ffE5UU0MgRGl2aXNvciBTZWxlY3R8X198RlZDTyBSZWZlcmVuY2UgRGl2aXNvcnxfX3z3TnxfXwogfCAxNC4zTUh6IHwgIHwoTlRTQ0RTKSAo9zEsIPc1KSAgfCAgfFNlbGVjdCAoUkRTKSAo9zEsIPc0KSB8ICB8ICB8ICB8CiArLS0tLS0tLS0tKyAgKy0tLS0tLS0tLS0tLS0tLS0tLS0rICArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsgICstLSsgIHwKICBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19ffAogfAogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ2Y28gICAgICAgICAgICAgICAgICAgICAgZm91dAogfCArLS0tLS0tLS0rICArLS0tLS0tLS0tLS0tKyAgKy0tLS0tKyAgICAgKy0tLS0tLS0tLS0tLS0tLS0tLS0rICAgKy0tLS0rCiArLXwgUGhhc2UgIHxfX3xDaGFyZ2UgUHVtcCB8X198IFZDTyB8X19fX198UG9zdCBEaXZpc29yIChQRCkgIHxfX198Q0xLIHwtLS0+CiArLXwgRGV0ZWN0IHwgIHwmIEZpbHRlciBWQ098ICB8ICAgICB8ICB8ICB89zEsIDIsIDQsIDgsIDE2LCAzMnwgICB8ICAgIHwKIHwgKy0tLS0tLS0tKyAgKy0tLS0tLS0tLS0tLSsgICstLS0tLSsgIHwgICstLS0tLS0tLS0tLS0tLS0tLS0tKyAgICstLS0tKwogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAogfCAgICArLS0rICAgKy0tLS0tLS0tLS0tLS0tLSsgICAgICAgICAgfAogfF9fX1989018X19ffFZDTyBMb29wIERpdmlkZXxfX19fX19fX19ffAogICAgICB8ICB8ICAgfChWTEQpKPc0LCD3MTYpIHwKICAgICAgKy0tKyAgICstLS0tLS0tLS0tLS0tLS0rCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICB0aGF0IGlzIHRoZSBoYXJkd2FyZSA+PSA2OTAwMCB3ZSBoYXZlIHRvIG1hbmFnZQogKy0tLS0tLS0tLSsgICstLSsKIHwgUkVGQ0xLICB8X1989058X18KIHwgMTQuM01IeiB8ICB8ICB8ICB8CiArLS0tLS0tLS0tKyAgKy0tKyAgfAogIF9fX19fX19fX19fX19fX19fX3wKIHwKIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdmNvICAgICAgICAgICAgICAgICAgICAgIGZvdXQKIHwgKy0tLS0tLS0tKyAgKy0tLS0tLS0tLS0tLSsgICstLS0tLSsgICAgICstLS0tLS0tLS0tLS0tLS0tLS0tKyAgICstLS0tKwogKy18IFBoYXNlICB8X198Q2hhcmdlIFB1bXAgfF9ffCBWQ08gfF9fX19ffFBvc3QgRGl2aXNvciAoUEQpICB8X19ffENMSyB8LS0tPgogKy18IERldGVjdCB8ICB8JiBGaWx0ZXIgVkNPfCAgfCAgICAgfCAgfCAgfPcxLCAyLCA0LCA4LCAxNiwgMzJ8ICAgfCAgICB8CiB8ICstLS0tLS0tLSsgICstLS0tLS0tLS0tLS0rICArLS0tLS0rICB8ICArLS0tLS0tLS0tLS0tLS0tLS0tLSsgICArLS0tLSsKIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKIHwgICAgKy0tKyAgICstLS0tLS0tLS0tLS0tLS0rICAgICAgICAgIHwKIHxfX19ffPdNfF9fX3xWQ08gTG9vcCBEaXZpZGV8X19fX19fX19fX3wKICAgICAgfCAgfCAgIHwoVkxEKSj3MSwg9zQpICB8CiAgICAgICstLSsgICArLS0tLS0tLS0tLS0tLS0tKwoKCiovCgojZGVmaW5lIFZJREVPX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