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ZSA8bGludXgva3RocmVhZC5oPgojaW5jbHVkZSA8bWFjaC9pb21hcC5oPgoKI2lmbmRlZiBDT05GSUdfU1lTVEVNX0NBUAojaW5jbHVkZSA8bGludXgvcHJvY19mcy5oPgojaW5jbHVkZSA8bGludXgvc3RyaW5nLmg+CiNpbmNsdWRlIDxsaW51eC9zZXFfZmlsZS5oPgojZW5kaWYKCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgILrqtqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiNpZiBkZWZpbmVkKF9PU19UT1MpCiMgZGVmaW5lIE9TX1NUQVRJU1RJQ19JUkFNX0JBU0UgICAgKElSQU1fQkFTRV9BRERSX09TX1NUQVRJU1RJQ19QU0NQVSkKIyBkZWZpbmUgT1NfU1RBVElTVElDX1RJTUUgICAgICAgICB6RHJ2VGltZXJfU3RhbXAoKQojZWxpZiBkZWZpbmVkKF9PU19MSU5VWCkKIyBkZWZpbmUgT1NfU1RBVElTVElDX0lSQU1fQkFTRSAgICBnX3p4aWNfdHJhY2VfYXBjcHVfYWRkciAvLyhJUkFNX0JBU0VfQUREUl9PU19TVEFUSVNUSUNfQVBDUFUpCiMgZGVmaW5lIE9TX1NUQVRJU1RJQ19USU1FICAgICAgICAgKGNwdV9jbG9jaygwKT4+MTApCiNlbHNlCiMgZXJyb3IgInVua25vd24gb3MiCiNlbmRpZgoKI2RlZmluZSBPU19JUkFNX1NUQVRJU1RJQ19DTlQgICAgICAgICg4KQojZGVmaW5lIE9TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOICAgKDE2KQojZGVmaW5lIE9TX0REUl9TVEFUSVNUSUNfQ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X3N0YXRpc3RpY19jaGVjaygpICAgICAgICooKHZvbGF0aWxlIHVuc2lnbmVkIGxvbmcgKilPU19TVEFUSVNUSUNfSVJBTV9CQVNFKQojZGVmaW5lIG9zX3N0YXRpc3RpY19lbmFibGVkKCkgICAgIGdfb3Nfc3RhdGlzdGljX2VuYWJsZSAKCiNpZm5kZWYgQ09ORklHX1NZU1RFTV9DQVAKI2RlZmluZSBLRVJORUxfTDFXX0lSQU1fTE9HX0RST1AgICAoSVJBTV9CQVNFX0FERFJfTE9HX0RST1BfVFJBQ0UpCiNkZWZpbmUgS0VSTkVMX0wxbF9JUkFNX0xPR19EUk9QICAgKEtFUk5FTF9MMVdfSVJBTV9MT0dfRFJPUCArIHNpemVvZihUX0xvZ0lyYW1fUmVjb3JkKSkKI2VuZGlmCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMr9vt294bm5tqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCnR5cGVkZWYgdm9sYXRpbGUgc3RydWN0IHsKICAgIHVuc2lnbmVkIGludCBlbmFibGU7CiAgICB1bnNpZ25lZCBpbnQgY250OwogICAgdW5zaWduZWQgaW50IGluZGV4OwogICAgc3RydWN0IHsKICAgICAgICB1bnNpZ25lZCBjaGFyIG5hbWVbT1NfSVJBTV9TVEFUSVNUSUNfTkFNRV9MRU5dOwogICAgICAgIHVuc2lnbmVkIGludCBkYXRhMjsKICAgIH0gc3RhdGlzdGljc1tPU19JUkFNX1NUQVRJU1RJQ19DTlRdOwp9dF9vc19pcmFtX3RocmVhZF9zdGF0aXN0aWM7Cgp0eXBlZGVmIHZvbGF0aWxlIHN0cnVjdCB7CiAgICB1bnNpZ25lZCBpbnQgY250OwogICAgdW5zaWduZWQgaW50IGluZGV4OwogICAgc3RydWN0IHsKICAgICAgICB1bnNpZ25lZCBpbnQgZGF0YTE7CiAgICAgICAgdW5zaWduZWQgaW50IGRhdGEyOwogICAgfSBzdGF0aXN0aWNzW09TX0lSQU1fU1RBVElTVElDX0NOVF07Cn10X29zX2lyYW1fc3RhdGlzdGljOwoKdHlwZWRlZiBzdHJ1Y3QgewogICAgdW5zaWduZWQgaW50IGNudDsKICAgIHVuc2lnbmVkIGludCBpbmRleDsKICAgIHN0cnVjdCB7CiAgICAgICAgdW5zaWduZWQgaW50IGRhdGExOwogICAgICAgIHVuc2lnbmVkIGludCBkYXRhMjsKICAgIH0gc3RhdGlzdGljc1tPU19ERFJfU1RBVElTVElDX0NOVF07Cn10X29zX2Rkcl9zdGF0aXN0aWM7CgojaWZuZGVmIENPTkZJR19TWVNURU1fQ0FQCnR5cGVkZWYgc3RydWN0IAp7Cgl1bnNpZ25lZCBpbnQgbm9fbG9jazsKCXVuc2lnbmVkIGludCBub19tZW07Cn1UX0xvZ0lyYW1fUmVjb3JkOwojZW5kaWYKCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMirvtax5MG/ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiNpZiBkZWZpbmVkKF9PU19MSU5VWCkKc3RhdGljIGNoYXIgKmdfenhpY190cmFjZV9hcGNwdV9hZGRyOwojZW5kaWYKCnN0YXRpYyBpbnQgZ19vc19zdGF0aXN0aWNfZW5hYmxlOwpzdGF0aWMgdW5zaWduZWQgaW50IGdfb3Nfc3RhdGlzdGljX2NudDsKCnN0YXRpYy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pYyAqZ19vc19kZHJfZHNyX3N0YXJ0X3N0YXRpc3RpYzsKc3RhdGljIHRfb3NfZGRyX3N0YXRpc3RpYyAqZ19vc19kZHJfZHNyX2VuZF9zdGF0aXN0aWM7CiNlbGlmIGRlZmluZWQoX09TX0xJTlVYKQpzdGF0aWMgdF9vc19kZHJfc3RhdGlzdGljICpnX29zX2Rkcl9zb2Z0aXJxX3N0YXJ0X3N0YXRpc3RpYzsKc3RhdGljIHRfb3NfZGRyX3N0YXRpc3RpYyAqZ19vc19kZHJfc29mdGlycV9lbmRfc3RhdGlzdGljOwpzdGF0aWMgdF9vc19kZHJfc3RhdGlzdGljICpnX29zX2Rkcl90aW1lcl9zdGFydF9zdGF0aXN0aWM7CnN0YXRpYyB0X29zX2Rkcl9zdGF0aXN0aWMgKmdfb3NfZGRyX3RpbWVyX2VuZF9zdGF0aXN0aWM7CiNlbmRpZgoKI2lmbmRlZiBDT05GSUdfU1lTVEVNX0NBUApUX0xvZ0lyYW1fUmVjb3JkICpnTDF3X0xvZ01pc3NQb2ludCA9IChUX0xvZ0lyYW1fUmVjb3JkICopS0VSTkVMX0wxV19JUkFNX0xPR19EUk9QOwpUX0xvZ0lyYW1fUmVjb3JkICpnTDExX0xvZ01pc3NQb2ludCA9IChUX0xvZ0lyYW1fUmVjb3JkICopS0VSTkVMX0wxbF9JUkFNX0xPR19EUk9QOwojZW5kaWYKCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMirvta6r8r9yfnD9yAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCnZvaWQgb3Nfc3RhdGlzdGljX2VuYWJsZSh2b2lkKTsKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgvtayv7qvyv0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiC5psTcw+jK9jogICAgILnsvKPNs7zGtb1JUkFNCiogss7K/cu1w/c6ICAgICAKKiAgICi0q8jrss7K/SkgIGlyYW1fYWRkcjogtdjWtyAKICAgICAgICAgICAgICAgIGRhdGE6ICAgICAgysK8/s/uCiAgICAgICAgICAgICAgICB0aW1lOiAgICAgIMqxvOQKKiAgICi0q7P2ss7K/SkgIHZvaWQKKiC3tSC72CDWtTogICAgIHZvaWQKKiDG5Mv8y7XD9zogICAgIM7eCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCnN0YXRpYyBpbmxpbmUgdm9pZCBvc19zdGF0aXN0aWNfaW5faXJhbSh2b2xhdGlsZSB2b2lkICppcmFtX2FkZHIsIHZvaWQgKmRhdGEsIHVuc2lnbmVkIGxvbmcgdGltZSkKewogICAgdW5zaWduZWQgbG9uZyAgICAgICBpbmRleDsKICAgIHRfb3NfaXJhbV9zdGF0aXN0aWMgKmlyYW07CgogICAgaXJhbSA9ICh0X29zX2lyYW1fc3RhdGlzdGljICopaXJhbV9hZGRyOwogICAgCiAgICBpbmRleCA9IGlyYW0tPmluZGV4OwogICAgaWYoaW5kZXggPj0gT1NfSVJBTV9TVEFUSVNUSUNfQ05UKQogICAgewogICAgICAgIGluZGV4ID0gMDsKICAgIH0KCiAgICBpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5kYXRhMSA9ICh1bnNpZ25lZCBpbnQpZGF0YTsKICAgIGlyYW0tPnN0YXRpc3RpY3NbaW5kZXhdLmRhdGEyID0gdGltZTsKICAgIGluZGV4Kys7CgogICAgaXJhbS0+aW5kZXggPSBpbmRleDsKICAgIGlyYW0tPmNudCA9IGdfb3Nfc3RhdGlzdGljX2NudDsKfQoKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiC5psTcw+jK9jogICAgIM/fs8y57LyjzbO8xrW9SVJBTQoqILLOyv3LtcP3OiAgICAgCiogICAotKvI67LOyv0pICBpcmFtX2FkZHI6ILXY1rcgCiAgICAgICAgICAgICAgICBkYXRhOiAgICAgIMrCvP7P7gogICAgICAgICAgICAgICAgdGltZTogICAgICDKsbzkCiogICAotKuz9rLOyv0pICB2b2lkCiogt7Ugu9gg1rU6ICAgICB2b2lkCiogxuTL/Mu1w/c6ICAgICDO3goqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpzdGF0aWMgaW5saW5lIHZvaWQgb3Nfc3RhdGlzdGljX3RocmVhZF9pbl9pcmFtKHZvbGF0aWxlIHZvaWQgKmlyYW1fYWRkciwgdm9pZCAqZGF0YSwgdW5zaWduZWQgbG9uZyB0aW1lKQp7CiAgICB1bnNpZ25lZCBsb25nICAgICAgICAgICAgICBpbmRleDsKICAgIHRfb3NfaXJhbV90aHJlYWRfc3RhdGlzdGljICppcmFtOwoKICAgIGlyYW0gPSAodF9vc19pcmFtX3RocmVhZF9zdGF0aXN0aWMgKilpcmFtX2FkZHI7CiAgICAKICAgIGluZGV4ID0gaXJhbS0+aW5kZXg7CiAgICBpZihpbmRleCA+PSBPU19JUkFNX1NUQVRJU1RJQ19DTlQpCiAgICB7CiAgICAgICAgaW5kZXggPSAwOwogICAgfQoKICAgICNpZiBkZWZpbmVkKF9PU19UT1MpCiAgICBzdHJuY3B5KChjaGFyICopKGlyYW0tPnN0YXRpc3RpY3NbaW5kZXhdLm5hbWUpLCBjeWdfdGhyZWFkX2dldF9uYW1lKChjeWdfaGFuZGxlX3QpZGF0YSksIE9TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOIC0gMSk7CiAgICAjZWxpZiBkZWZpbmVkKF9PU19MSU5VWCkKICAgIHN0cm5jcHkoKGNoYXIgKikoaXJhbS0+c3RhdGlzdGljc1tpbmRleF0ubmFtZSksICgoc3RydWN0IHRhc2tfc3RydWN0ICopZGF0YSktPmNvbW0sIE9TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOIC0gMSk7CiAgICAjZWxzZQogICAgIyBlcnJvciAidW5rb3duIG9zIgogICAgI2VuZGlmCiAgICBpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5uYW1lW09TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOIC0gMV0gPSAwOwogICAgaXJhbS0+c3RhdGlzdGljc1tpbmRleF0uZGF0YTIgPSB0aW1lOwogICAgaW5kZXgrKzsKCiAgICBpcmFtLT5pbmRleCA9IGluZGV4OwogICAgaXJhbS0+Y250ID0gZ19vc19zdGF0aXN0aWNfY250Owp9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqILmmxNzD6Mr2OiAgICAguey8o82zvMa1vUREUgoqILLOyv3LtcP3OiAgICAgCiogICAotKvI67LOyv0pICBpcmFtX2FkZHI6ILXY1rcgCiAgICAgICAgICAgICAgICBkYXRhOiAgICAgIMrCvP7P7gogICAgICAgICAgICAgICAgdGltZTogICAgICDKsbzkCiogICAotKuz9rLOyv0pICB2b2lkCiogt7Ugu9gg1rU6ICAgICB2b2lkCiogxuTL/Mu1w/c6ICAgICDO3goqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpzdGF0aWMgaW5saW5lIHZvaWQgb3Nfc3RhdGlzdGljX2luX2Rkcih2b2lkICpkZHJfYWRkciwgdm9pZCAqZGF0YSwgdW5zaWduZWQgbG9uZyB0aW1lKQp7CiAgICB1bnNpZ25lZCBsb25nICAgICAgICAgICAgICBpbmRleDsKICAgIHRfb3NfZGRyX3N0YXRpc3RpYyAgICAgICAgICpkZHI7CgogICAgZGRyICA9ICh0X29zX2Rkcl9zdGF0aXN0aWMgKilkZHJfYWRkcjsKICAgIAogICAgaW5kZXggPSBkZHItPmluZGV4OwogICAgaWYgKGluZGV4ID49IE9TX0REUl9TVEFUSVNUSUNfQ05UKQogICAgewogICAgICAgIGluZGV4ID0gMDsKICAgIH0KICAgIGRkci0+c3RhdGlzdGljc1tpbmRleF0uZGF0YTEgPSAodW5zaWduZWQgaW50KWRhdGE7CiAgICBkZHItPnN0YXRpc3RpY3NbaW5kZXhdLmRhdGEyID0gdGltZTsKICAgIGluZGV4Kys7CgogICAgZGRyLT5pbmRleCA9IGluZGV4OwogICAgZGRyLT5jbnQgPSBnX29zX3N0YXRpc3RpY19jbnQ7Cn0KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCioguabE3MPoyvY6ICAgICC57LyjzbO8xrW9RERSCiogss7K/cu1w/c6ICAgICAKKiAgICi0q8jrss7K/SkgIGlyYW1fYWRkcjogtdjWtyAKICAgICAgICAgICAgICAgIGRhdGE6ICAgICAgysK8/s/uCiAgICAgICAgICAgICAgICB0aW1lOiAgICAgIMqxvOQKKiAgICi0q7P2ss7K/SkgIHZvaWQKKiC3tSC72CDWtTogICAgIHZvaWQKKiDG5Mv8y7XD9zogICAgIM7eCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCnN0YXRpYyBpbmxpbmUgdm9pZCBvc19zdGF0aXN0aWNfaW5mb191cGRhdGUodm9pZCkKewogICAgZ19vc19zdGF0aXN0aWNfY250Kys7Cn0KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCioguabE3MPoyvY6ICAgICC2qMqxxve72LX3ubPX0woqILLOyv3LtcP3OiAgICAgCiogICAotKvI67LOyv0pICAKKiAgICi0q7P2ss7K/SkgIHZvaWQKKiC3tSC72CDWtTogICAgIHZvaWQKKiDG5Mv8y7XD9zogICAgIM7eCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCnN0YXRpYyBpbnQgb3Nfc3RhdGlzdGljX2RlbGF5ZWRfd29ya190aW1lcl9mbih1bnNpZ25lZCBsb25nIGRhdGEpCnsKCWludCBzZWMgPSAwOwoJbXNsZWVwKDIwMDAwKTsKICAgIHdoaWxlKCFvc19zdGF0aXN0aWNfY2hlY2soKSkKCXsKCQkvL7Osuf00MHOjrNaxvdPNy7P2CgkJaWYoc2VjID49IDQpCgkJCXJldHVybjsKCQltc2xlZXAoMTAwMDApOwoJCXNlYysrOwoJfQoJb3Nfc3RhdGlzdGljX2VuYWJsZSgpOwoJcmV0dXJuIDA7Cn0KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDIq77Wuq/K/cq1z9YgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCioguabE3MPoyvY6ICAgICC57LyjzbO8xrP1yry7rwoqILLOyv3LtcP3OiAgICAgCiogICAotKvI67LOyv0pICB2b2lkCiogICAotKuz9rLOyv0pICB2b2lkCiogt7Ugu9gg1rU6ICAgICB2b2lkCiogxuTL/Mu1w/c6ICAgICBwc7rLtffTwwoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwp2b2lkIG9zX3N0YXRpc3RpY19pbml0KHZvaWQpCnsKICAgIG1lbXNldCgodm9pZCAqKUlSQU1fQkFTRV9BRERSX0xJTlVYX1NUQVRJU1RJQywgMHgwLCBJUkFNX0JBU0VfTEVOX0xJTlVYX1NUQVRJU1RJQyk7Cn0KRVhQT1JUX1NZTUJPTChvc19zdGF0aXN0aWNfaW5pdCk7CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqILmmxNzD6Mr2OiAgICAgyrnE3LnsvKPNs7zGuabE3AoqILLOyv3LtcP3OiAgICAgCiogICAotKvI67LOyv0pICBhZGRyZXNzOiC8x8K8tb1JUkFN1tC1xLXY1rcgCiAgICAgICAgICAgICAgICBzaXplOiAgICBJUkFNv9W85LTz0KEKKiAgICi0q7P2ss7K/SkgIHZvaWQKKiC3tSC72CDWtTogICAgIHZvaWQKKiDG5Mv8y7XD9zogICAgIM7eCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCnZvaWQgb3Nfc3RhdGlzdGljX2VuYWJsZSh2b2lkKQp7CiNpZiBkZWZpbmVkKF9PU19UT1MpCiAgICBnX29zX2lyYW1fc3dhcGluX3N0YXRpc3RpYyAgICAgICAgPSAodF9vc19p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ucyAtZXJybm8sIG9yIDAgZm9yIHN1Y2Nlc3MuCiAqLwpzdGF0aWMgY29uc3Qgc3RydWN0IGZpbGVfb3BlcmF0aW9ucyAga2VybmVsX2xvZ190cmFja2VyX3Byb2NfZm9wcyA9IHsKCS5vcGVuCQk9IGtlcm5lbF9sb2dfdHJhY2tlcl9vcGVuLAoJLnJlYWQJCT0gc2VxX3JlYWQsCgkud3JpdGUJCT0gTlVMTAp9OwoKI2VuZGlmCgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqILmmxNzD6Mr2OiAgICAguey8o82zvMa1vUREUgoqILLOyv3LtcP3OiAgICAgCiogICAotKvI67LOyv0pICBpcmFtX2FkZHI6ILXY1rcgCiAgICAgICAgICAgICAgICBkYXRhOiAgICAgIMrCvP7P7gogICAgICAgICAgICAgICAgdGltZTogICAgICDKsbzkCiogICAotKuz9rLOyv0pICB2b2lkCiogt7Ugu9gg1rU6ICAgICB2b2lkCiogxuTL/Mu1w/c6ICAgICDO3goqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwppbnQgX19pbml0IHp4aWNfZW5hYmxlX3RyYWNlKHZvaWQpCnsKCXN0cnVjdCB0aW1lcl9saXN0IHRpbWVyOwoJc3RydWN0IHRhc2tfc3RydWN0ICp0YXNrOwoKCSNpZmRlZiBJUkFNX0JBU0VfQUREUl9WQQoJZ196eGljX3RyYWNlX2FwY3B1X2FkZHIgPSBJUkFNX0JBU0VfQUREUl9MSU5VWF9TVEFUSVNUSUNfQVBDUFU7CgkjZWxzZQoKCWdfenhpY190cmFjZV9hcGNwdV9hZGRyID0gaW9yZW1hcChJUkFNX0JBU0VfQUREUl9MSU5VWF9TVEFUSVNUSUNfQVBDUFUsIElSQU1fQkFTRV9MRU5fTElOVVhfU1RBVElTVElDX0FQQ1BV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