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bGRfcHVsbF9kb3duIGVycm9yXG4iKTsKK30KKworLy9leHRlcm4gaW50IHp4MjM0MjkwX3J0Y19kaXNhYmxlX3RpbWVyX2FsYXJtKCk7CitFWFBPUlRfU1lNQk9MKHp4MjM0MjkwX3BzaG9sZF9wdWxsX2Rvd24pOworCisvKioqKioqKioqKip5dXdlaSBhZGRlZCBhdCAyMDE3MDUyMyoqKioqKioqKioqKioqLwordm9pZCB6eDIzNDI5MF9wc2hvbGRfcHVsbF91cCh2b2lkKQoreworCWlmKGdwaW9fbnVtX3BzaG9sZCkKKwkJZ3Bpb19kaXJlY3Rpb25fb3V0cHV0KGdwaW9fbnVtX3BzaG9sZCwxKTsKKwllbHNlCisJCXByaW50aygiengyMzQyOTBfcHNob2xkX3B1bGxfdXAgZXJyb3JcbiIpOworfQorLyoqKioqKioqKioqKioqLworCitzdGF0aWMgaW50IHp4MjM0MjkwX3NldF9zb2Z0b24oaW50IG9uKQoreworCXU4IHJlZyA9IDA7CisgICAgaW50IHJldDsKKworICAgIHJldCA9IHp4MjM0MjkwX2kyY19yZWFkX3NpbXBsZShaWDIzNDI5MF9SRUdfQUREUl9TWVNfQ1RSTCwgJnJlZyk7CisgICAgaWYgKHJldCkgeworICAgICAgICByZXR1cm4gLUVJTzsKKyAgICB9CisKKyAgICBpZiAoKHJlZyA+PiBaWDIzNDI5MF9TT0ZUT05fTFNIKSAhPSBvbikgeworICAgICAgICByZWcgXj0gKDB4MDEgPDwgWlgyMzQyOTBfU09GVE9OX0xTSCk7CisgICAgICAgIHJldCA9IHp4MjM0MjkwX2kyY193cml0ZV9zaW1wbGUoWlgyMzQyOTBfUkVHX0FERFJfU1lTX0NUUkwsICZyZWcpOworICAgICAgICBpZiAocmV0KSB7CisgICAgICAgICAgICByZXR1cm4gLUVJTzsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiAwOworfQorc3RhdGljIGludCB6eDIzNDI5MF9zZXRfc29mdG9uX1BTTShpbnQgb24pCit7CisJdTggcmV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dGF0aWMgaW50IG10ZF9udm1lbV9yZWdfcmVhZCh2b2lkICpwcml2LCB1bnNpZ25lZCBpbnQgb2Zmc2V0LAorCQkJICAgICAgdm9pZCAqdmFsLCBzaXplX3QgYnl0ZXMpCit7CisJc3RydWN0IG10ZF9pbmZvICptdGQgPSBwcml2OworCXNpemVfdCByZXRsZW47CisJaW50IGVycjsKKworCWVyciA9IG10ZF9yZWFkKG10ZCwgb2Zmc2V0LCBieXRlcywgJnJldGxlbiwgdmFsKTsKKwlpZiAoZXJyICYmIGVyciAhPSAtRVVDTEVBTikKKwkJcmV0dXJuIGVycjsKKworCXJldHVybiByZXRsZW4gPT0gYnl0ZXMgPyAwIDogLUVJTzsKK30KKworc3RhdGljIGludCBtdGRfbnZtZW1fYWRkKHN0cnVjdCBtdGRfaW5mbyAqbXRkKQoreworCXN0cnVjdCBudm1lbV9jb25maWcgY29uZmlnID0ge307CisKKwljb25maWcuaWQgPSAtMTsKKwljb25maWcuZGV2ID0gJm10ZC0+ZGV2OworCWNvbmZpZy5uYW1lID0gZGV2X25hbWUoJm10ZC0+ZGV2KTsKKwljb25maWcub3duZXIgPSBUSElTX01PRFVMRTsKKwljb25maWcucmVnX3JlYWQgPSBtdGRfbnZtZW1fcmVnX3JlYWQ7CisJY29uZmlnLnNpemUgPSBtdGQtPnNpemU7CisJY29uZmlnLndvcmRfc2l6ZSA9IDE7CisJY29uZmlnLnN0cmlkZSA9IDE7CisJY29uZmlnLnJlYWRfb25seSA9IHRydWU7CisJY29uZmlnLnJvb3Rfb25seSA9IHRydWU7CisJY29uZmlnLm5vX29mX25vZGUgPSB0cnVlOworCWNvbmZpZy5wcml2ID0gbXRkOworCisJbXRkLT5udm1lbSA9IG52bWVtX3JlZ2lzdGVyKCZjb25maWcpOworCWlmIChJU19FUlIobXRkLT5udm1lbSkpIHsKKwkJLyogSnVzdCBpZ25vcmUgaWYgdGhlcmUgaXMgbm8gTlZNRU0gc3VwcG9ydCBpbiB0aGUga2VybmVsICovCis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ICAgICAgICAgICAgLypyZXNldCB0byBhbGFybSovCisJUkVTRVRfVE9fRVhDRVBUUkVTRVQsCisJTUFYX1JFU0VUX1RZUEUsCit9IFRfWkRydlN5c19SRVNFVF9UWVBFOworI2VuZGlmCisKK3R5cGVkZWYgZW51bSBfVF9aRHJ2UG1pY19FbmFibGV7CisgICAgUE1fRElTQUJMRSA9IDAsCisgICAgUE1fRU5BQkxFLAorICAgIFBNX0VOQUJMRV9OT1RfU1VQUE9SVCA9IC0xMDAsCisgICAgUE1fRU5BQkxFX01BWF9TVEFUVVMgPSAtMjU1Cit9IFRfWkRydlBtaWNfRW5hYmxlOworCit0eXBlZGVmIGVudW0gX1RfWkRydlBtaWNfTnJtTW9kZXsKKyAgICBQTV9OUk1NT0RFX0FVVE8gPSAwLAorICAgIFBNX05STU1PREVfUEZNLAorICAgIFBNX05STU1PREVfUFdNLAorICAgIFBNX05STU1PREVfTk9UX1NVUFBPUlQgPSAtMTAwLAorICAgIFBNX05STU1PREVfTUFYX1NUQVRVUyA9IC0yNTUKK31UX1pEcnZQbWljX05ybU1vZGU7CisKK3R5cGVkZWYgZW51bSBfVF9aRHJ2UG1pY19TbHBNb2RleworICAgIFBNX1NMUE1PREVfQVVUT19OT1JNQUwgPSAwLCAgICAvL2F1dG8gaW4gZGNkYywgbm9ybWFsIGluIGxkbworICAgIFBNX1NMUE1PREVfRUNPX05STVYsICAgICAgICAgICAvL25vcm1hbCB2b2x0YWdlCisgICAgUE1fU0xQTU9ERV9FQ09fU0xQViwgICAgICAgICAgIC8vc2xlZXAgdm9sdGFnZQorICAgIFBNX1NMUE1PREVfT0ZGLCAgICAgICAgICAgICAgICAvL09GRgorICAgIFBNX1NMUE1PREVfTk9UX1NVUFBPUlQgPSAtMTAwLAorICAgIFBNX1NMUE1PREVfTUFYX1NUQVRVUyA9IC0yNTUKK31UX1pEcnZQbWljX1NscE1vZGU7CisKKy8vY29uc3VtZXIKK3R5cGVkZWYgZW51bSBfVF9aRHJ2UG1pY19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M0MjkwX0xETzhfU0xQTU9ERV9MU0ggICAgICAgICAgCSg2KQorI2RlZmluZSBaWDIzNDI5MF9MRE85X1NMUE1PREVfTFNIICAgICAgICAgIAkoMikKKyNkZWZpbmUgWlgyMzQyOTBfTERPMTBfU0xQTU9ERV9MU0ggICAgICAgICAJKDQpCisvLyNkZWZpbmUgWlgyMzQyOTBfTERPMTFfU0xQTU9ERV9MU0ggICAgICAgICAJKDYpCisKKy8qIExETyBWT0xUQUdFIFNFTEVDVCAqLworI2RlZmluZSBaWDIzNDI5MF9MRE9fVlNFTF9XSUQgICAgICAgICAgICAgICAoNCkKKworI2RlZmluZSBaWDIzNDI5MF9MRE8xX1ZTRUxfTFNIICAgICAgICAgICAJKDApCS8qIFszOjBdCSovCisjZGVmaW5lIFpYMjM0MjkwX0xETzJfVlNFTF9MU0ggICAgICAgICAgICAgICg0KQkvKiBbNzo0XQkqLworI2RlZmluZSBaWDIzNDI5MF9MRE8zX1ZTRUxfTFNIICAgICAgICAgICAgICAoMCkKKyNkZWZpbmUgWlgyMzQyOTBfTERPNF9WU0VMX0xTSCAgICAgICAgICAgICAgKDQpCisjZGVmaW5lIFpYMjM0MjkwX0xETzVfVlNFTF9MU0ggICAgICAgICAgICAgICgwKQorI2RlZmluZSBaWDIzNDI5MF9MRE82X1ZTRUxfTFNIICAgICAgICAgICAgICAoNCkKKyNkZWZpbmUgWlgyMzQyOTBfTERPN19WU0VMX0xTSCAgICAgICAgICAgICAgKDApCisjZGVmaW5lIFpYMjM0MjkwX0xETzhfVlNFTF9MU0ggICAgICAgICAgICAgICg0KQorI2RlZmluZSBaWDIzNDI5MF9MRE85X1ZTRUxfTFNIICAgICAgICAgICAgICAoNCkKKyNkZWZpbmUgWlgyMzQyOTBfTERPMTBfVlNFTF9MU0ggICAgICAgICAgICAgKDApCisjZGVmaW5lIFpYMjM0MjkwX0xETzExX1ZTRUxfTFNIICAgICAgICAgICAgICgwKQkvKiBbMzowXQkqLworCisjZGVmaW5lIFpYMjM0MjkwX1ZPUlRDX1ZTRUxfV0lEICAgICAgICAgICAgICgyKQorI2RlZmluZSBaWDIzNDI5MF9WT1JUQ19WU0VMX0xTSCAgICAgICAgICAgICAoNCkJLyogWzVdWzRdCSovCisjZGVmaW5lIFpYMjM0MjkwX0xETzVfVlNFTF9XSUQgICAgICAgICAgICAgICgyKSAvKiBbMV1bMF0qLworCisKKy8qIExETyBTTEVFUCBWT0xUQUdFCSovCisjZGVmaW5lIFpYMjM0MjkwX0JVQ0syX1ZTRUxfV0lEICAgICAgICAgICAgICg1KQorCisjZGVmaW5lIFpYMjM0MjkwX0JVQ0syX1ZTRUxfTFNIICAgICAgICAgCSgwKQorCisjZGVmaW5lIFpYMjM0MjkwX0xETzFfU0xQX1ZTRUxfTFNIICAgCQkoMCkJLyogWzM6MF0JKi8KKyNkZWZpbmUgWlgyMzQyOTBfTERPMl9TTFBfVlNFTF9MU0ggICAgICAgICAgKDQpCS8qIFs3OjRdCSovCisjZGVmaW5lIFpYMjM0MjkwX0xETzNfU0xQX1ZTRUxfTFNIICAgICAgICAgICgwKQorI2RlZmluZSBaWDIzNDI5MF9MRE83X1NMUF9WU0VMX0xTSCAgICAgICAgICAoMCkKKyNkZWZpbmUgWlgyMzQyOTBfTERPOF9TTFBfVlNFTF9MU0ggICAgICAgICAgKDApCisjZGVmaW5lIFpYMjM0MjkwX0xETzExX1NMUF9WU0VMX0xTSCAgICAgICAgICgwKQkvKiBbMzowXQkqLworCisvKiBFTkFCTEUgMHgyMS0weDIyICovCisjZGVmaW5lIFpYMjM0MjkwX0xET1NfT05fV0lEICAgICAgICAgICAgICAgICgxKQorCisjZGVmaW5lIFpYMjM0MjkwX0xETzFfT05fTFNIICAgICAgICAgICAgICAgCSgwKQorI2RlZmluZSBaWDIzNDI5MF9MRE8yX09OX0xTSCAgICAgICAgICAgICAgICAoMSkKKyNkZWZpbmUgWlgyMzQyOTBfTERPM19PTl9MU0ggICAgICAgICAgICAgICAgKDIpCisjZGVmaW5lIFpYMjM0MjkwX0xETzRfT05fTFNIICAgICAgICAgICAgICAgICgzKQorI2RlZmluZSBaWDIzNDI5MF9MRE81X09OX0xTSCAgICAgICAgICAgICAgICAoNCkKKyNkZWZpbmUgWlgyMzQyOTBfTERPNl9PTl9MU0ggICAgICAgICAgICAgICAgKDUpCisjZGVmaW5lIFpYMjM0MjkwX0xETzdfT05fTFNIICAgICAgICAgICAgICAgICg2KQorI2RlZmluZSBaWDIzNDI5MF9MRE84X09OX0xTSCAgICAgICAgICAgICAgICAoNykKKworI2RlZmluZSBaWDIzNDI5MF9MRE85X09OX0xTSCAgICAgICAgICAgICAgICAoMSkKKyNkZWZpbmUgWlgyMzQyOTdfTERPOV9PTl9MU0ggICAgICAgICAgICAgICAgKDApCisjZGVmaW5lIFpYMjM0MjkwX0xETzEwX09OX0xTSCAgICAgICAgICAgICAgICgyKQorI2RlZmluZSBaWDIzNDI5N19MRE8xMF9PTl9MU0ggICAgICAgICAgICAgICAoMSkKKyNkZWZpbmUgWlgyMzQyOTBfQlVDSzFfT05fTFNIICAgICAgICAgICAgICAgKDQpCisjZGVmaW5lIFpYMjM0MjkwX0JVQ0syX09OX0xTSCAgICAgICAgICAgICAgICg1KQorI2RlZmluZSBaWDIzNDI5MF9CVUNLM19PTl9MU0ggICAgICAgICAgICAgICAoNikKKyNkZWZpbmUgWlgyMzQyOTBfQlVDSzRfT05fTFNIICAgICAgICAgICAgICAgKDcpCisKKy8qIExPTkcgUFJFU1NFRCBUSU1FCSovCisjZGVmaW5lIFpYMjM0MjkwX1BXUk9OX1RJTUVfTFNICQkJCSgwKQorI2RlZmluZSBaWDIzNDI5MF9QV1JPTl9USU1FX1dJRAkJCQkoMikKKyNkZWZpbmUgWlgyMzQyOTBfUFdST05fTE9OR1BSRVNTX0VOX0xTSAkJKDIpCisjZGVmaW5lIFpYMjM0MjkwX1BXUk9OX0xPTkdQUkVTU19FTl9XSUQJCSgxKQorI2RlZmluZSBaWDIzNDI5MF9QV1JPTl9MTFBfV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0gNiwKKyAgICBWTERPQ18xXzEwMCA9IDcsCisgICAgVkxET0NfMV8yMDAgPSA4LAorICAgIFZMRE9DXzFfNTAwID0gOSwKKyAgICBWTERPQ18xXzgwMCA9IDEwLAorICAgIFZMRE9DXzJfMDAwID0gMTEsCisgICAgVkxET0NfMl81MDAgPSAxMiwKKyAgICBWTERPQ18yXzgwMCA9IDEzLAorICAgIFZMRE9DXzNfMDAwID0gMTQsCisgICAgVkxET0NfM18zMDAgPSAxNSwKKworICAgIFZMRE9DX01BWAorCit9VF9aRHJ2WngyMzQyOTBfVmxkb0M7CisKKy8qIFZMRCAtIGxkbzQvNi83LzgJKi8KK3R5cGVkZWYgZW51bSBfVF9aRHJ2WngyMzQyOTBfVmxkb0QKK3sKKyAgICBWTERPRF8xXzQwMCA9IDAsCisJVkxET0RfMV81MDAgPSAxLAorCVZMRE9EXzFfNjAwID0gMiwKKwlWTERPRF8xXzgwMCA9IDMsCisJVkxET0RfMV84NTAgPSA0LAorCVZMRE9EXzJfMDAwID0gNSwKKwlWTERPRF8yXzA1MCA9IDYsCisgICAgVkxET0RfMl81MDAgPSA3LAorICAgIFZMRE9EXzJfNTUwID0gOCwKKyAgICBWTERPRF8yXzcwMCA9IDksCisgICAgVkxET0RfMl83NTAgPSAxMCwKKyAgICBWTERPRF8yXzgwMCA9IDExLAorICAgIFZMRE9EXzJfODUwID0gMTIsCisgICAgVkxET0RfMl85MDAgPSAxMywKKyAgICBWTERPRF8yXzk1MCA9IDE0LAorICAgIFZMRE9EXzNfMDAwID0gMTUsCisKKyAgICBWTERPRF9NQVgKKworfVRfWkRydlp4MjM0MjkwX1ZsZG9EOworCisvKiAgVk9SVEMgMmJpdAkqLwordHlwZWRlZiBlbnVtIF9UX1pEcnZaeDIzNDI5MF9WbGRvRQoreworICAgIFZMRE9FXzFfODAwID0gMCwKKyAgICBWTERPRV8yXzUwMCA9IDEsCisgICAgVkxET0VfM18wMDAgPSAyLAorICAgIFZMRE9FXzNfMzAwID0gMywJ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JU0NIQVJHRVJfRU5BQkxFCit7CisgICAgRElTQ0hBUkdFUl9ESVNCQUxFICA9IDAsICAgLyogMDAgKi8KKyAgICBESVNDSEFSR0VSX0VOQUJMRSAgICA9IDEsICAgLyogMTAgKi8KKworICAgIERJU0NIQVJHRVJfRU5BQkxFX01BWAorfVRfWkRydlp4MjM0MjkwX0RJU0NIQVJHRVJfRU5BQkxFOworCit0eXBlZGVmIGVudW0gX1RfWkRydlp4MjM0MjkwX0xkb0xpc3QKK3sKKyAgICBMRE9MSVNUX0JVQ0tfMSAgPSAwLAorICAgIExET0xJU1RfQlVDS18yLAorICAgIExET0xJU1RfQlVDS18zLAorICAgIExET0xJU1RfQlVDS180LAorICAgIExET0xJU1RfTERPXzEsCisgICAgTERPTElTVF9MRE9fMiwKKyAgICBMRE9MSVNUX0xET18zLAorCisgICAgTERPTElTVF9MRE9fNCwKKyAgICBMRE9MSVNUX0xET181LAorICAgIExET0xJU1RfTERPXzYsLy9kZWZhdWx0IG9mZgorICAgIExET0xJU1RfTERPXzcsCisgICAgTERPTElTVF9MRE9fOCwKKyAgICBMRE9MSVNUX0xET185LC8vZGVmYXVsdCBvZmYKKyAgICBMRE9MSVNUX0xET18xMCwKKyAgICBMRE9MSVNUX0xET19SVEMsCisKKyAgICBMRE9MSVNUX01BWAorfVRfWkRydlp4MjM0MjkwX0xkb0xpc3Q7CisKK3R5cGVkZWYgZW51bSBfVF9aRHJ2WngyMzQyOTdfU0lOSworeworICAgIFpYMjM0Mjk3X1NJTksxID0gMCwgICAvKiAwMCAqLworICAgIFpYMjM0Mjk3X1NJTksyID0gMSwgICAvKiAxMCAqLworCisgICAgWlgyMzQyOTdfU0lOS19NQVgKK31UX1pEcnZaeDIzNDI5N19TSU5LOworCit0eXBlZGVmIGVudW0gX1RfWkRydlp4MjM0Mjk3X1NJTktfU0xQTU9ERQoreworICAgIFNMUE1PREVfTk9STUFMID0gMCwgICAvKiAwMCAqLworICAgIFNMUE1PREVfU0hVVERPV04gPSA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CisKKy8qYWRjIGZ1biovCit1aW50IGdldF9iYXR0ZXJ5X3ZvbHRhZ2Uodm9pZCk7Cit1aW50IGdldF9hZGMxX3ZvbHRhZ2Uodm9pZCk7Cit1aW50IGdldF9hZGMyX3ZvbHRhZ2Uodm9pZCk7CisKKworI2VuZGlmIC8qICBfX0xJTlVYX01GRF9UUFM2NTkxMl9IICovCmRpZmYgLS1naXQgYS91cHN0cmVhbS9saW51eC01LjEwL2luY2x1ZGUvbGludXgvbW1jL21tY19mdW5jLmggYi91cHN0cmVhbS9saW51eC01LjEwL2luY2x1ZGUvbGludXgvbW1jL21tY19mdW5jLmgKbmV3IGZpbGUgbW9kZSAxMDA3NTUKaW5kZXggMDAwMDAwMC4uYjI2MzZhYgotLS0gL2Rldi9udWxsCisrKyBiL3Vwc3RyZWFtL2xpbnV4LTUuMTAvaW5jbHVkZS9saW51eC9tbWMvbW1jX2Z1bmMuaApAQCAtMCwwICsxLDM3IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiCw5sioy/nT0CAoQykyMDE0LCDJ7tvaytDW0NDLzajRts6itefX0worKgorKiDOxLz+w/uzxqO6IGVtbWNfcmFtZHVtcC5jCisqIM7EvP6x6sq2o7oKKyogxNrI3dWq0qqjugorKiDG5Mv8y7XD96O6CisqILWxx7Cw5rG+o7ogMS4wCisqINf3oaGhodXfo7ogCisqIM3qs8nI1cbao7oKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKworI2lmbmRlZiBMSU5VWF9NTUNfTU1DX0ZVTkNfSAorI2RlZmluZSBMSU5VWF9NTUNfTU1DX0ZVTkNfSAorCisjaW5jbHVkZSA8bGludXgvdHlwZXMuaD4KKworaW50IG1tY19yYW1kdW1wX2luaXQodm9pZCk7CisvKgorKiAgc3RhcnRfY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2NhcC5jCm5ldyBmaWxlIG1vZGUgMTAwNzU1CmluZGV4IDAwMDAwMDAuLmJjYjZhNTMKLS0tIC9kZXYvbnVsbAorKysgYi91cHN0cmVhbS9saW51eC01LjEwL2tlcm5lbC9yYW1kdW1wL3JhbWR1bXBfY2xpZW50X2NhcC5jCkBAIC0wLDAgKzEsNDU3IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiCw5sioy/nT0CAoQykyMDE2LCDW0NDLzajRtrnJt93T0M/euavLvqGjCisqIAorKiDOxLz+w/uzxjogICAgIHJhbWR1bXBfY2xpZW50X2NhcC5jCisqIM7EvP6x6sq2OiAgICAgcmFtZHVtcF9jbGllbnRfY2FwLmMKKyogxNrI3dWq0qo6ICAgICByYW1kdW1wIGNhcL/Nu6e2y9Lss6PLwLv6z9azocr9vt21vLP2yrXP1gorKiAKKyog0N64xMjVxtogICAgICAgILDmsb66xSAgICAgINDeuMSx6rzHICAgICAgICDQ3rjEyMsgICAgICAgICAg0N64xMTayN0KKyogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisqIDIwMTkvMTAvMTAgICAgICBWMS4wICAgICAgICBDcmVhdGUgICAgICAgICAgMDAxMzA1NzQgICAgICAgICC0tL2oCisqIAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIM23zsS8/iAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2luY2x1ZGUgInJhbWR1bXAuaCIKKyNpbmNsdWRlICJyYW1kdW1wX2FyY2guaCIKKyNpbmNsdWRlIDxsaW51eC9tb2R1bGUuaD4KKyNpbmNsdWRlIDxsaW51eC9zb2MvenRlL3JwbXNnLmg+CisjaW5jbHVkZSAicmFtX2NvbmZpZy5oIgorCisjaWZkZWYgX19jcGx1c3BsdXMKK2V4dGVybiAiQyIgeworI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgILOjwb+2qNLlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgILrqtqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgyv2+3cDg0M22qNLlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICC6r8r9yfnD9yAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworZXh0ZXJuIHZvaWQgcmFtZHVtcF9yZWdpc3Rlcl9jYWxsYmFja3Modm9pZCk7CitleHRlcm4gdW5zaWduZWQgY2hhciAqcmFtZHVtcF9waHlfdG9fdmlyKHVuc2lnbmVkIGxvbmcgcGh5LCB1bnNpZ25lZCBsb25nIHNpemUpOworZXh0ZXJuIHZvaWQgcmFtZHVtcF9zaGFyZWRfbWVtX2luaXQodm9pZCk7CitleHRlcm4gdm9pZCByYW1kdW1wX2RhdGFfdHJhbnNmZXJfdG9fZGV2aWNlKHZvaWQpOworZXh0ZXJuIHZvaWQgcmFtZHVtcF9vc3NfZGF0YV90cmFuc19pbml0KHZvaWQpOworZXh0ZXJuIHVuc2lnbmVkIGNoYXIgKnJhbWR1bXBfZXhwb3J0X2ZsYWdfYmFzZTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICC+1rK/vrLMrLHkwb+2qNLlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBSQU1EVU1QX09OX0RFRkFVTFRfVkFMICAoMSkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMirvtax5MG/tqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyoKKyAqIHJ1biB0aW1lIGNvbnRyb2wgZHVtcCBvciBub3QsIHVzZSAoIGVjaG8gIjAiID4gcmFtZHVtcF9vbiApIHRvIGNsb3NlIHJhbWR1bXAKKyAqLworaW50IHN5c2N0bF9yYW1kdW1wX29uX3BhbmljID0gUkFNRFVNUF9PTl9ERUZBVUxUX1ZBTDsKK2ludCByYW1kdW1wX2NhcF9pbml0X2ZsYWcgPSAtMTsKK2ludCByYW1kdW1wX2NvdW50ID0gMDsKK2ludCByYW1kdW1wX3NlcnZlcl9leHBfY29yZSA9IFJBTURVTVBfRkFMU0U7CisjaWZkZWYgQ09ORklHX1JBTURVTVBfVVNFUgordW5zaWduZWQgaW50IHN5c2N0bF9yYW1kdW1wX29uX3VzZXIgPSAxOworI2VuZGlmCit1bnNpZ25lZCBpbnQgcmFtZHVtcF9leHBvcnRfbW9kZSA9IDB4RkY7CisvKiBDbW0gZmlsZSBjb250ZW50ICovCit1bnNpZ25lZCBjaGFyICpyYW1kdW1wX2NhcF9jbW1fYnVmID0gTlVMTDsKKy8qIGVyciBsb2cgZmlsZSAqLwordW5zaWduZWQgY2hhciAqcmFtZHVtcF9jYXBfZXJyb3JfbG9nICA9IE5VTEw7Cit1bnNpZ25lZCBpbnQgKmNhcF9kZHJfbGVuX2Jhc2UgICAgICAgID0gTlVMTDsKK3Vuc2lnbmVkIGludCAgIHN5c2N0bF9yYW1kdW1wX2VtbWNfc2l6ZSA9IDB4MDsKK3Vuc2lnbmVkIGludCAgIHN5c2N0bF9yYW1kdW1wX2VtbWNfc3RhcnRfYWRkciA9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SAgID0gInJhbWR1bXBfYXAiLAorICAgICAgICAubW9kZSAgICAgICA9IDA1NTUsCisgICAgICAgIC5jaGlsZCAgICAgID0gY2ZnX3JhbWR1bXBfYXJyYXksCisgICAgfSwKKyAgICB7IH0KK307CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICC+1rK/uq/K/cq1z9YgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgcmFtZHVtcF9jYXBfaWNwX2hhbmRsZQorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIGJ1ZjogaWNwIG1zZyBhZGRyCisqICAgICAgICAgICAgICAgbGVuOiBpY3AgbXNnIGxlbgorKiAgICi0q7P2ss7K/SkgIHZvaWQKKyogt7Ugu9gg1rU6ICAgICB2b2lkCisqIMbky/zLtcP3OiAgICAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciByYW1kdW1wIGNsaWVudCBpY3AgbXNnIGhhbmRsZSwgY29tbW9uIGVudHJ5CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgcmFtZHVtcF9jYXBfaWNwX2hhbmRsZSh2b2lkICpidWYsIHVuc2lnbmVkIGludCBsZW4pCit7CisJcmFtZHVtcF9tc2dfdCAqaWNwX21zZyA9IChyYW1kdW1wX21zZ190ICopYnVmOworCisJcmFtZHVtcF9zZXJ2ZXJfZXhwX2NvcmUgPSBSQU1EVU1QX1NVQ0NFU1M7CisKKwlzd2l0Y2goaWNwX21zZy0+bXNnX2lkKQorCXsKKwkJY2FzZSBSQU1EVU1QX01TR19FWENFUFQ6CisJCXsKKwkJCXJhbWR1bXBfcGFuaWMoInRyYW5zIHNlcnZlciByZWNlaXZlZCBmb3JjZWQgZHVtcCByZXF1ZXN0IGZyb20gQXAgc2VydmVyIVxuIik7CisJCQlicmVhazsKKwkJfQorCisJCWRlZmF1bHQ6CisJCXsKKwkJCXJhbWR1bXBfcGFuaWMoInRyYW5zIHNlcnZlciByZWNlaXZlZCBmb3JjZWQgZHVtcCByZXF1ZXN0IGZyb20gQXAgc2VydmVyIVxuIik7CisJCQlicmVhazsKKwkJfQorCX0KK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgIHJhbWR1bXBfb3NzX2ljcF9jcmVhdGVfY2hhbm5lbAorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgYWN0b3JJRDogaWNwIHNlbmQgY29yZSBpZAorICAgICAgICAgICAgICAgY2hJRDogICAgaWNwIGNoYW5uZWwgaWQKKyAgICAgICAgICAgICAgIHNpemU6ICAgIGljcCBjaGFubmVsIHNpemUKKyogICAotKuz9rLOyv0pIHZvaWQgCisqILe1ILvYINa1OiAgICBpbnQ6IGlmIG1zZyBzZW5kIHN1Y2Nlc3MgCisqIMbky/zLtcP3OiAgICAKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgaW50IHJhbWR1bXBfY2FwX2ljcF9jcmVhdGVfY2hhbm5lbChUX1JwTXNnX0NvcmVJRCBkc3RDb3JlSUQsIFRfUnBNc2dfQ2hJRCBjaElELCB1bnNpZ25lZCBpbnQgc2l6ZSkKK3sKKwlyZXR1cm4gcnBtc2dDcmVhdGVDaGFubmVsKGRzdENvcmVJRCwgY2hJRCwgc2l6ZSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICByYW1kdW1wX29zc19pY3BfcmVnY2FsbGJhY2sKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pIGFjdG9ySUQ6IGljcCBzZW5kIGNvcmUgaWQKKyAgICAgICAgICAgICAgIGNoSUQ6ICAgIGljcCBjaGFubmVsIGlkCisgICAgICAgICAgICAgICBjYWxsYmFjazppY3AgY2FsbGJhY2sgZnVuCisqICAgKLSrs/ayzsr9KSB2b2lkIAorKiC3tSC72CDWtTogICAgaW50OiBpZiBtc2cgc2VuZCBzdWNjZXNzIAorKiDG5Mv8y7XD9zogICAgCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCByYW1kdW1wX2NhcF9pY3BfcmVnY2FsbGJhY2sgKFRfUnBNc2dfQ29yZUlEIGNvcmVJRCwgdW5zaWduZWQgaW50IGNoSUQsIFRfUnBNc2dfQ2FsbGJhY2sgY2FsbGJhY2spCit7CisJcmV0dXJuIHJwbXNnUmVnQ2FsbEJhY2soY29yZUlELCBjaElELCBjYWxsYmFjayk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICByYW1kdW1wX2luaXRfc3lzY3RsX3RhYmxlCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSB2b2lkCisqICAgKLSrs/ayzsr9KSB2b2lkIAorKiC3tSC72CDWtTogICAgdm9pZCAKKyogxuTL/Mu1w/c6ICAgINeisuFzeXNjdGzD/MHuo6zTw7unzKzKudPDc3lzY3Rsv9jWxnJhbWR1bXC05rSitdjWtworKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgcmFtZHVtcF9pbml0X3N5c2N0bF90YWJsZSh2b2lkKQoreworCXJlZ2lzdGVyX3N5c2N0bF90YWJsZShzeXNjdGxfcmFtZHVtcF90YWJsZSk7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgcmFtZHVtcF9jYXBfaWNwX2luaXQKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICB2b2lkCisqICAgKLSrs/ayzsr9KSAgdm9pZAorKiC3tSC72CDWtTogICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIHJhbWR1bXAgY2xpZW50IGljcCBpbml0CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCByYW1kdW1wX2NhcF9pY3BfaW5pdCh2b2lkKQoreworCWludCByZXQgPSAwOworCisJcmV0ID0gcmFtZHVtcF9jYXBfaWNwX2NyZWF0ZV9jaGFubmVsKAorCQkJUkFNRFVNUF9TRVJWRVJfQVAsIAorCQkJUkFNRFVNUF9DSEFOTkVMLCAKKwkJCVJBTURVTVBfQ0hBTk5FTF9TSVpFKTsKKworCWlmIChyZXQgIT0gUkFNRFVNUF9TVUNDRVNTKQorCXsKKwkJcmV0dXJuIHJldDsKKwl9CisJcmV0ID0gcmFtZHVtcF9jYXBfaWNwX3JlZ2NhbGxiYWNrKAorCQkJUkFNRFVNUF9TRVJWRVJfQVAsCisJCQlSQU1EVU1QX0NIQU5ORUwsIAorCQkJcmFtZHVtcF9jYXBfaWNwX2hhbmRsZSk7CisKKwlpZiAocmV0ICE9IFJBTURVTVBfU1VDQ0VTUykKKwl7CisJCXJldHVybiByZXQ7CisJfQorCXJldHVybiBSQU1EVU1QX1NVQ0NFU1M7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgcmFtZHVtcF9ub3RpZnlfc2VydmVyX3BhbmljCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgdm9pZAorKiAgICi0q7P2ss7K/SkgIHZvaWQKKyogt7Ugu9gg1rU6ICAgICB2b2lkCisqIMbky/zLtcP3OiAgICAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciBjYXAgbm90aWZ5IHJhbWR1bXAgc2VydmVyIHRvIHBhbmljCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCByYW1kdW1wX25vdGlmeV9zZXJ2ZXJfcGFuaWModm9pZCkKK3sKKwlpbnQgcmV0ID0gMDsKKwlUX1JwTXNnX01zZyBycE1zZyA9IHswfTsKKwlyYW1kdW1wX21zZ190IHJhbWR1bXBNc2cgPSB7MH07CisJCisJcmFtZHVtcE1zZy5tc2dfaWQgPSBSQU1EVU1QX01TR19FWENFUFQ7CisJcmFtZHVtcE1zZy5jcHVfaWQgPSBDT1JFX0FQOworCisJcnBNc2cuY29yZUlEID0gUkFNRFVNUF9TRVJWRVJfQVA7CisJcnBNc2cuY2hJRCA9IFJBTURVTVBfQ0hBTk5FTDsKKwlycE1zZy5mbGFnID0gUlBNU0dfV1JJVEVfSU5UIHwgUlBNU0dfV1JJVEVfSVJRTE9DSzsKKwlycE1zZy5sZW4gPSBzaXplb2YocmFtZHVtcF9tc2dfdCk7CisJcnBNc2cuYnVmID0gJnJhbWR1bXBNc2c7CisKKwlyZXQgPSBycG1zZ1dyaXRlKCZycE1zZyk7CisJcmV0dXJuIHJldDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgIHJhbWR1bXBfY2FwX3N0b3JlX3JhbV9jb25mCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSBtZW06IGFkZHIKKyogICAotKuz9rLOyv0pIHZvaWQgCisqILe1ILvYINa1OiAgICB1bnNpZ2VuZCBjaGFyKjogY2hhbmdlZCBhZGRyCisqIMbky/zLtcP3OiAgICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgdG8gc3RvcmUgcmFtIGNvbmYKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgdW5zaWduZWQgY2hhciAqcmFtZHVtcF9jYXBfc3RvcmVfcmFtX2NvbmYodW5zaWduZWQgY2hhciAqbWVtKQoreworCW1lbSArPSBzcHJpbnRmKAorCQkJbWVtLCAKKwkJCSJkYXRhLmxvYWQuYmluYXJ5ICZyYW1kdW1wX2RpclxcJXMgQToweCV4LS1BOjB4JXggL25vY2xlYXJcbiIsCisJCQkiY2FwX2Rkci5iaW4iLAorCQkJKHVuc2lnbmVkIGludClERFJfQkFTRV9DQVBfQUREUl9QQSwgCisJCQkodW5zaWduZWQgaW50KShERFJfQkFTRV9DQVBfQUREUl9QQSArICpjYXBfZGRyX2xlbl9iYXNlICAtIDEpKTsKKwltZW0gKz0gc3ByaW50ZigKKwkJCW1lbSwgCisJCQkiZGF0YS5sb2FkLmJpbmFyeSAmcmFtZHVtcF9kaXJcXCVzIEE6MHgleC0tQToweCV4IC9ub2NsZWFyXG4iLAorCQkJImNhcC5jbW0iLAorCQkJKHVuc2lnbmVkIGludClSQU1EVU1QX0NBUF9DTU1fQlVGX0FERFIsIAorCQkJKHVuc2lnbmVkIGludCkoUkFNRFVNUF9DQVBfQ01NX0JVRl9BRERSICsgUkFNRFVNUF9DQVBfQ01NX0JVRl9MRU5fUkVBTCAtIDEpKTsKKwltZW0gKz0gc3ByaW50ZigKKwkJCW1lbSwgCisJCQkiZGF0YS5sb2FkLmJpbmFyeSAmcmFtZHVtcF9kaXJcXCVzIEE6MHgleC0tQToweCV4IC9ub2NsZWFyXG4iLAorCQkJImNhcF9lcnJfbG9nLnR4dCIsCisJCQkodW5zaWduZWQgaW50KVJBTURVTVBfQ0FQX0xPR19CVUZfQUREUiwgCisJCQkodW5zaWduZWQgaW50KShSQU1EVU1QX0NBUF9MT0dfQlVGX0FERFIgKyBSQU1EVU1QX0NBUF9MT0dfQlVGX0xFTiAtIDEpKTsKKwlyZXR1cm4gbWVtOworfQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgIHJhbWR1bXBfY2FwX2NtbV9jcmVhdGUKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pIHZvaWQKKyogICAotKuz9rLOyv0pIHZvaWQKKyogt7Ugu9gg1rU6ICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBmb3Igc2VydmVyIHRvIGdlbmVyYXRlIGNtbSBzY3JpcHRzCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgcmFtZHVtcF9jYXBfY21tX2NyZWF0ZSh2b2lkKQoreworCXVuc2lnbmVkIGNoYXIgKnBjbW1fYnVmID0gcmFtZHVtcF9jYXBfY21tX2J1ZjsKKworCW1lbXNldChyYW1kdW1wX2NhcF9jbW1fYnVmLCAwLCBSQU1EVU1QX0NBUF9DTU1fQlVGX0xFTl9SRUFMKTsKKworCS8vIHN0b3JlIHRoZSBjbW0gQkVHSU4KKwlwY21tX2J1ZiArPSBzcHJpbnRmKHBjbW1fYnVmLCAiRU5UUlkgJnJhbWR1bXBfZGlyXG4iKTsKKworCS8vIHN0b3JlIHByb2Ntb2RlcyByZWdzCisJcGNtbV9idWYgPSByYW1kdW1wX2FyY2hfc3RvcmVfbW9kZXNfcmVncyhwY21tX2J1Zik7CisKKwkvLyBzdG9yZSByYW0gY29uZmlnIAorCXBjbW1fYnVmID0gcmFtZHVtcF9jYXBfc3RvcmVfcmFtX2NvbmYocGNtbV9idWYpOworCisJLy8gc3RvcmUgbWVtb3J5IG1hcCBjb250cm9sIHJlZ3MKKwlwY21tX2J1ZiA9IHJhbWR1bXBfYXJjaF9zdG9yZV9tbV9yZWdzKHBjbW1fYnVmKTsKKworCS8vIHN0b3JlIGVuZCBzeW1ib2wKKwlwY21tX2J1ZiArPSBzcHJpbnRmKHBjbW1fYnVmLCAiRU5ERE9cbiIpOworCit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICByYW1kdW1wX3RyYW5zX2NhcF9lcnJvcl9sb2dfY3JlYXRlCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSB2b2lkCisqICAgKLSrs/ayzsr9KSB2b2lkCisqILe1ILvYINa1OiAgICB2b2lkCisqIMbky/zLtcP3OiAgICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgdG8gY3JlYXRlIGVyciBsb2cgZmlsZQorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkIHJhbWR1bXBfY2FwX2Vycm9yX2xvZ19jcmVhdGUodm9pZCkKK3sKKwl1bnNpZ25lZCBjaGFyICpidWYgPSByYW1kdW1wX2NhcF9lcnJvcl9sb2c7CisKKwltZW1zZXQocmFtZHVtcF9jYXBfZXJyb3JfbG9nLCAwLCBSQU1EVU1QX0NBUF9MT0dfQlVGX0xFTik7CisJYnVmICs9CXNwcmludGYoYnVmLCAiZHVtcCBhdCBjb3JlJWQsIiwgc21wX3Byb2Nlc3Nvcl9pZCgpKTsKKwlpZiAoY3VycmVudC0+bW0gIT0gTlVMTCkKKwkJYnVmICs9IHNwcmludGYoYnVmLCAiaW4gdXNlcix0YXNrIGlzOiAlc1xuIiwgY3VycmVudC0+Y29tbSk7CisJZWxzZQorCQlidWYgKz0gc3ByaW50ZihidWYsICJpbiBrZXJuZWwsdGFzayBpczogJXNcbiIsIGN1cnJlbnQtPmNvbW0pOworCisJaWYgKHJhbWR1bXBfc2VydmVyX2V4cF9jb3JlKQorCQlidWYgKz0gc3ByaW50ZihidWYsICJyZWN2IGR1bXBpbmZvIGZyb20gYXBcbiIpOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgyKu+1rqvyv3Ktc/WICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIHJhbWR1bXBfcmFtX2NvbmZfdGFibGVfYWRkCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgcmFtX25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IsIFJBTURVTVBfQ0FQX0NNTV9CVUZfTEVOX1JFQUwpOworCS8qIGVyciBsb2cgZmlsZSAqLworCXJhbWR1bXBfY2FwX2Vycm9yX2xvZyA9IHJhbWR1bXBfcGh5X3RvX3ZpcigodW5zaWduZWQgbG9uZylSQU1EVU1QX0NBUF9MT0dfQlVGX0FERFIsIFJBTURVTVBfQ0FQX0xPR19CVUZfTEVOKTsKKwljYXBfZGRyX2xlbl9iYXNlID0gKHVuc2lnbmVkIGludCAqKXJhbWR1bXBfcGh5X3RvX3ZpcigodW5zaWduZWQgbG9uZylJUkFNX0JBU0VfQUREUl9CT09UX0REUiwgc2l6ZW9mKHVuc2lnbmVkIGxvbmcpKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICByYW1kdW1wX2luaXQKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICB2b2lkCisqICAgKLSrs/ayzsr9KSAgdm9pZAorKiC3tSC72CDWtTogICAgIFJBTURVTVBfU1VDQ0VTUyBvciBSQU1EVU1QX0ZBSUxFRAorKiDG5Mv8y7XD9zogICAgIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBmb3IgcmFtZHVtcCBpbml0CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworaW50IF9faW5pdCByYW1kdW1wX2luaXQodm9pZCkKK3sKKwlpbnQgcmV0ID0gMDsKKwlyYW1kdW1wX3ByaW50ZigiUmFtZHVtcCBjYXAgaW5pdCBzdGFydCEhISEhXG4iKTsKKworCWlmIChyYW1kdW1wX2NhcF9pbml0X2ZsYWcgPT0gUkFNRFVNUF9UUlVFKQorCQlyZXR1cm4gUkFNRFVNUF9TVUNDRVNTOworCXJhbWR1bXBfcHJpbnRmKCJSYW1kdW1wIGNhcCBpbml0IHJwbXNnIHN0YXJ0ISEhISFcbiIpOworCXJldCA9IHJhbWR1bXBfY2FwX2ljcF9pbml0KCk7CisJaWYgKHJldCAhPSBSQU1EVU1QX0lDUF9TVUNDRVNTKSAKKwkJcmV0dXJuIHJldDsKKworCXJhbWR1bXBfcmVnaXN0ZXJfY2FsbGJhY2tzKCk7CisKKwlyYW1kdW1wX2luaXRfY21tX2J1ZigpOworCisJcmFtZHVtcF9pbml0X3N5c2N0bF90YWJsZSgpOworCisJcmFtZHVtcF9zaGFyZWRfbWVtX2luaXQoKTsKKwlyYW1kdW1wX29zc19kYXRhX3RyYW5zX2luaXQoKTsKKworCXJhbWR1bXBfcHJpbnRmKCJSYW1kdW1wIGNhcCBpbml0IHN1Y2Nlc3MhXG4iKTsKKwlyYW1kdW1wX2NhcF9pbml0X2ZsYWcgPSBSQU1EVU1QX1RSVUU7CisKKwlyZXR1cm4gUkFNRFVNUF9TVUNDRVNTOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIHJhbWR1bXBfZW50cnkKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICB2b2lkCisqICAgKLSrs/ayzsr9KSAgdm9pZAorKiC3tSC72CDWtTogICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIHJhbWR1bXAgZW50cnkKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit2b2lkIHJhbWR1bXBfZW50cnkgKHZvaWQpCit7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKwlpZiAoc3lzY3RsX3JhbWR1bXBfb25fcGFuaWMgPT0gZmFsc2UpCisJCXJldHVybjsKKworCS8qCisJKiB3ZSBuZ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gaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywgV0lUSE9VVAorICogV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKgorICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgIEluY2x1ZGUgaGVhZGVyIGZpbGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNpbmNsdWRlICJyYW1kdW1wLmgiCisjaW5jbHVkZSAicmFtZHVtcF9lbW1jLmgiCisjaW5jbHVkZSAicmFtX2NvbmZpZy5oIgorI2luY2x1ZGUgInJhbWR1bXBfY29tcHJlc3MuaCIKKyNpbmNsdWRlIDxsaW51eC9sem8uaD4KKworI2lmZGVmIF9fY3BsdXNwbHVzCitleHRlcm4gIkMiIHsKKyNlbmRpZgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgRXh0ZXJuIGZ1bmN0aW9uIGRlY2xhcmF0aW9ucyAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICBFeHRlcm4gdmFyaWFibGUgZGVjbGFyYXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK2V4dGVybiB1bnNpZ25lZCBjaGFyICpyYW1kdW1wX3NoYXJlZF9tZW1fYmFzZTsKK2V4dGVybiB1bnNpZ25lZCBjaGFyICpyYW1kdW1wX2VtbWNfZmxhZ19iYXNlOworZXh0ZXJuIHVuc2lnbmVkIGludCByYW1kdW1wX2NvbXByZXNzX2ZsYWc7CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFjcm8gZGVmaW5pdGlvbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyNkZWZpbmUgUkFNRFVNUF9ERUxBWV9NU19DT1VOVCAoMjUwMCkKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUeXBlIGRlZmluaXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICogICAgICAgICAgICAgICAgICAgICAgICBMb2NhbCBmdW5jdGlvbiBkZWNsYXJhdGlvbnMgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICAgICAgICAgICAgICBMb2NhbCB2YXJpYWJsZSBkZWZpbml0aW9ucyAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqICAgICAgICAgICAgICAgICAgICAgICAgR2xvYmFsIHZhcmlhYmxlIGRlZmluaXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwordW5zaWduZWQgaW50IHJhbWR1bXBfZW1tY19zaXplID0gMDsKK3ZvbGF0aWxlIHVuc2lnbmVkIGludCByYW1kdW1wX2VtbWNfb2Zmc2V0ID0gMDsKK2V4dGVybiB1bnNpZ25lZCBpbnQgcmFtZHVtcF9kZXZpY2VfZmlsZV9jbnQ7CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiAgICAgICAgICAgICAgICAgICAgICBJbmxpbmUgZnVuY3Rpb24gaW1wbGVtZW50YXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbmxpbmUgdm9pZCByYW1kdW1wX3dhaXRfZGVsYXkoIHVuc2lnbmVkIGxvbmcgbXMpCit7CisJdm9sYXRpbGUgaW50IGogPSAwOworCWZvciAoaiA9IDA7IGogPCAxMDAwMDsgaisrKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqICAgICAgICAgICAgICAgICAgICAgIExvY2FsIGZ1bmN0aW9uIGltcGxlbWVudGF0aW9ucyAgICAgICAgICAgICAgICAgICAgICAgICAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworaW50IHJhbWR1bXBfZW1tY19pbml0KHJhbWR1bXBfZmlsZV90ICpmcCkKK3sKKwlmcC0+bWFnaWMgPSAweDJBMkEyQTJBOworCXJhbWR1bXBfZW1tY19vZmZzZXQgPSByb3VuZHVwKHNpemVvZihyYW1kdW1wX2ZpbGVfdCksIFJBTURVTVBfRU1NQ19BTElHTl9TSVpFKTsKKwkKKwlpZihSQU1EVU1QX1RSQU5TX0VNTUNfTEVOID4gcmFtZHVtcF9lbW1jX29mZnNldCkKKwl7CisJCXJhbWR1bXBfZW1tY19zaXplID0gUkFNRFVNUF9UUkFOU19FTU1DX0xFTiAtIHJhbWR1bXBfZW1tY19vZmZzZXQ7CisJfQorCWVsc2UKKwl7CisJCXByaW50aygiW3JhbWR1bXBdIGVtbWMgc3RhcnQgYWRkciBpcyAlbGQsIGVtbWMgc2l6ZT0gJWxkLCBlcnJvcjogc2l6ZSBzbWFsbGVyIHRoYW4g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beoOiAjaW5jbHVkZSAicmFtZHVtcF9lbW1jLmgiCisqIAorKiDQ3rjEyNXG2iAgICAgICAgsOaxvrrFICAgICAg0N64xLHqvMcgICAgICAgINDeuMTIyyAgICAgICAgICDQ3rjExNrI3QorKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyogMjAxNi8zLzEwICAgICAgVjEuMCAgICAgICAgQ3JlYXRlICAgICAgICAgICDV1L78v/wgICAgICAgICAgtLS9qAorKiAKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpZm5kZWYgX1JBTURVTVBfRU1NQ19ICisjZGVmaW5lIF9SQU1EVU1QX0VNTUNfSAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgzbfOxLz+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaW5jbHVkZSAicmFtZHVtcC5oIgorI2luY2x1ZGUgPGxpbnV4L21tYy9tbWNfZnVuYy5oPgorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgzeKyv7Hkwb/J+cP3ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitleHRlcm4gdW5zaWduZWQgaW50IHN5c2N0bF9yYW1kdW1wX2VtbWNfc3RhcnRfYWRkcjsKK2V4dGVybiB1bnNpZ25lZCBpbnQgc3lzY3RsX3JhbWR1bXBfZW1tY19zaXplOworZXh0ZXJuIHZvbGF0aWxlIHVuc2lnbmVkIGludCByYW1kdW1wX2VtbWNfb2Zmc2V0OworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAguuq2qNLlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjZGVmaW5lIFJBTURVTVBfRU1NQ19BRERSICAgICAgICAgKHN5c2N0bF9yYW1kdW1wX2VtbWNfc3RhcnRfYWRkciAqIDUxMikgCisjZGVmaW5lIFJBTURVTVBfVFJBTlNfRU1NQ19MRU4gICAgKHN5c2N0bF9yYW1kdW1wX2VtbWNfc2l6ZSAqIDUxMikKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMr9vt3A4NDNtqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgyKu+1rHkwb/J+cP3ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDIq77Wuq/K/cn5w/cgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKgorICogQGJyaWVmIHJhbWR1bXBfZW1tY19pbml0IC4KKyAqCisgKiBAcGFyYW0gdm9pZC4KKyAqCisgKiBAcmV0dXJuIGludC4KKyAqIEByZXR2YWwgc3RhbmRhcmQgZXJyb3IKKyAqIEBub3RlICAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciByYW1kdW1wIGluaXQKKyAqLworaW50IHJhbWR1bXBfZW1tY19pbml0KHJhbWR1bXBfZmlsZV90ICpmcCk7CitpbnQgcmFtZHVtcF9lbW1jX3dyaXRlX2ZpbGUoY2hhciAqZmlsZV9uYW1lLCB1bnNpZ25lZCBpbnQgZmlsZV9zaXplLCByYW1kdW1wX2ZpbGVfdCAqZnApOworaW50IHJhbWR1bXBfZW1tY193cml0ZV9maWxlX2hlYWQocmFtZHVtcF9maWxlX3QgKmZwKTsKK2ludCByYW1kdW1wX2VtbWNfbW9kaWZ5X2ZpbGVfc2l6ZShyYW1kdW1wX2ZpbGVfdCAqZnAsIHVuc2lnbmVkIGludCBmaWxlX3NpemUpOworaW50IHJhbWR1bXBfZW1tY193cml0ZV9kYXRhKHJhbWR1bXBfc2htZW1fdCAqbXNnLCByYW1kdW1wX2ZpbGVfdCAqZnAsIHVuc2lnbmVkIGludCBzaXplKTsKK2ludCByYW1kdW1wX2VtbWNfd3JpdGVfbG9nYnVmKHJhbWR1bXBfZmlsZV90ICpmcCk7Cit2b2lkIHJhbWR1bXBfZW1tY19jbG9zZShyYW1kdW1wX2ZpbGVfdCAqZnApOworaW50IHJhbWR1bXBfZW1tY193cml0ZV9sb2dfdHh0KHJhbWR1bXBfZmlsZV90ICpmcCk7CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDE2sGquq/K/cq1z9YgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2VuZGlmICAvLyNpZm5kZWYgX1JBTURVTVBfRU1NQ19ICisKZGlmZiAtLWdpdCBhL3Vwc3RyZWFtL2xpbnV4LTUuMTAva2VybmVsL3RyYWNrZXIuYyBiL3Vwc3RyZWFtL2xpbnV4LTUuMTAva2VybmVsL3RyYWNrZXIuYwpuZXcgZmlsZSBtb2RlIDEwMDc1NQppbmRleCAwMDAwMDAwLi42ZjdlMWFiCi0tLSAvZGV2L251bGwKKysrIGIvdXBzdHJlYW0vbGludXgtNS4xMC9rZXJuZWwvdHJhY2tlci5jCkBAIC0wLDAgKzEsNDU5IEBACisvKgorICogdHJhY2tlci5jIC0gU3lzdGVtIGFjY291bnRpbmcgb3ZlciB0YXNrc3RhdHMgaW50ZXJmYWNlCisgKgorICogQ29weXJpZ2h0IChDKSBKYXkgTGFuLAk8amxhbkBzZ2kuY29tPgorICoKKyAqCisgKiBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQorICogaXQgdW5kZXIgdGhlIHRl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oqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgILrqtqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2RlZmluZSBfT1NfTElOVVggICAgICAgICAgICAgICAgICAgIDEKKworI2lmIGRlZmluZWQoX09TX1RPUykKKyMgZGVmaW5lIE9TX1NUQVRJU1RJQ19JUkFNX0JBU0UgICAgKElSQU1fQkFTRV9BRERSX09TX1NUQVRJU1RJQ19QU0NQVSkKKyMgZGVmaW5lIE9TX1NUQVRJU1RJQ19USU1FICAgICAgICAgekRydlRpbWVyX1N0YW1wKCkKKyNlbGlmIGRlZmluZWQoX09TX0xJTlVYKQorIyBkZWZpbmUgT1NfU1RBVElTVElDX0lSQU1fQkFTRSAgICBnX3p4aWNfdHJhY2VfYXBjcHVfYWRkciAvLyhJUkFNX0JBU0VfQUREUl9PU19TVEFUSVNUSUNfQVBDUFUpCisjIGRlZmluZSBPU19TVEFUSVNUSUNfVElNRSAgICAgICAgIChjcHVfY2xvY2soMCk+PjEwKQorI2Vsc2UKKyMgZXJyb3IgInVua25vd24gb3MiCisjZW5kaWYKKworCisKKyNkZWZpbmUgT1NfSVJBTV9TVEFUSVNUSUNfQ05UICAgICAgICAgKDUpCisjZGVmaW5lIE9TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOICAgICgxNikKKyNkZWZpbmUgT1NfRERSX1NUQVRJU1RJQ19DTlQgICAgICAgICAgKDEwMDApCisKKyNkZWZpbmUgT1NfSVJBTV9USFJFQURfU1dBUElOICAgICAgKE9TX1NUQVRJU1RJQ19JUkFNX0JBU0UpCisjZGVmaW5lIE9TX0lSQU1fSVJRX1NUQVJUICAgICA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3RhdGlzdGljX2VuYWJsZWQoKSAgICAgZ19vc19zdGF0aXN0aWNfZW5hYmxlIAorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgyv2+3b3hubm2qNLlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit0eXBlZGVmIHZvbGF0aWxlIHN0cnVjdCB7CisgICAgdW5zaWduZWQgaW50IGNudDsKKyAgICB1bnNpZ25lZCBpbnQgaW5kZXg7CisgICAgc3RydWN0IHsKKyAgICAgICAgdW5zaWduZWQgY2hhciBuYW1lW09TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOXTsKKyAgICAgICAgdW5zaWduZWQgaW50IGRhdGEyOworICAgIH0gc3RhdGlzdGljc1tPU19JUkFNX1NUQVRJU1RJQ19DTlRdOworfXRfb3NfaXJhbV90aHJlYWRfc3RhdGlzdGljOworCit0eXBlZGVmIHZvbGF0aWxlIHN0cnVjdCB7CisgICAgdW5zaWduZWQgaW50IGNudDsKKyAgICB1bnNpZ25lZCBpbnQgaW5kZXg7CisgICAgc3RydWN0IHsKKyAgICAgICAgdW5zaWduZWQgaW50IGRhdGExOworICAgICAgICB1bnNpZ25lZCBpbnQgZGF0YTI7CisgICAgfSBzdGF0aXN0aWNzW09TX0lSQU1fU1RBVElTVElDX0NOVF07Cit9dF9vc19pcmFtX3N0YXRpc3RpYzsKKwordHlwZWRlZiBzdHJ1Y3QgeworICAgIHVuc2lnbmVkIGludCBjbnQ7CisgICAgdW5zaWduZWQgaW50IGluZGV4OworICAgIHN0cnVjdCB7CisgICAgICAgIHVuc2lnbmVkIGludCBkYXRhMTsKKyAgICAgICAgdW5zaWduZWQgaW50IGRhdGEyOworICAgIH0gc3RhdGlzdGljc1tPU19ERFJfU1RBVElTVElDX0NOVF07Cit9dF9vc19kZHJfc3RhdGlzdGljOworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgyKu+1rHkwb8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaWYgZGVmaW5lZChfT1NfTElOVVgpCit2b2xhdGlsZSAgc3RhdGljIGNoYXIgKmdfenhpY190cmFjZV9hcGNwdV9hZGRyOworI2VuZGlmCisKK3ZvbGF0aWxlICBzdGF0aWMgaW50IGdfb3Nfc3RhdGlzdGljX2VuYWJsZTsKK3ZvbGF0aWxlICBzdGF0aWMgdW5zaWduZWQgaW50IGdfb3Nfc3RhdGlzdGljX2NudDsKKwordm9sYXRpbGUgIHN0YXRpYyB0X29zX2lyYW1fdGhyZWFkX3N0YXRpc3RpYyAqZ19vc19pcmFtX3N3YXBpbl9zdGF0aXN0aWM7Cit2b2xhdGlsZSAgc3RhdGljIHRfb3NfaXJhbV9zdGF0aXN0aWMgICAgICAgICpnX29zX2lyYW1faXJxX3N0YXJ0X3N0YXRpc3RpYzsKK3ZvbGF0aWxlICBzdGF0aWMgdF9vc19pcmFtX3N0YXRpc3RpYyAgICAgICAgKmdfb3NfaXJhbV9pcnFfZW5kX3N0YXRpc3RpYzsKKworI2lmIGRlZmluZWQoX09TX1RPUykKK3N0YXRpYyB0X29zX2lyYW1fc3RhdGlzdGljICpnX29zX2lyYW1fZHNyX3N0YXJ0X3N0YXRpc3RpYzsKK3N0YXRpYyB0X29zX2lyYW1fc3RhdGlzdGljICpnX29zX2lyYW1fZHNyX2VuZF9zdGF0aXN0aWM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V9lbmRfc3RhdGlzdGljOwordm9sYXRpbGUgIHN0YXRpYyB0X29zX2Rkcl9zdGF0aXN0aWMgKmdfb3NfZGRyX3RpbWVyX3N0YXJ0X3N0YXRpc3RpYzsKK3ZvbGF0aWxlICBzdGF0aWMgdF9vc19kZHJfc3RhdGlzdGljICpnX29zX2Rkcl90aW1lcl9lbmRfc3RhdGlzdGljOworI2VuZGlmCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDIq77Wuq/K/cn5w/cgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgb3Nfc3RhdGlzdGljX2VuYWJsZSh2b2lkKTsKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICC+1rK/uq/K/SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAguey8o82zvMa1vUlSQU0KKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBpcmFtX2FkZHI6ILXY1rcgCisgICAgICAgICAgICAgICAgZGF0YTogICAgICDKwrz+z+4KKyAgICAgICAgICAgICAgICB0aW1lOiAgICAgIMqxvOQKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgdm9pZAorKiDG5Mv8y7XD9zogICAgIM7eCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGlubGluZSB2b2lkIG9zX3N0YXRpc3RpY19pbl9pcmFtKHZvbGF0aWxlIHZvaWQgKmlyYW1fYWRkciwgdm9pZCAqZGF0YSwgdW5zaWduZWQgbG9uZyB0aW1lKQoreworICAgIHVuc2lnbmVkIGxvbmcgICAgICAgaW5kZXg7CisgICAgdF9vc19pcmFtX3N0YXRpc3RpYyAqaXJhbTsKKworICAgIGlyYW0gPSAodF9vc19pcmFtX3N0YXRpc3RpYyAqKWlyYW1fYWRkcjsKKyAgICAKKyAgICBpbmRleCA9IGlyYW0tPmluZGV4OworICAgIGlmKGluZGV4ID49IE9TX0lSQU1fU1RBVElTVElDX0NOVCkKKyAgICB7CisgICAgICAgIGluZGV4ID0gMDsKKyAgICB9CisKKyAgICBpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5kYXRhMSA9ICh1bnNpZ25lZCBpbnQpZGF0YTsKKyAgICBpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5kYXRhMiA9IHRpbWU7CisgICAgaW5kZXgrKzsKKworICAgIGlyYW0tPmluZGV4ID0gaW5kZXg7CisgICAgaXJhbS0+Y250ID0gZ19vc19zdGF0aXN0aWNfY250OworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIM/fs8y57LyjzbO8xrW9SVJBTQorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIGlyYW1fYWRkcjogtdjWtyAKKyAgICAgICAgICAgICAgICBkYXRhOiAgICAgIMrCvP7P7gorICAgICAgICAgICAgICAgIHRpbWU6ICAgICAgyrG85AorKiAgICi0q7P2ss7K/SkgIHZvaWQKKyogt7Ugu9gg1rU6ICAgICB2b2lkCisqIMbky/zLtcP3OiAgICAgzt4KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgaW5saW5lIHZvaWQgb3Nfc3RhdGlzdGljX3RocmVhZF9pbl9pcmFtKHZvbGF0aWxlIHZvaWQgKmlyYW1fYWRkciwgdm9pZCAqZGF0YSwgdW5zaWduZWQgbG9uZyB0aW1lKQoreworICAgIHVuc2lnbmVkIGxvbmcgICAgICAgICAgICAgIGluZGV4OworICAgIHRfb3NfaXJhbV90aHJlYWRfc3RhdGlzdGljICppcmFtOworCisgICAgaXJhbSA9ICh0X29zX2lyYW1fdGhyZWFkX3N0YXRpc3RpYyAqKWlyYW1fYWRkcjsKKyAgICAKKyAgICBpbmRleCA9IGlyYW0tPmluZGV4OworICAgIGlmKGluZGV4ID49IE9TX0lSQU1fU1RBVElTVElDX0NOVCkKKyAgICB7CisgICAgICAgIGluZGV4ID0gMDsKKyAgICB9CisKKyNpZiBkZWZpbmVkKF9PU19UT1MpCisgICAgc3RybmNweSgoY2hhciAqKShpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5uYW1lKSwgY3lnX3RocmVhZF9nZXRfbmFtZSgoY3lnX2hhbmRsZV90KWRhdGEpLCBPU19JUkFNX1NUQVRJU1RJQ19OQU1FX0xFTiAtIDEpOworI2VsaWYgZGVmaW5lZChfT1NfTElOVVgpCisgICAgc3RybmNweSgoY2hhciAqKShpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5uYW1lKSwgKChzdHJ1Y3QgdGFza19zdHJ1Y3QgKilkYXRhKS0+Y29tbSwgT1NfSVJBTV9TVEFUSVNUSUNfTkFNRV9MRU4gLSAxKTsKKyNlbHNlCisjIGVycm9yICJ1bmtvd24gb3MiCisjZW5kaWYKKyAgICBpcmFtLT5zdGF0aXN0aWNzW2luZGV4XS5uYW1lW09TX0lSQU1fU1RBVElTVElDX05BTUVfTEVOIC0gMV0gPSAwOworICAgIGlyYW0tPnN0YXRpc3RpY3NbaW5kZXhdLmRhdGEyID0gdGltZTsKKyAgICBpbmRleCsrOworCisgICAgaXJhbS0+aW5kZXggPSBpbmRleDsKKyAgICBpcmFtLT5jbnQgPSBnX29zX3N0YXRpc3RpY19jbnQ7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAguey8o82zvMa1vUREUgorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIGlyYW1fYWRkcjogtdjWtyAKKyAgICAgICAgICAgICAgICBkYXRhOiAgICAgIMrCvP7P7gorICAgICAgICAgICAgICAgIHRpbWU6ICAgICAgyrG85AorKiAgICi0q7P2ss7K/SkgIHZvaWQKKyogt7Ugu9gg1rU6ICAgICB2b2lkCisqIMbky/zLtcP3OiAgICAgzt4KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgaW5saW5lIHZvaWQgb3Nfc3RhdGlzdGljX2luX2Rkcih2b2lkICpkZHJfYWRkciwgdm9pZCAqZGF0YSwgdW5zaWduZWQgbG9uZyB0aW1lKQoreworICAgIHVuc2lnbmVkIGxvbmcgICAgICAgICAgICAgIGluZGV4OworICAgIHRfb3NfZGRyX3N0YXRpc3RpYyAgICAgICAgICpkZHI7CisKKyAgICBkZHIgID0gKHRfb3NfZGRyX3N0YXRpc3RpYyAqKWRkcl9hZGRyOworICAgIAorICAgIGluZGV4ID0gZGRyLT5pbmRleDsKKyAgICBpZiAoaW5kZXggPj0gT1NfRERSX1NUQVRJU1RJQ19DTlQpCisgICAgeworICAgICAgICBpbmRleCA9IDA7CisgICAgfQorICAgIGRkci0+c3RhdGlzdGljc1tpbmRleF0uZGF0YTEgPSAodW5zaWduZWQgaW50KWRhdGE7CisgICAgZGRyLT5zdGF0aXN0aWNzW2luZGV4XS5kYXRhMiA9IHRpbWU7CisgICAgaW5kZXgrKzsKKworICAgIGRkci0+aW5kZXggPSBpbmRleDsKKyAgICBkZHItPmNudCAgID0gZ19vc19zdGF0aXN0aWNfY250OworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgILnsvKPNs7zGtb1ERFIKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBpcmFtX2FkZHI6ILXY1rcgCisgICAgICAgICAgICAgICAgZGF0YTogICAgICDKwrz+z+4KKyAgICAgICAgICAgICAgICB0aW1lOiAgICAgIMqxvOQKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgdm9pZAorKiDG5Mv8y7XD9zogICAgIM7eCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGlubGluZSB2b2lkIG9zX3N0YXRpc3RpY19pbmZvX3VwZGF0ZSh2b2lkKQoreworICAgIGdfb3Nfc3RhdGlzdGljX2NudCsrOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgILaoyrHG97vYtfe5s9fTCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgCisqICAgKLSrs/ayzsr9KSAgdm9pZAorKiC3tSC72CDWtTogICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgICDO3gorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgb3Nfc3RhdGlzdGljX2RlbGF5ZWRfd29ya190aW1lcl9mbih1bnNpZ25lZCBsb25nIGRhdGEpCit7CisgICAgaW50IHNlYyA9IDA7CisgICAgbXNsZWVwKDIwMDAwKTsKKyAgICB3aGlsZSghb3Nfc3RhdGlzdGljX2NoZWNrKCkpCisgICAgeworICAgICAgICAvL7Osuf00MHOjrNaxvdPNy7P2CisgICAgICAgIGlmKHNlYyA+PSA0KQorICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIG1zbGVlcCgxMDAwMCk7CisgICAgICAgIHNlYysrOworICAgIH0KKyAgICBvc19zdGF0aXN0aWNfZW5hYmxlKCk7CisgICAgcmV0dXJuIDA7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgyKu+1rqvyv3Ktc/WICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgyrnE3LnsvKPNs7zGuabE3AorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIGFkZHJlc3M6ILzHwry1vUlSQU3W0LXEtdjWtyAKKyAgICAgICAgICAgICAgICBzaXplOiAgICBJUkFNv9W85LTz0KEKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgdm9pZAorKiDG5Mv8y7XD9zogICAgIM7eCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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l90aW1lcl9lbmRfc3RhdGlzdGljLCBmdW5jLCB0aW1lKTsKKyAgICBvc19zdGF0aXN0aWNfaW5mb191cGRhdGUoKTsKK30KKworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgILnsvKPNs7zGtb1ERFIKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBpcmFtX2FkZHI6ILXY1rcgCisgICAgICAgICAgICAgICAgZGF0YTogICAgICDKwrz+z+4KKyAgICAgICAgICAgICAgICB0aW1lOiAgICAgIMqxvOQKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgdm9pZAorKiDG5Mv8y7XD9zogICAgIM7eCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworaW50IF9faW5pdCB6eGljX2VuYWJsZV90cmFjZXIodm9pZCkKK3sKKyAgICBzdHJ1Y3QgdGltZXJfbGlzdCB0aW1lcjsKKyAgICBzdHJ1Y3QgdGFza19zdHJ1Y3QgKnRhc2s7CisKKyNpZmRlZiBJUkFNX0JBU0VfQUREUl9WQQorICAgIGdfenhpY190cmFjZV9hcGNwdV9hZGRyID0gSVJBTV9CQVNFX0FERFJfT1NfU1RBVElTVElDX1BTQ1BVOworI2Vsc2UKKyAgICBnX3p4aWNfdHJhY2VfYXBjcHVfYWRkciA9IGlvcmVtYXAoSVJBTV9CQVNFX0FERFJfT1NfU1RBVElTVElDX1BTQ1BVLCBJUkFNX0JBU0VfTEVOX09TX1NUQVRJU1RJQ19QU0NQVSk7CisjZW5kaWYKKworICAgIC8qCisgICAgaW5pdF90aW1lcigmdGltZXIpOworICAgIHRpbWVyLmV4cGlyZXMgPSBqaWZmaWVzICsgNDAqSFo7Ly9tc2Vjc190b19qaWZmaWVzKDQwKjEwMD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25kX3NvY19kYXBtX25jX3BpbihkYXBtLCAiSFBPVVQyUCIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIkhQT1VUMk4iKTsKKwlzbmRfc29jX2RhcG1fbmNfcGluKGRhcG0sICJTUEtPVVRMTiIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIlNQS09VVExQIik7CisJc25kX3NvY19kYXBtX25jX3BpbihkYXBtLCAiU1BLT1VUUlAiKTsKKwlzbmRfc29jX2RhcG1fbmNfcGluKGRhcG0sICJTUEtPVVRSTiIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIkxJTkVPVVQxTiIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIkxJTkVPVVQxUCIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIkxJTkVPVVQyTiIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIkxJTkVPVVQyUCIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIklOMUxQIik7CisJc25kX3NvY19kYXBtX25jX3BpbihkYXBtLCAiSU4yTFA6VlhSTiIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIklOMVJQIik7CisJc25kX3NvY19kYXBtX25jX3BpbihkYXBtLCAiSU4yUlA6VlhSUCIpOworCisJcmV0dXJuIDA7Cit9CisjZW5kaWYKKworCisKKworZW51bSB7CisJQVVESU9fRExfTUVESUEgPSAwLAorCUFVRElPX0RMX1ZPSUNFLAorCUFVRElPX0RMXzJHX0FORF8zR19WT0lDRSwKKwlBVURJT19ETF9WUF9MT09QLAkKKwlBVURJT19ETF8zR19WT0lDRSwKKwkKKwlBVURJT19ETF9NQVgsCit9OworU05EX1NPQ19EQUlMSU5LX0RFRihkdW1teSwgXAorCURBSUxJTktfQ09NUF9BUlJBWShDT01QX0RVTU1ZKCkpKTsKKworLy9TTkRfU09DX0RBSUxJTktfREVGKGNwdV9pMnMwLCB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ZGFwbSwgIkxJTkVPVVQyUCIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIklOMUxQIik7CisJc25kX3NvY19kYXBtX25jX3BpbihkYXBtLCAiSU4yTFA6VlhSTiIpOworCXNuZF9zb2NfZGFwbV9uY19waW4oZGFwbSwgIklOMVJQIik7CisJc25kX3NvY19kYXBtX25jX3BpbihkYXBtLCAiSU4yUlA6VlhSUCIpOworCisJcmV0dXJuIDA7Cit9CisjZW5kaWYKKworCisKKworZW51bSB7CisJQVVESU9fRExfTUVESUEgPSAwLAorCUFVRElPX0RMX1ZPSUNFLAorCUFVRElPX0RMXzJHX0FORF8zR19WT0lDRSwKKwlBVURJT19ETF9WUF9MT09QLAkKKwlBVURJT19ETF8zR19WT0lDRSwKKwkKKwlBVURJT19ETF9NQVgsCit9OworU05EX1NPQ19EQUlMSU5LX0RFRihkdW1teSwgXAorCURBSUxJTktfQ09NUF9BUlJBWShDT01QX0RVTU1ZKCkpKTsKKworLy9TTkRfU09DX0RBSUxJTktfREVGKGNwdV9pMnMwLCBcCisvLwlEQUlMSU5LX0NPTVBfQVJSQVkoQ09NUF9DUFUoIm1lZGlhLWNwdS1kYWkiKSkpOworU05EX1NPQ19EQUlMSU5LX0RFRihjcHVfaTJzMCwgXAorCURBSUxJTktfQ09NUF9BUlJBWShDT01QX0NQVSgiMTQwNTAwMC5pMnMiKSkpOworCisKK1NORF9TT0NfREFJTElOS19ERUYodm9pY2VfY3B1LCBcCisJREFJTElOS19DT01QX0FSUkFZKENPTVBfQ1BVKCJzb2M6dm9pY2VfYXVkaW8iKSkpOworCitTTkRfU09DX0RBSUxJTktfREVGKHZvaWNlXzJnXzNnLCBcCisJREFJTElOS19DT01QX0FSUkFZKENPTVBfQ1BVKCJ2b2ljZV8yZ18zZy1kYWkiKSkpOworCitTTkRfU09DX0RBSUxJTktfREVGKHZvaWNlXzNnLCBcCisJCURBSUxJTktfQ09NUF9BUlJBWShDT01QX0NQVSgidm9pY2VfM2ctZ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